summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorchangru <changrux.fan>2015-07-16 15:58:55 +0800
committerMarvin Liu <yong.liu@intel.com>2015-07-20 11:54:52 +0800
commit14febdc86d1b3b6ce66c6aa88bdc3e8b0f3ef80c (patch)
treef5fced35b9e7f147a66a4de86612b534cb52078b
parent0d5aea42fa08324094457f76e123ac50660bd737 (diff)
downloaddts-14febdc86d1b3b6ce66c6aa88bdc3e8b0f3ef80c.zip
dts-14febdc86d1b3b6ce66c6aa88bdc3e8b0f3ef80c.tar.gz
dts-14febdc86d1b3b6ce66c6aa88bdc3e8b0f3ef80c.tar.xz
fix that tx_vlan command changed sequence
Signed-off-by: changru <changrux.fan>
-rw-r--r--tests/TestSuite_dual_vlan.py4
-rw-r--r--tests/TestSuite_vlan.py28
2 files changed, 14 insertions, 18 deletions
diff --git a/tests/TestSuite_dual_vlan.py b/tests/TestSuite_dual_vlan.py
index 184eb64..47733b4 100644
--- a/tests/TestSuite_dual_vlan.py
+++ b/tests/TestSuite_dual_vlan.py
@@ -208,7 +208,7 @@ class TestDualVlan(TestCase):
self.mode_config(strip=temp[0], filter=temp[1], qinq=temp[2])
if (caseDef & txCase) != 0:
- self.dut.send_expect('tx_vlan set %s %s' % (txvlan, dutTxPortId), "testpmd> ")
+ self.dut.send_expect('tx_vlan set %s %s' % (dutTxPortId, txvlan), "testpmd> ")
configMode = "Strip %s, filter %s 0x1, extend %s, insert %s" % (temp[0], temp[1], temp[2], "on" if (caseDef & txCase) != 0 else "off")
@@ -372,7 +372,7 @@ class TestDualVlan(TestCase):
if(self.nic == "hartwell"):
self.dut.send_expect("vlan set strip on %s" % dutTxPortId, "testpmd> ")
- self.dut.send_expect("tx_vlan set %s %s" % (txvlan, dutTxPortId), "testpmd> ")
+ self.dut.send_expect("tx_vlan set %s %s" % (dutTxPortId, txvlan), "testpmd> ")
self.vlan_send_packet()
#out = self.tester.scapy_get_result()
diff --git a/tests/TestSuite_vlan.py b/tests/TestSuite_vlan.py
index fc6f2cb..7dde59c 100644
--- a/tests/TestSuite_vlan.py
+++ b/tests/TestSuite_vlan.py
@@ -94,7 +94,7 @@ class TestVlan(TestCase):
return self.tester.send_expect("tcpdump -nn -e -v -r ./vlan_test.cap","#")
def vlan_send_packet(self, vid, num=1):
"""
- Send $num of packet to portid
+ Send $num of packet to portid, if vid is -1, it means send pakcage not include vlan id.
"""
# The package stream : testTxPort->dutRxPort->dutTxport->testRxPort
port = self.tester.get_local_port(dutRxPortId)
@@ -108,8 +108,10 @@ class TestVlan(TestCase):
self.dmac = self.dut.get_mac_address(dutRxPortId)
# FIXME send a burst with only num packet
-
- self.tester.scapy_append('sendp([Ether(src="%s",dst="%s")/Dot1Q(vlan=%s)/IP(len=46)], iface="%s")' % (self.smac, self.dmac, vid, txItf))
+ if vid == -1:
+ self.tester.scapy_append('sendp([Ether(src="%s",dst="%s")/IP(len=46)], iface="%s")' % (self.smac, self.dmac, txItf))
+ else:
+ self.tester.scapy_append('sendp([Ether(src="%s",dst="%s")/Dot1Q(vlan=%s)/IP(len=46)], iface="%s")' % (self.smac, self.dmac, vid, txItf))
self.tester.scapy_execute()
def set_up(self):
@@ -197,20 +199,14 @@ class TestVlan(TestCase):
intf = self.tester.get_interface(port)
self.dut.send_expect("set nbport 2", "testpmd> ")
- self.dut.send_expect("tx_vlan set %d %s" % (self.vlan, dutTxPortId), "testpmd> ")
-
- self.tester.scapy_background()
- self.tester.scapy_append('p = sniff(iface="%s", count=1, timeout=5)' % intf)
- self.tester.scapy_append('RESULT=str(p)')
- self.tester.scapy_foreground()
-
- self.tester.scapy_execute()
- time.sleep(2)
- self.dut.send_expect("start tx_first", "testpmd> ")
- time.sleep(2)
+ self.dut.send_expect("tx_vlan set %s %d" % (dutTxPortId, self.vlan), "testpmd> ")
+ self.start_tcpdump()
- out = self.tester.scapy_get_result()
- self.verify("vlan=%dL" % self.vlan in out, "Wrong vlan: " + out)
+ self.dut.send_expect("start", "testpmd> ")
+ self.vlan_send_packet(-1)
+
+ out = self.get_tcpdump_package()
+ self.verify("vlan %d" % self.vlan in out, "Wrong vlan: " + out)
if self.nic in ["fortville_eagle", "fortville_spirit", "fortville_spirit_single", "redrockcanyou"]:
self.dut.send_expect("tx_vlan reset %s" % dutTxPortId, "testpmd> ", 30)
self.dut.send_expect("stop", "testpmd> ", 30)