9b6add1d65f46aeb6c32242abad39e7bccf1d1bd
[vpnservice.git] / interfacemgr / interfacemgr-api / src / main / yang / odl-interface.yang
1 module odl-interface {
2     namespace "urn:opendaylight:vpnservice:interfacemgr";
3
4     prefix "odlif";
5
6     import ietf-interfaces {
7         prefix if;
8     }
9
10     import yang-ext {
11         prefix ext;
12     }
13
14     import iana-if-type {
15         prefix ianaift;
16     }
17
18     import ietf-inet-types {
19         prefix inet;
20         revision-date "2010-09-24";
21     }
22
23     import opendaylight-inventory {
24         prefix inv; revision-date 2013-08-19;
25     }
26
27     import opendaylight-l2-types { prefix ethertype; revision-date "2013-08-27";}
28
29     import config {
30         prefix config; revision-date 2013-04-05;
31     }
32
33     revision "2015-03-31" {
34         description "ODL Interface Manager Module";
35     }
36
37     identity odl-interface {
38         status deprecated;
39         base "config:service-type";
40         config:java-class "org.opendaylight.vpnservice.interfacemgr.interfaces.IInterfaceManager";
41     }
42
43     identity stacked-vlan {
44         base if:interface-type;
45         reference "Q-in-Q interface";
46     }
47
48     identity mpls {
49         base if:interface-type;
50         reference "MPLS interface";
51     }
52
53     /* Tunnel (GRE, VxLAN) logical port */
54     identity l3tunnel {
55         status deprecated;
56         base if:interface-type;
57         reference "l3 tunnel interface";
58     }
59
60     identity tunnel-type-base {
61         description "Base identity for all tunnel-types";
62     }
63
64     identity tunnel-type-vxlan {
65         description "Tunnel type for vxlan tunnels";
66         base tunnel-type-base;
67     }
68
69     identity tunnel-type-gre {
70         description "Tunnel type for gre tunnels";
71         base tunnel-type-base;
72     }
73
74     identity tunnel-type-mpls-over-gre {
75         description "Tunnel type for mpls over gre tunnels";
76         base tunnel-type-base;
77     }
78
79     /* base/common properties */
80     augment "/if:interfaces/if:interface" {
81         status deprecated;
82         ext:augment-identifier "base-ids";
83         leaf of-port-id {
84             type inv:node-connector-id;
85             description "can be a physical switch port or virtual switch port e.g. neutron port";
86         }
87     }
88
89     augment "/if:interfaces/if:interface" {
90         ext:augment-identifier "parent-refs";
91         leaf datapath-node-identifier {
92             type uint64;
93             description "can be a physical switch identifier (optional)";
94         }
95
96         leaf parent-interface {
97             type string;
98             description "can be a physical switch port or virtual switch port e.g. neutron port";
99         }
100
101         list node-identifier {
102             key "topology-id";
103             description "an identifier of the dependant underlying configuration protocol";
104             leaf "topology-id" {
105                 type string;
106                 description "can be ovsdb configuration protocol";
107             }
108             leaf "node-id" {
109                 type string;
110                 description "can be hwvtep configuration protocol";
111             }
112         }
113     }
114
115     /* interface type specific properties */
116
117     /* VLAN logical port */
118     augment "/if:interfaces/if:interface" {
119         ext:augment-identifier "if-l2vlan";
120         when "if:type = 'ianaift:l2vlan'";
121         leaf vlan-id {
122             type ethertype:vlan-id;
123         }
124
125         leaf l2vlan-mode {
126             description "The VLAN mode of the L2Vlan Interface.";
127             type enumeration {
128                 enum "access" {
129                     value 1;
130                     description
131                         "The VLAN mode access.";
132                 }
133                 enum "native-tagged" {
134                     value 2;
135                     description
136                         "The VLAN mode native-tagged.";
137                 }
138                 enum "native-untagged" {
139                     value 3;
140                     description
141                         "The VLAN mode native-untagged.";
142                 }
143                 enum "trunk" {
144                     value 4;
145                     description
146                         "The VLAN mode trunk.";
147                 }
148                 enum "trunk-member" {
149                     value 5;
150                     description
151                         "The VLAN mode trunk-member.";
152                 }
153                 enum "transparent" {
154                     value 6;
155                     description
156                         "The VLAN mode transparent.";
157                 }
158             }
159             default "trunk";
160         }
161     }
162
163     /* Q-in-Q logical port */
164     augment "/if:interfaces/if:interface" {
165         ext:augment-identifier "if-stacked-vlan";
166         when "if:type = 'stacked-vlan'";
167         leaf stacked_vlan-id {
168             type uint16 {
169                 range "1..4094";
170             }
171         }
172     }
173
174     augment "/if:interfaces/if:interface" {
175         ext:augment-identifier "if-tunnel";
176         when "if:type = 'ianaift:tunnel'";
177
178         leaf internal {
179             type boolean;
180             default "false";
181             description
182               "represents whether this is an internal or external tunnel.";
183         }
184         
185         leaf tunnel-interface-type {
186             type identityref {
187                 base tunnel-type-base;
188             }
189         }
190
191         leaf tunnel-source {
192             type inet:ip-address;
193             description "Local Endpoint IP address";
194         }
195
196         leaf tunnel-destination {
197             type inet:ip-address;
198             description "Remote Endpoint IP address";
199         }
200
201         leaf tunnel-gateway {
202             type inet:ip-address;
203             description "gateway IP address";
204         }
205
206         leaf monitor-enabled {
207             type boolean;
208             default false;
209         }
210
211         leaf monitor-interval {
212              type uint32;
213               default 10000;
214         }
215     }
216
217     augment "/if:interfaces/if:interface" {
218         status deprecated;
219         ext:augment-identifier "if-l3tunnel";
220         when "if:type = 'ianaift:l3tunnel'";
221
222         leaf tunnel-type {
223             type identityref {
224                 base tunnel-type-base;
225             }
226         }
227
228         leaf local-ip {
229             type inet:ip-address;
230             description "Local Endpoint IP address";
231         }
232
233         leaf remote-ip {
234             type inet:ip-address;
235             description "Remote Endpoint IP address";
236         }
237
238         leaf gateway-ip {
239             type inet:ip-address;
240             description "gateway IP address";
241         }
242     }
243
244     /* MPLS logical port */
245     augment "/if:interfaces/if:interface" {
246         ext:augment-identifier "if-mpls";
247         when "if:type = 'mpls'";
248         leaf-list labelStack {
249             type uint32 {
250                 range "15..1048575";
251             }
252         }
253         leaf numLabels{
254             type uint8 {
255                 range "1..7";
256             }
257         }
258     }
259 }