Skip to content

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
sachinholla:sonicyang-import
Jun 12, 2023
Merged

Option to import sonic yangs from sonic-buildimage/src/sonic-yang-models into UMF#89
anand-kumar-subramanian merged 5 commits intosonic-net:masterfrom
sachinholla:sonicyang-import

Conversation

@sachinholla
Copy link
Copy Markdown
Contributor

  • Added 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 and all other local yangs (oc yangs, transformer annotations, local sonic yangs etc) will be copied to build/yang directory 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-models as 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)

sachinholla and others added 3 commits May 25, 2023 11:57
- 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]>
@anand-kumar-subramanian anand-kumar-subramanian merged commit 29be300 into sonic-net:master Jun 12, 2023
@sachinholla sachinholla deleted the sonicyang-import branch July 19, 2023 06:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants