Search in sources :

Example 16 with GroupEvent

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

the class SimpleGroupStore method groupMissing.

private void groupMissing(Group group) {
    switch(group.state()) {
        case PENDING_DELETE:
            log.debug("Group {} delete confirmation from device {}", group, group.deviceId());
            removeGroupEntry(group);
            break;
        case ADDED:
        case PENDING_ADD:
        case PENDING_UPDATE:
            log.debug("Group {} is in store but not on device {}", group, group.deviceId());
            StoredGroupEntry existing = (groupEntriesById.get(group.deviceId()) != null) ? groupEntriesById.get(group.deviceId()).get(group.id()) : null;
            log.trace("groupMissing: group " + "entry {} in device {} moving " + "from {} to PENDING_ADD", existing.id(), existing.deviceId(), existing.state());
            existing.setState(Group.GroupState.PENDING_ADD);
            notifyDelegate(new GroupEvent(GroupEvent.Type.GROUP_ADD_REQUESTED, group));
            break;
        default:
            log.debug("Group {} has not been installed.", group);
            break;
    }
}
Also used : StoredGroupEntry(org.onosproject.net.group.StoredGroupEntry) GroupEvent(org.onosproject.net.group.GroupEvent)

Example 17 with GroupEvent

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

the class SimpleGroupStore method addOrUpdateExtraneousGroupEntry.

@Override
public void addOrUpdateExtraneousGroupEntry(Group group) {
    ConcurrentMap<GroupId, Group> extraneousIdTable = getExtraneousGroupIdTable(group.deviceId());
    extraneousIdTable.put(group.id(), group);
    // Check the reference counter
    if (group.referenceCount() == 0) {
        notifyDelegate(new GroupEvent(Type.GROUP_REMOVE_REQUESTED, group));
    }
}
Also used : DefaultGroup(org.onosproject.net.group.DefaultGroup) Group(org.onosproject.net.group.Group) GroupEvent(org.onosproject.net.group.GroupEvent) GroupId(org.onosproject.core.GroupId)

Example 18 with GroupEvent

use of org.onosproject.net.group.GroupEvent 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)

Example 19 with GroupEvent

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

the class SimpleGroupStore method notifyOfFailovers.

@Override
public void notifyOfFailovers(Collection<Group> failoverGroups) {
    List<GroupEvent> failoverEvents = new ArrayList<>();
    failoverGroups.forEach(group -> {
        if (group.type() == Group.Type.FAILOVER) {
            failoverEvents.add(new GroupEvent(GroupEvent.Type.GROUP_BUCKET_FAILOVER, group));
        }
    });
    notifyDelegate(failoverEvents);
}
Also used : ArrayList(java.util.ArrayList) GroupEvent(org.onosproject.net.group.GroupEvent)

Example 20 with GroupEvent

use of org.onosproject.net.group.GroupEvent 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)

Aggregations

GroupEvent (org.onosproject.net.group.GroupEvent)32 StoredGroupEntry (org.onosproject.net.group.StoredGroupEntry)23 GroupId (org.onosproject.core.GroupId)13 DefaultGroup (org.onosproject.net.group.DefaultGroup)12 GroupKey (org.onosproject.net.group.GroupKey)11 Group (org.onosproject.net.group.Group)10 DefaultGroupDescription (org.onosproject.net.group.DefaultGroupDescription)5 GroupBucket (org.onosproject.net.group.GroupBucket)5 GroupBuckets (org.onosproject.net.group.GroupBuckets)5 GroupDescription (org.onosproject.net.group.GroupDescription)5 ArrayList (java.util.ArrayList)4 GroupOperation (org.onosproject.net.group.GroupOperation)4 StoredGroupBucketEntry (org.onosproject.net.group.StoredGroupBucketEntry)4 FluentIterable (com.google.common.collect.FluentIterable)2 Sets (com.google.common.collect.Sets)2 Collection (java.util.Collection)2 HashMap (java.util.HashMap)2 Iterator (java.util.Iterator)2 List (java.util.List)2 Map (java.util.Map)2