OVSDB-440: Fixes detecting SSL mode with OVSDB nodes 25/66525/2
authorTim Rozet <trozet@redhat.com>
Fri, 15 Dec 2017 21:34:32 +0000 (16:34 -0500)
committerSam Hague <shague@redhat.com>
Fri, 15 Dec 2017 21:53:41 +0000 (21:53 +0000)
The OF controller in netvirt is set by detecting the mode used in the
OVSDB manager connection.  However, this detection was absent for ssl
and was only working with tcp/ptcp.

Fixes: OVSDB-440
Change-Id: I66907a25e7ce5df14072218d33e0a5995081311a
Signed-off-by: Tim Rozet <trozet@redhat.com>
utils/southbound-utils/src/main/java/org/opendaylight/ovsdb/utils/southbound/utils/SouthboundUtils.java

index 77bacdc2b8f2060497a16c53d1d4fcd136c4fad0..9923ce79709d038ee782fc9ab2099ebb1c045f89 100644 (file)
@@ -114,6 +114,7 @@ public class SouthboundUtils {
     public static final TopologyId OVSDB_TOPOLOGY_ID = new TopologyId(new Uri("ovsdb:1"));
     private final MdsalUtils mdsalUtils;
     public static final String OPENFLOW_CONNECTION_PROTOCOL = "tcp";
+    public static final String OPENFLOW_SECURE_PROTOCOL = "ssl";
     public static short OPENFLOW_PORT = 6653;
     public static final String OVSDB_URI_PREFIX = "ovsdb";
     public static final String BRIDGE_URI_PREFIX = "bridge";
@@ -899,6 +900,18 @@ public class SouthboundUtils {
                             } else {
                                 LOG.warn("Ovsdb Node does not contain connection info: {}", node);
                             }
+                        } else if (tokens.length == 3 && tokens[0].equalsIgnoreCase("ssl")) {
+                            controllersStr.add(OPENFLOW_SECURE_PROTOCOL
+                                    + ":" + tokens[1] + ":" + getControllerOFPort());
+                        } else if (tokens[0].equalsIgnoreCase("pssl")) {
+                            ConnectionInfo connectionInfo = ovsdbNodeAugmentation.getConnectionInfo();
+                            if (connectionInfo != null && connectionInfo.getLocalIp() != null) {
+                                controllerIpStr = String.valueOf(connectionInfo.getLocalIp().getValue());
+                                controllersStr.add(OPENFLOW_SECURE_PROTOCOL
+                                        + ":" + controllerIpStr + ":" + OPENFLOW_PORT);
+                            } else {
+                                LOG.warn("Ovsdb Node does not contain connection info: {}", node);
+                            }
                         } else {
                             LOG.trace("Skipping manager entry {} for node {}",
                                     managerEntry.getTarget(), node.getNodeId().getValue());