blob: 1fd9984ed0fc1ae0cbae6fa4220cf4caf34aae6b [file] [log] [blame]
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -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.core.ApplicationId;
19import org.onosproject.net.Device;
20import org.onosproject.net.DeviceId;
21
22/**
23 * Service for create/update/delete "group" in the devices.
24 * Flow entries can point to a "group" defined in the devices that enables
25 * to represent additional methods of forwarding like load-balancing or
26 * failover among different group of ports or multicast to all ports
27 * specified in a group.
28 * "group" can also be used for grouping common actions of different flows,
29 * so that in some scenarios only one group entry required to be modified
30 * for all the referencing flow entries instead of modifying all of them
31 *
32 * This implements semantics of a distributed authoritative group store
33 * where the master copy of the groups lies with the controller and
34 * the devices hold only the 'cached' copy.
35 */
36public interface GroupService {
37
38 /**
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -080039 * Creates a group in the specified device with the provided buckets.
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -080040 * This API provides an option for application to associate a cookie
41 * while creating a group, so that applications can look-up the
42 * groups based on the cookies. These Groups will be retained by
43 * the core system and re-applied if any groups found missing in the
44 * device when it reconnects. This API would immediately return after
45 * submitting the request locally or to a remote Master controller
46 * instance. As a response to this API invocation, GROUP_ADDED or
47 * GROUP_ADD_FAILED notifications would be provided along with cookie
48 * depending on the result of the operation on the device in the
49 * data plane. The caller may also use "getGroup" API to get the
50 * Group object created as part of this request.
51 *
52 * @param groupDesc group creation parameters
53 *
54 */
55 void addGroup(GroupDescription groupDesc);
56
57 /**
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -080058 * Returns a group object associated to an application cookie.
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -080059 *
60 * NOTE1: The presence of group object in the system does not
61 * guarantee that the "group" is actually created in device.
62 * GROUP_ADDED notification would confirm the creation of
63 * this group in data plane
64 *
65 * @param deviceId device identifier
66 * @param appCookie application cookie to be used for lookup
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -080067 * @return group associated with the application cookie or
68 * NULL if Group is not found for the provided cookie
69 */
70 Group getGroup(DeviceId deviceId, GroupKey appCookie);
71
72 /**
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -080073 * Appends buckets to existing group. The caller can optionally
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -080074 * associate a new cookie during this updation. GROUP_UPDATED or
75 * GROUP_UPDATE_FAILED notifications would be provided along with
76 * cookie depending on the result of the operation on the device
77 *
78 * @param deviceId device identifier
79 * @param oldCookie cookie to be used to retrieve the existing group
80 * @param buckets immutable list of group bucket to be added
81 * @param newCookie immutable cookie to be used post update operation
82 * @param appId Application Id
83 */
84 void addBucketsToGroup(DeviceId deviceId,
85 GroupKey oldCookie,
86 GroupBuckets buckets,
87 GroupKey newCookie,
88 ApplicationId appId);
89
90 /**
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -080091 * Removes buckets from existing group. The caller can optionally
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -080092 * associate a new cookie during this updation. GROUP_UPDATED or
93 * GROUP_UPDATE_FAILED notifications would be provided along with
94 * cookie depending on the result of the operation on the device
95 *
96 * @param deviceId device identifier
97 * @param oldCookie cookie to be used to retrieve the existing group
98 * @param buckets immutable list of group bucket to be removed
99 * @param newCookie immutable cookie to be used post update operation
100 * @param appId Application Id
101 */
102 void removeBucketsFromGroup(Device deviceId,
103 GroupKey oldCookie,
104 GroupBuckets buckets,
105 GroupKey newCookie,
106 ApplicationId appId);
107
108 /**
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -0800109 * Deletes a group associated to an application cookie.
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -0800110 * GROUP_DELETED or GROUP_DELETE_FAILED notifications would be
111 * provided along with cookie depending on the result of the
112 * operation on the device
113 *
114 * @param deviceId device identifier
115 * @param appCookie application cookie to be used for lookup
116 * @param appId Application Id
117 */
118 void removeGroup(Device deviceId, GroupKey appCookie, ApplicationId appId);
119
120 /**
Srikanth Vavilapalli0599d512015-01-30 12:57:56 -0800121 * Retrieves all groups created by an application in the specified device
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -0800122 * as seen by current controller instance.
123 *
124 * @param deviceId device identifier
125 * @param appId application id
Srikanth Vavilapalli56db94f2015-01-22 22:30:17 -0800126 * @return collection of immutable group objects created by the application
127 */
128 Iterable<Group> getGroups(Device deviceId, ApplicationId appId);
129
130 /**
131 * Adds the specified group listener.
132 *
133 * @param listener group listener
134 */
135 void addListener(GroupListener listener);
136
137 /**
138 * Removes the specified group listener.
139 *
140 * @param listener group listener
141 */
142 void removeListener(GroupListener listener);
143}