blob: 08216044171768049c137c8aa899122347010cee [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
Srikanth Vavilapalli717361f2015-03-16 12:06:04 -070018import org.onosproject.core.GroupId;
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -080019import org.onosproject.net.DeviceId;
20import org.onosproject.store.Store;
21
22/**
23 * Manages inventory of groups per device; not intended for direct use.
24 */
25public interface GroupStore extends Store<GroupEvent, GroupStoreDelegate> {
26
Sho SHIMIZU3310a342015-05-13 12:14:05 -070027 enum UpdateType {
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -080028 /**
29 * Modify existing group entry by adding provided information.
30 */
31 ADD,
32 /**
33 * Modify existing group by removing provided information from it.
34 */
35 REMOVE
36 }
37
38 /**
39 * Returns the number of groups for the specified device in the store.
40 *
41 * @param deviceId the device ID
42 * @return number of groups for the specified device
43 */
44 int getGroupCount(DeviceId deviceId);
45
46 /**
47 * Returns the groups associated with a device.
48 *
49 * @param deviceId the device ID
50 * @return the group entries
51 */
52 Iterable<Group> getGroups(DeviceId deviceId);
53
54 /**
55 * Returns the stored group entry.
56 *
57 * @param deviceId the device ID
58 * @param appCookie the group key
59 * @return a group associated with the key
60 */
61 Group getGroup(DeviceId deviceId, GroupKey appCookie);
62
63 /**
Srikanth Vavilapalli717361f2015-03-16 12:06:04 -070064 * Returns the stored group entry for an id.
65 *
66 * @param deviceId the device ID
67 * @param groupId the group identifier
68 * @return a group associated with the key
69 */
70 Group getGroup(DeviceId deviceId, GroupId groupId);
71
72 /**
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -080073 * Stores a new group entry using the information from group description.
74 *
75 * @param groupDesc group description to be used to store group entry
76 */
77 void storeGroupDescription(GroupDescription groupDesc);
78
79 /**
80 * Updates the existing group entry with the information
81 * from group description.
82 *
83 * @param deviceId the device ID
84 * @param oldAppCookie the current group key
85 * @param type update type
Srikanth Vavilapalli45c27c82015-01-30 12:57:56 -080086 * @param newBuckets group buckets for updates
87 * @param newAppCookie optional new group key
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -080088 */
89 void updateGroupDescription(DeviceId deviceId,
90 GroupKey oldAppCookie,
91 UpdateType type,
Srikanth Vavilapalli45c27c82015-01-30 12:57:56 -080092 GroupBuckets newBuckets,
93 GroupKey newAppCookie);
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -080094
95 /**
96 * Triggers deleting the existing group entry.
97 *
98 * @param deviceId the device ID
99 * @param appCookie the group key
100 */
101 void deleteGroupDescription(DeviceId deviceId,
102 GroupKey appCookie);
103
104 /**
105 * Stores a new group entry, or updates an existing entry.
106 *
107 * @param group group entry
108 */
109 void addOrUpdateGroupEntry(Group group);
110
111 /**
112 * Removes the group entry from store.
113 *
114 * @param group group entry
115 */
116 void removeGroupEntry(Group group);
Srikanth Vavilapalli45c27c82015-01-30 12:57:56 -0800117
118 /**
119 * A group entry that is present in switch but not in the store.
120 *
121 * @param group group entry
122 */
123 void addOrUpdateExtraneousGroupEntry(Group group);
124
125 /**
126 * Remove the group entry from extraneous database.
127 *
128 * @param group group entry
129 */
130 void removeExtraneousGroupEntry(Group group);
131
132 /**
133 * Returns the extraneous groups associated with a device.
134 *
135 * @param deviceId the device ID
136 *
137 * @return the extraneous group entries
138 */
139 Iterable<Group> getExtraneousGroups(DeviceId deviceId);
140
141 /**
142 * Indicates the first group audit is completed.
143 *
144 * @param deviceId the device ID
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -0800145 * @param completed initial audit status
Srikanth Vavilapalli45c27c82015-01-30 12:57:56 -0800146 */
Srikanth Vavilapallied12ae52015-02-09 14:43:19 -0800147 void deviceInitialAuditCompleted(DeviceId deviceId, boolean completed);
Srikanth Vavilapalli45c27c82015-01-30 12:57:56 -0800148
149 /**
150 * Retrieves the initial group audit status for a device.
151 *
152 * @param deviceId the device ID
153 *
154 * @return initial group audit status
155 */
156 boolean deviceInitialAuditStatus(DeviceId deviceId);
sangho7ff01812015-02-09 16:21:53 -0800157
158 /**
159 * Indicates the group operations failed.
160 *
161 * @param deviceId the device ID
162 * @param operation the group operation failed
163 */
164 void groupOperationFailed(DeviceId deviceId, GroupOperation operation);
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -0800165}