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

[minigraph] set admin_status to down if port not in minigraph #6865

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

dmytroxshevchuk
Copy link
Contributor

@dmytroxshevchuk dmytroxshevchuk commented Feb 23, 2021

Why I did it

After produce platform.json, hwsku.json on DUT we have issue with some ports on load_minigraph flow. Previous scripts in sonic took the list of ports from port_config.ini(than we can announce ports what we need), but for now sonic gets full pack of ports from platform.json/hwsku.json and sets configuration for ports parsed from minigraph. So we have all ports from config_db and only a part(ports announced in minigraph) from this pack will be configured. Another pack of ports not using and OperState will be in Down, however AdminStatus has Up state.
So sanity check will fall because of AdminStatus is Up and OperState is Down. More correct set AdminStatus to down.

How I did it

Current PR sets AdminStatus to Down state in load_minigraph flow it case when this port not exist in minigraph.

How to verify it

  • add platform.json hwsku.json with full pack of ports
  • generate minigraph file with some ports
  • command: sonic-cfggen -m /ets/sonic/minigraph.xml --print-data
  • check admin_status

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012

Description for the changelog

A picture of a cute animal (not mandatory but encouraged)

@@ -1090,6 +1092,7 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
port_speeds_default = {}
port_speed_png = {}
port_descriptions = {}
port_alias_list = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to create a new list or can we use existing port_alias_map?.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

port_alias_map contains aliases from config_db, so we cannot use it

@@ -1346,6 +1349,11 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
for port in ports.values():
port['pfc_asym'] = 'off'

# make admin status to down if port not parsed from minigraph
for port in ports.values():
if port['alias'] not in port_alias_list:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this impact multi-asic platforms where there are backplane ports? @arlakshm ?

@prsunny prsunny requested a review from arlakshm February 23, 2021 17:31
@dmytroxshevchuk dmytroxshevchuk force-pushed the admin_status_down_if_port_not_in_mini branch from 3c24498 to ec23e2b Compare February 25, 2021 16:14
@dmytroxshevchuk dmytroxshevchuk changed the title [minigraph] set admin_status to down if port not in minigraph WIP: [minigraph] set admin_status to down if port not in minigraph Feb 25, 2021
@dmytroxshevchuk dmytroxshevchuk force-pushed the admin_status_down_if_port_not_in_mini branch 10 times, most recently from b4e6bf2 to bee186d Compare March 3, 2021 19:47
@dmytroxshevchuk dmytroxshevchuk changed the title WIP: [minigraph] set admin_status to down if port not in minigraph [minigraph] set admin_status to down if port not in minigraph Mar 3, 2021
@@ -810,7 +810,7 @@
"index": "7",
"lanes": "26,27",
"description": "Eth7/2",
"admin_status": "up",
"admin_status": "down",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is the test modified to have all port set to "down"?. I would expect test some port down and some up.

Copy link
Contributor Author

@dmytroxshevchuk dmytroxshevchuk Mar 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ports described in minigraph.xml as EthernetInterface has up admin_status.
This ports:
Ethernet8, Ethernet9, Ethernet36, Ethernet98, Ethernet0, Ethernet6, Ethernet4, Ethernet109, Ethernet108, Ethernet18, Ethernet100, Ethernet34, Ethernet104, Ethernet106, Ethernet76, Ethernet74, Ethernet39, Ethernet72, Ethernet73, Ethernet70, Ethernet71, Ethernet32, Ethernet33, Ethernet16, Ethernet10, Ethernet11, Ethernet19, Ethernet112
have "admin_status": "up"

@dmytroxshevchuk dmytroxshevchuk force-pushed the admin_status_down_if_port_not_in_mini branch from bee186d to 49484a7 Compare March 4, 2021 17:04
@dmytroxshevchuk dmytroxshevchuk requested a review from prsunny March 9, 2021 10:28
@@ -1364,6 +1364,11 @@ def parse_xml(filename, platform=None, port_config_file=None, asic_name=None, hw
for port in ports.values():
port['pfc_asym'] = 'off'

# make admin status to down if port not parsed from minigraph
for port in ports.keys():
if 'admin_status' in ports[port] and port not in port_speeds_default:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This check if 'admin_status' in ports[port]. What would be the value if its present? Where is that default value coming from?

@dmytroxshevchuk dmytroxshevchuk requested a review from a team as a code owner June 10, 2022 02:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants