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