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

[buildImage] Add support of platform.json parsing to portconfig.py file #3909

Merged
merged 9 commits into from
Jun 18, 2020

Conversation

samaity
Copy link
Collaborator

@samaity samaity commented Dec 14, 2019

Signed-off-by: Sangita Maity sangitamaity0211@gmail.com

  • [sonic-cfggen] Add a unit-test to test platform capability file

Signed-off-by: Sangita Maity sangitamaity0211@gmail.com

Adding a new function to create BRKOUT_CFG TABLE in config db

Signed-off-by: Sangita Maity sangitamaity0211@gmail.com

- What I did
Add support of platform.json parsing to portconfig.py file which is being used by sonic-cfggen and minigraph.py file under src/sonic-config-engine folder to get port config via get_port_config function.

- How I did it

  1. portconfig.py file will first check whether the platform.json file is there or not. if not then whether port_config.ini file is there or not. Modified get_port_config_file_name for this purpose.
  2. Added two separate functions i.e. parse_platform_json_file to get port attributes from platform.json and gen_port_config to generate port attributes.
  3. Added another two functions i.e get_breakout_mode parse_breakout_mode to get breakout mode and parse breakout mode from platform.json respectively.

- How to verify it

rebuilt "sonic_config_engine-1.0" wheel package with all the test cases.All the below-mentioned test cases passed.

# Check whether all interfaces present or not as per platform.json
def test_platform_json_interfaces_keys(self):
       
# Check specific Interface with it's proper configuration as per platform.json
def test_platform_json_specific_ethernet_interfaces(self):

# Check all Interface with it's proper configuration as per platform.json
def test_platform_json_all_ethernet_interfaces(self):

log file

samaity@50c03d616603:/sonic$ BLDENV=stretch make -f slave.mk target/python-wheels/sonic_config_engine-1.0-py2-none-any.whl
SONiC Build System

Build Configuration
"CONFIGURED_PLATFORM"             : "vs"
"CONFIGURED_ARCH"                 : "amd64"
"SONIC_CONFIG_PRINT_DEPENDENCIES" : ""
"SONIC_BUILD_JOBS"                : "1"
"SONIC_CONFIG_MAKE_JOBS"          : "24"
"SONIC_USE_DOCKER_BUILDKIT"       : ""
"USERNAME"                        : "admin"
"PASSWORD"                        : "admin123"
"ENABLE_DHCP_GRAPH_SERVICE"       : ""
"SHUTDOWN_BGP_ON_START"           : ""
"ENABLE_PFCWD_ON_START"           : ""
"INSTALL_DEBUG_TOOLS"             : ""
"ROUTING_STACK"                   : "frr"
"FRR_USER_UID"                    : "300"
"FRR_USER_GID"                    : "300"
"ENABLE_SYNCD_RPC"                : ""
"ENABLE_ORGANIZATION_EXTENSIONS"  : "y"
"HTTP_PROXY"                      : ""
"HTTPS_PROXY"                     : ""
"ENABLE_SYSTEM_TELEMETRY"         : "y"
"SONIC_DEBUGGING_ON"              : ""
"SONIC_PROFILING_ON"              : ""
"KERNEL_PROCURE_METHOD"           : "build"
"BUILD_TIMESTAMP"                 : ""
"BLDENV"                          : "stretch"
"VS_PREPARE_MEM"                  : "yes"
"ENABLE_SFLOW"                    : "y"

samaity@server09:~/REPO_FACTORY/GIT_REPO/DPB/sonic-buildimage$ ls -la     target/python-wheels/sonic_config_engine-1.0-py2-none-any.whl
-rw-r--r-- 1 samaity samaity 44514 Dec  2 19:05 target/python-wheels/sonic_config_engine-1.0-py2-none-any.whl

@stevenlu99
Copy link
Contributor

I think would be better if we put all port definitions in platform.json file into a section "interfaces" or "port_defs"?

@samaity
Copy link
Collaborator Author

samaity commented May 14, 2020

I think would be better if we put all port definitions in platform.json file into a section "interfaces" or "port_defs"?

#done

samaity added 2 commits June 2, 2020 20:41
Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>

* [sonic-cfggen] Add a unit-test to test platform capability file

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>

Adding a new function to create BRKOUT_CFG TABLE in config db (sonic-net#17)

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
@samaity samaity force-pushed the port_config_file_change_msft branch from c25cc98 to e5066af Compare June 2, 2020 21:03
@lgtm-com
Copy link

lgtm-com bot commented Jun 2, 2020

This pull request introduces 3 alerts when merging e5066af into 7b80377 - view on LGTM.com

new alerts:

  • 2 for Except block handles 'BaseException'
  • 1 for Result of integer division may be truncated

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
@lgtm-com
Copy link

lgtm-com bot commented Jun 2, 2020

This pull request introduces 1 alert when merging 20c212c into 3e110fb - view on LGTM.com

new alerts:

  • 1 for Result of integer division may be truncated

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
@lgtm-com
Copy link

lgtm-com bot commented Jun 3, 2020

This pull request introduces 1 alert when merging 2f17452 into 3e110fb - view on LGTM.com

new alerts:

  • 1 for Result of integer division may be truncated

@jleveque
Copy link
Contributor

jleveque commented Jun 3, 2020

Please fix LGTM alert. Looks like integer division. If you don't care about the remainder, you can use the Python "floor division" operator: //

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
@samaity
Copy link
Collaborator Author

samaity commented Jun 3, 2020

Please fix LGTM alert. Looks like integer division. If you don't care about the remainder, you can use the Python "floor division" operator: //

#done

jleveque
jleveque previously approved these changes Jun 3, 2020
@lguohan
Copy link
Collaborator

lguohan commented Jun 4, 2020

retest vsimage please

2 similar comments
@daall
Copy link
Contributor

daall commented Jun 5, 2020

retest vsimage please

@renukamanavalan
Copy link
Contributor

retest vsimage please

@zhenggen-xu
Copy link
Collaborator

retest vsimage please

1 similar comment
@daall
Copy link
Contributor

daall commented Jun 10, 2020

retest vsimage please

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
@lgtm-com
Copy link

lgtm-com bot commented Jun 13, 2020

This pull request introduces 1 alert when merging abf66c9 into a748dae - view on LGTM.com

new alerts:

  • 1 for Unused import

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
@zhenggen-xu
Copy link
Collaborator

retest vsimage please

1 similar comment
@daall
Copy link
Contributor

daall commented Jun 15, 2020

retest vsimage please

…it and addressed review comments

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
@samaity
Copy link
Collaborator Author

samaity commented Jun 17, 2020

All test cases are passing except dhcp_relay.test_dhcp_relay.test_dhcp_relay_after_link_flap

I can see some ongoing issue related to this matter? Any Idea @daall?

@daall
Copy link
Contributor

daall commented Jun 17, 2020

retest vsimage please

@daall
Copy link
Contributor

daall commented Jun 17, 2020

All test cases are passing except dhcp_relay.test_dhcp_relay.test_dhcp_relay_after_link_flap

I can see some ongoing issue related to this matter? Any Idea @daall?

We can re-run the tests. It looks like everything else is working now so hopefully it passes on the next run. :)

@samaity samaity requested a review from jleveque June 18, 2020 04:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants