[dts] [PATCH 3/3] tests: Add RRC support with vlan suite

Qiu, Michael michael.qiu at intel.com
Wed Jul 8 03:54:19 CEST 2015


On 7/8/2015 9:43 AM, Liu, Yong wrote:
> Hi Michael,
> Some comments below.
>
>> -----Original Message-----
>> From: dts [mailto:dts-bounces at dpdk.org] On Behalf Of Michael Qiu
>> Sent: Tuesday, July 07, 2015 5:38 PM
>> To: dts at dpdk.org
>> Subject: [dts] [PATCH 3/3] tests: Add RRC support with vlan suite
>>
>> Add RRC support with vlan suite
>>
>> Signed-off-by: Michael Qiu <michael.qiu at intel.com>
>> ---
>>  tests/TestSuite_vlan.py | 56 ++++++++++++++++++++++++++++++--------------
>> -----
>>  1 file changed, 34 insertions(+), 22 deletions(-)
>>
>> diff --git a/tests/TestSuite_vlan.py b/tests/TestSuite_vlan.py
>> index fba68e3..6f443de 100644
>> --- a/tests/TestSuite_vlan.py
>> +++ b/tests/TestSuite_vlan.py
>> @@ -74,12 +74,13 @@ class TestVlan(TestCase):
>>          self.dut.send_expect("set verbose 1", "testpmd> ")
>>          out = self.dut.send_expect("set fwd mac", "testpmd> ")
>>
>> -        if self.nic in ["fortville_eagle", "fortville_spirit",
>> "fortville_spirit_single"]:
>> +        if self.nic in ["fortville_eagle", "fortville_spirit",
>> "fortville_spirit_single", "redrockcanyou"]:
>>              self.dut.send_expect("set promisc all off", "testpmd> ")
>>              self.dut.send_expect("vlan set filter on %s"%dutRxPortId,
>> "testpmd> ")
>>
>>          self.dut.send_expect("vlan set strip off %s" % dutRxPortId,
>> "testpmd> ")
>>          self.verify('Set mac packet forwarding mode' in out, "set fwd
>> rxonly error")
>> +        self.vlan = 51
>>
> Is there any specified reason to set vlan to 51? We used to use value 1 to check vlan feature.

Because RRC default will be set vlan 1, so if we change to 51 will
verify it correctly.

Thanks,
Michael
>
>>      def start_tcpdump(self):
>>          port = self.tester.get_local_port(dutTxPortId)
>> @@ -98,16 +99,17 @@ class TestVlan(TestCase):
>>          # The package stream : testTxPort->dutRxPort->dutTxport-
>>> testRxPort
>>          port = self.tester.get_local_port(dutRxPortId)
>>          txItf = self.tester.get_interface(port)
>> +        self.smac = self.tester.get_mac(port)
>>
>>          port = self.tester.get_local_port(dutTxPortId)
>>          rxItf = self.tester.get_interface(port)
>>
>>          # the package dect mac must is dut tx port id when the port
>> promisc is off
>> -        mac = self.dut.get_mac_address(dutRxPortId)
>> +        self.dmac = self.dut.get_mac_address(dutRxPortId)
>>
>>          # FIXME  send a burst with only num packet
>>
>> -
>> self.tester.scapy_append('sendp([Ether(dst="%s")/Dot1Q(vlan=%s)/IP(len=46)
>> ], iface="%s")' % (mac, vid, txItf))
>> +
>> self.tester.scapy_append('sendp([Ether(src="%s",dst="%s")/Dot1Q(vlan=%s)/I
>> P(len=46)], iface="%s")' % (self.smac, self.dmac, vid, txItf))
>>
>>          self.tester.scapy_execute()
>>      def set_up(self):
>> @@ -120,16 +122,19 @@ class TestVlan(TestCase):
>>          Enable receipt of VLAN packets
>>          """
>>
>> -        self.dut.send_expect("rx_vlan add 1 %s" % dutRxPortId, "testpmd>
>> ")
>> +        if self.nic == "redrockcanyou" :
>> +            print "fm10k not support this case\n"
>> +            return
>> +        self.dut.send_expect("rx_vlan add %d %s" % (self.vlan,
>> dutRxPortId), "testpmd> ")
>>          self.dut.send_expect("vlan set strip off  %s" % dutRxPortId,
>> "testpmd> ")
>>          self.dut.send_expect("start", "testpmd> ", 120)
>>          out = self.dut.send_expect("show port info %s" % dutRxPortId,
>> "testpmd> ", 20)
>>
>>          self.start_tcpdump()
>> -        self.vlan_send_packet(1)
>> +        self.vlan_send_packet(self.vlan)
>>          #out = self.tester.scapy_get_result()
>>          out = self.get_tcpdump_package()
>> -        self.verify("vlan 1" in out, "Wrong vlan:" + out)
>> +        self.verify("vlan %d" % self.vlan in out, "Wrong vlan:" + out)
>>
>>          self.dut.send_expect("stop", "testpmd> ")
>>
>> @@ -140,13 +145,15 @@ class TestVlan(TestCase):
>>          """
>>
>>
>> -        self.dut.send_expect("rx_vlan rm 1 %s" % dutRxPortId, "testpmd> ")
>> +        self.dut.send_expect("rx_vlan rm %d %s" % (self.vlan,
>> dutRxPortId), "testpmd> ")
>>          self.dut.send_expect("start", "testpmd> ", 120)
>>          self.start_tcpdump()
>> -        self.vlan_send_packet(1)
>> +        self.vlan_send_packet(self.vlan)
>>
>>          out = self.get_tcpdump_package()
>> -        self.verify("vlan 1" not in out, "Wrong vlan:" + out)
>> +        # fm10k switch will redirect package if not send to nic
>> +        if (not((self.nic == "redrockcanyou") and ("%s > %s"%(self.smac,
>> self.dmac) in out))):
>> +            self.verify("vlan %d" % self.vlan not in out, "Wrong vlan:" +
>> out)
>>
>>          out = self.dut.send_expect("stop", "testpmd> ")
>>
>> @@ -154,45 +161,48 @@ class TestVlan(TestCase):
>>      def test_vlan_strip_config_on(self):
>>
>>          self.dut.send_expect("vlan set strip on %s" % dutRxPortId,
>> "testpmd> ", 20)
>> -        self.dut.send_expect("rx_vlan add 1 %s" % dutRxPortId, "testpmd>
>> ", 20)
>> +        self.dut.send_expect("rx_vlan add %d %s" % (self.vlan,
>> dutRxPortId), "testpmd> ", 20)
>>          out = self.dut.send_expect("show port info %s" % dutRxPortId,
>> "testpmd> ", 20)
>>          self.verify("strip on" in out, "Wrong strip:" + out)
>>
>>          self.dut.send_expect("start", "testpmd> ", 120)
>>          self.start_tcpdump()
>> -        self.vlan_send_packet(1)
>> +        self.vlan_send_packet(self.vlan)
>>          out = self.get_tcpdump_package()
>> -        self.verify("vlan 1" not in out, "Wrong vlan:" + out)
>> +        self.verify("vlan %d" % self.vlan not in out, "Wrong vlan:" + out)
>>          out = self.dut.send_expect("quit", "#", 120)
>>
>>      def test_vlan_strip_config_off(self):
>>
>> +        if self.nic == "redrockcanyou" :
>> +            print "fm10k not support this case\n"
>> +            return
> We should use "print dts.RED()" to emphasize this situation.
>
>>          self.dut.send_expect("vlan set strip off %s" % dutRxPortId,
>> "testpmd> ", 20)
>> -        self.dut.send_expect("rx_vlan add 1 %s" % dutRxPortId, "testpmd>
>> ", 20)
>> +        self.dut.send_expect("rx_vlan add %d %s" % (self.vlan,
>> dutRxPortId), "testpmd> ", 20)
>>          out = self.dut.send_expect("show port info %s" % dutRxPortId,
>> "testpmd> ", 20)
>>          self.verify("strip off" in out, "Wrong strip:" + out)
>>          self.dut.send_expect("set nbport 2", "testpmd> ")
>>          self.dut.send_expect("start", "testpmd> ", 120)
>>          self.start_tcpdump()
>> -        self.vlan_send_packet(1)
>> +        self.vlan_send_packet(self.vlan)
>>          out = self.get_tcpdump_package()
>> -        self.verify("vlan 1" in out, "Wrong strip vlan:" + out)
>> +        self.verify("vlan %d" % self.vlan in out, "Wrong strip vlan:" +
>> out)
>>          out = self.dut.send_expect("stop", "testpmd> ", 120)
>>
>> -    def FAILING_test_vlan_enable_vlan_insertion(self):
>> +    def test_vlan_enable_vlan_insertion(self):
>>          """
>>          Enable VLAN header insertion in transmitted packets
>>          """
>>
>> -        port = self.tester.get_local_port(valports[0])
>> +        port = self.tester.get_local_port(dutTxPortId,)
>>          intf = self.tester.get_interface(port)
>>
>>          self.dut.send_expect("set nbport 2", "testpmd> ")
>> -        self.dut.send_expect("tx_vlan set 1 %s" % valports[0], "testpmd>
>> ")
>> +        self.dut.send_expect("tx_vlan set %d %s" % (self.vlan,
>> dutTxPortId), "testpmd> ")
>>
>> -        self.dut.send_expect("set promisc all on", "testpmd> ")
>> +        #self.dut.send_expect("set promisc all on", "testpmd> ")
> Please remove this line.
>
>>          if self.nic == 'hartwell':
>> -            self.dut.send_expect("vlan set strip on %s" % valports[0],
>> "testpmd> ")
> 'hartwell' not defined in settings.py, here is topy issue or there's new NIC need support in DTS?
>
>> +            self.dut.send_expect("vlan set strip on %s" % dutRxPortId,
>> "testpmd> ")
>>
>>          self.tester.scapy_background()
>>          self.tester.scapy_append('p = sniff(iface="%s", count=1,
>> timeout=5)' % intf)
>> @@ -205,8 +215,9 @@ class TestVlan(TestCase):
>>          time.sleep(2)
>>
>>          out = self.tester.scapy_get_result()
>> -        self.verify("vlan=1L" in out, "Wrong vlan: " + out)
>> -        if self.nic in ["fortville_eagle", "fortville_spirit",
>> "fortville_spirit_single"]:
>> +        self.verify("vlan=%dL" % 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)
>>          else:
>>              self.dut.send_expect("quit", "# ", 30)
>> @@ -217,6 +228,7 @@ class TestVlan(TestCase):
>>          """
>>          pass
>>
>> +
>>      def tear_down_all(self):
>>          """
>>          Run after each test suite.
>> --
>> 1.9.3
>



More information about the dts mailing list