X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=test%2Ftest_gbp.py;h=0580fff2b6f257c90489c25c65ef1fb6cdef3aa4;hb=bc764c8bc26282445901dc9aa32223a13f18e8dc;hp=33de9b574bb6ac56981715975739fe7415ea1c76;hpb=fe52dea08f3ebf3c95a33266c7fa15da33f4e9d0;p=vpp.git diff --git a/test/test_gbp.py b/test/test_gbp.py index 33de9b574bb..0580fff2b6f 100644 --- a/test/test_gbp.py +++ b/test/test_gbp.py @@ -17,7 +17,8 @@ from framework import VppTestCase, VppTestRunner from vpp_object import VppObject from vpp_interface import VppInterface from vpp_ip_route import VppIpRoute, VppRoutePath, VppIpTable, \ - VppIpInterfaceAddress, VppIpInterfaceBind, find_route + VppIpInterfaceAddress, VppIpInterfaceBind, find_route, FibPathProto, \ + FibPathType from vpp_l2 import VppBridgeDomain, VppBridgeDomainPort, \ VppBridgeDomainArpEntry, VppL2FibEntry, find_bridge_domain_port, VppL2Vtr from vpp_sub_interface import L2_VTR_OP, VppDot1QSubint @@ -840,10 +841,10 @@ class TestGBP(VppTestCase): # add the BD ARP termination entry for BVI IP epg.bd_arp_ip4 = VppBridgeDomainArpEntry(self, epg.bd.bd, str(self.router_mac), - epg.bvi_ip4) + epg.bvi_ip4.address) epg.bd_arp_ip6 = VppBridgeDomainArpEntry(self, epg.bd.bd, str(self.router_mac), - epg.bvi_ip6) + epg.bvi_ip6.address) epg.bd_arp_ip4.add_vpp_config() epg.bd_arp_ip6.add_vpp_config() @@ -916,17 +917,18 @@ class TestGBP(VppTestCase): # add the BD ARP termination entry for floating IP for fip in ep.fips: - ba = VppBridgeDomainArpEntry(self, epg_nat.bd.bd, ep.mac, fip) + ba = VppBridgeDomainArpEntry(self, epg_nat.bd.bd, ep.mac, + fip.address) ba.add_vpp_config() # floating IPs route via EPG recirc - r = VppIpRoute(self, fip.address, fip.length, - [VppRoutePath(fip.address, - ep.recirc.recirc.sw_if_index, - is_dvr=1, - proto=fip.dpo_proto)], - table_id=20, - is_ip6=fip.is_ip6) + r = VppIpRoute( + self, fip.address, fip.length, + [VppRoutePath(fip.address, + ep.recirc.recirc.sw_if_index, + type=FibPathType.FIB_PATH_TYPE_DVR, + proto=fip.dpo_proto)], + table_id=20) r.add_vpp_config() # L2 FIB entries in the NAT EPG BD to bridge the packets from @@ -2062,7 +2064,7 @@ class TestGBP(VppTestCase): # add the BD ARP termination entry for BVI IP epg.bd_arp_ip4 = VppBridgeDomainArpEntry(self, epg.bd.bd, str(self.router_mac), - epg.bvi_ip4) + epg.bvi_ip4.address) epg.bd_arp_ip4.add_vpp_config() # EPG in VPP @@ -2438,7 +2440,7 @@ class TestGBP(VppTestCase): def test_gbp_learn_l3(self): """ GBP L3 Endpoint Learning """ - self.vapi.cli("set logging class gbp debug") + self.vapi.cli("set logging class gbp level debug") ep_flags = VppEnum.vl_api_gbp_endpoint_flags_t routed_dst_mac = "00:0c:0c:0c:0c:0c" @@ -2877,7 +2879,7 @@ class TestGBP(VppTestCase): def test_gbp_redirect(self): """ GBP Endpoint Redirect """ - self.vapi.cli("set logging class gbp debug") + self.vapi.cli("set logging class gbp level debug") ep_flags = VppEnum.vl_api_gbp_endpoint_flags_t routed_dst_mac = "00:0c:0c:0c:0c:0c" @@ -3449,7 +3451,7 @@ class TestGBP(VppTestCase): """ GBP L3 Out """ ep_flags = VppEnum.vl_api_gbp_endpoint_flags_t - self.vapi.cli("set logging class gbp debug") + self.vapi.cli("set logging class gbp level debug") routed_dst_mac = "00:0c:0c:0c:0c:0c" routed_src_mac = "00:22:bd:f8:19:ff" @@ -3529,6 +3531,9 @@ class TestGBP(VppTestCase): vlan_101 = VppDot1QSubint(self, self.pg0, 101) vlan_101.admin_up() VppL2Vtr(self, vlan_101, L2_VTR_OP.L2_POP_1).add_vpp_config() + # vlan_102 is not poped + vlan_102 = VppDot1QSubint(self, self.pg0, 102) + vlan_102.admin_up() ext_itf = VppGbpExtItf(self, self.loop0, bd1, rd1) ext_itf.add_vpp_config() @@ -3557,6 +3562,12 @@ class TestGBP(VppTestCase): "2001:10::2", "3001::2", ep_flags.GBP_API_ENDPOINT_FLAG_EXTERNAL) eep2.add_vpp_config() + eep3 = VppGbpEndpoint(self, vlan_102, + epg_220, None, + "10.0.0.3", "11.0.0.3", + "2001:10::3", "3001::3", + ep_flags.GBP_API_ENDPOINT_FLAG_EXTERNAL) + eep3.add_vpp_config() # # A remote external endpoint @@ -3581,6 +3592,16 @@ class TestGBP(VppTestCase): hwsrc=eep1.mac, hwdst="ff:ff:ff:ff:ff:ff")) rxs = self.send_and_expect(self.pg0, p_arp * 1, self.pg0) + # + # ARP packet from host in remote subnet are accepted and replied to + # + p_arp = (Ether(src=vlan_102.remote_mac, dst="ff:ff:ff:ff:ff:ff") / + Dot1Q(vlan=102) / + ARP(op="who-has", + psrc="10.0.0.17", pdst="10.0.0.128", + hwsrc=vlan_102.remote_mac, hwdst="ff:ff:ff:ff:ff:ff")) + rxs = self.send_and_expect(self.pg0, p_arp * 1, self.pg0) + # # packets destined to unknown addresses in the BVI's subnet # are ARP'd for @@ -3661,6 +3682,20 @@ class TestGBP(VppTestCase): self.assertEqual(rx[Ether].dst, eep2.mac) self.assertEqual(rx[Dot1Q].vlan, 101) + # + # local EP pings router w/o vlan tag poped + # + p = (Ether(src=eep3.mac, dst=str(self.router_mac)) / + Dot1Q(vlan=102) / + IP(src=eep3.ip4.address, dst="10.0.0.128") / + ICMP(type='echo-request')) + + rxs = self.send_and_expect(self.pg0, p * 1, self.pg0) + + for rx in rxs: + self.assertEqual(rx[Ether].src, str(self.router_mac)) + self.assertEqual(rx[Ether].dst, vlan_102.remote_mac) + # # A subnet reachable through the external EP1 #