aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/topology.py
diff options
context:
space:
mode:
authorPeter Mikus <pmikus@cisco.com>2018-01-02 14:37:24 +0100
committerPeter Mikus <pmikus@cisco.com>2018-01-04 06:30:18 +0000
commit92cbb44a89ca808df32e4a4cb137bed076a68a94 (patch)
tree904bb62e9bdb933ca57033b0efb56abb20142a7b /resources/libraries/python/topology.py
parentc293eae53515f7b94ac5a71b329a9a9655bd8c09 (diff)
TRex ASTF onboarding Part I
- Preparing initialization of TRex in L7 mode - Updating Topology files - Adding sample ASTF profiles Change-Id: If71f7f8f3db66425a1b543f1d29069a7543f4090 Signed-off-by: Peter Mikus <pmikus@cisco.com>
Diffstat (limited to 'resources/libraries/python/topology.py')
-rw-r--r--resources/libraries/python/topology.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/resources/libraries/python/topology.py b/resources/libraries/python/topology.py
index 4ff68ec43d..a5a446008b 100644
--- a/resources/libraries/python/topology.py
+++ b/resources/libraries/python/topology.py
@@ -600,6 +600,21 @@ class Topology(object):
return None
@staticmethod
+ def get_interface_ip4(node, iface_key):
+ """Get IP4 address for the interface.
+
+ :param node: Node to get interface mac on.
+ :param iface_key: Interface key from topology file.
+ :type node: dict
+ :type iface_key: str
+ :returns: Return IP4 or None if not found.
+ """
+ try:
+ return node['interfaces'][iface_key].get('ip4_address', None)
+ except KeyError:
+ return None
+
+ @staticmethod
def get_adjacent_node_and_interface(nodes_info, node, iface_key):
"""Get node and interface adjacent to specified interface
on local network.