blob: 6803b58ff076a022f8bc53868c0d12e5fd7627ed [file] [log] [blame]
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -08001/*
2 * Copyright 2015 Open Networking Laboratory
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.net.group;
17
18import org.onosproject.net.DeviceId;
19import org.onosproject.store.Store;
20
21/**
22 * Manages inventory of groups per device; not intended for direct use.
23 */
24public interface GroupStore extends Store<GroupEvent, GroupStoreDelegate> {
25
26 public enum UpdateType {
27 /**
28 * Modify existing group entry by adding provided information.
29 */
30 ADD,
31 /**
32 * Modify existing group by removing provided information from it.
33 */
34 REMOVE
35 }
36
37 /**
38 * Returns the number of groups for the specified device in the store.
39 *
40 * @param deviceId the device ID
41 * @return number of groups for the specified device
42 */
43 int getGroupCount(DeviceId deviceId);
44
45 /**
46 * Returns the groups associated with a device.
47 *
48 * @param deviceId the device ID
49 * @return the group entries
50 */
51 Iterable<Group> getGroups(DeviceId deviceId);
52
53 /**
54 * Returns the stored group entry.
55 *
56 * @param deviceId the device ID
57 * @param appCookie the group key
58 * @return a group associated with the key
59 */
60 Group getGroup(DeviceId deviceId, GroupKey appCookie);
61
62 /**
63 * Stores a new group entry using the information from group description.
64 *
65 * @param groupDesc group description to be used to store group entry
66 */
67 void storeGroupDescription(GroupDescription groupDesc);
68
69 /**
70 * Updates the existing group entry with the information
71 * from group description.
72 *
73 * @param deviceId the device ID
74 * @param oldAppCookie the current group key
75 * @param type update type
Srikanth Vavilapalli45c27c82015-01-30 12:57:56 -080076 * @param newBuckets group buckets for updates
77 * @param newAppCookie optional new group key
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -080078 */
79 void updateGroupDescription(DeviceId deviceId,
80 GroupKey oldAppCookie,
81 UpdateType type,
Srikanth Vavilapalli45c27c82015-01-30 12:57:56 -080082 GroupBuckets newBuckets,
83 GroupKey newAppCookie);
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -080084
85 /**
86 * Triggers deleting the existing group entry.
87 *
88 * @param deviceId the device ID
89 * @param appCookie the group key
90 */
91 void deleteGroupDescription(DeviceId deviceId,
92 GroupKey appCookie);
93
94 /**
95 * Stores a new group entry, or updates an existing entry.
96 *
97 * @param group group entry
98 */
99 void addOrUpdateGroupEntry(Group group);
100
101 /**
102 * Removes the group entry from store.
103 *
104 * @param group group entry
105 */
106 void removeGroupEntry(Group group);
Srikanth Vavilapalli45c27c82015-01-30 12:57:56 -0800107
108 /**
109 * A group entry that is present in switch but not in the store.
110 *
111 * @param group group entry
112 */
113 void addOrUpdateExtraneousGroupEntry(Group group);
114
115 /**
116 * Remove the group entry from extraneous database.
117 *
118 * @param group group entry
119 */
120 void removeExtraneousGroupEntry(Group group);
121
122 /**
123 * Returns the extraneous groups associated with a device.
124 *
125 * @param deviceId the device ID
126 *
127 * @return the extraneous group entries
128 */
129 Iterable<Group> getExtraneousGroups(DeviceId deviceId);
130
131 /**
132 * Indicates the first group audit is completed.
133 *
134 * @param deviceId the device ID
135 */
136 void deviceInitialAuditCompleted(DeviceId deviceId);
137
138 /**
139 * Retrieves the initial group audit status for a device.
140 *
141 * @param deviceId the device ID
142 *
143 * @return initial group audit status
144 */
145 boolean deviceInitialAuditStatus(DeviceId deviceId);
sangho7ff01812015-02-09 16:21:53 -0800146
147 /**
148 * Indicates the group operations failed.
149 *
150 * @param deviceId the device ID
151 * @param operation the group operation failed
152 */
153 void groupOperationFailed(DeviceId deviceId, GroupOperation operation);
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -0800154}