diff --git a/doc/SONiC_Yang_WorkGroup_Wiki.md b/doc/SONiC_Yang_WorkGroup_Wiki.md index 1d04a6efab0..2876f69a365 100644 --- a/doc/SONiC_Yang_WorkGroup_Wiki.md +++ b/doc/SONiC_Yang_WorkGroup_Wiki.md @@ -406,9 +406,11 @@ RFC 7951 Yang tests are mainly written in below two files: Json file contains the config to test in sonic_yang format. + https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-models/tests/yang_model_tests/yangTest.json And test Code is in: + https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-models/tests/yang_model_tests/test_yang_model.py There are 4 kinds to tests: @@ -562,7 +564,10 @@ Python test file will have an entry as below which specifies that for configurat PLY library is written mainly in below 2 files, which together contains a single class. -https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-mgmt/sonic_yang.py (Wrapper on Libyang: find_data\schema_dependencies, add_node, del_node) +https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-mgmt/sonic_yang.py + +(Wrapper on Libyang: find_data\schema_dependencies, add_node, del_node) + This part of the library can work with Any YANG model. Below is the list of few APIs which are written on top of Libyang library: @@ -593,7 +598,10 @@ _find_schema_dependencies find_data_dependencies ``` Second file contains SONiC yang models specific code which mainly does translation from config_db.json to sonic_yang.jason and vice versa. -https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-mgmt/sonic_yang_ext.py (SONiC specific functions: xlate and revXlate). + +https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-mgmt/sonic_yang_ext.py + +(SONiC specific functions: xlate and revXlate). Below is the list of few APIs which are written on top of Libyang library: ``` @@ -630,6 +638,7 @@ deleteNode # Python Library for Yang Tests: Below file contanins test cases for PLY: + https://github.com/Azure/sonic-buildimage/blob/master/src/sonic-yang-mgmt/tests/libyang-python-tests/test_sonic_yang.py One snapshot of SONiC YANG models is used for Libyang Wrapper testing. @@ -659,11 +668,29 @@ test_xlate_rev_xlate() How to make sure YANG models are written or updated for any new table or new field in existing table of config_db: As part of SONiC YANG workgroup below measure will be taken while review is done for HLD of new SONiC feature: + a.) Any change to ConfigDB schema MUST include YANG model schema change. + b.) PR covering YANG model update MUST be reviewed and approved by YANG subgroup. + c.) HLD approval can be BLOCKED if YANG model is not reviewed and approved by YANG subgroup. -Build time tests will check for a.) Existence of YANG models and b.) Validation of YANG models as per SONiC YANG Models Guidelines using below steps: +Build time tests will check for + +a.) Existence of YANG models and + +b.) Validation of YANG models as per SONiC YANG Models Guidelines using below steps: + +-- Developer will have to update new config in + +https://github.com/Azure/sonic-buildimage/tree/master/src/sonic-yang-models/sample_config_db.json + +-- At build time, Package sonic-yang-mgmt internally will try to load SONiC config from this file + +a.) by converting the config as per RFC 7951 using YANG Models, + +b.) by creating data tree using new YANG models and + +c.) by validating config against YANG models. --- Developer will have to update new config in https://github.com/Azure/sonic-buildimage/tree/master/src/sonic-yang-models/sample_config_db.json --- At build time, Package sonic-yang-mgmt internally will try to load SONiC config from this file a.) by converting the config as per RFC 7951 using YANG Models, b.) by creating data tree using new YANG models and c.) by validating config against YANG models. Successful execution of these steps can be treated as validation of new Yang models. \ No newline at end of file +Successful execution of these steps can be treated as validation of new Yang models. \ No newline at end of file