"neutronvpn:createL3VPN" fails to create L3VPN for IPv6 use case.
[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     /*
24      * VPN instance view.
25      */
26     container vpn-instances {
27        list vpn-instance {
28           max-elements "unbounded";
29           min-elements "0";
30           key "vpn-instance-name";
31
32           leaf vpn-instance-name {
33              mandatory "true";
34              type string;
35              description
36                 "The name of the vpn-instance.";
37           }
38
39           leaf-list route-distinguisher {
40
41              description
42              "A set of configuration parameters that is applicable to both IPv4 and
43              IPv6 address family for a VPN instance.
44
45              Format is ASN:nn or IP-address:nn.";
46
47              config "true";
48              type string {
49                 length "3..21";
50              }
51           }
52
53           container vpnTargets {
54
55              description
56                 "The vpn-target command configures the export or import VPN target
57                 extended community attribute for the VPN instance IPv4/IPv6 address
58                 family.
59                 Format is ASN:nn or IP-address:nn.";
60
61              list vpnTarget {
62                 key "vrfRTValue";
63                 max-elements "unbounded";
64                 min-elements "0";
65
66                 description
67                    "L3vpn vpntarget configure class";
68
69                 leaf vrfRTValue {
70
71                    description
72                       "Vpn-target: adds VPN target extended community attribute to the
73                       export or import VPN target extended community list. The
74                       vpn-target can be expressed in either of the following formats:
75                       (1)16-bit AS number:32-bit user-defined number
76                       For example, 1:3. The AS number ranges from 0 to 65535. The
77                       user-defined number ranges from 0 to 4294967295. The AS number
78                       and the user-defined number cannot be 0s at the same time.
79                       That is, a VPN target cannot be 0:0.
80                       (2)32-bit IP address:16-bit user-defined number
81                       For example, 192.168.122.15:1. The IP address ranges from
82                       0.0.0.0 to 255.255.255.255. The user-defined number ranges from
83                       0 to 65535.
84                       (3)32-bit IP address:16-bit user-defined number
85                       For example, 192.168.122.15:1. An IP address ranges from
86                       0.0.0.0 to 255.255.255.255. A user-defined number ranges from 0
87                       to 65535.";
88
89                    config "true";
90                    mandatory "true";
91                    type string {
92                       length "3..21";
93                    }
94                 }
95
96                 leaf vrfRTType {
97
98                    description
99                       "Specifies the vpn target type, export-extcommunity:
100                       specifies the extended community attributes carried in routing
101                       information to be sent. import-extcommunity: receives routing
102                       information carrying specified extended community attributes.";
103
104                    mandatory "true";
105                    type enumeration {
106                       enum export_extcommunity {
107                          value "0";
108                          description "export-extcommunity:";
109                       }
110                       enum import_extcommunity {
111                          value "1";
112                          description "import-extcommunity:";
113                       }
114                       enum both {
115                          value "2";
116                          description "export-extcommunity & import-extcommunity:";
117                       }
118                    }
119                 }
120              }
121           }
122
123           leaf l2vpn {
124              type boolean;
125              default false;
126              description
127                 "The type of the VPN Instance.
128                 false indicates it is an L3VPN.
129                 true indicates it is an EVPN";
130           }
131
132           leaf bgpvpn-type {
133              type enumeration {
134                 enum InternetBGPVPN {
135                    value "0";
136                    description "Internet BGPVPN";
137                 }
138                 enum BGPVPN {
139                    value "1";
140                    description "BGPVPN";
141                 }
142                 enum InternalVPN {
143                    value "2";
144                    description "InternalVPN";
145                 }
146              }
147              default BGPVPN;
148           }
149
150           leaf ip-address-family-configured {
151              type enumeration {
152                 enum "undefined" {
153                    value "0";
154                 }
155                 enum "ipv4" {
156                    value "4";
157                 }
158                 enum "ipv6" {
159                    value "6";
160                 }
161                 enum "ipv4-and-ipv6" {
162                    value "10";
163                 }
164              }
165              default "undefined";
166           }
167
168           leaf l3vni {
169              type uint32;
170           }
171
172        }
173     }
174
175     augment "/vpn-interfaces/vpn-interface" {
176         ext:augment-identifier "adjacencies";
177         uses adjacency-list;
178     }
179
180     grouping adjacency-list{
181         list adjacency{
182             key "ip_address";
183             leaf-list next-hop-ip-list { type string; }
184             leaf ip_address {type string;}
185             leaf adjacency_type {
186                 description "The type of adjacency";
187                 type enumeration {
188                     enum "primary-adjacency" {
189                         value 1;
190                         description "Primary adjacency type.";
191                     }
192                     enum "learnt-ip" {
193                         value 2;
194                         description "Learnt ip adjacency type.";
195                     }
196                     enum "extra-route" {
197                         value 3;
198                         description "Extra route adjacency type.";
199                     }
200                 }
201                 default "extra-route";
202             }
203             leaf mac_address {type string;} /* optional */
204             leaf subnet_id {type yang:uuid;} /* optional */
205             leaf subnet_gateway_ip {type string;}  /* optional */
206             leaf phys-network-func {
207                 type boolean;
208                 default false;
209                 description "Value of True indicates this is an adjacency of a device in a provider network";
210             }
211             uses adjacency-op-data;
212         }
213     }
214
215     grouping adjacency-op-data{
216         leaf label { type uint32; config "false"; } /* optional */
217         leaf subnet_gateway_mac_address {type string; config "false";} /* optional */
218         leaf vrf-id { type string; config "false"; }
219         leaf marked_for_deletion {
220             config "false";
221             type boolean;
222             description "This flag if true suggest this adjancency has been marked for deletion";
223         }
224     }
225
226
227     /*
228      * Binding Interfaces to a VPN Instance.
229      */
230
231     container vpn-interfaces {
232         description "VPN is enabled on interfaces.";
233
234         list vpn-interface  {
235             key "name";
236             max-elements "unbounded";
237             min-elements "0";
238             leaf name {
239                 type leafref {
240                     path "/if:interfaces/if:interface/if:name";
241                 }
242             }
243             list vpn-instance-names {
244                 key "vpn-name";
245                 leaf vpn-name {
246                     type string {
247                         length "1..40";
248                     }
249                 }
250                 leaf associated-subnet-type {
251                     type enumeration {
252                         enum V4Subnet {
253                             value "0";
254                             description "V4 Router Internal VPN";
255                         }
256                         enum V6Subnet {
257                             value "1";
258                             description "V6 Router Internal VPN";
259                         }
260                         enum V6InternetVPN {
261                             value "2";
262                             description "BGPVPN Internet";
263                         }
264                         enum V4AndV6Subnets {
265                             value "3";
266                             description "BGPVPN dual stack or V6/V4 Router or undefined";
267                         }
268                     }
269                 }
270             }
271             leaf dpn-id {
272                 type uint64;
273             }
274             leaf router-interface {
275                 type boolean;
276             }
277             uses nvpn:network-attributes;
278         }
279     }
280 }