Search in sources :

Example 1 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 2 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 3 with GroupKey

use of org.onosproject.net.group.GroupKey in project onos by opennetworkinglab.

the class SimpleVirtualGroupStore method storeGroupDescriptionInternal.

private void storeGroupDescriptionInternal(NetworkId networkId, GroupDescription groupDesc) {
    // Check if a group is existing with the same key
    if (getGroup(networkId, groupDesc.deviceId(), groupDesc.appCookie()) != null) {
        return;
    }
    GroupId id = null;
    if (groupDesc.givenGroupId() == null) {
        // Get a new group identifier
        id = new GroupId(getFreeGroupIdValue(networkId, groupDesc.deviceId()));
    } else {
        id = new GroupId(groupDesc.givenGroupId());
    }
    // Create a group entry object
    StoredGroupEntry group = new DefaultGroup(id, groupDesc);
    // Insert the newly created group entry into concurrent key and id maps
    ConcurrentMap<GroupKey, StoredGroupEntry> keyTable = getGroupKeyTable(networkId, groupDesc.deviceId());
    keyTable.put(groupDesc.appCookie(), group);
    ConcurrentMap<GroupId, StoredGroupEntry> idTable = getGroupIdTable(networkId, groupDesc.deviceId());
    idTable.put(id, group);
    notifyDelegate(networkId, new GroupEvent(GroupEvent.Type.GROUP_ADD_REQUESTED, group));
}
Also used : DefaultGroup(org.onosproject.net.group.DefaultGroup) GroupKey(org.onosproject.net.group.GroupKey) StoredGroupEntry(org.onosproject.net.group.StoredGroupEntry) GroupEvent(org.onosproject.net.group.GroupEvent) GroupId(org.onosproject.core.GroupId)

Example 4 with GroupKey

use of org.onosproject.net.group.GroupKey in project onos by opennetworkinglab.

the class SimpleVirtualGroupStore method storeGroupDescription.

@Override
public void storeGroupDescription(NetworkId networkId, GroupDescription groupDesc) {
    // Check if a group is existing with the same key
    if (getGroup(networkId, groupDesc.deviceId(), groupDesc.appCookie()) != null) {
        return;
    }
    if (deviceAuditStatus.get(networkId) == null || deviceAuditStatus.get(networkId).get(groupDesc.deviceId()) == null) {
        // Device group audit has not completed yet
        // Add this group description to pending group key table
        // Create a group entry object with Dummy Group ID
        StoredGroupEntry group = new DefaultGroup(dummyGroupId, groupDesc);
        group.setState(Group.GroupState.WAITING_AUDIT_COMPLETE);
        ConcurrentMap<GroupKey, StoredGroupEntry> pendingKeyTable = getPendingGroupKeyTable(networkId, groupDesc.deviceId());
        pendingKeyTable.put(groupDesc.appCookie(), group);
        return;
    }
    storeGroupDescriptionInternal(networkId, groupDesc);
}
Also used : DefaultGroup(org.onosproject.net.group.DefaultGroup) GroupKey(org.onosproject.net.group.GroupKey) StoredGroupEntry(org.onosproject.net.group.StoredGroupEntry)

Example 5 with GroupKey

use of org.onosproject.net.group.GroupKey in project onos by opennetworkinglab.

the class SimpleVirtualGroupStore method removeGroupEntry.

@Override
public void removeGroupEntry(NetworkId networkId, Group group) {
    StoredGroupEntry existing = null;
    if (groupEntriesById.get(networkId) != null && groupEntriesById.get(networkId).get(group.deviceId()) != null) {
        existing = groupEntriesById.get(networkId).get(group.deviceId()).get(group.id());
    }
    if (existing != null) {
        ConcurrentMap<GroupKey, StoredGroupEntry> keyTable = getGroupKeyTable(networkId, existing.deviceId());
        ConcurrentMap<GroupId, StoredGroupEntry> idTable = getGroupIdTable(networkId, existing.deviceId());
        idTable.remove(existing.id());
        keyTable.remove(existing.appCookie());
        notifyDelegate(networkId, new GroupEvent(GroupEvent.Type.GROUP_REMOVED, existing));
    }
}
Also used : GroupKey(org.onosproject.net.group.GroupKey) StoredGroupEntry(org.onosproject.net.group.StoredGroupEntry) GroupEvent(org.onosproject.net.group.GroupEvent) GroupId(org.onosproject.core.GroupId)

Aggregations

GroupKey (org.onosproject.net.group.GroupKey)94 DefaultGroupKey (org.onosproject.net.group.DefaultGroupKey)78 GroupBuckets (org.onosproject.net.group.GroupBuckets)54 GroupBucket (org.onosproject.net.group.GroupBucket)53 Group (org.onosproject.net.group.Group)49 DefaultGroupDescription (org.onosproject.net.group.DefaultGroupDescription)47 DefaultTrafficTreatment (org.onosproject.net.flow.DefaultTrafficTreatment)45 TrafficTreatment (org.onosproject.net.flow.TrafficTreatment)45 DefaultGroupBucket (org.onosproject.net.group.DefaultGroupBucket)44 GroupDescription (org.onosproject.net.group.GroupDescription)43 GroupId (org.onosproject.core.GroupId)31 ArrayList (java.util.ArrayList)29 DefaultGroup (org.onosproject.net.group.DefaultGroup)26 PortNumber (org.onosproject.net.PortNumber)24 NextGroup (org.onosproject.net.behaviour.NextGroup)23 OfdpaGroupHandlerUtility.l2MulticastGroupKey (org.onosproject.driver.pipeline.ofdpa.OfdpaGroupHandlerUtility.l2MulticastGroupKey)21 ArrayDeque (java.util.ArrayDeque)20 Deque (java.util.Deque)19 Instruction (org.onosproject.net.flow.instructions.Instruction)18 TrafficSelector (org.onosproject.net.flow.TrafficSelector)16