Avoid creating default EAPOL on port removed event
Change-Id: If15f846d6a4c4463b5a0d4e7d4b3abb390aed1ab
diff --git a/impl/src/main/java/org/opencord/olt/impl/OltFlowService.java b/impl/src/main/java/org/opencord/olt/impl/OltFlowService.java
index 28a0f53..cbc538a 100644
--- a/impl/src/main/java/org/opencord/olt/impl/OltFlowService.java
+++ b/impl/src/main/java/org/opencord/olt/impl/OltFlowService.java
@@ -581,8 +581,9 @@
// remove the tagged eapol
handleSubscriberEapolFlows(sub, FlowOperation.REMOVE, si);
- // and add the default one back
- if (sub.port.isEnabled()) {
+ // and add the default one back (only if the port is ENABLED and still present on the device)
+ if (sub.port.isEnabled() && deviceService.getPort(sub.device.id(), sub.port.number()) != null) {
+
// NOTE we remove the subscriber when the port goes down
// but in that case we don't need to add default eapol
handleEapolFlow(sub, defaultBandwithProfile, defaultBandwithProfile,