Option to import sonic yangs from sonic-buildimage/src/sonic-yang-models into UMF#89
Merged
anand-kumar-subramanian merged 5 commits intosonic-net:masterfrom Jun 12, 2023
Conversation
- Modified the existing schema generator pyang plugin as a standalone script. It uses pyang APIs to process all the sonic yangs and write the schema yin files at once. - Schema generator will transform the single table's container syntax to the regular table's list syntax. All references to such container will also be updatede in the other sonic yangs. This enables all cvl validations for the tables modeled in singleton container syntax. - Updated cvl makefiles to use this new tool for generating main schema as well as test schema. Removed all unused makefiles. Signed-off-by: Sachin Holla <[email protected]> Co-authored-by: Mohammed Faraaz C <[email protected]>
- Scripts to import selected sonic yangs and its dependencies from
sonic-buildimage/src/sonic-yang-models during build time. Yang file
names to be imported are read from models/yang/sonic/import.mk file.
- Imported sonic models will be kept at build/yang/sonic directory.
All other yangs are also copied to build/yang directory. Preserves
the source directory structure.
build/yang ==> API yangs (openconfig, ietf)
├── annotations ==> tranformer annotations
├── common ==> dependent yangs of API yangs
├── extensions ==> API extension yangs
└── sonic ==> sonic yangs (local & imported)
└── common ==> dependent yangs of the imported sonic yangs
- Cannot import all sonic yangs at this point. A few of them are not
compatible with current codegens, cvl and transformer infra.
To avoid unexpected failures, only the yangs mentioned in import.mk
will be supported in the APIs. Other sonic yangs referred by them
are used for validation & compilation purposes only.
- Updated all codegens, debian install specs and test tools to use
yangs from build/yang directory instead of models/yang.
- Added build/yang directory to sonic-mgmt-common-codegen.deb. Added a
debian postinstall script to fix the file ownership of source files
installed from dpkg cache.
Signed-off-by: Sachin Holla <[email protected]>
kwangsuk
approved these changes
May 26, 2023
ac508ed to
8e94dd1
Compare
anand-kumar-subramanian
approved these changes
Jun 12, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Added scripts to import selected sonic yangs and its dependencies from
sonic-buildimage/src/sonic-yang-modelsduring build time. Yang file names to be imported are read frommodels/yang/sonic/import.mkfile.Imported sonic models and all other local yangs (oc yangs, transformer annotations, local sonic yangs etc) will be copied to
build/yangdirectory first. Preserves the source directory structure.This is the first step towards addressing Incomplete REST API Support for Yang Models on SONiC Target Board sonic-buildimage#15183 requirement. We cannot support all yangs from
sonic-buildimage/src/sonic-yang-modelsas of now due to limitations in UMF code generators, cvl & transformer components. They will be enhanced gradually later.Enhanced the CVL schema generator to handle the singleton tables modeled as a container instead of usual list syntax (with _LIST suffix)