From daa29ff070bbeaeb8eb6341bef22362e51f8bcb4 Mon Sep 17 00:00:00 2001 From: Robert Varga Date: Fri, 1 Jan 2021 22:51:20 +0100 Subject: [PATCH] Final round of isFoo() migration Finish up remaining components, so that we do not use isFoo() anywhere. Change-Id: I4da07dd94b689176ecc07ffb64ecfc36890e73b0 Signed-off-by: Robert Varga --- .../bulk/o/matic/SalBulkFlowServiceImpl.java | 20 +- .../bulk/o/matic/BulkOMaticUtilsTest.java | 1 - .../frm/impl/ForwardingRulesManagerImpl.java | 6 +- .../test/java/test/mock/FlowListenerTest.java | 6 +- .../src/test/java/test/mock/util/FRMTest.java | 14 +- .../impl/SimplifiedOperationalListener.java | 2 +- .../frsync/impl/strategy/TableForwarder.java | 29 +- .../SimplifiedOperationalListenerTest.java | 4 +- .../impl/strategy/FlowForwarderTest.java | 8 +- ...SyncPlanPushStrategyFlatBatchImplTest.java | 2 +- ...ncPlanPushStrategyIncrementalImplTest.java | 8 +- ...NodeConnectorInventoryEventTranslator.java | 11 +- ...ConnectorInventoryEventTranslatorTest.java | 2 +- .../ReconciliationServiceImpl.java | 21 +- .../cli/ShowNodeCommandProvider.java | 1 + .../TerminationPointChangeListenerImpl.java | 6 +- .../eric/codec/match/AbstractMatchCodec.java | 14 +- .../match/Icmpv6NDOptionsTypeCodecTest.java | 16 +- .../match/Icmpv6NDReservedCodecTest.java | 16 +- .../match/AbstractExperimenterMatchCodec.java | 23 +- .../nx/codec/match/AbstractMatchCodec.java | 15 +- .../nx/codec/match/AbstractRegCodec.java | 8 +- .../nx/codec/match/CtMarkCodec.java | 10 +- .../AbstractExperimenterMatchCodecTest.java | 14 +- .../nx/codec/match/ArpOpCodecTest.java | 4 +- .../nx/codec/match/ArpShaCodecTest.java | 4 +- .../nx/codec/match/ArpSpaCodecTest.java | 18 +- .../nx/codec/match/ArpThaCodecTest.java | 4 +- .../nx/codec/match/ArpTpaCodecTest.java | 17 +- .../nx/codec/match/CtStateCodecTest.java | 17 +- .../nx/codec/match/CtTpDstCodecTest.java | 17 +- .../nx/codec/match/CtTpSrcCodecTest.java | 5 +- .../nx/codec/match/CtZoneCodecTest.java | 20 +- .../nx/codec/match/EthDstCodecTest.java | 17 +- .../nx/codec/match/EthSrcCodecTest.java | 17 +- .../nx/codec/match/EthTypeCodecTest.java | 17 +- .../nx/codec/match/IcmpTypeCodecTest.java | 17 +- .../nx/codec/match/IpDstCodecTest.java | 17 +- .../nx/codec/match/IpSrcCodecTest.java | 17 +- .../nx/codec/match/Ipv6DstCodecTest.java | 17 +- .../nx/codec/match/Ipv6SrcCodecTest.java | 17 +- .../nx/codec/match/MetadataCodecTest.java | 17 +- .../nx/codec/match/PktMarkCodecTest.java | 17 +- .../nx/codec/match/Reg0CodecTest.java | 17 +- .../nx/codec/match/Reg1CodecTest.java | 17 +- .../nx/codec/match/Reg2CodecTest.java | 18 +- .../nx/codec/match/Reg3CodecTest.java | 18 +- .../nx/codec/match/Reg4CodecTest.java | 19 +- .../nx/codec/match/Reg5CodecTest.java | 18 +- .../nx/codec/match/Reg6CodecTest.java | 17 +- .../nx/codec/match/Reg7CodecTest.java | 17 +- .../nx/codec/match/TcpDstCodecTest.java | 17 +- .../nx/codec/match/TcpSrcCodecTest.java | 17 +- .../nx/codec/match/TunIdCodecTest.java | 17 +- .../nx/codec/match/TunIpv4DstCodecTest.java | 17 +- .../nx/codec/match/TunIpv4SrcCodecTest.java | 17 +- .../nx/codec/match/UdpDstCodecTest.java | 17 +- .../nx/codec/match/UdpSrcCodecTest.java | 17 +- .../nicira/convertor/match/RegConvertor.java | 12 +- .../AbstractBundleMessageFactory.java | 5 +- .../BundleAddMessageConverterTest.java | 6 +- .../converter/BundleControlConverterTest.java | 4 +- .../BundleControlFactoryTest.java | 11 +- ...lowPluginBulkGroupTransactionProvider.java | 642 +++++++----------- ...OpenflowPluginBulkTransactionProvider.java | 459 +++++-------- .../OpenflowpluginTestCommandProvider.java | 4 +- 66 files changed, 710 insertions(+), 1226 deletions(-) diff --git a/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/SalBulkFlowServiceImpl.java b/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/SalBulkFlowServiceImpl.java index db58c4db2b..d4392cfa25 100644 --- a/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/SalBulkFlowServiceImpl.java +++ b/applications/bulk-o-matic/src/main/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/SalBulkFlowServiceImpl.java @@ -99,7 +99,7 @@ public class SalBulkFlowServiceImpl implements SalBulkFlowService { @Override public ListenableFuture> addFlowsDs(final AddFlowsDsInput input) { WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction(); - boolean createParentsNextTime = requireNonNullElse(input.isAlwaysCreateParents(), Boolean.FALSE); + boolean createParentsNextTime = requireNonNullElse(input.getAlwaysCreateParents(), Boolean.FALSE); boolean createParents = true; for (BulkFlowDsItem bulkFlow : input.getBulkFlowDsItem()) { FlowBuilder flowBuilder = new FlowBuilder(bulkFlow); @@ -191,7 +191,7 @@ public class SalBulkFlowServiceImpl implements SalBulkFlowService { @Override public ListenableFuture> readFlowTest(final ReadFlowTestInput input) { FlowReader flowReader = FlowReader.getNewInstance(dataBroker, input.getDpnCount().intValue(), - input.getFlowsPerDpn().intValue(), input.isVerbose(), input.isIsConfigDs(), + input.getFlowsPerDpn().intValue(), input.getVerbose(), input.getIsConfigDs(), input.getStartTableId().shortValue(), input.getEndTableId().shortValue()); flowCounterBeanImpl.setReader(flowReader); fjService.execute(flowReader); @@ -249,14 +249,14 @@ public class SalBulkFlowServiceImpl implements SalBulkFlowService { @Override public ListenableFuture> flowTest(final FlowTestInput input) { - if (input.isTxChain()) { + if (input.getTxChain()) { FlowWriterTxChain flowTester = new FlowWriterTxChain(dataBroker, fjService); flowCounterBeanImpl.setWriter(flowTester); - if (input.isIsAdd()) { + if (input.getIsAdd()) { flowTester.addFlows(input.getDpnCount().intValue(), input.getFlowsPerDpn().intValue(), input.getBatchSize().intValue(), input.getSleepFor().intValue(), input.getSleepAfter().intValue(), input.getStartTableId().shortValue(), - input.getEndTableId().shortValue(), input.isCreateParents()); + input.getEndTableId().shortValue(), input.getCreateParents()); } else { flowTester.deleteFlows(input.getDpnCount().intValue(), input.getFlowsPerDpn().intValue(), input.getBatchSize().intValue(), input.getStartTableId().shortValue(), @@ -265,14 +265,14 @@ public class SalBulkFlowServiceImpl implements SalBulkFlowService { RpcResultBuilder rpcResultBuilder = RpcResultBuilder.success(); return Futures.immediateFuture(rpcResultBuilder.build()); } - if (input.isSeq()) { + if (input.getSeq()) { FlowWriterSequential flowTester = new FlowWriterSequential(dataBroker, fjService); flowCounterBeanImpl.setWriter(flowTester); - if (input.isIsAdd()) { + if (input.getIsAdd()) { flowTester.addFlows(input.getDpnCount().intValue(), input.getFlowsPerDpn().intValue(), input.getBatchSize().intValue(), input.getSleepFor().intValue(), input.getStartTableId().shortValue(), input.getEndTableId().shortValue(), - input.isCreateParents()); + input.getCreateParents()); } else { flowTester.deleteFlows(input.getDpnCount().intValue(), input.getFlowsPerDpn().intValue(), input.getBatchSize().intValue(), input.getStartTableId().shortValue(), @@ -281,11 +281,11 @@ public class SalBulkFlowServiceImpl implements SalBulkFlowService { } else { FlowWriterConcurrent flowTester = new FlowWriterConcurrent(dataBroker, fjService); flowCounterBeanImpl.setWriter(flowTester); - if (input.isIsAdd()) { + if (input.getIsAdd()) { flowTester.addFlows(input.getDpnCount().intValue(), input.getFlowsPerDpn().intValue(), input.getBatchSize().intValue(), input.getSleepFor().intValue(), input.getSleepAfter().intValue(), input.getStartTableId().shortValue(), - input.getEndTableId().shortValue(), input.isCreateParents()); + input.getEndTableId().shortValue(), input.getCreateParents()); } else { flowTester.deleteFlows(input.getDpnCount().intValue(), input.getFlowsPerDpn().intValue(), input.getBatchSize().intValue(), input.getStartTableId().shortValue(), diff --git a/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/BulkOMaticUtilsTest.java b/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/BulkOMaticUtilsTest.java index f640af1dbd..b7be46ee82 100644 --- a/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/BulkOMaticUtilsTest.java +++ b/applications/bulk-o-matic/src/test/java/org/opendaylight/openflowplugin/applications/bulk/o/matic/BulkOMaticUtilsTest.java @@ -5,7 +5,6 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.openflowplugin.applications.bulk.o.matic; import org.junit.Assert; diff --git a/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/ForwardingRulesManagerImpl.java b/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/ForwardingRulesManagerImpl.java index 4b39a21bbb..b5eaa2da02 100644 --- a/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/ForwardingRulesManagerImpl.java +++ b/applications/forwardingrules-manager/src/main/java/org/opendaylight/openflowplugin/applications/frm/impl/ForwardingRulesManagerImpl.java @@ -124,10 +124,10 @@ public class ForwardingRulesManagerImpl implements ForwardingRulesManager { @Reference final ServiceRecoveryRegistry serviceRecoveryRegistry, @Reference final FlowGroupCacheManager flowGroupCacheManager, final ListenerRegistrationHelper registrationHelper) { - disableReconciliation = config.isDisableReconciliation(); - staleMarkingEnabled = config.isStaleMarkingEnabled(); + disableReconciliation = config.getDisableReconciliation(); + staleMarkingEnabled = config.getStaleMarkingEnabled(); reconciliationRetryCount = config.getReconciliationRetryCount().toJava(); - isBundleBasedReconciliationEnabled = config.isBundleBasedReconciliationEnabled(); + isBundleBasedReconciliationEnabled = config.getBundleBasedReconciliationEnabled(); this.configurationServiceRegistration = configurationService.registerListener(this); this.registrationHelper = requireNonNull(registrationHelper, "RegistrationHelper cannot be null"); this.dataService = requireNonNull(dataBroker, "DataBroker can not be null!"); diff --git a/applications/forwardingrules-manager/src/test/java/test/mock/FlowListenerTest.java b/applications/forwardingrules-manager/src/test/java/test/mock/FlowListenerTest.java index 46c0fe3905..9d483803d5 100644 --- a/applications/forwardingrules-manager/src/test/java/test/mock/FlowListenerTest.java +++ b/applications/forwardingrules-manager/src/test/java/test/mock/FlowListenerTest.java @@ -166,8 +166,8 @@ public class FlowListenerTest extends FRMTest { assertEquals(1, updateFlowCalls.size()); assertEquals("DOM-1", updateFlowCalls.get(0).getTransactionUri().getValue()); assertEquals(flowII, updateFlowCalls.get(0).getFlowRef().getValue()); - assertEquals(Boolean.TRUE, updateFlowCalls.get(0).getOriginalFlow().isStrict()); - assertEquals(Boolean.TRUE, updateFlowCalls.get(0).getUpdatedFlow().isStrict()); + assertEquals(Boolean.TRUE, updateFlowCalls.get(0).getOriginalFlow().getStrict()); + assertEquals(Boolean.TRUE, updateFlowCalls.get(0).getUpdatedFlow().getStrict()); } @Test @@ -241,7 +241,7 @@ public class FlowListenerTest extends FRMTest { assertEquals(1, removeFlowCalls.size()); assertEquals("DOM-1", removeFlowCalls.get(0).getTransactionUri().getValue()); assertEquals(flowII, removeFlowCalls.get(0).getFlowRef().getValue()); - assertEquals(Boolean.TRUE, removeFlowCalls.get(0).isStrict()); + assertEquals(Boolean.TRUE, removeFlowCalls.get(0).getStrict()); } @Test diff --git a/applications/forwardingrules-manager/src/test/java/test/mock/util/FRMTest.java b/applications/forwardingrules-manager/src/test/java/test/mock/util/FRMTest.java index 06f5aa8e22..51c776220f 100644 --- a/applications/forwardingrules-manager/src/test/java/test/mock/util/FRMTest.java +++ b/applications/forwardingrules-manager/src/test/java/test/mock/util/FRMTest.java @@ -35,7 +35,7 @@ import org.opendaylight.yangtools.yang.common.Uint16; public abstract class FRMTest extends AbstractDataBrokerTest { - public void addFlowCapableNode(NodeKey nodeKey) { + public void addFlowCapableNode(final NodeKey nodeKey) { Nodes nodes = new NodesBuilder().build(); NodeBuilder nodeBuilder = new NodeBuilder(); @@ -54,11 +54,11 @@ public abstract class FRMTest extends AbstractDataBrokerTest { // TODO: remove with mdsal-3.0.7 or later @SuppressWarnings("unchecked") - protected static final void assertCommit(FluentFuture future) { + protected static final void assertCommit(final FluentFuture future) { assertCommit((ListenableFuture) future); } - public void removeNode(NodeKey nodeKey) throws ExecutionException, InterruptedException { + public void removeNode(final NodeKey nodeKey) throws ExecutionException, InterruptedException { WriteTransaction writeTx = getDataBroker().newWriteOnlyTransaction(); writeTx.delete(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.create(Nodes.class).child(Node.class, nodeKey)); @@ -92,21 +92,21 @@ public abstract class FRMTest extends AbstractDataBrokerTest { }); Mockito.lenient().when(configurationService.getProperty(Mockito.eq("disable-reconciliation"), Mockito.any())) - .thenReturn(config.isDisableReconciliation()); + .thenReturn(config.getDisableReconciliation()); Mockito.lenient().when(configurationService.getProperty(Mockito.eq("stale-marking-enabled"), Mockito.any())) - .thenReturn(config.isStaleMarkingEnabled()); + .thenReturn(config.getStaleMarkingEnabled()); Mockito.lenient().when(configurationService.getProperty(Mockito.eq("reconciliation-retry-count"), Mockito.any())).thenReturn(config.getReconciliationRetryCount()); Mockito.lenient().when(configurationService.getProperty(Mockito.eq("bundle-based-reconciliation-enabled"), - Mockito.any())).thenReturn(config.isBundleBasedReconciliationEnabled()); + Mockito.any())).thenReturn(config.getBundleBasedReconciliationEnabled()); return configurationService; } - protected Callable listSize(List list) { + protected Callable listSize(final List list) { // The condition supplier part return list::size; } diff --git a/applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/SimplifiedOperationalListener.java b/applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/SimplifiedOperationalListener.java index 3448b160b7..d2620c2b35 100644 --- a/applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/SimplifiedOperationalListener.java +++ b/applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/SimplifiedOperationalListener.java @@ -190,7 +190,7 @@ public class SimplifiedOperationalListener extends AbstractFrmSyncListener return false; } - if (!gatheringStatusEnd.isSucceeded()) { + if (!gatheringStatusEnd.getSucceeded()) { LOG.trace("Statistics gathering was not successful: {}", nodeId.getValue()); return false; } diff --git a/applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/TableForwarder.java b/applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/TableForwarder.java index 351a86ba40..6d470b4bc3 100644 --- a/applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/TableForwarder.java +++ b/applications/forwardingrules-sync/src/main/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/TableForwarder.java @@ -5,11 +5,9 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.openflowplugin.applications.frsync.impl.strategy; import com.google.common.util.concurrent.ListenableFuture; -import java.util.Collections; import org.opendaylight.openflowplugin.applications.frsync.ForwardingRulesUpdateCommitter; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table; @@ -24,6 +22,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.tab import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.TableRef; import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.binding.util.BindingMap; import org.opendaylight.yangtools.yang.common.RpcResult; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -36,7 +35,7 @@ public class TableForwarder implements ForwardingRulesUpdateCommitter> update(final InstanceIdentifier identifier, final TableFeatures original, final TableFeatures update, final InstanceIdentifier nodeIdent) { - LOG.debug("Forwarding Table Update request [Tbl id, node Id {} {}", - identifier, nodeIdent); - - final UpdateTableInputBuilder builder = new UpdateTableInputBuilder(); - - builder.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class))); - + LOG.debug("Forwarding Table Update request [Tbl id, node Id {} {}", identifier, nodeIdent); final InstanceIdentifier iiToTable = nodeIdent.child(Table.class, new TableKey(identifier.firstKeyOf(TableFeatures.class).getTableId())); - builder.setTableRef(new TableRef(iiToTable)); - - builder.setUpdatedTable(new UpdatedTableBuilder().setTableFeatures( - Collections.singletonList(update)).build()); - - builder.setOriginalTable(new OriginalTableBuilder().setTableFeatures( - Collections.singletonList(original)).build()); - LOG.debug("Invoking SalTableService {} ", nodeIdent); - return salTableService.updateTable(builder.build()); + LOG.debug("Invoking SalTableService {}", nodeIdent); + return salTableService.updateTable(new UpdateTableInputBuilder() + .setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class))) + .setTableRef(new TableRef(iiToTable)) + .setUpdatedTable(new UpdatedTableBuilder().setTableFeatures(BindingMap.of(update)).build()) + .setOriginalTable(new OriginalTableBuilder().setTableFeatures(BindingMap.of(original)).build()) + .build()); } } diff --git a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SimplifiedOperationalListenerTest.java b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SimplifiedOperationalListenerTest.java index 3502295cfa..be4a21de52 100644 --- a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SimplifiedOperationalListenerTest.java +++ b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/SimplifiedOperationalListenerTest.java @@ -192,7 +192,7 @@ public class SimplifiedOperationalListenerTest { Mockito.when(operationalNode.augmentation(FlowCapableStatisticsGatheringStatus.class)) .thenReturn(statisticsGatheringStatus); Mockito.when(statisticsGatheringStatus.getSnapshotGatheringStatusEnd()).thenReturn(snapshotGatheringStatusEnd); - Mockito.when(snapshotGatheringStatusEnd.isSucceeded()).thenReturn(false); + Mockito.when(snapshotGatheringStatusEnd.getSucceeded()).thenReturn(false); nodeListenerOperational.onDataTreeChanged(Collections.singleton(dataTreeModification)); @@ -260,7 +260,7 @@ public class SimplifiedOperationalListenerTest { Mockito.when(operationalNode.augmentation(FlowCapableStatisticsGatheringStatus.class)) .thenReturn(statisticsGatheringStatus); Mockito.when(statisticsGatheringStatus.getSnapshotGatheringStatusEnd()).thenReturn(snapshotGatheringStatusEnd); - Mockito.when(snapshotGatheringStatusEnd.isSucceeded()).thenReturn(true); + Mockito.when(snapshotGatheringStatusEnd.getSucceeded()).thenReturn(true); Mockito.when(snapshotGatheringStatusEnd.getEnd()).thenReturn(Mockito.mock(DateAndTime.class)); final String timestampBefore = "0000-12-12T01:01:01.000-07:00"; final String timestampAfter = "9999-12-12T01:01:01.000-07:00"; diff --git a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/FlowForwarderTest.java b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/FlowForwarderTest.java index 21350b4484..6f551cf803 100644 --- a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/FlowForwarderTest.java +++ b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/FlowForwarderTest.java @@ -117,7 +117,7 @@ public class FlowForwarderTest { Assert.assertEquals(null, flowInput.getInstructions()); Assert.assertEquals(nodePath, flowInput.getNode().getValue()); Assert.assertEquals(flowPath, flowInput.getFlowRef().getValue()); - Assert.assertEquals(null, flowInput.isStrict()); + Assert.assertEquals(null, flowInput.getStrict()); final RpcResult addFlowOutputRpcResult = addResult.get(2, TimeUnit.SECONDS); @@ -168,12 +168,12 @@ public class FlowForwarderTest { Assert.assertEquals(2, flowInput.getTableId().shortValue()); Assert.assertEquals(emptyMatch, flowInput.getMatch()); Assert.assertEquals(originalInstructions, flowInput.getInstructions()); - Assert.assertEquals(true, flowInput.isStrict()); + Assert.assertEquals(true, flowInput.getStrict()); Assert.assertEquals(2, flowOrigInput.getTableId().shortValue()); Assert.assertEquals(emptyMatch, flowOrigInput.getMatch()); Assert.assertEquals(null, flowOrigInput.getInstructions()); - Assert.assertEquals(true, flowOrigInput.isStrict()); + Assert.assertEquals(true, flowOrigInput.getStrict()); final RpcResult updateFlowOutputRpcResult = updateResult.get(2, TimeUnit.SECONDS); @@ -199,7 +199,7 @@ public class FlowForwarderTest { Assert.assertEquals(2, flowInput.getTableId().shortValue()); Assert.assertEquals(emptyMatch, flowInput.getMatch()); Assert.assertEquals(null, flowInput.getInstructions()); - Assert.assertEquals(true, flowInput.isStrict()); + Assert.assertEquals(true, flowInput.getStrict()); final RpcResult removeFlowOutputRpcResult = removeResult.get(2, TimeUnit.SECONDS); diff --git a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyFlatBatchImplTest.java b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyFlatBatchImplTest.java index 2ecd2e83cf..f7a19315b0 100644 --- a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyFlatBatchImplTest.java +++ b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyFlatBatchImplTest.java @@ -134,7 +134,7 @@ public class SyncPlanPushStrategyFlatBatchImplTest { Mockito.verify(flatBatchService).processFlatBatch(processFlatBatchInputCpt.capture()); final ProcessFlatBatchInput processFlatBatchInput = processFlatBatchInputCpt.getValue(); - Assert.assertFalse(processFlatBatchInput.isExitOnFirstError()); + Assert.assertFalse(processFlatBatchInput.getExitOnFirstError()); Assert.assertEquals(13, processFlatBatchInput.getBatch().size()); Assert.assertTrue(rpcResult.isDone()); diff --git a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyIncrementalImplTest.java b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyIncrementalImplTest.java index b194454f7d..2338477f4c 100644 --- a/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyIncrementalImplTest.java +++ b/applications/forwardingrules-sync/src/test/java/org/opendaylight/openflowplugin/applications/frsync/impl/strategy/SyncPlanPushStrategyIncrementalImplTest.java @@ -9,7 +9,6 @@ package org.opendaylight.openflowplugin.applications.frsync.impl.strategy; import com.google.common.collect.Lists; import com.google.common.util.concurrent.ListenableFuture; -import java.util.Collections; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; @@ -57,6 +56,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.Upd import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures; import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesBuilder; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.binding.util.BindingMap; import org.opendaylight.yangtools.yang.common.RpcResult; import org.opendaylight.yangtools.yang.common.RpcResultBuilder; import org.opendaylight.yangtools.yang.common.Uint32; @@ -616,10 +616,8 @@ public class SyncPlanPushStrategyIncrementalImplTest { .thenReturn(RpcResultBuilder.success(new UpdateTableOutputBuilder().build()).buildFuture()); final FlowCapableNode operational = new FlowCapableNodeBuilder() - .setTable(Collections.singletonList(new TableBuilder() - .setId(Uint8.ONE) - .build())) - .setTableFeatures(Collections.singletonList(new TableFeaturesBuilder() + .setTable(BindingMap.of(new TableBuilder().setId(Uint8.ONE).build())) + .setTableFeatures(BindingMap.of(new TableFeaturesBuilder() .setName("test table features") .setTableId(Uint8.ONE) .build())) diff --git a/applications/lldp-speaker/src/main/java/org/opendaylight/openflowplugin/applications/lldpspeaker/NodeConnectorInventoryEventTranslator.java b/applications/lldp-speaker/src/main/java/org/opendaylight/openflowplugin/applications/lldpspeaker/NodeConnectorInventoryEventTranslator.java index 5534f6967d..fe59607dc3 100644 --- a/applications/lldp-speaker/src/main/java/org/opendaylight/openflowplugin/applications/lldpspeaker/NodeConnectorInventoryEventTranslator.java +++ b/applications/lldp-speaker/src/main/java/org/opendaylight/openflowplugin/applications/lldpspeaker/NodeConnectorInventoryEventTranslator.java @@ -61,7 +61,8 @@ public class NodeConnectorInventoryEventTranslator = new HashMap<>(); @SuppressWarnings("IllegalCatch") - public NodeConnectorInventoryEventTranslator(DataBroker dataBroker, NodeConnectorEventsObserver... observers) { + public NodeConnectorInventoryEventTranslator(final DataBroker dataBroker, + final NodeConnectorEventsObserver... observers) { this.observers = ImmutableSet.copyOf(observers); final DataTreeIdentifier dtiToNodeConnector = DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL, II_TO_FLOW_CAPABLE_NODE_CONNECTOR); @@ -93,7 +94,7 @@ public class NodeConnectorInventoryEventTranslator } @Override - public void onDataTreeChanged(@NonNull Collection> modifications) { + public void onDataTreeChanged(@NonNull final Collection> modifications) { for (DataTreeModification modification : modifications) { LOG.trace("Node connectors in inventory changed -> {}", modification.getRootNode().getModificationType()); switch (modification.getRootNode().getModificationType()) { @@ -142,7 +143,7 @@ public class NodeConnectorInventoryEventTranslator FlowCapableNodeConnector flowNodeConnector = iiToDownFlowCapableNodeConnectors.get(nodeConnectorInstanceId); if (flowNodeConnector != null) { State state = (State) modification.getRootNode().getDataAfter(); - if (!state.isLinkDown()) { + if (!state.getLinkDown()) { FlowCapableNodeConnectorBuilder flowCapableNodeConnectorBuilder = new FlowCapableNodeConnectorBuilder(flowNodeConnector); flowCapableNodeConnectorBuilder.setState(state); @@ -162,14 +163,14 @@ public class NodeConnectorInventoryEventTranslator } } - private boolean compareIITail(final InstanceIdentifier ii1, final InstanceIdentifier ii2) { + private static boolean compareIITail(final InstanceIdentifier ii1, final InstanceIdentifier ii2) { return Iterables.getLast(ii1.getPathArguments()).equals(Iterables.getLast(ii2.getPathArguments())); } private static boolean isPortDown(final FlowCapableNodeConnector flowCapableNodeConnector) { PortState portState = flowCapableNodeConnector.getState(); PortConfig portConfig = flowCapableNodeConnector.getConfiguration(); - return portState != null && portState.isLinkDown() || portConfig != null && portConfig.isPORTDOWN(); + return portState != null && portState.getLinkDown() || portConfig != null && portConfig.getPORTDOWN(); } private void notifyNodeConnectorAppeared(final InstanceIdentifier nodeConnectorInstanceId, diff --git a/applications/lldp-speaker/src/test/java/org/opendaylight/openflowplugin/applications/lldpspeaker/NodeConnectorInventoryEventTranslatorTest.java b/applications/lldp-speaker/src/test/java/org/opendaylight/openflowplugin/applications/lldpspeaker/NodeConnectorInventoryEventTranslatorTest.java index b7e48cbcd2..92a4754367 100644 --- a/applications/lldp-speaker/src/test/java/org/opendaylight/openflowplugin/applications/lldpspeaker/NodeConnectorInventoryEventTranslatorTest.java +++ b/applications/lldp-speaker/src/test/java/org/opendaylight/openflowplugin/applications/lldpspeaker/NodeConnectorInventoryEventTranslatorTest.java @@ -161,7 +161,7 @@ public class NodeConnectorInventoryEventTranslatorTest { // Create prerequisites InstanceIdentifier id2 = TestUtils.createNodeConnectorId("openflow:1", "openflow:1:2"); InstanceIdentifier iiToConnector2 = id2.augmentation(FlowCapableNodeConnector.class); - List modifications = new ArrayList(); + List modifications = new ArrayList<>(); modifications.add(setupDataTreeChange(WRITE, NODE_CONNECTOR_INSTANCE_IDENTIFIER, FLOW_CAPABLE_NODE_CONNECTOR)); modifications.add(setupDataTreeChange(DELETE, iiToConnector2, null)); // Invoke onDataTreeChanged and check that both observers notified diff --git a/applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/ReconciliationServiceImpl.java b/applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/ReconciliationServiceImpl.java index c2839277eb..f7f7e7b19a 100644 --- a/applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/ReconciliationServiceImpl.java +++ b/applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/ReconciliationServiceImpl.java @@ -69,9 +69,10 @@ public class ReconciliationServiceImpl implements ReconciliationService, AutoClo private final AlarmAgent alarmAgent; private final NodeListener nodeListener; private final int threadPoolSize = 10; - private final ExecutorService executor = Executors.newWorkStealingPool(threadPoolSize); private final Map reconciliationStates; + private ExecutorService executor = Executors.newWorkStealingPool(threadPoolSize); + public ReconciliationServiceImpl(final DataBroker broker, final FrmReconciliationService frmReconciliationService, final AlarmAgent alarmAgent, final NodeListener nodeListener, final FlowGroupCacheManager flowGroupCacheManager) { @@ -86,12 +87,13 @@ public class ReconciliationServiceImpl implements ReconciliationService, AutoClo public void close() { if (executor != null) { executor.shutdownNow(); + executor = null; } } @Override - public ListenableFuture> reconcile(ReconcileInput input) { - boolean reconcileAllNodes = input.isReconcileAllNodes(); + public ListenableFuture> reconcile(final ReconcileInput input) { + boolean reconcileAllNodes = input.getReconcileAllNodes(); List inputNodes = input.getNodes(); if (inputNodes == null) { inputNodes = new ArrayList<>(); @@ -142,7 +144,7 @@ public class ReconciliationServiceImpl implements ReconciliationService, AutoClo return reconciliationStates.get(nodeId.toString()); } - private static ListenableFuture> buildErrorResponse(String msg) { + private static ListenableFuture> buildErrorResponse(final String msg) { LOG.error("Error {}", msg); return RpcResultBuilder.failed() .withError(RpcError.ErrorType.PROTOCOL, "reconcile", msg) @@ -151,7 +153,7 @@ public class ReconciliationServiceImpl implements ReconciliationService, AutoClo private List getAllNodes() { List nodeList = ShellUtil.getAllNodes(nodeListener); - List nodes = nodeList.stream().distinct().map(node -> node.getNodeId()).collect(Collectors.toList()); + List nodes = nodeList.stream().distinct().map(OFNode::getNodeId).collect(Collectors.toList()); return nodes; } @@ -160,7 +162,7 @@ public class ReconciliationServiceImpl implements ReconciliationService, AutoClo private final NodeKey nodeKey; private final Uint64 nodeId; - private ReconciliationTask(Uint64 nodeId, NodeKey nodeKey) { + private ReconciliationTask(final Uint64 nodeId, final NodeKey nodeKey) { this.nodeId = nodeId; this.nodeKey = nodeKey; } @@ -230,8 +232,8 @@ public class ReconciliationServiceImpl implements ReconciliationService, AutoClo } } - private Optional getReconciliationCount(ReadWriteTransaction tx, - InstanceIdentifier instanceIdentifier) { + private Optional getReconciliationCount(final ReadWriteTransaction tx, + final InstanceIdentifier instanceIdentifier) { try { return tx.read(LogicalDatastoreType.OPERATIONAL, instanceIdentifier).get(); } catch (InterruptedException | ExecutionException e) { @@ -240,8 +242,7 @@ public class ReconciliationServiceImpl implements ReconciliationService, AutoClo return Optional.empty(); } - - private void updateReconciliationState(ReconciliationState.ReconciliationStatus status) { + private void updateReconciliationState(final ReconciliationState.ReconciliationStatus status) { ReconciliationState state = new ReconciliationState(status, LocalDateTime.now()); reconciliationStates.put(nodeId.toString(),state); } diff --git a/applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/cli/ShowNodeCommandProvider.java b/applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/cli/ShowNodeCommandProvider.java index da4bb99b0a..d75ced1e69 100644 --- a/applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/cli/ShowNodeCommandProvider.java +++ b/applications/southbound-cli/src/main/java/org/opendaylight/openflowplugin/applications/southboundcli/cli/ShowNodeCommandProvider.java @@ -32,6 +32,7 @@ public class ShowNodeCommandProvider extends OsgiCommandSupport { } @SuppressWarnings("checkstyle:RegexpSinglelineJava") + @Deprecated @Override protected Object doExecute() { if (nodeId == null) { diff --git a/applications/topology-manager/src/main/java/org/opendaylight/openflowplugin/applications/topology/manager/TerminationPointChangeListenerImpl.java b/applications/topology-manager/src/main/java/org/opendaylight/openflowplugin/applications/topology/manager/TerminationPointChangeListenerImpl.java index 43ac954e3d..16e52aa31a 100644 --- a/applications/topology-manager/src/main/java/org/opendaylight/openflowplugin/applications/topology/manager/TerminationPointChangeListenerImpl.java +++ b/applications/topology-manager/src/main/java/org/opendaylight/openflowplugin/applications/topology/manager/TerminationPointChangeListenerImpl.java @@ -47,7 +47,7 @@ public class TerminationPointChangeListenerImpl extends DataTreeChangeListenerIm } @Override - public void onDataTreeChanged(Collection> modifications) { + public void onDataTreeChanged(final Collection> modifications) { for (DataTreeModification modification : modifications) { switch (modification.getRootNode().getModificationType()) { case WRITE: @@ -127,9 +127,9 @@ public class TerminationPointChangeListenerImpl extends DataTreeChangeListenerIm private void removeLinks(final FlowCapableNodeConnector flowCapNodeConnector, final TerminationPoint point) { operationProcessor.enqueueOperation(manager -> { - if (flowCapNodeConnector.getState() != null && flowCapNodeConnector.getState().isLinkDown() + if (flowCapNodeConnector.getState() != null && flowCapNodeConnector.getState().getLinkDown() || flowCapNodeConnector.getConfiguration() != null - && flowCapNodeConnector.getConfiguration().isPORTDOWN()) { + && flowCapNodeConnector.getConfiguration().getPORTDOWN()) { TopologyManagerUtil.removeAffectedLinks(point.getTpId(), manager, II_TO_TOPOLOGY); } }); diff --git a/extension/openflowjava-extension-eric/src/main/java/org/opendaylight/openflowjava/eric/codec/match/AbstractMatchCodec.java b/extension/openflowjava-extension-eric/src/main/java/org/opendaylight/openflowjava/eric/codec/match/AbstractMatchCodec.java index 8a98549a72..b6e645ff9e 100644 --- a/extension/openflowjava-extension-eric/src/main/java/org/opendaylight/openflowjava/eric/codec/match/AbstractMatchCodec.java +++ b/extension/openflowjava-extension-eric/src/main/java/org/opendaylight/openflowjava/eric/codec/match/AbstractMatchCodec.java @@ -26,7 +26,7 @@ public abstract class AbstractMatchCodec implements protected EricHeader headerWithMask; protected EricHeader headerWithoutMask; - protected MatchEntryBuilder deserializeHeaderToBuilder(ByteBuf message) { + protected MatchEntryBuilder deserializeHeaderToBuilder(final ByteBuf message) { MatchEntryBuilder builder = new MatchEntryBuilder(); builder.setOxmClass(getOxmClass()); // skip oxm_class - provided @@ -40,20 +40,20 @@ public abstract class AbstractMatchCodec implements } @Override - public MatchEntry deserializeHeader(ByteBuf message) { + public MatchEntry deserializeHeader(final ByteBuf message) { return deserializeHeaderToBuilder(message).build(); } @Override - public void serializeHeader(MatchEntry input, ByteBuf outBuffer) { - serializeHeader(getHeader(input.isHasMask()), outBuffer); + public void serializeHeader(final MatchEntry input, final ByteBuf outBuffer) { + serializeHeader(getHeader(input.getHasMask()), outBuffer); } - public void serializeHeader(EricHeader input, ByteBuf outBuffer) { + public void serializeHeader(final EricHeader input, final ByteBuf outBuffer) { outBuffer.writeInt((int) input.toLong()); } - protected EricHeader getHeader(boolean hasMask) { + protected EricHeader getHeader(final boolean hasMask) { if (hasMask) { if (headerWithMask == null) { headerWithMask = buildHeader(hasMask); @@ -67,7 +67,7 @@ public abstract class AbstractMatchCodec implements } } - protected EricHeader buildHeader(boolean hasMask) { + protected EricHeader buildHeader(final boolean hasMask) { return new EricHeader( getOxmClassCode(), getEricFieldCode(), diff --git a/extension/openflowjava-extension-eric/src/test/java/org/opendaylight/openflowjava/eric/codec/match/Icmpv6NDOptionsTypeCodecTest.java b/extension/openflowjava-extension-eric/src/test/java/org/opendaylight/openflowjava/eric/codec/match/Icmpv6NDOptionsTypeCodecTest.java index 7eb82bf8bb..4f137b6f4d 100644 --- a/extension/openflowjava-extension-eric/src/test/java/org/opendaylight/openflowjava/eric/codec/match/Icmpv6NDOptionsTypeCodecTest.java +++ b/extension/openflowjava-extension-eric/src/test/java/org/opendaylight/openflowjava/eric/codec/match/Icmpv6NDOptionsTypeCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.eric.api.EricConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.EricExpClass; @@ -28,15 +27,10 @@ public class Icmpv6NDOptionsTypeCodecTest { private static final int ERIC_FIELD_CODE = 2; private static final int VALUE_LENGTH = 1; - private Icmpv6NDOptionsTypeCodec icmpv6NDOptionsTypeCodec; - private ByteBuf buffer; - private MatchEntry input; + private final Icmpv6NDOptionsTypeCodec icmpv6NDOptionsTypeCodec = new Icmpv6NDOptionsTypeCodec(); + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); - @Before - public void setUp() { - icmpv6NDOptionsTypeCodec = new Icmpv6NDOptionsTypeCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } + private MatchEntry input; @Test public void serializeTest() { @@ -61,7 +55,7 @@ public class Icmpv6NDOptionsTypeCodecTest { final Icmpv6NdOptionsTypeCaseValue result = (Icmpv6NdOptionsTypeCaseValue) input.getMatchEntryValue(); assertEquals(EricExpClass.class, input.getOxmClass()); assertEquals(Icmpv6NdOptionsType.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(2, result.getIcmpv6NdOptionsTypeValues().getIcmpv6NdOptionsType().shortValue()); } @@ -81,7 +75,7 @@ public class Icmpv6NDOptionsTypeCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(EricConstants.ERICOXM_OF_EXPERIMENTER_ID); int fieldMask = ERIC_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-eric/src/test/java/org/opendaylight/openflowjava/eric/codec/match/Icmpv6NDReservedCodecTest.java b/extension/openflowjava-extension-eric/src/test/java/org/opendaylight/openflowjava/eric/codec/match/Icmpv6NDReservedCodecTest.java index 5138344400..5db34ae34b 100644 --- a/extension/openflowjava-extension-eric/src/test/java/org/opendaylight/openflowjava/eric/codec/match/Icmpv6NDReservedCodecTest.java +++ b/extension/openflowjava-extension-eric/src/test/java/org/opendaylight/openflowjava/eric/codec/match/Icmpv6NDReservedCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.eric.api.EricConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.EricExpClass; @@ -28,15 +27,10 @@ public class Icmpv6NDReservedCodecTest { private static final int ERIC_FIELD_CODE = 1; private static final int VALUE_LENGTH = 4; - private Icmpv6NDReservedCodec icmpv6NDReservedCodec; - private ByteBuf buffer; - private MatchEntry input; + private final Icmpv6NDReservedCodec icmpv6NDReservedCodec = new Icmpv6NDReservedCodec(); + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); - @Before - public void setUp() { - icmpv6NDReservedCodec = new Icmpv6NDReservedCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } + private MatchEntry input; @Test public void serializeTest() { @@ -60,7 +54,7 @@ public class Icmpv6NDReservedCodecTest { assertEquals(EricExpClass.class, input.getOxmClass()); assertEquals(Icmpv6NdReserved.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(2, result.getIcmpv6NdReservedValues().getIcmpv6NdReserved().intValue()); } @@ -79,7 +73,7 @@ public class Icmpv6NDReservedCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(EricConstants.ERICOXM_OF_EXPERIMENTER_ID); int fieldMask = ERIC_FIELD_CODE << 1; message.writeByte(fieldMask); diff --git a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/AbstractExperimenterMatchCodec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/AbstractExperimenterMatchCodec.java index 35e44e53e1..eaa7da5a40 100644 --- a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/AbstractExperimenterMatchCodec.java +++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/AbstractExperimenterMatchCodec.java @@ -29,7 +29,7 @@ import org.opendaylight.yangtools.yang.common.Uint32; public abstract class AbstractExperimenterMatchCodec extends AbstractMatchCodec { protected static MatchEntrySerializerKey createSerializerKey( - short version, Uint32 expId, Class oxmField) { + final short version, final Uint32 expId, final Class oxmField) { MatchEntrySerializerKey key = new MatchEntrySerializerKey<>( version, ExperimenterClass.class, oxmField); key.setExperimenterId(expId); @@ -37,7 +37,7 @@ public abstract class AbstractExperimenterMatchCodec extends AbstractMatchCodec } protected static MatchEntryDeserializerKey createDeserializerKey( - short version, Uint32 expId, int fieldCode) { + final short version, final Uint32 expId, final int fieldCode) { MatchEntryDeserializerKey key = new MatchEntryDeserializerKey( version, OxmMatchConstants.EXPERIMENTER_CLASS, fieldCode); key.setExperimenterId(expId); @@ -45,7 +45,7 @@ public abstract class AbstractExperimenterMatchCodec extends AbstractMatchCodec } @Override - public void serialize(MatchEntry input, ByteBuf outBuffer) { + public void serialize(final MatchEntry input, final ByteBuf outBuffer) { // serializes standard header + experimenterId serializeHeader(input, outBuffer); @@ -53,13 +53,13 @@ public abstract class AbstractExperimenterMatchCodec extends AbstractMatchCodec OfjAugNxExpMatch ofjAugNxExpMatch = experimenterIdCase.augmentation(OfjAugNxExpMatch.class); NxExpMatchEntryValue nxExpMatchEntryValue = ofjAugNxExpMatch.getNxExpMatchEntryValue(); - serializeValue(nxExpMatchEntryValue, input.isHasMask(), outBuffer); + serializeValue(nxExpMatchEntryValue, input.getHasMask(), outBuffer); } protected abstract void serializeValue(NxExpMatchEntryValue value, boolean hasMask, ByteBuf outBuffer); @Override - public MatchEntry deserialize(ByteBuf message) { + public MatchEntry deserialize(final ByteBuf message) { final MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message); // skip experimenter Id @@ -70,16 +70,16 @@ public abstract class AbstractExperimenterMatchCodec extends AbstractMatchCodec expBuilder.setExperimenter(new ExperimenterId(getExperimenterId())); expCaseBuilder.setExperimenter(expBuilder.build()); - final NxExpMatchEntryValue value = deserializeValue(message, matchEntryBuilder.isHasMask()); + final NxExpMatchEntryValue value = deserializeValue(message, matchEntryBuilder.getHasMask()); return buildMatchEntry(matchEntryBuilder, expCaseBuilder, value); } protected abstract NxExpMatchEntryValue deserializeValue(ByteBuf message, boolean hasMask); - private static MatchEntry buildMatchEntry(MatchEntryBuilder matchEntryBuilder, - ExperimenterIdCaseBuilder experimenterIdCaseBuilder, - NxExpMatchEntryValue nxExpMatchEntryValue) { + private static MatchEntry buildMatchEntry(final MatchEntryBuilder matchEntryBuilder, + final ExperimenterIdCaseBuilder experimenterIdCaseBuilder, + final NxExpMatchEntryValue nxExpMatchEntryValue) { return matchEntryBuilder .setMatchEntryValue(experimenterIdCaseBuilder.addAugmentation(new OfjAugNxExpMatchBuilder() .setNxExpMatchEntryValue(nxExpMatchEntryValue) @@ -89,12 +89,12 @@ public abstract class AbstractExperimenterMatchCodec extends AbstractMatchCodec } @Override - public void serializeHeader(NxmHeader input, ByteBuf outBuffer) { + public void serializeHeader(final NxmHeader input, final ByteBuf outBuffer) { outBuffer.writeLong(input.toLong()); } @Override - protected NxmHeader buildHeader(boolean hasMask) { + protected NxmHeader buildHeader(final boolean hasMask) { return new NxmHeader( getNxmFieldCode(), hasMask, @@ -113,5 +113,4 @@ public abstract class AbstractExperimenterMatchCodec extends AbstractMatchCodec } protected abstract @NonNull Uint32 getExperimenterId(); - } diff --git a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/AbstractMatchCodec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/AbstractMatchCodec.java index 21cd1c0bf9..723fc4b48a 100644 --- a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/AbstractMatchCodec.java +++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/AbstractMatchCodec.java @@ -26,7 +26,7 @@ public abstract class AbstractMatchCodec implements protected NxmHeader headerWithMask; protected NxmHeader headerWithoutMask; - protected MatchEntryBuilder deserializeHeaderToBuilder(ByteBuf message) { + protected MatchEntryBuilder deserializeHeaderToBuilder(final ByteBuf message) { MatchEntryBuilder builder = new MatchEntryBuilder(); builder.setOxmClass(getOxmClass()); // skip oxm_class - provided @@ -40,20 +40,20 @@ public abstract class AbstractMatchCodec implements } @Override - public MatchEntry deserializeHeader(ByteBuf message) { + public MatchEntry deserializeHeader(final ByteBuf message) { return deserializeHeaderToBuilder(message).build(); } @Override - public void serializeHeader(MatchEntry input, ByteBuf outBuffer) { - serializeHeader(getHeader(input.isHasMask()), outBuffer); + public void serializeHeader(final MatchEntry input, final ByteBuf outBuffer) { + serializeHeader(getHeader(input.getHasMask()), outBuffer); } - public void serializeHeader(NxmHeader input, ByteBuf outBuffer) { + public void serializeHeader(final NxmHeader input, final ByteBuf outBuffer) { outBuffer.writeInt((int) input.toLong()); } - protected NxmHeader getHeader(boolean hasMask) { + protected NxmHeader getHeader(final boolean hasMask) { if (hasMask) { if (headerWithMask == null) { headerWithMask = buildHeader(hasMask); @@ -67,7 +67,7 @@ public abstract class AbstractMatchCodec implements } } - protected NxmHeader buildHeader(boolean hasMask) { + protected NxmHeader buildHeader(final boolean hasMask) { return new NxmHeader( getOxmClassCode(), getNxmFieldCode(), @@ -108,5 +108,4 @@ public abstract class AbstractMatchCodec implements * Returns the oxm_class class. */ public abstract Class getOxmClass(); - } diff --git a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/AbstractRegCodec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/AbstractRegCodec.java index 062b3dab79..90610e8594 100644 --- a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/AbstractRegCodec.java +++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/AbstractRegCodec.java @@ -23,12 +23,12 @@ public abstract class AbstractRegCodec extends AbstractMatchCodec { private static final int VALUE_LENGTH = 4; @Override - public MatchEntry deserialize(ByteBuf message) { + public MatchEntry deserialize(final ByteBuf message) { final MatchEntryBuilder matchEntriesBuilder = deserializeHeaderToBuilder(message); final RegValuesBuilder regValuesBuilder = new RegValuesBuilder(); regValuesBuilder.setValue(readUint32(message)); - if (matchEntriesBuilder.isHasMask()) { + if (matchEntriesBuilder.getHasMask()) { regValuesBuilder.setMask(readUint32(message)); } @@ -40,12 +40,12 @@ public abstract class AbstractRegCodec extends AbstractMatchCodec { } @Override - public void serialize(MatchEntry input, ByteBuf outBuffer) { + public void serialize(final MatchEntry input, final ByteBuf outBuffer) { serializeHeader(input, outBuffer); final RegCaseValue regCase = (RegCaseValue) input.getMatchEntryValue(); outBuffer.writeInt(regCase.getRegValues().getValue().intValue()); - if (input.isHasMask()) { + if (input.getHasMask()) { outBuffer.writeInt(regCase.getRegValues().getMask().intValue()); } } diff --git a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/CtMarkCodec.java b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/CtMarkCodec.java index b318f186d1..18aa86cc6a 100755 --- a/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/CtMarkCodec.java +++ b/extension/openflowjava-extension-nicira/src/main/java/org/opendaylight/openflowjava/nx/codec/match/CtMarkCodec.java @@ -26,20 +26,20 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 /** * Codec for CtMark. - * s + * * @author Bertrand Low. */ public class CtMarkCodec extends AbstractMatchCodec { - private static final int VALUE_LENGTH = 4; private static final int NXM_FIELD_CODE = 107; + public static final MatchEntrySerializerKey SERIALIZER_KEY = new MatchEntrySerializerKey<>( EncodeConstants.OF13_VERSION_ID, Nxm1Class.class, NxmNxCtMark.class); public static final MatchEntryDeserializerKey DESERIALIZER_KEY = new MatchEntryDeserializerKey( EncodeConstants.OF13_VERSION_ID, OxmMatchConstants.NXM_1_CLASS, NXM_FIELD_CODE); @Override - public void serialize(MatchEntry input, ByteBuf outBuffer) { + public void serialize(final MatchEntry input, final ByteBuf outBuffer) { serializeHeader(input, outBuffer); CtMarkCaseValue ctMarkCase = (CtMarkCaseValue) input.getMatchEntryValue(); outBuffer.writeInt(ctMarkCase.getCtMarkValues().getCtMark().intValue()); @@ -47,11 +47,11 @@ public class CtMarkCodec extends AbstractMatchCodec { } @Override - public MatchEntry deserialize(ByteBuf message) { + public MatchEntry deserialize(final ByteBuf message) { final MatchEntryBuilder matchEntryBuilder = deserializeHeaderToBuilder(message); CtMarkCaseValueBuilder caseBuilder = new CtMarkCaseValueBuilder(); CtMarkValuesBuilder ctMarkValuesBuilder = new CtMarkValuesBuilder(); - if (matchEntryBuilder.isHasMask()) { + if (matchEntryBuilder.getHasMask()) { ctMarkValuesBuilder.setMask(readUint32(message)); } ctMarkValuesBuilder.setCtMark(readUint32(message)); diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/AbstractExperimenterMatchCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/AbstractExperimenterMatchCodecTest.java index c1eda2b10c..4771953772 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/AbstractExperimenterMatchCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/AbstractExperimenterMatchCodecTest.java @@ -5,7 +5,6 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.openflowjava.nx.codec.match; import static org.junit.Assert.assertEquals; @@ -48,12 +47,13 @@ public class AbstractExperimenterMatchCodecTest { private class TestCodec extends AbstractExperimenterMatchCodec { @Override - protected void serializeValue(NxExpMatchEntryValue value, boolean hasMask, ByteBuf outBuffer) { + protected void serializeValue(final NxExpMatchEntryValue value, final boolean hasMask, + final ByteBuf outBuffer) { // noop } @Override - protected NxExpMatchEntryValue deserializeValue(ByteBuf outBuffer, boolean hasMask) { + protected NxExpMatchEntryValue deserializeValue(final ByteBuf outBuffer, final boolean hasMask) { return null; } @@ -120,7 +120,7 @@ public class AbstractExperimenterMatchCodecTest { assertEquals(ExperimenterClass.class, matchEntry.getOxmClass()); assertEquals(TestNxmField.class, matchEntry.getOxmMatchField()); - assertEquals(false, matchEntry.isHasMask()); + assertEquals(false, matchEntry.getHasMask()); Experimenter experimenter = ((ExperimenterIdCase) matchEntry.getMatchEntryValue()).getExperimenter(); assertEquals(EXPERIMENTER_ID, experimenter.getExperimenter().getValue()); assertFalse(buffer.isReadable()); @@ -135,14 +135,14 @@ public class AbstractExperimenterMatchCodecTest { assertEquals(ExperimenterClass.class, matchEntry.getOxmClass()); assertEquals(TestNxmField.class, matchEntry.getOxmMatchField()); - assertEquals(true, matchEntry.isHasMask()); + assertEquals(true, matchEntry.getHasMask()); Experimenter experimenter = ((ExperimenterIdCase) matchEntry.getMatchEntryValue()).getExperimenter(); assertEquals(EXPERIMENTER_ID, experimenter.getExperimenter().getValue()); assertFalse(buffer.isReadable()); verify(testCodec).deserializeValue(buffer, true); } - static MatchEntry createMatchEntry(NxExpMatchEntryValue value, boolean hasMask) { + static MatchEntry createMatchEntry(final NxExpMatchEntryValue value, final boolean hasMask) { return new MatchEntryBuilder() .setOxmClass(ExperimenterClass.class) .setOxmMatchField(TestNxmField.class) @@ -156,7 +156,7 @@ public class AbstractExperimenterMatchCodecTest { .build(); } - static void writeBuffer(ByteBuf message, boolean hasMask) { + static void writeBuffer(final ByteBuf message, final boolean hasMask) { int fieldMask = FIELD_CODE << 1; int length = Integer.BYTES + VALUE_LENGTH; if (hasMask) { diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/ArpOpCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/ArpOpCodecTest.java index 5d55a7c134..253351df37 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/ArpOpCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/ArpOpCodecTest.java @@ -62,7 +62,7 @@ public class ArpOpCodecTest { assertEquals(Nxm0Class.class, input.getOxmClass()); assertEquals(NxmOfArpOp.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(2, result.getArpOpValues().getValue().shortValue()); } @@ -82,7 +82,7 @@ public class ArpOpCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_0_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/ArpShaCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/ArpShaCodecTest.java index 739fd1c321..5aea6d9f14 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/ArpShaCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/ArpShaCodecTest.java @@ -66,7 +66,7 @@ public class ArpShaCodecTest { assertEquals(Nxm1Class.class, input.getOxmClass()); assertEquals(NxmNxArpSha.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(RESULT_ADDRESS, result.getArpShaValues().getMacAddress()); } @@ -88,7 +88,7 @@ public class ArpShaCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/ArpSpaCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/ArpSpaCodecTest.java index 01718ffa22..9b8e31ae87 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/ArpSpaCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/ArpSpaCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class; @@ -24,21 +23,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint32; public class ArpSpaCodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final ArpSpaCodec arpSpaCodec = new ArpSpaCodec(); - ArpSpaCodec arpSpaCodec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int VALUE_LENGTH = 4; private static final int NXM_FIELD_CODE = 16; - - @Before - public void setUp() { - arpSpaCodec = new ArpSpaCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -61,7 +53,7 @@ public class ArpSpaCodecTest { assertEquals(Nxm0Class.class, input.getOxmClass()); assertEquals(NxmOfArpSpa.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(2, result.getArpSpaValues().getValue().shortValue()); } @@ -81,7 +73,7 @@ public class ArpSpaCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_0_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/ArpThaCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/ArpThaCodecTest.java index b243fb8db6..276bd43c90 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/ArpThaCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/ArpThaCodecTest.java @@ -65,7 +65,7 @@ public class ArpThaCodecTest { assertEquals(Nxm1Class.class, input.getOxmClass()); assertEquals(NxmNxArpTha.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(TEST_ADDRESS, result.getArpThaValues().getMacAddress()); } @@ -85,7 +85,7 @@ public class ArpThaCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/ArpTpaCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/ArpTpaCodecTest.java index 3d69533a88..9d90b14df8 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/ArpTpaCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/ArpTpaCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class; @@ -24,20 +23,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint32; public class ArpTpaCodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final ArpTpaCodec arpTpaCodec = new ArpTpaCodec(); - ArpTpaCodec arpTpaCodec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int VALUE_LENGTH = 4; private static final int NXM_FIELD_CODE = 17; - @Before - public void setUp() { - arpTpaCodec = new ArpTpaCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -60,7 +53,7 @@ public class ArpTpaCodecTest { assertEquals(Nxm0Class.class, input.getOxmClass()); assertEquals(NxmOfArpTpa.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(2, result.getArpTpaValues().getValue().intValue()); } @@ -80,7 +73,7 @@ public class ArpTpaCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_0_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/CtStateCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/CtStateCodecTest.java index 0f709f39b1..49d1c68e3b 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/CtStateCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/CtStateCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class; @@ -24,20 +23,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint32; public class CtStateCodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final CtStateCodec ctStateCodec = new CtStateCodec(); - CtStateCodec ctStateCodec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int VALUE_LENGTH = 8; private static final int NXM_FIELD_CODE = 105; - @Before - public void setUp() { - ctStateCodec = new CtStateCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -61,7 +54,7 @@ public class CtStateCodecTest { assertEquals(Nxm1Class.class, input.getOxmClass()); assertEquals(NxmNxCtState.class, input.getOxmMatchField()); - assertEquals(true, input.isHasMask()); + assertEquals(true, input.getHasMask()); assertEquals(1, result.getCtStateValues().getCtState().intValue()); assertEquals(2, result.getCtStateValues().getMask().intValue()); } @@ -83,7 +76,7 @@ public class CtStateCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/CtTpDstCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/CtTpDstCodecTest.java index a818edaf74..8036100f5f 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/CtTpDstCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/CtTpDstCodecTest.java @@ -5,14 +5,12 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.openflowjava.nx.codec.match; import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class; @@ -25,19 +23,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint16; public class CtTpDstCodecTest { - private CtTpDstCodec ctTpDstCodec; - private ByteBuf buffer; + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final CtTpDstCodec ctTpDstCodec = new CtTpDstCodec(); + private MatchEntry input; private static final int VALUE_LENGTH = 2; private static final int NXM_FIELD_CODE = 125; - @Before - public void setUp() { - ctTpDstCodec = new CtTpDstCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -60,7 +53,7 @@ public class CtTpDstCodecTest { assertEquals(Nxm1Class.class, input.getOxmClass()); assertEquals(NxmNxCtTpDst.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(2, result.getCtTpDstValues().getCtTpDst().shortValue()); } @@ -80,7 +73,7 @@ public class CtTpDstCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/CtTpSrcCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/CtTpSrcCodecTest.java index 12bd711c08..bd4d859d92 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/CtTpSrcCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/CtTpSrcCodecTest.java @@ -5,7 +5,6 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.openflowjava.nx.codec.match; import static org.junit.Assert.assertEquals; @@ -60,7 +59,7 @@ public class CtTpSrcCodecTest { assertEquals(Nxm1Class.class, input.getOxmClass()); assertEquals(NxmNxCtTpSrc.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(2, result.getCtTpSrcValues().getCtTpSrc().shortValue()); } @@ -80,7 +79,7 @@ public class CtTpSrcCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/CtZoneCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/CtZoneCodecTest.java index 1f72f8c42a..1d12a8ae28 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/CtZoneCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/CtZoneCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class; @@ -24,22 +23,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint16; public class CtZoneCodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final CtZoneCodec ctZoneCodec = new CtZoneCodec(); - CtZoneCodec ctZoneCodec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int VALUE_LENGTH = 2; private static final int NXM_FIELD_CODE = 106; - - - @Before - public void setUp() { - ctZoneCodec = new CtZoneCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -62,11 +53,10 @@ public class CtZoneCodecTest { assertEquals(Nxm1Class.class, input.getOxmClass()); assertEquals(NxmNxCtZone.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(2, result.getCtZoneValues().getCtZone().shortValue()); } - private static MatchEntry createMatchEntry() { MatchEntryBuilder matchEntryBuilder = new MatchEntryBuilder(); final CtZoneCaseValueBuilder caseBuilder = new CtZoneCaseValueBuilder(); @@ -83,7 +73,7 @@ public class CtZoneCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/EthDstCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/EthDstCodecTest.java index b80f603ef1..cbe14449df 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/EthDstCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/EthDstCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.openflowjava.util.ByteBufUtils; @@ -26,10 +25,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.EthDstCaseValueBuilder; public class EthDstCodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final EthDstCodec ethDstCodec = new EthDstCodec(); - EthDstCodec ethDstCodec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int VALUE_LENGTH = 6; private static final int NXM_FIELD_CODE = 1; @@ -37,12 +36,6 @@ public class EthDstCodecTest { private static final byte[] TEST_ADDR = new byte[VALUE_LENGTH]; private static final MacAddress TEST_ADDRESS = IetfYangUtil.INSTANCE.macAddressFor(TEST_ADDR); - @Before - public void setUp() { - ethDstCodec = new EthDstCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -66,7 +59,7 @@ public class EthDstCodecTest { assertEquals(Nxm0Class.class, input.getOxmClass()); assertEquals(NxmOfEthDst.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(TEST_ADDRESS, result.getEthDstValues().getMacAddress()); } @@ -86,7 +79,7 @@ public class EthDstCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_0_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/EthSrcCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/EthSrcCodecTest.java index fdd8ef4c09..2c5d14dec7 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/EthSrcCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/EthSrcCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.openflowjava.util.ByteBufUtils; @@ -27,10 +26,10 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.EthSrcCaseValueBuilder; public class EthSrcCodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final EthSrcCodec ethSrcCodec = new EthSrcCodec(); - EthSrcCodec ethSrcCodec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int VALUE_LENGTH = 6; private static final int NXM_FIELD_CODE = 2; @@ -38,12 +37,6 @@ public class EthSrcCodecTest { private static final byte[] TEST_ADDR = new byte[VALUE_LENGTH]; private static final MacAddress TEST_ADDRESS = IetfYangUtil.INSTANCE.macAddressFor(TEST_ADDR); - @Before - public void setUp() { - ethSrcCodec = new EthSrcCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -67,7 +60,7 @@ public class EthSrcCodecTest { assertEquals(Nxm0Class.class, input.getOxmClass()); assertEquals(NxmOfEthSrc.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(TEST_ADDRESS, result.getEthSrcValues().getMacAddress()); } @@ -88,7 +81,7 @@ public class EthSrcCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_0_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/EthTypeCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/EthTypeCodecTest.java index fe3083e237..08f5dbec80 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/EthTypeCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/EthTypeCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class; @@ -24,20 +23,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint16; public class EthTypeCodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final EthTypeCodec ethTypeCodec = new EthTypeCodec(); - EthTypeCodec ethTypeCodec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int VALUE_LENGTH = 2; private static final int NXM_FIELD_CODE = 3; - @Before - public void setUp() { - ethTypeCodec = new EthTypeCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -61,7 +54,7 @@ public class EthTypeCodecTest { assertEquals(Nxm0Class.class, input.getOxmClass()); assertEquals(NxmOfEthType.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(2, result.getEthTypeValues().getValue().shortValue()); } @@ -81,7 +74,7 @@ public class EthTypeCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_0_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/IcmpTypeCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/IcmpTypeCodecTest.java index fe94fef50e..02990cd761 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/IcmpTypeCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/IcmpTypeCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class; @@ -24,20 +23,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint8; public class IcmpTypeCodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final IcmpTypeCodec icmpTypeCodec = new IcmpTypeCodec(); - IcmpTypeCodec icmpTypeCodec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int VALUE_LENGTH = 1; private static final int NXM_FIELD_CODE = 13; - @Before - public void setUp() { - icmpTypeCodec = new IcmpTypeCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -61,7 +54,7 @@ public class IcmpTypeCodecTest { assertEquals(Nxm0Class.class, input.getOxmClass()); assertEquals(NxmOfIcmpType.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(2, result.getIcmpTypeValues().getValue().shortValue()); } @@ -81,7 +74,7 @@ public class IcmpTypeCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_0_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/IpDstCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/IpDstCodecTest.java index a6f7a688bd..d185c82f43 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/IpDstCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/IpDstCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class; @@ -24,20 +23,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint32; public class IpDstCodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final IpDstCodec ipDstCodec = new IpDstCodec(); - IpDstCodec ipDstCodec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int VALUE_LENGTH = 4; private static final int NXM_FIELD_CODE = 8; - @Before - public void setUp() { - ipDstCodec = new IpDstCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -61,7 +54,7 @@ public class IpDstCodecTest { assertEquals(Nxm0Class.class, input.getOxmClass()); assertEquals(NxmOfIpDst.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(2, result.getIpDstValues().getValue().intValue()); } @@ -81,7 +74,7 @@ public class IpDstCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_0_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/IpSrcCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/IpSrcCodecTest.java index 3ebebf7e26..617fc417be 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/IpSrcCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/IpSrcCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class; @@ -24,20 +23,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint32; public class IpSrcCodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final IpSrcCodec ipSrcCodec = new IpSrcCodec(); - IpSrcCodec ipSrcCodec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int VALUE_LENGTH = 4; private static final int NXM_FIELD_CODE = 7; - @Before - public void setUp() { - ipSrcCodec = new IpSrcCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -61,7 +54,7 @@ public class IpSrcCodecTest { assertEquals(Nxm0Class.class, input.getOxmClass()); assertEquals(NxmOfIpSrc.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(2, result.getIpSrcValues().getValue().intValue()); } @@ -81,7 +74,7 @@ public class IpSrcCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_0_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Ipv6DstCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Ipv6DstCodecTest.java index 54b470c415..6f25fd9f0d 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Ipv6DstCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Ipv6DstCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class; @@ -24,20 +23,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint32; public class Ipv6DstCodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final Ipv6DstCodec ipv6DstCodec = new Ipv6DstCodec(); - Ipv6DstCodec ipv6DstCodec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int VALUE_LENGTH = 16; private static final int NXM_FIELD_CODE = 20; - @Before - public void setUp() { - ipv6DstCodec = new Ipv6DstCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -61,7 +54,7 @@ public class Ipv6DstCodecTest { assertEquals(Nxm1Class.class, input.getOxmClass()); assertEquals(NxmOfIpDst.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(2, result.getIpDstValues().getValue().intValue()); } @@ -81,7 +74,7 @@ public class Ipv6DstCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Ipv6SrcCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Ipv6SrcCodecTest.java index b8a18f35a5..c6b7bb06e2 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Ipv6SrcCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Ipv6SrcCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class; @@ -24,20 +23,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint32; public class Ipv6SrcCodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final Ipv6SrcCodec ipv6SrcCodec = new Ipv6SrcCodec(); - Ipv6SrcCodec ipv6SrcCodec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int VALUE_LENGTH = 16; private static final int NXM_FIELD_CODE = 19; - @Before - public void setUp() { - ipv6SrcCodec = new Ipv6SrcCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -61,7 +54,7 @@ public class Ipv6SrcCodecTest { assertEquals(Nxm1Class.class, input.getOxmClass()); assertEquals(NxmOfIpSrc.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(2, result.getIpSrcValues().getValue().intValue()); } @@ -81,7 +74,7 @@ public class Ipv6SrcCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/MetadataCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/MetadataCodecTest.java index d562c14bab..51f4e2abd1 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/MetadataCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/MetadataCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm0Class; @@ -22,20 +21,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.oxm.container.match.entry.value.OfMetadataCaseValueBuilder; public class MetadataCodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final MetadataCodec metadataCodec = new MetadataCodec(); - MetadataCodec metadataCodec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int NXM_FIELD_CODE = 2; private static final int VALUE_LENGTH = 8; - @Before - public void setUp() { - metadataCodec = new MetadataCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -54,7 +47,7 @@ public class MetadataCodecTest { input = metadataCodec.deserialize(buffer); assertEquals(Nxm0Class.class, input.getOxmClass()); assertEquals(NxmOfMetadata.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); } private static MatchEntry createMatchEntry() { @@ -71,7 +64,7 @@ public class MetadataCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1; message.writeByte(fieldMask); diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/PktMarkCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/PktMarkCodecTest.java index 828fca8ea0..00f8dcfd12 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/PktMarkCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/PktMarkCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class; @@ -24,18 +23,12 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint32; public class PktMarkCodecTest { - private static final int VALUE_LENGTH = 4; private static final int NXM_FIELD_CODE = 33; - private PktMarkCodec pktMarkCodec; - private ByteBuf buffer; - private MatchEntry input; - @Before - public void setUp() { - pktMarkCodec = new PktMarkCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final PktMarkCodec pktMarkCodec = new PktMarkCodec(); + private MatchEntry input; @Test public void serializeTest() { @@ -59,7 +52,7 @@ public class PktMarkCodecTest { assertEquals(Nxm1Class.class, input.getOxmClass()); assertEquals(NxmNxPktMark.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(2, result.getPktMarkValues().getPktMark().intValue()); } @@ -79,7 +72,7 @@ public class PktMarkCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg0CodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg0CodecTest.java index 0304e723eb..20d6bbb5e5 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg0CodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg0CodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class; @@ -24,20 +23,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint32; public class Reg0CodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final Reg0Codec reg0Codec = new Reg0Codec(); - Reg0Codec reg0Codec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int NXM_FIELD_CODE = 0; private static final int VALUE_LENGTH = 4; - @Before - public void setUp() { - reg0Codec = new Reg0Codec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -61,7 +54,7 @@ public class Reg0CodecTest { assertEquals(Nxm1Class.class, input.getOxmClass()); assertEquals(NxmNxReg0.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(1, result.getRegValues().getValue().intValue()); } @@ -81,7 +74,7 @@ public class Reg0CodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg1CodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg1CodecTest.java index 386df9eb97..94c363daa4 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg1CodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg1CodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class; @@ -24,20 +23,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint32; public class Reg1CodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final Reg1Codec reg1Codec = new Reg1Codec(); - Reg1Codec reg1Codec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int NXM_FIELD_CODE = 1; private static final int VALUE_LENGTH = 4; - @Before - public void setUp() { - reg1Codec = new Reg1Codec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -61,7 +54,7 @@ public class Reg1CodecTest { assertEquals(Nxm1Class.class, input.getOxmClass()); assertEquals(NxmNxReg1.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(1, result.getRegValues().getValue().intValue()); } @@ -81,7 +74,7 @@ public class Reg1CodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg2CodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg2CodecTest.java index 280799fa3b..bc51caccfa 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg2CodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg2CodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class; @@ -24,19 +23,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint32; public class Reg2CodecTest { - Reg2Codec reg2Codec; - ByteBuf buffer; - MatchEntry input; + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final Reg2Codec reg2Codec = new Reg2Codec(); + + private MatchEntry input; private static final int NXM_FIELD_CODE = 2; private static final int VALUE_LENGTH = 4; - @Before - public void setUp() { - reg2Codec = new Reg2Codec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -60,7 +54,7 @@ public class Reg2CodecTest { assertEquals(Nxm1Class.class, input.getOxmClass()); assertEquals(NxmNxReg2.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(1, result.getRegValues().getValue().intValue()); } @@ -80,7 +74,7 @@ public class Reg2CodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg3CodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg3CodecTest.java index 4871909ae7..34ed88ef5f 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg3CodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg3CodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class; @@ -24,21 +23,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint32; public class Reg3CodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final Reg3Codec reg3Codec = new Reg3Codec(); - Reg3Codec reg3Codec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int NXM_FIELD_CODE = 3; private static final int VALUE_LENGTH = 4; - @Before - public void setUp() { - reg3Codec = new Reg3Codec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - - @Test public void serializeTest() { input = createMatchEntry(); @@ -62,7 +54,7 @@ public class Reg3CodecTest { assertEquals(Nxm1Class.class, input.getOxmClass()); assertEquals(NxmNxReg3.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(1, result.getRegValues().getValue().intValue()); } @@ -82,7 +74,7 @@ public class Reg3CodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg4CodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg4CodecTest.java index e8731431a9..53a675096d 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg4CodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg4CodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class; @@ -24,20 +23,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint32; public class Reg4CodecTest { - Reg4Codec reg4Codec; - ByteBuf buffer; - MatchEntry input; + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final Reg4Codec reg4Codec = new Reg4Codec(); + + private MatchEntry input; private static final int NXM_FIELD_CODE = 4; private static final int VALUE_LENGTH = 4; - @Before - public void setUp() { - reg4Codec = new Reg4Codec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - - @Test public void serializeTest() { input = createMatchEntry(); @@ -61,7 +54,7 @@ public class Reg4CodecTest { assertEquals(Nxm1Class.class, input.getOxmClass()); assertEquals(NxmNxReg4.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(1, result.getRegValues().getValue().intValue()); } @@ -81,7 +74,7 @@ public class Reg4CodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg5CodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg5CodecTest.java index 75741c9089..245b1d0537 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg5CodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg5CodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class; @@ -24,21 +23,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint32; public class Reg5CodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final Reg5Codec reg5Codec = new Reg5Codec(); - Reg5Codec reg5Codec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int NXM_FIELD_CODE = 5; private static final int VALUE_LENGTH = 4; - @Before - public void setUp() { - reg5Codec = new Reg5Codec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - - @Test public void serializeTest() { input = createMatchEntry(); @@ -62,7 +54,7 @@ public class Reg5CodecTest { assertEquals(Nxm1Class.class, input.getOxmClass()); assertEquals(NxmNxReg5.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(1, result.getRegValues().getValue().intValue()); } @@ -82,7 +74,7 @@ public class Reg5CodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg6CodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg6CodecTest.java index f304636387..2178d2695b 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg6CodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg6CodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class; @@ -24,20 +23,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint32; public class Reg6CodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final Reg6Codec reg6Codec = new Reg6Codec(); - Reg6Codec reg6Codec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int NXM_FIELD_CODE = 6; private static final int VALUE_LENGTH = 4; - @Before - public void setUp() { - reg6Codec = new Reg6Codec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -61,7 +54,7 @@ public class Reg6CodecTest { assertEquals(Nxm1Class.class, input.getOxmClass()); assertEquals(NxmNxReg6.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(1, result.getRegValues().getValue().intValue()); } @@ -81,7 +74,7 @@ public class Reg6CodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg7CodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg7CodecTest.java index 70620f5b2b..549cdb172a 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg7CodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/Reg7CodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class; @@ -24,20 +23,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint32; public class Reg7CodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final Reg7Codec reg7Codec = new Reg7Codec(); - Reg7Codec reg7Codec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int NXM_FIELD_CODE = 7; private static final int VALUE_LENGTH = 4; - @Before - public void setUp() { - reg7Codec = new Reg7Codec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -61,7 +54,7 @@ public class Reg7CodecTest { assertEquals(Nxm1Class.class, input.getOxmClass()); assertEquals(NxmNxReg7.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(1, result.getRegValues().getValue().intValue()); } @@ -81,7 +74,7 @@ public class Reg7CodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/TcpDstCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/TcpDstCodecTest.java index ed27114674..e7b7b1c08f 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/TcpDstCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/TcpDstCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber; @@ -25,20 +24,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint16; public class TcpDstCodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final TcpDstCodec tcpDstCodec = new TcpDstCodec(); - TcpDstCodec tcpDstCodec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int VALUE_LENGTH = 4; private static final int NXM_FIELD_CODE = 10; - @Before - public void setUp() { - tcpDstCodec = new TcpDstCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -63,7 +56,7 @@ public class TcpDstCodecTest { assertEquals(Nxm0Class.class, input.getOxmClass()); assertEquals(NxmOfTcpDst.class, input.getOxmMatchField()); - assertEquals(true, input.isHasMask()); + assertEquals(true, input.getHasMask()); assertEquals(1, result.getTcpDstValues().getPort().getValue().shortValue()); assertEquals(0xffff, result.getTcpDstValues().getMask().shortValue() & 0xffff); } @@ -85,7 +78,7 @@ public class TcpDstCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_0_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/TcpSrcCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/TcpSrcCodecTest.java index a5218e1407..9e727351fd 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/TcpSrcCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/TcpSrcCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber; @@ -25,20 +24,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint16; public class TcpSrcCodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final TcpSrcCodec tcpSrcCodec = new TcpSrcCodec(); - TcpSrcCodec tcpSrcCodec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int VALUE_LENGTH = 4; private static final int NXM_FIELD_CODE = 9; - @Before - public void setUp() { - tcpSrcCodec = new TcpSrcCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -63,7 +56,7 @@ public class TcpSrcCodecTest { assertEquals(Nxm0Class.class, input.getOxmClass()); assertEquals(NxmOfTcpSrc.class, input.getOxmMatchField()); - assertEquals(true, input.isHasMask()); + assertEquals(true, input.getHasMask()); assertEquals(1, result.getTcpSrcValues().getPort().getValue().shortValue()); assertEquals(0xffff, result.getTcpSrcValues().getMask().shortValue() & 0xffff); } @@ -85,7 +78,7 @@ public class TcpSrcCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_0_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/TunIdCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/TunIdCodecTest.java index 8653fd6eb8..ad3694b820 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/TunIdCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/TunIdCodecTest.java @@ -12,7 +12,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; import java.math.BigInteger; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class; @@ -25,20 +24,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint64; public class TunIdCodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final TunIdCodec tunIdCodec = new TunIdCodec(); - TunIdCodec tunIdCodec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int VALUE_LENGTH = 8; private static final int NXM_FIELD_CODE = 16; - @Before - public void setUp() { - tunIdCodec = new TunIdCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -62,7 +55,7 @@ public class TunIdCodecTest { assertEquals(Nxm1Class.class, input.getOxmClass()); assertEquals(NxmNxTunId.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(0, result.getTunIdValues().getValue().longValue()); } @@ -82,7 +75,7 @@ public class TunIdCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/TunIpv4DstCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/TunIpv4DstCodecTest.java index 66bca890d5..6e72c1e6ad 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/TunIpv4DstCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/TunIpv4DstCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class; @@ -24,20 +23,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint32; public class TunIpv4DstCodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final TunIpv4DstCodec tunIpv4DstCodec = new TunIpv4DstCodec(); - TunIpv4DstCodec tunIpv4DstCodec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int VALUE_LENGTH = 4; private static final int NXM_FIELD_CODE = 32; - @Before - public void setUp() { - tunIpv4DstCodec = new TunIpv4DstCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -61,7 +54,7 @@ public class TunIpv4DstCodecTest { assertEquals(Nxm1Class.class, input.getOxmClass()); assertEquals(NxmNxTunIpv4Dst.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(1, result.getTunIpv4DstValues().getValue().intValue()); } @@ -81,7 +74,7 @@ public class TunIpv4DstCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/TunIpv4SrcCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/TunIpv4SrcCodecTest.java index 6fcb1fbc99..fec87dba38 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/TunIpv4SrcCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/TunIpv4SrcCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Nxm1Class; @@ -24,20 +23,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint32; public class TunIpv4SrcCodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final TunIpv4SrcCodec tunIpv4SrcCodec = new TunIpv4SrcCodec(); - TunIpv4SrcCodec tunIpv4SrcCodec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int VALUE_LENGTH = 4; private static final int NXM_FIELD_CODE = 31; - @Before - public void setUp() { - tunIpv4SrcCodec = new TunIpv4SrcCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -61,7 +54,7 @@ public class TunIpv4SrcCodecTest { assertEquals(Nxm1Class.class, input.getOxmClass()); assertEquals(NxmNxTunIpv4Src.class, input.getOxmMatchField()); - assertEquals(false, input.isHasMask()); + assertEquals(false, input.getHasMask()); assertEquals(1, result.getTunIpv4SrcValues().getValue().intValue()); } @@ -81,7 +74,7 @@ public class TunIpv4SrcCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_1_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/UdpDstCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/UdpDstCodecTest.java index d296a52230..780625cb6c 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/UdpDstCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/UdpDstCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber; @@ -25,20 +24,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint16; public class UdpDstCodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final UdpDstCodec udpDstCodec = new UdpDstCodec(); - UdpDstCodec udpDstCodec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int VALUE_LENGTH = 4; private static final int NXM_FIELD_CODE = 12; - @Before - public void setUp() { - udpDstCodec = new UdpDstCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -63,7 +56,7 @@ public class UdpDstCodecTest { assertEquals(Nxm0Class.class, input.getOxmClass()); assertEquals(NxmOfUdpDst.class, input.getOxmMatchField()); - assertEquals(true, input.isHasMask()); + assertEquals(true, input.getHasMask()); assertEquals(1, result.getUdpDstValues().getPort().getValue().shortValue()); assertEquals(0xffff, result.getUdpDstValues().getMask().shortValue() & 0xffff); } @@ -85,7 +78,7 @@ public class UdpDstCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_0_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/UdpSrcCodecTest.java b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/UdpSrcCodecTest.java index 37f438c897..8dfdc5cbd3 100644 --- a/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/UdpSrcCodecTest.java +++ b/extension/openflowjava-extension-nicira/src/test/java/org/opendaylight/openflowjava/nx/codec/match/UdpSrcCodecTest.java @@ -11,7 +11,6 @@ import static org.junit.Assert.assertEquals; import io.netty.buffer.ByteBuf; import io.netty.buffer.ByteBufAllocator; -import org.junit.Before; import org.junit.Test; import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.PortNumber; @@ -25,20 +24,14 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev14 import org.opendaylight.yangtools.yang.common.Uint16; public class UdpSrcCodecTest { + private final ByteBuf buffer = ByteBufAllocator.DEFAULT.buffer(); + private final UdpSrcCodec udpSrcCodec = new UdpSrcCodec(); - UdpSrcCodec udpSrcCodec; - ByteBuf buffer; - MatchEntry input; + private MatchEntry input; private static final int VALUE_LENGTH = 4; private static final int NXM_FIELD_CODE = 11; - @Before - public void setUp() { - udpSrcCodec = new UdpSrcCodec(); - buffer = ByteBufAllocator.DEFAULT.buffer(); - } - @Test public void serializeTest() { input = createMatchEntry(); @@ -63,7 +56,7 @@ public class UdpSrcCodecTest { assertEquals(Nxm0Class.class, input.getOxmClass()); assertEquals(NxmOfUdpSrc.class, input.getOxmMatchField()); - assertEquals(true, input.isHasMask()); + assertEquals(true, input.getHasMask()); assertEquals(1, result.getUdpSrcValues().getPort().getValue().shortValue()); assertEquals(0xffff, result.getUdpSrcValues().getMask().shortValue() & 0xffff); } @@ -85,7 +78,7 @@ public class UdpSrcCodecTest { return matchEntryBuilder.build(); } - private static void createBuffer(ByteBuf message) { + private static void createBuffer(final ByteBuf message) { message.writeShort(OxmMatchConstants.NXM_0_CLASS); int fieldMask = NXM_FIELD_CODE << 1; diff --git a/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/RegConvertor.java b/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/RegConvertor.java index 07e19202b7..7aaf2abe85 100644 --- a/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/RegConvertor.java +++ b/extension/openflowplugin-extension-nicira/src/main/java/org/opendaylight/openflowplugin/extension/vendor/nicira/convertor/match/RegConvertor.java @@ -58,7 +58,7 @@ public class RegConvertor implements ConvertorToOFJava, ConvertorFro @SuppressWarnings("unchecked") @Override - public ExtensionAugment> convert(MatchEntry input, MatchPath path) { + public ExtensionAugment> convert(final MatchEntry input, final MatchPath path) { NxmNxRegBuilder nxRegBuilder = new NxmNxRegBuilder(); if (!org.opendaylight.yang.gen.v1.urn.opendaylight.openflowjava.nx.match.rev140421.NxmNxReg.class .isAssignableFrom(input.getOxmMatchField())) { @@ -73,7 +73,7 @@ public class RegConvertor implements ConvertorToOFJava, ConvertorFro RegCaseValue regCaseValue = (RegCaseValue) input.getMatchEntryValue(); nxRegBuilder.setValue(regCaseValue.getRegValues().getValue()); - if (input.isHasMask()) { + if (input.getHasMask()) { nxRegBuilder.setMask(regCaseValue.getRegValues().getMask()); } @@ -81,7 +81,7 @@ public class RegConvertor implements ConvertorToOFJava, ConvertorFro } @Override - public MatchEntry convert(Extension extension) { + public MatchEntry convert(final Extension extension) { Optional matchGrouping = MatchUtil.REG_RESOLVER.findExtension(extension); if (!matchGrouping.isPresent()) { throw new CodecPreconditionException(extension); @@ -100,7 +100,7 @@ public class RegConvertor implements ConvertorToOFJava, ConvertorFro .build(); } - private static Class resolveRegKey(Class oxmMatchField) { + private static Class resolveRegKey(final Class oxmMatchField) { if (NiciraMatchCodecs.REG0_CODEC.getNxmField().isAssignableFrom(oxmMatchField)) { return NxmNxReg0Key.class; } @@ -128,8 +128,8 @@ public class RegConvertor implements ConvertorToOFJava, ConvertorFro throw new CodecPreconditionException("There is no key for " + oxmMatchField); } - private static ExtensionAugment> resolveAugmentation(NxmNxReg nxmNxReg, - MatchPath path, Class key) { + private static ExtensionAugment> resolveAugmentation(final NxmNxReg nxmNxReg, + final MatchPath path, final Class key) { switch (path) { case FLOWS_STATISTICS_UPDATE_MATCH: return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class, diff --git a/extension/openflowplugin-extension-onf/src/main/java/org/opendaylight/openflowplugin/extension/onf/serializer/AbstractBundleMessageFactory.java b/extension/openflowplugin-extension-onf/src/main/java/org/opendaylight/openflowplugin/extension/onf/serializer/AbstractBundleMessageFactory.java index 3f3243b75b..cacbf6571d 100644 --- a/extension/openflowplugin-extension-onf/src/main/java/org/opendaylight/openflowplugin/extension/onf/serializer/AbstractBundleMessageFactory.java +++ b/extension/openflowplugin-extension-onf/src/main/java/org/opendaylight/openflowplugin/extension/onf/serializer/AbstractBundleMessageFactory.java @@ -5,7 +5,6 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.openflowplugin.extension.onf.serializer; import io.netty.buffer.ByteBuf; @@ -34,12 +33,12 @@ public abstract class AbstractBundleMessageFactory impl protected SerializerRegistry serializerRegistry; @Override - public void injectSerializerRegistry(SerializerRegistry registry) { + public void injectSerializerRegistry(final SerializerRegistry registry) { this.serializerRegistry = registry; } static void writeBundleFlags(final BundleFlags bundleFlags, final ByteBuf outBuffer) { - short flagsBitMap = fillBitMask(bundleFlags.isAtomic(), bundleFlags.isOrdered()); + short flagsBitMap = fillBitMask(bundleFlags.getAtomic(), bundleFlags.getOrdered()); outBuffer.writeShort(flagsBitMap); } diff --git a/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/converter/BundleAddMessageConverterTest.java b/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/converter/BundleAddMessageConverterTest.java index 6b187bda11..05627b9842 100644 --- a/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/converter/BundleAddMessageConverterTest.java +++ b/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/converter/BundleAddMessageConverterTest.java @@ -169,7 +169,7 @@ public class BundleAddMessageConverterTest { testConvert(message, BundleFlowModCase.class, withProperty); } - private void testConvert(final BundleInnerMessage message, Class clazz, + private void testConvert(final BundleInnerMessage message, final Class clazz, final boolean withProperty) throws ConversionException { final BundleAddMessageSal original = createMessage(withProperty, message); final ExtensionConvertorData data = new ExtensionConvertorData(OFConstants.OFP_VERSION_1_3); @@ -178,8 +178,8 @@ public class BundleAddMessageConverterTest { Assert.assertEquals("Wrong BundleId", new BundleId(original.getSalAddMessageData().getBundleId().getValue()), converted.getOnfAddMessageGroupingData().getBundleId()); Assert.assertEquals("Wrong flags", - new BundleFlags(original.getSalAddMessageData().getFlags().isAtomic(), - original.getSalAddMessageData().getFlags().isOrdered()), + new BundleFlags(original.getSalAddMessageData().getFlags().getAtomic(), + original.getSalAddMessageData().getFlags().getOrdered()), converted.getOnfAddMessageGroupingData().getFlags()); Assert.assertEquals("Wrong inner message conversion", clazz, converted.getOnfAddMessageGroupingData().getBundleInnerMessage().implementedInterface()); diff --git a/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/converter/BundleControlConverterTest.java b/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/converter/BundleControlConverterTest.java index 7f3b760d76..43905e1c01 100644 --- a/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/converter/BundleControlConverterTest.java +++ b/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/converter/BundleControlConverterTest.java @@ -100,8 +100,8 @@ public class BundleControlConverterTest { ); Assert.assertEquals("Wrong flags", new BundleFlags( - ofpMessage.getSalControlData().getFlags().isAtomic(), - ofpMessage.getSalControlData().getFlags().isOrdered()), + ofpMessage.getSalControlData().getFlags().getAtomic(), + ofpMessage.getSalControlData().getFlags().getOrdered()), ofjMessage.getOnfControlGroupingData().getFlags() ); if (withProperty) { diff --git a/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/deserializer/BundleControlFactoryTest.java b/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/deserializer/BundleControlFactoryTest.java index 4b83b238e7..3061d9280c 100644 --- a/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/deserializer/BundleControlFactoryTest.java +++ b/extension/openflowplugin-extension-onf/src/test/java/org/opendaylight/openflowplugin/extension/onf/deserializer/BundleControlFactoryTest.java @@ -5,7 +5,6 @@ * terms of the Eclipse Public License v1.0 which accompanies this distribution, * and is available at http://www.eclipse.org/legal/epl-v10.html */ - package org.opendaylight.openflowplugin.extension.onf.deserializer; import static org.mockito.ArgumentMatchers.any; @@ -51,9 +50,9 @@ public class BundleControlFactoryTest { Assert.assertEquals(1, builtByFactory.getOnfControlGroupingData().getBundleId().getValue().intValue()); BundleFlags flags = new BundleFlags(true, true); Assert.assertEquals("Wrong atomic flag", - flags.isAtomic(), builtByFactory.getOnfControlGroupingData().getFlags().isAtomic()); + flags.getAtomic(), builtByFactory.getOnfControlGroupingData().getFlags().getAtomic()); Assert.assertEquals("Wrong ordered flag", - flags.isOrdered(), builtByFactory.getOnfControlGroupingData().getFlags().isOrdered()); + flags.getOrdered(), builtByFactory.getOnfControlGroupingData().getFlags().getOrdered()); Assert.assertEquals("Wrong type", BundleControlType.ONFBCTOPENREPLY, builtByFactory.getOnfControlGroupingData().getType()); Assert.assertTrue("Properties not empty", @@ -80,10 +79,10 @@ public class BundleControlFactoryTest { Assert.assertEquals(1, builtByFactory.getOnfControlGroupingData().getBundleId().getValue().intValue()); BundleFlags flags = new BundleFlags(false, true); Assert.assertEquals("Wrong atomic flag", - flags.isAtomic(), builtByFactory.getOnfControlGroupingData().getFlags().isAtomic()); + flags.getAtomic(), builtByFactory.getOnfControlGroupingData().getFlags().getAtomic()); Assert.assertEquals("Wrong ordered flag", - flags.isOrdered(), - builtByFactory.getOnfControlGroupingData().getFlags().isOrdered()); + flags.getOrdered(), + builtByFactory.getOnfControlGroupingData().getFlags().getOrdered()); Assert.assertEquals("Wrong type", BundleControlType.ONFBCTCOMMITREPLY, builtByFactory.getOnfControlGroupingData().getType()); BundleProperty property = builtByFactory.getOnfControlGroupingData().getBundleProperty().get(0); diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowPluginBulkGroupTransactionProvider.java b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowPluginBulkGroupTransactionProvider.java index 255771a822..19277ed3b6 100644 --- a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowPluginBulkGroupTransactionProvider.java +++ b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowPluginBulkGroupTransactionProvider.java @@ -9,8 +9,7 @@ package org.opendaylight.openflowplugin.test; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.MoreExecutors; -import java.util.ArrayList; -import java.util.List; +import java.util.Map; import org.eclipse.osgi.framework.console.CommandInterpreter; import org.eclipse.osgi.framework.console.CommandProvider; import org.opendaylight.mdsal.binding.api.DataBroker; @@ -38,9 +37,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.acti import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.in._case.CopyTtlInBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.out._case.CopyTtlOutBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.mpls.ttl._case.DecMplsTtlBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtl; import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtlBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropAction; import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropActionBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.pop.mpls.action._case.PopMplsActionBuilder; @@ -67,14 +64,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instru import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.apply.actions._case.ApplyActionsBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.go.to.table._case.GoToTableBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.meter._case.MeterBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.BucketId; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupId; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupTypes; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.BucketsBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.Bucket; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.BucketBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.buckets.BucketKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group; @@ -84,7 +78,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType; import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId; import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId; @@ -96,6 +89,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.NodeErrorListener; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.binding.util.BindingMap; import org.opendaylight.yangtools.yang.common.Uint16; import org.opendaylight.yangtools.yang.common.Uint32; import org.opendaylight.yangtools.yang.common.Uint64; @@ -104,7 +98,6 @@ import org.osgi.framework.BundleContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@SuppressWarnings("checkstyle:MethodName") public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvider { private static final Logger LOG = LoggerFactory.getLogger(OpenflowPluginBulkGroupTransactionProvider.class); private final DataBroker dataBroker; @@ -115,8 +108,8 @@ public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvid private final String originalGroupName = "Foo"; private final NotificationService notificationService; - public OpenflowPluginBulkGroupTransactionProvider(DataBroker dataBroker, NotificationService notificationService, - BundleContext ctx) { + public OpenflowPluginBulkGroupTransactionProvider(final DataBroker dataBroker, + final NotificationService notificationService, final BundleContext ctx) { this.dataBroker = dataBroker; this.notificationService = notificationService; this.ctx = ctx; @@ -132,17 +125,11 @@ public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvid if (nodeId == null) { nodeId = OpenflowpluginTestActivator.NODE_ID; } - NodeBuilder builder = new NodeBuilder(); - builder.setId(new NodeId(nodeId)); - builder.withKey(new NodeKey(builder.getId())); - return builder; + return new NodeBuilder().setId(new NodeId(nodeId)); } private void createTestNode() { - NodeBuilder builder = new NodeBuilder(); - builder.setId(new NodeId(OpenflowpluginTestActivator.NODE_ID)); - builder.withKey(new NodeKey(builder.getId())); - testNode12 = builder.build(); + testNode12 = new NodeBuilder().setId(new NodeId(OpenflowpluginTestActivator.NODE_ID)).build(); } @Override @@ -167,272 +154,166 @@ public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvid } private static InstructionsBuilder createDecNwTtlInstructions() { - DecNwTtlBuilder ta = new DecNwTtlBuilder(); - DecNwTtl decNwTtl = ta.build(); - ActionBuilder ab = new ActionBuilder(); - ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build()); - - // Add our drop action to a list - List actionList = new ArrayList<>(); - actionList.add(ab.build()); - - // Create an Apply Action - ApplyActionsBuilder aab = new ApplyActionsBuilder(); - aab.setAction(actionList); - - // Wrap our Apply Action in an Instruction - InstructionBuilder ib = new InstructionBuilder(); - ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build()); - ib.withKey(new InstructionKey(0)); - ib.setOrder(0); - - // Put our Instruction in a list of Instructions - InstructionsBuilder isb = new InstructionsBuilder(); - List instructions = new ArrayList<>(); - instructions.add(ib.build()); - isb.setInstruction(instructions); - return isb; + return new InstructionsBuilder() + .setInstruction(BindingMap.of(new InstructionBuilder() + .setOrder(0) + .setInstruction(new ApplyActionsCaseBuilder() + .setApplyActions(new ApplyActionsBuilder() + .setAction(BindingMap.of(new ActionBuilder() + .setAction(new DecNwTtlCaseBuilder().setDecNwTtl(new DecNwTtlBuilder().build()).build()) + .build())) + .build()) + .build()) + .build())); } private static MatchBuilder createMatch2() { - MatchBuilder match = new MatchBuilder(); - Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder(); - Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1"); - ipv4Match.setIpv4Source(prefix); - Ipv4Match i4m = ipv4Match.build(); - match.setLayer3Match(i4m); - - EthernetMatchBuilder eth = new EthernetMatchBuilder(); - EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); - ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x0800))); - eth.setEthernetType(ethTypeBuilder.build()); - match.setEthernetMatch(eth.build()); - return match; + return new MatchBuilder() + .setLayer3Match(new Ipv4MatchBuilder().setIpv4Source(new Ipv4Prefix("10.0.0.1")).build()) + .setEthernetMatch(new EthernetMatchBuilder() + .setEthernetType(new EthernetTypeBuilder().setType(new EtherType(Uint32.valueOf(0x0800))).build()) + .build()); } private static MatchBuilder createMatch3() { - MatchBuilder match = new MatchBuilder(); - EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder(); - EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder(); - ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01")); - ethernetMatch.setEthernetSource(ethSourceBuilder.build()); - match.setEthernetMatch(ethernetMatch.build()); - - return match; + return new MatchBuilder() + .setEthernetMatch(new EthernetMatchBuilder() + .setEthernetSource(new EthernetSourceBuilder().setAddress(new MacAddress("00:00:00:00:00:01")).build()) + .build()); } private static InstructionsBuilder createDropInstructions() { - DropActionBuilder dab = new DropActionBuilder(); - DropAction dropAction = dab.build(); - ActionBuilder ab = new ActionBuilder(); - ab.setAction(new DropActionCaseBuilder().setDropAction(dropAction).build()); - - // Add our drop action to a list - List actionList = new ArrayList<>(); - actionList.add(ab.build()); - - // Create an Apply Action - ApplyActionsBuilder aab = new ApplyActionsBuilder(); - aab.setAction(actionList); - - // Wrap our Apply Action in an Instruction - InstructionBuilder ib = new InstructionBuilder(); - ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build()); - - // Put our Instruction in a list of Instructions - InstructionsBuilder isb = new InstructionsBuilder(); - List instructions = new ArrayList<>(); - instructions.add(ib.build()); - isb.setInstruction(instructions); - return isb; + return new InstructionsBuilder() + .setInstruction(BindingMap.of(new InstructionBuilder() + .setInstruction(new ApplyActionsCaseBuilder() + .setApplyActions(new ApplyActionsBuilder() + .setAction(BindingMap.of(new ActionBuilder() + .setAction(new DropActionCaseBuilder() + .setDropAction(new DropActionBuilder().build()) + .build()) + .build())) + .build()) + .build()) + .build())); } private static MatchBuilder createEthernetMatch() { - EthernetMatchBuilder ethmatch = new EthernetMatchBuilder(); // ethernettype - // match - EthernetTypeBuilder ethtype = new EthernetTypeBuilder(); - EtherType type = new EtherType(Uint32.valueOf(0x0800)); - ethmatch.setEthernetType(ethtype.setType(type).build()); - - EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder(); // ethernet - // macaddress - // match - MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff"); - ethdest.setAddress(macdest); - // ethdest.setMask(mask1); - - ethmatch.setEthernetDestination(ethdest.build()); - - EthernetSourceBuilder ethsrc = new EthernetSourceBuilder(); - MacAddress macsrc = new MacAddress("00:00:00:00:23:ae"); - ethsrc.setAddress(macsrc); - // ethsrc.setMask(mask2); - - ethmatch.setEthernetSource(ethsrc.build()); - MatchBuilder match = new MatchBuilder(); - match.setEthernetMatch(ethmatch.build()); - return match; - + return new MatchBuilder() + .setEthernetMatch(new EthernetMatchBuilder() + .setEthernetType(new EthernetTypeBuilder().setType(new EtherType(Uint32.valueOf(0x0800))).build()) + .setEthernetDestination(new EthernetDestinationBuilder() + .setAddress(new MacAddress("ff:ff:ff:ff:ff:ff")) + // .setMask(mask1); + .build()) + .setEthernetSource(new EthernetSourceBuilder() + .setAddress(new MacAddress("00:00:00:00:23:ae")) + // .setMask(mask2); + .build()) + .build()); } private static InstructionsBuilder createMeterInstructions() { - - MeterBuilder aab = new MeterBuilder(); - aab.setMeterId(new MeterId(Uint32.ONE)); - - InstructionBuilder ib = new InstructionBuilder(); - ib.setInstruction(new MeterCaseBuilder().setMeter(aab.build()).build()); - - // Put our Instruction in a list of Instructions - InstructionsBuilder isb = new InstructionsBuilder(); - List instructions = new ArrayList<>(); - instructions.add(ib.build()); - isb.setInstruction(instructions); - return isb; + return new InstructionsBuilder() + .setInstruction(BindingMap.of(new InstructionBuilder() + .setInstruction(new MeterCaseBuilder() + .setMeter(new MeterBuilder().setMeterId(new MeterId(Uint32.ONE)).build()) + .build()) + .build())); } private static InstructionsBuilder createAppyActionInstruction() { - - List actionList = new ArrayList<>(); - ActionBuilder ab = new ActionBuilder(); - ControllerActionBuilder controller = new ControllerActionBuilder(); - controller.setMaxLength(Uint16.valueOf(5)); - ab.setAction(new ControllerActionCaseBuilder().setControllerAction(controller.build()).build()); - actionList.add(ab.build()); - // Create an Apply Action - ApplyActionsBuilder aab = new ApplyActionsBuilder(); - aab.setAction(actionList); - - // Wrap our Apply Action in an Instruction - InstructionBuilder ib = new InstructionBuilder(); - ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build()); - - // Put our Instruction in a list of Instructions - InstructionsBuilder isb = new InstructionsBuilder(); - List instructions = new ArrayList<>(); - instructions.add(ib.build()); - isb.setInstruction(instructions); - return isb; + return new InstructionsBuilder() + .setInstruction(BindingMap.of(new InstructionBuilder() + .setInstruction(new ApplyActionsCaseBuilder() + .setApplyActions(new ApplyActionsBuilder() + .setAction(BindingMap.of(new ActionBuilder() + .setAction(new ControllerActionCaseBuilder() + .setControllerAction(new ControllerActionBuilder() + .setMaxLength(Uint16.valueOf(5)) + .build()) + .build()) + .build())) + .build()) + .build()) + .build())); } private static InstructionsBuilder createAppyActionInstruction7() { - - List actionList = new ArrayList<>(); - ActionBuilder ab = new ActionBuilder(); - - SetVlanIdActionBuilder vl = new SetVlanIdActionBuilder(); - VlanId vlanId = new VlanId(Uint16.valueOf(4012)); - vl.setVlanId(vlanId); - ab.setAction(new SetVlanIdActionCaseBuilder().setSetVlanIdAction(vl.build()).build()); - actionList.add(ab.build()); - // Create an Apply Action - ApplyActionsBuilder aab = new ApplyActionsBuilder(); - aab.setAction(actionList); - - // Wrap our Apply Action in an Instruction - InstructionBuilder ib = new InstructionBuilder(); - ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build()); - - // Put our Instruction in a list of Instructions - InstructionsBuilder isb = new InstructionsBuilder(); - List instructions = new ArrayList<>(); - instructions.add(ib.build()); - isb.setInstruction(instructions); - return isb; + return new InstructionsBuilder() + .setInstruction(BindingMap.of(new InstructionBuilder() + .setInstruction(new ApplyActionsCaseBuilder() + .setApplyActions(new ApplyActionsBuilder() + .setAction(BindingMap.of(new ActionBuilder() + .setAction(new SetVlanIdActionCaseBuilder() + .setSetVlanIdAction(new SetVlanIdActionBuilder() + .setVlanId(new VlanId(Uint16.valueOf(4012))) + .build()) + .build()) + .build())) + .build()) + .build()) + .build())); } private static InstructionsBuilder createAppyActionInstruction21() { - - List actionList = new ArrayList<>(); - ActionBuilder ab = new ActionBuilder(); - - PopVlanActionBuilder popVlanActionBuilder = new PopVlanActionBuilder(); - ab.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(popVlanActionBuilder.build()).build()); - actionList.add(ab.build()); - - // Create an Apply Action - ApplyActionsBuilder aab = new ApplyActionsBuilder(); - aab.setAction(actionList); - - // Wrap our Apply Action in an Instruction - InstructionBuilder ib = new InstructionBuilder(); - ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build()); - - // Put our Instruction in a list of Instructions - InstructionsBuilder isb = new InstructionsBuilder(); - List instructions = new ArrayList<>(); - instructions.add(ib.build()); - isb.setInstruction(instructions); - return isb; + return new InstructionsBuilder() + .setInstruction(BindingMap.of(new InstructionBuilder() + .setInstruction(new ApplyActionsCaseBuilder() + .setApplyActions(new ApplyActionsBuilder() + .setAction(BindingMap.of(new ActionBuilder() + .setAction(new PopVlanActionCaseBuilder() + .setPopVlanAction(new PopVlanActionBuilder().build()) + .build()) + .build())) + .build()) + .build()) + .build())); } private static InstructionsBuilder createAppyActionInstruction2() { - - List actionList = new ArrayList<>(); - ActionBuilder ab = new ActionBuilder(); - - PushMplsActionBuilder push = new PushMplsActionBuilder(); - push.setEthernetType(Uint16.valueOf(0x8847)); - ab.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build()); - actionList.add(ab.build()); - // Create an Apply Action - ApplyActionsBuilder aab = new ApplyActionsBuilder(); - aab.setAction(actionList); - - // Wrap our Apply Action in an Instruction - InstructionBuilder ib = new InstructionBuilder(); - ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build()); - - // Put our Instruction in a list of Instructions - InstructionsBuilder isb = new InstructionsBuilder(); - List instructions = new ArrayList<>(); - instructions.add(ib.build()); - isb.setInstruction(instructions); - return isb; + return new InstructionsBuilder() + .setInstruction(BindingMap.of(new InstructionBuilder() + .setInstruction(new ApplyActionsCaseBuilder() + .setApplyActions(new ApplyActionsBuilder() + .setAction(BindingMap.of(new ActionBuilder() + .setAction(new PushMplsActionCaseBuilder() + .setPushMplsAction(new PushMplsActionBuilder() + .setEthernetType(Uint16.valueOf(0x8847)) + .build()) + .build()) + .build())) + .build()) + .build()) + .build())); } private static InstructionsBuilder createAppyActionInstruction3() { - - List actionList = new ArrayList<>(); - ActionBuilder ab = new ActionBuilder(); - - PushPbbActionBuilder pbb = new PushPbbActionBuilder(); - pbb.setEthernetType(Uint16.valueOf(0x88E7)); - ab.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build()); - actionList.add(ab.build()); - // Create an Apply Action - ApplyActionsBuilder aab = new ApplyActionsBuilder(); - aab.setAction(actionList); - - // Wrap our Apply Action in an Instruction - InstructionBuilder ib = new InstructionBuilder(); - ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build()); - - // Put our Instruction in a list of Instructions - InstructionsBuilder isb = new InstructionsBuilder(); - List instructions = new ArrayList<>(); - instructions.add(ib.build()); - isb.setInstruction(instructions); - return isb; + return new InstructionsBuilder() + .setInstruction(BindingMap.of(new InstructionBuilder() + .setInstruction(new ApplyActionsCaseBuilder() + .setApplyActions(new ApplyActionsBuilder() + .setAction(BindingMap.of(new ActionBuilder() + .setAction(new PushPbbActionCaseBuilder() + .setPushPbbAction(new PushPbbActionBuilder() + .setEthernetType(Uint16.valueOf(0x88E7)) + .build()) + .build()) + .build())) + .build()) + .build()) + .build())); } private static InstructionsBuilder createGotoTableInstructions() { - - GoToTableBuilder aab = new GoToTableBuilder(); - aab.setTableId(Uint8.TWO); - - InstructionBuilder ib = new InstructionBuilder(); - ib.setInstruction(new GoToTableCaseBuilder().setGoToTable(aab.build()).build()); - - // Put our Instruction in a list of Instructions - InstructionsBuilder isb = new InstructionsBuilder(); - List instructions = new ArrayList<>(); - instructions.add(ib.build()); - isb.setInstruction(instructions); - return isb; + return new InstructionsBuilder() + .setInstruction(BindingMap.of(new InstructionBuilder() + .setInstruction(new GoToTableCaseBuilder() + .setGoToTable(new GoToTableBuilder().setTableId(Uint8.TWO).build()) + .build()) + .build())); } - private FlowBuilder createTestFlow(NodeBuilder nodeBuilder, String flowTypeArg, String tableId) { + private FlowBuilder createTestFlow(final NodeBuilder nodeBuilder, final String flowTypeArg, final String tableId) { FlowBuilder flow = new FlowBuilder(); long id = 123; @@ -514,7 +395,7 @@ public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvid } final FlowKey key = new FlowKey(new FlowId(Long.toString(id))); - if (null == flow.isBarrier()) { + if (null == flow.getBarrier()) { flow.setBarrier(Boolean.FALSE); } // flow.setBufferId(12L); @@ -539,7 +420,7 @@ public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvid return flow; } - private static Uint8 getTableId(String tableId) { + private static Uint8 getTableId(final String tableId) { Uint8 table = Uint8.TWO; if (tableId == null) { return table; @@ -555,7 +436,8 @@ public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvid } - public void _addGroups(CommandInterpreter ci) { + @SuppressWarnings("checkstyle:MethodName") + public void _addGroups(final CommandInterpreter ci) { String nref = ci.nextArgument(); if (nref == null) { @@ -593,14 +475,12 @@ public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvid } } - private void createUserNode(String nodeRef) { - NodeBuilder builder = new NodeBuilder(); - builder.setId(new NodeId(nodeRef)); - builder.withKey(new NodeKey(builder.getId())); - testNode12 = builder.build(); + private void createUserNode(final String nodeRef) { + testNode12 = new NodeBuilder().setId(new NodeId(nodeRef)).build(); } - public void _modifyGroups(CommandInterpreter ci) { + @SuppressWarnings("checkstyle:MethodName") + public void _modifyGroups(final CommandInterpreter ci) { String nref = ci.nextArgument(); if (nref == null) { @@ -638,11 +518,12 @@ public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvid } } - private static InstanceIdentifier nodeToInstanceId(Node node) { + private static InstanceIdentifier nodeToInstanceId(final Node node) { return InstanceIdentifier.create(Nodes.class).child(Node.class, node.key()); } - public void _removeGroups(CommandInterpreter ci) { + @SuppressWarnings("checkstyle:MethodName") + public void _removeGroups(final CommandInterpreter ci) { String nref = ci.nextArgument(); if (nref == null) { @@ -701,7 +582,7 @@ public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvid } } - private void writeGroup(final CommandInterpreter ci, Group group, Group group1) { + private void writeGroup(final CommandInterpreter ci, final Group group, final Group group1) { ReadWriteTransaction modification = dataBroker.newReadWriteTransaction(); InstanceIdentifier path1 = InstanceIdentifier.create(Nodes.class) @@ -719,18 +600,18 @@ public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvid modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path2, group1); modification.commit().addCallback(new FutureCallback() { @Override - public void onSuccess(CommitInfo notUsed) { + public void onSuccess(final CommitInfo notUsed) { ci.println("Status of Group Data Loaded Transaction: success."); } @Override - public void onFailure(Throwable throwable) { + public void onFailure(final Throwable throwable) { ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable)); } }, MoreExecutors.directExecutor()); } - private void deleteGroup(final CommandInterpreter ci, Group group, Group group1) { + private void deleteGroup(final CommandInterpreter ci, final Group group, final Group group1) { ReadWriteTransaction modification = dataBroker.newReadWriteTransaction(); InstanceIdentifier path1 = InstanceIdentifier.create(Nodes.class) .child(Node.class, testNode12.key()).augmentation(FlowCapableNode.class) @@ -744,18 +625,19 @@ public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvid modification.delete(LogicalDatastoreType.CONFIGURATION, path2); modification.commit().addCallback(new FutureCallback() { @Override - public void onSuccess(CommitInfo notUsed) { + public void onSuccess(final CommitInfo notUsed) { ci.println("Status of Group Data Loaded Transaction: success."); } @Override - public void onFailure(Throwable throwable) { + public void onFailure(final Throwable throwable) { ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable)); } }, MoreExecutors.directExecutor()); } - private GroupBuilder createTestGroup(String actionType, String groupType, String groupmod, String strId) { + private GroupBuilder createTestGroup(String actionType, String groupType, final String groupmod, + final String strId) { // Sample data , committing to DataStore GroupBuilder group = new GroupBuilder(); @@ -835,132 +717,102 @@ public class OpenflowPluginBulkGroupTransactionProvider implements CommandProvid bucket.setWeight(Uint16.valueOf(30)); } - GroupKey key = new GroupKey(new GroupId(Uint32.valueOf(strId))); - group.withKey(key); - // group.setInstall(false); - group.setGroupName(originalGroupName); - group.setBarrier(false); - BucketsBuilder value = new BucketsBuilder(); - List value1 = new ArrayList<>(); - value1.add(bucket.build()); - value.setBucket(value1); - group.setBuckets(value.build()); - return group; - } - - private static List createPopVlanAction() { - PopVlanActionBuilder vlanAction = new PopVlanActionBuilder(); - ActionBuilder action = new ActionBuilder(); - action.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(vlanAction.build()).build()); - action.withKey(new ActionKey(0)); - List actions = new ArrayList<>(); - actions.add(action.build()); - return actions; - } - - private static List createPushVlanAction() { - PushVlanActionBuilder vlan = new PushVlanActionBuilder(); - vlan.setEthernetType(Uint16.valueOf(0x8100)); - VlanId vlanId = new VlanId(Uint16.TWO); - vlan.setVlanId(vlanId); - ActionBuilder action = new ActionBuilder(); - action.setAction(new PushVlanActionCaseBuilder().setPushVlanAction(vlan.build()).build()); - List actions = new ArrayList<>(); - actions.add(action.build()); - return actions; - } - - private static List createPushMplsAction() { - PushMplsActionBuilder push = new PushMplsActionBuilder(); - push.setEthernetType(Uint16.valueOf(0x8847)); - ActionBuilder action = new ActionBuilder(); - action.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build()); - List actions = new ArrayList<>(); - actions.add(action.build()); - return actions; - } - - private static List createPopMplsAction() { - PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder(); - popMplsActionBuilder.setEthernetType(Uint16.valueOf(0XB)); - ActionBuilder action = new ActionBuilder(); - action.setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsActionBuilder.build()).build()); - List actions = new ArrayList<>(); - actions.add(action.build()); - return actions; - } - - private static List createPopPbbAction() { - PopPbbActionBuilder popPbbActionBuilder = new PopPbbActionBuilder(); - ActionBuilder action = new ActionBuilder(); - action.setAction(new PopPbbActionCaseBuilder().setPopPbbAction(popPbbActionBuilder.build()).build()); - List actions = new ArrayList<>(); - actions.add(action.build()); - return actions; - } - - private static List createPushPbbAction() { - PushPbbActionBuilder pbb = new PushPbbActionBuilder(); - pbb.setEthernetType(Uint16.valueOf(0x88E7)); - ActionBuilder action = new ActionBuilder(); - action.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build()); - List actions = new ArrayList<>(); - actions.add(action.build()); - return actions; - } - - private static List createCopyTtlInAction() { - CopyTtlInBuilder ttlin = new CopyTtlInBuilder(); - ActionBuilder action = new ActionBuilder(); - action.setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(ttlin.build()).build()); - List actions = new ArrayList<>(); - actions.add(action.build()); - return actions; - } - - private static List createCopyTtlOutAction() { - CopyTtlOutBuilder ttlout = new CopyTtlOutBuilder(); - ActionBuilder action = new ActionBuilder(); - action.setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(ttlout.build()).build()); - List actions = new ArrayList<>(); - actions.add(action.build()); - return actions; - } - - private static List createDecMplsTtlAction() { - DecMplsTtlBuilder mpls = new DecMplsTtlBuilder(); - ActionBuilder action = new ActionBuilder(); - action.setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(mpls.build()).build()); - List actions = new ArrayList<>(); - actions.add(action.build()); - return actions; - } - - private static List createGroupAction() { - - GroupActionBuilder groupActionB = new GroupActionBuilder(); - groupActionB.setGroupId(Uint32.ONE); - groupActionB.setGroup("0"); - ActionBuilder action = new ActionBuilder(); - action.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build()); - action.withKey(new ActionKey(0)); - List actions = new ArrayList<>(); - actions.add(action.build()); - return actions; - } - - private static List createNonAppyPushVlanAction() { - - ActionBuilder ab = new ActionBuilder(); - - GroupActionBuilder groupActionB = new GroupActionBuilder(); - groupActionB.setGroupId(Uint32.ONE); - groupActionB.setGroup("0"); - ab.setAction(new GroupActionCaseBuilder().setGroupAction(groupActionB.build()).build()); - - List actionList = new ArrayList<>(); - actionList.add(ab.build()); - - return actionList; + return group.withKey(new GroupKey(new GroupId(Uint32.valueOf(strId)))) + // .group.setInstall(false) + .setGroupName(originalGroupName) + .setBarrier(false) + .setBuckets(new BucketsBuilder().setBucket(BindingMap.of(bucket.build())).build()); + } + + private static Map createPopVlanAction() { + return BindingMap.of(new ActionBuilder() + .setOrder(0) + .setAction(new PopVlanActionCaseBuilder().setPopVlanAction(new PopVlanActionBuilder().build()).build()) + .build()); + } + + private static Map createPushVlanAction() { + return BindingMap.of(new ActionBuilder() + .setOrder(0) + .setAction(new PushVlanActionCaseBuilder() + .setPushVlanAction(new PushVlanActionBuilder() + .setEthernetType(Uint16.valueOf(0x8100)) + .setVlanId(new VlanId(Uint16.TWO)) + .build()) + .build()) + .build()); + } + + private static Map createPushMplsAction() { + return BindingMap.of(new ActionBuilder() + .setOrder(0) + .setAction(new PushMplsActionCaseBuilder() + .setPushMplsAction(new PushMplsActionBuilder().setEthernetType(Uint16.valueOf(0x8847)).build()) + .build()) + .build()); + } + + private static Map createPopMplsAction() { + return BindingMap.of(new ActionBuilder() + .setOrder(0) + .setAction(new PopMplsActionCaseBuilder() + .setPopMplsAction(new PopMplsActionBuilder().setEthernetType(Uint16.valueOf(0xB)).build()) + .build()) + .build()); + } + + private static Map createPopPbbAction() { + return BindingMap.of(new ActionBuilder() + .setOrder(0) + .setAction(new PopPbbActionCaseBuilder().setPopPbbAction(new PopPbbActionBuilder().build()).build()) + .build()); + } + + private static Map createPushPbbAction() { + return BindingMap.of(new ActionBuilder() + .setOrder(0) + .setAction(new PushPbbActionCaseBuilder() + .setPushPbbAction(new PushPbbActionBuilder().setEthernetType(Uint16.valueOf(0x88E7)).build()) + .build()) + .build()); + } + + private static Map createCopyTtlInAction() { + return BindingMap.of(new ActionBuilder() + .setOrder(0) + .setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(new CopyTtlInBuilder().build()).build()) + .build()); + } + + private static Map createCopyTtlOutAction() { + return BindingMap.of(new ActionBuilder() + .setOrder(0) + .setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(new CopyTtlOutBuilder().build()).build()) + .build()); + } + + private static Map createDecMplsTtlAction() { + return BindingMap.of(new ActionBuilder() + .setOrder(0) + .setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(new DecMplsTtlBuilder().build()).build()) + .build()); + } + + private static Map createGroupAction() { + return BindingMap.of(new ActionBuilder() + .setOrder(0) + .setAction(new GroupActionCaseBuilder() + .setGroupAction(new GroupActionBuilder().setGroupId(Uint32.ONE).setGroup("0").build()) + .build()) + .build()); + } + + private static Map createNonAppyPushVlanAction() { + return BindingMap.of(new ActionBuilder() + .setOrder(0) + .setAction(new GroupActionCaseBuilder() + .setGroupAction(new GroupActionBuilder().setGroupId(Uint32.ONE).setGroup("0").build()) + .build()) + .build()); } } diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowPluginBulkTransactionProvider.java b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowPluginBulkTransactionProvider.java index 708146a15d..358fc6e1cd 100644 --- a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowPluginBulkTransactionProvider.java +++ b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowPluginBulkTransactionProvider.java @@ -40,9 +40,7 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.acti import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.SwPathActionCaseBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.controller.action._case.ControllerActionBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.copy.ttl.in._case.CopyTtlInBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtl; import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.dec.nw.ttl._case.DecNwTtlBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropAction; import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.drop.action._case.DropActionBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.flood.all.action._case.FloodAllActionBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.group.action._case.GroupActionBuilder; @@ -58,7 +56,6 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.acti import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.sw.path.action._case.SwPathActionBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.Action; import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.list.ActionKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId; @@ -80,13 +77,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instru import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.meter._case.MeterBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.Instruction; import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.list.InstructionKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeConnectorId; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node; import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey; import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType; import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanId; import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.VlanPcp; @@ -99,11 +94,11 @@ import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026 import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Icmpv6MatchBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.IpMatchBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.MetadataBuilder; -import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4Match; import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv6MatchBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.node.error.service.rev140410.NodeErrorListener; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; +import org.opendaylight.yangtools.yang.binding.util.BindingMap; import org.opendaylight.yangtools.yang.common.Uint16; import org.opendaylight.yangtools.yang.common.Uint32; import org.opendaylight.yangtools.yang.common.Uint64; @@ -112,18 +107,17 @@ import org.osgi.framework.BundleContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -@SuppressWarnings("checkstyle:MethodName") public class OpenflowPluginBulkTransactionProvider implements CommandProvider { - private static final Logger LOG = LoggerFactory.getLogger(OpenflowPluginBulkTransactionProvider.class); + private final DataBroker dataBroker; private final BundleContext ctx; private final String originalFlowName = "Foo"; private final NodeErrorListener nodeErrorListener = new NodeErrorListenerLoggingImpl(); private final NotificationService notificationService; - public OpenflowPluginBulkTransactionProvider(DataBroker dataBroker, NotificationService notificationService, - BundleContext ctx) { + public OpenflowPluginBulkTransactionProvider(final DataBroker dataBroker, + final NotificationService notificationService, final BundleContext ctx) { this.dataBroker = dataBroker; this.notificationService = notificationService; this.ctx = ctx; @@ -139,10 +133,7 @@ public class OpenflowPluginBulkTransactionProvider implements CommandProvider { if (nodeId == null) { nodeId = OpenflowpluginTestActivator.NODE_ID; } - NodeBuilder builder = new NodeBuilder(); - builder.setId(new NodeId(nodeId)); - builder.withKey(new NodeKey(builder.getId())); - return builder; + return new NodeBuilder().setId(new NodeId(nodeId)); } @Override @@ -150,7 +141,7 @@ public class OpenflowPluginBulkTransactionProvider implements CommandProvider { return "No help"; } - private FlowBuilder createTestFlow(NodeBuilder nodeBuilder, String flowTypeArg, String tableId) { + private FlowBuilder createTestFlow(final NodeBuilder nodeBuilder, final String flowTypeArg, final String tableId) { FlowBuilder flow = new FlowBuilder(); long id = 123; @@ -391,7 +382,7 @@ public class OpenflowPluginBulkTransactionProvider implements CommandProvider { LOG.warn("flow type not understood: {}", flowType); } - if (null == flow.isBarrier()) { + if (null == flow.getBarrier()) { flow.setBarrier(Boolean.FALSE); } // flow.setBufferId(12L); @@ -417,7 +408,7 @@ public class OpenflowPluginBulkTransactionProvider implements CommandProvider { return flow; } - private static Uint8 getTableId(String tableId) { + private static Uint8 getTableId(final String tableId) { if (tableId != null) { try { return Uint8.valueOf(tableId); @@ -428,7 +419,8 @@ public class OpenflowPluginBulkTransactionProvider implements CommandProvider { return Uint8.TWO; } - public void _addFlows(CommandInterpreter ci) { + @SuppressWarnings("checkstyle:MethodName") + public void _addFlows(final CommandInterpreter ci) { NodeBuilder tn = createTestNode(ci.nextArgument()); String flowtype = ci.nextArgument(); Integer flowcnt = Integer.parseInt(flowtype); @@ -481,11 +473,12 @@ public class OpenflowPluginBulkTransactionProvider implements CommandProvider { writeFlow(ci, tf, tf1, tf2, tf3, tn); } - private static InstanceIdentifier nodeBuilderToInstanceId(NodeBuilder node) { + private static InstanceIdentifier nodeBuilderToInstanceId(final NodeBuilder node) { return InstanceIdentifier.create(Nodes.class).child(Node.class, node.key()); } - public void _modifyFlows(CommandInterpreter ci) { + @SuppressWarnings("checkstyle:MethodName") + public void _modifyFlows(final CommandInterpreter ci) { NodeBuilder tn = createTestNode(ci.nextArgument()); String flowtype = ci.nextArgument(); Integer flowcnt = Integer.parseInt(flowtype); @@ -537,9 +530,9 @@ public class OpenflowPluginBulkTransactionProvider implements CommandProvider { } writeFlow(ci, tf, tf1, tf2, tf3, tn); - } + @SuppressWarnings("checkstyle:MethodName") public void _removeFlows(final CommandInterpreter ci) { ReadWriteTransaction modification = dataBroker.newReadWriteTransaction(); NodeBuilder tn = createTestNode(ci.nextArgument()); @@ -645,12 +638,12 @@ public class OpenflowPluginBulkTransactionProvider implements CommandProvider { modification.delete(LogicalDatastoreType.CONFIGURATION, path4); modification.commit().addCallback(new FutureCallback() { @Override - public void onSuccess(CommitInfo notUsed) { + public void onSuccess(final CommitInfo notUsed) { ci.println("Status of Group Data Loaded Transaction: success."); } @Override - public void onFailure(Throwable throwable) { + public void onFailure(final Throwable throwable) { LOG.error("Status of Group Data Loaded Transaction : failure.", throwable); ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable)); } @@ -658,8 +651,8 @@ public class OpenflowPluginBulkTransactionProvider implements CommandProvider { } - private void writeFlow(final CommandInterpreter ci, FlowBuilder flow, FlowBuilder flow1, FlowBuilder flow2, - FlowBuilder flow3, NodeBuilder nodeBuilder) { + private void writeFlow(final CommandInterpreter ci, final FlowBuilder flow, final FlowBuilder flow1, + final FlowBuilder flow2, final FlowBuilder flow3, final NodeBuilder nodeBuilder) { ReadWriteTransaction modification = dataBroker.newReadWriteTransaction(); InstanceIdentifier path1 = InstanceIdentifier.create(Nodes.class) .child(Node.class, nodeBuilder.key()).augmentation(FlowCapableNode.class) @@ -701,12 +694,12 @@ public class OpenflowPluginBulkTransactionProvider implements CommandProvider { modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path4, flow3.build()); modification.commit().addCallback(new FutureCallback() { @Override - public void onSuccess(CommitInfo notUsed) { + public void onSuccess(final CommitInfo notUsed) { ci.println("Status of Group Data Loaded Transaction: success."); } @Override - public void onFailure(Throwable throwable) { + public void onFailure(final Throwable throwable) { LOG.error("Status of Group Data Loaded Transaction : failure.", throwable); ci.println(String.format("Status of Group Data Loaded Transaction : failure. Reason : %s", throwable)); } @@ -714,144 +707,91 @@ public class OpenflowPluginBulkTransactionProvider implements CommandProvider { } private static InstructionsBuilder createDecNwTtlInstructions() { - DecNwTtlBuilder ta = new DecNwTtlBuilder(); - DecNwTtl decNwTtl = ta.build(); - ActionBuilder ab = new ActionBuilder(); - ab.setAction(new DecNwTtlCaseBuilder().setDecNwTtl(decNwTtl).build()); - - // Add our drop action to a list - List actionList = new ArrayList<>(); - actionList.add(ab.build()); - - // Create an Apply Action - ApplyActionsBuilder aab = new ApplyActionsBuilder(); - aab.setAction(actionList); - - // Wrap our Apply Action in an Instruction - InstructionBuilder ib = new InstructionBuilder(); - ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build()); - ib.withKey(new InstructionKey(0)); - ib.setOrder(0); - - // Put our Instruction in a list of Instructions - InstructionsBuilder isb = new InstructionsBuilder(); - List instructions = new ArrayList<>(); - instructions.add(ib.build()); - isb.setInstruction(instructions); - return isb; + return new InstructionsBuilder() + .setInstruction(BindingMap.of(new InstructionBuilder() + .setOrder(0) + .setInstruction(new ApplyActionsCaseBuilder() + .setApplyActions(new ApplyActionsBuilder() + .setAction(BindingMap.of(new ActionBuilder() + .setAction(new DecNwTtlCaseBuilder().setDecNwTtl(new DecNwTtlBuilder().build()).build()) + .build())) + .build()) + .build()) + .build())); } private static InstructionsBuilder createMeterInstructions() { - - MeterBuilder aab = new MeterBuilder(); - aab.setMeterId(new MeterId(Uint32.ONE)); - - InstructionBuilder ib = new InstructionBuilder(); - ib.setInstruction(new MeterCaseBuilder().setMeter(aab.build()).build()); - - // Put our Instruction in a list of Instructions - InstructionsBuilder isb = new InstructionsBuilder(); - List instructions = new ArrayList<>(); - instructions.add(ib.build()); - isb.setInstruction(instructions); - return isb; + return new InstructionsBuilder() + .setInstruction(BindingMap.of(new InstructionBuilder() + .setOrder(0) + .setInstruction(new MeterCaseBuilder() + .setMeter(new MeterBuilder().setMeterId(new MeterId(Uint32.ONE)).build()) + .build()) + .build())); } private static InstructionsBuilder createGotoTableInstructions() { - - GoToTableBuilder aab = new GoToTableBuilder(); - aab.setTableId(Uint8.TWO); - - InstructionBuilder ib = new InstructionBuilder(); - ib.setInstruction(new GoToTableCaseBuilder().setGoToTable(aab.build()).build()); - - // Put our Instruction in a list of Instructions - InstructionsBuilder isb = new InstructionsBuilder(); - List instructions = new ArrayList<>(); - instructions.add(ib.build()); - isb.setInstruction(instructions); - return isb; + return new InstructionsBuilder() + .setInstruction(BindingMap.of(new InstructionBuilder() + .setOrder(0) + .setInstruction(new GoToTableCaseBuilder() + .setGoToTable(new GoToTableBuilder().setTableId(Uint8.TWO).build()) + .build()) + .build())); } private static InstructionsBuilder createDropInstructions() { - DropActionBuilder dab = new DropActionBuilder(); - DropAction dropAction = dab.build(); - ActionBuilder ab = new ActionBuilder(); - ab.setAction(new DropActionCaseBuilder().setDropAction(dropAction).build()); - - // Add our drop action to a list - List actionList = new ArrayList<>(); - actionList.add(ab.build()); - - // Create an Apply Action - ApplyActionsBuilder aab = new ApplyActionsBuilder(); - aab.setAction(actionList); - - // Wrap our Apply Action in an Instruction - InstructionBuilder ib = new InstructionBuilder(); - ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build()); - - // Put our Instruction in a list of Instructions - InstructionsBuilder isb = new InstructionsBuilder(); - List instructions = new ArrayList<>(); - instructions.add(ib.build()); - isb.setInstruction(instructions); - return isb; + return new InstructionsBuilder() + .setInstruction(BindingMap.of(new InstructionBuilder() + .setOrder(0) + .setInstruction(new ApplyActionsCaseBuilder() + .setApplyActions(new ApplyActionsBuilder() + .setAction(BindingMap.of(new ActionBuilder() + .setAction(new DropActionCaseBuilder() + .setDropAction(new DropActionBuilder().build()) + .build()) + .build())) + .build()) + .build()) + .build())); } private static InstructionsBuilder createAppyActionInstruction() { - - List actionList = new ArrayList<>(); - ActionBuilder ab = new ActionBuilder(); - ControllerActionBuilder controller = new ControllerActionBuilder(); - controller.setMaxLength(Uint16.valueOf(5)); - ab.setAction(new ControllerActionCaseBuilder().setControllerAction(controller.build()).build()); - actionList.add(ab.build()); - // Create an Apply Action - ApplyActionsBuilder aab = new ApplyActionsBuilder(); - aab.setAction(actionList); - - // Wrap our Apply Action in an Instruction - InstructionBuilder ib = new InstructionBuilder(); - ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build()); - - // Put our Instruction in a list of Instructions - InstructionsBuilder isb = new InstructionsBuilder(); - List instructions = new ArrayList<>(); - instructions.add(ib.build()); - isb.setInstruction(instructions); - return isb; + return new InstructionsBuilder() + .setInstruction(BindingMap.of(new InstructionBuilder() + .setOrder(0) + .setInstruction(new ApplyActionsCaseBuilder() + .setApplyActions(new ApplyActionsBuilder() + .setAction(BindingMap.of(new ActionBuilder() + .setAction(new ControllerActionCaseBuilder() + .setControllerAction(new ControllerActionBuilder() + .setMaxLength(Uint16.valueOf(5)) + .build()) + .build()) + .build())) + .build()) + .build()) + .build())); } private static InstructionsBuilder createSentToControllerInstructions() { - ActionBuilder ab = new ActionBuilder(); - - OutputActionBuilder output = new OutputActionBuilder(); - output.setMaxLength(Uint16.MAX_VALUE); - Uri value = new Uri(OutputPortValues.CONTROLLER.toString()); - output.setOutputNodeConnector(value); - ab.setAction(new OutputActionCaseBuilder().setOutputAction(output.build()).build()); - ab.setOrder(0); - ab.withKey(new ActionKey(0)); - - List actionList = new ArrayList<>(); - actionList.add(ab.build()); - // Create an Apply Action - ApplyActionsBuilder aab = new ApplyActionsBuilder(); - aab.setAction(actionList); - - // Wrap our Apply Action in an Instruction - InstructionBuilder ib = new InstructionBuilder(); - ib.setInstruction(new ApplyActionsCaseBuilder().setApplyActions(aab.build()).build()); - ib.setOrder(0); - ib.withKey(new InstructionKey(0)); - - // Put our Instruction in a list of Instructions - InstructionsBuilder isb = new InstructionsBuilder(); - List instructions = new ArrayList<>(); - instructions.add(ib.build()); - isb.setInstruction(instructions); - return isb; + return new InstructionsBuilder() + .setInstruction(BindingMap.of(new InstructionBuilder() + .setOrder(0) + .setInstruction(new ApplyActionsCaseBuilder() + .setApplyActions(new ApplyActionsBuilder() + .setAction(BindingMap.of(new ActionBuilder() + .setOrder(0) + .setAction(new OutputActionCaseBuilder() + .setOutputAction(new OutputActionBuilder() + .setMaxLength(Uint16.MAX_VALUE) + .setOutputNodeConnector(new Uri(OutputPortValues.CONTROLLER.toString())) + .build()) + .build()) + .build())) + .build()) + .build()) + .build())); } private static InstructionsBuilder createAppyActionInstruction2() { @@ -1166,174 +1106,107 @@ public class OpenflowPluginBulkTransactionProvider implements CommandProvider { } private static MatchBuilder createLLDPMatch() { - MatchBuilder match = new MatchBuilder(); - EthernetMatchBuilder eth = new EthernetMatchBuilder(); - EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); - ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x88cc))); - eth.setEthernetType(ethTypeBuilder.build()); - match.setEthernetMatch(eth.build()); - return match; + return new MatchBuilder() + .setEthernetMatch(new EthernetMatchBuilder() + .setEthernetType(new EthernetTypeBuilder().setType(new EtherType(Uint32.valueOf(0x88cc))).build()) + .build()); } private static MatchBuilder createMatch1() { - MatchBuilder match = new MatchBuilder(); - Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder(); - Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1/24"); - ipv4Match.setIpv4Destination(prefix); - Ipv4Match i4m = ipv4Match.build(); - match.setLayer3Match(i4m); - - EthernetMatchBuilder eth = new EthernetMatchBuilder(); - EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); - ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x0800))); - eth.setEthernetType(ethTypeBuilder.build()); - match.setEthernetMatch(eth.build()); - return match; + return new MatchBuilder() + .setLayer3Match(new Ipv4MatchBuilder().setIpv4Destination(new Ipv4Prefix("10.0.0.1/24")).build()) + .setEthernetMatch(new EthernetMatchBuilder() + .setEthernetType(new EthernetTypeBuilder().setType(new EtherType(Uint32.valueOf(0x0800))).build()) + .build()); } private static MatchBuilder createMatch1000() { - MatchBuilder match = new MatchBuilder(); - Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder(); - Ipv4Prefix prefix = new Ipv4Prefix("10.1.1.1/24"); - ipv4Match.setIpv4Destination(prefix); - Ipv4Match i4m = ipv4Match.build(); - match.setLayer3Match(i4m); - - EthernetMatchBuilder eth = new EthernetMatchBuilder(); - EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); - ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x0800))); - eth.setEthernetType(ethTypeBuilder.build()); - match.setEthernetMatch(eth.build()); - return match; + return new MatchBuilder() + .setLayer3Match(new Ipv4MatchBuilder().setIpv4Destination(new Ipv4Prefix("10.1.1.1/24")).build()) + .setEthernetMatch(new EthernetMatchBuilder() + .setEthernetType(new EthernetTypeBuilder().setType(new EtherType(Uint32.valueOf(0x0800))).build()) + .build()); } private static MatchBuilder createMatch2() { - MatchBuilder match = new MatchBuilder(); - Ipv4MatchBuilder ipv4Match = new Ipv4MatchBuilder(); - Ipv4Prefix prefix = new Ipv4Prefix("10.0.0.1"); - ipv4Match.setIpv4Source(prefix); - Ipv4Match i4m = ipv4Match.build(); - match.setLayer3Match(i4m); - - EthernetMatchBuilder eth = new EthernetMatchBuilder(); - EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); - ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x0800))); - eth.setEthernetType(ethTypeBuilder.build()); - match.setEthernetMatch(eth.build()); - return match; + return new MatchBuilder() + .setLayer3Match(new Ipv4MatchBuilder().setIpv4Source(new Ipv4Prefix("10.0.0.1")).build()) + .setEthernetMatch(new EthernetMatchBuilder() + .setEthernetType(new EthernetTypeBuilder().setType(new EtherType(Uint32.valueOf(0x0800))).build()) + .build()); } private static MatchBuilder createMatch3() { - MatchBuilder match = new MatchBuilder(); - EthernetMatchBuilder ethernetMatch = new EthernetMatchBuilder(); - EthernetSourceBuilder ethSourceBuilder = new EthernetSourceBuilder(); - ethSourceBuilder.setAddress(new MacAddress("00:00:00:00:00:01")); - ethernetMatch.setEthernetSource(ethSourceBuilder.build()); - match.setEthernetMatch(ethernetMatch.build()); - - return match; + return new MatchBuilder() + .setEthernetMatch(new EthernetMatchBuilder() + .setEthernetSource(new EthernetSourceBuilder().setAddress(new MacAddress("00:00:00:00:00:01")).build()) + .build()); } - private static MatchBuilder createInphyportMatch(NodeId nodeId) { - MatchBuilder match = new MatchBuilder(); - match.setInPort(new NodeConnectorId(nodeId + ":202")); - match.setInPhyPort(new NodeConnectorId(nodeId + ":10122")); - return match; + private static MatchBuilder createInphyportMatch(final NodeId nodeId) { + return new MatchBuilder() + .setInPort(new NodeConnectorId(nodeId + ":202")) + .setInPhyPort(new NodeConnectorId(nodeId + ":10122")); } private static MatchBuilder createEthernetMatch() { - EthernetMatchBuilder ethmatch = new EthernetMatchBuilder(); // ethernettype - // match - EthernetTypeBuilder ethtype = new EthernetTypeBuilder(); - EtherType type = new EtherType(Uint32.valueOf(0x0800)); - ethmatch.setEthernetType(ethtype.setType(type).build()); - - EthernetDestinationBuilder ethdest = new EthernetDestinationBuilder(); // ethernet - // macaddress - // match - MacAddress macdest = new MacAddress("ff:ff:ff:ff:ff:ff"); - ethdest.setAddress(macdest); - // ethdest.setMask(mask1); - - ethmatch.setEthernetDestination(ethdest.build()); - - EthernetSourceBuilder ethsrc = new EthernetSourceBuilder(); - MacAddress macsrc = new MacAddress("00:00:00:00:23:ae"); - ethsrc.setAddress(macsrc); - // ethsrc.setMask(mask2); - - ethmatch.setEthernetSource(ethsrc.build()); - - MatchBuilder match = new MatchBuilder(); - match.setEthernetMatch(ethmatch.build()); - return match; - + return new MatchBuilder() + .setEthernetMatch(new EthernetMatchBuilder() + .setEthernetType(new EthernetTypeBuilder().setType(new EtherType(Uint32.valueOf(0x0800))).build()) + .setEthernetDestination(new EthernetDestinationBuilder() + .setAddress(new MacAddress("ff:ff:ff:ff:ff:ff")) + // .setMask(mask1) + .build()) + .setEthernetSource(new EthernetSourceBuilder() + .setAddress(new MacAddress("00:00:00:00:23:ae")) + // .setMask(mask2) + .build()) + .build()); } private static MatchBuilder createL3IPv6Match() { - MatchBuilder match = new MatchBuilder(); - - EthernetMatchBuilder eth = new EthernetMatchBuilder(); - EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); - ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x86dd))); - eth.setEthernetType(ethTypeBuilder.build()); - match.setEthernetMatch(eth.build()); - - Ipv6LabelBuilder ipv6label = new Ipv6LabelBuilder(); - Ipv6FlowLabel label = new Ipv6FlowLabel(Uint32.valueOf(10028)); - ipv6label.setIpv6Flabel(label); - // ipv6label.setFlabelMask(new byte[] { 0, 1, -1, -1 }); - - Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6 - // match - icmpv6match.setIcmpv6Type(Uint8.valueOf(135)); - icmpv6match.setIcmpv6Code(Uint8.ZERO); - match.setIcmpv6Match(icmpv6match.build()); - - Ipv6MatchBuilder ipv6match = new Ipv6MatchBuilder(); - // ipv6match.setIpv6Source(srcip6); - // ipv6match.setIpv6Destination(dstip6); - // ipv6match.setIpv6ExtHeader(nextheader.build()); - - ipv6match.setIpv6NdSll(new MacAddress("c2:00:54:f5:00:00")); - ipv6match.setIpv6NdTll(new MacAddress("00:0c:29:0e:4c:67")); - // ipv6match.setIpv6NdTarget(ndtarget); - ipv6match.setIpv6Label(ipv6label.build()); - - match.setLayer3Match(ipv6match.build()); - - return match; + return new MatchBuilder() + .setEthernetMatch(new EthernetMatchBuilder() + .setEthernetType(new EthernetTypeBuilder().setType(new EtherType(Uint32.valueOf(0x86dd))).build()) + .build()) + // icmpv6 + .setIcmpv6Match(new Icmpv6MatchBuilder() + .setIcmpv6Type(Uint8.valueOf(135)) + .setIcmpv6Code(Uint8.ZERO) + .build()) + .setLayer3Match(new Ipv6MatchBuilder() + // .setIpv6Source(srcip6) + // .setIpv6Destination(dstip6) + // .setIpv6ExtHeader(nextheader.build()) + .setIpv6NdSll(new MacAddress("c2:00:54:f5:00:00")) + .setIpv6NdTll(new MacAddress("00:0c:29:0e:4c:67")) + // .setIpv6NdTarget(ndtarget) + .setIpv6Label(new Ipv6LabelBuilder() + .setIpv6Flabel(new Ipv6FlowLabel(Uint32.valueOf(10028))) + // .setFlabelMask(new byte[] { 0, 1, -1, -1 }) + .build()) + .build()); } private static MatchBuilder createICMPv6Match() { - - MatchBuilder match = new MatchBuilder(); - EthernetMatchBuilder eth = new EthernetMatchBuilder(); - EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder(); - ethTypeBuilder.setType(new EtherType(Uint32.valueOf(0x86dd))); - eth.setEthernetType(ethTypeBuilder.build()); - match.setEthernetMatch(eth.build()); - - IpMatchBuilder ipmatch = new IpMatchBuilder(); // ipv4 version - ipmatch.setIpProtocol(Uint8.valueOf(58)); - match.setIpMatch(ipmatch.build()); - - Icmpv6MatchBuilder icmpv6match = new Icmpv6MatchBuilder(); // icmpv6 - // match - icmpv6match.setIcmpv6Type(Uint8.valueOf(135)); - icmpv6match.setIcmpv6Code(Uint8.ONE); - match.setIcmpv6Match(icmpv6match.build()); - - return match; + return new MatchBuilder() + .setEthernetMatch(new EthernetMatchBuilder() + .setEthernetType(new EthernetTypeBuilder().setType(new EtherType(Uint32.valueOf(0x86dd))).build()) + .build()) + // ipv4 version + .setIpMatch(new IpMatchBuilder().setIpProtocol(Uint8.valueOf(58)).build()) + // icmpv6 + .setIcmpv6Match(new Icmpv6MatchBuilder() + .setIcmpv6Type(Uint8.valueOf(135)) + .setIcmpv6Code(Uint8.ONE) + .build()); } private static MatchBuilder createMetadataMatch() { - MatchBuilder match = new MatchBuilder(); - MetadataBuilder metadata = new MetadataBuilder(); // metadata match - metadata.setMetadata(Uint64.valueOf(500)); - // metadata.setMetadataMask(metamask); - match.setMetadata(metadata.build()); - - return match; + return new MatchBuilder() + .setMetadata(new MetadataBuilder() + .setMetadata(Uint64.valueOf(500)) + // .setMetadataMask(metamask) + .build()); } } diff --git a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestCommandProvider.java b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestCommandProvider.java index 0dc6a63e7a..6ebcf4396a 100644 --- a/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestCommandProvider.java +++ b/test-provider/src/main/java/org/opendaylight/openflowplugin/test/OpenflowpluginTestCommandProvider.java @@ -687,7 +687,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider { } final FlowKey key = new FlowKey(new FlowId(Long.toString(id))); - if (null == flow.isBarrier()) { + if (null == flow.getBarrier()) { flow.setBarrier(Boolean.FALSE); } flow.setCookie(new FlowCookie(Uint64.TEN)); @@ -729,7 +729,7 @@ public class OpenflowpluginTestCommandProvider implements CommandProvider { } final FlowKey key = new FlowKey(new FlowId(Long.toString(flowId))); - if (null == flow.isBarrier()) { + if (null == flow.getBarrier()) { flow.setBarrier(Boolean.FALSE); } flow.setCookie(new FlowCookie(Uint64.TEN)); -- 2.36.6