blob: ae9d92f6bb31b9438f050ff21115d7b41d92d94c [file] [log] [blame]
wei wei89ddc322015-03-22 16:29:04 -05001/*
Brian O'Connor5ab426f2016-04-09 01:19:45 -07002 * Copyright 2015-present Open Networking Laboratory
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;
jcc4a20a5f2015-04-30 15:43:39 +080019import org.onosproject.core.DefaultGroupId;
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 */
95 UNSTABLE
wei wei89ddc322015-03-22 16:29:04 -050096 }
97
wei wei89ddc322015-03-22 16:29:04 -050098 /**
99 * Returns the tunnel state.
100 *
101 * @return tunnel state
102 */
103 State state();
104
105 /**
jcc4a20a5f2015-04-30 15:43:39 +0800106 * the origin of a tunnel.
wei wei89ddc322015-03-22 16:29:04 -0500107 *
jcc4a20a5f2015-04-30 15:43:39 +0800108 * @return the origin of a tunnel
wei wei89ddc322015-03-22 16:29:04 -0500109 */
jcc4a20a5f2015-04-30 15:43:39 +0800110 TunnelEndPoint src();
wei wei89ddc322015-03-22 16:29:04 -0500111
112 /**
jcc4a20a5f2015-04-30 15:43:39 +0800113 * the terminal of a tunnel.
wei wei89ddc322015-03-22 16:29:04 -0500114 *
jcc4a20a5f2015-04-30 15:43:39 +0800115 * @return the terminal of a tunnel
wei wei89ddc322015-03-22 16:29:04 -0500116 */
jcc4a20a5f2015-04-30 15:43:39 +0800117 TunnelEndPoint dst();
wei wei89ddc322015-03-22 16:29:04 -0500118
119 /**
jcc4a20a5f2015-04-30 15:43:39 +0800120 * Returns the tunnel type.
wei wei89ddc322015-03-22 16:29:04 -0500121 *
jcc4a20a5f2015-04-30 15:43:39 +0800122 * @return tunnel type
wei wei89ddc322015-03-22 16:29:04 -0500123 */
jcc4a20a5f2015-04-30 15:43:39 +0800124 Type type();
125
126 /**
127 * Returns group flow table id which a tunnel match up.
128 *
129 * @return OpenFlowGroupId
130 */
131 DefaultGroupId groupId();
132
133 /**
134 * Returns tunnel identify generated by ONOS as primary key.
135 *
136 * @return TunnelId
137 */
138 TunnelId tunnelId();
139
140 /**
141 * Return the name of a tunnel.
142 *
143 * @return Tunnel Name
144 */
145 TunnelName tunnelName();
146
147 /**
148 * Network resource backing the tunnel, e.g. lambda, VLAN id, MPLS tag.
149 *
150 * @return backing resource
151 */
152 NetworkResource resource();
153
samuel7a5691a2015-05-23 00:36:32 +0800154 /**
155 * Returns the path of the tunnel.
156 *
157 * @return the path of the tunnel
158 */
159 Path path();
wei wei89ddc322015-03-22 16:29:04 -0500160}