Skip to content

Commit 75d195e

Browse files
Added ability to enable/disable auto negothiation via config files per setup (sonic-net#15397)
1 parent 3e07b9e commit 75d195e

File tree

5 files changed

+55
-40
lines changed

5 files changed

+55
-40
lines changed

ansible/files/sonic_lab_links.csv

+35-35
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,35 @@
1-
StartDevice,StartPort,EndDevice,EndPort,BandWidth,VlanID,VlanMode
2-
str-msn2700-01,Ethernet0,str-7260-10,Ethernet1,40000,1681,Access
3-
str-msn2700-01,Ethernet4,str-7260-10,Ethernet2,40000,1682,Access
4-
str-msn2700-01,Ethernet8,str-7260-10,Ethernet3,40000,1683,Access
5-
str-msn2700-01,Ethernet12,str-7260-10,Ethernet4,40000,1684,Access
6-
str-msn2700-01,Ethernet16,str-7260-10,Ethernet5,40000,1685,Access
7-
str-msn2700-01,Ethernet20,str-7260-10,Ethernet6,40000,1686,Access
8-
str-msn2700-01,Ethernet24,str-7260-10,Ethernet7,40000,1687,Access
9-
str-msn2700-01,Ethernet28,str-7260-10,Ethernet8,40000,1688,Access
10-
str-msn2700-01,Ethernet32,str-7260-10,Ethernet9,40000,1689,Access
11-
str-msn2700-01,Ethernet36,str-7260-10,Ethernet10,40000,1690,Access
12-
str-msn2700-01,Ethernet40,str-7260-10,Ethernet11,40000,1691,Access
13-
str-msn2700-01,Ethernet44,str-7260-10,Ethernet12,40000,1692,Access
14-
str-msn2700-01,Ethernet48,str-7260-10,Ethernet13,40000,1693,Access
15-
str-msn2700-01,Ethernet52,str-7260-10,Ethernet14,40000,1694,Access
16-
str-msn2700-01,Ethernet56,str-7260-10,Ethernet15,40000,1695,Access
17-
str-msn2700-01,Ethernet60,str-7260-10,Ethernet16,40000,1696,Access
18-
str-msn2700-01,Ethernet64,str-7260-10,Ethernet17,40000,1697,Access
19-
str-msn2700-01,Ethernet68,str-7260-10,Ethernet18,40000,1698,Access
20-
str-msn2700-01,Ethernet72,str-7260-10,Ethernet19,40000,1699,Access
21-
str-msn2700-01,Ethernet76,str-7260-10,Ethernet20,40000,1700,Access
22-
str-msn2700-01,Ethernet80,str-7260-10,Ethernet21,40000,1701,Access
23-
str-msn2700-01,Ethernet84,str-7260-10,Ethernet22,40000,1702,Access
24-
str-msn2700-01,Ethernet88,str-7260-10,Ethernet23,40000,1703,Access
25-
str-msn2700-01,Ethernet92,str-7260-10,Ethernet24,40000,1704,Access
26-
str-msn2700-01,Ethernet96,str-7260-10,Ethernet25,40000,1705,Access
27-
str-msn2700-01,Ethernet100,str-7260-10,Ethernet26,40000,1706,Access
28-
str-msn2700-01,Ethernet104,str-7260-10,Ethernet27,40000,1707,Access
29-
str-msn2700-01,Ethernet108,str-7260-10,Ethernet28,40000,1708,Access
30-
str-msn2700-01,Ethernet112,str-7260-10,Ethernet29,40000,1709,Access
31-
str-msn2700-01,Ethernet116,str-7260-10,Ethernet30,40000,1710,Access
32-
str-msn2700-01,Ethernet120,str-7260-10,Ethernet31,40000,1711,Access
33-
str-msn2700-01,Ethernet124,str-7260-10,Ethernet32,40000,1712,Access
34-
str-7260-11,Ethernet19,str-acs-serv-01,p4p1,40000,,Trunk
35-
str-7260-11,Ethernet30,str-7260-10,Ethernet64,40000,1681-1712,Trunk
1+
StartDevice,StartPort,EndDevice,EndPort,BandWidth,VlanID,VlanMode,AutoNeg
2+
str-msn2700-01,Ethernet0,str-7260-10,Ethernet1,40000,1681,Access,on
3+
str-msn2700-01,Ethernet4,str-7260-10,Ethernet2,40000,1682,Access,on
4+
str-msn2700-01,Ethernet8,str-7260-10,Ethernet3,40000,1683,Access,on
5+
str-msn2700-01,Ethernet12,str-7260-10,Ethernet4,40000,1684,Access,on
6+
str-msn2700-01,Ethernet16,str-7260-10,Ethernet5,40000,1685,Access,on
7+
str-msn2700-01,Ethernet20,str-7260-10,Ethernet6,40000,1686,Access,on
8+
str-msn2700-01,Ethernet24,str-7260-10,Ethernet7,40000,1687,Access,on
9+
str-msn2700-01,Ethernet28,str-7260-10,Ethernet8,40000,1688,Access,on
10+
str-msn2700-01,Ethernet32,str-7260-10,Ethernet9,40000,1689,Access,on
11+
str-msn2700-01,Ethernet36,str-7260-10,Ethernet10,40000,1690,Access,on
12+
str-msn2700-01,Ethernet40,str-7260-10,Ethernet11,40000,1691,Access,on
13+
str-msn2700-01,Ethernet44,str-7260-10,Ethernet12,40000,1692,Access,on
14+
str-msn2700-01,Ethernet48,str-7260-10,Ethernet13,40000,1693,Access,on
15+
str-msn2700-01,Ethernet52,str-7260-10,Ethernet14,40000,1694,Access,on
16+
str-msn2700-01,Ethernet56,str-7260-10,Ethernet15,40000,1695,Access,on
17+
str-msn2700-01,Ethernet60,str-7260-10,Ethernet16,40000,1696,Access,on
18+
str-msn2700-01,Ethernet64,str-7260-10,Ethernet17,40000,1697,Access,on
19+
str-msn2700-01,Ethernet68,str-7260-10,Ethernet18,40000,1698,Access,on
20+
str-msn2700-01,Ethernet72,str-7260-10,Ethernet19,40000,1699,Access,on
21+
str-msn2700-01,Ethernet76,str-7260-10,Ethernet20,40000,1700,Access,on
22+
str-msn2700-01,Ethernet80,str-7260-10,Ethernet21,40000,1701,Access,on
23+
str-msn2700-01,Ethernet84,str-7260-10,Ethernet22,40000,1702,Access,on
24+
str-msn2700-01,Ethernet88,str-7260-10,Ethernet23,40000,1703,Access,off
25+
str-msn2700-01,Ethernet92,str-7260-10,Ethernet24,40000,1704,Access,off
26+
str-msn2700-01,Ethernet96,str-7260-10,Ethernet25,40000,1705,Access,off
27+
str-msn2700-01,Ethernet100,str-7260-10,Ethernet26,40000,1706,Access,off
28+
str-msn2700-01,Ethernet104,str-7260-10,Ethernet27,40000,1707,Access,off
29+
str-msn2700-01,Ethernet108,str-7260-10,Ethernet28,40000,1708,Access,off
30+
str-msn2700-01,Ethernet112,str-7260-10,Ethernet29,40000,1709,Access,on
31+
str-msn2700-01,Ethernet116,str-7260-10,Ethernet30,40000,1710,Access,on
32+
str-msn2700-01,Ethernet120,str-7260-10,Ethernet31,40000,1711,Access,on
33+
str-msn2700-01,Ethernet124,str-7260-10,Ethernet32,40000,1712,Access,on
34+
str-7260-11,Ethernet19,str-acs-serv-01,p4p1,40000,,Trunk,on
35+
str-7260-11,Ethernet30,str-7260-10,Ethernet64,40000,1681-1712,Trunk,on

ansible/library/conn_graph_facts.py

+5-3
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ def csv_to_graph_facts(self):
299299
band_width = link["BandWidth"]
300300
vlan_ID = link["VlanID"]
301301
vlan_mode = link["VlanMode"]
302-
autoneg_mode = link.get("AutoNeg", "off")
302+
autoneg_mode = link.get("AutoNeg")
303303

304304
if start_device not in links:
305305
links[start_device] = {}
@@ -314,15 +314,17 @@ def csv_to_graph_facts(self):
314314
"peerdevice": end_device,
315315
"peerport": end_port,
316316
"speed": band_width,
317-
"autoneg": autoneg_mode,
318317
}
319318
links[end_device][end_port] = {
320319
"peerdevice": start_device,
321320
"peerport": start_port,
322321
"speed": band_width,
323-
"autoneg": autoneg_mode,
324322
}
325323

