Merge changes from topic 'sonar-cleanup'
[netvirt.git] / openstack / net-virt / src / main / java / org / opendaylight / ovsdb / openstack / netvirt / impl / ConfigurationServiceImpl.java
index 3c9a9f611b124caccd26ce1905c6c9bb5d278c4e..c9691fce72a395d4c0db83e6f8a7e013ffd27430 100644 (file)
@@ -1,12 +1,11 @@
 /*
- * Copyright (C) 2013 Red Hat, Inc.
+ * Copyright (c) 2013, 2015 Red Hat, Inc. and others. All rights reserved.
  *
  * This program and the accompanying materials are made available under the
  * terms of the Eclipse Public License v1.0 which accompanies this distribution,
  * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Authors : Madhu Venugopal, Brent Salisbury, Sam Hague, Dave Tucker
  */
+
 package org.opendaylight.ovsdb.openstack.netvirt.impl;
 
 import com.google.common.collect.Maps;
@@ -24,13 +23,13 @@ import org.opendaylight.ovsdb.openstack.netvirt.api.Southbound;
 import org.opendaylight.ovsdb.utils.config.ConfigProperties;
 import org.opendaylight.ovsdb.utils.servicehelper.ServiceHelper;
 import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
-import org.osgi.framework.BundleContext;
+
 import org.osgi.framework.ServiceReference;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class ConfigurationServiceImpl implements ConfigurationService, ConfigInterface {
-    static final Logger logger = LoggerFactory.getLogger(ConfigurationServiceImpl.class);
+    private static final Logger LOG = LoggerFactory.getLogger(ConfigurationServiceImpl.class);
 
     private String integrationBridgeName;
     private String networkBridgeName;
@@ -141,10 +140,10 @@ public class ConfigurationServiceImpl implements ConfigurationService, ConfigInt
         if (tunnelEndpoint != null) {
             try {
                 address = InetAddress.getByName(tunnelEndpoint);
+                LOG.debug("Tunnel Endpoint for Node {} {}", node, address.getHostAddress());
             } catch (UnknownHostException e) {
-                logger.error("Error populating Tunnel Endpoint for Node {} ", node, e);
+                LOG.error("Error populating Tunnel Endpoint for Node {} ", node, e);
             }
-            logger.debug("Tunnel Endpoint for Node {} {}", node, address.getHostAddress());
         }
         return address;
     }
@@ -163,7 +162,7 @@ public class ConfigurationServiceImpl implements ConfigurationService, ConfigInt
     @Override
     public boolean isDistributedArpDisabled() {
         final String strARPDisabled = ConfigProperties.getProperty(this.getClass(), "ovsdb.l3.arp.responder.disabled");
-        return (strARPDisabled.equalsIgnoreCase("yes"));
+        return strARPDisabled != null && strARPDisabled.equalsIgnoreCase("yes");
     }
 
     @Override
@@ -180,7 +179,13 @@ public class ConfigurationServiceImpl implements ConfigurationService, ConfigInt
     }
 
     @Override
-    public void setDependencies(BundleContext bundleContext, ServiceReference serviceReference) {
+    public boolean isUserSpaceEnabled() {
+        final String enabledPropertyStr = ConfigProperties.getProperty(this.getClass(), "ovsdb.userspace.enabled");
+        return enabledPropertyStr != null && enabledPropertyStr.equalsIgnoreCase("yes");
+    }
+
+    @Override
+    public void setDependencies(ServiceReference serviceReference) {
         southbound =
                 (Southbound) ServiceHelper.getGlobalInstance(Southbound.class, this);
     }