Host Location Provider improvements and logging

Change-Id: Ia8e5d7357ee6acb5c19925661778d1d24a0a5d14
(cherry picked from commit 76da0290a77010d38a57c0ff4b8a1a9da6cff466)
diff --git a/core/net/src/main/java/org/onosproject/net/host/impl/HostManager.java b/core/net/src/main/java/org/onosproject/net/host/impl/HostManager.java
index 07c7996..46cbc0a 100644
--- a/core/net/src/main/java/org/onosproject/net/host/impl/HostManager.java
+++ b/core/net/src/main/java/org/onosproject/net/host/impl/HostManager.java
@@ -69,7 +69,6 @@
 import java.util.concurrent.TimeUnit;
 
 import static com.google.common.base.Preconditions.checkNotNull;
-import static com.google.common.base.Preconditions.checkState;
 import static com.google.common.base.Strings.isNullOrEmpty;
 import static org.onlab.packet.IPv6.getLinkLocalAddress;
 import static org.onlab.util.Tools.get;
@@ -469,14 +468,10 @@
 
         @Override
         public void hostDetected(HostId hostId, HostDescription initialHostDescription, boolean replaceIps) {
+            log.debug("Host Detected {}, {}", hostId, initialHostDescription);
             HostDescription hostDescription = initialHostDescription;
             checkNotNull(hostId, HOST_ID_NULL);
             checkValidity();
-            hostDescription = validateHost(hostDescription, hostId);
-
-            if (!allowDuplicateIps) {
-                removeDuplicates(hostId, hostDescription);
-            }
 
             BasicHostConfig cfg = networkConfigService.getConfig(hostId, BasicHostConfig.class);
             if (!isAllowed(cfg)) {
@@ -485,6 +480,11 @@
             }
 
             hostDescription = BasicHostOperator.combine(cfg, initialHostDescription);
+
+            if (!allowDuplicateIps) {
+                removeDuplicates(hostId, hostDescription);
+            }
+
             HostAnnotationConfig annoConfig = networkConfigService.getConfig(hostId, HostAnnotationConfig.class);
             if (annoConfig != null) {
                 hostDescription = hostAnnotationOperator.combine(hostId, hostDescription, Optional.of(annoConfig));
@@ -558,15 +558,6 @@
             });
         }
 
-        // returns a HostDescription made from the union of the BasicHostConfig
-        // annotations if it exists
-        private HostDescription validateHost(HostDescription hostDescription, HostId hostId) {
-            BasicHostConfig cfg = networkConfigService.getConfig(hostId, BasicHostConfig.class);
-            checkState(cfg == null || cfg.isAllowed(), "Host {} is not allowed", hostId);
-
-            return BasicHostOperator.combine(cfg, hostDescription);
-        }
-
         @Override
         public void hostVanished(HostId hostId) {
             checkNotNull(hostId, HOST_ID_NULL);
diff --git a/providers/host/src/main/java/org/onosproject/provider/host/impl/HostLocationProvider.java b/providers/host/src/main/java/org/onosproject/provider/host/impl/HostLocationProvider.java
index a6b9bb0..089f173 100644
--- a/providers/host/src/main/java/org/onosproject/provider/host/impl/HostLocationProvider.java
+++ b/providers/host/src/main/java/org/onosproject/provider/host/impl/HostLocationProvider.java
@@ -472,6 +472,7 @@
         private void createOrUpdateHost(HostId hid, MacAddress mac, VlanId vlan,
                                         VlanId innerVlan, EthType outerTpid,
                                         HostLocation hloc, IpAddress ip) {
+            log.debug("Creating Host {} based on Location {}", hid, hloc);
             Set<HostLocation> newLocations = Sets.newHashSet(hloc);
 
             if (multihomingEnabled) {