mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-02 11:37:49 +00:00
APs running into Backoff shows as connected.
Signed-off-by: Mike Hansen <mike.hansen@connectus.ai>
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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 + "]";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -65,9 +59,6 @@ public class OpensyncMqttClient implements ApplicationListener<ContextClosedEven
|
||||
@Autowired
|
||||
private StatsPublisherInterface statsPublisher;
|
||||
|
||||
@Autowired
|
||||
private OvsdbSessionMapInterface ovsdbSessionMapInterface;
|
||||
|
||||
// dtop: use anonymous constructor to ensure that the following code always
|
||||
// get executed,
|
||||
// even when somebody adds another constructor in here
|
||||
@@ -193,16 +184,6 @@ public class OpensyncMqttClient implements ApplicationListener<ContextClosedEven
|
||||
// Only supported protobuf on the TIP opensync APs is Report
|
||||
Report statsReport = Report.parseFrom(payload);
|
||||
mqttMsg.ack();
|
||||
String apId = extractApIdFromTopic(mqttMsg.getTopic());
|
||||
if (apId != null) {
|
||||
OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(extractApIdFromTopic(mqttMsg.getTopic()));
|
||||
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);
|
||||
}
|
||||
}
|
||||
MQTT_LOG.info("Topic {}\n{}", mqttMsg.getTopic(), jsonPrinter.print(statsReport));
|
||||
statsPublisher.processMqttMessage(mqttMsg.getTopic(), statsReport);
|
||||
LOG.debug("Dispatched report for topic {} to backend for processing", mqttMsg.getTopic());
|
||||
@@ -245,25 +226,4 @@ public class OpensyncMqttClient implements ApplicationListener<ContextClosedEven
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param topic
|
||||
* @return apId extracted from the topic name, or null if it cannot be
|
||||
* extracted
|
||||
*/
|
||||
static String extractApIdFromTopic(String topic) {
|
||||
// Topic is formatted as
|
||||
// "/ap/"+clientCn+"_"+ret.serialNumber+"/opensync"
|
||||
if (topic == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String[] parts = topic.split("/");
|
||||
if (parts.length < 3) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// apId is the third element in the topic
|
||||
return parts[2];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user