From 8def761c3293561a9a656346b6c181c94e5cefa0 Mon Sep 17 00:00:00 2001 From: Nico Schottelius Date: Mon, 3 Jun 2019 21:39:03 +0200 Subject: [PATCH] Abort on error detection --- netpfga/do-all-steps.sh | 10 +++++++++- netpfga/minip4/testdata/gen_testdata.py | 15 +++++++++++++-- 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/netpfga/do-all-steps.sh b/netpfga/do-all-steps.sh index 8012951..6fdf576 100755 --- a/netpfga/do-all-steps.sh +++ b/netpfga/do-all-steps.sh @@ -12,7 +12,15 @@ read something cd $P4_PROJECT_DIR && make # Step 5 -cd $P4_PROJECT_DIR/nf_sume_sdnet_ip/SimpleSumeSwitch && ./vivado_sim.bash +cd $P4_PROJECT_DIR/nf_sume_sdnet_ip/SimpleSumeSwitch && ./vivado_sim.bash >& LOG 2>&1 + +expected_line=$(grep ^expected LOG | sed 's/.*(//') +actual_line=$(grep ^actual LOG | sed 's/.*(//') + +if [ "$expected_line" != "$actual_line" ]; then + echo packet mismatch + exit 1 +fi # Step 6 cd $P4_PROJECT_DIR && make config_writes diff --git a/netpfga/minip4/testdata/gen_testdata.py b/netpfga/minip4/testdata/gen_testdata.py index ae10d1a..9a67dae 100755 --- a/netpfga/minip4/testdata/gen_testdata.py +++ b/netpfga/minip4/testdata/gen_testdata.py @@ -100,9 +100,18 @@ lookup_table = { 3: 0x00001000 } +def test_port1(): + pktCnt = 0 + + # First ethernet + pktCnt += 1 + pkt = Ether(dst=MAC2, src=MAC1) + pkt = pad_pkt(pkt, 64) + applyPkt(pkt, 'nf0', pktCnt) + expPkt(pkt, 'nf0') + # Test that packets are being mirrored def test_mirror(): - pktCnt = 0 # First ethernet @@ -136,5 +145,7 @@ def test_mirror(): # pkt = pad_pkt(pkt, 64) # expPkt(pkt, 'nf0') -test_mirror() +#test_mirror() +test_port1() + write_pcap_files()