TSC-181: ITM Yang Models Cleanup
[genius.git] / itm / itm-api / src / main / yang / itm-state.yang
1 module itm-state {
2
3       namespace "urn:opendaylight:genius:itm:op";
4
5       prefix itm-state;
6
7       import ietf-interfaces {
8           prefix if;
9       }
10
11       import ietf-yang-types {
12           prefix yang;
13       }
14
15       import ietf-inet-types {
16           prefix inet;
17           revision-date "2013-07-15";
18       }
19       import odl-interface {
20           prefix odlif; revision-date "2016-04-06";
21       }
22
23
24       description "This YANG module defines operation part of the model.";
25
26       revision "2016-04-06";
27
28         /* Operational state */
29
30       identity tep-type-base {
31           description "Base TEP device type";
32       }
33
34       identity tep-type-internal {
35           base tep-type-base;
36           description "TEP type internal e.g. Compute OVS";
37       }
38
39       identity tep-type-external {
40           base tep-type-base;
41           description "TEP type external e.g. DC Gateway";
42       }
43
44       identity tep-type-hwvtep {
45           base tep-type-base;
46           description "TEP type Hwvtep e.g. TOR devices";
47       }
48
49       typedef tep-type {
50           type identityref {
51               base tep-type-base;
52           }
53           description "This type is used to refer to an TEP Device Type.";
54       }
55
56       grouping tep-info-attributes {
57           leaf tep-device-type {
58               type identityref {
59                   base tep-type-base;
60               }
61           }
62           leaf tep-device-id {
63               type string; //dpnid or node-id
64           }
65           leaf tep-ip {
66               type inet:ip-address; //dpnid or node-id
67           }
68       }
69
70       typedef tunnel-oper-status {
71           type enumeration {
72                enum up;
73                enum down;
74                enum unknown;
75                enum ignore;
76            }
77       }
78
79       container dpn-endpoints {
80           list DPN-TEPs-info {
81           key "DPN-ID";
82
83           leaf DPN-ID {
84               type uint64;
85           }
86
87           leaf dst-id {
88               description "Identifier to get to a this DPN, which will be used in programming Egress flows ";
89               type int32 {
90                   range "1..2147483647";
91               }
92           }
93
94           leaf up {
95               status deprecated;
96               type boolean;
97               config false;
98           }
99
100           /* Minimum 1 port. We may for now support only two ports */
101           list tunnel-end-points {
102               ordered-by user;
103               key "ip-address tunnel-type"; /* Multiple tunnels on the same physical port but on different VLAN can be supported */
104
105               leaf ip-address {
106                   type inet:ip-address;
107               }
108               list tz-membership {
109                   key "zone-name";
110                   leaf zone-name {
111                       type string;
112                   }
113               }
114               leaf interface-name {
115                   type string;
116               }
117               leaf tunnel-type {
118                   type identityref {
119                       base odlif:tunnel-type-base;
120                   }
121               }
122               leaf option-of-tunnel {
123                   description "Use flow based tunnels for remote-ip";
124                   type boolean;
125                   default false;
126               }
127               leaf option-tunnel-tos {
128                   description "Value of ToS bits to be set on the encapsulating
129                       packet. The value of 'inherit' will copy the DSCP value
130                       from inner IPv4 or IPv6 packets.  When ToS is given as
131                       a numberic value, the least significant two bits will
132                       be ignored.";
133                   type string {
134                       length "1..8";
135                   }
136               }
137           }
138        }
139     }
140
141
142     container tunnel-list {
143         list internal-tunnel {
144
145             key  "source-DPN destination-DPN transport-type";
146
147             leaf source-DPN {
148                 type uint64;
149             }
150
151             leaf destination-DPN {
152                 type uint64;
153             }
154
155             leaf transport-type {
156                 type identityref {
157                     base odlif:tunnel-type-base;
158                 }
159             }
160
161             /* logical-group interface id */
162
163             leaf-list tunnel-interface-names {
164                 type string;
165             }
166         }
167     }
168
169     container external-tunnel-list {
170         list external-tunnel {
171             key  "source-device destination-device transport-type";
172
173             leaf source-device {
174                 type string; //dpnid or node-id
175             }
176
177             leaf destination-device {
178                 type string; //dpn-id or node-id or ip
179             }
180
181             leaf transport-type {
182                  type identityref {
183                      base odlif:tunnel-type-base;
184                  }
185             }
186
187             /* logical-group interface id */
188
189             leaf tunnel-interface-name {
190                  type string;
191             }
192
193         }
194     }
195
196     container tunnels_state {
197         config false;
198         list state-tunnel-list {
199             key  "tunnel-interface-name";
200
201             leaf tunnel-interface-name {
202                 type string;
203             }
204
205             leaf tunnel-state {
206                 type boolean;
207                 config false;
208                 status deprecated;
209             }
210
211             leaf oper-state { type tunnel-oper-status; }
212
213             container src-info {
214                 uses tep-info-attributes;
215             }
216
217             container dst-info {
218                 uses tep-info-attributes;
219             }
220
221             leaf transport-type {
222                 type identityref {
223                     base odlif:tunnel-type-base;
224                 }
225             }
226
227             leaf port-number {
228                 type string;
229             }
230
231             leaf if-index {
232                 type uint16;
233             }
234         }
235     }
236
237     container dpn-teps-state {
238         list dpns-teps {
239             key "source-dpn-id";
240             leaf source-dpn-id {
241                 type uint64;
242                 mandatory true;
243             }
244
245             leaf ip-address {
246                 type inet:ip-address;
247             }
248
249             leaf tunnel-type {
250                 type identityref {
251                     base odlif:tunnel-type-base;
252                 }
253                 mandatory true;
254             }
255
256             leaf of-tunnel {
257                 description "Specifies OFTunnel port name when OFTunnel is enabled on ITM Direct Tunnels";
258                 type string;
259             }
260
261             /* Remote DPNs to which this DPN-Tep has a tunnel */
262             list remote-dpns {
263                 key "destination-dpn-id";
264                 leaf destination-dpn-id {
265                     type uint64;
266                     mandatory true;
267                 }
268
269                 leaf tunnel-name {
270                     type string;
271                     mandatory true;
272                 }
273
274                 /* This will later be changed to monitor profile id */
275                 /* The monitor profile will contain monitoring related params */
276                 leaf monitoring-enabled {
277                     type boolean;
278                 }
279
280                 leaf monitoring-interval {
281                     type uint16 {
282                         range "1000..30000";
283                     }
284                 }
285
286                 leaf internal {
287                     type boolean;
288                     mandatory true;
289                     description "represents whether this is an internal or external tunnel.";
290                 }
291             }
292         }
293     }
294
295     container monitoring-ref-count {
296         config false;
297         description "The container for maintaing the reference count for monitoring requests
298                       between a src and dst DPN pair.";
299         list monitored-tunnels {
300             key "source-dpn destination-dpn";
301             leaf source-dpn {
302                 type uint64;
303             }
304             leaf destination-dpn {
305                 type uint64;
306             }
307             leaf reference-count {
308                 type uint16;
309             }
310         }
311     }
312 }