HONEYCOMB-46: Add NSH_SFC Feature in Honeycomb
[honeycomb.git] / nsh / api / src / main / yang / vpp-nsh.yang
1 module vpp-nsh {
2   yang-version 1;
3   namespace "urn:opendaylight:params:xml:ns:yang:vpp:nsh";
4   prefix "vpp-nsh";
5
6   revision "2016-06-24" {
7     description "Initial revision of vpp-nsh model";
8   }
9
10   import iana-if-type {
11     prefix "ianaift";
12   }
13   import ietf-interfaces {
14     prefix "if";
15   }
16   import ietf-yang-types {
17     prefix "yang";
18   }
19   import ietf-inet-types {
20     prefix "inet";
21   }
22   import yang-ext {
23     prefix "ext";
24   }
25   import v3po {
26     prefix "v3po";
27   }
28   /*
29    * Defines the supported next protocols that can be used for
30    * NSH next-protocol field.
31    */
32   identity next-protocol {
33     description "Base identity from which all nsh next protocols
34                  are derived from";
35   }
36
37   identity ipv4 {
38     base next-protocol;
39     description
40       "Support ipv4 to act as next protocol";
41   }
42
43   identity ipv6 {
44     base next-protocol;
45     description
46       "Support ipv6 to act as next protocol";
47   }
48
49   identity ethernet {
50     base next-protocol;
51     description
52       "Support ethernet to act as next protocol";
53   }
54
55   typedef nsh-next-protocol {
56     type identityref {
57       base "next-protocol";
58     }
59     description "Identifies a specific next protocol for nsh";
60   }
61
62   /*
63    * Defines the supported encap type.
64    */
65   identity encap-type {
66     description "encap type";
67   }
68
69   identity vxlan-gpe {
70     base "encap-type";
71     description "vxlan-gpe encap type";
72   }
73
74   identity vxlan {
75     base "encap-type";
76     description "vxlan encap type";
77   }
78
79   typedef nsh-encap-type {
80     type identityref {
81       base "encap-type";
82     }
83   }
84
85   /*
86    * Defines the supported MD-types.
87    */
88   identity md-type {
89     description "md type";
90   }
91
92   identity md-type1 {
93     base "md-type";
94     description "nsh md-type1";
95   }
96
97   identity md-type2 {
98     base "md-type";
99     description "nsh md-type2";
100   }
101
102   typedef nsh-md-type {
103     type identityref {
104       base "md-type";
105     }
106   }
107
108   grouping nsh-md-type1-attributes {
109     leaf c1 {
110       type uint32;
111     }
112     leaf c2 {
113       type uint32;
114     }
115     leaf c3 {
116       type uint32;
117     }
118     leaf c4 {
119       type uint32;
120     }
121   }
122
123   grouping nsh-md-type2-attributes {
124       leaf type {
125       type uint32;
126     }
127   }
128
129   grouping nsh-entry-base-attributes {
130     leaf name {
131       type string;
132       description "NSH Entry Name";
133     }
134     leaf nsp {
135       type uint32 {
136         range "0..16777215";
137       }
138     }
139     leaf nsi {
140       type uint8 {
141         range "1..255";
142       }
143     }
144     leaf md-type {
145       type nsh-md-type;
146     }
147     leaf version {
148       type uint8;
149     }
150     leaf length {
151       type uint8;
152     }
153     leaf next-protocol {
154       type nsh-next-protocol;
155     }
156   }
157
158   grouping nsh-map-base-attributes {
159     leaf name {
160       type string;
161       description "NSH Map Name";
162     }
163     leaf nsp {
164       type uint32 {
165         range "0..16777215";
166       }
167     }
168     leaf nsi {
169       type uint8 {
170         range "1..255";
171       }
172     }
173     leaf mapped-nsp {
174       type uint32 {
175         range "0..16777215";
176       }
177     }
178     leaf mapped-nsi {
179       type uint8 {
180         range "1..255";
181       }
182     }
183     leaf encap-type {
184       type nsh-encap-type;
185     }
186     leaf encap-if-name {
187       type string;
188       description "Interface Name";
189     }
190   }
191
192   container vpp-nsh {
193     description
194     "NSH config data";
195
196     container nsh-entries {
197       list nsh-entry {
198         key "name";
199
200         uses nsh-entry-base-attributes;
201
202         description
203           "nsh-entry configuration";
204       }
205     }
206
207     container nsh-maps {
208       list nsh-map {
209         key "name";
210
211         uses nsh-map-base-attributes;
212
213         description
214           "nsh-map configuration";
215       }
216     }
217   }
218
219   augment /vpp-nsh/nsh-entries/nsh-entry {
220     ext:augment-identifier nsh-md-type-1-augment;
221     when "/md-type = 'vpp-nsh:md-type1' ";
222     uses nsh-md-type1-attributes;
223   }
224
225   augment /vpp-nsh/nsh-entries/nsh-entry {
226     ext:augment-identifier nsh-md-type-2-augment;
227     when "/md-type = 'vpp-nsh:md-type2' ";
228     uses nsh-md-type2-attributes;
229   }
230
231   container vpp-nsh-state {
232     config false;
233
234     description
235       "NSH operational data";
236
237     container nsh-entries {
238       list nsh-entry {
239         key "name";
240
241         uses nsh-entry-base-attributes;
242
243         description
244           "nsh-entry operational data";
245       }
246     }
247
248     container nsh-maps {
249       list nsh-map {
250         key "name";
251
252         uses nsh-map-base-attributes;
253
254         description
255           "nsh-map operational data";
256       }
257     }
258   }
259
260   augment /vpp-nsh-state/nsh-entries/nsh-entry {
261     ext:augment-identifier nsh-md-type-1-state-augment;
262     when "/md-type = 'vpp-nsh:md-type1' ";
263     uses nsh-md-type1-attributes;
264   }
265
266   augment /vpp-nsh-state/nsh-entries/nsh-entry {
267     ext:augment-identifier nsh-md-type-2-state-augment;
268     when "/md-type = 'vpp-nsh:md-type2' ";
269     uses nsh-md-type2-attributes;
270   }
271 }