*/
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;
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 =
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);
return node;
}
- private static String getLocalControllerHostIpAddress() {
+ @VisibleForTesting
+ static String getLocalControllerHostIpAddress() {
String ipaddress = null;
try {
Enumeration<NetworkInterface> ifaces = NetworkInterface.getNetworkInterfaces();
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();
}
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) {