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

[test] Adding platform.json configuration file unit test #3911

Merged
merged 3 commits into from
Jun 4, 2020

Conversation

samaity
Copy link
Collaborator

@samaity samaity commented Dec 14, 2019

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

- What I did
In order to allow the SONiC community to check in platform capability file i.e. platform.json
file directly under device folder. We need to add this test to make sure the contents of the this file is compliant with platform capability design specified in DPB HLD doc

- How I did it
Added platformJson_checker.py file in Test folder.

- How to verify it

With the change as-is, build passes, the built image executed on the target platform, the configuration was applied properly.

Snapshot of success Build

samaity@43b85cf2e5e7:/sonic$ BLDENV=stretch make -f slave.mk target/debs/stretch/sonic-device-data_1.0-1_all.deb
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@43b85cf2e5e7:/sonic$ ls -la target/debs/stretch/sonic-device-data_1.0-1_all.deb*
-rw-r--r-- 1 samaity gsamaity 5806088 Dec  4 01:29 target/debs/stretch/sonic-device-data_1.0-1_all.deb
-rw-r--r-- 1 samaity gsamaity   27553 Dec  4 01:29 target/debs/stretch/sonic-device-data_1.0-1_all.deb.log

Snapshot of target/debs/stretch/sonic-device-data_1.0-1_all.deb.log

File ../../../device/dell/x86_64-dellemc_z9264f_c3538-r0/media_settings.json passed validity check
File ../../../device/celestica/x86_64-cel_seastone-r0/platform.json passed validity check
/sonic/src/sonic-device-data/src

Created a few bad platform.json files to test. Build got failed for all the bad platform capability file.
Build hit following failure:

index value is missing

Error: index of Ethernet0 has no value.
File ../../../device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-25-50/platform.json failed validity check
Makefile:6: recipe for target 'test' failed
make[3]: *** [test] Error 255
make[3]: Leaving directory '/sonic/src/sonic-device-data/src'

interface name is wrong in this case.

Error: Unknown Interface Esthernet8s at top level
File ../../../device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-10-50/platform.json failed validity check
Makefile:6: recipe for target 'test' failed
make[3]: *** [test] Error 255
make[3]: Leaving directory '/sonic/src/sonic-device-data/src'
brakout_modes is not the correct port attribute. syntax Error

port Attribute is missing

File ../../../device/dell/x86_64-dellemc_z9264f_c3538-r0/media_settings.json passed validity check
Error: brakout_modes is not the correct Port attribute.
File ../../../device/celestica/x86_64-cel_seastone-r0/Seastone-DX010-50-40/platform.json failed validity check
Makefile:6: recipe for target 'test' failed
make[3]: *** [test] Error 255
some of the port Attribute is missing

Breakout mode is missing here.

File ../../../device/celestica/x86_64-cel_seastone-r0/platform.json passed validity check
Error: index, default_brkout_mode of Ethernet16 is/are missing
File ../../../device/celestica/x86_64-cel_seastone-r0/Seastone-DX010/platform.json failed validity check
Makefile:6: recipe for target 'test' failed
make[3]: *** [test] Error 255

@samaity samaity marked this pull request as ready for review December 14, 2019 20:45
@jleveque
Copy link
Contributor

jleveque commented Jan 3, 2020

Retest vsimage please

Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
src/sonic-device-data/tests/platformJson_checker Outdated Show resolved Hide resolved
src/sonic-device-data/tests/platformJson_checker Outdated Show resolved Hide resolved
Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
Signed-off-by: Sangita Maity <sangitamaity0211@gmail.com>
@jleveque jleveque changed the title [test] Adding platform.json configuration file test [test] Adding platform.json configuration file unit test Jun 4, 2020
@jleveque jleveque merged commit 65fa874 into sonic-net:master Jun 4, 2020
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.

3 participants