Commit Graph

18 Commits

Author SHA1 Message Date
Longxiang Lyu
b88f68b1d6
[YANG] add YANG model support for CABLE_LENGTH (#9273)
Why I did it
Add YANG model support for table CABLE_LENGTH

How I did it
Add the YANG model file
Add the test description file and config file
add list CABLE_LENGTH_LIST to the qos_maps_model list in sonic-yang-ext, as it has an inner list.

How to verify it
Build sonic-yang-model and sonic-yang-mgmt
2021-12-09 09:34:01 -08:00
Cosmin-Jinga-MS
c5d0df1b51
[Yang] [CBF Maps] SONiC CBF MAPs Yang (#9116)
* SONiC CBF MAPs Yang

    Created SONiC Yang model for the following CBF MAPs:
    DSCP_TO_FC_MAP
    EXP_TO_FC
2021-12-06 11:41:39 -08:00
Alexander Allen
d39d1a31ba
[yang] fix yang model tests to run on installed models (#9316)
Previously the Yang model unit tests pulled directly from the Yang model source code for their models. This worked up to a point where we had jinja templates which needed to be rendered before they could be tested on. Now we need to reference the install location of the rendered templates for the unit tests.

Additionally, PBH yang was never added to the list of models to install onto a switch so I have resolved that (another example why pulling directly from the source was not correct)

My best explanation for why we only saw this failing on mellanox was that these tests could not have possibly been running on the broadcom build (I have not investigated this specifically). There was no way for these tests to pass recently given they were referencing Yang models which did not exist in the source (ACL).
2021-11-19 21:16:14 -08:00
ohu1
459d3d1f55
SONiC QoS MAPs and PORT_QOS_MAP Yang (#7375)
Why I did it
Created SONiC Yang model for the following QOS MAPs and PORT QOS MAP:
DSCP_TO_TC_MAP
DOT1P_TO_TC_MAP
TC_TO_QUEUE_MAP
TC_TO_PRIORITY_GROUP_MAP
MAP_PFC_PRIORITY_TO_QUEUE
PORT_QOS_MAP

How I did it
Defined Yang models for QOS MAPs based on Guideline doc:
https://github.com/Azure/SONiC/blob/master/doc/mgmt/SONiC_YANG_Model_Guidelines.md
and
https://github.com/Azure/sonic-utilities/blob/master/doc/Command-Reference.md

How to verify it
sonic_yang_models package build
The infra code was modified to handle the nested list definition in YANG and translate it to a flat list in DB.
2021-10-19 12:50:07 -07:00
Praveen Chaudhary
83108d9c9a
[YANG MGMT]: Support Grouping translation in YANG Models. (#8318)
Changes:
 -- pre Process Grouping section from all yang models, so it can be used
from any yang model.
-- add jsondiff in setup.py, it is useful for test debugging in case of
failures.
-- use 'stypes' instead of head.
-- pass config DB table name in _createLeafDict().
-- added test config for grouping.
-- white spaces changes.

Note: Changes are done in the way that we can add support for other
Generic YANG statement easily for translation.

Signed-off-by: Praveen Chaudhary pchaudhary@linkedin.com
2021-09-30 12:53:34 -07:00
lguohan
4157ea9b78
[sonic-yang]: format test sonic yang json file (#8200)
Signed-off-by: Guohan Lu <lguohan@gmail.com>
2021-07-16 22:23:11 -07:00
Mohamed Ghoneim
62d3c245b8
[sonic-yang] Backlinks are none when there is 0 backlinks (#8187)
Backlinks are none when there is 0 backlinks. without this change backlinks.number() 
throws an exception when backlinks==None.
2021-07-16 07:40:27 -07:00
bsun-sudo
14953e452b
Add SONiC YANGs for Management Port, Management Interface, Management VRF and NTP. (#7252)
* SONiC YANG model support for Management Port, Management Interface, Management VRF and NTP.
Co-authored-by: Bing Sun <Bing_Sun@dell.com>
2021-06-18 11:47:45 -07:00
Venkatesan Mahalingam
a3e144b16d
[YANG] Add to support BGP and route-map YANG models (#6917)
Why I did it
SONiC YANG model support for BGP & route-map features.

How I did it
Defined various BGP and route-map YANG containers and lists based on config-DB schema.

How to verify it
Built the following successfully with various BGP & route-map unit test cases.
make target/python-wheels/sonic_yang_models-1.0-py3-none-any.whl
make target/python-wheels/sonic_yang_mgmt-1.0-py3-none-any.whl
2021-06-18 10:31:19 -07:00
arlakshm
4d07bbbec6
[Yang][cfggen] update sonic-cfggen to generate config_db from Yang data (#7712)
Why I did it
This PR adds changes in sonic-config-engine to consume configuration data in SONiC Yang schema and generate config_db entries

How I did it
Add a new file sonic_yang_cfg_generator .
This file has the functions to

parse yang data json and convert them in config_db json format.
Validate the converted config_db entries to make sure all the dependencies and constraints are met.
Add a new option -Y to the sonic-cfggen command for this purpose

Add unit tests

This capability is support only in sonic-config-engine Python3 package only
2021-06-10 12:03:33 -07:00
Praveen Chaudhary
d3d0c2623d
[yang-models]: Remove PLY Extensions and change translation code. (#6915)
* [yang-models]: Remove PLY Extensions and change translation code.

   With assumption that TABLE_SEPARATOR and ENTRY_SEPARATOR for configDB is always "|",
   translation from configDB.json to sonicYang.json can be done based on keys specified
   in YANG Lists inside YANG models. So removing extensions is good idea.

Changes:
-- Remove use of regex in Translation code.
-- Remove regex Extensions from YANG models.
-- Improved debugging i.e. log on stdout in case of any Exception from sonic-yang-mgmt,
   so that failed tests can be debugged faster. Also this is good to debug Dynamic
   port breakout issues.
-- Minor Test changes.

Co-authored-by: lguohan <lguohan@gmail.com>
2021-03-28 00:49:10 -07:00
Praveen Chaudhary
41af024d14
[sonic-yang-models]: Test to Validate yang models with SONiC config. (#6637)
Changes:
— Remove unnecessary file libyang-python-tests/sample_config_db.json
— Keep only config in format of sonic_yang.json in yang_model_tests/yangTest.json.
— Keep config in format of config_db.json in file tests/files/sample_config_db.json
— Add a test case to validate yang models.


**- Why I did it**
As per discussion in sonic Yang workgroup, arranging files better so that Yang model can be in force for new config, also adding a test case to validate young models upto some extent.

**- How I did it**
Changes:
— Remove unnecessary file libyang-python-tests/sample_config_db.json
— Keep only config in format of sonic_yang.json in yang_model_tests/yangTest.json.
— Keep config in format of config_db.json in file tests/files/sample_config_db.json
— Add a test case to validate yang models.

**- How to verify it**
Build PKGs----Building-----
2021-03-09 18:48:35 -08:00
Praveen Chaudhary
2fe79c2c61
[yang_models]: yang models for device_metadata, device_neighbor, flex… (#4442)
Changes:
1.) yang models for device_metadata, device_neighbor, flex_counters, crm, versions.
2.) Test cases for above yang models.
Signed-off-by: Praveen Chaudhary pchaudhary@linkedin.com:
2020-11-18 01:59:55 -08:00
Joe LeVeque
4669c3241b
Remove shebangs from various setup.py files (#5867)
setup.py files are not executable, and thus have no need for shebangs.

Also remove unnecessary comments
2020-11-10 00:07:37 -08:00
Praveen Chaudhary
6156cb2805
[sonic-yang-mgmt] Build PY3 & PY2 packages (#5559)
Moving sonic-yang-mgmt to PY3 to support move of sonic-utilities to PY3.

Signed-off-by: Praveen Chaudhary<pchaudhary@linkedin.com>
2020-11-07 13:03:41 -08:00
Joe LeVeque
c6365e7abe
Reorganize .gitignore files (#4707)
- Add .gitignore files in each subdirectory of src/, so as to reduce the size of the .gitignore file in the project root, and also make it easier to maintain (i.e., if a directory in src/ is removed, there will not be outdated entries in the root .gitignore file.

- Also add missing .gitignore entries and remove outdated entries and duplicates.
2020-06-09 21:04:55 -07:00
Praveen Chaudhary
87201929d3
[sonic-yang-mgmt/setup.py]: Removing the part where build dependencies are installed in setup.py. (#4657)
Changes:
-- Removing the part where build dependencies are installed in setup.py.
-- Adding build dependencies in corresponsing rules\..*.mk file.

Signed-off-by: Praveen Chaudhary pchaudhary@linkedin.com
2020-05-28 12:16:25 -07:00
Praveen Chaudhary
0ccdd70671
[sonic-yang-mgmt]: sonic-yang-mgmt package for configuration validation. (#3861)
**- What I did**

#### wheel package Makefiles

- wheel package Makefiles for sonic-yang-mgmt package.

#### libyang Python APIs:
- python APIs based on libyang
- functions to load/merge yang models and Yang data files
- function to validate data trees based on Yang models
- functions to merge yang data files/trees
- add/set/delete node in schema and data trees
- find data/schema nodes from xpath from the Yang data/schema tree in memory
- find dependencies
- dump the data tree in json/xml

#### Extension of libyang Python APIs:
-- Cropping input config based on Yang Model.
-- Translate input config based on Yang Model.
-- rev Translate input config based on Yang Model.
-- Find xpath of port, portleaf and a yang list.
-- Find if node is key of a list while deletion if yes, then delete the parent.

Signed-off-by: Praveen Chaudhary pchaudhary@linkedin.com
Signed-off-by: Ping Mao pmao@linkedin.com
2020-05-21 16:27:57 -07:00