Adding ConnectPoint info to all the EAPOL logs and use standard form
devId/portNo for easier debugging

Change-Id: I95da74038738c6fd4f611bd2b1d233f7f213beb9
diff --git a/app/src/main/java/org/opencord/olt/impl/Olt.java b/app/src/main/java/org/opencord/olt/impl/Olt.java
index c98b69c..2a8c6e8 100644
--- a/app/src/main/java/org/opencord/olt/impl/Olt.java
+++ b/app/src/main/java/org/opencord/olt/impl/Olt.java
@@ -684,10 +684,14 @@
     private void provisionUniTagList(ConnectPoint connectPoint, PortNumber uplinkPort,
                                      SubscriberAndDeviceInformation sub) {
 
-        log.debug("Provisioning vlans for subscriber {} on dev/port: {}", sub, connectPoint);
+        log.debug("Provisioning vlans for subscriber on dev/port: {}", connectPoint.toString());
+        if (log.isTraceEnabled()) {
+            log.trace("Subscriber informations {}", sub);
+        }
 
         if (sub.uniTagList() == null || sub.uniTagList().isEmpty()) {
-            log.warn("Unitaglist doesn't exist for the subscriber {}", sub.id());
+            log.warn("Unitaglist doesn't exist for the subscriber {} on dev/port {}",
+                    sub.id(), connectPoint.toString());
             return;
         }
 
@@ -744,7 +748,8 @@
     private void handleSubscriberFlows(DeviceId deviceId, PortNumber uplinkPort, PortNumber subscriberPort,
                                        UniTagInformation tagInfo) {
 
-        log.debug("Provisioning vlan-based flows for the uniTagInformation {}", tagInfo);
+        log.debug("Provisioning vlan-based flows for the uniTagInformation {} on dev/port {}/{}",
+                tagInfo, deviceId, subscriberPort);
 
         Port port = deviceService.getPort(deviceId, subscriberPort);
 
@@ -763,7 +768,7 @@
                 getBandwidthProfileInformation(tagInfo.getDownstreamBandwidthProfile());
         if (upstreamBpInfo == null) {
             log.warn("No meter installed since no Upstream BW Profile definition found for "
-                             + "ctag {} stag {} tpId {} and Device/port: {}:{}",
+                             + "ctag {} stag {} tpId {} and dev/port: {}/{}",
                      tagInfo.getPonCTag(), tagInfo.getPonSTag(),
                      tagInfo.getTechnologyProfileId(), deviceId,
                      subscriberPort);
@@ -771,7 +776,7 @@
         }
         if (downstreamBpInfo == null) {
             log.warn("No meter installed since no Downstream BW Profile definition found for "
-                             + "ctag {} stag {} tpId {} and Device/port: {}:{}",
+                             + "ctag {} stag {} tpId {} and dev/port: {}/{}",
                      tagInfo.getPonCTag(), tagInfo.getPonSTag(),
                      tagInfo.getTechnologyProfileId(), deviceId,
                      subscriberPort);
@@ -788,22 +793,22 @@
                                                        downstreamBpInfo.id(), upstreamBpInfo.id());
 
         if (upMeterId != null && downMeterId != null) {
-            log.debug("Meters are existing for upstream {} and downstream {}",
-                     upstreamBpInfo.id(), downstreamBpInfo.id());
+            log.debug("Meters are existing for upstream {} and downstream {} on dev/port {}/{}",
+                     upstreamBpInfo.id(), downstreamBpInfo.id(), deviceId, subscriberPort);
             handleSubFlowsWithMeters(fi);
         } else {
-            log.debug("Adding {} to pending subs", fi);
+            log.debug("Adding {} on {}/{} to pending subs", fi, deviceId, subscriberPort);
             // one or both meters are not ready. It's possible they are in the process of being
             // created for other subscribers that share the same bandwidth profile.
             pendingSubscribers.add(fi);
 
             // queue up the meters to be created
             if (upMeterId == null) {
-                log.debug("Missing meter for upstream {}", upstreamBpInfo.id());
+                log.debug("Missing meter for upstream {} on {}/{}", upstreamBpInfo.id(), deviceId, subscriberPort);
                 checkAndCreateDevMeter(deviceId, upstreamBpInfo);
             }
             if (downMeterId == null) {
-                log.debug("Missing meter for downstream {}", downstreamBpInfo.id());
+                log.debug("Missing meter for downstream {} on {}/{}", downstreamBpInfo.id(), deviceId, subscriberPort);
                 checkAndCreateDevMeter(deviceId, downstreamBpInfo);
             }
         }
@@ -817,7 +822,7 @@
     }
 
     private void createMeter(DeviceId deviceId, BandwidthProfileInformation bwpInfo) {
-        log.debug("Creating Meter with {} on {} for subscriber", bwpInfo, deviceId);
+        log.debug("Creating Meter with {} on {}", bwpInfo, deviceId);
         CompletableFuture<Object> meterFuture = new CompletableFuture<>();
 
         MeterId meterId = oltMeterService.createMeter(deviceId, bwpInfo,
@@ -837,10 +842,10 @@
                     MeterId downMeterId = oltMeterService
                             .getMeterIdFromBpMapping(deviceId, fi.getDownBpInfo());
                     if (upMeterId != null && downMeterId != null) {
-                        log.debug("Provisioning subscriber after meter {}" +
+                        log.debug("Provisioning subscriber after meter {} " +
                                           "installation and both meters are present " +
-                                          "upstream {} and downstream {}",
-                                  meterId, upMeterId, downMeterId);
+                                          "upstream {} and downstream {} on {}/{}",
+                                  meterId, upMeterId, downMeterId, deviceId, fi.getUniPort());
                         // put in the meterIds  because when fi was first
                         // created there may or may not have been a meterId
                         // depending on whether the meter was created or
@@ -853,8 +858,8 @@
                     oltMeterService.removeFromPendingMeters(deviceId, bwpInfo);
                 } else {
                     // meter install failed
-                    log.error("Addition of subscriber {} failed due to meter " +
-                                      "{} with result {}", fi, meterId, result);
+                    log.error("Addition of subscriber {} on {}/{} failed due to meter " +
+                                      "{} with result {}", fi, deviceId, fi.getUniPort(), meterId, result);
                     subsIterator.remove();
                     oltMeterService.removeFromPendingMeters(deviceId, bwpInfo);
                 }
@@ -868,7 +873,8 @@
      * @param subscriberFlowInfo relevant information for subscriber
      */
     private void handleSubFlowsWithMeters(SubscriberFlowInfo subscriberFlowInfo) {
-        log.debug("Provisioning subscriber flows based on {}", subscriberFlowInfo);
+        log.debug("Provisioning subscriber flows on {}/{} based on {}",
+                  subscriberFlowInfo.getDevId(), subscriberFlowInfo.getUniPort(), subscriberFlowInfo);
         UniTagInformation tagInfo = subscriberFlowInfo.getTagInfo();
         CompletableFuture<ObjectiveError> upFuture = new CompletableFuture<>();
         CompletableFuture<ObjectiveError> downFuture = new CompletableFuture<>();
@@ -879,7 +885,8 @@
         flowObjectiveService.forward(subscriberFlowInfo.getDevId(), upFwd.add(new ObjectiveContext() {
             @Override
             public void onSuccess(Objective objective) {
-                log.debug("Upstream flow installed successfully {}", subscriberFlowInfo);
+                log.debug("Upstream HSIA flow {} installed successfully on {}/{}",
+                        subscriberFlowInfo, subscriberFlowInfo.getDevId(), subscriberFlowInfo.getUniPort());
                 upFuture.complete(null);
             }
 
@@ -895,7 +902,8 @@
         flowObjectiveService.forward(subscriberFlowInfo.getDevId(), downFwd.add(new ObjectiveContext() {
             @Override
             public void onSuccess(Objective objective) {
-                log.debug("Downstream flow installed successfully {}", subscriberFlowInfo);
+                log.debug("Downstream HSIA flow {} installed successfully on {}/{}",
+                        subscriberFlowInfo, subscriberFlowInfo.getDevId(), subscriberFlowInfo.getUniPort());
                 downFuture.complete(null);
             }
 
@@ -908,20 +916,18 @@
         upFuture.thenAcceptBothAsync(downFuture, (upStatus, downStatus) -> {
             AccessDeviceEvent.Type type = AccessDeviceEvent.Type.SUBSCRIBER_UNI_TAG_REGISTERED;
             if (downStatus != null) {
-                log.error("Flow with innervlan {} and outerVlan {} on device {} " +
-                                  "on port {} failed downstream installation: {}",
+                log.error("Flow with innervlan {} and outerVlan {} on {}/{} failed downstream installation: {}",
                           tagInfo.getPonCTag(), tagInfo.getPonSTag(), subscriberFlowInfo.getDevId(),
                           subscriberFlowInfo.getUniPort(), downStatus);
                 type = AccessDeviceEvent.Type.SUBSCRIBER_UNI_TAG_REGISTRATION_FAILED;
             } else if (upStatus != null) {
-                log.error("Flow with innerVlan {} and outerVlan {} on device {} " +
-                                  "on port {} failed upstream installation: {}",
+                log.error("Flow with innervlan {} and outerVlan {} on {}/{} failed downstream installation: {}",
                           tagInfo.getPonCTag(), tagInfo.getPonSTag(), subscriberFlowInfo.getDevId(),
                           subscriberFlowInfo.getUniPort(), upStatus);
                 type = AccessDeviceEvent.Type.SUBSCRIBER_UNI_TAG_REGISTRATION_FAILED;
             } else {
                 log.debug("Upstream and downstream data plane flows are installed successfully " +
-                                 "for {}", subscriberFlowInfo);
+                                 "for {}/{}", subscriberFlowInfo.getDevId(), subscriberFlowInfo.getUniPort());
                 oltFlowService.processEapolFilteringObjectives(subscriberFlowInfo.getDevId(),
                                                                subscriberFlowInfo.getUniPort(),
                                                                tagInfo.getUpstreamBandwidthProfile(),
@@ -960,17 +966,17 @@
      */
     private Optional<UniTagInformation> getUniTagInformation(ConnectPoint cp, VlanId innerVlan, VlanId outerVlan,
                                                              int tpId) {
-        log.info("Getting uni tag information for cp: {}, innerVlan: {}, outerVlan: {}, tpId: {}", cp, innerVlan,
-                 outerVlan, tpId);
+        log.debug("Getting uni tag information for cp: {}, innerVlan: {}, outerVlan: {}, tpId: {}",
+                cp.toString(), innerVlan, outerVlan, tpId);
         SubscriberAndDeviceInformation subInfo = getSubscriber(cp);
         if (subInfo == null) {
-            log.warn("Subscriber information doesn't exist for the connect point {}", cp);
+            log.warn("Subscriber information doesn't exist for the connect point {}", cp.toString());
             return Optional.empty();
         }
 
         List<UniTagInformation> uniTagList = subInfo.uniTagList();
         if (uniTagList == null) {
-            log.warn("Uni tag list is not found for the subscriber {}", subInfo.id());
+            log.warn("Uni tag list is not found for the subscriber {} on {}", subInfo.id(), cp.toString());
             return Optional.empty();
         }
 
@@ -984,8 +990,8 @@
         }
 
         if (service == null) {
-            log.warn("SADIS doesn't include the service with ponCtag {} ponStag {} and tpId {}",
-                     innerVlan, outerVlan, tpId);
+            log.warn("SADIS doesn't include the service with ponCtag {} ponStag {} and tpId {} on {}",
+                     innerVlan, outerVlan, tpId, cp.toString());
             return Optional.empty();
         }
 
@@ -1011,12 +1017,12 @@
                 }
                 if (isUniPort(dev, p)) {
                     if (!programmedSubs.containsKey(new ConnectPoint(dev.id(), p.number()))) {
-                        log.info("Creating Eapol for the uni {}", p);
+                        log.info("Creating Eapol on {}/{}", dev.id(), p.number());
                         oltFlowService.processEapolFilteringObjectives(dev.id(), p.number(), defaultBpId, null,
                                                                        VlanId.vlanId(EAPOL_DEFAULT_VLAN), true);
                     } else {
-                        log.debug("Subscriber Eapol for UNI port {} on device {} is already " +
-                                          "provisioned, not installing default", p.number(), dev.id());
+                        log.debug("Subscriber Eapol on {}/{} is already provisioned, not installing default",
+                                dev.id(), p.number());
                     }
                 } else {
                     oltFlowService.processNniFilteringObjectives(dev.id(), p.number(), true);
@@ -1163,7 +1169,7 @@
                     return;
                 }
 
-                log.debug("OLT got {} event for {} {}", eventType, event.subject(), event.port());
+                log.debug("OLT got {} event for {}/{}", eventType, event.subject(), event.port());
 
                 if (getOltInfo(dev) == null) {
                     // it's possible that we got an event for a previously
@@ -1188,7 +1194,7 @@
                             post(new AccessDeviceEvent(AccessDeviceEvent.Type.UNI_ADDED, devId, port));
 
                             if (port.isEnabled() && !port.number().equals(PortNumber.LOCAL)) {
-                                log.info("eapol will be sent for port added {}", port);
+                                log.info("eapol will be sent for port added {}/{}", devId, port);
                                 oltFlowService.processEapolFilteringObjectives(devId, port.number(), defaultBpId,
                                                                                null,
                                                                                VlanId.vlanId(EAPOL_DEFAULT_VLAN),
@@ -1209,8 +1215,8 @@
                             Collection<? extends UniTagInformation> uniTagInformationSet =
                                     programmedSubs.get(new ConnectPoint(port.element().id(), port.number())).value();
                             if (uniTagInformationSet == null || uniTagInformationSet.isEmpty()) {
-                                log.info("No subscriber provisioned on port {} in PORT_REMOVED event, " +
-                                                 "removing default EAPOL flow", port);
+                                log.info("No subscriber provisioned on port {}/{} in PORT_REMOVED event, " +
+                                                 "removing default EAPOL flow", devId, port);
                                 oltFlowService.processEapolFilteringObjectives(devId, port.number(), defaultBpId,
                                                                                null,
                                                                                VlanId.vlanId(EAPOL_DEFAULT_VLAN),
diff --git a/app/src/main/java/org/opencord/olt/impl/OltFlowService.java b/app/src/main/java/org/opencord/olt/impl/OltFlowService.java
index 6ae705a..58344e6 100644
--- a/app/src/main/java/org/opencord/olt/impl/OltFlowService.java
+++ b/app/src/main/java/org/opencord/olt/impl/OltFlowService.java
@@ -167,7 +167,6 @@
     protected ApplicationId appId;
     protected BaseInformationService<BandwidthProfileInformation> bpService;
     protected BaseInformationService<SubscriberAndDeviceInformation> subsService;
-    private Set<ConnectPoint> pendingAddEapol = Sets.newConcurrentHashSet();
     private Set<SubscriberFlowInfo> pendingEapolForMeters = Sets.newConcurrentHashSet();;
 
     @Activate
@@ -324,14 +323,14 @@
         FilteringObjective dhcpUpstream = dhcpUpstreamBuilder.add(new ObjectiveContext() {
             @Override
             public void onSuccess(Objective objective) {
-                log.info("DHCP {} filter for device {} on port {} {}.",
+                log.info("DHCP {} filter for dev/port {}/{} {}.",
                         (ethType.equals(EthType.EtherType.IPV4.ethType())) ? V4 : V6,
                         devId, port, (install) ? INSTALLED : REMOVED);
             }
 
             @Override
             public void onError(Objective objective, ObjectiveError error) {
-                log.info("DHCP {} filter for device {} on port {} failed {} because {}",
+                log.error("DHCP {} filter for dev/port {}/{} failed {} because {}",
                         (ethType.equals(EthType.EtherType.IPV4.ethType())) ? V4 : V6,
                         devId, port, (install) ? INSTALLATION : REMOVAL,
                         error);
@@ -406,13 +405,13 @@
                 .add(new ObjectiveContext() {
                     @Override
                     public void onSuccess(Objective objective) {
-                        log.info("Igmp filter for {} on {} {}.",
+                        log.info("Igmp filter for dev/port {}/{} {}.",
                                 devId, port, (install) ? INSTALLED : REMOVED);
                     }
 
                     @Override
                     public void onError(Objective objective, ObjectiveError error) {
-                        log.info("Igmp filter for {} on {} failed {} because {}.",
+                        log.error("Igmp filter for dev/port {}/{} failed {} because {}.",
                                 devId, port, (install) ? INSTALLATION : REMOVAL,
                                 error);
                     }
@@ -433,11 +432,12 @@
             }
             return;
         }
-
+        log.info("Processing EAPOL with Bandwidth profile {} on {}/{}", bpId,
+                 devId, portNumber);
         BandwidthProfileInformation bpInfo = getBandwidthProfileInformation(bpId);
         if (bpInfo == null) {
             log.warn("Bandwidth profile {} is not found. Authentication flow"
-                    + " will not be installed", bpId);
+                    + " will not be installed on {}/{}", bpId, devId, portNumber);
             if (filterFuture != null) {
                 filterFuture.complete(ObjectiveError.BADPARAMS);
             }
@@ -445,27 +445,15 @@
         }
 
         ConnectPoint cp = new ConnectPoint(devId, portNumber);
-        if (install) {
-            boolean added = pendingAddEapol.add(cp);
-            if (!added) {
-                if (filterFuture != null) {
-                    log.warn("The eapol flow is processing for the port {}. Ignoring this request", portNumber);
-                    filterFuture.complete(null);
-                }
-                return;
-            }
-            log.info("connectPoint added to pendingAddEapol map {}", cp.toString());
-        }
-
         DefaultFilteringObjective.Builder filterBuilder = DefaultFilteringObjective.builder();
         TrafficTreatment.Builder treatmentBuilder = DefaultTrafficTreatment.builder();
         CompletableFuture<Object> meterFuture = new CompletableFuture<>();
-
         // check if meter exists and create it only for an install
         final MeterId meterId = oltMeterService.getMeterIdFromBpMapping(devId, bpInfo.id());
+        log.info("Meter id {} for Bandwidth profile {} associated to EAPOL on {}", meterId, bpInfo.id(), devId);
         if (meterId == null) {
             if (install) {
-                log.debug("Need to install meter for EAPOL with bwp {}", bpInfo.id());
+                log.debug("Need to install meter for EAPOL with bwp {} on dev/port {}", bpInfo.id(), cp.toString());
                 SubscriberFlowInfo fi = new SubscriberFlowInfo(devId, null, cp.port(),
                                                                new UniTagInformation.Builder()
                                                                        .setPonCTag(vlanId).build(),
@@ -486,7 +474,7 @@
                 // Nevertheless we can still delete the flow as we only need the
                 // correct 'match' to do so.
                 log.warn("Unknown meter id for bp {}, still proceeding with "
-                        + "delete of eapol flow for {}/{}", bpInfo.id(), devId, portNumber);
+                        + "delete of eapol flow for {}", bpInfo.id(), cp.toString());
                 SubscriberFlowInfo fi = new SubscriberFlowInfo(devId, null, cp.port(),
                                                                new UniTagInformation.Builder()
                                                                        .setPonCTag(vlanId).build(),
@@ -495,7 +483,7 @@
                 handleEapol(filterFuture, install, cp, filterBuilder, treatmentBuilder, fi, meterId);
             }
         } else {
-            log.debug("Meter {} was previously created for bp {}", meterId, bpInfo.id());
+            log.debug("Meter {} was previously created for bp {} on {}", meterId, bpInfo.id(), cp.toString());
             SubscriberFlowInfo fi = new SubscriberFlowInfo(devId, null, cp.port(),
                                                            new UniTagInformation.Builder()
                                                                    .setPonCTag(vlanId).build(),
@@ -507,19 +495,24 @@
         }
         meterFuture.thenAcceptAsync(result -> {
             //for each pending eapol flow we check if the meter is there.
+            //TODO possibly the iterator gets taken at time t0, while the sub is added at time t1
+            // and thus never considered
             Iterator<SubscriberFlowInfo> eapIterator = pendingEapolForMeters.iterator();
             while (eapIterator.hasNext()) {
                 SubscriberFlowInfo fi = eapIterator.next();
+                log.debug("handing pending eapol on {}/{} for {}", fi.getDevId(), fi.getUniPort(), fi);
                 if (result == null) {
                     MeterId mId = oltMeterService
                             .getMeterIdFromBpMapping(devId, fi.getUpBpInfo());
                     if (mId != null) {
+                        log.debug("Meter installation completed for subscriber on {}, handling EAPOL trap flow",
+                                cp.toString());
                         handleEapol(filterFuture, install, cp, filterBuilder, treatmentBuilder, fi, mId);
                         eapIterator.remove();
                     }
                 } else {
-                    log.warn("Meter installation error while sending eapol trap flow. " +
-                                     "Result {} and MeterId {}", result, meterId);
+                    log.warn("Meter installation error while sending EAPOL trap flow to {}. " +
+                                     "Result {} and MeterId {}", cp.toString(), result, meterId);
                     eapIterator.remove();
                 }
                 oltMeterService.removeFromPendingMeters(devId, bpInfo);
@@ -557,18 +550,17 @@
                 .add(new ObjectiveContext() {
                     @Override
                     public void onSuccess(Objective objective) {
-                        log.info("Eapol filter {} for {} on {} {} with meter {}.",
+                        log.info("Eapol filter {} for {} on {}/{} with meter {}.",
                                  objective.id(), fi.getDevId(), fi.getUniPort(),
                                  (install) ? INSTALLED : REMOVED, mId);
                         if (filterFuture != null) {
                             filterFuture.complete(null);
                         }
-                        pendingAddEapol.remove(cp);
                     }
 
                     @Override
                     public void onError(Objective objective, ObjectiveError error) {
-                        log.error("Eapol filter {} for {} on {} with meter {} " +
+                        log.error("Eapol filter {} for {}/{} with meter {} " +
                                          "failed {} because {}", objective.id(),
                                  fi.getDevId(), fi.getUniPort(), mId,
                                  (install) ? INSTALLATION : REMOVAL,
@@ -576,7 +568,6 @@
                         if (filterFuture != null) {
                             filterFuture.complete(error);
                         }
-                        pendingAddEapol.remove(cp);
                     }
                 });
         flowObjectiveService.filter(fi.getDevId(), eapol);
@@ -614,13 +605,13 @@
                 .add(new ObjectiveContext() {
                     @Override
                     public void onSuccess(Objective objective) {
-                        log.info("LLDP filter for device {} on port {} {}.",
+                        log.info("LLDP filter for dev/port {}/{} {}.",
                                 devId, port, (install) ? INSTALLED : REMOVED);
                     }
 
                     @Override
                     public void onError(Objective objective, ObjectiveError error) {
-                        log.info("LLDP filter for device {} on port {} failed {} because {}",
+                        log.error("LLDP filter for dev/port {}/{} failed {} because {}",
                                 devId, port, (install) ? INSTALLATION : REMOVAL,
                                 error);
                     }
@@ -751,8 +742,6 @@
     @Override
     public void clearDeviceState(DeviceId deviceId) {
         pendingEapolForMeters.removeIf(fi -> fi.getDevId().equals(deviceId));
-        pendingAddEapol.removeIf(connectPoint -> connectPoint.deviceId().equals(deviceId));
-
     }
 
     private DefaultForwardingObjective.Builder createForwardingObjectiveBuilder(TrafficSelector selector,
diff --git a/app/src/main/java/org/opencord/olt/impl/OltMeterService.java b/app/src/main/java/org/opencord/olt/impl/OltMeterService.java
index 478e280..d57f3c1 100644
--- a/app/src/main/java/org/opencord/olt/impl/OltMeterService.java
+++ b/app/src/main/java/org/opencord/olt/impl/OltMeterService.java
@@ -166,10 +166,10 @@
                         ImmutableMap::copyOf));
     }
 
-    void addMeterIdToBpMapping(DeviceId deviceId, MeterId meterId, String bandwidthProfile) {
+    boolean addMeterIdToBpMapping(DeviceId deviceId, MeterId meterId, String bandwidthProfile) {
         log.debug("adding bp {} to meter {} mapping for device {}",
                  bandwidthProfile, meterId, deviceId);
-        bpInfoToMeter.put(bandwidthProfile, MeterKey.key(deviceId, meterId));
+        return bpInfoToMeter.put(bandwidthProfile, MeterKey.key(deviceId, meterId));
     }
 
     @Override
@@ -185,12 +185,12 @@
                 .filter(meterKey -> meterKey.deviceId().equals(deviceId))
                 .findFirst();
         if (meterKeyForDevice.isPresent()) {
-            log.debug("Found meter {} for bandwidth profile {}",
-                    meterKeyForDevice.get().meterId(), bandwidthProfile);
+            log.debug("Found meter {} for bandwidth profile {} on {}",
+                    meterKeyForDevice.get().meterId(), bandwidthProfile, deviceId);
             return meterKeyForDevice.get().meterId();
         } else {
-            log.warn("Bandwidth Profile '{}' is not currently mapped to a meter in {}",
-                     bandwidthProfile, bpInfoToMeter.get(bandwidthProfile).value());
+            log.warn("Bandwidth Profile '{}' is not currently mapped to a meter on {} , {}",
+                     bandwidthProfile, deviceId, bpInfoToMeter.get(bandwidthProfile).value());
             return null;
         }
     }
@@ -207,7 +207,7 @@
                                CompletableFuture<Object> meterFuture) {
         log.debug("Creating meter on {} for {}", deviceId, bpInfo);
         if (bpInfo == null) {
-            log.warn("Requested bandwidth profile information is NULL");
+            log.warn("Requested bandwidth profile on {} information is NULL", deviceId);
             meterFuture.complete(ObjectiveError.BADPARAMS);
             return null;
         }
@@ -228,10 +228,16 @@
                 .withContext(new MeterContext() {
                     @Override
                     public void onSuccess(MeterRequest op) {
-                        log.debug("Meter {} is installed on the device {}",
-                                 meterIdRef.get(), deviceId);
-                        addMeterIdToBpMapping(deviceId, meterIdRef.get(), bpInfo.id());
-                        meterFuture.complete(null);
+                        log.debug("Meter {} for {} is installed on the device {}",
+                                  meterIdRef.get(), bpInfo.id(), deviceId);
+                        boolean added = addMeterIdToBpMapping(deviceId, meterIdRef.get(), bpInfo.id());
+                        if (added) {
+                            meterFuture.complete(null);
+                        } else {
+                            log.error("Failed to add Meter {} for {} on {} to the meter-bandwidth mapping",
+                                      meterIdRef.get(), bpInfo.id(), deviceId);
+                            meterFuture.complete(ObjectiveError.UNKNOWN);
+                        }
                     }
 
                     @Override
@@ -270,7 +276,7 @@
     public synchronized boolean checkAndAddPendingMeter(DeviceId deviceId, BandwidthProfileInformation bwpInfo) {
         if (pendingMeters.containsKey(deviceId)
                 && pendingMeters.get(deviceId).contains(bwpInfo)) {
-            log.debug("Meter is already pending for EAPOL on {} with bp {}",
+            log.debug("Meter is already pending on {} with bp {}",
                       deviceId, bwpInfo);
             return false;
         }