public void run() {
for (OvsdbClient client : clientFutureMap.keySet()) {
Future<?> clientFuture = clientFutureMap.get(client);
- if ( !clientFuture.isDone() && !clientFuture.isCancelled()) {
+ if (!clientFuture.isDone() && !clientFuture.isCancelled()) {
clientFuture.cancel(true);
}
if (client.isActive()) {
Catch the IOException and close the channel. Similarly if the peer is
powered off, Catch the read time out exception and close the channel
*/
- if ((cause instanceof IOException ) || (cause instanceof ReadTimeoutException)) {
+ if ((cause instanceof IOException) || (cause instanceof ReadTimeoutException)) {
LOG.info("Closing channel to ovsdb {}", ctx.channel());
ctx.channel().close();
return;
@Override
public void run() {
CallContext cc = methodContext.remove(request.getId());
- if ( cc != null) {
- if ( cc.getFuture().isDone() || cc.getFuture().isCancelled()) {
+ if (cc != null) {
+ if (cc.getFuture().isDone() || cc.getFuture().isCancelled()) {
return;
}
cc.getFuture().cancel(false);
public void registerCallbacks(InstanceIdentifierCodec instanceIdentifierCodec) {
if (this.callback == null) {
- if (this.initialCreateData != null ) {
+ if (this.initialCreateData != null) {
this.updateConnectionAttributes(instanceIdentifierCodec);
}
LOG.debug("Update attributes of ovsdb node ip: {} port: {}",
this.initialCreateData.getConnectionInfo().getRemoteIp(),
this.initialCreateData.getConnectionInfo().getRemotePort());
- for ( Map.Entry<DatabaseSchema,TransactInvoker> entry: transactInvokers.entrySet()) {
+ for (Map.Entry<DatabaseSchema,TransactInvoker> entry: transactInvokers.entrySet()) {
TransactionBuilder transaction = new TransactionBuilder(this.client, entry.getKey());
return this.connectedEntity;
}
- public void setConnectedEntity(Entity entity ) {
+ public void setConnectedEntity(Entity entity) {
this.connectedEntity = entity;
}
operations.add(op.comment("Fetching Open_VSwitch table rows"));
try {
List<OperationResult> results = connectionInstance.transact(dbSchema, operations).get();
- if (results != null ) {
+ if (results != null) {
OperationResult selectResult = results.get(0);
openVSwitchRow = TyperUtils.getTypedRowWrapper(
dbSchema,OpenVSwitch.class,selectResult.getRows().get(0));
private Entity getEntityFromConnectionInstance(@Nonnull OvsdbConnectionInstance ovsdbConnectionInstance) {
InstanceIdentifier<Node> iid = ovsdbConnectionInstance.getInstanceIdentifier();
- if ( iid == null ) {
+ if (iid == null) {
/* Switch initiated connection won't have iid, till it gets OpenVSwitch
* table update but update callback is always registered after ownership
* is granted. So we are explicitly fetch the row here to get the iid.
*/
ON_DISCONNECT
}
-}
\ No newline at end of file
+}
OvsdbNodeAugmentation ovsdbNode = ovsdbNodeModification.getDataAfter();
ConnectionInfo key = ovsdbNode.getConnectionInfo();
InstanceIdentifier<Node> iid = cm.getInstanceIdentifier(key);
- if ( iid != null) {
+ if (iid != null) {
LOG.warn("Connection to device {} already exists. Plugin does not allow multiple connections "
+ "to same device, hence dropping the request {}", key, ovsdbNode);
} else {
* multi threaded and i don't see any need to further parallelism per DataChange
* notifications processing.
*/
- if ( cm.getHasDeviceOwnership(client.getMDConnectionInfo())) {
+ if (cm.getHasDeviceOwnership(client.getMDConnectionInfo())) {
LOG.debug("*This* instance of southbound plugin is an owner of the device {}", node);
result.computeIfAbsent(client, key -> new ArrayList<>()).add(change);
} else {
bridge, updatedControllerRows);
final Set<UUID> controllerUuids = bridge.getControllerColumn().getData();
final List<ControllerEntry> controllerEntries = new ArrayList<>();
- for (UUID controllerUuid : controllerUuids ) {
+ for (UUID controllerUuid : controllerUuids) {
final Controller controller = updatedControllerRows.get(controllerUuid);
addControllerEntries(controllerEntries, controller);
}
private void setFailMode(Bridge bridge,
OvsdbBridgeAugmentation ovsdbManagedNode) {
if (ovsdbManagedNode.getFailMode() != null
- && SouthboundConstants.OVSDB_FAIL_MODE_MAP.get(ovsdbManagedNode.getFailMode()) != null ) {
+ && SouthboundConstants.OVSDB_FAIL_MODE_MAP.get(ovsdbManagedNode.getFailMode()) != null) {
bridge.setFailMode(Sets.newHashSet(
SouthboundConstants.OVSDB_FAIL_MODE_MAP.get(ovsdbManagedNode.getFailMode())));
}
.build());
}
-}
\ No newline at end of file
+}
tpChanges.add(node);
} else if (node.getKey().getNodeId().getValue().startsWith(
nodeIid.firstKeyOf(Node.class).getNodeId().getValue())
- && node.getTerminationPoint() != null && !node.getTerminationPoint().isEmpty() ) {
+ && node.getTerminationPoint() != null && !node.getTerminationPoint().isEmpty()) {
tpChanges.add(node);
}
}
@Override
public void execute(ReadWriteTransaction transaction) {
final InstanceIdentifier<Node> connectionIId = getOvsdbConnectionInstance().getInstanceIdentifier();
- if ( (portUpdatedRows == null && interfaceOldRows == null )
- || ( interfaceOldRows.isEmpty() && portUpdatedRows.isEmpty())) {
+ if ((portUpdatedRows == null && interfaceOldRows == null)
+ || (interfaceOldRows.isEmpty() && portUpdatedRows.isEmpty())) {
return;
}
Optional<Node> node = readNode(transaction, connectionIId);
portName = portUpdate.getValue().getNameColumn().getData();
Optional<InstanceIdentifier<Node>> bridgeIid = getTerminationPointBridge(portUpdate.getKey());
if (!bridgeIid.isPresent()) {
- bridgeIid = getTerminationPointBridge( transaction, node, portName);
+ bridgeIid = getTerminationPointBridge(transaction, node, portName);
}
if (bridgeIid.isPresent()) {
NodeId bridgeId = SouthboundMapper.createManagedNodeId(bridgeIid.get());
for (Entry<UUID, Interface> interfaceUpdate : interfaceUpdatedRows.entrySet()) {
String interfaceName = null;
interfaceName = interfaceUpdatedRows.get(interfaceUpdate.getKey()).getNameColumn().getData();
- Optional<InstanceIdentifier<Node>> bridgeIid = getTerminationPointBridge( transaction, node, interfaceName);
+ Optional<InstanceIdentifier<Node>> bridgeIid = getTerminationPointBridge(transaction, node, interfaceName);
if (bridgeIid.isPresent()) {
TerminationPointKey tpKey = new TerminationPointKey(new TpId(interfaceName));
TerminationPointBuilder tpBuilder = new TerminationPointBuilder();
OvsdbNodeAugmentation ovsdbNode = node.getAugmentation(OvsdbNodeAugmentation.class);
List<ManagedNodeEntry> managedNodes = ovsdbNode.getManagedNodeEntry();
TpId tpId = new TpId(tpName);
- for ( ManagedNodeEntry managedNodeEntry : managedNodes ) {
+ for (ManagedNodeEntry managedNodeEntry : managedNodes) {
Node managedNode = readNode(transaction,
(InstanceIdentifier<Node>)managedNodeEntry.getBridgeRef().getValue()).get();
for (TerminationPoint tpEntry : managedNode.getTerminationPoint()) {
private Map<ReadWriteTransaction,TransactionCommand> transactionToCommand
= new HashMap<>();
private List<ReadWriteTransaction> pendingTransactions = new ArrayList<>();
- private final AtomicBoolean runTask = new AtomicBoolean( true );
+ private final AtomicBoolean runTask = new AtomicBoolean(true);
public TransactionInvokerImpl(DataBroker db) {
this.db = db;
when(TransactUtils.extractRemoved(changes, OvsdbBridgeAugmentation.class)).thenReturn(removed);
when(TransactUtils.extractOriginal(changes, OvsdbBridgeAugmentation.class)).thenReturn(originals);
- TransactionBuilder transaction = mock( TransactionBuilder.class, Mockito.RETURNS_MOCKS);
+ TransactionBuilder transaction = mock(TransactionBuilder.class, Mockito.RETURNS_MOCKS);
briRemovedCmd.execute(transaction, mock(BridgeOperationalState.class), changes,
mock(InstanceIdentifierCodec.class));
when(TransactUtils.extractCreated(changes, OvsdbBridgeAugmentation.class)).thenReturn(created);
when(TransactUtils.extractUpdated(changes, OvsdbBridgeAugmentation.class)).thenReturn(updated);
- TransactionBuilder transaction = mock( TransactionBuilder.class, Mockito.RETURNS_MOCKS);
+ TransactionBuilder transaction = mock(TransactionBuilder.class, Mockito.RETURNS_MOCKS);
briUpdatedCmd.execute(transaction, mock(BridgeOperationalState.class), changes,
mock(InstanceIdentifierCodec.class));
when(TransactUtils.extractCreated(changes, ControllerEntry.class)).thenReturn(controllers);
when(TransactUtils.extractUpdated(changes, OvsdbBridgeAugmentation.class)).thenReturn(bridges);
- TransactionBuilder transaction = mock( TransactionBuilder.class, Mockito.RETURNS_MOCKS);
+ TransactionBuilder transaction = mock(TransactionBuilder.class, Mockito.RETURNS_MOCKS);
contUpdateCmd.execute(transaction, mock(BridgeOperationalState.class), changes,
mock(InstanceIdentifierCodec.class));
OpenVSwitch openVSwitch = mock(OpenVSwitch.class);
Column<GenericTableSchema, Set<String>> column = mock(Column.class);
- when(openVSwitch.getIfaceTypesColumn()).thenReturn(column );
+ when(openVSwitch.getIfaceTypesColumn()).thenReturn(column);
Set<String> set = new HashSet<>();
set.add("dpdk");
set.add("dpdkr");
public void testSetDataPathTypes() throws Exception {
OpenVSwitch openVSwitch = mock(OpenVSwitch.class);
Column<GenericTableSchema, Set<String>> column = mock(Column.class);
- when(openVSwitch.getDatapathTypesColumn()).thenReturn(column );
+ when(openVSwitch.getDatapathTypesColumn()).thenReturn(column);
Set<String> set = new HashSet<>();
set.add("netdev");
set.add("system");
verify(ovsdbNodeBuilder).setDbVersion(anyString());
verify(openVSwitch).getDbVersionColumn();
}
-}
\ No newline at end of file
+}
when(ovsdbConnectionAugmentationBuilder.setManagedNodeEntry(any(List.class)))
.thenReturn(ovsdbConnectionAugmentationBuilder);
- when(ovsdbConnectionAugmentationBuilder.build()).thenReturn(mock(OvsdbNodeAugmentation.class) );
+ when(ovsdbConnectionAugmentationBuilder.build()).thenReturn(mock(OvsdbNodeAugmentation.class));
when(connectionNode.addAugmentation(eq(OvsdbNodeAugmentation.class), any(OvsdbNodeAugmentation.class)))
.thenReturn(connectionNode);