import com.google.common.base.Function;
import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableSet;
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.ListeningExecutorService;
import com.google.common.util.concurrent.MoreExecutors;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentMap;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.RpcService;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
final UpgradeState upgradeState) {
Preconditions.checkArgument(rpcRegistry != null, "RpcConsumerRegistry cannot be null !");
this.reconciliationManager = requireNonNull(reconciliationManager, "ReconciliationManager cannot be null!");
- this.salBundleService = requireNonNull(rpcRegistry.getRpcService(SalBundleService.class),
+ salBundleService = requireNonNull(rpcRegistry.getRpcService(SalBundleService.class),
"RPC SalBundleService not found.");
this.rpcProviderService = rpcProviderService;
this.upgradeState = requireNonNull(upgradeState, "UpgradeState cannot be null!");
}
return RpcResultBuilder.success(new CommitActiveBundleOutputBuilder()
.setResult(null).build())
- .withRpcErrors(Collections.singleton(RpcResultBuilder.newError(RpcError.ErrorType.APPLICATION,
- null, "No active bundle found for the node" + nodeId.toString()))).buildFuture();
+ .withRpcErrors(List.of(RpcResultBuilder.newError(ErrorType.APPLICATION,
+ null, "No active bundle found for the node" + nodeId))).buildFuture();
}
@Override
.setResult(bundleDetails.getBundleId())
.build())
.buildFuture();
- } catch (InterruptedException | ExecutionException | NullPointerException e) {
+ } catch (InterruptedException | ExecutionException e) {
return RpcResultBuilder.<GetActiveBundleOutput>failed()
- .withRpcErrors(Collections.singleton(RpcResultBuilder.newError(RpcError.ErrorType.APPLICATION,
+ .withRpcErrors(List.of(RpcResultBuilder.newError(ErrorType.APPLICATION,
null, e.getMessage()))).buildFuture();
}
}
return executor.submit(upgradeReconTask);
}
- @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
- justification = "https://github.com/spotbugs/spotbugs/issues/811")
private static Messages createMessages(final NodeRef nodeRef) {
final List<Message> messages = new ArrayList<>();
messages.add(new MessageBuilder()
}
} else {
resultSink = RpcResultBuilder.<CommitActiveBundleOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION, "action of " + action + " failed");
+ .withError(ErrorType.APPLICATION, "action of " + action + " failed");
}
return resultSink.build();
};
.child(Node.class, new NodeKey(node.getNodeId()));
LOG.debug("The path is registered : {}", path);
ObjectRegistration<? extends RpcService> rpcRegistration =
- rpcProviderService.registerRpcImplementation(ArbitratorReconcileService.class,
- this, ImmutableSet.of(path));
+ rpcProviderService.registerRpcImplementation(ArbitratorReconcileService.class, this, Set.of(path));
rpcRegistrations.put(node.getNodeId().getValue(), rpcRegistration);
}
}
}
- @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
- justification = "https://github.com/spotbugs/spotbugs/issues/811")
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>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
@Override
public void onFailure(final Throwable throwable) {
RpcResultBuilder<Void> rpcResultBld = RpcResultBuilder.<Void>failed()
- .withRpcErrors(Collections.singleton(RpcResultBuilder.newError(RpcError.ErrorType.APPLICATION,
+ .withRpcErrors(Collections.singleton(RpcResultBuilder.newError(ErrorType.APPLICATION,
null, throwable.getMessage())));
rpcResult.set(rpcResultBld.build());
}
import com.google.common.util.concurrent.FutureCallback;
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.MoreExecutors;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Collection;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.mdsal.binding.api.DataBroker;
protected final ListenerRegistrationHelper registrationHelper;
protected ListenerRegistration<AbstractListeningCommiter> listenerRegistration;
- public AbstractListeningCommiter(final ForwardingRulesManager provider, final DataBroker dataBroker,
+ @SuppressFBWarnings(value = "MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR", justification = "See FIXME below")
+ protected AbstractListeningCommiter(final ForwardingRulesManager provider, final DataBroker dataBroker,
final ListenerRegistrationHelper registrationHelper) {
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!");
+
+ // FIXME: this may start listening on an uninitialized object: clean up the lifecycle here
registerListener();
provider.addRecoverableListener(this);
}
}
@Override
- public void registerListener() {
+ public final void registerListener() {
final DataTreeIdentifier<T> treeId =
DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, getWildCardPath());
Futures.addCallback(registrationHelper.checkedRegisterListener(treeId, this),
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundleFlags;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundleId;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
public BundleFlowForwarder(final ForwardingRulesManager forwardingRulesManager) {
this.forwardingRulesManager = requireNonNull(forwardingRulesManager, "ForwardingRulesManager can not be null!");
- this.nodeConfigurator = requireNonNull(forwardingRulesManager.getNodeConfigurator(),
+ nodeConfigurator = requireNonNull(forwardingRulesManager.getNodeConfigurator(),
"NodeConfigurator can not be null!");
}
}, MoreExecutors.directExecutor());
} else {
LOG.debug("Group {} not present in the config inventory", groupId);
- resultFuture = Futures.immediateFuture(RpcResultBuilder.<AddBundleMessagesOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION,
- "Group " + groupId + " not present in the config inventory").build());
+ resultFuture = RpcResultBuilder.<AddBundleMessagesOutput>failed()
+ .withError(ErrorType.APPLICATION,
+ "Group " + groupId + " not present in the config inventory").buildFuture();
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("Error while reading group from config datastore for the group ID {}", groupId, e);
- resultFuture = Futures.immediateFuture(RpcResultBuilder.<AddBundleMessagesOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION,
- "Group " + groupId + " not present in the config inventory").build());
+ resultFuture = RpcResultBuilder.<AddBundleMessagesOutput>failed()
+ .withError(ErrorType.APPLICATION,
+ "Group " + groupId + " not present in the config inventory").buildFuture();
}
}
} else {
- resultFuture = Futures.immediateFuture(RpcResultBuilder.<AddBundleMessagesOutput>success().build());
+ resultFuture = RpcResultBuilder.<AddBundleMessagesOutput>success().buildFuture();
}
return resultFuture;
}
this.bundleId = bundleId;
this.messages = messages;
this.resultFuture = resultFuture;
- this.flowId = getFlowId(identifier);
- this.tableId = getTableId(identifier);
+ flowId = getFlowId(identifier);
+ tableId = getTableId(identifier);
nodeId = getNodeIdValueFromNodeIdentifier(nodeIdent);
}
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Iterables;
import com.google.common.collect.Sets;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Collection;
import java.util.Collections;
import java.util.Set;
private Set<InstanceIdentifier<FlowCapableNode>> activeNodes = Collections.emptySet();
private MastershipChangeRegistration mastershipChangeServiceRegistration;
+ @SuppressFBWarnings(value = "MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR", justification = "Non-final for mocking")
public DeviceMastershipManager(final ClusterSingletonServiceProvider clusterSingletonService,
final FlowNodeReconciliation reconcliationAgent,
final DataBroker dataBroker,
this.clusterSingletonService = clusterSingletonService;
this.reconcliationAgent = reconcliationAgent;
this.rpcProviderService = rpcProviderService;
- this.reconcliationService = reconciliationService;
+ reconcliationService = reconciliationService;
this.dataBroker = dataBroker;
registerNodeListener();
- this.mastershipChangeServiceRegistration = mastershipChangeServiceManager.register(this);
+ mastershipChangeServiceRegistration = mastershipChangeServiceManager.register(this);
}
public boolean isDeviceMastered(final NodeId nodeId) {
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.rev170124.BundleId;
import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
builder.setGroupRef(new GroupRef(nodeIdent));
builder.setTransactionUri(new Uri(provider.getNewTransactionId()));
AddGroupInput addGroupInput = builder.build();
- resultFuture = this.provider.getSalGroupService().addGroup(addGroupInput);
+ resultFuture = provider.getSalGroupService().addGroup(addGroupInput);
} else {
- resultFuture = Futures.immediateFuture(RpcResultBuilder.<AddGroupOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION,
- "Group " + groupId + " not present in the config inventory").build());
+ resultFuture = RpcResultBuilder.<AddGroupOutput>failed()
+ .withError(ErrorType.APPLICATION,
+ "Group " + groupId + " not present in the config inventory").buildFuture();
}
} catch (InterruptedException | ExecutionException e) {
LOG.error("Error while reading group from config datastore for the group ID {}", groupId, e);
- resultFuture = Futures.immediateFuture(RpcResultBuilder.<AddGroupOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION,
- "Error while reading group " + groupId + " from inventory").build());
+ resultFuture = RpcResultBuilder.<AddGroupOutput>failed()
+ .withError(ErrorType.APPLICATION,
+ "Error while reading group " + groupId + " from inventory").buildFuture();
}
return resultFuture;
}
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class FlowNodeConnectorInventoryTranslatorImpl extends AbstractNodeConnectorCommitter<FlowCapableNodeConnector>
+public final class FlowNodeConnectorInventoryTranslatorImpl
+ extends AbstractNodeConnectorCommitter<FlowCapableNodeConnector>
implements FlowNodeConnectorInventoryTranslator {
private static final Logger LOG = LoggerFactory.getLogger(FlowNodeConnectorInventoryTranslatorImpl.class);
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.math.BigInteger;
import java.time.LocalDateTime;
import java.util.ArrayList;
}
}
- @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
- justification = "https://github.com/spotbugs/spotbugs/issues/811")
private static BigInteger getDpnIdFromNodeName(final String nodeName) {
String dpId = nodeName.substring(nodeName.lastIndexOf(SEPARATOR) + 1);
return new BigInteger(dpId);
return nodeIdent.child(StaleMeter.class, new StaleMeterKey(new MeterId(staleMeter.getMeterId())));
}
- @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
- justification = "https://github.com/spotbugs/spotbugs/issues/811")
private List<ListenableFuture<RpcResult<AddBundleMessagesOutput>>> addBundleMessages(final FlowCapableNode flowNode,
final BundleId bundleIdValue,
final InstanceIdentifier<FlowCapableNode> nodeIdentity) {
.build();
}
- @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
- justification = "https://github.com/spotbugs/spotbugs/issues/811")
private static Messages createMessages(final NodeRef nodeRef) {
final List<Message> messages = new ArrayList<>();
messages.add(new MessageBuilder().setNode(nodeRef)
*
*/
@Singleton
-public class ForwardingRulesManagerImpl implements ForwardingRulesManager {
+public final class ForwardingRulesManagerImpl implements ForwardingRulesManager {
private static final Logger LOG = LoggerFactory.getLogger(ForwardingRulesManagerImpl.class);
static final int STARTUP_LOOP_TICK = 1000;
staleMarkingEnabled = config.getStaleMarkingEnabled();
reconciliationRetryCount = config.getReconciliationRetryCount().toJava();
isBundleBasedReconciliationEnabled = config.getBundleBasedReconciliationEnabled();
- this.configurationServiceRegistration = configurationService.registerListener(this);
+ configurationServiceRegistration = configurationService.registerListener(this);
this.registrationHelper = requireNonNull(registrationHelper, "RegistrationHelper cannot be null");
- this.dataService = requireNonNull(dataBroker, "DataBroker can not be null!");
- this.clusterSingletonServiceProvider = requireNonNull(clusterSingletonService,
+ dataService = requireNonNull(dataBroker, "DataBroker can not be null!");
+ 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 = requireNonNull(rpcRegistry.getRpcService(SalFlowService.class),
+ salFlowService = requireNonNull(rpcRegistry.getRpcService(SalFlowService.class),
"RPC SalFlowService not found.");
- this.salGroupService = requireNonNull(rpcRegistry.getRpcService(SalGroupService.class),
+ salGroupService = requireNonNull(rpcRegistry.getRpcService(SalGroupService.class),
"RPC SalGroupService not found.");
- this.salMeterService = requireNonNull(rpcRegistry.getRpcService(SalMeterService.class),
+ salMeterService = requireNonNull(rpcRegistry.getRpcService(SalMeterService.class),
"RPC SalMeterService not found.");
- this.salTableService = requireNonNull(rpcRegistry.getRpcService(SalTableService.class),
+ salTableService = requireNonNull(rpcRegistry.getRpcService(SalTableService.class),
"RPC SalTableService not found.");
- this.salBundleService = requireNonNull(rpcRegistry.getRpcService(SalBundleService.class),
+ salBundleService = requireNonNull(rpcRegistry.getRpcService(SalBundleService.class),
"RPC SalBundlService not found.");
this.openflowServiceRecoveryHandler = requireNonNull(openflowServiceRecoveryHandler,
"Openflow service recovery handler cannot be null");
this.serviceRecoveryRegistry = requireNonNull(serviceRecoveryRegistry,
"Service recovery registry cannot be null");
- this.arbitratorReconciliationManager =
+ arbitratorReconciliationManager =
requireNonNull(rpcRegistry.getRpcService(ArbitratorReconcileService.class),
"ArbitratorReconciliationManager can not be null!");
}
@PostConstruct
public void start() {
nodeConfigurator = new NodeConfiguratorImpl();
- this.devicesGroupRegistry = new DevicesGroupRegistry();
- this.nodeListener = new FlowNodeReconciliationImpl(this, dataService, SERVICE_NAME, FRM_RECONCILIATION_PRIORITY,
+ devicesGroupRegistry = new DevicesGroupRegistry();
+ nodeListener = new FlowNodeReconciliationImpl(this, dataService, SERVICE_NAME, FRM_RECONCILIATION_PRIORITY,
ResultState.DONOTHING, flowGroupCacheManager);
if (this.isReconciliationDisabled()) {
LOG.debug("Reconciliation is disabled by user");
} else {
- this.reconciliationNotificationRegistration = reconciliationManager.registerService(this.nodeListener);
+ reconciliationNotificationRegistration = reconciliationManager.registerService(nodeListener);
LOG.debug("Reconciliation is enabled by user and successfully registered to the reconciliation framework");
}
- this.deviceMastershipManager = new DeviceMastershipManager(clusterSingletonServiceProvider, this.nodeListener,
+ deviceMastershipManager = new DeviceMastershipManager(clusterSingletonServiceProvider, nodeListener,
dataService, mastershipChangeServiceManager, rpcProviderService,
new FrmReconciliationServiceImpl(this));
flowNodeConnectorInventoryTranslatorImpl = new FlowNodeConnectorInventoryTranslatorImpl(dataService);
- this.bundleFlowListener = new BundleFlowForwarder(this);
- this.bundleGroupListener = new BundleGroupForwarder(this);
- this.flowListener = new FlowForwarder(this, dataService, registrationHelper);
- this.groupListener = new GroupForwarder(this, dataService, registrationHelper);
- this.meterListener = new MeterForwarder(this, dataService, registrationHelper);
- this.tableListener = new TableForwarder(this, dataService, registrationHelper);
+ bundleFlowListener = new BundleFlowForwarder(this);
+ bundleGroupListener = new BundleGroupForwarder(this);
+ flowListener = new FlowForwarder(this, dataService, registrationHelper);
+ groupListener = new GroupForwarder(this, dataService, registrationHelper);
+ meterListener = new MeterForwarder(this, dataService, registrationHelper);
+ tableListener = new TableForwarder(this, dataService, registrationHelper);
LOG.info("ForwardingRulesManager has started successfully.");
}
public void close() throws Exception {
configurationServiceRegistration.close();
- if (this.flowListener != null) {
- this.flowListener.close();
- this.flowListener = null;
+ if (flowListener != null) {
+ flowListener.close();
+ flowListener = null;
}
- if (this.groupListener != null) {
- this.groupListener.close();
- this.groupListener = null;
+ if (groupListener != null) {
+ groupListener.close();
+ groupListener = null;
}
- if (this.meterListener != null) {
- this.meterListener.close();
- this.meterListener = null;
+ if (meterListener != null) {
+ meterListener.close();
+ meterListener = null;
}
- if (this.tableListener != null) {
- this.tableListener.close();
- this.tableListener = null;
+ if (tableListener != null) {
+ tableListener.close();
+ tableListener = null;
}
- if (this.nodeListener != null) {
- this.nodeListener.close();
- this.nodeListener = null;
+ if (nodeListener != null) {
+ nodeListener.close();
+ nodeListener = null;
}
if (deviceMastershipManager != null) {
deviceMastershipManager.close();
}
- if (this.reconciliationNotificationRegistration != null) {
- this.reconciliationNotificationRegistration.close();
- this.reconciliationNotificationRegistration = null;
+ if (reconciliationNotificationRegistration != null) {
+ reconciliationNotificationRegistration.close();
+ reconciliationNotificationRegistration = null;
}
}
@Override
public DevicesGroupRegistry getDevicesGroupRegistry() {
- return this.devicesGroupRegistry;
+ return devicesGroupRegistry;
}
@Override
if (forwardingRulesProperty != null) {
switch (forwardingRulesProperty) {
case DISABLE_RECONCILIATION:
- disableReconciliation = Boolean.valueOf(propertyValue);
+ disableReconciliation = Boolean.parseBoolean(propertyValue);
break;
case STALE_MARKING_ENABLED:
- staleMarkingEnabled = Boolean.valueOf(propertyValue);
+ staleMarkingEnabled = Boolean.parseBoolean(propertyValue);
break;
case RECONCILIATION_RETRY_COUNT:
reconciliationRetryCount = Integer.parseInt(propertyValue);
break;
case BUNDLE_BASED_RECONCILIATION_ENABLED:
- isBundleBasedReconciliationEnabled = Boolean.valueOf(propertyValue);
+ isBundleBasedReconciliationEnabled = Boolean.parseBoolean(propertyValue);
break;
default:
LOG.warn("No forwarding rule property found.");
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.frm.reconciliation.service.rev180227.ReconcileNodeOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.frm.reconciliation.service.rev180227.ReconcileNodeOutputBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
futureResult.set(RpcResultBuilder.success(output).build());
} else {
futureResult.set(RpcResultBuilder.<ReconcileNodeOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION, "Error while triggering reconciliation").build());
+ .withError(ErrorType.APPLICATION, "Error while triggering reconciliation").build());
}
}
public void onFailure(Throwable error) {
LOG.error("initReconciliation failed", error);
futureResult.set(RpcResultBuilder.<ReconcileNodeOutput>failed()
- .withError(RpcError.ErrorType.RPC,"Error while calling RPC").build());
+ .withError(ErrorType.RPC, "Error while calling RPC").build());
}
}
}
import org.slf4j.LoggerFactory;
@Singleton
-public class OpenflowServiceRecoveryHandlerImpl implements ServiceRecoveryInterface,
+public final class OpenflowServiceRecoveryHandlerImpl implements ServiceRecoveryInterface,
OpenflowServiceRecoveryHandler {
private static final Logger LOG = LoggerFactory.getLogger(OpenflowServiceRecoveryHandlerImpl.class);
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
import org.opendaylight.openflowplugin.applications.frsync.SemaphoreKeeper;
};
}
- @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
- justification = "https://github.com/spotbugs/spotbugs/issues/811")
private static String formatNanos(final long nanos) {
return "'" + TimeUnit.NANOSECONDS.toMillis(nanos) + " ms'";
}
/**
* {@link ClusterSingletonService} clusterSingletonServiceRegistration per connected device.
*/
-public class DeviceMastership implements ClusterSingletonService, AutoCloseable {
+public final class DeviceMastership implements ClusterSingletonService, AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(DeviceMastership.class);
private final NodeId nodeId;
private final ServiceGroupIdentifier identifier;
final ReconciliationRegistry reconciliationRegistry,
final ClusterSingletonServiceProvider clusterSingletonService) {
this.nodeId = nodeId;
- this.identifier = ServiceGroupIdentifier.create(nodeId.getValue());
+ identifier = ServiceGroupIdentifier.create(nodeId.getValue());
this.reconciliationRegistry = reconciliationRegistry;
- this.deviceMastered = false;
+ deviceMastered = false;
clusterSingletonServiceRegistration = clusterSingletonService.registerClusterSingletonService(this);
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.NodeRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
return salFlowService.removeFlow(builder.build());
} else {
return RpcResultBuilder.<RemoveFlowOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION, TABLE_ID_MISMATCH).buildFuture();
+ .withError(ErrorType.APPLICATION, TABLE_ID_MISMATCH).buildFuture();
}
}
output = salFlowService.updateFlow(builder.build());
} else {
output = RpcResultBuilder.<UpdateFlowOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION, TABLE_ID_MISMATCH).buildFuture();
+ .withError(ErrorType.APPLICATION, TABLE_ID_MISMATCH).buildFuture();
}
return output;
builder.setFlowTable(new FlowTableRef(nodeIdent.child(Table.class, tableKey)));
output = salFlowService.addFlow(builder.build());
} else {
- output = RpcResultBuilder.<AddFlowOutput>failed().withError(RpcError.ErrorType.APPLICATION,
- TABLE_ID_MISMATCH).buildFuture();
+ output = RpcResultBuilder.<AddFlowOutput>failed().withError(ErrorType.APPLICATION, TABLE_ID_MISMATCH)
+ .buildFuture();
}
return output;
}
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedHashMap;
};
}
- @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
- justification = "https://github.com/spotbugs/spotbugs/issues/811")
private static void decrementBatchFailuresCounters(final Collection<BatchFailure> batchFailures,
final Map<Range<Uint16>, Batch> batchMap,
final SyncCrudCounters counters) {
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutput;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
}
} catch (IllegalStateException e) {
chainedResult = RpcResultBuilder.<Void>failed()
- .withError(RpcError.ErrorType.APPLICATION, "failed to add missing groups", e)
+ .withError(ErrorType.APPLICATION, "failed to add missing groups", e)
.buildFuture();
}
}
} catch (IllegalStateException e) {
chainedResult = RpcResultBuilder.<Void>failed()
- .withError(RpcError.ErrorType.APPLICATION, "failed to add missing groups", e)
+ .withError(ErrorType.APPLICATION, "failed to add missing groups", e)
.buildFuture();
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.nodes.Node;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.types.rev130918.MeterId;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
}
} else {
resultSink = RpcResultBuilder.<Void>failed()
- .withError(RpcError.ErrorType.APPLICATION, "previous " + previousItemAction + " failed");
+ .withError(ErrorType.APPLICATION, "previous " + previousItemAction + " failed");
}
return resultSink.build();
};
}
} else {
resultSink = RpcResultBuilder.<Void>failed()
- .withError(RpcError.ErrorType.APPLICATION, "action of " + actionDescription + " failed");
+ .withError(ErrorType.APPLICATION, "action of " + actionDescription + " failed");
}
return resultSink.build();
};
final Group existingGroup = installedGroups.get(group.getGroupId().getValue());
if (existingGroup != null) {
- if (!gatherUpdates) {
+ if (!gatherUpdates || group.equals(existingGroup)) {
iterator.remove();
- } else {
+ } else if (checkGroupPrecondition(installedGroups.keySet(), group)) {
// check buckets and eventually update
- if (group.equals(existingGroup)) {
- iterator.remove();
- } else {
- if (checkGroupPrecondition(installedGroups.keySet(), group)) {
- iterator.remove();
- LOG.trace("Group {} on device {} differs - planned for update", group.getGroupId(),
- nodeId);
- stepPlan.getItemsToUpdate().add(new ItemSyncBox.ItemUpdateTuple<>(existingGroup,
- group));
- }
- }
+ iterator.remove();
+ LOG.trace("Group {} on device {} differs - planned for update", group.getGroupId(), nodeId);
+ stepPlan.getItemsToUpdate().add(new ItemSyncBox.ItemUpdateTuple<>(existingGroup, group));
}
} else if (checkGroupPrecondition(installedGroups.keySet(), group)) {
iterator.remove();
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyZeroInteractions;
+import static org.mockito.Mockito.verifyNoInteractions;
import static org.mockito.Mockito.when;
import static org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType.DELETE;
import static org.opendaylight.mdsal.binding.api.DataObjectModification.ModificationType.SUBTREE_MODIFIED;
FlowCapableNodeConnector fcnc = TestUtils.createFlowCapableNodeConnector(true, false).build();
DataTreeModification dataTreeModification = setupDataTreeChange(WRITE, ID, fcnc);
translator.onDataTreeChanged(Collections.singleton(dataTreeModification));
- verifyZeroInteractions(eventsObserver);
+ verifyNoInteractions(eventsObserver);
}
/**
FlowCapableNodeConnector fcnc = TestUtils.createFlowCapableNodeConnector(false, true).build();
DataTreeModification dataTreeModification = setupDataTreeChange(WRITE, ID, fcnc);
translator.onDataTreeChanged(Collections.singleton(dataTreeModification));
- verifyZeroInteractions(eventsObserver);
+ verifyNoInteractions(eventsObserver);
}
/**
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<packaging>bundle</packaging>
<dependencies>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>osgi.core</artifactId>
- </dependency>
<dependency>
<groupId>org.opendaylight.openflowplugin</groupId>
<artifactId>openflowplugin-api</artifactId>
<artifactId>org.apache.karaf.shell.console</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.framework</artifactId>
+ </dependency>
<dependency>
<groupId>com.guicedee.services</groupId>
<artifactId>javax.inject</artifactId>
<packaging>bundle</packaging>
<dependencies>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>osgi.core</artifactId>
- </dependency>
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-binding-api</artifactId>
<artifactId>org.apache.karaf.shell.console</artifactId>
<scope>provided</scope>
</dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.framework</artifactId>
+ </dependency>
<dependency>
<groupId>org.opendaylight.openflowplugin.applications</groupId>
<artifactId>forwardingrules-manager</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.applications.southboundcli;
import static java.util.Objects.requireNonNull;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import org.eclipse.jdt.annotation.NonNull;
import org.opendaylight.mdsal.binding.api.ClusteredDataTreeChangeListener;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.DataObjectModification;
public static final String DEFAULT_DPN_NAME = "UNKNOWN";
public static final String SEPARATOR = ":";
+ private final Map<Long, String> dpnIdToNameCache = new ConcurrentHashMap<>();
private final DataBroker dataBroker;
private ListenerRegistration<?> listenerReg;
- private Map<Long, String> dpnIdToNameCache;
- public NodeListener(DataBroker broker) {
- this.dataBroker = broker;
+ public NodeListener(final DataBroker broker) {
+ dataBroker = broker;
}
public void start() {
final DataTreeIdentifier<FlowCapableNode> identifier =
DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL, path);
listenerReg = dataBroker.registerDataTreeChangeListener(identifier, NodeListener.this);
- dpnIdToNameCache = new ConcurrentHashMap<>();
}
@Override
}
@Override
- public void onDataTreeChanged(@NonNull Collection<DataTreeModification<FlowCapableNode>> changes) {
+ public void onDataTreeChanged(final Collection<DataTreeModification<FlowCapableNode>> changes) {
requireNonNull(changes, "Changes may not be null!");
for (DataTreeModification<FlowCapableNode> change : changes) {
final InstanceIdentifier<FlowCapableNode> key = change.getRootPath().getRootIdentifier();
}
}
- private void remove(InstanceIdentifier<FlowCapableNode> instId, FlowCapableNode delNode) {
+ private void remove(final InstanceIdentifier<FlowCapableNode> instId, final FlowCapableNode delNode) {
LOG.trace("Received remove notification for {}", delNode);
String[] node = instId.firstKeyOf(Node.class).getId().getValue().split(SEPARATOR);
if (node.length < 2) {
dpnIdToNameCache.remove(dpnId);
}
- private void update(InstanceIdentifier<FlowCapableNode> instId, FlowCapableNode dataObjectModificationBefore,
- FlowCapableNode dataObjectModificationAfter) {
+ private void update(final InstanceIdentifier<FlowCapableNode> instId,
+ final FlowCapableNode dataObjectModificationBefore, final FlowCapableNode dataObjectModificationAfter) {
LOG.trace("Received update notification {}", instId);
String[] node = instId.firstKeyOf(Node.class).getId().getValue().split(SEPARATOR);
if (node.length < 2) {
- LOG.error("Failed to add Unexpected nodeId {}", instId.firstKeyOf(Node.class).getId()
- .getValue());
+ LOG.error("Failed to add Unexpected nodeId {}", instId.firstKeyOf(Node.class).getId().getValue());
return;
}
long dpnId = Long.parseLong(node[1]);
- try {
- String nodeName = dataObjectModificationAfter.getDescription();
- if (nodeName != null) {
- dpnIdToNameCache.put(dpnId, nodeName);
- } else {
- dpnIdToNameCache.put(dpnId , DEFAULT_DPN_NAME);
- }
- } catch (NullPointerException e) {
- LOG.error("Error while converting Node:{} to FlowCapableNode: ", dpnId, e);
+ String nodeName = dataObjectModificationAfter == null ? null : dataObjectModificationAfter.getDescription();
+ if (nodeName != null) {
+ dpnIdToNameCache.put(dpnId, nodeName);
+ } else {
+ dpnIdToNameCache.put(dpnId, DEFAULT_DPN_NAME);
}
}
- private void add(InstanceIdentifier<FlowCapableNode> instId, FlowCapableNode addNode) {
+ private void add(final InstanceIdentifier<FlowCapableNode> instId, final FlowCapableNode addNode) {
LOG.trace("Received ADD notification for {}", instId);
String[] node = instId.firstKeyOf(Node.class).getId().getValue().split(SEPARATOR);
if (node.length < 2) {
- LOG.error("Failed to add Unexpected nodeId {}", instId.firstKeyOf(Node.class).getId()
- .getValue());
+ LOG.error("Failed to add Unexpected nodeId {}", instId.firstKeyOf(Node.class).getId().getValue());
return;
}
long dpnId = Long.parseLong(node[1]);
- String dpnName = null;
- try {
- dpnName = addNode.getDescription();
- } catch (NullPointerException e) {
- LOG.error("Error while converting Node:{} to FlowCapableNode: ", dpnId, e);
- }
+ String dpnName = addNode == null ? null : addNode.getDescription();
LOG.trace("Adding DPNID {} to cache", dpnId);
if (dpnName == null) {
dpnName = DEFAULT_DPN_NAME;
import static org.opendaylight.openflowplugin.api.openflow.ReconciliationState.ReconciliationStatus.FAILED;
import static org.opendaylight.openflowplugin.api.openflow.ReconciliationState.ReconciliationStatus.STARTED;
+import com.google.common.collect.ImmutableSet;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.SettableFuture;
import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
-import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Map;
import java.util.Optional;
+import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.reconciliation.service.rev180227.reconciliation.counter.ReconcileCounterBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.app.reconciliation.service.rev180227.reconciliation.counter.ReconcileCounterKey;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorTag;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
@Override
public ListenableFuture<RpcResult<ReconcileOutput>> reconcile(final ReconcileInput input) {
boolean reconcileAllNodes = input.getReconcileAllNodes();
- List<Uint64> inputNodes = input.getNodes();
+ Set<Uint64> inputNodes = input.getNodes();
if (inputNodes == null) {
- inputNodes = new ArrayList<>();
+ inputNodes = Set.of();
}
if (reconcileAllNodes && inputNodes.size() > 0) {
return buildErrorResponse("Error executing command reconcile. "
return buildErrorResponse("Error executing command reconcile. "
+ "Node(s) not found: " + String.join(", ", unresolvedNodes.toString()));
}
- List<Uint64> inprogressNodes = new ArrayList<>();
+ ImmutableSet.Builder<Uint64> inprogressNodes = ImmutableSet.builder();
nodesToReconcile.parallelStream().forEach(nodeId -> {
ReconciliationState state = getReconciliationState(nodeId);
if (state != null && state.getState().equals(STARTED)) {
}
});
ReconcileOutput reconcilingInProgress = new ReconcileOutputBuilder()
- .setInprogressNodes(inprogressNodes)
+ .setInprogressNodes(inprogressNodes.build())
.build();
result.set(RpcResultBuilder.success(reconcilingInProgress).build());
return result;
private static ListenableFuture<RpcResult<ReconcileOutput>> buildErrorResponse(final String msg) {
LOG.error("Error {}", msg);
return RpcResultBuilder.<ReconcileOutput>failed()
- .withError(RpcError.ErrorType.PROTOCOL, "reconcile", msg)
+ .withError(ErrorType.PROTOCOL, new ErrorTag("reconcile"), msg)
.buildFuture();
}
if (rpcResult.isSuccessful()) {
increaseReconcileCount(true);
updateReconciliationState(COMPLETED);
- LOG.info("Reconciliation successfully completed for node {}", this.nodeId);
+ LOG.info("Reconciliation successfully completed for node {}", nodeId);
} else {
increaseReconcileCount(false);
updateReconciliationState(FAILED);
- LOG.error("Reconciliation failed for node {} with error {}", this.nodeId, rpcResult.getErrors());
+ LOG.error("Reconciliation failed for node {} with error {}", nodeId, rpcResult.getErrors());
}
} catch (ExecutionException | InterruptedException e) {
increaseReconcileCount(false);
updateReconciliationState(FAILED);
- LOG.error("Error occurred while invoking reconcile RPC for node {}", this.nodeId, e);
+ LOG.error("Error occurred while invoking reconcile RPC for node {}", nodeId, e);
} finally {
alarmAgent.clearNodeReconciliationAlarm(nodeId.longValue());
}
}
private void increaseReconcileCount(final boolean isSuccess) {
+ // FIXME: do not use SimpleDateFormat
final SimpleDateFormat simpleDateFormat = new SimpleDateFormat(DATE_AND_TIME_FORMAT);
InstanceIdentifier<ReconcileCounter> instanceIdentifier = InstanceIdentifier
.builder(ReconciliationCounter.class).child(ReconcileCounter.class,
import java.util.List;
import org.apache.felix.gogo.commands.Command;
import org.apache.karaf.shell.console.OsgiCommandSupport;
-import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.openflowplugin.applications.southboundcli.NodeListener;
import org.opendaylight.openflowplugin.applications.southboundcli.util.OFNode;
import org.opendaylight.openflowplugin.applications.southboundcli.util.ShellUtil;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
@Command(scope = "openflow", name = "getallnodes", description = "Print all nodes from the operational datastore")
public class GetAllNodesCommandProvider extends OsgiCommandSupport {
- private static final Logger LOG = LoggerFactory.getLogger(GetAllNodesCommandProvider.class);
-
- private DataBroker dataBroker;
private NodeListener nodeListener;
- public void setDataBroker(final DataBroker dataBroker) {
- this.dataBroker = dataBroker;
- }
-
public void setNodeListener(final NodeListener nodeListener) {
this.nodeListener = nodeListener;
}
* 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.southboundcli.cli;
-import java.util.ArrayList;
import java.util.Formatter;
import java.util.List;
+import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Future;
import java.util.stream.Collectors;
@SuppressWarnings("checkstyle:RegexpSinglelineJava")
@Override
protected Object doExecute() throws Exception {
- List<Uint64> nodes = nodeIds == null
- ? new ArrayList<>()
- : nodeIds.stream().distinct().map(Uint64::valueOf).collect(Collectors.toList());
+ Set<Uint64> nodes = nodeIds == null
+ ? Set.of()
+ : nodeIds.stream().distinct().map(Uint64::valueOf).collect(Collectors.toUnmodifiableSet());
LOG.debug("Triggering reconciliation for nodes {}", nodes);
ReconcileInput rpcInput = new ReconcileInputBuilder().setNodes(nodes)
.setReconcileAllNodes(reconcileAllNodes).build();
@SuppressWarnings("checkstyle:RegexpSinglelineJava")
private static void printInProgressNodes(ReconcileOutput reconcileOutput) {
- List<Uint64> inprogressNodes = reconcileOutput.getInprogressNodes();
+ Set<Uint64> inprogressNodes = reconcileOutput.getInprogressNodes();
if (inprogressNodes.size() > 0) {
StringBuilder stringBuilder = new StringBuilder();
final Formatter formatter = new Formatter(stringBuilder);
formatter.close();
return header;
}
-}
\ No newline at end of file
+}
if (result.isPresent()) {
output = result.get().nonnullReconcileCounter().values();
}
- } catch (ExecutionException | InterruptedException | NullPointerException e) {
+ } catch (ExecutionException | InterruptedException e) {
LOG.error("Error reading reconciliation counter from datastore", e);
}
return output;
<command-bundle xmlns="http://karaf.apache.org/xmlns/shell/v1.0.0">
<command name="openflow/getallnodes">
<action class="org.opendaylight.openflowplugin.applications.southboundcli.cli.GetAllNodesCommandProvider">
- <property name="dataBroker" ref="dataBroker" />
<property name="nodeListener" ref="nodeListener"/>
</action>
</command>
import com.google.common.annotations.VisibleForTesting;
import java.util.Collection;
import java.util.Date;
-import java.util.Map;
import java.util.Map.Entry;
import java.util.Timer;
import java.util.TimerTask;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ConcurrentMap;
import javax.annotation.PreDestroy;
import javax.inject.Inject;
import javax.inject.Singleton;
import org.opendaylight.mdsal.binding.api.ClusteredDataTreeChangeListener;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.DataObjectModification;
-import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
import org.opendaylight.mdsal.binding.api.DataTreeModification;
import org.opendaylight.mdsal.binding.api.NotificationPublishService;
import org.slf4j.LoggerFactory;
@Singleton
-public class LLDPLinkAger implements ConfigurationListener, ClusteredDataTreeChangeListener<Link>, AutoCloseable {
+public final class LLDPLinkAger implements ConfigurationListener, ClusteredDataTreeChangeListener<Link>, AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(LLDPLinkAger.class);
static final String TOPOLOGY_ID = "flow:1";
static final InstanceIdentifier<Link> II_TO_LINK = InstanceIdentifier.create(NetworkTopology.class)
.child(Topology.class, new TopologyKey(new TopologyId(TOPOLOGY_ID))).child(Link.class);
private final long linkExpirationTime;
- private final Map<LinkDiscovered, Date> linkToDate;
- private final Timer timer;
+ // FIXME: use Instant instead of Date
+ private final ConcurrentMap<LinkDiscovered, Date> linkToDate = new ConcurrentHashMap<>();
+ private final Timer timer = new Timer();
private final NotificationPublishService notificationService;
private final AutoCloseable configurationServiceRegistration;
private final EntityOwnershipService eos;
- private ListenerRegistration<DataTreeChangeListener> listenerRegistration;
+ private ListenerRegistration<?> listenerRegistration;
/**
* default ctor - start timer.
final ConfigurationService configurationService,
final EntityOwnershipService entityOwnershipService,
final DataBroker dataBroker) {
- this.linkExpirationTime = topologyLldpDiscoveryConfig.getTopologyLldpExpirationInterval().getValue().toJava();
+ linkExpirationTime = topologyLldpDiscoveryConfig.getTopologyLldpExpirationInterval().getValue().toJava();
this.notificationService = notificationService;
- this.configurationServiceRegistration = configurationService.registerListener(this);
- this.eos = entityOwnershipService;
- linkToDate = new ConcurrentHashMap<>();
- timer = new Timer();
- final DataTreeIdentifier dtiToNodeConnector = DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL,
+ configurationServiceRegistration = configurationService.registerListener(this);
+ eos = entityOwnershipService;
+ final DataTreeIdentifier<Link> dtiToNodeConnector = DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL,
II_TO_LINK);
try {
listenerRegistration = dataBroker.registerDataTreeChangeListener(dtiToNodeConnector, LLDPLinkAger.this);
@Override
public void onDataTreeChanged(@NonNull Collection<DataTreeModification<Link>> changes) {
- for (DataTreeModification modification : changes) {
+ for (DataTreeModification<Link> modification : changes) {
switch (modification.getRootNode().getModificationType()) {
case WRITE:
break;
return linkToDate.containsKey(linkDiscovered);
}
- private void processLinkDeleted(DataObjectModification rootNode) {
- Link link = (Link) rootNode.getDataBefore();
+ private void processLinkDeleted(DataObjectModification<Link> rootNode) {
+ Link link = rootNode.getDataBefore();
LOG.trace("Removing link {} from linkToDate cache", link);
LinkDiscovered linkDiscovered = LLDPDiscoveryUtils.toLLDPLinkDiscovered(link);
linkToDate.remove(linkDiscovered);
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.lldp.discovery.config.rev160511.TopologyLldpDiscoveryConfigBuilder;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.Uint32;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* Test for {@link LLDPLinkAger}.
*/
@RunWith(MockitoJUnitRunner.class)
public class LLDPLinkAgerTest {
-
- private static final Logger LOG = LoggerFactory.getLogger(LLDPLinkAgerTest.class);
-
private static final Uint32 LLDP_INTERVAL = Uint32.valueOf(5);
private static final Uint32 LINK_EXPIRATION_TIME = Uint32.TEN;
import org.opendaylight.yang.gen.v1.urn.opendaylight.inventory.rev130819.node.NodeConnectorKey;
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.slf4j.Logger;
-import org.slf4j.LoggerFactory;
/**
* Test for {@link LLDPDiscoveryUtils}.
*/
@RunWith(MockitoJUnitRunner.class)
public class LLDPDiscoveryUtilsTest {
-
- private static final Logger LOG = LoggerFactory.getLogger(LLDPDiscoveryUtilsTest.class);
-
@Test
public void testLldpToNodeConnectorRefLLDP() {
byte[] packetLLDP = {
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>karaf4-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
</parent>
<groupId>org.opendaylight.openflowplugin</groupId>
<artifactId>openflowplugin-karaf</artifactId>
<developerConnection>scm:git:ssh://git.opendaylight.org:29418/openflowplugin.git</developerConnection>
</scm>
<dependencies>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>osgi.core</artifactId>
- </dependency>
<dependency>
<groupId>org.opendaylight.openflowplugin</groupId>
<artifactId>test-common</artifactId>
</dependency>
- <dependency>
- <groupId>com.google.guava</groupId>
- <artifactId>guava</artifactId>
- </dependency>
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-binding-api</artifactId>
<groupId>org.opendaylight.openflowplugin.model</groupId>
<artifactId>model-flow-service</artifactId>
</dependency>
- <dependency>
- <groupId>org.opendaylight.openflowplugin.model</groupId>
- <artifactId>model-flow-base</artifactId>
- </dependency>
- <dependency>
- <groupId>org.opendaylight.openflowplugin.model</groupId>
- <artifactId>model-inventory</artifactId>
- </dependency>
<dependency>
<groupId>org.apache.karaf.shell</groupId>
<artifactId>org.apache.karaf.shell.console</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
- <groupId>commons-lang</groupId>
- <artifactId>commons-lang</artifactId>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.framework</artifactId>
</dependency>
-
</dependencies>
<build>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>feature-repo-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<modelVersion>4.0.0</modelVersion>
*
* @author msunal
*/
-public class NxmHeader {
+public final class NxmHeader {
// Full 4 or 8 byte header as big integer
private final Uint64 header;
* @see NxmHeader#NxmHeader(long)
*/
public NxmHeader(final Uint64 header) {
- this.headerAsLong = header.longValue();
+ headerAsLong = header.longValue();
if (isExperimenter(header)) {
- this.experimenterId = (int) this.headerAsLong;
- this.shortHeader = this.headerAsLong >>> 32;
+ experimenterId = (int) headerAsLong;
+ shortHeader = headerAsLong >>> 32;
} else {
- this.shortHeader = this.headerAsLong;
- this.experimenterId = -1;
+ shortHeader = headerAsLong;
+ experimenterId = -1;
}
this.header = header;
try {
- this.oxmClass = Math.toIntExact(extractSub(this.shortHeader, 16, 16));
- this.nxmField = Math.toIntExact(extractSub(this.shortHeader, 7, 9));
- this.hasMask = extractSub(this.shortHeader, 1, 8) == 1;
- this.length = Math.toIntExact(extractSub(this.shortHeader, 8, 0));
+ oxmClass = Math.toIntExact(extractSub(shortHeader, 16, 16));
+ nxmField = Math.toIntExact(extractSub(shortHeader, 7, 9));
+ hasMask = extractSub(shortHeader, 1, 8) == 1;
+ length = Math.toIntExact(extractSub(shortHeader, 8, 0));
} catch (ArithmeticException e) {
throw new IllegalArgumentException(e);
}
this.nxmField = nxmField;
this.hasMask = hasMask;
this.length = length;
- this.shortHeader = (long) oxmClass << 16 | nxmField << 9 | (hasMask ? 1 : 0) << 8 | length;
+ shortHeader = (long) oxmClass << 16 | nxmField << 9 | (hasMask ? 1 : 0) << 8 | length;
this.experimenterId = experimenterId;
if (isExperimenter()) {
- this.header = Uint64.fromLongBits((this.shortHeader << 32) + experimenterId);
+ header = Uint64.fromLongBits((shortHeader << 32) + experimenterId);
} else {
- this.header = Uint64.valueOf(this.shortHeader);
+ header = Uint64.valueOf(shortHeader);
}
- this.headerAsLong = this.header.longValue();
+ headerAsLong = header.longValue();
}
private static long extractSub(final long value, final int nrBits, final int offset) {
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>feature-repo-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<classifier>features</classifier>
<type>xml</type>
</dependency>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>odl-openflowplugin-app-reconciliation-framework</artifactId>
+ <version>${project.version}</version>
+ <classifier>features</classifier>
+ <type>xml</type>
+ </dependency>
+
<dependency>
<groupId>org.opendaylight.openflowplugin.applications</groupId>
<artifactId>arbitratorreconciliation-impl</artifactId>
<version>${project.version}</version>
</dependency>
-
</dependencies>
-
</project>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<dependency>
<groupId>org.opendaylight.netconf</groupId>
<artifactId>netconf-artifacts</artifactId>
- <version>2.0.14</version>
+ <version>3.0.0</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<name>OpenDaylight :: Openflow Plugin :: Libraries</name>
<dependencies>
+ <dependency>
+ <groupId>org.opendaylight.odlparent</groupId>
+ <artifactId>odl-apache-commons-lang3</artifactId>
+ <type>xml</type>
+ <classifier>features</classifier>
+ </dependency>
<dependency>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odl-guava</artifactId>
<?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="[9,10)">odl-guava</feature>
+ <feature version="[10,11)">odl-apache-commons-lang3</feature>
+ <feature version="[10,11)">odl-guava</feature>
</feature>
</features>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-artifacts</artifactId>
- <version>8.0.11</version>
+ <version>9.0.1</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>controller-artifacts</artifactId>
- <version>4.0.10</version>
+ <version>5.0.1</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependencies>
<!-- feature dependencies -->
+ <dependency>
+ <groupId>org.opendaylight.mdsal.model</groupId>
+ <artifactId>odl-mdsal-model-draft-clemm-netmod-yang-network-topo-01-minimal</artifactId>
+ <classifier>features</classifier>
+ <type>xml</type>
+ </dependency>
<dependency>
<groupId>org.opendaylight.mdsal.model</groupId>
<artifactId>odl-mdsal-model-odl-l2-types</artifactId>
<?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="[8,9)">odl-mdsal-model-odl-l2-types</feature>
+ <feature version="[9,10)">odl-mdsal-model-draft-clemm-netmod-yang-network-topo-01-minimal</feature>
+ <feature version="[9,10)">odl-mdsal-model-odl-l2-types</feature>
</feature>
</features>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>controller-artifacts</artifactId>
- <version>4.0.10</version>
+ <version>5.0.1</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.opendaylight.infrautils</groupId>
<artifactId>infrautils-artifacts</artifactId>
- <version>2.0.13</version>
+ <version>3.0.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="[4,5)">odl-mdsal-broker</feature>
- <feature version="[2,3)">odl-infrautils-diagstatus</feature>
+ <feature version="[5,6)">odl-mdsal-broker</feature>
+ <feature version="[3,4)">odl-infrautils-diagstatus</feature>
</feature>
</features>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
typedef group-id {
type uint32;
}
-
+
typedef bucket-id {
- type uint32;
+ type uint32;
}
-
- typedef group-types {
+
+ typedef group-types {
type enumeration {
enum group-all;
enum group-select;
enum group-indirect;
enum group-ff;
- }
+ }
}
-
- typedef group-capabilities {
+
+ typedef group-capabilities {
type enumeration {
enum select-weight;
enum select-liveness;
enum chaining;
enum chaining-checks;
- }
+ }
}
-
+
identity group-type {
- description "Base identity for all the available group types";
+ description "Base identity for all the available group types";
}
-
+
identity group-all {
- base group-type;
- description "All (multicast/broadcast) group";
+ base group-type;
+ description "All (multicast/broadcast) group";
}
-
+
identity group-select {
- base group-type;
- description "Select group";
+ base group-type;
+ description "Select group";
}
-
+
identity group-indirect {
- base group-type;
- description "Indirect group";
+ base group-type;
+ description "Indirect group";
}
-
+
identity group-ff {
- base group-type;
- description "Fast failover group";
+ base group-type;
+ description "Fast failover group";
}
-
+
identity group-capability {
- description "Base identity for all the supported group capabilities";
+ description "Base identity for all the supported group capabilities";
}
-
+
identity select-weight{
- base group-capability;
- description "Support weight for select groups";
+ base group-capability;
+ description "Support weight for select groups";
}
identity select-liveness{
- base group-capability;
- description "Support liveness for select groups";
+ base group-capability;
+ description "Support liveness for select groups";
}
identity chaining{
- base group-capability;
- description "Support chaining groups";
+ base group-capability;
+ description "Support chaining groups";
}
identity chaining-checks{
- base group-capability;
- description "Check chaining for loops and delete";
+ base group-capability;
+ description "Check chaining for loops and delete";
}
-
+
typedef group-ref {
type instance-identifier;
}
-
+
grouping group {
-
+
leaf group-type {
type group-types;
}
-
+
leaf group-id {
type group-id;
}
-
+
leaf group-name {
type string;
}
-
+
leaf container-name {
- type string;
+ type string;
}
-
+
leaf barrier {
- type boolean;
- }
-
+ type boolean;
+ }
+
container buckets {
list bucket {
key "bucket-id";
leaf bucket-id {
type bucket-id;
}
-
+
leaf weight {
type uint16;
}
-
+
leaf watch_port {
type uint32;
}
-
+
leaf watch_group {
type uint32;
}
-
+
uses action:action-list;
}
}
}
-
+
grouping group-statistics {
-
+
leaf group-id {
type group-id;
}
-
+
leaf ref-count {
type yang:counter32;
}
-
+
leaf packet-count {
type yang:counter64;
- }
-
+ }
+
leaf byte-count {
type yang:counter64;
}
type yang:counter32;
}
}
-
+
container buckets {
list bucket-counter {
key "bucket-id";
leaf bucket-id {
type bucket-id;
}
-
+
leaf packet-count {
type yang:counter64;
- }
-
+ }
+
leaf byte-count {
type yang:counter64;
}
}
- }
+ }
}
grouping group-features {
-
- leaf-list group-types-supported {
- type identityref {
- base group-type;
- }
- }
-
- leaf-list group-capabilities-supported {
- type identityref {
- base group-capability;
- }
- }
+
+ leaf-list group-types-supported {
+ type identityref {
+ base group-type;
+ }
+ }
+
+ leaf-list group-capabilities-supported {
+ type identityref {
+ base group-capability;
+ }
+ }
leaf-list max-groups {
type uint32;
description "Maximum number of groups for each type";
max-elements 4;
+ ordered-by user;
}
-
+
leaf-list actions {
type uint32;
description "Bitmap number OFPAT_* that are supported";
max-elements 4;
+ ordered-by user;
}
}
-
+
grouping group-statistics-request {
list group-stats {
- key "group-id";
+ key "group-id";
leaf group-id {
type group-id;
- }
+ }
}
}
-
+
grouping group-statistics-reply {
-
+
list group-stats {
key "group-id";
uses group-statistics;
}
}
-
+
grouping group-desc-stats-reply {
-
+
list group-desc-stats {
- key "group-id";
+ key "group-id";
uses group;
}
}
-
+
grouping group-features-reply {
- uses group-features;
+ uses group-features;
}
-
+
grouping groups {
list group {
- key "group-id";
-
+ key "group-id";
+
uses group;
}
}
typedef table-id {
- type uint8;
+ type uint8;
}
typedef table-ref {
grouping set-field-match {
list set-field-match {
- key "match-type";
+ key "match-type";
leaf match-type {
type identityref {
base match-field;
container tables {
leaf-list table-ids {
type uint8;
+ ordered-by user;
}
}
}
container tables-miss {
leaf-list table-ids {
type uint8;
+ ordered-by user;
}
}
}
}
case match {
- container match-setfield {
- uses set-field-match;
- }
+ container match-setfield {
+ uses set-field-match;
+ }
}
case wildcards {
- container wildcard-setfield {
+ container wildcard-setfield {
uses set-field-match;
}
}
case write-setfield {
- container write-setfield {
+ container write-setfield {
uses set-field-match;
}
}
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>feature-repo-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>single-feature-parent</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
<dependency>
<groupId>org.opendaylight.infrautils</groupId>
<artifactId>infrautils-artifacts</artifactId>
- <version>2.0.13</version>
+ <version>3.0.0</version>
+ <scope>import</scope>
+ <type>pom</type>
+ </dependency>
+
+ <!-- YANG Tools -->
+ <dependency>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>yangtools-artifacts</artifactId>
+ <version>8.0.2</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<dependency>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>mdsal-artifacts</artifactId>
- <version>8.0.11</version>
+ <version>9.0.1</version>
<scope>import</scope>
<type>pom</type>
</dependency>
<classifier>features</classifier>
</dependency>
<dependency>
- <groupId>org.opendaylight.odlparent</groupId>
- <artifactId>odl-netty-4</artifactId>
+ <groupId>org.opendaylight.yangtools</groupId>
+ <artifactId>odl-yangtools-netty</artifactId>
<type>xml</type>
<classifier>features</classifier>
</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="[9,10)">odl-netty-4</feature>
- <feature version="[8,9)">odl-mdsal-model-rfc6991</feature>
- <feature version="[2,3)">odl-infrautils-diagstatus</feature>
+ <feature version="[8,9)">odl-yangtools-netty</feature>
+ <feature version="[9,10)">odl-mdsal-model-rfc6991</feature>
+ <feature version="[9,10)">odl-mdsal-model-rfc6991</feature>
+ <feature version="[3,4)">odl-infrautils-diagstatus</feature>
</feature>
</features>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
leaf-list version-bitmap {
type boolean;
+ ordered-by user;
}
}
}
}
leaf-list max_groups {
type uint32;
+ ordered-by user;
+ // FIXME: min-elements = max-elements = 4
}
leaf-list actions-bitmap {
type oft:action-type;
+ ordered-by user;
+ // FIXME: min-elements = max-elements = 4
}
}
}
uses meter-mod;
}
} /* Controller/switch message */
-}
\ No newline at end of file
+}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.api.connection;
import static org.junit.Assert.assertEquals;
-import com.google.common.collect.Lists;
import java.util.List;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.config.rev140630.KeystoreType;
* @author michal.polkorab
*/
public class TlsConfigurationImplTest {
-
/**
* Test correct TlsConfigurationImpl creation.
*/
@Test
public void test() {
- List<String> cipherSuites = Lists.newArrayList("TLS_RSA_WITH_AES_128_CBC_SHA",
- "TLS_RSA_WITH_AES_128_CBC_SHA256");
+ List<String> cipherSuites = List.of("TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA256");
TlsConfigurationImpl config = new TlsConfigurationImpl(KeystoreType.JKS,
"user/dir", PathType.CLASSPATH, KeystoreType.PKCS12, "/var/lib", PathType.PATH, cipherSuites);
assertEquals("Wrong keystore location", "/var/lib", config.getTlsKeystore());
<groupId>org.opendaylight.yangtools</groupId>
<artifactId>yang-common-netty</artifactId>
</dependency>
+ <dependency>
+ <groupId>io.netty</groupId>
+ <artifactId>netty-transport-classes-epoll</artifactId>
+ </dependency>
+
<dependency>
<groupId>io.netty</groupId>
<artifactId>netty-transport-native-epoll</artifactId>
- <!-- Explicitly bring in the linux classifier, test may fail on 32-bit linux -->
- <!--
- FIXME: I don't think this is a good idea. We should be platform-agnostic
- for build, so this works on Mac and others as well.
- x86-64 Linux is tested in CSIT, where this library is present
- -->
<classifier>linux-x86_64</classifier>
+ <scope>test</scope>
</dependency>
</dependencies>
</project>
List<String> suitesList = getTlsConfiguration().getCipherSuites();
if (suitesList != null && !suitesList.isEmpty()) {
LOG.debug("Requested Cipher Suites are: {}", suitesList);
- String[] suites = suitesList.toArray(new String[suitesList.size()]);
- engine.setEnabledCipherSuites(suites);
+ engine.setEnabledCipherSuites(suitesList.toArray(new String[0]));
LOG.debug("Cipher suites enabled in SSLEngine are: {}",
Arrays.toString(engine.getEnabledCipherSuites()));
}
import static com.google.common.base.Preconditions.checkArgument;
import static java.util.Objects.requireNonNull;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.util.concurrent.Future;
// Passed to executor to request triggering of flush
protected final Runnable flushRunnable = this::flush;
+ @SuppressFBWarnings(value = "MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR",
+ justification = "Circular dependency on outbound queue")
AbstractOutboundQueueManager(final ConnectionAdapterImpl parent, final InetSocketAddress address, final T handler) {
this.parent = requireNonNull(parent);
this.handler = requireNonNull(handler);
import com.google.common.util.concurrent.SettableFuture;
import io.netty.util.concurrent.Future;
import io.netty.util.concurrent.GenericFutureListener;
+import org.opendaylight.yangtools.yang.common.ErrorTag;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcError;
-import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
ChannelOutboundQueue.MessageHolder<Object> {
private static final Logger LOG = LoggerFactory.getLogger(AbstractRpcListener.class);
private static final String APPLICATION_TAG = "OPENFLOW_LIBRARY";
- private static final String TAG = "OPENFLOW";
+ private static final ErrorTag TAG = new ErrorTag("OPENFLOW");
private final SettableFuture<RpcResult<T>> result = SettableFuture.create();
private final String failureInfo;
private Object message;
import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+import com.google.common.collect.ImmutableSet;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowRemovedReason;
return inMasks;
}
- private static List<PacketInReason> decodePacketInReasons(long input) {
- List<PacketInReason> reasons = new ArrayList<>();
+ private static Set<PacketInReason> decodePacketInReasons(long input) {
+ final var builder = ImmutableSet.<PacketInReason>builder();
if ((input & 1 << 0) != 0) {
- reasons.add(PacketInReason.OFPRNOMATCH);
+ builder.add(PacketInReason.OFPRNOMATCH);
}
if ((input & 1 << 1) != 0) {
- reasons.add(PacketInReason.OFPRACTION);
+ builder.add(PacketInReason.OFPRACTION);
}
if ((input & 1 << 2) != 0) {
- reasons.add(PacketInReason.OFPRINVALIDTTL);
+ builder.add(PacketInReason.OFPRINVALIDTTL);
}
- return reasons;
+ return builder.build();
}
- private static List<PortReason> decodePortReasons(long input) {
- List<PortReason> reasons = new ArrayList<>();
+ private static Set<PortReason> decodePortReasons(long input) {
+ final var builder = ImmutableSet.<PortReason>builder();
if ((input & 1 << 0) != 0) {
- reasons.add(PortReason.OFPPRADD);
+ builder.add(PortReason.OFPPRADD);
}
if ((input & 1 << 1) != 0) {
- reasons.add(PortReason.OFPPRDELETE);
+ builder.add(PortReason.OFPPRDELETE);
}
if ((input & 1 << 2) != 0) {
- reasons.add(PortReason.OFPPRMODIFY);
+ builder.add(PortReason.OFPPRMODIFY);
}
- return reasons;
+ return builder.build();
}
- private static List<FlowRemovedReason> decodeFlowRemovedReasons(long input) {
- List<FlowRemovedReason> reasons = new ArrayList<>();
+ private static Set<FlowRemovedReason> decodeFlowRemovedReasons(long input) {
+ final var builder = ImmutableSet.<FlowRemovedReason>builder();
if ((input & 1 << 0) != 0) {
- reasons.add(FlowRemovedReason.OFPRRIDLETIMEOUT);
+ builder.add(FlowRemovedReason.OFPRRIDLETIMEOUT);
}
if ((input & 1 << 1) != 0) {
- reasons.add(FlowRemovedReason.OFPRRHARDTIMEOUT);
+ builder.add(FlowRemovedReason.OFPRRHARDTIMEOUT);
}
if ((input & 1 << 2) != 0) {
- reasons.add(FlowRemovedReason.OFPRRDELETE);
+ builder.add(FlowRemovedReason.OFPRRDELETE);
}
if ((input & 1 << 3) != 0) {
- reasons.add(FlowRemovedReason.OFPRRGROUPDELETE);
+ builder.add(FlowRemovedReason.OFPRRGROUPDELETE);
}
- return reasons;
+ return builder.build();
}
}
MultipartReplyGroupFeaturesBuilder featuresBuilder = new MultipartReplyGroupFeaturesBuilder();
featuresBuilder.setTypes(createGroupType(rawMessage.readUnsignedInt()));
featuresBuilder.setCapabilities(createCapabilities(rawMessage.readUnsignedInt()));
- List<Uint32> maxGroupsList = new ArrayList<>();
+ List<Uint32> maxGroupsList = new ArrayList<>(GROUP_TYPES);
for (int i = 0; i < GROUP_TYPES; i++) {
maxGroupsList.add(Uint32.valueOf(rawMessage.readUnsignedInt()));
}
featuresBuilder.setMaxGroups(maxGroupsList);
- List<ActionType> actionBitmaps = new ArrayList<>();
+ List<ActionType> actionBitmaps = new ArrayList<>(GROUP_TYPES);
for (int i = 0; i < GROUP_TYPES; i++) {
actionBitmaps.add(createActionBitmap(rawMessage.readUnsignedInt()));
}
import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+import com.google.common.collect.ImmutableSet;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowRemovedReason;
* @author giuseppex.petralia@intel.com
*/
public class SetAsyncInputMessageFactory implements OFDeserializer<SetAsyncInput> {
-
private static final byte SEPARATE_ROLES = 2;
@Override
}
private static List<PacketInMask> decodePacketInMask(ByteBuf input) {
- List<PacketInMask> inMasks = new ArrayList<>();
+ List<PacketInMask> inMasks = new ArrayList<>(SEPARATE_ROLES);
PacketInMaskBuilder maskBuilder;
for (int i = 0; i < SEPARATE_ROLES; i++) {
maskBuilder = new PacketInMaskBuilder();
return inMasks;
}
- private static List<PacketInReason> decodePacketInReasons(long input) {
- List<PacketInReason> reasons = new ArrayList<>();
+ private static Set<PacketInReason> decodePacketInReasons(long input) {
+ final var builder = ImmutableSet.<PacketInReason>builder();
if ((input & 1 << 0) != 0) {
- reasons.add(PacketInReason.OFPRNOMATCH);
+ builder.add(PacketInReason.OFPRNOMATCH);
}
if ((input & 1 << 1) != 0) {
- reasons.add(PacketInReason.OFPRACTION);
+ builder.add(PacketInReason.OFPRACTION);
}
if ((input & 1 << 2) != 0) {
- reasons.add(PacketInReason.OFPRINVALIDTTL);
+ builder.add(PacketInReason.OFPRINVALIDTTL);
}
- return reasons;
+ return builder.build();
}
private static List<PortStatusMask> decodePortStatusMask(ByteBuf input) {
- List<PortStatusMask> inMasks = new ArrayList<>();
+ List<PortStatusMask> inMasks = new ArrayList<>(SEPARATE_ROLES);
PortStatusMaskBuilder maskBuilder;
for (int i = 0; i < SEPARATE_ROLES; i++) {
maskBuilder = new PortStatusMaskBuilder();
return inMasks;
}
- private static List<PortReason> decodePortReasons(long input) {
- List<PortReason> reasons = new ArrayList<>();
+ private static Set<PortReason> decodePortReasons(long input) {
+ final var builder = ImmutableSet.<PortReason>builder();
if ((input & 1 << 0) != 0) {
- reasons.add(PortReason.OFPPRADD);
+ builder.add(PortReason.OFPPRADD);
}
if ((input & 1 << 1) != 0) {
- reasons.add(PortReason.OFPPRDELETE);
+ builder.add(PortReason.OFPPRDELETE);
}
if ((input & 1 << 2) != 0) {
- reasons.add(PortReason.OFPPRMODIFY);
+ builder.add(PortReason.OFPPRMODIFY);
}
- return reasons;
+ return builder.build();
}
private static List<FlowRemovedMask> decodeFlowRemovedMask(ByteBuf input) {
- List<FlowRemovedMask> inMasks = new ArrayList<>();
+ List<FlowRemovedMask> inMasks = new ArrayList<>(SEPARATE_ROLES);
FlowRemovedMaskBuilder maskBuilder;
for (int i = 0; i < SEPARATE_ROLES; i++) {
maskBuilder = new FlowRemovedMaskBuilder();
return inMasks;
}
- private static List<FlowRemovedReason> decodeFlowRemovedReasons(long input) {
- List<FlowRemovedReason> reasons = new ArrayList<>();
+ private static Set<FlowRemovedReason> decodeFlowRemovedReasons(long input) {
+ final var builder = ImmutableSet.<FlowRemovedReason>builder();
if ((input & 1 << 0) != 0) {
- reasons.add(FlowRemovedReason.OFPRRIDLETIMEOUT);
+ builder.add(FlowRemovedReason.OFPRRIDLETIMEOUT);
}
if ((input & 1 << 1) != 0) {
- reasons.add(FlowRemovedReason.OFPRRHARDTIMEOUT);
+ builder.add(FlowRemovedReason.OFPRRHARDTIMEOUT);
}
if ((input & 1 << 2) != 0) {
- reasons.add(FlowRemovedReason.OFPRRDELETE);
+ builder.add(FlowRemovedReason.OFPRRDELETE);
}
if ((input & 1 << 3) != 0) {
- reasons.add(FlowRemovedReason.OFPRRGROUPDELETE);
+ builder.add(FlowRemovedReason.OFPRRGROUPDELETE);
}
- return reasons;
+ return builder.build();
}
}
package org.opendaylight.openflowjava.protocol.impl.serialization.factories;
import io.netty.buffer.ByteBuf;
+import java.util.Collection;
import java.util.List;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
}
}
- private static void serializeReasons(final List<? extends Enumeration> reasons, final ByteBuf outBuffer) {
+ private static void serializeReasons(final Collection<? extends Enumeration> reasons, final ByteBuf outBuffer) {
if (reasons != null) {
int bitmap = 0;
for (Enumeration reason : reasons) {
package org.opendaylight.openflowjava.protocol.impl.serialization.factories;
import io.netty.buffer.ByteBuf;
+import java.util.Collection;
import java.util.List;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
}
}
- private static void serializeReasons(final List<? extends Enumeration> reasons, final ByteBuf outBuffer) {
+ private static void serializeReasons(final Collection<? extends Enumeration> reasons, final ByteBuf outBuffer) {
if (reasons != null) {
int bitmap = 0;
for (Enumeration reason : reasons) {
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.impl.core;
import static org.junit.Assert.assertNotNull;
-import com.google.common.collect.Lists;
+import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
factory = new ChannelInitializerFactory();
tlsConfiguration = new TlsConfigurationImpl(KeystoreType.JKS, "/exemplary-ctlTrustStore",
PathType.CLASSPATH, KeystoreType.JKS, "/exemplary-ctlKeystore", PathType.CLASSPATH,
- Lists.newArrayList("TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA256"));
+ List.of("TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA256"));
factory.setDeserializationFactory(deserializationFactory);
factory.setSerializationFactory(serializationFactory);
factory.setSwitchConnectionHandler(switchConnectionHandler);
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.impl.core;
import static org.junit.Assert.assertEquals;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
-import com.google.common.collect.Lists;
import io.netty.channel.ChannelHandler;
import io.netty.channel.ChannelPipeline;
import io.netty.channel.group.DefaultChannelGroup;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.UnknownHostException;
+import java.util.List;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
tlsConfiguration = new TlsConfigurationImpl(KeystoreType.JKS, "/selfSignedSwitch", PathType.CLASSPATH,
KeystoreType.JKS, "/selfSignedController", PathType.CLASSPATH,
- Lists.newArrayList("TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA256"));
+ List.of("TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA256"));
}
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
-
package org.opendaylight.openflowjava.protocol.impl.core;
import static org.junit.Assert.assertNotNull;
-import com.google.common.collect.Lists;
+import java.util.List;
import javax.net.ssl.SSLContext;
import org.junit.Before;
import org.junit.Test;
public void setUp() {
tlsConfiguration = new TlsConfigurationImpl(KeystoreType.JKS, "/exemplary-ctlTrustStore",
PathType.CLASSPATH, KeystoreType.JKS, "/exemplary-ctlKeystore", PathType.CLASSPATH,
- Lists.newArrayList("TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA256")) ;
+ List.of("TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA256"));
sslContextFactory = new SslContextFactory(tlsConfiguration);
}
*/
package org.opendaylight.openflowjava.protocol.impl.core.connection;
-import com.google.common.collect.Lists;
import com.google.common.util.concurrent.ListenableFuture;
import java.net.InetAddress;
import java.net.UnknownHostException;
+import java.util.List;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
tlsConfiguration = new TlsConfigurationImpl(KeystoreType.JKS,
"/selfSignedSwitch", PathType.CLASSPATH, KeystoreType.JKS,
"/selfSignedController", PathType.CLASSPATH,
- Lists.newArrayList("TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA256")) ;
+ List.of("TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA256"));
}
config = new ConnectionConfigurationImpl(startupAddress, 0, tlsConfiguration, SWITCH_IDLE_TIMEOUT, true, false,
CHANNEL_OUTBOUND_QUEUE_SIZE);
package org.opendaylight.openflowjava.protocol.impl.core.connection;
-import com.google.common.collect.Lists;
import com.google.common.util.concurrent.ListenableFuture;
import java.net.InetAddress;
import java.net.UnknownHostException;
+import java.util.List;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
tlsConfiguration = new TlsConfigurationImpl(KeystoreType.JKS,
"/selfSignedSwitch", PathType.CLASSPATH, KeystoreType.JKS,
"/selfSignedController", PathType.CLASSPATH,
- Lists.newArrayList("TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA256")) ;
+ List.of("TLS_RSA_WITH_AES_128_CBC_SHA", "TLS_RSA_WITH_AES_128_CBC_SHA256"));
}
config = new ConnectionConfigurationImpl(startupAddress, 0, tlsConfiguration, SWITCH_IDLE_TIMEOUT, true,
false, CHANNEL_OUTBOUND_QUEUE_SIZE);
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
GetAsyncOutput builtByFactory = BufferHelper.deserialize(asyncFactory, bb);
BufferHelper.checkHeaderV13(builtByFactory);
- Assert.assertEquals("Wrong packetInMask",createPacketInMask(), builtByFactory.getPacketInMask());
- Assert.assertEquals("Wrong portStatusMask",createPortStatusMask(), builtByFactory.getPortStatusMask());
- Assert.assertEquals("Wrong flowRemovedMask",createFlowRemovedMask(), builtByFactory.getFlowRemovedMask());
+ Assert.assertEquals("Wrong packetInMask", createPacketInMask(), builtByFactory.getPacketInMask());
+ Assert.assertEquals("Wrong portStatusMask", createPortStatusMask(), builtByFactory.getPortStatusMask());
+ Assert.assertEquals("Wrong flowRemovedMask", createFlowRemovedMask(), builtByFactory.getFlowRemovedMask());
}
private static List<PacketInMask> createPacketInMask() {
- final List<PacketInMask> inMasks = new ArrayList<>();
- PacketInMaskBuilder maskBuilder;
- // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
- maskBuilder = new PacketInMaskBuilder();
- List<PacketInReason> reasons = new ArrayList<>();
- reasons.add(PacketInReason.OFPRNOMATCH);
- reasons.add(PacketInReason.OFPRACTION);
- reasons.add(PacketInReason.OFPRINVALIDTTL);
- maskBuilder.setMask(reasons);
- inMasks.add(maskBuilder.build());
- // OFPCR_ROLE_SLAVE
- maskBuilder = new PacketInMaskBuilder();
- reasons = new ArrayList<>();
- maskBuilder.setMask(reasons);
- inMasks.add(maskBuilder.build());
- return inMasks;
+ return List.of(
+ // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
+ new PacketInMaskBuilder()
+ .setMask(Set.of(PacketInReason.OFPRNOMATCH, PacketInReason.OFPRACTION, PacketInReason.OFPRINVALIDTTL))
+ .build(),
+ // OFPCR_ROLE_SLAVE
+ new PacketInMaskBuilder().setMask(Set.of()).build());
}
private static List<PortStatusMask> createPortStatusMask() {
- final List<PortStatusMask> inMasks = new ArrayList<>();
- PortStatusMaskBuilder maskBuilder;
- // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
- maskBuilder = new PortStatusMaskBuilder();
- List<PortReason> reasons = new ArrayList<>();
- reasons.add(PortReason.OFPPRADD);
- reasons.add(PortReason.OFPPRDELETE);
- reasons.add(PortReason.OFPPRMODIFY);
- inMasks.add(maskBuilder.setMask(reasons).build());
- // OFPCR_ROLE_SLAVE
- maskBuilder = new PortStatusMaskBuilder();
- reasons = new ArrayList<>();
- maskBuilder.setMask(reasons);
- inMasks.add(maskBuilder.build());
- return inMasks;
+ return List.of(
+ // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
+ new PortStatusMaskBuilder()
+ .setMask(Set.of(PortReason.OFPPRADD, PortReason.OFPPRDELETE, PortReason.OFPPRMODIFY))
+ .build(),
+ // OFPCR_ROLE_SLAVE
+ new PortStatusMaskBuilder().setMask(Set.of()).build());
}
private static List<FlowRemovedMask> createFlowRemovedMask() {
- final List<FlowRemovedMask> inMasks = new ArrayList<>();
- FlowRemovedMaskBuilder maskBuilder;
- // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
- maskBuilder = new FlowRemovedMaskBuilder();
- List<FlowRemovedReason> reasons = new ArrayList<>();
- reasons.add(FlowRemovedReason.OFPRRIDLETIMEOUT);
- reasons.add(FlowRemovedReason.OFPRRHARDTIMEOUT);
- reasons.add(FlowRemovedReason.OFPRRDELETE);
- reasons.add(FlowRemovedReason.OFPRRGROUPDELETE);
- maskBuilder.setMask(reasons);
- inMasks.add(maskBuilder.build());
- // OFPCR_ROLE_SLAVE
- maskBuilder = new FlowRemovedMaskBuilder();
- reasons = new ArrayList<>();
- maskBuilder.setMask(reasons);
- inMasks.add(maskBuilder.build());
- return inMasks;
+ return List.of(
+ // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
+ new FlowRemovedMaskBuilder()
+ .setMask(Set.of(
+ FlowRemovedReason.OFPRRIDLETIMEOUT,
+ FlowRemovedReason.OFPRRHARDTIMEOUT,
+ FlowRemovedReason.OFPRRDELETE,
+ FlowRemovedReason.OFPRRGROUPDELETE))
+ .build(),
+ // OFPCR_ROLE_SLAVE
+ new FlowRemovedMaskBuilder().setMask(Set.of()).build());
}
}
package org.opendaylight.openflowjava.protocol.impl.deserialization.factories;
import io.netty.buffer.ByteBuf;
-import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
}
private static List<PacketInMask> createPacketInMask() {
- final List<PacketInMask> masks = new ArrayList<>();
- PacketInMaskBuilder builder;
- // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
- builder = new PacketInMaskBuilder();
- List<PacketInReason> packetInReasonList = new ArrayList<>();
- packetInReasonList.add(PacketInReason.OFPRNOMATCH);
- packetInReasonList.add(PacketInReason.OFPRACTION);
- packetInReasonList.add(PacketInReason.OFPRINVALIDTTL);
- builder.setMask(packetInReasonList);
- masks.add(builder.build());
- // OFPCR_ROLE_SLAVE
- builder = new PacketInMaskBuilder();
- packetInReasonList = new ArrayList<>();
- builder.setMask(packetInReasonList);
- masks.add(builder.build());
- return masks;
+ return List.of(
+ // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
+ new PacketInMaskBuilder()
+ .setMask(Set.of(PacketInReason.OFPRNOMATCH, PacketInReason.OFPRACTION, PacketInReason.OFPRINVALIDTTL))
+ .build(),
+ // OFPCR_ROLE_SLAVE
+ new PacketInMaskBuilder().setMask(Set.of()).build());
}
private static List<PortStatusMask> createPortStatusMask() {
- final List<PortStatusMask> masks = new ArrayList<>();
- PortStatusMaskBuilder builder;
- builder = new PortStatusMaskBuilder();
- // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
- List<PortReason> portReasonList = new ArrayList<>();
- portReasonList.add(PortReason.OFPPRADD);
- portReasonList.add(PortReason.OFPPRDELETE);
- portReasonList.add(PortReason.OFPPRMODIFY);
- builder.setMask(portReasonList);
- masks.add(builder.build());
- // OFPCR_ROLE_SLAVE
- builder = new PortStatusMaskBuilder();
- portReasonList = new ArrayList<>();
- builder.setMask(portReasonList);
- masks.add(builder.build());
- return masks;
+ return List.of(
+ // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
+ new PortStatusMaskBuilder()
+ .setMask(Set.of(PortReason.OFPPRADD, PortReason.OFPPRDELETE, PortReason.OFPPRMODIFY))
+ .build(),
+ // OFPCR_ROLE_SLAVE
+ new PortStatusMaskBuilder().setMask(Set.of()).build());
}
private static List<FlowRemovedMask> createFlowRemowedMask() {
- final List<FlowRemovedMask> masks = new ArrayList<>();
- FlowRemovedMaskBuilder builder;
- // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
- builder = new FlowRemovedMaskBuilder();
- List<FlowRemovedReason> flowRemovedReasonList = new ArrayList<>();
- flowRemovedReasonList.add(FlowRemovedReason.OFPRRIDLETIMEOUT);
- flowRemovedReasonList.add(FlowRemovedReason.OFPRRHARDTIMEOUT);
- flowRemovedReasonList.add(FlowRemovedReason.OFPRRDELETE);
- flowRemovedReasonList.add(FlowRemovedReason.OFPRRGROUPDELETE);
- builder.setMask(flowRemovedReasonList);
- masks.add(builder.build());
- // OFPCR_ROLE_SLAVE
- builder = new FlowRemovedMaskBuilder();
- flowRemovedReasonList = new ArrayList<>();
- builder.setMask(flowRemovedReasonList);
- masks.add(builder.build());
- return masks;
+ return List.of(
+ // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
+ new FlowRemovedMaskBuilder()
+ .setMask(Set.of(
+ FlowRemovedReason.OFPRRIDLETIMEOUT,
+ FlowRemovedReason.OFPRRHARDTIMEOUT,
+ FlowRemovedReason.OFPRRDELETE,
+ FlowRemovedReason.OFPRRGROUPDELETE))
+ .build(),
+ // OFPCR_ROLE_SLAVE
+ new FlowRemovedMaskBuilder().setMask(Set.of()).build());
}
-
}
registry.registerSerializer(key, serializerMock);
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
ser.serialize(actionBuilder.build(), out);
- Mockito.verify(serializerMock, Mockito.times(1)).serialize(Mockito.anyObject(),
- Mockito.anyObject());
+ Mockito.verify(serializerMock, Mockito.times(1)).serialize(Mockito.any(), Mockito.any());
int lenght = out.readableBytes();
Assert.assertEquals("Wrong - bad field code", ActionConstants.SET_FIELD_CODE, out.readUnsignedShort());
Assert.assertEquals("Wrong - bad lenght", lenght, out.readUnsignedShort());
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
}
private static List<PacketInMask> createPacketInMask() {
- final List<PacketInMask> masks = new ArrayList<>();
- PacketInMaskBuilder builder;
- // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
- builder = new PacketInMaskBuilder();
- List<PacketInReason> packetInReasonList = new ArrayList<>();
- packetInReasonList.add(PacketInReason.OFPRNOMATCH);
- packetInReasonList.add(PacketInReason.OFPRACTION);
- packetInReasonList.add(PacketInReason.OFPRINVALIDTTL);
- builder.setMask(packetInReasonList);
- masks.add(builder.build());
- // OFPCR_ROLE_SLAVE
- builder = new PacketInMaskBuilder();
- packetInReasonList = new ArrayList<>();
- builder.setMask(packetInReasonList);
- masks.add(builder.build());
- return masks;
+ return List.of(
+ // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
+ new PacketInMaskBuilder()
+ .setMask(Set.of(PacketInReason.OFPRNOMATCH, PacketInReason.OFPRACTION, PacketInReason.OFPRINVALIDTTL))
+ .build(),
+ // OFPCR_ROLE_SLAVE
+ new PacketInMaskBuilder().setMask(Set.of()).build());
}
private static List<PortStatusMask> createPortStatusMask() {
- final List<PortStatusMask> masks = new ArrayList<>();
- PortStatusMaskBuilder builder;
- builder = new PortStatusMaskBuilder();
- // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
- List<PortReason> portReasonList = new ArrayList<>();
- portReasonList.add(PortReason.OFPPRADD);
- portReasonList.add(PortReason.OFPPRDELETE);
- portReasonList.add(PortReason.OFPPRMODIFY);
- builder.setMask(portReasonList);
- masks.add(builder.build());
- // OFPCR_ROLE_SLAVE
- builder = new PortStatusMaskBuilder();
- portReasonList = new ArrayList<>();
- builder.setMask(portReasonList);
- masks.add(builder.build());
- return masks;
+ return List.of(
+ // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
+ new PortStatusMaskBuilder()
+ .setMask(Set.of(PortReason.OFPPRADD, PortReason.OFPPRDELETE, PortReason.OFPPRMODIFY))
+ .build(),
+ // OFPCR_ROLE_SLAVE
+ new PortStatusMaskBuilder().setMask(Set.of()).build());
}
private static List<FlowRemovedMask> createFlowRemowedMask() {
- final List<FlowRemovedMask> masks = new ArrayList<>();
- FlowRemovedMaskBuilder builder;
- // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
- builder = new FlowRemovedMaskBuilder();
- List<FlowRemovedReason> flowRemovedReasonList = new ArrayList<>();
- flowRemovedReasonList.add(FlowRemovedReason.OFPRRIDLETIMEOUT);
- flowRemovedReasonList.add(FlowRemovedReason.OFPRRHARDTIMEOUT);
- flowRemovedReasonList.add(FlowRemovedReason.OFPRRDELETE);
- flowRemovedReasonList.add(FlowRemovedReason.OFPRRGROUPDELETE);
- builder.setMask(flowRemovedReasonList);
- masks.add(builder.build());
- // OFPCR_ROLE_SLAVE
- builder = new FlowRemovedMaskBuilder();
- flowRemovedReasonList = new ArrayList<>();
- builder.setMask(flowRemovedReasonList);
- masks.add(builder.build());
- return masks;
+ return List.of(
+ // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
+ new FlowRemovedMaskBuilder()
+ .setMask(Set.of(
+ FlowRemovedReason.OFPRRIDLETIMEOUT,
+ FlowRemovedReason.OFPRRHARDTIMEOUT,
+ FlowRemovedReason.OFPRRDELETE,
+ FlowRemovedReason.OFPRRGROUPDELETE))
+ .build(),
+ // OFPCR_ROLE_SLAVE
+ new FlowRemovedMaskBuilder().setMask(Set.of()).build());
}
@Test
import io.netty.buffer.ByteBuf;
import io.netty.buffer.UnpooledByteBufAllocator;
-import java.util.ArrayList;
import java.util.List;
+import java.util.Set;
import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
}
private static List<PacketInMask> createPacketInMask() {
- final List<PacketInMask> masks = new ArrayList<>();
- PacketInMaskBuilder builder;
- // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
- builder = new PacketInMaskBuilder();
- List<PacketInReason> packetInReasonList = new ArrayList<>();
- packetInReasonList.add(PacketInReason.OFPRNOMATCH);
- packetInReasonList.add(PacketInReason.OFPRACTION);
- packetInReasonList.add(PacketInReason.OFPRINVALIDTTL);
- builder.setMask(packetInReasonList);
- masks.add(builder.build());
- // OFPCR_ROLE_SLAVE
- builder = new PacketInMaskBuilder();
- packetInReasonList = new ArrayList<>();
- builder.setMask(packetInReasonList);
- masks.add(builder.build());
- return masks;
+ return List.of(
+ // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
+ new PacketInMaskBuilder()
+ .setMask(Set.of(PacketInReason.OFPRNOMATCH, PacketInReason.OFPRACTION, PacketInReason.OFPRINVALIDTTL))
+ .build(),
+ // OFPCR_ROLE_SLAVE
+ new PacketInMaskBuilder().setMask(Set.of()).build());
}
private static List<PortStatusMask> createPortStatusMask() {
- final List<PortStatusMask> masks = new ArrayList<>();
- PortStatusMaskBuilder builder;
- builder = new PortStatusMaskBuilder();
- // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
- List<PortReason> portReasonList = new ArrayList<>();
- portReasonList.add(PortReason.OFPPRADD);
- portReasonList.add(PortReason.OFPPRDELETE);
- portReasonList.add(PortReason.OFPPRMODIFY);
- builder.setMask(portReasonList);
- masks.add(builder.build());
- // OFPCR_ROLE_SLAVE
- builder = new PortStatusMaskBuilder();
- portReasonList = new ArrayList<>();
- builder.setMask(portReasonList);
- masks.add(builder.build());
- return masks;
+ return List.of(
+ // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
+ new PortStatusMaskBuilder()
+ .setMask(Set.of(PortReason.OFPPRADD, PortReason.OFPPRDELETE, PortReason.OFPPRMODIFY))
+ .build(),
+ // OFPCR_ROLE_SLAVE
+ new PortStatusMaskBuilder().setMask(Set.of()).build());
}
private static List<FlowRemovedMask> createFlowRemowedMask() {
- final List<FlowRemovedMask> masks = new ArrayList<>();
- FlowRemovedMaskBuilder builder;
- // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
- builder = new FlowRemovedMaskBuilder();
- List<FlowRemovedReason> flowRemovedReasonList = new ArrayList<>();
- flowRemovedReasonList.add(FlowRemovedReason.OFPRRIDLETIMEOUT);
- flowRemovedReasonList.add(FlowRemovedReason.OFPRRHARDTIMEOUT);
- flowRemovedReasonList.add(FlowRemovedReason.OFPRRDELETE);
- flowRemovedReasonList.add(FlowRemovedReason.OFPRRGROUPDELETE);
- builder.setMask(flowRemovedReasonList);
- masks.add(builder.build());
- // OFPCR_ROLE_SLAVE
- builder = new FlowRemovedMaskBuilder();
- flowRemovedReasonList = new ArrayList<>();
- builder.setMask(flowRemovedReasonList);
- masks.add(builder.build());
- return masks;
+ return List.of(
+ // OFPCR_ROLE_EQUAL or OFPCR_ROLE_MASTER
+ new FlowRemovedMaskBuilder()
+ .setMask(Set.of(
+ FlowRemovedReason.OFPRRIDLETIMEOUT,
+ FlowRemovedReason.OFPRRHARDTIMEOUT,
+ FlowRemovedReason.OFPRRDELETE,
+ FlowRemovedReason.OFPRRGROUPDELETE))
+ .build(),
+ // OFPCR_ROLE_SLAVE
+ new FlowRemovedMaskBuilder().setMask(Set.of()).build());
}
/**
tlsConfiguration = new TlsConfigurationImpl(KeystoreType.JKS,
"/selfSignedSwitch", PathType.CLASSPATH, KeystoreType.JKS,
"/selfSignedController", PathType.CLASSPATH,
- new ArrayList<String>());
+ List.of());
}
connConfig = new ConnectionConfigurationImpl(startupAddress, 0, tlsConfiguration,
SWITCH_IDLE_TIMEOUT, true, false, CHANNEL_OUTBOUND_QUEUE_SIZE);
leaf-list cipher-suites {
description "combination of cryptographic algorithms used by TLS connection";
type string;
+ ordered-by user;
}
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowCookie;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.Match;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.flow.MatchBuilder;
+import org.opendaylight.yangtools.yang.common.ErrorTag;
import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint32;
import org.opendaylight.yangtools.yang.common.Uint64;
public static final int SIGNUM_UNSIGNED = 1;
/** RpcError application tag. */
- public static final String APPLICATION_TAG = "OPENFLOW_PLUGIN";
- /** RpcError tag - timeout. */
- public static final String ERROR_TAG_TIMEOUT = "TIMOUT";
+ public static final ErrorTag APPLICATION_TAG = new ErrorTag("OPENFLOW_PLUGIN");
/** Persistent ID of OpenFlowPlugin configuration file. */
public static final String CONFIG_FILE_ID = "org.opendaylight.openflowplugin";
<dependencies>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>osgi.core</artifactId>
+ <artifactId>org.osgi.framework</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.service.cm</artifactId>
</dependency>
<dependency>
<groupId>org.opendaylight.openflowplugin</groupId>
<groupId>${project.groupId}.openflowjava</groupId>
<artifactId>openflow-protocol-impl</artifactId>
</dependency>
- <dependency>
- <groupId>org.osgi</groupId>
- <artifactId>osgi.cmpn</artifactId>
- </dependency>
<dependency>
<groupId>org.opendaylight.openflowplugin</groupId>
<artifactId>openflowplugin-common</artifactId>
*/
package org.opendaylight.openflowplugin.impl.common;
-import java.util.ArrayList;
+import com.google.common.collect.ImmutableSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
.reply.body.MultipartReplyGroupFeatures translateGroupFeatures(final MultipartReply msg) {
final MultipartReplyGroupFeatures replyBody = ((MultipartReplyGroupFeaturesCase) msg.getMultipartReplyBody())
.getMultipartReplyGroupFeatures();
- final List<Class<? extends GroupType>> supportedGroups = new ArrayList<>();
- if (replyBody.getTypes().getOFPGTALL()) {
+
+ final var replyTypes = replyBody.getTypes();
+ final var supportedGroups = ImmutableSet.<Class<? extends GroupType>>builder();
+ if (replyTypes.getOFPGTALL()) {
supportedGroups.add(GroupAll.class);
}
- if (replyBody.getTypes().getOFPGTSELECT()) {
+ if (replyTypes.getOFPGTSELECT()) {
supportedGroups.add(GroupSelect.class);
}
- if (replyBody.getTypes().getOFPGTINDIRECT()) {
+ if (replyTypes.getOFPGTINDIRECT()) {
supportedGroups.add(GroupIndirect.class);
}
- if (replyBody.getTypes().getOFPGTFF()) {
+ if (replyTypes.getOFPGTFF()) {
supportedGroups.add(GroupFf.class);
}
- List<Class<? extends GroupCapability>> supportedCapabilities = new ArrayList<>();
- if (replyBody.getCapabilities().getOFPGFCCHAINING()) {
+ final var replyCapabilities = replyBody.getCapabilities();
+ final var supportedCapabilities = ImmutableSet.<Class<? extends GroupCapability>>builder();
+ if (replyCapabilities.getOFPGFCCHAINING()) {
supportedCapabilities.add(Chaining.class);
}
- if (replyBody.getCapabilities().getOFPGFCCHAININGCHECKS()) {
+ if (replyCapabilities.getOFPGFCCHAININGCHECKS()) {
supportedCapabilities.add(ChainingChecks.class);
}
- if (replyBody.getCapabilities().getOFPGFCSELECTLIVENESS()) {
+ if (replyCapabilities.getOFPGFCSELECTLIVENESS()) {
supportedCapabilities.add(SelectLiveness.class);
}
- if (replyBody.getCapabilities().getOFPGFCSELECTWEIGHT()) {
+ if (replyCapabilities.getOFPGFCSELECTWEIGHT()) {
supportedCapabilities.add(SelectWeight.class);
}
return new MultipartReplyGroupFeaturesBuilder()
- .setGroupTypesSupported(supportedGroups)
+ .setGroupTypesSupported(supportedGroups.build())
.setMaxGroups(replyBody.getMaxGroups())
- .setGroupCapabilitiesSupported(supportedCapabilities)
+ .setGroupCapabilitiesSupported(supportedCapabilities.build())
.setActions(GroupUtil.extractGroupActionsSupportBitmap(replyBody.getActionsBitmap()))
.build();
}
MultipartReplyMeterFeaturesCase caseBody = (MultipartReplyMeterFeaturesCase) msg.getMultipartReplyBody();
MultipartReplyMeterFeatures replyBody = caseBody.getMultipartReplyMeterFeatures();
- final List<Class<? extends MeterCapability>> supportedCapabilities = new ArrayList<>();
- if (replyBody.getCapabilities().getOFPMFBURST()) {
+ final var replyCapabilities = replyBody.getCapabilities();
+ final var supportedCapabilities = ImmutableSet.<Class<? extends MeterCapability>>builder();
+ if (replyCapabilities.getOFPMFBURST()) {
supportedCapabilities.add(MeterBurst.class);
}
- if (replyBody.getCapabilities().getOFPMFKBPS()) {
+ if (replyCapabilities.getOFPMFKBPS()) {
supportedCapabilities.add(MeterKbps.class);
}
- if (replyBody.getCapabilities().getOFPMFPKTPS()) {
+ if (replyCapabilities.getOFPMFPKTPS()) {
supportedCapabilities.add(MeterPktps.class);
}
- if (replyBody.getCapabilities().getOFPMFSTATS()) {
+ if (replyCapabilities.getOFPMFSTATS()) {
supportedCapabilities.add(MeterStats.class);
}
- final List<Class<? extends MeterBand>> supportedMeterBand = new ArrayList<>();
- if (replyBody.getBandTypes().getOFPMBTDROP()) {
+ final var replyMeterBand = replyBody.getBandTypes();
+ final var supportedMeterBand = ImmutableSet.<Class<? extends MeterBand>>builder();
+ if (replyMeterBand.getOFPMBTDROP()) {
supportedMeterBand.add(MeterBandDrop.class);
}
- if (replyBody.getBandTypes().getOFPMBTDSCPREMARK()) {
+ if (replyMeterBand.getOFPMBTDSCPREMARK()) {
supportedMeterBand.add(MeterBandDscpRemark.class);
}
.setMaxBands(replyBody.getMaxBands())
.setMaxColor(replyBody.getMaxColor())
.setMaxMeter(new Counter32(replyBody.getMaxMeter()))
- .setMeterCapabilitiesSupported(supportedCapabilities)
- .setMeterBandSupported(supportedMeterBand)
+ .setMeterCapabilitiesSupported(supportedCapabilities.build())
+ .setMeterBandSupported(supportedMeterBand.build())
.build();
}
*/
package org.opendaylight.openflowplugin.impl.device;
-import java.util.ArrayList;
-import java.util.List;
+import com.google.common.collect.ImmutableSet;
import org.opendaylight.openflowplugin.api.openflow.md.core.sal.BuildSwitchFeatures;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FeatureCapability;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowFeatureCapabilityArpMatchIp;
@Override
public SwitchFeatures build(final GetFeaturesOutput features) {
- List<Class<? extends FeatureCapability>> capabilities = new ArrayList<>();
- if (features.getCapabilitiesV10().getOFPCARPMATCHIP()) {
- capabilities.add(FlowFeatureCapabilityArpMatchIp.class);
+ final var capabilities = features.getCapabilitiesV10();
+ if (capabilities == null) {
+ return null;
}
- if (features.getCapabilitiesV10().getOFPCFLOWSTATS()) {
- capabilities.add(FlowFeatureCapabilityFlowStats.class);
+
+ final var builder = ImmutableSet.<Class<? extends FeatureCapability>>builder();
+ if (capabilities.getOFPCARPMATCHIP()) {
+ builder.add(FlowFeatureCapabilityArpMatchIp.class);
+ }
+ if (capabilities.getOFPCFLOWSTATS()) {
+ builder.add(FlowFeatureCapabilityFlowStats.class);
}
- if (features.getCapabilitiesV10().getOFPCIPREASM()) {
- capabilities.add(FlowFeatureCapabilityIpReasm.class);
+ if (capabilities.getOFPCIPREASM()) {
+ builder.add(FlowFeatureCapabilityIpReasm.class);
}
- if (features.getCapabilitiesV10().getOFPCPORTSTATS()) {
- capabilities.add(FlowFeatureCapabilityPortStats.class);
+ if (capabilities.getOFPCPORTSTATS()) {
+ builder.add(FlowFeatureCapabilityPortStats.class);
}
- if (features.getCapabilitiesV10().getOFPCQUEUESTATS()) {
- capabilities.add(FlowFeatureCapabilityQueueStats.class);
+ if (capabilities.getOFPCQUEUESTATS()) {
+ builder.add(FlowFeatureCapabilityQueueStats.class);
}
- if (features.getCapabilitiesV10().getOFPCRESERVED()) {
- capabilities.add(FlowFeatureCapabilityReserved.class);
+ if (capabilities.getOFPCRESERVED()) {
+ builder.add(FlowFeatureCapabilityReserved.class);
}
- if (features.getCapabilitiesV10().getOFPCSTP()) {
- capabilities.add(FlowFeatureCapabilityStp.class);
+ if (capabilities.getOFPCSTP()) {
+ builder.add(FlowFeatureCapabilityStp.class);
}
- if (features.getCapabilitiesV10().getOFPCTABLESTATS()) {
- capabilities.add(FlowFeatureCapabilityTableStats.class);
+ if (capabilities.getOFPCTABLESTATS()) {
+ builder.add(FlowFeatureCapabilityTableStats.class);
}
return new SwitchFeaturesBuilder()
.setMaxBuffers(features.getBuffers())
.setMaxTables(features.getTables())
- .setCapabilities(capabilities)
+ .setCapabilities(builder.build())
.build();
}
}
*/
package org.opendaylight.openflowplugin.impl.device;
-import java.util.ArrayList;
-import java.util.List;
+import com.google.common.collect.ImmutableSet;
import org.opendaylight.openflowplugin.api.openflow.md.core.sal.BuildSwitchFeatures;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FeatureCapability;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowFeatureCapabilityFlowStats;
@Override
public SwitchFeatures build(final GetFeaturesOutput features) {
- List<Class<? extends FeatureCapability>> capabilities = new ArrayList<>();
- if (features.getCapabilities().getOFPCFLOWSTATS()) {
- capabilities.add(FlowFeatureCapabilityFlowStats.class);
+ final var capabilities = features.getCapabilities();
+ if (capabilities == null) {
+ return null;
}
- if (features.getCapabilities().getOFPCGROUPSTATS()) {
- capabilities.add(FlowFeatureCapabilityGroupStats.class);
+
+ final var builder = ImmutableSet.<Class<? extends FeatureCapability>>builder();
+ if (capabilities.getOFPCFLOWSTATS()) {
+ builder.add(FlowFeatureCapabilityFlowStats.class);
+ }
+ if (capabilities.getOFPCGROUPSTATS()) {
+ builder.add(FlowFeatureCapabilityGroupStats.class);
}
- if (features.getCapabilities().getOFPCIPREASM()) {
- capabilities.add(FlowFeatureCapabilityIpReasm.class);
+ if (capabilities.getOFPCIPREASM()) {
+ builder.add(FlowFeatureCapabilityIpReasm.class);
}
- if (features.getCapabilities().getOFPCPORTBLOCKED()) {
- capabilities.add(FlowFeatureCapabilityPortBlocked.class);
+ if (capabilities.getOFPCPORTBLOCKED()) {
+ builder.add(FlowFeatureCapabilityPortBlocked.class);
}
- if (features.getCapabilities().getOFPCPORTSTATS()) {
- capabilities.add(FlowFeatureCapabilityPortStats.class);
+ if (capabilities.getOFPCPORTSTATS()) {
+ builder.add(FlowFeatureCapabilityPortStats.class);
}
- if (features.getCapabilities().getOFPCQUEUESTATS()) {
- capabilities.add(FlowFeatureCapabilityQueueStats.class);
+ if (capabilities.getOFPCQUEUESTATS()) {
+ builder.add(FlowFeatureCapabilityQueueStats.class);
}
- if (features.getCapabilities().getOFPCTABLESTATS()) {
- capabilities.add(FlowFeatureCapabilityTableStats.class);
+ if (capabilities.getOFPCTABLESTATS()) {
+ builder.add(FlowFeatureCapabilityTableStats.class);
}
return new SwitchFeaturesBuilder()
.setMaxBuffers(features.getBuffers())
.setMaxTables(features.getTables())
- .setCapabilities(capabilities)
+ .setCapabilities(builder.build())
.build();
}
}
import static org.opendaylight.openflowplugin.api.OFConstants.OFP_VERSION_1_0;
import static org.opendaylight.openflowplugin.api.OFConstants.OFP_VERSION_1_3;
-import java.util.HashMap;
import java.util.Map;
import org.opendaylight.openflowplugin.api.openflow.md.core.sal.BuildSwitchFeatures;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.flow.node.SwitchFeatures;
import org.slf4j.LoggerFactory;
public final class SwitchFeaturesUtil {
-
private static final Logger LOG = LoggerFactory.getLogger(SwitchFeaturesUtil.class);
- private static SwitchFeaturesUtil instance = new SwitchFeaturesUtil();
- private final Map<Uint8, BuildSwitchFeatures> swFeaturesBuilders;
+ private static final Map<Uint8, BuildSwitchFeatures> SWITCH_FEATURES_BUILDERS = Map.of(
+ OFP_VERSION_1_0, BuildSwitchCapabilitiesOF10.getInstance(),
+ OFP_VERSION_1_3, BuildSwitchCapabilitiesOF13.getInstance());
private SwitchFeaturesUtil() {
- swFeaturesBuilders = new HashMap<>();
- swFeaturesBuilders.put(OFP_VERSION_1_0, BuildSwitchCapabilitiesOF10.getInstance());
- swFeaturesBuilders.put(OFP_VERSION_1_3, BuildSwitchCapabilitiesOF13.getInstance());
- }
-
- /**
- * Get singleton instance.
- *
- * @return instance
- */
- public static SwitchFeaturesUtil getInstance() {
- return instance;
+ // Hidden on purpose
}
/**
* {@link org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetFeaturesOutput}
* @return switch features
*/
- public SwitchFeatures buildSwitchFeatures(final GetFeaturesOutput features) {
- if (swFeaturesBuilders.containsKey(features.getVersion())) {
- LOG.debug("map contains version {}", features.getVersion());
- try {
- return swFeaturesBuilders.get(features.getVersion()).build(features);
- } catch (NullPointerException e) {
- LOG.warn("error while building switch features: {}", e.getMessage());
- LOG.debug("error while building switch features.. ", e);
- }
- } else {
- LOG.warn("unknown version: {}", features.getVersion());
+ public static SwitchFeatures buildSwitchFeatures(final GetFeaturesOutput features) {
+ final var version = features.getVersion();
+ final var builder = SWITCH_FEATURES_BUILDERS.get(version);
+ if (builder != null) {
+ LOG.debug("map contains version {}", version);
+ return builder.build(features);
}
+ LOG.warn("unknown version: {}", version);
return null;
}
}
import com.google.common.util.concurrent.Futures;
import com.google.common.util.concurrent.ListenableFuture;
import com.google.common.util.concurrent.MoreExecutors;
-import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
}
@SuppressWarnings("checkstyle:IllegalCatch")
- @SuppressFBWarnings(value = "UPM_UNCALLED_PRIVATE_METHOD",
- justification = "https://github.com/spotbugs/spotbugs/issues/811")
private static void makeEmptyFlowCapableNode(final TxFacade txFacade, final DeviceInfo deviceInfo) {
try {
txFacade.writeToTransaction(LogicalDatastoreType.OPERATIONAL,
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class ContextChainHolderImpl implements ContextChainHolder, MasterChecker {
+public final class ContextChainHolderImpl implements ContextChainHolder, MasterChecker {
private static final Logger LOG = LoggerFactory.getLogger(ContextChainHolderImpl.class);
private static final Logger OF_EVENT_LOG = LoggerFactory.getLogger("OfEventLog");
this.ownershipChangeListener.setMasterChecker(this);
this.entityOwnershipService = entityOwnershipService;
this.config = config;
- this.eosListenerRegistration = Objects
+ eosListenerRegistration = Objects
.requireNonNull(entityOwnershipService.registerListener(ASYNC_SERVICE_ENTITY_TYPE, this));
}
LOG.warn("Seems like device is still owned by other controller instance. Skip deleting {} "
+ "node from operational datastore.", entityName);
}
- } catch (TimeoutException | ExecutionException | NullPointerException | InterruptedException e) {
+ } catch (TimeoutException | ExecutionException | InterruptedException e) {
LOG.warn("Not able to remove device {} from operational DS. ", entityName, e);
}
}, config.getDeviceDatastoreRemovalDelay().getValue().toJava(), TimeUnit.MILLISECONDS);
import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
+import com.google.common.collect.ImmutableSet;
import io.netty.buffer.ByteBuf;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Set;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
@Override
public MultipartReplyBody deserialize(final ByteBuf message) {
- final MultipartReplyGroupFeaturesBuilder builder = new MultipartReplyGroupFeaturesBuilder();
-
- return builder
+ return new MultipartReplyGroupFeaturesBuilder()
.setGroupTypesSupported(readGroupTypes(message))
.setGroupCapabilitiesSupported(readGroupCapabilities(message))
.setMaxGroups(IntStream.range(0, GROUP_TYPES)
.mapToObj(i -> readUint32(message))
- .collect(Collectors.toList()))
+ .collect(Collectors.toUnmodifiableList()))
.setActions(IntStream.range(0, GROUP_TYPES)
.mapToObj(i -> readUint32(message))
- .collect(Collectors.toList()))
+ .collect(Collectors.toUnmodifiableList()))
.build();
}
- private static List<Class<? extends GroupCapability>> readGroupCapabilities(final ByteBuf message) {
- final List<Class<? extends GroupCapability>> groupCapabilities = new ArrayList<>();
+ private static Set<Class<? extends GroupCapability>> readGroupCapabilities(final ByteBuf message) {
final long capabilitiesMask = message.readUnsignedInt();
- final boolean gcSelectWeight = (capabilitiesMask & 1 << 0) != 0;
- final boolean gcSelectLiveness = (capabilitiesMask & 1 << 1) != 0;
- final boolean gcChaining = (capabilitiesMask & 1 << 2) != 0;
- final boolean gcChainingChecks = (capabilitiesMask & 1 << 3) != 0;
-
- if (gcSelectWeight) {
- groupCapabilities.add(SelectWeight.class);
+ final var builder = ImmutableSet.<Class<? extends GroupCapability>>builder();
+ if ((capabilitiesMask & 1 << 0) != 0) {
+ builder.add(SelectWeight.class);
}
- if (gcSelectLiveness) {
- groupCapabilities.add(SelectLiveness.class);
+ if ((capabilitiesMask & 1 << 1) != 0) {
+ builder.add(SelectLiveness.class);
}
- if (gcChaining) {
- groupCapabilities.add(Chaining.class);
+ if ((capabilitiesMask & 1 << 2) != 0) {
+ builder.add(Chaining.class);
}
- if (gcChainingChecks) {
- groupCapabilities.add(ChainingChecks.class);
+ if ((capabilitiesMask & 1 << 3) != 0) {
+ builder.add(ChainingChecks.class);
}
-
- return groupCapabilities;
+ return builder.build();
}
- private static List<Class<? extends GroupType>> readGroupTypes(final ByteBuf message) {
- final List<Class<? extends GroupType>> groupTypes = new ArrayList<>();
+ private static Set<Class<? extends GroupType>> readGroupTypes(final ByteBuf message) {
final long typesMask = message.readUnsignedInt();
- final boolean gtAll = (typesMask & 1 << 0) != 0;
- final boolean gtSelect = (typesMask & 1 << 1) != 0;
- final boolean gtIndirect = (typesMask & 1 << 2) != 0;
- final boolean gtFF = (typesMask & 1 << 3) != 0;
-
- if (gtAll) {
- groupTypes.add(GroupAll.class);
+ final var builder = ImmutableSet.<Class<? extends GroupType>>builder();
+ if ((typesMask & 1 << 0) != 0) {
+ builder.add(GroupAll.class);
}
- if (gtSelect) {
- groupTypes.add(GroupSelect.class);
+ if ((typesMask & 1 << 1) != 0) {
+ builder.add(GroupSelect.class);
}
- if (gtIndirect) {
- groupTypes.add(GroupIndirect.class);
+ if ((typesMask & 1 << 2) != 0) {
+ builder.add(GroupIndirect.class);
}
- if (gtFF) {
- groupTypes.add(GroupFf.class);
+ if ((typesMask & 1 << 3) != 0) {
+ builder.add(GroupFf.class);
}
-
- return groupTypes;
+ return builder.build();
}
}
import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint32;
import static org.opendaylight.yangtools.yang.common.netty.ByteBufUtils.readUint8;
+import com.google.common.collect.ImmutableSet;
import io.netty.buffer.ByteBuf;
-import java.util.ArrayList;
-import java.util.List;
+import java.util.Set;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Counter32;
import org.opendaylight.yang.gen.v1.urn.opendaylight.meter.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyMeterFeaturesBuilder;
.build();
}
- private static List<Class<? extends MeterBand>> readMeterBands(final ByteBuf message) {
- final List<Class<? extends MeterBand>> bandTypes = new ArrayList<>();
+ private static Set<Class<? extends MeterBand>> readMeterBands(final ByteBuf message) {
final long typesMask = message.readUnsignedInt();
- final boolean mbtDrop = (typesMask & 1) != 0;
- final boolean mbtDscpRemark = (typesMask & 1 << 1) != 0;
- if (mbtDrop) {
+ final var bandTypes = ImmutableSet.<Class<? extends MeterBand>>builder();
+ if ((typesMask & 1) != 0) {
bandTypes.add(MeterBandDrop.class);
}
- if (mbtDscpRemark) {
+ if ((typesMask & 1 << 1) != 0) {
bandTypes.add(MeterBandDscpRemark.class);
}
-
- return bandTypes;
+ return bandTypes.build();
}
- private static List<Class<? extends MeterCapability>> readMeterCapabilities(final ByteBuf message) {
- final List<Class<? extends MeterCapability>> meterCapabilities = new ArrayList<>();
+ private static Set<Class<? extends MeterCapability>> readMeterCapabilities(final ByteBuf message) {
final long capabilitiesMask = message.readUnsignedInt();
- final boolean mfKbps = (capabilitiesMask & 1) != 0;
- final boolean mfPktps = (capabilitiesMask & 1 << 1) != 0;
- final boolean mfBurst = (capabilitiesMask & 1 << 2) != 0;
- final boolean mfStats = (capabilitiesMask & 1 << 3) != 0;
-
- if (mfKbps) {
+ final var meterCapabilities = ImmutableSet.<Class<? extends MeterCapability>>builder();
+ if ((capabilitiesMask & 1) != 0) {
meterCapabilities.add(MeterKbps.class);
}
- if (mfPktps) {
+ if ((capabilitiesMask & 1 << 1) != 0) {
meterCapabilities.add(MeterPktps.class);
}
- if (mfBurst) {
+ if ((capabilitiesMask & 1 << 2) != 0) {
meterCapabilities.add(MeterBurst.class);
}
- if (mfStats) {
+ if ((capabilitiesMask & 1 << 3) != 0) {
meterCapabilities.add(MeterStats.class);
}
- return meterCapabilities;
+ return meterCapabilities.build();
}
-
}
import org.opendaylight.openflowplugin.api.openflow.device.handlers.MultiMsgCollector;
import org.opendaylight.openflowplugin.api.openflow.statistics.ofpspecific.EventIdentifier;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
setResult(RpcResultBuilder
.<List<T>>failed()
- .withError(RpcError.ErrorType.APPLICATION,
+ .withError(ErrorType.APPLICATION,
String.format("Unexpected response type received: %s.", result.getClass()))
.build());
} else {
package org.opendaylight.openflowplugin.impl.services;
import com.google.common.util.concurrent.Service;
+import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.util.Collections;
import java.util.List;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.MultipartType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public abstract class AbstractMultipartRequestOnTheFlyCallback<T extends OfHeader>
extends AbstractMultipartRequestCallback<T> {
private static final Logger LOG = LoggerFactory.getLogger(AbstractMultipartRequestOnTheFlyCallback.class);
+
private final DeviceInfo deviceInfo;
private final EventIdentifier doneEventIdentifier;
private final TxFacade txFacade;
private final MultipartWriterProvider statisticsWriterProvider;
private final DeviceRegistry deviceRegistry;
- private volatile Service.State gatheringState = Service.State.NEW;
private final ConvertorExecutor convertorExecutor;
- public AbstractMultipartRequestOnTheFlyCallback(final RequestContext<List<T>> context, Class<?> requestType,
+ private volatile Service.State gatheringState = Service.State.NEW;
+
+ @SuppressFBWarnings(value = "MC_OVERRIDABLE_METHOD_CALL_IN_CONSTRUCTOR",
+ justification = "getMultipartType() should be okay to call")
+ public AbstractMultipartRequestOnTheFlyCallback(final RequestContext<List<T>> context, final Class<?> requestType,
final DeviceContext deviceContext,
final EventIdentifier eventIdentifier,
final MultipartWriterProvider statisticsWriterProvider,
if (!isMultipart(result)) {
LOG.warn("Unexpected response type received: {}.", result.getClass());
- setResult(RpcResultBuilder.<List<T>>failed().withError(RpcError.ErrorType.APPLICATION,
+ setResult(RpcResultBuilder.<List<T>>failed().withError(ErrorType.APPLICATION,
String.format("Unexpected response type received: %s.", result.getClass())).build());
endCollecting(false);
} else {
});
} catch (final Exception ex) {
LOG.warn("Unexpected exception occurred while translating response: {}.", result.getClass(), ex);
- setResult(RpcResultBuilder.<List<T>>failed().withError(RpcError.ErrorType.APPLICATION,
+ setResult(RpcResultBuilder.<List<T>>failed().withError(ErrorType.APPLICATION,
String.format("Unexpected exception occurred while translating response: %s. %s",
result.getClass(),
ex)).build());
import org.opendaylight.openflowplugin.impl.statistics.ofpspecific.EventsTimeCounter;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.Error;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
err.getTypeString(),
err.getCodeString());
- builder = RpcResultBuilder.<T>failed().withError(RpcError.ErrorType.APPLICATION, errorString, throwable);
+ builder = RpcResultBuilder.<T>failed().withError(ErrorType.APPLICATION, errorString, throwable);
spyMessage(StatisticsGroup.TO_SWITCH_SUBMIT_FAILURE);
} else {
if (throwable != null) {
builder = RpcResultBuilder.<T>failed()
- .withError(RpcError.ErrorType.APPLICATION, throwable.getMessage(), throwable);
+ .withError(ErrorType.APPLICATION, throwable.getMessage(), throwable);
} else {
Throwable deviceReadFailedThrowable = new Throwable("Failed to read from device.");
builder = RpcResultBuilder.<T>failed()
- .withError(RpcError.ErrorType.APPLICATION, deviceReadFailedThrowable.getMessage(),
+ .withError(ErrorType.APPLICATION, deviceReadFailedThrowable.getMessage(),
deviceReadFailedThrowable);
}
spyMessage(StatisticsGroup.TO_SWITCH_SUBMIT_ERROR);
import org.opendaylight.openflowplugin.impl.services.util.ServiceException;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
import org.opendaylight.yangtools.yang.binding.DataContainer;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorTag;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
this.eventIdentifier = eventIdentifier;
}
- public Uint8 getVersion() {
+ public final Uint8 getVersion() {
return version;
}
- public Uint64 getDatapathId() {
+ public final Uint64 getDatapathId() {
return datapathId;
}
getMessageSpy().spyMessage(AbstractService.class, MessageSpy.StatisticsGroup.TO_SWITCH_DISREGARDED);
return Futures.immediateFuture(RpcResultBuilder
.<O>failed()
- .withError(RpcError.ErrorType.APPLICATION, "", "Request quota exceeded")
+ .withError(ErrorType.APPLICATION, ErrorTag.ACCESS_DENIED, "Request quota exceeded")
.build());
}
package org.opendaylight.openflowplugin.impl.services.multilayer;
+import static java.util.Objects.requireNonNull;
+
import com.google.common.base.MoreObjects;
-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;
super(requestContextStack, deviceContext);
this.convertorExecutor = convertorExecutor;
this.translatorLibrary = translatorLibrary;
- this.data = new VersionConvertorData(getVersion());
+ data = new VersionConvertorData(getVersion());
}
final GetAggregateFlowStatisticsFromFlowTableForGivenMatchInput input) {
return Futures.transform(handleServiceCall(input),
result -> {
- if (Preconditions.checkNotNull(result).isSuccessful()) {
+ if (requireNonNull(result).isSuccessful()) {
final MessageTranslator<MultipartReply, AggregatedFlowStatistics>
messageTranslator = translatorLibrary.lookupTranslator(
new TranslatorKey(getVersion(),
multipartReply,
getDeviceInfo(),
null))
- .collect(Collectors
- .toList())))
+ .collect(Collectors.toList()))
+ .build())
.build();
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.MultipartRequestExperimenterCaseBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.experimenter._case.MultipartRequestExperimenterBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.experimenter.types.rev151020.experimenter.core.message.ExperimenterMessageOfChoice;
-import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
import org.opendaylight.yangtools.yang.binding.DataObject;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
for (RpcResult<O> flowModResult : results) {
if (flowModResult == null) {
errors.add(RpcResultBuilder.newError(
- RpcError.ErrorType.PROTOCOL, OFConstants.APPLICATION_TAG,
+ ErrorType.PROTOCOL, OFConstants.APPLICATION_TAG,
"unexpected flowMod result (null) occurred"));
} else if (!flowModResult.isSuccessful()) {
errors.addAll(flowModResult.getErrors());
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.service.rev131026.UpdateTableOutputBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.TableFeatures;
import org.opendaylight.yangtools.yang.binding.util.BindingMap;
-import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
public SalAsyncConfigServiceImpl(final RequestContextStack requestContextStack, final DeviceContext deviceContext) {
setAsyncConfigService = new SingleLayerSetAsyncConfigService(requestContextStack, deviceContext);
- this.getAsyncConfigService = new SingleLayerGetAsyncConfigService(requestContextStack, deviceContext);
+ getAsyncConfigService = new SingleLayerGetAsyncConfigService(requestContextStack, deviceContext);
}
@Override
- public ListenableFuture<RpcResult<SetAsyncOutput>> setAsync(SetAsyncInput input) {
+ public ListenableFuture<RpcResult<SetAsyncOutput>> setAsync(final SetAsyncInput input) {
return setAsyncConfigService.handleServiceCall(input);
}
@Override
- public ListenableFuture<RpcResult<GetAsyncOutput>> getAsync(GetAsyncInput input) {
+ public ListenableFuture<RpcResult<GetAsyncOutput>> getAsync(final GetAsyncInput input) {
return Futures.transform(getAsyncConfigService.handleServiceCall(input), result ->
result != null && result.isSuccessful()
- ? RpcResultBuilder.success(new GetAsyncOutputBuilder(result.getResult())).build()
+ ? RpcResultBuilder.success(new GetAsyncOutputBuilder(result.getResult()).build()).build()
: RpcResultBuilder.<GetAsyncOutput>failed().build(),
MoreExecutors.directExecutor());
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.BundleControlSalBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.bundle.add.message.sal.SalAddMessageDataBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.bundle.control.sal.SalControlDataBuilder;
+import org.opendaylight.yangtools.yang.common.ErrorTag;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
}
@Override
- public ListenableFuture<RpcResult<ControlBundleOutput>> controlBundle(ControlBundleInput input) {
+ public ListenableFuture<RpcResult<ControlBundleOutput>> controlBundle(final ControlBundleInput input) {
LOG.debug("Control message for device {} and bundle type {}", input.getNode(), input.getType());
final SendExperimenterInputBuilder experimenterInputBuilder = new SendExperimenterInputBuilder();
experimenterInputBuilder.setNode(input.getNode());
}
@Override
- public ListenableFuture<RpcResult<AddBundleMessagesOutput>> addBundleMessages(AddBundleMessagesInput input) {
+ public ListenableFuture<RpcResult<AddBundleMessagesOutput>> addBundleMessages(final AddBundleMessagesInput input) {
final List<ListenableFuture<RpcResult<SendExperimenterOutput>>> partialResults = new ArrayList<>();
final SendExperimenterInputBuilder experimenterInputBuilder = new SendExperimenterInputBuilder();
final BundleAddMessageSalBuilder bundleAddMessageBuilder = new BundleAddMessageSalBuilder();
Futures.addCallback(Futures.successfulAsList(partialResults),new FutureCallback<
List<RpcResult<SendExperimenterOutput>>>() {
@Override
- public void onSuccess(List<RpcResult<SendExperimenterOutput>> results) {
+ public void onSuccess(final List<RpcResult<SendExperimenterOutput>> results) {
final ArrayList<RpcError> errors = new ArrayList<>();
final RpcResultBuilder<AddBundleMessagesOutput> rpcResultBuilder;
for (RpcResult<SendExperimenterOutput> res : results) {
if (res == null) {
- errors.add(RpcResultBuilder.newError(RpcError.ErrorType.APPLICATION, "BundleExtensionService",
- "RpcResult is null."));
+ // FIXME: this should never happen
+ errors.add(RpcResultBuilder.newError(ErrorType.APPLICATION,
+ new ErrorTag("BundleExtensionService"), "RpcResult is null."));
} else if (!res.isSuccessful()) {
errors.addAll(res.getErrors());
}
}
@Override
- public void onFailure(Throwable throwable) {
+ public void onFailure(final Throwable throwable) {
RpcResultBuilder<AddBundleMessagesOutput> rpcResultBuilder = RpcResultBuilder.failed();
result.set(rpcResultBuilder.build());
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.service.rev130819.flow.update.UpdatedFlow;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.FlowRef;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowModInputBuilder;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
for (RpcResult<UpdateFlowOutput> flowModResult : results) {
if (flowModResult == null) {
errors.add(RpcResultBuilder.newError(
- RpcError.ErrorType.PROTOCOL, OFConstants.APPLICATION_TAG,
+ ErrorType.PROTOCOL, OFConstants.APPLICATION_TAG,
"unexpected flowMod result (null) occurred"));
} else if (!flowModResult.isSuccessful()) {
errors.addAll(flowModResult.getErrors());
new AggregatedFlowStatisticsBuilder(
(MultipartReplyFlowAggregateStats) multipartReplyBody)
.build())
- .collect(Collectors.toList())))
+ .collect(Collectors.toList()))
+ .build())
.build();
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.experimenter.types.rev151020.multipart.reply.multipart.reply.body.MultipartReplyExperimenter;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.experimenter.types.rev151020.multipart.request.multipart.request.body.MultipartRequestExperimenterBuilder;
-import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multipart.reply.multipart.reply.body.MultipartReplyTableFeatures;
import org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.multipart.request.multipart.request.body.MultipartRequestTableFeaturesBuilder;
import org.opendaylight.yangtools.yang.binding.util.BindingMap;
-import org.opendaylight.yangtools.yang.common.RpcError.ErrorType;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint64;
import com.google.common.util.concurrent.ListenableFuture;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContext;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorTag;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
final RequestContext<T> requestContext,
final String errorMessage) {
RpcResultBuilder<T> rpcResultBuilder = RpcResultBuilder.<T>failed().withRpcError(RpcResultBuilder
- .newError(RpcError.ErrorType.APPLICATION, "", errorMessage));
+ .newError(ErrorType.APPLICATION, ErrorTag.OPERATION_FAILED, errorMessage));
requestContext.setResult(rpcResultBuilder.build());
closeRequestContext(requestContext);
return requestContext.getFuture();
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.StatisticsManagerControlService;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.openflowplugin.sm.control.rev150812.StatisticsWorkMode;
import org.opendaylight.yangtools.concepts.ObjectRegistration;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class StatisticsManagerImpl implements StatisticsManager, StatisticsManagerControlService {
+public final class StatisticsManagerImpl implements StatisticsManager, StatisticsManagerControlService {
private static final Logger LOG = LoggerFactory.getLogger(StatisticsManagerImpl.class);
final ConvertorExecutor convertorExecutor,
@NonNull final Executor executor) {
this.config = config;
- this.converterExecutor = convertorExecutor;
- this.controlServiceRegistration = requireNonNull(rpcProviderRegistry
- .registerRpcImplementation(StatisticsManagerControlService.class, this));
this.executor = executor;
+ converterExecutor = convertorExecutor;
+ controlServiceRegistration = requireNonNull(rpcProviderRegistry)
+ .registerRpcImplementation(StatisticsManagerControlService.class, this);
}
@Override
}
return RpcResultBuilder.<ChangeStatisticsWorkModeOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION,
- "Statistics work mode change is already in progress")
+ .withError(ErrorType.APPLICATION, "Statistics work mode change is already in progress")
.buildFuture();
}
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
-import java.util.ArrayList;
+import com.google.common.collect.ImmutableSet;
import java.util.List;
+import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
}
@VisibleForTesting
- static List<Class<? extends GroupCapability>> extractSupportedCapabilities(final GroupCapabilities capabilities) {
- List<Class<? extends GroupCapability>> supportedCapabilities = new ArrayList<>();
+ static Set<Class<? extends GroupCapability>> extractSupportedCapabilities(final GroupCapabilities capabilities) {
+ final var builder = ImmutableSet.<Class<? extends GroupCapability>>builder();
if (capabilities.getOFPGFCCHAINING()) {
- supportedCapabilities.add(Chaining.class);
+ builder.add(Chaining.class);
}
if (capabilities.getOFPGFCCHAININGCHECKS()) {
- supportedCapabilities.add(ChainingChecks.class);
+ builder.add(ChainingChecks.class);
}
if (capabilities.getOFPGFCSELECTLIVENESS()) {
- supportedCapabilities.add(SelectLiveness.class);
+ builder.add(SelectLiveness.class);
}
if (capabilities.getOFPGFCSELECTWEIGHT()) {
- supportedCapabilities.add(SelectWeight.class);
+ builder.add(SelectWeight.class);
}
- return supportedCapabilities;
+ return builder.build();
}
@VisibleForTesting
- static List<Class<? extends GroupType>> extractSupportedGroupTypes(final GroupTypes types) {
- List<Class<? extends GroupType>> supportedGroups = new ArrayList<>();
+ static Set<Class<? extends GroupType>> extractSupportedGroupTypes(final GroupTypes types) {
+ final var builder = ImmutableSet.<Class<? extends GroupType>>builder();
if (types.getOFPGTALL()) {
- supportedGroups.add(GroupAll.class);
+ builder.add(GroupAll.class);
}
if (types.getOFPGTSELECT()) {
- supportedGroups.add(GroupSelect.class);
+ builder.add(GroupSelect.class);
}
if (types.getOFPGTINDIRECT()) {
- supportedGroups.add(GroupIndirect.class);
+ builder.add(GroupIndirect.class);
}
if (types.getOFPGTFF()) {
- supportedGroups.add(GroupFf.class);
+ builder.add(GroupFf.class);
}
- return supportedGroups;
+ return builder.build();
}
}
import com.google.common.annotations.VisibleForTesting;
import com.google.common.base.Preconditions;
-import java.util.ArrayList;
+import com.google.common.collect.ImmutableSet;
import java.util.List;
+import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
import org.opendaylight.openflowplugin.api.openflow.device.DeviceContext;
import org.opendaylight.openflowplugin.api.openflow.device.RequestContextStack;
}
@VisibleForTesting
- protected static List<Class<? extends MeterBand>> extractSupportedMeterBand(
+ protected static Set<Class<? extends MeterBand>> extractSupportedMeterBand(
final MultipartReplyMeterFeatures replyBody, final MeterBandTypeBitmap bandTypes) {
- List<Class<? extends MeterBand>> supportedMeterBand = new ArrayList<>();
+ final var supportedMeterBand = ImmutableSet.<Class<? extends MeterBand>>builder();
if (bandTypes.getOFPMBTDROP()) {
supportedMeterBand.add(MeterBandDrop.class);
}
if (replyBody.getBandTypes().getOFPMBTDSCPREMARK()) {
supportedMeterBand.add(MeterBandDscpRemark.class);
}
- return supportedMeterBand;
+ return supportedMeterBand.build();
}
@VisibleForTesting
- protected static List<Class<? extends MeterCapability>> extractMeterCapabilities(final MeterFlags capabilities) {
- List<Class<? extends MeterCapability>> supportedCapabilities = new ArrayList<>();
-
+ protected static Set<Class<? extends MeterCapability>> extractMeterCapabilities(final MeterFlags capabilities) {
+ final var supportedCapabilities = ImmutableSet.<Class<? extends MeterCapability>>builder();
if (capabilities.getOFPMFBURST()) {
supportedCapabilities.add(MeterBurst.class);
}
if (capabilities.getOFPMFSTATS()) {
supportedCapabilities.add(MeterStats.class);
}
- return supportedCapabilities;
+ return supportedCapabilities.build();
}
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.GetQueueStatisticsOutput;
import org.opendaylight.yang.gen.v1.urn.opendaylight.direct.statistics.rev160511.OpendaylightDirectStatisticsService;
import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
private static <T extends DataObject> ListenableFuture<RpcResult<T>> missingImplementation(Class service) {
return RpcResultBuilder.<T>failed().withError(
- RpcError.ErrorType.APPLICATION,
+ ErrorType.APPLICATION,
String.format("No implementation found for direct statistics service %s.", service.getCanonicalName()))
.buildFuture();
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.flow._case.MultipartRequestFlowBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
-public class FlowDirectStatisticsService extends AbstractFlowDirectStatisticsService<MultipartReply> {
-
+public final class FlowDirectStatisticsService extends AbstractFlowDirectStatisticsService<MultipartReply> {
private final FlowStatsResponseConvertorData data;
public FlowDirectStatisticsService(final RequestContextStack requestContextStack,
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.multipart.request.multipart.request.body.multipart.request.group._case.MultipartRequestGroupBuilder;
import org.opendaylight.yangtools.yang.binding.util.BindingMap;
-public class GroupDirectStatisticsService extends AbstractGroupDirectStatisticsService<MultipartReply> {
-
+public final class GroupDirectStatisticsService extends AbstractGroupDirectStatisticsService<MultipartReply> {
private final VersionConvertorData data;
public GroupDirectStatisticsService(final RequestContextStack requestContextStack,
* @return switch features
*/
public static SwitchFeatures getSwitchFeatures(final ConnectionContext connectionContext) {
- return SwitchFeaturesUtil
- .getInstance()
- .buildSwitchFeatures(new GetFeaturesOutputBuilder(connectionContext
- .getFeatures())
- .build());
+ return SwitchFeaturesUtil.buildSwitchFeatures(new GetFeaturesOutputBuilder(connectionContext.getFeatures())
+ .build());
}
private static @Nullable InetSocketAddress getRemoteAddress(final ConnectionContext connectionContext,
*/
package org.opendaylight.openflowplugin.impl.device;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
import org.junit.After;
-import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.Capabilities;
* @author jsebin
*/
public class SwitchFeaturesUtilTest {
-
private GetFeaturesOutputBuilder featuresOutputBuilder;
- private SwitchFeaturesUtil swUtil;
-
/**
* Initialization of
@Before
public void setUp() {
featuresOutputBuilder = new GetFeaturesOutputBuilder();
- swUtil = SwitchFeaturesUtil.getInstance();
}
@After
public void tearDown() {
featuresOutputBuilder = null;
- swUtil = null;
}
/**
CapabilitiesV10 capabilities = new CapabilitiesV10(true, false, true, false, true, false, true, false);
featuresOutputBuilder.setCapabilitiesV10(capabilities).setVersion(Uint8.ONE);
- Assert.assertNotNull(swUtil.buildSwitchFeatures(featuresOutputBuilder.build()));
+ assertNotNull(SwitchFeaturesUtil.buildSwitchFeatures(featuresOutputBuilder.build()));
}
/**
Capabilities capabilities = new Capabilities(true, false, true, false, true, false, true);
featuresOutputBuilder.setCapabilities(capabilities).setCapabilitiesV10(null).setVersion(Uint8.valueOf(4));
- Assert.assertNotNull(swUtil.buildSwitchFeatures(featuresOutputBuilder.build()));
+ assertNotNull(SwitchFeaturesUtil.buildSwitchFeatures(featuresOutputBuilder.build()));
}
/**
CapabilitiesV10 capabilities = new CapabilitiesV10(true, false, true, false, true, false, true, null);
featuresOutputBuilder.setCapabilitiesV10(capabilities).setCapabilities(null).setVersion(Uint8.ONE);
- Assert.assertNull(swUtil.buildSwitchFeatures(featuresOutputBuilder.build()));
+ assertNull(SwitchFeaturesUtil.buildSwitchFeatures(featuresOutputBuilder.build()));
}
/**
CapabilitiesV10 capabilities = new CapabilitiesV10(true, false, true, false, true, false, true, false);
featuresOutputBuilder.setCapabilitiesV10(capabilities).setCapabilities(null).setVersion(Uint8.valueOf(4));
- Assert.assertNull(swUtil.buildSwitchFeatures(featuresOutputBuilder.build()));
+ assertNull(SwitchFeaturesUtil.buildSwitchFeatures(featuresOutputBuilder.build()));
}
/**
CapabilitiesV10 capabilities = new CapabilitiesV10(true, false, true, false, true, false, true, false);
featuresOutputBuilder.setCapabilitiesV10(capabilities).setCapabilities(null).setVersion(Uint8.ZERO);
- Assert.assertNull(swUtil.buildSwitchFeatures(featuresOutputBuilder.build()));
+ assertNull(SwitchFeaturesUtil.buildSwitchFeatures(featuresOutputBuilder.build()));
}
}
public void testOnTransactionChainSuccessful() {
txChainManager.onTransactionChainSuccessful(transactionChain);
// NOOP
- Mockito.verifyZeroInteractions(transactionChain);
+ Mockito.verifyNoInteractions(transactionChain);
}
@Test
import io.netty.buffer.UnpooledByteBufAllocator;
import java.util.Arrays;
import java.util.List;
+import java.util.Set;
import org.junit.Test;
import org.opendaylight.openflowjava.util.ByteBufUtils;
import org.opendaylight.yang.gen.v1.urn.opendaylight.group.statistics.rev131111.multipart.reply.multipart.reply.body.MultipartReplyGroupFeatures;
assertTrue(reply.getActions().containsAll(ACTIONS_LIST));
assertTrue(reply.getMaxGroups().containsAll(MAX_GROUPS_LIST));
- assertEquals(GROUP_TYPES_SUPPORTED.size(), reply.getGroupTypesSupported().size());
- assertEquals(GroupAll.class, reply.getGroupTypesSupported().get(0));
- assertEquals(GroupSelect.class, reply.getGroupTypesSupported().get(1));
- assertEquals(GroupIndirect.class, reply.getGroupTypesSupported().get(2));
-
- assertEquals(GROUP_CAPABILITIES_SUPPORTED.size(), reply.getGroupCapabilitiesSupported().size());
- assertEquals(Chaining.class, reply.getGroupCapabilitiesSupported().get(0));
- assertEquals(ChainingChecks.class, reply.getGroupCapabilitiesSupported().get(1));
+ assertEquals(Set.of(GroupAll.class, GroupSelect.class, GroupIndirect.class), reply.getGroupTypesSupported());
+ assertEquals(Set.of(Chaining.class, ChainingChecks.class), reply.getGroupCapabilitiesSupported());
assertEquals(0, buffer.readableBytes());
}
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.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcError;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
multipartRequestOnTheFlyCallback.onSuccess(mockedHelloMessage);
final RpcResult<List<MultipartReply>> expectedRpcResult =
- RpcResultBuilder.<List<MultipartReply>>failed().withError(RpcError.ErrorType.APPLICATION,
+ RpcResultBuilder.<List<MultipartReply>>failed().withError(ErrorType.APPLICATION,
String.format("Unexpected response type received: %s.", mockedHelloMessage.getClass())).build();
final RpcResult<List<MultipartReply>> actualResult = dummyRequestContext.getFuture().get();
assertNotNull(actualResult.getErrors());
assertEquals(actualError.getMessage(),
String.format("Unexpected response type received: %s.",
mockedHelloMessage.getClass()));
- assertEquals(actualError.getErrorType(),RpcError.ErrorType.APPLICATION);
+ assertEquals(actualError.getErrorType(), ErrorType.APPLICATION);
assertEquals(expectedRpcResult.getResult(), actualResult.getResult());
assertEquals(expectedRpcResult.isSuccessful(), actualResult.isSuccessful());
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.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint16;
@Test
public void testCreateBatchFlowChainingFunction_failures() {
final RpcResult<BatchFlowOutputListGrouping> input = RpcResultBuilder.<BatchFlowOutputListGrouping>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ut-flowError")
+ .withError(ErrorType.APPLICATION, "ut-flowError")
.withResult(new AddFlowsBatchOutputBuilder()
.setBatchFailedFlowsOutput(BindingMap.ordered(
createBatchFailedFlowsOutput(Uint16.ZERO, "f1"),
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.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint16;
@Test
public void testCreateBatchGroupChainingFunction_failures() {
final RpcResult<BatchGroupOutputListGrouping> input = RpcResultBuilder.<BatchGroupOutputListGrouping>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ut-groupError")
+ .withError(ErrorType.APPLICATION, "ut-groupError")
.withResult(new AddGroupsBatchOutputBuilder()
.setBatchFailedGroupsOutput(BindingMap.ordered(
createBatchFailedGroupsOutput(Uint16.ZERO, Uint32.ONE),
import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.remove.meters.batch.input.BatchRemoveMeters;
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.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint16;
@Test
public void testCreateBatchMeterChainingFunction_failures() {
final RpcResult<BatchMeterOutputListGrouping> input = RpcResultBuilder.<BatchMeterOutputListGrouping>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ut-meterError")
+ .withError(ErrorType.APPLICATION, "ut-meterError")
.withResult(new AddMetersBatchOutputBuilder()
.setBatchFailedMetersOutput(BindingMap.ordered(
createBatchFailedMetersOutput(Uint16.ZERO, Uint32.ONE),
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.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint16;
.setFlowId(new FlowId("123"))
.build()))
.build())
- .withError(RpcError.ErrorType.APPLICATION, "ut-firstFlowAddError")
+ .withError(ErrorType.APPLICATION, "ut-firstFlowAddError")
.buildFuture());
Mockito.when(salFlowsBatchService.updateFlowsBatch(ArgumentMatchers.any()))
.thenReturn(RpcResultBuilder.success(new UpdateFlowsBatchOutputBuilder().build()).buildFuture());
FlatBatchUtil.createEmptyRpcBatchResultFuture(true);
final ListenableFuture<RpcResult<ProcessFlatBatchOutput>> failedChainOutput =
RpcResultBuilder.<ProcessFlatBatchOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ut-chainError")
+ .withError(ErrorType.APPLICATION, "ut-chainError")
.withResult(createFlatBatchOutput(createFlowBatchFailure(Uint16.ZERO, "f1"),
createFlowBatchFailure(Uint16.ONE, "f2")))
.buildFuture();
.setFlowId(new FlowId("f2"))
.build()))
.build())
- .withError(RpcError.ErrorType.APPLICATION, "ut-addFlowBatchError")
+ .withError(ErrorType.APPLICATION, "ut-addFlowBatchError")
.buildFuture());
final Future<RpcResult<ProcessFlatBatchOutput>> rpcResultFuture =
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.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint16;
public void testRemoveFlowsBatch_failed() throws Exception {
Mockito.when(salFlowService.removeFlow(ArgumentMatchers.any()))
.thenReturn(RpcResultBuilder.<RemoveFlowOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION, "flow-remove-fail-1")
+ .withError(ErrorType.APPLICATION, "flow-remove-fail-1")
.buildFuture());
final BatchRemoveFlows batchFlow1 = createEmptyBatchRemoveFlow(FLOW_ID_VALUE_1, 42);
public void testAddFlowsBatch_failed() throws Exception {
Mockito.when(salFlowService.addFlow(ArgumentMatchers.any()))
.thenReturn(RpcResultBuilder
- .<AddFlowOutput>failed().withError(RpcError.ErrorType.APPLICATION, "ut-groupAddError")
+ .<AddFlowOutput>failed().withError(ErrorType.APPLICATION, "ut-groupAddError")
.buildFuture());
final AddFlowsBatchInput input = new AddFlowsBatchInputBuilder()
public void testUpdateFlowsBatch_failure() throws Exception {
Mockito.when(salFlowService.updateFlow(ArgumentMatchers.any()))
.thenReturn(RpcResultBuilder.<UpdateFlowOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ut-flowUpdateError")
+ .withError(ErrorType.APPLICATION, "ut-flowUpdateError")
.buildFuture());
final UpdateFlowsBatchInput input = new UpdateFlowsBatchInputBuilder()
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.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
public void testUpdateGroupsBatch_failure() throws Exception {
Mockito.when(salGroupService.updateGroup(Mockito.any()))
.thenReturn(RpcResultBuilder.<UpdateGroupOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ur-groupUpdateError")
+ .withError(ErrorType.APPLICATION, "ur-groupUpdateError")
.buildFuture());
final UpdateGroupsBatchInput input = new UpdateGroupsBatchInputBuilder()
public void testAddGroupsBatch_failure() throws Exception {
Mockito.when(salGroupService.addGroup(Mockito.any()))
.thenReturn(RpcResultBuilder.<AddGroupOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ut-groupAddError")
+ .withError(ErrorType.APPLICATION, "ut-groupAddError")
.buildFuture());
final AddGroupsBatchInput input = new AddGroupsBatchInputBuilder()
public void testRemoveGroupsBatch_failure() throws Exception {
Mockito.when(salGroupService.removeGroup(Mockito.any()))
.thenReturn(RpcResultBuilder.<RemoveGroupOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ut-groupRemoveError")
+ .withError(ErrorType.APPLICATION, "ut-groupRemoveError")
.buildFuture());
final RemoveGroupsBatchInput input = new RemoveGroupsBatchInputBuilder()
import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.update.meters.batch.input.BatchUpdateMetersBuilder;
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.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint32;
public void testUpdateMetersBatch_failure() throws Exception {
Mockito.when(salMeterService.updateMeter(Mockito.any()))
.thenReturn(RpcResultBuilder.<UpdateMeterOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ur-groupUpdateError")
+ .withError(ErrorType.APPLICATION, "ur-groupUpdateError")
.buildFuture());
final UpdateMetersBatchInput input = new UpdateMetersBatchInputBuilder()
public void testAddMetersBatch_failure() throws Exception {
Mockito.when(salMeterService.addMeter(Mockito.any()))
.thenReturn(RpcResultBuilder.<AddMeterOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ut-groupAddError")
+ .withError(ErrorType.APPLICATION, "ut-groupAddError")
.buildFuture());
final AddMetersBatchInput input = new AddMetersBatchInputBuilder()
public void testRemoveMetersBatch_failure() throws Exception {
Mockito.when(salMeterService.removeMeter(Mockito.any()))
.thenReturn(RpcResultBuilder.<RemoveMeterOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ut-groupRemoveError")
+ .withError(ErrorType.APPLICATION, "ut-groupRemoveError")
.buildFuture());
final RemoveMetersBatchInput input = new RemoveMetersBatchInputBuilder()
import org.opendaylight.yang.gen.v1.urn.opendaylight.flat.batch.service.rev160321.process.flat.batch.output.BatchFailureKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowId;
import org.opendaylight.yangtools.yang.binding.util.BindingMap;
-import org.opendaylight.yangtools.yang.common.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint16;
= new ProcessFlatBatchOutputBuilder().setBatchFailure(BindingMap.of(batchFailure_1)).build();
final RpcResult<ProcessFlatBatchOutput> rpcResultFailed = RpcResultBuilder.<ProcessFlatBatchOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ut-rpcError")
+ .withError(ErrorType.APPLICATION, "ut-rpcError")
.withResult(output).build();
final RpcResult<ProcessFlatBatchOutput> rpcResultFailed_1 = RpcResultBuilder.<ProcessFlatBatchOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ut-rpcError")
+ .withError(ErrorType.APPLICATION, "ut-rpcError")
.withResult(output_1).build();
final RpcResult<ProcessFlatBatchOutput> rpcResultSuccess = RpcResultBuilder.<ProcessFlatBatchOutput>success()
- .withResult(new ProcessFlatBatchOutputBuilder().setBatchFailure(Map.of())).build();
+ .withResult(new ProcessFlatBatchOutputBuilder().setBatchFailure(Map.of()).build()).build();
final RpcResult<ProcessFlatBatchOutput> rpcResult1
= FlatBatchUtil.mergeRpcResults().apply(Lists.newArrayList(rpcResultFailed, rpcResultSuccess));
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.RpcError;
+import org.opendaylight.yangtools.yang.common.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint16;
final RpcResult<List<BatchFailedFlowsOutput>> summary = function.apply(Lists.newArrayList(
RpcResultBuilder.success("a").build(),
RpcResultBuilder.<String>failed()
- .withError(RpcError.ErrorType.APPLICATION, "action-failed reason")
+ .withError(ErrorType.APPLICATION, "action-failed reason")
.build()));
Assert.assertFalse(summary.isSuccessful());
private static RpcResult<List<BatchFailedFlowsOutput>> createBatchOutcomeWithError() {
return RpcResultBuilder.<List<BatchFailedFlowsOutput>>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ut-flowAddFail")
+ .withError(ErrorType.APPLICATION, "ut-flowAddFail")
.withResult(Collections.singletonList(new BatchFailedFlowsOutputBuilder()
.setFlowId(DUMMY_FLOW_ID)
.setBatchOrder(Uint16.ZERO)
private static RpcResult<SendBarrierOutput> createBarrierFailureOutcome() {
return RpcResultBuilder.<SendBarrierOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ut-barrier-error")
+ .withError(ErrorType.APPLICATION, "ut-barrier-error")
.build();
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ActionType;
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.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint16;
final RpcResult<List<BatchFailedGroupsOutput>> summary = function.apply(Lists.newArrayList(
RpcResultBuilder.success("a").build(),
RpcResultBuilder.<String>failed()
- .withError(RpcError.ErrorType.APPLICATION, "action-failed reason")
+ .withError(ErrorType.APPLICATION, "action-failed reason")
.build()));
Assert.assertFalse(summary.isSuccessful());
private static RpcResult<List<BatchFailedGroupsOutput>> createBatchOutcomeWithError() {
return RpcResultBuilder.<List<BatchFailedGroupsOutput>>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ut-flowAddFail")
- .withResult(Collections.singletonList(new BatchFailedGroupsOutputBuilder()
+ .withError(ErrorType.APPLICATION, "ut-flowAddFail")
+ .withResult(List.of(new BatchFailedGroupsOutputBuilder()
.setBatchOrder(Uint16.ZERO)
.setGroupId(DUMMY_GROUP_ID)
.build()))
private static RpcResult<SendBarrierOutput> createBarrierFailureOutcome() {
return RpcResultBuilder.<SendBarrierOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ut-barrier-error")
+ .withError(ErrorType.APPLICATION, "ut-barrier-error")
.build();
}
import org.opendaylight.yang.gen.v1.urn.opendaylight.meters.service.rev160316.batch.meter.output.list.grouping.BatchFailedMetersOutputKey;
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.ErrorType;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
import org.opendaylight.yangtools.yang.common.Uint16;
final RpcResult<List<BatchFailedMetersOutput>> output = function.apply(Lists.newArrayList(
RpcResultBuilder.success("a").build(),
RpcResultBuilder.<String>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ut-meter-error")
+ .withError(ErrorType.APPLICATION, "ut-meter-error")
.build()));
Assert.assertFalse(output.isSuccessful());
private static RpcResult<List<BatchFailedMetersOutput>> createBatchOutcomeWithError() {
return RpcResultBuilder.<List<BatchFailedMetersOutput>>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ut-flowAddFail")
- .withResult(Collections.singletonList(new BatchFailedMetersOutputBuilder()
+ .withError(ErrorType.APPLICATION, "ut-flowAddFail")
+ .withResult(List.of(new BatchFailedMetersOutputBuilder()
.setBatchOrder(Uint16.ZERO)
.setMeterId(DUMMY_METER_ID)
.build()))
private static RpcResult<SendBarrierOutput> createBarrierFailureOutcome() {
return RpcResultBuilder.<SendBarrierOutput>failed()
- .withError(RpcError.ErrorType.APPLICATION, "ut-barrier-error")
+ .withError(ErrorType.APPLICATION, "ut-barrier-error")
.build();
}
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import java.util.Map;
import org.opendaylight.openflowplugin.openflow.md.core.sal.convertor.common.Convertor;
final org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.features.table.features
.TableProperties tableProperties) {
if (tableProperties == null) {
- return Collections.emptyList();
+ return List.of();
}
List<TableFeatureProperties> ofTablePropertiesList = new ArrayList<>();
setSetFieldTableFeatureProperty(
propBuilder,
TableFeaturesPropType.OFPTFPTAPPLYSETFIELDMISS,
- setFieldMatch == null ? Collections.emptyMap() : setFieldMatch);
+ setFieldMatch == null ? Map.of() : setFieldMatch);
}
private static void setTableFeatureProperty(final ApplySetfield propType,
setSetFieldTableFeatureProperty(
propBuilder,
TableFeaturesPropType.OFPTFPTAPPLYSETFIELD,
- setFieldMatch == null ? Collections.emptyMap() : setFieldMatch);
+ setFieldMatch == null ? Map.of() : setFieldMatch);
}
private static void setTableFeatureProperty(final WriteSetfieldMiss propType,
setSetFieldTableFeatureProperty(
propBuilder,
TableFeaturesPropType.OFPTFPTWRITESETFIELDMISS,
- setFieldMatch == null ? Collections.emptyMap() : setFieldMatch);
+ setFieldMatch == null ? Map.of() : setFieldMatch);
}
private static void setTableFeatureProperty(final WriteSetfield propType,
setSetFieldTableFeatureProperty(
propBuilder,
TableFeaturesPropType.OFPTFPTWRITESETFIELD,
- setFieldMatch == null ? Collections.emptyMap() : setFieldMatch);
+ setFieldMatch == null ? Map.of() : setFieldMatch);
}
private static void setTableFeatureProperty(final Wildcards propType,
setSetFieldTableFeatureProperty(
propBuilder,
TableFeaturesPropType.OFPTFPTWILDCARDS,
- setFieldMatch == null ? Collections.emptyMap() : setFieldMatch);
+ setFieldMatch == null ? Map.of() : setFieldMatch);
}
private static void setTableFeatureProperty(final Match propType, final TableFeaturePropertiesBuilder propBuilder) {
setSetFieldTableFeatureProperty(
propBuilder,
TableFeaturesPropType.OFPTFPTMATCH,
- setFieldMatch == null ? Collections.emptyMap() : setFieldMatch);
+ setFieldMatch == null ? Map.of() : setFieldMatch);
}
private static void setTableFeatureProperty(final ApplyActionsMiss propType,
setActionTableFeatureProperty(
propBuilder,
TableFeaturesPropType.OFPTFPTAPPLYACTIONSMISS,
- applyActionsMiss == null ? Collections.emptyMap() : applyActionsMiss.nonnullAction());
+ applyActionsMiss == null ? Map.of() : applyActionsMiss.nonnullAction());
}
private static void setTableFeatureProperty(final ApplyActions propType,
setActionTableFeatureProperty(
propBuilder,
TableFeaturesPropType.OFPTFPTAPPLYACTIONS,
- applyActions == null ? Collections.emptyMap() : applyActions.nonnullAction());
+ applyActions == null ? Map.of() : applyActions.nonnullAction());
}
private static void setTableFeatureProperty(final WriteActionsMiss propType,
setActionTableFeatureProperty(
propBuilder,
TableFeaturesPropType.OFPTFPTWRITEACTIONSMISS,
- writeActionsMiss == null ? Collections.emptyMap() : writeActionsMiss.nonnullAction());
+ writeActionsMiss == null ? Map.of() : writeActionsMiss.nonnullAction());
}
private static void setTableFeatureProperty(final WriteActions propType,
setActionTableFeatureProperty(
propBuilder,
TableFeaturesPropType.OFPTFPTWRITEACTIONS,
- writeActions == null ? Collections.emptyMap() : writeActions.nonnullAction());
+ writeActions == null ? Map.of() : writeActions.nonnullAction());
}
private static void setTableFeatureProperty(final NextTableMiss propType,
org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop
.type.instructions.miss.InstructionsMiss instructions = propType.getInstructionsMiss();
setInstructionTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTINSTRUCTIONSMISS,
- instructions == null ? Collections.emptyMap() : instructions.nonnullInstruction());
+ instructions == null ? Map.of() : instructions.nonnullInstruction());
}
private static void setTableFeatureProperty(final Instructions propType,
org.opendaylight.yang.gen.v1.urn.opendaylight.table.types.rev131026.table.feature.prop.type.table.feature.prop
.type.instructions.Instructions instructions = propType.getInstructions();
setInstructionTableFeatureProperty(propBuilder, TableFeaturesPropType.OFPTFPTINSTRUCTIONS,
- instructions == null ? Collections.emptyMap() : instructions.nonnullInstruction());
+ instructions == null ? Map.of() : instructions.nonnullInstruction());
}
private static void setInstructionTableFeatureProperty(final TableFeaturePropertiesBuilder builder,
List<NextTableIds> nextTableIdsList = new ArrayList<>();
for (Uint8 tableId : tableIds) {
- NextTableIdsBuilder nextTableId = new NextTableIdsBuilder();
- nextTableId.setTableId(tableId);
- nextTableIdsList.add(nextTableId.build());
+ nextTableIdsList.add(new NextTableIdsBuilder().setTableId(tableId).build());
}
builder.setType(type).addAugmentation(new NextTableRelatedTableFeaturePropertyBuilder()
<parent>
<groupId>org.opendaylight.mdsal</groupId>
<artifactId>binding-parent</artifactId>
- <version>8.0.11</version>
+ <version>9.0.1</version>
<relativePath/>
</parent>
<dependency>
<groupId>org.opendaylight.controller</groupId>
<artifactId>controller-artifacts</artifactId>
- <version>4.0.10</version>
+ <version>5.0.1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.opendaylight.infrautils</groupId>
<artifactId>infrautils-artifacts</artifactId>
- <version>2.0.13</version>
+ <version>3.0.0</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<parent>
<groupId>org.opendaylight.odlparent</groupId>
<artifactId>odlparent-lite</artifactId>
- <version>9.0.13</version>
+ <version>10.0.0</version>
<relativePath/>
</parent>
</dependency>
<dependency>
<groupId>org.osgi</groupId>
- <artifactId>osgi.cmpn</artifactId>
+ <artifactId>org.osgi.framework</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.service.component.annotations</artifactId>
</dependency>
</dependencies>