X-Git-Url: https://gerrit.fd.io/r/gitweb?a=blobdiff_plain;f=resources%2Flibraries%2Fpython%2FIPUtil.py;h=17ba75d7fb0f46a9c916348c989774146f7495d3;hb=refs%2Fchanges%2F09%2F20509%2F3;hp=0c4356bb6447c9039bce35ac52f4d761c5bb6417;hpb=758d50dd77f6114b2d4fe0ca13d95ae111f7b110;p=csit.git diff --git a/resources/libraries/python/IPUtil.py b/resources/libraries/python/IPUtil.py index 0c4356bb64..17ba75d7fb 100644 --- a/resources/libraries/python/IPUtil.py +++ b/resources/libraries/python/IPUtil.py @@ -154,6 +154,21 @@ class IPUtil(object): PapiExecutor.run_cli_cmd(node, 'show ip6 fib') PapiExecutor.run_cli_cmd(node, 'show ip6 fib summary') + @staticmethod + def vpp_get_ip_tables_prefix(node, address): + """Get dump of all IP FIB tables on a VPP node. + + :param node: VPP node. + :type node: dict + """ + ip = ip_address(unicode(address)) + + PapiExecutor.run_cli_cmd( + node, 'show {ip_ver} fib {addr}/{addr_len}'.format( + ip_ver='ip6' if ip.version == 6 else 'ip', + addr=ip, + addr_len=ip.max_prefixlen)) + @staticmethod def get_interface_vrf_table(node, interface, ip_version='ipv4'): """Get vrf ID for the given interface. @@ -549,7 +564,7 @@ class IPUtil(object): if count > 100: gateway = kwargs.get("gateway", '') - + interface = kwargs.get("interface", '') vrf = kwargs.get("vrf", None) multipath = kwargs.get("multipath", False) @@ -559,6 +574,9 @@ class IPUtil(object): network=network, prefix_length=prefix_len, via='via {}'.format(gateway) if gateway else '', + sw_if_index='sw_if_index {}'.format( + InterfaceUtil.get_interface_index(node, interface)) + if interface else '', vrf='vrf {}'.format(vrf) if vrf else '', count='count {}'.format(count) if count else '', multipath='multipath' if multipath else '')