Code Review
/
csit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
Update DPDK to v17.11
[csit.git]
/
resources
/
libraries
/
python
/
NodePath.py
diff --git
a/resources/libraries/python/NodePath.py
b/resources/libraries/python/NodePath.py
index
bbc6d31
..
8ee29b2
100644
(file)
--- a/
resources/libraries/python/NodePath.py
+++ b/
resources/libraries/python/NodePath.py
@@
-55,16
+55,20
@@
class NodePath(object):
def __init__(self):
self._nodes = []
def __init__(self):
self._nodes = []
+ self._nodes_filter = []
self._links = []
self._path = []
self._path_iter = []
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.
"""Append node to the path.
:param node: Node to append to the path.
+ :param filter_list: Filter criteria list.
:type node: dict
:type node: dict
+ :type filter_list: list of strings
"""
"""
+ self._nodes_filter.append(filter_list)
self._nodes.append(node)
def append_nodes(self, *nodes):
self._nodes.append(node)
def append_nodes(self, *nodes):
@@
-81,6
+85,7
@@
class NodePath(object):
def clear_path(self):
"""Clear path."""
self._nodes = []
def clear_path(self):
"""Clear path."""
self._nodes = []
+ self._nodes_filter = []
self._links = []
self._path = []
self._path_iter = []
self._links = []
self._path = []
self._path_iter = []
@@
-103,7
+108,11
@@
class NodePath(object):
topo = Topology()
node1 = nodes[idx]
node2 = nodes[idx + 1]
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']))
if not links:
raise RuntimeError('No link between {0} and {1}'.format(
node1['host'], node2['host']))
@@
-134,7
+143,7
@@
class NodePath(object):
def next_interface(self):
"""Path interface iterator.
def next_interface(self):
"""Path interface iterator.
- :return: Interface and node or None if not next interface.
+ :return
s
: Interface and node or None if not next interface.
:rtype: tuple (str, dict)
.. note:: Call compute_path before.
:rtype: tuple (str, dict)
.. note:: Call compute_path before.
@@
-147,7
+156,7
@@
class NodePath(object):
def first_interface(self):
"""Return first interface on the path.
def first_interface(self):
"""Return first interface on the path.
- :return: Interface and node.
+ :return
s
: Interface and node.
:rtype: tuple (str, dict)
.. note:: Call compute_path before.
:rtype: tuple (str, dict)
.. note:: Call compute_path before.
@@
-159,7
+168,7
@@
class NodePath(object):
def last_interface(self):
"""Return last interface on the path.
def last_interface(self):
"""Return last interface on the path.
- :return: Interface and node.
+ :return
s
: Interface and node.
:rtype: tuple (str, dict)
.. note:: Call compute_path before.
:rtype: tuple (str, dict)
.. note:: Call compute_path before.
@@
-171,7
+180,7
@@
class NodePath(object):
def first_ingress_interface(self):
"""Return first ingress interface on the path.
def first_ingress_interface(self):
"""Return first ingress interface on the path.
- :return: Interface and node.
+ :return
s
: Interface and node.
:rtype: tuple (str, dict)
.. note:: Call compute_path before.
:rtype: tuple (str, dict)
.. note:: Call compute_path before.
@@
-183,7
+192,7
@@
class NodePath(object):
def last_egress_interface(self):
"""Return last egress interface on the path.
def last_egress_interface(self):
"""Return last egress interface on the path.
- :return: Interface and node.
+ :return
s
: Interface and node.
:rtype: tuple (str, dict)
.. note:: Call compute_path before.
:rtype: tuple (str, dict)
.. note:: Call compute_path before.