Moving vpn-instance yang from VPNMgr > NeutronVPN
[netvirt.git] / neutronvpn / api / src / main / yang / l3vpn-instances-interfaces.yang
1
2 module l3vpn-instances-interfaces {
3
4     namespace "urn:opendaylight:netvirt:neutronvpn:l3vpn";
5     prefix l3vpn-instances-interfaces;
6
7     import ietf-yang-types { prefix yang; revision-date "2013-07-15";}
8
9     import ietf-interfaces {
10         prefix if;
11             //rfc7223-YANG Interface Management
12     }
13     import yang-ext {prefix ext; revision-date "2013-07-09";}
14     import neutronvpn {
15         prefix nvpn;
16         revision-date "2015-06-02";
17     }
18     revision "2020-02-04" {
19         description "This YANG module defines the generic configuration data for L3VPN service.
20             This has been adapted from l3vpn.yang";
21     }
22
23     grouping vpn-af-config {
24         description "A set of configuration parameters that is applicable to both IPv4 and
25             IPv6 address family for a VPN instance .";
26
27         leaf-list route-distinguisher {
28             description "The route-distinguisher command configures a route distinguisher (RD)
29                 for the IPv4 or IPv6 address family of a VPN instance. Format is ASN:nn or IP-address:nn.";
30
31             config "true";
32             type string {
33                 length "3..21";
34             }
35         }
36
37         container vpnTargets {
38             description "The vpn-target command configures the export or import VPN target
39                 extended community attribute for the VPN instance IPv4/IPv6 address family.
40                 Format is ASN:nn or IP-address:nn.";
41
42             list vpnTarget {
43                 key "vrfRTValue";
44                 max-elements "unbounded";
45                 min-elements "0";
46                 description "L3vpn vpntarget configure class";
47
48                 leaf vrfRTValue {
49
50                     description "Vpn-target: adds VPN target extended community attribute to the
51                         export or import VPN target extended community list. The
52                         vpn-target can be expressed in either of the following formats:
53                         (1)16-bit AS number:32-bit user-defined number
54                           For example, 1:3. The AS number ranges from 0 to 65535. The
55                           user-defined number ranges from 0 to 4294967295. The AS number
56                           and the user-defined number cannot be 0s at the same time.
57                           That is, a VPN target cannot be 0:0.
58                        (2)32-bit IP address:16-bit user-defined number
59                           For example, 192.168.122.15:1. The IP address ranges from
60                           0.0.0.0 to 255.255.255.255. The user-defined number ranges from 0 to 65535.
61                        (3)32-bit IP address:16-bit user-defined number
62                           For example, 192.168.122.15:1. An IP address ranges from
63                           0.0.0.0 to 255.255.255.255. A user-defined number ranges from 0 to 65535.";
64
65                     config "true";
66                     mandatory "true";
67                     type string {
68                         length "3..21";
69                     }
70                 }
71
72                 leaf vrfRTType {
73                     description "Specifies the vpn target type, export-extcommunity:
74                         specifies the extended community attributes carried in routing
75                         information to be sent. import-extcommunity: receives routing
76                         information carrying specified extended community attributes.";
77
78                     mandatory "true";
79                     type enumeration {
80                         enum export_extcommunity {
81                             value "0";
82                             description "export-extcommunity:";
83                         }
84                         enum import_extcommunity {
85                             value "1";
86                             description "import-extcommunity:";
87                         }
88                         enum both {
89                             value "2";
90                             description "export-extcommunity & import-extcommunity:";
91                         }
92                     }
93                 }
94             }
95         }
96
97         container apply-label {
98             description "Apply one label mode for the VPN instance route.";
99
100             choice apply-label-mode {
101                 case per-route {
102                     description "The apply-label per-route command enables the one-label-per-route
103                         mode. The VPN instance IPv4/IPv6 address family assigns a unique
104                         label to each route to be sent to the peer PE.";
105
106                     leaf apply-label-per-route {
107                         type boolean;
108                         default "true";
109                     }
110                 }
111                 case per-instance {
112                     description "The apply-label per-instance command applies one label to all VPN
113                         instance IPv4 address family or IPv6 address family routes to a peer PE.";
114
115                     leaf apply-label-per-instance {
116                         type boolean;
117                         default "false";
118                     }
119                 }
120             }
121         }//End of "container apply-label"
122
123         leaf import-route-policy {
124             description "The import route-policy command associates a VPN instance enabled
125                 with the IPv4 or IPv6 address family with an import routing policy.
126                 Only one import routing policy can be associated with a VPN instance
127                 enabled with the IPv4 or IPv6 address family. If the import route-policy
128                 command is run more than once, the latest configuration overrides the previous ones.";
129
130             config "true";
131             type string {
132                 length "1..40";
133             }
134         }
135
136         leaf export-route-policy {
137             description "The export route-policy command associates a VPN instance enabled
138                 with the IPv4 or IPv6 address family with an export routing policy.
139                 Only one export routing policy can be associated with a VPN instance enabled with
140                 the IPv4 or IPv6 address family. If the export route-policy command is run more than once,
141                 the latest configuration overrides the previous ones.";
142
143             config "true";
144             type string {
145                 length "1..40";
146             }
147         }
148
149         container prefix-limit {
150             description "The prefix limit command sets a limit on the maximum number of
151                 prefixes supported in the existing VPN instance, preventing the
152                 PE from importing excessive VPN route prefixes.";
153
154             leaf prefix-limit-number {
155                 description "Specifies the maximum number of prefixes supported in the VPN
156                     instance IPv4 or IPv6 address family.";
157
158                 type uint32 {
159                     range "1..4294967295";
160                 }
161             }
162
163             choice prefix-limit-action {
164                 case enable-alert-percent {
165                     leaf alert-percent-value {
166                         description "Specifies the proportion of the alarm threshold to the maximum
167                             number of prefixes.";
168                         type uint8 {
169                             range "1..100";
170                         }
171                     }
172                     leaf route-unchanged {
173                         description "Indicates that the routing table remains unchanged. By default,
174                             route-unchanged is not configured. When the number of prefixes
175                             in the routing table is greater than the value of the parameter number,
176                             routes are processed as follows:
177                              (1)If route-unchanged is configured, routes in the routing table remain unchanged.
178                              (2)If route-unchanged is not configured, all routes in the
179                                 routing table are deleted and then re-added.";
180
181                         config "true";
182                         type boolean;
183                         default "false";
184                     }
185                 }
186                 case enable-simple-alert {
187                     leaf simple-alert {
188                         description "Indicates that when the number of VPN route prefixes exceeds
189                         number, prefixes can still join the VPN routing table and alarms are displayed.";
190
191                         config "true";
192                         type boolean;
193                         default "false";
194                     }
195                 }
196             }
197         }
198
199         container routing-table-limit {
200             description "The routing-table limit command sets a limit on the maximum number of
201                 routes that the IPv4 or IPv6 address family of a VPN instance can support.
202                 By default, there is no limit on the maximum number of routes that the
203                 IPv4 or IPv6 address family of a VPN instance can support, but the
204                 total number of private network and public network routes on a device
205                 cannot exceed the allowed maximum number of unicast routes.";
206
207             leaf routing-table-limit-number {
208                 description "Specifies the maximum number of routes supported by a VPN instance. ";
209                 config "true";
210                 type uint32 {
211                     range "1..4294967295";
212                 }
213             }
214             choice routing-table-limit-action {
215                 case enable-alert-percent {
216                     leaf alert-percent-value {
217                         description "Specifies the percentage of the maximum number of routes. When
218                             the maximum number of routes that join the VPN instance is up
219                             to the value (number*alert-percent)/100, the system prompts alarms.
220                             The VPN routes can be still added to the routing table,
221                             but after the number of routes reaches number, the subsequent routes are dropped.";
222
223                         config "true";
224                         type uint8 {
225                             range "1..100";
226                         }
227                     }
228                 }
229                 case enable-simple-alert {
230                     leaf simple-alert {
231                         description "Indicates that when VPN routes exceed number, routes can still
232                             be added into the routing table, but the system prompts alarms.
233                             However, after the total number of VPN routes and network public
234                             routes reaches the unicast route limit specified in the License,
235                             the subsequent VPN routes are dropped.";
236                         config "true";
237                         type boolean;
238                     }
239                 }
240             }
241         }
242
243         leaf vpn-frr {
244             description "Enable VPN FRR in the VPN instance address family view.
245                 If a PE is connected to two other PEs, running the vpn frr command in
246                 the VPN instance address family view of the PE enables VPN FRR and
247                 improves network reliability. After VPN FRR is configured, traffic can
248                 switch to the secondary LSP immediately after the primary LSP becomes faulty.";
249
250             type boolean;
251             default "false";
252         }
253
254
255         /*
256         * VPN QoS.
257         */
258         container l3vpnVrfPipe {
259             description "The diffserv-mode command configures the mode of the MPLS
260                 differentiated service (Diff-Serv) for ensuring end-to-end QoS.";
261
262             leaf pipeMode {
263                 description "Pipe mode";
264
265                 type enumeration {
266                     enum pipe {
267                         value "0";
268                             description "pipe: Indicates that the Pipe MPLS Diff-Serv mode is adopted.";
269                     }
270                     enum shortPipe {
271                         value "1";
272                         description "shortPipe: Indicates that the Short-pipe MPLS Diff-Serv mode is adopted.";
273                     }
274                     enum uniform {
275                         value "2";
276                         description "uniform: Indicates that the Uniform MPLS Diff-Serv mode is adopted.";
277                     }
278                 }
279                 default "uniform";
280             }
281
282             leaf serviceClass {
283                 description "Service Class, Specifies the service type when the packet enters the
284                     public network from the private network. The values are cs7, cs6, ef, af4, af3, af2, af1, be.";
285
286                 type enumeration {
287                     enum be {
288                         value "0";
289                         description "be:";
290                     }
291                     enum af1 {
292                         value "1";
293                         description "af1:";
294                     }
295                     enum af2 {
296                         value "2";
297                         description "af2:";
298                     }
299                     enum af3 {
300                         value "3";
301                         description "af3:";
302                     }
303                     enum af4 {
304                         value "4";
305                         description "af4:";
306                     }
307                     enum ef {
308                         value "5";
309                         description "ef:";
310                     }
311                     enum cs6 {
312                         value "6";
313                         description "cs6:";
314                     }
315                     enum cs7 {
316                         value "7";
317                         description "cs7:";
318                     }
319                 }
320                 default "be";
321             }
322
323             leaf color {
324                 description "Specifies a color for marking the discard priority of a packet
325                     transferred from a private network to a public network. The values
326                     are green, yellow, and red.";
327
328                 type enumeration {
329                     enum green {
330                         value "0";
331                         description "green:";
332                     }
333                     enum yellow {
334                         value "1";
335                         description "yellow:";
336                     }
337                     enum red {
338                         value "2";
339                         description "red:";
340                     }
341                 }
342                 default "green";
343             }
344
345             leaf dsName {
346                 description "Specifies the DS domain name of the specified Per-Hop Behavior (PHB)
347                     applied to the egress in Short pipe mode. It is a string of 1 to 31 characters.";
348
349                 type string;
350                 default "default";
351             }
352         }
353
354         container l3vpnTtlMode {
355             description "The ttl-mode command enables MPLS to process the TTL in a specified
356                 mode. By default, MPLS processes the TTL in pipe mode.";
357
358             leaf ttlMode {
359                 description "TTL mode";
360                 default "pipe";
361                 type enumeration {
362                     enum pipe {
363                         value "0";
364                         description "pipe: Enables MPLS to process the TTL in pipe mode.";
365                     }
366
367                     enum uniform {
368                         value "1";
369                         description "uniform: Enables MPLS to process the TTL in uniform mode.";
370                     }
371                 }
372             }
373         }
374
375         leaf tunnel-policy {
376             description "The tnl-policy command associates the IPv4 or IPv6 address family of
377                 a VPN instance with a tunnel policy.";
378
379             type string {
380                 length "1..39";
381             }
382         }
383
384         container importRibs {
385             description "Import route class";
386
387             leaf protocol {
388                 description "Specifies the protocol from which routes are imported.
389                     At present, In the IPv4 unicast address family view, the protocol
390                     can be IS-IS,static, direct and BGP.";
391
392                 type enumeration {
393                     enum ALL {
394                         value "0";
395                         description "ALL:";
396                     }
397                     enum Direct {
398                         value "1";
399                         description "Direct:";
400                     }
401                     enum OSPF {
402                         value "2";
403                         description "OSPF:";
404                     }
405                     enum ISIS {
406                         value "3";
407                         description "ISIS:";
408                     }
409                     enum Static {
410                         value "4";
411                         description "Static:";
412                     }
413                     enum RIP {
414                         value "5";
415                         description "RIP:";
416                     }
417                     enum BGP {
418                         value "6";
419                         description "BGP:";
420                     }
421                     enum OSPFV3 {
422                         value "7";
423                         description "OSPFV3:";
424                     }
425                     enum RIPNG {
426                         value "8";
427                         description "RIPNG:";
428                     }
429                     enum INVALID {
430                         value "9";
431                         description "INVALID:";
432                     }
433                 }
434             }
435
436             leaf processId {
437                 description "Specifies the process ID if the protocol from routes are imported is IS-IS.";
438
439                 default "0";
440                 type uint32 {
441                     range "0..4294967295";
442                 }
443             }
444
445             leaf bgp-valid-route {
446                 type boolean;
447             }
448
449             leaf policyName {
450                 description "Policy Id for import routes";
451                 type string {}
452             }
453         }
454
455         leaf traffic-statistics {
456             description "The traffic-statistics enable command enables traffic statistics
457                 for a VPN instance.";
458
459             type boolean;
460             default "false";
461         }
462     }
463
464
465     /*
466      * VPN instance view.
467      */
468     container vpn-instances {
469         description "VPN instances configuration parameters. VPN instances support both the
470             IPv4 and IPv6 address families.";
471
472         list vpn-instance {
473             max-elements "unbounded";
474             min-elements "0";
475             key "vpn-instance-name";
476             description "Specifies the name of the VPN instance. It is a string of 1 to 31
477                 case-sensitive characters.";
478
479             leaf vpn-instance-name {
480                 mandatory "true";
481                 type string;
482                 description "The name of the vpn-instance.";
483             }
484             leaf type {
485                 description "The type of the VPN Instance.
486                 L3 indicates it is an L3VPN.
487                 L2 indicates it is an EVPN";
488
489                 type enumeration {
490                     enum l3 {
491                         value "0";
492                         description "L3VPN";
493                     }
494                     enum l2 {
495                         value "1";
496                         description "EVPN";
497                     }
498                 }
499                 default "l3";
500             }
501
502             leaf l3vni {
503                 type uint32;
504             }
505
506             leaf description {
507                 description "A textual description of VPN instance, the VPN instance description
508                     helps users memorize the VPN instance.";
509
510                 type string {
511                     length "1..242";
512                     pattern "([^?]*)";
513                 }
514             }
515
516             container ipv4-family {
517                 description "The IPv4 address family is enabled for the VPN instance.";
518                 uses vpn-af-config;
519             }
520
521             container ipv6-family {
522                 description "The IPv6 address family is enabled for the VPN instance.";
523                 uses vpn-af-config;
524             }
525         }
526     }
527 }