Small INT app and UI improvements

[INT App]
 - Load INT report config when activate the app
 - Remove config listener and config factory from app when deactivate
 - Check INT intent map before remove a INT intent
 - Add more check to check the input from frontend UI
 - Change log level of UI message handler from info to debug

[GUI1]
 - Reformat CSS code
 - Remove '$scope.sendIntConfigString' which breaks the UI
 - Fix regular expression that matches IP prefix
 - Remove "required" attribute from all field
 - Add additional check to prevent sending invalid input to backend
 - Use 'let' instead of 'var' to limit the scope of variable
 - Make INT button aligned with other elements
 - Show message if any field is invalid

[GUI2]
 - Remove INT collector config panel
 - Reformat HTML code
 - Fix regular expression which matches the IP prefix

[API]
 - Add default value '0' for all fields in INT device config
 - Skip checking the metadata types when building the IntObjective since
   some pipeline won't need it

Change-Id: Ica260c35d411336419f77eb0de5787e943dc1887
diff --git a/apps/inbandtelemetry/impl/src/main/java/org/onosproject/inbandtelemetry/impl/SimpleIntManager.java b/apps/inbandtelemetry/impl/src/main/java/org/onosproject/inbandtelemetry/impl/SimpleIntManager.java
index 48a7a24..8506a40 100644
--- a/apps/inbandtelemetry/impl/src/main/java/org/onosproject/inbandtelemetry/impl/SimpleIntManager.java
+++ b/apps/inbandtelemetry/impl/src/main/java/org/onosproject/inbandtelemetry/impl/SimpleIntManager.java
@@ -210,9 +210,20 @@
 
         netcfgRegistry.registerConfigFactory(intAppConfigFactory);
         netcfgService.addListener(appConfigListener);
+        // Initialize the INT report
+        IntReportConfig reportConfig = netcfgService.getConfig(appId, IntReportConfig.class);
+        if (reportConfig != null) {
+            IntDeviceConfig intDeviceConfig = IntDeviceConfig.builder()
+                    .withMinFlowHopLatencyChangeNs(reportConfig.minFlowHopLatencyChangeNs())
+                    .withCollectorPort(reportConfig.collectorPort())
+                    .withCollectorIp(reportConfig.collectorIp())
+                    .enabled(true)
+                    .build();
+            setConfig(intDeviceConfig);
+        }
 
         startInt();
-        log.info("Started", appId.id());
+        log.info("Started");
     }
 
     @Deactivate
@@ -242,6 +253,8 @@
         });
         // Clean up INT rules from existing devices.
         deviceService.getDevices().forEach(d -> cleanupDevice(d.id()));
+        netcfgService.removeListener(appConfigListener);
+        netcfgRegistry.unregisterConfigFactory(intAppConfigFactory);
         log.info("Deactivated");
     }
 
@@ -293,7 +306,11 @@
     public void removeIntIntent(IntIntentId intentId) {
         checkNotNull(intentId);
         // Intent map event will trigger device configure.
-        intentMap.remove(intentId).value();
+        if (!intentMap.containsKey(intentId)) {
+            log.warn("INT intent {} does not exists, skip removing the intent.", intentId);
+            return;
+        }
+        intentMap.remove(intentId);
     }
 
     @Override