SubnetRoute enhancements to VPN Service models
[vpnservice.git] / vpnmanager / vpnmanager-api / src / main / yang / odl-l3vpn.yang
1 module odl-l3vpn {
2     namespace "urn:opendaylight: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
9     revision "2013-09-11" {
10         description "L3 VPN Service module";
11     }
12
13     grouping adjacency-list{
14         list adjacency{
15             key "ip_address";
16             leaf nextHopIp { type string; }
17             leaf ip_address {type string;}
18             leaf label { type uint32; config "false"; } /* optional */
19             leaf mac_address {type string;} /* optional */
20         }
21     }
22
23     grouping vpn-route-list{
24         leaf-list route-entry-id{
25             type uint32;
26         }
27     }
28
29     augment "/l3vpn:vpn-interfaces/l3vpn:vpn-interface" {
30         ext:augment-identifier "adjacencies";
31         uses adjacency-list;
32     }
33
34     augment "/l3vpn:vpn-interfaces/l3vpn:vpn-interface" {
35         ext:augment-identifier "opState";
36         leaf stateUp {type boolean; config false;}
37     }
38
39     /* Operational DS containers for reverse lookups*/
40     container prefix-to-interface {
41         config false;
42         list vpn-ids {
43            key vpn-id;
44            leaf vpn-id {type uint32;}
45            list prefixes {
46               key ip_address;
47               leaf ip_address {type string;}
48               leaf dpnId {
49                  type uint64;
50               }
51               leaf vpn-interface-name {
52                   type string;
53               }
54            }
55         }
56     }
57
58     container vpn-to-extraroute {
59         config false;
60         list vpn {
61            key vrf-id;
62            leaf vrf-id {
63               description
64                  "The vrf-id command configures a route distinguisher (RD)
65                   for the IPv4 or IPv6 address family of a VPN instance or
66                   vpn instance name for internal vpn case.";
67               type string;
68            }
69            list extraroute {
70               key prefix;
71               leaf prefix {type string;}
72                       leaf nexthop-ip {
73                           type string;
74                       }
75            }
76         }
77     }
78
79     /* Data models to adhere to restart requirements */
80     container vpn-instance-to-vpn-id {
81        list vpn-instance {
82           key vpn-instance-name;
83           leaf vpn-instance-name {
84              type string;
85           }
86           leaf vpn-id {
87              type uint32;
88           }
89           leaf vrf-id {
90               description
91                  "The vrf-id command configures a route distinguisher (RD)
92                   for the IPv4 or IPv6 address family of a VPN instance or
93                   vpn instance name for internal vpn case.";
94               type string;
95           }
96        }
97     }
98
99     container vpn-instance-op-data {
100         config false;
101         list vpn-instance-op-data-entry {
102            key vrf-id;
103            leaf vpn-id { type uint32;}
104            leaf vrf-id {
105               description
106                  "The vrf-id command configures a route distinguisher (RD)
107                   for the IPv4 or IPv6 address family of a VPN instance or
108                   vpn instance name for internal vpn case.";
109               type string;
110            }
111
112            leaf vpn-interface-count { type uint32; }
113            uses vpn-route-list;
114            list vpn-to-dpn-list {
115                key dpnId;
116                leaf dpnId {
117                   type uint64;
118                }
119                list vpn-interfaces {
120                   key interface-name;
121                   leaf interface-name {
122                       type string;
123                   }
124                }
125            }
126         }
127     }
128
129     typedef task-state {
130          type enumeration {
131            enum na {
132              value "0";
133              description
134               "Task not applicable";
135            }
136            enum pending {
137              value "1";
138              description
139               "Task is in pending state";
140            }
141            enum done {
142              value "2";
143              description
144               "Task has been completed";
145            }
146          }
147          description
148           "This value the status of any task.
149            The possible values are NA, PENDING or DONE.
150            ";
151     }
152
153
154     container subnet-op-data {
155         list subnet-op-data-entry {
156             key subnet-id;
157             leaf subnet-id {
158                 type    yang:uuid;
159                 description "UUID representing the subnet ";
160             }
161             leaf nh-dpnId {
162                 type uint64;
163                 description "DpnId for the DPN used as nexthop for this subnet";
164             }
165             leaf vpn-name {
166                 type string;
167                 description "VPN Instance name";
168             }
169             leaf vrf-id {
170                 type string;
171             }
172             leaf subnet-cidr {
173                 type string;
174                 description "Subnet in cidr notation";
175             }
176             leaf route-adv-state {
177                 type task-state;
178                 description "The status of the subnet route advertisement. Route advertisement could be in a NA, PENDING or DONE state.";
179             }
180             leaf elan-tag{
181                 type uint32;
182             }
183             list subnet-to-dpn {
184                 key dpnId;
185                 leaf dpnId {
186                     type uint64;
187                 }
188                 list vpn-interfaces {
189                     key interface-name;
190                     leaf interface-name {
191                         type string;
192                     }
193                 }
194             }
195
196         }
197     }
198
199     container port-op-data {
200         list port-op-data-entry {
201             key port-id;
202             leaf port-id {
203                 type  string;
204                 description "UUID in string format representing the port ";
205             }
206             leaf subnet-id {
207                 type  yang:uuid;
208                 description "Back reference to obtain the subnet for a port ";
209             }
210             leaf dpnId {
211                 type uint64;
212             }
213         }
214     }
215
216     container rd-to-elan-op{
217         list rd-to-elan-op-entry{
218             key "rd subnet-ip";
219             leaf rd {
220                 type string;
221             }
222             leaf subnet-ip {
223                 type string;
224             }
225             leaf next-hop-ip {
226                 type string;
227             }
228             leaf vpn-name {
229                 type string;
230             }
231             leaf elan-tag{
232                 type uint32;
233             }
234         }
235     }
236
237 }