-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
[sonic-utilities][sonic-py-common] Move logic to get port config file path to sonic-py-common and update sonic-utilities to comply #5264
[sonic-utilities][sonic-py-common] Move logic to get port config file path to sonic-py-common and update sonic-utilities to comply #5264
Conversation
Fix pfcwd stats crash with invalid queue name (sonic-net#1077) [show][bgp]Display the Total number of neighbors in the show ip bgp(v6) summary. (sonic-net#1079) [config] Update SONiC Environment Vars When Loading Minigraph (sonic-net#1073) Multi asic platform changes for interface, portchannel commands (sonic-net#878) Update Command-Reference.md (sonic-net#1075) [filter-fdb] Fix Filter FDB With IPv6 Present in Config DB (sonic-net#1059) [config] Remove _get_breakout_cfg_file_name helper function (sonic-net#1069) [SHOW][BGP] support show ip(v6) bgp summary for multi asic platform (sonic-net#1064) [fanshow] Display other fan status, such as Updating (sonic-net#1014) Add ip_prefix len based on proxy_arp status (sonic-net#1046) Enable the platform specific ssd firmware upgrade during reboot (sonic-net#954) [show][cli[show interface portchannel support for Multi ASIC (sonic-net#1005) support show interface commands for multi ASIC platforms (sonic-net#1006) Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
fix the build Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
port_config_candidates.append(os.path.join(hwsku_path, PORT_CONFIG_INI)) | ||
if asic: | ||
port_config_candidates.append(os.path.join(hwsku_path, asic, PORT_CONFIG_INI)) | ||
port_config_candidates.append(os.path.join(hwsku_path, PORT_CONFIG_INI)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
line 199 and 202 are appending the same file. The list from the sonic-config-engine is:
port_config_candidates.append(os.path.join(HWSKU_ROOT_PATH, PORT_CONFIG_INI))
if hwsku:
if platform:
if asic:
port_config_candidates.append(os.path.join(PLATFORM_ROOT_PATH, platform, hwsku, asic, PORT_CONFIG_INI))
port_config_candidates.append(os.path.join(PLATFORM_ROOT_PATH, platform, hwsku, PORT_CONFIG_INI))
port_config_candidates.append(os.path.join(PLATFORM_ROOT_PATH_DOCKER, hwsku, PORT_CONFIG_INI))
port_config_candidates.append(os.path.join(SONIC_ROOT_PATH, hwsku, PORT_CONFIG_INI))
elif platform and not hwsku:
port_config_candidates.append(os.path.join(PLATFORM_ROOT_PATH, platform, PORT_CONFIG_INI))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. the second is no longer needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question is, why were we checking for port_config.ini in this order?
/usr/share/sonic/hwsku/
/usr/share/sonic/device/<platform>/<hwsku>/<ASIC>/
/usr/share/sonic/device/<platform>/<hwsku>/
/usr/share/sonic/<platform>/
@samaity, @SuvarnaMeenakshi: Can you help answer this? Determining whether we are running inside a container versus in the host OS should now be handled by get_paths_to_platform_and_hwsku_dirs()
. What is the new proper order with which to look for the port_config.ini file?
Before the addition of multi-ASIC functionality, the port_config.ini file was always located under the HwSKU directory, which, in the host OS was at /usr/share/sonic/device/<platform>/<hwsku>/
and in the containers was mounted at /usr/share/sonic/hwsku/
. Why did we start checking the <platform>
directory? Is there now a case where port_config.ini will reside directly under the platform directory? That has never been the case as far as I'm aware.
I believe the proper method for finding the port_config.ini file now that we have multi-ASIC functionality should be as simple as this:
# This function will return `/usr/share/sonic/hwsku/` as hwsku_path if run inside a container
# or `/usr/share/sonic/device/<platform>/<hwsku>/` if run in the host OS
(platform_path, hwsku_path) = get_paths_to_platform_and_hwsku_dirs()
if asic:
port_config_candidates.append(os.path.join(hwsku_path, asic, PORT_CONFIG_INI))
else:
port_config_candidates.append(os.path.join(hwsku_path, PORT_CONFIG_INI))
Please correct me if I am wrong.
fix builds Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed, please also remove the get_port_config_file_name()
function from portconfig.py as you had done in #5253, and close that PR as it will be redundant to this one.
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
fixed |
port_config_candidates.append(os.path.join(hwsku_path, PORT_CONFIG_INI)) | ||
if asic: | ||
port_config_candidates.append(os.path.join(hwsku_path, asic, PORT_CONFIG_INI)) | ||
port_config_candidates.append(os.path.join(platform_path, PORT_CONFIG_INI)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe we should be able to simplify this as follows, but will wait for input from @samaity and @SuvarnaMeenakshi in case recent changes have altered this:
if asic:
port_config_candidates.append(os.path.join(hwsku_path, asic, PORT_CONFIG_INI))
else:
port_config_candidates.append(os.path.join(hwsku_path, PORT_CONFIG_INI))
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the above suggested simplification looks good. If asic is defined, then platform/hwsku/port_config.ini will not be present as per current design.
In the previous code, I do not see port_config_candidates.append(os.path.join(platform_path, PORT_CONFIG_INI)). being directly used, and is used only if hwsku is not defined. Any reason for removing that check?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, the above suggested simplification looks good. If asic is defined, then platform/hwsku/port_config.ini will not be present as per current design.
Great. Thanks for the confirmation!
In the previous code, I do not see port_config_candidates.append(os.path.join(platform_path, PORT_CONFIG_INI)). being directly used, and is used only if hwsku is not defined. Any reason for removing that check?
Because port_config.ini
has never resided directly under the <platform>
directory (unless something changed recently), as it has always been hardware SKU-specific. That's one of the reasons I'm asking these questions. I don't believe that is a valid check, and I want to confirm that it can be removed. @samaity: It appears you added this directory as a candidate. What was your reasoning?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jleveque , As I have understood till now and also during platform.json
file porting, the order was like below.
/usr/share/sonic/hwsku/
/usr/share/sonic/device/<platform>/<hwsku>/
/usr/share/sonic/platform/<hwsku>/
/usr/share/sonic/<hwsku>/
So, I followed the same, but yeah, I guess, I mistakenly added the directory. I don't think it's needed for port_config.ini
. however, platform.json
will be under the platform directory. So we are safe with the changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So to finalize/summarize for posterity, platform.json
will always be found under:
/usr/share/sonic/device/<platform>/
in the host OS/usr/share/sonic/platform/
inside a container
And port_config.ini
will always be found under:
/usr/share/sonic/device/<platform>/<hwsku>/<ASIC index>/
in the host OS of a multi-ASIC switch/usr/share/sonic/device/<platform>/<hwsku>/
in the host OS of a single-ASIC switch/usr/share/sonic/hwsku/<ASIC index>/
(also/usr/share/sonic/platform/<hwsku>/<ASIC index>/
) in a container on a multi-ASIC switch/usr/share/sonic/hwsku/
(also/usr/share/sonic/platform/<hwsku>/
) in a container on a single-ASIC switch
@SuvarnaMeenakshi, @samaity: Correct?
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
retest this please |
@vdahiya12: The PR builds are now failing because the sonic-config-engine unit tests do not run on any platform, therefore |
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Retest vsimage please |
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Retest vsimage please |
Retest vsimage please |
2 similar comments
Retest vsimage please |
Retest vsimage please |
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
… path to sonic-py-common and update sonic-utilities to comply (sonic-net#5264) * [sonic-utilities]update submodule with fix This PR addresses fixes in sonic-py-common to imitate the behavior inside sonic-cfggen. Essentially this is a fix for accessing the port-config file. First check if there is a platform.json file for config generation and then for legacy port_config.ini. Also updating the sub-module sonic-utilities. Fix pfcwd stats crash with invalid queue name (sonic-net#1077) [show][bgp]Display the Total number of neighbors in the show ip bgp(v6) summary. (sonic-net#1079) [config] Update SONiC Environment Vars When Loading Minigraph (sonic-net#1073) Multi asic platform changes for interface, portchannel commands (sonic-net#878) Update Command-Reference.md (sonic-net#1075) [filter-fdb] Fix Filter FDB With IPv6 Present in Config DB (sonic-net#1059) [config] Remove _get_breakout_cfg_file_name helper function (sonic-net#1069) [SHOW][BGP] support show ip(v6) bgp summary for multi asic platform (sonic-net#1064) [fanshow] Display other fan status, such as Updating (sonic-net#1014) Add ip_prefix len based on proxy_arp status (sonic-net#1046) Enable the platform specific ssd firmware upgrade during reboot (sonic-net#954) [show][cli[show interface portchannel support for Multi ASIC (sonic-net#1005) support show interface commands for multi ASIC platforms (sonic-net#1006) Signed-off-by: vaibhav-dahiya <vdahiya@microsoft.com>
This PR addresses fixes in sonic-py-common to imitate the behavior inside
sonic-cfggen. Essentially this is a fix for accessing the port-config file.
First check if there is a platform.json file for config generation
and then for legacy port_config.ini.
Also updating the sub-module sonic-utilities.
sonic-utilities update submodule includes all these PR's
Fix pfcwd stats crash with invalid queue name (#1077)
[show][bgp]Display the Total number of neighbors in the show ip bgp(v6) summary. (#1079)
[config] Update SONiC Environment Vars When Loading Minigraph (#1073)
Multi asic platform changes for interface, portchannel commands (#878)
Update Command-Reference.md (#1075)
[filter-fdb] Fix Filter FDB With IPv6 Present in Config DB (#1059)
[config] Remove _get_breakout_cfg_file_name helper function (#1069)
[SHOW][BGP] support show ip(v6) bgp summary for multi asic platform (#1064)
[fanshow] Display other fan status, such as Updating (#1014)
Add ip_prefix len based on proxy_arp status (#1046)
Enable the platform specific ssd firmware upgrade during reboot (#954)
[show][cli[show interface portchannel support for Multi ASIC (#1005)
support show interface commands for multi ASIC platforms (#1006)
Signed-off-by: vaibhav-dahiya vdahiya@microsoft.com