Merge "Make neutron a simple osgi app"
[controller.git] / opendaylight / netconf / netconf-util / src / main / java / org / opendaylight / controller / netconf / util / osgi / NetconfConfigUtil.java
index 333fea3493172286fdba2c807eff105760741411..64aeebd54205c658cad64589994a436282cbdb5b 100644 (file)
@@ -16,7 +16,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public final class NetconfConfigUtil {
-    private static final Logger logger = LoggerFactory.getLogger(NetconfConfigUtil.class);
+    private static final Logger LOG = LoggerFactory.getLogger(NetconfConfigUtil.class);
 
     private static final String PREFIX_PROP = "netconf.";
 
@@ -48,34 +48,11 @@ public final class NetconfConfigUtil {
         try {
             return Long.parseLong(timeoutString);
         } catch (final NumberFormatException e) {
-            logger.warn("Cannot parse {} property: {}, using defaults", key, timeoutString, e);
+            LOG.warn("Cannot parse {} property: {}, using defaults", key, timeoutString, e);
             return DEFAULT_TIMEOUT_MILLIS;
         }
     }
 
-    /**
-     * Get extracted address or default.
-     *
-     * @throws java.lang.IllegalStateException if neither address is present.
-     */
-    private static InetSocketAddress getNetconfAddress(final InetSocketAddress defaultAddress, Optional<InetSocketAddress> extractedAddress, InfixProp infix) {
-        InetSocketAddress inetSocketAddress;
-
-        if (extractedAddress.isPresent() == false) {
-            logger.debug("Netconf {} address not found, falling back to default {}", infix, defaultAddress);
-
-            if (defaultAddress == null) {
-                logger.warn("Netconf {} address not found, default address not provided", infix);
-                throw new IllegalStateException("Netconf " + infix + " address not found, default address not provided");
-            }
-            inetSocketAddress = defaultAddress;
-        } else {
-            inetSocketAddress = extractedAddress.get();
-        }
-
-        return inetSocketAddress;
-    }
-
     public static String getPrivateKeyPath(final BundleContext context) {
         return getPropertyValue(context, getPrivateKeyKey());
     }
@@ -112,7 +89,7 @@ public final class NetconfConfigUtil {
             try {
                 return Optional.of(parseAddress(address, port));
             } catch (final RuntimeException e) {
-                logger.warn("Unable to parse {} netconf address from {}:{}, fallback to default",
+                LOG.warn("Unable to parse {} netconf address from {}:{}, fallback to default",
                         infixProp, address, port, e);
             }
         }