use of org.onosproject.net.group.GroupKey in project onos by opennetworkinglab.
the class SelectGroupHandler method updateGatewayGroupBuckets.
/**
* Updates groupBuckets in select type group.
*
* @param deviceId target device id to update the group
* @param nodeList updated gateway node list for bucket action
* @param isInsert update type(add or remove)
*/
public void updateGatewayGroupBuckets(DeviceId deviceId, List<GatewayNode> nodeList, boolean isInsert) {
List<GroupBucket> bucketList = generateBucketsForSelectGroup(deviceId, nodeList);
GroupKey groupKey = getGroupKey(deviceId);
if (isInsert) {
groupService.addBucketsToGroup(deviceId, groupKey, new GroupBuckets(bucketList), groupKey, appId);
} else {
groupService.removeBucketsFromGroup(deviceId, groupKey, new GroupBuckets(bucketList), groupKey, appId);
}
}
use of org.onosproject.net.group.GroupKey in project onos by opennetworkinglab.
the class ScalableGatewayManager method getGatewayGroupId.
@Override
public synchronized GroupId getGatewayGroupId(DeviceId srcDeviceId) {
GroupKey groupKey = selectGroupHandler.getGroupKey(srcDeviceId);
Group group = groupService.getGroup(srcDeviceId, groupKey);
if (group == null) {
log.info("Created gateway group for {}", srcDeviceId);
return selectGroupHandler.createGatewayGroup(srcDeviceId, getGatewayNodes());
} else {
return group.id();
}
}
use of org.onosproject.net.group.GroupKey in project onos by opennetworkinglab.
the class GroupsWebResource method getGroupByDeviceIdAndAppCookie.
/**
* Returns a group with the given deviceId and appCookie.
*
* @param deviceId device identifier
* @param appCookie group key
* @return 200 OK with a group entry in the system
* @onos.rsModel Group
*/
@GET
@Produces(MediaType.APPLICATION_JSON)
@Path("{deviceId}/{appCookie}")
public Response getGroupByDeviceIdAndAppCookie(@PathParam("deviceId") String deviceId, @PathParam("appCookie") String appCookie) {
GroupService groupService = get(GroupService.class);
final DeviceId deviceIdInstance = DeviceId.deviceId(deviceId);
final GroupKey appCookieInstance = createKey(appCookie);
Group group = nullIsNotFound(groupService.getGroup(deviceIdInstance, appCookieInstance), GROUP_NOT_FOUND);
groupsNode.add(codec(Group.class).encode(group, this));
return ok(root).build();
}
use of org.onosproject.net.group.GroupKey in project onos by opennetworkinglab.
the class VirtualNetworkGroupManagerTest method testRemoveGroup.
// Test group remove operations
private void testRemoveGroup(NetworkId networkId, DeviceId deviceId) {
VirtualNetworkGroupManager groupManager;
VirtualGroupProviderService providerService;
TestGroupListener listener;
if (networkId.id() == 1) {
groupManager = groupManager1;
providerService = providerService1;
listener = listener1;
} else {
groupManager = groupManager2;
providerService = providerService2;
listener = listener2;
}
GroupKey currKey = new DefaultGroupKey("group1RemoveBuckets".getBytes());
Group existingGroup = groupManager.getGroup(deviceId, currKey);
groupManager.removeGroup(deviceId, currKey, appId);
List<GroupOperation> expectedGroupOps = Collections.singletonList(GroupOperation.createDeleteGroupOperation(existingGroup.id(), Group.Type.SELECT));
if (deviceId.equals(VDID1)) {
provider.validate(networkId, deviceId, expectedGroupOps);
}
List<Group> groupEntries = Collections.emptyList();
providerService.pushGroupMetrics(deviceId, groupEntries);
listener.validateEvent(Collections.singletonList(GroupEvent.Type.GROUP_REMOVED));
}
use of org.onosproject.net.group.GroupKey in project onos by opennetworkinglab.
the class VirtualNetworkGroupManagerTest method testAuditWithConfirmedGroups.
// Test AUDIT with confirmed groups
private void testAuditWithConfirmedGroups(NetworkId networkId, DeviceId deviceId) {
VirtualNetworkGroupManager groupManager;
VirtualGroupProviderService providerService;
TestGroupListener listener;
if (networkId.id() == 1) {
groupManager = groupManager1;
providerService = providerService1;
listener = listener1;
} else {
groupManager = groupManager2;
providerService = providerService2;
listener = listener2;
}
GroupKey key = new DefaultGroupKey("group1BeforeAudit".getBytes());
Group createdGroup = groupManager.getGroup(deviceId, key);
createdGroup = new DefaultGroup(createdGroup.id(), deviceId, Group.Type.SELECT, createdGroup.buckets());
List<Group> groupEntries = Collections.singletonList(createdGroup);
providerService.pushGroupMetrics(deviceId, groupEntries);
listener.validateEvent(Collections.singletonList(GroupEvent.Type.GROUP_ADDED));
}
Aggregations