From e1ec0d31511b97040c721b32814a21e4cbd47d54 Mon Sep 17 00:00:00 2001 From: Sudharsan Dhamal Gopalarathnam Date: Thu, 2 Mar 2023 14:45:22 -0800 Subject: [PATCH 1/2] [yang]Add missing fields in PortChannel yang model (#14045) Fixing issue https://github.com/sonic-net/sonic-buildimage/issues/13983 Added Missing fields in sonic-portchannel yang model. "fallback" and "fast_rate" fields are present in configuration schema but not in yang model. This leads to traceback when yang is validated sonic_yang(3):All Keys are not parsed in PORTCHANNEL dict_keys(['PortChannel100']) sonic_yang(3):exceptionList:["'fast_rate'"] sonic_yang(3):Data Loading Failed:All Keys are not parsed in PORTCHANNEL dict_keys(['PortChannel100']) exceptionList:["'fast_rate'"] Data Loading Failed All Keys are not parsed in PORTCHANNEL dict_keys(['PortChannel100']) exceptionList:["'fast_rate'"] ConfigMgmt Class creation failed Failed to break out Port. Error: Failed to load the config. Error: ConfigMgmtDPB Class creation failed Updated yang model Added tests to verify Part of the PR --- src/sonic-yang-models/doc/Configuration.md | 6 +++- .../tests/files/sample_config_db.json | 4 ++- .../yang_model_tests/tests/portchannel.json | 10 ++++++ .../tests_config/portchannel.json | 34 ++++++++++++++++++- .../yang-models/sonic-portchannel.yang | 9 +++++ 5 files changed, 60 insertions(+), 3 deletions(-) diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index 15a60a5d01a2..19032af53a87 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -1365,7 +1365,9 @@ name as object key and member list as attribute. "members": [ "Ethernet56" ], - "mtu": "9100" + "mtu": "9100", + "fallback": "false", + "fast_rate": "true" } } } @@ -1938,3 +1940,5 @@ Incremental Configuration by Subscribing to ConfigDB Detail instruction to be added. A sample could be found in this [PR](https://github.com/Azure/sonic-buildimage/pull/861) that implemented dynamic configuration for BGP. +======= +# SONiC Configuration Database Manual diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 6d3efab05aa1..0192e19bb828 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -117,7 +117,9 @@ ], "min_links": "2", "mtu": "9100", - "tpid": "0x8100" + "tpid": "0x8100", + "fast_rate": "false", + "fallback" : "true" } }, "PORTCHANNEL_INTERFACE": { diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/portchannel.json b/src/sonic-yang-models/tests/yang_model_tests/tests/portchannel.json index e69074bdfbf6..ae7a7dffd928 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/portchannel.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/portchannel.json @@ -19,6 +19,16 @@ "eStrKey" : "Pattern", "eStr": ["0x8100|0x9100|0x9200|0x88a8|0x88A8"] }, + "PORT_CHANNEL_INVALID_FALLBACK": { + "desc": "INCORRECT PORTCHANNEL FALLBACK IN PORT_CHANNEL TABLE.", + "eStrKey" : "Pattern", + "eStr": ["false|true|False|True"] + }, + "PORT_CHANNEL_INVALID_FAST_RATE": { + "desc": "INCORRECT PORTCHANNEL FAST_RATE IN PORT_CHANNEL TABLE.", + "eStrKey" : "Pattern", + "eStr": ["false|true|False|True"] + }, "PORTCHANNEL_INTERFACE_IP_ADDR_TEST": { "desc": "Configure IP address on PORTCHANNEL_INTERFACE table." }, diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/portchannel.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/portchannel.json index 6c26e9ce83e6..85a62e039c99 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/portchannel.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/portchannel.json @@ -28,7 +28,9 @@ "mtu": "9100", "tpid": "0x8100", "lacp_key": "auto", - "name": "PortChannel0001" + "name": "PortChannel0001", + "fast_rate": "false", + "fallback" : "false" } ] } @@ -125,6 +127,36 @@ } } }, + "PORT_CHANNEL_INVALID_FALLBACK": { + "sonic-portchannel:sonic-portchannel": { + "sonic-portchannel:PORTCHANNEL": { + "PORTCHANNEL_LIST": [ + { + "admin_status": "up", + "mtu": "9100", + "tpid": "0x9100", + "name": "PortChannel0001", + "fallback": "enabled" + } + ] + } + } + }, + "PORT_CHANNEL_INVALID_FAST_RATE": { + "sonic-portchannel:sonic-portchannel": { + "sonic-portchannel:PORTCHANNEL": { + "PORTCHANNEL_LIST": [ + { + "admin_status": "up", + "mtu": "9100", + "tpid": "0x9100", + "name": "PortChannel0001", + "fast_rate": "TRUE" + } + ] + } + } + }, "PORTCHANNEL_INTERFACE_IP_ADDR_TEST": { "sonic-portchannel:sonic-portchannel": { "sonic-portchannel:PORTCHANNEL": { diff --git a/src/sonic-yang-models/yang-models/sonic-portchannel.yang b/src/sonic-yang-models/yang-models/sonic-portchannel.yang index 31235a0d2277..00134b5cf68e 100644 --- a/src/sonic-yang-models/yang-models/sonic-portchannel.yang +++ b/src/sonic-yang-models/yang-models/sonic-portchannel.yang @@ -119,6 +119,15 @@ module sonic-portchannel { type stypes:tpid_type; } + leaf fallback { + description "Enable LACP fallback feature"; + type stypes:boolean_type; + } + leaf fast_rate { + description "Enable LACP fast rate"; + type stypes:boolean_type; + } + } /* end of list PORTCHANNEL_LIST */ } /* end of container PORTCHANNEL */ From ddcb16ff5287c018755ce3b79dadd4faada7fc75 Mon Sep 17 00:00:00 2001 From: dgsudharsan Date: Tue, 7 Mar 2023 21:38:14 +0000 Subject: [PATCH 2/2] Resolving conflicts --- src/sonic-yang-models/doc/Configuration.md | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index 19032af53a87..e21bfed9263b 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -1940,5 +1940,3 @@ Incremental Configuration by Subscribing to ConfigDB Detail instruction to be added. A sample could be found in this [PR](https://github.com/Azure/sonic-buildimage/pull/861) that implemented dynamic configuration for BGP. -======= -# SONiC Configuration Database Manual