Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions ansible/library/conn_graph_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,7 @@ def csv_to_graph_facts(self):
vlan_mode = link["VlanMode"]
autoneg_mode = link.get("AutoNeg")
fec_disable = link.get("FECDisable", False)
linktraining_mode = link.get("LinkTraining", "")

if start_device not in links:
links[start_device] = {}
Expand All @@ -327,6 +328,9 @@ def csv_to_graph_facts(self):
if autoneg_mode:
links[start_device][start_port].update({"autoneg": autoneg_mode})
links[end_device][end_port].update({"autoneg": autoneg_mode})
if linktraining_mode:
links[start_device][start_port].update({"linktraining": linktraining_mode})
links[end_device][end_port].update({"linktraining": linktraining_mode})

port_vlans[start_device][start_port] = {
"mode": vlan_mode,
Expand Down
20 changes: 20 additions & 0 deletions ansible/library/generate_golden_config_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,23 @@ def generate_lt2_ft2_golden_config_db(self):

return json.dumps(golden_config, indent=4)

def generate_t0_f2_golden_config_db(self):
"""
Generate golden_config for t0-f2 to enable link_training on server facing ports.
"""
SUPPORTED_TOPO = ["t0-f2-d40u8"]
if self.topo_name not in SUPPORTED_TOPO:
return "{}"
ori_config = json.loads(self.get_config_from_minigraph())
golden_config = ori_config
golden_config["PORT"] = ori_config.get("PORT", {})
for _, config in golden_config["PORT"].items():
# Enable link_training for server facing ports
if "Server" in config.get("description", ""):
config["link_training"] = "on"

return json.dumps(golden_config, indent=4)

def generate(self):
module_msg = "Success to generate golden_config_db.json"
# topo check
Expand All @@ -351,6 +368,9 @@ def generate(self):
config = self.generate_smartswitch_golden_config_db()
self.module.run_command("sudo rm -f {}".format(TEMP_SMARTSWITCH_CONFIG_PATH))
module_msg = module_msg + " for smartswitch"
elif "t0-f2" in self.topo_name:
config = self.generate_t0_f2_golden_config_db()
module_msg = module_msg + " for t0-f2"
elif "ft2" in self.topo_name or "lt2" in self.topo_name:
config = self.generate_lt2_ft2_golden_config_db()
elif "t2_single_node" in self.topo_name:
Expand Down
21 changes: 20 additions & 1 deletion ansible/roles/fanout/templates/sonic_deploy_202405.j2
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,28 @@
{% if fanout_hwsku == "Arista-720DT-G48S4" and (fanout_port_config[port_name]['lanes'] | int) <= 24 %}
"autoneg": "on",
{% endif %}
{% if fanout_port_config[port_name]['speed'] | default('100000') in ["100000", "400000", "800000"] %}
{% if fanout_port_config[port_name]['speed'] | default('100000') in ["100000", "200000", "400000", "800000"] %}
"fec" : "rs",
{% endif %}
{% if port_name in device_conn[inventory_hostname] %}
{% if 'linktraining' in device_conn[inventory_hostname][port_name] %}
{% if 'on' in device_conn[inventory_hostname][port_name]['linktraining'] %}
"link_training": "on",
{% elif 'off' in device_conn[inventory_hostname][port_name]['linktraining'] %}
"link_training": "off",
{% endif %}
{% endif %}
{% if 'autoneg' in device_conn[inventory_hostname][port_name] %}
{% if 'on' in device_conn[inventory_hostname][port_name]['autoneg'] %}
"autoneg": "on",
{% if msft_an_enabled is defined %}
"fec": "none",
{% endif %}
{% elif 'off' in device_conn[inventory_hostname][port_name]['autoneg'] %}
"autoneg": "off",
{% endif %}
{% endif %}
{% endif %}
{% if 'broadcom' in fanout_sonic_version["asic_type"] or 'marvell' in fanout_sonic_version["asic_type"] or 'mellanox' in fanout_sonic_version["asic_type"] %}
{% if port_name in device_port_vlans[inventory_hostname] and device_port_vlans[inventory_hostname][port_name]["mode"].lower() == "access" %}
"tpid": "0x9100",
Expand Down
Loading