Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[201811][sonic-config-engine] Parse AutoNegotiation element from LinkMetadata section of minigraph file #7048

Merged
merged 1 commit into from
Mar 18, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
10 changes: 10 additions & 0 deletions src/sonic-config-engine/minigraph.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ def parse_linkmeta(meta, hname):
for linkmeta in link.findall(str(QName(ns1, "LinkMetadata"))):
port = None
fec_disabled = None
auto_negotiation = None

# Sample: ARISTA05T1:Ethernet1/33;switch-t0:fortyGigE0/4
key = linkmeta.find(str(QName(ns1, "Key"))).text
Expand All @@ -441,10 +442,14 @@ def parse_linkmeta(meta, hname):
value = device_property.find(str(QName(ns1, "Value"))).text
if name == "FECDisabled":
fec_disabled = value
elif name == "AutoNegotiation":
auto_negotiation = value

linkmetas[port] = {}
if fec_disabled:
linkmetas[port]["FECDisabled"] = fec_disabled
if auto_negotiation:
linkmetas[port]["AutoNegotiation"] = auto_negotiation
return linkmetas


Expand Down Expand Up @@ -638,6 +643,11 @@ def parse_xml(filename, platform=None, port_config_file=None):
if port.get('speed') == '100000' and linkmetas.get(alias, {}).get('FECDisabled', '').lower() != 'true':
port['fec'] = 'rs'

# If AutoNegotiation is available in the minigraph, we override any value we may have received from port_config.ini
autoneg = linkmetas.get(alias, {}).get('AutoNegotiation')
if autoneg:
port['autoneg'] = '1' if autoneg.lower() == 'true' else '0'

# set port description if parsed from deviceinfo
for port_name in port_descriptions:
# ignore port not in port_config.ini
Expand Down
Loading