diff options
author | Ole Troan <ot@cisco.com> | 2019-03-11 19:23:25 +0100 |
---|---|---|
committer | Paul Vinciguerra <pvinci@vinciconsulting.com> | 2019-03-11 21:57:19 +0000 |
commit | a5b2eec0535f9025319a752891d77ff9948ae0df (patch) | |
tree | 08c801cb85ab9639e00e5f565e613b817b3924e4 /test | |
parent | 2d9b427a5b20dcec3d2212a3a8a47c29b4acdd46 (diff) |
vpp_papi_provider: Remove more wrapper functions.
Split this work up into pieces.
Please don't add new wrappers to vpp_papi_provider.py.
Change-Id: I0f8f2afc4cd2bba07ea70ddecea2d7319f7b2e10
Signed-off-by: Ole Troan <ot@cisco.com>
Diffstat (limited to 'test')
36 files changed, 409 insertions, 783 deletions
diff --git a/test/test_acl_plugin.py b/test/test_acl_plugin.py index fa92513cbb5..38c8d2c5580 100644 --- a/test/test_acl_plugin.py +++ b/test/test_acl_plugin.py @@ -103,8 +103,8 @@ class TestACLplugin(VppTestCase): cls.vapi.bridge_domain_add_del(bd_id=cls.bd_id, uu_flood=1, learn=1) for pg_if in cls.pg_interfaces: - cls.vapi.sw_interface_set_l2_bridge(pg_if.sw_if_index, - bd_id=cls.bd_id) + cls.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=pg_if.sw_if_index, bd_id=cls.bd_id) # Set up all interfaces for i in cls.pg_interfaces: diff --git a/test/test_acl_plugin_l2l3.py b/test/test_acl_plugin_l2l3.py index 2a99e86119b..05c043e859e 100644 --- a/test/test_acl_plugin_l2l3.py +++ b/test/test_acl_plugin_l2l3.py @@ -72,12 +72,12 @@ class TestACLpluginL2L3(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, + rx_sw_if_index=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( - cls.pg1.sw_if_index, bd_id=cls.bd_id) + cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=cls.pg0.sw_if_index, + bd_id=cls.bd_id) + cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=cls.pg1.sw_if_index, + bd_id=cls.bd_id) # Configure IPv4 addresses on loopback interface and routed interface cls.loop0.config_ip4() diff --git a/test/test_acl_plugin_macip.py b/test/test_acl_plugin_macip.py index 6f99646e6e2..7d11c65b60e 100644 --- a/test/test_acl_plugin_macip.py +++ b/test/test_acl_plugin_macip.py @@ -95,16 +95,16 @@ class MethodHolder(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, + rx_sw_if_index=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) + rx_sw_if_index=cls.pg0.sw_if_index, bd_id=cls.bd_id) cls.vapi.sw_interface_set_l2_bridge( - cls.pg1.sw_if_index, bd_id=cls.bd_id) + rx_sw_if_index=cls.pg1.sw_if_index, bd_id=cls.bd_id) cls.vapi.sw_interface_set_l2_bridge( - cls.subifs[0].sw_if_index, bd_id=cls.bd_id) + rx_sw_if_index=cls.subifs[0].sw_if_index, bd_id=cls.bd_id) cls.vapi.sw_interface_set_l2_bridge( - cls.subifs[1].sw_if_index, bd_id=cls.bd_id) + rx_sw_if_index=cls.subifs[1].sw_if_index, bd_id=cls.bd_id) # Configure IPv4/6 addresses on loop interface and routed interface cls.loop0.config_ip4() diff --git a/test/test_classifier.py b/test/test_classifier.py index f62a76ded6f..5585ac02da4 100644 --- a/test/test_classifier.py +++ b/test/test_classifier.py @@ -96,11 +96,10 @@ class TestClassifier(VppTestCase): """ addr_len = 24 - self.vapi.ip_add_del_route(intf.local_ip4n, - addr_len, - intf.remote_ip4n, - table_id=self.pbr_vrfid, - is_add=is_add) + self.vapi.ip_add_del_route(dst_address=intf.local_ip4n, + dst_address_length=addr_len, + next_hop_address=intf.remote_ip4n, + table_id=self.pbr_vrfid, is_add=is_add) def create_stream(self, src_if, dst_if, packet_sizes, proto_l=UDP(sport=1234, dport=5678)): diff --git a/test/test_classify_l2_acl.py b/test/test_classify_l2_acl.py index a729929681f..fddaa0f07a4 100644 --- a/test/test_classify_l2_acl.py +++ b/test/test_classify_l2_acl.py @@ -105,8 +105,8 @@ class TestClassifyAcl(VppTestCase): cls.vapi.bridge_domain_add_del(bd_id=cls.bd_id, uu_flood=1, learn=1) for pg_if in cls.pg_interfaces: - cls.vapi.sw_interface_set_l2_bridge(pg_if.sw_if_index, - bd_id=cls.bd_id) + cls.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=pg_if.sw_if_index, bd_id=cls.bd_id) # Set up all interfaces for i in cls.pg_interfaces: diff --git a/test/test_dhcp6.py b/test/test_dhcp6.py index 7510543af8e..ae0f01f6154 100644 --- a/test/test_dhcp6.py +++ b/test/test_dhcp6.py @@ -52,8 +52,10 @@ class TestDHCPv6DataPlane(VppTestCase): address = {'address': address_bin, 'preferred_time': 60, 'valid_time': 120} - self.vapi.dhcp6_send_client_message(1, self.pg0.sw_if_index, - T1=20, T2=40, addresses=[address]) + self.vapi.dhcp6_send_client_message(msg_type=1, + sw_if_index=self.pg0.sw_if_index, + T1=20, T2=40, addresses=[address], + n_addresses=len([address])) rx_list = self.pg0.get_capture(1) self.assertEqual(len(rx_list), 1) packet = rx_list[0] diff --git a/test/test_dvr.py b/test/test_dvr.py index d2088ea2320..07ea7878a74 100644 --- a/test/test_dvr.py +++ b/test/test_dvr.py @@ -84,21 +84,24 @@ class TestDVR(VppTestCase): # # Put all the interfaces into a new bridge domain # - self.vapi.sw_interface_set_l2_bridge(self.pg0.sw_if_index, 1) - self.vapi.sw_interface_set_l2_bridge(self.pg1.sw_if_index, 1) - self.vapi.sw_interface_set_l2_bridge(sub_if_on_pg2.sw_if_index, 1) - self.vapi.sw_interface_set_l2_bridge(sub_if_on_pg3.sw_if_index, 1) - self.vapi.sw_interface_set_l2_bridge(self.loop0.sw_if_index, 1, - port_type=L2_PORT_TYPE.BVI) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=self.pg0.sw_if_index, bd_id=1) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=self.pg1.sw_if_index, bd_id=1) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=sub_if_on_pg2.sw_if_index, bd_id=1) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=sub_if_on_pg3.sw_if_index, bd_id=1) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=self.loop0.sw_if_index, bd_id=1, + port_type=L2_PORT_TYPE.BVI) self.vapi.l2_interface_vlan_tag_rewrite( - sub_if_on_pg2.sw_if_index, - L2_VTR_OP.L2_POP_1, - 92) + sw_if_index=sub_if_on_pg2.sw_if_index, vtr_op=L2_VTR_OP.L2_POP_1, + push_dot1q=92) self.vapi.l2_interface_vlan_tag_rewrite( - sub_if_on_pg3.sw_if_index, - L2_VTR_OP.L2_POP_1, - 93) + sw_if_index=sub_if_on_pg3.sw_if_index, vtr_op=L2_VTR_OP.L2_POP_1, + push_dot1q=93) # # Add routes to bridge the traffic via a tagged an nontagged interface @@ -202,17 +205,17 @@ class TestDVR(VppTestCase): 0, []) self.vapi.acl_del(acl.acl_index) - 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, port_type=L2_PORT_TYPE.BVI, - enable=0) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=self.pg0.sw_if_index, bd_id=1, enable=0) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=self.pg1.sw_if_index, bd_id=1, enable=0) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=sub_if_on_pg2.sw_if_index, bd_id=1, enable=0) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=sub_if_on_pg3.sw_if_index, bd_id=1, enable=0) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=self.loop0.sw_if_index, bd_id=1, + port_type=L2_PORT_TYPE.BVI, enable=0) # # Do a FIB dump to make sure the paths are correctly reported as DVR @@ -289,24 +292,27 @@ class TestDVR(VppTestCase): # # Put all the interfaces into a new bridge domain # - self.vapi.sw_interface_set_l2_bridge(self.pg0.sw_if_index, 1) - self.vapi.sw_interface_set_l2_bridge(self.pg1.sw_if_index, 1) - self.vapi.sw_interface_set_l2_bridge(sub_if_on_pg2.sw_if_index, 1) - self.vapi.sw_interface_set_l2_bridge(sub_if_on_pg3.sw_if_index, 1) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=self.pg0.sw_if_index, bd_id=1) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=self.pg1.sw_if_index, bd_id=1) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=sub_if_on_pg2.sw_if_index, bd_id=1) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=sub_if_on_pg3.sw_if_index, bd_id=1) self.vapi.l2_interface_vlan_tag_rewrite( - sub_if_on_pg2.sw_if_index, - L2_VTR_OP.L2_POP_1, - 92) + sw_if_index=sub_if_on_pg2.sw_if_index, vtr_op=L2_VTR_OP.L2_POP_1, + push_dot1q=92) self.vapi.l2_interface_vlan_tag_rewrite( - sub_if_on_pg3.sw_if_index, - L2_VTR_OP.L2_POP_1, - 93) + sw_if_index=sub_if_on_pg3.sw_if_index, vtr_op=L2_VTR_OP.L2_POP_1, + push_dot1q=93) # # Disable UU flooding, learning and ARP terminaation. makes this test # easier as unicast packets are dropped if not extracted. # - self.vapi.bridge_flags(1, 0, (1 << 0) | (1 << 3) | (1 << 4)) + self.vapi.bridge_flags(bd_id=1, is_set=0, + flags=(1 << 0) | (1 << 3) | (1 << 4)) # # Add a DVR route to steer traffic at L3 @@ -371,14 +377,14 @@ class TestDVR(VppTestCase): self.vapi.l2_emulation(sub_if_on_pg3.sw_if_index, enable=0) - 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( + rx_sw_if_index=self.pg0.sw_if_index, bd_id=1, enable=0) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=self.pg1.sw_if_index, bd_id=1, enable=0) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=sub_if_on_pg2.sw_if_index, bd_id=1, enable=0) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=sub_if_on_pg3.sw_if_index, bd_id=1, enable=0) route_1.remove_vpp_config() route_2.remove_vpp_config() diff --git a/test/test_flowprobe.py b/test/test_flowprobe.py index c7b1f722fe0..625bb3a2a29 100644 --- a/test/test_flowprobe.py +++ b/test/test_flowprobe.py @@ -125,8 +125,10 @@ class MethodHolder(VppTestCase): # Create BD with MAC learning and unknown unicast flooding disabled # and put interfaces to this BD cls.vapi.bridge_domain_add_del(bd_id=1, uu_flood=1, learn=1) - cls.vapi.sw_interface_set_l2_bridge(cls.pg1._sw_if_index, bd_id=1) - cls.vapi.sw_interface_set_l2_bridge(cls.pg2._sw_if_index, bd_id=1) + cls.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=cls.pg1._sw_if_index, bd_id=1) + cls.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=cls.pg2._sw_if_index, bd_id=1) # Set up all interfaces for i in cls.pg_interfaces: diff --git a/test/test_gbp.py b/test/test_gbp.py index 09d218d8ac3..05a4b4df513 100644 --- a/test/test_gbp.py +++ b/test/test_gbp.py @@ -1977,9 +1977,9 @@ class TestGBP(VppTestCase): # vlan_11 = VppDot1QSubint(self, self.pg0, 11) vlan_11.admin_up() - self.vapi.l2_interface_vlan_tag_rewrite(vlan_11.sw_if_index, - L2_VTR_OP.L2_POP_1, - 11) + self.vapi.l2_interface_vlan_tag_rewrite( + sw_if_index=vlan_11.sw_if_index, vtr_op=L2_VTR_OP.L2_POP_1, + push_dot1q=11) bd_uu_fwd = VppVxlanGbpTunnel(self, self.pg3.local_ip4, self.pg3.remote_ip4, 116) diff --git a/test/test_geneve.py b/test/test_geneve.py index d77bfbfcff1..ebe95a0f1a0 100644 --- a/test/test_geneve.py +++ b/test/test_geneve.py @@ -89,12 +89,14 @@ class TestGeneve(BridgeDomain, VppTestCase): for dest_ip4n in ip4n_range(next_hop_address, ip_range_start, ip_range_end): # add host route so dest_ip4n will not be resolved - cls.vapi.ip_add_del_route(dest_ip4n, 32, next_hop_address) + cls.vapi.ip_add_del_route(dst_address=dest_ip4n, + dst_address_length=32, + next_hop_address=next_hop_address) r = cls.vapi.geneve_add_del_tunnel( - local_addr=cls.pg0.local_ip4n, - remote_addr=dest_ip4n, + local_address=cls.pg0.local_ip4n, remote_address=dest_ip4n, vni=vni) - cls.vapi.sw_interface_set_l2_bridge(r.sw_if_index, bd_id=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): @@ -107,11 +109,9 @@ class TestGeneve(BridgeDomain, VppTestCase): vni_end = vni_start + n_shared_dst_tunnels for vni in range(vni_start, vni_end): r = cls.vapi.geneve_add_del_tunnel( - local_addr=cls.pg0.local_ip4n, - remote_addr=cls.mcast_ip4n, - mcast_sw_if_index=1, - vni=vni, - is_add=is_add) + local_address=cls.pg0.local_ip4n, + remote_address=cls.mcast_ip4n, mcast_sw_if_index=1, + is_add=is_add, vni=vni) if r.sw_if_index == 0xffffffff: raise "bad sw_if_index" @@ -134,12 +134,10 @@ class TestGeneve(BridgeDomain, VppTestCase): for dest_ip4n in ip4n_range(cls.mcast_ip4n, ip_range_start, ip_range_end): vni = bytearray(dest_ip4n)[3] - cls.vapi.geneve_add_del_tunnel( - local_addr=cls.pg0.local_ip4n, - remote_addr=dest_ip4n, - mcast_sw_if_index=1, - vni=vni, - is_add=is_add) + cls.vapi.geneve_add_del_tunnel(local_address=cls.pg0.local_ip4n, + remote_address=dest_ip4n, + mcast_sw_if_index=1, is_add=is_add, + vni=vni) @classmethod def add_mcast_tunnels_load(cls): @@ -183,13 +181,12 @@ class TestGeneve(BridgeDomain, VppTestCase): # into BD. cls.single_tunnel_bd = 1 r = cls.vapi.geneve_add_del_tunnel( - local_addr=cls.pg0.local_ip4n, - remote_addr=cls.pg0.remote_ip4n, - vni=cls.single_tunnel_bd) - cls.vapi.sw_interface_set_l2_bridge(r.sw_if_index, - bd_id=cls.single_tunnel_bd) - cls.vapi.sw_interface_set_l2_bridge(cls.pg1.sw_if_index, + local_address=cls.pg0.local_ip4n, + remote_address=cls.pg0.remote_ip4n, vni=cls.single_tunnel_bd) + 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 @@ -197,14 +194,13 @@ class TestGeneve(BridgeDomain, VppTestCase): cls.create_geneve_flood_test_bd(cls.mcast_flood_bd, cls.n_ucast_tunnels) r = cls.vapi.geneve_add_del_tunnel( - local_addr=cls.pg0.local_ip4n, - remote_addr=cls.mcast_ip4n, - mcast_sw_if_index=1, + local_address=cls.pg0.local_ip4n, + remote_address=cls.mcast_ip4n, mcast_sw_if_index=1, vni=cls.mcast_flood_bd) - cls.vapi.sw_interface_set_l2_bridge(r.sw_if_index, - bd_id=cls.mcast_flood_bd) - cls.vapi.sw_interface_set_l2_bridge(cls.pg2.sw_if_index, + 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() @@ -216,8 +212,8 @@ class TestGeneve(BridgeDomain, VppTestCase): cls.ucast_flood_bd = 3 cls.create_geneve_flood_test_bd(cls.ucast_flood_bd, cls.n_ucast_tunnels) - cls.vapi.sw_interface_set_l2_bridge(cls.pg3.sw_if_index, - bd_id=cls.ucast_flood_bd) + 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(TestGeneve, cls).tearDownClass() raise diff --git a/test/test_gre.py b/test/test_gre.py index 694f819308e..92fc3bc9191 100644 --- a/test/test_gre.py +++ b/test/test_gre.py @@ -827,12 +827,12 @@ class TestGRE(VppTestCase): # Configure both to pop thier respective VLAN tags, # so that during the x-coonect they will subsequently push # - self.vapi.l2_interface_vlan_tag_rewrite(gre_if_12.sw_if_index, - L2_VTR_OP.L2_POP_1, - 12) - self.vapi.l2_interface_vlan_tag_rewrite(gre_if_11.sw_if_index, - L2_VTR_OP.L2_POP_1, - 11) + self.vapi.l2_interface_vlan_tag_rewrite( + sw_if_index=gre_if_12.sw_if_index, vtr_op=L2_VTR_OP.L2_POP_1, + push_dot1q=12) + self.vapi.l2_interface_vlan_tag_rewrite( + sw_if_index=gre_if_11.sw_if_index, vtr_op=L2_VTR_OP.L2_POP_1, + push_dot1q=11) # # Send traffic in both directiond - expect the VLAN tags to diff --git a/test/test_gtpu.py b/test/test_gtpu.py index ed4e6897713..f5b1089757e 100644 --- a/test/test_gtpu.py +++ b/test/test_gtpu.py @@ -141,12 +141,15 @@ class TestGtpu(BridgeDomain, VppTestCase): for dest_ip4n in ip4n_range(next_hop_address, ip_range_start, ip_range_end): # add host route so dest_ip4n will not be resolved - cls.vapi.ip_add_del_route(dest_ip4n, 32, next_hop_address) + cls.vapi.ip_add_del_route(dst_address=dest_ip4n, + dst_address_length=32, + next_hop_address=next_hop_address) r = cls.vapi.gtpu_add_del_tunnel( src_addr=cls.pg0.local_ip4n, dst_addr=dest_ip4n, teid=teid) - cls.vapi.sw_interface_set_l2_bridge(r.sw_if_index, bd_id=teid) + cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index, + bd_id=teid) @classmethod def add_del_shared_mcast_dst_load(cls, is_add): @@ -239,10 +242,10 @@ class TestGtpu(BridgeDomain, VppTestCase): src_addr=cls.pg0.local_ip4n, dst_addr=cls.pg0.remote_ip4n, teid=cls.single_tunnel_bd) - cls.vapi.sw_interface_set_l2_bridge(r.sw_if_index, - bd_id=cls.single_tunnel_bd) - cls.vapi.sw_interface_set_l2_bridge(cls.pg1.sw_if_index, + 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 teid 2 to test multicast flooding cls.n_ucast_tunnels = 10 @@ -254,10 +257,10 @@ class TestGtpu(BridgeDomain, VppTestCase): dst_addr=cls.mcast_ip4n, mcast_sw_if_index=1, teid=cls.mcast_flood_bd) - cls.vapi.sw_interface_set_l2_bridge(r.sw_if_index, - bd_id=cls.mcast_flood_bd) - cls.vapi.sw_interface_set_l2_bridge(cls.pg2.sw_if_index, + 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() @@ -269,8 +272,8 @@ class TestGtpu(BridgeDomain, VppTestCase): cls.ucast_flood_bd = 13 cls.create_gtpu_flood_test_bd(cls.ucast_flood_bd, cls.n_ucast_tunnels) - cls.vapi.sw_interface_set_l2_bridge(cls.pg3.sw_if_index, - bd_id=cls.ucast_flood_bd) + 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(TestGtpu, cls).tearDownClass() raise diff --git a/test/test_ip4.py b/test/test_ip4.py index ab733ac1bb6..6f764373075 100644 --- a/test/test_ip4.py +++ b/test/test_ip4.py @@ -96,8 +96,9 @@ class TestIPv4(VppTestCase): for i in self.interfaces: next_hop_address = i.local_ip4n for j in range(count / n_int): - self.vapi.ip_add_del_route( - dest_addr, dest_addr_len, next_hop_address) + self.vapi.ip_add_del_route(dst_address=dest_addr, + dst_address_length=dest_addr_len, + next_hop_address=next_hop_address) counter += 1 if counter / count * 100 > percent: self.logger.info("Configure %d FIB entries .. %d%% done" % @@ -312,8 +313,9 @@ class TestIPv4FibCrud(VppTestCase): n_next_hop_addr = socket.inet_pton(socket.AF_INET, next_hop_addr) for _ in range(count): n_dest_addr = binascii.unhexlify('{:08x}'.format(dest_addr)) - self.vapi.ip_add_del_route(n_dest_addr, dest_addr_len, - n_next_hop_addr) + self.vapi.ip_add_del_route(dst_address=n_dest_addr, + dst_address_length=dest_addr_len, + next_hop_address=n_next_hop_addr) added_ips.append(socket.inet_ntoa(n_dest_addr)) dest_addr += 1 return added_ips @@ -327,8 +329,10 @@ class TestIPv4FibCrud(VppTestCase): n_next_hop_addr = socket.inet_pton(socket.AF_INET, next_hop_addr) for _ in range(count): n_dest_addr = binascii.unhexlify('{:08x}'.format(dest_addr)) - self.vapi.ip_add_del_route(n_dest_addr, dest_addr_len, - n_next_hop_addr, is_add=0) + self.vapi.ip_add_del_route(dst_address=n_dest_addr, + dst_address_length=dest_addr_len, + next_hop_address=n_next_hop_addr, + is_add=0) removed_ips.append(socket.inet_ntoa(n_dest_addr)) dest_addr += 1 return removed_ips @@ -976,7 +980,7 @@ class TestIPLoadBalance(VppTestCase): # - now only the stream with differing source address will # load-balance # - self.vapi.set_ip_flow_hash(0, src=1, dst=1, sport=0, dport=0) + self.vapi.set_ip_flow_hash(vrf_id=0, src=1, dst=1, sport=0, dport=0) self.send_and_expect_load_balancing(self.pg0, src_ip_pkts, [self.pg1, self.pg2]) @@ -988,7 +992,7 @@ class TestIPLoadBalance(VppTestCase): # # change the flow hash config back to defaults # - self.vapi.set_ip_flow_hash(0, src=1, dst=1, sport=1, dport=1) + self.vapi.set_ip_flow_hash(vrf_id=0, src=1, dst=1, sport=1, dport=1) # # Recursive prefixes diff --git a/test/test_ip4_irb.py b/test/test_ip4_irb.py index 9b762aa0248..1d55cef5d90 100644 --- a/test/test_ip4_irb.py +++ b/test/test_ip4_irb.py @@ -66,12 +66,12 @@ 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, + rx_sw_if_index=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( - cls.pg1.sw_if_index, bd_id=cls.bd_id) + cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=cls.pg0.sw_if_index, + bd_id=cls.bd_id) + cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=cls.pg1.sw_if_index, + bd_id=cls.bd_id) # Configure IPv4 addresses on loopback interface and routed interface cls.loop0.config_ip4() diff --git a/test/test_ip6.py b/test/test_ip6.py index 2f330c56d67..6cfb04be142 100644 --- a/test/test_ip6.py +++ b/test/test_ip6.py @@ -246,8 +246,10 @@ class TestIPv6(TestIPv6ND): for i in self.interfaces: next_hop_address = i.local_ip6n for j in range(count / n_int): - self.vapi.ip_add_del_route( - dest_addr, dest_addr_len, next_hop_address, is_ipv6=1) + self.vapi.ip_add_del_route(dst_address=dest_addr, + dst_address_length=dest_addr_len, + next_hop_address=next_hop_address, + is_ipv6=1) counter += 1 if counter / count * 100 > percent: self.logger.info("Configure %d FIB entries .. %d%% done" % @@ -1804,7 +1806,8 @@ class TestIP6LoadBalance(VppTestCase): # - now only the stream with differing source address will # load-balance # - self.vapi.set_ip_flow_hash(0, is_ip6=1, src=1, dst=1, sport=0, dport=0) + self.vapi.set_ip_flow_hash(vrf_id=0, src=1, dst=1, sport=0, dport=0, + is_ipv6=1) self.send_and_expect_load_balancing(self.pg0, src_ip_pkts, [self.pg1, self.pg2]) @@ -1815,7 +1818,8 @@ class TestIP6LoadBalance(VppTestCase): # # change the flow hash config back to defaults # - self.vapi.set_ip_flow_hash(0, is_ip6=1, src=1, dst=1, sport=1, dport=1) + self.vapi.set_ip_flow_hash(vrf_id=0, src=1, dst=1, sport=1, dport=1, + is_ipv6=1) # # Recursive prefixes diff --git a/test/test_ip_ecmp.py b/test/test_ip_ecmp.py index 5abaea41e46..c6a33c815b8 100644 --- a/test/test_ip_ecmp.py +++ b/test/test_ip_ecmp.py @@ -5,7 +5,6 @@ import random import socket from ipaddress import IPv4Address, IPv6Address, AddressValueError - from framework import VppTestCase, VppTestRunner from util import ppp @@ -187,7 +186,9 @@ class TestECMP(VppTestCase): next_hop_address = socket.inet_pton(af, nh_host_ip) next_hop_sw_if_index = pg_if.sw_if_index self.vapi.ip_add_del_route( - dst_ip, dst_prefix_len, next_hop_address, + dst_address=dst_ip, + dst_address_length=dst_prefix_len, + next_hop_address=next_hop_address, next_hop_sw_if_index=next_hop_sw_if_index, is_ipv6=is_ipv6, is_multipath=1) self.logger.info("Route via %s on %s created" % diff --git a/test/test_l2_fib.py b/test/test_l2_fib.py index 58dc37eea23..97915a34e7a 100644 --- a/test/test_l2_fib.py +++ b/test/test_l2_fib.py @@ -117,12 +117,12 @@ class TestL2fib(VppTestCase): for bd_id in n_brs: # Create BD with MAC learning and unknown unicast flooding # disabled and put interfaces to this BD - cls.vapi.bridge_domain_add_del( - bd_id=bd_id, uu_flood=0, learn=0) + cls.vapi.bridge_domain_add_del(bd_id=bd_id, uu_flood=0, + learn=0) ifs = [cls.pg_interfaces[i] for i in cls.bd_ifs(bd_id)] for pg_if in ifs: - cls.vapi.sw_interface_set_l2_bridge(pg_if.sw_if_index, - bd_id=bd_id) + cls.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=pg_if.sw_if_index, bd_id=bd_id) # Set up all interfaces for i in cls.pg_interfaces: @@ -183,7 +183,7 @@ class TestL2fib(VppTestCase): :param int bd_id: BD to teach :param dict hosts: dict of hosts per interface """ - self.vapi.bridge_flags(bd_id, 1, 1) + self.vapi.bridge_flags(bd_id=bd_id, is_set=1, flags=1) ifs = [self.pg_interfaces[i] for i in self.bd_ifs(bd_id)] for pg_if in ifs: swif = pg_if.sw_if_index @@ -343,7 +343,7 @@ class TestL2fib(VppTestCase): if pkts: i.add_stream(pkts) - self.vapi.bridge_flags(bd_id, 0, 1) + self.vapi.bridge_flags(bd_id=bd_id, is_set=0, flags=1) # Enable packet capture and start packet sending self.pg_enable_capture(ifs) self.pg_start() @@ -371,7 +371,7 @@ class TestL2fib(VppTestCase): if pkts: i.add_stream(pkts) - self.vapi.bridge_flags(bd_id, 0, 1) + self.vapi.bridge_flags(bd_id=bd_id, is_set=0, flags=1) # Enable packet capture and start packet sending self.pg_enable_capture(ifs) self.pg_start() diff --git a/test/test_l2_flood.py b/test/test_l2_flood.py index 9f3ef533091..7fe5214dcde 100644 --- a/test/test_l2_flood.py +++ b/test/test_l2_flood.py @@ -47,19 +47,23 @@ class TestL2Flood(VppTestCase): # # Create a single bridge Domain # - self.vapi.bridge_domain_add_del(1) + self.vapi.bridge_domain_add_del(bd_id=1) # # add each interface to the BD. 3 interfaces per split horizon group # for i in self.pg_interfaces[0:4]: - self.vapi.sw_interface_set_l2_bridge(i.sw_if_index, 1, 0) + self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=i.sw_if_index, + bd_id=1, shg=0) for i in self.pg_interfaces[4:8]: - self.vapi.sw_interface_set_l2_bridge(i.sw_if_index, 1, 1) + self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=i.sw_if_index, + bd_id=1, shg=1) for i in self.pg_interfaces[8:12]: - self.vapi.sw_interface_set_l2_bridge(i.sw_if_index, 1, 2) + self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=i.sw_if_index, + bd_id=1, shg=2) for i in self.lo_interfaces: - self.vapi.sw_interface_set_l2_bridge(i.sw_if_index, 1, 2, + self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=i.sw_if_index, + bd_id=1, shg=2, port_type=L2_PORT_TYPE.BVI) p = (Ether(dst="ff:ff:ff:ff:ff:ff", @@ -136,13 +140,15 @@ class TestL2Flood(VppTestCase): # cleanup # for i in self.pg_interfaces[:12]: - self.vapi.sw_interface_set_l2_bridge(i.sw_if_index, 1, enable=0) + self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=i.sw_if_index, + bd_id=1, enable=0) for i in self.lo_interfaces: - self.vapi.sw_interface_set_l2_bridge(i.sw_if_index, 1, 2, + self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=i.sw_if_index, + bd_id=1, shg=2, port_type=L2_PORT_TYPE.BVI, enable=0) - self.vapi.bridge_domain_add_del(1, is_add=0) + self.vapi.bridge_domain_add_del(bd_id=1, is_add=0) def test_flood_one(self): """ L2 no-Flood Test """ @@ -150,14 +156,15 @@ class TestL2Flood(VppTestCase): # # Create a single bridge Domain # - self.vapi.bridge_domain_add_del(1) + self.vapi.bridge_domain_add_del(bd_id=1) # # add 2 interfaces to the BD. this means a flood goes to only # one member # for i in self.pg_interfaces[:2]: - self.vapi.sw_interface_set_l2_bridge(i.sw_if_index, 1, 0) + self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=i.sw_if_index, + bd_id=1, shg=0) p = (Ether(dst="ff:ff:ff:ff:ff:ff", src="00:00:de:ad:be:ef") / @@ -174,8 +181,9 @@ class TestL2Flood(VppTestCase): # cleanup # for i in self.pg_interfaces[:2]: - self.vapi.sw_interface_set_l2_bridge(i.sw_if_index, 1, enable=0) - self.vapi.bridge_domain_add_del(1, is_add=0) + self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=i.sw_if_index, + bd_id=1, enable=0) + self.vapi.bridge_domain_add_del(bd_id=1, is_add=0) def test_uu_fwd(self): """ UU Flood """ @@ -183,13 +191,14 @@ class TestL2Flood(VppTestCase): # # Create a single bridge Domain # - self.vapi.bridge_domain_add_del(1, uu_flood=1) + self.vapi.bridge_domain_add_del(bd_id=1, uu_flood=1) # # add each interface to the BD. 3 interfaces per split horizon group # for i in self.pg_interfaces[0:4]: - self.vapi.sw_interface_set_l2_bridge(i.sw_if_index, 1, 0) + self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=i.sw_if_index, + bd_id=1, shg=0) # # an unknown unicast and braodcast packets @@ -225,8 +234,9 @@ class TestL2Flood(VppTestCase): # # use pg8 as the uu-fwd interface # - self.vapi.sw_interface_set_l2_bridge(self.pg8.sw_if_index, 1, 0, - port_type=L2_PORT_TYPE.UU_FWD) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=self.pg8.sw_if_index, bd_id=1, shg=0, + port_type=L2_PORT_TYPE.UU_FWD) # # expect the UU packet on the uu-fwd interface and not be flooded @@ -250,9 +260,9 @@ class TestL2Flood(VppTestCase): # # remove the uu-fwd interface and expect UU to be flooded again # - self.vapi.sw_interface_set_l2_bridge(self.pg8.sw_if_index, 1, 0, - port_type=L2_PORT_TYPE.UU_FWD, - enable=0) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=self.pg8.sw_if_index, bd_id=1, shg=0, + port_type=L2_PORT_TYPE.UU_FWD, enable=0) self.pg0.add_stream(p_uu*65) self.pg_enable_capture(self.pg_interfaces) @@ -264,15 +274,16 @@ class TestL2Flood(VppTestCase): # # change the BD config to not support UU-flood # - self.vapi.bridge_flags(1, 0, BRIDGE_FLAGS.UU_FLOOD) + self.vapi.bridge_flags(bd_id=1, is_set=0, flags=BRIDGE_FLAGS.UU_FLOOD) self.send_and_assert_no_replies(self.pg0, p_uu) # # re-add the uu-fwd interface # - self.vapi.sw_interface_set_l2_bridge(self.pg8.sw_if_index, 1, 0, - port_type=L2_PORT_TYPE.UU_FWD) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=self.pg8.sw_if_index, bd_id=1, shg=0, + port_type=L2_PORT_TYPE.UU_FWD) self.logger.info(self.vapi.cli("sh bridge 1 detail")) self.pg0.add_stream(p_uu*65) @@ -287,18 +298,19 @@ class TestL2Flood(VppTestCase): # # remove the uu-fwd interface # - self.vapi.sw_interface_set_l2_bridge(self.pg8.sw_if_index, 1, 0, - port_type=L2_PORT_TYPE.UU_FWD, - enable=0) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=self.pg8.sw_if_index, bd_id=1, shg=0, + port_type=L2_PORT_TYPE.UU_FWD, enable=0) self.send_and_assert_no_replies(self.pg0, p_uu) # # cleanup # for i in self.pg_interfaces[:4]: - self.vapi.sw_interface_set_l2_bridge(i.sw_if_index, 1, enable=0) + self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=i.sw_if_index, + bd_id=1, enable=0) - self.vapi.bridge_domain_add_del(1, is_add=0) + self.vapi.bridge_domain_add_del(bd_id=1, is_add=0) if __name__ == '__main__': diff --git a/test/test_l2bd.py b/test/test_l2bd.py index db831f35405..61cf4efdb2e 100644 --- a/test/test_l2bd.py +++ b/test/test_l2bd.py @@ -75,7 +75,7 @@ class TestL2bd(VppTestCase): for pg_if in cls.pg_interfaces: sw_if_index = pg_if.sub_if.sw_if_index \ if hasattr(pg_if, 'sub_if') else pg_if.sw_if_index - cls.vapi.sw_interface_set_l2_bridge(sw_if_index, + cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=sw_if_index, bd_id=cls.bd_id) # setup all interfaces diff --git a/test/test_l2bd_arp_term.py b/test/test_l2bd_arp_term.py index f721131d0c7..de84eddcad9 100644 --- a/test/test_l2bd_arp_term.py +++ b/test/test_l2bd_arp_term.py @@ -108,8 +108,8 @@ class TestL2bdArpTerm(VppTestCase): self.vapi.bridge_domain_add_del(bd_id=bd_id, is_add=is_add) for swif in self.bd_swifs(bd_id): swif_idx = swif.sw_if_index - self.vapi.sw_interface_set_l2_bridge( - swif_idx, bd_id=bd_id, enable=is_add) + self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=swif_idx, + bd_id=bd_id, enable=is_add) if not is_add: self.vapi.bridge_domain_add_del(bd_id=bd_id, is_add=is_add) @@ -226,7 +226,8 @@ class TestL2bdArpTerm(VppTestCase): else: raise ValueError("Unknown feature used: %s" % flag) is_set = 1 if args[flag] else 0 - self.vapi.bridge_flags(bd_id, is_set, feature_bitmap) + self.vapi.bridge_flags(bd_id=bd_id, is_set=is_set, + flags=feature_bitmap) self.logger.info("Bridge domain ID %d updated" % bd_id) def verify_arp(self, src_host, req_hosts, resp_hosts, bd_id=1): diff --git a/test/test_l2bd_multi_instance.py b/test/test_l2bd_multi_instance.py index ac3662ff5a3..67c208837c8 100644 --- a/test/test_l2bd_multi_instance.py +++ b/test/test_l2bd_multi_instance.py @@ -187,8 +187,8 @@ class TestL2bdMultiInst(VppTestCase): self.bd_deleted_list.remove(b) for j in self.bd_if_range(b): pg_if = self.pg_interfaces[j] - self.vapi.sw_interface_set_l2_bridge(pg_if.sw_if_index, - bd_id=b) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=pg_if.sw_if_index, bd_id=b) self.logger.info("pg-interface %s added to bridge domain ID %d" % (pg_if.name, b)) self.pg_in_bd.append(pg_if) @@ -212,8 +212,8 @@ class TestL2bdMultiInst(VppTestCase): for b in range(start, start + count): for j in self.bd_if_range(b): pg_if = self.pg_interfaces[j] - self.vapi.sw_interface_set_l2_bridge(pg_if.sw_if_index, - bd_id=b, enable=0) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=pg_if.sw_if_index, bd_id=b, enable=0) self.pg_in_bd.remove(pg_if) self.vapi.bridge_domain_add_del(bd_id=b, is_add=0) self.bd_list.remove(b) @@ -316,7 +316,8 @@ class TestL2bdMultiInst(VppTestCase): else: raise ValueError("Unknown feature used: %s" % flag) is_set = 1 if args[flag] else 0 - self.vapi.bridge_flags(bd_id, is_set, feature_bitmap) + self.vapi.bridge_flags(bd_id=bd_id, is_set=is_set, + flags=feature_bitmap) self.logger.info("Bridge domain ID %d updated" % bd_id) def verify_bd(self, bd_id, **args): diff --git a/test/test_lb.py b/test/test_lb.py index fa179504855..1652cc5d4d4 100644 --- a/test/test_lb.py +++ b/test/test_lb.py @@ -52,8 +52,11 @@ class TestLB(VppTestCase): i.resolve_ndp() dst4 = socket.inet_pton(socket.AF_INET, "10.0.0.0") dst6 = socket.inet_pton(socket.AF_INET6, "2002::") - cls.vapi.ip_add_del_route(dst4, 24, cls.pg1.remote_ip4n) - cls.vapi.ip_add_del_route(dst6, 16, cls.pg1.remote_ip6n, is_ipv6=1) + cls.vapi.ip_add_del_route(dst_address=dst4, dst_address_length=24, + next_hop_address=cls.pg1.remote_ip4n) + cls.vapi.ip_add_del_route(dst_address=dst6, dst_address_length=16, + next_hop_address=cls.pg1.remote_ip6n, + is_ipv6=1) cls.vapi.cli("lb conf ip4-src-address 39.40.41.42") cls.vapi.cli("lb conf ip6-src-address 2004::1") except Exception: diff --git a/test/test_memif.py b/test/test_memif.py index 1f98e3f2215..d89e06bfb4b 100644 --- a/test/test_memif.py +++ b/test/test_memif.py @@ -250,8 +250,9 @@ class TestMemif(VppTestCase): dst_addr = socket.inet_pton(socket.AF_INET, self.pg0._local_ip4_subnet) dst_addr_len = 24 next_hop_addr = socket.inet_pton(socket.AF_INET, memif.ip4_addr) - self.remote_test.vapi.ip_add_del_route( - dst_addr, dst_addr_len, next_hop_addr) + self.remote_test.vapi.ip_add_del_route(dst_address=dst_addr, + dst_address_length=dst_addr_len, + next_hop_address=next_hop_addr) # create ICMP echo-request from local pg to remote memif packet_num = 10 diff --git a/test/test_mpls.py b/test/test_mpls.py index 3198d905327..09e47521ee0 100644 --- a/test/test_mpls.py +++ b/test/test_mpls.py @@ -1972,10 +1972,10 @@ class TestMPLSL2(VppTestCase): # # add to tunnel to the customers bridge-domain # - self.vapi.sw_interface_set_l2_bridge(mpls_tun.sw_if_index, - bd_id=1) - self.vapi.sw_interface_set_l2_bridge(self.pg1.sw_if_index, - bd_id=1) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=mpls_tun.sw_if_index, bd_id=1) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=self.pg1.sw_if_index, bd_id=1) # # Packet from the customer interface and from the core @@ -2027,12 +2027,10 @@ class TestMPLSL2(VppTestCase): # # remove interfaces from customers bridge-domain # - self.vapi.sw_interface_set_l2_bridge(mpls_tun.sw_if_index, - bd_id=1, - enable=0) - self.vapi.sw_interface_set_l2_bridge(self.pg1.sw_if_index, - bd_id=1, - enable=0) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=mpls_tun.sw_if_index, bd_id=1, enable=0) + self.vapi.sw_interface_set_l2_bridge( + rx_sw_if_index=self.pg1.sw_if_index, bd_id=1, enable=0) if __name__ == '__main__': unittest.main(testRunner=VppTestRunner) diff --git a/test/test_nat.py b/test/test_nat.py index f4978cfe223..b2c442f81e6 100644 --- a/test/test_nat.py +++ b/test/test_nat.py @@ -4236,9 +4236,9 @@ class TestNAT44EndpointDependent(MethodHolder): cls.pg5.admin_up() cls.vapi.ip_add_del_route(dst_address=cls.pg5.remote_ip4n, dst_address_length=32, - table_id=1, + next_hop_address=zero_ip4n, next_hop_sw_if_index=cls.pg5.sw_if_index, - next_hop_address=zero_ip4n) + table_id=1) cls.pg6._local_ip4 = "10.1.2.1" cls.pg6._local_ip4n = socket.inet_pton(socket.AF_INET, @@ -4251,25 +4251,23 @@ class TestNAT44EndpointDependent(MethodHolder): cls.pg6.admin_up() cls.vapi.ip_add_del_route(dst_address=cls.pg6.remote_ip4n, dst_address_length=32, - table_id=1, + next_hop_address=zero_ip4n, next_hop_sw_if_index=cls.pg6.sw_if_index, - next_hop_address=zero_ip4n) + table_id=1) cls.vapi.ip_add_del_route(dst_address=cls.pg6.remote_ip4n, dst_address_length=16, - next_hop_address=zero_ip4n, - table_id=0, + next_hop_address=zero_ip4n, table_id=0, next_hop_table_id=1) cls.vapi.ip_add_del_route(dst_address=zero_ip4n, dst_address_length=0, - next_hop_address=zero_ip4n, - table_id=1, + next_hop_address=zero_ip4n, table_id=1, next_hop_table_id=0) cls.vapi.ip_add_del_route(dst_address=zero_ip4n, dst_address_length=0, - table_id=0, + next_hop_address=cls.pg1.local_ip4n, next_hop_sw_if_index=cls.pg1.sw_if_index, - next_hop_address=cls.pg1.local_ip4n) + table_id=0) cls.pg5.resolve_arp() cls.pg6.resolve_arp() @@ -6458,10 +6456,11 @@ class TestNAT44Out2InDPO(MethodHolder): cls.pg1.config_ip6() cls.pg1.resolve_ndp() - cls.vapi.ip_add_del_route(is_ipv6=True, dst_address=b'\x00' * 16, + cls.vapi.ip_add_del_route(dst_address=b'\x00' * 16, dst_address_length=0, next_hop_address=cls.pg1.remote_ip6n, - next_hop_sw_if_index=cls.pg1.sw_if_index) + next_hop_sw_if_index=cls.pg1.sw_if_index, + is_ipv6=True) except Exception: super(TestNAT44Out2InDPO, cls).tearDownClass() diff --git a/test/test_span.py b/test/test_span.py index 021eed83177..b6f816e9cf2 100644 --- a/test/test_span.py +++ b/test/test_span.py @@ -53,10 +53,8 @@ class TestSpan(VppTestCase): i.resolve_arp() cls.vxlan = cls.vapi.vxlan_add_del_tunnel( - src_addr=cls.pg2.local_ip4n, - dst_addr=cls.pg2.remote_ip4n, - vni=1111, - is_add=1) + src_address=cls.pg2.local_ip4n, dst_address=cls.pg2.remote_ip4n, + is_add=1, vni=1111) def setUp(self): super(TestSpan, self).setUp() @@ -72,8 +70,8 @@ class TestSpan(VppTestCase): self.vapi.sw_interface_set_l2_xconnect(b, a, enable=is_add) def bridge(self, sw_if_index, is_add=1): - self.vapi.sw_interface_set_l2_bridge( - sw_if_index, bd_id=self.bd_id, enable=is_add) + self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=sw_if_index, + bd_id=self.bd_id, enable=is_add) def _remove_tag(self, packet, vlan, tag_type): self.assertEqual(packet.type, tag_type) @@ -526,9 +524,9 @@ class TestSpan(VppTestCase): # Create bi-directional cross-connects between pg0 and pg1 self.vapi.sw_interface_set_l2_bridge( - self.sub_if.sw_if_index, bd_id=99, enable=1) + rx_sw_if_index=self.sub_if.sw_if_index, bd_id=99, enable=1) self.vapi.sw_interface_set_l2_bridge( - self.pg1.sw_if_index, bd_id=99, enable=1) + rx_sw_if_index=self.pg1.sw_if_index, bd_id=99, enable=1) # Create incoming packet streams for packet-generator interfaces pg0_pkts = self.create_stream( @@ -558,9 +556,9 @@ class TestSpan(VppTestCase): self.bridge(self.pg2.sw_if_index, is_add=0) self.vapi.sw_interface_set_l2_bridge( - self.sub_if.sw_if_index, bd_id=99, enable=0) + rx_sw_if_index=self.sub_if.sw_if_index, bd_id=99, enable=0) self.vapi.sw_interface_set_l2_bridge( - self.pg1.sw_if_index, bd_id=99, enable=0) + rx_sw_if_index=self.pg1.sw_if_index, bd_id=99, enable=0) # Disable SPAN on pg0 (mirrored to pg2) self.vapi.sw_interface_span_enable_disable( self.sub_if.sw_if_index, self.pg2.sw_if_index, state=0, is_l2=1) diff --git a/test/test_vtr.py b/test/test_vtr.py index 02df2ce2c4b..d69dd20dc51 100644 --- a/test/test_vtr.py +++ b/test/test_vtr.py @@ -49,7 +49,7 @@ class TestVtr(VppTestCase): for pg_if in cls.pg_interfaces: sw_if_index = pg_if.sub_if.sw_if_index \ if hasattr(pg_if, 'sub_if') else pg_if.sw_if_index - cls.vapi.sw_interface_set_l2_bridge(sw_if_index, + cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=sw_if_index, bd_id=cls.bd_id) # setup all interfaces @@ -168,8 +168,8 @@ class TestVtr(VppTestCase): return i = VppDot1QSubint(self, self.pg0, tags[0].vlan) - self.vapi.sw_interface_set_l2_bridge( - i.sw_if_index, bd_id=self.bd_id, enable=1) + self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=i.sw_if_index, + bd_id=self.bd_id, enable=1) i.admin_up() p = self.create_packet(self.pg0, swif, do_dot1=False) @@ -181,8 +181,8 @@ class TestVtr(VppTestCase): swif.sub_if.remove_dot1_layer(rx[0]) self.assertTrue(Dot1Q not in rx[0]) - self.vapi.sw_interface_set_l2_bridge( - i.sw_if_index, bd_id=self.bd_id, enable=0) + self.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=i.sw_if_index, + bd_id=self.bd_id, enable=0) i.remove_vpp_config() def test_1ad_vtr_pop_1(self): diff --git a/test/test_vxlan.py b/test/test_vxlan.py index 34bf11a53e4..7e3ea50c2e4 100644 --- a/test/test_vxlan.py +++ b/test/test_vxlan.py @@ -88,12 +88,13 @@ class TestVxlan(BridgeDomain, VppTestCase): for dest_ip4n in ip4n_range(next_hop_address, ip_range_start, ip_range_end): # add host route so dest_ip4n will not be resolved - cls.vapi.ip_add_del_route(dest_ip4n, 32, next_hop_address) - r = cls.vapi.vxlan_add_del_tunnel( - src_addr=cls.pg0.local_ip4n, - dst_addr=dest_ip4n, - vni=vni) - cls.vapi.sw_interface_set_l2_bridge(r.sw_if_index, bd_id=vni) + cls.vapi.ip_add_del_route(dst_address=dest_ip4n, + dst_address_length=32, + next_hop_address=next_hop_address) + r = cls.vapi.vxlan_add_del_tunnel(src_address=cls.pg0.local_ip4n, + dst_address=dest_ip4n, 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): @@ -105,12 +106,10 @@ class TestVxlan(BridgeDomain, VppTestCase): vni_start = 10000 vni_end = vni_start + n_shared_dst_tunnels for vni in range(vni_start, vni_end): - r = cls.vapi.vxlan_add_del_tunnel( - src_addr=cls.pg0.local_ip4n, - dst_addr=cls.mcast_ip4n, - mcast_sw_if_index=1, - vni=vni, - is_add=is_add) + r = cls.vapi.vxlan_add_del_tunnel(src_address=cls.pg0.local_ip4n, + dst_address=cls.mcast_ip4n, + mcast_sw_if_index=1, + is_add=is_add, vni=vni) if r.sw_if_index == 0xffffffff: raise "bad sw_if_index" @@ -133,12 +132,10 @@ class TestVxlan(BridgeDomain, VppTestCase): for dest_ip4n in ip4n_range(cls.mcast_ip4n, ip_range_start, ip_range_end): vni = bytearray(dest_ip4n)[3] - cls.vapi.vxlan_add_del_tunnel( - src_addr=cls.pg0.local_ip4n, - dst_addr=dest_ip4n, - mcast_sw_if_index=1, - vni=vni, - is_add=is_add) + cls.vapi.vxlan_add_del_tunnel(src_address=cls.pg0.local_ip4n, + dst_address=dest_ip4n, + mcast_sw_if_index=1, is_add=is_add, + vni=vni) @classmethod def add_mcast_tunnels_load(cls): @@ -182,29 +179,27 @@ class TestVxlan(BridgeDomain, VppTestCase): # Create VXLAN VTEP on VPP pg0, and put vxlan_tunnel0 and pg1 # into BD. cls.single_tunnel_bd = 1 - r = cls.vapi.vxlan_add_del_tunnel( - src_addr=cls.pg0.local_ip4n, - dst_addr=cls.pg0.remote_ip4n, - vni=cls.single_tunnel_bd) - cls.vapi.sw_interface_set_l2_bridge(r.sw_if_index, - bd_id=cls.single_tunnel_bd) - cls.vapi.sw_interface_set_l2_bridge(cls.pg1.sw_if_index, + r = cls.vapi.vxlan_add_del_tunnel(src_address=cls.pg0.local_ip4n, + dst_address=cls.pg0.remote_ip4n, + vni=cls.single_tunnel_bd) + 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 = 2 cls.create_vxlan_flood_test_bd(cls.mcast_flood_bd, cls.n_ucast_tunnels) - r = cls.vapi.vxlan_add_del_tunnel( - src_addr=cls.pg0.local_ip4n, - dst_addr=cls.mcast_ip4n, - mcast_sw_if_index=1, - vni=cls.mcast_flood_bd) - cls.vapi.sw_interface_set_l2_bridge(r.sw_if_index, - bd_id=cls.mcast_flood_bd) - cls.vapi.sw_interface_set_l2_bridge(cls.pg2.sw_if_index, + r = cls.vapi.vxlan_add_del_tunnel(src_address=cls.pg0.local_ip4n, + dst_address=cls.mcast_ip4n, + 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() @@ -216,8 +211,8 @@ class TestVxlan(BridgeDomain, VppTestCase): cls.ucast_flood_bd = 3 cls.create_vxlan_flood_test_bd(cls.ucast_flood_bd, cls.n_ucast_tunnels) - cls.vapi.sw_interface_set_l2_bridge(cls.pg3.sw_if_index, - bd_id=cls.ucast_flood_bd) + 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(TestVxlan, cls).tearDownClass() raise diff --git a/test/test_vxlan6.py b/test/test_vxlan6.py index 5ae8e7e1268..6f8fee71ec0 100644 --- a/test/test_vxlan6.py +++ b/test/test_vxlan6.py @@ -89,13 +89,14 @@ class TestVxlan6(BridgeDomain, VppTestCase): for dest_ip6 in cls.ip_range(start, end): dest_ip6n = socket.inet_pton(socket.AF_INET6, dest_ip6) # add host route so dest ip will not be resolved - cls.vapi.ip_add_del_route(dest_ip6n, 128, next_hop, is_ipv6=1) - r = cls.vapi.vxlan_add_del_tunnel( - is_ipv6=1, - src_addr=cls.pg0.local_ip6n, - dst_addr=dest_ip6n, - vni=vni) - cls.vapi.sw_interface_set_l2_bridge(r.sw_if_index, bd_id=vni) + cls.vapi.ip_add_del_route(dst_address=dest_ip6n, + dst_address_length=128, + next_hop_address=next_hop, is_ipv6=1) + r = cls.vapi.vxlan_add_del_tunnel(src_address=cls.pg0.local_ip6n, + dst_address=dest_ip6n, is_ipv6=1, + vni=vni) + cls.vapi.sw_interface_set_l2_bridge(rx_sw_if_index=r.sw_if_index, + bd_id=vni) @classmethod def add_mcast_tunnels_load(cls): @@ -136,37 +137,35 @@ class TestVxlan6(BridgeDomain, VppTestCase): # Create VXLAN VTEP on VPP pg0, and put vxlan_tunnel0 and pg1 # into BD. cls.single_tunnel_bd = 1 - r = cls.vapi.vxlan_add_del_tunnel( - is_ipv6=1, - src_addr=cls.pg0.local_ip6n, - dst_addr=cls.pg0.remote_ip6n, - vni=cls.single_tunnel_bd) - cls.vapi.sw_interface_set_l2_bridge(r.sw_if_index, - bd_id=cls.single_tunnel_bd) - cls.vapi.sw_interface_set_l2_bridge(cls.pg1.sw_if_index, + r = cls.vapi.vxlan_add_del_tunnel(src_address=cls.pg0.local_ip6n, + dst_address=cls.pg0.remote_ip6n, + is_ipv6=1, + vni=cls.single_tunnel_bd) + 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 = 2 cls.create_vxlan_flood_test_bd(cls.mcast_flood_bd, cls.n_ucast_tunnels) - r = cls.vapi.vxlan_add_del_tunnel( - mcast_sw_if_index=1, - src_addr=cls.pg0.local_ip6n, - dst_addr=cls.mcast_ip6n, - vni=cls.mcast_flood_bd, is_ipv6=1) - cls.vapi.sw_interface_set_l2_bridge(r.sw_if_index, - bd_id=cls.mcast_flood_bd) - cls.vapi.sw_interface_set_l2_bridge(cls.pg2.sw_if_index, + r = cls.vapi.vxlan_add_del_tunnel(src_address=cls.pg0.local_ip6n, + dst_address=cls.mcast_ip6n, + mcast_sw_if_index=1, is_ipv6=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) # Setup vni 3 to test unicast flooding cls.ucast_flood_bd = 3 cls.create_vxlan_flood_test_bd(cls.ucast_flood_bd, cls.n_ucast_tunnels) - cls.vapi.sw_interface_set_l2_bridge(cls.pg3.sw_if_index, - bd_id=cls.ucast_flood_bd) + 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(TestVxlan6, cls).tearDownClass() raise diff --git a/test/test_vxlan_gbp.py b/test/test_vxlan_gbp.py index ee106a5769f..11e119822ee 100644 --- a/test/test_vxlan_gbp.py +++ b/test/test_vxlan_gbp.py @@ -96,12 +96,15 @@ class TestVxlanGbp(VppTestCase): ip_range_end): # add host route so dest_ip4n will not be resolved vip = VppIpAddress(dest_ip4) - cls.vapi.ip_add_del_route(vip.bytes, 32, next_hop_address) + cls.vapi.ip_add_del_route(dst_address=vip.bytes, + dst_address_length=32, + next_hop_address=next_hop_address) r = cls.vapi.vxlan_gbp_tunnel_add_del( VppIpAddress(cls.pg0.local_ip4).encode(), vip.encode(), vni=vni) - cls.vapi.sw_interface_set_l2_bridge(r.sw_if_index, bd_id=vni) + 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. @@ -136,10 +139,10 @@ class TestVxlanGbp(VppTestCase): VppIpAddress(cls.pg0.local_ip4).encode(), VppIpAddress(cls.pg0.remote_ip4).encode(), vni=cls.single_tunnel_bd) - cls.vapi.sw_interface_set_l2_bridge(r.sw_if_index, - bd_id=cls.single_tunnel_bd) - cls.vapi.sw_interface_set_l2_bridge(cls.pg1.sw_if_index, + 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 @@ -147,8 +150,8 @@ class TestVxlanGbp(VppTestCase): 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(cls.pg3.sw_if_index, - bd_id=cls.ucast_flood_bd) + 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 diff --git a/test/test_vxlan_gpe.py b/test/test_vxlan_gpe.py index f635bb1d077..6ee33d59c9e 100644 --- a/test/test_vxlan_gpe.py +++ b/test/test_vxlan_gpe.py @@ -87,12 +87,15 @@ class TestVxlanGpe(BridgeDomain, VppTestCase): for dest_ip4n in ip4n_range(next_hop_address, ip_range_start, ip_range_end): # add host route so dest_ip4n will not be resolved - cls.vapi.ip_add_del_route(dest_ip4n, 32, next_hop_address) + cls.vapi.ip_add_del_route(dst_address=dest_ip4n, + dst_address_length=32, + next_hop_address=next_hop_address) r = cls.vapi.vxlan_gpe_add_del_tunnel( src_addr=cls.pg0.local_ip4n, dst_addr=dest_ip4n, vni=vni) - cls.vapi.sw_interface_set_l2_bridge(r.sw_if_index, bd_id=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): @@ -185,10 +188,10 @@ class TestVxlanGpe(BridgeDomain, VppTestCase): src_addr=cls.pg0.local_ip4n, dst_addr=cls.pg0.remote_ip4n, vni=cls.single_tunnel_bd) - cls.vapi.sw_interface_set_l2_bridge(r.sw_if_index, - bd_id=cls.single_tunnel_bd) - cls.vapi.sw_interface_set_l2_bridge(cls.pg1.sw_if_index, + 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 @@ -200,10 +203,10 @@ class TestVxlanGpe(BridgeDomain, VppTestCase): dst_addr=cls.mcast_ip4n, mcast_sw_if_index=1, vni=cls.mcast_flood_bd) - cls.vapi.sw_interface_set_l2_bridge(r.sw_if_index, - bd_id=cls.mcast_flood_bd) - cls.vapi.sw_interface_set_l2_bridge(cls.pg2.sw_if_index, + 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() @@ -215,8 +218,8 @@ class TestVxlanGpe(BridgeDomain, VppTestCase): 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(cls.pg3.sw_if_index, - bd_id=cls.ucast_flood_bd) + 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 diff --git a/test/vpp_interface.py b/test/vpp_interface.py index 6797b10b3fe..84f694d7107 100644 --- a/test/vpp_interface.py +++ b/test/vpp_interface.py @@ -343,17 +343,17 @@ class VppInterface(object): suppress=suppress, send_unicast=send_unicast) + # TODO: This should accept ipaddress object. def ip6_ra_prefix(self, address, address_length, is_no=0, off_link=0, no_autoconfig=0, use_default=0): """Configure IPv6 RA suppress on the VPP interface.""" self.test.vapi.sw_interface_ip6nd_ra_prefix( - self.sw_if_index, - address, - address_length, - is_no=is_no, - off_link=off_link, - no_autoconfig=no_autoconfig, - use_default=use_default) + sw_if_index=self.sw_if_index, + prefix={'address': address, + 'address_length': address_length}, + use_default=use_default, + off_link=off_link, no_autoconfig=no_autoconfig, + is_no=is_no) def admin_up(self): """Put interface ADMIN-UP.""" diff --git a/test/vpp_ip_route.py b/test/vpp_ip_route.py index 2be0e7908c8..b7ceb3474d4 100644 --- a/test/vpp_ip_route.py +++ b/test/vpp_ip_route.py @@ -384,70 +384,67 @@ class VppIpRoute(VppObject): def add_vpp_config(self): if self.is_unreach or self.is_prohibit or self.is_drop: r = self._test.vapi.ip_add_del_route( - self.dest_addr, - self.dest_addr_len, - inet_pton(AF_INET6, "::"), - 0xffffffff, - is_local=self.is_local, + dst_address=self.dest_addr, + dst_address_length=self.dest_addr_len, + next_hop_address=inet_pton( + AF_INET6, "::"), + next_hop_sw_if_index=0xffffffff, + table_id=self.table_id, + is_drop=self.is_drop, is_unreach=self.is_unreach, is_prohibit=self.is_prohibit, - is_drop=self.is_drop, - table_id=self.table_id, - is_ipv6=self.is_ip6) + is_ipv6=self.is_ip6, + is_local=self.is_local) else: for path in self.paths: lstack = path.encode_labels() r = self._test.vapi.ip_add_del_route( - self.dest_addr, - self.dest_addr_len, - path.nh_addr, - path.nh_itf, - table_id=self.table_id, - next_hop_out_label_stack=lstack, + dst_address=self.dest_addr, + dst_address_length=self.dest_addr_len, + next_hop_address=path.nh_addr, + next_hop_sw_if_index=path.nh_itf, table_id=self.table_id, + next_hop_table_id=path.nh_table_id, next_hop_n_out_labels=len(lstack), + next_hop_out_label_stack=lstack, next_hop_via_label=path.nh_via_label, - next_hop_table_id=path.nh_table_id, next_hop_id=path.next_hop_id, - is_ipv6=self.is_ip6, - is_dvr=path.is_dvr, - is_local=self.is_local, is_resolve_host=path.is_resolve_host, is_resolve_attached=path.is_resolve_attached, - is_source_lookup=path.is_source_lookup, - is_udp_encap=path.is_udp_encap, - is_multipath=1 if len(self.paths) > 1 else 0) + is_ipv6=self.is_ip6, is_local=self.is_local, + is_multipath=1 if len(self.paths) > 1 else 0, + is_dvr=path.is_dvr, is_udp_encap=path.is_udp_encap, + is_source_lookup=path.is_source_lookup) self.stats_index = r.stats_index self._test.registry.register(self, self._test.logger) def remove_vpp_config(self): if self.is_unreach or self.is_prohibit or self.is_drop: self._test.vapi.ip_add_del_route( - self.dest_addr, - self.dest_addr_len, - inet_pton(AF_INET6, "::"), - 0xffffffff, - is_local=self.is_local, + dst_address=self.dest_addr, + dst_address_length=self.dest_addr_len, + next_hop_address=inet_pton( + AF_INET6, "::"), + next_hop_sw_if_index=0xffffffff, + table_id=self.table_id, is_add=0, is_unreach=self.is_unreach, is_prohibit=self.is_prohibit, - is_add=0, - table_id=self.table_id, - is_ipv6=self.is_ip6) + is_ipv6=self.is_ip6, + is_local=self.is_local) else: for path in self.paths: self._test.vapi.ip_add_del_route( - self.dest_addr, - self.dest_addr_len, - path.nh_addr, - path.nh_itf, + dst_address=self.dest_addr, + dst_address_length=self.dest_addr_len, + next_hop_address=path.nh_addr, + next_hop_sw_if_index=path.nh_itf, table_id=self.table_id, next_hop_table_id=path.nh_table_id, next_hop_via_label=path.nh_via_label, next_hop_id=path.next_hop_id, - is_add=0, - is_udp_encap=path.is_udp_encap, - is_ipv6=self.is_ip6, - is_dvr=path.is_dvr) + is_add=0, is_ipv6=self.is_ip6, + is_dvr=path.is_dvr, + is_udp_encap=path.is_udp_encap) def query_vpp_config(self): return find_route(self._test, @@ -735,33 +732,35 @@ class VppMplsRoute(VppObject): lstack = path.encode_labels() r = self._test.vapi.mpls_route_add_del( - self.local_label, - self.eos_bit, - path.proto, - path.nh_addr, - path.nh_itf, - is_multicast=self.is_multicast, - is_multipath=is_multipath, - table_id=self.table_id, - is_interface_rx=path.is_interface_rx, - is_rpf_id=path.is_rpf_id, - next_hop_out_label_stack=lstack, - next_hop_n_out_labels=len(lstack), - next_hop_via_label=path.nh_via_label, - next_hop_table_id=path.nh_table_id) + mr_label=self.local_label, + mr_eos=self.eos_bit, + mr_next_hop_proto=path.proto, + mr_next_hop=path.nh_addr, + mr_next_hop_sw_if_index=path.nh_itf, + mr_table_id=self.table_id, + mr_next_hop_table_id=path.nh_table_id, + mr_next_hop_n_out_labels=len( + lstack), + mr_next_hop_out_label_stack=lstack, + mr_next_hop_via_label=path.nh_via_label, + mr_is_interface_rx=path.is_interface_rx, + mr_is_rpf_id=path.is_rpf_id, + mr_is_multicast=self.is_multicast, + mr_is_multipath=is_multipath) self.stats_index = r.stats_index self._test.registry.register(self, self._test.logger) def remove_vpp_config(self): for path in self.paths: - self._test.vapi.mpls_route_add_del(self.local_label, - self.eos_bit, - path.proto, - path.nh_addr, - path.nh_itf, - is_rpf_id=path.is_rpf_id, - table_id=self.table_id, - is_add=0) + self._test.vapi.mpls_route_add_del( + mr_label=self.local_label, + mr_eos=self.eos_bit, + mr_next_hop_proto=path.proto, + mr_next_hop=path.nh_addr, + mr_next_hop_sw_if_index=path.nh_itf, + mr_table_id=self.table_id, + mr_is_rpf_id=path.is_rpf_id, + mr_is_add=0) def query_vpp_config(self): return find_mpls_route(self._test, self.table_id, diff --git a/test/vpp_l2.py b/test/vpp_l2.py index 72f14dcfa3c..45b7d69dd01 100644 --- a/test/vpp_l2.py +++ b/test/vpp_l2.py @@ -79,18 +79,16 @@ class VppBridgeDomain(VppObject): self.arp_term = arp_term def add_vpp_config(self): - self._test.vapi.bridge_domain_add_del( - self.bd_id, - is_add=1, - flood=self.flood, - uu_flood=self.uu_flood, - forward=self.forward, - learn=self.learn, - arp_term=self.arp_term) + self._test.vapi.bridge_domain_add_del(bd_id=self.bd_id, + flood=self.flood, + uu_flood=self.uu_flood, + forward=self.forward, + learn=self.learn, + arp_term=self.arp_term, is_add=1) self._test.registry.register(self, self._test.logger) def remove_vpp_config(self): - self._test.vapi.bridge_domain_add_del(self.bd_id, is_add=0) + self._test.vapi.bridge_domain_add_del(bd_id=self.bd_id, is_add=0) def query_vpp_config(self): return find_bridge_domain(self._test, self.bd_id) @@ -113,18 +111,14 @@ class VppBridgeDomainPort(VppObject): def add_vpp_config(self): self._test.vapi.sw_interface_set_l2_bridge( - self.itf.sw_if_index, - self.bd.bd_id, - port_type=self.port_type, - enable=1) + rx_sw_if_index=self.itf.sw_if_index, bd_id=self.bd.bd_id, + port_type=self.port_type, enable=1) self._test.registry.register(self, self._test.logger) def remove_vpp_config(self): self._test.vapi.sw_interface_set_l2_bridge( - self.itf.sw_if_index, - self.bd.bd_id, - port_type=self.port_type, - enable=0) + rx_sw_if_index=self.itf.sw_if_index, bd_id=self.bd.bd_id, + port_type=self.port_type, enable=0) def query_vpp_config(self): return find_bridge_domain_port(self._test, diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py index ad64da6b9f2..bce8336de05 100644 --- a/test/vpp_papi_provider.py +++ b/test/vpp_papi_provider.py @@ -123,9 +123,11 @@ defaultmapping = { 'macip_acl_dump': {'acl_index': 4294967295, }, 'macip_acl_interface_add_del': {'is_add': 1, }, 'mpls_ip_bind_unbind': {'is_ip4': 1, 'is_bind': 1, }, - 'mpls_route_add_del': {'next_hop_sw_if_index': 4294967295, - 'next_hop_weight': 1, 'next_hop_via_label': 1048576, - 'is_add': 1, 'classify_table_index': 4294967295, }, + 'mpls_route_add_del': {'mr_next_hop_sw_if_index': 4294967295, + 'mr_next_hop_weight': 1, + 'mr_next_hop_via_label': 1048576, + 'mr_is_add': 1, + 'mr_classify_table_index': 4294967295, }, 'mpls_table_add_del': {'is_add': 1, }, 'mpls_tunnel_add_del': {'next_hop_sw_if_index': 4294967295, 'next_hop_weight': 1, @@ -410,145 +412,6 @@ class VppPapiProvider(object): """ return cli + "\n" + str(self.cli(cli)) - def set_ip_flow_hash(self, - table_id, - src=1, - dst=1, - sport=1, - dport=1, - proto=1, - reverse=0, - is_ip6=0): - return self.api(self.papi.set_ip_flow_hash, - {'vrf_id': table_id, - 'src': src, - 'dst': dst, - 'dport': dport, - 'sport': sport, - 'proto': proto, - 'reverse': reverse, - 'is_ipv6': is_ip6}) - - def sw_interface_ip6nd_ra_prefix(self, - sw_if_index, - address, - address_length, - use_default=0, - no_advertise=0, - off_link=0, - no_autoconfig=0, - no_onlink=0, - is_no=0, - val_lifetime=0xffffffff, - pref_lifetime=0xffffffff): - return self.api(self.papi.sw_interface_ip6nd_ra_prefix, - {'sw_if_index': sw_if_index, - 'prefix': { - 'address': address, - 'address_length': address_length, - }, - 'use_default': use_default, - 'no_advertise': no_advertise, - 'off_link': off_link, - 'no_autoconfig': no_autoconfig, - 'no_onlink': no_onlink, - 'is_no': is_no, - 'val_lifetime': val_lifetime, - 'pref_lifetime': pref_lifetime}) - - def vxlan_add_del_tunnel( - self, - src_addr, - dst_addr, - mcast_sw_if_index=0xFFFFFFFF, - is_add=1, - is_ipv6=0, - encap_vrf_id=0, - decap_next_index=0xFFFFFFFF, - vni=0, - instance=0xFFFFFFFF): - """ - - :param dst_addr: - :param src_addr: - :param is_add: (Default value = 1) - :param is_ipv6: (Default value = 0) - :param encap_vrf_id: (Default value = 0) - :param decap_next_index: (Default value = 0xFFFFFFFF) - :param mcast_sw_if_index: (Default value = 0xFFFFFFFF) - :param vni: (Default value = 0) - :param instance: (Default value = 0xFFFFFFFF) - - """ - return self.api(self.papi.vxlan_add_del_tunnel, - {'is_add': is_add, - 'is_ipv6': is_ipv6, - 'src_address': src_addr, - 'dst_address': dst_addr, - 'mcast_sw_if_index': mcast_sw_if_index, - 'encap_vrf_id': encap_vrf_id, - 'decap_next_index': decap_next_index, - 'vni': vni, - 'instance': instance}) - - def geneve_add_del_tunnel( - self, - local_addr, - remote_addr, - mcast_sw_if_index=0xFFFFFFFF, - is_add=1, - is_ipv6=0, - encap_vrf_id=0, - decap_next_index=0xFFFFFFFF, - vni=0): - """ - - :param remote_addr: - :param local_addr: - :param is_add: (Default value = 1) - :param is_ipv6: (Default value = 0) - :param encap_vrf_id: (Default value = 0) - :param decap_next_index: (Default value = 0xFFFFFFFF) - :param mcast_sw_if_index: (Default value = 0xFFFFFFFF) - :param vni: (Default value = 0) - - """ - return self.api(self.papi.geneve_add_del_tunnel, - {'is_add': is_add, - 'is_ipv6': is_ipv6, - 'local_address': local_addr, - 'remote_address': remote_addr, - 'mcast_sw_if_index': mcast_sw_if_index, - 'encap_vrf_id': encap_vrf_id, - 'decap_next_index': decap_next_index, - 'vni': vni}) - - def bridge_domain_add_del(self, bd_id, flood=1, uu_flood=1, forward=1, - learn=1, arp_term=0, is_add=1): - """Create/delete bridge domain. - - :param int bd_id: Bridge domain index. - :param int flood: Enable/disable bcast/mcast flooding in the BD. - (Default value = 1) - :param int uu_flood: Enable/disable unknown unicast flood in the BD. - (Default value = 1) - :param int forward: Enable/disable forwarding on all interfaces in - the BD. (Default value = 1) - :param int learn: Enable/disable learning on all interfaces in the BD. - (Default value = 1) - :param int arp_term: Enable/disable arp termination in the BD. - (Default value = 1) - :param int is_add: Add or delete flag. (Default value = 1) - """ - return self.api(self.papi.bridge_domain_add_del, - {'bd_id': bd_id, - 'flood': flood, - 'uu_flood': uu_flood, - 'forward': forward, - 'learn': learn, - 'arp_term': arp_term, - 'is_add': is_add}) - def want_ip4_arp_events(self, enable_disable=1, ip="0.0.0.0"): return self.api(self.papi.want_ip4_arp_events, {'enable_disable': enable_disable, @@ -599,24 +462,6 @@ class VppPapiProvider(object): {'enable_disable': enable_disable, 'pid': os.getpid()}) - def dhcp6_send_client_message(self, msg_type, sw_if_index, T1, T2, - addresses, server_index=0xFFFFFFFF, - irt=0, mrt=0, mrc=1, mrd=0, stop=0, - ): - return self.api(self.papi.dhcp6_send_client_message, - {'sw_if_index': sw_if_index, - 'server_index': server_index, - 'irt': irt, - 'mrt': mrt, - 'mrc': mrc, - 'mrd': mrd, - 'stop': stop, - 'msg_type': msg_type, - 'T1': T1, - 'T2': T2, - 'n_addresses': len(addresses), - 'addresses': addresses}) - def dhcp6_pd_send_client_message(self, msg_type, sw_if_index, T1, T2, prefixes, server_index=0xFFFFFFFF, irt=0, mrt=0, mrc=1, mrd=0, stop=0, @@ -658,107 +503,11 @@ class VppPapiProvider(object): 'prefix_length': prefix_length, 'is_add': is_add}) - def sw_interface_set_l2_bridge(self, sw_if_index, bd_id, - shg=0, port_type=L2_PORT_TYPE.NORMAL, - enable=1): - """Add/remove interface to/from bridge domain. - - :param int sw_if_index: Software interface index of the interface. - :param int bd_id: Bridge domain index. - :param int shg: Split-horizon group index. (Default value = 0) - :param int bvi: Set interface as a bridge group virtual interface. - (Default value = 0) - :param int enable: Add or remove interface. (Default value = 1) - """ - return self.api(self.papi.sw_interface_set_l2_bridge, - {'rx_sw_if_index': sw_if_index, - 'bd_id': bd_id, - 'shg': shg, - 'port_type': port_type, - 'enable': enable}) - - def bridge_flags(self, bd_id, is_set, feature_bitmap): - """Enable/disable required feature of the bridge domain with defined - ID. - - :param int bd_id: Bridge domain ID. - :param int is_set: Set to 1 to enable, set to 0 to disable the feature. - :param int flags: Bitmap value of the feature to be set: - - learn (1 << 0), - - forward (1 << 1), - - flood (1 << 2), - - uu-flood (1 << 3) or - - arp-term (1 << 4). - """ - return self.api(self.papi.bridge_flags, - {'bd_id': bd_id, - 'is_set': is_set, - 'flags': feature_bitmap}) - - def l2_interface_vlan_tag_rewrite( - self, - sw_if_index, - vtr_oper, - push=0, - tag1=0, - tag2=0): - """L2 interface vlan tag rewrite configure request - :param client_index - opaque cookie to identify the sender - :param context - sender context, to match reply w/ request - :param sw_if_index - interface the operation is applied to - :param vtr_op - Choose from l2_vtr_op_t enum values - :param push_dot1q - first pushed flag dot1q id set, else dot1ad - :param tag1 - Needed for any push or translate vtr op - :param tag2 - Needed for any push 2 or translate x-2 vtr ops - - """ - return self.api(self.papi.l2_interface_vlan_tag_rewrite, - {'sw_if_index': sw_if_index, - 'vtr_op': vtr_oper, - 'push_dot1q': push, - 'tag1': tag1, - 'tag2': tag2}) - def sw_interface_set_mac_address(self, sw_if_index, mac): return self.api(self.papi.sw_interface_set_mac_address, {'sw_if_index': sw_if_index, 'mac_address': mac}) - def create_subif(self, sw_if_index, sub_id, outer_vlan, inner_vlan, - no_tags=0, one_tag=0, two_tags=0, dot1ad=0, exact_match=0, - default_sub=0, outer_vlan_id_any=0, inner_vlan_id_any=0): - """Create subinterface - from vpe.api: set dot1ad = 0 for dot1q, set dot1ad = 1 for dot1ad - - :param sub_id: param inner_vlan: - :param sw_if_index: - :param outer_vlan: - :param inner_vlan: - :param no_tags: (Default value = 0) - :param one_tag: (Default value = 0) - :param two_tags: (Default value = 0) - :param dot1ad: (Default value = 0) - :param exact_match: (Default value = 0) - :param default_sub: (Default value = 0) - :param outer_vlan_id_any: (Default value = 0) - :param inner_vlan_id_any: (Default value = 0) - - """ - return self.api( - self.papi.create_subif, - {'sw_if_index': sw_if_index, - 'sub_id': sub_id, - 'no_tags': no_tags, - 'one_tag': one_tag, - 'two_tags': two_tags, - 'dot1ad': dot1ad, - 'exact_match': exact_match, - 'default_sub': default_sub, - 'outer_vlan_id_any': outer_vlan_id_any, - 'inner_vlan_id_any': inner_vlan_id_any, - 'outer_vlan_id': outer_vlan, - 'inner_vlan_id': inner_vlan}) - def p2p_ethernet_add(self, sw_if_index, remote_mac, subif_id): """Create p2p ethernet subinterface @@ -803,85 +552,6 @@ class VppPapiProvider(object): return self.api(self.papi.create_loopback, {'mac_address': mac}) - def ip_add_del_route( - self, - dst_address, - dst_address_length, - next_hop_address, - next_hop_sw_if_index=0xFFFFFFFF, - table_id=0, - next_hop_table_id=0, - next_hop_weight=1, - next_hop_n_out_labels=0, - next_hop_out_label_stack=[], - next_hop_via_label=MPLS_LABEL_INVALID, - next_hop_id=0xFFFFFFFF, - is_resolve_host=0, - is_resolve_attached=0, - classify_table_index=0xFFFFFFFF, - is_add=1, - is_drop=0, - is_unreach=0, - is_prohibit=0, - is_ipv6=0, - is_local=0, - is_classify=0, - is_multipath=0, - is_dvr=0, - is_udp_encap=0, - is_source_lookup=0): - """ - - :param dst_address_length: - :param next_hop_sw_if_index: (Default value = 0xFFFFFFFF) - :param dst_address: - :param next_hop_address: - :param next_hop_sw_if_index: (Default value = 0xFFFFFFFF) - :param vrf_id: (Default value = 0) - :param lookup_in_vrf: (Default value = 0) - :param classify_table_index: (Default value = 0xFFFFFFFF) - :param is_add: (Default value = 1) - :param is_drop: (Default value = 0) - :param is_ipv6: (Default value = 0) - :param is_local: (Default value = 0) - :param is_classify: (Default value = 0) - :param is_multipath: (Default value = 0) - :param is_resolve_host: (Default value = 0) - :param is_resolve_attached: (Default value = 0) - :param is_dvr: (Default value = 0) - :param is_source_lookup: (Default value = 0) - :param next_hop_weight: (Default value = 1) - - """ - - return self.api( - self.papi.ip_add_del_route, - {'next_hop_sw_if_index': next_hop_sw_if_index, - 'table_id': table_id, - 'classify_table_index': classify_table_index, - 'next_hop_table_id': next_hop_table_id, - 'is_add': is_add, - 'is_drop': is_drop, - 'is_unreach': is_unreach, - 'is_prohibit': is_prohibit, - 'is_ipv6': is_ipv6, - 'is_local': is_local, - 'is_classify': is_classify, - 'is_multipath': is_multipath, - 'is_resolve_host': is_resolve_host, - 'is_resolve_attached': is_resolve_attached, - 'is_dvr': is_dvr, - 'is_source_lookup': is_source_lookup, - 'is_udp_encap': is_udp_encap, - 'next_hop_weight': next_hop_weight, - 'dst_address_length': dst_address_length, - 'dst_address': dst_address, - 'next_hop_id': next_hop_id, - 'next_hop_address': next_hop_address, - 'next_hop_n_out_labels': next_hop_n_out_labels, - 'next_hop_via_label': next_hop_via_label, - 'next_hop_out_label_stack': next_hop_out_label_stack}) - def ip_neighbor_add_del(self, sw_if_index, mac_address, @@ -1022,74 +692,6 @@ class VppPapiProvider(object): {'mt_table_id': table_id, 'mt_is_add': is_add}) - def mpls_route_add_del( - self, - label, - eos, - next_hop_proto, - next_hop_address, - next_hop_sw_if_index=0xFFFFFFFF, - table_id=0, - next_hop_table_id=0, - next_hop_weight=1, - next_hop_n_out_labels=0, - next_hop_out_label_stack=[], - next_hop_via_label=MPLS_LABEL_INVALID, - is_resolve_host=0, - is_resolve_attached=0, - is_interface_rx=0, - is_rpf_id=0, - is_multicast=0, - is_add=1, - is_drop=0, - is_multipath=0, - classify_table_index=0xFFFFFFFF, - is_classify=0): - """ - - :param dst_address_length: - :param next_hop_sw_if_index: (Default value = 0xFFFFFFFF) - :param dst_address: - :param next_hop_address: - :param next_hop_sw_if_index: (Default value = 0xFFFFFFFF) - :param vrf_id: (Default value = 0) - :param lookup_in_vrf: (Default value = 0) - :param classify_table_index: (Default value = 0xFFFFFFFF) - :param is_add: (Default value = 1) - :param is_drop: (Default value = 0) - :param is_ipv6: (Default value = 0) - :param is_local: (Default value = 0) - :param is_classify: (Default value = 0) - :param is_multipath: (Default value = 0) - :param is_multicast: (Default value = 0) - :param is_resolve_host: (Default value = 0) - :param is_resolve_attached: (Default value = 0) - :param next_hop_weight: (Default value = 1) - - """ - return self.api( - self.papi.mpls_route_add_del, - {'mr_label': label, - 'mr_eos': eos, - 'mr_table_id': table_id, - 'mr_classify_table_index': classify_table_index, - 'mr_is_add': is_add, - 'mr_is_classify': is_classify, - 'mr_is_multipath': is_multipath, - 'mr_is_multicast': is_multicast, - 'mr_is_resolve_host': is_resolve_host, - 'mr_is_resolve_attached': is_resolve_attached, - 'mr_is_interface_rx': is_interface_rx, - 'mr_is_rpf_id': is_rpf_id, - 'mr_next_hop_proto': next_hop_proto, - 'mr_next_hop_weight': next_hop_weight, - 'mr_next_hop': next_hop_address, - 'mr_next_hop_n_out_labels': next_hop_n_out_labels, - 'mr_next_hop_sw_if_index': next_hop_sw_if_index, - 'mr_next_hop_table_id': next_hop_table_id, - 'mr_next_hop_via_label': next_hop_via_label, - 'mr_next_hop_out_label_stack': next_hop_out_label_stack}) - def mpls_ip_bind_unbind( self, label, diff --git a/test/vpp_sub_interface.py b/test/vpp_sub_interface.py index a374cba4354..15cd6edb8e0 100644 --- a/test/vpp_sub_interface.py +++ b/test/vpp_sub_interface.py @@ -120,7 +120,7 @@ class VppSubInterface(VppPGInterface): self._push1q = push1q self.test.vapi.l2_interface_vlan_tag_rewrite( - self.sw_if_index, vtr, push=self._push1q, + sw_if_index=self.sw_if_index, vtr_op=vtr, push_dot1q=self._push1q, tag1=self._tag1, tag2=self._tag2) self._vtr = vtr @@ -171,9 +171,10 @@ class VppDot1ADSubint(VppSubInterface): def __init__(self, test, parent, sub_id, outer_vlan, inner_vlan): super(VppDot1ADSubint, self).__init__(test, parent, sub_id) - r = test.vapi.create_subif(parent.sw_if_index, sub_id, outer_vlan, - inner_vlan, dot1ad=1, two_tags=1, - exact_match=1) + r = test.vapi.create_subif(sw_if_index=parent.sw_if_index, + sub_id=sub_id, outer_vlan_id=outer_vlan, + inner_vlan_id=inner_vlan, two_tags=1, + dot1ad=1, exact_match=1) self.set_sw_if_index(r.sw_if_index) self._outer_vlan = outer_vlan self._inner_vlan = inner_vlan |