blob: 4a66e269ebaaa54e6d372b4bf8226464b03927d0 [file] [log] [blame]
Jian Lie2a04ce2020-07-01 19:07:02 +09001/*
2 * Copyright 2020-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.k8snode.api;
17
18import org.onlab.packet.IpAddress;
19import org.onlab.packet.IpPrefix;
20
21import java.util.Set;
22
23/**
24 * A service manages external network objects including IP addresses.
25 */
26public interface ExternalNetworkService {
27
28 /**
29 * Registers an external network.
30 *
31 * @param cidr network CIDR
32 */
33 void registerNetwork(IpPrefix cidr);
34
35 /**
36 * Unregisters an existing external network.
37 *
38 * @param cidr network CIDR
39 */
40 void unregisterNetwork(IpPrefix cidr);
41
42 /**
43 * Obtains a gateway IP address of the given network CIDR.
44 *
45 * @param cidr network CIDR
46 * @return a gateway IP address
47 */
48 IpAddress getGatewayIp(IpPrefix cidr);
49
50 /**
51 * Obtains an allocated IP address of the given network CIDR.
52 *
53 * @param cidr network CIDR
54 * @return an IP address exists in the given network CIDR IP pool
55 */
56 IpAddress allocateIp(IpPrefix cidr);
57
58 /**
59 * Releases the given IP address to the given network CIDR.
60 *
61 * @param cidr network CIDR
62 * @param ip IP address to be released
63 */
64 void releaseIp(IpPrefix cidr, IpAddress ip);
65
66 /**
67 * Obtains all IP addresses of the given network CIDR.
68 *
69 * @param cidr network CIDR
70 * @return all IP addresses
71 */
72 Set<String> getAllIps(IpPrefix cidr);
73}