mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-01 19:17:52 +00:00
Renamed projects to follow a naming convention. Moved KDC-specific projects into a separate repository
This commit is contained in:
@@ -1,27 +1,26 @@
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>root-pom</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>ai.connectus</groupId>
|
||||
<artifactId>opensync_ext_interface</artifactId>
|
||||
<name>opensync_ext_interface</name>
|
||||
<artifactId>opensync-ext-interface</artifactId>
|
||||
<name>opensync-ext-interface</name>
|
||||
<description>Interface that defines how opensync gateway gets the AP config</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>base-models</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ai.connectus</groupId>
|
||||
<artifactId>opensync_protobuf</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<version>${tip-wlan-cloud.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>opensync_protobuf</artifactId>
|
||||
<version>${tip-wlan-cloud.release.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<dependency>
|
||||
<groupId>com.vmware.ovsdb</groupId>
|
||||
<artifactId>ovsdb-client</artifactId>
|
||||
<version>1.0.1</version>
|
||||
@@ -31,7 +30,7 @@
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
</project>
|
||||
@@ -1,19 +1,18 @@
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>root-pom</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>ai.connectus</groupId>
|
||||
<artifactId>opensync_ext_static</artifactId>
|
||||
<name>opensync_ext_static</name>
|
||||
</parent>
|
||||
<artifactId>opensync-ext-static</artifactId>
|
||||
<name>opensync-ext-static</name>
|
||||
<description>Configuration interface that provides static config from the file</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>ai.connectus</groupId>
|
||||
<artifactId>opensync_ext_interface</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>opensync-ext-interface</artifactId>
|
||||
<version>${tip-wlan-cloud.release.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
</project>
|
||||
@@ -1,14 +1,13 @@
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>ai.connectus</groupId>
|
||||
<artifactId>opensync_gateway_build</artifactId>
|
||||
<artifactId>opensync-gateway-build</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>opensync_gateway_build</name>
|
||||
<name>opensync-gateway-build</name>
|
||||
<description>Aggregation of modules, to build everything related to Opensync Gateway</description>
|
||||
<profiles>
|
||||
|
||||
@@ -19,13 +18,11 @@
|
||||
</activation>
|
||||
|
||||
<modules>
|
||||
<module>../opensync_ext_interface</module>
|
||||
<module>../opensync_ext_kdc</module>
|
||||
<module>../opensync_ext_static</module>
|
||||
<module>../opensync_gateway</module>
|
||||
<module>../opensync_gateway_kdc_process</module>
|
||||
<module>../opensync_gateway_static_process</module>
|
||||
<module>../opensync-ext-interface</module>
|
||||
<module>../opensync-ext-static</module>
|
||||
<module>../opensync-gateway</module>
|
||||
<module>../opensync-gateway-static-process</module>
|
||||
</modules>
|
||||
</profile>
|
||||
</profiles>
|
||||
</project>
|
||||
</project>
|
||||
@@ -1,14 +1,13 @@
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>root-pom</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>ai.connectus</groupId>
|
||||
<artifactId>opensync_gateway_static_process</artifactId>
|
||||
<name>opensync_gateway_static_process</name>
|
||||
<description>Process definition for opensync_gateway that uses static configuration</description>
|
||||
</parent>
|
||||
<artifactId>opensync-gateway-static-process</artifactId>
|
||||
<name>opensync-gateway-static-process</name>
|
||||
<description>Process definition for opensync gateway that uses static configuration</description>
|
||||
|
||||
<properties>
|
||||
<start-class>ai.connectus.opensync.experiment.OpenSyncProcess</start-class>
|
||||
@@ -16,14 +15,14 @@
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>ai.connectus</groupId>
|
||||
<artifactId>opensync_gateway</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>opensync-gateway</artifactId>
|
||||
<version>${tip-wlan-cloud.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ai.connectus</groupId>
|
||||
<artifactId>opensync_ext_static</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>opensync-ext-static</artifactId>
|
||||
<version>${tip-wlan-cloud.release.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
@@ -37,4 +36,4 @@
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
</project>
|
||||
58
opensync-gateway/pom.xml
Normal file
58
opensync-gateway/pom.xml
Normal file
@@ -0,0 +1,58 @@
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<artifactId>opensync-gateway</artifactId>
|
||||
<name>opensync-gateway</name>
|
||||
<description>Redirector and Controller for OpenSync</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<artifactId>base-container</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>${tip-wlan-cloud.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>opensync-ext-interface</artifactId>
|
||||
<version>${tip-wlan-cloud.release.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.vmware.ovsdb</groupId>
|
||||
<artifactId>ovsdb-client</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- MQTT dependencies BEGIN -->
|
||||
<dependency>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>opensync_protobuf</artifactId>
|
||||
<version>${tip-wlan-cloud.release.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-java-util</artifactId>
|
||||
<version>3.11.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.fusesource.mqtt-client</groupId>
|
||||
<artifactId>mqtt-client</artifactId>
|
||||
<version>1.12</version>
|
||||
</dependency>
|
||||
<!-- MQTT dependencies END -->
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,157 +0,0 @@
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>ai.connectus</groupId>
|
||||
<artifactId>opensync_ext_kdc</artifactId>
|
||||
<name>opensync_ext_kdc</name>
|
||||
<description>Component that reads AP configuration from the KDC deployment, and registers/deregisters APs in there.</description>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>ai.connectus</groupId>
|
||||
<artifactId>opensync_ext_interface</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>base-container</artifactId>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>equipment-configuration-manager-service-remote</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>equipment-and-network-management-service-remote</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>equipment-routing-service-remote</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>order-and-subscription-management-service-remote</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>equipment-metrics-collector-service-remote</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>equipment-status-and-alarm-collector-service-remote</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- KDC models -->
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>service-metrics-models</artifactId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>rule-engine-partitioning-models</artifactId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>equipment-and-network-status-models</artifactId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>customer-account-models</artifactId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>service-subscription-models</artifactId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>equipment-inventory-models</artifactId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>equipment-routing-info-models</artifactId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>equipment-and-network-config-models</artifactId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>radio-resource-planner-models</artifactId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>system-event-models</artifactId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>issue-and-action-report-models</artifactId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>preferences-models</artifactId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>cami-models</artifactId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>ml-results-models</artifactId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>client-models</artifactId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>rogue-ap-models</artifactId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>msp-account-models</artifactId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>equipment-configuration-manager-models</artifactId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>email-notification-models</artifactId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>recommendation-models</artifactId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
@@ -1,910 +0,0 @@
|
||||
package ai.connectus.opensync.external.integration;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Callable;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.cache.Cache;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.context.annotation.Profile;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.whizcontrol.core.model.equipment.DetectedAuthMode;
|
||||
import com.whizcontrol.core.model.equipment.EquipmentType;
|
||||
import com.whizcontrol.core.model.equipment.MacAddress;
|
||||
import com.whizcontrol.core.model.equipment.NeighboreScanPacketType;
|
||||
import com.whizcontrol.core.model.equipment.NetworkType;
|
||||
import com.whizcontrol.core.model.equipment.RadioType;
|
||||
import com.whizcontrol.core.model.equipment.Toggle;
|
||||
import com.whizcontrol.equipmentandnetworkconfig.models.ApElementConfiguration;
|
||||
import com.whizcontrol.equipmentandnetworkconfig.models.ApElementConfiguration.ApModel;
|
||||
import com.whizcontrol.equipmentandnetworkconfig.models.CountryCode;
|
||||
import com.whizcontrol.equipmentandnetworkconfig.models.DeviceMode;
|
||||
import com.whizcontrol.equipmentandnetworkconfig.models.ElementRadioConfiguration;
|
||||
import com.whizcontrol.equipmentandnetworkconfig.models.EquipmentElementConfiguration;
|
||||
import com.whizcontrol.equipmentandnetworkconfig.models.GettingDNS;
|
||||
import com.whizcontrol.equipmentandnetworkconfig.models.GettingIP;
|
||||
import com.whizcontrol.equipmentandnetworkconfig.models.SsidConfiguration;
|
||||
import com.whizcontrol.equipmentandnetworkconfig.models.SsidConfiguration.AppliedRadio;
|
||||
import com.whizcontrol.equipmentandnetworkconfig.models.SsidConfiguration.SecureMode;
|
||||
import com.whizcontrol.equipmentandnetworkconfig.models.StateSetting;
|
||||
import com.whizcontrol.equipmentandnetworkmanagement.EquipmentAndNetworkManagementInterface;
|
||||
import com.whizcontrol.equipmentandnetworkstatus.models.EquipmentProtocolState;
|
||||
import com.whizcontrol.equipmentandnetworkstatus.models.StatusCode;
|
||||
import com.whizcontrol.equipmentandnetworkstatus.models.equipment.CustomerEquipmentStatusRecord;
|
||||
import com.whizcontrol.equipmentandnetworkstatus.models.equipment.EquipmentAdminStatusData;
|
||||
import com.whizcontrol.equipmentandnetworkstatus.models.equipment.EquipmentLANStatusData;
|
||||
import com.whizcontrol.equipmentandnetworkstatus.models.equipment.EquipmentProtocolStatusData;
|
||||
import com.whizcontrol.equipmentandnetworkstatus.models.equipment.VLANStatusData;
|
||||
import com.whizcontrol.equipmentconfigurationmanager.EquipmentConfigurationManagerInterface;
|
||||
import com.whizcontrol.equipmentconfigurationmanager.models.ResolvedEquipmentConfiguration;
|
||||
import com.whizcontrol.equipmentinventory.models.CustomerEquipment;
|
||||
import com.whizcontrol.equipmentmetricscollector.EquipmentMetricsCollectorInterface;
|
||||
import com.whizcontrol.equipmentrouting.EquipmentRoutingInterface;
|
||||
import com.whizcontrol.equipmentroutinginfo.models.EquipmentRoutingRecord;
|
||||
import com.whizcontrol.equipmentstatusandalarmcollector.EquipmentStatusAndAlarmCollectorInterface;
|
||||
import com.whizcontrol.orderandsubscriptionmanagement.OrderAndSubscriptionManagementInterface;
|
||||
import com.whizcontrol.servicemetrics.models.APDemoMetric;
|
||||
import com.whizcontrol.servicemetrics.models.ApClientMetrics;
|
||||
import com.whizcontrol.servicemetrics.models.ApPerformance;
|
||||
import com.whizcontrol.servicemetrics.models.ClientMetrics;
|
||||
import com.whizcontrol.servicemetrics.models.EthernetLinkState;
|
||||
import com.whizcontrol.servicemetrics.models.NeighbourReport;
|
||||
import com.whizcontrol.servicemetrics.models.NeighbourScanReports;
|
||||
import com.whizcontrol.servicemetrics.models.RadioUtilization;
|
||||
import com.whizcontrol.servicemetrics.models.SingleMetricRecord;
|
||||
|
||||
import ai.connectus.opensync.external.integration.controller.OpensyncKDCGatewayController;
|
||||
import ai.connectus.opensync.external.integration.models.ConnectNodeInfo;
|
||||
import ai.connectus.opensync.external.integration.models.OpensyncAPConfig;
|
||||
import ai.connectus.opensync.external.integration.models.OpensyncAPRadioConfig;
|
||||
import ai.connectus.opensync.external.integration.models.OpensyncAPSsidConfig;
|
||||
|
||||
import sts.PlumeStats.Client;
|
||||
import sts.PlumeStats.ClientReport;
|
||||
import sts.PlumeStats.Device;
|
||||
import sts.PlumeStats.Device.RadioTemp;
|
||||
import sts.PlumeStats.Neighbor;
|
||||
import sts.PlumeStats.Neighbor.NeighborBss;
|
||||
import sts.PlumeStats.RadioBandType;
|
||||
import sts.PlumeStats.Report;
|
||||
import sts.PlumeStats.Survey;
|
||||
import sts.PlumeStats.Survey.SurveySample;
|
||||
import traffic.NetworkMetadata.FlowReport;
|
||||
import wc.stats.IpDnsTelemetry.WCStatsReport;
|
||||
|
||||
@Profile("opensync_kdc_config")
|
||||
@Component
|
||||
public class OpensyncExternalIntegrationKDC implements OpensyncExternalIntegrationInterface {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(OpensyncExternalIntegrationKDC.class);
|
||||
|
||||
@Autowired
|
||||
private EquipmentAndNetworkManagementInterface eqNetworkManagementInterface;
|
||||
|
||||
@Autowired
|
||||
private EquipmentConfigurationManagerInterface eqConfigurationManagerInterface;
|
||||
|
||||
@Autowired
|
||||
private OrderAndSubscriptionManagementInterface orderAndSubscriptionManagementInterface;
|
||||
|
||||
@Autowired
|
||||
private EquipmentMetricsCollectorInterface equipmentMetricsCollectorInterface;
|
||||
|
||||
@Autowired
|
||||
private EquipmentStatusAndAlarmCollectorInterface equipmentStatusInterface;
|
||||
|
||||
/**
|
||||
* Equipment routing provide the qrCode to CE gateway mapping
|
||||
*/
|
||||
@Autowired
|
||||
private EquipmentRoutingInterface eqRoutingInterface;
|
||||
|
||||
@Autowired
|
||||
private OpensyncKDCGatewayController kdcGwController;
|
||||
|
||||
@Autowired
|
||||
private OvsdbSessionMapInterface ovsdbSessionMapInterface;
|
||||
|
||||
@Autowired
|
||||
private CacheManager cacheManagerShortLived;
|
||||
|
||||
@Value("${connectus.ovsdb.autoProvisionedCustomerId:1004}")
|
||||
private int autoProvisionedCustomerId;
|
||||
@Value("${connectus.ovsdb.autoProvisionedLocationId:2}")
|
||||
private int autoProvisionedLocationId;
|
||||
@Value("${connectus.ovsdb.autoProvisionedNetworkConfigId:3}")
|
||||
private long autoProvisionedNetworkConfigId;
|
||||
|
||||
private Cache kdcEquipmentRecordCache;
|
||||
|
||||
@PostConstruct
|
||||
private void postCreate(){
|
||||
LOG.info("Using KDC integration");
|
||||
kdcEquipmentRecordCache = cacheManagerShortLived.getCache("KDC_equipment_record_cache");
|
||||
}
|
||||
|
||||
public CustomerEquipment getCustomerEquipment(String apId) {
|
||||
CustomerEquipment ce = null;
|
||||
|
||||
try {
|
||||
ce = kdcEquipmentRecordCache.get(apId, new Callable<CustomerEquipment>() {
|
||||
@Override
|
||||
public CustomerEquipment call() throws Exception {
|
||||
return eqNetworkManagementInterface.getCustomerEquipmentByQrCode(apId);
|
||||
}
|
||||
});
|
||||
}catch (Exception e) {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
return ce;
|
||||
}
|
||||
|
||||
public void apConnected(String apId, ConnectNodeInfo connectNodeInfo) {
|
||||
LOG.info("AP {} got connected to the gateway", apId);
|
||||
try {
|
||||
|
||||
CustomerEquipment ce = getCustomerEquipment(apId);
|
||||
|
||||
if(ce == null) {
|
||||
|
||||
//auto-provision APs for the demo
|
||||
//we'll use hardcoded customerId/locationId/networkConfigId for the new equipment
|
||||
|
||||
ce = new CustomerEquipment();
|
||||
ce.setEquipmentType(EquipmentType.AP);
|
||||
ce.setModelId("plume");
|
||||
ce.setQrCode(apId);
|
||||
ce = eqNetworkManagementInterface.createCustomerEquipment(ce);
|
||||
|
||||
//bind newly created CE to specified customer
|
||||
Set<Long> equipmentIdsToAdd = new HashSet<Long>();
|
||||
equipmentIdsToAdd.add(ce.getId());
|
||||
orderAndSubscriptionManagementInterface.bindEquipment(autoProvisionedCustomerId, equipmentIdsToAdd);
|
||||
|
||||
// now update CE record itself
|
||||
ce.setName(apId);
|
||||
ce.setCustomerId(autoProvisionedCustomerId);
|
||||
ce.setEquipmentNetworkConfigId(autoProvisionedNetworkConfigId);
|
||||
ce.setLocation(autoProvisionedLocationId);
|
||||
|
||||
ce = eqNetworkManagementInterface.updateCustomerEquipment(ce);
|
||||
|
||||
// create the element configuration
|
||||
LOG.debug("Creating element configuration for AP({})", apId);
|
||||
|
||||
EquipmentElementConfiguration equipmentElementConfiguration = new EquipmentElementConfiguration();
|
||||
EquipmentType equipmentType = ce.getEquipmentType();
|
||||
|
||||
equipmentElementConfiguration.setEquipmentId(ce.getId());
|
||||
equipmentElementConfiguration.setEquipmentType(equipmentType);
|
||||
equipmentElementConfiguration.setCustomerId(ce.getCustomerId());
|
||||
equipmentElementConfiguration.setElementConfigVersion("" + equipmentType + "-V1");
|
||||
|
||||
ApElementConfiguration apElementConfiguration = ApElementConfiguration.createWithDefaults(
|
||||
equipmentElementConfiguration.getElementConfigVersion(),
|
||||
ApModel.INDOOR);
|
||||
|
||||
apElementConfiguration.setGettingIP(GettingIP.dhcp);
|
||||
apElementConfiguration.setGettingDNS(GettingDNS.dhcp);
|
||||
apElementConfiguration.setDeviceMode(DeviceMode.standaloneAP);
|
||||
|
||||
equipmentElementConfiguration.setApElementConfig(apElementConfiguration);
|
||||
|
||||
equipmentElementConfiguration = eqNetworkManagementInterface
|
||||
.createEquipmentElementConfiguration(equipmentElementConfiguration);
|
||||
|
||||
// Establish admin status for the new equipment.
|
||||
try {
|
||||
CustomerEquipmentStatusRecord statusRecord = new CustomerEquipmentStatusRecord();
|
||||
statusRecord.setCustomerId(ce.getCustomerId());
|
||||
statusRecord.setEquipmentId(ce.getId());
|
||||
EquipmentAdminStatusData statusData = new EquipmentAdminStatusData();
|
||||
statusData.setStatusCode(StatusCode.normal);
|
||||
statusData.setCustomerLevelStatusCode(StatusCode.normal);
|
||||
statusRecord.setStatusData(statusData);
|
||||
|
||||
// Update the equipment status
|
||||
equipmentStatusInterface.updateEquipmentAdminStatus(statusRecord);
|
||||
} catch (Exception e) {
|
||||
//do nothing
|
||||
}
|
||||
|
||||
//cache newly created AP
|
||||
kdcEquipmentRecordCache.put(apId, ce);
|
||||
}
|
||||
|
||||
|
||||
//register equipment routing record
|
||||
EquipmentRoutingRecord equipmentRoutingRecord = new EquipmentRoutingRecord();
|
||||
equipmentRoutingRecord.setGatewayRecordId(kdcGwController.getRegisteredGwId());
|
||||
equipmentRoutingRecord.setCustomerId(ce.getCustomerId());
|
||||
equipmentRoutingRecord.setEquipmentId(ce.getId());
|
||||
EquipmentRoutingRecord ret = eqRoutingInterface.registerUERoute(equipmentRoutingRecord);
|
||||
OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId);
|
||||
ovsdbSession.setRoutingId(ret.getId());
|
||||
ovsdbSession.setEquipmentId(ce.getId());
|
||||
ovsdbSession.setCustomerId(ce.getCustomerId());
|
||||
|
||||
//update equipment status
|
||||
// Establish admin status for the connected equipment.
|
||||
CustomerEquipmentStatusRecord statusRecord = equipmentStatusInterface.getEquipmentAdminStatusByEquipmentId(ce.getCustomerId(), ce.getId(), false);
|
||||
if(statusRecord==null) {
|
||||
statusRecord = new CustomerEquipmentStatusRecord();
|
||||
statusRecord.setCustomerId(ce.getCustomerId());
|
||||
statusRecord.setEquipmentId(ce.getId());
|
||||
|
||||
EquipmentAdminStatusData statusData = new EquipmentAdminStatusData();
|
||||
statusRecord.setStatusData(statusData);
|
||||
}
|
||||
|
||||
((EquipmentAdminStatusData)statusRecord.getStatusData()).setStatusCode(StatusCode.normal);
|
||||
((EquipmentAdminStatusData)statusRecord.getStatusData()).setCustomerLevelStatusCode(StatusCode.normal);
|
||||
|
||||
// Update the equipment status
|
||||
equipmentStatusInterface.updateEquipmentAdminStatus(statusRecord);
|
||||
|
||||
//update LAN status - nothing to do here for now
|
||||
statusRecord = equipmentStatusInterface.getEquipmentLANStatusByEquipmentId(ce.getCustomerId(), ce.getId(), false);
|
||||
if(statusRecord==null) {
|
||||
statusRecord = new CustomerEquipmentStatusRecord();
|
||||
statusRecord.setCustomerId(ce.getCustomerId());
|
||||
statusRecord.setEquipmentId(ce.getId());
|
||||
|
||||
EquipmentLANStatusData statusData = new EquipmentLANStatusData();
|
||||
statusRecord.setStatusData(statusData);
|
||||
}
|
||||
|
||||
Map<Integer, VLANStatusData> vlanStatusDataMap = new HashMap<>();
|
||||
((EquipmentLANStatusData)statusRecord.getStatusData()).setVlanStatusDataMap(vlanStatusDataMap );
|
||||
|
||||
equipmentStatusInterface.updateEquipmentLANStatus(statusRecord);
|
||||
|
||||
//update protocol status
|
||||
statusRecord = equipmentStatusInterface.getEquipmentProtocolStatusByEquipmentId(ce.getCustomerId(), ce.getId(), false);
|
||||
if(statusRecord==null) {
|
||||
statusRecord = new CustomerEquipmentStatusRecord();
|
||||
statusRecord.setCustomerId(ce.getCustomerId());
|
||||
statusRecord.setEquipmentId(ce.getId());
|
||||
|
||||
EquipmentProtocolStatusData statusData = new EquipmentProtocolStatusData();
|
||||
statusRecord.setStatusData(statusData);
|
||||
}
|
||||
|
||||
EquipmentProtocolStatusData protocolStatusData = ((EquipmentProtocolStatusData)statusRecord.getStatusData());
|
||||
protocolStatusData.setPoweredOn(true);
|
||||
protocolStatusData.setCloudProtocolVersion("1100");
|
||||
protocolStatusData.setProtocolState(EquipmentProtocolState.ready);
|
||||
protocolStatusData.setBandPlan("FCC");
|
||||
protocolStatusData.setBaseMacAddress(MacAddress.valueOf(connectNodeInfo.macAddress));
|
||||
protocolStatusData.setCloudCfgDataVersion(42L);
|
||||
protocolStatusData.setReportedCfgDataVersion(42L);
|
||||
protocolStatusData.setCountryCode("CA");
|
||||
protocolStatusData.setReportedCC(CountryCode.ca);
|
||||
protocolStatusData.setReportedHwVersion(connectNodeInfo.platformVersion);
|
||||
protocolStatusData.setReportedSwVersion(connectNodeInfo.firmwareVersion);
|
||||
protocolStatusData.setReportedSwAltVersion(connectNodeInfo.firmwareVersion);
|
||||
protocolStatusData.setReportedIpV4Addr(InetAddress.getByName(connectNodeInfo.ipV4Address));
|
||||
if(connectNodeInfo.macAddress!=null && MacAddress.valueOf(connectNodeInfo.macAddress)!=null) {
|
||||
protocolStatusData.setReportedMacAddr(MacAddress.valueOf(connectNodeInfo.macAddress).getAddress());
|
||||
}
|
||||
protocolStatusData.setReportedSku(connectNodeInfo.skuNumber);
|
||||
protocolStatusData.setSerialNumber(connectNodeInfo.serialNumber);
|
||||
protocolStatusData.setSystemName(connectNodeInfo.model);
|
||||
|
||||
equipmentStatusInterface.updateEquipmentProtocolStatus(statusRecord);
|
||||
|
||||
//TODO: continue from here --->>>
|
||||
|
||||
//TODO: equipmentStatusInterface.updateEquipmentFirmwareStatus(statusRecord);
|
||||
//TODO: equipmentStatusInterface.updateEquipmentNeighbouringStatusRecord(record);
|
||||
//TODO: equipmentStatusInterface.updateEquipmentPeerStatus(statusRecord);
|
||||
|
||||
//TODO: equipmentStatusInterface.updateNetworkAdminStatus(networkAdminStatusRecord);
|
||||
//dtop: this one populates traffic capacity and usage dial on the main dashboard
|
||||
//from APDemoMetric properties getPeriodLengthSec, getRxBytes2G, getTxBytes2G, getRxBytes5G, getTxBytes5G
|
||||
//TODO: equipmentStatusInterface.updateNetworkAggregateStatus(networkAggregateStatusRecord);
|
||||
|
||||
|
||||
|
||||
}catch(Exception e) {
|
||||
LOG.error("Exception when registering ap routing {}", apId, e);
|
||||
}
|
||||
}
|
||||
|
||||
public void apDisconnected(String apId) {
|
||||
LOG.info("AP {} got disconnected from the gateway", apId);
|
||||
try {
|
||||
OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId);
|
||||
|
||||
if(ovsdbSession!=null) {
|
||||
eqRoutingInterface.deregisterUserEquipment(ovsdbSession.getEquipmentId());
|
||||
} else {
|
||||
LOG.warn("Cannot find ap {} in KDC inventory", apId);
|
||||
}
|
||||
}catch(Exception e) {
|
||||
LOG.error("Exception when registering ap routing {}", apId, e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public OpensyncAPConfig getApConfig(String apId) {
|
||||
LOG.info("Retrieving config for AP {} ", apId);
|
||||
OpensyncAPConfig ret = null;
|
||||
|
||||
try {
|
||||
|
||||
OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId);
|
||||
if(ovsdbSession == null) {
|
||||
throw new IllegalStateException("AP is not connected " + apId);
|
||||
}
|
||||
long equipmentId = ovsdbSession.getEquipmentId();
|
||||
ResolvedEquipmentConfiguration resolvedEqCfg = eqConfigurationManagerInterface.getResolvedEquipmentConfiguration(equipmentId, null, null);
|
||||
|
||||
if(resolvedEqCfg==null) {
|
||||
throw new IllegalStateException("Cannot retrieve configuration for " + apId);
|
||||
}
|
||||
ret = new OpensyncAPConfig();
|
||||
|
||||
//extract country, radio channels from resolvedEqCfg
|
||||
String country = "CA";
|
||||
CountryCode countryCode = resolvedEqCfg.getEquipmentCountryCode();
|
||||
if(countryCode!=null && countryCode!=CountryCode.UNSUPPORTED) {
|
||||
country = countryCode.toString().toUpperCase();
|
||||
}
|
||||
|
||||
int radioChannel24G = 1;
|
||||
int radioChannel5LG = 44;
|
||||
|
||||
Map<Integer, ElementRadioConfiguration> erc = resolvedEqCfg.getEquipmentElementConfiguration().getApElementConfig().getRadioMap();
|
||||
if(erc!=null) {
|
||||
ElementRadioConfiguration erc24 = erc.get(1);
|
||||
ElementRadioConfiguration erc5 = erc.get(0);
|
||||
|
||||
if(erc24!=null) {
|
||||
radioChannel24G = erc24.getChannelNumber();
|
||||
}
|
||||
|
||||
if(erc5!=null) {
|
||||
radioChannel5LG = erc5.getChannelNumber();
|
||||
}
|
||||
}
|
||||
|
||||
OpensyncAPRadioConfig radioConfig = new OpensyncAPRadioConfig();
|
||||
radioConfig.setCountry(country);
|
||||
radioConfig.setRadioChannel24G(radioChannel24G);
|
||||
radioConfig.setRadioChannel5LG(radioChannel5LG);
|
||||
//hardcoding this one, as there are no config for it in KDC
|
||||
radioConfig.setRadioChannel5HG(108);
|
||||
|
||||
ret.setRadioConfig(radioConfig);
|
||||
|
||||
//extract ssid parameters from resolvedEqCfg
|
||||
List<OpensyncAPSsidConfig> ssidConfigs = new ArrayList<>();
|
||||
ret.setSsidConfigs(ssidConfigs);
|
||||
|
||||
List<SsidConfiguration> resolvedSsids = resolvedEqCfg.getSsidConfigurations();
|
||||
if(resolvedSsids!=null) {
|
||||
for(SsidConfiguration ssidCfg : resolvedSsids) {
|
||||
OpensyncAPSsidConfig osSsidCfg = new OpensyncAPSsidConfig();
|
||||
osSsidCfg.setSsid(ssidCfg.getSsid());
|
||||
|
||||
AppliedRadio ar = ssidCfg.getAppliedRadio();
|
||||
if(ar == AppliedRadio.radioA) {
|
||||
osSsidCfg.setRadioType(RadioType.is5GHz);
|
||||
} else if (ar == AppliedRadio.radioB ){
|
||||
osSsidCfg.setRadioType(RadioType.is2dot4GHz);
|
||||
} else if (ar == AppliedRadio.radioAandB ){
|
||||
osSsidCfg.setRadioType(RadioType.is5GHz);
|
||||
}
|
||||
|
||||
osSsidCfg.setBroadcast(ssidCfg.getBroadcastSsid() == StateSetting.enabled);
|
||||
|
||||
if(ssidCfg.getSecureMode() == SecureMode.wpa2OnlyPSK || ssidCfg.getSecureMode() == SecureMode.wpa2PSK) {
|
||||
osSsidCfg.setEncryption("WPA-PSK");
|
||||
osSsidCfg.setMode("2");
|
||||
} else if(ssidCfg.getSecureMode() == SecureMode.wpaPSK ) {
|
||||
osSsidCfg.setEncryption("WPA-PSK");
|
||||
osSsidCfg.setMode("1");
|
||||
} else {
|
||||
LOG.warn("Unsupported encryption mode {} - will use WPA-PSK instead", ssidCfg.getSecureMode());
|
||||
osSsidCfg.setEncryption("WPA-PSK");
|
||||
osSsidCfg.setMode("2");
|
||||
}
|
||||
|
||||
osSsidCfg.setKey(ssidCfg.getKeyStr());
|
||||
|
||||
ssidConfigs.add(osSsidCfg);
|
||||
|
||||
if( ar==AppliedRadio.radioAandB ) {
|
||||
//configure the same ssid on the second radio
|
||||
osSsidCfg = osSsidCfg.clone();
|
||||
osSsidCfg.setRadioType(RadioType.is2dot4GHz);
|
||||
ssidConfigs.add(osSsidCfg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
LOG.error("Cannot read config for AP {}", apId, e);
|
||||
}
|
||||
|
||||
LOG.debug("Config content : {}", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param topic
|
||||
* @return apId extracted from the topic name, or null if it cannot be extracted
|
||||
*/
|
||||
public 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];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param topic
|
||||
* @return customerId looked up from the topic name, or -1 if it cannot be extracted
|
||||
*/
|
||||
public int extractCustomerIdFromTopic(String topic) {
|
||||
|
||||
String apId = extractApIdFromTopic(topic);
|
||||
if(apId == null) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId);
|
||||
|
||||
if(ovsdbSession!=null) {
|
||||
return ovsdbSession.getCustomerId();
|
||||
}
|
||||
|
||||
CustomerEquipment ce = getCustomerEquipment(apId);
|
||||
if(ce!=null) {
|
||||
return ce.getCustomerId();
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
public long extractEquipmentIdFromTopic(String topic) {
|
||||
|
||||
String apId = extractApIdFromTopic(topic);
|
||||
if(apId == null) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId);
|
||||
|
||||
if(ovsdbSession!=null) {
|
||||
return ovsdbSession.getEquipmentId();
|
||||
}
|
||||
|
||||
CustomerEquipment ce = getCustomerEquipment(apId);
|
||||
if(ce!=null) {
|
||||
return ce.getId();
|
||||
}
|
||||
|
||||
return -1;
|
||||
|
||||
}
|
||||
|
||||
public void processMqttMessage(String topic, Report report) {
|
||||
LOG.info("Received report on topic {} for ap {}", topic, report.getNodeID());
|
||||
int customerId = extractCustomerIdFromTopic(topic);
|
||||
if(customerId>0) {
|
||||
kdcGwController.updateActiveCustomer(customerId);
|
||||
}
|
||||
|
||||
long equipmentId = extractEquipmentIdFromTopic(topic);
|
||||
if(equipmentId <= 0 || customerId <=0) {
|
||||
LOG.warn("Cannot determine equipment ids from topic {} - customerId {} equipmentId {}", topic, customerId, equipmentId);
|
||||
return;
|
||||
}
|
||||
|
||||
List<SingleMetricRecord> metricRecordList = new ArrayList<>();
|
||||
|
||||
populateAPDemoMetrics(metricRecordList, report, customerId, equipmentId);
|
||||
populateApClientMetrics(metricRecordList, report, customerId, equipmentId);
|
||||
populateNeighbourScanReports(metricRecordList, report, customerId, equipmentId);
|
||||
|
||||
populateApSsidMetrics(metricRecordList, report, customerId, equipmentId);
|
||||
populateChannelInfoReports(metricRecordList, report, customerId, equipmentId);
|
||||
|
||||
if(!metricRecordList.isEmpty()) {
|
||||
equipmentMetricsCollectorInterface.createRecordList(metricRecordList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void populateNeighbourScanReports(List<SingleMetricRecord> metricRecordList, Report report, int customerId, long equipmentId) {
|
||||
|
||||
for(Neighbor neighbor: report.getNeighborsList()){
|
||||
|
||||
SingleMetricRecord smr = new SingleMetricRecord(customerId, equipmentId);
|
||||
metricRecordList.add(smr);
|
||||
NeighbourScanReports neighbourScanReports = new NeighbourScanReports();
|
||||
smr.setData(neighbourScanReports);
|
||||
|
||||
smr.setCreatedTimestamp(neighbor.getTimestampMs());
|
||||
|
||||
List<NeighbourReport> neighbourReports = new ArrayList<>();
|
||||
neighbourScanReports.setNeighbourReports(neighbourReports);
|
||||
|
||||
for(NeighborBss nBss: neighbor.getBssListList()) {
|
||||
NeighbourReport nr = new NeighbourReport();
|
||||
neighbourReports.add(nr);
|
||||
|
||||
// "band": "BAND5GL",
|
||||
// "scanType": "ONCHAN_SCAN",
|
||||
// "timestampMs": "1581118421629",
|
||||
// "bssList": [
|
||||
// {
|
||||
// "bssid": "80:D0:4A:E6:66:C9",
|
||||
// "ssid": "",
|
||||
// "rssi": 4,
|
||||
// "tsf": "0",
|
||||
// "chanWidth": "CHAN_WIDTH_80MHZ",
|
||||
// "channel": 44,
|
||||
// "status": "ADDED"
|
||||
// },
|
||||
|
||||
if(neighbor.getBand()==RadioBandType.BAND2G) {
|
||||
nr.setAcMode(Toggle.off);
|
||||
nr.setbMode(Toggle.off);
|
||||
nr.setnMode(Toggle.on);
|
||||
nr.setRadioType(RadioType.is2dot4GHz);
|
||||
} else {
|
||||
nr.setAcMode(Toggle.on);
|
||||
nr.setbMode(Toggle.off);
|
||||
nr.setnMode(Toggle.off);
|
||||
nr.setRadioType(RadioType.is5GHz);
|
||||
}
|
||||
|
||||
nr.setChannel(nBss.getChannel());
|
||||
nr.setMacAddress(MacAddress.valueOf(nBss.getBssid()).getAddress());
|
||||
nr.setNetworkType(NetworkType.AP);
|
||||
nr.setPacketType(NeighboreScanPacketType.BEACON);
|
||||
nr.setPrivacy((nBss.getSsid()==null || nBss.getSsid().isEmpty())?Toggle.on:Toggle.off);
|
||||
//nr.setRate(rate);
|
||||
nr.setRssi(nBss.getRssi());
|
||||
//nr.setScanTimeInSeconds(scanTimeInSeconds);
|
||||
nr.setSecureMode(DetectedAuthMode.WPA);
|
||||
//nr.setSignal(signal);
|
||||
nr.setSsid(nBss.getSsid());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void populateChannelInfoReports(List<SingleMetricRecord> metricRecordList, Report report, int customerId, long equipmentId) {
|
||||
|
||||
//TODO: implement me!
|
||||
//TODO: continue from here --->>>
|
||||
|
||||
|
||||
// {
|
||||
// SingleMetricRecord smr = new SingleMetricRecord(customerId, equipmentId);
|
||||
// metricRecordList.add(smr);
|
||||
// ChannelInfoReports channelInfoReports = new ChannelInfoReports();
|
||||
// smr.setData(channelInfoReports);
|
||||
//
|
||||
// List<ChannelInfo> channelInformationReports2g = new ArrayList<>();
|
||||
// channelInfoReports.setChannelInformationReports2g(channelInformationReports2g);
|
||||
//
|
||||
// List<ChannelInfo> channelInformationReports5g = new ArrayList<>();
|
||||
// channelInfoReports.setChannelInformationReports5g(channelInformationReports5g);
|
||||
//
|
||||
// ChannelInfo chInfo = new ChannelInfo();
|
||||
// chInfo.setBandwidth(bandwidth);
|
||||
// chInfo.setChanNumber(chanNumber);
|
||||
// chInfo.setNoiseFloor(noiseFloor);
|
||||
// chInfo.setTotalUtilization(totalUtilization);
|
||||
// chInfo.setWifiUtilization(wifiUtilization);
|
||||
//
|
||||
// channelInformationReports2g.add(chInfo);
|
||||
//
|
||||
// chInfo = new ChannelInfo();
|
||||
// chInfo.setBandwidth(bandwidth);
|
||||
// chInfo.setChanNumber(chanNumber);
|
||||
// chInfo.setNoiseFloor(noiseFloor);
|
||||
// chInfo.setTotalUtilization(totalUtilization);
|
||||
// chInfo.setWifiUtilization(wifiUtilization);
|
||||
//
|
||||
// channelInformationReports5g.add(chInfo);
|
||||
//
|
||||
// }
|
||||
}
|
||||
|
||||
private void populateApSsidMetrics(List<SingleMetricRecord> metricRecordList, Report report, int customerId, long equipmentId) {
|
||||
//TODO: implement me!
|
||||
// {
|
||||
// SingleMetricRecord smr = new SingleMetricRecord(customerId, equipmentId);
|
||||
// metricRecordList.add(smr);
|
||||
//
|
||||
// ApSsidMetrics apSsidMetrics = new ApSsidMetrics();
|
||||
// smr.setData(apSsidMetrics);
|
||||
//
|
||||
// List<SsidStatistics> ssidStats2g = new ArrayList<>();
|
||||
// apSsidMetrics.setSsidStats2g(ssidStats2g );
|
||||
//
|
||||
// List<SsidStatistics> ssidStats5g = new ArrayList<>();
|
||||
// apSsidMetrics.setSsidStats5g(ssidStats5g );
|
||||
//
|
||||
// SsidStatistics ssidStat = new SsidStatistics();
|
||||
// ssidStats2g.add(ssidStat);
|
||||
// ssidStat.setBssid(bssid);
|
||||
// ssidStat.setSsid(ssid);
|
||||
// ssidStat.setNumClient(numClient);
|
||||
// ssidStat.setRxBytes(rxBytes);
|
||||
// ssidStat.setRxLastRssi(rxLastRssi);
|
||||
// ssidStat.setNumTxBytesSucc(numTxBytesSucc);
|
||||
//
|
||||
// ssidStat = new SsidStatistics();
|
||||
// ssidStats5g.add(ssidStat);
|
||||
// ssidStat.setBssid(bssid);
|
||||
// ssidStat.setSsid(ssid);
|
||||
// ssidStat.setNumClient(numClient);
|
||||
// ssidStat.setRxBytes(rxBytes);
|
||||
// ssidStat.setRxLastRssi(rxLastRssi);
|
||||
// ssidStat.setNumTxBytesSucc(numTxBytesSucc);
|
||||
// }
|
||||
}
|
||||
|
||||
private void populateApClientMetrics(List<SingleMetricRecord> metricRecordList, Report report, int customerId, long equipmentId) {
|
||||
|
||||
for(ClientReport clReport: report.getClientsList()){
|
||||
SingleMetricRecord smr = new SingleMetricRecord(customerId, equipmentId);
|
||||
metricRecordList.add(smr);
|
||||
|
||||
ApClientMetrics apClientMetrics = new ApClientMetrics();
|
||||
smr.setData(apClientMetrics);
|
||||
smr.setCreatedTimestamp(clReport.getTimestampMs());
|
||||
|
||||
Integer periodLengthSec = 60; //matches what's configured by OvsdbDao.configureStats(OvsdbClient)
|
||||
apClientMetrics.setPeriodLengthSec(periodLengthSec);
|
||||
|
||||
List<ClientMetrics> clientMetrics = new ArrayList<>();
|
||||
|
||||
for(Client cl: clReport.getClientListList()) {
|
||||
//clReport.getChannel();
|
||||
ClientMetrics cMetrics = new ClientMetrics();
|
||||
clientMetrics.add(cMetrics);
|
||||
cMetrics.setRadioType((clReport.getBand() == RadioBandType.BAND2G)?RadioType.is2dot4GHz:RadioType.is5GHz);
|
||||
cMetrics.setDeviceMacAddress(new MacAddress(cl.getMacAddress()));
|
||||
|
||||
if(cl.hasStats()) {
|
||||
if(cl.getStats().hasRssi()) {
|
||||
cMetrics.setRssi(cl.getStats().getRssi());
|
||||
}
|
||||
|
||||
//we'll report each device as having a single (very long) session
|
||||
cMetrics.setSessionId(cMetrics.getDeviceMacAddress().getAddressAsLong());
|
||||
|
||||
//populate Rx stats
|
||||
if(cl.getStats().hasRxBytes()) {
|
||||
cMetrics.setRxBytes(cl.getStats().getRxBytes());
|
||||
}
|
||||
|
||||
if(cl.getStats().hasRxRate()) {
|
||||
//cMetrics.setAverageRxRate(cl.getStats().getRxRate());
|
||||
}
|
||||
|
||||
if(cl.getStats().hasRxErrors()) {
|
||||
cMetrics.setNumRxNoFcsErr((int)cl.getStats().getRxErrors());
|
||||
}
|
||||
|
||||
if(cl.getStats().hasRxFrames()) {
|
||||
//cMetrics.setNumRxFramesReceived(cl.getStats().getRxFrames());
|
||||
cMetrics.setNumRxPackets(cl.getStats().getRxFrames());
|
||||
}
|
||||
|
||||
if(cl.getStats().hasRxRetries()) {
|
||||
cMetrics.setNumRxRetry((int)cl.getStats().getRxRetries());
|
||||
}
|
||||
|
||||
//populate Tx stats
|
||||
if(cl.getStats().hasTxBytes()) {
|
||||
cMetrics.setNumTxBytes(cl.getStats().getTxBytes());
|
||||
}
|
||||
|
||||
if(cl.getStats().hasTxRate()) {
|
||||
//cMetrics.setAverageTxRate(cl.getStats().getTxRate());
|
||||
}
|
||||
|
||||
if(cl.getStats().hasTxRate() && cl.getStats().hasRxRate()) {
|
||||
cMetrics.setRates(new byte[]{(byte) (cl.getStats().getTxRate()), (byte) (cl.getStats().getRxRate())});
|
||||
}
|
||||
|
||||
if(cl.getStats().hasTxErrors()) {
|
||||
cMetrics.setNumTxDropped((int)cl.getStats().getTxErrors());
|
||||
}
|
||||
|
||||
if(cl.getStats().hasTxFrames()) {
|
||||
//cMetrics.setNumTxFramesTransmitted(cl.getStats().getTxFrames());
|
||||
cMetrics.setNumTxPackets(cl.getStats().getRxFrames());
|
||||
}
|
||||
|
||||
if(cl.getStats().hasTxRetries()) {
|
||||
cMetrics.setNumTxDataRetries((int)cl.getStats().getTxRetries());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if(clReport.getBand() == RadioBandType.BAND2G) {
|
||||
apClientMetrics.setClientMetrics2g(clientMetrics.toArray(new ClientMetrics[0]));
|
||||
} else {
|
||||
apClientMetrics.setClientMetrics5g(clientMetrics.toArray(new ClientMetrics[0]));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void populateAPDemoMetrics(List<SingleMetricRecord> metricRecordList, Report report, int customerId, long equipmentId) {
|
||||
APDemoMetric data = null;
|
||||
|
||||
for(Device deviceReport : report.getDeviceList()) {
|
||||
|
||||
SingleMetricRecord smr = new SingleMetricRecord(customerId, equipmentId);
|
||||
metricRecordList.add(smr);
|
||||
|
||||
data = new APDemoMetric();
|
||||
smr.setData(data);
|
||||
ApPerformance apPerformance = new ApPerformance();
|
||||
data.setApPerformance(apPerformance);
|
||||
|
||||
smr.setCreatedTimestamp(deviceReport.getTimestampMs());
|
||||
// data.setChannelUtilization2G(channelUtilization2G);
|
||||
// data.setChannelUtilization5G(channelUtilization5G);
|
||||
|
||||
if(deviceReport.getRadioTempCount()>0) {
|
||||
int cpuTemperature = 0;
|
||||
int numSamples = 0;
|
||||
for(RadioTemp r: deviceReport.getRadioTempList()) {
|
||||
if(r.hasValue()) {
|
||||
cpuTemperature += r.getValue();
|
||||
numSamples++;
|
||||
}
|
||||
}
|
||||
|
||||
if(numSamples>0) {
|
||||
apPerformance.setCpuTemperature( cpuTemperature / numSamples );
|
||||
}
|
||||
}
|
||||
|
||||
if(deviceReport.hasCpuUtil() && deviceReport.getCpuUtil().hasCpuUtil()) {
|
||||
apPerformance.setCpuUtilized(new byte[]{(byte) (deviceReport.getCpuUtil().getCpuUtil()), (byte) (0)});
|
||||
}
|
||||
|
||||
apPerformance.setEthLinkState(EthernetLinkState.UP1000_FULL_DUPLEX);
|
||||
|
||||
if(deviceReport.hasMemUtil() && deviceReport.getMemUtil().hasMemTotal() && deviceReport.getMemUtil().hasMemUsed()) {
|
||||
apPerformance.setFreeMemory(deviceReport.getMemUtil().getMemTotal() - deviceReport.getMemUtil().getMemUsed());
|
||||
}
|
||||
apPerformance.setUpTime(new Long(deviceReport.getUptime()));
|
||||
|
||||
}
|
||||
|
||||
if(data != null) {
|
||||
//Main Network dashboard shows Traffic and Capacity values that are calculated from
|
||||
// APDemoMetric properties getPeriodLengthSec, getRxBytes2G, getTxBytes2G, getRxBytes5G, getTxBytes5G
|
||||
|
||||
//go over all the clients to aggregate per-client tx/rx stats - we want to do this
|
||||
//only once per batch of APDemoMetrics - so we do not repeat values over and over again
|
||||
long rxBytes2g = 0;
|
||||
long txBytes2g = 0;
|
||||
long rxBytes5g = 0;
|
||||
long txBytes5g = 0;
|
||||
|
||||
for(ClientReport clReport: report.getClientsList()){
|
||||
for(Client cl: clReport.getClientListList()) {
|
||||
|
||||
if(clReport.getBand() == RadioBandType.BAND2G) {
|
||||
if(cl.getStats().hasTxBytes()) {
|
||||
txBytes2g += cl.getStats().getTxBytes();
|
||||
}
|
||||
|
||||
if(cl.getStats().hasRxBytes()) {
|
||||
rxBytes2g += cl.getStats().getRxBytes();
|
||||
}
|
||||
} else {
|
||||
if(cl.getStats().hasTxBytes()) {
|
||||
txBytes5g += cl.getStats().getTxBytes();
|
||||
}
|
||||
|
||||
if(cl.getStats().hasRxBytes()) {
|
||||
rxBytes5g += cl.getStats().getRxBytes();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
data.setRxBytes2G(rxBytes2g);
|
||||
data.setTxBytes2G(txBytes2g);
|
||||
data.setRxBytes5G(rxBytes5g);
|
||||
data.setTxBytes5G(txBytes5g);
|
||||
data.setPeriodLengthSec(60);
|
||||
|
||||
//Now try to populate metrics for calculation of radio capacity
|
||||
//see com.whizcontrol.metrics.streaming.spark.equipmentreport.CapacityDStreamsConfig.toAggregatedStats(int, long, APDemoMetric data)
|
||||
//result.stats2g = toAggregatedRadioStats(data.getNoiseFloor2G(),data.getRadioUtilization2G());
|
||||
//result.stats5g = toAggregatedRadioStats(data.getNoiseFloor5G(),data.getRadioUtilization5G());
|
||||
// RadioUtilization
|
||||
// private Integer assocClientTx;
|
||||
// private Integer unassocClientTx;
|
||||
// private Integer assocClientRx;
|
||||
// private Integer unassocClientRx;
|
||||
// private Integer nonWifi;
|
||||
// private Integer timestampSeconds;
|
||||
|
||||
data.setRadioUtilization2G(new ArrayList<>());
|
||||
data.setRadioUtilization5G(new ArrayList<>());
|
||||
|
||||
//populate it from report.survey
|
||||
for(Survey survey: report.getSurveyList()){
|
||||
for(SurveySample surveySample: survey.getSurveyListList()) {
|
||||
if(surveySample.getDurationMs()==0) {
|
||||
continue;
|
||||
}
|
||||
RadioUtilization radioUtil = new RadioUtilization();
|
||||
radioUtil.setTimestampSeconds((int)((survey.getTimestampMs() + surveySample.getOffsetMs())/1000));
|
||||
radioUtil.setAssocClientTx(100 * surveySample.getBusyTx()/surveySample.getDurationMs());
|
||||
radioUtil.setAssocClientRx(100 * surveySample.getBusyRx()/surveySample.getDurationMs());
|
||||
radioUtil.setNonWifi(100 * (surveySample.getBusy() - surveySample.getBusyTx() - surveySample.getBusyRx())/surveySample.getDurationMs());
|
||||
|
||||
if(survey.getBand() == RadioBandType.BAND2G) {
|
||||
data.getRadioUtilization2G().add(radioUtil);
|
||||
} else {
|
||||
data.getRadioUtilization5G().add(radioUtil);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public void processMqttMessage(String topic, FlowReport flowReport) {
|
||||
LOG.info("Received flowReport on topic {} for ap {}", topic, flowReport.getObservationPoint().getNodeId());
|
||||
int customerId = extractCustomerIdFromTopic(topic);
|
||||
if(customerId>0) {
|
||||
kdcGwController.updateActiveCustomer(customerId);
|
||||
}
|
||||
//TODO: implement me
|
||||
}
|
||||
|
||||
public void processMqttMessage(String topic, WCStatsReport wcStatsReport) {
|
||||
LOG.info("Received wcStatsReport on topic {} for ap {}", topic, wcStatsReport.getObservationPoint().getNodeId());
|
||||
int customerId = extractCustomerIdFromTopic(topic);
|
||||
if(customerId>0) {
|
||||
kdcGwController.updateActiveCustomer(customerId);
|
||||
}
|
||||
//TODO: implement me
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package ai.connectus.opensync.external.integration.controller;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ContextStartedEvent;
|
||||
|
||||
/**
|
||||
* Listen for context started event so that we are register with routing service
|
||||
*
|
||||
* @author yongli
|
||||
*
|
||||
*/
|
||||
public class OpensyncGatewayControllerStartListener implements ApplicationListener<ContextStartedEvent> {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(OpensyncGatewayControllerStartListener.class);
|
||||
|
||||
OpensyncKDCGatewayController controller;
|
||||
|
||||
public OpensyncGatewayControllerStartListener(OpensyncKDCGatewayController controller) {
|
||||
this.controller = controller;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ContextStartedEvent event) {
|
||||
LOG.debug("Processing ContextStartedEvent event");
|
||||
controller.registerWithRoutingService();
|
||||
}
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package ai.connectus.opensync.external.integration.controller;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.event.ContextClosedEvent;
|
||||
|
||||
/**
|
||||
* Register for stop event so that we can de-register from routing service
|
||||
*
|
||||
* @author yongli
|
||||
*
|
||||
*/
|
||||
public class OpensyncGatewayControllerStopListener implements ApplicationListener<ContextClosedEvent> {
|
||||
OpensyncKDCGatewayController controller;
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(OpensyncGatewayControllerStopListener.class);
|
||||
|
||||
public OpensyncGatewayControllerStopListener(OpensyncKDCGatewayController controller) {
|
||||
this.controller = controller;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ContextClosedEvent event) {
|
||||
LOG.debug("Processing ContextClosedEvent event");
|
||||
controller.deregisterFromRoutingService();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,29 +0,0 @@
|
||||
package ai.connectus.opensync.external.integration.controller;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.event.ContextClosedEvent;
|
||||
import org.springframework.context.event.ContextStartedEvent;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class OpensyncGatewayListenerConfiguration {
|
||||
@Autowired
|
||||
OpensyncKDCGatewayController controller;
|
||||
private static final Logger LOG = LoggerFactory.getLogger(OpensyncGatewayControllerStartListener.class);
|
||||
|
||||
@Bean
|
||||
public ApplicationListener<ContextClosedEvent> myStopEventListner() {
|
||||
LOG.debug("Creating stop event listener");
|
||||
return new OpensyncGatewayControllerStopListener(controller);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ApplicationListener<ContextStartedEvent> myStartedEventListener() {
|
||||
LOG.debug("Creating start event listener");
|
||||
return new OpensyncGatewayControllerStartListener(controller);
|
||||
}
|
||||
}
|
||||
@@ -1,457 +0,0 @@
|
||||
package ai.connectus.opensync.external.integration.controller;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentMap;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReadWriteLock;
|
||||
import java.util.concurrent.locks.ReentrantReadWriteLock;
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.security.core.userdetails.User;
|
||||
import org.springframework.security.web.bind.annotation.AuthenticationPrincipal;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.whizcontrol.core.model.json.BaseJsonModel;
|
||||
import com.whizcontrol.core.model.service.ServiceInstanceInformation;
|
||||
import com.whizcontrol.core.server.container.ConnectorProperties;
|
||||
import com.whizcontrol.customerequipmentgateway.models.CEGWBaseCommand;
|
||||
import com.whizcontrol.customerequipmentgateway.models.CEGWBlinkRequest;
|
||||
import com.whizcontrol.customerequipmentgateway.models.CEGWCloseSessionRequest;
|
||||
import com.whizcontrol.customerequipmentgateway.models.CEGWCommandResultCode;
|
||||
import com.whizcontrol.customerequipmentgateway.models.CEGWConfigChangeNotification;
|
||||
import com.whizcontrol.customerequipmentgateway.models.CEGWRouteCheck;
|
||||
import com.whizcontrol.customerequipmentgateway.models.CEGWStartDebugEngine;
|
||||
import com.whizcontrol.customerequipmentgateway.models.CustomerEquipmentCommand;
|
||||
import com.whizcontrol.customerequipmentgateway.models.CustomerEquipmentCommandResponse;
|
||||
import com.whizcontrol.customerequipmentgateway.models.GatewayDefaults;
|
||||
import com.whizcontrol.equipmentrouting.EquipmentRoutingInterface;
|
||||
import com.whizcontrol.equipmentroutinginfo.models.CustomerEquipmentGwRecord;
|
||||
import com.whizcontrol.equipmentroutinginfo.models.EquipmentRoutingRecord;
|
||||
import com.whizcontrol.equipmentroutinginfo.models.RoutingRegisterResponse;
|
||||
import com.whizcontrol.server.exceptions.ConfigurationException;
|
||||
|
||||
import ai.connectus.opensync.external.integration.ConnectusOvsdbClientInterface;
|
||||
import ai.connectus.opensync.external.integration.OvsdbSession;
|
||||
import ai.connectus.opensync.external.integration.OvsdbSessionMapInterface;
|
||||
|
||||
/**
|
||||
* Opensync Gateway Controller - integration code for Kodacloud deployment
|
||||
*
|
||||
* @author yongli
|
||||
* @author dtop
|
||||
*
|
||||
*/
|
||||
@RestController
|
||||
@EnableScheduling
|
||||
public class OpensyncKDCGatewayController {
|
||||
|
||||
@Autowired
|
||||
EquipmentRoutingInterface eqRoutingSvc;
|
||||
|
||||
@Autowired
|
||||
ConnectorProperties connectorProperties;
|
||||
|
||||
@Autowired
|
||||
private ServiceInstanceInformation serviceInstanceInfo;
|
||||
|
||||
@Autowired
|
||||
private ConnectusOvsdbClientInterface connectusOvsdbClient;
|
||||
|
||||
/**
|
||||
* Flag indicates if this gateway has registered with routing service
|
||||
*/
|
||||
private boolean registeredWithRoutingService = false;
|
||||
|
||||
private long registeredGwId = -1;
|
||||
|
||||
/**
|
||||
* Lock used to protected {@link #activeCustomerLock}
|
||||
*/
|
||||
private final ReadWriteLock activeCustomerLock = new ReentrantReadWriteLock();
|
||||
private final Lock activeCustomerReadLock = activeCustomerLock.readLock();
|
||||
private final Lock activeCustomerWriteLock = activeCustomerLock.writeLock();
|
||||
|
||||
@Autowired
|
||||
private OvsdbSessionMapInterface ovsdbSessionMapInterface;
|
||||
|
||||
/**
|
||||
* Map <customerId, lastSeenTimestamp>
|
||||
*/
|
||||
private ConcurrentMap<Integer, Long> activeCustomerMap = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* latestTimetamp used when updating {@link #activeCustomerMap}
|
||||
*/
|
||||
private final BiFunction<Long, Long, Long> latestTimestamp = new BiFunction<Long, Long, Long>() {
|
||||
@Override
|
||||
public Long apply(Long oldValue, Long newValue) {
|
||||
if (newValue.compareTo(oldValue) > 0) {
|
||||
return newValue;
|
||||
}
|
||||
return oldValue;
|
||||
}
|
||||
};
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(OpensyncKDCGatewayController.class);
|
||||
|
||||
@RequestMapping(value = "/command", method = RequestMethod.POST)
|
||||
public CustomerEquipmentCommandResponse sendCommand(@RequestBody CEGWBaseCommand command) {
|
||||
LOG.debug("sendCommand({})", command);
|
||||
String qrCode = command.getEquipmentQRCode();
|
||||
if (BaseJsonModel.hasUnsupportedValue(command)) {
|
||||
LOG.error("[{}] Failed to deliver command {}, command contains unsupported value", qrCode, command);
|
||||
return new CustomerEquipmentCommandResponse(CEGWCommandResultCode.UnsupportedCommand.ordinal(),
|
||||
"Unsupported value in command for " + qrCode);
|
||||
}
|
||||
OvsdbSession session = ovsdbSessionMapInterface.getSession(qrCode);
|
||||
if (session == null) {
|
||||
LOG.warn("[{}] Failed to deliver command {}, websocket session not found", qrCode, command);
|
||||
return new CustomerEquipmentCommandResponse(CEGWCommandResultCode.NoRouteToCE.ordinal(),
|
||||
"No session found for " + qrCode);
|
||||
}
|
||||
|
||||
switch (command.getCommandType()) {
|
||||
case ConfigChangeNotification:
|
||||
return sendConfigChangeNotification(session, (CEGWConfigChangeNotification) command);
|
||||
case CloseSessionRequest:
|
||||
return closeSession(session, (CEGWCloseSessionRequest) command);
|
||||
case CheckRouting:
|
||||
return checkEquipmentRouting(session, (CEGWRouteCheck) command);
|
||||
case BlinkRequest:
|
||||
return processBlinkRequest(session, (CEGWBlinkRequest) command);
|
||||
case StartDebugEngine:
|
||||
return processChangeRedirector(session, (CEGWStartDebugEngine) command);
|
||||
case StopDebugEngine:
|
||||
case FirmwareDownloadRequest:
|
||||
case FirmwareFlashRequest:
|
||||
case RebootRequest:
|
||||
case NeighbourhoodReport:
|
||||
case ClientDeauthRequest:
|
||||
case CellSizeRequest:
|
||||
case NewChannelRequest:
|
||||
case ReportCurrentAPCRequest:
|
||||
case FileUpdateRequest:
|
||||
case InterferenceThresholdUpdateRequest:
|
||||
case BestApConfigurationUpdateRequest:
|
||||
case StartPacketFileCapture:
|
||||
case StopPacketCapture:
|
||||
case ReportCurrentVLANRequest:
|
||||
case BSSIDToMacMonitoringRequest:
|
||||
case ChannelChangeAnnouncementRequest:
|
||||
case UploadLogFile:
|
||||
case TogglePoERequest:
|
||||
case RadioReset:
|
||||
case ClearScanTable:
|
||||
case WdsRequest:
|
||||
default:
|
||||
LOG.warn("[{}] Failed to deliver command {}, unsupported command type", qrCode, command);
|
||||
return new CustomerEquipmentCommandResponse(CEGWCommandResultCode.UnsupportedCommand.ordinal(),
|
||||
"Invalid command type (" + command.getCommandType() + ") for equipment (" + qrCode + ")");
|
||||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/defaults", method = RequestMethod.GET)
|
||||
public GatewayDefaults retrieveGatewayDefaults()
|
||||
{
|
||||
return new GatewayDefaults();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Verify a route to customer equipment
|
||||
*
|
||||
* @param session
|
||||
* @param command
|
||||
* @param protocolVersion
|
||||
* @return NoRouteToCE if route Id does not match or Success
|
||||
*/
|
||||
private CustomerEquipmentCommandResponse checkEquipmentRouting(OvsdbSession session, CEGWRouteCheck command) {
|
||||
if (null != command.getRoutingId()) {
|
||||
if (!command.getRoutingId().equals(session.getRoutingId())) {
|
||||
|
||||
LOG.info("[C:{} E:{} R:{}] Stale routing entry ({}) detected",
|
||||
session.getCustomerId(), command.getEquipmentQRCode(),
|
||||
session.getRoutingId(), command.getRoutingId());
|
||||
|
||||
return new CustomerEquipmentCommandResponse(CEGWCommandResultCode.NoRouteToCE.ordinal(),
|
||||
"Inactive Route Identifer");
|
||||
}
|
||||
}
|
||||
return new CustomerEquipmentCommandResponse(CEGWCommandResultCode.Success.ordinal(), "Route active");
|
||||
}
|
||||
|
||||
private CustomerEquipmentCommandResponse sendConfigChangeNotification(OvsdbSession session,
|
||||
CEGWConfigChangeNotification command) {
|
||||
|
||||
return sendMessage(session, command.getEquipmentQRCode(), command);
|
||||
}
|
||||
|
||||
private CustomerEquipmentCommandResponse closeSession(OvsdbSession session, CEGWCloseSessionRequest command) {
|
||||
try {
|
||||
session.getOvsdbClient().shutdown();
|
||||
} catch (Exception e) {
|
||||
LOG.error("[{}] Failed to close session on CE: {}", command.getEquipmentQRCode(), e.getLocalizedMessage());
|
||||
return new CustomerEquipmentCommandResponse(CEGWCommandResultCode.FailedToSend.ordinal(),
|
||||
"Failed to send command " + command.getCommandType() + " to " + command.getEquipmentQRCode() + ": "
|
||||
+ e.getMessage());
|
||||
}
|
||||
LOG.debug("[{}] Closed session to CE", command.getEquipmentQRCode());
|
||||
return new CustomerEquipmentCommandResponse(CEGWCommandResultCode.Success.ordinal(),
|
||||
"Closed session to " + command.getEquipmentQRCode());
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Deliver a message in payload to the CE
|
||||
*
|
||||
* @param session
|
||||
* @param qrCode
|
||||
* @param command
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
private CustomerEquipmentCommandResponse sendMessage(OvsdbSession session, String qrCode,
|
||||
CustomerEquipmentCommand command) {
|
||||
|
||||
LOG.debug("Received command {} for {}", command.getCommandType(), qrCode);
|
||||
CustomerEquipmentCommandResponse response = new CustomerEquipmentCommandResponse(CEGWCommandResultCode.Success.ordinal(),
|
||||
"Received Command " + command.getCommandType() + " for " + qrCode);
|
||||
|
||||
if(command instanceof CEGWConfigChangeNotification) {
|
||||
connectusOvsdbClient.processConfigChanged(qrCode);
|
||||
} else if(command instanceof CEGWStartDebugEngine) {
|
||||
//dtop: we will be using CEGWStartDebugEngine command to deliver request to change redirector
|
||||
//TODO: after the demo introduce a specialized command for this!
|
||||
String newRedirectorAddress = ((CEGWStartDebugEngine) command).getGatewayHostname();
|
||||
connectusOvsdbClient.changeRedirectorAddress(qrCode, newRedirectorAddress );
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
private CustomerEquipmentCommandResponse processChangeRedirector(OvsdbSession session, CEGWStartDebugEngine command) {
|
||||
return sendMessage(session, command.getEquipmentQRCode(), command);
|
||||
}
|
||||
|
||||
private CustomerEquipmentCommandResponse processBlinkRequest(OvsdbSession session,
|
||||
CEGWBlinkRequest command) {
|
||||
|
||||
return sendMessage(session, command.getEquipmentQRCode(), command);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/commandWithUser", method = RequestMethod.POST)
|
||||
public CustomerEquipmentCommandResponse sendCommandWithAuthUser(@RequestBody CustomerEquipmentCommand command,
|
||||
@AuthenticationPrincipal Object requestUser, HttpServletRequest httpServletRequest) {
|
||||
|
||||
// use these properties to get address and port where request has
|
||||
// arrived
|
||||
httpServletRequest.getLocalAddr();
|
||||
httpServletRequest.getLocalPort();
|
||||
|
||||
// requestUser will be instance of
|
||||
// org.springframework.security.core.userdetails.User for client auth
|
||||
// and digest auth,
|
||||
// although other auth providers may return something entirely different
|
||||
if (requestUser instanceof User) {
|
||||
LOG.debug("calling command with auth principal: {}", ((User) requestUser).getUsername());
|
||||
} else {
|
||||
LOG.debug("calling command with auth principal: {}", requestUser);
|
||||
}
|
||||
|
||||
// This is a test method to show how to get access to the auth user
|
||||
// object for a given request
|
||||
|
||||
return sendCommand(command);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register this controller with Equipment Routing Service
|
||||
*/
|
||||
public void registerWithRoutingService() {
|
||||
synchronized (this) {
|
||||
if (registeredWithRoutingService) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (eqRoutingSvc == null) {
|
||||
throw new ConfigurationException(
|
||||
"Unabled to register gateway with routing service: routing service interface not initialized");
|
||||
}
|
||||
CustomerEquipmentGwRecord gwRecord = new CustomerEquipmentGwRecord();
|
||||
gwRecord.setDeploymentId(getDeploymentId());
|
||||
|
||||
// Internal facing service
|
||||
gwRecord.setGatewayId(getGatewayName());
|
||||
gwRecord.setIpAddr(connectorProperties.getInternalIpAddress().getHostAddress());
|
||||
gwRecord.setPort(connectorProperties.getInternalPort());
|
||||
|
||||
try {
|
||||
CustomerEquipmentGwRecord result = this.eqRoutingSvc.registerGateway(gwRecord);
|
||||
this.registeredGwId = result.getId();
|
||||
LOG.info("Successfully registered (name={}, id={}) with Routing Service", result.getGatewayId(),
|
||||
registeredGwId);
|
||||
registeredWithRoutingService = true;
|
||||
} catch (RuntimeException e) {
|
||||
// failed
|
||||
LOG.error("Failed to register Customer Equipment Gateway (name={}) with Routing Service : {}",
|
||||
getGatewayName(), e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the current deployment identifier
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public int getDeploymentId() {
|
||||
return serviceInstanceInfo.getDeploymentId();
|
||||
}
|
||||
|
||||
/**
|
||||
* De-register from Routing service
|
||||
*/
|
||||
public void deregisterFromRoutingService() {
|
||||
if (registeredWithRoutingService) {
|
||||
try {
|
||||
eqRoutingSvc.deregisterGateway(registeredGwId);
|
||||
LOG.info("Deregistered Customer Equipment Gateway (name={},id={}) with Routing Service",
|
||||
getGatewayName(), this.registeredGwId);
|
||||
} catch (Exception e) {
|
||||
// failed
|
||||
LOG.error("Failed to deregister Customer Equipment Gateway (name={},id={}) with Routing Service: {}",
|
||||
getGatewayName(), this.registeredGwId, e.getLocalizedMessage());
|
||||
}
|
||||
registeredWithRoutingService = false;
|
||||
}
|
||||
}
|
||||
|
||||
public long getRegisteredGwId() {
|
||||
return this.registeredGwId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a customer equipment with this gateway
|
||||
*
|
||||
* @param equipmentName
|
||||
* @param customerId
|
||||
* @param equipmentId
|
||||
* @return associationId
|
||||
*/
|
||||
public RoutingRegisterResponse registerCustomerEquipment(String equipmentName, Integer customerId,
|
||||
Long equipmentId) {
|
||||
registerWithRoutingService();
|
||||
if (!registeredWithRoutingService) {
|
||||
LOG.error("Unable to register customer equipement (name={},id={}): gateway not registered.", equipmentName,
|
||||
equipmentId);
|
||||
return null;
|
||||
}
|
||||
EquipmentRoutingRecord routingRecord = new EquipmentRoutingRecord();
|
||||
routingRecord.setCustomerId(customerId);
|
||||
routingRecord.setEquipmentId(equipmentId);
|
||||
routingRecord.setGatewayRecordId(this.registeredGwId);
|
||||
try {
|
||||
RoutingRegisterResponse result = eqRoutingSvc.registerUERouteForDeployment(routingRecord,
|
||||
getDeploymentId());
|
||||
LOG.debug("Registered customer equipment (name={},id={}) with route id={}", equipmentName, equipmentId,
|
||||
result.getRoutingRecord().getId());
|
||||
return result;
|
||||
|
||||
} catch (Exception e) {
|
||||
LOG.error("Failed to register customer equipement (name={},id={}): {}", equipmentName, equipmentId,
|
||||
e.getLocalizedMessage());
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void deregisterCustomerEquipment(Long routingId, String equipmentName, Long equipmentId) {
|
||||
if (!registeredWithRoutingService) {
|
||||
LOG.error("Unable to deregister customer equipement (name={},id={}): gateway not registered", equipmentName,
|
||||
equipmentId);
|
||||
return;
|
||||
}
|
||||
try {
|
||||
LOG.debug("Deregistering customer equipment (name={},id={}) with route id={}", equipmentName, equipmentId,
|
||||
routingId);
|
||||
|
||||
eqRoutingSvc.deregisterUERoute(routingId);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Failed to deregister customer equipement (name={},id={}) with route id={}: {}", equipmentName,
|
||||
equipmentId, routingId, e.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Run every 5 minutes
|
||||
*/
|
||||
@Scheduled(initialDelay = 5 * 60 * 1000, fixedRate = 5 * 60 * 1000)
|
||||
public void updateActiveCustomer() {
|
||||
try {
|
||||
Map<Integer, Long> activeMap = this.getActiveCustomerMapForUpdate();
|
||||
if (null != activeMap) {
|
||||
LOG.info("Updating active customer records, total record size {}", activeMap.size());
|
||||
this.eqRoutingSvc.updateActiveCustomer(activeMap, getDeploymentId());
|
||||
}
|
||||
} catch (RuntimeException exp) {
|
||||
LOG.error("Failed to update active customer records due to exception {}", exp.getLocalizedMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Use connection internal hostname as the gateway name
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
private String getGatewayName() {
|
||||
return connectorProperties.getInternalHostName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the active timestamp for the customer
|
||||
*
|
||||
* @param customerId
|
||||
*/
|
||||
public void updateActiveCustomer(int customerId) {
|
||||
this.activeCustomerReadLock.lock();
|
||||
try {
|
||||
this.activeCustomerMap.merge(customerId, System.currentTimeMillis(), latestTimestamp);
|
||||
} finally {
|
||||
this.activeCustomerReadLock.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Swap the active customer map for reporting if it contains records.
|
||||
*
|
||||
* @return null if no records.
|
||||
*/
|
||||
protected Map<Integer, Long> getActiveCustomerMapForUpdate() {
|
||||
this.activeCustomerWriteLock.lock();
|
||||
try {
|
||||
Map<Integer, Long> map = null;
|
||||
if (!this.activeCustomerMap.isEmpty()) {
|
||||
map = this.activeCustomerMap;
|
||||
this.activeCustomerMap = new ConcurrentHashMap<>();
|
||||
}
|
||||
|
||||
return map;
|
||||
} finally {
|
||||
this.activeCustomerWriteLock.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>ai.connectus</groupId>
|
||||
<artifactId>opensync_gateway</artifactId>
|
||||
<name>opensync_gateway</name>
|
||||
<description>Redirector and Controller for OpenSync</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<artifactId>base-container</artifactId>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<version>${whizcontrol.release.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ai.connectus</groupId>
|
||||
<artifactId>opensync_ext_interface</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.vmware.ovsdb</groupId>
|
||||
<artifactId>ovsdb-client</artifactId>
|
||||
<version>1.0.1</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<artifactId>slf4j-log4j12</artifactId>
|
||||
<groupId>org.slf4j</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<!-- MQTT dependencies BEGIN -->
|
||||
<dependency>
|
||||
<groupId>ai.connectus</groupId>
|
||||
<artifactId>opensync_protobuf</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.protobuf</groupId>
|
||||
<artifactId>protobuf-java-util</artifactId>
|
||||
<version>3.11.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.fusesource.mqtt-client</groupId>
|
||||
<artifactId>mqtt-client</artifactId>
|
||||
<version>1.12</version>
|
||||
</dependency>
|
||||
<!-- MQTT dependencies END -->
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -1,39 +0,0 @@
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.whizcontrol</groupId>
|
||||
<artifactId>root-pom</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</parent>
|
||||
<groupId>ai.connectus</groupId>
|
||||
<artifactId>opensync_gateway_kdc_process</artifactId>
|
||||
<name>opensync_gateway_kdc_process</name>
|
||||
<description>Process definition for opensync_gateway that talks to KDC</description>
|
||||
<properties>
|
||||
<start-class>ai.connectus.opensync.experiment.OpenSyncProcess</start-class>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>ai.connectus</groupId>
|
||||
<artifactId>opensync_gateway</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ai.connectus</groupId>
|
||||
<artifactId>opensync_ext_kdc</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<!-- package executable jar file with all the dependencies in it -->
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -1,122 +0,0 @@
|
||||
# see http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#common-application-properties-security for details
|
||||
|
||||
app.name=OpenSyncManager
|
||||
|
||||
#
|
||||
#Select spring profiles
|
||||
#
|
||||
# valid values for security profiles are: no_ssl, use_ssl
|
||||
# valid values for auth profiles are: no_auth, form_based_auth, http_basic_auth, http_digest_auth, client_certificate_auth
|
||||
#
|
||||
# this property can be overridden by application.properties in the following locations:
|
||||
# classpath root
|
||||
# current directory
|
||||
# classpath /config package
|
||||
# /config subdir of the current directory.
|
||||
# System property -Dspring.profiles.active=production
|
||||
# or specified on the command line using the switch --spring.profiles.active=dev,hsqldb
|
||||
#
|
||||
# This does not work: spring.profiles.active=${whizcontrol.core.server.security},${whizcontrol.core.server.auth},Extra_${app.name}
|
||||
# Substitution of ${} in application.properties works in general, but not for spring.profiles.active and not for spring.profiles.include properties
|
||||
#
|
||||
# *** Do not set spring.profiles.active property in this file, or be prepared for the World of Weird.
|
||||
#spring.profiles.active=a_1,a_2,integration_test
|
||||
# Example: with application.properties:spring.profiles.active=a_1,a_2,dev,integration_test and @ActiveProfiles(profiles = "test1")
|
||||
# active profiles: [profile_it_1, profile_it_2, profile_dev_1, profile_dev_2, p_1, p_2, a_1, a_2, dev, integration_test, test1]
|
||||
# What happens:
|
||||
# RealActiveProfiles.addAll(application.properties:spring.profiles.active)
|
||||
# RealActiveProfiles.addAll(application.properties:spring.profiles.include)
|
||||
# Find all other files named application-${profileName}.properties based on content of RealActiveProfiles
|
||||
# All application-${profileName}.properties:spring.profiles.include are read, and for each file:
|
||||
# RealActiveProfiles.addAll(application-${profileName}.properties:spring.profiles.include)
|
||||
# Recursively process other files named application-${profileName}.properties based on content of RealActiveProfiles
|
||||
#
|
||||
# Note that application-${profileName}.properties:spring.profiles.active values are NOT added to the RealActiveProfiles in this case.
|
||||
#
|
||||
# Another Example: with application.properties:spring.profiles.active NOT SET and @ActiveProfiles(profiles = "integration_test")
|
||||
# active profiles: [profile_it_1, profile_it_2, active_it_1, active_it_2, p_1, p_2, integration_test]
|
||||
# What happens:
|
||||
# application.properties:spring.profiles.active is read and not found
|
||||
# RealActiveProfiles.addAll(application.properties:spring.profiles.include)
|
||||
# Find all other files named application-${profileName}.properties based on content of RealActiveProfiles
|
||||
# Found application-integration_test.properties file
|
||||
# RealActiveProfiles.addAll(application-integration_test.properties:spring.profiles.active)
|
||||
# RealActiveProfiles.addAll(application-integration_test.properties:spring.profiles.include)
|
||||
# Find all other files named application-${profileName}.properties based on content of RealActiveProfiles
|
||||
# All application-${profileName}.properties:spring.profiles.include are read, and for each file:
|
||||
# RealActiveProfiles.addAll(application-${profileName}.properties:spring.profiles.include)
|
||||
# Recursively process other files named application-${profileName}.properties based on content of RealActiveProfiles
|
||||
#
|
||||
# Note that only application-integration_test.properties:spring.profiles.active is read,
|
||||
# all other application-${profileName}.properties:spring.profiles.active values
|
||||
# are NOT added to the RealActiveProfiles in this case.
|
||||
#
|
||||
# Summary:
|
||||
# 1. Only the first available property application*.properties:spring.profiles.active is read and added to RealActiveProfiles
|
||||
# 2. All properties application*.properties:spring.profiles.include are read, and their values are added to RealActiveProfiles
|
||||
# 3. Many application*.properties can be read during initialization (i.e. one can include a profile name that is referring to another)
|
||||
#
|
||||
# ***
|
||||
#
|
||||
# Use spring.profiles.active property for unit/integration tests to select proper application-*.properties file
|
||||
# - this can be done by placing annotation @ActiveProfiles(profiles = "integration_test") on the test classes
|
||||
#
|
||||
# Use spring.profiles.active property for specific deployments - staging/cloud to select proper application-*.properties file
|
||||
# - this can be done by using SystemProperty -Dspring.profiles.active=cloud
|
||||
#
|
||||
# Deployment-specific properties can be configured in other property files, like persistence-${envTarget:dev}.properties
|
||||
# where value for property envTarget can be set using any mechanism, including placing it in the application-*.properties
|
||||
#
|
||||
#
|
||||
# Use spring.profiles.include property to specify static collection of profiles that are
|
||||
# always present in this configuration, regardless of spring.profiles.active property
|
||||
# Note: this property is additive, its value is always added to the list of active profiles
|
||||
#spring.profiles.include=use_ssl,http_digest_auth,customer-credential-datastore-inmemory
|
||||
#spring.profiles.include=no_ssl,no_auth
|
||||
#spring.profiles.include=use_ssl,client_certificate_auth
|
||||
spring.profiles.include=use_ssl_with_client_cert_and_basic_auth,client_certificate_and_basic_auth,rest-template-single-user-per-service-digest-auth,use_single_ds,opensync_kdc_config
|
||||
|
||||
whizcontrol.equipmentAndNetworkManagementServiceBaseUrl=https://localhost:9094
|
||||
|
||||
#used by *-remote client classes when they authenticate their requests
|
||||
whizcontrol.httpClientConfig=classpath:httpClientConfig.json
|
||||
|
||||
#this user/password is used together with http_digest_auth and http_basic_auth spring profiles
|
||||
whizcontrol.serviceUser=user
|
||||
whizcontrol.servicePassword=password
|
||||
|
||||
spring.main.show-banner=false
|
||||
server.port=9096
|
||||
|
||||
#this port is used by secondary server connector, it is protected by digest authentication, while primary server.port is protected by client certificate auth
|
||||
whizcontrol.secondaryPort=7071
|
||||
|
||||
#this server only supports REST requests, CSRF would get in the way
|
||||
whizcontrol.csrf-enabled=false
|
||||
whizcontrol.emailVerificationTokenExpiryMs=600
|
||||
whizcontrol.passwordResetTokenExpiryMs=3600
|
||||
|
||||
whizcontrol.customerAccountManagementServiceBaseUrl=https://localhost:9092
|
||||
whizcontrol.orderAndSubscriptionManagementServiceBaseUrl=https://localhost:9093
|
||||
whizcontrol.equipmentAndNetworkManagementServiceBaseUrl=https://localhost:9094
|
||||
whizcontrol.equipmentConfigurationManagerServiceBaseUrl=https://localhost:9082
|
||||
whizcontrol.equipmentStatusAndAlarmCollectorServiceBaseUrl=https://localhost:9083
|
||||
whizcontrol.equipmentMetricsCollectorServiceBaseUrl=https://localhost:9085
|
||||
whizcontrol.equipmentRoutingServiceBaseUrl=https://localhost:9081
|
||||
whizcontrol.firmwareManagementServiceBaseUrl=https://localhost:9072
|
||||
whizcontrol.equipmentEventCollectorServiceBaseUrl=https://localhost:9076
|
||||
|
||||
#server.session-timeout= # session timeout in seconds
|
||||
#server.tomcat.max-threads = 0 # number of threads in protocol handler
|
||||
|
||||
#server.context-path= # the context path, defaults to '/'
|
||||
#server.servlet-path= # the servlet path, defaults to '/'
|
||||
#server.tomcat.access-log-pattern= # log pattern of the access log
|
||||
#server.tomcat.access-log-enabled=false # is access logging enabled
|
||||
|
||||
# pretty print JSON
|
||||
spring.jackson.serialization.INDENT_OUTPUT=TRUE
|
||||
# sort keys
|
||||
#http.mappers.json-sort-keys=false
|
||||
|
||||
#spring.jmx.enabled=true # Expose MBeans from Spring
|
||||
@@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
|
||||
<listEntry value="/opensync_gateway/src/main/java/ai/connectus/opensync/experiment/OpenSyncProcess.java"/>
|
||||
</listAttribute>
|
||||
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
|
||||
<listEntry value="1"/>
|
||||
</listAttribute>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_EXCLUDE_TEST_CODE" value="true"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_CLASSPATH_ONLY_JAR" value="false"/>
|
||||
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER" value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/OpenJDK 13.0.2"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="ai.connectus.opensync.experiment.OpenSyncProcess"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="opensync_gateway_kdc_process"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="-D123javax.net.debug=ssl,handshake -D123javax.net.debug=ssl:handshake:verbose:keymanager:trustmanager -D123jdk.tls.server.cipherSuites=TLS_ECDHE_ECDSA_AES256_GCM_SHA384,TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256 -Dssl.props=file://${connectus_certs}/ssl.properties -Dwhizcontrol.httpClientConfig=file://${connectus_certs}/httpClientConfig.json -D123javax.net.ssl.keyStore=${connectus_certs}/client2Keystore.jks -D123javax.net.ssl.trustStore=${connectus_certs}/truststore.jks -Djavax.net.ssl.keyStore=${plume_certs}/plume_client_keystore.jks -Djavax.net.ssl.trustStore=${plume_certs}/plume_truststore.jks -Djavax.net.ssl.keyStorePassword=mypassword -Djavax.net.ssl.trustStorePassword=mypassword -D123connectus.mqttBroker.password=tri4hE4Hod5Ev2 -Dconnectus.ovsdb.managerAddr=192.168.0.137 -Dconnectus.ovsdb.listenPort=6640 -Dconnectus.ovsdb.redirector.listenPort=6643 -Dconnectus.ovsdb.timeoutSec=30 -D123connectus.ovsdb.trustStore=${connectus_certs}/truststore.jks -D123connectus.ovsdb.keyStore=${connectus_certs}/server.p12 -Dconnectus.ovsdb.trustStore=${plume_certs}/plume_truststore.jks -Dconnectus.ovsdb.keyStore=${plume_certs}/opensync_server.pkcs12 -Dconnectus.ovsdb.configFileName=${project_loc:opensync_ext_static}/src/main/resources/config_2_ssids.json -D123connectus.mqttBroker.address=testportal.123wlan.com -Dconnectus.mqttBroker.address=mqtt.zone1.art2wave.com -Dconnectus.mqttBroker.listenPort=1883 -Dspring.profiles.include=ovsdb_redirector,ovsdb_manager -D123spring.profiles.include=mqtt_receiver,ovsdb_redirector,ovsdb_manager -D123spring.profiles.include=ovsdb_redirector,ovsdb_manager -D123spring.profiles.include=mqtt_receiver -Dwhizcontrol.orderAndSubscriptionManagementServiceBaseUrl=https://${PROV_SERVER} -Dwhizcontrol.equipmentAndNetworkManagementServiceBaseUrl=https://${PROV_SERVER} -Dwhizcontrol.equipmentConfigurationManagerServiceBaseUrl=https://${PROV_SERVER} -Dwhizcontrol.equipmentRoutingServiceBaseUrl=https://${PROV_SERVER} -Dwhizcontrol.equipmentStatusAndAlarmCollectorServiceBaseUrl=https://${SMEC_SERVER} -Dwhizcontrol.equipmentMetricsCollectorServiceBaseUrl=https://${SMEC_SERVER} -Dwhizcontrol.equipmentEventCollectorServiceBaseUrl=https://${SMEC_SERVER} -Dwhizcontrol.realTimeDataAnalyticsServiceBaseUrl=https://${SMEC_SERVER}"/>
|
||||
</launchConfiguration>
|
||||
Reference in New Issue
Block a user