Skip to content

SONiC Yang for Warm Restart #7698

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 11 commits into from
Sep 28, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/sonic-yang-models/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,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-lldp.yang',
'./yang-models/sonic_yang_tree']),
],
Expand Down
7 changes: 7 additions & 0 deletions src/sonic-yang-models/tests/files/sample_config_db.json
Original file line number Diff line number Diff line change
Expand Up @@ -879,6 +879,13 @@
"polling_interval": "0"
}
},

"WARM_RESTART": {
"bgp": {
"bgp_timer": "500"
}
},

"PFC_WD": {
"Ethernet9": {
"action": "drop",
Expand Down
Original file line number Diff line number Diff line change
@@ -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..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..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..9999"]
}
}
Original file line number Diff line number Diff line change
@@ -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": 3601
}]
}
}
},

"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": 3601
}]
}
}
},

"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": 0
}]
}
}
}

}

105 changes: 105 additions & 0 deletions src/sonic-yang-models/yang-models/sonic-warm-restart.yang
Original file line number Diff line number Diff line change
@@ -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
"Warm Restart on a System level.";
}

}

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 End-of-Initial Update (EOIU) signal enable/disable";
}

leaf bgp_timer {
type uint16 {
range "1..3600" {
error-message "Timer must be 1..3600";
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..3600" {
error-message "Timer must be 1..3600";
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..9999" {
error-message "Timer must be 1..9999";
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 */