All callers of these method are using a primitive short, hence
change the method signature to take that and explicitly convert
it to Uint8. This fixes one deprecation warning and further eclipse
notices around boxing.
JIRA: OPNFLWPLUG-1099
Change-Id: Iaffc9984322f460129975436d88e8c048ca63fa2
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.l2.types.rev130827.EtherType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.ethernet.match.fields.EthernetTypeBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.EthernetMatchBuilder;
-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.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.layer._3.match.Ipv4MatchBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint8;
public final class BulkOMaticUtils {
public final class BulkOMaticUtils {
}
public static Match getMatch(final int sourceIp) {
}
public static Match getMatch(final int sourceIp) {
- Ipv4Match ipv4Match = new Ipv4MatchBuilder().setIpv4Source(new Ipv4Prefix(ipIntToStr(sourceIp))).build();
- MatchBuilder matchBuilder = new MatchBuilder();
- matchBuilder.setLayer3Match(ipv4Match);
- EthernetTypeBuilder ethTypeBuilder = new EthernetTypeBuilder();
- EthernetMatchBuilder ethMatchBuilder = new EthernetMatchBuilder();
- ethTypeBuilder.setType(new EtherType(2048L));
- ethMatchBuilder.setEthernetType(ethTypeBuilder.build());
- matchBuilder.setEthernetMatch(ethMatchBuilder.build());
- return matchBuilder.build();
+ return new MatchBuilder()
+ .setLayer3Match(new Ipv4MatchBuilder().setIpv4Source(new Ipv4Prefix(ipIntToStr(sourceIp))).build())
+ .setEthernetMatch(new EthernetMatchBuilder()
+ .setEthernetType(new EthernetTypeBuilder().setType(new EtherType(Uint32.valueOf(2048))).build())
+ .build())
+ .build();
- public static Flow buildFlow(Short tableId, String flowId, Match match) {
- FlowBuilder flowBuilder = new FlowBuilder();
- flowBuilder.withKey(new FlowKey(new FlowId(flowId)));
- flowBuilder.setTableId(tableId);
- flowBuilder.setMatch(match);
- return flowBuilder.build();
+ public static Flow buildFlow(short tableId, String flowId, Match match) {
+ return new FlowBuilder()
+ .withKey(new FlowKey(new FlowId(flowId)))
+ .setTableId(Uint8.valueOf(tableId))
+ .setMatch(match)
+ .build();
- public static InstanceIdentifier<Flow> getFlowInstanceIdentifier(Short tableId, String flowId, String dpId) {
- return InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(new NodeId(dpId)))
- .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tableId))
+ public static InstanceIdentifier<Flow> getFlowInstanceIdentifier(short tableId, String flowId, String dpId) {
+ return InstanceIdentifier.create(Nodes.class)
+ .child(Node.class, new NodeKey(new NodeId(dpId)))
+ .augmentation(FlowCapableNode.class)
+ .child(Table.class, new TableKey(Uint8.valueOf(tableId)))
.child(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow.class,
new FlowKey(new FlowId(flowId)));
}
.child(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow.class,
new FlowKey(new FlowId(flowId)));
}
return InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(new NodeId(dpId))).build();
}
return InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(new NodeId(dpId))).build();
}
- public static InstanceIdentifier<Table> getTableId(Short tableId, String dpId) {
+ public static InstanceIdentifier<Table> getTableId(short tableId, String dpId) {
return InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(new NodeId(dpId)))
return InstanceIdentifier.builder(Nodes.class).child(Node.class, new NodeKey(new NodeId(dpId)))
- .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tableId)).build();
+ .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(Uint8.valueOf(tableId))).build();
}
public static InstanceIdentifier<Flow> getFlowId(final InstanceIdentifier<Table> tablePath, final String flowId) {
}
public static InstanceIdentifier<Flow> getFlowId(final InstanceIdentifier<Table> tablePath, final String flowId) {
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint8;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
LOG.info("Total Flows read: {}", flowCount);
}
LOG.info("Total Flows read: {}", flowCount);
}
- private InstanceIdentifier<Flow> getFlowInstanceIdentifier(String dpId, Short tableId, String flowId) {
+ private static InstanceIdentifier<Flow> getFlowInstanceIdentifier(String dpId, short tableId, String flowId) {
return InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(new NodeId(dpId)))
return InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(new NodeId(dpId)))
- .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(tableId))
+ .augmentation(FlowCapableNode.class).child(Table.class, new TableKey(Uint8.valueOf(tableId)))
.child(Flow.class, new FlowKey(new FlowId(flowId)));
}
.child(Flow.class, new FlowKey(new FlowId(flowId)));
}
private final short endTableId;
private final short beginTableId;
private final short endTableId;
private final short beginTableId;
- DsCallBack(String dpId, Short beginTableId, Short endTableId, Integer sourceIp) {
+ DsCallBack(String dpId, short beginTableId, short endTableId, int sourceIp) {
this.dpId = dpId;
this.sourceIp = sourceIp;
this.endTableId = endTableId;
this.dpId = dpId;
this.sourceIp = sourceIp;
this.endTableId = endTableId;
private final short beginTableId;
private final TransactionChain txChain;
private final short beginTableId;
private final TransactionChain txChain;
- DsCallBack(String dpId, Short beginTableId, Short endTableId, Integer sourceIp,
+ DsCallBack(String dpId, short beginTableId, short endTableId, int sourceIp,
TransactionChain txChain) {
this.dpId = dpId;
this.sourceIp = sourceIp;
TransactionChain txChain) {
this.dpId = dpId;
this.sourceIp = sourceIp;
},MoreExecutors.directExecutor());
}
},MoreExecutors.directExecutor());
}
- private InstanceIdentifier<Flow> getFlowInstanceIdentifier(BulkFlowDsItem bulkFlow) {
+ private static InstanceIdentifier<Flow> getFlowInstanceIdentifier(BulkFlowDsItem bulkFlow) {
final NodeRef nodeRef = bulkFlow.getNode();
return ((InstanceIdentifier<Node>) nodeRef.getValue()).augmentation(FlowCapableNode.class)
.child(Table.class, new TableKey(bulkFlow.getTableId()))
final NodeRef nodeRef = bulkFlow.getNode();
return ((InstanceIdentifier<Node>) nodeRef.getValue()).augmentation(FlowCapableNode.class)
.child(Table.class, new TableKey(bulkFlow.getTableId()))
}, MoreExecutors.directExecutor());
}
}, MoreExecutors.directExecutor());
}
- private <T> ListenableFuture<RpcResult<Void>> handleResultFuture(ListenableFuture<List<T>> submitFuture) {
+ private static <T> ListenableFuture<RpcResult<Void>> handleResultFuture(ListenableFuture<List<T>> submitFuture) {
final SettableFuture<RpcResult<Void>> rpcResult = SettableFuture.create();
Futures.addCallback(submitFuture, new FutureCallback<List<T>>() {
@Override
final SettableFuture<RpcResult<Void>> rpcResult = SettableFuture.create();
Futures.addCallback(submitFuture, new FutureCallback<List<T>>() {
@Override
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint8;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
String dpId = BulkOMaticUtils.DEVICE_TYPE_PREFIX + String.valueOf(dpn);
for (short tableId = startTableId; tableId <= endTableId; tableId++) {
WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
String dpId = BulkOMaticUtils.DEVICE_TYPE_PREFIX + String.valueOf(dpn);
for (short tableId = startTableId; tableId <= endTableId; tableId++) {
WriteTransaction wtx = dataBroker.newWriteOnlyTransaction();
- Table table = new TableBuilder().withKey(new TableKey(tableId)).setId(tableId).build();
+ Table table = new TableBuilder().withKey(new TableKey(Uint8.valueOf(tableId))).build();
InstanceIdentifier<Table> tableIId = BulkOMaticUtils.getTableId(tableId, dpId);
if (isAdd) {
InstanceIdentifier<Table> tableIId = BulkOMaticUtils.getTableId(tableId, dpId);
if (isAdd) {
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint8;
/**
* Test for {@link SalBulkFlowServiceImpl}.
/**
* Test for {@link SalBulkFlowServiceImpl}.
doReturn(CommitInfo.emptyFluentFuture()).when(writeTransaction).commit();
final BulkFlowDsItemBuilder bulkFlowDsItemBuilder = new BulkFlowDsItemBuilder().setFlowId(new FlowId("1"))
doReturn(CommitInfo.emptyFluentFuture()).when(writeTransaction).commit();
final BulkFlowDsItemBuilder bulkFlowDsItemBuilder = new BulkFlowDsItemBuilder().setFlowId(new FlowId("1"))
- .setTableId((short) 2);
+ .setTableId(Uint8.TWO);
final InstanceIdentifier<Node> nodeId = BulkOMaticUtils.getFlowCapableNodeId("1");
bulkFlowDsItemBuilder.setNode(new NodeRef(nodeId));
final InstanceIdentifier<Node> nodeId = BulkOMaticUtils.getFlowCapableNodeId("1");
bulkFlowDsItemBuilder.setNode(new NodeRef(nodeId));
@Test
public void testReadFlowTest() throws Exception {
@Test
public void testReadFlowTest() throws Exception {
- final ReadFlowTestInputBuilder readFlowTestInputBuilder = new ReadFlowTestInputBuilder().setDpnCount(1L)
- .setStartTableId(1L).setEndTableId(2L).setIsConfigDs(false).setFlowsPerDpn(1L).setVerbose(true);
+ final ReadFlowTestInputBuilder readFlowTestInputBuilder = new ReadFlowTestInputBuilder().setDpnCount(Uint32.ONE)
+ .setStartTableId(Uint32.ONE).setEndTableId(Uint32.TWO).setIsConfigDs(false).setFlowsPerDpn(Uint32.ONE)
+ .setVerbose(true);
final ReadFlowTestInput readFlowTestInput = readFlowTestInputBuilder.build();
final ListenableFuture<RpcResult<ReadFlowTestOutput>> resultFuture
final ReadFlowTestInput readFlowTestInput = readFlowTestInputBuilder.build();
final ListenableFuture<RpcResult<ReadFlowTestOutput>> resultFuture
doReturn(FluentFutures.immediateFluentFuture(Optional.of(mockNodes))).when(readOnlyTransaction)
.read(any(LogicalDatastoreType.class), any());
doReturn(FluentFutures.immediateFluentFuture(Optional.of(mockNodes))).when(readOnlyTransaction)
.read(any(LogicalDatastoreType.class), any());
- final FlowRpcAddTestInputBuilder flowRpcAddTestInputBuilder = new FlowRpcAddTestInputBuilder().setFlowCount(1L)
- .setDpnId("1").setRpcBatchSize(1L);
+ final FlowRpcAddTestInputBuilder flowRpcAddTestInputBuilder = new FlowRpcAddTestInputBuilder()
+ .setFlowCount(Uint32.ONE).setDpnId("1").setRpcBatchSize(Uint32.ONE);
final FlowRpcAddTestInput flowRpcAddTestInput = flowRpcAddTestInputBuilder.build();
final ListenableFuture<RpcResult<FlowRpcAddTestOutput>> resultFuture
final FlowRpcAddTestInput flowRpcAddTestInput = flowRpcAddTestInputBuilder.build();
final ListenableFuture<RpcResult<FlowRpcAddTestOutput>> resultFuture
@Test
public void testFlowTest() throws Exception {
@Test
public void testFlowTest() throws Exception {
- final FlowTestInputBuilder flowTestInputBuilder = new FlowTestInputBuilder().setBatchSize(1L).setDpnCount(1L)
- .setEndTableId(2L).setFlowsPerDpn(1L).setIsAdd(true).setSeq(true).setSleepAfter(20L).setSleepFor(1L)
- .setStartTableId(1L).setTxChain(true).setCreateParents(true);
+ final FlowTestInputBuilder flowTestInputBuilder = new FlowTestInputBuilder()
+ .setBatchSize(Uint32.ONE).setDpnCount(Uint32.ONE).setEndTableId(Uint32.TWO).setFlowsPerDpn(Uint32.ONE)
+ .setIsAdd(true).setSeq(true).setSleepAfter(Uint32.valueOf(20)).setSleepFor(Uint32.ONE)
+ .setStartTableId(Uint32.ONE).setTxChain(true).setCreateParents(true);
FlowTestInput flowTestInput = flowTestInputBuilder.build();
FlowTestInput flowTestInput = flowTestInputBuilder.build();
.read(any(LogicalDatastoreType.class), any());
final FlowRpcAddMultipleInputBuilder flowRpcAddMultipleInputBuilder = new FlowRpcAddMultipleInputBuilder()
.read(any(LogicalDatastoreType.class), any());
final FlowRpcAddMultipleInputBuilder flowRpcAddMultipleInputBuilder = new FlowRpcAddMultipleInputBuilder()
- .setFlowCount(1L).setRpcBatchSize(1L);
+ .setFlowCount(Uint32.ONE).setRpcBatchSize(Uint32.ONE);
final FlowRpcAddMultipleInput flowRpcAddMultipleInput = flowRpcAddMultipleInputBuilder.build();
final FlowRpcAddMultipleInput flowRpcAddMultipleInput = flowRpcAddMultipleInputBuilder.build();
@Test
public void testTableTest() throws Exception {
@Test
public void testTableTest() throws Exception {
- final TableTestInputBuilder tableTestInputBuilder = new TableTestInputBuilder().setStartTableId(0L)
- .setEndTableId(99L).setDpnCount(1L).setOperation(Operation.Add);
+ final TableTestInputBuilder tableTestInputBuilder = new TableTestInputBuilder().setStartTableId(Uint32.ZERO)
+ .setEndTableId(Uint32.valueOf(99)).setDpnCount(Uint32.ONE).setOperation(Operation.Add);
TableTestInput tableTestInput = tableTestInputBuilder.build();
TableTestInput tableTestInput = tableTestInputBuilder.build();