IntentManager: Don't compile all failed intents on every event

Also don't compile all failed on any Host event. Intents that care about
hosts should have that host tracked and react to changes in that host only.

ONOS-2978

Change-Id: I1f6b2b2fa31987cffff0f9a7a9aa0191dc1edbcf
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java
index 4c828e7..baa3bf4 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/IntentManager.java
@@ -256,15 +256,16 @@
             submit(intent);
         }
 
-        // If required, compile all currently failed intents.
-        for (Intent intent : getIntents()) {
-            IntentState state = getIntentState(intent.key());
-            if ((compileAllFailed && RECOMPILE.contains(state))
-                    || intentAllowsPartialFailure(intent)) {
-                if (WITHDRAW.contains(state)) {
-                    withdraw(intent);
-                } else {
-                    submit(intent);
+        if (compileAllFailed) {
+            // If required, compile all currently failed intents.
+            for (Intent intent : getIntents()) {
+                IntentState state = getIntentState(intent.key());
+                if (RECOMPILE.contains(state) || intentAllowsPartialFailure(intent)) {
+                    if (WITHDRAW.contains(state)) {
+                        withdraw(intent);
+                    } else {
+                        submit(intent);
+                    }
                 }
             }
         }
diff --git a/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java b/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
index 5710ace..4996db9 100644
--- a/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
+++ b/core/net/src/main/java/org/onosproject/net/intent/impl/ObjectiveTracker.java
@@ -415,9 +415,7 @@
         @Override
         public void event(HostEvent event) {
             HostId id = event.subject().id();
-            HostEvent.Type type = event.type();
-            boolean available = (type == HostEvent.Type.HOST_ADDED);
-            executorService.execute(new DeviceAvailabilityHandler(id, available));
+            executorService.execute(new DeviceAvailabilityHandler(id, false));
         }
     }