-
Notifications
You must be signed in to change notification settings - Fork 1.5k
/
Copy pathsonic-route-map.yang
359 lines (311 loc) · 11.9 KB
/
sonic-route-map.yang
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
module sonic-route-map {
namespace "http://github.com/Azure/sonic-route-map";
prefix rmap;
yang-version 1.1;
import ietf-inet-types {
prefix inet;
}
import sonic-port {
prefix port;
}
import sonic-portchannel {
prefix lag;
}
import sonic-routing-policy-sets {
prefix rpolsets;
}
// Comment sonic-vlan import here until libyang back-links issue is resolved for VLAN leaf reference.
// import sonic-vlan {
// prefix vlan;
// }
import sonic-vrf {
prefix vrf;
}
organization
"SONiC";
contact
"SONiC";
description
"SONIC Route map YANG";
revision 2021-02-26 {
description
"Initial revision.";
}
typedef route-map-intf {
type union {
type leafref {
path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name";
}
type leafref {
path "/lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name";
}
// Comment VLAN leaf reference here until libyang back-links issue is resolved and use VLAN string pattern
//type leafref {
// path "/vlan:sonic-vlan/vlan:VLAN/vlan:VLAN_LIST/vlan:name";
//}
type string {
pattern 'Vlan([0-9]{1,3}|[1-3][0-9]{3}|[4][0][0-8][0-9]|[4][0][9][0-4])';
}
}
}
typedef bgp-origin-attr-type {
type enumeration {
enum IGP {
description
"Origin of the NLRI is internal";
}
enum EGP {
description
"Origin of the NLRI is EGP";
}
enum INCOMPLETE {
description
"Origin of the NLRI is neither IGP or EGP";
}
}
description
"Type definition for standard BGP origin attribute";
reference "RFC 4271 - A Border Gateway Protocol 4 (BGP-4),
Sec 4.3";
}
typedef metric-action-type {
type enumeration {
enum METRIC_SET_VALUE {
description "Set a specified metric value.";
}
enum METRIC_ADD_VALUE {
description
"Add a specified metric value from current
set value of metric.";
}
enum METRIC_SUBTRACT_VALUE {
description
"Subtract a specified metric value from current
set value of metric.";
}
enum METRIC_SET_RTT {
description "Add round trip time value as metric." ;
}
enum METRIC_ADD_RTT {
description
"Add round trip time value from current
set value of metric.";
}
enum METRIC_SUBTRACT_RTT {
description
"Subtract round trip time value from current
set value of metric.";
}
}
description
"Type used to specify type of route metric value
to be set in a policy chain.";
}
container sonic-route-map {
container ROUTE_MAP_SET {
list ROUTE_MAP_SET_LIST {
key "name";
leaf name {
type string;
description "Route map name";
}
}
}
container ROUTE_MAP {
list ROUTE_MAP_LIST {
key "name stmt_name";
leaf name {
type string;
description "Route map name";
}
leaf stmt_name {
type uint16 {
range 1..65535;
}
description "Statement name, this helps to provide multiple statements
under a particular route-map";
}
leaf route_operation {
type rpolsets:routing-policy-action-type;
description "permit/deny operation";
}
leaf match_interface{
type route-map-intf;
description "Match based on interface";
}
leaf match_prefix_set{
type leafref {
path "/rpolsets:sonic-routing-policy-sets/rpolsets:PREFIX_SET/rpolsets:PREFIX_SET_LIST/rpolsets:name";
}
description
"Match a prefix list name that contains IPv4 prefixes.";
}
leaf match_ipv6_prefix_set{
type leafref {
path "/rpolsets:sonic-routing-policy-sets/rpolsets:PREFIX_SET/rpolsets:PREFIX_SET_LIST/rpolsets:name";
}
description
"Match a prefix list name that contains IPv6 prefixes.";
}
leaf match_protocol {
type string;
description "Match based on IP protocols bgp, connected, ospf, ospf3 and static";
}
leaf match_next_hop_set {
type leafref {
path "/rpolsets:sonic-routing-policy-sets/rpolsets:PREFIX_SET/rpolsets:PREFIX_SET_LIST/rpolsets:name";
}
description "Match based on nexthop";
}
leaf match_src_vrf {
type union {
type string {
pattern "default";
}
type leafref {
path "/vrf:sonic-vrf/vrf:VRF/vrf:VRF_LIST/vrf:name";
}
}
description "Match based on source VRF";
}
leaf-list match_neighbor {
type union {
type inet:ip-address;
type leafref {
path "/port:sonic-port/port:PORT/port:PORT_LIST/port:name";
}
type leafref {
path "/lag:sonic-portchannel/lag:PORTCHANNEL/lag:PORTCHANNEL_LIST/lag:name";
}
// Comment VLAN leaf reference here until libyang back-links issue is resolved and use VLAN string pattern
//type leafref {
// path "/vlan:sonic-vlan/vlan:VLAN/vlan:VLAN_LIST/vlan:name";
//}
type string {
pattern 'Vlan([0-9]{1,3}|[1-3][0-9]{3}|[4][0][0-8][0-9]|[4][0][9][0-4])';
}
}
description
"IP addresse or interface for match operation.";
max-elements 1;
}
leaf-list match_tag {
type uint32;
description
"Value of the tag match member";
max-elements 1;
}
leaf match_med{
type uint32;
description "Match based on MED value";
}
leaf match_origin{
type string;
description "Match based on BGP route origin egp, igp and incomplete";
}
leaf match_local_pref{
type uint32;
description "Match based on BGP local preference value";
}
leaf match_community{
type leafref {
path "/rpolsets:sonic-routing-policy-sets/rpolsets:COMMUNITY_SET/rpolsets:COMMUNITY_SET_LIST/rpolsets:name";
}
description "Match based on community value";
}
leaf match_ext_community{
type leafref {
path "/rpolsets:sonic-routing-policy-sets/rpolsets:EXTENDED_COMMUNITY_SET/rpolsets:EXTENDED_COMMUNITY_SET_LIST/rpolsets:name";
}
description "Match based on extended community value";
}
leaf match_as_path{
type leafref {
path "/rpolsets:sonic-routing-policy-sets/rpolsets:AS_PATH_SET/rpolsets:AS_PATH_SET_LIST/rpolsets:name";
}
description "Match based on BGP AS-PATH";
}
leaf call_route_map {
type leafref {
path "../../../ROUTE_MAP_SET/ROUTE_MAP_SET_LIST/name";
}
description "Invoke another route-map";
}
leaf set_origin{
type string;
description "Set BGP origin value";
}
leaf set_local_pref{
type uint32;
description "Set BGP local preference value";
}
leaf set_med {
type uint32;
description "Set BGP MED value";
}
leaf set_metric_action {
type metric-action-type;
description "Set metric action";
}
leaf set_metric {
/*
when "../set_metric_action = 'METRIC_SET_VALUE' " +
"or ../set_metric_action = 'METRIC_ADD_VALUE' " +
"or ../set_metric_action = 'METRIC_SUBTRACT_VALUE'";
*/
type uint32;
description "Set metric value";
}
leaf set_next_hop{
type string;
description "Set IP nexthop";
}
leaf set_ipv6_next_hop_global {
type string;
description "Set IPv6 global next hop";
}
leaf set_ipv6_next_hop_prefer_global {
type boolean;
description "Set to prefer IPv6 nexthop global address";
}
leaf set_repeat_asn{
type uint8;
description "Indicates number of times the ASN value to be repeated";
}
leaf set_asn{
type uint32;
description "Set ASN value";
}
leaf set_asn_list{
type string;
description "Set list of ASN values";
}
leaf-list set_community_inline {
type string;
description "Set community string";
}
leaf set_community_ref {
type leafref {
path "/rpolsets:sonic-routing-policy-sets/rpolsets:COMMUNITY_SET/rpolsets:COMMUNITY_SET_LIST/rpolsets:name";
}
description "Refer community from community list";
}
leaf-list set_ext_community_inline {
type string;
description "Set extended community string";
}
leaf set_ext_community_ref {
type leafref {
path "/rpolsets:sonic-routing-policy-sets/rpolsets:EXTENDED_COMMUNITY_SET/rpolsets:EXTENDED_COMMUNITY_SET_LIST/rpolsets:name";
}
description "Refer extended community from extended community list";
}
leaf set_tag {
type uint32;
description
"Value of the tag set member";
}
}
}
}
}