Avoid probing hosts on non-existent or disabled ports

- All ports that has a subnet configured in netcfg will be used for probing
- A port may not exist on the device even if it's configured in interfces
- A port will never be added to the edge port list if it is never enabled
If a port meets both conditions above, it will fail the isEdgePort check and produce repeating warning messages.
This patch explicitly avoid probing on non-existent or disabled ports

Change-Id: I5cc5f32d4b2ff9fc00729e0adddbede29fb49ca0
(cherry picked from commit a618d74a7596633d666679f709a853d374fe2cb9)
diff --git a/core/net/src/test/java/org/onosproject/net/host/impl/HostMonitorTest.java b/core/net/src/test/java/org/onosproject/net/host/impl/HostMonitorTest.java
index 37ae0d3..d492e39 100644
--- a/core/net/src/test/java/org/onosproject/net/host/impl/HostMonitorTest.java
+++ b/core/net/src/test/java/org/onosproject/net/host/impl/HostMonitorTest.java
@@ -126,7 +126,7 @@
         expectLastCall().times(2);
         replay(hostProvider);
 
-        hostMonitor = new HostMonitor(null, hostManager, null, edgePortService);
+        hostMonitor = new HostMonitor(null, hostManager, null, edgePortService, null);
 
         hostMonitor.registerHostProvider(hostProvider);
         hostMonitor.addMonitoringFor(hostIp);
@@ -151,6 +151,7 @@
 
         Port port = createMock(Port.class);
         expect(port.number()).andReturn(portNum).anyTimes();
+        expect(port.isEnabled()).andReturn(true).anyTimes();
         replay(port);
 
         TestDeviceService deviceService = new TestDeviceService();
@@ -173,7 +174,7 @@
 
 
         // Run the test
-        hostMonitor = new HostMonitor(packetService, hostManager, interfaceService, edgePortService);
+        hostMonitor = new HostMonitor(packetService, hostManager, interfaceService, edgePortService, deviceService);
 
         hostMonitor.addMonitoringFor(TARGET_IPV4_ADDR);
         hostMonitor.run();
@@ -220,6 +221,7 @@
 
         Port port = createMock(Port.class);
         expect(port.number()).andReturn(portNum).anyTimes();
+        expect(port.isEnabled()).andReturn(true).anyTimes();
         replay(port);
 
         TestDeviceService deviceService = new TestDeviceService();
@@ -242,7 +244,7 @@
 
 
         // Run the test
-        hostMonitor = new HostMonitor(packetService, hostManager, interfaceService, edgePortService);
+        hostMonitor = new HostMonitor(packetService, hostManager, interfaceService, edgePortService, deviceService);
 
         hostMonitor.addMonitoringFor(TARGET_IPV6_ADDR);
         hostMonitor.run();
@@ -291,6 +293,7 @@
 
         Port port = createMock(Port.class);
         expect(port.number()).andReturn(portNum).anyTimes();
+        expect(port.isEnabled()).andReturn(true).anyTimes();
         replay(port);
 
         TestDeviceService deviceService = new TestDeviceService();
@@ -313,7 +316,7 @@
 
 
         // Run the test
-        hostMonitor = new HostMonitor(packetService, hostManager, interfaceService, edgePortService);
+        hostMonitor = new HostMonitor(packetService, hostManager, interfaceService, edgePortService, deviceService);
 
         hostMonitor.addMonitoringFor(TARGET_IPV4_ADDR);
         hostMonitor.run();
@@ -361,6 +364,7 @@
 
         Port port = createMock(Port.class);
         expect(port.number()).andReturn(portNum).anyTimes();
+        expect(port.isEnabled()).andReturn(true).anyTimes();
         replay(port);
 
         TestDeviceService deviceService = new TestDeviceService();
@@ -383,7 +387,7 @@
 
 
         // Run the test
-        hostMonitor = new HostMonitor(packetService, hostManager, interfaceService, edgePortService);
+        hostMonitor = new HostMonitor(packetService, hostManager, interfaceService, edgePortService, deviceService);
 
         hostMonitor.addMonitoringFor(TARGET_IPV6_ADDR);
         hostMonitor.run();
@@ -451,5 +455,12 @@
             }
             return ports;
         }
+
+        @Override
+        public Port getPort(ConnectPoint cp) {
+            return devicePorts.get(cp.deviceId()).stream()
+                    .filter(p -> p.number().equals(cp.port()))
+                    .findAny().orElse(null);
+        }
     }
 }