diff options
-rw-r--r-- | src/plugins/svs/test/test_svs.py | 105 | ||||
-rw-r--r-- | src/vnet/gso/test/test_gso.py | 37 | ||||
-rw-r--r-- | test/test_neighbor.py | 18 | ||||
-rw-r--r-- | test/vpp_interface.py | 4 | ||||
-rw-r--r-- | test/vpp_papi_provider.py | 76 |
5 files changed, 99 insertions, 141 deletions
diff --git a/src/plugins/svs/test/test_svs.py b/src/plugins/svs/test/test_svs.py index 3daf7a50a28..db4ad8078e0 100644 --- a/src/plugins/svs/test/test_svs.py +++ b/src/plugins/svs/test/test_svs.py @@ -106,24 +106,33 @@ class TestSVS(VppTestCase): for table_id in table_ids: self.vapi.svs_table_add_del( - VppEnum.vl_api_address_family_t.ADDRESS_IP4, table_id) + is_add=1, + af=VppEnum.vl_api_address_family_t.ADDRESS_IP4, + table_id=table_id) # # map X.0.0.0/8 to each SVS table for lookup in table X # for i in range(1, 4): self.vapi.svs_route_add_del( - table_id, "%d.0.0.0/8" % i, i) + is_add=1, + prefix="%d.0.0.0/8" % i, + table_id=table_id, + source_table_id=i) # # Enable SVS on pg0/pg1 using table 1001/1002 # self.vapi.svs_enable_disable( - VppEnum.vl_api_address_family_t.ADDRESS_IP4, table_ids[0], - self.pg0.sw_if_index) + is_enable=1, + af=VppEnum.vl_api_address_family_t.ADDRESS_IP4, + table_id=table_ids[0], + sw_if_index=self.pg0.sw_if_index) self.vapi.svs_enable_disable( - VppEnum.vl_api_address_family_t.ADDRESS_IP4, table_ids[1], - self.pg1.sw_if_index) + is_enable=1, + af=VppEnum.vl_api_address_family_t.ADDRESS_IP4, + table_id=table_ids[1], + sw_if_index=self.pg1.sw_if_index) # # now all the packets should be delivered out the respective interface @@ -167,25 +176,28 @@ class TestSVS(VppTestCase): # cleanup # self.vapi.svs_enable_disable( - VppEnum.vl_api_address_family_t.ADDRESS_IP4, - table_ids[0], - self.pg0.sw_if_index, - is_enable=0) + is_enable=0, + af=VppEnum.vl_api_address_family_t.ADDRESS_IP4, + table_id=table_ids[0], + sw_if_index=self.pg0.sw_if_index) self.vapi.svs_enable_disable( - VppEnum.vl_api_address_family_t.ADDRESS_IP4, - table_ids[1], - self.pg1.sw_if_index, - is_enable=0) + is_enable=0, + af=VppEnum.vl_api_address_family_t.ADDRESS_IP4, + table_id=table_ids[1], + sw_if_index=self.pg1.sw_if_index) for table_id in table_ids: for i in range(1, 4): self.vapi.svs_route_add_del( - table_id, "%d.0.0.0/8" % i, - 0, is_add=0) + is_add=0, + prefix="%d.0.0.0/8" % i, + table_id=table_id, + source_table_id=0) + self.vapi.svs_table_add_del( - VppEnum.vl_api_address_family_t.ADDRESS_IP4, - table_id, - is_add=0) + is_add=0, + af=VppEnum.vl_api_address_family_t.ADDRESS_IP4, + table_id=table_id) def test_svs6(self): """ Source VRF Select IP6 """ @@ -233,27 +245,33 @@ class TestSVS(VppTestCase): for table_id in table_ids: self.vapi.svs_table_add_del( - VppEnum.vl_api_address_family_t.ADDRESS_IP6, table_id) + is_add=1, + af=VppEnum.vl_api_address_family_t.ADDRESS_IP6, + table_id=table_id) # # map X.0.0.0/8 to each SVS table for lookup in table X # for i in range(1, 4): self.vapi.svs_route_add_del( - table_id, "2001:%d::/32" % i, - i) + is_add=1, + prefix="2001:%d::/32" % i, + table_id=table_id, + source_table_id=i) # # Enable SVS on pg0/pg1 using table 1001/1002 # self.vapi.svs_enable_disable( - VppEnum.vl_api_address_family_t.ADDRESS_IP6, - table_ids[0], - self.pg0.sw_if_index) + is_enable=1, + af=VppEnum.vl_api_address_family_t.ADDRESS_IP6, + table_id=table_ids[0], + sw_if_index=self.pg0.sw_if_index) self.vapi.svs_enable_disable( - VppEnum.vl_api_address_family_t.ADDRESS_IP6, - table_ids[1], - self.pg1.sw_if_index) + is_enable=1, + af=VppEnum.vl_api_address_family_t.ADDRESS_IP6, + table_id=table_ids[1], + sw_if_index=self.pg1.sw_if_index) # # now all the packets should be delivered out the respective interface @@ -297,25 +315,28 @@ class TestSVS(VppTestCase): # cleanup # self.vapi.svs_enable_disable( - VppEnum.vl_api_address_family_t.ADDRESS_IP6, - table_ids[0], - self.pg0.sw_if_index, - is_enable=0) + is_enable=0, + af=VppEnum.vl_api_address_family_t.ADDRESS_IP6, + table_id=table_ids[0], + sw_if_index=self.pg0.sw_if_index) self.vapi.svs_enable_disable( - VppEnum.vl_api_address_family_t.ADDRESS_IP6, - table_ids[1], - self.pg1.sw_if_index, - is_enable=0) + is_enable=0, + af=VppEnum.vl_api_address_family_t.ADDRESS_IP6, + table_id=table_ids[1], + sw_if_index=self.pg1.sw_if_index) + for table_id in table_ids: for i in range(1, 4): self.vapi.svs_route_add_del( - table_id, "2001:%d::/32" % i, - 0, is_add=0) - self.vapi.svs_table_add_del( - VppEnum.vl_api_address_family_t.ADDRESS_IP6, - table_id, - is_add=0) + is_add=0, + prefix="2001:%d::/32" % i, + table_id=table_id, + source_table_id=0) + self.vapi.svs_table_add_del( + is_add=0, + af=VppEnum.vl_api_address_family_t.ADDRESS_IP6, + table_id=table_id) if __name__ == '__main__': unittest.main(testRunner=VppTestRunner) diff --git a/src/vnet/gso/test/test_gso.py b/src/vnet/gso/test/test_gso.py index ba830049e64..094600eb74c 100644 --- a/src/vnet/gso/test/test_gso.py +++ b/src/vnet/gso/test/test_gso.py @@ -148,7 +148,8 @@ class TestGSO(VppTestCase): # Send jumbo frame with gso enabled and DF bit is set # input and output interfaces support GSO # - self.vapi.feature_gso_enable_disable(self.pg3.sw_if_index) + self.vapi.feature_gso_enable_disable(sw_if_index=self.pg3.sw_if_index, + enable_disable=1) p41 = (Ether(src=self.pg2.remote_mac, dst=self.pg2.local_mac) / IP(src=self.pg2.remote_ip4, dst=self.pg3.remote_ip4, flags='DF') / @@ -190,7 +191,8 @@ class TestGSO(VppTestCase): # and DF bit is set. GSO packet will be chunked into gso_size # data payload # - self.vapi.feature_gso_enable_disable(self.pg0.sw_if_index) + self.vapi.feature_gso_enable_disable(sw_if_index=self.pg0.sw_if_index, + enable_disable=1) p42 = (Ether(src=self.pg2.remote_mac, dst=self.pg2.local_mac) / IP(src=self.pg2.remote_ip4, dst=self.pg0.remote_ip4, flags='DF') / @@ -241,7 +243,8 @@ class TestGSO(VppTestCase): # and DF bit is unset. GSO packet will be fragmented. # self.vapi.sw_interface_set_mtu(self.pg1.sw_if_index, [576, 0, 0, 0]) - self.vapi.feature_gso_enable_disable(self.pg1.sw_if_index) + self.vapi.feature_gso_enable_disable(sw_if_index=self.pg1.sw_if_index, + enable_disable=1) p43 = (Ether(src=self.pg2.remote_mac, dst=self.pg2.local_mac) / IP(src=self.pg2.remote_ip4, dst=self.pg1.remote_ip4) / @@ -331,9 +334,9 @@ class TestGSO(VppTestCase): size += payload_len self.assertEqual(size, 65200*5) - self.vapi.feature_gso_enable_disable(self.pg0.sw_if_index, + self.vapi.feature_gso_enable_disable(sw_if_index=self.pg0.sw_if_index, enable_disable=0) - self.vapi.feature_gso_enable_disable(self.pg1.sw_if_index, + self.vapi.feature_gso_enable_disable(sw_if_index=self.pg1.sw_if_index, enable_disable=0) def test_gso_vxlan(self): @@ -353,7 +356,8 @@ class TestGSO(VppTestCase): rx_sw_if_index=self.vxlan.sw_if_index, bd_id=self.single_tunnel_bd) self.vapi.sw_interface_set_l2_bridge( rx_sw_if_index=self.pg2.sw_if_index, bd_id=self.single_tunnel_bd) - self.vapi.feature_gso_enable_disable(self.pg0.sw_if_index) + self.vapi.feature_gso_enable_disable(sw_if_index=self.pg0.sw_if_index, + enable_disable=1) # # IPv4/IPv4 - VXLAN @@ -493,7 +497,7 @@ class TestGSO(VppTestCase): # self.vxlan2.remove_vpp_config() - self.vapi.feature_gso_enable_disable(self.pg0.sw_if_index, + self.vapi.feature_gso_enable_disable(sw_if_index=self.pg0.sw_if_index, enable_disable=0) def test_gso_ipip(self): @@ -503,7 +507,8 @@ class TestGSO(VppTestCase): # Send jumbo frame with gso enabled only on input interface and # create IPIP tunnel on VPP pg0. # - self.vapi.feature_gso_enable_disable(self.pg0.sw_if_index) + self.vapi.feature_gso_enable_disable(sw_if_index=self.pg0.sw_if_index, + enable_disable=1) # # enable ipip4 @@ -588,9 +593,11 @@ class TestGSO(VppTestCase): # create IPIP tunnel on VPP pg0. Enable gso feature node on ipip # tunnel - IPSec use case # - self.vapi.feature_gso_enable_disable(self.pg0.sw_if_index, + self.vapi.feature_gso_enable_disable(sw_if_index=self.pg0.sw_if_index, enable_disable=0) - self.vapi.feature_gso_enable_disable(self.ipip4.sw_if_index) + self.vapi.feature_gso_enable_disable( + sw_if_index=self.ipip4.sw_if_index, + enable_disable=1) rxs = self.send_and_expect(self.pg2, 5*[p47], self.pg0, 225) size = 0 @@ -615,8 +622,9 @@ class TestGSO(VppTestCase): # # disable ipip4 # - self.vapi.feature_gso_enable_disable(self.ipip4.sw_if_index, - enable_disable=0) + self.vapi.feature_gso_enable_disable( + sw_if_index=self.ipip4.sw_if_index, + enable_disable=0) self.ip4_via_ip4_tunnel.remove_vpp_config() self.ip6_via_ip4_tunnel.remove_vpp_config() self.ipip4.remove_vpp_config() @@ -624,7 +632,8 @@ class TestGSO(VppTestCase): # # enable ipip6 # - self.vapi.feature_gso_enable_disable(self.pg0.sw_if_index) + self.vapi.feature_gso_enable_disable(sw_if_index=self.pg0.sw_if_index, + enable_disable=1) self.ipip6.add_vpp_config() # Set interface up and enable IP on it @@ -706,7 +715,7 @@ class TestGSO(VppTestCase): self.ip6_via_ip6_tunnel.remove_vpp_config() self.ipip6.remove_vpp_config() - self.vapi.feature_gso_enable_disable(self.pg0.sw_if_index, + self.vapi.feature_gso_enable_disable(sw_if_index=self.pg0.sw_if_index, enable_disable=0) if __name__ == '__main__': diff --git a/test/test_neighbor.py b/test/test_neighbor.py index 9f0f97c8cbb..d81fe1b3f80 100644 --- a/test/test_neighbor.py +++ b/test/test_neighbor.py @@ -763,8 +763,10 @@ class ARPTestCase(VppTestCase): # # Configure Proxy ARP for the subnet on PG0addresses on pg0 # - self.vapi.proxy_arp_add_del(self.pg0._local_ip4_subnet, - self.pg0._local_ip4_bcast) + self.vapi.proxy_arp_add_del(proxy={'table_id': 0, + 'low': self.pg0._local_ip4_subnet, + 'hi': self.pg0._local_ip4_bcast}, + is_add=1) # Make pg2 un-numbered to pg0 # @@ -838,9 +840,9 @@ class ARPTestCase(VppTestCase): # # cleanup # - self.pg2.set_proxy_arp(0) - self.vapi.proxy_arp_add_del(self.pg0._local_ip4_subnet, - self.pg0._local_ip4_bcast, + self.vapi.proxy_arp_add_del(proxy={'table_id': 0, + 'low': self.pg0._local_ip4_subnet, + 'hi': self.pg0._local_ip4_bcast}, is_add=0) def test_proxy_arp(self): @@ -886,8 +888,10 @@ class ARPTestCase(VppTestCase): # # Configure Proxy ARP for 10.10.10.0 -> 10.10.10.124 # - self.vapi.proxy_arp_add_del(inet_pton(AF_INET, "10.10.10.2"), - inet_pton(AF_INET, "10.10.10.124")) + self.vapi.proxy_arp_add_del(proxy={'table_id': 0, + 'low': "10.10.10.2", + 'hi': "10.10.10.124"}, + is_add=1) # # No responses are sent when the interfaces are not enabled for proxy diff --git a/test/vpp_interface.py b/test/vpp_interface.py index 2d991ede06c..cb1fbafce48 100644 --- a/test/vpp_interface.py +++ b/test/vpp_interface.py @@ -438,8 +438,8 @@ class VppInterface(object): def set_proxy_arp(self, enable=1): """ Set the interface to enable/disable Proxy ARP """ self.test.vapi.proxy_arp_intfc_enable_disable( - self.sw_if_index, - enable) + sw_if_index=self.sw_if_index, + enable=enable) return self def query_vpp_config(self): diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py index 6e5ebc25fb4..c4328a0e833 100644 --- a/test/vpp_papi_provider.py +++ b/test/vpp_papi_provider.py @@ -84,15 +84,10 @@ defaultmapping = { 'l2_table_index': 4294967295, }, 'pppoe_add_del_session': {'is_add': 1, }, 'policer_add_del': {'is_add': 1, 'conform_action': {'type': 1}, }, - 'proxy_arp_add_del': {'is_add': 1, }, - 'proxy_arp_intfc_enable_disable': {'is_enable': 1, }, 'set_ip_flow_hash': {'src': 1, 'dst': 1, 'sport': 1, 'dport': 1, 'proto': 1, }, 'set_ipfix_exporter': {'collector_port': 4739, }, 'sr_policy_add': {'weight': 1, 'is_encap': 1, }, - 'svs_enable_disable': {'is_enable': 1, }, - 'svs_route_add_del': {'is_add': 1, }, - 'svs_table_add_del': {'is_add': 1, }, 'sw_interface_add_del_address': {'is_add': 1, }, 'sw_interface_ip6nd_ra_prefix': {'val_lifetime': 4294967295, 'pref_lifetime': 4294967295, }, @@ -449,44 +444,6 @@ class VppPapiProvider(object): } ) - def proxy_arp_add_del(self, - low, - hi, - table_id=0, - is_add=1): - """ Config Proxy Arp Range. - - :param low_address: Start address in the rnage to Proxy for - :param hi_address: End address in the rnage to Proxy for - :param vrf_id: The VRF/table in which to proxy - """ - - return self.api( - self.papi.proxy_arp_add_del, - {'proxy': - { - 'table_id': table_id, - 'low': low, - 'hi': hi, - }, - 'is_add': is_add}) - - def proxy_arp_intfc_enable_disable(self, - sw_if_index, - is_enable=1): - """ Enable/Disable an interface for proxy ARP requests - - :param sw_if_index: Interface - :param enable_disable: Enable/Disable - """ - - return self.api( - self.papi.proxy_arp_intfc_enable_disable, - {'sw_if_index': sw_if_index, - 'enable': is_enable - } - ) - def udp_encap_add(self, src_ip, dst_ip, @@ -1319,36 +1276,3 @@ class VppPapiProvider(object): def pipe_delete(self, parent_sw_if_index): return self.api(self.papi.pipe_delete, {'parent_sw_if_index': parent_sw_if_index}) - - def svs_table_add_del(self, af, table_id, is_add=1): - return self.api(self.papi.svs_table_add_del, - { - 'table_id': table_id, - 'is_add': is_add, - 'af': af, - }) - - def svs_route_add_del(self, table_id, prefix, src_table_id, is_add=1): - return self.api(self.papi.svs_route_add_del, - { - 'table_id': table_id, - 'source_table_id': src_table_id, - 'prefix': prefix, - 'is_add': is_add, - }) - - def svs_enable_disable(self, af, table_id, sw_if_index, is_enable=1): - return self.api(self.papi.svs_enable_disable, - { - 'af': af, - 'table_id': table_id, - 'sw_if_index': sw_if_index, - 'is_enable': is_enable, - }) - - def feature_gso_enable_disable(self, sw_if_index, enable_disable=1): - return self.api(self.papi.feature_gso_enable_disable, - { - 'sw_if_index': sw_if_index, - 'enable_disable': enable_disable, - }) |