use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInput in project openflowplugin by opendaylight.
the class SalGroupsBatchServiceImpl method removeGroupsBatch.
@Override
public Future<RpcResult<RemoveGroupsBatchOutput>> removeGroupsBatch(final RemoveGroupsBatchInput input) {
LOG.trace("Removing groups @ {} : {}", PathUtil.extractNodeId(input.getNode()), input.getBatchRemoveGroups().size());
final ArrayList<ListenableFuture<RpcResult<RemoveGroupOutput>>> resultsLot = new ArrayList<>();
for (BatchRemoveGroups addGroup : input.getBatchRemoveGroups()) {
final RemoveGroupInput removeGroupInput = new RemoveGroupInputBuilder(addGroup).setGroupRef(createGroupRef(input.getNode(), addGroup)).setNode(input.getNode()).build();
resultsLot.add(JdkFutureAdapters.listenInPoolThread(salGroupService.removeGroup(removeGroupInput)));
}
final ListenableFuture<RpcResult<List<BatchFailedGroupsOutput>>> commonResult = Futures.transform(Futures.allAsList(resultsLot), GroupUtil.<RemoveGroupOutput>createCumulatingFunction(input.getBatchRemoveGroups()));
ListenableFuture<RpcResult<RemoveGroupsBatchOutput>> removeGroupsBulkFuture = Futures.transform(commonResult, GroupUtil.GROUP_REMOVE_TRANSFORM);
if (input.isBarrierAfter()) {
removeGroupsBulkFuture = BarrierUtil.chainBarrier(removeGroupsBulkFuture, input.getNode(), transactionService, GroupUtil.GROUP_REMOVE_COMPOSING_TRANSFORM);
}
return removeGroupsBulkFuture;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.group.service.rev130918.RemoveGroupInput in project openflowplugin by opendaylight.
the class GroupConvertor method convert.
@Override
public GroupModInputBuilder convert(Group source, VersionDatapathIdConvertorData data) {
GroupModInputBuilder groupModInputBuilder = new GroupModInputBuilder();
if (source instanceof AddGroupInput) {
groupModInputBuilder.setCommand(GroupModCommand.OFPGCADD);
} else if (source instanceof RemoveGroupInput) {
groupModInputBuilder.setCommand(GroupModCommand.OFPGCDELETE);
} else if (source instanceof UpdatedGroup) {
groupModInputBuilder.setCommand(GroupModCommand.OFPGCMODIFY);
}
if (GroupTypes.GroupAll.equals(source.getGroupType())) {
groupModInputBuilder.setType(GroupType.OFPGTALL);
}
if (GroupTypes.GroupSelect.equals(source.getGroupType())) {
groupModInputBuilder.setType(GroupType.OFPGTSELECT);
}
if (GroupTypes.GroupIndirect.equals(source.getGroupType())) {
groupModInputBuilder.setType(GroupType.OFPGTINDIRECT);
}
if (GroupTypes.GroupFf.equals(source.getGroupType())) {
groupModInputBuilder.setType(GroupType.OFPGTFF);
}
groupModInputBuilder.setGroupId(new GroupId(source.getGroupId().getValue()));
// During group deletion do not push the buckets
if (groupModInputBuilder.getCommand() != GroupModCommand.OFPGCDELETE) {
if (source.getBuckets() != null && source.getBuckets().getBucket().size() != 0) {
Collections.sort(source.getBuckets().getBucket(), COMPARATOR);
List<BucketsList> bucketLists = salToOFBucketList(source.getBuckets(), data.getVersion(), source.getGroupType().getIntValue(), data.getDatapathId());
groupModInputBuilder.setBucketsList(bucketLists);
}
}
groupModInputBuilder.setVersion(data.getVersion());
return groupModInputBuilder;
}
Aggregations