aboutsummaryrefslogtreecommitdiffstats
path: root/test/vpp_papi_provider.py
diff options
context:
space:
mode:
authorNeale Ranns <neale.ranns@cisco.com>2018-05-01 05:17:55 -0700
committerOle Trøan <otroan@employees.org>2019-06-18 13:31:39 +0000
commit097fa66b986f06281f603767d321ab13ab6c88c3 (patch)
treeed052819615d08ee4bd0afbc34de7e64e4598105 /test/vpp_papi_provider.py
parent39baa32186fd3e4b20d9f58afbbfe7b8daebed62 (diff)
fib: fib api updates
Enhance the route add/del APIs to take a set of paths rather than just one. Most unicast routing protocols calcualte all the available paths in one run of the algorithm so updating all the paths at once is beneficial for the client. two knobs control the behaviour: is_multipath - if set the the set of paths passed will be added to those that already exist, otherwise the set will replace them. is_add - add or remove the set is_add=0, is_multipath=1 and an empty set, results in deleting the route. It is also considerably faster to add multiple paths at once, than one at a time: vat# ip_add_del_route 1.1.1.1/32 count 100000 multipath via 10.10.10.11 100000 routes in .572240 secs, 174751.80 routes/sec vat# ip_add_del_route 1.1.1.1/32 count 100000 multipath via 10.10.10.12 100000 routes in .528383 secs, 189256.54 routes/sec vat# ip_add_del_route 1.1.1.1/32 count 100000 multipath via 10.10.10.13 100000 routes in .757131 secs, 132077.52 routes/sec vat# ip_add_del_route 1.1.1.1/32 count 100000 multipath via 10.10.10.14 100000 routes in .878317 secs, 113854.12 routes/sec vat# ip_route_add_del 1.1.1.1/32 count 100000 multipath via 10.10.10.11 via 10.10.10.12 via 10.10.10.13 via 10.10.10.14 100000 routes in .900212 secs, 111084.93 routes/sec Change-Id: I416b93f7684745099c1adb0b33edac58c9339c1a Signed-off-by: Neale Ranns <neale.ranns@cisco.com> Signed-off-by: Ole Troan <ot@cisco.com> Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'test/vpp_papi_provider.py')
-rw-r--r--test/vpp_papi_provider.py237
1 files changed, 132 insertions, 105 deletions
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index 6a6fb45529e..038a3718dde 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -67,6 +67,7 @@ defaultmapping = {
'ip_neighbor_add_del': {'is_add': 1, },
'ip_punt_police': {'is_add': 1, },
'ip_punt_redirect': {'is_add': 1, },
+ 'ip_route_add_del': {'is_add': 1, },
'ip_table_add_del': {'is_add': 1, },
'ip_unnumbered_dump': {'sw_if_index': 4294967295, },
'ipsec_interface_add_del_spd': {'is_add': 1, },
@@ -506,6 +507,37 @@ class VppPapiProvider(object):
return self.api(self.papi.create_loopback,
{'mac_address': mac})
+ def ip_table_add_del(self,
+ table_id,
+ is_add=1,
+ is_ipv6=0):
+ """
+
+ :param table_id
+ :param is_add: (Default value = 1)
+ :param is_ipv6: (Default value = 0)
+
+ """
+
+ return self.api(
+ self.papi.ip_table_add_del,
+ {'table':
+ {
+ 'table_id': table_id,
+ 'is_ip6': is_ipv6
+ },
+ 'is_add': is_add})
+
+ def ip_table_dump(self):
+ return self.api(self.papi.ip_table_dump, {})
+
+ def ip_route_dump(self, table_id, is_ip6=False):
+ return self.api(self.papi.ip_route_dump,
+ {'table': {
+ 'table_id': table_id,
+ 'is_ip6': is_ip6
+ }})
+
def ip_neighbor_add_del(self,
sw_if_index,
mac_address,
@@ -631,6 +663,26 @@ class VppPapiProvider(object):
}
})
+ def udp_encap_del(self, id):
+ return self.api(self.papi.udp_encap_del, {'id': id})
+
+ def udp_encap_dump(self):
+ return self.api(self.papi.udp_encap_dump, {})
+
+ def want_udp_encap_stats(self, enable=1):
+ return self.api(self.papi.want_udp_encap_stats,
+ {'enable': enable,
+ 'pid': os.getpid()})
+
+ def mpls_route_dump(self, table_id):
+ return self.api(self.papi.mpls_route_dump,
+ {'table': {
+ 'mt_table_id': table_id
+ }})
+
+ def mpls_table_dump(self):
+ return self.api(self.papi.mpls_table_dump, {})
+
def mpls_table_add_del(
self,
table_id,
@@ -644,17 +696,43 @@ class VppPapiProvider(object):
return self.api(
self.papi.mpls_table_add_del,
- {'mt_table_id': table_id,
+ {'mt_table':
+ {
+ 'mt_table_id': table_id,
+ },
'mt_is_add': is_add})
+ def mpls_route_add_del(self,
+ table_id,
+ label,
+ eos,
+ eos_proto,
+ is_multicast,
+ paths,
+ is_add,
+ is_multipath):
+ """ MPLS Route add/del """
+ return self.api(
+ self.papi.mpls_route_add_del,
+ {'mr_route':
+ {
+ 'mr_table_id': table_id,
+ 'mr_label': label,
+ 'mr_eos': eos,
+ 'mr_eos_proto': eos_proto,
+ 'mr_is_multicast': is_multicast,
+ 'mr_n_paths': len(paths),
+ 'mr_paths': paths,
+ },
+ 'mr_is_add': is_add,
+ 'mr_is_multipath': is_multipath})
+
def mpls_ip_bind_unbind(
self,
label,
- dst_address,
- dst_address_length,
+ prefix,
table_id=0,
ip_table_id=0,
- is_ip4=1,
is_bind=1):
"""
"""
@@ -664,60 +742,28 @@ class VppPapiProvider(object):
'mb_label': label,
'mb_ip_table_id': ip_table_id,
'mb_is_bind': is_bind,
- 'mb_is_ip4': is_ip4,
- 'mb_address_length': dst_address_length,
- 'mb_address': dst_address})
+ 'mb_prefix': prefix})
def mpls_tunnel_add_del(
self,
tun_sw_if_index,
- next_hop_proto_is_ip4,
- next_hop_address,
- next_hop_sw_if_index=0xFFFFFFFF,
- 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,
+ paths,
is_add=1,
l2_only=0,
is_multicast=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 next_hop_weight: (Default value = 1)
- :param is_multicast: (Default value = 0)
-
"""
return self.api(
self.papi.mpls_tunnel_add_del,
- {'mt_sw_if_index': tun_sw_if_index,
- 'mt_is_add': is_add,
- 'mt_l2_only': l2_only,
- 'mt_is_multicast': is_multicast,
- 'mt_next_hop_proto_is_ip4': next_hop_proto_is_ip4,
- 'mt_next_hop_weight': next_hop_weight,
- 'mt_next_hop': next_hop_address,
- 'mt_next_hop_n_out_labels': next_hop_n_out_labels,
- 'mt_next_hop_sw_if_index': next_hop_sw_if_index,
- 'mt_next_hop_table_id': next_hop_table_id,
- 'mt_next_hop_via_label': next_hop_via_label,
- 'mt_next_hop_out_label_stack': next_hop_out_label_stack})
+ {'mt_is_add': is_add,
+ 'mt_tunnel':
+ {
+ 'mt_sw_if_index': tun_sw_if_index,
+ 'mt_l2_only': l2_only,
+ 'mt_is_multicast': is_multicast,
+ 'mt_n_paths': len(paths),
+ 'mt_paths': paths,
+ }})
def bfd_udp_add(self, sw_if_index, desired_min_tx, required_min_rx,
detect_mult, local_addr, peer_addr, is_ipv6=0,
@@ -1004,39 +1050,40 @@ class VppPapiProvider(object):
})
def ip_mroute_add_del(self,
- src_address,
- grp_address,
- grp_address_length,
+ table_id,
+ prefix,
e_flags,
- next_hop_afi,
- next_hop_sw_if_index,
- next_hop_address,
- i_flags,
- bier_imp=0,
- rpf_id=0,
- table_id=0,
+ rpf_id,
+ paths,
is_add=1,
- is_ipv6=0,
- is_local=0):
+ is_multipath=1):
"""
IP Multicast Route add/del
"""
return self.api(
self.papi.ip_mroute_add_del,
- {'next_hop_sw_if_index': next_hop_sw_if_index,
- 'entry_flags': e_flags,
- 'itf_flags': i_flags,
- 'table_id': table_id,
- 'rpf_id': rpf_id,
- 'is_add': is_add,
- 'is_ipv6': is_ipv6,
- 'is_local': is_local,
- 'bier_imp': bier_imp,
- 'next_hop_afi': next_hop_afi,
- 'grp_address_length': grp_address_length,
- 'grp_address': grp_address,
- 'src_address': src_address,
- 'nh_address': next_hop_address})
+ {
+ 'is_add': is_add,
+ 'is_multipath': is_multipath,
+ 'route': {
+ 'table_id': table_id,
+ 'entry_flags': e_flags,
+ 'rpf_id': rpf_id,
+ 'prefix': prefix,
+ 'n_paths': len(paths),
+ 'paths': paths,
+ }
+ })
+
+ def mfib_signal_dump(self):
+ return self.api(self.papi.mfib_signal_dump, {})
+
+ def ip_mroute_dump(self, table_id, is_ip6=False):
+ return self.api(self.papi.ip_mroute_dump,
+ {'table': {
+ 'table_id': table_id,
+ 'is_ip6': is_ip6
+ }})
def lisp_enable_disable(self, is_enabled):
return self.api(
@@ -1633,14 +1680,18 @@ class VppPapiProvider(object):
""" BIER Route add/del """
return self.api(
self.papi.bier_route_add_del,
- {'br_tbl_id': {"bt_set": bti.set_id,
- "bt_sub_domain": bti.sub_domain_id,
- "bt_hdr_len_id": bti.hdr_len_id},
- 'br_bp': bp,
- 'br_n_paths': len(paths),
- 'br_paths': paths,
- 'br_is_add': is_add,
- 'br_is_replace': is_replace})
+ {
+ 'br_route': {
+ 'br_tbl_id': {"bt_set": bti.set_id,
+ "bt_sub_domain": bti.sub_domain_id,
+ "bt_hdr_len_id": bti.hdr_len_id},
+ 'br_bp': bp,
+ 'br_n_paths': len(paths),
+ 'br_paths': paths,
+ },
+ 'br_is_add': is_add,
+ 'br_is_replace': is_replace
+ })
def bier_route_dump(self, bti):
return self.api(
@@ -2238,30 +2289,6 @@ class VppPapiProvider(object):
return self.api(self.papi.pipe_delete,
{'parent_sw_if_index': parent_sw_if_index})
- def memif_create(
- self,
- role,
- mode,
- rx_queues=None,
- tx_queues=None,
- _id=None,
- socket_id=None,
- secret=None,
- ring_size=None,
- buffer_size=None,
- hw_addr=None):
- return self.api(self.papi.memif_create,
- {'role': role,
- 'mode': mode,
- 'rx_queues': rx_queues,
- 'tx_queues': tx_queues,
- 'id': _id,
- 'socket_id': socket_id,
- 'secret': secret,
- 'ring_size': ring_size,
- 'buffer_size': buffer_size,
- 'hw_addr': hw_addr})
-
def svs_table_add_del(self, af, table_id, is_add=1):
return self.api(self.papi.svs_table_add_del,
{