X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=southbound%2Fsouthbound-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fovsdb%2Fsouthbound%2FOvsdbConnectionManager.java;h=be0ab7e042d9ef6c1d09cc0371b522b788a421b4;hb=b9626b60a7758c39f0fe181df8a6619f5b79191c;hp=ae517a06e978d7daef264ff6defee94d0f687d75;hpb=50e7f939993fa9da3c80a1c8d166629a4868af9c;p=ovsdb.git diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManager.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManager.java index ae517a06e..be0ab7e04 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManager.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbConnectionManager.java @@ -14,6 +14,8 @@ import com.google.common.base.Preconditions; import com.google.common.util.concurrent.CheckedFuture; import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.Futures; + +import java.net.ConnectException; import java.net.InetAddress; import java.net.UnknownHostException; import java.util.ArrayList; @@ -71,6 +73,7 @@ public class OvsdbConnectionManager implements OvsdbConnectionListener, AutoClos new ConcurrentHashMap<>(); private static final Logger LOG = LoggerFactory.getLogger(OvsdbConnectionManager.class); private static final String ENTITY_TYPE = "ovsdb"; + private static final int DB_FETCH_TIMEOUT = 1000; private DataBroker db; private TransactionInvoker txInvoker; @@ -104,7 +107,7 @@ public class OvsdbConnectionManager implements OvsdbConnectionListener, AutoClos externalClient.getConnectionInfo().getLocalPort()); List databases = new ArrayList<>(); try { - databases = externalClient.getDatabases().get(1000, TimeUnit.MILLISECONDS); + databases = externalClient.getDatabases().get(DB_FETCH_TIMEOUT, TimeUnit.MILLISECONDS); if (databases.contains(SouthboundConstants.OPEN_V_SWITCH)) { OvsdbConnectionInstance client = connectedButCallBacksNotRegistered(externalClient); // Register Cluster Ownership for ConnectionInfo @@ -185,7 +188,7 @@ public class OvsdbConnectionManager implements OvsdbConnectionListener, AutoClos } public OvsdbClient connect(InstanceIdentifier iid, - OvsdbNodeAugmentation ovsdbNode) throws UnknownHostException { + OvsdbNodeAugmentation ovsdbNode) throws UnknownHostException, ConnectException { LOG.info("Connecting to {}", SouthboundUtil.connectionInfoToString(ovsdbNode.getConnectionInfo())); // TODO handle case where we already have a connection @@ -246,7 +249,7 @@ public class OvsdbConnectionManager implements OvsdbConnectionListener, AutoClos ovsdbDeviceEntityOwnershipListener.close(); } - for (OvsdbClient client: clients.values()) { + for (OvsdbConnectionInstance client: clients.values()) { client.disconnect(); } } @@ -311,28 +314,28 @@ public class OvsdbConnectionManager implements OvsdbConnectionListener, AutoClos LogicalDatastoreType.OPERATIONAL, nodePath); transaction.close(); Optional optional = nodeFuture.get(); - if (optional != null && optional.isPresent() && optional.get() != null) { + if (optional.isPresent()) { return this.getConnectionInstance(optional.get()); } else { - LOG.warn("Found non-topological node {} on path {}",optional); + LOG.debug("Node was not found on the path in the operational DS: {}", nodePath); return null; } - } catch (Exception e) { + } catch (InterruptedException | ExecutionException e) { LOG.warn("Failed to get Ovsdb Node {}",nodePath, e); return null; } } public OvsdbClient getClient(ConnectionInfo connectionInfo) { - return getConnectionInstance(connectionInfo); + return getConnectionInstance(connectionInfo).getOvsdbClient(); } public OvsdbClient getClient(OvsdbBridgeAttributes mn) { - return getConnectionInstance(mn); + return getConnectionInstance(mn).getOvsdbClient(); } public OvsdbClient getClient(Node node) { - return getConnectionInstance(node); + return getConnectionInstance(node).getOvsdbClient(); } public Boolean getHasDeviceOwnership(ConnectionInfo connectionInfo) { @@ -365,6 +368,7 @@ public class OvsdbConnectionManager implements OvsdbConnectionListener, AutoClos iid, null); reconciliationManager.dequeue(task); + reconciliationManager.cancelTerminationPointReconciliation(); } private void handleOwnershipChanged(EntityOwnershipChange ownershipChange) { @@ -468,10 +472,10 @@ public class OvsdbConnectionManager implements OvsdbConnectionListener, AutoClos DatabaseSchema dbSchema = null; OpenVSwitch openVSwitchRow = null; try { - dbSchema = connectionInstance.getSchema(OvsdbSchemaContants.databaseName).get(); + dbSchema = connectionInstance.getSchema(OvsdbSchemaContants.DATABASE_NAME).get(); } catch (InterruptedException | ExecutionException e) { LOG.warn("Not able to fetch schema for database {} from device {}", - OvsdbSchemaContants.databaseName,connectionInstance.getConnectionInfo(),e); + OvsdbSchemaContants.DATABASE_NAME,connectionInstance.getConnectionInfo(),e); } if (dbSchema != null) { GenericTableSchema openVSwitchSchema = TyperUtils.getTableSchema(dbSchema, OpenVSwitch.class);