Skip to content

Commit 34ae06f

Browse files
ausphamselldinesh
authored andcommitted
feat: add support multi-lanes L1 NUT (#20910)
Description of PR Summary: This PR allows option to group multiple L1 ports into 1 peer connection. Which is needed when we run with ixia topology requires 4 lanes per port connection. Fixes # (issue) 35384297 Type of change Bug fix Testbed and Framework(new/improvement) New Test case Skipped for non-supported platforms Test case improvement Back port request 202205 202305 202311 202405 202411 202505 Approach What is the motivation for this PR? Due to the need of running L1 test on IXIA, we need to allow ocs to configure using n lane per port. Now the user can use something like tgen,Card2/Port1,l1-switch,13|14|15|16 tgen,Card2/Port2,l1-switch,17|18|19|20 tgen,Card2/Port3,l1-switch,21|22|23|24 ... dut,Ethernet184,l1-switch,41|42|43|44 dut,Ethernet188,l1-switch,45|46|47|48 dut,Ethernet192,l1-switch,49|50|51|52 This will in turn generates the follow mapping "device_l1_cross_connects[inventory_hostname]": { "13": "41", "14": "42", "15": "43", "16": "44", "17": "45", "18": "46", "19": "47", "20": "48", "21": "49", "22": "50", "23": "51", "24": "52" } And result into the following cross connects id a_side b_side ------- -------- -------- 13A-41B 13A 41B 14A-42B 14A 42B 15A-43B 15A 43B 16A-44B 16A 44B 17A-45B 17A 45B 18A-46B 18A 46B 19A-47B 19A 47B 20A-48B 20A 48B 21A-49B 21A 49B 22A-50B 22A 50B 23A-51B 23A 51B 24A-52B 24A 52B 41A-13B 41A 13B 42A-14B 42A 14B 43A-15B 43A 15B 44A-16B 44A 16B 45A-17B 45A 17B 46A-18B 46A 18B 47A-19B 47A 19B 48A-20B 48A 20B 49A-21B 49A 21B 50A-22B 50A 22B 51A-23B 51A 23B with labels 13A Link to tgen Card2/Port1 RX normal 13B Link to tgen Card2/Port1 TX normal 14A Link to tgen Card2/Port1 RX normal 14B Link to tgen Card2/Port1 TX normal 15A Link to tgen Card2/Port1 RX normal 15B Link to tgen Card2/Port1 TX normal 16A Link to tgen Card2/Port1 RX normal 16B Link to tgen Card2/Port1 TX normal 17A Link to tgen Card2/Port2 RX normal 17B Link to tgen Card2/Port2 TX normal 18A Link to tgen Card2/Port2 RX normal 18B Link to tgen Card2/Port2 TX normal 19A Link to tgen Card2/Port2 RX normal 19B Link to tgen Card2/Port2 TX normal 20A Link to tgen Card2/Port2 RX normal 20B Link to tgen Card2/Port2 TX normal 21A Link to tgen Card2/Port3 RX normal 21B Link to tgen Card2/Port3 TX normal 22A Link to tgen Card2/Port3 RX normal 22B Link to tgen Card2/Port3 TX normal 23A Link to tgen Card2/Port3 RX normal 23B Link to tgen Card2/Port3 TX normal 24A Link to tgen Card2/Port3 RX normal 24B Link to tgen Card2/Port3 TX normal ... 41A Link to dut Ethernet184 RX normal 41B Link to dut Ethernet184 TX normal 42A Link to dut Ethernet184 RX normal 42B Link to dut Ethernet184 TX normal 43A Link to dut Ethernet184 RX normal 43B Link to dut Ethernet184 TX normal 44A Link to dut Ethernet184 RX normal 44B Link to dut Ethernet184 TX normal 45A Link to dut Ethernet188 RX normal 45B Link to dut Ethernet188 TX normal 46A Link to dut Ethernet188 RX normal 46B Link to dut Ethernet188 TX normal 47A Link to dut Ethernet188 RX normal 47B Link to dut Ethernet188 TX normal 48A Link to dut Ethernet188 RX normal 48B Link to dut Ethernet188 TX normal 49A Link to dut Ethernet192 RX normal 49B Link to dut Ethernet192 TX normal 50A Link to dut Ethernet192 RX normal 50B Link to dut Ethernet192 TX normal 51A Link to dut Ethernet192 RX normal 51B Link to dut Ethernet192 TX normal 52A Link to dut Ethernet192 RX normal 52B Link to dut Ethernet192 TX normal Signed-off-by: Austin Pham <austinpham@microsoft.com> Signed-off-by: selldinesh <dinesh.sellappan@keysight.com>
1 parent 71c904b commit 34ae06f

File tree

1 file changed

+22
-6
lines changed

1 file changed

+22
-6
lines changed

ansible/module_utils/graph_utils.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -333,16 +333,27 @@ def csv_to_graph_facts(self):
333333

334334
if l1_name not in from_l1_links:
335335
from_l1_links[l1_name] = {}
336-
from_l1_links[l1_name][l1_port] = {
337-
"peerdevice": device_name,
338-
"peerport": device_port,
339-
}
336+
337+
if "|" in l1_port:
338+
lanes = l1_port.split("|")
339+
340+
for lane in lanes:
341+
from_l1_links[l1_name][lane] = {
342+
"peerdevice": device_name,
343+
"peerport": device_port
344+
}
345+
else:
346+
from_l1_links[l1_name][l1_port] = {
347+
"peerdevice": device_name,
348+
"peerport": device_port,
349+
}
340350

341351
if device_name not in to_l1_links:
342352
to_l1_links[device_name] = {}
353+
343354
to_l1_links[device_name][device_port] = {
344355
"peerdevice": l1_name,
345-
"peerport": l1_port,
356+
"peerport": l1_port if "|" not in l1_port else l1_port.split("|"),
346357
}
347358

348359
logging.debug("Found L1 links from L1 switches to devices: {}".format(from_l1_links))
@@ -561,6 +572,11 @@ def _create_l1_cross_connects(self, filtered_linked_ports):
561572
l1_cross_connects[l1_start_device] = {}
562573

563574
l1_port_pair = sorted([l1_start_port, l1_end_port])
564-
l1_cross_connects[l1_start_device][l1_port_pair[0]] = l1_port_pair[1]
575+
576+
if isinstance(l1_port_pair[0], list) and isinstance(l1_port_pair[1], list):
577+
for l1_port_start, l1_port_end in zip(l1_port_pair[0], l1_port_pair[1]):
578+
l1_cross_connects[l1_start_device][l1_port_start] = l1_port_end
579+
else:
580+
l1_cross_connects[l1_start_device][l1_port_pair[0]] = l1_port_pair[1]
565581

566582
return l1_cross_connects

0 commit comments

Comments
 (0)