diff --git a/ansible/TestbedProcessing.py b/ansible/TestbedProcessing.py index 355a99f0fb9..8b9ab554a19 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 c0a64f1a1ee..6688e9f833b 100755 --- a/ansible/library/conn_graph_facts.py +++ b/ansible/library/conn_graph_facts.py @@ -210,14 +210,15 @@ def parse_graph(self): for link in allinks: start_dev = link.attrib['StartDevice'] end_dev = link.attrib['EndDevice'] + autoneg_mode = link.attrib.get('AutoNeg', 'off') if start_dev: self.links[start_dev][link.attrib['StartPort']] = { 'peerdevice': link.attrib['EndDevice'], 'peerport': link.attrib['EndPort'], - 'speed': link.attrib['BandWidth']} + 'speed': link.attrib['BandWidth'], 'autoneg': autoneg_mode} if end_dev: self.links[end_dev][link.attrib['EndPort']] = { 'peerdevice': link.attrib['StartDevice'], 'peerport': link.attrib['StartPort'], - 'speed': link.attrib['BandWidth']} + 'speed': link.attrib['BandWidth'], 'autoneg': autoneg_mode} console_root = self.root.find(self.csgtag) if console_root: devicecsgroot = console_root.find('DevicesConsoleInfo') diff --git a/ansible/library/topo_facts.py b/ansible/library/topo_facts.py index 0b2207bd050..b6d8ffb3555 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 b32bed638bf..23d9bcb2b49 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/roles/fanout/templates/arista_7260cx3_deploy.j2 b/ansible/roles/fanout/templates/arista_7260cx3_deploy.j2 index 9acbcb66132..2692b184063 100644 --- a/ansible/roles/fanout/templates/arista_7260cx3_deploy.j2 +++ b/ansible/roles/fanout/templates/arista_7260cx3_deploy.j2 @@ -39,8 +39,13 @@ vrf definition management switchport access vlan {{ device_port_vlans[inventory_hostname][intf]['vlanids'] }} switchport mode dot1q-tunnel spanning-tree portfast +{% if device_conn[inventory_hostname][intf]['autoneg']|lower == "on" %} + speed auto {{ device_conn[inventory_hostname][intf]['speed'] }}full + no error-correction encoding +{% else %} speed forced 100gfull error-correction encoding reed-solomon +{% endif %} no shutdown {% elif device_conn[inventory_hostname][intf]['speed'] == "40000" %} interface {{ intf }} diff --git a/ansible/templates/minigraph_link_meta.j2 b/ansible/templates/minigraph_link_meta.j2 index a3acae8cec4..2bcf14880bf 100644 --- a/ansible/templates/minigraph_link_meta.j2 +++ b/ansible/templates/minigraph_link_meta.j2 @@ -27,3 +27,35 @@ {% endif %} + +{% if msft_an_enabled is defined and vm_topo_config.get('autoneg_interfaces') is not none %} + + +{% for if_index in vm_topo_config['autoneg_interfaces']['intfs'] %} + +{% if "mellanox" in device_info[inventory_hostname]['HwSku']|lower %} +{% set autoneg_intf = "etp" ~ if_index %} +{% else %} +{% set autoneg_intf = "Ethernet" ~ if_index ~ "/1" %} +{% endif %} +{% 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 a922c7329c8..2d62182ac42 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 dcc114a7340..44ef9623e98 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 23e38ed4d67..3e1dd93a7f6 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: