aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/InterfaceUtil.py
diff options
context:
space:
mode:
authorJan Gelety <jgelety@cisco.com>2017-10-23 12:56:04 +0200
committerJan Gelety <jgelety@cisco.com>2017-10-23 12:56:04 +0200
commit2cc797fa23da02eefa19637521098ec41622189b (patch)
tree9f36e5441ded069634f3d34c43760f200052b959 /resources/libraries/python/InterfaceUtil.py
parentb52c43bd354ee658d4f955995a08073a1338e898 (diff)
FIX: IPSec tunnel interface
- add following line per interface tunnel: set int unnum <ipsec> use <interface> Change-Id: Iff75f27b7cf25f3d24eea92366b1fd4a718c253b Signed-off-by: Jan Gelety <jgelety@cisco.com>
Diffstat (limited to 'resources/libraries/python/InterfaceUtil.py')
-rw-r--r--resources/libraries/python/InterfaceUtil.py23
1 files changed, 23 insertions, 0 deletions
diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py
index 795bb52933..a68b921146 100644
--- a/resources/libraries/python/InterfaceUtil.py
+++ b/resources/libraries/python/InterfaceUtil.py
@@ -221,6 +221,29 @@ class InterfaceUtil(object):
return data
@staticmethod
+ def vpp_get_interface_name(node, sw_if_index):
+ """Get interface name for the given SW interface index from actual
+ interface dump.
+
+ :param node: VPP node to get interface data from.
+ :param sw_if_index: SW interface index of the specific interface.
+ :type node: dict
+ :type sw_if_index: int
+ :returns: Name of the given interface.
+ :rtype: str
+ """
+
+ if_data = InterfaceUtil.vpp_get_interface_data(node, sw_if_index)
+ if if_data['sup_sw_if_index'] != if_data['sw_if_index']:
+ if_data = InterfaceUtil.vpp_get_interface_data(
+ node, if_data['sup_sw_if_index'])
+ try:
+ if_name = if_data["interface_name"]
+ except KeyError:
+ if_name = None
+ return if_name
+
+ @staticmethod
def vpp_get_interface_mac(node, interface=None):
"""Get MAC address for the given interface from actual interface dump.