blob: d8752f826bce1079bbb30c833cdf19784ee95b13 [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 Li9b199162019-02-10 18:00:35 +090036 * Releases the IP address from the given network.
Jian Lifc55e422019-01-21 14:39:34 +090037 *
38 * @param networkId network identifier
Jian Li9b199162019-02-10 18:00:35 +090039 * @param ipAddress IP address
40 * @return true if the given IP was successfully released, false otherwise
Jian Lifc55e422019-01-21 14:39:34 +090041 */
Jian Li9b199162019-02-10 18:00:35 +090042 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 Lifc55e422019-01-21 14:39:34 +090058}