Do not create a link if port is disabled.

There is some case regarding link creation.
Let's suppose that there are A and B devices on topology.

The link discovery drivers on onos will gather the link information from device(eg, switches).
In this case, if a port on the device A is unplugged or changed to down state but the link information(eg, LLDP) will be remained because TTL is not reached yet.

So, onos will re-create the link using link information that is gathered from link discovery driver.
This behavior result to link is re-created suddenly even if ports are disabled.

ONOS-7854

Change-Id: I224fb39fee92648600f9c9e40fcc97890d3ea9ef
diff --git a/drivers/arista/src/main/java/org/onosproject/drivers/arista/LinkDiscoveryAristaImpl.java b/drivers/arista/src/main/java/org/onosproject/drivers/arista/LinkDiscoveryAristaImpl.java
index a32c6b7..5cf1a17 100644
--- a/drivers/arista/src/main/java/org/onosproject/drivers/arista/LinkDiscoveryAristaImpl.java
+++ b/drivers/arista/src/main/java/org/onosproject/drivers/arista/LinkDiscoveryAristaImpl.java
@@ -170,6 +170,12 @@
                     continue;
                 }
 
+                if (!localPort.get().isEnabled() || !remotePort.get().isEnabled()) {
+                    log.debug("Ports are disabled. Cannot create a link between {}/{} and {}/{}",
+                            localDeviceId, localPort.get(), remoteDevice.get().id(), remotePort.get());
+                    continue;
+                }
+
                 linkDescriptions
                         .addAll(buildLinkPair(localDeviceId, localPort.get(),
                                 remoteDevice.get().id(), remotePort.get()));
diff --git a/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/LinkDiscoveryJuniperImpl.java b/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/LinkDiscoveryJuniperImpl.java
index e78779e..ebb683c 100644
--- a/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/LinkDiscoveryJuniperImpl.java
+++ b/drivers/juniper/src/main/java/org/onosproject/drivers/juniper/LinkDiscoveryJuniperImpl.java
@@ -136,6 +136,12 @@
                 continue;
             }
 
+            if (!localPort.get().isEnabled() || !remotePort.get().isEnabled()) {
+                log.debug("Ports are disabled. Cannot create a link between {}/{} and {}/{}",
+                        localDeviceId, localPort.get(), remoteDevice.id(), remotePort.get());
+                continue;
+            }
+
             JuniperUtils.createOneWayLinkDescription(localDeviceId,
                                                      localPort.get(),
                                                      remoteDevice.id(),
diff --git a/providers/lldpcommon/src/main/java/org/onosproject/provider/lldpcommon/LinkDiscovery.java b/providers/lldpcommon/src/main/java/org/onosproject/provider/lldpcommon/LinkDiscovery.java
index 09807ac..2448828 100644
--- a/providers/lldpcommon/src/main/java/org/onosproject/provider/lldpcommon/LinkDiscovery.java
+++ b/providers/lldpcommon/src/main/java/org/onosproject/provider/lldpcommon/LinkDiscovery.java
@@ -280,6 +280,12 @@
             DeviceId srcDeviceId = srcDevice.get().id();
             DeviceId dstDeviceId = packetContext.inPacket().receivedFrom().deviceId();
 
+            if (!sourcePort.get().isEnabled()) {
+                log.debug("Ports are disabled. Cannot create a link between {}/{} and {}/{}",
+                        srcDeviceId, sourcePort.get(), dstDeviceId, dstPort);
+                return false;
+            }
+
             ConnectPoint src = new ConnectPoint(srcDeviceId, srcPort);
             ConnectPoint dst = new ConnectPoint(dstDeviceId, dstPort);