Moving vpn-instance yang from VPNMgr > NeutronVPN
[netvirt.git] / vpnmanager / api / src / main / yang / l3vpn.yang
1 module l3vpn {
2   namespace "urn:huawei:params:xml:ns:yang:l3vpn";
3 // replace with IANA namespace when assigned
4   prefix "l3vpn";
5
6   import bgp {
7     prefix bgp;
8     //draft-zhdankin-netmod-bgp-cfg
9   }
10   import ietf-interfaces {
11     prefix if;
12     //rfc7223-YANG Interface Management
13   }
14
15   import ietf-inet-types {
16     prefix inet;
17     revision-date "2013-07-15";
18     //RFC6991
19   }
20
21   import ietf-yang-types {
22     prefix yang;
23     //RFC6991
24   }
25
26   import neutronvpn {
27     prefix nvpn;
28     revision-date "2015-06-02";
29   }
30
31   description
32     "This YANG module defines the generic configuration data for L3VPN service.
33
34      Terms and Acronyms
35
36      BGP (bgp): Border Gateway Protocol
37      IPv4 (ipv4):Internet Protocol Version 4
38      IPv6 (ipv6): Internet Protocol Version 6
39
40     ";
41
42   revision 2014-08-15 {
43     description
44       "Initial revision.";
45       reference "RFC4271, RFC4364, RFC4760";
46   }
47
48   grouping augment-bgp-af-vpn-config {
49     description
50       "A set of configuration parameters that is applicable to both BGP-VPNv4
51       and BGP-VPNv6 address family.";
52
53     leaf apply-label-per-nexthop {
54       description
55         "The apply-label per-nexthop command enables the ASBR to allocate
56          labels for IPv4 VPN routes or IPv6 VPN routes based on the next hop.";
57
58
59
60       config "true";
61       type boolean;
62       default "false";
63     }
64
65     leaf upeEnable {
66       description
67         "Specify peer as UPE.";
68
69       config "true";
70       type boolean;
71       default "false";
72     }
73
74   }
75
76
77   grouping bgp-af-vpn-instance-config {
78
79     container router-id {
80       description
81         "The router-id command configures router ID for BGP VPN instance IPv4
82         or IPv6 address family.
83         By default, no router ID is configured for BGP VPN instance IPv4 or
84         IPv6 address family, and the BGP router ID is used as the router ID.";
85
86       leaf enable {
87         type boolean;
88       }
89
90       choice config-type {
91         case static {
92           leaf ip-address {
93             description
94               "Specifies the router ID of a BGP VPN instance IPv4 address
95                family. The router ID is expressed in the IPv4 address format.
96                ";
97
98             config "true";
99             type inet:ip-address;
100           }
101         }
102         case auto-select {
103           leaf enable-auto-select {
104             description
105               "Configures automatic route ID selection for the current BGP VPN
106                instance address family.";
107
108
109             config "true";
110             type boolean;
111           }
112         }
113       }
114     }
115
116     leaf auto-frr {
117       description
118         "The auto-frr command enables BGP Auto FRR.";
119
120       config "true";
121       type boolean;
122       default "false";
123     }
124
125     container bgpPeers {
126       list bgpPeer {
127       key "peerAddr";
128       max-elements "unbounded";
129       min-elements "0";
130         description
131           "BGP Peer configure class";
132
133         leaf peerAddr {
134           description
135             "The nerighbor address";
136             config "true";
137             type inet:ip-address;
138             mandatory true;
139         }
140
141           leaf groupName {
142             description "peerGroupName";
143             config "true";
144             type string {
145               length "1..47";
146             }
147           }
148           leaf remoteAs {
149             description "Specifies the AS number of the peer.";
150             config "true";
151             type string {
152               length "1..11";
153             }
154           }
155
156           leaf description {
157
158             description
159               "specifies the description. The description is a string of letters
160                or figures. The value ranges from 1 to 80 characters without
161                spaces.";
162           config "true";
163             type string {
164               length "1..80";
165               pattern "([^?]*)";
166             }
167           }
168
169           leaf soo {
170             description
171               "The peer soo command configures the Site of Origin (SoO)
172                attribute for an EBGP peer in a BGP VPN instance. Format is ASN:nn
173                or IP-address:nn.";
174
175           config "true";
176           type string {
177             length "3..21";
178           }
179         }
180
181         leaf substituteAsEnable {
182           description
183             "Using the peer substitute-as command, you can substitute the AS
184              number of the specified peer in the as-path with the local AS
185              number.";
186
187           config "true";
188           type boolean;
189             default "false";
190         }
191
192       }
193     }
194
195   }
196
197
198
199   /*
200    * Binding Interfaces to a VPN Instance.
201    */
202
203   container vpn-interfaces {
204     description
205       "VPN is enabled on interfaces.";
206
207     list vpn-interface  {
208       key "name";
209       max-elements "unbounded";
210       min-elements "0";
211       leaf name {
212         type leafref {
213           path "/if:interfaces/if:interface/if:name";
214         }
215       }
216       list vpn-instance-names {
217         key "vpn-name";
218         leaf vpn-name {
219             type string {
220                 length "1..40";
221             }
222         }
223         leaf associated-subnet-type {
224           type enumeration {
225              enum V4Subnet {
226                 value "0";
227                 description "V4 Router Internal VPN";
228              }
229              enum V6Subnet {
230                 value "1";
231                 description "V6 Router Internal VPN";
232              }
233              enum V6InternetVPN {
234                 value "2";
235                 description "BGPVPN Internet";
236              }
237              enum V4AndV6Subnets {
238                 value "3";
239                 description "BGPVPN dual stack or V6/V4 Router or undefined";
240              }
241           }
242         }
243       }
244       leaf dpn-id {
245         type uint64;
246       }
247       leaf router-interface {
248           type boolean;
249       }
250       uses nvpn:network-attributes;
251     }
252   }
253
254   container vrfInfo {
255     description
256       "Display the information of the vrf.
257
258
259       It is intended that this container may be augmented by vendors to
260       reflect the vendor-specific operational state parameters.";
261
262     leaf vrfCreateTime {
263       description
264         "CreateTime of the vrf.";
265       config "false";
266       type yang:timestamp;
267     }
268
269     leaf vrfUpTime {
270       description
271         "UpTime period of the vrf.";
272       config "false";
273       type yang:timeticks;
274     }
275
276     leaf label {
277       description
278         "Label of the vrf.";
279       config "false";
280       type uint32 {
281         range "16..1048574";
282       }
283     }
284
285     leaf vrfStatus {
286       description
287         "vrf status.";
288       config "false";
289       type enumeration {
290         enum up {
291           value "0";
292           description "vrf up.";
293         }
294         enum down {
295           value "1";
296           description "vrf down.";
297         }
298       }
299     }
300   }
301
302
303   /*
304    * augment some bgp vpn functions in bgp module.
305    */
306   augment "/bgp:bgp-router/bgp:vpnv4/bgp:unicast" {
307
308     uses augment-bgp-af-vpn-config;
309
310   }
311
312   augment "/bgp:bgp-router/bgp:vpnv6/bgp:unicast" {
313     uses augment-bgp-af-vpn-config;
314
315   }
316
317   augment "/bgp:bgp-router" {
318
319     container bgp-af-ipv4-vpn-instances {
320       description
321         "vpn-instances ipv4 address family.";
322       list bgp-af-ipv4-vpn-instance {
323         key "vpn-instance-name";
324         max-elements "unbounded";
325         min-elements "0";
326         leaf vpn-instance-name {
327           type string;
328         }
329         uses bgp-af-vpn-instance-config;
330       }
331     }
332
333     container bgp-af-ipv6-vpn-instances {
334       description
335         "vpn-instances ipv6 address family.";
336       list bgp-af-ipv6-vpn-instance {
337         key "vpn-instance-name";
338         max-elements "unbounded";
339         min-elements "0";
340         leaf vpn-instance-name {
341           type string;
342         }
343         uses bgp-af-vpn-instance-config;
344       }
345     }
346
347   }
348
349
350 }