blob: fbca1b37c6fba29da8c911abdcd03d5f6fd41c4f [file] [log] [blame]
Jian Lifc55e422019-01-21 14:39:34 +09001/*
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 */
16package org.onosproject.k8snetworking.api;
17
18import org.onlab.packet.IpAddress;
19
Jian Li9b199162019-02-10 18:00:35 +090020import java.util.Set;
21
Jian Lifc55e422019-01-21 14:39:34 +090022/**
23 * IP Address Management admin service for kubernetes network.
24 */
25public 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 Li7970b712019-05-03 20:58:21 +090036 * Reserves an IP address with the given network.
37 *
38 * @param networkId network identifier
39 * @param ipAddress IP address
40 */
41 void reserveIp(String networkId, IpAddress ipAddress);
42
43 /**
Jian Li9b199162019-02-10 18:00:35 +090044 * Releases the IP address from the given network.
Jian Lifc55e422019-01-21 14:39:34 +090045 *
46 * @param networkId network identifier
Jian Li9b199162019-02-10 18:00:35 +090047 * @param ipAddress IP address
48 * @return true if the given IP was successfully released, false otherwise
Jian Lifc55e422019-01-21 14:39:34 +090049 */
Jian Li9b199162019-02-10 18:00:35 +090050 boolean releaseIp(String networkId, IpAddress ipAddress);
51
52 /**
53 * Initializes IP address pool.
54 *
55 * @param networkId network identifier
56 * @param ipAddresses a set of IP addresses contained in this IP pool
57 */
58 void initializeIpPool(String networkId, Set<IpAddress> ipAddresses);
59
60 /**
61 * Purges the existing IP address pool of the given network identifier.
62 *
63 * @param networkId network identifier
64 */
65 void purgeIpPool(String networkId);
Jian Lifc55e422019-01-21 14:39:34 +090066}