From cbd27b37bfb3a8745463592b16e91bc3aee3834d Mon Sep 17 00:00:00 2001 From: Mike Hansen Date: Wed, 21 Jul 2021 10:56:39 -0400 Subject: [PATCH] APs running into Backoff shows as connected. Signed-off-by: Mike Hansen --- .../integration/utils/MqttStatsPublisher.java | 11 +++++ .../external/integration/OvsdbSession.java | 27 +------------ .../opensync/mqtt/OpensyncMqttClient.java | 40 ------------------- 3 files changed, 12 insertions(+), 66 deletions(-) diff --git a/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/utils/MqttStatsPublisher.java b/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/utils/MqttStatsPublisher.java index 67f18c1..020ec2c 100644 --- a/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/utils/MqttStatsPublisher.java +++ b/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/utils/MqttStatsPublisher.java @@ -161,6 +161,7 @@ public class MqttStatsPublisher implements StatsPublisherInterface { @Override @Async public void processMqttMessage(String topic, Report report) { + long startTime = System.nanoTime(); String apId = extractApIdFromTopic(topic); LOG.info("Received report on topic {} for ap {}", topic, report.getNodeID()); @@ -170,6 +171,16 @@ public class MqttStatsPublisher implements StatsPublisherInterface { return; } + if (apId != null) { + OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(extractApIdFromTopic(topic)); + if (ovsdbSession != null) { + ovsdbSession.setMostRecentStatsTimestamp(System.currentTimeMillis()); + LOG.debug("Last metrics received from AP updated to {}",ovsdbSession.toString()); + } else { + LOG.debug("No ovsdb session exists for this AP {}",apId); + } + } + int customerId = ce.getCustomerId(); long equipmentId = ce.getId(); long locationId = ce.getLocationId(); diff --git a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OvsdbSession.java b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OvsdbSession.java index a263ec7..8334982 100644 --- a/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OvsdbSession.java +++ b/opensync-ext-interface/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OvsdbSession.java @@ -1,7 +1,5 @@ package com.telecominfraproject.wlan.opensync.external.integration; -import java.util.Objects; - import com.vmware.ovsdb.service.OvsdbClient; public class OvsdbSession { @@ -41,28 +39,5 @@ public class OvsdbSession { public void setMostRecentStatsTimestamp(long mostRecentStatsTimestamp) { this.mostRecentStatsTimestamp = mostRecentStatsTimestamp; } - @Override - public int hashCode() { - return Objects.hash(apId, equipmentId, mostRecentStatsTimestamp, ovsdbClient, routingId); - } - @Override - public boolean equals(Object obj) { - if (this == obj) - return true; - if (obj == null) - return false; - if (getClass() != obj.getClass()) - return false; - OvsdbSession other = (OvsdbSession) obj; - return Objects.equals(apId, other.apId) && equipmentId == other.equipmentId && mostRecentStatsTimestamp == other.mostRecentStatsTimestamp - && Objects.equals(ovsdbClient, other.ovsdbClient) && routingId == other.routingId; - } - - @Override - public String toString() { - return "OvsdbSession [ovsdbClient=" + ovsdbClient + ", apId=" + apId + ", routingId=" + routingId + ", equipmentId=" + equipmentId - + ", mostRecentStatsTimestamp=" + mostRecentStatsTimestamp + "]"; - } - - + } diff --git a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/mqtt/OpensyncMqttClient.java b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/mqtt/OpensyncMqttClient.java index 2c13460..a09559d 100644 --- a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/mqtt/OpensyncMqttClient.java +++ b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/mqtt/OpensyncMqttClient.java @@ -11,10 +11,6 @@ import org.fusesource.mqtt.client.MQTT; import org.fusesource.mqtt.client.Message; import org.fusesource.mqtt.client.QoS; import org.fusesource.mqtt.client.Topic; -import org.fusesource.mqtt.client.Tracer; -import org.fusesource.mqtt.codec.MQTTFrame; -import org.fusesource.mqtt.codec.PINGREQ; -import org.fusesource.mqtt.codec.PINGRESP; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -36,8 +32,6 @@ import com.netflix.servo.monitor.Stopwatch; import com.netflix.servo.monitor.Timer; import com.netflix.servo.tag.TagList; import com.telecominfraproject.wlan.cloudmetrics.CloudMetricsTags; -import com.telecominfraproject.wlan.opensync.external.integration.OvsdbSession; -import com.telecominfraproject.wlan.opensync.external.integration.OvsdbSessionMapInterface; import com.telecominfraproject.wlan.opensync.external.integration.utils.StatsPublisherInterface; import com.telecominfraproject.wlan.opensync.util.ZlibUtil; @@ -64,9 +58,6 @@ public class OpensyncMqttClient implements ApplicationListener