wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2015 Open Networking Laboratory |
| 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 | */ |
| 16 | package org.onosproject.net.tunnel; |
| 17 | |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 18 | import org.onosproject.core.DefaultGroupId; |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 19 | import org.onosproject.net.Annotated; |
| 20 | import org.onosproject.net.NetworkResource; |
| 21 | import org.onosproject.net.Provided; |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 22 | |
| 23 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 24 | * Abstraction of a generalized Tunnel entity (bandwidth pipe) for either L3/L2 |
| 25 | * networks or L1/L0 networks, representation of e.g., VLAN, GRE tunnel, MPLS |
| 26 | * LSP, L1 ODUk connection, WDM OCH, etc.. Each Tunnel is associated with at |
| 27 | * least two tunnel end point objects that model the logical ports essentially. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 28 | * Note that it supports nested case. |
| 29 | */ |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 30 | public interface Tunnel extends Annotated, Provided, NetworkResource { |
| 31 | |
| 32 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 33 | * Tunnel technology type. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 34 | */ |
Sho SHIMIZU | 3310a34 | 2015-05-13 12:14:05 -0700 | [diff] [blame] | 35 | enum Type { |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 36 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 37 | * Signifies that this is a MPLS tunnel. |
| 38 | */ |
| 39 | MPLS, |
| 40 | /** |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 41 | * Signifies that this is a L2 tunnel. |
| 42 | */ |
| 43 | VLAN, |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 44 | /** |
| 45 | * Signifies that this is a DC L2 extension tunnel. |
| 46 | */ |
| 47 | VXLAN, |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 48 | /** |
| 49 | * Signifies that this is a L3 tunnel. |
| 50 | */ |
| 51 | GRE, |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 52 | /** |
| 53 | * Signifies that this is a L1 OTN tunnel. |
| 54 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 55 | ODUK, |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 56 | /** |
| 57 | * Signifies that this is a L0 OCH tunnel. |
| 58 | */ |
| 59 | OCH |
| 60 | } |
| 61 | |
| 62 | /** |
| 63 | * Representation of the tunnel state. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 64 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 65 | public enum State { |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 66 | /** |
| 67 | * Signifies that a tunnel is currently in a initialized state. |
| 68 | */ |
| 69 | INIT, |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 70 | /** |
| 71 | * Signifies that a tunnel is currently established but no traffic. |
| 72 | */ |
| 73 | ESTABLISHED, |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 74 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 75 | * Signifies that a tunnel is currently active. This state means that |
| 76 | * this tunnel is available. It can be borrowed by consumer. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 77 | */ |
| 78 | ACTIVE, |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 79 | /** |
| 80 | * Signifies that a tunnel is currently out of service. |
| 81 | */ |
| 82 | FAILED, |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 83 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 84 | * Signifies that a tunnel is currently inactive. This state means that |
| 85 | * this tunnel can not be borrowed by consumer. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 86 | */ |
| 87 | INACTIVE |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 88 | } |
| 89 | |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 90 | /** |
| 91 | * Returns the tunnel state. |
| 92 | * |
| 93 | * @return tunnel state |
| 94 | */ |
| 95 | State state(); |
| 96 | |
| 97 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 98 | * the origin of a tunnel. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 99 | * |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 100 | * @return the origin of a tunnel |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 101 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 102 | TunnelEndPoint src(); |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 103 | |
| 104 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 105 | * the terminal of a tunnel. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 106 | * |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 107 | * @return the terminal of a tunnel |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 108 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 109 | TunnelEndPoint dst(); |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 110 | |
| 111 | /** |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 112 | * Returns the tunnel type. |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 113 | * |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 114 | * @return tunnel type |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 115 | */ |
jcc | 4a20a5f | 2015-04-30 15:43:39 +0800 | [diff] [blame] | 116 | Type type(); |
| 117 | |
| 118 | /** |
| 119 | * Returns group flow table id which a tunnel match up. |
| 120 | * |
| 121 | * @return OpenFlowGroupId |
| 122 | */ |
| 123 | DefaultGroupId groupId(); |
| 124 | |
| 125 | /** |
| 126 | * Returns tunnel identify generated by ONOS as primary key. |
| 127 | * |
| 128 | * @return TunnelId |
| 129 | */ |
| 130 | TunnelId tunnelId(); |
| 131 | |
| 132 | /** |
| 133 | * Return the name of a tunnel. |
| 134 | * |
| 135 | * @return Tunnel Name |
| 136 | */ |
| 137 | TunnelName tunnelName(); |
| 138 | |
| 139 | /** |
| 140 | * Network resource backing the tunnel, e.g. lambda, VLAN id, MPLS tag. |
| 141 | * |
| 142 | * @return backing resource |
| 143 | */ |
| 144 | NetworkResource resource(); |
| 145 | |
wei wei | 89ddc32 | 2015-03-22 16:29:04 -0500 | [diff] [blame] | 146 | } |