wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 3 | * |
| 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 Vachuska | bf916ea | 2015-05-20 18:24:34 -0700 | [diff] [blame] | 16 | package org.onosproject.incubator.net.tunnel; |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 17 | |
Brian O'Connor | 2bed5ce | 2015-06-25 15:10:28 -0400 | [diff] [blame] | 18 | import com.google.common.annotations.Beta; |
Yi Tseng | fa394de | 2017-02-01 11:26:40 -0800 | [diff] [blame] | 19 | import org.onosproject.core.GroupId; |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 20 | import org.onosproject.net.Annotated; |
| 21 | import org.onosproject.net.NetworkResource; |
samuel | 7a5691a | 2015-05-23 00:36:32 +0800 | [diff] [blame] | 22 | import org.onosproject.net.Path; |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 23 | import org.onosproject.net.Provided; |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 24 | |
| 25 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 26 | * 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 wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 30 | * Note that it supports nested case. |
| 31 | */ |
Brian O'Connor | 2bed5ce | 2015-06-25 15:10:28 -0400 | [diff] [blame] | 32 | @Beta |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 33 | public interface Tunnel extends Annotated, Provided, NetworkResource { |
| 34 | |
| 35 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 36 | * Tunnel technology type. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 37 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 38 | enum Type { |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 39 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 40 | * Signifies that this is a MPLS tunnel. |
| 41 | */ |
| 42 | MPLS, |
| 43 | /** |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 44 | * Signifies that this is a L2 tunnel. |
| 45 | */ |
| 46 | VLAN, |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 47 | /** |
| 48 | * Signifies that this is a DC L2 extension tunnel. |
| 49 | */ |
| 50 | VXLAN, |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 51 | /** |
| 52 | * Signifies that this is a L3 tunnel. |
| 53 | */ |
| 54 | GRE, |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 55 | /** |
| 56 | * Signifies that this is a L1 OTN tunnel. |
| 57 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 58 | ODUK, |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 59 | /** |
| 60 | * Signifies that this is a L0 OCH tunnel. |
| 61 | */ |
| 62 | OCH |
| 63 | } |
| 64 | |
| 65 | /** |
| 66 | * Representation of the tunnel state. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 67 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 68 | public enum State { |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 69 | /** |
| 70 | * Signifies that a tunnel is currently in a initialized state. |
| 71 | */ |
| 72 | INIT, |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 73 | /** |
| 74 | * Signifies that a tunnel is currently established but no traffic. |
| 75 | */ |
| 76 | ESTABLISHED, |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 77 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 78 | * Signifies that a tunnel is currently active. This state means that |
| 79 | * this tunnel is available. It can be borrowed by consumer. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 80 | */ |
| 81 | ACTIVE, |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 82 | /** |
| 83 | * Signifies that a tunnel is currently out of service. |
| 84 | */ |
| 85 | FAILED, |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 86 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 87 | * Signifies that a tunnel is currently inactive. This state means that |
| 88 | * this tunnel can not be borrowed by consumer. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 89 | */ |
Avantika-Huawei | e75edbf | 2016-05-11 17:02:47 +0530 | [diff] [blame] | 90 | INACTIVE, |
| 91 | |
| 92 | /** |
| 93 | * Signifies that the tunnel's state is unreliable and should be setup again. |
| 94 | */ |
tony-liu | 684b2b8 | 2016-09-20 16:19:30 +0800 | [diff] [blame] | 95 | 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 wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 106 | } |
| 107 | |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 108 | /** |
| 109 | * Returns the tunnel state. |
| 110 | * |
| 111 | * @return tunnel state |
| 112 | */ |
| 113 | State state(); |
| 114 | |
| 115 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 116 | * the origin of a tunnel. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 117 | * |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 118 | * @return the origin of a tunnel |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 119 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 120 | TunnelEndPoint src(); |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 121 | |
| 122 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 123 | * the terminal of a tunnel. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 124 | * |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 125 | * @return the terminal of a tunnel |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 126 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 127 | TunnelEndPoint dst(); |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 128 | |
| 129 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 130 | * Returns the tunnel type. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 131 | * |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 132 | * @return tunnel type |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 133 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 134 | Type type(); |
| 135 | |
| 136 | /** |
| 137 | * Returns group flow table id which a tunnel match up. |
| 138 | * |
| 139 | * @return OpenFlowGroupId |
| 140 | */ |
Yi Tseng | fa394de | 2017-02-01 11:26:40 -0800 | [diff] [blame] | 141 | GroupId groupId(); |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 142 | |
| 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 | |
samuel | 7a5691a | 2015-05-23 00:36:32 +0800 | [diff] [blame] | 164 | /** |
| 165 | * Returns the path of the tunnel. |
| 166 | * |
| 167 | * @return the path of the tunnel |
| 168 | */ |
| 169 | Path path(); |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 170 | } |