Bug 5182 - Customized name support for VLAN trunk should be supported
[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
102     /* interface type specific properties */
103
104     /* VLAN logical port */
105     augment "/if:interfaces/if:interface" {
106         ext:augment-identifier "if-l2vlan";
107         when "if:type = 'ianaift:l2vlan'";
108         leaf vlan-id {
109             type ethertype:vlan-id;
110         }
111
112         leaf l2vlan-mode {
113             description "The VLAN mode of the L2Vlan Interface.";
114             type enumeration {
115                 enum "access" {
116                     value 1;
117                     description
118                         "The VLAN mode access.";
119                 }
120                 enum "native-tagged" {
121                     value 2;
122                     description
123                         "The VLAN mode native-tagged.";
124                 }
125                 enum "native-untagged" {
126                     value 3;
127                     description
128                         "The VLAN mode native-untagged.";
129                 }
130                 enum "trunk" {
131                     value 4;
132                     description
133                         "The VLAN mode trunk.";
134                 }
135                 enum "trunk-member" {
136                     value 5;
137                     description
138                         "The VLAN mode trunk-member.";
139                 }
140                 enum "transparent" {
141                     value 6;
142                     description
143                         "The VLAN mode transparent.";
144                 }
145             }
146             default "trunk";
147         }
148     }
149
150     /* Q-in-Q logical port */
151     augment "/if:interfaces/if:interface" {
152         ext:augment-identifier "if-stacked-vlan";
153         when "if:type = 'stacked-vlan'";
154         leaf stacked_vlan-id {
155             type uint16 {
156                 range "1..4094";
157             }
158         }
159     }
160
161     augment "/if:interfaces/if:interface" {
162         ext:augment-identifier "if-tunnel";
163         when "if:type = 'ianaift:tunnel'";
164
165         leaf internal {
166             type boolean;
167             default "false";
168             description
169               "represents whether this is an internal or external tunnel.";
170         }
171         
172         leaf tunnel-interface-type {
173             type identityref {
174                 base tunnel-type-base;
175             }
176         }
177
178         leaf tunnel-source {
179             type inet:ip-address;
180             description "Local Endpoint IP address";
181         }
182
183         leaf tunnel-destination {
184             type inet:ip-address;
185             description "Remote Endpoint IP address";
186         }
187
188         leaf tunnel-gateway {
189             type inet:ip-address;
190             description "gateway IP address";
191         }
192
193         leaf monitor-enabled {
194             type boolean;
195             default false;
196         }
197
198         leaf monitor-interval {
199              type uint32;
200               default 10000;
201         }
202     }
203
204     augment "/if:interfaces/if:interface" {
205         status deprecated;
206         ext:augment-identifier "if-l3tunnel";
207         when "if:type = 'ianaift:l3tunnel'";
208
209         leaf tunnel-type {
210             type identityref {
211                 base tunnel-type-base;
212             }
213         }
214
215         leaf local-ip {
216             type inet:ip-address;
217             description "Local Endpoint IP address";
218         }
219
220         leaf remote-ip {
221             type inet:ip-address;
222             description "Remote Endpoint IP address";
223         }
224
225         leaf gateway-ip {
226             type inet:ip-address;
227             description "gateway IP address";
228         }
229     }
230
231     /* MPLS logical port */
232     augment "/if:interfaces/if:interface" {
233         ext:augment-identifier "if-mpls";
234         when "if:type = 'mpls'";
235         leaf-list labelStack {
236             type uint32 {
237                 range "15..1048575";
238             }
239         }
240         leaf numLabels{
241             type uint8 {
242                 range "1..7";
243             }
244         }
245     }
246 }