Phaneendra Manda | 1ea4914 | 2015-10-26 22:33:06 +0530 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame] | 2 | * Copyright 2015-present Open Networking Laboratory |
Phaneendra Manda | 1ea4914 | 2015-10-26 22:33:06 +0530 | [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.vtnrsc; |
| 17 | |
| 18 | import java.util.List; |
Phaneendra Manda | 329a127 | 2016-02-10 22:57:00 +0530 | [diff] [blame] | 19 | import java.util.Set; |
Phaneendra Manda | 1ea4914 | 2015-10-26 22:33:06 +0530 | [diff] [blame] | 20 | |
Phaneendra Manda | ab7fdfa | 2016-04-19 01:24:09 +0530 | [diff] [blame] | 21 | import org.onosproject.net.DeviceId; |
| 22 | |
Phaneendra Manda | 1ea4914 | 2015-10-26 22:33:06 +0530 | [diff] [blame] | 23 | /** |
| 24 | * Abstraction of an entity providing Port Chain information. |
| 25 | * A Port Chain (Service Function Path) consists of |
| 26 | * a set of Neutron ports, to define the sequence of service functions |
| 27 | * a set of flow classifiers, to specify the classified traffic flows to enter the chain |
| 28 | */ |
| 29 | public interface PortChain { |
| 30 | |
| 31 | /** |
| 32 | * Returns the ID of this port chain. |
| 33 | * |
| 34 | * @return the port chain id |
| 35 | */ |
| 36 | PortChainId portChainId(); |
| 37 | |
| 38 | /** |
| 39 | * Returns the tenant id of this port chain. |
| 40 | * |
| 41 | * @return the tenant id |
| 42 | */ |
| 43 | TenantId tenantId(); |
| 44 | |
| 45 | /** |
| 46 | * Returns the name of this port chain. |
| 47 | * |
| 48 | * @return name of port chain |
| 49 | */ |
| 50 | String name(); |
| 51 | |
| 52 | /** |
| 53 | * Returns the description of this port chain. |
| 54 | * |
| 55 | * @return description of port chain |
| 56 | */ |
| 57 | String description(); |
| 58 | |
| 59 | /** |
| 60 | * Returns the list of port pair groups associated with |
| 61 | * this port chain. |
| 62 | * |
| 63 | * @return list of port pair groups |
| 64 | */ |
| 65 | List<PortPairGroupId> portPairGroups(); |
| 66 | |
| 67 | /** |
| 68 | * Returns the list of flow classifiers associated with |
| 69 | * this port chain. |
| 70 | * |
| 71 | * @return list of flow classifiers |
| 72 | */ |
| 73 | List<FlowClassifierId> flowClassifiers(); |
| 74 | |
| 75 | /** |
Phaneendra Manda | 8db7d09 | 2016-06-04 00:17:24 +0530 | [diff] [blame^] | 76 | * Returns the old port chain. |
| 77 | * |
| 78 | * @return old port chain |
| 79 | */ |
| 80 | PortChain oldPortChain(); |
| 81 | |
| 82 | /** |
Phaneendra Manda | 329a127 | 2016-02-10 22:57:00 +0530 | [diff] [blame] | 83 | * Adds a new load balanced path. |
| 84 | * |
| 85 | * @param fiveTuple five tuple from the packet |
| 86 | * @param id load balance path identifier |
| 87 | * @param path load balanced path of list of port pairs |
| 88 | */ |
| 89 | void addLoadBalancePath(FiveTuple fiveTuple, LoadBalanceId id, |
| 90 | List<PortPairId> path); |
| 91 | |
| 92 | /** |
Phaneendra Manda | ab7fdfa | 2016-04-19 01:24:09 +0530 | [diff] [blame] | 93 | * Adds sfc classifiers to the given load balance id for a port chain. |
| 94 | * |
| 95 | * @param id load balance path identifier |
| 96 | * @param classifierList list of classifier devices |
| 97 | */ |
| 98 | void addSfcClassifiers(LoadBalanceId id, List<DeviceId> classifierList); |
| 99 | |
| 100 | /** |
| 101 | * Adds sfc forwarders to the given load balance id for a port chain. |
| 102 | * |
| 103 | * @param id load balance path identifier |
| 104 | * @param forwarderList list of forwarder devices |
| 105 | */ |
| 106 | void addSfcForwarders(LoadBalanceId id, List<DeviceId> forwarderList); |
| 107 | |
| 108 | /** |
| 109 | * Removes sfc classifiers to the given load balance id for a port chain. |
| 110 | * |
| 111 | * @param id load balance path identifier |
| 112 | * @param classifierList list of classifier devices |
| 113 | */ |
| 114 | void removeSfcClassifiers(LoadBalanceId id, List<DeviceId> classifierList); |
| 115 | |
| 116 | /** |
| 117 | * Removes sfc forwarders to the given load balance id for a port chain. |
| 118 | * |
| 119 | * @param id load balance path identifier |
| 120 | * @param forwarderList list of forwarder devices |
| 121 | */ |
| 122 | void removeSfcForwarders(LoadBalanceId id, List<DeviceId> forwarderList); |
| 123 | |
| 124 | /** |
| 125 | * Returns sfc classifiers to the given load balance id for a port chain. |
| 126 | * |
| 127 | * @param id load balance path identifier |
| 128 | * @return list of classifier devices |
| 129 | */ |
| 130 | List<DeviceId> getSfcClassifiers(LoadBalanceId id); |
| 131 | |
| 132 | /** |
| 133 | * Returns sfc forwarders to the given load balance id for a port chain. |
| 134 | * |
| 135 | * @param id load balance path identifier |
| 136 | * @return list of forwarder devices |
| 137 | */ |
| 138 | List<DeviceId> getSfcForwarders(LoadBalanceId id); |
| 139 | |
| 140 | /** |
| 141 | * Returns the load balance id from five tuple. |
Phaneendra Manda | 329a127 | 2016-02-10 22:57:00 +0530 | [diff] [blame] | 142 | * |
| 143 | * @param fiveTuple five tuple from the packet |
| 144 | * @return load balance identifier for the given packet |
| 145 | */ |
| 146 | LoadBalanceId getLoadBalanceId(FiveTuple fiveTuple); |
| 147 | |
| 148 | /** |
Phaneendra Manda | ab7fdfa | 2016-04-19 01:24:09 +0530 | [diff] [blame] | 149 | * Returns the keys set from load balance id map. |
Phaneendra Manda | 329a127 | 2016-02-10 22:57:00 +0530 | [diff] [blame] | 150 | * |
| 151 | * @return set of five tuple info |
| 152 | */ |
| 153 | Set<FiveTuple> getLoadBalanceIdMapKeys(); |
| 154 | |
| 155 | /** |
Phaneendra Manda | ab7fdfa | 2016-04-19 01:24:09 +0530 | [diff] [blame] | 156 | * Returns the keys set from load balance path map. |
| 157 | * |
| 158 | * @return set of load balance id's |
| 159 | */ |
| 160 | Set<LoadBalanceId> getLoadBalancePathMapKeys(); |
| 161 | |
| 162 | /** |
| 163 | * Returns the load balanced path from load balance Id. |
Phaneendra Manda | 329a127 | 2016-02-10 22:57:00 +0530 | [diff] [blame] | 164 | * |
| 165 | * @param id load balance id. |
| 166 | * @return path containing list of port pairs |
| 167 | */ |
| 168 | List<PortPairId> getLoadBalancePath(LoadBalanceId id); |
| 169 | |
| 170 | /** |
Phaneendra Manda | ab7fdfa | 2016-04-19 01:24:09 +0530 | [diff] [blame] | 171 | * Returns the load balanced path from five tuple. |
Phaneendra Manda | 329a127 | 2016-02-10 22:57:00 +0530 | [diff] [blame] | 172 | * |
| 173 | * @param fiveTuple five tuple from the packet |
| 174 | * @return path containing list of port pairs |
| 175 | */ |
| 176 | List<PortPairId> getLoadBalancePath(FiveTuple fiveTuple); |
| 177 | |
| 178 | /** |
Phaneendra Manda | ab7fdfa | 2016-04-19 01:24:09 +0530 | [diff] [blame] | 179 | * Returns the no of load balance paths created. |
Phaneendra Manda | 275ff0c | 2016-02-25 11:50:24 +0530 | [diff] [blame] | 180 | * |
| 181 | * @return size of load balanced paths |
| 182 | */ |
| 183 | int getLoadBalancePathSize(); |
| 184 | |
| 185 | /** |
Phaneendra Manda | 329a127 | 2016-02-10 22:57:00 +0530 | [diff] [blame] | 186 | * Match the given path with existing load balanced paths. |
| 187 | * |
| 188 | * @param path load balanced path |
| 189 | * @return load balance id if the path matches, null otherwise. |
| 190 | */ |
Phaneendra Manda | 8db7d09 | 2016-06-04 00:17:24 +0530 | [diff] [blame^] | 191 | LoadBalanceId matchPath(List<PortPairId> path); |
Phaneendra Manda | 329a127 | 2016-02-10 22:57:00 +0530 | [diff] [blame] | 192 | |
| 193 | /** |
Phaneendra Manda | 1ea4914 | 2015-10-26 22:33:06 +0530 | [diff] [blame] | 194 | * Returns whether this port chain is an exact match to the port chain given |
| 195 | * in the argument. |
| 196 | * <p> |
| 197 | * Exact match means the port pair groups and flow classifiers match |
| 198 | * with the given port chain. It does not consider the port chain id, name |
| 199 | * and description. |
| 200 | * </p> |
| 201 | * |
| 202 | * @param portChain other port chain to match against |
| 203 | * @return true if the port chains are an exact match, otherwise false |
| 204 | */ |
| 205 | boolean exactMatch(PortChain portChain); |
| 206 | |
| 207 | /** |
| 208 | * A port chain builder.. |
| 209 | */ |
| 210 | interface Builder { |
| 211 | |
| 212 | /** |
| 213 | * Assigns the port chain id to this object. |
| 214 | * |
| 215 | * @param portChainId the port chain id |
| 216 | * @return this the builder object |
| 217 | */ |
| 218 | Builder setId(PortChainId portChainId); |
| 219 | |
| 220 | /** |
| 221 | * Assigns tenant id to this object. |
| 222 | * |
| 223 | * @param tenantId tenant id of the port chain |
| 224 | * @return this the builder object |
| 225 | */ |
| 226 | Builder setTenantId(TenantId tenantId); |
| 227 | |
| 228 | /** |
| 229 | * Assigns the name to this object. |
| 230 | * |
| 231 | * @param name name of the port chain |
| 232 | * @return this the builder object |
| 233 | */ |
| 234 | Builder setName(String name); |
| 235 | |
| 236 | /** |
| 237 | * Assigns the description to this object. |
| 238 | * |
| 239 | * @param description description of the port chain |
| 240 | * @return this the builder object |
| 241 | */ |
| 242 | Builder setDescription(String description); |
| 243 | |
| 244 | /** |
| 245 | * Assigns the port pair groups associated with the port chain |
| 246 | * to this object. |
| 247 | * |
| 248 | * @param portPairGroups list of port pair groups |
| 249 | * @return this the builder object |
| 250 | */ |
| 251 | Builder setPortPairGroups(List<PortPairGroupId> portPairGroups); |
| 252 | |
| 253 | /** |
| 254 | * Assigns the flow classifiers associated with the port chain |
| 255 | * to this object. |
| 256 | * |
| 257 | * @param flowClassifiers list of flow classifiers |
| 258 | * @return this the builder object |
| 259 | */ |
| 260 | Builder setFlowClassifiers(List<FlowClassifierId> flowClassifiers); |
| 261 | |
| 262 | /** |
| 263 | * Builds a port chain object. |
| 264 | * |
| 265 | * @return a port chain. |
| 266 | */ |
| 267 | PortChain build(); |
| 268 | } |
| 269 | } |