Search in sources :

Example 36 with StoredGroupEntry

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

the class SimpleVirtualGroupStore method deleteGroupDescription.

@Override
public void deleteGroupDescription(NetworkId networkId, DeviceId deviceId, GroupKey appCookie) {
    // Check if a group is existing with the provided key
    StoredGroupEntry existing = null;
    if (groupEntriesByKey.get(networkId) != null && groupEntriesByKey.get(networkId).get(deviceId) != null) {
        existing = groupEntriesByKey.get(networkId).get(deviceId).get(appCookie);
    }
    if (existing == null) {
        return;
    }
    synchronized (existing) {
        existing.setState(Group.GroupState.PENDING_DELETE);
    }
    notifyDelegate(networkId, new GroupEvent(GroupEvent.Type.GROUP_REMOVE_REQUESTED, existing));
}
Also used : StoredGroupEntry(org.onosproject.net.group.StoredGroupEntry) GroupEvent(org.onosproject.net.group.GroupEvent)

Example 37 with StoredGroupEntry

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

the class SimpleGroupStore method removeGroupEntry.

/**
 * Removes the group entry from store.
 *
 * @param group group entry
 */
@Override
public void removeGroupEntry(Group group) {
    StoredGroupEntry existing = (groupEntriesById.get(group.deviceId()) != null) ? groupEntriesById.get(group.deviceId()).get(group.id()) : null;
    if (existing != null) {
        ConcurrentMap<GroupKey, StoredGroupEntry> keyTable = getGroupKeyTable(existing.deviceId());
        ConcurrentMap<GroupId, StoredGroupEntry> idTable = getGroupIdTable(existing.deviceId());
        idTable.remove(existing.id());
        keyTable.remove(existing.appCookie());
        notifyDelegate(new 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)

Example 38 with StoredGroupEntry

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

the class SimpleGroupStore method deleteGroupDescription.

/**
 * Triggers deleting the existing group entry.
 *
 * @param deviceId the device ID
 * @param appCookie the group key
 */
@Override
public void deleteGroupDescription(DeviceId deviceId, GroupKey appCookie) {
    // Check if a group is existing with the provided key
    StoredGroupEntry existing = (groupEntriesByKey.get(deviceId) != null) ? groupEntriesByKey.get(deviceId).get(appCookie) : null;
    if (existing == null) {
        return;
    }
    synchronized (existing) {
        existing.setState(GroupState.PENDING_DELETE);
    }
    notifyDelegate(new GroupEvent(Type.GROUP_REMOVE_REQUESTED, existing));
}
Also used : StoredGroupEntry(org.onosproject.net.group.StoredGroupEntry) GroupEvent(org.onosproject.net.group.GroupEvent)

Aggregations

StoredGroupEntry (org.onosproject.net.group.StoredGroupEntry)38 GroupEvent (org.onosproject.net.group.GroupEvent)26 DefaultGroup (org.onosproject.net.group.DefaultGroup)19 GroupKey (org.onosproject.net.group.GroupKey)18 GroupId (org.onosproject.core.GroupId)15 Group (org.onosproject.net.group.Group)13 GroupBucket (org.onosproject.net.group.GroupBucket)11 GroupBuckets (org.onosproject.net.group.GroupBuckets)11 DefaultGroupDescription (org.onosproject.net.group.DefaultGroupDescription)10 GroupDescription (org.onosproject.net.group.GroupDescription)10 ArrayList (java.util.ArrayList)8 StoredGroupBucketEntry (org.onosproject.net.group.StoredGroupBucketEntry)8 DeviceId (org.onosproject.net.DeviceId)6 Activate (org.osgi.service.component.annotations.Activate)6 FluentIterable (com.google.common.collect.FluentIterable)5 Sets (com.google.common.collect.Sets)5 Collection (java.util.Collection)5 HashMap (java.util.HashMap)5 Iterator (java.util.Iterator)5 List (java.util.List)5