Multiple fixes in different module
[netvirt.git] / vpnservice / vpnmanager / vpnmanager-api / src / main / yang / odl-l3vpn.yang
1 module odl-l3vpn {
2     namespace "urn:opendaylight:netvirt:l3vpn";
3     prefix odl-l3vpn;
4
5     import yang-ext {prefix ext; revision-date "2013-07-09";}
6     import l3vpn { prefix l3vpn; revision-date "2014-08-15"; }
7     import ietf-yang-types { prefix "yang"; }
8     import odl-interface { prefix odlif; revision-date "2016-04-06"; }
9
10     revision "2013-09-11" {
11         description "L3 VPN Service module";
12     }
13
14     grouping adjacency-list{
15         list adjacency{
16             key "ip_address";
17             leaf nextHopIp { type string; }
18             leaf ip_address {type string;}
19             leaf label { type uint32; config "false"; } /* optional */
20             leaf mac_address {type string;} /* optional */
21         }
22     }
23
24     grouping vpn-route-list{
25         leaf-list route-entry-id{
26             type uint32;
27         }
28     }
29
30     augment "/l3vpn:vpn-interfaces/l3vpn:vpn-interface" {
31         ext:augment-identifier "adjacencies";
32         uses adjacency-list;
33     }
34
35     augment "/l3vpn:vpn-interfaces/l3vpn:vpn-interface" {
36         ext:augment-identifier "opState";
37         leaf stateUp {type boolean; config false;}
38     }
39
40     /* Operational DS containers for reverse lookups*/
41     container prefix-to-interface {
42         config false;
43         list vpn-ids {
44            key vpn-id;
45            leaf vpn-id {type uint32;}
46            list prefixes {
47               key ip_address;
48               leaf ip_address {type string;}
49               leaf dpnId {
50                  type uint64;
51               }
52               leaf vpn-interface-name {
53                   type string;
54               }
55            }
56         }
57     }
58
59     container vpn-to-extraroute {
60         config false;
61         list vpn {
62            key vrf-id;
63            leaf vrf-id {
64               description
65                  "The vrf-id command configures a route distinguisher (RD)
66                   for the IPv4 or IPv6 address family of a VPN instance or
67                   vpn instance name for internal vpn case.";
68               type string;
69            }
70            list extraroute {
71               key prefix;
72               leaf prefix {type string;}
73               leaf nexthop-ip {
74                   type string;
75               }
76            }
77         }
78     }
79
80     /* Data models to adhere to restart requirements */
81     container vpn-instance-to-vpn-id {
82        list vpn-instance {
83           key vpn-instance-name;
84           leaf vpn-instance-name {
85              type string;
86           }
87           leaf vpn-id {
88              type uint32;
89           }
90           leaf vrf-id {
91               description
92                  "The vrf-id command configures a route distinguisher (RD)
93                   for the IPv4 or IPv6 address family of a VPN instance or
94                   vpn instance name for internal vpn case.";
95               type string;
96           }
97        }
98     }
99
100     container vpn-instance-op-data {
101         config false;
102         list vpn-instance-op-data-entry {
103            key vrf-id;
104            leaf vpn-id { type uint32;}
105            leaf vrf-id {
106               description
107                  "The vrf-id command configures a route distinguisher (RD)
108                   for the IPv4 or IPv6 address family of a VPN instance or
109                   vpn instance name for internal vpn case.";
110               type string;
111            }
112
113            leaf vpn-interface-count { type uint32; }
114            uses vpn-route-list;
115            list vpn-to-dpn-list {
116                key dpnId;
117                leaf dpnId {
118                   type uint64;
119                }
120                list vpn-interfaces {
121                   key interface-name;
122                   leaf interface-name {
123                       type string;
124                   }
125                }
126                list ip-addresses {
127                   key ip-address;
128                   leaf ip-address {
129                       type string;
130                   }
131                }
132            }
133         }
134     }
135
136     typedef task-state {
137          type enumeration {
138            enum na {
139              value "0";
140              description
141               "Task not applicable";
142            }
143            enum pending {
144              value "1";
145              description
146               "Task is in pending state";
147            }
148            enum done {
149              value "2";
150              description
151               "Task has been completed";
152            }
153          }
154          description
155           "This value the status of any task.
156            The possible values are NA, PENDING or DONE.
157            ";
158     }
159
160
161     container subnet-op-data {
162         config false;
163         list subnet-op-data-entry {
164             key subnet-id;
165             leaf subnet-id {
166                 type    yang:uuid;
167                 description "UUID representing the subnet ";
168             }
169             leaf nh-dpnId {
170                 type uint64;
171                 description "DpnId for the DPN used as nexthop for this subnet";
172             }
173             leaf vpn-name {
174                 type string;
175                 description "VPN Instance name";
176             }
177             leaf vrf-id {
178                 type string;
179             }
180             leaf subnet-cidr {
181                 type string;
182                 description "Subnet in cidr notation";
183             }
184             leaf route-adv-state {
185                 type task-state;
186                 description "The status of the subnet route advertisement. Route advertisement could be in a NA, PENDING or DONE state.";
187             }
188             leaf elan-tag{
189                 type uint32;
190             }
191             list subnet-to-dpn {
192                 key dpnId;
193                 leaf dpnId {
194                     type uint64;
195                 }
196                 list vpn-interfaces {
197                     key interface-name;
198                     leaf interface-name {
199                         type string;
200                     }
201                 }
202             }
203
204         }
205     }
206
207     container port-op-data {
208         config false;
209         list port-op-data-entry {
210             key port-id;
211             leaf port-id {
212                 type  string;
213                 description "UUID in string format representing the port ";
214             }
215             leaf subnet-id {
216                 type  yang:uuid;
217                 description "Back reference to obtain the subnet for a port ";
218             }
219             leaf dpnId {
220                 type uint64;
221             }
222         }
223     }
224
225     grouping dpn-in-vpn-event {
226             leaf dpn-id { type uint64; }
227             leaf vpn-name { type string; }
228             leaf rd { type string; }
229         }
230
231         notification add-dpn-event {
232             container add-event-data {
233                uses dpn-in-vpn-event;
234             }
235         }
236
237         notification remove-dpn-event {
238             container remove-event-data {
239                uses dpn-in-vpn-event;
240             }
241         }
242
243
244     /* container to maintain mapping between neutron router and DPN(s) on which vpn-interfaces for router are present */
245     container neutron-router-dpns {
246         config false;
247         list router-dpn-list {
248             key router-id;
249             leaf router-id { type string;}
250             list dpn-vpninterfaces-list {
251                 key dpn-id;
252                 leaf dpn-id { type uint64;}
253                 list router-interfaces {
254                     key interface;
255                     leaf interface { type string; }
256                 }
257             }
258         }
259     }
260
261     container router-interfaces {
262         list router-interface {
263             key interface-name;
264             leaf interface-name { type string; }
265             leaf router-name { type string; }
266         }
267     }
268
269     /*
270      * Configured Transport Type for l3vpn service.
271      */
272     container conf-transport-type-l3vpn {
273         leaf transport-type {
274             mandatory "true";
275             type identityref {
276                 base odlif:tunnel-type-base;
277             }
278             description
279                 "L3VPN service will use this config to setup
280                 the transport type for tunnels between DPNs.";
281         }
282     }
283 }