13
13
log = logger .Logger (SYSLOG_IDENTIFIER )
14
14
log .set_min_log_priority_info ()
15
15
16
+
16
17
#
17
18
# BGP DB interface ----------------------------------------------------------------------------------------------------
18
19
#
19
20
21
+
20
22
def update_entry_validated (db , table , key , data , create_if_not_exists = False ):
21
23
""" Update entry in table and validate configuration.
22
24
If attribute value in data is None, the attribute is deleted.
@@ -61,10 +63,12 @@ def update_entry_validated(db, table, key, data, create_if_not_exists=False):
61
63
62
64
db .set_entry (table , key , cfg [table ][key ])
63
65
66
+
64
67
#
65
68
# BGP handlers --------------------------------------------------------------------------------------------------------
66
69
#
67
70
71
+
68
72
def tsa_handler (ctx , db , state ):
69
73
""" Handle config updates for Traffic-Shift-Away (TSA) feature """
70
74
@@ -81,6 +85,7 @@ def tsa_handler(ctx, db, state):
81
85
log .log_error ("Failed to configure TSA state: {}" .format (str (e )))
82
86
ctx .fail (str (e ))
83
87
88
+
84
89
def wcmp_handler (ctx , db , state ):
85
90
""" Handle config updates for Weighted-Cost Multi-Path (W-ECMP) feature """
86
91
@@ -97,10 +102,12 @@ def wcmp_handler(ctx, db, state):
97
102
log .log_error ("Failed to configure W-ECMP state: {}" .format (str (e )))
98
103
ctx .fail (str (e ))
99
104
105
+
100
106
#
101
107
# BGP device-global ---------------------------------------------------------------------------------------------------
102
108
#
103
109
110
+
104
111
@click .group (
105
112
name = "device-global" ,
106
113
cls = clicommon .AliasedGroup
@@ -110,10 +117,12 @@ def DEVICE_GLOBAL():
110
117
111
118
pass
112
119
120
+
113
121
#
114
122
# BGP device-global tsa -----------------------------------------------------------------------------------------------
115
123
#
116
124
125
+
117
126
@DEVICE_GLOBAL .group (
118
127
name = "tsa" ,
119
128
cls = clicommon .AliasedGroup
@@ -123,6 +132,7 @@ def DEVICE_GLOBAL_TSA():
123
132
124
133
pass
125
134
135
+
126
136
@DEVICE_GLOBAL_TSA .command (
127
137
name = "enabled"
128
138
)
@@ -133,6 +143,7 @@ def DEVICE_GLOBAL_TSA_ENABLED(ctx, db):
133
143
134
144
tsa_handler (ctx , db , "true" )
135
145
146
+
136
147
@DEVICE_GLOBAL_TSA .command (
137
148
name = "disabled"
138
149
)
@@ -143,10 +154,12 @@ def DEVICE_GLOBAL_TSA_DISABLED(ctx, db):
143
154
144
155
tsa_handler (ctx , db , "false" )
145
156
157
+
146
158
#
147
159
# BGP device-global w-ecmp --------------------------------------------------------------------------------------------
148
160
#
149
161
162
+
150
163
@DEVICE_GLOBAL .group (
151
164
name = "w-ecmp" ,
152
165
cls = clicommon .AliasedGroup
@@ -156,6 +169,7 @@ def DEVICE_GLOBAL_WCMP():
156
169
157
170
pass
158
171
172
+
159
173
@DEVICE_GLOBAL_WCMP .command (
160
174
name = "enabled"
161
175
)
@@ -166,6 +180,7 @@ def DEVICE_GLOBAL_WCMP_ENABLED(ctx, db):
166
180
167
181
wcmp_handler (ctx , db , "true" )
168
182
183
+
169
184
@DEVICE_GLOBAL_WCMP .command (
170
185
name = "disabled"
171
186
)
0 commit comments