Skip to content

Commit ac17433

Browse files
author
Arthi Sivanantham
committed
SONiC Yang for Warm Restart
Signed-off-by: Arthi Sivanantham <[email protected]>
1 parent 6a9d1e5 commit ac17433

File tree

5 files changed

+236
-0
lines changed

5 files changed

+236
-0
lines changed

src/sonic-yang-models/setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@
5656
'./yang-models/sonic-versions.yang',
5757
'./yang-models/sonic-vlan.yang',
5858
'./yang-models/sonic-vrf.yang',
59+
'./yang-models/sonic-warm-restart.yang',
5960
'./yang-models/sonic_yang_tree']),
6061
],
6162
zip_safe=False,

src/sonic-yang-models/tests/files/sample_config_db.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -700,6 +700,11 @@
700700
"nexthop_group_threshold_type": "percentage",
701701
"polling_interval": "0"
702702
}
703+
},
704+
"WARM_RESTART": {
705+
"bgp": {
706+
"bgp_timer": "500"
707+
}
703708
}
704709
},
705710

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
{
2+
"WARM_RESTART_TEST": {
3+
"desc": "Configure an entry in WARM_RESTART table."
4+
},
5+
"WARM_RESTART_WITH_MUST_CONDITION_FAILURE_TEST_FOR_BGP_EOIU": {
6+
"desc": "Configuration of bgp eoiu with incorrect module name.",
7+
"eStr" : ["bgp_eoiu is only supported for module bgp"]
8+
},
9+
"WARM_RESTART_WITH_MUST_CONDITION_FAILURE_TEST_FOR_BGP_TIMER": {
10+
"desc": "Configuration of bgp timer with incorrect module name.",
11+
"eStr" : ["bgp_timer is only supported for module bgp"]
12+
},
13+
"WARM_RESTART_WITH_MUST_CONDITION_FAILURE_TEST_FOR_TEAMSYNCD_TIMER": {
14+
"desc": "Configuration of teamsyncd timer with incorrect module name.",
15+
"eStr" : ["teamsyncd_timer is only supported for module teamd"]
16+
},
17+
"WARM_RESTART_WITH_MUST_CONDITION_FAILURE_TEST_FOR_NEIGHSYNCD_TIMER": {
18+
"desc": "Configuration of neighsyncd timer with incorrect module name.",
19+
"eStr" : ["neighsyncd_timer is only supported for module swss"]
20+
},
21+
"WARM_RESTART_TEST_WITH_INCORRECT_BGP_TIMER": {
22+
"desc": "Configure Warm restart for bgp module with an out of range bgp timer.",
23+
"eStr": ["Timer must be 1..3599"]
24+
},
25+
"WARM_RESTART_TEST_WITH_INCORRECT_TEAMSYNCD_TIMER": {
26+
"desc": "Configure Warm restart for teamsyncd module with an out of range teamsyncd timer.",
27+
"eStr": ["Timer must be 1..3599"]
28+
},
29+
"WARM_RESTART_TEST_WITH_INCORRECT_NEIGHSYNCD_TIMER": {
30+
"desc": "Configure Warm restart for neighsyncd module with an out of range neighsyncd timer.",
31+
"eStr": ["Timer must be 1..9998"]
32+
}
33+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
{
2+
"WARM_RESTART_TEST": {
3+
"sonic-warm-restart:sonic-warm-restart": {
4+
"sonic-warm-restart:WARM_RESTART": {
5+
"WARM_RESTART_LIST": [{
6+
"module": "bgp",
7+
"bgp_eoiu": true,
8+
"bgp_timer": 500
9+
}]
10+
}
11+
}
12+
},
13+
14+
"WARM_RESTART_WITH_MUST_CONDITION_FAILURE_TEST_FOR_BGP_EOIU": {
15+
"sonic-warm-restart:sonic-warm-restart": {
16+
"sonic-warm-restart:WARM_RESTART": {
17+
"WARM_RESTART_LIST": [{
18+
"module": "teamd",
19+
"bgp_eoiu": true
20+
}]
21+
}
22+
}
23+
},
24+
25+
"WARM_RESTART_WITH_MUST_CONDITION_FAILURE_TEST_FOR_BGP_TIMER": {
26+
"sonic-warm-restart:sonic-warm-restart": {
27+
"sonic-warm-restart:WARM_RESTART": {
28+
"WARM_RESTART_LIST": [{
29+
"module": "teamd",
30+
"bgp_timer": 500
31+
}]
32+
}
33+
}
34+
},
35+
36+
"WARM_RESTART_WITH_MUST_CONDITION_FAILURE_TEST_FOR_TEAMSYNCD_TIMER": {
37+
"sonic-warm-restart:sonic-warm-restart": {
38+
"sonic-warm-restart:WARM_RESTART": {
39+
"WARM_RESTART_LIST": [{
40+
"module": "bgp",
41+
"teamsyncd_timer": 500
42+
}]
43+
}
44+
}
45+
},
46+
47+
"WARM_RESTART_WITH_MUST_CONDITION_FAILURE_TEST_FOR_NEIGHSYNCD_TIMER": {
48+
"sonic-warm-restart:sonic-warm-restart": {
49+
"sonic-warm-restart:WARM_RESTART": {
50+
"WARM_RESTART_LIST": [{
51+
"module": "bgp",
52+
"neighsyncd_timer": 500
53+
}]
54+
}
55+
}
56+
},
57+
58+
"WARM_RESTART_TEST_WITH_INCORRECT_BGP_TIMER": {
59+
"sonic-warm-restart:sonic-warm-restart": {
60+
"sonic-warm-restart:WARM_RESTART": {
61+
"WARM_RESTART_LIST": [{
62+
"module": "bgp",
63+
"bgp_timer": 3600
64+
}]
65+
}
66+
}
67+
},
68+
69+
"WARM_RESTART_TEST_WITH_INCORRECT_TEAMSYNCD_TIMER": {
70+
"sonic-warm-restart:sonic-warm-restart": {
71+
"sonic-warm-restart:WARM_RESTART": {
72+
"WARM_RESTART_LIST": [{
73+
"module": "teamd",
74+
"teamsyncd_timer": 3600
75+
}]
76+
}
77+
}
78+
},
79+
80+
"WARM_RESTART_TEST_WITH_INCORRECT_NEIGHSYNCD_TIMER": {
81+
"sonic-warm-restart:sonic-warm-restart": {
82+
"sonic-warm-restart:WARM_RESTART": {
83+
"WARM_RESTART_LIST": [{
84+
"module": "swss",
85+
"neighsyncd_timer": 9999
86+
}]
87+
}
88+
}
89+
}
90+
91+
}
92+
Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
module sonic-warm-restart {
2+
3+
yang-version 1.1;
4+
5+
namespace "http://github.com/Azure/sonic-warm-restart";
6+
prefix wrm;
7+
8+
description "SONIC WARMRESTART";
9+
10+
revision 2021-05-24 {
11+
description "First Revision";
12+
}
13+
14+
typedef module-name {
15+
16+
type enumeration {
17+
18+
enum bgp {
19+
description
20+
"BGP module";
21+
}
22+
23+
enum teamd {
24+
description
25+
"Teamd module";
26+
}
27+
28+
enum swss {
29+
description
30+
"Switch State Services module";
31+
}
32+
33+
enum system {
34+
description
35+
"system level enable/disable warm-restart";
36+
}
37+
38+
}
39+
40+
description
41+
"The modules supported in warm-restart";
42+
}
43+
44+
45+
container sonic-warm-restart {
46+
container WARM_RESTART {
47+
48+
list WARM_RESTART_LIST {
49+
key "module";
50+
51+
leaf module {
52+
type module-name;
53+
description
54+
"Name of the module";
55+
}
56+
57+
leaf bgp_eoiu {
58+
type boolean;
59+
must "current()/../module = 'bgp'" { error-message "bgp_eoiu is only supported for module bgp."; }
60+
description
61+
"BGP EOIU enable/disable";
62+
}
63+
64+
leaf bgp_timer {
65+
type uint16 {
66+
range "1..3599" {
67+
error-message "Timer must be 1..3599";
68+
error-app-tag timer-invalid;
69+
}
70+
}
71+
must "current()/../module = 'bgp'" { error-message "bgp_timer is only supported for module bgp."; }
72+
description
73+
"Timer value for BGP module";
74+
}
75+
76+
leaf teamsyncd_timer {
77+
type uint16 {
78+
range "1..3599" {
79+
error-message "Timer must be 1..3599";
80+
error-app-tag timer-invalid;
81+
}
82+
}
83+
must "current()/../module = 'teamd'" { error-message "teamsyncd_timer is only supported for module teamd."; }
84+
description
85+
"Timer value for teamd module";
86+
}
87+
88+
leaf neighsyncd_timer {
89+
type uint16 {
90+
range "1..9998" {
91+
error-message "Timer must be 1..9998";
92+
error-app-tag timer-invalid;
93+
}
94+
}
95+
must "current()/../module = 'swss'" { error-message "neighsyncd_timer is only supported for module swss."; }
96+
description
97+
"Timer value for swss module";
98+
}
99+
100+
} /* end of list WARM_RESTART_LIST */
101+
} /* end of container WARM_RESTART */
102+
} /* end of container sonic-warm-restart */
103+
104+
105+
} /* end of module sonic-warm-restart */

0 commit comments

Comments
 (0)