HONEYCOMB-58 - Routing Api
[honeycomb.git] / routing / routing-api / src / main / yang / ietf-ipv4-unicast-routing.yang
1 module ietf-ipv4-unicast-routing {
2
3   namespace "urn:ietf:params:xml:ns:yang:ietf-ipv4-unicast-routing";
4
5   prefix "v4ur";
6
7   import ietf-routing {
8     prefix "rt";
9   }
10
11   import ietf-inet-types {
12     prefix "inet";
13   }
14
15   //TODO modification needed because of yangtools bug(unable to proceed augmentation in separate model of augmentation in this model)
16   import vpp-routing {
17     prefix vpp-r;
18   }
19
20   organization
21     "IETF NETMOD (NETCONF Data Modeling Language) Working Group";
22
23   contact
24     "WG Web:   <http://tools.ietf.org/wg/netmod/>
25      WG List:  <mailto:netmod@ietf.org>
26
27      WG Chair: Thomas Nadeau
28                <mailto:tnadeau@lucidvision.com>
29
30      WG Chair: Juergen Schoenwaelder
31                <mailto:j.schoenwaelder@jacobs-university.de>
32
33      Editor:   Ladislav Lhotka
34                <mailto:lhotka@nic.cz>";
35
36   description
37     "This YANG module augments the 'ietf-routing' module with basic
38      configuration and operational state data for IPv4 unicast
39      routing.
40
41      Copyright (c) 2014 IETF Trust and the persons identified as
42      authors of the code. All rights reserved.
43
44      Redistribution and use in source and binary forms, with or
45      without modification, is permitted pursuant to, and subject to
46      the license terms contained in, the Simplified BSD License set
47      forth in Section 4.c of the IETF Trust's Legal Provisions
48      Relating to IETF Documents
49      (http://trustee.ietf.org/license-info).
50
51      This version of this YANG module is part of RFC XXXX; see the
52      RFC itself for full legal notices.";
53
54   revision 2014-05-24 {
55     description
56       "Initial revision.";
57     reference
58       "RFC XXXX: A YANG Data Model for Routing Management";
59   }
60
61   /* Identities */
62
63   identity ipv4-unicast {
64     base rt:ipv4;
65     description
66       "This identity represents the IPv4 unicast address family.";
67   }
68
69   /* Operational state data */
70
71   augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route" {
72     when "../../rt:address-family = 'v4ur:ipv4-unicast'" {
73       description
74         "This augment is valid only for IPv4 unicast.";
75     }
76     description
77       "This leaf augments an IPv4 unicast route.";
78     leaf destination-prefix {
79       type inet:ipv4-prefix;
80       description
81         "IPv4 destination prefix.";
82     }
83   }
84
85   augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route/"
86         + "rt:next-hop-options/rt:simple-next-hop" {
87     when "../../rt:address-family = 'v4ur:ipv4-unicast'" {
88       description
89         "This augment is valid only for IPv4 unicast.";
90     }
91     description
92       "This leaf augments the 'simple-next-hop' case of IPv4 unicast
93        routes.";
94     leaf next-hop {
95       type inet:ipv4-address;
96       description
97         "IPv4 address of the next-hop.";
98     }
99   }
100
101   augment "/rt:routing-state/rt:ribs/rt:rib/rt:routes/rt:route/"
102         + "rt:next-hop-options/rt:next-hop-list/rt:next-hop-list/"
103         + "rt:next-hop" {
104     when "../../../../rt:address-family = 'v4ur:ipv4-unicast'" {
105       description
106         "This augment is valid only for IPv4 unicast.";
107     }
108     if-feature rt:multipath-routes;
109     description
110       "This leaf augments the 'next-hop-list' case of IPv4 unicast
111        routes.";
112     leaf address {
113       type inet:ipv4-address;
114       description
115         "IPv4 address of the next-hop.";
116     }
117   }
118
119   //NODE Added same augmentation for operation state
120   augment "/rt:routing-state/rt:routing-instance/rt:routing-protocols/rt:routing-protocol/rt:static-routes" {
121       description
122         "This augment defines the configuration of the 'static'
123          pseudo-protocol with data specific to IPv4 unicast.";
124       container ipv4 {
125         description
126           "Configuration of a 'static' pseudo-protocol instance
127            consists of a list of routes.";
128         list route {
129           key "id";
130           ordered-by "user";
131           description
132             "A user-ordered list of static routes.";
133           leaf id {
134             type uint32 {
135               //WARNING - range changed from 1..max to be mappable on vpp table ids
136               range "0..max";
137             }
138             description
139               "Unique numeric identifier of the route.
140
141                This value is unrelated to system-assigned 'id'
142                parameters of routes in RIBs.";
143           }
144           leaf description {
145             type string;
146             description
147               "Textual description of the route.";
148           }
149           leaf destination-prefix {
150             type inet:ipv4-prefix;
151             mandatory "true";
152             description
153               "IPv4 destination prefix.";
154           }
155           choice next-hop-options {
156             mandatory "true";
157             description
158               "Options for expressing the next-hop in static routes.";
159             case special-next-hop {
160               uses rt:special-next-hop-grouping;
161             }
162             case simple-next-hop {
163               leaf next-hop {
164                 type inet:ipv4-address;
165                 description
166                   "IPv4 address of the next-hop.";
167               }
168
169               //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
170               leaf outgoing-interface {
171                 type leafref {
172                   path "/rt:routing/rt:routing-instance/rt:interfaces/rt:interface/"
173                      + "rt:name";
174                 }
175                 description
176                   "Name of the outgoing interface.
177
178                    Only interfaces configured for the ancestor routing
179                    instance can be given.";
180               }
181             }
182             case next-hop-list {
183               if-feature rt:multipath-routes;
184               container next-hop-list {
185                 description
186                   "Configuration of multiple next-hops.";
187                 list next-hop {
188                   key "id";
189                   description
190                     "An entry of a next-hop list.";
191                   leaf id {
192                     type uint32;
193                     description
194                       "Unique numeric identifier of the entry.
195
196                        This value is unrelated to system-assigned 'id'
197                        parameters of next-hops in RIBs.";
198                   }
199                   leaf address {
200                     type inet:ipv4-address;
201                     description
202                       "IPv4 address of the next-hop.";
203                   }
204                   //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
205                   leaf outgoing-interface {
206                     type leafref {
207                       path "/rt:routing/rt:routing-instance/rt:interfaces/"
208                          + "rt:interface/rt:name";
209                     }
210                     description
211                       "Name of the outgoing interface.
212
213                        Only interfaces configured for the ancestor
214                        routing instance can be given.";
215                   }
216                   uses rt:next-hop-classifiers {
217                     refine "priority" {
218                       default "primary";
219                     }
220                     refine "weight" {
221                       default "0";
222                     }
223                   }
224                 }
225               }
226             }
227           }
228
229           //TODO modification needed because of yangtools bug(unable to proceed augmentation in separate model of augmentation in this model)
230           container vpp-ipv4-route-state{
231               uses vpp-r:vpp-routing-state-attributes;
232           }
233         }
234       }
235     }
236
237
238   /* Configuration data */
239
240   augment "/rt:routing/rt:routing-instance/rt:routing-protocols/rt:routing-protocol/rt:static-routes" {
241     description
242       "This augment defines the configuration of the 'static'
243        pseudo-protocol with data specific to IPv4 unicast.";
244     container ipv4 {
245       description
246         "Configuration of a 'static' pseudo-protocol instance
247          consists of a list of routes.";
248       list route {
249         key "id";
250         ordered-by "user";
251         description
252           "A user-ordered list of static routes.";
253         leaf id {
254           type uint32 {
255             //WARNING - range changed from 1..max to be mappable on vpp table ids
256             range "0..max";
257           }
258           description
259             "Unique numeric identifier of the route.
260
261              This value is unrelated to system-assigned 'id'
262              parameters of routes in RIBs.";
263         }
264         leaf description {
265           type string;
266           description
267             "Textual description of the route.";
268         }
269         leaf destination-prefix {
270           type inet:ipv4-prefix;
271           mandatory "true";
272           description
273             "IPv4 destination prefix.";
274         }
275         choice next-hop-options {
276           mandatory "true";
277           description
278             "Options for expressing the next-hop in static routes.";
279           case special-next-hop {
280             uses rt:special-next-hop-grouping;
281           }
282           case simple-next-hop {
283             leaf next-hop {
284               type inet:ipv4-address;
285               description
286                 "IPv4 address of the next-hop.";
287             }
288
289             //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
290             leaf outgoing-interface {
291               type leafref {
292                 path "/rt:routing/rt:routing-instance/rt:interfaces/rt:interface/"
293                    + "rt:name";
294               }
295               description
296                 "Name of the outgoing interface.
297
298                  Only interfaces configured for the ancestor routing
299                  instance can be given.";
300             }
301           }
302           case next-hop-list {
303             if-feature rt:multipath-routes;
304             container next-hop-list {
305               description
306                 "Configuration of multiple next-hops.";
307               list next-hop {
308                 key "id";
309                 description
310                   "An entry of a next-hop list.";
311                 leaf id {
312                   type uint32;
313                   description
314                     "Unique numeric identifier of the entry.
315
316                      This value is unrelated to system-assigned 'id'
317                      parameters of next-hops in RIBs.";
318                 }
319                 leaf address {
320                   type inet:ipv4-address;
321                   description
322                     "IPv4 address of the next-hop.";
323                 }
324                 //TODO - temporarily set to absolute path until https://bugs.opendaylight.org/show_bug.cgi?id=6881 is resolved
325                 leaf outgoing-interface {
326                   type leafref {
327                     path "/rt:routing/rt:routing-instance/rt:interfaces/"
328                        + "rt:interface/rt:name";
329                   }
330                   description
331                     "Name of the outgoing interface.
332
333                      Only interfaces configured for the ancestor
334                      routing instance can be given.";
335                 }
336                 uses rt:next-hop-classifiers {
337                   refine "priority" {
338                     default "primary";
339                   }
340                   refine "weight" {
341                     default "0";
342                   }
343                 }
344               }
345             }
346           }
347         }
348
349         //TODO modification needed because of yangtools bug(unable to proceed augmentation in separate model of augmentation in this model)
350         container vpp-ipv4-route{
351             uses vpp-r:vpp-routing-attributes;
352         }
353       }
354     }
355   }
356
357   /* RPC methods */
358
359   augment "/rt:active-route/rt:input/rt:destination-address" {
360     when "rt:address-family='v4ur:ipv4-unicast'" {
361       description
362         "This augment is valid only for IPv4 unicast.";
363     }
364     description
365       "This leaf augments the 'rt:destination-address' parameter of
366        the 'rt:active-route' operation.";
367     leaf address {
368       type inet:ipv4-address;
369       description
370         "IPv4 destination address.";
371     }
372   }
373
374   augment "/rt:active-route/rt:output/rt:route" {
375     when "rt:address-family='v4ur:ipv4-unicast'" {
376       description
377         "This augment is valid only for IPv4 unicast.";
378     }
379     description
380       "This leaf augments the reply to the 'rt:active-route'
381        operation.";
382     leaf destination-prefix {
383       type inet:ipv4-prefix;
384       description
385         "IPv4 destination prefix.";
386     }
387   }
388
389   augment "/rt:active-route/rt:output/rt:route/rt:next-hop-options/"
390         + "rt:simple-next-hop" {
391     when "rt:address-family='v4ur:ipv4-unicast'" {
392       description
393         "This augment is valid only for IPv4 unicast.";
394     }
395     description
396       "This leaf augments the 'simple-next-hop' case in the reply to
397        the 'rt:active-route' operation.";
398     leaf next-hop {
399       type inet:ipv4-address;
400       description
401         "IPv4 address of the next-hop.";
402     }
403   }
404
405   augment "/rt:active-route/rt:output/rt:route/rt:next-hop-options/"
406         + "rt:next-hop-list/rt:next-hop-list/rt:next-hop" {
407     when "../../rt:address-family='v4ur:ipv4-unicast'" {
408       description
409         "This augment is valid only for IPv4 unicast.";
410     }
411     if-feature rt:multipath-routes;
412     description
413       "This leaf augments the 'next-hop-list' case in the reply to
414        the 'rt:active-route' operation.";
415     leaf address {
416       type inet:ipv4-address;
417       description
418         "IPv4 address of the next-hop.";
419     }
420   }
421 }