jiangrui | e3d60b1 | 2015-11-25 16:27:04 +0800 | [diff] [blame] | 1 | /* |
Brian O'Connor | 5ab426f | 2016-04-09 01:19:45 -0700 | [diff] [blame^] | 2 | * Copyright 2015-present Open Networking Laboratory |
jiangrui | e3d60b1 | 2015-11-25 16:27:04 +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.vtnrsc.floatingip; |
| 17 | |
| 18 | import java.util.Collection; |
| 19 | |
| 20 | import org.onlab.packet.IpAddress; |
| 21 | import org.onosproject.vtnrsc.FloatingIp; |
| 22 | import org.onosproject.vtnrsc.FloatingIpId; |
| 23 | import org.onosproject.vtnrsc.TenantId; |
| 24 | |
| 25 | /** |
| 26 | * Service for interacting with the inventory of floating IP. |
| 27 | */ |
| 28 | public interface FloatingIpService { |
| 29 | /** |
| 30 | * Returns exists or not of specific floatingIp identifier. |
| 31 | * |
| 32 | * @param floatingIpId floatingIp identifier |
| 33 | * @return true or false |
| 34 | */ |
| 35 | boolean exists(FloatingIpId floatingIpId); |
| 36 | |
| 37 | /** |
| 38 | * Returns is used or not of specific floating IP address. |
| 39 | * |
| 40 | * @param floatingIpAddr floatingIp address |
| 41 | * @param floatingIpId floatingIp identifier |
| 42 | * @return true or false |
| 43 | */ |
| 44 | boolean floatingIpIsUsed(IpAddress floatingIpAddr, FloatingIpId floatingIpId); |
| 45 | |
| 46 | /** |
| 47 | * Returns is used or not of specific fixed IP address. |
| 48 | * |
| 49 | * @param fixedIpAddr fixedIp address |
| 50 | * @param tenantId the tenant identifier of floating IP |
| 51 | * @param floatingIpId floatingIp identifier |
| 52 | * @return true or false |
| 53 | */ |
| 54 | boolean fixedIpIsUsed(IpAddress fixedIpAddr, TenantId tenantId, FloatingIpId floatingIpId); |
| 55 | |
| 56 | /** |
| 57 | * Returns a collection of the currently known floating IP. |
| 58 | * |
| 59 | * @return collection of floating IP |
| 60 | */ |
| 61 | Collection<FloatingIp> getFloatingIps(); |
| 62 | |
| 63 | /** |
| 64 | * Returns the floatingIp with the specified identifier. |
| 65 | * |
| 66 | * @param floatingIpId floatingIp identifier |
| 67 | * @return floatingIp or null if one with the given identifier is not known |
| 68 | */ |
| 69 | FloatingIp getFloatingIp(FloatingIpId floatingIpId); |
| 70 | |
| 71 | /** |
| 72 | * Creates new floatingIps. |
| 73 | * |
| 74 | * @param floatingIps the collection of floatingIp |
| 75 | * @return true if the identifier floatingIp has been created right |
| 76 | */ |
| 77 | boolean createFloatingIps(Collection<FloatingIp> floatingIps); |
| 78 | |
| 79 | /** |
| 80 | * Updates existing floatingIps. |
| 81 | * |
| 82 | * @param floatingIps the collection of floatingIp |
| 83 | * @return true if all floatingIp were updated successfully |
| 84 | */ |
| 85 | boolean updateFloatingIps(Collection<FloatingIp> floatingIps); |
| 86 | |
| 87 | /** |
| 88 | * Removes the specified floatingIp from the store. |
| 89 | * |
| 90 | * @param floatingIpIds the collection of floatingIp identifier |
| 91 | * @return true if remove identifier floatingIp successfully |
| 92 | */ |
| 93 | boolean removeFloatingIps(Collection<FloatingIpId> floatingIpIds); |
| 94 | |
| 95 | /** |
| 96 | * Adds the specified listener to floating Ip manager. |
| 97 | * |
| 98 | * @param listener floating Ip listener |
| 99 | */ |
| 100 | void addListener(FloatingIpListener listener); |
| 101 | |
| 102 | /** |
| 103 | * Removes the specified listener to floating Ip manager. |
| 104 | * |
| 105 | * @param listener floating Ip listener |
| 106 | */ |
| 107 | void removeListener(FloatingIpListener listener); |
| 108 | } |