- # cleanup
- #
- self.vapi.sw_interface_set_l2_bridge(self.pg0.sw_if_index, 1,
- enable=0)
- self.vapi.sw_interface_set_l2_bridge(self.pg1.sw_if_index, 1,
- enable=0)
- self.vapi.sw_interface_set_l2_bridge(sub_if_on_pg2.sw_if_index,
- 1, enable=0)
- self.vapi.sw_interface_set_l2_bridge(sub_if_on_pg3.sw_if_index,
- 1, enable=0)
- self.vapi.sw_interface_set_l2_bridge(self.loop0.sw_if_index,
- 1, bvi=1, enable=0)
-
- #
- # the explicit route delete is require so it happens before
- # the sbu-interface delete. subinterface delete is required
- # because that object type does not use the object registry
- #
- route_no_tag.remove_vpp_config()
- route_with_tag.remove_vpp_config()
- sub_if_on_pg3.remove_vpp_config()
- sub_if_on_pg2.remove_vpp_config()
-
- def test_l2_emulation(self):
- """ L2 Emulation """
-
- #
- # non distinct L3 packets, in the tag/non-tag combos
- #
- pkt_no_tag = (Ether(src=self.pg0.remote_mac,
- dst=self.pg1.remote_mac) /
- IP(src="2.2.2.2",
- dst="1.1.1.1") /
- UDP(sport=1234, dport=1234) /
- Raw('\xa5' * 100))
- pkt_to_tag = (Ether(src=self.pg0.remote_mac,
- dst=self.pg2.remote_mac) /
- IP(src="2.2.2.2",
- dst="1.1.1.2") /
- UDP(sport=1234, dport=1234) /
- Raw('\xa5' * 100))
- pkt_from_tag = (Ether(src=self.pg3.remote_mac,
- dst=self.pg2.remote_mac) /
- Dot1Q(vlan=93) /
- IP(src="2.2.2.2",
- dst="1.1.1.1") /
- UDP(sport=1234, dport=1234) /
- Raw('\xa5' * 100))
- pkt_from_to_tag = (Ether(src=self.pg3.remote_mac,
- dst=self.pg2.remote_mac) /
- Dot1Q(vlan=93) /
- IP(src="2.2.2.2",
- dst="1.1.1.2") /
- UDP(sport=1234, dport=1234) /
- Raw('\xa5' * 100))
- pkt_bcast = (Ether(src=self.pg0.remote_mac,
- dst="ff:ff:ff:ff:ff:ff") /
- IP(src="2.2.2.2",
- dst="255.255.255.255") /
- UDP(sport=1234, dport=1234) /
- Raw('\xa5' * 100))
-
- #
- # A couple of sub-interfaces for tags
- #
- sub_if_on_pg2 = VppDot1QSubint(self, self.pg2, 92)
- sub_if_on_pg3 = VppDot1QSubint(self, self.pg3, 93)
- sub_if_on_pg2.admin_up()
- sub_if_on_pg3.admin_up()
-
- #
- # Put all the interfaces into a new bridge domain