aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/topology.py
diff options
context:
space:
mode:
authorselias <samelias@cisco.com>2016-09-13 16:51:37 +0200
committerPeter Mikus <pmikus@cisco.com>2016-10-03 06:41:33 +0000
commit19c91adadd57bfc4e7514993b2a711a826d52e04 (patch)
tree5c7656c69c6a3936838c5c6ddcf9313e7e98a6ba /resources/libraries/python/topology.py
parentc75b9804c9510d0a342563e41407089145b38d50 (diff)
CSIT-405: Honeycomb test update and cleanup
- update suite setup and constants to allow test runs again - cleanup basic interface keywords - cleanup L2-fib test data - add "continue on failure" keyword to some partially failing tests - add teardown to all suites, restarts honeycomb if suite had test failures - fix minor PEP-8 violations in Topology.py Change-Id: Ic5b434af71f77855f81461b280299b8318932c5a Signed-off-by: selias <samelias@cisco.com>
Diffstat (limited to 'resources/libraries/python/topology.py')
-rw-r--r--resources/libraries/python/topology.py34
1 files changed, 28 insertions, 6 deletions
diff --git a/resources/libraries/python/topology.py b/resources/libraries/python/topology.py
index a5c67d313c..c02991fbde 100644
--- a/resources/libraries/python/topology.py
+++ b/resources/libraries/python/topology.py
@@ -278,11 +278,12 @@ class Topology(object):
:return: Interface name of the interface connected to the given link.
:rtype: str
"""
- return Topology._get_interface_by_key_value(node, "vpp_sw_index", sw_index)
+ return Topology._get_interface_by_key_value(node, "vpp_sw_index",
+ sw_index)
@staticmethod
def get_interface_sw_index(node, iface_key):
- """Get VPP sw_if_index for the interface.
+ """Get VPP sw_if_index for the interface using interface key.
:param node: Node to get interface sw_if_index on.
:param iface_key: Interface key from topology file, or sw_index.
@@ -300,6 +301,26 @@ class Topology(object):
return None
@staticmethod
+ def get_interface_sw_index_by_name(node, iface_name):
+ """Get VPP sw_if_index for the interface using interface name.
+
+ :param node: Node to get interface sw_if_index on.
+ :param iface_name: Interface name.
+ :type node: dict
+ :type iface_name: str
+ :return: Return sw_if_index or None if not found.
+ :raises TypeError: If provided interface name is not a string.
+ """
+ try:
+ if isinstance(iface_name, basestring):
+ iface_key = Topology.get_interface_by_name(node, iface_name)
+ return node['interfaces'][iface_key].get('vpp_sw_index')
+ else:
+ raise TypeError("Interface name must be a string.")
+ except (KeyError, ValueError):
+ return None
+
+ @staticmethod
def get_interface_mtu(node, iface_key):
"""Get interface MTU.
@@ -514,7 +535,7 @@ class Topology(object):
if filt == interface['model']:
link_names.append(interface['link'])
elif (filter_list is not None) and ('model' not in interface):
- logger.trace("Cannot apply filter on interface: {}" \
+ logger.trace("Cannot apply filter on interface: {}"
.format(str(interface)))
else:
link_names.append(interface['link'])
@@ -534,8 +555,8 @@ class Topology(object):
:param filter_list_node2: Link filter criteria for node2.
:type node1: dict
:type node2: dict
- :type filter_list1: list of strings
- :type filter_list2: list of strings
+ :type filter_list_node1: list of strings
+ :type filter_list_node2: list of strings
:return: List of strings that represent connecting link names.
:rtype: list
"""
@@ -578,7 +599,8 @@ class Topology(object):
else:
return connecting_links[0]
- @keyword('Get egress interfaces name on "${node1}" for link with "${node2}"')
+ @keyword('Get egress interfaces name on "${node1}" for link with '
+ '"${node2}"')
def get_egress_interfaces_name_for_nodes(self, node1, node2):
"""Get egress interfaces on node1 for link with node2.