Jian Li | fc55e42 | 2019-01-21 14:39:34 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2019-present Open Networking Foundation |
| 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.k8snetworking.api; |
| 17 | |
| 18 | import org.onlab.packet.IpAddress; |
| 19 | |
Jian Li | 9b19916 | 2019-02-10 18:00:35 +0900 | [diff] [blame] | 20 | import java.util.Set; |
| 21 | |
Jian Li | fc55e42 | 2019-01-21 14:39:34 +0900 | [diff] [blame] | 22 | /** |
| 23 | * IP Address Management admin service for kubernetes network. |
| 24 | */ |
| 25 | public interface K8sIpamAdminService extends K8sIpamService { |
| 26 | |
| 27 | /** |
| 28 | * Allocates a new IP address with the given network. |
| 29 | * |
| 30 | * @param networkId network identifier |
| 31 | * @return allocated IP address |
| 32 | */ |
| 33 | IpAddress allocateIp(String networkId); |
| 34 | |
| 35 | /** |
Jian Li | 9b19916 | 2019-02-10 18:00:35 +0900 | [diff] [blame] | 36 | * Releases the IP address from the given network. |
Jian Li | fc55e42 | 2019-01-21 14:39:34 +0900 | [diff] [blame] | 37 | * |
| 38 | * @param networkId network identifier |
Jian Li | 9b19916 | 2019-02-10 18:00:35 +0900 | [diff] [blame] | 39 | * @param ipAddress IP address |
| 40 | * @return true if the given IP was successfully released, false otherwise |
Jian Li | fc55e42 | 2019-01-21 14:39:34 +0900 | [diff] [blame] | 41 | */ |
Jian Li | 9b19916 | 2019-02-10 18:00:35 +0900 | [diff] [blame] | 42 | boolean releaseIp(String networkId, IpAddress ipAddress); |
| 43 | |
| 44 | /** |
| 45 | * Initializes IP address pool. |
| 46 | * |
| 47 | * @param networkId network identifier |
| 48 | * @param ipAddresses a set of IP addresses contained in this IP pool |
| 49 | */ |
| 50 | void initializeIpPool(String networkId, Set<IpAddress> ipAddresses); |
| 51 | |
| 52 | /** |
| 53 | * Purges the existing IP address pool of the given network identifier. |
| 54 | * |
| 55 | * @param networkId network identifier |
| 56 | */ |
| 57 | void purgeIpPool(String networkId); |
Jian Li | fc55e42 | 2019-01-21 14:39:34 +0900 | [diff] [blame] | 58 | } |