diff --git a/ansible/TestbedProcessing.py b/ansible/TestbedProcessing.py index a61f069c37..6e5b3862ec 100755 --- a/ansible/TestbedProcessing.py +++ b/ansible/TestbedProcessing.py @@ -311,7 +311,7 @@ def makeTestbed(data, outfile): def makeSonicLabLinks(data, outfile): - csv_columns = "StartDevice,StartPort,EndDevice,EndPort,BandWidth,VlanID,VlanMode,SlotId" + csv_columns = "StartDevice,StartPort,EndDevice,EndPort,BandWidth,VlanID,VlanMode,AutoNeg,SlotId" topology = data csv_file = outfile @@ -331,6 +331,7 @@ def makeSonicLabLinks(data, outfile): bandWidth = element.get("Bandwidth") vlanID = element.get("VlanID") vlanMode = element.get("VlanMode") + AutoNeg = element.get("AutoNeg") slotId = element.get("SlotId") # catch empty values @@ -346,10 +347,13 @@ def makeSonicLabLinks(data, outfile): vlanMode = "" if not slotId: slotId = "" + if not AutoNeg: + AutoNeg = "" row = startDevice + "," + startPort + "," + endDevice + "," + \ endPort + "," + str(bandWidth) + \ "," + str(vlanID) + "," + vlanMode + \ + "," + str(AutoNeg) + \ "," + str(slotId) f.write(row + "\n") except IOError: diff --git a/ansible/library/conn_graph_facts.py b/ansible/library/conn_graph_facts.py index 5c4a3bf9e4..abc6dfbe16 100755 --- a/ansible/library/conn_graph_facts.py +++ b/ansible/library/conn_graph_facts.py @@ -299,6 +299,7 @@ def csv_to_graph_facts(self): band_width = link["BandWidth"] vlan_ID = link["VlanID"] vlan_mode = link["VlanMode"] + autoneg_mode = link.get("AutoNeg", "off") if start_device not in links: links[start_device] = {} @@ -313,11 +314,13 @@ def csv_to_graph_facts(self): "peerdevice": end_device, "peerport": end_port, "speed": band_width, + "autoneg": autoneg_mode, } links[end_device][end_port] = { "peerdevice": start_device, "peerport": start_port, "speed": band_width, + "autoneg": autoneg_mode, } port_vlans[start_device][start_port] = { diff --git a/ansible/library/topo_facts.py b/ansible/library/topo_facts.py index 0b2207bd05..b6d8ffb355 100644 --- a/ansible/library/topo_facts.py +++ b/ansible/library/topo_facts.py @@ -334,6 +334,8 @@ def get_topo_config(self, topo_name, hwsku, testbed_name, asics_present, card_ty if 'DUT' in topo_definition['topology']: vm_topo_config['DUT'] = topo_definition['topology']['DUT'] + if 'autoneg_interfaces' in vm_topo_config['DUT']: + vm_topo_config['autoneg_interfaces'] = topo_definition['topology']['DUT']['autoneg_interfaces'] else: vm_topo_config['DUT'] = {} diff --git a/ansible/roles/fanout/templates/arista_7060_deploy.j2 b/ansible/roles/fanout/templates/arista_7060_deploy.j2 index b32bed638b..23d9bcb2b4 100644 --- a/ansible/roles/fanout/templates/arista_7060_deploy.j2 +++ b/ansible/roles/fanout/templates/arista_7060_deploy.j2 @@ -36,14 +36,20 @@ interface defaults {% for intf in device_port_vlans[inventory_hostname] %} interface {{ intf }} description {{ device_conn[inventory_hostname][intf]['peerdevice'] }}-{{ device_conn[inventory_hostname][intf]['peerport'] }} +# TODO: Add an additional var/check in fanout devices if autoneg is enabled with the below check +{% if device_conn[inventory_hostname][intf]['autoneg']|lower == "on" %} + speed auto {{ device_conn[inventory_hostname][intf]['speed'] }}full +{% else %} speed force {{ device_conn[inventory_hostname][intf]['speed'] }}full +{% endif %} {% if device_port_vlans[inventory_hostname][intf]['mode'] == 'Trunk' %} switchport mode trunk switchport trunk allowed vlan {{ device_port_vlans[inventory_hostname][intf]['vlanids'] }} {% else %} switchport mode dot1q-tunnel switchport access vlan {{ device_port_vlans[inventory_hostname][intf]['vlanids'] }} -{% if device_conn[inventory_hostname][intf]['speed'] == "100000" %} +# TODO: Add an additional var/check in fanout devices if autoneg is enabled with the below check +{% if device_conn[inventory_hostname][intf]['speed'] == "100000" and device_conn[inventory_hostname][intf]['autoneg']|lower == "off" %} error-correction encoding reed-solomon {% else %} no error-correction encoding diff --git a/ansible/templates/minigraph_link_meta.j2 b/ansible/templates/minigraph_link_meta.j2 index d74f4a87cc..b6420c0199 100644 --- a/ansible/templates/minigraph_link_meta.j2 +++ b/ansible/templates/minigraph_link_meta.j2 @@ -52,3 +52,30 @@ {% endif %} + +{% if msft_an_enabled is defined %} + + +{% for if_index in vm_topo_config['autoneg_interfaces']['intfs'] %} +{% set autoneg_intf = "Ethernet" ~ if_index ~ "/1" %} +{% if device_conn[inventory_hostname][port_alias_map[autoneg_intf]]['autoneg']|lower == "on" %} + + + + + AutoNegotiation + True + + + FECDisabled + + True + + + {{ device_conn[inventory_hostname][port_alias_map[autoneg_intf]]['peerdevice'] }}:{{ device_conn[inventory_hostname][port_alias_map[autoneg_intf]]['peerport'] }};{{ inventory_hostname }}:{{ autoneg_intf }} + +{% endif %} +{% endfor %} + + +{% endif %} diff --git a/ansible/templates/minigraph_meta.j2 b/ansible/templates/minigraph_meta.j2 index f9b14197c2..e57765273c 100644 --- a/ansible/templates/minigraph_meta.j2 +++ b/ansible/templates/minigraph_meta.j2 @@ -136,6 +136,13 @@ {{ switch_type }} {% endif %} +{% if msft_an_enabled is defined %} + + AutoNegotiation + + {{ msft_an_enabled }} + +{% endif %} {% if num_asics == 1 and switch_type is defined and switch_type == 'voq' %} SwitchId diff --git a/ansible/vars/topo_t0-116.yml b/ansible/vars/topo_t0-116.yml index dcc114a734..44ef9623e9 100644 --- a/ansible/vars/topo_t0-116.yml +++ b/ansible/vars/topo_t0-116.yml @@ -134,6 +134,8 @@ topology: - 31 vm_offset: 3 DUT: + autoneg_interfaces: + intfs: [13, 14, 15, 16] vlan_configs: default_vlan_config: one_vlan_a one_vlan_a: diff --git a/ansible/vars/topo_t0.yml b/ansible/vars/topo_t0.yml index 5a547e0e9e..58118cff34 100644 --- a/ansible/vars/topo_t0.yml +++ b/ansible/vars/topo_t0.yml @@ -51,6 +51,8 @@ topology: - 31 vm_offset: 3 DUT: + autoneg_interfaces: + intfs: [7, 8, 9, 10] vlan_configs: default_vlan_config: one_vlan_a one_vlan_a: