X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=openflowplugin-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fopenflowplugin%2Fimpl%2Fstatistics%2Fservices%2FMeterFeaturesService.java;h=0818e94303459e4e6a3c7c460ed971664460c2cc;hb=HEAD;hp=c6593134b95b7f4e8d33307b7e28d24921f763ac;hpb=e2a2a5cb2bf24107ea8fcac048567cece947c371;p=openflowplugin.git diff --git a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/MeterFeaturesService.java b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/MeterFeaturesService.java index c6593134b9..0818e94303 100644 --- a/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/MeterFeaturesService.java +++ b/openflowplugin-impl/src/main/java/org/opendaylight/openflowplugin/impl/statistics/services/MeterFeaturesService.java @@ -9,8 +9,9 @@ package org.opendaylight.openflowplugin.impl.statistics.services; import com.google.common.annotations.VisibleForTesting; import com.google.common.base.Preconditions; -import java.util.ArrayList; +import com.google.common.collect.ImmutableSet; import java.util.List; +import java.util.Set; import java.util.concurrent.atomic.AtomicLong; import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext; import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack; @@ -48,9 +49,9 @@ final class MeterFeaturesService private static final MultipartRequestMeterFeaturesCase METER_FEATURES_CASE = new MultipartRequestMeterFeaturesCaseBuilder().build(); - MeterFeaturesService(RequestContextStack requestContextStack, - DeviceContext deviceContext, - AtomicLong compatibilityXidSeed) { + MeterFeaturesService(final RequestContextStack requestContextStack, + final DeviceContext deviceContext, + final AtomicLong compatibilityXidSeed) { super(requestContextStack, deviceContext, compatibilityXidSeed); } @@ -63,14 +64,15 @@ final class MeterFeaturesService } @Override - public GetMeterFeaturesOutput buildTxCapableResult(TransactionId emulatedTxId) { + public GetMeterFeaturesOutput buildTxCapableResult(final TransactionId emulatedTxId) { return new GetMeterFeaturesOutputBuilder().setTransactionId(emulatedTxId).build(); } @Override - public MeterFeaturesUpdated transformToNotification(List result, TransactionId emulatedTxId) { + public MeterFeaturesUpdated transformToNotification(final List result, + final TransactionId emulatedTxId) { final int mpSize = result.size(); - Preconditions.checkArgument(mpSize == 1, "unexpected (!=1) mp-reply size received: {}", mpSize); + Preconditions.checkArgument(mpSize == 1, "unexpected (!=1) mp-reply size received: %s", mpSize); MeterFeaturesUpdatedBuilder notification = new MeterFeaturesUpdatedBuilder(); notification.setId(getDeviceInfo().getNodeId()); @@ -90,34 +92,33 @@ final class MeterFeaturesService } @VisibleForTesting - protected static List> extractSupportedMeterBand(MultipartReplyMeterFeatures replyBody, - MeterBandTypeBitmap bandTypes) { - List> supportedMeterBand = new ArrayList<>(); - if (bandTypes.isOFPMBTDROP()) { - supportedMeterBand.add(MeterBandDrop.class); + protected static Set extractSupportedMeterBand( + final MultipartReplyMeterFeatures replyBody, final MeterBandTypeBitmap bandTypes) { + final var supportedMeterBand = ImmutableSet.builder(); + if (bandTypes.getOFPMBTDROP()) { + supportedMeterBand.add(MeterBandDrop.VALUE); } - if (replyBody.getBandTypes().isOFPMBTDSCPREMARK()) { - supportedMeterBand.add(MeterBandDscpRemark.class); + if (replyBody.getBandTypes().getOFPMBTDSCPREMARK()) { + supportedMeterBand.add(MeterBandDscpRemark.VALUE); } - return supportedMeterBand; + return supportedMeterBand.build(); } @VisibleForTesting - protected static List> extractMeterCapabilities(MeterFlags capabilities) { - List> supportedCapabilities = new ArrayList<>(); - - if (capabilities.isOFPMFBURST()) { - supportedCapabilities.add(MeterBurst.class); + protected static Set extractMeterCapabilities(final MeterFlags capabilities) { + final var supportedCapabilities = ImmutableSet.builder(); + if (capabilities.getOFPMFBURST()) { + supportedCapabilities.add(MeterBurst.VALUE); } - if (capabilities.isOFPMFKBPS()) { - supportedCapabilities.add(MeterKbps.class); + if (capabilities.getOFPMFKBPS()) { + supportedCapabilities.add(MeterKbps.VALUE); } - if (capabilities.isOFPMFPKTPS()) { - supportedCapabilities.add(MeterPktps.class); + if (capabilities.getOFPMFPKTPS()) { + supportedCapabilities.add(MeterPktps.VALUE); } - if (capabilities.isOFPMFSTATS()) { - supportedCapabilities.add(MeterStats.class); + if (capabilities.getOFPMFSTATS()) { + supportedCapabilities.add(MeterStats.VALUE); } - return supportedCapabilities; + return supportedCapabilities.build(); } }