restructure and base modules for different features
[vpnservice.git] / interfacemgr / interfacemgr-api / src / main / yang / odl-interface.yang
1
2 module odl-interface {
3         namespace "urn:opendaylight:vpnservice:interfacemgr";
4
5         prefix "odlif";
6
7         import ietf-interfaces {
8                 prefix if;
9         }
10         import iana-if-type {
11                 prefix ianaift;
12         }
13
14         import ietf-inet-types {
15                 prefix inet;
16         }
17         revision "2015-03-31" {
18         description "ODL Interface Manager Module";
19     }
20
21         identity stacked-vlan {
22                 base if:interface-type;
23                 reference
24                 "Q-in-Q interface";
25         }
26         
27         identity l3tunnel {
28                 base if:interface-type;
29                 reference
30                 "l3 tunnel interface";
31         }
32
33         identity mpls {
34                 base if:interface-type;
35                 reference
36                 "MPLS interface";
37         }
38
39         /* l3Tunnel (GRE, VxLAN) logical port */
40         identity tunnel-type-base {
41                 description "Base identity for all tunnel-types";
42         }
43
44         identity tunnel-type-vxlan {
45                 description "Tunnel type for vxlan tunnels";
46                 base tunnel-type-base;
47         }
48
49         identity tunnel-type-gre {
50                 description "Tunnel type for gre tunnels";
51                 base tunnel-type-base;
52         }
53
54         /* base/common properties */
55         augment "/if:interfaces/if:interface" {
56                 leaf of-port-id { 
57                         type string; 
58                         description "can be a physical switch port or virtual switch port e.g. neutron port";
59                 } 
60                 leaf tenant-id { 
61                         type string; 
62                         description "Tenant that owns particular interface";
63                 } /* optional */
64                 leaf base-interface { 
65                         type if:interface-ref; 
66                         description "some interfaces need a reference to parent interface ";
67                 } 
68         }
69         
70         /* interface type specific properties */
71         
72         /* VLAN logical port */
73         augment "/if:interfaces/if:interface" {
74                 when "if:type = 'ianaift:l2vlan'";
75                 leaf vlan-id {
76                         type uint16 {
77                                 range "1..4094";
78                         }
79                         must "../base-interface" {
80                                 description
81                                 "If a vlan-id is defined, a base-interface must
82                                 be specified.";
83                         }
84                 }
85         }
86         
87         /* Q-in-Q logical port */
88         augment "/if:interfaces/if:interface" {
89                 when "if:type = 'stacked_vlan'";
90                 leaf stacked_vlan-id {
91                         type uint16 {
92                                 range "1..4094";
93                         }
94                         must "../base-interface" {
95                                 description
96                                 "If a vlan-id is defined, a base-interface must
97                                 be specified.";
98                         }
99                 }
100         }
101
102         augment "/if:interfaces/if:interface" {
103                 when "if:type = 'ianaift:l3tunnel'";
104
105                 leaf tunnel-type {
106             type identityref {
107                 base tunnel-type-base;
108             }
109         }
110                 leaf local-ip {
111                         type inet:ip-address;
112                         description "Local Endpoint IP address";
113                 }
114                 
115                 leaf remote-ip {
116                         type inet:ip-address;
117                         description "Remote Endpoint IP address";
118                 }
119                 
120                 leaf gateway-ip {
121                         type inet:ip-address;
122                         description "gateway IP address";
123                 }
124                                 
125         }
126
127                 
128         /* MPLS logical port */
129         augment "/if:interfaces/if:interface" {
130                 when "if:type = 'mpls'";
131                 leaf-list labelStack {
132                         type uint32 {
133                                 range "15..1048575";
134                         }
135                 }
136                 leaf numLabels{
137                         type uint8 {
138                                 range "1..7";
139                         }
140                 }               
141         }
142
143 }
144