blob: 6b36ead00d55caaab0b84bcd4101eb5ffe06168e [file] [log] [blame]
wei wei89ddc322015-03-22 16:29:04 -05001/*
Brian O'Connora09fe5b2017-08-03 21:12:30 -07002 * Copyright 2015-present Open Networking Foundation
wei wei89ddc322015-03-22 16:29:04 -05003 *
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 */
Thomas Vachuskabf916ea2015-05-20 18:24:34 -070016package org.onosproject.incubator.net.tunnel;
wei wei89ddc322015-03-22 16:29:04 -050017
Brian O'Connor2bed5ce2015-06-25 15:10:28 -040018import com.google.common.annotations.Beta;
Yi Tsengfa394de2017-02-01 11:26:40 -080019import org.onosproject.core.GroupId;
wei wei89ddc322015-03-22 16:29:04 -050020import org.onosproject.net.Annotated;
21import org.onosproject.net.NetworkResource;
samuel7a5691a2015-05-23 00:36:32 +080022import org.onosproject.net.Path;
wei wei89ddc322015-03-22 16:29:04 -050023import org.onosproject.net.Provided;
wei wei89ddc322015-03-22 16:29:04 -050024
25/**
jcc4a20a5f2015-04-30 15:43:39 +080026 * Abstraction of a generalized Tunnel entity (bandwidth pipe) for either L3/L2
27 * networks or L1/L0 networks, representation of e.g., VLAN, GRE tunnel, MPLS
28 * LSP, L1 ODUk connection, WDM OCH, etc.. Each Tunnel is associated with at
29 * least two tunnel end point objects that model the logical ports essentially.
wei wei89ddc322015-03-22 16:29:04 -050030 * Note that it supports nested case.
31 */
Brian O'Connor2bed5ce2015-06-25 15:10:28 -040032@Beta
wei wei89ddc322015-03-22 16:29:04 -050033public interface Tunnel extends Annotated, Provided, NetworkResource {
34
35 /**
jcc4a20a5f2015-04-30 15:43:39 +080036 * Tunnel technology type.
wei wei89ddc322015-03-22 16:29:04 -050037 */
Sho SHIMIZU3310a342015-05-13 12:14:05 -070038 enum Type {
wei wei89ddc322015-03-22 16:29:04 -050039 /**
jcc4a20a5f2015-04-30 15:43:39 +080040 * Signifies that this is a MPLS tunnel.
41 */
42 MPLS,
43 /**
wei wei89ddc322015-03-22 16:29:04 -050044 * Signifies that this is a L2 tunnel.
45 */
46 VLAN,
wei wei89ddc322015-03-22 16:29:04 -050047 /**
48 * Signifies that this is a DC L2 extension tunnel.
49 */
50 VXLAN,
wei wei89ddc322015-03-22 16:29:04 -050051 /**
52 * Signifies that this is a L3 tunnel.
53 */
54 GRE,
wei wei89ddc322015-03-22 16:29:04 -050055 /**
56 * Signifies that this is a L1 OTN tunnel.
57 */
jcc4a20a5f2015-04-30 15:43:39 +080058 ODUK,
wei wei89ddc322015-03-22 16:29:04 -050059 /**
60 * Signifies that this is a L0 OCH tunnel.
61 */
62 OCH
63 }
64
65 /**
66 * Representation of the tunnel state.
wei wei89ddc322015-03-22 16:29:04 -050067 */
jcc4a20a5f2015-04-30 15:43:39 +080068 public enum State {
wei wei89ddc322015-03-22 16:29:04 -050069 /**
70 * Signifies that a tunnel is currently in a initialized state.
71 */
72 INIT,
wei wei89ddc322015-03-22 16:29:04 -050073 /**
74 * Signifies that a tunnel is currently established but no traffic.
75 */
76 ESTABLISHED,
wei wei89ddc322015-03-22 16:29:04 -050077 /**
jcc4a20a5f2015-04-30 15:43:39 +080078 * Signifies that a tunnel is currently active. This state means that
79 * this tunnel is available. It can be borrowed by consumer.
wei wei89ddc322015-03-22 16:29:04 -050080 */
81 ACTIVE,
wei wei89ddc322015-03-22 16:29:04 -050082 /**
83 * Signifies that a tunnel is currently out of service.
84 */
85 FAILED,
wei wei89ddc322015-03-22 16:29:04 -050086 /**
jcc4a20a5f2015-04-30 15:43:39 +080087 * Signifies that a tunnel is currently inactive. This state means that
88 * this tunnel can not be borrowed by consumer.
wei wei89ddc322015-03-22 16:29:04 -050089 */
Avantika-Huaweie75edbf2016-05-11 17:02:47 +053090 INACTIVE,
91
92 /**
93 * Signifies that the tunnel's state is unreliable and should be setup again.
94 */
tony-liu684b2b82016-09-20 16:19:30 +080095 UNSTABLE,
96
97 /**
98 * Signifies that a tunnel is being established.
99 */
100 ESTABLISHING,
101
102 /**
103 * Signifies that a tunnel is being removed.
104 */
105 REMOVING
wei wei89ddc322015-03-22 16:29:04 -0500106 }
107
wei wei89ddc322015-03-22 16:29:04 -0500108 /**
109 * Returns the tunnel state.
110 *
111 * @return tunnel state
112 */
113 State state();
114
115 /**
jcc4a20a5f2015-04-30 15:43:39 +0800116 * the origin of a tunnel.
wei wei89ddc322015-03-22 16:29:04 -0500117 *
jcc4a20a5f2015-04-30 15:43:39 +0800118 * @return the origin of a tunnel
wei wei89ddc322015-03-22 16:29:04 -0500119 */
jcc4a20a5f2015-04-30 15:43:39 +0800120 TunnelEndPoint src();
wei wei89ddc322015-03-22 16:29:04 -0500121
122 /**
jcc4a20a5f2015-04-30 15:43:39 +0800123 * the terminal of a tunnel.
wei wei89ddc322015-03-22 16:29:04 -0500124 *
jcc4a20a5f2015-04-30 15:43:39 +0800125 * @return the terminal of a tunnel
wei wei89ddc322015-03-22 16:29:04 -0500126 */
jcc4a20a5f2015-04-30 15:43:39 +0800127 TunnelEndPoint dst();
wei wei89ddc322015-03-22 16:29:04 -0500128
129 /**
jcc4a20a5f2015-04-30 15:43:39 +0800130 * Returns the tunnel type.
wei wei89ddc322015-03-22 16:29:04 -0500131 *
jcc4a20a5f2015-04-30 15:43:39 +0800132 * @return tunnel type
wei wei89ddc322015-03-22 16:29:04 -0500133 */
jcc4a20a5f2015-04-30 15:43:39 +0800134 Type type();
135
136 /**
137 * Returns group flow table id which a tunnel match up.
138 *
139 * @return OpenFlowGroupId
140 */
Yi Tsengfa394de2017-02-01 11:26:40 -0800141 GroupId groupId();
jcc4a20a5f2015-04-30 15:43:39 +0800142
143 /**
144 * Returns tunnel identify generated by ONOS as primary key.
145 *
146 * @return TunnelId
147 */
148 TunnelId tunnelId();
149
150 /**
151 * Return the name of a tunnel.
152 *
153 * @return Tunnel Name
154 */
155 TunnelName tunnelName();
156
157 /**
158 * Network resource backing the tunnel, e.g. lambda, VLAN id, MPLS tag.
159 *
160 * @return backing resource
161 */
162 NetworkResource resource();
163
samuel7a5691a2015-05-23 00:36:32 +0800164 /**
165 * Returns the path of the tunnel.
166 *
167 * @return the path of the tunnel
168 */
169 Path path();
wei wei89ddc322015-03-22 16:29:04 -0500170}