Search in sources :

Example 21 with GroupKey

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);
    }
}
Also used : GroupKey(org.onosproject.net.group.GroupKey) DefaultGroupKey(org.onosproject.net.group.DefaultGroupKey) GroupBucket(org.onosproject.net.group.GroupBucket) DefaultGroupBucket.createSelectGroupBucket(org.onosproject.net.group.DefaultGroupBucket.createSelectGroupBucket) GroupBuckets(org.onosproject.net.group.GroupBuckets)

Example 22 with GroupKey

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();
    }
}
Also used : Group(org.onosproject.net.group.Group) GroupKey(org.onosproject.net.group.GroupKey)

Example 23 with GroupKey

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();
}
Also used : Group(org.onosproject.net.group.Group) DeviceId(org.onosproject.net.DeviceId) GroupKey(org.onosproject.net.group.GroupKey) DefaultGroupKey(org.onosproject.net.group.DefaultGroupKey) GroupService(org.onosproject.net.group.GroupService) Path(javax.ws.rs.Path) Produces(javax.ws.rs.Produces) GET(javax.ws.rs.GET)

Example 24 with GroupKey

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));
}
Also used : VirtualGroupProviderService(org.onosproject.incubator.net.virtual.provider.VirtualGroupProviderService) DefaultGroup(org.onosproject.net.group.DefaultGroup) Group(org.onosproject.net.group.Group) GroupKey(org.onosproject.net.group.GroupKey) DefaultGroupKey(org.onosproject.net.group.DefaultGroupKey) DefaultGroupKey(org.onosproject.net.group.DefaultGroupKey) GroupOperation(org.onosproject.net.group.GroupOperation)

Example 25 with GroupKey

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));
}
Also used : VirtualGroupProviderService(org.onosproject.incubator.net.virtual.provider.VirtualGroupProviderService) DefaultGroup(org.onosproject.net.group.DefaultGroup) Group(org.onosproject.net.group.Group) GroupKey(org.onosproject.net.group.GroupKey) DefaultGroupKey(org.onosproject.net.group.DefaultGroupKey) DefaultGroupKey(org.onosproject.net.group.DefaultGroupKey) DefaultGroup(org.onosproject.net.group.DefaultGroup)

Aggregations

GroupKey (org.onosproject.net.group.GroupKey)99 DefaultGroupKey (org.onosproject.net.group.DefaultGroupKey)83 GroupBuckets (org.onosproject.net.group.GroupBuckets)59 GroupBucket (org.onosproject.net.group.GroupBucket)58 DefaultGroupDescription (org.onosproject.net.group.DefaultGroupDescription)52 Group (org.onosproject.net.group.Group)50 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)48 DefaultGroupBucket (org.onosproject.net.group.DefaultGroupBucket)48 TrafficTreatment (org.onosproject.net.flow.TrafficTreatment)47 GroupDescription (org.onosproject.net.group.GroupDescription)46 GroupId (org.onosproject.core.GroupId)31 ArrayList (java.util.ArrayList)29 PortNumber (org.onosproject.net.PortNumber)27 DefaultGroup (org.onosproject.net.group.DefaultGroup)27 NextGroup (org.onosproject.net.behaviour.NextGroup)24 OfdpaGroupHandlerUtility.l2MulticastGroupKey (org.onosproject.driver.pipeline.ofdpa.OfdpaGroupHandlerUtility.l2MulticastGroupKey)21 ArrayDeque (java.util.ArrayDeque)20 Deque (java.util.Deque)19 TrafficSelector (org.onosproject.net.flow.TrafficSelector)18 Instruction (org.onosproject.net.flow.instructions.Instruction)18