blob: 5a8875681e931b8df19e2fcc454698f35e838d55 [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
Jian Lifc55e422019-01-21 14:39:34 +090018import org.onosproject.store.Store;
19
20import java.util.Set;
21
22/**
23 * Manages inventory of instance IPAM; not intended for direct use.
24 */
25public interface K8sIpamStore extends Store<K8sIpamEvent, K8sIpamStoreDelegate> {
26
27 /**
Jian Li9b199162019-02-10 18:00:35 +090028 * Creates a new allocated IP address.
Jian Lifc55e422019-01-21 14:39:34 +090029 *
Jian Li9b199162019-02-10 18:00:35 +090030 * @param ipam IPAM instance
Jian Lifc55e422019-01-21 14:39:34 +090031 */
Jian Li9b199162019-02-10 18:00:35 +090032 void createAllocatedIp(K8sIpam ipam);
Jian Lifc55e422019-01-21 14:39:34 +090033
34 /**
Jian Li9b199162019-02-10 18:00:35 +090035 * Updates the existing allocated IP address.
Jian Lifc55e422019-01-21 14:39:34 +090036 *
Jian Li9b199162019-02-10 18:00:35 +090037 * @param ipam IPAM instance
Jian Lifc55e422019-01-21 14:39:34 +090038 */
Jian Li9b199162019-02-10 18:00:35 +090039 void updateAllocatedIp(K8sIpam ipam);
Jian Lifc55e422019-01-21 14:39:34 +090040
41 /**
Jian Li9b199162019-02-10 18:00:35 +090042 * Removes the existing allocated IP address.
Jian Lifc55e422019-01-21 14:39:34 +090043 *
Jian Li9b199162019-02-10 18:00:35 +090044 * @param ipamId IPAM identifier
45 * @return removed IPAM instance; null if failed
Jian Lifc55e422019-01-21 14:39:34 +090046 */
Jian Li9b199162019-02-10 18:00:35 +090047 K8sIpam removeAllocatedIp(String ipamId);
Jian Lifc55e422019-01-21 14:39:34 +090048
49 /**
Jian Li9b199162019-02-10 18:00:35 +090050 * Returns the IPAM with the given IPAM identifier.
Jian Lifc55e422019-01-21 14:39:34 +090051 *
Jian Li9b199162019-02-10 18:00:35 +090052 * @param ipamId IPAM identifier
53 * @return IPAM; null it not found
Jian Lifc55e422019-01-21 14:39:34 +090054 */
Jian Li9b199162019-02-10 18:00:35 +090055 K8sIpam allocatedIp(String ipamId);
Jian Lifc55e422019-01-21 14:39:34 +090056
57 /**
Jian Li9b199162019-02-10 18:00:35 +090058 * Returns all allocated IPAM instances.
Jian Lifc55e422019-01-21 14:39:34 +090059 *
Jian Li9b199162019-02-10 18:00:35 +090060 * @return set of IPAM instances
Jian Lifc55e422019-01-21 14:39:34 +090061 */
Jian Li9b199162019-02-10 18:00:35 +090062 Set<K8sIpam> allocatedIps();
Jian Lifc55e422019-01-21 14:39:34 +090063
64 /**
Jian Li9b199162019-02-10 18:00:35 +090065 * Creates a new available IP address.
66 *
67 * @param ipam IPAM instance
68 */
69 void createAvailableIp(K8sIpam ipam);
70
71 /**
72 * Updates the existing available IP address.
73 *
74 * @param ipam IPAM instance
75 */
76 void updateAvailableIp(K8sIpam ipam);
77
78 /**
79 * Removes the existing available IP address.
80 *
81 * @param ipamId IPAM identifier
82 * @return remved IPAM instance; null if failed
83 */
84 K8sIpam removeAvailableIp(String ipamId);
85
86 /**
87 * Returns the IPAM with the given IPAM identifier.
88 *
89 * @param ipamId IPAM identifier
90 * @return IPAM; null it not found
91 */
92 K8sIpam availableIp(String ipamId);
93
94 /**
95 * Returns all available IPAM instances.
96 *
97 * @return set of IPAM instances
98 */
99 Set<K8sIpam> availableIps();
100
101 /**
102 * Clears all allocated and available IP addresses.
103 */
104 void clear();
105
106 /**
107 * Clears allocated and available IP addresses associated with the given network.
Jian Lifc55e422019-01-21 14:39:34 +0900108 *
109 * @param networkId network identifier
Jian Lifc55e422019-01-21 14:39:34 +0900110 */
Jian Li9b199162019-02-10 18:00:35 +0900111 void clear(String networkId);
Jian Lifc55e422019-01-21 14:39:34 +0900112}