@Override
public ListenableFuture<RpcResult<AddFlowsDsOutput>> 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);
@Override
public ListenableFuture<RpcResult<ReadFlowTestOutput>> 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);
@Override
public ListenableFuture<RpcResult<FlowTestOutput>> 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(),
RpcResultBuilder<FlowTestOutput> 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(),
} 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(),
* 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;
@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!");
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
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
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();
// 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<Void>) 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));
});
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<Integer> listSize(List<?> list) {
+ protected Callable<Integer> listSize(final List<?> list) {
// The condition supplier part
return list::size;
}
return false;
}
- if (!gatheringStatusEnd.isSucceeded()) {
+ if (!gatheringStatusEnd.getSucceeded()) {
LOG.trace("Statistics gathering was not successful: {}", nodeId.getValue());
return false;
}
* 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;
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;
private static final Logger LOG = LoggerFactory.getLogger(TableForwarder.class);
private final SalTableService salTableService;
- public TableForwarder(SalTableService salTableService) {
+ public TableForwarder(final SalTableService salTableService) {
this.salTableService = salTableService;
}
public ListenableFuture<RpcResult<UpdateTableOutput>> update(final InstanceIdentifier<TableFeatures> identifier,
final TableFeatures original, final TableFeatures update,
final InstanceIdentifier<FlowCapableNode> 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<Table> 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());
}
}
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));
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";
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<AddFlowOutput> addFlowOutputRpcResult = addResult.get(2, TimeUnit.SECONDS);
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<UpdateFlowOutput> updateFlowOutputRpcResult = updateResult.get(2, TimeUnit.SECONDS);
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<RemoveFlowOutput> removeFlowOutputRpcResult = removeResult.get(2, TimeUnit.SECONDS);
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());
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;
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;
.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()))
= 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);
}
@Override
- public void onDataTreeChanged(@NonNull Collection<DataTreeModification<T>> modifications) {
+ public void onDataTreeChanged(@NonNull final Collection<DataTreeModification<T>> modifications) {
for (DataTreeModification modification : modifications) {
LOG.trace("Node connectors in inventory changed -> {}", modification.getRootNode().getModificationType());
switch (modification.getRootNode().getModificationType()) {
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);
}
}
- 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<NodeConnector> nodeConnectorInstanceId,
// Create prerequisites
InstanceIdentifier<NodeConnector> id2 = TestUtils.createNodeConnectorId("openflow:1", "openflow:1:2");
InstanceIdentifier<FlowCapableNodeConnector> iiToConnector2 = id2.augmentation(FlowCapableNodeConnector.class);
- List<DataTreeModification> modifications = new ArrayList();
+ List<DataTreeModification> 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
private final AlarmAgent alarmAgent;
private final NodeListener nodeListener;
private final int threadPoolSize = 10;
- private final ExecutorService executor = Executors.newWorkStealingPool(threadPoolSize);
private final Map<String, ReconciliationState> reconciliationStates;
+ private ExecutorService executor = Executors.newWorkStealingPool(threadPoolSize);
+
public ReconciliationServiceImpl(final DataBroker broker, final FrmReconciliationService frmReconciliationService,
final AlarmAgent alarmAgent, final NodeListener nodeListener,
final FlowGroupCacheManager flowGroupCacheManager) {
public void close() {
if (executor != null) {
executor.shutdownNow();
+ executor = null;
}
}
@Override
- public ListenableFuture<RpcResult<ReconcileOutput>> reconcile(ReconcileInput input) {
- boolean reconcileAllNodes = input.isReconcileAllNodes();
+ public ListenableFuture<RpcResult<ReconcileOutput>> reconcile(final ReconcileInput input) {
+ boolean reconcileAllNodes = input.getReconcileAllNodes();
List<Uint64> inputNodes = input.getNodes();
if (inputNodes == null) {
inputNodes = new ArrayList<>();
return reconciliationStates.get(nodeId.toString());
}
- private static ListenableFuture<RpcResult<ReconcileOutput>> buildErrorResponse(String msg) {
+ private static ListenableFuture<RpcResult<ReconcileOutput>> buildErrorResponse(final String msg) {
LOG.error("Error {}", msg);
return RpcResultBuilder.<ReconcileOutput>failed()
.withError(RpcError.ErrorType.PROTOCOL, "reconcile", msg)
private List<Long> getAllNodes() {
List<OFNode> nodeList = ShellUtil.getAllNodes(nodeListener);
- List<Long> nodes = nodeList.stream().distinct().map(node -> node.getNodeId()).collect(Collectors.toList());
+ List<Long> nodes = nodeList.stream().distinct().map(OFNode::getNodeId).collect(Collectors.toList());
return nodes;
}
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;
}
}
}
- private Optional<ReconcileCounter> getReconciliationCount(ReadWriteTransaction tx,
- InstanceIdentifier<ReconcileCounter> instanceIdentifier) {
+ private Optional<ReconcileCounter> getReconciliationCount(final ReadWriteTransaction tx,
+ final InstanceIdentifier<ReconcileCounter> instanceIdentifier) {
try {
return tx.read(LogicalDatastoreType.OPERATIONAL, instanceIdentifier).get();
} catch (InterruptedException | ExecutionException e) {
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);
}
}
@SuppressWarnings("checkstyle:RegexpSinglelineJava")
+ @Deprecated
@Override
protected Object doExecute() {
if (nodeId == null) {
}
@Override
- public void onDataTreeChanged(Collection<DataTreeModification<FlowCapableNodeConnector>> modifications) {
+ public void onDataTreeChanged(final Collection<DataTreeModification<FlowCapableNodeConnector>> modifications) {
for (DataTreeModification<FlowCapableNodeConnector> modification : modifications) {
switch (modification.getRootNode().getModificationType()) {
case WRITE:
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);
}
});
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
}
@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);
}
}
- protected EricHeader buildHeader(boolean hasMask) {
+ protected EricHeader buildHeader(final boolean hasMask) {
return new EricHeader(
getOxmClassCode(),
getEricFieldCode(),
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;
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() {
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());
}
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;
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;
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() {
assertEquals(EricExpClass.class, input.getOxmClass());
assertEquals(Icmpv6NdReserved.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(2, result.getIcmpv6NdReservedValues().getIcmpv6NdReserved().intValue());
}
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);
public abstract class AbstractExperimenterMatchCodec extends AbstractMatchCodec {
protected static <F extends MatchField> MatchEntrySerializerKey<ExperimenterClass, F> createSerializerKey(
- short version, Uint32 expId, Class<F> oxmField) {
+ final short version, final Uint32 expId, final Class<F> oxmField) {
MatchEntrySerializerKey<ExperimenterClass, F> key = new MatchEntrySerializerKey<>(
version, ExperimenterClass.class, oxmField);
key.setExperimenterId(expId);
}
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);
}
@Override
- public void serialize(MatchEntry input, ByteBuf outBuffer) {
+ public void serialize(final MatchEntry input, final ByteBuf outBuffer) {
// serializes standard header + experimenterId
serializeHeader(input, outBuffer);
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
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)
}
@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,
}
protected abstract @NonNull Uint32 getExperimenterId();
-
}
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
}
@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);
}
}
- protected NxmHeader buildHeader(boolean hasMask) {
+ protected NxmHeader buildHeader(final boolean hasMask) {
return new NxmHeader(
getOxmClassCode(),
getNxmFieldCode(),
* Returns the oxm_class class.
*/
public abstract Class<? extends OxmClassBase> getOxmClass();
-
}
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));
}
}
@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());
}
}
/**
* 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<Nxm1Class, NxmNxCtMark> 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());
}
@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));
* 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;
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;
}
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());
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)
.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) {
assertEquals(Nxm0Class.class, input.getOxmClass());
assertEquals(NxmOfArpOp.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(2, result.getArpOpValues().getValue().shortValue());
}
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;
assertEquals(Nxm1Class.class, input.getOxmClass());
assertEquals(NxmNxArpSha.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(RESULT_ADDRESS, result.getArpShaValues().getMacAddress());
}
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;
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;
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();
assertEquals(Nxm0Class.class, input.getOxmClass());
assertEquals(NxmOfArpSpa.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(2, result.getArpSpaValues().getValue().shortValue());
}
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;
assertEquals(Nxm1Class.class, input.getOxmClass());
assertEquals(NxmNxArpTha.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(TEST_ADDRESS, result.getArpThaValues().getMacAddress());
}
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;
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;
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();
assertEquals(Nxm0Class.class, input.getOxmClass());
assertEquals(NxmOfArpTpa.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(2, result.getArpTpaValues().getValue().intValue());
}
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;
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;
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();
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());
}
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;
* 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;
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();
assertEquals(Nxm1Class.class, input.getOxmClass());
assertEquals(NxmNxCtTpDst.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(2, result.getCtTpDstValues().getCtTpDst().shortValue());
}
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;
* 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;
assertEquals(Nxm1Class.class, input.getOxmClass());
assertEquals(NxmNxCtTpSrc.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(2, result.getCtTpSrcValues().getCtTpSrc().shortValue());
}
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;
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;
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();
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();
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;
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;
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;
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();
assertEquals(Nxm0Class.class, input.getOxmClass());
assertEquals(NxmOfEthDst.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(TEST_ADDRESS, result.getEthDstValues().getMacAddress());
}
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;
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;
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;
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();
assertEquals(Nxm0Class.class, input.getOxmClass());
assertEquals(NxmOfEthSrc.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(TEST_ADDRESS, result.getEthSrcValues().getMacAddress());
}
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;
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;
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();
assertEquals(Nxm0Class.class, input.getOxmClass());
assertEquals(NxmOfEthType.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(2, result.getEthTypeValues().getValue().shortValue());
}
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;
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;
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();
assertEquals(Nxm0Class.class, input.getOxmClass());
assertEquals(NxmOfIcmpType.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(2, result.getIcmpTypeValues().getValue().shortValue());
}
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;
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;
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();
assertEquals(Nxm0Class.class, input.getOxmClass());
assertEquals(NxmOfIpDst.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(2, result.getIpDstValues().getValue().intValue());
}
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;
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;
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();
assertEquals(Nxm0Class.class, input.getOxmClass());
assertEquals(NxmOfIpSrc.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(2, result.getIpSrcValues().getValue().intValue());
}
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;
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;
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();
assertEquals(Nxm1Class.class, input.getOxmClass());
assertEquals(NxmOfIpDst.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(2, result.getIpDstValues().getValue().intValue());
}
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;
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;
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();
assertEquals(Nxm1Class.class, input.getOxmClass());
assertEquals(NxmOfIpSrc.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(2, result.getIpSrcValues().getValue().intValue());
}
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;
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;
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();
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() {
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);
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;
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() {
assertEquals(Nxm1Class.class, input.getOxmClass());
assertEquals(NxmNxPktMark.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(2, result.getPktMarkValues().getPktMark().intValue());
}
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;
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;
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();
assertEquals(Nxm1Class.class, input.getOxmClass());
assertEquals(NxmNxReg0.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(1, result.getRegValues().getValue().intValue());
}
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;
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;
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();
assertEquals(Nxm1Class.class, input.getOxmClass());
assertEquals(NxmNxReg1.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(1, result.getRegValues().getValue().intValue());
}
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;
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;
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();
assertEquals(Nxm1Class.class, input.getOxmClass());
assertEquals(NxmNxReg2.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(1, result.getRegValues().getValue().intValue());
}
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;
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;
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();
assertEquals(Nxm1Class.class, input.getOxmClass());
assertEquals(NxmNxReg3.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(1, result.getRegValues().getValue().intValue());
}
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;
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;
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();
assertEquals(Nxm1Class.class, input.getOxmClass());
assertEquals(NxmNxReg4.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(1, result.getRegValues().getValue().intValue());
}
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;
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;
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();
assertEquals(Nxm1Class.class, input.getOxmClass());
assertEquals(NxmNxReg5.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(1, result.getRegValues().getValue().intValue());
}
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;
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;
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();
assertEquals(Nxm1Class.class, input.getOxmClass());
assertEquals(NxmNxReg6.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(1, result.getRegValues().getValue().intValue());
}
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;
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;
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();
assertEquals(Nxm1Class.class, input.getOxmClass());
assertEquals(NxmNxReg7.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(1, result.getRegValues().getValue().intValue());
}
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;
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;
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();
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);
}
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;
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;
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();
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);
}
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;
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;
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();
assertEquals(Nxm1Class.class, input.getOxmClass());
assertEquals(NxmNxTunId.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(0, result.getTunIdValues().getValue().longValue());
}
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;
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;
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();
assertEquals(Nxm1Class.class, input.getOxmClass());
assertEquals(NxmNxTunIpv4Dst.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(1, result.getTunIpv4DstValues().getValue().intValue());
}
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;
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;
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();
assertEquals(Nxm1Class.class, input.getOxmClass());
assertEquals(NxmNxTunIpv4Src.class, input.getOxmMatchField());
- assertEquals(false, input.isHasMask());
+ assertEquals(false, input.getHasMask());
assertEquals(1, result.getTunIpv4SrcValues().getValue().intValue());
}
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;
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;
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();
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);
}
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;
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;
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();
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);
}
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;
@SuppressWarnings("unchecked")
@Override
- public ExtensionAugment<? extends Augmentation<Extension>> convert(MatchEntry input, MatchPath path) {
+ public ExtensionAugment<? extends Augmentation<Extension>> 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())) {
RegCaseValue regCaseValue = (RegCaseValue) input.getMatchEntryValue();
nxRegBuilder.setValue(regCaseValue.getRegValues().getValue());
- if (input.isHasMask()) {
+ if (input.getHasMask()) {
nxRegBuilder.setMask(regCaseValue.getRegValues().getMask());
}
}
@Override
- public MatchEntry convert(Extension extension) {
+ public MatchEntry convert(final Extension extension) {
Optional<NxmNxRegGrouping> matchGrouping = MatchUtil.REG_RESOLVER.findExtension(extension);
if (!matchGrouping.isPresent()) {
throw new CodecPreconditionException(extension);
.build();
}
- private static Class<? extends ExtensionKey> resolveRegKey(Class<? extends MatchField> oxmMatchField) {
+ private static Class<? extends ExtensionKey> resolveRegKey(final Class<? extends MatchField> oxmMatchField) {
if (NiciraMatchCodecs.REG0_CODEC.getNxmField().isAssignableFrom(oxmMatchField)) {
return NxmNxReg0Key.class;
}
throw new CodecPreconditionException("There is no key for " + oxmMatchField);
}
- private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(NxmNxReg nxmNxReg,
- MatchPath path, Class<? extends ExtensionKey> key) {
+ private static ExtensionAugment<? extends Augmentation<Extension>> resolveAugmentation(final NxmNxReg nxmNxReg,
+ final MatchPath path, final Class<? extends ExtensionKey> key) {
switch (path) {
case FLOWS_STATISTICS_UPDATE_MATCH:
return new ExtensionAugment<>(NxAugMatchNodesNodeTableFlow.class,
* 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;
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);
}
testConvert(message, BundleFlowModCase.class, withProperty);
}
- private void testConvert(final BundleInnerMessage message, Class<? extends DataObject> clazz,
+ private void testConvert(final BundleInnerMessage message, final Class<? extends DataObject> clazz,
final boolean withProperty) throws ConversionException {
final BundleAddMessageSal original = createMessage(withProperty, message);
final ExtensionConvertorData data = new ExtensionConvertorData(OFConstants.OFP_VERSION_1_3);
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());
);
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) {
* 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;
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",
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);
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;
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;
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;
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;
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;
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;
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;
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
}
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<Action> 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<Instruction> 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<Action> 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<Instruction> 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<Instruction> 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<Action> 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<Instruction> 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<Action> 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<Instruction> 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<Action> 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<Instruction> 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<Action> 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<Instruction> 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<Action> 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<Instruction> 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<Instruction> 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;
}
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);
return flow;
}
- private static Uint8 getTableId(String tableId) {
+ private static Uint8 getTableId(final String tableId) {
Uint8 table = Uint8.TWO;
if (tableId == null) {
return table;
}
- public void _addGroups(CommandInterpreter ci) {
+ @SuppressWarnings("checkstyle:MethodName")
+ public void _addGroups(final CommandInterpreter ci) {
String nref = ci.nextArgument();
if (nref == null) {
}
}
- 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) {
}
}
- private static InstanceIdentifier<Node> nodeToInstanceId(Node node) {
+ private static InstanceIdentifier<Node> 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) {
}
}
- 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<Group> path1 = InstanceIdentifier.create(Nodes.class)
modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path2, group1);
modification.commit().addCallback(new FutureCallback<CommitInfo>() {
@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<Group> path1 = InstanceIdentifier.create(Nodes.class)
.child(Node.class, testNode12.key()).augmentation(FlowCapableNode.class)
modification.delete(LogicalDatastoreType.CONFIGURATION, path2);
modification.commit().addCallback(new FutureCallback<CommitInfo>() {
@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();
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<Bucket> value1 = new ArrayList<>();
- value1.add(bucket.build());
- value.setBucket(value1);
- group.setBuckets(value.build());
- return group;
- }
-
- private static List<Action> createPopVlanAction() {
- PopVlanActionBuilder vlanAction = new PopVlanActionBuilder();
- ActionBuilder action = new ActionBuilder();
- action.setAction(new PopVlanActionCaseBuilder().setPopVlanAction(vlanAction.build()).build());
- action.withKey(new ActionKey(0));
- List<Action> actions = new ArrayList<>();
- actions.add(action.build());
- return actions;
- }
-
- private static List<Action> 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<Action> actions = new ArrayList<>();
- actions.add(action.build());
- return actions;
- }
-
- private static List<Action> createPushMplsAction() {
- PushMplsActionBuilder push = new PushMplsActionBuilder();
- push.setEthernetType(Uint16.valueOf(0x8847));
- ActionBuilder action = new ActionBuilder();
- action.setAction(new PushMplsActionCaseBuilder().setPushMplsAction(push.build()).build());
- List<Action> actions = new ArrayList<>();
- actions.add(action.build());
- return actions;
- }
-
- private static List<Action> createPopMplsAction() {
- PopMplsActionBuilder popMplsActionBuilder = new PopMplsActionBuilder();
- popMplsActionBuilder.setEthernetType(Uint16.valueOf(0XB));
- ActionBuilder action = new ActionBuilder();
- action.setAction(new PopMplsActionCaseBuilder().setPopMplsAction(popMplsActionBuilder.build()).build());
- List<Action> actions = new ArrayList<>();
- actions.add(action.build());
- return actions;
- }
-
- private static List<Action> createPopPbbAction() {
- PopPbbActionBuilder popPbbActionBuilder = new PopPbbActionBuilder();
- ActionBuilder action = new ActionBuilder();
- action.setAction(new PopPbbActionCaseBuilder().setPopPbbAction(popPbbActionBuilder.build()).build());
- List<Action> actions = new ArrayList<>();
- actions.add(action.build());
- return actions;
- }
-
- private static List<Action> createPushPbbAction() {
- PushPbbActionBuilder pbb = new PushPbbActionBuilder();
- pbb.setEthernetType(Uint16.valueOf(0x88E7));
- ActionBuilder action = new ActionBuilder();
- action.setAction(new PushPbbActionCaseBuilder().setPushPbbAction(pbb.build()).build());
- List<Action> actions = new ArrayList<>();
- actions.add(action.build());
- return actions;
- }
-
- private static List<Action> createCopyTtlInAction() {
- CopyTtlInBuilder ttlin = new CopyTtlInBuilder();
- ActionBuilder action = new ActionBuilder();
- action.setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(ttlin.build()).build());
- List<Action> actions = new ArrayList<>();
- actions.add(action.build());
- return actions;
- }
-
- private static List<Action> createCopyTtlOutAction() {
- CopyTtlOutBuilder ttlout = new CopyTtlOutBuilder();
- ActionBuilder action = new ActionBuilder();
- action.setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(ttlout.build()).build());
- List<Action> actions = new ArrayList<>();
- actions.add(action.build());
- return actions;
- }
-
- private static List<Action> createDecMplsTtlAction() {
- DecMplsTtlBuilder mpls = new DecMplsTtlBuilder();
- ActionBuilder action = new ActionBuilder();
- action.setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(mpls.build()).build());
- List<Action> actions = new ArrayList<>();
- actions.add(action.build());
- return actions;
- }
-
- private static List<Action> 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<Action> actions = new ArrayList<>();
- actions.add(action.build());
- return actions;
- }
-
- private static List<Action> 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<Action> 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<ActionKey, Action> createPopVlanAction() {
+ return BindingMap.of(new ActionBuilder()
+ .setOrder(0)
+ .setAction(new PopVlanActionCaseBuilder().setPopVlanAction(new PopVlanActionBuilder().build()).build())
+ .build());
+ }
+
+ private static Map<ActionKey, Action> 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<ActionKey, Action> createPushMplsAction() {
+ return BindingMap.of(new ActionBuilder()
+ .setOrder(0)
+ .setAction(new PushMplsActionCaseBuilder()
+ .setPushMplsAction(new PushMplsActionBuilder().setEthernetType(Uint16.valueOf(0x8847)).build())
+ .build())
+ .build());
+ }
+
+ private static Map<ActionKey, Action> createPopMplsAction() {
+ return BindingMap.of(new ActionBuilder()
+ .setOrder(0)
+ .setAction(new PopMplsActionCaseBuilder()
+ .setPopMplsAction(new PopMplsActionBuilder().setEthernetType(Uint16.valueOf(0xB)).build())
+ .build())
+ .build());
+ }
+
+ private static Map<ActionKey, Action> createPopPbbAction() {
+ return BindingMap.of(new ActionBuilder()
+ .setOrder(0)
+ .setAction(new PopPbbActionCaseBuilder().setPopPbbAction(new PopPbbActionBuilder().build()).build())
+ .build());
+ }
+
+ private static Map<ActionKey, Action> createPushPbbAction() {
+ return BindingMap.of(new ActionBuilder()
+ .setOrder(0)
+ .setAction(new PushPbbActionCaseBuilder()
+ .setPushPbbAction(new PushPbbActionBuilder().setEthernetType(Uint16.valueOf(0x88E7)).build())
+ .build())
+ .build());
+ }
+
+ private static Map<ActionKey, Action> createCopyTtlInAction() {
+ return BindingMap.of(new ActionBuilder()
+ .setOrder(0)
+ .setAction(new CopyTtlInCaseBuilder().setCopyTtlIn(new CopyTtlInBuilder().build()).build())
+ .build());
+ }
+
+ private static Map<ActionKey, Action> createCopyTtlOutAction() {
+ return BindingMap.of(new ActionBuilder()
+ .setOrder(0)
+ .setAction(new CopyTtlOutCaseBuilder().setCopyTtlOut(new CopyTtlOutBuilder().build()).build())
+ .build());
+ }
+
+ private static Map<ActionKey, Action> createDecMplsTtlAction() {
+ return BindingMap.of(new ActionBuilder()
+ .setOrder(0)
+ .setAction(new DecMplsTtlCaseBuilder().setDecMplsTtl(new DecMplsTtlBuilder().build()).build())
+ .build());
+ }
+
+ private static Map<ActionKey, Action> 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<ActionKey, Action> createNonAppyPushVlanAction() {
+ return BindingMap.of(new ActionBuilder()
+ .setOrder(0)
+ .setAction(new GroupActionCaseBuilder()
+ .setGroupAction(new GroupActionBuilder().setGroupId(Uint32.ONE).setGroup("0").build())
+ .build())
+ .build());
}
}
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;
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;
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;
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;
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;
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
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;
LOG.warn("flow type not understood: {}", flowType);
}
- if (null == flow.isBarrier()) {
+ if (null == flow.getBarrier()) {
flow.setBarrier(Boolean.FALSE);
}
// flow.setBufferId(12L);
return flow;
}
- private static Uint8 getTableId(String tableId) {
+ private static Uint8 getTableId(final String tableId) {
if (tableId != null) {
try {
return Uint8.valueOf(tableId);
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);
writeFlow(ci, tf, tf1, tf2, tf3, tn);
}
- private static InstanceIdentifier<Node> nodeBuilderToInstanceId(NodeBuilder node) {
+ private static InstanceIdentifier<Node> 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);
}
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());
modification.delete(LogicalDatastoreType.CONFIGURATION, path4);
modification.commit().addCallback(new FutureCallback<CommitInfo>() {
@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));
}
}
- 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<Flow> path1 = InstanceIdentifier.create(Nodes.class)
.child(Node.class, nodeBuilder.key()).augmentation(FlowCapableNode.class)
modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path4, flow3.build());
modification.commit().addCallback(new FutureCallback<CommitInfo>() {
@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));
}
}
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<Action> 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<Instruction> 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<Instruction> 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<Instruction> 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<Action> 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<Instruction> 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<Action> 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<Instruction> 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<Action> 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<Instruction> 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() {
}
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());
}
}
}
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));
}
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));