From 39c63c32d5b9642b68140a9edc4b305b31c46d26 Mon Sep 17 00:00:00 2001 From: Mike Hansen Date: Tue, 21 Jul 2020 17:10:55 -0400 Subject: [PATCH] Setting external and internal mqtt broker addresses, Allow autoprov off with pre-config/enrolled APs, JUnit tests --- .../OpensyncExternalIntegrationCloud.java | 47 ++-- .../OpensyncExternalIntegrationCloudTest.java | 230 +++++++++++++++--- .../src/main/docker/app/run.sh | 8 +- ...yncProcess (local, KDC certs) cloud.launch | 2 +- .../app/run.sh | 15 +- .../src/main/docker/app/run.sh | 8 +- ...ncProcess (local, KDC certs) static.launch | 2 +- .../opensync/mqtt/OpensyncMqttClient.java | 2 +- .../wlan/opensync/ovsdb/dao/OvsdbDao.java | 2 +- 9 files changed, 237 insertions(+), 79 deletions(-) diff --git a/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloud.java b/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloud.java index c2d60c4..6fea22d 100644 --- a/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloud.java +++ b/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloud.java @@ -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) { diff --git a/opensync-ext-cloud/src/test/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloudTest.java b/opensync-ext-cloud/src/test/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloudTest.java index ccefcf7..979e624 100644 --- a/opensync-ext-cloud/src/test/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloudTest.java +++ b/opensync-ext-cloud/src/test/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloudTest.java @@ -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 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 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; + } + } diff --git a/opensync-gateway-cloud-docker/src/main/docker/app/run.sh b/opensync-gateway-cloud-docker/src/main/docker/app/run.sh index 6a75ebc..1414b81 100755 --- a/opensync-gateway-cloud-docker/src/main/docker/app/run.sh +++ b/opensync-gateway-cloud-docker/src/main/docker/app/run.sh @@ -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 \ No newline at end of file +java $ALL_PROPS -jar app.jar diff --git a/opensync-gateway-cloud-process/src/main/resources/launchers/OpenSyncProcess (local, KDC certs) cloud.launch b/opensync-gateway-cloud-process/src/main/resources/launchers/OpenSyncProcess (local, KDC certs) cloud.launch index 716cb18..8f829ff 100644 --- a/opensync-gateway-cloud-process/src/main/resources/launchers/OpenSyncProcess (local, KDC certs) cloud.launch +++ b/opensync-gateway-cloud-process/src/main/resources/launchers/OpenSyncProcess (local, KDC certs) cloud.launch @@ -21,5 +21,5 @@ - + diff --git a/opensync-gateway-static-docker/src/main/docker-opensync-gateway-and-mqtt/app/run.sh b/opensync-gateway-static-docker/src/main/docker-opensync-gateway-and-mqtt/app/run.sh index f9d2fad..4451c57 100755 --- a/opensync-gateway-static-docker/src/main/docker-opensync-gateway-and-mqtt/app/run.sh +++ b/opensync-gateway-static-docker/src/main/docker-opensync-gateway-and-mqtt/app/run.sh @@ -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" diff --git a/opensync-gateway-static-docker/src/main/docker/app/run.sh b/opensync-gateway-static-docker/src/main/docker/app/run.sh index 3d6d70a..66f9029 100755 --- a/opensync-gateway-static-docker/src/main/docker/app/run.sh +++ b/opensync-gateway-static-docker/src/main/docker/app/run.sh @@ -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 \ No newline at end of file +java $ALL_PROPS -jar app.jar diff --git a/opensync-gateway-static-process/src/main/resources/launchers/OpenSyncProcess (local, KDC certs) static.launch b/opensync-gateway-static-process/src/main/resources/launchers/OpenSyncProcess (local, KDC certs) static.launch index 2eef6dd..bf00161 100644 --- a/opensync-gateway-static-process/src/main/resources/launchers/OpenSyncProcess (local, KDC certs) static.launch +++ b/opensync-gateway-static-process/src/main/resources/launchers/OpenSyncProcess (local, KDC certs) static.launch @@ -14,5 +14,5 @@ - + diff --git a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/mqtt/OpensyncMqttClient.java b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/mqtt/OpensyncMqttClient.java index 2d3d964..559bd1a 100644 --- a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/mqtt/OpensyncMqttClient.java +++ b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/mqtt/OpensyncMqttClient.java @@ -55,7 +55,7 @@ public class OpensyncMqttClient implements ApplicationListener