blob: 1d61f90cbf5eec49ceecbb2b1a4b26ff902b6d21 [file] [log] [blame]
samuel8d6b0a92015-07-11 13:22:57 +08001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
samuel8d6b0a92015-07-11 13:22:57 +08003 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16package org.onosproject.net.behaviour;
17
18import org.onosproject.net.Annotated;
19import org.onosproject.net.Description;
20
21import com.google.common.annotations.Beta;
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070022import org.onosproject.net.SparseAnnotations;
23
24import java.util.Optional;
samuel8d6b0a92015-07-11 13:22:57 +080025
26/**
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070027 * Describes a tunnel interface.
samuel8d6b0a92015-07-11 13:22:57 +080028 */
29@Beta
30public interface TunnelDescription extends Description, Annotated {
31
32 /**
33 * Tunnel technology type.
34 */
35 enum Type {
36 /**
37 * Signifies that this is a MPLS tunnel.
38 */
39 MPLS,
40 /**
41 * Signifies that this is a L2 tunnel.
42 */
43 VLAN,
44 /**
45 * Signifies that this is a DC L2 extension tunnel.
46 */
47 VXLAN,
48 /**
49 * Signifies that this is a L3 tunnel.
50 */
51 GRE,
52 /**
53 * Signifies that this is a L1 OTN tunnel.
54 */
55 ODUK,
56 /**
57 * Signifies that this is a L0 OCH tunnel.
58 */
59 OCH
60 }
61
62 /**
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070063 * Returns the identifier of the device where the interface is.
samuel8d6b0a92015-07-11 13:22:57 +080064 *
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070065 * @return device identifier
samuel8d6b0a92015-07-11 13:22:57 +080066 */
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070067 Optional<String> deviceId();
samuel8d6b0a92015-07-11 13:22:57 +080068
69 /**
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070070 * Return the name of the tunnel interface.
samuel8d6b0a92015-07-11 13:22:57 +080071 *
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070072 * @return tunnel interface name
samuel8d6b0a92015-07-11 13:22:57 +080073 */
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070074 String ifaceName();
samuel8d6b0a92015-07-11 13:22:57 +080075
76 /**
77 * Returns the tunnel type.
78 *
79 * @return tunnel type
80 */
81 Type type();
82
83 /**
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070084 * Returns the local connection point.
85 *
86 * @return tunnel source ConnectionPoint
87 */
88 Optional<TunnelEndPoint> local();
89
90 /**
91 * Returns the remote connection point.
92 *
93 * @return tunnel destination
94 */
95 Optional<TunnelEndPoint> remote();
96
97 /**
98 * Returns the tunnel key.
99 *
100 * @return tunnel key
101 */
102 Optional<TunnelKey> key();
103
104 /**
105 * Returns the connection point source.
106 *
107 * @deprecated version 1.7.0 - Hummingbird; use local instead
108 * @return tunnel source ConnectionPoint
109 */
110 @Deprecated
111 TunnelEndPoint src();
112
113 /**
114 * Returns the connection point destination.
115 *
116 * @deprecated version 1.7.0 - Hummingbird; use remote instead
117 * @return tunnel destination
118 */
119 @Deprecated
120 TunnelEndPoint dst();
121
122 /**
samuel8d6b0a92015-07-11 13:22:57 +0800123 * Return the name of a tunnel.
124 *
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700125 * @deprecated version 1.7.0 - Hummingbird; use ifaceName instead
samuel8d6b0a92015-07-11 13:22:57 +0800126 * @return Tunnel Name
127 */
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700128 @Deprecated
samuel8d6b0a92015-07-11 13:22:57 +0800129 TunnelName tunnelName();
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700130
131 /**
132 * Builder of tunnel interface description entities.
133 */
134 interface Builder {
135
136 /**
137 * Returns new tunnel interface description.
138 *
139 * @return tunnel description
140 */
141 TunnelDescription build();
142
143 /**
144 * Returns tunnel interface description biulder with supplied device ID.
145 *
146 * @param deviceId device identifier
147 * @return tunnel description builder
148 */
149 Builder deviceId(String deviceId);
150
151 /**
152 * Returns tunnel interface description builder with a given interface name.
153 *
154 * @param name tunnel interface name
155 * @return tunnel description builder
156 */
157 Builder ifaceName(String name);
158
159 /**
160 * Returns tunnel interface description builder with a given tunnel type.
161 *
162 * @param type tunnel type
163 * @return tunnel description builder
164 */
165 Builder type(Type type);
166
167 /**
168 * Returns tunnel interface description builder with a given local
169 * tunnel endpoint.
170 *
171 * @param endpoint tunnel endpoint
172 * @return tunnel description builder
173 */
174 Builder local(TunnelEndPoint endpoint);
175
176 /**
177 * Returns tunnel interface description builder with a given remote
178 * tunnel endpoint.
179 *
180 * @param endpoint tunnel endpoint
181 * @return tunnel description builder
182 */
183 Builder remote(TunnelEndPoint endpoint);
184
185 /**
186 * Returns tunnel interface description builder with a tunnel key.
187 *
Ray Milkeybb23e0b2016-08-02 17:00:21 -0700188 * @param tunnelKey tunnel key
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700189 * @return tunnel description builder
190 */
191 Builder key(TunnelKey tunnelKey);
192
193 /**
194 * Returns tunnel interface descriptions builder with other configurations.
195 *
196 * @param configs configurations
197 * @return tunnel description builder
198 */
199 Builder otherConfigs(SparseAnnotations configs);
200 }
samuel8d6b0a92015-07-11 13:22:57 +0800201}