Merge "FibManager module sync up"
[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 vpn-instance-name {
106               type string;
107            }
108            leaf vrf-id {
109               description
110                  "The vrf-id command configures a route distinguisher (RD)
111                   for the IPv4 or IPv6 address family of a VPN instance or
112                   vpn instance name for internal vpn case.";
113               type string;
114            }
115
116            leaf vpn-interface-count { type uint32; }
117            uses vpn-route-list;
118            list vpn-to-dpn-list {
119                key dpnId;
120                leaf dpnId {
121                   type uint64;
122                }
123                list vpn-interfaces {
124                   key interface-name;
125                   leaf interface-name {
126                       type string;
127                   }
128                }
129                list ip-addresses {
130                   key ip-address;
131                   leaf ip-address {
132                       type string;
133                   }
134                }
135            }
136            leaf cleanup_complete { type boolean;}
137         }
138     }
139
140     typedef task-state {
141          type enumeration {
142            enum na {
143              value "0";
144              description
145               "Task not applicable";
146            }
147            enum pending {
148              value "1";
149              description
150               "Task is in pending state";
151            }
152            enum done {
153              value "2";
154              description
155               "Task has been completed";
156            }
157          }
158          description
159           "This value the status of any task.
160            The possible values are NA, PENDING or DONE.
161            ";
162     }
163
164
165     container subnet-op-data {
166         config false;
167         list subnet-op-data-entry {
168             key subnet-id;
169             leaf subnet-id {
170                 type    yang:uuid;
171                 description "UUID representing the subnet ";
172             }
173             leaf nh-dpnId {
174                 type uint64;
175                 description "DpnId for the DPN used as nexthop for this subnet";
176             }
177             leaf vpn-name {
178                 type string;
179                 description "VPN Instance name";
180             }
181             leaf vrf-id {
182                 type string;
183             }
184             leaf subnet-cidr {
185                 type string;
186                 description "Subnet in cidr notation";
187             }
188             leaf route-adv-state {
189                 type task-state;
190                 description "The status of the subnet route advertisement. Route advertisement could be in a NA, PENDING or DONE state.";
191             }
192             leaf elan-tag{
193                 type uint32;
194             }
195             list subnet-to-dpn {
196                 key dpnId;
197                 leaf dpnId {
198                     type uint64;
199                 }
200                 list vpn-interfaces {
201                     key interface-name;
202                     leaf interface-name {
203                         type string;
204                     }
205                 }
206             }
207
208         }
209     }
210
211     container port-op-data {
212         config false;
213         list port-op-data-entry {
214             key port-id;
215             leaf port-id {
216                 type  string;
217                 description "UUID in string format representing the port ";
218             }
219             leaf subnet-id {
220                 type  yang:uuid;
221                 description "Back reference to obtain the subnet for a port ";
222             }
223             leaf dpnId {
224                 type uint64;
225             }
226         }
227     }
228
229     grouping dpn-in-vpn-event {
230             leaf dpn-id { type uint64; }
231             leaf vpn-name { type string; }
232             leaf rd { type string; }
233         }
234
235         notification add-dpn-event {
236             container add-event-data {
237                uses dpn-in-vpn-event;
238             }
239         }
240
241         notification remove-dpn-event {
242             container remove-event-data {
243                uses dpn-in-vpn-event;
244             }
245         }
246
247
248     /* container to maintain mapping between neutron router and DPN(s) on which vpn-interfaces for router are present */
249     container neutron-router-dpns {
250         config false;
251         list router-dpn-list {
252             key router-id;
253             leaf router-id { type string;}
254             list dpn-vpninterfaces-list {
255                 key dpn-id;
256                 leaf dpn-id { type uint64;}
257                 list router-interfaces {
258                     key interface;
259                     leaf interface { type string; }
260                 }
261             }
262         }
263     }
264
265     container router-interfaces {
266         list router-interface {
267             key interface-name;
268             leaf interface-name { type string; }
269             leaf router-name { type string; }
270         }
271     }
272
273     /*
274      * Configured Transport Type for l3vpn service.
275      */
276     container conf-transport-type-l3vpn {
277         leaf transport-type {
278             mandatory "true";
279             type identityref {
280                 base odlif:tunnel-type-base;
281             }
282             description
283                 "L3VPN service will use this config to setup
284                 the transport type for tunnels between DPNs.";
285         }
286     }
287 }