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