aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/InterfaceUtil.py
diff options
context:
space:
mode:
authorTibor Frank <tifrank@cisco.com>2016-08-24 16:09:20 +0200
committerJan Gelety <jgelety@cisco.com>2016-09-05 14:18:00 +0000
commit872e0d6cb093b92b5b594f329be173ebeac3047a (patch)
tree9d7c6046db2fef298556c0f7616636fdd0d25482 /resources/libraries/python/InterfaceUtil.py
parent1291bc395ff12bb3561813fc1813aa3776019a15 (diff)
CSIT-229: ip4-lispgpe-ip4
- main fib, - vrf, - phy2lisp Change-Id: Ic9bacef4574dc07b25041c4cd0653825a65c94fb Signed-off-by: Tibor Frank <tifrank@cisco.com> (cherry picked from commit c3bf9f6ad20223998c1103ba3061a5e338979e2b)
Diffstat (limited to 'resources/libraries/python/InterfaceUtil.py')
-rw-r--r--resources/libraries/python/InterfaceUtil.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/resources/libraries/python/InterfaceUtil.py b/resources/libraries/python/InterfaceUtil.py
index f5f1ce314e..11600a1d47 100644
--- a/resources/libraries/python/InterfaceUtil.py
+++ b/resources/libraries/python/InterfaceUtil.py
@@ -213,6 +213,28 @@ class InterfaceUtil(object):
return data
@staticmethod
+ def vpp_get_interface_mac(node, interface=None):
+ """Get MAC address for the given interface from actual interface dump.
+
+ :param node: VPP node to get interface data from.
+ :param interface: Numeric index or name string of a specific interface.
+ :type node: dict
+ :type interface: int or str
+ :return: MAC address.
+ :rtype: str
+ """
+
+ if_data = InterfaceUtil.vpp_get_interface_data(node, interface)
+ mac_data = [str(hex(item))[2:] for item in if_data['l2_address'][:6]]
+ mac_data_nice = []
+ for item in mac_data:
+ if len(item) == 1:
+ item = '0' + item
+ mac_data_nice.append(item)
+ mac = ":".join(mac_data_nice)
+ return mac
+
+ @staticmethod
def vpp_get_interface_ip_addresses(node, interface, ip_version):
"""Get list of IP addresses from an interface on a VPP node.