samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | a09fe5b | 2017-08-03 21:12:30 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Foundation |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [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 | */ |
| 16 | package org.onosproject.net.behaviour; |
| 17 | |
| 18 | import org.onosproject.net.Annotated; |
| 19 | import org.onosproject.net.Description; |
| 20 | |
| 21 | import com.google.common.annotations.Beta; |
Hyunsun Moon | dd14e8e | 2016-06-09 16:17:32 -0700 | [diff] [blame] | 22 | import org.onosproject.net.SparseAnnotations; |
| 23 | |
| 24 | import java.util.Optional; |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 25 | |
| 26 | /** |
Hyunsun Moon | dd14e8e | 2016-06-09 16:17:32 -0700 | [diff] [blame] | 27 | * Describes a tunnel interface. |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 28 | */ |
| 29 | @Beta |
| 30 | public interface TunnelDescription extends Description, Annotated { |
| 31 | |
| 32 | /** |
| 33 | * Tunnel technology type. |
| 34 | */ |
| 35 | enum Type { |
| 36 | /** |
| 37 | * Signifies that this is a MPLS tunnel. |
| 38 | */ |
| 39 | MPLS, |
| 40 | /** |
| 41 | * Signifies that this is a L2 tunnel. |
| 42 | */ |
| 43 | VLAN, |
| 44 | /** |
| 45 | * Signifies that this is a DC L2 extension tunnel. |
| 46 | */ |
| 47 | VXLAN, |
| 48 | /** |
| 49 | * Signifies that this is a L3 tunnel. |
| 50 | */ |
| 51 | GRE, |
| 52 | /** |
Jian Li | 654204c | 2018-12-16 01:56:31 +0900 | [diff] [blame] | 53 | * Signifies that this is a L3 tunnel. |
| 54 | */ |
| 55 | GENEVE, |
| 56 | /** |
Jian Li | 4b3436a | 2022-03-23 13:07:19 +0900 | [diff] [blame^] | 57 | * Signifies that this is a L3 tunnel. |
| 58 | */ |
| 59 | STT, |
| 60 | /** |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 61 | * Signifies that this is a L1 OTN tunnel. |
| 62 | */ |
| 63 | ODUK, |
| 64 | /** |
| 65 | * Signifies that this is a L0 OCH tunnel. |
| 66 | */ |
| 67 | OCH |
| 68 | } |
| 69 | |
| 70 | /** |
Hyunsun Moon | dd14e8e | 2016-06-09 16:17:32 -0700 | [diff] [blame] | 71 | * Returns the identifier of the device where the interface is. |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 72 | * |
Hyunsun Moon | dd14e8e | 2016-06-09 16:17:32 -0700 | [diff] [blame] | 73 | * @return device identifier |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 74 | */ |
Hyunsun Moon | dd14e8e | 2016-06-09 16:17:32 -0700 | [diff] [blame] | 75 | Optional<String> deviceId(); |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 76 | |
| 77 | /** |
Hyunsun Moon | dd14e8e | 2016-06-09 16:17:32 -0700 | [diff] [blame] | 78 | * Return the name of the tunnel interface. |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 79 | * |
Hyunsun Moon | dd14e8e | 2016-06-09 16:17:32 -0700 | [diff] [blame] | 80 | * @return tunnel interface name |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 81 | */ |
Hyunsun Moon | dd14e8e | 2016-06-09 16:17:32 -0700 | [diff] [blame] | 82 | String ifaceName(); |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 83 | |
| 84 | /** |
| 85 | * Returns the tunnel type. |
| 86 | * |
| 87 | * @return tunnel type |
| 88 | */ |
| 89 | Type type(); |
| 90 | |
| 91 | /** |
Hyunsun Moon | dd14e8e | 2016-06-09 16:17:32 -0700 | [diff] [blame] | 92 | * Returns the local connection point. |
| 93 | * |
| 94 | * @return tunnel source ConnectionPoint |
| 95 | */ |
| 96 | Optional<TunnelEndPoint> local(); |
| 97 | |
| 98 | /** |
| 99 | * Returns the remote connection point. |
| 100 | * |
| 101 | * @return tunnel destination |
| 102 | */ |
| 103 | Optional<TunnelEndPoint> remote(); |
| 104 | |
| 105 | /** |
| 106 | * Returns the tunnel key. |
| 107 | * |
| 108 | * @return tunnel key |
| 109 | */ |
| 110 | Optional<TunnelKey> key(); |
| 111 | |
| 112 | /** |
Hyunsun Moon | dd14e8e | 2016-06-09 16:17:32 -0700 | [diff] [blame] | 113 | * Builder of tunnel interface description entities. |
| 114 | */ |
| 115 | interface Builder { |
| 116 | |
| 117 | /** |
| 118 | * Returns new tunnel interface description. |
| 119 | * |
| 120 | * @return tunnel description |
| 121 | */ |
| 122 | TunnelDescription build(); |
| 123 | |
| 124 | /** |
| 125 | * Returns tunnel interface description biulder with supplied device ID. |
| 126 | * |
| 127 | * @param deviceId device identifier |
| 128 | * @return tunnel description builder |
| 129 | */ |
| 130 | Builder deviceId(String deviceId); |
| 131 | |
| 132 | /** |
| 133 | * Returns tunnel interface description builder with a given interface name. |
| 134 | * |
| 135 | * @param name tunnel interface name |
| 136 | * @return tunnel description builder |
| 137 | */ |
| 138 | Builder ifaceName(String name); |
| 139 | |
| 140 | /** |
| 141 | * Returns tunnel interface description builder with a given tunnel type. |
| 142 | * |
| 143 | * @param type tunnel type |
| 144 | * @return tunnel description builder |
| 145 | */ |
| 146 | Builder type(Type type); |
| 147 | |
| 148 | /** |
| 149 | * Returns tunnel interface description builder with a given local |
| 150 | * tunnel endpoint. |
| 151 | * |
| 152 | * @param endpoint tunnel endpoint |
| 153 | * @return tunnel description builder |
| 154 | */ |
| 155 | Builder local(TunnelEndPoint endpoint); |
| 156 | |
| 157 | /** |
| 158 | * Returns tunnel interface description builder with a given remote |
| 159 | * tunnel endpoint. |
| 160 | * |
| 161 | * @param endpoint tunnel endpoint |
| 162 | * @return tunnel description builder |
| 163 | */ |
| 164 | Builder remote(TunnelEndPoint endpoint); |
| 165 | |
| 166 | /** |
| 167 | * Returns tunnel interface description builder with a tunnel key. |
| 168 | * |
Ray Milkey | bb23e0b | 2016-08-02 17:00:21 -0700 | [diff] [blame] | 169 | * @param tunnelKey tunnel key |
Hyunsun Moon | dd14e8e | 2016-06-09 16:17:32 -0700 | [diff] [blame] | 170 | * @return tunnel description builder |
| 171 | */ |
| 172 | Builder key(TunnelKey tunnelKey); |
| 173 | |
| 174 | /** |
| 175 | * Returns tunnel interface descriptions builder with other configurations. |
| 176 | * |
| 177 | * @param configs configurations |
| 178 | * @return tunnel description builder |
| 179 | */ |
| 180 | Builder otherConfigs(SparseAnnotations configs); |
| 181 | } |
samuel | 8d6b0a9 | 2015-07-11 13:22:57 +0800 | [diff] [blame] | 182 | } |