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