324+
if autoneg_mode:
325+
links[start_device][start_port].update({"autoneg": autoneg_mode})
326+
links[end_device][end_port].update({"autoneg": autoneg_mode})
327+
326328
port_vlans[start_device][start_port] = {
327329
"mode": vlan_mode,
328330
"vlanids": vlan_ID,

ansible/roles/fanout/tasks/fanout_sonic.yml

+5
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
- debug: msg="{{ device_info[inventory_hostname] }}"
22

3+
- name: get connection graph if defined for dut (ignore any errors)
4+
conn_graph_facts: host="{{ inventory_hostname }}" ignore_errors=true
5+
delegate_to: localhost
6+
ignore_errors: true
7+
38
- name: set login to tacacs if tacacs is defined
49
set_fact: ansible_ssh_user={{ fanout_tacacs_sonic_user }} ansible_ssh_pass={{ fanout_tacacs_sonic_password }}
510
when: >

ansible/roles/fanout/templates/sonic_deploy_202311.j2

+10
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,16 @@
2222
{% if fanout_port_config[port_name]['speed'] | default('100000') == "100000" %}
2323
"fec" : "rs",
2424
{% endif %}
25+
{% if port_name in device_conn[inventory_hostname] %}
26+
{% if 'autoneg' in device_conn[inventory_hostname][port_name] %}
27+
{% if 'on' in device_conn[inventory_hostname][port_name]['autoneg']%}
28+
"autoneg": "on",
29+
{% if msft_an_enabled is defined %}
30+
"fec": "none",
31+
{% endif %}
32+
{% endif %}
33+
{% endif %}
34+
{% endif %}
2535
{% if 'broadcom' in fanout_sonic_version["asic_type"] or 'marvell' in fanout_sonic_version["asic_type"] or 'mellanox' in fanout_sonic_version["asic_type"] %}
2636
{% if port_name in device_port_vlans[inventory_hostname] and device_port_vlans[inventory_hostname][port_name]["mode"].lower() == "access" %}
2737
"tpid": "0x9100",

ansible/templates/minigraph_device.j2

-2
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,12 @@
11
<DeviceInfos>
22
<DeviceInfo>
3-
<AutoNegotiation>true</AutoNegotiation>
43
<EthernetInterfaces xmlns:a="http://schemas.datacontract.org/2004/07/Microsoft.Search.Autopilot.Evolution">
54
{% if switch_type is not defined or switch_type != 'fabric' %}
65
{% set num_of_intf = port_alias | length %}
76
{% for index in range(num_of_intf) %}
87
<a:EthernetInterface>
98
<ElementType>DeviceInterface</ElementType>
109
<AlternateSpeeds i:nil="true"/>
11-
<EnableAutoNegotiation>true</EnableAutoNegotiation>
1210
<EnableFlowControl>true</EnableFlowControl>
1311
<Index>1</Index>
1412
<InterfaceName>{{ port_alias[index] }}</InterfaceName>

0 commit comments

Comments
 (0)