-
Notifications
You must be signed in to change notification settings - Fork 770
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support for not all DUT ports connected to a fanout switch (#2517)
What is the motivation for this PR? Currently, it is required that all ports on DUT are in use and are connected to a fanout. However, there is a need to be able to run tests where all ports are not in use. Specifically, when dealing with New Sonic devices Sonic device with a front panel port used for in-band management Chassis with lots of ports and multiple asics, were every port on every asic is not required to be covered Chassis as a DUT, where the number of ports can be in hundreds Expensive, high speed ports like 400G (hard to go from 400G down to 1/10G) So, need to add support where not all DUT ports are connected to fanout and are thus not part of the testing. How did you do it? conn_graph_facts: conn_graph_facts.py returns device_vlan_map_list. This used to be a dictionary with key being hostname and value being a list of vlanids for the fanout ports. Have modified this where the value instead of being a list of vlanids, it is a dictionary with key being the port_index and the value being the vlan id. This port_index is what gets put in the topology file. We get the port by looking at the host_port_vlans defined in the conn_graph for that device. This host_port_vlans has key being the Ethernet port (like Ethernet10) and value being a dictionary with key 'vlanlist' being a the list of fanout vlans. We check against all the ports 'vlanlist' to get the port on the DUT that connects to this fanout vlan, and then split on 'Ethernet' to get the port index. For example - lets say on dut with hostname "dut1", we have port Ethernet10 connected to fanout w/ vlan 120, and Ethernet11 connected to fanout w/ vlan 121, then we would have: "host_port_vlans": { "Ethernet10": { "mode": "Access", "vlanids": "120", "vlanlist": [ 120 ] }, "Ethernet11": { "mode": "Access", "vlanids": "121", "vlanlist": [ 121 ] } } "VlanList": [ 120, 121 ] For vlan 120 in VlanList, we would iterate through host_port_vlans to find the port that has vlan 120 - in our case "Ethernet10". The port_index would then be "10". Similarly, for vlan 121, the port_index would be "Ethernet11". So, returned device_vlan_map_list would be: "dut1" : { "10" : 120, "11" : 121 } vlan_port/kvm_port/mellanox_simx_port: Updated to return (dut_fp_ports) a dictionary with key being the port index (same as in the topo file) and vlan being the port - instead of the just the list of ports. bind/unbind vm_topology: vlan_index is now a string in the dictionary of dut_fp_ports updated regexp for checking valid vlan for multi-dut to be of the format '.@' remove_dut_port.yml (bug fix): set cmd to "remove" instead of "create" in vlan_port module call. How did you verify/test it? Tested against pizza box DUT with all DUT ports connected to a fanout, and also against another DUT where we have only 4 of the 52 ports connected to a different fanout.
- Loading branch information
1 parent
06688b6
commit d062c61
Showing
8 changed files
with
175 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
def _port_alias_to_name_map_50G(all_ports, s100G_ports): | ||
new_map = {} | ||
# 50G ports | ||
s50G_ports = list(set(all_ports) - set(s100G_ports)) | ||
|
||
for i in s50G_ports: | ||
new_map["Ethernet%d/1" % i] = "Ethernet%d" % ((i - 1) * 4) | ||
new_map["Ethernet%d/3" % i] = "Ethernet%d" % ((i - 1) * 4 + 2) | ||
|
||
for i in s100G_ports: | ||
new_map["Ethernet%d/1" % i] = "Ethernet%d" % ((i - 1) * 4) | ||
|
||
return new_map | ||
|
||
def get_port_alias_to_name_map(hwsku): | ||
port_alias_to_name_map = {} | ||
if hwsku == "Force10-S6000": | ||
for i in range(0, 128, 4): | ||
port_alias_to_name_map["fortyGigE0/%d" % i] = "Ethernet%d" % i | ||
elif hwsku == "Force10-S6100": | ||
for i in range(0, 4): | ||
for j in range(0, 16): | ||
port_alias_to_name_map["fortyGigE1/%d/%d" % (i + 1, j + 1)] = "Ethernet%d" % (i * 16 + j) | ||
elif hwsku == "Force10-Z9100": | ||
for i in range(0, 128, 4): | ||
port_alias_to_name_map["hundredGigE1/%d" % (i / 4 + 1)] = "Ethernet%d" % i | ||
elif hwsku == "Arista-7050-QX32": | ||
for i in range(1, 25): | ||
port_alias_to_name_map["Ethernet%d/1" % i] = "Ethernet%d" % ((i - 1) * 4) | ||
for i in range(25, 33): | ||
port_alias_to_name_map["Ethernet%d" % i] = "Ethernet%d" % ((i - 1) * 4) | ||
elif hwsku == "Arista-7050-QX-32S": | ||
for i in range(5, 29): | ||
port_alias_to_name_map["Ethernet%d/1" % i] = "Ethernet%d" % ((i - 5) * 4) | ||
for i in range(29, 37): | ||
port_alias_to_name_map["Ethernet%d" % i] = "Ethernet%d" % ((i - 5) * 4) | ||
elif hwsku == "Arista-7260CX3-C64" or hwsku == "Arista-7170-64C": | ||
for i in range(1, 65): | ||
port_alias_to_name_map["Ethernet%d/1" % i] = "Ethernet%d" % ((i - 1) * 4) | ||
elif hwsku == "Arista-7060CX-32S-C32" or hwsku == "Arista-7060CX-32S-Q32" or hwsku == "Arista-7060CX-32S-C32-T1" or hwsku == "Arista-7170-32CD-C32": | ||
for i in range(1, 33): | ||
port_alias_to_name_map["Ethernet%d/1" % i] = "Ethernet%d" % ((i - 1) * 4) | ||
elif hwsku == "Mellanox-SN2700-D48C8": | ||
# 50G ports | ||
s50G_ports = [x for x in range(0, 24, 2)] + [x for x in range(40, 88, 2)] + [x for x in range(104, 128, 2)] | ||
|
||
# 100G ports | ||
s100G_ports = [x for x in range(24, 40, 4)] + [x for x in range(88, 104, 4)] | ||
|
||
for i in s50G_ports: | ||
alias = "etp%d" % (i / 4 + 1) + ("a" if i % 4 == 0 else "b") | ||
port_alias_to_name_map[alias] = "Ethernet%d" % i | ||
for i in s100G_ports: | ||
alias = "etp%d" % (i / 4 + 1) | ||
port_alias_to_name_map[alias] = "Ethernet%d" % i | ||
elif hwsku == "Mellanox-SN2700" or hwsku == "ACS-MSN2700": | ||
for i in range(1, 33): | ||
port_alias_to_name_map["etp%d" % i] = "Ethernet%d" % ((i - 1) * 4) | ||
elif hwsku == "Arista-7060CX-32S-D48C8": | ||
# All possible breakout 50G port numbers: | ||
all_ports = [x for x in range(1, 33)] | ||
|
||
# 100G ports | ||
s100G_ports = [x for x in range(7, 11)] | ||
s100G_ports += [x for x in range(23, 27)] | ||
|
||
port_alias_to_name_map = _port_alias_to_name_map_50G(all_ports, s100G_ports) | ||
elif hwsku == "Arista-7260CX3-D108C8": | ||
# All possible breakout 50G port numbers: | ||
all_ports = [x for x in range(1, 65)] | ||
|
||
# 100G ports | ||
s100G_ports = [x for x in range(13, 21)] | ||
|
||
port_alias_to_name_map = _port_alias_to_name_map_50G(all_ports, s100G_ports) | ||
elif hwsku == "INGRASYS-S9100-C32": | ||
for i in range(1, 33): | ||
port_alias_to_name_map["Ethernet%d/1" % i] = "Ethernet%d" % ((i - 1) * 4) | ||
elif hwsku == "INGRASYS-S9100-C32" or hwsku == "INGRASYS-S9130-32X" or hwsku == "INGRASYS-S8810-32Q": | ||
for i in range(1, 33): | ||
port_alias_to_name_map["Ethernet%d/1" % i] = "Ethernet%d" % ((i - 1) * 4) | ||
elif hwsku == "INGRASYS-S8900-54XC": | ||
for i in range(1, 49): | ||
port_alias_to_name_map["Ethernet%d" % i] = "Ethernet%d" % (i - 1) | ||
for i in range(49, 55): | ||
port_alias_to_name_map["Ethernet%d/1" % i] = "Ethernet%d" % ((i - 49) * 4 + 48) | ||
elif hwsku == "INGRASYS-S8900-64XC": | ||
for i in range(1, 49): | ||
port_alias_to_name_map["Ethernet%d" % i] = "Ethernet%d" % (i - 1) | ||
for i in range(49, 65): | ||
port_alias_to_name_map["Ethernet%d/1" % i] = "Ethernet%d" % ((i - 49) * 4 + 48) | ||
elif hwsku == "Accton-AS7712-32X": | ||
for i in range(1, 33): | ||
port_alias_to_name_map["hundredGigE%d" % i] = "Ethernet%d" % ((i - 1) * 4) | ||
elif hwsku == "Celestica-DX010-C32": | ||
for i in range(1, 33): | ||
port_alias_to_name_map["etp%d" % i] = "Ethernet%d" % ((i - 1) * 4) | ||
elif hwsku == "Seastone-DX010": | ||
for i in range(1, 33): | ||
port_alias_to_name_map["Eth%d" % i] = "Ethernet%d" % ((i - 1) * 4) | ||
elif hwsku == "Celestica-E1031-T48S4": | ||
for i in range(1, 53): | ||
port_alias_to_name_map["etp%d" % i] = "Ethernet%d" % ((i - 1)) | ||
elif hwsku == "et6448m": | ||
for i in range(0, 52): | ||
port_alias_to_name_map["Ethernet%d" % i] = "Ethernet%d" % i | ||
elif hwsku == "newport": | ||
for i in range(0, 256, 8): | ||
port_alias_to_name_map["Ethernet%d" % i] = "Ethernet%d" % i | ||
else: | ||
for i in range(0, 128, 4): | ||
port_alias_to_name_map["Ethernet%d" % i] = "Ethernet%d" % i | ||
|
||
return port_alias_to_name_map | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.