blob: 15c945e2b70c525c8e45a82e2b8210785d8c625e [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/**
24 * Manages inventory of OpenstackVtap states; not intended for direct use.
25 */
26public interface OpenstackVtapStore
27 extends Store<OpenstackVtapEvent, OpenstackVtapStoreDelegate> {
28
29 /**
30 * Creates a new vTap or updates the existing one based on the specified
31 * description.
32 *
33 * @param vTapId vTap identifier
34 * @param description vTap description data
35 * @param replaceFlag replace device set if true, merge device set otherwise
36 * @return created or updated vTap object or null if error occurred
37 */
38 OpenstackVtap createOrUpdateVtap(OpenstackVtapId vTapId, OpenstackVtap description, boolean replaceFlag);
39
40 /**
41 * Removes the specified vTap from the inventory by the given vTap identifier.
42 *
43 * @param vTapId vTap identifier
44 * @return removed vTap object or null if error occurred
45 */
46 OpenstackVtap removeVtapById(OpenstackVtapId vTapId);
47
48 /**
49 * Adds the specified device id from the vTap entry.
50 *
51 * @param vTapId vTap identification
52 * @param type vTap type
53 * @param deviceId device identifier to be added
54 * @return true on success, false otherwise
55 */
56 boolean addDeviceToVtap(OpenstackVtapId vTapId, OpenstackVtap.Type type, DeviceId deviceId);
57
58 /**
59 * Removes the specified device id from the vTap entry.
60 *
61 * @param vTapId vTap identification
62 * @param type vTap type
63 * @param deviceId device identifier to be removed
64 * @return true on success, false otherwise
65 */
66 boolean removeDeviceFromVtap(OpenstackVtapId vTapId, OpenstackVtap.Type type, DeviceId deviceId);
67
68 /**
69 * Adds the specified device id from the vTap entry.
70 *
71 * @param vTapId vTap identification
72 * @param txDeviceIds TX device identifiers to be updated
73 * @param rxDeviceIds RX device identifiers to be updated
74 * @param replaceFlag replace device set if true, merge device set otherwise
75 * @return true on success, false otherwise
76 */
77 boolean updateDeviceForVtap(OpenstackVtapId vTapId, Set<DeviceId> txDeviceIds,
78 Set<DeviceId> rxDeviceIds, boolean replaceFlag);
79
80 /**
81 * Returns the number of vTaps in the store.
82 *
83 * @param type vTap type
84 * @return vTap count
85 */
86 int getVtapCount(OpenstackVtap.Type type);
87
88 /**
89 * Returns a collection of selected vTaps in the store.
90 *
91 * @param type vTap type
92 * @return iterable collection of selected vTaps
93 */
94 Set<OpenstackVtap> getVtaps(OpenstackVtap.Type type);
95
96 /**
97 * Returns the vTap with the specified identifier.
98 *
99 * @param vTapId vTap identifier
100 * @return vtap or null if not found
101 */
102 OpenstackVtap getVtap(OpenstackVtapId vTapId);
103
104 /**
105 * Returns the set of vTaps whose included on device.
106 *
107 * @param type vTap type
108 * @param deviceId device identifier
109 * @return set of vTaps
110 */
111 Set<OpenstackVtap> getVtapsByDeviceId(OpenstackVtap.Type type, DeviceId deviceId);
112}