aboutsummaryrefslogtreecommitdiffstats
path: root/resources/libraries/python/NodePath.py
diff options
context:
space:
mode:
authorMiroslav Miklus <mmiklus@cisco.com>2016-04-18 17:15:40 +0200
committerStefan Kobza <skobza@cisco.com>2016-04-26 09:53:46 +0000
commitc8790d06d412b1daf303f6da9d8d11d97d053697 (patch)
tree602fb007cba1ae993fb24ba0f8fe4cb372dfd3bd /resources/libraries/python/NodePath.py
parent26f067d4fb5a37eb4fe2eaf25b5113599cee1b90 (diff)
Extend host topology with NIC type filtering
JIRA: CSIT-1 Changes to allow filtering based on NIC model. Switched xconnect perf test to use filtered topology. Change-Id: Id526f47dc28f92bf26d070e54819ad29bccc0440 Signed-off-by: Miroslav Miklus <mmiklus@cisco.com>
Diffstat (limited to 'resources/libraries/python/NodePath.py')
-rw-r--r--resources/libraries/python/NodePath.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/resources/libraries/python/NodePath.py b/resources/libraries/python/NodePath.py
index bbc6d31811..dfcee4d720 100644
--- a/resources/libraries/python/NodePath.py
+++ b/resources/libraries/python/NodePath.py
@@ -55,16 +55,20 @@ class NodePath(object):
def __init__(self):
self._nodes = []
+ self._nodes_filter = []
self._links = []
self._path = []
self._path_iter = []
- def append_node(self, node):
+ def append_node(self, node, filter_list=None):
"""Append node to the path.
:param node: Node to append to the path.
+ :param filter_list: Filter criteria list.
:type node: dict
+ :type filter_list: list of strings
"""
+ self._nodes_filter.append(filter_list)
self._nodes.append(node)
def append_nodes(self, *nodes):
@@ -81,6 +85,7 @@ class NodePath(object):
def clear_path(self):
"""Clear path."""
self._nodes = []
+ self._nodes_filter = []
self._links = []
self._path = []
self._path_iter = []
@@ -96,6 +101,7 @@ class NodePath(object):
.. note:: First add at least two nodes to the topology.
"""
nodes = self._nodes
+ nodes_filer = self._nodes_filter
if len(nodes) < 2:
raise RuntimeError('Not enough nodes to compute path')
@@ -103,7 +109,11 @@ class NodePath(object):
topo = Topology()
node1 = nodes[idx]
node2 = nodes[idx + 1]
- links = topo.get_active_connecting_links(node1, node2)
+ n1_list = self._nodes_filter[idx]
+ n2_list = self._nodes_filter[idx + 1]
+ links = topo.get_active_connecting_links(node1, node2,
+ filter_list_node1=n1_list,
+ filter_list_node2=n2_list)
if not links:
raise RuntimeError('No link between {0} and {1}'.format(
node1['host'], node2['host']))