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