blob: 4d9e41bf6e6028165e65e6a969a08c1b15c651eb [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 /**
Jian Li654204c2018-12-16 01:56:31 +090053 * Signifies that this is a L3 tunnel.
54 */
55 GENEVE,
56 /**
samuel8d6b0a92015-07-11 13:22:57 +080057 * Signifies that this is a L1 OTN tunnel.
58 */
59 ODUK,
60 /**
61 * Signifies that this is a L0 OCH tunnel.
62 */
63 OCH
64 }
65
66 /**
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070067 * Returns the identifier of the device where the interface is.
samuel8d6b0a92015-07-11 13:22:57 +080068 *
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070069 * @return device identifier
samuel8d6b0a92015-07-11 13:22:57 +080070 */
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070071 Optional<String> deviceId();
samuel8d6b0a92015-07-11 13:22:57 +080072
73 /**
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070074 * Return the name of the tunnel interface.
samuel8d6b0a92015-07-11 13:22:57 +080075 *
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070076 * @return tunnel interface name
samuel8d6b0a92015-07-11 13:22:57 +080077 */
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070078 String ifaceName();
samuel8d6b0a92015-07-11 13:22:57 +080079
80 /**
81 * Returns the tunnel type.
82 *
83 * @return tunnel type
84 */
85 Type type();
86
87 /**
Hyunsun Moondd14e8e2016-06-09 16:17:32 -070088 * Returns the local connection point.
89 *
90 * @return tunnel source ConnectionPoint
91 */
92 Optional<TunnelEndPoint> local();
93
94 /**
95 * Returns the remote connection point.
96 *
97 * @return tunnel destination
98 */
99 Optional<TunnelEndPoint> remote();
100
101 /**
102 * Returns the tunnel key.
103 *
104 * @return tunnel key
105 */
106 Optional<TunnelKey> key();
107
108 /**
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700109 * Builder of tunnel interface description entities.
110 */
111 interface Builder {
112
113 /**
114 * Returns new tunnel interface description.
115 *
116 * @return tunnel description
117 */
118 TunnelDescription build();
119
120 /**
121 * Returns tunnel interface description biulder with supplied device ID.
122 *
123 * @param deviceId device identifier
124 * @return tunnel description builder
125 */
126 Builder deviceId(String deviceId);
127
128 /**
129 * Returns tunnel interface description builder with a given interface name.
130 *
131 * @param name tunnel interface name
132 * @return tunnel description builder
133 */
134 Builder ifaceName(String name);
135
136 /**
137 * Returns tunnel interface description builder with a given tunnel type.
138 *
139 * @param type tunnel type
140 * @return tunnel description builder
141 */
142 Builder type(Type type);
143
144 /**
145 * Returns tunnel interface description builder with a given local
146 * tunnel endpoint.
147 *
148 * @param endpoint tunnel endpoint
149 * @return tunnel description builder
150 */
151 Builder local(TunnelEndPoint endpoint);
152
153 /**
154 * Returns tunnel interface description builder with a given remote
155 * tunnel endpoint.
156 *
157 * @param endpoint tunnel endpoint
158 * @return tunnel description builder
159 */
160 Builder remote(TunnelEndPoint endpoint);
161
162 /**
163 * Returns tunnel interface description builder with a tunnel key.
164 *
Ray Milkeybb23e0b2016-08-02 17:00:21 -0700165 * @param tunnelKey tunnel key
Hyunsun Moondd14e8e2016-06-09 16:17:32 -0700166 * @return tunnel description builder
167 */
168 Builder key(TunnelKey tunnelKey);
169
170 /**
171 * Returns tunnel interface descriptions builder with other configurations.
172 *
173 * @param configs configurations
174 * @return tunnel description builder
175 */
176 Builder otherConfigs(SparseAnnotations configs);
177 }
samuel8d6b0a92015-07-11 13:22:57 +0800178}