X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=southbound%2Fsouthbound-impl%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fovsdb%2Fsouthbound%2FSouthboundUtil.java;h=b11dffe881d21e52420ff942135f62b199e0bfb6;hb=50e7f939993fa9da3c80a1c8d166629a4868af9c;hp=3e2ecb9743844d0978e2789dd7d6e969a2f3aa32;hpb=e3d5cc5696b66be18d41131189c77596f8b54d82;p=ovsdb.git diff --git a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundUtil.java b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundUtil.java index 3e2ecb974..b11dffe88 100644 --- a/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundUtil.java +++ b/southbound/southbound-impl/src/main/java/org/opendaylight/ovsdb/southbound/SouthboundUtil.java @@ -18,6 +18,7 @@ import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction; import org.opendaylight.controller.md.sal.binding.api.ReadWriteTransaction; import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType; import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException; +import org.opendaylight.ovsdb.lib.error.SchemaVersionMismatchException; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbBridgeAttributes; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeAugmentation; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.ovsdb.rev150105.OvsdbNodeRef; @@ -31,6 +32,8 @@ import org.slf4j.LoggerFactory; public class SouthboundUtil { private static final Logger LOG = LoggerFactory.getLogger(SouthboundUtil.class); + private static final String SCHEMA_VERSION_MISMATCH = + "{} column for {} table is not supported by this version of the {} schema: {}"; private static InstanceIdentifierCodec instanceIdentifierCodec; @@ -42,6 +45,10 @@ public class SouthboundUtil { instanceIdentifierCodec = iidc; } + public static InstanceIdentifierCodec getInstanceIdentifierCodec() { + return instanceIdentifierCodec; + } + public static String serializeInstanceIdentifier(InstanceIdentifier iid) { return instanceIdentifierCodec.serialize(iid); } @@ -138,7 +145,7 @@ public class SouthboundUtil { ConnectionInfo connectionInfo = ovsdbNodeAugmentation.getConnectionInfo(); LOG.info("connectionInfo: {}", connectionInfo); if (connectionInfo != null && connectionInfo.getLocalIp() != null) { - ipAddr = new String(connectionInfo.getLocalIp().getValue()); + ipAddr = String.valueOf(connectionInfo.getLocalIp().getValue()); } if (ipAddr == null) { ipAddr = getLocalControllerHostIpAddress(); @@ -151,4 +158,13 @@ public class SouthboundUtil { return target; } + + public static String connectionInfoToString(final ConnectionInfo connectionInfo) { + return String.valueOf( + connectionInfo.getRemoteIp().getValue()) + ":" + connectionInfo.getRemotePort().getValue(); + } + + public static void schemaMismatchLog(String column, String table, SchemaVersionMismatchException ex) { + LOG.debug(SCHEMA_VERSION_MISMATCH, column, table, SouthboundConstants.OPEN_V_SWITCH, ex.getMessage()); + } }