-/**
+/*
* Copyright (c) 2015 Cisco Systems, Inc. and others. All rights reserved.
*
* This program and the accompanying materials are made available under the
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
import org.opendaylight.openflowplugin.api.openflow.device.Xid;
-import org.opendaylight.openflowplugin.impl.services.RequestInputUtils;
-import org.opendaylight.openflowplugin.impl.services.ServiceException;
+import org.opendaylight.openflowplugin.impl.services.util.RequestInputUtils;
import org.opendaylight.openflowplugin.impl.statistics.services.compatibility.AbstractCompatibleStatService;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorExecutor;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.data.VersionConvertorData;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestGroupDescCaseBuilder;
final class GroupDescriptionService
- extends AbstractCompatibleStatService<GetGroupDescriptionInput, GetGroupDescriptionOutput, GroupDescStatsUpdated> {
- private static final MultipartRequestGroupDescCase GROUP_DESC_CASE = new MultipartRequestGroupDescCaseBuilder().build();
+ extends AbstractCompatibleStatService<GetGroupDescriptionInput,
+ GetGroupDescriptionOutput,
+ GroupDescStatsUpdated> {
+ private static final MultipartRequestGroupDescCase GROUP_DESC_CASE =
+ new MultipartRequestGroupDescCaseBuilder().build();
private final ConvertorExecutor convertorExecutor;
- public GroupDescriptionService(RequestContextStack requestContextStack, DeviceContext deviceContext, AtomicLong compatibilityXidSeed, ConvertorExecutor convertorExecutor) {
+ GroupDescriptionService(RequestContextStack requestContextStack,
+ DeviceContext deviceContext,
+ AtomicLong compatibilityXidSeed,
+ ConvertorExecutor convertorExecutor) {
super(requestContextStack, deviceContext, compatibilityXidSeed);
this.convertorExecutor = convertorExecutor;
}
@Override
- protected OfHeader buildRequest(final Xid xid, final GetGroupDescriptionInput input) throws ServiceException {
+ protected OfHeader buildRequest(final Xid xid, final GetGroupDescriptionInput input) {
final MultipartRequestInputBuilder mprInput = RequestInputUtils.createMultipartHeader(
MultipartType.OFPMPGROUPDESC, xid.getValue(), getVersion());
mprInput.setMultipartRequestBody(GROUP_DESC_CASE);
notification.setMoreReplies(Boolean.FALSE);
notification.setTransactionId(emulatedTxId);
- notification.setGroupDescStats(new ArrayList<GroupDescStats>());
+ notification.setGroupDescStats(new ArrayList<>());
final VersionConvertorData data = new VersionConvertorData(getVersion());
for (MultipartReply mpReply : result) {
final Optional<List<GroupDescStats>> groupDescStatsList = convertorExecutor.convert(
replyBody.getGroupDesc(), data);
- if (groupDescStatsList.isPresent()) {
- notification.getGroupDescStats().addAll(groupDescStatsList.get());
- }
+ groupDescStatsList.ifPresent(groupDescStats -> notification.getGroupDescStats().addAll(groupDescStats));
}
return notification.build();