aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorDave Wallace <dwallacelf@gmail.com>2021-01-06 10:48:45 -0500
committerJohn Lo <lojultra2020@outlook.com>2021-03-29 05:24:25 +0000
commitd4a907bdd2f86404790ebbe2c85a7f1b844639f8 (patch)
tree5bee7205e1940d61118f8490acb23725ae01de38 /test
parentdc2632e010585e74216d557698ae127a212fe51f (diff)
tests: move vxlan tests to src/vnet/vxlan/tests
- Refactor make test code to be co-located with the vpp feature source code Type: test Signed-off-by: Dave Wallace <dwallacelf@gmail.com> Change-Id: I66379dfe671628e39dfc9685c4fd70fa0e566f6f
Diffstat (limited to 'test')
-rw-r--r--test/test_vxlan.py421
-rw-r--r--test/test_vxlan6.py316
-rw-r--r--test/test_vxlan_gbp.py293
-rw-r--r--test/test_vxlan_gpe.py265
-rw-r--r--test/vpp_vxlan_gbp_tunnel.py83
-rw-r--r--test/vpp_vxlan_tunnel.py86
6 files changed, 0 insertions, 1464 deletions
diff --git a/test/test_vxlan.py b/test/test_vxlan.py
deleted file mode 100644
index 028275ccedf..00000000000
--- a/test/test_vxlan.py
+++ /dev/null
@@ -1,421 +0,0 @@
-#!/usr/bin/env python3
-
-import socket
-from util import ip4_range, reassemble4
-import unittest
-from framework import VppTestCase, VppTestRunner
-from template_bd import BridgeDomain
-
-from scapy.layers.l2 import Ether
-from scapy.packet import Raw, bind_layers
-from scapy.layers.inet import IP, UDP
-from scapy.layers.vxlan import VXLAN
-
-import util
-from vpp_ip_route import VppIpRoute, VppRoutePath
-from vpp_vxlan_tunnel import VppVxlanTunnel
-from vpp_ip import INVALID_INDEX
-
-
-class TestVxlan(BridgeDomain, VppTestCase):
- """ VXLAN Test Case """
-
- def __init__(self, *args):
- BridgeDomain.__init__(self)
- VppTestCase.__init__(self, *args)
-
- def encapsulate(self, pkt, vni):
- """
- Encapsulate the original payload frame by adding VXLAN header with its
- UDP, IP and Ethernet fields
- """
- return (Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac) /
- IP(src=self.pg0.remote_ip4, dst=self.pg0.local_ip4) /
- UDP(sport=self.dport, dport=self.dport, chksum=0) /
- VXLAN(vni=vni, flags=self.flags) /
- pkt)
-
- def ip_range(self, start, end):
- """ range of remote ip's """
- return ip4_range(self.pg0.remote_ip4, start, end)
-
- def encap_mcast(self, pkt, src_ip, src_mac, vni):
- """
- Encapsulate the original payload frame by adding VXLAN header with its
- UDP, IP and Ethernet fields
- """
- return (Ether(src=src_mac, dst=self.mcast_mac) /
- IP(src=src_ip, dst=self.mcast_ip4) /
- UDP(sport=self.dport, dport=self.dport, chksum=0) /
- VXLAN(vni=vni, flags=self.flags) /
- pkt)
-
- def decapsulate(self, pkt):
- """
- Decapsulate the original payload frame by removing VXLAN header
- """
- # check if is set I flag
- self.assertEqual(pkt[VXLAN].flags, int('0x8', 16))
- return pkt[VXLAN].payload
-
- # Method for checking VXLAN encapsulation.
- #
- def check_encapsulation(self, pkt, vni, local_only=False, mcast_pkt=False):
- # TODO: add error messages
- # Verify source MAC is VPP_MAC and destination MAC is MY_MAC resolved
- # by VPP using ARP.
- self.assertEqual(pkt[Ether].src, self.pg0.local_mac)
- if not local_only:
- if not mcast_pkt:
- self.assertEqual(pkt[Ether].dst, self.pg0.remote_mac)
- else:
- self.assertEqual(pkt[Ether].dst, type(self).mcast_mac)
- # Verify VXLAN tunnel source IP is VPP_IP and destination IP is MY_IP.
- self.assertEqual(pkt[IP].src, self.pg0.local_ip4)
- if not local_only:
- if not mcast_pkt:
- self.assertEqual(pkt[IP].dst, self.pg0.remote_ip4)
- else:
- self.assertEqual(pkt[IP].dst, type(self).mcast_ip4)
- # Verify UDP destination port is VXLAN 4789, source UDP port could be
- # arbitrary.
- self.assertEqual(pkt[UDP].dport, self.dport)
- # Verify UDP checksum
- self.assert_udp_checksum_valid(pkt)
- # Verify VNI
- self.assertEqual(pkt[VXLAN].vni, vni)
-
- @classmethod
- def create_vxlan_flood_test_bd(cls, vni, n_ucast_tunnels, port):
- # Create 10 ucast vxlan tunnels under bd
- ip_range_start = 10
- ip_range_end = ip_range_start + n_ucast_tunnels
- next_hop_address = cls.pg0.remote_ip4
- for dest_ip4 in ip4_range(next_hop_address, ip_range_start,
- ip_range_end):
- # add host route so dest_ip4 will not be resolved
- rip = VppIpRoute(cls, dest_ip4, 32,
- [VppRoutePath(next_hop_address,
- INVALID_INDEX)],
- register=False)
- rip.add_vpp_config()
-
- r = VppVxlanTunnel(cls, src=cls.pg0.local_ip4,
- src_port=port, dst_port=port,
- dst=dest_ip4, vni=vni)
- r.add_vpp_config()
- cls.vapi.sw_interface_set_l2_bridge(r.sw_if_index, bd_id=vni)
-
- @classmethod
- def add_del_shared_mcast_dst_load(cls, port, is_add):
- """
- add or del tunnels sharing the same mcast dst
- to test vxlan ref_count mechanism
- """
- n_shared_dst_tunnels = 20
- vni_start = 10000
- vni_end = vni_start + n_shared_dst_tunnels
- for vni in range(vni_start, vni_end):
- r = VppVxlanTunnel(cls, src=cls.pg0.local_ip4,
- src_port=port, dst_port=port,
- dst=cls.mcast_ip4, mcast_sw_if_index=1, vni=vni)
- if is_add:
- r.add_vpp_config()
- if r.sw_if_index == 0xffffffff:
- raise ValueError("bad sw_if_index: ~0")
- else:
- r.remove_vpp_config()
-
- @classmethod
- def add_shared_mcast_dst_load(cls, port):
- cls.add_del_shared_mcast_dst_load(port=port, is_add=1)
-
- @classmethod
- def del_shared_mcast_dst_load(cls, port):
- cls.add_del_shared_mcast_dst_load(port=port, is_add=0)
-
- @classmethod
- def add_del_mcast_tunnels_load(cls, port, is_add):
- """
- add or del tunnels to test vxlan stability
- """
- n_distinct_dst_tunnels = 200
- ip_range_start = 10
- ip_range_end = ip_range_start + n_distinct_dst_tunnels
- for dest_ip4 in ip4_range(cls.mcast_ip4, ip_range_start,
- ip_range_end):
- vni = bytearray(socket.inet_pton(socket.AF_INET, dest_ip4))[3]
- r = VppVxlanTunnel(cls, src=cls.pg0.local_ip4,
- src_port=port, dst_port=port,
- dst=dest_ip4, mcast_sw_if_index=1, vni=vni)
- if is_add:
- r.add_vpp_config()
- else:
- r.remove_vpp_config()
-
- @classmethod
- def add_mcast_tunnels_load(cls, port):
- cls.add_del_mcast_tunnels_load(port=port, is_add=1)
-
- @classmethod
- def del_mcast_tunnels_load(cls, port):
- cls.add_del_mcast_tunnels_load(port=port, is_add=0)
-
- # Class method to start the VXLAN test case.
- # Overrides setUpClass method in VppTestCase class.
- # Python try..except statement is used to ensure that the tear down of
- # the class will be executed even if exception is raised.
- # @param cls The class pointer.
- @classmethod
- def setUpClass(cls):
- super(TestVxlan, cls).setUpClass()
-
- try:
- cls.flags = 0x8
-
- # Create 2 pg interfaces.
- cls.create_pg_interfaces(range(4))
- for pg in cls.pg_interfaces:
- pg.admin_up()
-
- # Configure IPv4 addresses on VPP pg0.
- cls.pg0.config_ip4()
-
- # Resolve MAC address for VPP's IP address on pg0.
- cls.pg0.resolve_arp()
-
- # Our Multicast address
- cls.mcast_ip4 = '239.1.1.1'
- cls.mcast_mac = util.mcast_ip_to_mac(cls.mcast_ip4)
- except Exception:
- cls.tearDownClass()
- raise
-
- @classmethod
- def tearDownClass(cls):
- super(TestVxlan, cls).tearDownClass()
-
- def setUp(self):
- super(TestVxlan, self).setUp()
-
- def createVxLANInterfaces(self, port=4789):
- # Create VXLAN VTEP on VPP pg0, and put vxlan_tunnel0 and pg1
- # into BD.
- self.dport = port
-
- self.single_tunnel_vni = 0x12345
- self.single_tunnel_bd = 1
- r = VppVxlanTunnel(self, src=self.pg0.local_ip4,
- dst=self.pg0.remote_ip4,
- src_port=self.dport, dst_port=self.dport,
- vni=self.single_tunnel_vni)
- r.add_vpp_config()
- self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index,
- bd_id=self.single_tunnel_bd)
- self.vapi.sw_interface_set_l2_bridge(
- rx_sw_if_index=self.pg1.sw_if_index, bd_id=self.single_tunnel_bd)
-
- # Setup vni 2 to test multicast flooding
- self.n_ucast_tunnels = 10
- self.mcast_flood_bd = 2
- self.create_vxlan_flood_test_bd(self.mcast_flood_bd,
- self.n_ucast_tunnels,
- self.dport)
- r = VppVxlanTunnel(self, src=self.pg0.local_ip4, dst=self.mcast_ip4,
- src_port=self.dport, dst_port=self.dport,
- mcast_sw_if_index=1, vni=self.mcast_flood_bd)
- r.add_vpp_config()
- self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index,
- bd_id=self.mcast_flood_bd)
- self.vapi.sw_interface_set_l2_bridge(
- rx_sw_if_index=self.pg2.sw_if_index, bd_id=self.mcast_flood_bd)
-
- # Add and delete mcast tunnels to check stability
- self.add_shared_mcast_dst_load(self.dport)
- self.add_mcast_tunnels_load(self.dport)
- self.del_shared_mcast_dst_load(self.dport)
- self.del_mcast_tunnels_load(self.dport)
-
- # Setup vni 3 to test unicast flooding
- self.ucast_flood_bd = 3
- self.create_vxlan_flood_test_bd(self.ucast_flood_bd,
- self.n_ucast_tunnels,
- self.dport)
- self.vapi.sw_interface_set_l2_bridge(
- rx_sw_if_index=self.pg3.sw_if_index, bd_id=self.ucast_flood_bd)
-
- # Set scapy listen custom port for VxLAN
- bind_layers(UDP, VXLAN, dport=self.dport)
-
- def encap_big_packet(self):
- self.vapi.sw_interface_set_mtu(self.pg0.sw_if_index, [1500, 0, 0, 0])
-
- frame = (Ether(src='00:00:00:00:00:02', dst='00:00:00:00:00:01') /
- IP(src='4.3.2.1', dst='1.2.3.4') /
- UDP(sport=20000, dport=10000) /
- Raw(b'\xa5' * 1450))
-
- self.pg1.add_stream([frame])
-
- self.pg0.enable_capture()
-
- self.pg_start()
-
- # Pick first received frame and check if it's correctly encapsulated.
- out = self.pg0.get_capture(2)
- ether = out[0]
- pkt = reassemble4(out)
- pkt = ether / pkt
- self.check_encapsulation(pkt, self.single_tunnel_vni)
-
- payload = self.decapsulate(pkt)
- # TODO: Scapy bug?
- # self.assert_eq_pkts(payload, frame)
-
- """
- Tests with default port (4789)
- """
- def test_decap(self):
- """ Decapsulation test
- from BridgeDoman
- """
- self.createVxLANInterfaces()
- super(TestVxlan, self).test_decap()
-
- def test_encap(self):
- """ Encapsulation test
- from BridgeDoman
- """
- self.createVxLANInterfaces()
- super(TestVxlan, self).test_encap()
-
- def test_encap_big_packet(self):
- """ Encapsulation test send big frame from pg1
- Verify receipt of encapsulated frames on pg0
- """
- self.createVxLANInterfaces()
- self.encap_big_packet()
-
- def test_ucast_flood(self):
- """ Unicast flood test
- from BridgeDoman
- """
- self.createVxLANInterfaces()
- super(TestVxlan, self).test_ucast_flood()
-
- def test_mcast_flood(self):
- """ Multicast flood test
- from BridgeDoman
- """
- self.createVxLANInterfaces()
- super(TestVxlan, self).test_mcast_flood()
-
- def test_mcast_rcv(self):
- """ Multicast receive test
- from BridgeDoman
- """
- self.createVxLANInterfaces()
- super(TestVxlan, self).test_mcast_rcv()
-
- """
- Tests with custom port
- """
- def test_decap_custom_port(self):
- """ Decapsulation test custom port
- from BridgeDoman
- """
- self.createVxLANInterfaces(1111)
- super(TestVxlan, self).test_decap()
-
- def test_encap_custom_port(self):
- """ Encapsulation test custom port
- from BridgeDoman
- """
- self.createVxLANInterfaces(1111)
- super(TestVxlan, self).test_encap()
-
- def test_ucast_flood_custom_port(self):
- """ Unicast flood test custom port
- from BridgeDoman
- """
- self.createVxLANInterfaces(1111)
- super(TestVxlan, self).test_ucast_flood()
-
- def test_mcast_flood_custom_port(self):
- """ Multicast flood test custom port
- from BridgeDoman
- """
- self.createVxLANInterfaces(1111)
- super(TestVxlan, self).test_mcast_flood()
-
- def test_mcast_rcv_custom_port(self):
- """ Multicast receive test custom port
- from BridgeDoman
- """
- self.createVxLANInterfaces(1111)
- super(TestVxlan, self).test_mcast_rcv()
-
- # Method to define VPP actions before tear down of the test case.
- # Overrides tearDown method in VppTestCase class.
- # @param self The object pointer.
-
- def tearDown(self):
- super(TestVxlan, self).tearDown()
-
- def show_commands_at_teardown(self):
- self.logger.info(self.vapi.cli("show bridge-domain 1 detail"))
- self.logger.info(self.vapi.cli("show bridge-domain 2 detail"))
- self.logger.info(self.vapi.cli("show bridge-domain 3 detail"))
- self.logger.info(self.vapi.cli("show vxlan tunnel"))
-
-
-class TestVxlan2(VppTestCase):
- """ VXLAN Test Case """
- def setUp(self):
- super(TestVxlan2, self).setUp()
-
- # Create 2 pg interfaces.
- self.create_pg_interfaces(range(4))
- for pg in self.pg_interfaces:
- pg.admin_up()
-
- # Configure IPv4 addresses on VPP pg0.
- self.pg0.config_ip4()
- self.pg0.resolve_arp()
-
- def tearDown(self):
- super(TestVxlan2, self).tearDown()
-
- def test_xconnect(self):
- """ VXLAN source address not local """
-
- #
- # test the broken configuration of a VXLAN tunnel whose
- # source address is not local ot the box. packets sent
- # through the tunnel should be dropped
- #
- t = VppVxlanTunnel(self,
- src="10.0.0.5",
- dst=self.pg0.local_ip4,
- vni=1000)
- t.add_vpp_config()
- t.admin_up()
-
- self.vapi.sw_interface_set_l2_xconnect(t.sw_if_index,
- self.pg1.sw_if_index,
- enable=1)
- self.vapi.sw_interface_set_l2_xconnect(self.pg1.sw_if_index,
- t.sw_if_index,
- enable=1)
-
- p = (Ether(src="00:11:22:33:44:55",
- dst="00:00:00:11:22:33") /
- IP(src="4.3.2.1", dst="1.2.3.4") /
- UDP(sport=20000, dport=10000) /
- Raw(b'\xa5' * 1450))
-
- rx = self.send_and_assert_no_replies(self.pg1, [p])
-
-
-if __name__ == '__main__':
- unittest.main(testRunner=VppTestRunner)
diff --git a/test/test_vxlan6.py b/test/test_vxlan6.py
deleted file mode 100644
index 123cce9b7ba..00000000000
--- a/test/test_vxlan6.py
+++ /dev/null
@@ -1,316 +0,0 @@
-#!/usr/bin/env python3
-
-import socket
-import unittest
-from framework import VppTestCase, VppTestRunner
-from template_bd import BridgeDomain
-
-from scapy.layers.l2 import Ether
-from scapy.packet import Raw, bind_layers
-from scapy.layers.inet6 import IP, IPv6, UDP
-from scapy.layers.vxlan import VXLAN
-
-import util
-from vpp_ip_route import VppIpRoute, VppRoutePath
-from vpp_vxlan_tunnel import VppVxlanTunnel
-from vpp_ip import INVALID_INDEX
-
-
-class TestVxlan6(BridgeDomain, VppTestCase):
- """ VXLAN over IPv6 Test Case """
-
- def __init__(self, *args):
- BridgeDomain.__init__(self)
- VppTestCase.__init__(self, *args)
-
- def encapsulate(self, pkt, vni):
- """
- Encapsulate the original payload frame by adding VXLAN header with its
- UDP, IP and Ethernet fields
- """
- return (Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac) /
- IPv6(src=self.pg0.remote_ip6, dst=self.pg0.local_ip6) /
- UDP(sport=self.dport, dport=self.dport, chksum=0) /
- VXLAN(vni=vni, flags=self.flags) /
- pkt)
-
- @classmethod
- def ip_range(cls, s, e):
- """ range of remote ip's """
- tmp = cls.pg0.remote_ip6.rsplit(':', 1)[0]
- return ("%s:%x" % (tmp, i) for i in range(s, e))
-
- def encap_mcast(self, pkt, src_ip, src_mac, vni):
- """
- Encapsulate the original payload frame by adding VXLAN header with its
- UDP, IP and Ethernet fields
- """
- return (Ether(src=src_mac, dst=self.mcast_mac) /
- IPv6(src=src_ip, dst=self.mcast_ip6) /
- UDP(sport=self.dport, dport=self.dport, chksum=0) /
- VXLAN(vni=vni, flags=self.flags) /
- pkt)
-
- def decapsulate(self, pkt):
- """
- Decapsulate the original payload frame by removing VXLAN header
- """
- # check if is set I flag
- self.assertEqual(pkt[VXLAN].flags, int('0x8', 16))
- return pkt[VXLAN].payload
-
- # Method for checking VXLAN encapsulation.
- #
- def check_encapsulation(self, pkt, vni, local_only=False, mcast_pkt=False):
- # TODO: add error messages
- # Verify source MAC is VPP_MAC and destination MAC is MY_MAC resolved
- # by VPP using ARP.
- self.assertEqual(pkt[Ether].src, self.pg0.local_mac)
- if not local_only:
- if not mcast_pkt:
- self.assertEqual(pkt[Ether].dst, self.pg0.remote_mac)
- else:
- self.assertEqual(pkt[Ether].dst, type(self).mcast_mac)
- # Verify VXLAN tunnel source IP is VPP_IP and destination IP is MY_IP.
- self.assertEqual(pkt[IPv6].src, self.pg0.local_ip6)
- if not local_only:
- if not mcast_pkt:
- self.assertEqual(pkt[IPv6].dst, self.pg0.remote_ip6)
- else:
- self.assertEqual(pkt[IPv6].dst, type(self).mcast_ip6)
- # Verify UDP destination port is VXLAN 4789, source UDP port could be
- # arbitrary.
- self.assertEqual(pkt[UDP].dport, self.dport)
- # Verify UDP checksum
- self.assert_udp_checksum_valid(pkt, ignore_zero_checksum=False)
- # Verify VNI
- self.assertEqual(pkt[VXLAN].vni, vni)
-
- @classmethod
- def create_vxlan_flood_test_bd(cls, vni, n_ucast_tunnels, port):
- # Create 10 ucast vxlan tunnels under bd
- start = 10
- end = start + n_ucast_tunnels
- for dest_ip6 in cls.ip_range(start, end):
- # add host route so dest ip will not be resolved
- rip = VppIpRoute(cls, dest_ip6, 128,
- [VppRoutePath(cls.pg0.remote_ip6, INVALID_INDEX)],
- register=False)
- rip.add_vpp_config()
- r = VppVxlanTunnel(cls, src=cls.pg0.local_ip6,
- src_port=port, dst_port=port,
- dst=dest_ip6, vni=vni)
- r.add_vpp_config()
- cls.vapi.sw_interface_set_l2_bridge(r.sw_if_index, bd_id=vni)
-
- @classmethod
- def add_mcast_tunnels_load(cls):
- cls.add_del_mcast_tunnels_load(is_add=1)
-
- @classmethod
- def del_mcast_tunnels_load(cls):
- cls.add_del_mcast_tunnels_load(is_add=0)
-
- # Class method to start the VXLAN test case.
- # Overrides setUpClass method in VppTestCase class.
- # Python try..except statement is used to ensure that the tear down of
- # the class will be executed even if exception is raised.
- # @param cls The class pointer.
- @classmethod
- def setUpClass(cls):
- super(TestVxlan6, cls).setUpClass()
-
- try:
- cls.flags = 0x8
-
- # Create 2 pg interfaces.
- cls.create_pg_interfaces(range(4))
- for pg in cls.pg_interfaces:
- pg.admin_up()
-
- # Configure IPv6 addresses on VPP pg0.
- cls.pg0.config_ip6()
-
- # Resolve MAC address for VPP's IP address on pg0.
- cls.pg0.resolve_ndp()
-
- # Our Multicast address
- cls.mcast_ip6 = 'ff0e::1'
- cls.mcast_mac = util.mcast_ip_to_mac(cls.mcast_ip6)
- except Exception:
- super(TestVxlan6, cls).tearDownClass()
- raise
-
- @classmethod
- def tearDownClass(cls):
- super(TestVxlan6, cls).tearDownClass()
-
- def setUp(self):
- super(TestVxlan6, self).setUp()
-
- def createVxLANInterfaces(self, port=4789):
- # Create VXLAN VTEP on VPP pg0, and put vxlan_tunnel0 and pg1
- # into BD.
- self.dport = port
-
- self.single_tunnel_vni = 0x12345
- self.single_tunnel_bd = 1
- r = VppVxlanTunnel(self, src=self.pg0.local_ip6,
- dst=self.pg0.remote_ip6,
- src_port=self.dport, dst_port=self.dport,
- vni=self.single_tunnel_vni)
- r.add_vpp_config()
- self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index,
- bd_id=self.single_tunnel_bd)
- self.vapi.sw_interface_set_l2_bridge(
- rx_sw_if_index=self.pg1.sw_if_index, bd_id=self.single_tunnel_bd)
-
- # Setup vni 2 to test multicast flooding
- self.n_ucast_tunnels = 10
- self.mcast_flood_bd = 2
- self.create_vxlan_flood_test_bd(self.mcast_flood_bd,
- self.n_ucast_tunnels,
- self.dport)
- r = VppVxlanTunnel(self, src=self.pg0.local_ip6, dst=self.mcast_ip6,
- src_port=self.dport, dst_port=self.dport,
- mcast_sw_if_index=1, vni=self.mcast_flood_bd)
- r.add_vpp_config()
- self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index,
- bd_id=self.mcast_flood_bd)
- self.vapi.sw_interface_set_l2_bridge(
- rx_sw_if_index=self.pg2.sw_if_index, bd_id=self.mcast_flood_bd)
-
- # Setup vni 3 to test unicast flooding
- self.ucast_flood_bd = 3
- self.create_vxlan_flood_test_bd(self.ucast_flood_bd,
- self.n_ucast_tunnels,
- self.dport)
- self.vapi.sw_interface_set_l2_bridge(
- rx_sw_if_index=self.pg3.sw_if_index, bd_id=self.ucast_flood_bd)
-
- # Set scapy listen custom port for VxLAN
- bind_layers(UDP, VXLAN, dport=self.dport)
-
- # Method to define VPP actions before tear down of the test case.
- # Overrides tearDown method in VppTestCase class.
- # @param self The object pointer.
- def tearDown(self):
- super(TestVxlan6, self).tearDown()
-
- def show_commands_at_teardown(self):
- self.logger.info(self.vapi.cli("show bridge-domain 1 detail"))
- self.logger.info(self.vapi.cli("show bridge-domain 2 detail"))
- self.logger.info(self.vapi.cli("show bridge-domain 3 detail"))
- self.logger.info(self.vapi.cli("show vxlan tunnel"))
-
- def encap_fragmented_packet(self):
- frame = (Ether(src='00:00:00:00:00:02', dst='00:00:00:00:00:01') /
- IP(src='4.3.2.1', dst='1.2.3.4') /
- UDP(sport=20000, dport=10000) /
- Raw(b'\xa5' * 1000))
-
- frags = util.fragment_rfc791(frame, 400)
-
- self.pg1.add_stream(frags)
-
- self.pg0.enable_capture()
-
- self.pg_start()
-
- out = self.pg0.get_capture(3)
-
- payload = []
- for pkt in out:
- payload.append(self.decapsulate(pkt))
- self.check_encapsulation(pkt, self.single_tunnel_vni)
-
- reassembled = util.reassemble4(payload)
-
- self.assertEqual(Ether(raw(frame))[IP], reassembled[IP])
-
- """
- Tests with default port (4789)
- """
- def test_decap(self):
- """ Decapsulation test
- from BridgeDoman
- """
- self.createVxLANInterfaces()
- super(TestVxlan6, self).test_decap()
-
- def test_encap(self):
- """ Encapsulation test
- from BridgeDoman
- """
- self.createVxLANInterfaces()
- super(TestVxlan6, self).test_encap()
-
- def test_encap_fragmented_packet(self):
- """ Encapsulation test send fragments from pg1
- Verify receipt of encapsulated frames on pg0
- """
- self.createVxLANInterfaces()
- self.encap_fragmented_packet()
-
- def test_ucast_flood(self):
- """ Unicast flood test
- from BridgeDoman
- """
- self.createVxLANInterfaces()
- super(TestVxlan6, self).test_ucast_flood()
-
- def test_mcast_flood(self):
- """ Multicast flood test
- from BridgeDoman
- """
- self.createVxLANInterfaces()
- super(TestVxlan6, self).test_mcast_flood()
-
- def test_mcast_rcv(self):
- """ Multicast receive test
- from BridgeDoman
- """
- self.createVxLANInterfaces()
- super(TestVxlan6, self).test_mcast_rcv()
-
- """
- Tests with custom port
- """
- def test_decap_custom_port(self):
- """ Decapsulation test custom port
- from BridgeDoman
- """
- self.createVxLANInterfaces(1111)
- super(TestVxlan6, self).test_decap()
-
- def test_encap_custom_port(self):
- """ Encapsulation test custom port
- from BridgeDoman
- """
- self.createVxLANInterfaces(1111)
- super(TestVxlan6, self).test_encap()
-
- def test_ucast_flood_custom_port(self):
- """ Unicast flood test custom port
- from BridgeDoman
- """
- self.createVxLANInterfaces(1111)
- super(TestVxlan6, self).test_ucast_flood()
-
- def test_mcast_flood_custom_port(self):
- """ Multicast flood test custom port
- from BridgeDoman
- """
- self.createVxLANInterfaces(1111)
- super(TestVxlan6, self).test_mcast_flood()
-
- def test_mcast_rcv_custom_port(self):
- """ Multicast receive test custom port
- from BridgeDoman
- """
- self.createVxLANInterfaces(1111)
- super(TestVxlan6, self).test_mcast_rcv()
-
-
-if __name__ == '__main__':
- unittest.main(testRunner=VppTestRunner)
diff --git a/test/test_vxlan_gbp.py b/test/test_vxlan_gbp.py
deleted file mode 100644
index f332aced7d8..00000000000
--- a/test/test_vxlan_gbp.py
+++ /dev/null
@@ -1,293 +0,0 @@
-#!/usr/bin/env python3
-
-import socket
-from util import ip4_range, reassemble4_ether
-import unittest
-from framework import VppTestCase, VppTestRunner
-from template_bd import BridgeDomain
-
-from scapy.layers.l2 import Ether
-from scapy.packet import Raw
-from scapy.layers.inet import IP, UDP
-from scapy.layers.vxlan import VXLAN
-
-from vpp_ip_route import VppIpRoute, VppRoutePath
-from vpp_ip import INVALID_INDEX
-
-
-class TestVxlanGbp(VppTestCase):
- """ VXLAN GBP Test Case """
-
- @property
- def frame_request(self):
- """ Ethernet frame modeling a generic request """
- return (Ether(src='00:00:00:00:00:01', dst='00:00:00:00:00:02') /
- IP(src='1.2.3.4', dst='4.3.2.1') /
- UDP(sport=10000, dport=20000) /
- Raw(b'\xa5' * 100))
-
- @property
- def frame_reply(self):
- """ Ethernet frame modeling a generic reply """
- return (Ether(src='00:00:00:00:00:02', dst='00:00:00:00:00:01') /
- IP(src='4.3.2.1', dst='1.2.3.4') /
- UDP(sport=20000, dport=10000) /
- Raw(b'\xa5' * 100))
-
- def encapsulate(self, pkt, vni):
- """
- Encapsulate the original payload frame by adding VXLAN GBP header with
- its UDP, IP and Ethernet fields
- """
- return (Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac) /
- IP(src=self.pg0.remote_ip4, dst=self.pg0.local_ip4) /
- UDP(sport=self.dport, dport=self.dport, chksum=0) /
- VXLAN(vni=vni, flags=self.flags, gpflags=self.gpflags,
- gpid=self.sclass) / pkt)
-
- def ip_range(self, start, end):
- """ range of remote ip's """
- return ip4_range(self.pg0.remote_ip4, start, end)
-
- def decapsulate(self, pkt):
- """
- Decapsulate the original payload frame by removing VXLAN header
- """
- # check if is set G and I flag
- self.assertEqual(pkt[VXLAN].flags, int('0x88', 16))
- return pkt[VXLAN].payload
-
- # Method for checking VXLAN GBP encapsulation.
- #
- def check_encapsulation(self, pkt, vni, local_only=False, mcast_pkt=False):
- # TODO: add error messages
- # Verify source MAC is VPP_MAC and destination MAC is MY_MAC resolved
- # by VPP using ARP.
- self.assertEqual(pkt[Ether].src, self.pg0.local_mac)
- if not local_only:
- if not mcast_pkt:
- self.assertEqual(pkt[Ether].dst, self.pg0.remote_mac)
- else:
- self.assertEqual(pkt[Ether].dst, type(self).mcast_mac)
- # Verify VXLAN GBP tunnel source IP is VPP_IP and destination IP is
- # MY_IP.
- self.assertEqual(pkt[IP].src, self.pg0.local_ip4)
- if not local_only:
- if not mcast_pkt:
- self.assertEqual(pkt[IP].dst, self.pg0.remote_ip4)
- else:
- self.assertEqual(pkt[IP].dst, type(self).mcast_ip4)
- # Verify UDP destination port is VXLAN GBP 48879, source UDP port could
- # be arbitrary.
- self.assertEqual(pkt[UDP].dport, type(self).dport)
- # Verify UDP checksum
- self.assert_udp_checksum_valid(pkt)
- # Verify VNI
- # pkt.show()
- self.assertEqual(pkt[VXLAN].vni, vni)
- # Verify Source Class
- self.assertEqual(pkt[VXLAN].gpid, 0)
-
- @classmethod
- def create_vxlan_gbp_flood_test_bd(cls, vni, n_ucast_tunnels):
- # Create 2 ucast vxlan tunnels under bd
- ip_range_start = 10
- ip_range_end = ip_range_start + n_ucast_tunnels
- next_hop_address = cls.pg0.remote_ip4
- for dest_ip4 in ip4_range(cls.pg0.remote_ip4,
- ip_range_start,
- ip_range_end):
- # add host route so dest_ip4 will not be resolved
- rip = VppIpRoute(cls, dest_ip4, 32,
- [VppRoutePath(next_hop_address,
- INVALID_INDEX)],
- register=False)
- rip.add_vpp_config()
- r = cls.vapi.vxlan_gbp_tunnel_add_del(
- tunnel={
- 'src': cls.pg0.local_ip4,
- 'dst': dest_ip4,
- 'vni': vni,
- 'instance': INVALID_INDEX,
- 'mcast_sw_if_index': INVALID_INDEX,
- 'mode': 1,
- },
- is_add=1
- )
- cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index,
- bd_id=vni)
-
- # Class method to start the VXLAN GBP test case.
- # Overrides setUpClass method in VppTestCase class.
- # Python try..except statement is used to ensure that the tear down of
- # the class will be executed even if exception is raised.
- # @param cls The class pointer.
- @classmethod
- def setUpClass(cls):
- super(TestVxlanGbp, cls).setUpClass()
-
- try:
- cls.dport = 48879
- cls.flags = 0x88
- cls.gpflags = 0x0
- cls.sclass = 0
-
- # Create 2 pg interfaces.
- cls.create_pg_interfaces(range(4))
- for pg in cls.pg_interfaces:
- pg.admin_up()
-
- # Configure IPv4 addresses on VPP pg0.
- cls.pg0.config_ip4()
-
- # Resolve MAC address for VPP's IP address on pg0.
- cls.pg0.resolve_arp()
-
- # Create VXLAN GBP VTEP on VPP pg0, and put vxlan_gbp_tunnel0 and
- # pg1 into BD.
- cls.single_tunnel_bd = 1
- cls.single_tunnel_vni = 0xabcde
- r = cls.vapi.vxlan_gbp_tunnel_add_del(
- tunnel={
- 'src': cls.pg0.local_ip4,
- 'dst': cls.pg0.remote_ip4,
- 'vni': cls.single_tunnel_vni,
- 'instance': INVALID_INDEX,
- 'mcast_sw_if_index': INVALID_INDEX,
- 'mode': 1,
- },
- is_add=1
- )
- cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index,
- bd_id=cls.single_tunnel_bd)
- cls.vapi.sw_interface_set_l2_bridge(
- rx_sw_if_index=cls.pg1.sw_if_index,
- bd_id=cls.single_tunnel_bd)
-
- # Setup vni 2 to test multicast flooding
- cls.n_ucast_tunnels = 2
- # Setup vni 3 to test unicast flooding
- cls.ucast_flood_bd = 3
- cls.create_vxlan_gbp_flood_test_bd(cls.ucast_flood_bd,
- cls.n_ucast_tunnels)
- cls.vapi.sw_interface_set_l2_bridge(
- rx_sw_if_index=cls.pg3.sw_if_index,
- bd_id=cls.ucast_flood_bd)
- except Exception:
- super(TestVxlanGbp, cls).tearDownClass()
- raise
-
- @classmethod
- def tearDownClass(cls):
- super(TestVxlanGbp, cls).tearDownClass()
-
- def assert_eq_pkts(self, pkt1, pkt2):
- """ Verify the Ether, IP, UDP, payload are equal in both
- packets
- """
- self.assertEqual(pkt1[Ether].src, pkt2[Ether].src)
- self.assertEqual(pkt1[Ether].dst, pkt2[Ether].dst)
- self.assertEqual(pkt1[IP].src, pkt2[IP].src)
- self.assertEqual(pkt1[IP].dst, pkt2[IP].dst)
- self.assertEqual(pkt1[UDP].sport, pkt2[UDP].sport)
- self.assertEqual(pkt1[UDP].dport, pkt2[UDP].dport)
- self.assertEqual(pkt1[Raw], pkt2[Raw])
-
- def test_decap(self):
- """ Decapsulation test
- Send encapsulated frames from pg0
- Verify receipt of decapsulated frames on pg1
- """
- encapsulated_pkt = self.encapsulate(self.frame_request,
- self.single_tunnel_vni)
-
- self.pg0.add_stream([encapsulated_pkt, ])
-
- self.pg1.enable_capture()
-
- self.pg_start()
-
- # Pick first received frame and check if it's the non-encapsulated
- # frame
- out = self.pg1.get_capture(1)
- pkt = out[0]
- self.assert_eq_pkts(pkt, self.frame_request)
-
- def test_encap(self):
- """ Encapsulation test
- Send frames from pg1
- Verify receipt of encapsulated frames on pg0
- """
- self.pg1.add_stream([self.frame_reply])
-
- self.pg0.enable_capture()
-
- self.pg_start()
-
- # Pick first received frame and check if it's correctly encapsulated.
- out = self.pg0.get_capture(1)
- pkt = out[0]
- self.check_encapsulation(pkt, self.single_tunnel_vni)
-
- payload = self.decapsulate(pkt)
- self.assert_eq_pkts(payload, self.frame_reply)
-
- def test_ucast_flood(self):
- """ Unicast flood test
- Send frames from pg3
- Verify receipt of encapsulated frames on pg0
- """
- self.pg3.add_stream([self.frame_reply])
-
- self.pg0.enable_capture()
-
- self.pg_start()
-
- # Get packet from each tunnel and assert it's correctly encapsulated.
- out = self.pg0.get_capture(self.n_ucast_tunnels)
- for pkt in out:
- self.check_encapsulation(pkt, self.ucast_flood_bd, True)
- payload = self.decapsulate(pkt)
- self.assert_eq_pkts(payload, self.frame_reply)
-
- def test_encap_big_packet(self):
- """ Encapsulation test send big frame from pg1
- Verify receipt of encapsulated frames on pg0
- """
-
- self.vapi.sw_interface_set_mtu(self.pg0.sw_if_index, [1500, 0, 0, 0])
-
- frame = (Ether(src='00:00:00:00:00:02', dst='00:00:00:00:00:01') /
- IP(src='4.3.2.1', dst='1.2.3.4') /
- UDP(sport=20000, dport=10000) /
- Raw(b'\xa5' * 1450))
-
- self.pg1.add_stream([frame])
-
- self.pg0.enable_capture()
-
- self.pg_start()
-
- # Pick first received frame and check if it's correctly encapsulated.
- out = self.pg0.get_capture(2)
- pkt = reassemble4_ether(out)
- self.check_encapsulation(pkt, self.single_tunnel_vni)
-
- payload = self.decapsulate(pkt)
- self.assert_eq_pkts(payload, frame)
-
-# Method to define VPP actions before tear down of the test case.
-# Overrides tearDown method in VppTestCase class.
-# @param self The object pointer.
- def tearDown(self):
- super(TestVxlanGbp, self).tearDown()
-
- def show_commands_at_teardown(self):
- self.logger.info(self.vapi.cli("show bridge-domain 1 detail"))
- self.logger.info(self.vapi.cli("show bridge-domain 3 detail"))
- self.logger.info(self.vapi.cli("show vxlan-gbp tunnel"))
- self.logger.info(self.vapi.cli("show error"))
-
-
-if __name__ == '__main__':
- unittest.main(testRunner=VppTestRunner)
diff --git a/test/test_vxlan_gpe.py b/test/test_vxlan_gpe.py
deleted file mode 100644
index c5d6bf07f7c..00000000000
--- a/test/test_vxlan_gpe.py
+++ /dev/null
@@ -1,265 +0,0 @@
-#!/usr/bin/env python3
-
-import socket
-from util import ip4_range
-import unittest
-from framework import VppTestCase, VppTestRunner, running_extended_tests
-from template_bd import BridgeDomain
-
-from scapy.layers.l2 import Ether
-from scapy.packet import Raw
-from scapy.layers.inet import IP, UDP
-from scapy.layers.vxlan import VXLAN
-
-import util
-from vpp_ip_route import VppIpRoute, VppRoutePath
-
-from vpp_ip import INVALID_INDEX
-
-
-@unittest.skipUnless(running_extended_tests, "part of extended tests")
-class TestVxlanGpe(BridgeDomain, VppTestCase):
- """ VXLAN-GPE Test Case """
-
- def __init__(self, *args):
- BridgeDomain.__init__(self)
- VppTestCase.__init__(self, *args)
-
- def encapsulate(self, pkt, vni):
- """
- Encapsulate the original payload frame by adding VXLAN-GPE header
- with its UDP, IP and Ethernet fields
- """
- return (Ether(src=self.pg0.remote_mac, dst=self.pg0.local_mac) /
- IP(src=self.pg0.remote_ip4, dst=self.pg0.local_ip4) /
- UDP(sport=self.dport, dport=self.dport, chksum=0) /
- VXLAN(vni=vni, flags=self.flags) /
- pkt)
-
- def ip_range(self, start, end):
- """ range of remote ip's """
- return ip4_range(self.pg0.remote_ip4, start, end)
-
- def encap_mcast(self, pkt, src_ip, src_mac, vni):
- """
- Encapsulate the original payload frame by adding VXLAN-GPE header
- with its UDP, IP and Ethernet fields
- """
- return (Ether(src=src_mac, dst=self.mcast_mac) /
- IP(src=src_ip, dst=self.mcast_ip4) /
- UDP(sport=self.dport, dport=self.dport, chksum=0) /
- VXLAN(vni=vni, flags=self.flags) /
- pkt)
-
- def decapsulate(self, pkt):
- """
- Decapsulate the original payload frame by removing VXLAN-GPE header
- """
- # check if is set I and P flag
- self.assertEqual(pkt[VXLAN].flags, 0x0c)
- return pkt[VXLAN].payload
-
- # Method for checking VXLAN-GPE encapsulation.
- #
- def check_encapsulation(self, pkt, vni, local_only=False, mcast_pkt=False):
- # Verify source MAC is VPP_MAC and destination MAC is MY_MAC resolved
- # by VPP using ARP.
- self.assertEqual(pkt[Ether].src, self.pg0.local_mac)
- if not local_only:
- if not mcast_pkt:
- self.assertEqual(pkt[Ether].dst, self.pg0.remote_mac)
- else:
- self.assertEqual(pkt[Ether].dst, type(self).mcast_mac)
- # Verify VXLAN-GPE tunnel src IP is VPP_IP and dst IP is MY_IP.
- self.assertEqual(pkt[IP].src, self.pg0.local_ip4)
- if not local_only:
- if not mcast_pkt:
- self.assertEqual(pkt[IP].dst, self.pg0.remote_ip4)
- else:
- self.assertEqual(pkt[IP].dst, type(self).mcast_ip4)
- # Verify UDP destination port is VXLAN-GPE 4790, source UDP port
- # could be arbitrary.
- self.assertEqual(pkt[UDP].dport, type(self).dport)
- # Verify UDP checksum
- self.assert_udp_checksum_valid(pkt)
- # Verify VNI
- self.assertEqual(pkt[VXLAN].vni, vni)
-
- @classmethod
- def create_vxlan_gpe_flood_test_bd(cls, vni, n_ucast_tunnels):
- # Create 10 ucast vxlan tunnels under bd
- ip_range_start = 10
- ip_range_end = ip_range_start + n_ucast_tunnels
- next_hop_address = cls.pg0.remote_ip4
- for dest_ip4 in ip4_range(next_hop_address, ip_range_start,
- ip_range_end):
- # add host route so dest_ip4n will not be resolved
- rip = VppIpRoute(cls, dest_ip4, 32,
- [VppRoutePath(next_hop_address,
- INVALID_INDEX)],
- register=False)
- rip.add_vpp_config()
-
- r = cls.vapi.vxlan_gpe_add_del_tunnel(
- src_addr=cls.pg0.local_ip4,
- dst_addr=dest_ip4,
- vni=vni)
- cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index,
- bd_id=vni)
-
- @classmethod
- def add_del_shared_mcast_dst_load(cls, is_add):
- """
- add or del tunnels sharing the same mcast dst
- to test vxlan_gpe ref_count mechanism
- """
- n_shared_dst_tunnels = 20
- vni_start = 1000
- vni_end = vni_start + n_shared_dst_tunnels
- for vni in range(vni_start, vni_end):
- r = cls.vapi.vxlan_gpe_add_del_tunnel(
- local=cls.pg0.local_ip4,
- remote=cls.mcast_ip4,
- mcast_sw_if_index=1,
- vni=vni,
- is_add=is_add)
- if r.sw_if_index == 0xffffffff:
- raise ValueError("bad sw_if_index: ~0")
-
- @classmethod
- def add_shared_mcast_dst_load(cls):
- cls.add_del_shared_mcast_dst_load(is_add=1)
-
- @classmethod
- def del_shared_mcast_dst_load(cls):
- cls.add_del_shared_mcast_dst_load(is_add=0)
-
- @classmethod
- def add_del_mcast_tunnels_load(cls, is_add):
- """
- add or del tunnels to test vxlan_gpe stability
- """
- n_distinct_dst_tunnels = 20
- ip_range_start = 10
- ip_range_end = ip_range_start + n_distinct_dst_tunnels
- for dest_ip4 in ip4_range(cls.mcast_ip4, ip_range_start,
- ip_range_end):
- vni = int(dest_ip4.split(".")[3])
- cls.vapi.vxlan_gpe_add_del_tunnel(
- src_addr=cls.pg0.local_ip4,
- dst_addr=dest_ip4,
- mcast_sw_if_index=1,
- vni=vni,
- is_add=is_add)
-
- @classmethod
- def add_mcast_tunnels_load(cls):
- cls.add_del_mcast_tunnels_load(is_add=1)
-
- @classmethod
- def del_mcast_tunnels_load(cls):
- cls.add_del_mcast_tunnels_load(is_add=0)
-
- # Class method to start the VXLAN-GPE test case.
- # Overrides setUpClass method in VppTestCase class.
- # Python try..except statement is used to ensure that the tear down of
- # the class will be executed even if exception is raised.
- # @param cls The class pointer.
- @classmethod
- def setUpClass(cls):
- super(TestVxlanGpe, cls).setUpClass()
-
- try:
- cls.dport = 4790
- cls.flags = 0x0c
-
- # Create 2 pg interfaces.
- cls.create_pg_interfaces(range(4))
- for pg in cls.pg_interfaces:
- pg.admin_up()
-
- # Configure IPv4 addresses on VPP pg0.
- cls.pg0.config_ip4()
-
- # Resolve MAC address for VPP's IP address on pg0.
- cls.pg0.resolve_arp()
-
- # Our Multicast address
- cls.mcast_ip4 = '239.1.1.1'
- cls.mcast_mac = util.mcast_ip_to_mac(cls.mcast_ip4)
-
- # Create VXLAN-GPE VTEP on VPP pg0, and put vxlan_gpe_tunnel0
- # and pg1 into BD.
- cls.single_tunnel_vni = 0xabcde
- cls.single_tunnel_bd = 11
- r = cls.vapi.vxlan_gpe_add_del_tunnel(
- src_addr=cls.pg0.local_ip4,
- dst_addr=cls.pg0.remote_ip4,
- vni=cls.single_tunnel_vni)
- cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index,
- bd_id=cls.single_tunnel_bd)
- cls.vapi.sw_interface_set_l2_bridge(
- rx_sw_if_index=cls.pg1.sw_if_index, bd_id=cls.single_tunnel_bd)
-
- # Setup vni 2 to test multicast flooding
- cls.n_ucast_tunnels = 10
- cls.mcast_flood_bd = 12
- cls.create_vxlan_gpe_flood_test_bd(cls.mcast_flood_bd,
- cls.n_ucast_tunnels)
- r = cls.vapi.vxlan_gpe_add_del_tunnel(
- src_addr=cls.pg0.local_ip4,
- dst_addr=cls.mcast_ip4,
- mcast_sw_if_index=1,
- vni=cls.mcast_flood_bd)
- cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index,
- bd_id=cls.mcast_flood_bd)
- cls.vapi.sw_interface_set_l2_bridge(
- rx_sw_if_index=cls.pg2.sw_if_index, bd_id=cls.mcast_flood_bd)
-
- # Add and delete mcast tunnels to check stability
- cls.add_shared_mcast_dst_load()
- cls.add_mcast_tunnels_load()
- cls.del_shared_mcast_dst_load()
- cls.del_mcast_tunnels_load()
-
- # Setup vni 3 to test unicast flooding
- cls.ucast_flood_bd = 13
- cls.create_vxlan_gpe_flood_test_bd(cls.ucast_flood_bd,
- cls.n_ucast_tunnels)
- cls.vapi.sw_interface_set_l2_bridge(
- rx_sw_if_index=cls.pg3.sw_if_index, bd_id=cls.ucast_flood_bd)
- except Exception:
- super(TestVxlanGpe, cls).tearDownClass()
- raise
-
- @classmethod
- def tearDownClass(cls):
- super(TestVxlanGpe, cls).tearDownClass()
-
- @unittest.skip("test disabled for vxlan-gpe")
- def test_mcast_flood(self):
- """ inherited from BridgeDomain """
- pass
-
- @unittest.skip("test disabled for vxlan-gpe")
- def test_mcast_rcv(self):
- """ inherited from BridgeDomain """
- pass
-
- # Method to define VPP actions before tear down of the test case.
- # Overrides tearDown method in VppTestCase class.
- # @param self The object pointer.
- def tearDown(self):
- super(TestVxlanGpe, self).tearDown()
-
- def show_commands_at_teardown(self):
- self.logger.info(self.vapi.cli("show bridge-domain 11 detail"))
- self.logger.info(self.vapi.cli("show bridge-domain 12 detail"))
- self.logger.info(self.vapi.cli("show bridge-domain 13 detail"))
- self.logger.info(self.vapi.cli("show int"))
- self.logger.info(self.vapi.cli("show vxlan-gpe"))
- self.logger.info(self.vapi.cli("show trace"))
-
-
-if __name__ == '__main__':
- unittest.main(testRunner=VppTestRunner)
diff --git a/test/vpp_vxlan_gbp_tunnel.py b/test/vpp_vxlan_gbp_tunnel.py
deleted file mode 100644
index 22555858d12..00000000000
--- a/test/vpp_vxlan_gbp_tunnel.py
+++ /dev/null
@@ -1,83 +0,0 @@
-
-from vpp_interface import VppInterface
-from vpp_papi import VppEnum
-
-
-INDEX_INVALID = 0xffffffff
-
-
-def find_vxlan_gbp_tunnel(test, src, dst, vni):
- ts = test.vapi.vxlan_gbp_tunnel_dump(INDEX_INVALID)
- for t in ts:
- if src == str(t.tunnel.src) and \
- dst == str(t.tunnel.dst) and \
- t.tunnel.vni == vni:
- return t.tunnel.sw_if_index
- return INDEX_INVALID
-
-
-class VppVxlanGbpTunnel(VppInterface):
- """
- VPP VXLAN GBP interface
- """
-
- def __init__(self, test, src, dst, vni, mcast_itf=None, mode=None,
- is_ipv6=None, encap_table_id=None, instance=0xffffffff):
- """ Create VXLAN-GBP Tunnel interface """
- super(VppVxlanGbpTunnel, self).__init__(test)
- self.src = src
- self.dst = dst
- self.vni = vni
- self.mcast_itf = mcast_itf
- self.ipv6 = is_ipv6
- self.encap_table_id = encap_table_id
- self.instance = instance
- if not mode:
- self.mode = (VppEnum.vl_api_vxlan_gbp_api_tunnel_mode_t.
- VXLAN_GBP_API_TUNNEL_MODE_L2)
- else:
- self.mode = mode
-
- def add_vpp_config(self):
- mcast_sw_if_index = INDEX_INVALID
- if (self.mcast_itf):
- mcast_sw_if_index = self.mcast_itf.sw_if_index
- reply = self.test.vapi.vxlan_gbp_tunnel_add_del(
- is_add=1,
- tunnel={
- 'src': self.src,
- 'dst': self.dst,
- 'mode': self.mode,
- 'vni': self.vni,
- 'mcast_sw_if_index': mcast_sw_if_index,
- 'encap_table_id': self.encap_table_id,
- 'instance': self.instance
- })
- self.set_sw_if_index(reply.sw_if_index)
- self._test.registry.register(self, self._test.logger)
-
- def remove_vpp_config(self):
- mcast_sw_if_index = INDEX_INVALID
- if (self.mcast_itf):
- mcast_sw_if_index = self.mcast_itf.sw_if_index
- self.test.vapi.vxlan_gbp_tunnel_add_del(
- is_add=0,
- tunnel={
- 'src': self.src,
- 'dst': self.dst,
- 'mode': self.mode,
- 'vni': self.vni,
- 'mcast_sw_if_index': mcast_sw_if_index,
- 'encap_table_id': self.encap_table_id,
- 'instance': self.instance,
- })
-
- def query_vpp_config(self):
- return (INDEX_INVALID != find_vxlan_gbp_tunnel(self._test,
- self.src,
- self.dst,
- self.vni))
-
- def object_id(self):
- return "vxlan-gbp-%d-%d-%s-%s" % (self.sw_if_index, self.vni,
- self.src, self.dst)
diff --git a/test/vpp_vxlan_tunnel.py b/test/vpp_vxlan_tunnel.py
deleted file mode 100644
index dce5ab86c07..00000000000
--- a/test/vpp_vxlan_tunnel.py
+++ /dev/null
@@ -1,86 +0,0 @@
-from vpp_interface import VppInterface
-from vpp_papi import VppEnum
-
-
-INDEX_INVALID = 0xffffffff
-DEFAULT_PORT = 4789
-UNDEFINED_PORT = 0
-
-
-def find_vxlan_tunnel(test, src, dst, s_port, d_port, vni):
- ts = test.vapi.vxlan_tunnel_v2_dump(INDEX_INVALID)
-
- src_port = DEFAULT_PORT
- if s_port != UNDEFINED_PORT:
- src_port = s_port
-
- dst_port = DEFAULT_PORT
- if d_port != UNDEFINED_PORT:
- dst_port = d_port
-
- for t in ts:
- if src == str(t.src_address) and \
- dst == str(t.dst_address) and \
- src_port == t.src_port and \
- dst_port == t.dst_port and \
- t.vni == vni:
- return t.sw_if_index
- return INDEX_INVALID
-
-
-class VppVxlanTunnel(VppInterface):
- """
- VPP VXLAN interface
- """
-
- def __init__(self, test, src, dst, vni,
- src_port=UNDEFINED_PORT, dst_port=UNDEFINED_PORT,
- mcast_itf=None,
- mcast_sw_if_index=INDEX_INVALID,
- decap_next_index=INDEX_INVALID,
- encap_vrf_id=None, instance=0xffffffff):
- """ Create VXLAN Tunnel interface """
- super(VppVxlanTunnel, self).__init__(test)
- self.src = src
- self.dst = dst
- self.vni = vni
- self.src_port = src_port
- self.dst_port = dst_port
- self.mcast_itf = mcast_itf
- self.mcast_sw_if_index = mcast_sw_if_index
- self.encap_vrf_id = encap_vrf_id
- self.decap_next_index = decap_next_index
- self.instance = instance
-
- if (self.mcast_itf):
- self.mcast_sw_if_index = self.mcast_itf.sw_if_index
-
- def add_vpp_config(self):
- reply = self.test.vapi.vxlan_add_del_tunnel_v2(
- is_add=1, src_address=self.src, dst_address=self.dst, vni=self.vni,
- src_port=self.src_port, dst_port=self.dst_port,
- mcast_sw_if_index=self.mcast_sw_if_index,
- encap_vrf_id=self.encap_vrf_id,
- instance=self.instance, decap_next_index=self.decap_next_index)
- self.set_sw_if_index(reply.sw_if_index)
- self._test.registry.register(self, self._test.logger)
-
- def remove_vpp_config(self):
- self.test.vapi.vxlan_add_del_tunnel_v2(
- is_add=0, src_address=self.src, dst_address=self.dst, vni=self.vni,
- src_port=self.src_port, dst_port=self.dst_port,
- mcast_sw_if_index=self.mcast_sw_if_index,
- encap_vrf_id=self.encap_vrf_id, instance=self.instance,
- decap_next_index=self.decap_next_index)
-
- def query_vpp_config(self):
- return (INDEX_INVALID != find_vxlan_tunnel(self._test,
- self.src,
- self.dst,
- self.src_port,
- self.dst_port,
- self.vni))
-
- def object_id(self):
- return "vxlan-%d-%d-%s-%s" % (self.sw_if_index, self.vni,
- self.src, self.dst)