X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Ftest_ip4_irb.py;h=8c3830c2d816e073024cc6c84ed243a2c42ddeb1;hb=8006c6a;hp=bbec7ca709f18e79024e87f2ef805152acf927b2;hpb=c8efa29b6f9a91381897b54f1147daf922ed7164;p=vpp.git diff --git a/test/test_ip4_irb.py b/test/test_ip4_irb.py index bbec7ca709f..8c3830c2d81 100644 --- a/test/test_ip4_irb.py +++ b/test/test_ip4_irb.py @@ -31,6 +31,8 @@ from scapy.layers.l2 import Ether from scapy.layers.inet import IP, UDP from framework import VppTestCase, VppTestRunner +from vpp_papi import MACAddress +from vpp_papi_provider import L2_PORT_TYPE class TestIpIrb(VppTestCase): @@ -54,7 +56,7 @@ class TestIpIrb(VppTestCase): # create 3 pg interfaces, 1 loopback interface cls.create_pg_interfaces(range(3)) - cls.create_loopback_interfaces(range(1)) + cls.create_loopback_interfaces(1) cls.interfaces = list(cls.pg_interfaces) cls.interfaces.extend(cls.lo_interfaces) @@ -64,7 +66,8 @@ class TestIpIrb(VppTestCase): # Create BD with MAC learning enabled and put interfaces to this BD cls.vapi.sw_interface_set_l2_bridge( - cls.loop0.sw_if_index, bd_id=cls.bd_id, bvi=1) + cls.loop0.sw_if_index, bd_id=cls.bd_id, + port_type=L2_PORT_TYPE.BVI) cls.vapi.sw_interface_set_l2_bridge( cls.pg0.sw_if_index, bd_id=cls.bd_id) cls.vapi.sw_interface_set_l2_bridge( @@ -238,26 +241,36 @@ class TestIpIrb(VppTestCase): self.assertListEqual(rcvd1.res, rcvd2.res) - def test_ip4_irb_2(self): - """ IPv4 IRB test 2 - - Test scenario: - - ip traffic from pg0 and pg1 ends on pg2 - """ - + def send_and_verify_l2_to_ip(self): stream1 = self.create_stream_l2_to_ip( self.pg0, self.loop0, self.pg2, self.pg_if_packet_sizes) stream2 = self.create_stream_l2_to_ip( self.pg1, self.loop0, self.pg2, self.pg_if_packet_sizes) + self.vapi.cli("clear trace") self.pg0.add_stream(stream1) self.pg1.add_stream(stream2) self.pg_enable_capture(self.pg_interfaces) self.pg_start() - rcvd = self.pg2.get_capture() + rcvd = self.pg2.get_capture(514) self.verify_capture_l2_to_ip(self.pg2, self.loop0, rcvd) + def test_ip4_irb_2(self): + """ IPv4 IRB test 2 + + Test scenario: + - ip traffic from pg0 and pg1 ends on pg2 + """ + self.send_and_verify_l2_to_ip() + + # change the BVI's mac and resed traffic + self.loop0.set_mac(MACAddress("00:00:00:11:11:33")) + + self.send_and_verify_l2_to_ip() + # check it wasn't flooded + self.pg1.assert_nothing_captured(remark="UU Flood") + if __name__ == '__main__': unittest.main(testRunner=VppTestRunner)