blob: da9364d2bb570c473a247e9638ebe4a6f650bafc [file] [log] [blame]
Jian Li38e4d942018-07-03 22:19:16 +09001/*
2 * Copyright 2018-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.openstackvtap.api;
17
18import org.onosproject.net.DeviceId;
19import org.onosproject.store.Store;
20
21import java.util.Set;
22
23/**
Jimo Jung14e87bf2018-09-03 16:28:13 +090024 * Manages inventory of openstack vtap datum; not intended for direct use.
Jian Li38e4d942018-07-03 22:19:16 +090025 */
26public interface OpenstackVtapStore
27 extends Store<OpenstackVtapEvent, OpenstackVtapStoreDelegate> {
28
29 /**
Jimo Jung14e87bf2018-09-03 16:28:13 +090030 * Creates a new openstack vtap network based on the specified description.
Jian Li38e4d942018-07-03 22:19:16 +090031 *
Jimo Jung14e87bf2018-09-03 16:28:13 +090032 * @param key vtap network identifier
33 * @param description description of vtap network
34 * @return created openstack vtap network object or null if error occurred
Jian Li38e4d942018-07-03 22:19:16 +090035 */
Jimo Jung14e87bf2018-09-03 16:28:13 +090036 OpenstackVtapNetwork createVtapNetwork(Integer key, OpenstackVtapNetwork description);
Jian Li38e4d942018-07-03 22:19:16 +090037
38 /**
Jimo Jung14e87bf2018-09-03 16:28:13 +090039 * Updates the openstack vtap network based on the specified description.
Jian Li38e4d942018-07-03 22:19:16 +090040 *
Jimo Jung14e87bf2018-09-03 16:28:13 +090041 * @param key vtap network identifier
42 * @param description description of vtap network
43 * @return updated openstack vtap network object or null if error occurred
Jian Li38e4d942018-07-03 22:19:16 +090044 */
Jimo Jung14e87bf2018-09-03 16:28:13 +090045 OpenstackVtapNetwork updateVtapNetwork(Integer key, OpenstackVtapNetwork description);
Jian Li38e4d942018-07-03 22:19:16 +090046
47 /**
Jimo Jung14e87bf2018-09-03 16:28:13 +090048 * Removes the specified openstack vtap network with the specified identifier.
Jian Li38e4d942018-07-03 22:19:16 +090049 *
Jimo Jung14e87bf2018-09-03 16:28:13 +090050 * @param key vtap network identifier
51 * @return removed openstack vtap network object or null if error occurred
52 */
53 OpenstackVtapNetwork removeVtapNetwork(Integer key);
54
55 /**
56 * Removes all openstack vtap networks.
57 */
58 void clearVtapNetworks();
59
60 /**
61 * Returns the number of openstack vtap networks.
62 *
63 * @return number of openstack vtap networks
64 */
65 int getVtapNetworkCount();
66
67 /**
68 * Returns the openstack vtap network with the specified identifier.
69 *
70 * @param key vtap network identifier
71 * @return openstack vtap or null if one with the given identifier is not known
72 */
73 OpenstackVtapNetwork getVtapNetwork(Integer key);
74
75 /**
76 * Adds the specified device id to the specified vtap network entry.
77 *
78 * @param key vtap network identifier
79 * @param deviceId device identifier to be added
Jian Li38e4d942018-07-03 22:19:16 +090080 * @return true on success, false otherwise
81 */
Jimo Jung14e87bf2018-09-03 16:28:13 +090082 boolean addDeviceToVtapNetwork(Integer key, DeviceId deviceId);
Jian Li38e4d942018-07-03 22:19:16 +090083
84 /**
Jimo Jung14e87bf2018-09-03 16:28:13 +090085 * Removes the specified device id from the specified vtap network entry.
Jian Li38e4d942018-07-03 22:19:16 +090086 *
Jimo Jung14e87bf2018-09-03 16:28:13 +090087 * @param key vtap network identifier
88 * @param deviceId device identifier to be removed
Jian Li38e4d942018-07-03 22:19:16 +090089 * @return true on success, false otherwise
90 */
Jimo Jung14e87bf2018-09-03 16:28:13 +090091 boolean removeDeviceFromVtapNetwork(Integer key, DeviceId deviceId);
Jian Li38e4d942018-07-03 22:19:16 +090092
93 /**
Jimo Jung14e87bf2018-09-03 16:28:13 +090094 * Returns a set of device identifiers from the specified vtap network entry.
Jian Li38e4d942018-07-03 22:19:16 +090095 *
Jimo Jung14e87bf2018-09-03 16:28:13 +090096 * @param key vtap network identifier
97 * @return set of device identifier
Jian Li38e4d942018-07-03 22:19:16 +090098 */
Jimo Jung14e87bf2018-09-03 16:28:13 +090099 Set<DeviceId> getVtapNetworkDevices(Integer key);
Jian Li38e4d942018-07-03 22:19:16 +0900100
101 /**
Jimo Jung14e87bf2018-09-03 16:28:13 +0900102 * Creates a new openstack vtap based on the specified description.
Jian Li38e4d942018-07-03 22:19:16 +0900103 *
Jimo Jung14e87bf2018-09-03 16:28:13 +0900104 * @param description description of vtap
105 * @return created openstack vtap object or null if error occurred
106 */
107 OpenstackVtap createVtap(OpenstackVtap description);
108
109 /**
110 * Updates the openstack vtap with specified description.
111 *
112 * @param description description of vtap
113 * @param replaceDevices replace device set if true, merge device set otherwise
114 * @return updated openstack vtap object or null if error occurred
115 */
116 OpenstackVtap updateVtap(OpenstackVtap description, boolean replaceDevices);
117
118 /**
119 * Removes the specified openstack vtap with given vtap identifier.
120 *
121 * @param vtapId vtap identifier
122 * @return removed openstack vtap object or null if error occurred
123 */
124 OpenstackVtap removeVtap(OpenstackVtapId vtapId);
125
126 /**
127 * Removes all openstack vtaps.
128 */
129 void clearVtaps();
130
131 /**
132 * Returns the number of openstack vtaps for the given type.
133 *
134 * @param type type of vtap (any,rx,tx,all)
135 * @return number of openstack vtaps
Jian Li38e4d942018-07-03 22:19:16 +0900136 */
137 int getVtapCount(OpenstackVtap.Type type);
138
139 /**
Jimo Jung14e87bf2018-09-03 16:28:13 +0900140 * Returns a set of openstack vtaps for the given type.
Jian Li38e4d942018-07-03 22:19:16 +0900141 *
Jimo Jung14e87bf2018-09-03 16:28:13 +0900142 * @param type type of vtap (any,rx,tx,all)
143 * @return set of openstack vtaps
Jian Li38e4d942018-07-03 22:19:16 +0900144 */
145 Set<OpenstackVtap> getVtaps(OpenstackVtap.Type type);
146
147 /**
Jimo Jung14e87bf2018-09-03 16:28:13 +0900148 * Returns the openstack vtap with the specified identifier.
Jian Li38e4d942018-07-03 22:19:16 +0900149 *
Jimo Jung14e87bf2018-09-03 16:28:13 +0900150 * @param vtapId vtap identifier
151 * @return openstack vtap or null if one with the given identifier is not known
Jian Li38e4d942018-07-03 22:19:16 +0900152 */
Jimo Jung14e87bf2018-09-03 16:28:13 +0900153 OpenstackVtap getVtap(OpenstackVtapId vtapId);
Jian Li38e4d942018-07-03 22:19:16 +0900154
155 /**
Jimo Jung14e87bf2018-09-03 16:28:13 +0900156 * Adds the specified device id to the specified vtap entry.
Jian Li38e4d942018-07-03 22:19:16 +0900157 *
Jimo Jung14e87bf2018-09-03 16:28:13 +0900158 * @param vtapId vtap identifier
159 * @param type type of vtap (any,rx,tx,all)
160 * @param deviceId device identifier to be added
161 * @return true on success, false otherwise
Jian Li38e4d942018-07-03 22:19:16 +0900162 */
Jimo Jung14e87bf2018-09-03 16:28:13 +0900163 boolean addDeviceToVtap(OpenstackVtapId vtapId, OpenstackVtap.Type type, DeviceId deviceId);
164
165 /**
166 * Removes the specified device id from the vtap entry.
167 *
168 * @param vtapId vtap identifier
169 * @param type type of vtap (any,rx,tx,all)
170 * @param deviceId device identifier to be removed
171 * @return true on success, false otherwise
172 */
173 boolean removeDeviceFromVtap(OpenstackVtapId vtapId, OpenstackVtap.Type type, DeviceId deviceId);
174
175 /**
176 * Returns a set of openstack vtaps which are associated with the given device.
177 *
178 * @param deviceId device identifier
179 * @return set of openstack vtaps
180 */
181 Set<OpenstackVtap> getVtapsByDeviceId(DeviceId deviceId);
Jian Li38e4d942018-07-03 22:19:16 +0900182}