nbactions.xml
nb-configuration.xml
.fbExcludeFilterFile
+.factorypath
@Override
public void run() {
- readFlowsX(dpnCount, flowsPerDpn, verbose);
+ readFlowsX();
}
- private void readFlowsX(Integer dpnCount, Integer flowsPerDPN, boolean verbose) {
+ private void readFlowsX() {
readOpStatus.set(FlowCounter.OperationStatus.IN_PROGRESS.status());
for (int i = 1; i <= dpnCount; i++) {
String dpId = BulkOMaticUtils.DEVICE_TYPE_PREFIX + i;
- for (int j = 0; j < flowsPerDPN; j++) {
+ for (int j = 0; j < flowsPerDpn; j++) {
short tableRollover = (short) (endTableId - startTableId + 1);
short tableId = (short) (j % tableRollover + startTableId);
LOG.info("Using Sequential implementation of Flow Writer.");
}
- public void addFlows(Integer dpnCount, Integer flowsPerDPN, int batchSize, int sleepMillis, short startTableId,
+ public void addFlows(Integer count, Integer flowsPerDPN, int batchSize, int sleepMillis, short startTableId,
short endTableId, boolean isCreateParents) {
LOG.info("Using Sequential implementation of Flow Writer.");
- this.dpnCount = dpnCount;
- countDpnWriteCompletion.set(dpnCount);
+ this.dpnCount = count;
+ countDpnWriteCompletion.set(count);
startTime = System.nanoTime();
- for (int i = 1; i <= dpnCount; i++) {
+ for (int i = 1; i <= count; i++) {
FlowHandlerTask task = new FlowHandlerTask(Integer.toString(i), flowsPerDPN, true, batchSize, sleepMillis,
startTableId, endTableId, isCreateParents);
flowPusher.execute(task);
}
}
- public void deleteFlows(Integer dpnCount, Integer flowsPerDPN, int batchSize, short startTableId,
+ public void deleteFlows(Integer count, Integer flowsPerDPN, int batchSize, short startTableId,
short endTableId) {
LOG.info("Using Sequential implementation of Flow Writer.");
- countDpnWriteCompletion.set(dpnCount);
- for (int i = 1; i <= dpnCount; i++) {
+ countDpnWriteCompletion.set(count);
+ for (int i = 1; i <= count; i++) {
FlowHandlerTask task = new FlowHandlerTask(Integer.toString(i), flowsPerDPN, false, batchSize, 0,
startTableId, endTableId, false);
flowPusher.execute(task);
}
}
- /**
- * {@inheritDoc}
- */
@Override
public void nodeConnectorAdded(final InstanceIdentifier<NodeConnector> nodeConnectorInstanceId,
final FlowCapableNodeConnector flowConnector) {
packetProcessingService.transmitPacket(packet);
}
- /**
- * {@inheritDoc}
- */
@Override
public void nodeConnectorRemoved(final InstanceIdentifier<NodeConnector> nodeConnectorInstanceId) {
nodeConnectorMap.remove(nodeConnectorInstanceId);
private static final Logger LOG = LoggerFactory.getLogger(LLDPUtil.class);
private static final String OF_URI_PREFIX = "openflow:";
+ private LLDPUtil() {
+ }
+
static byte[] buildLldpFrame(final NodeId nodeId, final NodeConnectorId nodeConnectorId, final MacAddress src,
final Long outPortNo, final MacAddress destinationAddress) {
// Create discovery pkt
/**
* Helper methods that are used by multiple tests.
*/
-public class TestUtils {
+public final class TestUtils {
+ private TestUtils() {
+ }
+
static InstanceIdentifier<NodeConnector> createNodeConnectorId(String nodeKey, String nodeConnectorKey) {
return InstanceIdentifier.builder(Nodes.class)
.child(Node.class, new NodeKey(new NodeId(nodeKey)))
/**
* Method to initialize NotificationProviderConfig.
*/
- private NotificationProviderConfig initializeNotificationProviderConfig(boolean flowSupp, boolean meterSupp,
- boolean groupSupp,
- boolean connectorStatSupp,
- boolean flowStatSupp,
- boolean flowTableStatSupp,
- boolean meterStatSupp,
- boolean groupStatSupp,
- boolean queueStatSupp) {
+ private NotificationProviderConfig initializeNotificationProviderConfig(boolean hasFlowSupp,
+ boolean hasMeterSupp,
+ boolean hasGroupSupp,
+ boolean hasConnectorStatSupp,
+ boolean hasFlowStatSupp,
+ boolean hasFlowTableStatSupp,
+ boolean hasMeterStatSupp,
+ boolean hasGroupStatSupp,
+ boolean hasQueueStatSupp) {
NotificationProviderConfig.NotificationProviderConfigBuilder notif
= new NotificationProviderConfig.NotificationProviderConfigBuilder();
- notif.setFlowSupport(flowSupp);
- notif.setMeterSupport(meterSupp);
- notif.setGroupSupport(groupSupp);
- notif.setNodeConnectorStatSupport(connectorStatSupp);
- notif.setFlowStatSupport(flowStatSupp);
- notif.setFlowTableStatSupport(flowTableStatSupp);
- notif.setMeterStatSupport(meterStatSupp);
- notif.setGroupStatSupport(groupStatSupp);
- notif.setQueueStatSupport(queueStatSupp);
+ notif.setFlowSupport(hasFlowSupp);
+ notif.setMeterSupport(hasMeterSupp);
+ notif.setGroupSupport(hasGroupSupp);
+ notif.setNodeConnectorStatSupport(hasConnectorStatSupp);
+ notif.setFlowStatSupport(hasFlowStatSupp);
+ notif.setFlowTableStatSupport(hasFlowTableStatSupp);
+ notif.setMeterStatSupport(hasMeterStatSupp);
+ notif.setGroupStatSupport(hasGroupStatSupp);
+ notif.setQueueStatSupport(hasQueueStatSupp);
return notif.build();
}
/**
* Class is designed as ConfigSubsystem settings holder.
*/
-public class NotificationProviderConfig {
+public final class NotificationProviderConfig {
private final boolean flowSupport;
private final boolean meterSupport;
public class NotificationProviderTest {
private NotificationProviderService notificationProviderService;
- private NotificationProviderConfig config;
private DataBroker dataBroker;
@Before
}
@Test
- public void testCreateAllSuppliers() {
+ public void testCreateAllSuppliers() throws Exception {
final NotificationProviderConfig config = createAllConfigSupplier();
- final NotificationProvider provider = new NotificationProvider(notificationProviderService, dataBroker,
- config.isFlowSupport(), config.isMeterSupport(),
- config.isGroupSupport(),
- config.isNodeConnectorStatSupport(),
- config.isFlowStatSupport(),
- config.isFlowTableStatSupport(),
- config.isMeterStatSupport(),
- config.isGroupStatSupport(),
- config.isQueueStatSupport());
- provider.start();
- final List<NotificationSupplierDefinition<?>> listSuppliers = provider.getSupplierList();
- int nrOfSuppliers = 0;
- for (final NotificationSupplierDefinition<?> supplier : listSuppliers) {
- if (supplier != null) {
- nrOfSuppliers++;
+ try (NotificationProvider provider = new NotificationProvider(notificationProviderService, dataBroker,
+ config.isFlowSupport(), config.isMeterSupport(), config.isGroupSupport(),
+ config.isNodeConnectorStatSupport(), config.isFlowStatSupport(), config.isFlowTableStatSupport(),
+ config.isMeterStatSupport(), config.isGroupStatSupport(), config.isQueueStatSupport())) {
+ provider.start();
+ final List<NotificationSupplierDefinition<?>> listSuppliers = provider.getSupplierList();
+ int nrOfSuppliers = 0;
+ for (final NotificationSupplierDefinition<?> supplier : listSuppliers) {
+ if (supplier != null) {
+ nrOfSuppliers++;
+ }
}
+ assertEquals(11, nrOfSuppliers);
}
- assertEquals(11, nrOfSuppliers);
}
@Test
import java.util.Collection;
import java.util.Collections;
-public class TestChangeEventBuildHelper {
+public final class TestChangeEventBuildHelper {
private TestChangeEventBuildHelper() {
throw new UnsupportedOperationException("Test utility class");
import org.opendaylight.controller.md.sal.binding.api.DataTreeChangeListener;
import org.opendaylight.controller.md.sal.binding.api.DataTreeIdentifier;
-public class TestSupplierVerifyHelper {
+public final class TestSupplierVerifyHelper {
private TestSupplierVerifyHelper() {
throw new UnsupportedOperationException("Test utility class");
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class ShellUtil {
+public final class ShellUtil {
private static final Logger LOG = LoggerFactory.getLogger(ShellUtil.class);
public static final String NODE_PREFIX = "openflow:";
+ private ShellUtil() {
+ }
+
public static List<OFNode> getAllNodes(final DataBroker broker) {
List<Node> nodes = null;
ReadOnlyTransaction tx = broker.newReadOnlyTransaction();
}
return ofNode;
}
-}
\ No newline at end of file
+}
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-class TopologyManagerUtil {
+final class TopologyManagerUtil {
private static final Logger LOG = LoggerFactory.getLogger(TopologyManagerUtil.class);
import static org.mockito.Mockito.never;
import com.google.common.base.Optional;
-import com.google.common.util.concurrent.CheckedFuture;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.SettableFuture;
import com.google.common.util.concurrent.Uninterruptibles;
import java.util.concurrent.TimeUnit;
import org.mockito.ArgumentCaptor;
import org.mockito.InOrder;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
-import org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-public class TestUtils {
+public final class TestUtils {
+ private TestUtils() {
+ }
+
static void verifyMockTx(ReadWriteTransaction mockTx) {
InOrder inOrder = inOrder(mockTx);
inOrder.verify(mockTx, atLeast(0)).submit();
static CountDownLatch setupStubbedSubmit(ReadWriteTransaction mockTx) {
final CountDownLatch latch = new CountDownLatch(1);
- doAnswer(new Answer<CheckedFuture<Void, TransactionCommitFailedException>>() {
- @Override
- public CheckedFuture<Void, TransactionCommitFailedException> answer(InvocationOnMock invocation) {
- latch.countDown();
- return Futures.immediateCheckedFuture(null);
- }
+ doAnswer(invocation -> {
+ latch.countDown();
+ return Futures.immediateCheckedFuture(null);
}).when(mockTx).submit();
return latch;
@SuppressWarnings("rawtypes")
static void setupStubbedDeletes(ReadWriteTransaction mockTx, ArgumentCaptor<InstanceIdentifier> deletedLinkIDs,
final CountDownLatch latch) {
- doAnswer(new Answer<Void>() {
- @Override
- public Void answer(InvocationOnMock invocation) {
- latch.countDown();
- return null;
- }
+ doAnswer(invocation -> {
+ latch.countDown();
+ return null;
}).when(mockTx).delete(eq(LogicalDatastoreType.OPERATIONAL), deletedLinkIDs.capture());
}
}
@Override
- public void setFeatures(final FeaturesReply featuresReply) {
- this.featuresReply = featuresReply;
+ public void setFeatures(final FeaturesReply newFeaturesReply) {
+ this.featuresReply = newFeaturesReply;
}
@Override
}
@Override
- public void setOutboundQueueHandleRegistration(OutboundQueueHandlerRegistration<OutboundQueueProvider>
- outboundQueueHandlerRegistration) {
- this.outboundQueueHandlerRegistration = outboundQueueHandlerRegistration;
+ public void setOutboundQueueHandleRegistration(
+ OutboundQueueHandlerRegistration<OutboundQueueProvider> newRegistration) {
+ this.outboundQueueHandlerRegistration = newRegistration;
}
private void unregisterOutboundQueue() {
@Override
public void onSuccess(Void result) {
try {
- stepByStepVersionSubStep(remoteVersion, lastProposedVersion);
+ stepByStepVersionSubStep(remoteVersion);
} catch (Exception e) {
errorHandler.handleException(e);
handshakeListener.onHandshakeFailure();
}
});
} else {
- stepByStepVersionSubStep(remoteVersion, lastProposedVersion);
+ stepByStepVersionSubStep(remoteVersion);
}
}
- private void stepByStepVersionSubStep(Short remoteVersion, Short lastProposedVersion) throws Exception {
+ private void stepByStepVersionSubStep(Short remoteVersion) throws Exception {
if (remoteVersion.equals(lastProposedVersion)) {
postHandshake(lastProposedVersion, getNextXid());
LOG.trace("ret - OK - switch answered with lastProposedVersion");
} else {
checkNegotiationStalling(remoteVersion);
- if (remoteVersion > (lastProposedVersion == null ? highestVersion : this.lastProposedVersion)) {
+ if (remoteVersion > (lastProposedVersion == null ? highestVersion : lastProposedVersion)) {
// wait for next version
LOG.trace("ret - wait");
} else {
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
+import com.google.common.util.concurrent.MoreExecutors;
import io.netty.util.HashedWheelTimer;
import java.util.Collection;
import java.util.Collections;
public void processReply(final OfHeader ofHeader) {
messageSpy.spyMessage(
ofHeader.getImplementedInterface(),
- (ofHeader instanceof Error)
+ ofHeader instanceof Error
? MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_FAILURE
: MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_SUCCESS);
}
public void processReply(final Xid xid, final List<? extends OfHeader> ofHeaderList) {
ofHeaderList.forEach(header -> messageSpy.spyMessage(
header.getImplementedInterface(),
- (header instanceof Error)
+ header instanceof Error
? MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_FAILURE
: MessageSpy.StatisticsGroup.FROM_SWITCH_PUBLISHED_SUCCESS));
}
LOG.trace("notification offer failed..", throwable);
packetInLimiter.releasePermit();
}
- });
+ }, MoreExecutors.directExecutor());
}
@Override
}
@Override
- public void registerMastershipWatcher(@Nonnull final ContextChainMastershipWatcher contextChainMastershipWatcher) {
- this.contextChainMastershipWatcher = contextChainMastershipWatcher;
+ public void registerMastershipWatcher(@Nonnull final ContextChainMastershipWatcher newWatcher) {
+ this.contextChainMastershipWatcher = newWatcher;
}
@Nonnull
// TODO: exception handling should be fixed by using custom checked exception, never RuntimeExceptions
@Override
- @SuppressWarnings({"checkstyle:IllegalCatch", "checkstyle:AvoidHidingCauseExceptionCheck"})
+ @SuppressWarnings({"checkstyle:IllegalCatch"})
public void instantiateServiceInstance() {
lazyTransactionManagerInitialization();
submitTransaction();
} catch (final Exception ex) {
throw new RuntimeException(String.format("Error processing port status messages from device %s: %s",
- deviceInfo.toString(),
- ex.toString()));
+ deviceInfo.toString(), ex.toString()), ex);
}
final Optional<AbstractDeviceInitializer> initializer = deviceInitializerProvider
} catch (TimeoutException ex) {
initialize.cancel(true);
throw new RuntimeException(String.format("Failed to initialize device %s in %ss: %s",
- deviceInfo.toString(),
- String.valueOf(DEVICE_INIT_TIMEOUT / 1000),
- ex.toString()));
+ deviceInfo.toString(), String.valueOf(DEVICE_INIT_TIMEOUT / 1000), ex.toString()), ex);
} catch (ExecutionException | InterruptedException ex) {
- throw new RuntimeException(String.format("Device %s cannot be initialized: %s",
- deviceInfo.toString(),
- ex.toString()));
+ throw new RuntimeException(
+ String.format("Device %s cannot be initialized: %s", deviceInfo.toString(), ex.toString()), ex);
}
} else {
throw new RuntimeException(String.format("Unsupported version %s for device %s",
deviceRemovedHandlers.add(deviceRemovedHandler);
}
- private void changeMastershipState(final ContextChainState contextChainState) {
+ private void changeMastershipState(final ContextChainState newContextChainState) {
if (ContextChainState.CLOSED.equals(this.contextChainState.get())) {
return;
}
boolean propagate = ContextChainState.UNDEFINED.equals(this.contextChainState.get());
- this.contextChainState.set(contextChainState);
+ this.contextChainState.set(newContextChainState);
if (propagate) {
contexts.forEach(context -> {
if (context.map(ContextChainStateListener.class::isInstance)) {
- context.map(ContextChainStateListener.class::cast).onStateAcquired(contextChainState);
+ context.map(ContextChainStateListener.class::cast).onStateAcquired(newContextChainState);
}
});
}
}
@Override
- public void registerMastershipWatcher(@Nonnull final ContextChainMastershipWatcher contextChainMastershipWatcher) {
- this.contextChainMastershipWatcher = contextChainMastershipWatcher;
+ public void registerMastershipWatcher(@Nonnull final ContextChainMastershipWatcher newWatcher) {
+ this.contextChainMastershipWatcher = newWatcher;
}
@Override
}
@Override
- public void registerMastershipWatcher(@Nonnull final ContextChainMastershipWatcher contextChainMastershipWatcher) {
- this.contextChainMastershipWatcher = contextChainMastershipWatcher;
+ public void registerMastershipWatcher(@Nonnull final ContextChainMastershipWatcher newWatcher) {
+ this.contextChainMastershipWatcher = newWatcher;
}
@Override
private final long maximumPollingDelay;
private final boolean isUsingReconciliationFramework;
private final AtomicBoolean schedulingEnabled = new AtomicBoolean(true);
- private final AtomicReference<ListenableFuture<Boolean>> lastDataGathering = new AtomicReference<>();
- private final AtomicReference<StatisticsPollingService> statisticsPollingService = new AtomicReference<>();
+ private final AtomicReference<ListenableFuture<Boolean>> lastDataGatheringRef = new AtomicReference<>();
+ private final AtomicReference<StatisticsPollingService> statisticsPollingServiceRef = new AtomicReference<>();
private List<MultipartType> collectingStatType;
private StatisticsGatheringService<T> statisticsGatheringService;
private StatisticsGatheringOnTheFlyService<T> statisticsGatheringOnTheFlyService;
}
@Override
- public void registerMastershipWatcher(@Nonnull final ContextChainMastershipWatcher contextChainMastershipWatcher) {
- this.contextChainMastershipWatcher = contextChainMastershipWatcher;
+ public void registerMastershipWatcher(@Nonnull final ContextChainMastershipWatcher newWatcher) {
+ this.contextChainMastershipWatcher = newWatcher;
}
@Override
return Futures.immediateFuture(Boolean.TRUE);
}
- return this.lastDataGathering.updateAndGet(future -> {
+ return this.lastDataGatheringRef.updateAndGet(future -> {
// write start timestamp to state snapshot container
StatisticsGatheringUtils.markDeviceStateSnapshotStart(deviceInfo, deviceContext);
schedulingEnabled.set(true);
statisticsPollingService.startAsync();
- this.statisticsPollingService.set(statisticsPollingService);
+ this.statisticsPollingServiceRef.set(statisticsPollingService);
}
private ListenableFuture<Void> stopGatheringData() {
LOG.info("Stopping running statistics gathering for node {}", deviceInfo);
cancelLastDataGathering();
- return Optional.ofNullable(statisticsPollingService.getAndSet(null)).map(StatisticsPollingService::stop)
+ return Optional.ofNullable(statisticsPollingServiceRef.getAndSet(null)).map(StatisticsPollingService::stop)
.orElseGet(() -> Futures.immediateFuture(null));
}
private void cancelLastDataGathering() {
- final ListenableFuture<Boolean> future = lastDataGathering.getAndSet(null);
+ final ListenableFuture<Boolean> future = lastDataGatheringRef.getAndSet(null);
if (Objects.nonNull(future) && !future.isDone() && !future.isCancelled()) {
future.cancel(true);
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
+import com.google.common.util.concurrent.MoreExecutors;
import java.text.SimpleDateFormat;
import java.util.Collections;
import java.util.Date;
rpcResultIsNull ? "" : rpcResult.getErrors());
}
return false;
- }));
+ }), MoreExecutors.directExecutor());
}
private static boolean processStatistics(final MultipartType type, final List<? extends DataContainer> statistics,
*/
public class MultipartRequestInputFactoryTest {
- private long xid = 42L;
+ private final long xid = 42L;
private short ofVersion;
@Before
MultipartType mpType = MultipartType.OFPMPDESC;
final MultipartRequestInput mpRqInput =
(MultipartRequestInput) MultipartRequestInputFactory.makeMultipartRequest(xid, ofVersion, mpType, false);
- checkHeader(mpRqInput, mpType, ofVersion);
+ checkHeader(mpRqInput, mpType);
checkEmptyBody(mpRqInput.getMultipartRequestBody(), MultipartRequestDescCase.class);
}
final MultipartType mpType = MultipartType.OFPMPFLOW;
final MultipartRequestInput mpRqInput =
(MultipartRequestInput) MultipartRequestInputFactory.makeMultipartRequest(xid, ofVersion, mpType, false);
- checkHeader(mpRqInput, mpType, ofVersion);
+ checkHeader(mpRqInput, mpType);
final MultipartRequestBody mpRqBody = mpRqInput.getMultipartRequestBody();
Assert.assertTrue(mpRqBody instanceof MultipartRequestFlowCase);
ofVersion = OFConstants.OFP_VERSION_1_0;
final MultipartRequestInput mpRqInput =
(MultipartRequestInput) MultipartRequestInputFactory.makeMultipartRequest(xid, ofVersion, mpType, false);
- checkHeader(mpRqInput, mpType, ofVersion);
+ checkHeader(mpRqInput, mpType);
final MultipartRequestBody mpRqBody = mpRqInput.getMultipartRequestBody();
Assert.assertTrue(mpRqBody instanceof MultipartRequestFlowCase);
MultipartType mpType = MultipartType.OFPMPAGGREGATE;
final MultipartRequestInput mpRqInput =
(MultipartRequestInput) MultipartRequestInputFactory.makeMultipartRequest(xid, ofVersion, mpType, false);
- checkHeader(mpRqInput, mpType, ofVersion);
+ checkHeader(mpRqInput, mpType);
checkEmptyBody(mpRqInput.getMultipartRequestBody(), MultipartRequestAggregateCase.class);
}
MultipartType mpType = MultipartType.OFPMPTABLE;
final MultipartRequestInput mpRqInput =
(MultipartRequestInput) MultipartRequestInputFactory.makeMultipartRequest(xid, ofVersion, mpType, false);
- checkHeader(mpRqInput, mpType, ofVersion);
+ checkHeader(mpRqInput, mpType);
checkEmptyBody(mpRqInput.getMultipartRequestBody(), MultipartRequestTableCase.class);
}
final MultipartType mpType = MultipartType.OFPMPPORTSTATS;
final MultipartRequestInput mpRqInput =
(MultipartRequestInput) MultipartRequestInputFactory.makeMultipartRequest(xid, ofVersion, mpType, false);
- checkHeader(mpRqInput, mpType, ofVersion);
+ checkHeader(mpRqInput, mpType);
final MultipartRequestBody mpRqBody = mpRqInput.getMultipartRequestBody();
Assert.assertTrue(mpRqBody instanceof MultipartRequestPortStatsCase);
final MultipartType mpType = MultipartType.OFPMPQUEUE;
final MultipartRequestInput mpRqInput =
(MultipartRequestInput) MultipartRequestInputFactory.makeMultipartRequest(xid, ofVersion, mpType, false);
- checkHeader(mpRqInput, mpType, ofVersion);
+ checkHeader(mpRqInput, mpType);
final MultipartRequestBody mpRqBody = mpRqInput.getMultipartRequestBody();
Assert.assertTrue(mpRqBody instanceof MultipartRequestQueueCase);
final MultipartType mpType = MultipartType.OFPMPGROUP;
final MultipartRequestInput mpRqInput =
(MultipartRequestInput) MultipartRequestInputFactory.makeMultipartRequest(xid, ofVersion, mpType, false);
- checkHeader(mpRqInput, mpType, ofVersion);
+ checkHeader(mpRqInput, mpType);
final MultipartRequestBody mpRqBody = mpRqInput.getMultipartRequestBody();
Assert.assertTrue(mpRqBody instanceof MultipartRequestGroupCase);
MultipartType mpType = MultipartType.OFPMPGROUPDESC;
final MultipartRequestInput mpRqInput =
(MultipartRequestInput) MultipartRequestInputFactory.makeMultipartRequest(xid, ofVersion, mpType, false);
- checkHeader(mpRqInput, mpType, ofVersion);
+ checkHeader(mpRqInput, mpType);
checkEmptyBody(mpRqInput.getMultipartRequestBody(), MultipartRequestGroupDescCase.class);
}
MultipartType mpType = MultipartType.OFPMPGROUPFEATURES;
final MultipartRequestInput mpRqInput =
(MultipartRequestInput) MultipartRequestInputFactory.makeMultipartRequest(xid, ofVersion, mpType, false);
- checkHeader(mpRqInput, mpType, ofVersion);
+ checkHeader(mpRqInput, mpType);
checkEmptyBody(mpRqInput.getMultipartRequestBody(), MultipartRequestGroupFeaturesCase.class);
}
final MultipartType mpType = MultipartType.OFPMPMETER;
final MultipartRequestInput mpRqInput =
(MultipartRequestInput) MultipartRequestInputFactory.makeMultipartRequest(xid, ofVersion, mpType, false);
- checkHeader(mpRqInput, mpType, ofVersion);
+ checkHeader(mpRqInput, mpType);
final MultipartRequestBody mpRqBody = mpRqInput.getMultipartRequestBody();
Assert.assertTrue(mpRqBody instanceof MultipartRequestMeterCase);
final MultipartType mpType = MultipartType.OFPMPMETERCONFIG;
final MultipartRequestInput mpRqInput =
(MultipartRequestInput) MultipartRequestInputFactory.makeMultipartRequest(xid, ofVersion, mpType, false);
- checkHeader(mpRqInput, mpType, ofVersion);
+ checkHeader(mpRqInput, mpType);
final MultipartRequestBody mpRqBody = mpRqInput.getMultipartRequestBody();
Assert.assertTrue(mpRqBody instanceof MultipartRequestMeterConfigCase);
MultipartType mpType = MultipartType.OFPMPMETERFEATURES;
final MultipartRequestInput mpRqInput =
(MultipartRequestInput) MultipartRequestInputFactory.makeMultipartRequest(xid, ofVersion, mpType, false);
- checkHeader(mpRqInput, mpType, ofVersion);
+ checkHeader(mpRqInput, mpType);
checkEmptyBody(mpRqInput.getMultipartRequestBody(), MultipartRequestMeterFeaturesCase.class);
}
final MultipartType mpType = MultipartType.OFPMPTABLEFEATURES;
final MultipartRequestInput mpRqInput =
(MultipartRequestInput) MultipartRequestInputFactory.makeMultipartRequest(xid, ofVersion, mpType, false);
- checkHeader(mpRqInput, mpType, ofVersion);
+ checkHeader(mpRqInput, mpType);
final MultipartRequestBody mpRqBody = mpRqInput.getMultipartRequestBody();
Assert.assertTrue(mpRqBody instanceof MultipartRequestTableFeaturesCase);
MultipartType mpType = MultipartType.OFPMPPORTDESC;
final MultipartRequestInput mpRqInput =
(MultipartRequestInput) MultipartRequestInputFactory.makeMultipartRequest(xid, ofVersion, mpType, false);
- checkHeader(mpRqInput, mpType, ofVersion);
+ checkHeader(mpRqInput, mpType);
checkEmptyBody(mpRqInput.getMultipartRequestBody(), MultipartRequestPortDescCase.class);
}
MultipartType mpType = MultipartType.OFPMPEXPERIMENTER;
final MultipartRequestInput mpRqInput =
(MultipartRequestInput) MultipartRequestInputFactory.makeMultipartRequest(xid, ofVersion, mpType, false);
- checkHeader(mpRqInput, mpType, ofVersion);
+ checkHeader(mpRqInput, mpType);
checkEmptyBody(mpRqInput.getMultipartRequestBody(), MultipartRequestExperimenterCase.class);
}
- private void checkHeader(MultipartRequestInput mpRqInput, MultipartType mpType, short ofVersion) {
+ private void checkHeader(MultipartRequestInput mpRqInput, MultipartType mpType) {
Assert.assertFalse(mpRqInput.getFlags().isOFPMPFREQMORE());
Assert.assertEquals(ofVersion, mpRqInput.getVersion().shortValue());
Assert.assertEquals(mpType, mpRqInput.getType());
import org.opendaylight.controller.md.sal.binding.api.DataBroker;
import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
-import org.opendaylight.controller.md.sal.binding.api.ReadTransaction;
import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction;
import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
private OutboundQueueProvider outboundQueueProvider;
@Mock
private ConnectionAdapter connectionAdapter;
- private NodeId nodeId = new NodeId("h2g2:42");
- private KeyedInstanceIdentifier<Node, NodeKey> nodeKeyIdent = DeviceStateUtil.createNodeInstanceIdentifier(nodeId);
+ private final NodeId nodeId = new NodeId("h2g2:42");
+ private final KeyedInstanceIdentifier<Node, NodeKey> nodeKeyIdent =
+ DeviceStateUtil.createNodeInstanceIdentifier(nodeId);
@Mock
private TranslatorLibrary translatorLibrary;
@Mock
@Test
public void testGetReadTransaction() {
- final ReadTransaction readTx = deviceContext.getReadTransaction();
+ readTx = deviceContext.getReadTransaction();
assertNotNull(readTx);
assertEquals(this.readTx, readTx);
}
};
private MessageIntelligenceAgency mi5;
+ @Override
public void doSetUp() {
clearStatsCommandProvider = new ClearStatsCommandProvider();
mi5 = OpenFlowPluginProviderImpl.getMessageIntelligenceAgency();
*/
@Test
public void testDoExecute_dirty() throws Exception {
- final MessageIntelligenceAgency mi5 = OpenFlowPluginProviderImpl.getMessageIntelligenceAgency();
+ mi5 = OpenFlowPluginProviderImpl.getMessageIntelligenceAgency();
Assert.assertTrue(checkNoActivity(mi5.provideIntelligence(), CHECK_NO_ACTIVITY_FUNCTION));
mi5.spyMessage(OfHeader.class, MessageSpy.StatisticsGroup.FROM_SWITCH);
Assert.assertFalse(checkNoActivity(mi5.provideIntelligence(), CHECK_NO_ACTIVITY_FUNCTION));
clearStatsCommandProvider.execute(cmdSession);
Assert.assertTrue(checkNoActivity(mi5.provideIntelligence(), CHECK_NO_ACTIVITY_FUNCTION));
}
-}
\ No newline at end of file
+}
.build();
final Map<FlowRegistryKey, FlowDescriptor> allFlowDescriptors = fillRegistry(path, flowCapableNode);
- final FlowRegistryKey key = FlowRegistryKeyFactory.create(OFConstants.OFP_VERSION_1_3, flow);
+ key = FlowRegistryKeyFactory.create(OFConstants.OFP_VERSION_1_3, flow);
InOrder order = inOrder(dataBroker, readOnlyTransaction);
order.verify(dataBroker).newReadOnlyTransaction();
@Test
public void testForEach() throws Exception {
final AtomicInteger counter = new AtomicInteger(0);
- deviceFlowRegistry.forEach(key -> counter.incrementAndGet());
+ deviceFlowRegistry.forEach(k -> counter.incrementAndGet());
Assert.assertEquals(1, counter.get());
}
@Test
@SuppressWarnings("checkstyle:IllegalCatch")
public void testClose() throws Exception {
- final StatisticsContextImpl<MultipartReply> statisticsContext =
+ statisticsContext =
new StatisticsContextImpl<>(mockedDeviceContext,
convertorManager,
MultipartWriterProviderFactory
.thenReturn(new DeviceFlowRegistryImpl(OFConstants.OFP_VERSION_1_3, dataBroker, nodePath));
when(mockedDeviceContext.getDeviceState()).thenReturn(mockedDeviceState);
when(mockedDeviceContext.getMultiMsgCollector(
- Matchers.<RequestContext<List<MultipartReply>>>any())).thenAnswer(
+ Matchers.<RequestContext<List<MultipartReply>>>any())).thenAnswer(
invocation -> {
currentRequestContext = (RequestContext<List<MultipartReply>>) invocation.getArguments()[0];
return multiMagCollector;
- }
- );
+ });
when(rpcProviderRegistry.addRpcImplementation(
Matchers.eq(StatisticsManagerControlService.class),
Matchers.<StatisticsManagerControlService>any())).thenReturn(serviceControlRegistration);
service.handleAndNotify(input, notificationPublishService);
Assert.assertTrue(resultFuture.isDone());
- final RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput> rpcResult = resultFuture.get();
- Assert.assertTrue(rpcResult.isSuccessful());
+ final RpcResult<GetAggregateFlowStatisticsFromFlowTableForAllFlowsOutput> result = resultFuture.get();
+ Assert.assertTrue(result.isSuccessful());
Assert.assertEquals(MultipartType.OFPMPAGGREGATE, requestInput.getValue().getType());
Mockito.verify(notificationPublishService, Mockito.timeout(500))
.offerNotification(Matchers.any(AggregateFlowStatisticsUpdate.class));
@Mock
DeviceInfo deviceInfo;
@Mock
- List<PhyPort> phyPorts;
- @Mock
PhyPort phyPort;
ConvertorManager convertorManager;