BUG 5885 - OVSDB plugin failure to update passive ovsdb nodes 48/39548/3
authorAnil Vishnoi <vishnoianil@gmail.com>
Fri, 27 May 2016 23:28:07 +0000 (16:28 -0700)
committerAnil Vishnoi <vishnoianil@gmail.com>
Sat, 28 May 2016 07:16:44 +0000 (07:16 +0000)
Updates the ovsdb southbound so that configuration to ovsdb
nodes which have connected to the plugin passively can be
updated (e.g. such as qos or queue entries) without requiring
connection-info to be supplied in the configuration.
Similar to what already works when adding bridges or
termination points to passively connected ovsdb nodes.

The onDataChanged() method executes the following
sequence of operations on changes to the Ovsdb data tree:
- connect(changes)
- updateConnections(changes)
- updateData(changes)
- disconnect(changes)

When an OVSDB node has connected passively, or more
generally, when the changes to the OVSDB node do not
include 'connection-info', it is not necessary to
attempt to execute connection related operations for
the specified host.  This patch  checks for the absence
of the connection-info and skips trying to connect or
update a connection in the connect() and updateConnections()
methods.

v2 - add in data tree change patch from master branch
     now that data tree change listener is merged.

Change-Id: I8238711076a74cfa06422e5cacb127ba95fd23b7
Signed-off-by: Eric Multanen <eric.w.multanen@intel.com>
Signed-off-by: Anil Vishnoi <vishnoianil@gmail.com>
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/OvsdbDataTreeChangeListener.java
southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/ovsdb/transact/OvsdbNodeUpdateCommand.java

index 70175cb8c60fcc4d4ca77628a6902f777e10d7d8..0b3b282b44f7787375e2225b4c389d839db7c89a 100644 (file)
@@ -107,7 +107,8 @@ public class OvsdbDataTreeChangeListener implements ClusteredDataTreeChangeListe
                 DataObjectModification<OvsdbNodeAugmentation> ovsdbNodeModification =
                         change.getRootNode().getModifiedAugmentation(OvsdbNodeAugmentation.class);
                 if (ovsdbNodeModification != null && ovsdbNodeModification.getDataBefore() == null
-                        && ovsdbNodeModification.getDataAfter() != null) {
+                        && ovsdbNodeModification.getDataAfter() != null
+                        && ovsdbNodeModification.getDataAfter().getConnectionInfo() != null) {
                     OvsdbNodeAugmentation ovsdbNode = ovsdbNodeModification.getDataAfter();
                     ConnectionInfo key = ovsdbNode.getConnectionInfo();
                     InstanceIdentifier<Node> iid = cm.getInstanceIdentifier(key);
@@ -156,7 +157,8 @@ public class OvsdbDataTreeChangeListener implements ClusteredDataTreeChangeListe
                 DataObjectModification<OvsdbNodeAugmentation> ovsdbNodeModification =
                         change.getRootNode().getModifiedAugmentation(OvsdbNodeAugmentation.class);
                 if (ovsdbNodeModification != null && ovsdbNodeModification.getDataBefore() != null
-                        && ovsdbNodeModification.getDataAfter() != null) {
+                        && ovsdbNodeModification.getDataAfter() != null
+                        && ovsdbNodeModification.getDataAfter().getConnectionInfo() != null) {
                     OvsdbClient client = cm.getClient(ovsdbNodeModification.getDataAfter().getConnectionInfo());
                     if (client == null) {
                         if (ovsdbNodeModification.getDataBefore() != null) {
@@ -203,6 +205,11 @@ public class OvsdbDataTreeChangeListener implements ClusteredDataTreeChangeListe
                 if (nodeModification != null && nodeModification.getDataAfter() != null && nodeModification
                         .getDataAfter().getConnectionInfo() != null) {
                     client = cm.getConnectionInstance(nodeModification.getDataAfter().getConnectionInfo());
+                } else if (nodeModification != null && nodeModification.getDataAfter() != null && nodeModification
+                            .getDataAfter().getConnectionInfo() == null) {
+                    InstanceIdentifier<Node> nodeIid = SouthboundMapper.createInstanceIdentifier(
+                            node.getNodeId());
+                    client = cm.getConnectionInstance(nodeIid);
                 } else {
                     if (node != null) {
                         List<TerminationPoint> terminationPoints = node.getTerminationPoint();
index a79bbcadee381b4d3352d232b1c1cd4096a7a191..1a406aeca0bf3c374163870ce3f92a73d5a6c660 100644 (file)
@@ -53,9 +53,13 @@ public class OvsdbNodeUpdateCommand implements TransactCommand {
         for (Entry<InstanceIdentifier<OvsdbNodeAugmentation>, OvsdbNodeAugmentation> ovsdbNodeEntry:
             updated.entrySet()) {
             OvsdbNodeAugmentation ovsdbNode = ovsdbNodeEntry.getValue();
-            LOG.debug("Received request to update ovsdb node ip: {} port: {}",
+            if (ovsdbNode.getConnectionInfo() != null) {
+                LOG.debug("Received request to update ovsdb node ip: {} port: {}",
                         ovsdbNode.getConnectionInfo().getRemoteIp(),
                         ovsdbNode.getConnectionInfo().getRemotePort());
+            } else {
+                LOG.debug("Received request to update ovsdb node: {}", ovsdbNode);
+            }
 
             // OpenVSwitchPart
             OpenVSwitch ovs = TyperUtils.getTypedRowWrapper(transaction.getDatabaseSchema(), OpenVSwitch.class);