[Nexthop][NPI] "asic_config_v3" part 2 - JSON schemas and validation script#1199
[Nexthop][NPI] "asic_config_v3" part 2 - JSON schemas and validation script#1199marif-nexthop wants to merge 1 commit into
Conversation
5927fc1 to
8289e96
Compare
01bf56e to
f7f4e06
Compare
e070735 to
5219eef
Compare
| return platforms | ||
|
|
||
|
|
||
| def generate_all_asic_configs() -> None: |
There was a problem hiding this comment.
Can we also support generate asic config based on the specific platform?
This will be helpful for the users who are working on a specific platform and don't have to wait to generate other unrelated platforms.
We could support specific platform asic config gen logic in the future PR
But eventually fboss will generate all configs.
There was a problem hiding this comment.
After rebasing on the latest main, the file gen.py is not part of this PR (it was of the base PR) but I have noted your suggestion to add the feature to generate platform specific asic_config. Thanks.
Add strict JSON schemas for the Broadcom `XGS` ASIC config, the platform config, and the shared vendor common JSONs. Include a validation script that scans the `asic_config_v3` directory tree and validates every matching file against its schema.
5219eef to
9198c4a
Compare
|
@joseph5wu has imported this pull request. If you are a Meta employee, you can view this in D109061608. |
|
@joseph5wu merged this pull request in d0689fe. |
Summary: **Pre-submission checklist** - [x] I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running `pip install -r requirements-dev.txt && pre-commit install` - [x] `pre-commit run` Implements `asic_config_v3` design. In this PR, introduce the `asic_config_v3` Broadcom XGS generator class along with the shared XGS SDK and SAI common JSONs, and per-ASIC JSONs for Tomahawk 5 and Tomahawk 6. Registered both ASICs in gen.py's `_GENERATOR_REGISTRY` and extend the CMake target SOURCES with the new generator file. After this commit the `asic_config_v3` package can generate XGS configs for any platform whose `asic_config.json` references `tomahawk5` or `tomahawk6`. No platforms are registered yet but will be added in the following PRs. Pull Request resolved: #1220 Test Plan: Running `fboss/lib/asic_config_v3/run-helper.sh` is no-op as there are no platforms added yet. The platforms will be added in the following PRs. Schema validation passes for all files. ``` $ python3 ./fboss/lib/asic_config_v3/validation/validate_asic_configs.py Vendor common configs (vendor_common.schema.json): vendors/broadcom/xgs/sai_common.json: PASSED vendors/broadcom/xgs/sdk_common.json: PASSED Broadcom XGS ASIC configs (broadcom_xgs_asic_config.schema.json): vendors/broadcom/xgs/asics/tomahawk5.json: PASSED vendors/broadcom/xgs/asics/tomahawk6.json: PASSED Platform configs (platform_config.schema.json): No files found. 4 passed, 0 failed ``` ---- **This PR is created on top of** - #1131 - #1149 - #1198 - #1199 **so it contains diff from these PRs. When these PRs will merge, this PR will have a shorter diff.** Reviewed By: daiwei1983 Differential Revision: D109338944 Pulled By: joseph5wu fbshipit-source-id: 454fd40e05ba8504a5929ceee1efdd328e8c2b68
Summary: **Pre-submission checklist** - [x] I've ran the linters locally and fixed lint errors related to the files I modified in this PR. You can install the linters by running `pip install -r requirements-dev.txt && pre-commit install` - [x] `pre-commit run` Implements `asic_config_v3` design. In this PR, add platform configurations for the four core XGS platforms which were originally generated by `asic_config_v2`: - montblanc - icecube800bc - icecube800banw - wedge800bact After this commit the `asic_config_v3` generator produces four XGS output files which should be identical to the `asic_config_v2` output. **Note: After review comments, changed variant name `base` to `default`.** v2: montblanc_base.yml v3: montblanc_defaultyml v2: wedge800bact_base.yml v3: wedge800bact_default.yml Pull Request resolved: #1221 Test Plan: Ran `fboss/lib/asic_config_v3/run-helper.sh` to generate `asic_config_v3` output: ``` Completed build for fboss-asic-config-v3-gen.GEN_PY_EXE ... Writing to /var/FBOSS/fboss/fboss/lib/asic_config_v3/generated_asic_configs/icecube800banw_default.yml ... Writing to /var/FBOSS/fboss/fboss/lib/asic_config_v3/generated_asic_configs/wedge800bact_default.yml ... Writing to /var/FBOSS/fboss/fboss/lib/asic_config_v3/generated_asic_configs/montblanc_default.yml ... Writing to /var/FBOSS/fboss/fboss/lib/asic_config_v3/generated_asic_configs/icecube800bc_default.yml Configs have been written to specified output directory $ ls -1 fboss/lib/asic_config_v3/generated_asic_configs icecube800banw_default.yml icecube800bc_default.yml montblanc_default.yml wedge800bact_default.yml ``` The generated output files are byte-identical with `asic_config_v2` output ``` $ diff -r fboss/lib/asic_config_v3/generated_asic_configs/ fboss/lib/asic_config_v2/generated_asic_configs/ <no diff> ``` Schema validation also passed for all files ``` $ python3 ./fboss/lib/asic_config_v3/validation/validate_asic_configs.py Vendor common configs (vendor_common.schema.json): vendors/broadcom/xgs/sai_common.json: PASSED vendors/broadcom/xgs/sdk_common.json: PASSED Broadcom XGS ASIC configs (broadcom_xgs_asic_config.schema.json): vendors/broadcom/xgs/asics/tomahawk5.json: PASSED vendors/broadcom/xgs/asics/tomahawk6.json: PASSED Platform configs (platform_config.schema.json): platforms/icecube800banw/asic_config.json: PASSED platforms/icecube800bc/asic_config.json: PASSED platforms/montblanc/asic_config.json: PASSED platforms/wedge800bact/asic_config.json: PASSED 8 passed, 0 failed ``` **This PR is created on top of** - #1131 - #1149 - #1198 - #1199 - #1220 **so it contains diff from these PRs. When these PRs will merge, this PR will have a shorter diff.** Reviewed By: daiwei1983 Differential Revision: D109735092 Pulled By: joseph5wu fbshipit-source-id: 936409ca309759f8feab3c29046ca0d8ad645189
Pre-submission checklist
pip install -r requirements-dev.txt && pre-commit installpre-commit runSummary
Implements
asic_config_v3design.Add strict JSON schemas for the Broadcom
XGSASIC config, the platform config, and the shared vendor common JSONs. Include a validation script that scans theasic_config_v3directory tree and validates every matching file against its schema.Test Plan
Install required package
python3 -m pip install jsonschemaRun schema validation
Note: There are no json files to validate at this point. Will be added in the next PR.
This PR is created on top of
so it contains diff from these PRs. When these PRs will merge, this PR will have a shorter diff.