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/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(),