Upgrade to Neon base platform
[ovsdb.git] / southbound / southbound-impl / src / main / java / org / opendaylight / ovsdb / southbound / SouthboundUtil.java
index 63bf657b4ed67d2e6aa246af21f2d036ff798d83..5411a0fd76b8de53e03b0acddd2cbef7e48fb164 100644 (file)
@@ -7,6 +7,7 @@
  */
 package org.opendaylight.ovsdb.southbound;
 
+import com.google.common.annotations.VisibleForTesting;
 import com.google.common.base.Optional;
 import com.google.common.base.Preconditions;
 import com.google.common.util.concurrent.CheckedFuture;
@@ -31,7 +32,7 @@ import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-public class SouthboundUtil {
+public final class SouthboundUtil {
 
     private static final Logger LOG = LoggerFactory.getLogger(SouthboundUtil.class);
     private static final String SCHEMA_VERSION_MISMATCH =
@@ -61,7 +62,7 @@ public class SouthboundUtil {
                     if (node instanceof OvsdbNodeAugmentation) {
                         ovsdbNode = (OvsdbNodeAugmentation) node;
                     } else if (node != null) {
-                        ovsdbNode = node.getAugmentation(OvsdbNodeAugmentation.class);
+                        ovsdbNode = node.augmentation(OvsdbNodeAugmentation.class);
                     }
                     if (ovsdbNode != null) {
                         return Optional.of(ovsdbNode);
@@ -95,7 +96,8 @@ public class SouthboundUtil {
         return node;
     }
 
-    private static String getLocalControllerHostIpAddress() {
+    @VisibleForTesting
+    static String getLocalControllerHostIpAddress() {
         String ipaddress = null;
         try {
             Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces();
@@ -123,11 +125,11 @@ public class SouthboundUtil {
     public static String getControllerTarget(Node ovsdbNode) {
         String target = null;
         String ipAddr = null;
-        OvsdbNodeAugmentation ovsdbNodeAugmentation = ovsdbNode.getAugmentation(OvsdbNodeAugmentation.class);
+        OvsdbNodeAugmentation ovsdbNodeAugmentation = ovsdbNode.augmentation(OvsdbNodeAugmentation.class);
         ConnectionInfo connectionInfo = ovsdbNodeAugmentation.getConnectionInfo();
         LOG.info("connectionInfo: {}", connectionInfo);
         if (connectionInfo != null && connectionInfo.getLocalIp() != null) {
-            ipAddr = String.valueOf(connectionInfo.getLocalIp().getValue());
+            ipAddr = connectionInfo.getLocalIp().stringValue();
         }
         if (ipAddr == null) {
             ipAddr = getLocalControllerHostIpAddress();
@@ -142,8 +144,7 @@ public class SouthboundUtil {
     }
 
     public static String connectionInfoToString(final ConnectionInfo connectionInfo) {
-        return String.valueOf(
-                connectionInfo.getRemoteIp().getValue()) + ":" + connectionInfo.getRemotePort().getValue();
+        return connectionInfo.getRemoteIp().stringValue() + ":" + connectionInfo.getRemotePort().getValue();
     }
 
     public static void schemaMismatchLog(String column, String table, SchemaVersionMismatchException ex) {