blob: 21b0741ede1f0674b8ab7bb066409672886b20ea [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 */
90 INACTIVE
wei wei89ddc322015-03-22 16:29:04 -050091 }
92
wei wei89ddc322015-03-22 16:29:04 -050093 /**
94 * Returns the tunnel state.
95 *
96 * @return tunnel state
97 */
98 State state();
99
100 /**
jcc4a20a5f2015-04-30 15:43:39 +0800101 * the origin of a tunnel.
wei wei89ddc322015-03-22 16:29:04 -0500102 *
jcc4a20a5f2015-04-30 15:43:39 +0800103 * @return the origin of a tunnel
wei wei89ddc322015-03-22 16:29:04 -0500104 */
jcc4a20a5f2015-04-30 15:43:39 +0800105 TunnelEndPoint src();
wei wei89ddc322015-03-22 16:29:04 -0500106
107 /**
jcc4a20a5f2015-04-30 15:43:39 +0800108 * the terminal of a tunnel.
wei wei89ddc322015-03-22 16:29:04 -0500109 *
jcc4a20a5f2015-04-30 15:43:39 +0800110 * @return the terminal of a tunnel
wei wei89ddc322015-03-22 16:29:04 -0500111 */
jcc4a20a5f2015-04-30 15:43:39 +0800112 TunnelEndPoint dst();
wei wei89ddc322015-03-22 16:29:04 -0500113
114 /**
jcc4a20a5f2015-04-30 15:43:39 +0800115 * Returns the tunnel type.
wei wei89ddc322015-03-22 16:29:04 -0500116 *
jcc4a20a5f2015-04-30 15:43:39 +0800117 * @return tunnel type
wei wei89ddc322015-03-22 16:29:04 -0500118 */
jcc4a20a5f2015-04-30 15:43:39 +0800119 Type type();
120
121 /**
122 * Returns group flow table id which a tunnel match up.
123 *
124 * @return OpenFlowGroupId
125 */
126 DefaultGroupId groupId();
127
128 /**
129 * Returns tunnel identify generated by ONOS as primary key.
130 *
131 * @return TunnelId
132 */
133 TunnelId tunnelId();
134
135 /**
136 * Return the name of a tunnel.
137 *
138 * @return Tunnel Name
139 */
140 TunnelName tunnelName();
141
142 /**
143 * Network resource backing the tunnel, e.g. lambda, VLAN id, MPLS tag.
144 *
145 * @return backing resource
146 */
147 NetworkResource resource();
148
samuel7a5691a2015-05-23 00:36:32 +0800149 /**
150 * Returns the path of the tunnel.
151 *
152 * @return the path of the tunnel
153 */
154 Path path();
wei wei89ddc322015-03-22 16:29:04 -0500155}