mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-01 11:07:49 +00:00
Update mqtt client and google protobuf versions
This commit is contained in:
@@ -68,7 +68,6 @@ import com.telecominfraproject.wlan.firmware.models.FirmwareTrackRecord;
|
|||||||
import com.telecominfraproject.wlan.firmware.models.FirmwareVersion;
|
import com.telecominfraproject.wlan.firmware.models.FirmwareVersion;
|
||||||
import com.telecominfraproject.wlan.location.models.Location;
|
import com.telecominfraproject.wlan.location.models.Location;
|
||||||
import com.telecominfraproject.wlan.location.service.LocationServiceInterface;
|
import com.telecominfraproject.wlan.location.service.LocationServiceInterface;
|
||||||
import com.telecominfraproject.wlan.manufacturer.ManufacturerInterface;
|
|
||||||
import com.telecominfraproject.wlan.opensync.external.integration.controller.OpensyncCloudGatewayController;
|
import com.telecominfraproject.wlan.opensync.external.integration.controller.OpensyncCloudGatewayController;
|
||||||
import com.telecominfraproject.wlan.opensync.external.integration.controller.OpensyncCloudGatewayController.ListOfEquipmentCommandResponses;
|
import com.telecominfraproject.wlan.opensync.external.integration.controller.OpensyncCloudGatewayController.ListOfEquipmentCommandResponses;
|
||||||
import com.telecominfraproject.wlan.opensync.external.integration.models.ConnectNodeInfo;
|
import com.telecominfraproject.wlan.opensync.external.integration.models.ConnectNodeInfo;
|
||||||
|
|||||||
@@ -1,15 +1,17 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
<modelVersion>4.0.0</modelVersion>
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
<parent>
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
<groupId>com.telecominfraproject.wlan</groupId>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
<parent>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<groupId>com.telecominfraproject.wlan</groupId>
|
||||||
<relativePath>../../wlan-cloud-root</relativePath>
|
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||||
</parent>
|
<version>0.0.1-SNAPSHOT</version>
|
||||||
<artifactId>opensync-gateway</artifactId>
|
<relativePath>../../wlan-cloud-root</relativePath>
|
||||||
<name>opensync-gateway</name>
|
</parent>
|
||||||
<description>Redirector and Controller for OpenSync</description>
|
<artifactId>opensync-gateway</artifactId>
|
||||||
|
<name>opensync-gateway</name>
|
||||||
|
<description>Redirector and Controller for OpenSync</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
<dependency>
|
<dependency>
|
||||||
<artifactId>base-container</artifactId>
|
<artifactId>base-container</artifactId>
|
||||||
@@ -23,37 +25,38 @@
|
|||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.vmware.ovsdb</groupId>
|
<groupId>com.vmware.ovsdb</groupId>
|
||||||
<artifactId>ovsdb-client</artifactId>
|
<artifactId>ovsdb-client</artifactId>
|
||||||
<version>1.0.1</version>
|
<version>1.0.1</version>
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<artifactId>slf4j-log4j12</artifactId>
|
<artifactId>slf4j-log4j12</artifactId>
|
||||||
<groupId>org.slf4j</groupId>
|
<groupId>org.slf4j</groupId>
|
||||||
</exclusion>
|
</exclusion>
|
||||||
</exclusions>
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- MQTT dependencies BEGIN -->
|
<!-- MQTT dependencies BEGIN -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.telecominfraproject.wlan</groupId>
|
<groupId>com.telecominfraproject.wlan</groupId>
|
||||||
<artifactId>tip-wlan-opensync-protobuf</artifactId>
|
<artifactId>tip-wlan-opensync-protobuf</artifactId>
|
||||||
<version>${tip-wlan-cloud.release.version}</version>
|
<version>${tip-wlan-cloud.release.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- https://mvnrepository.com/artifact/com.google.protobuf/protobuf-java-util -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.protobuf</groupId>
|
<groupId>com.google.protobuf</groupId>
|
||||||
<artifactId>protobuf-java-util</artifactId>
|
<artifactId>protobuf-java-util</artifactId>
|
||||||
<version>3.11.1</version>
|
<version>3.12.4</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.fusesource.mqtt-client</groupId>
|
<groupId>org.fusesource.mqtt-client</groupId>
|
||||||
<artifactId>mqtt-client</artifactId>
|
<artifactId>mqtt-client</artifactId>
|
||||||
<version>1.12</version>
|
<version>1.16</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<!-- MQTT dependencies END -->
|
<!-- MQTT dependencies END -->
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -4,9 +4,7 @@ import java.nio.charset.Charset;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.TimeUnit;
|
|
||||||
|
|
||||||
import org.fusesource.mqtt.client.BlockingConnection;
|
|
||||||
import org.fusesource.mqtt.client.FutureConnection;
|
import org.fusesource.mqtt.client.FutureConnection;
|
||||||
import org.fusesource.mqtt.client.MQTT;
|
import org.fusesource.mqtt.client.MQTT;
|
||||||
import org.fusesource.mqtt.client.Message;
|
import org.fusesource.mqtt.client.Message;
|
||||||
@@ -82,10 +80,11 @@ public class OpensyncMqttClient implements ApplicationListener<ContextClosedEven
|
|||||||
}
|
}
|
||||||
|
|
||||||
Runnable mqttClientRunnable = new Runnable() {
|
Runnable mqttClientRunnable = new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
while (keepReconnecting) {
|
while (keepReconnecting) {
|
||||||
BlockingConnection connection = null;
|
FutureConnection futureConnection = null;
|
||||||
try {
|
try {
|
||||||
Thread.sleep(5000);
|
Thread.sleep(5000);
|
||||||
|
|
||||||
@@ -131,10 +130,9 @@ public class OpensyncMqttClient implements ApplicationListener<ContextClosedEven
|
|||||||
|
|
||||||
// TODO: revisit this blocking connection, change it to
|
// TODO: revisit this blocking connection, change it to
|
||||||
// futureConnection
|
// futureConnection
|
||||||
FutureConnection futureConnection = mqtt.futureConnection();
|
futureConnection = mqtt.futureConnection();
|
||||||
futureConnection.connect();
|
futureConnection.connect();
|
||||||
// connection = mqtt.blockingConnection();
|
|
||||||
// connection.connect();
|
|
||||||
LOG.info("Connected to MQTT broker at {}", mqtt.getHost());
|
LOG.info("Connected to MQTT broker at {}", mqtt.getHost());
|
||||||
|
|
||||||
// Subscribe to topics:
|
// Subscribe to topics:
|
||||||
@@ -161,12 +159,11 @@ public class OpensyncMqttClient implements ApplicationListener<ContextClosedEven
|
|||||||
// main loop - receive messages
|
// main loop - receive messages
|
||||||
while (true) {
|
while (true) {
|
||||||
Message mqttMsg = futureConnection.receive().await();
|
Message mqttMsg = futureConnection.receive().await();
|
||||||
// Message mqttMsg = connection.receive(5, TimeUnit.SECONDS);
|
|
||||||
|
|
||||||
if (mqttMsg == null) {
|
if (mqttMsg == null) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.debug("MQTT Topic {}", mqttMsg.getTopic());
|
LOG.debug("MQTT Topic {}", mqttMsg.getTopic());
|
||||||
|
|
||||||
byte payload[] = mqttMsg.getPayload();
|
byte payload[] = mqttMsg.getPayload();
|
||||||
@@ -197,28 +194,36 @@ public class OpensyncMqttClient implements ApplicationListener<ContextClosedEven
|
|||||||
try {
|
try {
|
||||||
|
|
||||||
encodedMsg = Report.parseFrom(payload);
|
encodedMsg = Report.parseFrom(payload);
|
||||||
|
|
||||||
MQTT_LOG.info("topic = {} Report = {}", mqttMsg.getTopic(),
|
MQTT_LOG.info("topic = {} Report = {}", mqttMsg.getTopic(),
|
||||||
jsonPrinter.print(encodedMsg));
|
jsonPrinter.print(encodedMsg));
|
||||||
|
|
||||||
|
|
||||||
extIntegrationInterface.processMqttMessage(mqttMsg.getTopic(), (Report) encodedMsg);
|
extIntegrationInterface.processMqttMessage(mqttMsg.getTopic(), (Report) encodedMsg);
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
try {
|
try {
|
||||||
// not a plume_stats report, attempt to
|
// not a opensync_stats report, attempt to
|
||||||
// deserialize as network_metadata
|
// deserialize as network_metadata
|
||||||
encodedMsg = FlowReport.parseFrom(payload);
|
encodedMsg = FlowReport.parseFrom(payload);
|
||||||
|
|
||||||
MQTT_LOG.info("topic = {} FlowReport = {}", mqttMsg.getTopic(),
|
MQTT_LOG.info("topic = {} FlowReport = {}", mqttMsg.getTopic(),
|
||||||
jsonPrinter.print(encodedMsg));
|
jsonPrinter.print(encodedMsg));
|
||||||
|
|
||||||
extIntegrationInterface.processMqttMessage(mqttMsg.getTopic(),
|
extIntegrationInterface.processMqttMessage(mqttMsg.getTopic(),
|
||||||
(FlowReport) encodedMsg);
|
(FlowReport) encodedMsg);
|
||||||
} catch (Exception e1) {
|
} catch (Exception e1) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// not a plume_stats report and not
|
// not a opensync_stats report and not
|
||||||
// network_metadata report, attempt to
|
// network_metadata report, attempt to
|
||||||
// deserialize as WCStatsReport
|
// deserialize as WCStatsReport
|
||||||
encodedMsg = WCStatsReport.parseFrom(payload);
|
encodedMsg = WCStatsReport.parseFrom(payload);
|
||||||
|
|
||||||
MQTT_LOG.info("topic = {} IpDnsTelemetry = {}", mqttMsg.getTopic(),
|
MQTT_LOG.info("topic = {} IpDnsTelemetry = {}", mqttMsg.getTopic(),
|
||||||
jsonPrinter.print(encodedMsg));
|
jsonPrinter.print(encodedMsg));
|
||||||
|
|
||||||
|
|
||||||
extIntegrationInterface.processMqttMessage(mqttMsg.getTopic(),
|
extIntegrationInterface.processMqttMessage(mqttMsg.getTopic(),
|
||||||
(WCStatsReport) encodedMsg);
|
(WCStatsReport) encodedMsg);
|
||||||
} catch (Exception e2) {
|
} catch (Exception e2) {
|
||||||
@@ -234,8 +239,8 @@ public class OpensyncMqttClient implements ApplicationListener<ContextClosedEven
|
|||||||
LOG.error("Exception in MQTT receiver", e);
|
LOG.error("Exception in MQTT receiver", e);
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
if (connection != null) {
|
if (futureConnection != null) {
|
||||||
connection.disconnect();
|
futureConnection.disconnect();
|
||||||
}
|
}
|
||||||
} catch (Exception e1) {
|
} catch (Exception e1) {
|
||||||
// do nothing
|
// do nothing
|
||||||
|
|||||||
Reference in New Issue
Block a user