@Override public void notifyOfFailovers(Collection<Group> failoverGroups) { store.notifyOfFailovers(failoverGroups); } }
@Override public void groupOperationFailed(DeviceId deviceId, GroupOperation operation) { store.groupOperationFailed(deviceId, operation); }
private void pollDeviceGroups(DeviceId deviceId) { Collection<Group> groups = getGroupProgrammable(deviceId).getGroups(); groupProviderService.pushGroupMetrics(deviceId, groups); }
@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)); } }
/** * 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)); } }
@Override public void event(GroupEvent event) { log.trace("received group event of type {}", event.type()); switch (event.type()) { case GROUP_ADDED: processPendingAddGroupsOrNextObjs(event.subject().appCookie(), true); break; case GROUP_REMOVED: processPendingRemoveNextObjs(event.subject().appCookie()); break; default: break; } } }
private void removeGroup(NextObjective nextObjective) { log.debug("removeGroup in {}: for next objective id {}", deviceId, nextObjective.id()); final GroupKey key = new DefaultGroupKey( appKryo.serialize(nextObjective.id())); groupService.removeGroup(deviceId, key, appId); }
@Override public PiActionProfileGroup translate(Group original, PiPipeconf pipeconf) throws PiTranslationException { return PiGroupTranslatorImpl .translate(original, pipeconf, getDevice(original.deviceId())); } }
/** * Creates group key unique to each intent. * * @param intentId identifier of intent to get a key for * @return unique group key for the intent identifier */ public static GroupKey makeGroupKey(IntentId intentId) { ByteBuffer buffer = ByteBuffer.allocate(Long.BYTES); buffer.putLong(intentId.fingerprint()); return new DefaultGroupKey(buffer.array()); }
@Override public void performGroupOperation(DeviceId deviceId, GroupOperations groupOps) { GroupProgrammable programmable = getGroupProgrammable(deviceId); if (programmable != null) { programmable.performGroupOperation(deviceId, groupOps); } }
@Override public void pushGroupMetrics(DeviceId deviceId, Collection<Group> groupEntries) { log.trace("Received group metrics from device {}", deviceId); checkValidity(); store.pushGroupMetrics(deviceId, groupEntries); }
@Override public Iterable<Group> getGroups(DeviceId deviceId) { checkPermission(GROUP_READ); return store.getGroups(deviceId); }
@Override public void purgeGroupEntries(DeviceId deviceId) { checkPermission(GROUP_WRITE); store.purgeGroupEntry(deviceId); }
/** * Create a group in the specified device with the provided parameters. * * @param groupDesc group creation parameters */ @Override public void addGroup(GroupDescription groupDesc) { checkPermission(GROUP_WRITE); store.storeGroupDescription(groupDesc); }
@Override public void purgeGroupEntries() { checkPermission(GROUP_WRITE); store.purgeGroupEntries(); }
@Override public void event(GroupEvent event) { if (event.type() == GroupEvent.Type.GROUP_ADDED) { GroupKey key = event.subject().appCookie(); NextObjective obj = pendingGroups.getIfPresent(key); if (obj != null) { flowObjectiveStore.putNextGroup(obj.id(), new OLTPipelineGroup(key)); pass(obj); pendingGroups.invalidate(key); } } } }
@Override public PiMulticastGroupEntry translate(Group original, PiPipeconf pipeconf) throws PiTranslationException { return PiMulticastGroupTranslatorImpl.translate( original, pipeconf, getDevice(original.deviceId())); } }
/** * Retrieve all groups created by an application in the specified device * as seen by current controller instance. * * @param deviceId device identifier * @param appId application id * @return collection of immutable group objects created by the application */ @Override public Iterable<Group> getGroups(DeviceId deviceId, ApplicationId appId) { checkPermission(GROUP_READ); return store.getGroups(deviceId); }
@Override public void event(GroupEvent event) { if (event.type() == GroupEvent.Type.GROUP_ADDED) { GroupKey key = event.subject().appCookie(); NextObjective obj = pendingGroups.getIfPresent(key); if (obj != null) { flowObjectiveStore.putNextGroup(obj.id(), new CentecV350Group(key)); pass(obj); pendingGroups.invalidate(key); } } } }
private void extraneousGroup(Group group) { log.debug("Group {} is on device {} but not in store.", group, group.deviceId()); addOrUpdateExtraneousGroupEntry(group); }