From ac17433484da785182bf7f5f655d6c5f44803d84 Mon Sep 17 00:00:00 2001 From: Arthi Sivanantham Date: Tue, 25 May 2021 01:36:01 +0000 Subject: [PATCH 1/6] SONiC Yang for Warm Restart Signed-off-by: Arthi Sivanantham --- src/sonic-yang-models/setup.py | 1 + .../tests/files/sample_config_db.json | 5 + .../yang_model_tests/tests/warm_restart.json | 33 ++++++ .../tests_config/warm_restart.json | 92 +++++++++++++++ .../yang-models/sonic-warm-restart.yang | 105 ++++++++++++++++++ 5 files changed, 236 insertions(+) create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests/warm_restart.json create mode 100644 src/sonic-yang-models/tests/yang_model_tests/tests_config/warm_restart.json create mode 100644 src/sonic-yang-models/yang-models/sonic-warm-restart.yang diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index d511b9898a5a..da4f33b55827 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -56,6 +56,7 @@ './yang-models/sonic-versions.yang', './yang-models/sonic-vlan.yang', './yang-models/sonic-vrf.yang', + './yang-models/sonic-warm-restart.yang', './yang-models/sonic_yang_tree']), ], zip_safe=False, 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 34a225b95633..d73d85c811ae 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -700,6 +700,11 @@ "nexthop_group_threshold_type": "percentage", "polling_interval": "0" } + }, + "WARM_RESTART": { + "bgp": { + "bgp_timer": "500" + } } }, diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/warm_restart.json b/src/sonic-yang-models/tests/yang_model_tests/tests/warm_restart.json new file mode 100644 index 000000000000..f4e61f2505c6 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/warm_restart.json @@ -0,0 +1,33 @@ +{ + "WARM_RESTART_TEST": { + "desc": "Configure an entry in WARM_RESTART table." + }, + "WARM_RESTART_WITH_MUST_CONDITION_FAILURE_TEST_FOR_BGP_EOIU": { + "desc": "Configuration of bgp eoiu with incorrect module name.", + "eStr" : ["bgp_eoiu is only supported for module bgp"] + }, + "WARM_RESTART_WITH_MUST_CONDITION_FAILURE_TEST_FOR_BGP_TIMER": { + "desc": "Configuration of bgp timer with incorrect module name.", + "eStr" : ["bgp_timer is only supported for module bgp"] + }, + "WARM_RESTART_WITH_MUST_CONDITION_FAILURE_TEST_FOR_TEAMSYNCD_TIMER": { + "desc": "Configuration of teamsyncd timer with incorrect module name.", + "eStr" : ["teamsyncd_timer is only supported for module teamd"] + }, + "WARM_RESTART_WITH_MUST_CONDITION_FAILURE_TEST_FOR_NEIGHSYNCD_TIMER": { + "desc": "Configuration of neighsyncd timer with incorrect module name.", + "eStr" : ["neighsyncd_timer is only supported for module swss"] + }, + "WARM_RESTART_TEST_WITH_INCORRECT_BGP_TIMER": { + "desc": "Configure Warm restart for bgp module with an out of range bgp timer.", + "eStr": ["Timer must be 1..3599"] + }, + "WARM_RESTART_TEST_WITH_INCORRECT_TEAMSYNCD_TIMER": { + "desc": "Configure Warm restart for teamsyncd module with an out of range teamsyncd timer.", + "eStr": ["Timer must be 1..3599"] + }, + "WARM_RESTART_TEST_WITH_INCORRECT_NEIGHSYNCD_TIMER": { + "desc": "Configure Warm restart for neighsyncd module with an out of range neighsyncd timer.", + "eStr": ["Timer must be 1..9998"] + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/warm_restart.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/warm_restart.json new file mode 100644 index 000000000000..ca007fe6359c --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/warm_restart.json @@ -0,0 +1,92 @@ +{ + "WARM_RESTART_TEST": { + "sonic-warm-restart:sonic-warm-restart": { + "sonic-warm-restart:WARM_RESTART": { + "WARM_RESTART_LIST": [{ + "module": "bgp", + "bgp_eoiu": true, + "bgp_timer": 500 + }] + } + } + }, + + "WARM_RESTART_WITH_MUST_CONDITION_FAILURE_TEST_FOR_BGP_EOIU": { + "sonic-warm-restart:sonic-warm-restart": { + "sonic-warm-restart:WARM_RESTART": { + "WARM_RESTART_LIST": [{ + "module": "teamd", + "bgp_eoiu": true + }] + } + } + }, + + "WARM_RESTART_WITH_MUST_CONDITION_FAILURE_TEST_FOR_BGP_TIMER": { + "sonic-warm-restart:sonic-warm-restart": { + "sonic-warm-restart:WARM_RESTART": { + "WARM_RESTART_LIST": [{ + "module": "teamd", + "bgp_timer": 500 + }] + } + } + }, + + "WARM_RESTART_WITH_MUST_CONDITION_FAILURE_TEST_FOR_TEAMSYNCD_TIMER": { + "sonic-warm-restart:sonic-warm-restart": { + "sonic-warm-restart:WARM_RESTART": { + "WARM_RESTART_LIST": [{ + "module": "bgp", + "teamsyncd_timer": 500 + }] + } + } + }, + + "WARM_RESTART_WITH_MUST_CONDITION_FAILURE_TEST_FOR_NEIGHSYNCD_TIMER": { + "sonic-warm-restart:sonic-warm-restart": { + "sonic-warm-restart:WARM_RESTART": { + "WARM_RESTART_LIST": [{ + "module": "bgp", + "neighsyncd_timer": 500 + }] + } + } + }, + + "WARM_RESTART_TEST_WITH_INCORRECT_BGP_TIMER": { + "sonic-warm-restart:sonic-warm-restart": { + "sonic-warm-restart:WARM_RESTART": { + "WARM_RESTART_LIST": [{ + "module": "bgp", + "bgp_timer": 3600 + }] + } + } + }, + + "WARM_RESTART_TEST_WITH_INCORRECT_TEAMSYNCD_TIMER": { + "sonic-warm-restart:sonic-warm-restart": { + "sonic-warm-restart:WARM_RESTART": { + "WARM_RESTART_LIST": [{ + "module": "teamd", + "teamsyncd_timer": 3600 + }] + } + } + }, + + "WARM_RESTART_TEST_WITH_INCORRECT_NEIGHSYNCD_TIMER": { + "sonic-warm-restart:sonic-warm-restart": { + "sonic-warm-restart:WARM_RESTART": { + "WARM_RESTART_LIST": [{ + "module": "swss", + "neighsyncd_timer": 9999 + }] + } + } + } + +} + diff --git a/src/sonic-yang-models/yang-models/sonic-warm-restart.yang b/src/sonic-yang-models/yang-models/sonic-warm-restart.yang new file mode 100644 index 000000000000..f90bb30595b2 --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-warm-restart.yang @@ -0,0 +1,105 @@ +module sonic-warm-restart { + + yang-version 1.1; + + namespace "http://github.com/Azure/sonic-warm-restart"; + prefix wrm; + + description "SONIC WARMRESTART"; + + revision 2021-05-24 { + description "First Revision"; + } + + typedef module-name { + + type enumeration { + + enum bgp { + description + "BGP module"; + } + + enum teamd { + description + "Teamd module"; + } + + enum swss { + description + "Switch State Services module"; + } + + enum system { + description + "system level enable/disable warm-restart"; + } + + } + + description + "The modules supported in warm-restart"; + } + + + container sonic-warm-restart { + container WARM_RESTART { + + list WARM_RESTART_LIST { + key "module"; + + leaf module { + type module-name; + description + "Name of the module"; + } + + leaf bgp_eoiu { + type boolean; + must "current()/../module = 'bgp'" { error-message "bgp_eoiu is only supported for module bgp."; } + description + "BGP EOIU enable/disable"; + } + + leaf bgp_timer { + type uint16 { + range "1..3599" { + error-message "Timer must be 1..3599"; + error-app-tag timer-invalid; + } + } + must "current()/../module = 'bgp'" { error-message "bgp_timer is only supported for module bgp."; } + description + "Timer value for BGP module"; + } + + leaf teamsyncd_timer { + type uint16 { + range "1..3599" { + error-message "Timer must be 1..3599"; + error-app-tag timer-invalid; + } + } + must "current()/../module = 'teamd'" { error-message "teamsyncd_timer is only supported for module teamd."; } + description + "Timer value for teamd module"; + } + + leaf neighsyncd_timer { + type uint16 { + range "1..9998" { + error-message "Timer must be 1..9998"; + error-app-tag timer-invalid; + } + } + must "current()/../module = 'swss'" { error-message "neighsyncd_timer is only supported for module swss."; } + description + "Timer value for swss module"; + } + + } /* end of list WARM_RESTART_LIST */ + } /* end of container WARM_RESTART */ + } /* end of container sonic-warm-restart */ + + +} /* end of module sonic-warm-restart */ From e418ff09207879cee070ff72407259805729247d Mon Sep 17 00:00:00 2001 From: Arthi Sivanantham Date: Tue, 22 Jun 2021 21:44:28 -0700 Subject: [PATCH 2/6] Update descriptions Signed-off-by: Arthi Sivanantham --- src/sonic-yang-models/yang-models/sonic-warm-restart.yang | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sonic-yang-models/yang-models/sonic-warm-restart.yang b/src/sonic-yang-models/yang-models/sonic-warm-restart.yang index f90bb30595b2..2a9a6f2d4f50 100644 --- a/src/sonic-yang-models/yang-models/sonic-warm-restart.yang +++ b/src/sonic-yang-models/yang-models/sonic-warm-restart.yang @@ -32,7 +32,7 @@ module sonic-warm-restart { enum system { description - "system level enable/disable warm-restart"; + "Warm Restart on a System level."; } } @@ -58,7 +58,7 @@ module sonic-warm-restart { type boolean; must "current()/../module = 'bgp'" { error-message "bgp_eoiu is only supported for module bgp."; } description - "BGP EOIU enable/disable"; + "BGP End-of-Initial Update (EOIU) signal enable/disable"; } leaf bgp_timer { From 12ccecf4accfca997c248e2a004bbb2816aad9ef Mon Sep 17 00:00:00 2001 From: Arthi Sivanantham Date: Wed, 23 Jun 2021 12:23:22 -0700 Subject: [PATCH 3/6] Fix merge conflicts Signed-off-by: Arthi Sivanantham --- src/sonic-yang-models/tests/files/sample_config_db.json | 1 - 1 file changed, 1 deletion(-) 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 fe061711b5cd..67d5c87fa16f 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -813,7 +813,6 @@ "TACPLUS_SERVER": { "192.168.1.1": { "timeout": "10" ->>>>>>> master } }, From 348e91e73f6a28d3d26be21806cda2e9690e6af0 Mon Sep 17 00:00:00 2001 From: Arthi Sivanantham Date: Fri, 17 Sep 2021 10:39:08 -0700 Subject: [PATCH 4/6] Fix bgp, neighsyncd and teamsyncd timers in sonic warmrestart yang Signed-off-by: Arthi Sivanantham --- .../yang-models/sonic-warm-restart.yang | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sonic-yang-models/yang-models/sonic-warm-restart.yang b/src/sonic-yang-models/yang-models/sonic-warm-restart.yang index 2a9a6f2d4f50..8366016746ad 100644 --- a/src/sonic-yang-models/yang-models/sonic-warm-restart.yang +++ b/src/sonic-yang-models/yang-models/sonic-warm-restart.yang @@ -63,8 +63,8 @@ module sonic-warm-restart { leaf bgp_timer { type uint16 { - range "1..3599" { - error-message "Timer must be 1..3599"; + range "1..3600" { + error-message "Timer must be 1..3600"; error-app-tag timer-invalid; } } @@ -75,8 +75,8 @@ module sonic-warm-restart { leaf teamsyncd_timer { type uint16 { - range "1..3599" { - error-message "Timer must be 1..3599"; + range "1..3600" { + error-message "Timer must be 1..3600"; error-app-tag timer-invalid; } } @@ -87,8 +87,8 @@ module sonic-warm-restart { leaf neighsyncd_timer { type uint16 { - range "1..9998" { - error-message "Timer must be 1..9998"; + range "1..9999" { + error-message "Timer must be 1..9999"; error-app-tag timer-invalid; } } From 86bf7b3193cc23c3dc8009eb50ff62dd53b2a1f7 Mon Sep 17 00:00:00 2001 From: Arthi Sivanantham Date: Fri, 17 Sep 2021 10:44:04 -0700 Subject: [PATCH 5/6] Fix warm restart test values Signed-off-by: Arthi Sivanantham --- .../tests/yang_model_tests/tests_config/warm_restart.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/warm_restart.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/warm_restart.json index ca007fe6359c..970767e00feb 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests_config/warm_restart.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/warm_restart.json @@ -60,7 +60,7 @@ "sonic-warm-restart:WARM_RESTART": { "WARM_RESTART_LIST": [{ "module": "bgp", - "bgp_timer": 3600 + "bgp_timer": 3601 }] } } @@ -71,7 +71,7 @@ "sonic-warm-restart:WARM_RESTART": { "WARM_RESTART_LIST": [{ "module": "teamd", - "teamsyncd_timer": 3600 + "teamsyncd_timer": 3601 }] } } @@ -82,7 +82,7 @@ "sonic-warm-restart:WARM_RESTART": { "WARM_RESTART_LIST": [{ "module": "swss", - "neighsyncd_timer": 9999 + "neighsyncd_timer": 0 }] } } From bedb8e2f33cd1829b78a624b01a7bf56138b4b42 Mon Sep 17 00:00:00 2001 From: Arthi Sivanantham Date: Fri, 17 Sep 2021 10:59:26 -0700 Subject: [PATCH 6/6] Fix error messages in warm restart tests Signed-off-by: Arthi Sivanantham --- .../tests/yang_model_tests/tests/warm_restart.json | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/warm_restart.json b/src/sonic-yang-models/tests/yang_model_tests/tests/warm_restart.json index f4e61f2505c6..2abc88944e47 100644 --- a/src/sonic-yang-models/tests/yang_model_tests/tests/warm_restart.json +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/warm_restart.json @@ -20,14 +20,14 @@ }, "WARM_RESTART_TEST_WITH_INCORRECT_BGP_TIMER": { "desc": "Configure Warm restart for bgp module with an out of range bgp timer.", - "eStr": ["Timer must be 1..3599"] + "eStr": ["Timer must be 1..3600"] }, "WARM_RESTART_TEST_WITH_INCORRECT_TEAMSYNCD_TIMER": { "desc": "Configure Warm restart for teamsyncd module with an out of range teamsyncd timer.", - "eStr": ["Timer must be 1..3599"] + "eStr": ["Timer must be 1..3600"] }, "WARM_RESTART_TEST_WITH_INCORRECT_NEIGHSYNCD_TIMER": { "desc": "Configure Warm restart for neighsyncd module with an out of range neighsyncd timer.", - "eStr": ["Timer must be 1..9998"] + "eStr": ["Timer must be 1..9999"] } }