Code Review
/
csit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
review
|
tree
raw
|
inline
| side by side
feat(core): Add 2n-spr topology
[csit.git]
/
resources
/
libraries
/
python
/
NodePath.py
diff --git
a/resources/libraries/python/NodePath.py
b/resources/libraries/python/NodePath.py
index
d1f974a
..
5b445bc
100644
(file)
--- a/
resources/libraries/python/NodePath.py
+++ b/
resources/libraries/python/NodePath.py
@@
-1,4
+1,4
@@
-# Copyright (c) 202
1
Cisco and/or its affiliates.
+# Copyright (c) 202
2
Cisco and/or its affiliates.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at:
@@
-217,7
+217,8
@@
class NodePath:
raise RuntimeError(u"No path for topology")
return self._path[-2]
raise RuntimeError(u"No path for topology")
return self._path[-2]
- def compute_circular_topology(self, nodes, filter_list=None, nic_pfs=1,
+ def compute_circular_topology(
+ self, nodes, filter_list=None, nic_pfs=1,
always_same_link=False, topo_has_tg=True, topo_has_dut=True):
"""Return computed circular path.
always_same_link=False, topo_has_tg=True, topo_has_dut=True):
"""Return computed circular path.
@@
-242,20
+243,30
@@
class NodePath:
:raises RuntimeError: If unsupported combination of parameters.
"""
t_dict = dict()
:raises RuntimeError: If unsupported combination of parameters.
"""
t_dict = dict()
+ t_dict[u"hosts"] = set()
if topo_has_dut:
duts = [key for key in nodes if u"DUT" in key]
if topo_has_dut:
duts = [key for key in nodes if u"DUT" in key]
+ for host in [nodes[dut][u"host"] for dut in duts]:
+ t_dict[u"hosts"].add(host)
t_dict[u"duts"] = duts
t_dict[u"duts_count"] = len(duts)
t_dict[u"int"] = u"pf"
for _ in range(0, nic_pfs // 2):
if topo_has_tg:
t_dict[u"duts"] = duts
t_dict[u"duts_count"] = len(duts)
t_dict[u"int"] = u"pf"
for _ in range(0, nic_pfs // 2):
if topo_has_tg:
- self.append_node(nodes[u"TG"])
+ if topo_has_dut:
+ self.append_node(nodes[u"TG"])
+ else:
+ self.append_node(nodes[u"TG"], filter_list=filter_list)
if topo_has_dut:
for dut in duts:
self.append_node(nodes[dut], filter_list=filter_list)
if topo_has_tg:
if topo_has_dut:
for dut in duts:
self.append_node(nodes[dut], filter_list=filter_list)
if topo_has_tg:
- self.append_node(nodes[u"TG"])
+ t_dict[u"hosts"].add(nodes[u"TG"][u"host"])
+ if topo_has_dut:
+ self.append_node(nodes[u"TG"])
+ else:
+ self.append_node(nodes[u"TG"], filter_list=filter_list)
self.compute_path(always_same_link, topo_has_dut)
n_idx = 0 # node index
self.compute_path(always_same_link, topo_has_dut)
n_idx = 0 # node index