mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-01 11:07:49 +00:00
Setting external and internal mqtt broker addresses, Allow autoprov off with pre-config/enrolled APs, JUnit tests
This commit is contained in:
@@ -225,28 +225,29 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
@Override
|
||||
public void apConnected(String apId, ConnectNodeInfo connectNodeInfo) {
|
||||
|
||||
Customer customer = customerServiceInterface.getOrNull(autoProvisionedCustomerId);
|
||||
if (customer == null) {
|
||||
LOG.error("Cannot auto-provision equipment because customer with id {} is not found",
|
||||
autoProvisionedCustomerId);
|
||||
throw new IllegalStateException(
|
||||
"Cannot auto-provision equipment because customer is not found : " + autoProvisionedCustomerId);
|
||||
}
|
||||
|
||||
if ((customer.getDetails() != null) && (customer.getDetails().getAutoProvisioning() != null)
|
||||
&& !customer.getDetails().getAutoProvisioning().isEnabled()) {
|
||||
LOG.error("Cannot auto-provision equipment because customer with id {} explicitly turned that feature off",
|
||||
autoProvisionedCustomerId);
|
||||
throw new IllegalStateException(
|
||||
"Cannot auto-provision equipment because customer explicitly turned that feature off : "
|
||||
+ autoProvisionedCustomerId);
|
||||
}
|
||||
|
||||
Equipment ce = getCustomerEquipment(apId);
|
||||
|
||||
try {
|
||||
|
||||
|
||||
try {
|
||||
if (ce == null) {
|
||||
|
||||
Customer customer = customerServiceInterface.getOrNull(autoProvisionedCustomerId);
|
||||
if (customer == null) {
|
||||
LOG.error("Cannot auto-provision equipment because customer with id {} is not found",
|
||||
autoProvisionedCustomerId);
|
||||
throw new IllegalStateException("Cannot auto-provision equipment because customer is not found : "
|
||||
+ autoProvisionedCustomerId);
|
||||
}
|
||||
|
||||
if ((customer.getDetails() != null) && (customer.getDetails().getAutoProvisioning() != null)
|
||||
&& !customer.getDetails().getAutoProvisioning().isEnabled()) {
|
||||
LOG.error(
|
||||
"Cannot auto-provision equipment because customer with id {} explicitly turned that feature off",
|
||||
autoProvisionedCustomerId);
|
||||
throw new IllegalStateException(
|
||||
"Cannot auto-provision equipment because customer explicitly turned that feature off : "
|
||||
+ autoProvisionedCustomerId);
|
||||
}
|
||||
|
||||
ce = new Equipment();
|
||||
ce.setEquipmentType(EquipmentType.AP);
|
||||
ce.setInventoryId(apId);
|
||||
@@ -713,10 +714,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
}
|
||||
int customerId = ovsdbSession.getCustomerId();
|
||||
Customer customer = customerServiceInterface.getOrNull(customerId);
|
||||
if (customer != null
|
||||
&& customer.getDetails()!=null
|
||||
&& customer.getDetails().getAutoProvisioning()!=null
|
||||
&& customer.getDetails().getAutoProvisioning().isEnabled()) {
|
||||
if (customer != null && customer.getDetails() != null && customer.getDetails().getAutoProvisioning() != null
|
||||
&& customer.getDetails().getAutoProvisioning().isEnabled()) {
|
||||
Equipment equipmentConfig = getCustomerEquipment(apId);
|
||||
|
||||
if (equipmentConfig == null) {
|
||||
|
||||
@@ -17,7 +17,6 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Answers;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.MockitoSession;
|
||||
import org.mockito.quality.Strictness;
|
||||
@@ -57,6 +56,9 @@ import com.telecominfraproject.wlan.equipment.models.Equipment;
|
||||
import com.telecominfraproject.wlan.firmware.FirmwareServiceInterface;
|
||||
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackRecord;
|
||||
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackSettings;
|
||||
import com.telecominfraproject.wlan.location.models.Location;
|
||||
import com.telecominfraproject.wlan.location.models.LocationDetails;
|
||||
import com.telecominfraproject.wlan.location.models.LocationType;
|
||||
import com.telecominfraproject.wlan.location.service.LocationServiceInterface;
|
||||
import com.telecominfraproject.wlan.opensync.external.integration.controller.OpensyncCloudGatewayController;
|
||||
import com.telecominfraproject.wlan.opensync.external.integration.models.ConnectNodeInfo;
|
||||
@@ -98,34 +100,31 @@ import sts.OpensyncStats.VLANMetrics;
|
||||
})
|
||||
public class OpensyncExternalIntegrationCloudTest {
|
||||
|
||||
@MockBean(answer = Answers.RETURNS_MOCKS)
|
||||
@MockBean
|
||||
AlarmServiceInterface alarmServiceInterface;
|
||||
@MockBean(answer = Answers.RETURNS_MOCKS)
|
||||
@MockBean
|
||||
CustomerServiceInterface customerServiceInterface;
|
||||
@MockBean(answer = Answers.RETURNS_MOCKS)
|
||||
@MockBean
|
||||
LocationServiceInterface locationServiceInterface;
|
||||
@MockBean(answer = Answers.RETURNS_MOCKS)
|
||||
OvsdbSessionMapInterface ovsdbSessionMapInterface;
|
||||
@MockBean(answer = Answers.RETURNS_MOCKS)
|
||||
@MockBean
|
||||
CloudEventDispatcherInterface equipmentMetricsCollectorInterface;
|
||||
@MockBean
|
||||
EquipmentServiceInterface equipmentServiceInterface;
|
||||
@MockBean(answer = Answers.RETURNS_MOCKS)
|
||||
@MockBean
|
||||
RoutingServiceInterface routingServiceInterface;
|
||||
@MockBean
|
||||
ProfileServiceInterface profileServiceInterface;
|
||||
@MockBean(answer = Answers.RETURNS_MOCKS)
|
||||
@MockBean
|
||||
StatusServiceInterface statusServiceInterface;
|
||||
@MockBean(answer = Answers.RETURNS_MOCKS)
|
||||
@MockBean
|
||||
ClientServiceInterface clientServiceInterface;
|
||||
@MockBean(answer = Answers.RETURNS_MOCKS)
|
||||
@MockBean
|
||||
FirmwareServiceInterface firmwareServiceInterface;
|
||||
@MockBean(answer = Answers.RETURNS_MOCKS)
|
||||
OpensyncCloudGatewayController gatewayController;
|
||||
|
||||
@Mock(answer = Answers.RETURNS_MOCKS)
|
||||
ConnectNodeInfo connectNodeInfo;
|
||||
|
||||
@Autowired
|
||||
OpensyncExternalIntegrationCloud opensyncExternalIntegrationCloud;
|
||||
|
||||
@@ -142,6 +141,7 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
public CacheManager cacheManager() {
|
||||
return new CaffeineCacheManager();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Before
|
||||
@@ -172,26 +172,35 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
|
||||
@Test
|
||||
public void testApConnected() {
|
||||
connectNodeInfo.wifiRadioStates = ImmutableMap.of("2.4G", "home-ap-24", "5GL", "home-ap-l50", "5GU",
|
||||
"home-ap-u50");
|
||||
|
||||
Location location = new Location();
|
||||
location.setId(8L);
|
||||
location.setCustomerId(2);
|
||||
location.setDetails(LocationDetails.createWithDefaults());
|
||||
location.setName("Location-UT");
|
||||
location.setLocationType(LocationType.BUILDING);
|
||||
|
||||
Customer customer = new Customer();
|
||||
customer.setId(2);
|
||||
CustomerDetails customerDetails = new CustomerDetails();
|
||||
customerDetails.setAutoProvisioning(new EquipmentAutoProvisioningSettings());
|
||||
customerDetails.getAutoProvisioning().setEnabled(true);
|
||||
customerDetails.getAutoProvisioning().setLocationId(location.getId());
|
||||
|
||||
customer.setDetails(customerDetails);
|
||||
|
||||
Mockito.when(customerServiceInterface.getOrNull(Mockito.anyInt())).thenReturn(customer);
|
||||
|
||||
Profile apProfile = new Profile();
|
||||
apProfile.setDetails(ApNetworkConfiguration.createWithDefaults());
|
||||
|
||||
Profile ssidProfile = new Profile();
|
||||
ssidProfile.setDetails(SsidConfiguration.createWithDefaults());
|
||||
|
||||
Mockito.when(profileServiceInterface.create(Mockito.any(Profile.class))).thenReturn(apProfile)
|
||||
.thenReturn(ssidProfile);
|
||||
Mockito.when(profileServiceInterface.update(Mockito.any(Profile.class))).thenReturn(apProfile);
|
||||
|
||||
Mockito.when(customerServiceInterface.getOrNull(Mockito.anyInt())).thenReturn(customer);
|
||||
apProfile.setChildProfileIds(ImmutableSet.of(ssidProfile.getId()));
|
||||
Mockito.when(profileServiceInterface.create(Mockito.any(Profile.class))).thenAnswer(i -> i.getArguments()[0]);
|
||||
// .thenReturn(ssidProfile);
|
||||
Mockito.when(profileServiceInterface.update(Mockito.any(Profile.class))).thenAnswer(i -> i.getArguments()[0]);
|
||||
|
||||
Status fwStatus = new Status();
|
||||
fwStatus.setDetails(new EquipmentUpgradeStatusData());
|
||||
@@ -206,15 +215,123 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
fwTrackRecord.setCustomerId(2);
|
||||
Mockito.when(firmwareServiceInterface.getCustomerFirmwareTrackRecord(Mockito.anyInt()))
|
||||
.thenReturn(fwTrackRecord);
|
||||
opensyncExternalIntegrationCloud.apConnected("Test_Client_21P10C68818122", connectNodeInfo);
|
||||
|
||||
Equipment equipment = new Equipment();
|
||||
equipment.setCustomerId(2);
|
||||
equipment.setEquipmentType(EquipmentType.AP);
|
||||
equipment.setInventoryId("Test_Client_21P10C68818122");
|
||||
equipment.setLocationId(location.getId());
|
||||
equipment.setId(1L);
|
||||
equipment.setProfileId(apProfile.getId());
|
||||
equipment.setDetails(ApElementConfiguration.createWithDefaults());
|
||||
|
||||
Mockito.when(equipmentServiceInterface.get(1L)).thenReturn(equipment);
|
||||
Mockito.when(equipmentServiceInterface.getByInventoryIdOrNull(Mockito.eq("Test_Client_21P10C68818122")))
|
||||
.thenReturn(equipment);
|
||||
|
||||
Mockito.when(equipmentServiceInterface.create(Mockito.any(Equipment.class)))
|
||||
.thenAnswer(i -> i.getArguments()[0]);
|
||||
Mockito.when(equipmentServiceInterface.update(Mockito.any(Equipment.class)))
|
||||
.thenAnswer(i -> i.getArguments()[0]);
|
||||
|
||||
OvsdbSession session = Mockito.mock(OvsdbSession.class);
|
||||
|
||||
Mockito.when(ovsdbSessionMapInterface.getSession("Test_Client_21P10C68818122")).thenReturn(session);
|
||||
|
||||
opensyncExternalIntegrationCloud.apConnected("Test_Client_21P10C68818122", createConnectNodeInfo());
|
||||
|
||||
Mockito.verify(customerServiceInterface).getOrNull(Mockito.anyInt());
|
||||
Mockito.verify(equipmentServiceInterface).getByInventoryIdOrNull(Mockito.anyString());
|
||||
Mockito.verify(equipmentServiceInterface).update(Mockito.any(Equipment.class));
|
||||
|
||||
Mockito.verify(firmwareServiceInterface).getDefaultCustomerTrackSetting();
|
||||
Mockito.verifyNoInteractions(locationServiceInterface);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testApConnectedNewAp() throws Exception {
|
||||
Location location = new Location();
|
||||
location.setId(8L);
|
||||
location.setCustomerId(2);
|
||||
location.setDetails(LocationDetails.createWithDefaults());
|
||||
location.setName("Location-UT");
|
||||
location.setLocationType(LocationType.BUILDING);
|
||||
|
||||
Mockito.when(locationServiceInterface.get(8L)).thenReturn(location);
|
||||
|
||||
Customer customer = new Customer();
|
||||
customer.setId(2);
|
||||
CustomerDetails customerDetails = new CustomerDetails();
|
||||
customerDetails.setAutoProvisioning(new EquipmentAutoProvisioningSettings());
|
||||
customerDetails.getAutoProvisioning().setEnabled(true);
|
||||
customerDetails.getAutoProvisioning().setLocationId(location.getId());
|
||||
|
||||
customer.setDetails(customerDetails);
|
||||
|
||||
Mockito.when(customerServiceInterface.getOrNull(Mockito.anyInt())).thenReturn(customer);
|
||||
|
||||
Profile apProfile = new Profile();
|
||||
apProfile.setDetails(ApNetworkConfiguration.createWithDefaults());
|
||||
|
||||
Profile ssidProfile = new Profile();
|
||||
ssidProfile.setDetails(SsidConfiguration.createWithDefaults());
|
||||
|
||||
apProfile.setChildProfileIds(ImmutableSet.of(ssidProfile.getId()));
|
||||
|
||||
Mockito.when(profileServiceInterface.create(Mockito.any(Profile.class))).thenReturn(apProfile)
|
||||
.thenReturn(ssidProfile);
|
||||
Mockito.when(profileServiceInterface.update(Mockito.any(Profile.class))).thenReturn(apProfile);
|
||||
|
||||
Equipment equipment = new Equipment();
|
||||
equipment.setCustomerId(2);
|
||||
equipment.setEquipmentType(EquipmentType.AP);
|
||||
equipment.setInventoryId("Test_Client_21P10C68818122");
|
||||
equipment.setLocationId(location.getId());
|
||||
equipment.setId(1L);
|
||||
equipment.setProfileId(apProfile.getId());
|
||||
equipment.setDetails(ApElementConfiguration.createWithDefaults());
|
||||
|
||||
Mockito.when(equipmentServiceInterface.get(1L)).thenReturn(equipment);
|
||||
|
||||
Mockito.when(equipmentServiceInterface.create(Mockito.any(Equipment.class)))
|
||||
.thenAnswer(i -> i.getArguments()[0]);
|
||||
Mockito.when(equipmentServiceInterface.update(Mockito.any(Equipment.class)))
|
||||
.thenAnswer(i -> i.getArguments()[0]);
|
||||
Mockito.when(equipmentServiceInterface.getByInventoryIdOrNull(Mockito.eq("Test_Client_21P10C68818122")))
|
||||
.thenReturn(null);
|
||||
|
||||
Status fwStatus = new Status();
|
||||
fwStatus.setDetails(new EquipmentUpgradeStatusData());
|
||||
Mockito.when(statusServiceInterface.getOrNull(Mockito.anyInt(), Mockito.anyLong(),
|
||||
Mockito.eq(StatusDataType.FIRMWARE))).thenReturn(fwStatus);
|
||||
|
||||
Mockito.when(firmwareServiceInterface.getDefaultCustomerTrackSetting())
|
||||
.thenReturn(new CustomerFirmwareTrackSettings());
|
||||
CustomerFirmwareTrackRecord fwTrackRecord = new CustomerFirmwareTrackRecord();
|
||||
fwTrackRecord.setSettings(new CustomerFirmwareTrackSettings());
|
||||
fwTrackRecord.setTrackRecordId(3);
|
||||
fwTrackRecord.setCustomerId(2);
|
||||
Mockito.when(firmwareServiceInterface.getCustomerFirmwareTrackRecord(Mockito.anyInt()))
|
||||
.thenReturn(fwTrackRecord);
|
||||
|
||||
OvsdbSession session = Mockito.mock(OvsdbSession.class);
|
||||
|
||||
Mockito.when(ovsdbSessionMapInterface.getSession("Test_Client_21P10C68818122")).thenReturn(session);
|
||||
|
||||
// Mockito.when(locationServiceInterface.get(Mockito.anyLong())).thenReturn(value);
|
||||
opensyncExternalIntegrationCloud.apConnected("Test_Client_21P10C68818122", createConnectNodeInfo());
|
||||
|
||||
Mockito.verify(customerServiceInterface).getOrNull(Mockito.anyInt());
|
||||
Mockito.verify(equipmentServiceInterface).getByInventoryIdOrNull("Test_Client_21P10C68818122");
|
||||
Mockito.verify(firmwareServiceInterface).getDefaultCustomerTrackSetting();
|
||||
Mockito.verify(locationServiceInterface).get(Mockito.anyLong());
|
||||
|
||||
}
|
||||
|
||||
@Test(expected = IllegalStateException.class)
|
||||
public void testApConnectedNoAutoprovisioning() throws Exception {
|
||||
|
||||
connectNodeInfo.wifiRadioStates = ImmutableMap.of("2.4G", "home-ap-24", "5GL", "home-ap-l50", "5GU",
|
||||
"home-ap-u50");
|
||||
Customer customer = new Customer();
|
||||
customer.setId(2);
|
||||
CustomerDetails customerDetails = new CustomerDetails();
|
||||
@@ -225,9 +342,8 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
|
||||
Mockito.when(customerServiceInterface.getOrNull(Mockito.anyInt())).thenReturn(customer);
|
||||
|
||||
opensyncExternalIntegrationCloud.apConnected("Test_Client_21P10C68818122", connectNodeInfo);
|
||||
opensyncExternalIntegrationCloud.apConnected("Test_Client_21P10C68818122", createConnectNodeInfo());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@@ -237,7 +353,7 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
|
||||
@Test
|
||||
public void testGetApConfig() throws Exception {
|
||||
|
||||
|
||||
Customer customer = new Customer();
|
||||
customer.setId(2);
|
||||
CustomerDetails customerDetails = new CustomerDetails();
|
||||
@@ -245,10 +361,9 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
autoprovSettings.setEnabled(true);
|
||||
customerDetails.setAutoProvisioning(autoprovSettings);
|
||||
customer.setDetails(customerDetails);
|
||||
|
||||
|
||||
Mockito.when(customerServiceInterface.getOrNull(Mockito.anyInt())).thenReturn(customer);
|
||||
|
||||
|
||||
Equipment equipment = new Equipment();
|
||||
equipment.setDetails(ApElementConfiguration.createWithDefaults());
|
||||
|
||||
@@ -266,10 +381,10 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
assertNotNull(opensyncExternalIntegrationCloud.getApConfig("Test_Client_21P10C68818122"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testGetApConfigNoAutoprovisioning() throws Exception {
|
||||
|
||||
|
||||
Customer customer = new Customer();
|
||||
customer.setId(2);
|
||||
CustomerDetails customerDetails = new CustomerDetails();
|
||||
@@ -277,13 +392,12 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
autoprovSettings.setEnabled(false);
|
||||
customerDetails.setAutoProvisioning(autoprovSettings);
|
||||
customer.setDetails(customerDetails);
|
||||
|
||||
|
||||
Mockito.when(customerServiceInterface.getOrNull(Mockito.anyInt())).thenReturn(customer);
|
||||
|
||||
assertNull(opensyncExternalIntegrationCloud.getApConfig("Test_Client_21P10C68818122"));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testExtractApIdFromTopic() {
|
||||
@@ -464,6 +578,7 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
equipment.setDetails(ApElementConfiguration.createWithDefaults());
|
||||
|
||||
Mockito.when(equipmentServiceInterface.getByInventoryIdOrNull(apId)).thenReturn(equipment);
|
||||
Mockito.when(equipmentServiceInterface.get(equipment.getId())).thenReturn(equipment);
|
||||
Mockito.when(equipmentServiceInterface.update(equipment)).thenReturn(equipment);
|
||||
|
||||
Mockito.when(ovsdbSessionMapInterface.getSession(apId)).thenReturn(session);
|
||||
@@ -475,6 +590,7 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
Mockito.verify(session).getEquipmentId();
|
||||
Mockito.verify(ovsdbSessionMapInterface).getSession(apId);
|
||||
Mockito.verify(equipmentServiceInterface).getByInventoryIdOrNull(apId);
|
||||
|
||||
Mockito.verify(statusServiceInterface).getOrNull(2, 1L, StatusDataType.CLIENT_DETAILS);
|
||||
Mockito.verify(statusServiceInterface).update(clientStatus);
|
||||
Mockito.verify(statusServiceInterface).update(bssidStatus);
|
||||
@@ -718,4 +834,54 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
return clients;
|
||||
}
|
||||
|
||||
private ConnectNodeInfo createConnectNodeInfo() {
|
||||
ConnectNodeInfo connectNodeInfo = new ConnectNodeInfo();
|
||||
connectNodeInfo.macAddress = "24:f5:a2:ef:2e:53";
|
||||
connectNodeInfo.ifType = "eth";
|
||||
connectNodeInfo.ifName = "eth1";
|
||||
connectNodeInfo.ipV4Address = "10.0.0.129";
|
||||
|
||||
connectNodeInfo.lanMacAddress = "24:f5:a2:ef:2e:52";
|
||||
connectNodeInfo.lanIfType = "bridge";
|
||||
connectNodeInfo.lanIfName = "br-lan";
|
||||
connectNodeInfo.lanIpV4Address = "192.168.1.1";
|
||||
|
||||
connectNodeInfo.managerAddr = "ssl:192.168.1.101:6640";
|
||||
connectNodeInfo.firmwareVersion = "0.1.0";
|
||||
connectNodeInfo.model = "EA8300-CA";
|
||||
connectNodeInfo.revision = "1";
|
||||
connectNodeInfo.serialNumber = "21P10C68818122";
|
||||
connectNodeInfo.skuNumber = "connectus.ai_21P10C68818122";
|
||||
connectNodeInfo.redirectorAddr = "ssl:opensync.zone1.art2wave.com:6643";
|
||||
connectNodeInfo.platformVersion = "OPENWRT_EA8300";
|
||||
connectNodeInfo.wifiRadioStates = ImmutableMap.of("2.4G", "home-ap-24", "5GL", "home-ap-l50", "5GU",
|
||||
"home-ap-u50");
|
||||
|
||||
Map<String, String> versionMatrix = new HashMap<>();
|
||||
versionMatrix.put("DATE", "Thu Jul 16 18:52:06 UTC 2020");
|
||||
versionMatrix.put("FIRMWARE", "0.1.0-0-notgit-development");
|
||||
versionMatrix.put("FW_BUILD", "0");
|
||||
versionMatrix.put("FW_COMMIT", "notgit");
|
||||
versionMatrix.put("FW_PROFILE", "development");
|
||||
versionMatrix.put("FW_VERSION", "0.1.0");
|
||||
versionMatrix.put("HOST", "runner@26793cf70348");
|
||||
versionMatrix.put("OPENSYNC", "2.0.5.0");
|
||||
versionMatrix.put("core", "2.0.5.0/0/notgit");
|
||||
versionMatrix.put("vendor/ipq40xx", "0.1.0/0/notgit");
|
||||
connectNodeInfo.versionMatrix = versionMatrix;
|
||||
|
||||
Map<String, String> mqttSettings = new HashMap<>();
|
||||
|
||||
mqttSettings.put("broker", "192.168.1.101");
|
||||
mqttSettings.put("compress", "zlib");
|
||||
mqttSettings.put("port", "1883");
|
||||
mqttSettings.put("qos", "0");
|
||||
mqttSettings.put("remote_log", "1");
|
||||
mqttSettings.put("topics", "/ap/Test_Client_21P10C68818122/opensync");
|
||||
|
||||
connectNodeInfo.mqttSettings = mqttSettings;
|
||||
|
||||
return connectNodeInfo;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -13,7 +13,8 @@ CLIENT_MQTT_SSL_PROPS+=" -Djavax.net.ssl.trustStorePassword=mypassword"
|
||||
CLIENT_MQTT_SSL_PROPS+=" -Dtip.wlan.mqttBroker.password=admin"
|
||||
|
||||
OVSDB_MANAGER_HOST=${OVSDB_MANAGER}
|
||||
MQTT_BROKER_HOST="${MQTT_SERVER}"
|
||||
MQTT_BROKER_HOST_INTERNAL="${MQTT_SERVER_INTERNAL}"
|
||||
MQTT_BROKER_HOST_EXTERNAL="${MQTT_SERVER_EXTERNAL}"
|
||||
PROV_SERVER_HOST="${PROV_SERVER}"
|
||||
SSC_SERVER_HOST="${SSC_SERVER}"
|
||||
ALL_IN_ONE_HOST="${INTEGRATED_SERVER}"
|
||||
@@ -28,7 +29,8 @@ OVSDB_PROPS+=" -Dtip.wlan.ovsdb.keyStore=/opt/tip-wlan/certs/server.pkcs12"
|
||||
OVSDB_PROPS+=" -Dtip.wlan.ovsdb.configFileName=/app/opensync/config_2_ssids.json"
|
||||
|
||||
MQTT_PROPS=" "
|
||||
MQTT_PROPS+=" -Dtip.wlan.mqttBroker.address=$MQTT_BROKER_HOST"
|
||||
MQTT_PROPS+=" -Dtip.wlan.mqttBroker.address.internal=$MQTT_BROKER_HOST_INTERNAL"
|
||||
MQTT_PROPS+=" -Dtip.wlan.mqttBroker.address.external=$MQTT_BROKER_HOST_EXTERNAL"
|
||||
MQTT_PROPS+=" -Dtip.wlan.mqttBroker.listenPort=1883"
|
||||
|
||||
LOGBACK_CONFIG_FILE="${LOGBACK_CONFIG_FILE:=/app/opensync/logback.xml}"
|
||||
@@ -98,4 +100,4 @@ PROV_PROPS+=" -Dtip.wlan.ovsdb.autoProvisionedCustomerId=$AUTO_PROV_CUSTOMER_ID"
|
||||
|
||||
export ALL_PROPS="$PROFILES $SSL_PROPS $CLIENT_MQTT_SSL_PROPS $OVSDB_PROPS $MQTT_PROPS $LOGGING_PROPS $RESTAPI_PROPS $SPRING_EXTRA_PROPS $HOST_PROPS $PROV_PROPS"
|
||||
|
||||
java $ALL_PROPS -jar app.jar
|
||||
java $ALL_PROPS -jar app.jar
|
||||
|
||||
@@ -21,5 +21,5 @@
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="opensync-gateway-cloud-process"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="opensync-gateway-cloud-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="--add-opens java.base/java.lang=ALL-UNNAMED -Dssl.props=file://${project_loc:opensync-gateway-cloud-process}/src/main/resources/app/certs/ssl.properties -Dtip.wlan.httpClientConfig=file://${project_loc:opensync-gateway-cloud-process}/src/main/resources/app/certs/httpClientConfig.json -Djavax.net.ssl.keyStore=${tip_wlan_service_certs}/client_keystore.jks -Djavax.net.ssl.keyStorePassword=mypassword -Djavax.net.ssl.trustStore=${tip_wlan_service_certs}/truststore.jks -Djavax.net.ssl.trustStorePassword=mypassword -Dtip.wlan.ovsdb.managerAddr=${local_server_address} -Dtip.wlan.ovsdb.listenPort=6640 -Dtip.wlan.ovsdb.redirector.listenPort=6643 -Dtip.wlan.ovsdb.timeoutSec=30 -Dtip.wlan.ovsdb.trustStore=${tip_wlan_service_certs}/truststore.jks -Dtip.wlan.ovsdb.keyStore=${tip_wlan_service_certs}/server.pkcs12 -Dtip.wlan.mqttBroker.address=${local_server_address} -Dtip.wlan.mqttBroker.listenPort=1883 -Dtip.wlan.ovsdb.wifi-iface.default_bridge=br-lan -Dtip.wlan.introspectTokenApi.host=${local_server_address}:9096 -Dtip.wlan.introspectTokenApi.clientToken=token_placeholder -Dtip.wlan.ovsdb.autoProvisionedCustomerId=2 -Dtip.wlan.ovsdb.autoProvisionedSsid=TipWlan-cloud -Dserver.port=9096 -Dtip.wlan.secondaryPort=7071 -Dspring.profiles.include=opensync_cloud_config,mqtt_receiver,ovsdb_redirector,ovsdb_manager"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="--add-opens java.base/java.lang=ALL-UNNAMED -Dssl.props=file://${project_loc:opensync-gateway-cloud-process}/src/main/resources/app/certs/ssl.properties -Dtip.wlan.httpClientConfig=file://${project_loc:opensync-gateway-cloud-process}/src/main/resources/app/certs/httpClientConfig.json -Djavax.net.ssl.keyStore=${tip_wlan_service_certs}/client_keystore.jks -Djavax.net.ssl.keyStorePassword=mypassword -Djavax.net.ssl.trustStore=${tip_wlan_service_certs}/truststore.jks -Djavax.net.ssl.trustStorePassword=mypassword -Dtip.wlan.ovsdb.managerAddr=${local_server_address} -Dtip.wlan.ovsdb.listenPort=6640 -Dtip.wlan.ovsdb.redirector.listenPort=6643 -Dtip.wlan.ovsdb.timeoutSec=30 -Dtip.wlan.ovsdb.trustStore=${tip_wlan_service_certs}/truststore.jks -Dtip.wlan.ovsdb.keyStore=${tip_wlan_service_certs}/server.pkcs12 -Dtip.wlan.mqttBroker.address.internal=${local_server_address} -Dtip.wlan.mqttBroker.address.external=${local_server_address} -Dtip.wlan.mqttBroker.listenPort=1883 -Dtip.wlan.ovsdb.wifi-iface.default_bridge=br-lan -Dtip.wlan.introspectTokenApi.host=${local_server_address}:9096 -Dtip.wlan.introspectTokenApi.clientToken=token_placeholder -Dtip.wlan.ovsdb.autoProvisionedCustomerId=2 -Dtip.wlan.ovsdb.autoProvisionedSsid=TipWlan-cloud -Dserver.port=9096 -Dtip.wlan.secondaryPort=7071 -Dspring.profiles.include=opensync_cloud_config,mqtt_receiver,ovsdb_redirector,ovsdb_manager"/>
|
||||
</launchConfiguration>
|
||||
|
||||
@@ -45,12 +45,6 @@ OVSDB_IF_DEFAULT_RADIO_1="${OVSDB_IF_DEFAULT_RADIO_1:=home-ap-24}"
|
||||
echo $OVSDB_IF_DEFAULT_RADIO_1
|
||||
OVSDB_IF_DEFAULT_RADIO_2="${OVSDB_IF_DEFAULT_RADIO_2:=home-ap-l50}"
|
||||
echo $OVSDB_IF_DEFAULT_RADIO_2
|
||||
OVSDB_DEVICE_RADIO_0="${OVSDB_DEVICE_RADIO_0:=wifi2}"
|
||||
echo $OVSDB_DEVICE_RADIO_0
|
||||
OVSDB_DEVICE_RADIO_1="${OVSDB_DEVICE_RADIO_1:=wifi0}"
|
||||
echo $OVSDB_DEVICE_RADIO_1
|
||||
OVSDB_DEVICE_RADIO_2="${OVSDB_DEVICE_RADIO_2:=wifi1}"
|
||||
echo $OVSDB_DEVICE_RADIO_2
|
||||
OVSDB_DEVICE_DEFAULT_WAN_TYPE="${OVSDB_DEVICE_DEFAULT_WAN_NAME:=eth}"
|
||||
echo $OVSDB_DEVICE_DEFAULT_WAN
|
||||
OVSDB_DEVICE_DEFAULT_LAN_TYPE="${OVSDB_DEVICE_DEFAULT_LAN_TYPE:=br-lan}"
|
||||
@@ -64,7 +58,8 @@ EXT_CLIENT_KEYSTORE_FILE="${EXT_CLIENT_KEYSTORE_FILE:=/opt/tip-wlan/certs/client
|
||||
EXT_TRUSTSTORE_FILE="${EXT_TRUSTSTORE_FILE:=/opt/tip-wlan/certs/truststore.jks}"
|
||||
EXT_TRUSTSTORE_PASSWORD="${EXT_TRUSTSTORE_PASSWORD:=mypassword}"
|
||||
|
||||
MQTT_BROKER_HOST="${MQTT_BROKER_HOST:=opensync-mqtt-broker}"
|
||||
MQTT_BROKER_HOST_INTERNAL="${MQTT_BROKER_HOST_INTERNAL:=opensync-mqtt-broker}"
|
||||
MQTT_BROKER_HOST_EXTERNAL="${MQTT_BROKER_HOST_EXTERNAL:=opensync-mqtt-broker}"
|
||||
OVSDB_MANAGER_HOST="${OVSDB_MANAGER_HOST:=opensync-wifi-controller}"
|
||||
|
||||
LOGBACK_CONFIG_FILE="${LOGBACK_CONFIG_FILE:=/app/opensync/logback.xml}"
|
||||
@@ -140,15 +135,13 @@ OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.wifi-iface.default_lan_name=$OVSDB_DE
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.wifi-iface.default_radio0=$OVSDB_IF_DEFAULT_RADIO_0"
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.wifi-iface.default_radio1=$OVSDB_IF_DEFAULT_RADIO_1"
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.wifi-iface.default_radio2=$OVSDB_IF_DEFAULT_RADIO_2"
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.wifi-device.radio0=$OVSDB_DEVICE_RADIO_0"
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.wifi-device.radio1=$OVSDB_DEVICE_RADIO_1"
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.wifi-device.radio2=$OVSDB_DEVICE_RADIO_2"
|
||||
|
||||
echo OVSDB_PROPS $OVSDB_PROPS
|
||||
|
||||
|
||||
MQTT_PROPS=" "
|
||||
MQTT_PROPS="$MQTT_PROPS -Dtip.wlan.mqttBroker.address=$MQTT_BROKER_HOST"
|
||||
MQTT_PROPS="$MQTT_PROPS -Dtip.wlan.mqttBroker.address.internal=$MQTT_BROKER_HOST_INTERNAL"
|
||||
MQTT_PROPS="$MQTT_PROPS -Dtip.wlan.mqttBroker.address.external=$MQTT_BROKER_HOST_EXTERNAL"
|
||||
MQTT_PROPS="$MQTT_PROPS -Dtip.wlan.mqttBroker.listenPort=1883"
|
||||
|
||||
LOGGING_PROPS=" -Dlogging.config=file:$LOGBACK_CONFIG_FILE"
|
||||
|
||||
@@ -31,14 +31,12 @@ OVSDB_PROPS+=" -Dtip.wlan.ovsdb.wifi-iface.default_lan_name=$OVSDB_DEVICE_DEFAUL
|
||||
OVSDB_PROPS+=" -Dtip.wlan.ovsdb.wifi-iface.default_radio0=$OVSDB_IF_DEFAULT_RADIO_0"
|
||||
OVSDB_PROPS+=" -Dtip.wlan.ovsdb.wifi-iface.default_radio1=$OVSDB_IF_DEFAULT_RADIO_1"
|
||||
OVSDB_PROPS+=" -Dtip.wlan.ovsdb.wifi-iface.default_radio2=$OVSDB_IF_DEFAULT_RADIO_2"
|
||||
OVSDB_PROPS+=" -Dtip.wlan.ovsdb.wifi-device.radio0=$OVSDB_DEVICE_RADIO_0"
|
||||
OVSDB_PROPS+=" -Dtip.wlan.ovsdb.wifi-device.radio1=$OVSDB_DEVICE_RADIO_1"
|
||||
OVSDB_PROPS+=" -Dtip.wlan.ovsdb.wifi-device.radio2=$OVSDB_DEVICE_RADIO_2"
|
||||
|
||||
echo OVSDB_PROPS $OVSDB_PROPS
|
||||
|
||||
MQTT_PROPS=" "
|
||||
MQTT_PROPS+=" -Dtip.wlan.mqttBroker.address=tip-wlan-opensync-mqtt-broker"
|
||||
MQTT_PROPS+=" -Dtip.wlan.mqttBroker.address.internal=tip-wlan-opensync-mqtt-broker-internal"
|
||||
MQTT_PROPS+=" -Dtip.wlan.mqttBroker.address.external=tip-wlan-opensync-mqtt-broker-external"
|
||||
MQTT_PROPS+=" -Dtip.wlan.mqttBroker.listenPort=1883"
|
||||
|
||||
LOGGING_PROPS=" -Dlogging.config=file:/app/opensync/logback.xml"
|
||||
@@ -50,4 +48,4 @@ SPRING_EXTRA_PROPS=" --add-opens java.base/java.lang=ALL-UNNAMED"
|
||||
|
||||
export ALL_PROPS="$PROFILES $SSL_PROPS $CLIENT_MQTT_SSL_PROPS $OVSDB_PROPS $MQTT_PROPS $LOGGING_PROPS $RESTAPI_PROPS $SPRING_EXTRA_PROPS"
|
||||
|
||||
java $ALL_PROPS -jar app.jar
|
||||
java $ALL_PROPS -jar app.jar
|
||||
|
||||
@@ -14,5 +14,5 @@
|
||||
<stringAttribute key="org.eclipse.jdt.launching.MODULE_NAME" value="opensync-gateway-static-process"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="opensync-gateway-static-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="--add-opens java.base/java.lang=ALL-UNNAMED -Dssl.props=file://${project_loc:opensync-gateway-static-process}/src/main/resources/app/certs/ssl.properties -Dtip.wlan.httpClientConfig=file://${project_loc:opensync-gateway-static-process}/src/main/resources/app/certs/httpClientConfig.json -Djavax.net.ssl.keyStore=${tip_wlan_service_certs}/client_keystore.jks -Djavax.net.ssl.keyStorePassword=mypassword -Djavax.net.ssl.trustStore=${tip_wlan_service_certs}/truststore.jks -Djavax.net.ssl.trustStorePassword=mypassword -Dtip.wlan.ovsdb.managerAddr=${local_server_address} -Dtip.wlan.ovsdb.listenPort=6640 -Dtip.wlan.ovsdb.redirector.listenPort=6643 -Dtip.wlan.ovsdb.timeoutSec=30 -Dtip.wlan.ovsdb.trustStore=${tip_wlan_service_certs}/truststore.jks -Dtip.wlan.ovsdb.keyStore=${tip_wlan_service_certs}/server.pkcs12 -Dtip.wlan.ovsdb.customerEquipmentFileName=${project_loc:opensync-ext-static}/src/main/resources/EquipmentExample.json -Dtip.wlan.ovsdb.apProfileFileName=${project_loc:opensync-ext-static}/src/main/resources/ProfileAPExample.json -Dtip.wlan.ovsdb.ssidProfileFileName=${project_loc:opensync-ext-static}/src/main/resources/ProfileSsid.json -Dtip.wlan.ovsdb.locationFileName=${project_loc:opensync-ext-static}/src/main/resources/LocationBuildingExample.json -Dtip.wlan.ovsdb.radiusProfileFileName=${project_loc:opensync-ext-static}/src/main/resources/ProfileRadius.json -Dtip.wlan.mqttBroker.address=${local_server_address} -Dtip.wlan.mqttBroker.listenPort=1883 -Dspring.profiles.include=use_ssl,use_webtoken_auth,use_single_ds,RestTemplateConfiguration_X509_client_cert_auth,opensync_static_config,mqtt_receiver,ovsdb_redirector,ovsdb_manager"/>
|
||||
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS" value="--add-opens java.base/java.lang=ALL-UNNAMED -Dssl.props=file://${project_loc:opensync-gateway-static-process}/src/main/resources/app/certs/ssl.properties -Dtip.wlan.httpClientConfig=file://${project_loc:opensync-gateway-static-process}/src/main/resources/app/certs/httpClientConfig.json -Djavax.net.ssl.keyStore=${tip_wlan_service_certs}/client_keystore.jks -Djavax.net.ssl.keyStorePassword=mypassword -Djavax.net.ssl.trustStore=${tip_wlan_service_certs}/truststore.jks -Djavax.net.ssl.trustStorePassword=mypassword -Dtip.wlan.ovsdb.managerAddr=${local_server_address} -Dtip.wlan.ovsdb.listenPort=6640 -Dtip.wlan.ovsdb.redirector.listenPort=6643 -Dtip.wlan.ovsdb.timeoutSec=30 -Dtip.wlan.ovsdb.trustStore=${tip_wlan_service_certs}/truststore.jks -Dtip.wlan.ovsdb.keyStore=${tip_wlan_service_certs}/server.pkcs12 -Dtip.wlan.ovsdb.customerEquipmentFileName=${project_loc:opensync-ext-static}/src/main/resources/EquipmentExample.json -Dtip.wlan.ovsdb.apProfileFileName=${project_loc:opensync-ext-static}/src/main/resources/ProfileAPExample.json -Dtip.wlan.ovsdb.ssidProfileFileName=${project_loc:opensync-ext-static}/src/main/resources/ProfileSsid.json -Dtip.wlan.ovsdb.locationFileName=${project_loc:opensync-ext-static}/src/main/resources/LocationBuildingExample.json -Dtip.wlan.ovsdb.radiusProfileFileName=${project_loc:opensync-ext-static}/src/main/resources/ProfileRadius.json -Dtip.wlan.mqttBroker.address.internal=${local_server_address} -Dtip.wlan.mqttBroker.address.external=${local_server_address} -Dtip.wlan.mqttBroker.listenPort=1883 -Dspring.profiles.include=use_ssl,use_webtoken_auth,use_single_ds,RestTemplateConfiguration_X509_client_cert_auth,opensync_static_config,mqtt_receiver,ovsdb_redirector,ovsdb_manager"/>
|
||||
</launchConfiguration>
|
||||
|
||||
@@ -55,7 +55,7 @@ public class OpensyncMqttClient implements ApplicationListener<ContextClosedEven
|
||||
private Thread mqttClientThread;
|
||||
|
||||
public OpensyncMqttClient(@Autowired io.netty.handler.ssl.SslContext sslContext,
|
||||
@Value("${tip.wlan.mqttBroker.address:testportal.123wlan.com}") String mqttBrokerAddress,
|
||||
@Value("${tip.wlan.mqttBroker.address.internal:testportal.123wlan.com}") String mqttBrokerAddress,
|
||||
@Value("${tip.wlan.mqttBroker.listenPort:1883}") int mqttBrokerListenPort,
|
||||
@Value("${tip.wlan.mqttBroker.user:admin}") String username,
|
||||
@Value("${tip.wlan.mqttBroker.password:admin}") String password,
|
||||
|
||||
@@ -89,7 +89,7 @@ public class OvsdbDao {
|
||||
@org.springframework.beans.factory.annotation.Value("${tip.wlan.ovsdb.listenPort:6640}")
|
||||
private int ovsdbListenPort;
|
||||
|
||||
@org.springframework.beans.factory.annotation.Value("${tip.wlan.mqttBroker.address:testportal.123wlan.com}")
|
||||
@org.springframework.beans.factory.annotation.Value("${tip.wlan.mqttBroker.address.external:testportal.123wlan.com}")
|
||||
private String mqttBrokerAddress;
|
||||
|
||||
@org.springframework.beans.factory.annotation.Value("${tip.wlan.mqttBroker.listenPort:1883}")
|
||||
|
||||
Reference in New Issue
Block a user