* 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.arbitratorreconciliation.impl;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.base.Function;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import org.opendaylight.openflowplugin.applications.reconciliation.ReconciliationNotificationListener;
import org.opendaylight.serviceutils.upgrade.UpgradeState;
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.FlowBuilder;
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.groups.GroupBuilder;
private static final String SEPARATOR = ":";
private static final BundleRemoveFlowCase DELETE_ALL_FLOW = new BundleRemoveFlowCaseBuilder()
- .setRemoveFlowCaseData(
- new RemoveFlowCaseDataBuilder(new FlowBuilder().setTableId(OFConstants.OFPTT_ALL).build()).build())
+ .setRemoveFlowCaseData(new RemoveFlowCaseDataBuilder()
+ .setTableId(OFConstants.OFPTT_ALL)
+ .build())
.build();
private static final BundleRemoveGroupCase DELETE_ALL_GROUP = new BundleRemoveGroupCaseBuilder()
.setRemoveGroupCaseData(new RemoveGroupCaseDataBuilder(new GroupBuilder()
ObjectRegistration<? extends RpcService>> rpcRegistrations = new ConcurrentHashMap<>();
@Inject
- public ArbitratorReconciliationManagerImpl(
- @Reference ReconciliationManager reconciliationManager, @Reference RpcProviderService rpcProviderService,
- @Reference final RpcConsumerRegistry rpcRegistry, @Reference UpgradeState upgradeState) {
+ public ArbitratorReconciliationManagerImpl(@Reference final ReconciliationManager reconciliationManager,
+ @Reference final RpcProviderService rpcProviderService, @Reference final RpcConsumerRegistry rpcRegistry,
+ @Reference final UpgradeState upgradeState) {
Preconditions.checkArgument(rpcRegistry != null, "RpcConsumerRegistry cannot be null !");
- this.reconciliationManager = Preconditions.checkNotNull(reconciliationManager,
- "ReconciliationManager cannot be null!");
- this.salBundleService = Preconditions.checkNotNull(rpcRegistry.getRpcService(SalBundleService.class),
+ this.reconciliationManager = requireNonNull(reconciliationManager, "ReconciliationManager cannot be null!");
+ this.salBundleService = requireNonNull(rpcRegistry.getRpcService(SalBundleService.class),
"RPC SalBundleService not found.");
this.rpcProviderService = rpcProviderService;
- this.upgradeState = Preconditions.checkNotNull(upgradeState, "UpgradeState cannot be null!");
+ this.upgradeState = requireNonNull(upgradeState, "UpgradeState cannot be null!");
}
@PostConstruct
@Override
public ListenableFuture<RpcResult<CommitActiveBundleOutput>> commitActiveBundle(
- CommitActiveBundleInput input) {
+ final CommitActiveBundleInput input) {
Uint64 nodeId = input.getNodeId();
if (bundleIdMap.containsKey(nodeId)) {
BundleId bundleId = bundleIdMap.get(nodeId).getBundleId();
}
@Override
- public ListenableFuture<Boolean> startReconciliation(DeviceInfo node) {
+ public ListenableFuture<Boolean> startReconciliation(final DeviceInfo node) {
registerRpc(node);
if (upgradeState.isUpgradeInProgress()) {
LOG.trace("Starting arbitrator reconciliation for node {}", node.getDatapathId());
}
@Override
- public ListenableFuture<Boolean> endReconciliation(DeviceInfo node) {
+ public ListenableFuture<Boolean> endReconciliation(final DeviceInfo node) {
Uint64 datapathId = node.getDatapathId();
LOG.trace("Stopping arbitrator reconciliation for node {}", datapathId);
bundleIdMap.remove(datapathId);
return ResultState.DONOTHING;
}
- private ListenableFuture<Boolean> reconcileConfiguration(DeviceInfo node) {
+ private ListenableFuture<Boolean> reconcileConfiguration(final DeviceInfo node) {
LOG.info("Triggering arbitrator reconciliation for device {}", node.getDatapathId());
ArbitratorReconciliationTask upgradeReconTask = new ArbitratorReconciliationTask(node);
return executor.submit(upgradeReconTask);
}
@Override
- public void onSuccess(RpcResult<?> rpcResult) {
+ public void onSuccess(final RpcResult<?> rpcResult) {
LOG.debug("Completed arbitrator reconciliation for device:{}", nodeId);
bundleIdMap.remove(nodeId);
}
@Override
- public void onFailure(Throwable throwable) {
+ public void onFailure(final Throwable throwable) {
LOG.error("Error while performing arbitrator reconciliation for device {}", nodeId, throwable);
}
}
};
}
- private void registerRpc(DeviceInfo node) {
+ private void registerRpc(final DeviceInfo node) {
KeyedInstanceIdentifier<Node, NodeKey> path = InstanceIdentifier.create(Nodes.class)
.child(Node.class, new NodeKey(node.getNodeId()));
LOG.debug("The path is registered : {}", path);
rpcRegistrations.put(node.getNodeId().getValue(), rpcRegistration);
}
- private void deregisterRpc(DeviceInfo node) {
+ private void deregisterRpc(final DeviceInfo node) {
KeyedInstanceIdentifier<Node, NodeKey> path = InstanceIdentifier.create(Nodes.class)
.child(Node.class, new NodeKey(node.getNodeId()));
LOG.debug("The path is unregistered : {}", path);
private final BundleId bundleId;
private final ListenableFuture<RpcResult<ControlBundleOutput>> result;
- BundleDetails(BundleId bundleId, ListenableFuture<RpcResult<ControlBundleOutput>> result) {
+ BundleDetails(final BundleId bundleId, final ListenableFuture<RpcResult<ControlBundleOutput>> result) {
this.bundleId = bundleId;
this.result = result;
}
@SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
justification = "https://github.com/spotbugs/spotbugs/issues/811")
- private static Uint64 getDpnIdFromNodeName(String nodeName) {
+ private static Uint64 getDpnIdFromNodeName(final String nodeName) {
String dpnId = nodeName.substring(nodeName.lastIndexOf(SEPARATOR) + 1);
return Uint64.valueOf(dpnId);
}
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
* 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 com.google.common.base.MoreObjects;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+import static java.util.Objects.requireNonNullElse;
+
import com.google.common.util.concurrent.FluentFuture;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
private final FlowCounter flowCounterBeanImpl = new FlowCounter();
private final ExecutorService fjService = new ForkJoinPool();
- public SalBulkFlowServiceImpl(SalFlowService flowService, DataBroker dataBroker) {
- this.flowService = Preconditions.checkNotNull(flowService);
- this.dataBroker = Preconditions.checkNotNull(dataBroker);
+ public SalBulkFlowServiceImpl(final SalFlowService flowService, final DataBroker dataBroker) {
+ this.flowService = requireNonNull(flowService);
+ this.dataBroker = requireNonNull(dataBroker);
LoggingFutures.addErrorLogging(register(new RegisterInputBuilder().build()), LOG, "register");
}
@Override
- public ListenableFuture<RpcResult<AddFlowsDsOutput>> addFlowsDs(AddFlowsDsInput input) {
+ public ListenableFuture<RpcResult<AddFlowsDsOutput>> addFlowsDs(final AddFlowsDsInput input) {
WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
- boolean createParentsNextTime = MoreObjects.firstNonNull(input.isAlwaysCreateParents(), Boolean.FALSE);
+ boolean createParentsNextTime = requireNonNullElse(input.isAlwaysCreateParents(), Boolean.FALSE);
boolean createParents = true;
for (BulkFlowDsItem bulkFlow : input.getBulkFlowDsItem()) {
FlowBuilder flowBuilder = new FlowBuilder(bulkFlow);
},MoreExecutors.directExecutor());
}
- private static InstanceIdentifier<Flow> getFlowInstanceIdentifier(BulkFlowDsItem bulkFlow) {
+ private static InstanceIdentifier<Flow> getFlowInstanceIdentifier(final BulkFlowDsItem bulkFlow) {
final NodeRef nodeRef = bulkFlow.getNode();
return ((InstanceIdentifier<Node>) nodeRef.getValue()).augmentation(FlowCapableNode.class)
.child(Table.class, new TableKey(bulkFlow.getTableId()))
}
@Override
- public ListenableFuture<RpcResult<RemoveFlowsDsOutput>> removeFlowsDs(RemoveFlowsDsInput input) {
+ public ListenableFuture<RpcResult<RemoveFlowsDsOutput>> removeFlowsDs(final RemoveFlowsDsInput input) {
WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
for (BulkFlowDsItem bulkFlow : input.getBulkFlowDsItem()) {
writeTransaction.delete(LogicalDatastoreType.CONFIGURATION, getFlowInstanceIdentifier(bulkFlow));
}, MoreExecutors.directExecutor());
}
- private static <T> ListenableFuture<RpcResult<Void>> handleResultFuture(ListenableFuture<List<T>> submitFuture) {
+ private static <T> ListenableFuture<RpcResult<Void>> handleResultFuture(
+ final ListenableFuture<List<T>> submitFuture) {
final SettableFuture<RpcResult<Void>> rpcResult = SettableFuture.create();
Futures.addCallback(submitFuture, new FutureCallback<List<T>>() {
@Override
- public void onSuccess(List<T> result) {
+ public void onSuccess(final List<T> result) {
rpcResult.set(RpcResultBuilder.success((Void) null).build());
}
@Override
- public void onFailure(Throwable throwable) {
+ public void onFailure(final Throwable throwable) {
RpcResultBuilder<Void> rpcResultBld = RpcResultBuilder.<Void>failed()
.withRpcErrors(Collections.singleton(RpcResultBuilder.newError(RpcError.ErrorType.APPLICATION,
null, throwable.getMessage())));
}
@Override
- public ListenableFuture<RpcResult<AddFlowsRpcOutput>> addFlowsRpc(AddFlowsRpcInput input) {
+ public ListenableFuture<RpcResult<AddFlowsRpcOutput>> addFlowsRpc(final AddFlowsRpcInput input) {
List<ListenableFuture<RpcResult<AddFlowOutput>>> bulkResults = new ArrayList<>();
for (BulkFlowBaseContentGrouping bulkFlow : input.getBulkFlowItem()) {
}
@Override
- public ListenableFuture<RpcResult<ReadFlowTestOutput>> readFlowTest(ReadFlowTestInput input) {
+ public ListenableFuture<RpcResult<ReadFlowTestOutput>> readFlowTest(final ReadFlowTestInput input) {
FlowReader flowReader = FlowReader.getNewInstance(dataBroker, input.getDpnCount().intValue(),
input.getFlowsPerDpn().intValue(), input.isVerbose(), input.isIsConfigDs(),
input.getStartTableId().shortValue(), input.getEndTableId().shortValue());
}
@Override
- public ListenableFuture<RpcResult<FlowRpcAddTestOutput>> flowRpcAddTest(FlowRpcAddTestInput input) {
+ public ListenableFuture<RpcResult<FlowRpcAddTestOutput>> flowRpcAddTest(final FlowRpcAddTestInput input) {
FlowWriterDirectOFRpc flowAddRpcTestImpl = new FlowWriterDirectOFRpc(dataBroker, flowService, fjService);
flowAddRpcTestImpl.rpcFlowAdd(input.getDpnId(), input.getFlowCount().intValue(),
input.getRpcBatchSize().intValue());
}
@Override
- public ListenableFuture<RpcResult<RegisterOutput>> register(RegisterInput input) {
+ public ListenableFuture<RpcResult<RegisterOutput>> register(final RegisterInput input) {
RpcResultBuilder<RegisterOutput> rpcResultBuilder = RpcResultBuilder.success();
try {
MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
}
@Override
- public ListenableFuture<RpcResult<RemoveFlowsRpcOutput>> removeFlowsRpc(RemoveFlowsRpcInput input) {
+ public ListenableFuture<RpcResult<RemoveFlowsRpcOutput>> removeFlowsRpc(final RemoveFlowsRpcInput input) {
List<ListenableFuture<RpcResult<RemoveFlowOutput>>> bulkResults = new ArrayList<>();
for (BulkFlowBaseContentGrouping bulkFlow : input.getBulkFlowItem()) {
}
@Override
- public ListenableFuture<RpcResult<FlowTestOutput>> flowTest(FlowTestInput input) {
+ public ListenableFuture<RpcResult<FlowTestOutput>> flowTest(final FlowTestInput input) {
if (input.isTxChain()) {
FlowWriterTxChain flowTester = new FlowWriterTxChain(dataBroker, fjService);
flowCounterBeanImpl.setWriter(flowTester);
}
@Override
- public ListenableFuture<RpcResult<FlowRpcAddMultipleOutput>> flowRpcAddMultiple(FlowRpcAddMultipleInput input) {
+ public ListenableFuture<RpcResult<FlowRpcAddMultipleOutput>> flowRpcAddMultiple(
+ final FlowRpcAddMultipleInput input) {
FlowWriterDirectOFRpc flowTesterRPC = new FlowWriterDirectOFRpc(dataBroker, flowService, fjService);
flowTesterRPC.rpcFlowAddAll(input.getFlowCount().intValue(), input.getRpcBatchSize().intValue());
RpcResultBuilder<FlowRpcAddMultipleOutput> rpcResultBuilder = RpcResultBuilder.success();
*/
package org.opendaylight.openflowplugin.applications.frm.impl;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.MoreExecutors;
public AbstractListeningCommiter(final ForwardingRulesManager provider, final DataBroker dataBroker,
final ListenerRegistrationHelper registrationHelper) {
- this.provider = Preconditions.checkNotNull(provider, "ForwardingRulesManager can not be null!");
- this.nodeConfigurator = Preconditions.checkNotNull(provider.getNodeConfigurator(),
- "NodeConfigurator can not be null!");
- this.dataBroker = Preconditions.checkNotNull(dataBroker, "DataBroker can not be null!");
- this.registrationHelper = Preconditions.checkNotNull(registrationHelper, "registrationHelper can not be null!");
+ this.provider = requireNonNull(provider, "ForwardingRulesManager can not be null!");
+ this.nodeConfigurator = requireNonNull(provider.getNodeConfigurator(), "NodeConfigurator can not be null!");
+ this.dataBroker = requireNonNull(dataBroker, "DataBroker can not be null!");
+ this.registrationHelper = requireNonNull(registrationHelper, "registrationHelper can not be null!");
registerListener();
provider.addRecoverableListener(this);
}
@SuppressWarnings("checkstyle:IllegalCatch")
@Override
- public void onDataTreeChanged(Collection<DataTreeModification<T>> changes) {
- Preconditions.checkNotNull(changes, "Changes may not be null!");
- LOG.trace("Received data changes :{}", changes);
+ public void onDataTreeChanged(final Collection<DataTreeModification<T>> changes) {
+ LOG.trace("Received data changes :{}", requireNonNull(changes, "Changes may not be null!"));
for (DataTreeModification<T> change : changes) {
final InstanceIdentifier<T> key = change.getRootPath().getRootIdentifier();
new FutureCallback<ListenerRegistration<AbstractListeningCommiter>>() {
@Override
public void onSuccess(
- @Nullable ListenerRegistration<AbstractListeningCommiter> flowListenerRegistration) {
+ @Nullable final ListenerRegistration<AbstractListeningCommiter> flowListenerRegistration) {
LOG.info("{} registered successfully", flowListenerRegistration.getInstance());
listenerRegistration = flowListenerRegistration;
}
@Override
- public void onFailure(Throwable throwable) {
+ public void onFailure(final Throwable throwable) {
LOG.error("Registration failed ", throwable);
}
}, MoreExecutors.directExecutor());
protected abstract InstanceIdentifier<T> getWildCardPath();
private boolean preConfigurationCheck(final InstanceIdentifier<FlowCapableNode> nodeIdent) {
- Preconditions.checkNotNull(nodeIdent, "FlowCapableNode identifier can not be null!");
+ requireNonNull(nodeIdent, "FlowCapableNode identifier can not be null!");
// In single node cluster, node should be in local cache before we get any flow/group/meter
// data change event from data store. So first check should pass.
// In case of 3-node cluster, when shard leader changes, clustering will send blob of data
*/
package org.opendaylight.openflowplugin.applications.frm.impl;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import java.util.Collection;
import org.opendaylight.mdsal.binding.api.DataObjectModification;
import org.opendaylight.mdsal.binding.api.DataTreeModification;
implements FlowCapableNodeConnectorCommitter<T> {
@Override
- public void onDataTreeChanged(Collection<DataTreeModification<T>> changes) {
- Preconditions.checkNotNull(changes, "Changes may not be null!");
+ public void onDataTreeChanged(final Collection<DataTreeModification<T>> changes) {
+ requireNonNull(changes, "Changes may not be null!");
for (DataTreeModification<T> change : changes) {
final InstanceIdentifier<T> key = change.getRootPath().getRootIdentifier();
protected abstract InstanceIdentifier<T> getWildCardPath();
private static boolean preConfigurationCheck(final InstanceIdentifier<FlowCapableNodeConnector> nodeConnIdent) {
- Preconditions.checkNotNull(nodeConnIdent, "FlowCapableNodeConnector ident can not be null!");
+ requireNonNull(nodeConnIdent, "FlowCapableNodeConnector ident can not be null!");
return true;
}
}
*/
package org.opendaylight.openflowplugin.applications.frm.impl;
+import static java.util.Objects.requireNonNull;
import static org.opendaylight.openflowplugin.applications.frm.util.FrmUtil.buildGroupInstanceIdentifier;
import static org.opendaylight.openflowplugin.applications.frm.util.FrmUtil.getFlowId;
import static org.opendaylight.openflowplugin.applications.frm.util.FrmUtil.getNodeIdValueFromNodeIdentifier;
import static org.opendaylight.openflowplugin.applications.frm.util.FrmUtil.isFlowDependentOnGroup;
import static org.opendaylight.openflowplugin.applications.frm.util.FrmUtil.isGroupExistsOnDevice;
-import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import org.slf4j.LoggerFactory;
public class BundleFlowForwarder implements BundleMessagesCommiter<Flow> {
-
private static final Logger LOG = LoggerFactory.getLogger(BundleFlowForwarder.class);
private static final BundleFlags BUNDLE_FLAGS = new BundleFlags(true, true);
+
private final ForwardingRulesManager forwardingRulesManager;
private final NodeConfigurator nodeConfigurator;
- public BundleFlowForwarder(ForwardingRulesManager forwardingRulesManager) {
- this.forwardingRulesManager = Preconditions.checkNotNull(forwardingRulesManager,
- "ForwardingRulesManager can not be null!");
- this.nodeConfigurator = Preconditions.checkNotNull(forwardingRulesManager.getNodeConfigurator(),
+ public BundleFlowForwarder(final ForwardingRulesManager forwardingRulesManager) {
+ this.forwardingRulesManager = requireNonNull(forwardingRulesManager, "ForwardingRulesManager can not be null!");
+ this.nodeConfigurator = requireNonNull(forwardingRulesManager.getNodeConfigurator(),
"NodeConfigurator can not be null!");
}
private final Uint8 tableId;
private final SettableFuture<RpcResult<AddBundleMessagesOutput>> resultFuture;
- BundleFlowCallBack(InstanceIdentifier<FlowCapableNode> nodeIdent, BundleId bundleId, Message messages,
- InstanceIdentifier<Flow> identifier , SettableFuture<RpcResult<AddBundleMessagesOutput>> resultFuture) {
+ BundleFlowCallBack(final InstanceIdentifier<FlowCapableNode> nodeIdent, final BundleId bundleId,
+ final Message messages, final InstanceIdentifier<Flow> identifier,
+ final SettableFuture<RpcResult<AddBundleMessagesOutput>> resultFuture) {
this.nodeIdent = nodeIdent;
this.bundleId = bundleId;
this.messages = messages;
}
@Override
- public void onSuccess(RpcResult<AddBundleMessagesOutput> rpcResult) {
+ public void onSuccess(final RpcResult<AddBundleMessagesOutput> rpcResult) {
if (rpcResult.isSuccessful()) {
AddBundleMessagesInput addBundleMessagesInput = new AddBundleMessagesInputBuilder()
.setNode(new NodeRef(nodeIdent.firstIdentifierOf(Node.class)))
forwardingRulesManager.getSalBundleService().addBundleMessages(addBundleMessagesInput);
Futures.addCallback(addFuture, new FutureCallback<RpcResult<AddBundleMessagesOutput>>() {
@Override
- public void onSuccess(RpcResult<AddBundleMessagesOutput> result) {
+ public void onSuccess(final RpcResult<AddBundleMessagesOutput> result) {
resultFuture.set(result);
if (!result.getErrors().isEmpty()) {
LOG.error("Flow add with flowId {} and tableId {} failed for node {} with error: {}",
}
@Override
- public void onFailure(Throwable failure) {
+ public void onFailure(final Throwable failure) {
resultFuture.setException(failure);
}
}, MoreExecutors.directExecutor());
}
@Override
- public void onFailure(Throwable throwable) {
+ public void onFailure(final Throwable throwable) {
LOG.error("Error while pushing flow add bundle {} for device {}", messages, nodeId);
resultFuture.setException(throwable);
}
*/
package org.opendaylight.openflowplugin.applications.frm.impl;
+import static java.util.Objects.requireNonNull;
import static org.opendaylight.openflowplugin.applications.frm.util.FrmUtil.getNodeIdValueFromNodeIdentifier;
import static org.opendaylight.openflowplugin.applications.frm.util.FrmUtil.isGroupExistsOnDevice;
-import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
private final NodeConfigurator nodeConfigurator;
public BundleGroupForwarder(final ForwardingRulesManager forwardingRulesManager) {
- this.forwardingRulesManager = Preconditions.checkNotNull(forwardingRulesManager,
- "ForwardingRulesManager can not be null!");
- this.nodeConfigurator = Preconditions.checkNotNull(forwardingRulesManager.getNodeConfigurator(),
+ this.forwardingRulesManager = requireNonNull(forwardingRulesManager, "ForwardingRulesManager can not be null!");
+ this.nodeConfigurator = requireNonNull(forwardingRulesManager.getNodeConfigurator(),
"NodeConfigurator can not be null!");
}
}
@Override
- public void onSuccess(RpcResult<AddBundleMessagesOutput> result) {
+ public void onSuccess(final RpcResult<AddBundleMessagesOutput> result) {
if (result.isSuccessful()) {
forwardingRulesManager.getDevicesGroupRegistry().storeGroup(nodeId, groupId);
LOG.debug("Group add with id {} finished without error for node {}", groupId, nodeId);
}
@Override
- public void onFailure(Throwable throwable) {
+ public void onFailure(final Throwable throwable) {
LOG.error("Service call for adding group {} failed for node {} with error ", groupId, nodeId, throwable);
}
}
}
@Override
- public void onSuccess(RpcResult<AddBundleMessagesOutput> result) {
+ public void onSuccess(final RpcResult<AddBundleMessagesOutput> result) {
if (result.isSuccessful()) {
forwardingRulesManager.getDevicesGroupRegistry().storeGroup(nodeId, groupId);
LOG.debug("Group update with id {} finished without error for node {}", groupId, nodeId);
}
@Override
- public void onFailure(Throwable throwable) {
+ public void onFailure(final Throwable throwable) {
LOG.error("Service call for updating group {} failed for node {}", groupId, nodeId, throwable);
}
}
}
@Override
- public void onSuccess(RpcResult<AddBundleMessagesOutput> result) {
+ public void onSuccess(final RpcResult<AddBundleMessagesOutput> result) {
if (result.isSuccessful()) {
LOG.debug("Group remove with id {} finished without error for node {}", groupId, nodeId);
forwardingRulesManager.getDevicesGroupRegistry().removeGroup(nodeId, groupId);
}
@Override
- public void onFailure(Throwable throwable) {
+ public void onFailure(final Throwable throwable) {
LOG.error("Service call for removing group {} failed for node {} with error", groupId, nodeId, throwable);
}
}
package org.opendaylight.openflowplugin.applications.frm.impl;
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
import java.util.Collection;
@Override
public void onDataTreeChanged(@NonNull final Collection<DataTreeModification<FlowCapableNode>> changes) {
- Preconditions.checkNotNull(changes, "Changes may not be null!");
-
for (DataTreeModification<FlowCapableNode> change : changes) {
final InstanceIdentifier<FlowCapableNode> key = change.getRootPath().getRootIdentifier();
final DataObjectModification<FlowCapableNode> mod = change.getRootNode();
*/
package org.opendaylight.openflowplugin.applications.frm.impl;
+import static java.util.Objects.requireNonNull;
import static org.opendaylight.openflowplugin.applications.frm.util.FrmUtil.buildGroupInstanceIdentifier;
import static org.opendaylight.openflowplugin.applications.frm.util.FrmUtil.getActiveBundle;
import static org.opendaylight.openflowplugin.applications.frm.util.FrmUtil.getFlowId;
import static org.opendaylight.openflowplugin.applications.frm.util.FrmUtil.isFlowDependentOnGroup;
import static org.opendaylight.openflowplugin.applications.frm.util.FrmUtil.isGroupExistsOnDevice;
-import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.FluentFuture;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
}
@Override
- public void createStaleMarkEntity(InstanceIdentifier<Flow> identifier, Flow del,
- InstanceIdentifier<FlowCapableNode> nodeIdent) {
+ public void createStaleMarkEntity(final InstanceIdentifier<Flow> identifier, final Flow del,
+ final InstanceIdentifier<FlowCapableNode> nodeIdent) {
LOG.debug("Creating Stale-Mark entry for the switch {} for flow {} ", nodeIdent, del);
StaleFlow staleFlow = makeStaleFlow(identifier, del, nodeIdent);
persistStaleFlow(staleFlow, nodeIdent);
}
private static boolean tableIdValidationPrecondition(final TableKey tableKey, final Flow flow) {
- Preconditions.checkNotNull(tableKey, "TableKey can not be null or empty!");
- Preconditions.checkNotNull(flow, "Flow can not be null or empty!");
+ requireNonNull(tableKey, "TableKey can not be null or empty!");
+ requireNonNull(flow, "Flow can not be null or empty!");
if (!tableKey.getId().equals(flow.getTableId())) {
LOG.warn("TableID in URI tableId={} and in palyload tableId={} is not same.", flow.getTableId(),
tableKey.getId());
return true;
}
- private static StaleFlow makeStaleFlow(InstanceIdentifier<Flow> identifier, Flow del,
- InstanceIdentifier<FlowCapableNode> nodeIdent) {
+ private static StaleFlow makeStaleFlow(final InstanceIdentifier<Flow> identifier, final Flow del,
+ final InstanceIdentifier<FlowCapableNode> nodeIdent) {
StaleFlowBuilder staleFlowBuilder = new StaleFlowBuilder(del);
return staleFlowBuilder.setId(del.getId()).build();
}
- private void persistStaleFlow(StaleFlow staleFlow, InstanceIdentifier<FlowCapableNode> nodeIdent) {
+ private void persistStaleFlow(final StaleFlow staleFlow, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
writeTransaction.put(LogicalDatastoreType.CONFIGURATION, getStaleFlowInstanceIdentifier(staleFlow, nodeIdent),
staleFlow);
handleStaleFlowResultFuture(submitFuture);
}
- private static void handleStaleFlowResultFuture(FluentFuture<?> submitFuture) {
+ private static void handleStaleFlowResultFuture(final FluentFuture<?> submitFuture) {
submitFuture.addCallback(new FutureCallback<Object>() {
@Override
- public void onSuccess(Object result) {
+ public void onSuccess(final Object result) {
LOG.debug("Stale Flow creation success");
}
@Override
- public void onFailure(Throwable throwable) {
+ public void onFailure(final Throwable throwable) {
LOG.error("Stale Flow creation failed", throwable);
}
}, MoreExecutors.directExecutor());
private static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight
.flow.inventory.rev130819.tables.table.StaleFlow> getStaleFlowInstanceIdentifier(
- StaleFlow staleFlow, InstanceIdentifier<FlowCapableNode> nodeIdent) {
+ final StaleFlow staleFlow, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
return nodeIdent.child(Table.class, new TableKey(staleFlow.getTableId())).child(
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.StaleFlow.class,
new StaleFlowKey(new FlowId(staleFlow.getId())));
private final Uint32 groupId;
private final SettableFuture<RpcResult<AddFlowOutput>> resultFuture;
- private AddFlowCallBack(final AddFlowInput addFlowInput, final String nodeId, Uint32 groupId,
- SettableFuture<RpcResult<AddFlowOutput>> resultFuture) {
+ private AddFlowCallBack(final AddFlowInput addFlowInput, final String nodeId, final Uint32 groupId,
+ final SettableFuture<RpcResult<AddFlowOutput>> resultFuture) {
this.addFlowInput = addFlowInput;
this.nodeId = nodeId;
this.groupId = groupId;
}
@Override
- public void onSuccess(RpcResult<AddGroupOutput> rpcResult) {
+ public void onSuccess(final RpcResult<AddGroupOutput> rpcResult) {
if (rpcResult.isSuccessful() || rpcResult.getErrors().size() == 1
&& rpcResult.getErrors().iterator().next().getMessage().contains(GROUP_EXISTS_IN_DEVICE_ERROR)) {
provider.getDevicesGroupRegistry().storeGroup(nodeId, groupId);
Futures.addCallback(provider.getSalFlowService().addFlow(addFlowInput),
new FutureCallback<RpcResult<AddFlowOutput>>() {
@Override
- public void onSuccess(RpcResult<AddFlowOutput> result) {
+ public void onSuccess(final RpcResult<AddFlowOutput> result) {
resultFuture.set(result);
}
@Override
- public void onFailure(Throwable failure) {
+ public void onFailure(final Throwable failure) {
resultFuture.setException(failure);
}
}, MoreExecutors.directExecutor());
}
@Override
- public void onFailure(Throwable throwable) {
+ public void onFailure(final Throwable throwable) {
LOG.error("Service call for adding flow with id {} failed for node {}",
getFlowId(addFlowInput.getFlowRef()), nodeId, throwable);
resultFuture.setException(throwable);
private final SettableFuture<RpcResult<UpdateFlowOutput>> resultFuture;
private UpdateFlowCallBack(final UpdateFlowInput updateFlowInput, final String nodeId,
- SettableFuture<RpcResult<UpdateFlowOutput>> resultFuture, Uint32 groupId) {
+ final SettableFuture<RpcResult<UpdateFlowOutput>> resultFuture, final Uint32 groupId) {
this.updateFlowInput = updateFlowInput;
this.nodeId = nodeId;
this.groupId = groupId;
}
@Override
- public void onSuccess(RpcResult<AddGroupOutput> rpcResult) {
+ public void onSuccess(final RpcResult<AddGroupOutput> rpcResult) {
if (rpcResult.isSuccessful() || rpcResult.getErrors().size() == 1
&& rpcResult.getErrors().iterator().next().getMessage().contains(GROUP_EXISTS_IN_DEVICE_ERROR)) {
provider.getDevicesGroupRegistry().storeGroup(nodeId, groupId);
Futures.addCallback(provider.getSalFlowService().updateFlow(updateFlowInput),
new FutureCallback<RpcResult<UpdateFlowOutput>>() {
@Override
- public void onSuccess(RpcResult<UpdateFlowOutput> result) {
+ public void onSuccess(final RpcResult<UpdateFlowOutput> result) {
resultFuture.set(result);
}
@Override
- public void onFailure(Throwable failure) {
+ public void onFailure(final Throwable failure) {
resultFuture.setException(failure);
}
}, MoreExecutors.directExecutor());
}
@Override
- public void onFailure(Throwable throwable) {
+ public void onFailure(final Throwable throwable) {
LOG.error("Service call for updating flow with id {} failed for node {}",
getFlowId(updateFlowInput.getFlowRef()), nodeId, throwable);
resultFuture.setException(throwable);
*/
package org.opendaylight.openflowplugin.applications.frm.impl;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.collect.ArrayListMultimap;
import com.google.common.collect.Iterables;
import com.google.common.collect.Multimap;
@SuppressWarnings("IllegalCatch")
public FlowNodeConnectorInventoryTranslatorImpl(final DataBroker dataBroker) {
- Preconditions.checkNotNull(dataBroker, "DataBroker can not be null!");
+ requireNonNull(dataBroker, "DataBroker can not be null!");
final DataTreeIdentifier<FlowCapableNodeConnector> treeId =
DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL, getWildCardPath());
}
@Override
- public void remove(InstanceIdentifier<FlowCapableNodeConnector> identifier, FlowCapableNodeConnector del,
- InstanceIdentifier<FlowCapableNodeConnector> nodeConnIdent) {
+ public void remove(final InstanceIdentifier<FlowCapableNodeConnector> identifier,
+ final FlowCapableNodeConnector del, final InstanceIdentifier<FlowCapableNodeConnector> nodeConnIdent) {
if (compareInstanceIdentifierTail(identifier, II_TO_FLOW_CAPABLE_NODE_CONNECTOR)) {
LOG.debug("Node Connector removed");
String nodeConnectorIdentifier = nodeConnIdent.firstKeyOf(NodeConnector.class)
}
@Override
- public void update(InstanceIdentifier<FlowCapableNodeConnector> identifier, FlowCapableNodeConnector original,
- FlowCapableNodeConnector update, InstanceIdentifier<FlowCapableNodeConnector> nodeConnIdent) {
+ public void update(final InstanceIdentifier<FlowCapableNodeConnector> identifier,
+ final FlowCapableNodeConnector original, final FlowCapableNodeConnector update,
+ final InstanceIdentifier<FlowCapableNodeConnector> nodeConnIdent) {
if (compareInstanceIdentifierTail(identifier, II_TO_FLOW_CAPABLE_NODE_CONNECTOR)) {
LOG.debug("Node Connector updated");
// Don't need to do anything as we are not considering updates here
}
@Override
- public void add(InstanceIdentifier<FlowCapableNodeConnector> identifier, FlowCapableNodeConnector add,
- InstanceIdentifier<FlowCapableNodeConnector> nodeConnIdent) {
+ public void add(final InstanceIdentifier<FlowCapableNodeConnector> identifier, final FlowCapableNodeConnector add,
+ final InstanceIdentifier<FlowCapableNodeConnector> nodeConnIdent) {
if (compareInstanceIdentifierTail(identifier, II_TO_FLOW_CAPABLE_NODE_CONNECTOR)) {
LOG.debug("Node Connector added");
String nodeConnectorIdentifier = nodeConnIdent
}
}
- private static boolean compareInstanceIdentifierTail(InstanceIdentifier<?> identifier1,
- InstanceIdentifier<?> identifier2) {
+ private static boolean compareInstanceIdentifierTail(final InstanceIdentifier<?> identifier1,
+ final InstanceIdentifier<?> identifier2) {
return Iterables.getLast(identifier1.getPathArguments())
.equals(Iterables.getLast(identifier2.getPathArguments()));
}
@Override
- public boolean isNodeConnectorUpdated(BigInteger dpId, String portName) {
+ public boolean isNodeConnectorUpdated(final BigInteger dpId, final String portName) {
return dpnToPortMultiMap.containsEntry(dpId,portName) ;
}
- private static BigInteger getDpIdFromPortName(String portName) {
+ private static BigInteger getDpIdFromPortName(final String portName) {
String dpId = portName.substring(portName.indexOf(SEPARATOR) + 1, portName.lastIndexOf(SEPARATOR));
return new BigInteger(dpId);
}
*/
package org.opendaylight.openflowplugin.applications.frm.impl;
+import static java.util.Objects.requireNonNull;
import static org.opendaylight.openflowplugin.api.openflow.ReconciliationState.ReconciliationStatus.COMPLETED;
import static org.opendaylight.openflowplugin.api.openflow.ReconciliationState.ReconciliationStatus.FAILED;
import static org.opendaylight.openflowplugin.api.openflow.ReconciliationState.ReconciliationStatus.STARTED;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.Lists;
import com.google.common.util.concurrent.FluentFuture;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
public FlowNodeReconciliationImpl(final ForwardingRulesManager manager, final DataBroker db,
final String serviceName, final int priority, final ResultState resultState,
final FlowGroupCacheManager flowGroupCacheManager) {
- this.provider = Preconditions.checkNotNull(manager, "ForwardingRulesManager can not be null!");
- dataBroker = Preconditions.checkNotNull(db, "DataBroker can not be null!");
+ this.provider = requireNonNull(manager, "ForwardingRulesManager can not be null!");
+ dataBroker = requireNonNull(db, "DataBroker can not be null!");
this.serviceName = serviceName;
this.priority = priority;
this.resultState = resultState;
- salBundleService = Preconditions.checkNotNull(manager.getSalBundleService(),
- "salBundleService can not be null!");
+ salBundleService = requireNonNull(manager.getSalBundleService(), "salBundleService can not be null!");
reconciliationStates = flowGroupCacheManager.getReconciliationStates();
}
}
@Override
- public ListenableFuture<Boolean> reconcileConfiguration(InstanceIdentifier<FlowCapableNode> connectedNode) {
+ public ListenableFuture<Boolean> reconcileConfiguration(final InstanceIdentifier<FlowCapableNode> connectedNode) {
LOG.info("Triggering reconciliation for device {}", connectedNode.firstKeyOf(Node.class));
// Clearing the group registry cache for the connected node if exists
String nodeId = FrmUtil.getNodeIdValueFromNodeIdentifier(connectedNode);
}
@Override
- public void flowNodeDisconnected(InstanceIdentifier<FlowCapableNode> disconnectedNode) {
+ public void flowNodeDisconnected(final InstanceIdentifier<FlowCapableNode> disconnectedNode) {
String node = disconnectedNode.firstKeyOf(Node.class).getId().getValue();
BigInteger dpnId = getDpnIdFromNodeName(node);
reconciliationStates.remove(dpnId.toString());
}
@Override
- public ListenableFuture<Boolean> startReconciliation(DeviceInfo node) {
+ public ListenableFuture<Boolean> startReconciliation(final DeviceInfo node) {
InstanceIdentifier<FlowCapableNode> connectedNode = node.getNodeInstanceIdentifier()
.augmentation(FlowCapableNode.class);
// Clearing the group registry cache for the connected node if exists
}
@Override
- public ListenableFuture<Boolean> endReconciliation(DeviceInfo node) {
+ public ListenableFuture<Boolean> endReconciliation(final DeviceInfo node) {
ListenableFuture<Boolean> listenableFuture = futureMap.computeIfPresent(node, (key, future) -> future);
if (listenableFuture != null) {
listenableFuture.cancel(true);
* @param group
* The group to add.
*/
- private void addGroup(Map<Uint32, ListenableFuture<?>> map, Group group) {
+ private void addGroup(final Map<Uint32, ListenableFuture<?>> map, final Group group) {
KeyedInstanceIdentifier<Group, GroupKey> groupIdent = nodeIdentity.child(Group.class, group.key());
final Uint32 groupId = group.getGroupId().getValue();
ListenableFuture<?> future = JdkFutureAdapters
Futures.addCallback(future, new FutureCallback<Object>() {
@Override
- public void onSuccess(Object result) {
+ public void onSuccess(final Object result) {
if (LOG.isTraceEnabled()) {
LOG.trace("add-group RPC completed: node={}, id={}",
nodeIdentity.firstKeyOf(Node.class).getId().getValue(), groupId);
}
@Override
- public void onFailure(Throwable cause) {
+ public void onFailure(final Throwable cause) {
LOG.debug("add-group RPC failed: node={}, id={}",
nodeIdentity.firstKeyOf(Node.class).getId().getValue(), groupId, cause);
}
* Future associated with add-group RPC that installs the target
* group.
*/
- private void awaitGroup(String nodeId, ListenableFuture<?> future) {
+ private void awaitGroup(final String nodeId, final ListenableFuture<?> future) {
awaitGroups(nodeId, Collections.singleton(future));
}
* @param futures
* A collection of futures associated with add-group RPCs.
*/
- private void awaitGroups(String nodeId, Collection<ListenableFuture<?>> futures) {
+ private void awaitGroups(final String nodeId, final Collection<ListenableFuture<?>> futures) {
if (!futures.isEmpty()) {
long timeout = Math.min(ADD_GROUP_TIMEOUT * futures.size(), MAX_ADD_GROUP_TIMEOUT);
try {
@SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
justification = "https://github.com/spotbugs/spotbugs/issues/811")
- private static BigInteger getDpnIdFromNodeName(String nodeName) {
+ private static BigInteger getDpnIdFromNodeName(final String nodeName) {
String dpId = nodeName.substring(nodeName.lastIndexOf(SEPARATOR) + 1);
return new BigInteger(dpId);
}
private void reconciliationPreProcess(final InstanceIdentifier<FlowCapableNode> nodeIdent) {
- List<InstanceIdentifier<StaleFlow>> staleFlowsToBeBulkDeleted = Lists.newArrayList();
- List<InstanceIdentifier<StaleGroup>> staleGroupsToBeBulkDeleted = Lists.newArrayList();
- List<InstanceIdentifier<StaleMeter>> staleMetersToBeBulkDeleted = Lists.newArrayList();
+ List<InstanceIdentifier<StaleFlow>> staleFlowsToBeBulkDeleted = new ArrayList<>();
+ List<InstanceIdentifier<StaleGroup>> staleGroupsToBeBulkDeleted = new ArrayList<>();
+ List<InstanceIdentifier<StaleMeter>> staleMetersToBeBulkDeleted = new ArrayList<>();
Optional<FlowCapableNode> flowNode = Optional.empty();
deleteDSStaleMeters(staleMetersToBeBulkDeleted);
}
- private void deleteDSStaleFlows(List<InstanceIdentifier<StaleFlow>> flowsForBulkDelete) {
+ private void deleteDSStaleFlows(final List<InstanceIdentifier<StaleFlow>> flowsForBulkDelete) {
WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
for (InstanceIdentifier<StaleFlow> staleFlowIId : flowsForBulkDelete) {
handleStaleEntityDeletionResultFuture(submitFuture);
}
- private void deleteDSStaleGroups(List<InstanceIdentifier<StaleGroup>> groupsForBulkDelete) {
+ private void deleteDSStaleGroups(final List<InstanceIdentifier<StaleGroup>> groupsForBulkDelete) {
WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
for (InstanceIdentifier<StaleGroup> staleGroupIId : groupsForBulkDelete) {
handleStaleEntityDeletionResultFuture(submitFuture);
}
- private void deleteDSStaleMeters(List<InstanceIdentifier<StaleMeter>> metersForBulkDelete) {
+ private void deleteDSStaleMeters(final List<InstanceIdentifier<StaleMeter>> metersForBulkDelete) {
WriteTransaction writeTransaction = dataBroker.newWriteOnlyTransaction();
for (InstanceIdentifier<StaleMeter> staleMeterIId : metersForBulkDelete) {
private static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight
.flow.inventory.rev130819.tables.table.StaleFlow> getStaleFlowInstanceIdentifier(
- StaleFlow staleFlow, InstanceIdentifier<FlowCapableNode> nodeIdent) {
+ final StaleFlow staleFlow, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
return nodeIdent.child(Table.class, new TableKey(staleFlow.getTableId())).child(
org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.StaleFlow.class,
new StaleFlowKey(new FlowId(staleFlow.getId())));
private static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight
.group.types.rev131018.groups.StaleGroup> getStaleGroupInstanceIdentifier(
- StaleGroup staleGroup, InstanceIdentifier<FlowCapableNode> nodeIdent) {
+ final StaleGroup staleGroup, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
return nodeIdent.child(StaleGroup.class, new StaleGroupKey(new GroupId(staleGroup.getGroupId())));
}
private static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight
.flow.inventory.rev130819.meters.StaleMeter> getStaleMeterInstanceIdentifier(
- StaleMeter staleMeter, InstanceIdentifier<FlowCapableNode> nodeIdent) {
+ final StaleMeter staleMeter, final InstanceIdentifier<FlowCapableNode> nodeIdent) {
return nodeIdent.child(StaleMeter.class, new StaleMeterKey(new MeterId(staleMeter.getMeterId())));
}
return futureList;
}
- private static void handleStaleEntityDeletionResultFuture(FluentFuture<?> submitFuture) {
+ private static void handleStaleEntityDeletionResultFuture(final FluentFuture<?> submitFuture) {
submitFuture.addCallback(new FutureCallback<Object>() {
@Override
- public void onSuccess(Object result) {
+ public void onSuccess(final Object result) {
LOG.debug("Stale entity removal success");
}
@Override
- public void onFailure(Throwable throwable) {
+ public void onFailure(final Throwable throwable) {
LOG.debug("Stale entity removal failed", throwable);
}
}, MoreExecutors.directExecutor());
*/
package org.opendaylight.openflowplugin.applications.frm.impl;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.ListenableFuture;
reconciliationRetryCount = config.getReconciliationRetryCount().toJava();
isBundleBasedReconciliationEnabled = config.isBundleBasedReconciliationEnabled();
this.configurationServiceRegistration = configurationService.registerListener(this);
- this.registrationHelper = Preconditions.checkNotNull(registrationHelper, "RegistrationHelper cannot be null");
- this.dataService = Preconditions.checkNotNull(dataBroker, "DataBroker can not be null!");
- this.clusterSingletonServiceProvider = Preconditions.checkNotNull(clusterSingletonService,
+ this.registrationHelper = requireNonNull(registrationHelper, "RegistrationHelper cannot be null");
+ this.dataService = requireNonNull(dataBroker, "DataBroker can not be null!");
+ this.clusterSingletonServiceProvider = requireNonNull(clusterSingletonService,
"ClusterSingletonService provider can not be null");
this.reconciliationManager = reconciliationManager;
this.rpcProviderService = rpcProviderService;
Preconditions.checkArgument(rpcRegistry != null, "RpcProviderRegistry can not be null !");
- this.salFlowService = Preconditions.checkNotNull(rpcRegistry.getRpcService(SalFlowService.class),
+ this.salFlowService = requireNonNull(rpcRegistry.getRpcService(SalFlowService.class),
"RPC SalFlowService not found.");
- this.salGroupService = Preconditions.checkNotNull(rpcRegistry.getRpcService(SalGroupService.class),
+ this.salGroupService = requireNonNull(rpcRegistry.getRpcService(SalGroupService.class),
"RPC SalGroupService not found.");
- this.salMeterService = Preconditions.checkNotNull(rpcRegistry.getRpcService(SalMeterService.class),
+ this.salMeterService = requireNonNull(rpcRegistry.getRpcService(SalMeterService.class),
"RPC SalMeterService not found.");
- this.salTableService = Preconditions.checkNotNull(rpcRegistry.getRpcService(SalTableService.class),
+ this.salTableService = requireNonNull(rpcRegistry.getRpcService(SalTableService.class),
"RPC SalTableService not found.");
- this.salBundleService = Preconditions.checkNotNull(rpcRegistry.getRpcService(SalBundleService.class),
+ this.salBundleService = requireNonNull(rpcRegistry.getRpcService(SalBundleService.class),
"RPC SalBundlService not found.");
- this.openflowServiceRecoveryHandler = Preconditions.checkNotNull(openflowServiceRecoveryHandler,
+ this.openflowServiceRecoveryHandler = requireNonNull(openflowServiceRecoveryHandler,
"Openflow service recovery handler cannot be null");
- this.serviceRecoveryRegistry = Preconditions.checkNotNull(serviceRecoveryRegistry,
+ this.serviceRecoveryRegistry = requireNonNull(serviceRecoveryRegistry,
"Service recovery registry cannot be null");
- this.arbitratorReconciliationManager = Preconditions
- .checkNotNull(rpcRegistry.getRpcService(ArbitratorReconcileService.class),
+ this.arbitratorReconciliationManager =
+ requireNonNull(rpcRegistry.getRpcService(ArbitratorReconcileService.class),
"ArbitratorReconciliationManager can not be null!");
}
*/
package org.opendaylight.openflowplugin.applications.frsync.impl;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
public ForwardingRulesSyncProvider(final DataBroker dataBroker,
final RpcConsumerRegistry rpcRegistry,
final ClusterSingletonServiceProvider clusterSingletonService) {
- Preconditions.checkNotNull(rpcRegistry, "RpcConsumerRegistry can not be null!");
- this.dataService = Preconditions.checkNotNull(dataBroker, "DataBroker can not be null!");
- this.clusterSingletonService = Preconditions.checkNotNull(clusterSingletonService,
+ requireNonNull(rpcRegistry, "RpcConsumerRegistry can not be null!");
+ this.dataService = requireNonNull(dataBroker, "DataBroker can not be null!");
+ this.clusterSingletonService = requireNonNull(clusterSingletonService,
"ClusterSingletonServiceProvider can not be null!");
- this.salTableService = Preconditions.checkNotNull(rpcRegistry.getRpcService(SalTableService.class),
+ this.salTableService = requireNonNull(rpcRegistry.getRpcService(SalTableService.class),
"RPC SalTableService not found.");
- this.flatBatchService = Preconditions.checkNotNull(rpcRegistry.getRpcService(SalFlatBatchService.class),
+ this.flatBatchService = requireNonNull(rpcRegistry.getRpcService(SalFlatBatchService.class),
"RPC SalFlatBatchService not found.");
nodeConfigDataTreePath = DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION,
*/
package org.opendaylight.openflowplugin.applications.frsync.impl;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
private final SyncPlanPushStrategy syncPlanPushStrategy;
public SyncReactorImpl(final SyncPlanPushStrategy syncPlanPushStrategy) {
- this.syncPlanPushStrategy = Preconditions.checkNotNull(syncPlanPushStrategy, "execution strategy is mandatory");
+ this.syncPlanPushStrategy = requireNonNull(syncPlanPushStrategy, "execution strategy is mandatory");
}
@Override
package org.opendaylight.openflowplugin.applications.frsync.impl.strategy;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.openflowplugin.applications.frsync.ForwardingRulesCommitter;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
}
private static boolean tableIdValidationPrecondition(final TableKey tableKey, final Flow flow) {
- Preconditions.checkNotNull(tableKey, "TableKey can not be null or empty!");
- Preconditions.checkNotNull(flow, "Flow can not be null or empty!");
+ requireNonNull(tableKey, "TableKey can not be null or empty!");
+ requireNonNull(flow, "Flow can not be null or empty!");
if (!tableKey.getId().equals(flow.getTableId())) {
LOG.warn("TableID in URI tableId={} and in payload tableId={} is not same.",
flow.getTableId(), tableKey.getId());
* 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.util;
-import com.google.common.base.MoreObjects;
+import static java.util.Objects.requireNonNullElse;
+
import com.google.common.collect.ImmutableList;
import com.google.common.util.concurrent.FutureCallback;
import java.util.Collection;
if (result.isSuccessful()) {
LOG.debug("{} finished successfully: {}", prefix, nodeId.getValue());
} else {
- final Collection<RpcError> errors = MoreObjects.firstNonNull(result.getErrors(),
- ImmutableList.of());
+ final Collection<RpcError> errors = requireNonNullElse(result.getErrors(), ImmutableList.of());
LOG.debug("{} failed: {} -> {}", prefix, nodeId.getValue(), errors);
}
} else {
*/
package org.opendaylight.openflowplugin.applications.frsync.util;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.cache.CacheBuilder;
import com.google.common.cache.CacheLoader;
import com.google.common.cache.LoadingCache;
@Override
public Semaphore summonGuardAndAcquire(@NonNull final K key) {
- final Semaphore guard = Preconditions.checkNotNull(summonGuard(key), "Guard not available for " + key);
+ final Semaphore guard = requireNonNull(summonGuard(key), "Guard not available for " + key);
try {
guard.acquire();
} catch (InterruptedException e) {
*/
package org.opendaylight.openflowplugin.applications.frsync.impl;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Uri;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.GroupActionCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.instruction.instruction.ApplyActionsCaseBuilder;
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.list.InstructionBuilder;
+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.group.Buckets;
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.groups.Group;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.band.type.band.type.DropBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.MeterBandHeadersBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.meter.band.headers.MeterBandHeaderBuilder;
+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.Uint8;
public static Group createGroupWithAction(final Uint32 groupIdValue) {
final Buckets buckets = new BucketsBuilder()
- .setBucket(Collections.singletonList(new BucketBuilder()
- .setAction(Collections.singletonList(new ActionBuilder()
+ .setBucket(BindingMap.of(new BucketBuilder()
+ .setBucketId(new BucketId(Uint32.ZERO))
+ .setAction(BindingMap.of(new ActionBuilder()
+ .setOrder(0)
.setAction(new OutputActionCaseBuilder()
.setOutputAction(new OutputActionBuilder()
.setOutputNodeConnector(new Uri("ut-port-1"))
.setTableId(Uint8.valueOf(42))
.setMatch(new MatchBuilder().build())
.setInstructions(new InstructionsBuilder()
- .setInstruction(Collections.singletonList(new InstructionBuilder()
+ .setInstruction(BindingMap.of(new InstructionBuilder()
+ .setOrder(0)
.setInstruction(new ApplyActionsCaseBuilder()
.setApplyActions(new ApplyActionsBuilder()
- .setAction(Collections.singletonList(new ActionBuilder()
+ .setAction(BindingMap.of(new ActionBuilder()
+ .setOrder(0)
.setAction(new OutputActionCaseBuilder()
.setOutputAction(new OutputActionBuilder()
.setOutputNodeConnector(new Uri("ut-port-1"))
return new MeterBuilder()
.setMeterId(new MeterId(meterIdValue))
.setMeterBandHeaders(new MeterBandHeadersBuilder()
- .setMeterBandHeader(Collections.singletonList(new MeterBandHeaderBuilder()
+ .setMeterBandHeader(BindingMap.of(new MeterBandHeaderBuilder()
.setBandId(new BandId(Uint32.valueOf(42)))
.setBandType(new DropBuilder()
.setDropRate(Uint32.valueOf(43))
}
public static Group createGroupWithPreconditions(final long groupIdValue, final long... requiredId) {
- final List<Action> actionBag = new ArrayList<>();
+ final BindingMap.Builder<ActionKey, Action> actionBag = BindingMap.orderedBuilder(requiredId.length);
int key = 0;
for (long groupIdPrecondition : requiredId) {
final GroupAction groupAction = new GroupActionBuilder()
actionBag.add(action);
}
- final Bucket bucket = new BucketBuilder()
- .setAction(actionBag)
- .build();
- final Buckets buckets = new BucketsBuilder()
- .setBucket(Collections.singletonList(bucket))
- .build();
-
return new GroupBuilder()
.setGroupId(new GroupId(Uint32.valueOf(groupIdValue)))
- .setBuckets(buckets)
+ .setBuckets(new BucketsBuilder()
+ .setBucket(BindingMap.of(new BucketBuilder()
+ .setBucketId(new BucketId(Uint32.ZERO))
+ .setAction(actionBag.build())
+ .build()))
+ .build())
.build();
}
}
package org.opendaylight.openflowplugin.applications.frsync.impl;
import com.google.common.util.concurrent.ListenableFuture;
-import java.util.Collections;
import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.junit.Before;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
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.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
+import org.opendaylight.yangtools.yang.common.Uint8;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@Test
public void testSyncup() throws Exception {
final FlowCapableNode configFcn = new FlowCapableNodeBuilder()
- .setGroup(Collections.singletonList(DSInputFactory.createGroup(Uint32.ONE)))
- .setTable(Collections.singletonList(new TableBuilder()
- .setFlow(Collections.singletonList(DSInputFactory.createFlow("f1", 1)))
+ .setGroup(BindingMap.of(DSInputFactory.createGroup(Uint32.ONE)))
+ .setTable(BindingMap.of(new TableBuilder()
+ .setId(Uint8.valueOf(42))
+ .setFlow(BindingMap.of(DSInputFactory.createFlow("f1", 1)))
.build()))
- .setMeter(Collections.singletonList(DSInputFactory.createMeter(Uint32.ONE)))
+ .setMeter(BindingMap.of(DSInputFactory.createMeter(Uint32.ONE)))
.build();
final FlowCapableNode operationalFcn = new FlowCapableNodeBuilder()
- .setGroup(Collections.singletonList(DSInputFactory.createGroup(Uint32.TWO)))
- .setTable(Collections.singletonList(new TableBuilder()
- .setFlow(Collections.singletonList(DSInputFactory.createFlow("f2", 2)))
+ .setGroup(BindingMap.of(DSInputFactory.createGroup(Uint32.TWO)))
+ .setTable(BindingMap.of(new TableBuilder()
+ .setId(Uint8.valueOf(42))
+ .setFlow(BindingMap.of(DSInputFactory.createFlow("f2", 2)))
.build()))
- .setMeter(Collections.singletonList(DSInputFactory.createMeter(Uint32.TWO)))
+ .setMeter(BindingMap.of(DSInputFactory.createMeter(Uint32.TWO)))
.build();
final SyncupEntry syncupEntry = new SyncupEntry(configFcn, LogicalDatastoreType.CONFIGURATION,
*/
package org.opendaylight.openflowplugin.applications.frsync.impl.strategy;
-import java.util.Collections;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import org.junit.Assert;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.NodeKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
+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.Uint64;
.build()).buildFuture());
final Instructions originalInstructions = new InstructionsBuilder()
- .setInstruction(Collections.singletonList(new InstructionBuilder()
+ .setInstruction(BindingMap.of(new InstructionBuilder()
.setInstruction(new ApplyActionsCaseBuilder()
.setApplyActions(new ApplyActionsBuilder()
- .setAction(Collections.singletonList(new ActionBuilder()
+ .setAction(BindingMap.of(new ActionBuilder()
.setAction(new DropActionCaseBuilder()
.build())
- .build())
- ).build()
- ).build())
- .build())
- ).build();
+ .setOrder(0)
+ .build()))
+ .build())
+ .build())
+ .setOrder(0)
+ .build()))
+ .build();
final Flow flowUpdated = new FlowBuilder(flow)
.setInstructions(originalInstructions)
import com.google.common.util.concurrent.SettableFuture;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.FlowCapableTransactionService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierInput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.transaction.rev150304.SendBarrierOutput;
+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.group.Buckets;
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.groups.Group;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder;
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.binding.util.BindingMap;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
}
private static Group createGroupWithPreconditions(final long groupIdValue, final long... requiredId) {
- final List<Action> actionBag = new ArrayList<>();
+ final BindingMap.Builder<ActionKey, Action> actionBag = BindingMap.builder(requiredId.length);
int key = 0;
for (long groupIdPrecondition : requiredId) {
actionBag.add(new ActionBuilder()
+ .setOrder(key)
.setAction(new GroupActionCaseBuilder()
.setGroupAction(new GroupActionBuilder()
.setGroupId(Uint32.valueOf(groupIdPrecondition))
.build());
}
- final Bucket bucket = new BucketBuilder().setAction(actionBag).build();
- final Buckets buckets = new BucketsBuilder()
- .setBucket(Collections.singletonMap(bucket.key(), bucket))
- .build();
-
return new GroupBuilder()
.setGroupId(new GroupId(Uint32.valueOf(groupIdValue)))
- .setBuckets(buckets)
+ .setBuckets(new BucketsBuilder()
+ .setBucket(BindingMap.of(new BucketBuilder()
+ .setBucketId(new BucketId(Uint32.ZERO))
+ .setAction(actionBag.build())
+ .build()))
+ .build())
.build();
}
- private static Map<Uint32, Group> createGroups(long... groupIds) {
+ private static Map<Uint32, Group> createGroups(final long... groupIds) {
final Map<Uint32, Group> ret = Maps.newHashMapWithExpectedSize(groupIds.length);
for (long groupId : groupIds) {
ret.put(Uint32.valueOf(groupId), createGroup(groupId));
package org.opendaylight.openflowplugin.applications.lldpspeaker;
+import static java.util.Objects.requireNonNull;
import static org.opendaylight.infrautils.utils.concurrent.LoggingFutures.addErrorLogging;
-import com.google.common.base.Preconditions;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
return operationalStatus;
}
- public void setLldpFloodInterval(long time) {
+ public void setLldpFloodInterval(final long time) {
this.currentFloodPeriod = time;
scheduledSpeakerTask.cancel(false);
scheduledSpeakerTask = this.scheduledExecutorService
@Override
public void nodeConnectorRemoved(final InstanceIdentifier<NodeConnector> nodeConnectorInstanceId) {
- Preconditions.checkNotNull(nodeConnectorInstanceId);
-
- nodeConnectorMap.remove(nodeConnectorInstanceId);
+ nodeConnectorMap.remove(requireNonNull(nodeConnectorInstanceId));
NodeConnectorId nodeConnectorId = InstanceIdentifier.keyOf(nodeConnectorInstanceId).getId();
LOG.trace("Port removed from node-connector map : {}", nodeConnectorId.getValue());
}
*/
package org.opendaylight.openflowplugin.applications.notification.supplier;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.annotations.VisibleForTesting;
-import com.google.common.base.Preconditions;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
* @param groupStatSupp - Group Stat Support Flag
* @param queueStatSupp - Queue Stat Support Flag
*/
- public NotificationProvider(final NotificationPublishService nps, final DataBroker db, boolean flowSupp,
- boolean meterSupp, boolean groupSupp, boolean connectorStatSupp, boolean flowStatSupp,
- boolean flowTableStatSupp, boolean meterStatSupp, boolean groupStatSupp,
- boolean queueStatSupp) {
- this.nps = Preconditions.checkNotNull(nps);
- this.db = Preconditions.checkNotNull(db);
+ public NotificationProvider(final NotificationPublishService nps, final DataBroker db, final boolean flowSupp,
+ final boolean meterSupp, final boolean groupSupp, final boolean connectorStatSupp,
+ final boolean flowStatSupp, final boolean flowTableStatSupp,
+ final boolean meterStatSupp, final boolean groupStatSupp, final boolean queueStatSupp) {
+ this.nps = requireNonNull(nps);
+ this.db = requireNonNull(db);
this.config = initializeNotificationProviderConfig(flowSupp, meterSupp, groupSupp, connectorStatSupp,
flowStatSupp, flowTableStatSupp, meterStatSupp,
groupStatSupp, queueStatSupp);
/**
* Method to initialize NotificationProviderConfig.
*/
- private NotificationProviderConfig initializeNotificationProviderConfig(boolean hasFlowSupp,
- boolean hasMeterSupp,
- boolean hasGroupSupp,
- boolean hasConnectorStatSupp,
- boolean hasFlowStatSupp,
- boolean hasFlowTableStatSupp,
- boolean hasMeterStatSupp,
- boolean hasGroupStatSupp,
- boolean hasQueueStatSupp) {
+ private NotificationProviderConfig initializeNotificationProviderConfig(final boolean hasFlowSupp,
+ final boolean hasMeterSupp,
+ final boolean hasGroupSupp,
+ final boolean hasConnectorStatSupp,
+ final boolean hasFlowStatSupp,
+ final boolean hasFlowTableStatSupp,
+ final boolean hasMeterStatSupp,
+ final boolean hasGroupStatSupp,
+ final boolean hasQueueStatSupp) {
NotificationProviderConfig.NotificationProviderConfigBuilder notif
= new NotificationProviderConfig.NotificationProviderConfigBuilder();
notif.setFlowSupport(hasFlowSupp);
*/
package org.opendaylight.openflowplugin.applications.notification.supplier.impl;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.base.Preconditions;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
* @param path pointer to element
* @return extracted {@link NodeKey} and wrapped in {@link NodeRef}
*/
- public static NodeRef createNodeRef(InstanceIdentifier<?> path) {
- final InstanceIdentifier<Node> nodePath = Preconditions.checkNotNull(path.firstIdentifierOf(Node.class));
+ public static NodeRef createNodeRef(final InstanceIdentifier<?> path) {
+ final InstanceIdentifier<Node> nodePath = requireNonNull(path.firstIdentifierOf(Node.class));
return new NodeRef(nodePath);
}
* @param path pointer to element
* @return extracted {@link NodeId}
*/
- public static NodeId getNodeId(InstanceIdentifier<?> path) {
- final NodeKey nodeKey = Preconditions.checkNotNull(path.firstKeyOf(Node.class));
+ public static NodeId getNodeId(final InstanceIdentifier<?> path) {
+ final NodeKey nodeKey = requireNonNull(path.firstKeyOf(Node.class));
return nodeKey.getId();
}
}
*/
package org.opendaylight.openflowplugin.applications.notification.supplier.impl;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import java.util.Collection;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.DataObjectModification;
public AbstractNotificationSupplierForItemRoot(final NotificationPublishService notificationProviderService,
final DataBroker db, final Class<O> clazz) {
super(db, clazz);
- this.notificationProviderService = Preconditions.checkNotNull(notificationProviderService);
+ this.notificationProviderService = requireNonNull(notificationProviderService);
}
@Override
- public void onDataTreeChanged(Collection<DataTreeModification<O>> changes) {
-
- Preconditions.checkNotNull(changes, "Changes may not be null!");
-
+ public void onDataTreeChanged(final Collection<DataTreeModification<O>> changes) {
for (DataTreeModification<O> change : changes) {
final InstanceIdentifier<O> key = change.getRootPath().getRootIdentifier();
final DataObjectModification<O> mod = change.getRootNode();
}
- public void add(InstanceIdentifier<O> identifier, O add) {
+ public void add(final InstanceIdentifier<O> identifier, final O add) {
putNotification(createNotification(add, identifier));
}
- public void remove(InstanceIdentifier<O> identifier, O del) {
+ public void remove(final InstanceIdentifier<O> identifier, final O del) {
putNotification(deleteNotification(identifier.firstIdentifierOf(clazz)));
}
- public void update(InstanceIdentifier<O> identifier, O before, O after) {
+ public void update(final InstanceIdentifier<O> identifier, final O before, final O after) {
//EMPTY NO-OP
}
- private void putNotification(Notification notif) {
+ private void putNotification(final Notification notif) {
if (notif != null) {
try {
notificationProviderService.putNotification(notif);
*/
package org.opendaylight.openflowplugin.applications.notification.supplier.impl.item;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import java.util.Collection;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.DataObjectModification;
public AbstractNotificationSupplierForItem(final NotificationPublishService notifProviderService,
final DataBroker db, final Class<O> clazz) {
super(db, clazz);
- this.notificationProviderService = Preconditions.checkNotNull(notifProviderService);
+ this.notificationProviderService = requireNonNull(notifProviderService);
}
@Override
- public void onDataTreeChanged(Collection<DataTreeModification<O>> changes) {
-
- Preconditions.checkNotNull(changes, "Changes may not be null!");
-
+ public void onDataTreeChanged(final Collection<DataTreeModification<O>> changes) {
for (DataTreeModification<O> change : changes) {
final InstanceIdentifier<O> key = change.getRootPath().getRootIdentifier();
final DataObjectModification<O> mod = change.getRootNode();
}
}
- public void add(InstanceIdentifier<O> identifier, O add) {
+ public void add(final InstanceIdentifier<O> identifier, final O add) {
putNotification(createNotification(add, identifier));
}
- public void remove(InstanceIdentifier<O> identifier, O del) {
+ public void remove(final InstanceIdentifier<O> identifier, final O del) {
putNotification(deleteNotification(identifier.firstIdentifierOf(clazz)));
}
- public void update(InstanceIdentifier<O> identifier, O before, O after) {
+ public void update(final InstanceIdentifier<O> identifier, final O before, final O after) {
putNotification(updateNotification(after, identifier));
}
- private void putNotification(Notification notif) {
+ private void putNotification(final Notification notif) {
if (notif != null) {
try {
notificationProviderService.putNotification(notif);
*/
package org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.stat;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import java.util.Collection;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.DataObjectModification;
public AbstractNotificationSupplierForItemStat(final NotificationPublishService notifProviderService,
final DataBroker db, final Class<O> clazz) {
super(db, clazz);
- this.notifProviderService = Preconditions.checkNotNull(notifProviderService);
+ this.notifProviderService = requireNonNull(notifProviderService);
}
@Override
- public void onDataTreeChanged(Collection<DataTreeModification<O>> changes) {
-
- Preconditions.checkNotNull(changes, "Changes may not be null!");
-
+ public void onDataTreeChanged(final Collection<DataTreeModification<O>> changes) {
for (DataTreeModification<O> change : changes) {
final InstanceIdentifier<O> key = change.getRootPath().getRootIdentifier();
final DataObjectModification<O> mod = change.getRootNode();
}
- public void add(InstanceIdentifier<O> identifier, O add) {
+ public void add(final InstanceIdentifier<O> identifier, final O add) {
final N notif = createNotification(add, identifier);
if (notif != null) {
try {
}
}
- public void remove(InstanceIdentifier<O> identifier, O del) {
+ public void remove(final InstanceIdentifier<O> identifier, final O del) {
//EMPTY NO-OP
}
- public void update(InstanceIdentifier<O> identifier, O before, O after) {
+ public void update(final InstanceIdentifier<O> identifier, final O before, final O after) {
//EMPTY NO-OP
}
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.group.statistics.reply.GroupStatsBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.util.BindingMap;
/**
* Implementation define a contract between {@link GroupStatistics} data object
builder.setId(getNodeId(path));
builder.setMoreReplies(Boolean.FALSE);
// TODO : fix if it needs, but we have to ask DataStore for the NodeConnector list
- builder.setNodeConnector(Collections.emptyList());
- builder.setGroupStats(Collections.singletonList(new GroupStatsBuilder(groupStatistics).build()));
+ builder.setNodeConnector(Collections.emptyMap());
+ builder.setGroupStats(BindingMap.of(new GroupStatsBuilder(groupStatistics)
+ .setGroupId(path.firstKeyOf(Group.class).getGroupId())
+ .build()));
return builder.build();
}
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.nodes.node.meter.MeterStatistics;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.meter.statistics.reply.MeterStatsBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.util.BindingMap;
/**
* Implementation define a contract between {@link MeterStatistics} data object
builder.setId(getNodeId(path));
builder.setMoreReplies(Boolean.FALSE);
// TODO : fix if it needs, but we have to ask DataStore for the NodeConnector list
- builder.setNodeConnector(Collections.emptyList());
- builder.setMeterStats(Collections.singletonList(new MeterStatsBuilder(meterStatistics).build()));
+ builder.setNodeConnector(Collections.emptyMap());
+ builder.setMeterStats(BindingMap.of(new MeterStatsBuilder(meterStatistics)
+ .setMeterId(path.firstKeyOf(Meter.class).getMeterId())
+ .build()));
return builder.build();
}
}
package org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.stat;
import com.google.common.base.Preconditions;
-import java.util.Collections;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnector;
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.flow.capable.node.connector.statistics.FlowCapableNodeConnectorStatistics;
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.statistics.rev131214.node.connector.statistics.and.port.number.map.NodeConnectorStatisticsAndPortNumberMapBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.util.BindingMap;
/**
* Implementation define a contract between {@link FlowCapableNodeConnectorStatistics} data object
ncBuilder.setId(ncKey.getId());
ncBuilder.withKey(ncKey);
- final NodeConnectorStatisticsUpdateBuilder builder = new NodeConnectorStatisticsUpdateBuilder();
- builder.setId(getNodeId(path));
- builder.setMoreReplies(Boolean.FALSE);
- builder.setNodeConnector(Collections.singletonList(ncBuilder.build()));
- builder.setNodeConnectorStatisticsAndPortNumberMap(Collections.singletonList(
- new NodeConnectorStatisticsAndPortNumberMapBuilder(flowCapableNodeConnectorStatistics).build()));
- return builder.build();
+ return new NodeConnectorStatisticsUpdateBuilder()
+ .setId(getNodeId(path))
+ .setMoreReplies(Boolean.FALSE)
+ .setNodeConnector(BindingMap.of(ncBuilder.build()))
+ .setNodeConnectorStatisticsAndPortNumberMap(BindingMap.of(
+ new NodeConnectorStatisticsAndPortNumberMapBuilder(flowCapableNodeConnectorStatistics)
+ .setNodeConnectorId(ncKey.getId()).build()))
+ .build();
}
}
package org.opendaylight.openflowplugin.applications.notification.supplier.impl.item.stat;
import com.google.common.base.Preconditions;
-import java.util.Collections;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.QueueStatisticsUpdateBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.queue.id.and.statistics.map.QueueIdAndStatisticsMapBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.util.BindingMap;
/**
* Implementation define a contract between {@link FlowCapableNodeConnectorQueueStatisticsData} data object
connBuilder.setId(key.getId());
connBuilder.withKey(key);
- final QueueIdAndStatisticsMapBuilder queueStatMapBuilder = new QueueIdAndStatisticsMapBuilder(
- statisticsDataTreeItem.getFlowCapableNodeConnectorQueueStatistics());
+ final QueueIdAndStatisticsMapBuilder queueStatMapBuilder =
+ new QueueIdAndStatisticsMapBuilder(statisticsDataTreeItem.getFlowCapableNodeConnectorQueueStatistics())
+ .setNodeConnectorId(key.getId()).setQueueId(path.firstKeyOf(Queue.class).getQueueId());
- final QueueStatisticsUpdateBuilder builder = new QueueStatisticsUpdateBuilder();
- builder.setId(getNodeId(path));
- builder.setMoreReplies(Boolean.FALSE);
- builder.setQueueIdAndStatisticsMap(Collections.singletonList(queueStatMapBuilder.build()));
- builder.setNodeConnector(Collections.singletonList(connBuilder.build()));
- return builder.build();
+ return new QueueStatisticsUpdateBuilder()
+ .setId(getNodeId(path))
+ .setMoreReplies(Boolean.FALSE)
+ .setQueueIdAndStatisticsMap(BindingMap.of(queueStatMapBuilder.build()))
+ .setNodeConnector(BindingMap.of(connBuilder.build()))
+ .build();
}
}
* 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.notification.supplier.impl.helper;
import java.util.Collection;
}
public static Collection createEmptyTestDataTreeEvent() {
- return Collections.EMPTY_LIST;
+ return Collections.emptyList();
}
public static Collection createNullTestDataTreeEvent() {
* 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.notification.supplier.impl.item.stat;
import static org.junit.Assert.assertEquals;
import org.opendaylight.openflowplugin.applications.notification.supplier.impl.helper.TestSupplierVerifyHelper;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeConnector;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.Queue;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.queues.QueueKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.queue.rev130925.QueueId;
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.queue.statistics.rev131216.QueueStatisticsUpdate;
import org.opendaylight.yang.gen.v1.urn.opendaylight.queue.statistics.rev131216.flow.capable.node.connector.queue.statistics.FlowCapableNodeConnectorQueueStatisticsBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class QueueStatNotificationSupplierImplTest {
private static InstanceIdentifier<FlowCapableNodeConnectorQueueStatisticsData> createTestQueueStatPath() {
return InstanceIdentifier.create(Nodes.class).child(Node.class, new NodeKey(new NodeId(FLOW_NODE_ID)))
.child(NodeConnector.class, new NodeConnectorKey(new NodeConnectorId(FLOW_CODE_CONNECTOR_ID)))
- .augmentation(FlowCapableNodeConnector.class).child(Queue.class)
+ .augmentation(FlowCapableNodeConnector.class).child(Queue.class, new QueueKey(new QueueId(Uint32.ZERO)))
.augmentation(FlowCapableNodeConnectorQueueStatisticsData.class);
}
private static FlowCapableNodeConnectorQueueStatisticsData createTestQueueStat() {
- final FlowCapableNodeConnectorQueueStatisticsDataBuilder builder
- = new FlowCapableNodeConnectorQueueStatisticsDataBuilder();
- final FlowCapableNodeConnectorQueueStatisticsBuilder value
- = new FlowCapableNodeConnectorQueueStatisticsBuilder();
- builder.setFlowCapableNodeConnectorQueueStatistics(value.build());
- return builder.build();
+ return new FlowCapableNodeConnectorQueueStatisticsDataBuilder()
+ .setFlowCapableNodeConnectorQueueStatistics(new FlowCapableNodeConnectorQueueStatisticsBuilder().build())
+ .build();
}
}
\ No newline at end of file
*/
package org.opendaylight.openflowplugin.openflow.ofswitch.config;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import java.util.Collection;
import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
private ListenerRegistration<?> listenerRegistration;
@Inject
- public DefaultConfigPusher(NodeConfigService nodeConfigService, @Reference DataBroker dataBroker,
- @Reference DeviceOwnershipService deviceOwnershipService) {
+ public DefaultConfigPusher(final NodeConfigService nodeConfigService, @Reference final DataBroker dataBroker,
+ @Reference final DeviceOwnershipService deviceOwnershipService) {
this.nodeConfigService = nodeConfigService;
this.dataBroker = dataBroker;
- this.deviceOwnershipService = Preconditions.checkNotNull(deviceOwnershipService,
- "DeviceOwnershipService can not be null");
+ this.deviceOwnershipService = requireNonNull(deviceOwnershipService, "DeviceOwnershipService can not be null");
}
@SuppressWarnings("checkstyle:IllegalCatch")
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
* 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.reconciliation.cli;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import java.util.List;
import org.apache.karaf.shell.commands.Command;
import org.apache.karaf.shell.console.OsgiCommandSupport;
private ReconciliationManager reconciliationManager;
- public void setReconciliationManager(ReconciliationManager reconciliationManager) {
- this.reconciliationManager = Preconditions.checkNotNull(reconciliationManager,
- "ReconciliationManager can not be null!");
+ public void setReconciliationManager(final ReconciliationManager reconciliationManager) {
+ this.reconciliationManager = requireNonNull(reconciliationManager, "ReconciliationManager can not be null!");
}
@Override
package org.opendaylight.openflowplugin.applications.reconciliation.impl;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.collect.ImmutableMap;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
private final AtomicReference<ResultState> decidedResultState = new AtomicReference<>(ResultState.DONOTHING);
@Inject
- public ReconciliationManagerImpl(@Reference MastershipChangeServiceManager mastershipChangeServiceManager) {
- this.mastershipChangeServiceManager = Preconditions
- .checkNotNull(mastershipChangeServiceManager, "MastershipChangeServiceManager can not be null!");
+ public ReconciliationManagerImpl(@Reference final MastershipChangeServiceManager mastershipChangeServiceManager) {
+ this.mastershipChangeServiceManager = requireNonNull(mastershipChangeServiceManager,
+ "MastershipChangeServiceManager can not be null!");
}
@PostConstruct
}
@Override
- public NotificationRegistration registerService(ReconciliationNotificationListener reconciliationTask) {
+ public NotificationRegistration registerService(final ReconciliationNotificationListener reconciliationTask) {
LOG.debug("Registered service {} with priority {} and intent {}", reconciliationTask.getName(),
reconciliationTask.getPriority(), reconciliationTask.getResultState());
registeredServices.computeIfAbsent(reconciliationTask.getPriority(), services -> new ArrayList<>())
return registration;
}
- private void decideResultState(ResultState resultState) {
+ private void decideResultState(final ResultState resultState) {
Integer count = resultStateMap.get(resultState);
- resultStateMap.put(resultState, count = (count == null ? 1 : count + 1));
+ resultStateMap.put(resultState, count = count == null ? 1 : count + 1);
Map.Entry<ResultState, Integer> maxEntry = null;
for (Map.Entry<ResultState, Integer> entry : resultStateMap.entrySet()) {
if (maxEntry == null || entry.getValue() > maxEntry.getValue()) {
}
@Override
- public ListenableFuture<ResultState> onDevicePrepared(@NonNull DeviceInfo node) {
+ public ListenableFuture<ResultState> onDevicePrepared(@NonNull final DeviceInfo node) {
LOG.debug("Triggering reconciliation for node : {}", node.getNodeId());
return futureMap.computeIfAbsent(node, value -> reconcileNode(node));
}
@Override
- public ListenableFuture<Void> onDeviceDisconnected(@NonNull DeviceInfo node) {
+ public ListenableFuture<Void> onDeviceDisconnected(@NonNull final DeviceInfo node) {
LOG.info("Stopping reconciliation for node {}", node.getNodeId());
if (futureMap.containsKey(node)) {
return cancelNodeReconciliation(node);
return Futures.immediateFuture(null);
}
- private ListenableFuture<ResultState> reconcileNode(DeviceInfo node) {
+ private ListenableFuture<ResultState> reconcileNode(final DeviceInfo node) {
ListenableFuture<ResultState> lastFuture = Futures.immediateFuture(null);
for (List<ReconciliationNotificationListener> services : registeredServices.values()) {
lastFuture = reconcileServices(lastFuture, services, node);
return lastFuture;
}
- private ListenableFuture<ResultState> reconcileServices(ListenableFuture<ResultState> prevFuture,
- List<ReconciliationNotificationListener>
+ private ListenableFuture<ResultState> reconcileServices(final ListenableFuture<ResultState> prevFuture,
+ final List<ReconciliationNotificationListener>
servicesForPriority,
- DeviceInfo node) {
+ final DeviceInfo node) {
return Futures.transformAsync(prevFuture, prevResult -> Futures.transform(Futures.allAsList(
servicesForPriority.stream().map(service -> service.startReconciliation(node))
.collect(Collectors.toList())), results -> decidedResultState.get(),
MoreExecutors.directExecutor());
}
- private ListenableFuture<Void> cancelNodeReconciliation(DeviceInfo node) {
+ private ListenableFuture<Void> cancelNodeReconciliation(final DeviceInfo node) {
ListenableFuture<Void> lastFuture = Futures.immediateFuture(null);
futureMap.get(node).cancel(true);
futureMap.remove(node);
return lastFuture;
}
- private ListenableFuture<Void> cancelServiceReconciliation(ListenableFuture<Void> prevFuture,
- List<ReconciliationNotificationListener>
+ private ListenableFuture<Void> cancelServiceReconciliation(final ListenableFuture<Void> prevFuture,
+ final List<ReconciliationNotificationListener>
servicesForPriority,
- DeviceInfo node) {
+ final DeviceInfo node) {
return Futures.transformAsync(prevFuture, prevResult -> Futures.transform(Futures.allAsList(
servicesForPriority.stream().map(service -> service.endReconciliation(node))
.collect(Collectors.toList())), results -> null, MoreExecutors.directExecutor()),
*/
package org.opendaylight.openflowplugin.applications.tablemissenforcer;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
private final DeviceOwnershipService deviceOwnershipService;
private ListenerRegistration<?> listenerRegistration;
- public LLDPPacketPuntEnforcer(SalFlowService flowService, DataBroker dataBroker,
- DeviceOwnershipService deviceOwnershipService) {
+ public LLDPPacketPuntEnforcer(final SalFlowService flowService, final DataBroker dataBroker,
+ final DeviceOwnershipService deviceOwnershipService) {
this.flowService = flowService;
this.dataBroker = dataBroker;
- this.deviceOwnershipService = Preconditions.checkNotNull(deviceOwnershipService,
- "DeviceOwnershipService can not be null");
+ this.deviceOwnershipService = requireNonNull(deviceOwnershipService, "DeviceOwnershipService can not be null");
}
@SuppressWarnings("IllegalCatch")
*/
package org.opendaylight.openflowplugin.applications.topology.lldp.utils;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.hash.HashCode;
import com.google.common.hash.HashFunction;
import com.google.common.hash.Hasher;
* @return nodeConnectorId - encoded in custom TLV of given lldp
* @see LLDPDiscoveryUtils#lldpToNodeConnectorRef(byte[], boolean)
*/
- public static NodeConnectorRef lldpToNodeConnectorRef(byte[] payload) {
+ public static NodeConnectorRef lldpToNodeConnectorRef(final byte[] payload) {
return lldpToNodeConnectorRef(payload, false);
}
* @return nodeConnectorId - encoded in custom TLV of given lldp
*/
@SuppressWarnings("checkstyle:IllegalCatch")
- public static NodeConnectorRef lldpToNodeConnectorRef(byte[] payload, boolean useExtraAuthenticatorCheck) {
+ public static NodeConnectorRef lldpToNodeConnectorRef(final byte[] payload,
+ final boolean useExtraAuthenticatorCheck) {
NodeConnectorRef nodeConnectorRef = null;
if (isLLDP(payload)) {
}
public static boolean isEntityOwned(final EntityOwnershipService eos, final String nodeId) {
- Preconditions.checkNotNull(eos, "Entity ownership service must not be null");
+ requireNonNull(eos, "Entity ownership service must not be null");
EntityOwnershipState state = null;
Optional<EntityOwnershipState> status = getCurrentOwnershipStatus(eos, nodeId);
}
public static org.opendaylight.yang.gen.v1.urn.opendaylight.flow.topology.discovery.rev130819
- .LinkDiscovered toLLDPLinkDiscovered(Link link) {
+ .LinkDiscovered toLLDPLinkDiscovered(final Link link) {
return new LinkDiscoveredBuilder()
.setSource(getNodeConnectorRefFromLink(link.getSource().getSourceTp(),
link.getSource().getSourceNode()))
return ethernetType == ETHERNET_TYPE_LLDP;
}
- private static boolean checkExtraAuthenticator(LLDP lldp, NodeConnectorId srcNodeConnectorId) {
+ private static boolean checkExtraAuthenticator(final LLDP lldp, final NodeConnectorId srcNodeConnectorId) {
final LLDPTLV hashLldptlv = lldp.getCustomTLV(LLDPTLV.createSecSubTypeCustomTLVKey());
boolean secAuthenticatorOk = false;
if (hashLldptlv != null) {
*/
package org.opendaylight.openflowplugin.applications.topology.manager;
+import static java.util.Objects.requireNonNull;
import static org.opendaylight.openflowplugin.applications.topology.manager.FlowCapableNodeMapping.toTopologyLink;
-import com.google.common.base.Preconditions;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
private final InstanceIdentifier<Topology> iiToTopology;
private final OperationProcessor processor;
- FlowCapableTopologyExporter(final OperationProcessor processor,
- final InstanceIdentifier<Topology> topology) {
- this.processor = Preconditions.checkNotNull(processor);
- this.iiToTopology = Preconditions.checkNotNull(topology);
+ FlowCapableTopologyExporter(final OperationProcessor processor, final InstanceIdentifier<Topology> topology) {
+ this.processor = requireNonNull(processor);
+ this.iiToTopology = requireNonNull(topology);
}
@Override
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
public abstract class DataTreeChangeListenerBase {
private OperationProcessor processor;
- protected InstanceIdentifier<Topology> topologyIID;
+ protected KeyedInstanceIdentifier<Topology, TopologyKey> topologyIID;
protected TerminationPointChangeListenerImpl terminationPointListener;
protected NodeChangeListenerImpl nodeChangeListener;
private final ExecutorService executor = Executors.newFixedThreadPool(1);
newLink("link1", newSourceNode("node1"), newDestNode("dest")),
newLink("link2", newSourceNode("source"), newDestNode("node1")),
newLink("link3", newSourceNode("source2"), newDestNode("dest2")));
- final Topology topology = new TopologyBuilder().setLink(linkList).build();
+ final Topology topology = new TopologyBuilder().withKey(topologyIID.getKey()).setLink(linkList).build();
final InstanceIdentifier[] expDeletedIIDs = {
topologyIID.child(Link.class, linkList.get(0).key()),
newLink("link1", newSourceTp("tp1"), newDestTp("dest")),
newLink("link2", newSourceTp("source"), newDestTp("tp1")),
newLink("link3", newSourceTp("source2"), newDestTp("dest2")));
- final Topology topology = new TopologyBuilder().setLink(linkList).build();
+ final Topology topology = new TopologyBuilder().withKey(topologyIID.getKey()).setLink(linkList).build();
final InstanceIdentifier[] expDeletedIIDs = {
topologyIID.child(Link.class, linkList.get(0).key()),
final InstanceIdentifier<?> invNodeConnID = newNodeConnID(nodeKey, ncKey);
List<Link> linkList = Arrays.asList(newLink("link1", newSourceTp("tp1"), newDestTp("dest")));
- Topology topology = new TopologyBuilder().setLink(linkList).build();
+ Topology topology = new TopologyBuilder().withKey(topologyIID.getKey()).setLink(linkList).build();
ReadWriteTransaction mockTx = mock(ReadWriteTransaction.class);
doReturn(FluentFutures.immediateFluentFuture(Optional.of(topology))).when(mockTx)
final InstanceIdentifier<?> invNodeConnID = newNodeConnID(nodeKey, ncKey);
List<Link> linkList = Arrays.asList(newLink("link1", newSourceTp("tp1"), newDestTp("dest")));
- Topology topology = new TopologyBuilder().setLink(linkList).build();
+ Topology topology = new TopologyBuilder().withKey(topologyIID.getKey()).setLink(linkList).build();
ReadWriteTransaction mockTx = mock(ReadWriteTransaction.class);
doReturn(FluentFutures.immediateFluentFuture(Optional.of(topology))).when(mockTx)
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>karaf4-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
</parent>
<groupId>org.opendaylight.openflowplugin</groupId>
<artifactId>openflowplugin-karaf</artifactId>
* 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.droptestkaraf;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.NotificationService;
import org.opendaylight.openflowplugin.testcommon.DropTestDsProvider;
public DropTestProviderImpl(final DataBroker dataBroker,
final NotificationService notificationService,
final SalFlowService salFlowService) {
- Preconditions.checkNotNull(dataBroker, "Data broker can't be empty");
- Preconditions.checkNotNull(notificationService, "NotificationProviderService can't be empty");
- Preconditions.checkNotNull(salFlowService, "SalFlowService can't be empty");
+ requireNonNull(dataBroker, "Data broker can't be empty");
+ requireNonNull(notificationService, "NotificationProviderService can't be empty");
+ requireNonNull(salFlowService, "SalFlowService can't be empty");
LOG.debug("Activator DropAllPack INIT");
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>feature-repo-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>openflowjava-extension-eric</artifactId>
<packaging>bundle</packaging>
+ <properties>
+ <!-- FIXME: Remove this -->
+ <odlparent.modernizer.enforce>false</odlparent.modernizer.enforce>
+ </properties>
+
<dependencies>
<dependency>
<groupId>${project.groupId}.openflowjava</groupId>
<artifactId>openflowjava-extension-nicira</artifactId>
<packaging>bundle</packaging>
+ <properties>
+ <!-- FIXME: Remove this -->
+ <odlparent.modernizer.enforce>false</odlparent.modernizer.enforce>
+ </properties>
+
<dependencies>
<dependency>
<groupId>${project.groupId}.openflowjava</groupId>
package org.opendaylight.openflowplugin.extension.vendor.eric;
-import com.google.common.base.Preconditions;
-import java.util.HashSet;
-import java.util.Set;
+import static java.util.Objects.requireNonNull;
+
+import java.util.List;
import org.opendaylight.openflowjava.eric.codec.match.Icmpv6NDOptionsTypeCodec;
import org.opendaylight.openflowjava.eric.codec.match.Icmpv6NDReservedCodec;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
= new Icmpv6NDOptionsTypeConvertor();
private final ExtensionConverterRegistrator extensionConverterRegistrator;
- private final Set<ObjectRegistration<?>> registrations;
+ private final List<ObjectRegistration<?>> registrations;
/**
* Register appropriate converters.
*/
public EricExtensionProvider(final OpenFlowPluginExtensionRegistratorProvider provider) {
- this.extensionConverterRegistrator = Preconditions.checkNotNull(provider.getExtensionConverterRegistrator());
- registrations = new HashSet<>();
-
- registrations.add(extensionConverterRegistrator.registerMatchConvertor(
- new ConverterExtensionKey<>(Icmpv6NdReservedKey.class, EncodeConstants.OF13_VERSION_ID),
- ICMPV6_ND_RESERVED_CONVERTOR));
- registrations.add(extensionConverterRegistrator.registerMatchConvertor(Icmpv6NDReservedCodec.SERIALIZER_KEY,
- ICMPV6_ND_RESERVED_CONVERTOR));
-
- registrations.add(extensionConverterRegistrator.registerMatchConvertor(
- new ConverterExtensionKey<>(Icmpv6NdOptionsTypeKey.class, EncodeConstants.OF13_VERSION_ID),
- ICMPV6_ND_OPTIONS_TYPE_CONVERTOR));
- registrations.add(extensionConverterRegistrator.registerMatchConvertor(Icmpv6NDOptionsTypeCodec.SERIALIZER_KEY,
- ICMPV6_ND_OPTIONS_TYPE_CONVERTOR));
+ this.extensionConverterRegistrator = requireNonNull(provider.getExtensionConverterRegistrator());
+ registrations = List.of(
+ extensionConverterRegistrator.registerMatchConvertor(new ConverterExtensionKey<>(
+ Icmpv6NdReservedKey.class, EncodeConstants.OF13_VERSION_ID), ICMPV6_ND_RESERVED_CONVERTOR),
+ extensionConverterRegistrator.registerMatchConvertor(
+ Icmpv6NDReservedCodec.SERIALIZER_KEY, ICMPV6_ND_RESERVED_CONVERTOR),
+ extensionConverterRegistrator.registerMatchConvertor(new ConverterExtensionKey<>(
+ Icmpv6NdOptionsTypeKey.class, EncodeConstants.OF13_VERSION_ID), ICMPV6_ND_OPTIONS_TYPE_CONVERTOR),
+ extensionConverterRegistrator.registerMatchConvertor(
+ Icmpv6NDOptionsTypeCodec.SERIALIZER_KEY, ICMPV6_ND_OPTIONS_TYPE_CONVERTOR));
}
@Override
*/
package org.opendaylight.openflowplugin.extension.vendor.nicira;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import java.util.HashSet;
import java.util.Set;
import org.opendaylight.openflowjava.nx.api.NiciraUtil;
* Register appropriate converters.
*/
public NiciraExtensionProvider(final OpenFlowPluginExtensionRegistratorProvider provider) {
- this.extensionConverterRegistrator = Preconditions.checkNotNull(provider.getExtensionConverterRegistrator());
+ this.extensionConverterRegistrator = requireNonNull(provider.getExtensionConverterRegistrator());
registrations = new HashSet<>();
// src=dataStore/config
registerAction13(NxActionRegLoadNodesNodeTableFlowApplyActionsCase.class, REG_LOAD_CONVERTOR_PROXY);
registrations.add(extensionConverterRegistrator.registerActionConvertor(key, actionConvertor));
}
- private void registerAction13(Class<? extends ActionChoice> actionCaseType,
- ConvertorActionFromOFJava<
+ private void registerAction13(final Class<? extends ActionChoice> actionCaseType,
+ final ConvertorActionFromOFJava<
org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.action.rev150203.actions.grouping.Action,
ActionPath> actionConvertor) {
ActionSerializerKey<?> key = new ActionSerializerKey<>(EncodeConstants.OF13_VERSION_ID, actionCaseType,
<artifactId>openflowplugin-extension-onf</artifactId>
<packaging>bundle</packaging>
+ <properties>
+ <!-- FIXME: Remove this -->
+ <odlparent.modernizer.enforce>false</odlparent.modernizer.enforce>
+ </properties>
+
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>feature-repo-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.4.0" name="odl-openflowplugin-libraries">
<feature name="odl-openflowplugin-libraries">
- <feature version="[7,8)">odl-guava</feature>
+ <feature version="[8,9)">odl-guava</feature>
</feature>
</features>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-artifacts</artifactId>
- <version>6.0.5</version>
+ <version>7.0.0</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>controller-artifacts</artifactId>
- <version>2.0.4</version>
+ <version>3.0.0</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<?xml version="1.0" encoding="UTF-8"?>
<features name="odl-openflowplugin-nsf-model-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0">
<feature name="odl-openflowplugin-nsf-model" version="${project.version}">
- <feature version="[6,7)">odl-mdsal-model-odl-l2-types</feature>
- <feature version="[2,3)">odl-mdsal-model-inventory</feature>
- <feature version="[2,3)">odl-controller-model-topology</feature>
+ <feature version="[7,8)">odl-mdsal-model-odl-l2-types</feature>
+ <feature version="[3,4)">odl-mdsal-model-inventory</feature>
+ <feature version="[3,4)">odl-controller-model-topology</feature>
</feature>
</features>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>controller-artifacts</artifactId>
- <version>2.0.4</version>
+ <version>3.0.0</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.opendaylight.infrautils</groupId>
<artifactId>infrautils-artifacts</artifactId>
- <version>1.8.1</version>
+ <version>1.9.0</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<features name="openflowplugin-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.2.0">
<feature name="odl-openflowplugin-southbound" version="${project.version}">
<configfile finalname="etc/org.opendaylight.openflowplugin.cfg">mvn:org.opendaylight.openflowplugin/openflowplugin-blueprint-config/${project.version}/cfg/config</configfile>
- <feature version="[2,3)">odl-mdsal-broker</feature>
+ <feature version="[3,4)">odl-mdsal-broker</feature>
</feature>
</features>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>feature-repo-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<dependency>
<groupId>org.opendaylight.infrautils</groupId>
<artifactId>infrautils-artifacts</artifactId>
- <version>1.8.1</version>
+ <version>1.9.0</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-artifacts</artifactId>
- <version>6.0.5</version>
+ <version>7.0.0</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<feature name='odl-openflowjava-protocol' version='${project.version}'>
<configfile finalname="etc/opendaylight/datastore/initial/config/default-openflow-connection-config.xml">mvn:org.opendaylight.openflowplugin.openflowjava/openflowjava-blueprint-config/${project.version}/xml/config</configfile>
<configfile finalname="etc/opendaylight/datastore/initial/config/legacy-openflow-connection-config.xml">mvn:org.opendaylight.openflowplugin.openflowjava/openflowjava-blueprint-config/${project.version}/xml/legacyConfig</configfile>
- <feature version="[7,8)">odl-netty-4</feature>
- <feature version="[6,7)">odl-mdsal-model-rfc6991</feature>
+ <feature version="[8,9)">odl-netty-4</feature>
+ <feature version="[7,8)">odl-mdsal-model-rfc6991</feature>
</feature>
</features>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
<tag>HEAD</tag>
</scm>
+ <properties>
+ <!-- FIXME: Remove this -->
+ <odlparent.modernizer.enforce>false</odlparent.modernizer.enforce>
+ </properties>
+
<build>
<plugins>
<plugin>
<artifactId>openflowplugin-impl</artifactId>
<packaging>bundle</packaging>
+ <properties>
+ <!-- FIXME: Remove this -->
+ <odlparent.modernizer.enforce>false</odlparent.modernizer.enforce>
+ </properties>
+
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint16Type;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.NonZeroUint32Type;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflow.provider.config.rev160510.OpenflowProviderConfig;
-import org.opendaylight.yangtools.yang.binding.Augmentation;
+import org.opendaylight.yangtools.yang.binding.AbstractAugmentable;
import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint32;
-public class OpenFlowProviderConfigImpl implements OpenflowProviderConfig {
+// FIXME: Rename this to "ConfigurationOpenflowProviderConfig" or some such. OpenFlowProviderConfigImpl is taken as
+// Builder-based (guaranteed to work).
+public class OpenFlowProviderConfigImpl extends AbstractAugmentable<OpenflowProviderConfig>
+ implements OpenflowProviderConfig {
private final ConfigurationService service;
public OpenFlowProviderConfigImpl(final ConfigurationService service) {
@Override
public NonZeroUint16Type getRpcRequestsQuota() {
- final Integer property = service.getProperty(
- ConfigurationProperty.RPC_REQUESTS_QUOTA.toString(),
- Integer::valueOf);
-
- return new NonZeroUint16Type(property);
+ return new NonZeroUint16Type(service.<Uint16>getProperty(
+ ConfigurationProperty.RPC_REQUESTS_QUOTA.toString(), Uint16::valueOf));
}
@Override
@Override
public NonZeroUint32Type getBarrierIntervalTimeoutLimit() {
- final Long property = service.getProperty(
- ConfigurationProperty.BARRIER_INTERVAL_TIMEOUT_LIMIT.toString(),
- Long::valueOf);
-
- return new NonZeroUint32Type(property);
+ return new NonZeroUint32Type(service.<Uint32>getProperty(
+ ConfigurationProperty.BARRIER_INTERVAL_TIMEOUT_LIMIT.toString(), Uint32::valueOf));
}
@Override
public NonZeroUint16Type getBarrierCountLimit() {
- final Integer property = service.getProperty(
- ConfigurationProperty.BARRIER_COUNT_LIMIT.toString(),
- Integer::valueOf);
-
- return new NonZeroUint16Type(property);
+ return new NonZeroUint16Type(service.<Uint16>getProperty(
+ ConfigurationProperty.BARRIER_COUNT_LIMIT.toString(), Uint16::valueOf));
}
@Override
public NonZeroUint32Type getEchoReplyTimeout() {
- final Long property = service.getProperty(
- ConfigurationProperty.ECHO_REPLY_TIMEOUT.toString(),
- Long::valueOf);
-
- return new NonZeroUint32Type(property);
+ return new NonZeroUint32Type(service.<Uint32>getProperty(
+ ConfigurationProperty.ECHO_REPLY_TIMEOUT.toString(), Uint32::valueOf));
}
@Override
public Uint16 getThreadPoolMinThreads() {
- return service.getProperty(ConfigurationProperty.THREAD_POOL_MIN_THREADS.toString(), Uint16::valueOf);
+ return service.<Uint16>getProperty(ConfigurationProperty.THREAD_POOL_MIN_THREADS.toString(), Uint16::valueOf);
}
@Override
public NonZeroUint16Type getThreadPoolMaxThreads() {
- final Integer property = service.getProperty(
- ConfigurationProperty.THREAD_POOL_MAX_THREADS.toString(),
- Integer::valueOf);
-
- return new NonZeroUint16Type(property);
+ return new NonZeroUint16Type(service.<Uint16>getProperty(
+ ConfigurationProperty.THREAD_POOL_MAX_THREADS.toString(), Uint16::valueOf));
}
@Override
@Override
public NonZeroUint32Type getBasicTimerDelay() {
- final Long property = service.getProperty(
- ConfigurationProperty.BASIC_TIMER_DELAY.toString(),
- Long::valueOf);
-
- return new NonZeroUint32Type(property);
+ return new NonZeroUint32Type(service.<Uint32>getProperty(
+ ConfigurationProperty.BASIC_TIMER_DELAY.toString(), Uint32::valueOf));
}
@Override
public NonZeroUint32Type getMaximumTimerDelay() {
- final Long property = service.getProperty(
- ConfigurationProperty.MAXIMUM_TIMER_DELAY.toString(),
- Long::valueOf);
-
- return new NonZeroUint32Type(property);
+ return new NonZeroUint32Type(service.<Uint32>getProperty(
+ ConfigurationProperty.MAXIMUM_TIMER_DELAY.toString(), Uint32::valueOf));
}
@Override
return service.getProperty(ConfigurationProperty.USE_SINGLE_LAYER_SERIALIZATION.toString(), Boolean::valueOf);
}
- @Override
- public <E extends Augmentation<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .openflow.provider.config.rev160510.OpenflowProviderConfig>> E augmentation(
- final java.lang.Class<E> augmentationType) {
- return null;
- }
-
@Override
public Uint16 getDeviceConnectionRateLimitPerMin() {
- return service.getProperty(ConfigurationProperty.DEVICE_CONNECTION_RATE_LIMIT_PER_MIN.toString(),
- Uint16::valueOf);
+ return service.getProperty(
+ ConfigurationProperty.DEVICE_CONNECTION_RATE_LIMIT_PER_MIN.toString(), Uint16::valueOf);
}
@Override
public Uint16 getDeviceConnectionHoldTimeInSeconds() {
- return service.getProperty(ConfigurationProperty.DEVICE_CONNECTION_HOLD_TIME_IN_SECONDS.toString(),
- Uint16::valueOf);
+ return service.getProperty(
+ ConfigurationProperty.DEVICE_CONNECTION_HOLD_TIME_IN_SECONDS.toString(), Uint16::valueOf);
}
@Override
public NonZeroUint32Type getDeviceDatastoreRemovalDelay() {
- final Long property = service.getProperty(
- ConfigurationProperty.DEVICE_DATASTORE_REMOVAL_DELAY.toString(),
- Long::valueOf);
-
- return new NonZeroUint32Type(property);
+ return new NonZeroUint32Type(service.<Uint32>getProperty(
+ ConfigurationProperty.DEVICE_DATASTORE_REMOVAL_DELAY.toString(), Uint32::valueOf));
}
@Override
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
public class FlowStatsMultipartWriter extends AbstractMultipartWriter<FlowAndStatisticsMapList> {
-
private final DeviceRegistry registry;
private final short version;
statistics.nonnullFlowAndStatisticsMapList()
.forEach(stat -> {
final FlowBuilder flow = new FlowBuilder(stat)
+ .withKey(FlowRegistryKeyFactory.DUMMY_FLOW_KEY)
.addAugmentation(new FlowStatisticsDataBuilder()
.setFlowStatistics(new FlowStatisticsBuilder(stat).build())
.build());
.getNodeInstanceIdentifier(),
new NodeBuilder()
.setId(deviceContext.getDeviceInfo().getNodeId())
- .setNodeConnector(Collections.emptyList())
+ .setNodeConnector(Collections.emptyMap())
.build());
} catch (final Exception e) {
LOG.warn("Failed to write node {} to DS ", deviceContext.getDeviceInfo().getNodeId(), e);
}
@Override
- public void onNotAbleToStartMastership(@NonNull final DeviceInfo deviceInfo, @NonNull final String reason,
- final boolean mandatory) {
+ public void onNotAbleToStartMastership(final DeviceInfo deviceInfo, final String reason, final boolean mandatory) {
LOG.error("Not able to set MASTER role on device {}, reason: {}", deviceInfo, reason);
if (!mandatory) {
package org.opendaylight.openflowplugin.impl.protocol.deserialization.match;
import io.netty.buffer.ByteBuf;
-import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.deserialization.match.OxmDeserializerHelper;
import org.opendaylight.openflowjava.util.ByteBufUtils;
public class Ipv4DestinationEntryDeserializer extends AbstractMatchEntryDeserializer {
@Override
- public void deserializeEntry(ByteBuf message, MatchBuilder builder) {
+ public void deserializeEntry(final ByteBuf message, final MatchBuilder builder) {
final boolean hasMask = processHeader(message);
final Ipv4Address address = ByteBufUtils.readIetfIpv4Address(message);
}
}
- private static void setPrefixMatch(final MatchBuilder builder, final Ipv4Address address, @Nullable final byte[]
- mask) {
+ private static void setPrefixMatch(final MatchBuilder builder, final Ipv4Address address, final byte[] mask) {
if (builder.getLayer3Match() == null) {
builder.setLayer3Match(new Ipv4MatchBuilder()
.setIpv4Destination(IpConversionUtil.createPrefix(address, mask))
import org.opendaylight.openflowplugin.impl.protocol.deserialization.util.ActionUtil;
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.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.GroupMessage;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.GroupMessageBuilder;
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.openflow.common.types.rev130731.GroupModCommand;
+import org.opendaylight.yangtools.yang.common.Uint32;
public class GroupMessageDeserializer implements OFDeserializer<GroupMessage>, DeserializerRegistryInjector {
private DeserializerRegistry registry;
@Override
- public GroupMessage deserialize(ByteBuf message) {
+ public GroupMessage deserialize(final ByteBuf message) {
final GroupMessageBuilder builder = new GroupMessageBuilder()
.setVersion((short) EncodeConstants.OF13_VERSION_ID)
.setXid(message.readUnsignedInt())
bucket.setAction(actions);
}
- buckets.add(bucket.build());
+ buckets.add(bucket.setBucketId(new BucketId(Uint32.valueOf(buckets.size()))).build());
}
buckets.sort(COMPARATOR);
}
@Override
- public void injectDeserializerRegistry(DeserializerRegistry deserializerRegistry) {
+ public void injectDeserializerRegistry(final DeserializerRegistry deserializerRegistry) {
registry = deserializerRegistry;
}
* 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.impl.protocol.serialization.match;
import io.netty.buffer.ByteBuf;
-import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.yang.gen.v1.urn.opendaylight.model.match.types.rev131026.match.Layer4Match;
import org.opendaylight.yangtools.yang.common.Uint16;
}
@Override
- protected void serializeEntry(@NonNull Layer4Match entry, @NonNull Uint16 mask, @NonNull ByteBuf outBuffer) {
+ protected void serializeEntry(final Layer4Match entry, final Uint16 mask, final ByteBuf outBuffer) {
Uint16 portMask = extractMask(entry);
Uint16 port = extractPort(entry);
if (port != null) {
}
}
- protected Uint16 extractEntryMask(@NonNull Layer4Match entry) {
+ @Override
+ protected Uint16 extractEntryMask(final Layer4Match entry) {
return extractMask(entry);
}
import org.opendaylight.openflowplugin.api.OFConstants;
import org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowRegistryKey;
import org.opendaylight.openflowplugin.impl.util.MatchNormalizationUtil;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.Flow;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.general.rev140714.GeneralAugMatchNodesNodeTableFlow;
import org.opendaylight.yangtools.yang.common.Uint8;
public final class FlowRegistryKeyFactory {
+ // Temporary use, we will overwrite this. We do not have a flow ID and are about to make one up
+ // from the contents -- but for that we need a Flow object. But for that we need a FlowId, but
+ // ... so we set a dummy value and overwrite it afterwards.
+ public static final FlowKey DUMMY_FLOW_KEY = new FlowKey(new FlowId("__DUMMY_ID_FOR_ALIEN__"));
private FlowRegistryKeyFactory() {
// Hide implicit constructor
* @param flowStatistics flow statistics
* @return generated flow ID
*/
- protected FlowId generateFlowId(FlowAndStatisticsMapList flowStatistics) {
+ protected FlowId generateFlowId(final FlowAndStatisticsMapList flowStatistics) {
final FlowStatisticsDataBuilder flowStatisticsDataBld = new FlowStatisticsDataBuilder()
.setFlowStatistics(new FlowStatisticsBuilder(flowStatistics).build());
- final FlowBuilder flowBuilder = new FlowBuilder(flowStatistics).addAugmentation(flowStatisticsDataBld.build());
+ final FlowBuilder flowBuilder = new FlowBuilder(flowStatistics)
+ .withKey(FlowRegistryKeyFactory.DUMMY_FLOW_KEY)
+ .addAugmentation(flowStatisticsDataBld.build());
final FlowRegistryKey flowRegistryKey = FlowRegistryKeyFactory.create(getVersion(), flowBuilder.build());
private static final int RPC_REQUESTS_QUOTA = 500;
private static final long GLOBAL_NOTIFICATION_QUOTA = 131072;
private static final Uint16 THREAD_POOL_MIN_THREADS = Uint16.ONE;
- private static final int THREAD_POOL_MAX_THREADS = 32000;
+ private static final Uint16 THREAD_POOL_MAX_THREADS = Uint16.valueOf(32000);
private static final Uint32 THREAD_POOL_TIMEOUT = Uint32.valueOf(60);
private static final long BASIC_TIMER_DELAY = 1L;
private static final boolean USE_SINGLE_LAYER_SERIALIZATION = false;
@RunWith(MockitoJUnitRunner.class)
public class OpenFlowProviderConfigImplTest {
private static final Boolean IS_STATISTICS_POLLING_ON = true;
- private static final int BARRIER_COUNT_LIMIT = 2000;
- private static final long BARRIER_INTERVAL_TIMEOUT_LIMIT = 3000L;
- private static final long ECHO_REPLY_TIMEOUT = 4000L;
+ private static final Uint16 BARRIER_COUNT_LIMIT = Uint16.valueOf(2000);
+ private static final Uint32 BARRIER_INTERVAL_TIMEOUT_LIMIT = Uint32.valueOf(3000);
+ private static final Uint32 ECHO_REPLY_TIMEOUT = Uint32.valueOf(4000);
private static final Boolean ENABLE_FLOW_REMOVED_NOTIFICATION = true;
private static final Boolean SKIP_TABLE_FEATURES = true;
- private static final long BASIC_TIMER_DELAY = 2690L;
- private static final long MAXIMUM_TIMER_DELAY = 3679L;
+ private static final Uint32 BASIC_TIMER_DELAY = Uint32.valueOf(2690);
+ private static final Uint32 MAXIMUM_TIMER_DELAY = Uint32.valueOf(3679);
private static final Boolean SWITCH_FEATURES_MANDATORY = false;
private static final Boolean IS_STATISTICS_RPC_ENABLED = false;
private static final Boolean USE_SINGLE_LAYER_SERIALIZATION = true;
- private static final int RPC_REQUESTS_QUOTA = 2500;
+ private static final Uint16 RPC_REQUESTS_QUOTA = Uint16.valueOf(2500);
private static final Uint32 GLOBAL_NOTIFICATION_QUOTA = Uint32.valueOf(9000);
private static final Uint16 THREAD_POOL_MIN_THREADS = Uint16.valueOf(3);
- private static final int THREAD_POOL_MAX_THREADS = 1000;
+ private static final Uint16 THREAD_POOL_MAX_THREADS = Uint16.valueOf(1000);
private static final Uint32 THREAD_POOL_TIMEOUT = Uint32.valueOf(60);
private static final Uint16 DEVICE_CONNECTION_RATE_LIMIT_PER_MIN = Uint16.ZERO;
private static final Uint16 DEVICE_CONNECTION_HOLD_TIME_IN_SECONDS = Uint16.valueOf(60);
- private static final long DEVICE_DATASTORE_REMOVAL_DELAY = 500L;
+ private static final Uint32 DEVICE_DATASTORE_REMOVAL_DELAY = Uint32.valueOf(500);
@Mock
private ConfigurationService configurationService;
@Test
public void getRpcRequestsQuota() {
- assertEquals(RPC_REQUESTS_QUOTA, openflowProviderConfig.getRpcRequestsQuota().getValue().toJava());
+ assertEquals(RPC_REQUESTS_QUOTA, openflowProviderConfig.getRpcRequestsQuota().getValue());
}
@Test
@Test
public void getBarrierIntervalTimeoutLimit() {
- assertEquals(BARRIER_INTERVAL_TIMEOUT_LIMIT, openflowProviderConfig.getBarrierIntervalTimeoutLimit()
- .getValue().toJava());
+ assertEquals(BARRIER_INTERVAL_TIMEOUT_LIMIT,
+ openflowProviderConfig.getBarrierIntervalTimeoutLimit().getValue());
}
@Test
public void getBarrierCountLimit() {
- assertEquals(BARRIER_COUNT_LIMIT, openflowProviderConfig.getBarrierCountLimit().getValue().toJava());
+ assertEquals(BARRIER_COUNT_LIMIT, openflowProviderConfig.getBarrierCountLimit().getValue());
}
@Test
public void getEchoReplyTimeout() {
- assertEquals(ECHO_REPLY_TIMEOUT, openflowProviderConfig.getEchoReplyTimeout().getValue().toJava());
+ assertEquals(ECHO_REPLY_TIMEOUT, openflowProviderConfig.getEchoReplyTimeout().getValue());
}
@Test
@Test
public void getThreadPoolMaxThreads() {
- assertEquals(THREAD_POOL_MAX_THREADS, openflowProviderConfig.getThreadPoolMaxThreads().getValue().toJava());
+ assertEquals(THREAD_POOL_MAX_THREADS, openflowProviderConfig.getThreadPoolMaxThreads().getValue());
}
@Test
@Test
public void getBasicTimerDelay() {
- assertEquals(BASIC_TIMER_DELAY, openflowProviderConfig.getBasicTimerDelay().getValue().toJava());
+ assertEquals(BASIC_TIMER_DELAY, openflowProviderConfig.getBasicTimerDelay().getValue());
}
@Test
public void getMaximumTimerDelay() {
- assertEquals(MAXIMUM_TIMER_DELAY, openflowProviderConfig.getMaximumTimerDelay().getValue().toJava());
+ assertEquals(MAXIMUM_TIMER_DELAY, openflowProviderConfig.getMaximumTimerDelay().getValue());
}
@Test
@Test
public void getDeviceDatastoreRemovalDelay() {
assertEquals(DEVICE_DATASTORE_REMOVAL_DELAY,
- openflowProviderConfig.getDeviceDatastoreRemovalDelay().getValue().toJava());
+ openflowProviderConfig.getDeviceDatastoreRemovalDelay().getValue());
}
}
\ No newline at end of file
when(connectionContext.getOutboundQueueProvider()).thenReturn(outboundQueueProvider);
when(deviceContext.getDeviceState()).thenReturn(deviceState);
when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeInstanceIdentifier);
+ when(deviceInfo.getNodeId()).thenReturn(nodeInstanceIdentifier.getKey().getId());
when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo);
when(deviceContext.getMessageSpy()).thenReturn(messageSpy);
when(translatorLibrary.lookupTranslator(any())).thenReturn(messageTranslator);
when(connectionContext.getOutboundQueueProvider()).thenReturn(outboundQueueProvider);
when(deviceContext.getDeviceState()).thenReturn(deviceState);
when(deviceInfo.getNodeInstanceIdentifier()).thenReturn(nodeInstanceIdentifier);
+ when(deviceInfo.getNodeId()).thenReturn(nodeInstanceIdentifier.getKey().getId());
when(deviceContext.getDeviceInfo()).thenReturn(deviceInfo);
when(deviceContext.getMessageSpy()).thenReturn(messageSpy);
when(deviceContext.oook()).thenReturn(translatorLibrary);
import org.opendaylight.yangtools.util.concurrent.FluentFutures;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.util.BindingMap;
import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint64;
import org.opendaylight.yangtools.yang.common.Uint8;
.build();
final Table table = new TableBuilder()
- .setFlow(Collections.singletonList(flow))
+ .setId(Uint8.ONE)
+ .setFlow(BindingMap.of(flow))
.build();
final FlowCapableNode flowCapableNode = new FlowCapableNodeBuilder()
- .setTable(Collections.singletonList(table))
+ .setTable(BindingMap.of(table))
.build();
final Map<FlowRegistryKey, FlowDescriptor> allFlowDescriptors = fillRegistry(path, flowCapableNode);
fillRegistry(path, new FlowCapableNodeBuilder().build());
fillRegistry(path, new FlowCapableNodeBuilder()
- .setTable(Collections.EMPTY_LIST)
+ .setTable(Collections.emptyMap())
.build());
fillRegistry(path, new FlowCapableNodeBuilder()
- .setTable(Collections.singletonList(new TableBuilder().build()))
+ .setTable(BindingMap.of(new TableBuilder().setId(Uint8.ZERO).build()))
.build());
fillRegistry(path, new FlowCapableNodeBuilder()
- .setTable(Collections.singletonList(new TableBuilder()
- .setFlow(Collections.EMPTY_LIST)
+ .setTable(BindingMap.of(new TableBuilder()
+ .setId(Uint8.ZERO)
+ .setFlow(Collections.emptyMap())
.build()))
.build());
fillRegistry(path, new FlowCapableNodeBuilder()
- .setTable(Collections.singletonList(new TableBuilder()
- .setFlow(Collections.singletonList(new FlowBuilder()
- .setId(null)
+ .setTable(BindingMap.of(new TableBuilder()
+ .setId(Uint8.ZERO)
+ .setFlow(BindingMap.of(new FlowBuilder()
+ .setId(new FlowId("foo"))
.build()))
.build()))
.build());
import org.opendaylight.openflowplugin.api.openflow.device.DeviceState;
import org.opendaylight.openflowplugin.api.openflow.registry.flow.FlowRegistryKey;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdate;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.statistics.rev130819.FlowsStatisticsUpdateBuilder;
MatchBuilder match1Builder = new MatchBuilder().setLayer3Match(new Ipv4MatchBuilder()
.setIpv4Destination(new Ipv4Prefix("10.0.1.157/32")).build());
FlowBuilder flow1Builder = new FlowBuilder()
+ .setId(new FlowId("foo"))
.setCookie(new FlowCookie(Uint64.valueOf(483)))
.setMatch(match1Builder.build())
.setPriority(Uint16.TWO)
MatchBuilder match1Builder = new MatchBuilder().setLayer3Match(new Ipv4MatchBuilder()
.setIpv4Destination(new Ipv4Prefix("10.0.1.157/32")).build());
FlowBuilder flow1Builder = new FlowBuilder()
+ .setId(new FlowId("foo"))
.setCookie(new FlowCookie(Uint64.valueOf(483)))
.setMatch(match1Builder.build())
.setPriority(Uint16.TWO)
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.ConvertorManagerFactory;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNodeBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.Nodes;
when(mockedNodeId.toString()).thenReturn(DUMMY_NODE_ID);
when(mockedPrimaryConnection.getFeatures()).thenReturn(mockedFeaturesReply);
+ when(mockedFlowDescriptor.getFlowId()).thenReturn(new FlowId("mookus"));
+
when(mockedDeviceContext.getPrimaryConnectionContext()).thenReturn(mockedPrimaryConnection);
when(mockedDeviceInfo.getNodeInstanceIdentifier()).thenReturn(NODE_PATH);
when(mockedDeviceInfo.getNodeId()).thenReturn(mockedNodeId);
final BatchPlanStep planStep = new BatchPlanStep(BatchStepType.FLOW_ADD);
planStep.setBarrierAfter(true);
planStep.getTaskBag().addAll(Lists.newArrayList(
- createAddFlowBatch("1"),
- createAddFlowBatch("2")));
+ createAddFlowBatch(Uint16.ONE),
+ createAddFlowBatch(Uint16.TWO)));
final AddFlowsBatchInput addFlowsBatchInput = FlatBatchFlowAdapters.adaptFlatBatchAddFlow(planStep, NODE_REF);
Iterator<BatchAddFlows> iterator = addFlowsBatchInput.nonnullBatchAddFlows().values().iterator();
Assert.assertEquals("2", iterator.next().getFlowId().getValue());
}
- private static FlatBatchAddFlow createAddFlowBatch(final String flowIdValue) {
+ private static FlatBatchAddFlow createAddFlowBatch(final Uint16 flowIdValue) {
return new FlatBatchAddFlowBuilder()
- .setFlowId(new FlowId(flowIdValue))
+ .setFlowId(new FlowId(flowIdValue.toString()))
+ .setBatchOrder(flowIdValue)
.build();
}
- private static FlatBatchRemoveFlow createRemoveFlowBatch(final String flowIdValue) {
+ private static FlatBatchRemoveFlow createRemoveFlowBatch(final Uint16 flowIdValue) {
return new FlatBatchRemoveFlowBuilder()
- .setFlowId(new FlowId(flowIdValue))
+ .setFlowId(new FlowId(flowIdValue.toString()))
+ .setBatchOrder(flowIdValue)
.build();
}
- private static FlatBatchUpdateFlow createUpdateFlowBatch(final String flowIdValue) {
+ private static FlatBatchUpdateFlow createUpdateFlowBatch(final Uint16 flowIdValue) {
return new FlatBatchUpdateFlowBuilder()
- .setFlowId(new FlowId(flowIdValue))
+ .setFlowId(new FlowId(flowIdValue.toString()))
+ .setBatchOrder(flowIdValue)
.build();
}
final BatchPlanStep planStep = new BatchPlanStep(BatchStepType.FLOW_REMOVE);
planStep.setBarrierAfter(true);
planStep.getTaskBag().addAll(Lists.newArrayList(
- createRemoveFlowBatch("1"),
- createRemoveFlowBatch("2")));
+ createRemoveFlowBatch(Uint16.ONE),
+ createRemoveFlowBatch(Uint16.TWO)));
final RemoveFlowsBatchInput removeFlowsBatchInput =
FlatBatchFlowAdapters.adaptFlatBatchRemoveFlow(planStep, NODE_REF);
final BatchPlanStep planStep = new BatchPlanStep(BatchStepType.FLOW_UPDATE);
planStep.setBarrierAfter(true);
planStep.getTaskBag().addAll(Lists.newArrayList(
- createUpdateFlowBatch("1"),
- createUpdateFlowBatch("2")));
+ createUpdateFlowBatch(Uint16.ONE),
+ createUpdateFlowBatch(Uint16.TWO)));
final UpdateFlowsBatchInput updateFlowsBatchInput =
FlatBatchFlowAdapters.adaptFlatBatchUpdateFlow(planStep, NODE_REF);
private static FlatBatchAddGroup createAddGroupBatch(final Uint32 groupIdValue) {
return new FlatBatchAddGroupBuilder()
.setGroupId(new GroupId(groupIdValue))
+ .setBatchOrder(groupIdValue.toUint16())
.build();
}
private static FlatBatchRemoveGroup createRemoveGroupBatch(final Uint32 groupIdValue) {
return new FlatBatchRemoveGroupBuilder()
.setGroupId(new GroupId(groupIdValue))
+ .setBatchOrder(groupIdValue.toUint16())
.build();
}
.setUpdatedBatchedGroup(new UpdatedBatchedGroupBuilder()
.setGroupId(new GroupId(groupIdValue))
.build())
+ .setBatchOrder(groupIdValue.toUint16())
.build();
}
private static FlatBatchAddMeter createAddMeterBatch(final Uint32 groupIdValue) {
return new FlatBatchAddMeterBuilder()
.setMeterId(new MeterId(groupIdValue))
+ .setBatchOrder(groupIdValue.toUint16())
.build();
}
private static FlatBatchRemoveMeter createRemoveMeterBatch(final Uint32 groupIdValue) {
return new FlatBatchRemoveMeterBuilder()
.setMeterId(new MeterId(groupIdValue))
+ .setBatchOrder(groupIdValue.toUint16())
.build();
}
.setUpdatedBatchedMeter(new UpdatedBatchedMeterBuilder()
.setMeterId(new MeterId(groupIdValue))
.build())
+ .setBatchOrder(groupIdValue.toUint16())
.build();
}
import com.google.common.util.concurrent.AsyncFunction;
import com.google.common.util.concurrent.ListenableFuture;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.List;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.batch.meter.input.update.grouping.OriginalBatchedMeterBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.batch.meter.input.update.grouping.UpdatedBatchedMeterBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.binding.util.BindingMap;
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
int idx = 0;
ProcessFlatBatchInput batchInput = new ProcessFlatBatchInputBuilder()
.setNode(NODE_REF)
- .setBatch(Lists.newArrayList(
+ .setBatch(BindingMap.ordered(
createFlowAddBatch(idx++, "f1", 2),
createFlowRemoveBatch(idx++, "f2"),
createFlowUpdateBatch(idx++, "f3"),
return new BatchBuilder()
.setBatchOrder(Uint16.valueOf(batchOrder))
.setBatchChoice(new FlatBatchRemoveFlowCaseBuilder()
- .setFlatBatchRemoveFlow(Collections.singletonList(new FlatBatchRemoveFlowBuilder()
+ .setFlatBatchRemoveFlow(BindingMap.of(new FlatBatchRemoveFlowBuilder()
.setFlowId(new FlowId(flowIdValue))
+ .setBatchOrder(Uint16.valueOf(batchOrder))
.build()))
.build())
.build();
.setBatchOrder(uint)
.withKey(new BatchKey(uint))
.setBatchChoice(new FlatBatchUpdateFlowCaseBuilder()
- .setFlatBatchUpdateFlow(Collections.singletonList(new FlatBatchUpdateFlowBuilder()
+ .setFlatBatchUpdateFlow(BindingMap.of(new FlatBatchUpdateFlowBuilder()
.setFlowId(new FlowId(flowIdValue))
+ .setBatchOrder(Uint16.valueOf(batchOrder))
.build()))
.build())
.build();
return new BatchBuilder()
.setBatchOrder(Uint16.valueOf(batchOrder))
.setBatchChoice(new FlatBatchAddGroupCaseBuilder()
- .setFlatBatchAddGroup(Collections.singletonList(new FlatBatchAddGroupBuilder()
+ .setFlatBatchAddGroup(BindingMap.of(new FlatBatchAddGroupBuilder()
.setGroupId(new GroupId(Uint32.valueOf(groupIdValue)))
+ .setBatchOrder(Uint16.valueOf(batchOrder))
.build()))
.build())
.build();
return new BatchBuilder()
.setBatchOrder(Uint16.valueOf(batchOrder))
.setBatchChoice(new FlatBatchRemoveGroupCaseBuilder()
- .setFlatBatchRemoveGroup(Collections.singletonList(new FlatBatchRemoveGroupBuilder()
+ .setFlatBatchRemoveGroup(BindingMap.of(new FlatBatchRemoveGroupBuilder()
.setGroupId(new GroupId(Uint32.valueOf(groupIdValue)))
+ .setBatchOrder(Uint16.valueOf(batchOrder))
.build()))
.build())
.build();
return new BatchBuilder()
.setBatchOrder(Uint16.valueOf(batchOrder))
.setBatchChoice(new FlatBatchUpdateGroupCaseBuilder()
- .setFlatBatchUpdateGroup(Collections.singletonList(new FlatBatchUpdateGroupBuilder()
+ .setFlatBatchUpdateGroup(BindingMap.of(new FlatBatchUpdateGroupBuilder()
.setOriginalBatchedGroup(new OriginalBatchedGroupBuilder()
.setGroupId(new GroupId(Uint32.valueOf(groupIdValue)))
.build())
.setUpdatedBatchedGroup(new UpdatedBatchedGroupBuilder()
.setGroupId(new GroupId(Uint32.valueOf(groupIdValue)))
.build())
+ .setBatchOrder(Uint16.valueOf(batchOrder))
.build()))
.build())
.build();
return new BatchBuilder()
.setBatchOrder(Uint16.valueOf(batchOrder))
.setBatchChoice(new FlatBatchAddMeterCaseBuilder()
- .setFlatBatchAddMeter(Collections.singletonList(new FlatBatchAddMeterBuilder()
+ .setFlatBatchAddMeter(BindingMap.of(new FlatBatchAddMeterBuilder()
.setMeterId(new MeterId(Uint32.valueOf(groupIdValue)))
+ .setBatchOrder(Uint16.valueOf(batchOrder))
.build()))
.build())
.build();
return new BatchBuilder()
.setBatchOrder(Uint16.valueOf(batchOrder))
.setBatchChoice(new FlatBatchRemoveMeterCaseBuilder()
- .setFlatBatchRemoveMeter(Collections.singletonList(new FlatBatchRemoveMeterBuilder()
+ .setFlatBatchRemoveMeter(BindingMap.of(new FlatBatchRemoveMeterBuilder()
.setMeterId(new MeterId(Uint32.valueOf(groupIdValue)))
+ .setBatchOrder(Uint16.valueOf(batchOrder))
.build()))
.build())
.build();
return new BatchBuilder()
.setBatchOrder(Uint16.valueOf(batchOrder))
.setBatchChoice(new FlatBatchUpdateMeterCaseBuilder()
- .setFlatBatchUpdateMeter(Collections.singletonList(new FlatBatchUpdateMeterBuilder()
+ .setFlatBatchUpdateMeter(BindingMap.of(new FlatBatchUpdateMeterBuilder()
.setOriginalBatchedMeter(new OriginalBatchedMeterBuilder()
.setMeterId(new MeterId(Uint32.valueOf(groupIdValue)))
.build())
.setUpdatedBatchedMeter(new UpdatedBatchedMeterBuilder()
.setMeterId(new MeterId(Uint32.valueOf(groupIdValue)))
.build())
+ .setBatchOrder(Uint16.valueOf(batchOrder))
.build()))
.build())
.build();
public void testPrepareBatchPlan_success() throws Exception {
final FlatBatchAddFlow flatBatchAddFlow_1 = new FlatBatchAddFlowBuilder()
.setFlowId(new FlowId("f1"))
+ .setBatchOrder(Uint16.ONE)
.build();
final FlatBatchAddFlow flatBatchAddFlow_2 = new FlatBatchAddFlowBuilder()
.setFlowId(new FlowId("f2"))
+ .setBatchOrder(Uint16.TWO)
.build();
final BatchPlanStep batchPlanStep = new BatchPlanStep(BatchStepType.FLOW_ADD);
batchPlanStep.getTaskBag().addAll(Lists.newArrayList(flatBatchAddFlow_1, flatBatchAddFlow_2));
public void testPrepareBatchPlan_failure() throws Exception {
final FlatBatchAddFlow flatBatchAddFlow_1 = new FlatBatchAddFlowBuilder()
.setFlowId(new FlowId("f1"))
+ .setBatchOrder(Uint16.ONE)
.build();
final FlatBatchAddFlow flatBatchAddFlow_2 = new FlatBatchAddFlowBuilder()
.setFlowId(new FlowId("f2"))
+ .setBatchOrder(Uint16.TWO)
.build();
final BatchPlanStep batchPlanStep = new BatchPlanStep(BatchStepType.FLOW_ADD);
batchPlanStep.getTaskBag().addAll(Lists.newArrayList(flatBatchAddFlow_1, flatBatchAddFlow_2));
import static org.mockito.Mockito.verify;
-import com.google.common.collect.Lists;
-import java.util.List;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.junit.MockitoJUnitRunner;
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.UpdatePortInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.port.update.UpdatedPort;
import org.opendaylight.yang.gen.v1.urn.opendaylight.port.service.rev131107.port.update.UpdatedPortBuilder;
+import org.opendaylight.yangtools.yang.binding.util.BindingMap;
import org.opendaylight.yangtools.yang.common.Uint32;
@RunWith(MockitoJUnitRunner.class)
true, true, true, true, true, true, true, true));
concretePortBuilder.setPortNumber(new PortNumberUni(DUMMY_PORT_NUMBER));
concretePortBuilder.setHardwareAddress(new MacAddress(DUMMY_MAC_ADDRESS));
+ concretePortBuilder.setPortModOrder(Uint32.ZERO);
- List<org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.port.mod.port.Port> ports
- = Lists.newArrayList(concretePortBuilder.build());
- Port port = new PortBuilder().setPort(ports).build();
+ Port port = new PortBuilder().setPort(BindingMap.of(concretePortBuilder.build())).build();
UpdatedPort updatePort = new UpdatedPortBuilder().setPort(port).build();
return new UpdatePortInputBuilder().setUpdatedPort(updatePort).build();
}
public void buildRequest() {
final Port input = new PortBuilder()
.setPortNumber(new PortNumberUni(PORT_ID))
+ .setPortModOrder(Uint32.ZERO)
.build();
final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multipart.reply.multipart.reply.body.MultipartReplyTableFeaturesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multipart.request.multipart.request.body.MultipartRequestTableFeatures;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeaturesBuilder;
+import org.opendaylight.yangtools.yang.binding.util.BindingMap;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.common.Uint64;
+import org.opendaylight.yangtools.yang.common.Uint8;
public class SingleLayerTableMultipartServiceTest extends ServiceMocking {
private static final Uint32 MAX_ENTRIES = Uint32.valueOf(42);
public void buildRequest() {
final UpdateTableInput input = new UpdateTableInputBuilder()
.setUpdatedTable(new UpdatedTableBuilder()
- .setTableFeatures(Collections.singletonList(new TableFeaturesBuilder()
+ .setTableFeatures(BindingMap.of(new TableFeaturesBuilder()
+ .setTableId(Uint8.ZERO)
.setMaxEntries(MAX_ENTRIES)
.build()))
.build())
mockSuccessfulFuture(Collections.singletonList(new MultipartReplyBuilder()
.setXid(XID)
.setMultipartReplyBody(new MultipartReplyTableFeaturesBuilder()
- .setTableFeatures(Collections.singletonList(new TableFeaturesBuilder()
+ .setTableFeatures(BindingMap.of(new TableFeaturesBuilder()
+ .setTableId(Uint8.ZERO)
.setMaxEntries(MAX_ENTRIES)
.build()))
.build())
final UpdateTableInput input = new UpdateTableInputBuilder()
.setUpdatedTable(new UpdatedTableBuilder()
- .setTableFeatures(Collections.singletonList(new TableFeaturesBuilder()
+ .setTableFeatures(BindingMap.of(new TableFeaturesBuilder()
+ .setTableId(Uint8.ZERO)
.setMaxEntries(MAX_ENTRIES)
.build()))
.build())
when(deviceContext.getDeviceGroupRegistry()).thenReturn(deviceGroupRegistry);
when(deviceContext.getDeviceMeterRegistry()).thenReturn(deviceMeterRegistry);
when(deviceFlowRegistry.retrieveDescriptor(any(FlowRegistryKey.class))).thenReturn(flowDescriptor);
+ when(flowDescriptor.getFlowId()).thenReturn(new FlowId("MOCK_FLOW"));
when(deviceContext.getReadTransaction()).thenReturn(readTx);
when(deviceContext.getReadTransaction()).thenReturn(readTx);
when(deviceContext.getPrimaryConnectionContext()).thenReturn(connectionAdapter);
}
}
- private static Batch createBatch(BatchStepType type) {
+ private static Batch createBatch(final BatchStepType type) {
return createBatch(type, 1);
}
- private static Batch createBatch(BatchStepType type, final int size) {
+ private static Batch createBatch(final BatchStepType type, final int size) {
final BatchChoice batchCase;
switch (type) {
case FLOW_ADD:
}
return new BatchBuilder()
+ .setBatchOrder(Uint16.ZERO)
.setBatchChoice(batchCase)
.build();
}
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint8;
public class FlowUtilTest {
.withError(RpcError.ErrorType.APPLICATION, "ut-flowAddFail")
.withResult(Collections.singletonList(new BatchFailedFlowsOutputBuilder()
.setFlowId(DUMMY_FLOW_ID)
+ .setBatchOrder(Uint16.ZERO)
.build()))
.build();
}
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint32;
/**
return RpcResultBuilder.<List<BatchFailedGroupsOutput>>failed()
.withError(RpcError.ErrorType.APPLICATION, "ut-flowAddFail")
.withResult(Collections.singletonList(new BatchFailedGroupsOutputBuilder()
+ .setBatchOrder(Uint16.ZERO)
.setGroupId(DUMMY_GROUP_ID)
.build()))
.build();
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
+import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint32;
/**
return RpcResultBuilder.<List<BatchFailedMetersOutput>>failed()
.withError(RpcError.ErrorType.APPLICATION, "ut-flowAddFail")
.withResult(Collections.singletonList(new BatchFailedMetersOutputBuilder()
+ .setBatchOrder(Uint16.ZERO)
.setMeterId(DUMMY_METER_ID)
.build()))
.build();
<artifactId>openflowplugin</artifactId>
<packaging>bundle</packaging>
+ <properties>
+ <!-- FIXME: Remove this -->
+ <odlparent.modernizer.enforce>false</odlparent.modernizer.enforce>
+ </properties>
+
<build>
<plugins>
<plugin>
}
});
- final Action source = new ActionBuilder().build();
+ final Action source = new ActionBuilder().setOrder(0).build();
final VersionConvertorData data = new VersionConvertorData(OFConstants.OFP_VERSION_1_3);
final String expectedResult = String.valueOf(source) + String.valueOf(data);
final Optional<String> result = convertorManager.convert(source, data);
}
});
- final List<Action> source = Collections.singletonList(new ActionBuilder().build());
+ final List<Action> source = Collections.singletonList(new ActionBuilder().setOrder(0).build());
final VersionConvertorData data = new VersionConvertorData(OFConstants.OFP_VERSION_1_3);
final String expectedResult = String.valueOf(source) + String.valueOf(data);
final Optional<String> result = convertorManager.convert(source, data);
MeterBandHeaderBuilder meterBandHeaderBuilder2 = new MeterBandHeaderBuilder();
meterBandHeaderBuilder2.setBandType(experimenter);
meterBandHeaderBuilder2.setMeterBandTypes(meterBandTypesB2.build());
- meterBandHeaderBuilder.withKey(new MeterBandHeaderKey(new BandId(Uint32.TWO)));
+ meterBandHeaderBuilder2.withKey(new MeterBandHeaderKey(new BandId(Uint32.TWO)));
MeterBandHeader meterBH2 = meterBandHeaderBuilder2.build();
List<MeterBandHeader> meterBandList = new ArrayList<>();
*/
@Test
public void testtoPortModInputwithAllParameters() {
- PortBuilder portBld = new PortBuilder();
- portBld.setAdvertisedFeatures(features);
- portBld.setConfiguration(config);
- portBld.setPortNumber(new PortNumberUni(Uint32.valueOf(42L)));
- portBld.setHardwareAddress(new MacAddress(DEFAULT_MAC_ADDRESS));
+ PortBuilder portBld = new PortBuilder()
+ .setPortModOrder(Uint32.ZERO)
+ .setAdvertisedFeatures(features)
+ .setConfiguration(config)
+ .setPortNumber(new PortNumberUni(Uint32.valueOf(42)))
+ .setHardwareAddress(new MacAddress(DEFAULT_MAC_ADDRESS));
VersionConvertorData data = new VersionConvertorData(OFConstants.OFP_VERSION_1_3);
final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
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.address.address.Ipv4Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
IpMatchBuilder ipMatchBld = new IpMatchBuilder().setIpProto(IpVersion.Ipv4);
MatchBuilder matchBld = new MatchBuilder().setIpMatch(ipMatchBld.build());
FlowBuilder flowBld = new FlowBuilder().setMatch(matchBld.build());
- Flow flow = flowBld.build();
+ Flow flow = flowBld.setId(new FlowId("foo")).build();
ActionConvertorData data = new ActionConvertorData(OFConstants.OFP_VERSION_1_0);
data.setDatapathId(Uint64.valueOf(42));
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.action.action.strip.vlan.action._case.StripVlanActionBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv4Builder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.action.types.rev131112.address.address.Ipv6Builder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
IpMatchBuilder ipMatchBld = new IpMatchBuilder().setIpProtocol(Uint8.valueOf(6));
MatchBuilder matchBld = new MatchBuilder().setIpMatch(ipMatchBld.build());
FlowBuilder flowBld = new FlowBuilder().setMatch(matchBld.build());
- Flow flow = flowBld.build();
+ Flow flow = flowBld.setId(new FlowId("foo")).build();
ActionConvertorData data = new ActionConvertorData(OFConstants.OFP_VERSION_1_3);
data.setDatapathId(Uint64.valueOf(42));
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModCommand;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowModFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
-import org.opendaylight.yangtools.yang.binding.Augmentation;
+import org.opendaylight.yangtools.yang.binding.AbstractAugmentable;
import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.common.Uint64;
.build())).build();
}
- private static class MockFlow implements AddFlowInput {
+ private static class MockFlow extends AbstractAugmentable<AddFlowInput> implements AddFlowInput {
private Instructions instructions;
private Match match;
this.match = match;
}
-
@Override
public FlowRef getFlowRef() {
return null;
}
- @Override
- public <E extends Augmentation<AddFlowInput>> E augmentation(final Class<E> augmentationType) {
- return null;
- }
-
@Override
public FlowTableRef getFlowTable() {
return null;
public Uri getTransactionUri() {
return null;
}
-
- @Override
- public Class<AddFlowInput> implementedInterface() {
- return AddFlowInput.class;
- }
}
}
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>6.0.5</version>
+ <version>7.0.0</version>
<relativePath/>
</parent>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>controller-artifacts</artifactId>
- <version>2.0.4</version>
+ <version>3.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.infrautils</groupId>
<artifactId>infrautils-artifacts</artifactId>
- <version>1.8.1</version>
+ <version>1.9.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>7.0.6</version>
+ <version>8.0.0</version>
<relativePath/>
</parent>
*/
package org.opendaylight.openflowplugin.test;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.MoreExecutors;
import java.util.ArrayList;
private Group testGroup;
private Node testNode;
- public OpenflowpluginGroupTestCommandProvider(DataBroker dataBroker, BundleContext ctx) {
+ public OpenflowpluginGroupTestCommandProvider(final DataBroker dataBroker, final BundleContext ctx) {
this.dataBroker = dataBroker;
this.ctx = ctx;
}
createTestNode();
}
- private void createUserNode(String nodeRef) {
+ private void createUserNode(final String nodeRef) {
NodeBuilder builder = new NodeBuilder();
builder.setId(new NodeId(nodeRef));
builder.withKey(new NodeKey(builder.getId()));
testNode = builder.build();
}
- 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());
}
- private GroupBuilder createTestGroup(String actionType, String groupType, String groupMod) {
+ private GroupBuilder createTestGroup(String actionType, String groupType, final String groupMod) {
// Sample data , committing to DataStore
GroupBuilder group = new GroupBuilder();
createUserNode(nref);
}
GroupBuilder gbuilder = createTestGroup(ci.nextArgument(), ci.nextArgument(), "add");
- ReadWriteTransaction modification = Preconditions.checkNotNull(dataBroker).newReadWriteTransaction();
+ ReadWriteTransaction modification = requireNonNull(dataBroker).newReadWriteTransaction();
InstanceIdentifier<Group> path1 = InstanceIdentifier.create(Nodes.class).child(Node.class, testNode.key())
.augmentation(FlowCapableNode.class).child(Group.class, new GroupKey(gbuilder.getGroupId()));
modification.delete(LogicalDatastoreType.CONFIGURATION, path1);
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());
}
- public void _addGroup(CommandInterpreter ci) {
+ public void _addGroup(final CommandInterpreter ci) {
String nref = ci.nextArgument();
if (nref == null) {
writeGroup(ci, testGroup);
}
- private void writeGroup(final CommandInterpreter ci, Group group) {
- ReadWriteTransaction modification = Preconditions.checkNotNull(dataBroker).newReadWriteTransaction();
+ private void writeGroup(final CommandInterpreter ci, final Group group) {
+ ReadWriteTransaction modification = requireNonNull(dataBroker).newReadWriteTransaction();
InstanceIdentifier<Group> path1 = InstanceIdentifier.create(Nodes.class)
.child(Node.class, testNode.key()).augmentation(FlowCapableNode.class)
.child(Group.class, new GroupKey(group.getGroupId()));
modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path1, group);
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());
}
- public void _modifyGroup(CommandInterpreter ci) {
+ public void _modifyGroup(final CommandInterpreter ci) {
String nref = ci.nextArgument();
if (nref == null) {
*/
package org.opendaylight.openflowplugin.test;
-import com.google.common.base.Preconditions;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.MoreExecutors;
import java.util.ArrayList;
private final BundleContext ctx;
private Node testNode;
- public OpenflowpluginTableFeaturesTestCommandProvider(DataBroker dataBroker, BundleContext ctx) {
+ public OpenflowpluginTableFeaturesTestCommandProvider(final DataBroker dataBroker, final BundleContext ctx) {
this.dataBroker = dataBroker;
this.ctx = ctx;
}
// createTestTableFeatures();
}
- private void createUserNode(String nodeRef) {
+ private void createUserNode(final String nodeRef) {
NodeBuilder builder = new NodeBuilder();
builder.setId(new NodeId(nodeRef));
builder.withKey(new NodeKey(builder.getId()));
testNode = builder.build();
}
- 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());
}
- private static TableFeaturesBuilder createTestTableFeatures(String tableFeatureTypeArg) {
+ private static TableFeaturesBuilder createTestTableFeatures(final String tableFeatureTypeArg) {
String tableFeatureType = tableFeatureTypeArg;
if (tableFeatureType == null) {
return tableFeatureProperty;
}
- private void writeTableFeatures(final CommandInterpreter ci, TableFeatures tableFeatures) {
- ReadWriteTransaction modification = Preconditions.checkNotNull(dataBroker).newReadWriteTransaction();
+ private void writeTableFeatures(final CommandInterpreter ci, final TableFeatures tableFeatures) {
+ ReadWriteTransaction modification = requireNonNull(dataBroker).newReadWriteTransaction();
KeyedInstanceIdentifier<TableFeatures, TableFeaturesKey> path1 = InstanceIdentifier.create(Nodes.class)
.child(Node.class, testNode.key()).augmentation(FlowCapableNode.class)
modification.mergeParentStructureMerge(LogicalDatastoreType.CONFIGURATION, path1, tableFeatures);
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());
}
- public void _modifyTable(CommandInterpreter ci) {
+ public void _modifyTable(final CommandInterpreter ci) {
String nref = ci.nextArgument();
ci.println(" Table Command Provider modify");