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;
}
}
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));
}
}
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));
}
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);
}
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));
}
}
Aggregations