mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-01 19:17:52 +00:00
WIFI-456: Cloud SDK BackEnd : Bonjour Gateway support
Add Bonjour Profile support to OpensyncApConfig Add static files for static and static-docker versions. Refactor of OpensyncExternalIntegrationCloud. Separate concerns, move MQTT message processing and stats events to new class. JUnit tests updated based on refactor
This commit is contained in:
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -4,8 +4,6 @@ import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.math.BigInteger;
|
||||
import java.net.InetAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -18,6 +16,7 @@ import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Answers;
|
||||
import org.mockito.ArgumentMatchers;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.MockitoSession;
|
||||
import org.mockito.quality.Strictness;
|
||||
@@ -70,8 +69,6 @@ import com.telecominfraproject.wlan.profile.models.Profile;
|
||||
import com.telecominfraproject.wlan.profile.network.models.ApNetworkConfiguration;
|
||||
import com.telecominfraproject.wlan.profile.ssid.models.SsidConfiguration;
|
||||
import com.telecominfraproject.wlan.routing.RoutingServiceInterface;
|
||||
import com.telecominfraproject.wlan.servicemetric.apnode.models.ApNodeMetrics;
|
||||
import com.telecominfraproject.wlan.servicemetric.apnode.models.StateUpDownError;
|
||||
import com.telecominfraproject.wlan.status.StatusServiceInterface;
|
||||
import com.telecominfraproject.wlan.status.equipment.models.EquipmentProtocolStatusData;
|
||||
import com.telecominfraproject.wlan.status.equipment.models.EquipmentUpgradeStatusData;
|
||||
@@ -85,15 +82,10 @@ import com.vmware.ovsdb.protocol.operation.notation.Uuid;
|
||||
import sts.OpensyncStats.AssocType;
|
||||
import sts.OpensyncStats.Client;
|
||||
import sts.OpensyncStats.ClientReport;
|
||||
import sts.OpensyncStats.DNSProbeMetric;
|
||||
import sts.OpensyncStats.EventReport;
|
||||
import sts.OpensyncStats.EventType;
|
||||
import sts.OpensyncStats.NetworkProbe;
|
||||
import sts.OpensyncStats.RADIUSMetrics;
|
||||
import sts.OpensyncStats.RadioBandType;
|
||||
import sts.OpensyncStats.Report;
|
||||
import sts.OpensyncStats.StateUpDown;
|
||||
import sts.OpensyncStats.VLANMetrics;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@ActiveProfiles(profiles = { "integration_test", })
|
||||
@@ -128,14 +120,18 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
FirmwareServiceInterface firmwareServiceInterface;
|
||||
@MockBean(answer = Answers.RETURNS_MOCKS)
|
||||
OpensyncCloudGatewayController gatewayController;
|
||||
@MockBean
|
||||
OpensyncExternalIntegrationMqttMessageProcessor opensyncExternalIntegrationMqttProcessor;
|
||||
|
||||
@Autowired
|
||||
OpensyncExternalIntegrationCloud opensyncExternalIntegrationCloud;
|
||||
|
||||
|
||||
MockitoSession mockito;
|
||||
|
||||
@Configuration
|
||||
static class Config {
|
||||
|
||||
@Bean
|
||||
public OpensyncExternalIntegrationCloud opensyncExternalIntegrationCloud() {
|
||||
return new OpensyncExternalIntegrationCloud();
|
||||
@@ -167,7 +163,8 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
Equipment equipment = new Equipment();
|
||||
equipment.setDetails(ApElementConfiguration.createWithDefaults());
|
||||
|
||||
Mockito.when(equipmentServiceInterface.getByInventoryIdOrNull(Mockito.eq("Test_Client_21P10C68818122")))
|
||||
Mockito.when(
|
||||
equipmentServiceInterface.getByInventoryIdOrNull(ArgumentMatchers.eq("Test_Client_21P10C68818122")))
|
||||
.thenReturn(equipment);
|
||||
assertNotNull(opensyncExternalIntegrationCloud.getCustomerEquipment("Test_Client_21P10C68818122"));
|
||||
assertNull(opensyncExternalIntegrationCloud.getCustomerEquipment("Test_Client_21P10C68818133"));
|
||||
@@ -193,7 +190,7 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
|
||||
customer.setDetails(customerDetails);
|
||||
|
||||
Mockito.when(customerServiceInterface.getOrNull(Mockito.anyInt())).thenReturn(customer);
|
||||
Mockito.when(customerServiceInterface.getOrNull(ArgumentMatchers.anyInt())).thenReturn(customer);
|
||||
|
||||
Profile apProfile = new Profile();
|
||||
apProfile.setDetails(ApNetworkConfiguration.createWithDefaults());
|
||||
@@ -202,14 +199,16 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
ssidProfile.setDetails(SsidConfiguration.createWithDefaults());
|
||||
|
||||
apProfile.setChildProfileIds(ImmutableSet.of(ssidProfile.getId()));
|
||||
Mockito.when(profileServiceInterface.create(Mockito.any(Profile.class))).thenAnswer(i -> i.getArguments()[0]);
|
||||
Mockito.when(profileServiceInterface.create(ArgumentMatchers.any(Profile.class)))
|
||||
.thenAnswer(i -> i.getArguments()[0]);
|
||||
// .thenReturn(ssidProfile);
|
||||
Mockito.when(profileServiceInterface.update(Mockito.any(Profile.class))).thenAnswer(i -> i.getArguments()[0]);
|
||||
Mockito.when(profileServiceInterface.update(ArgumentMatchers.any(Profile.class)))
|
||||
.thenAnswer(i -> i.getArguments()[0]);
|
||||
|
||||
Status fwStatus = new Status();
|
||||
fwStatus.setDetails(new EquipmentUpgradeStatusData());
|
||||
Mockito.when(statusServiceInterface.getOrNull(Mockito.anyInt(), Mockito.anyLong(),
|
||||
Mockito.eq(StatusDataType.FIRMWARE))).thenReturn(fwStatus);
|
||||
Mockito.when(statusServiceInterface.getOrNull(ArgumentMatchers.anyInt(), ArgumentMatchers.anyLong(),
|
||||
ArgumentMatchers.eq(StatusDataType.FIRMWARE))).thenReturn(fwStatus);
|
||||
|
||||
Mockito.when(firmwareServiceInterface.getDefaultCustomerTrackSetting())
|
||||
.thenReturn(new CustomerFirmwareTrackSettings());
|
||||
@@ -217,7 +216,7 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
fwTrackRecord.setSettings(new CustomerFirmwareTrackSettings());
|
||||
fwTrackRecord.setTrackRecordId(3);
|
||||
fwTrackRecord.setCustomerId(2);
|
||||
Mockito.when(firmwareServiceInterface.getCustomerFirmwareTrackRecord(Mockito.anyInt()))
|
||||
Mockito.when(firmwareServiceInterface.getCustomerFirmwareTrackRecord(ArgumentMatchers.anyInt()))
|
||||
.thenReturn(fwTrackRecord);
|
||||
|
||||
Equipment equipment = new Equipment();
|
||||
@@ -230,12 +229,13 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
equipment.setDetails(ApElementConfiguration.createWithDefaults());
|
||||
|
||||
Mockito.when(equipmentServiceInterface.get(1L)).thenReturn(equipment);
|
||||
Mockito.when(equipmentServiceInterface.getByInventoryIdOrNull(Mockito.eq("Test_Client_21P10C68818122")))
|
||||
Mockito.when(
|
||||
equipmentServiceInterface.getByInventoryIdOrNull(ArgumentMatchers.eq("Test_Client_21P10C68818122")))
|
||||
.thenReturn(equipment);
|
||||
|
||||
Mockito.when(equipmentServiceInterface.create(Mockito.any(Equipment.class)))
|
||||
Mockito.when(equipmentServiceInterface.create(ArgumentMatchers.any(Equipment.class)))
|
||||
.thenAnswer(i -> i.getArguments()[0]);
|
||||
Mockito.when(equipmentServiceInterface.update(Mockito.any(Equipment.class)))
|
||||
Mockito.when(equipmentServiceInterface.update(ArgumentMatchers.any(Equipment.class)))
|
||||
.thenAnswer(i -> i.getArguments()[0]);
|
||||
|
||||
OvsdbSession session = Mockito.mock(OvsdbSession.class);
|
||||
@@ -270,7 +270,7 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
|
||||
customer.setDetails(customerDetails);
|
||||
|
||||
Mockito.when(customerServiceInterface.getOrNull(Mockito.anyInt())).thenReturn(customer);
|
||||
Mockito.when(customerServiceInterface.getOrNull(ArgumentMatchers.anyInt())).thenReturn(customer);
|
||||
|
||||
Profile apProfile = new Profile();
|
||||
apProfile.setDetails(ApNetworkConfiguration.createWithDefaults());
|
||||
@@ -280,9 +280,9 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
|
||||
apProfile.setChildProfileIds(ImmutableSet.of(ssidProfile.getId()));
|
||||
|
||||
Mockito.when(profileServiceInterface.create(Mockito.any(Profile.class))).thenReturn(apProfile)
|
||||
Mockito.when(profileServiceInterface.create(ArgumentMatchers.any(Profile.class))).thenReturn(apProfile)
|
||||
.thenReturn(ssidProfile);
|
||||
Mockito.when(profileServiceInterface.update(Mockito.any(Profile.class))).thenReturn(apProfile);
|
||||
Mockito.when(profileServiceInterface.update(ArgumentMatchers.any(Profile.class))).thenReturn(apProfile);
|
||||
|
||||
Equipment equipment = new Equipment();
|
||||
equipment.setCustomerId(2);
|
||||
@@ -295,17 +295,18 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
|
||||
Mockito.when(equipmentServiceInterface.get(1L)).thenReturn(equipment);
|
||||
|
||||
Mockito.when(equipmentServiceInterface.create(Mockito.any(Equipment.class)))
|
||||
Mockito.when(equipmentServiceInterface.create(ArgumentMatchers.any(Equipment.class)))
|
||||
.thenAnswer(i -> i.getArguments()[0]);
|
||||
Mockito.when(equipmentServiceInterface.update(Mockito.any(Equipment.class)))
|
||||
Mockito.when(equipmentServiceInterface.update(ArgumentMatchers.any(Equipment.class)))
|
||||
.thenAnswer(i -> i.getArguments()[0]);
|
||||
Mockito.when(equipmentServiceInterface.getByInventoryIdOrNull(Mockito.eq("Test_Client_21P10C68818122")))
|
||||
Mockito.when(
|
||||
equipmentServiceInterface.getByInventoryIdOrNull(ArgumentMatchers.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(statusServiceInterface.getOrNull(ArgumentMatchers.anyInt(), ArgumentMatchers.anyLong(),
|
||||
ArgumentMatchers.eq(StatusDataType.FIRMWARE))).thenReturn(fwStatus);
|
||||
|
||||
Mockito.when(firmwareServiceInterface.getDefaultCustomerTrackSetting())
|
||||
.thenReturn(new CustomerFirmwareTrackSettings());
|
||||
@@ -313,7 +314,7 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
fwTrackRecord.setSettings(new CustomerFirmwareTrackSettings());
|
||||
fwTrackRecord.setTrackRecordId(3);
|
||||
fwTrackRecord.setCustomerId(2);
|
||||
Mockito.when(firmwareServiceInterface.getCustomerFirmwareTrackRecord(Mockito.anyInt()))
|
||||
Mockito.when(firmwareServiceInterface.getCustomerFirmwareTrackRecord(ArgumentMatchers.anyInt()))
|
||||
.thenReturn(fwTrackRecord);
|
||||
|
||||
OvsdbSession session = Mockito.mock(OvsdbSession.class);
|
||||
@@ -323,10 +324,10 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
// Mockito.when(locationServiceInterface.get(Mockito.anyLong())).thenReturn(value);
|
||||
opensyncExternalIntegrationCloud.apConnected("Test_Client_21P10C68818122", createConnectNodeInfo());
|
||||
|
||||
Mockito.verify(customerServiceInterface).getOrNull(Mockito.anyInt());
|
||||
Mockito.verify(customerServiceInterface).getOrNull(ArgumentMatchers.anyInt());
|
||||
Mockito.verify(equipmentServiceInterface).getByInventoryIdOrNull("Test_Client_21P10C68818122");
|
||||
Mockito.verify(firmwareServiceInterface).getDefaultCustomerTrackSetting();
|
||||
Mockito.verify(locationServiceInterface).get(Mockito.anyLong());
|
||||
Mockito.verify(locationServiceInterface).get(ArgumentMatchers.anyLong());
|
||||
|
||||
}
|
||||
|
||||
@@ -339,9 +340,11 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
ssidProfile.setDetails(SsidConfiguration.createWithDefaults());
|
||||
|
||||
apProfile.setChildProfileIds(ImmutableSet.of(ssidProfile.getId()));
|
||||
Mockito.when(profileServiceInterface.create(Mockito.any(Profile.class))).thenAnswer(i -> i.getArguments()[0]);
|
||||
Mockito.when(profileServiceInterface.create(ArgumentMatchers.any(Profile.class)))
|
||||
.thenAnswer(i -> i.getArguments()[0]);
|
||||
// .thenReturn(ssidProfile);
|
||||
Mockito.when(profileServiceInterface.update(Mockito.any(Profile.class))).thenAnswer(i -> i.getArguments()[0]);
|
||||
Mockito.when(profileServiceInterface.update(ArgumentMatchers.any(Profile.class)))
|
||||
.thenAnswer(i -> i.getArguments()[0]);
|
||||
|
||||
Location location = new Location();
|
||||
location.setId(8L);
|
||||
@@ -360,8 +363,8 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
equipment.setDetails(ApElementConfiguration.createWithDefaults());
|
||||
Status fwStatus = new Status();
|
||||
fwStatus.setDetails(new EquipmentUpgradeStatusData());
|
||||
Mockito.when(statusServiceInterface.getOrNull(Mockito.anyInt(), Mockito.anyLong(),
|
||||
Mockito.eq(StatusDataType.FIRMWARE))).thenReturn(fwStatus);
|
||||
Mockito.when(statusServiceInterface.getOrNull(ArgumentMatchers.anyInt(), ArgumentMatchers.anyLong(),
|
||||
ArgumentMatchers.eq(StatusDataType.FIRMWARE))).thenReturn(fwStatus);
|
||||
|
||||
Mockito.when(firmwareServiceInterface.getDefaultCustomerTrackSetting())
|
||||
.thenReturn(new CustomerFirmwareTrackSettings());
|
||||
@@ -369,15 +372,16 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
fwTrackRecord.setSettings(new CustomerFirmwareTrackSettings());
|
||||
fwTrackRecord.setTrackRecordId(3);
|
||||
fwTrackRecord.setCustomerId(2);
|
||||
Mockito.when(firmwareServiceInterface.getCustomerFirmwareTrackRecord(Mockito.anyInt()))
|
||||
Mockito.when(firmwareServiceInterface.getCustomerFirmwareTrackRecord(ArgumentMatchers.anyInt()))
|
||||
.thenReturn(fwTrackRecord);
|
||||
Mockito.when(equipmentServiceInterface.get(1L)).thenReturn(equipment);
|
||||
|
||||
Mockito.when(equipmentServiceInterface.create(Mockito.any(Equipment.class)))
|
||||
Mockito.when(equipmentServiceInterface.create(ArgumentMatchers.any(Equipment.class)))
|
||||
.thenAnswer(i -> i.getArguments()[0]);
|
||||
Mockito.when(equipmentServiceInterface.update(Mockito.any(Equipment.class)))
|
||||
Mockito.when(equipmentServiceInterface.update(ArgumentMatchers.any(Equipment.class)))
|
||||
.thenAnswer(i -> i.getArguments()[0]);
|
||||
Mockito.when(equipmentServiceInterface.getByInventoryIdOrNull(Mockito.eq("Test_Client_21P10C68818122")))
|
||||
Mockito.when(
|
||||
equipmentServiceInterface.getByInventoryIdOrNull(ArgumentMatchers.eq("Test_Client_21P10C68818122")))
|
||||
.thenReturn(equipment);
|
||||
|
||||
Customer customer = new Customer();
|
||||
@@ -388,7 +392,7 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
customerDetails.setAutoProvisioning(autoprovSettings);
|
||||
customer.setDetails(customerDetails);
|
||||
|
||||
Mockito.when(customerServiceInterface.getOrNull(Mockito.anyInt())).thenReturn(customer);
|
||||
Mockito.when(customerServiceInterface.getOrNull(ArgumentMatchers.anyInt())).thenReturn(customer);
|
||||
|
||||
opensyncExternalIntegrationCloud.apConnected("Test_Client_21P10C68818122", createConnectNodeInfo());
|
||||
|
||||
@@ -410,12 +414,12 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
customerDetails.setAutoProvisioning(autoprovSettings);
|
||||
customer.setDetails(customerDetails);
|
||||
|
||||
Mockito.when(customerServiceInterface.getOrNull(Mockito.anyInt())).thenReturn(customer);
|
||||
Mockito.when(customerServiceInterface.getOrNull(ArgumentMatchers.anyInt())).thenReturn(customer);
|
||||
|
||||
Equipment equipment = new Equipment();
|
||||
equipment.setDetails(ApElementConfiguration.createWithDefaults());
|
||||
|
||||
Mockito.when(equipmentServiceInterface.getByInventoryIdOrNull(Mockito.any())).thenReturn(equipment);
|
||||
Mockito.when(equipmentServiceInterface.getByInventoryIdOrNull(ArgumentMatchers.any())).thenReturn(equipment);
|
||||
|
||||
Profile apProfile = new Profile();
|
||||
apProfile.setDetails(ApNetworkConfiguration.createWithDefaults());
|
||||
@@ -424,7 +428,8 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
ssidProfile.setDetails(SsidConfiguration.createWithDefaults());
|
||||
|
||||
List<Profile> profileWithChildren = ImmutableList.of(apProfile, ssidProfile);
|
||||
Mockito.when(profileServiceInterface.getProfileWithChildren(Mockito.anyLong())).thenReturn(profileWithChildren);
|
||||
Mockito.when(profileServiceInterface.getProfileWithChildren(ArgumentMatchers.anyLong()))
|
||||
.thenReturn(profileWithChildren);
|
||||
|
||||
assertNotNull(opensyncExternalIntegrationCloud.getApConfig("Test_Client_21P10C68818122"));
|
||||
|
||||
@@ -441,7 +446,7 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
customerDetails.setAutoProvisioning(autoprovSettings);
|
||||
customer.setDetails(customerDetails);
|
||||
|
||||
Mockito.when(customerServiceInterface.getOrNull(Mockito.anyInt())).thenReturn(customer);
|
||||
Mockito.when(customerServiceInterface.getOrNull(ArgumentMatchers.anyInt())).thenReturn(customer);
|
||||
|
||||
assertNull(opensyncExternalIntegrationCloud.getApConfig("Test_Client_21P10C68818122"));
|
||||
|
||||
@@ -452,31 +457,8 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
|
||||
String topic = "/ap/Test_Client_21P10C68818122/opensync";
|
||||
|
||||
assertEquals("Test_Client_21P10C68818122", OpensyncExternalIntegrationCloud.extractApIdFromTopic(topic));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtractCustomerIdFromTopic() {
|
||||
String topic = "/ap/Test_Client_21P10C68818122/opensync";
|
||||
OvsdbSession session = Mockito.mock(OvsdbSession.class);
|
||||
Mockito.when(session.getCustomerId()).thenReturn(2);
|
||||
|
||||
Mockito.when(ovsdbSessionMapInterface.getSession("Test_Client_21P10C68818122")).thenReturn(session);
|
||||
|
||||
assertEquals(2, opensyncExternalIntegrationCloud.extractCustomerIdFromTopic(topic));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtractEquipmentIdFromTopic() {
|
||||
|
||||
String topic = "/ap/Test_Client_21P10C68818122/opensync";
|
||||
OvsdbSession session = Mockito.mock(OvsdbSession.class);
|
||||
Mockito.when(session.getEquipmentId()).thenReturn(1L);
|
||||
|
||||
Mockito.when(ovsdbSessionMapInterface.getSession("Test_Client_21P10C68818122")).thenReturn(session);
|
||||
|
||||
assertEquals(1L, opensyncExternalIntegrationCloud.extractEquipmentIdFromTopic(topic));
|
||||
assertEquals("Test_Client_21P10C68818122",
|
||||
OpensyncExternalIntegrationMqttMessageProcessor.extractApIdFromTopic(topic));
|
||||
|
||||
}
|
||||
|
||||
@@ -484,16 +466,11 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
public void testProcessMqttMessageStringReport() {
|
||||
|
||||
Report report = Report.newBuilder().setNodeID("21P10C68818122")
|
||||
.addAllClients(getOpensyncStatsClientReportsList()).addAllEventReport(getOpensyncStatsEventReportsList()).build();
|
||||
.addAllClients(getOpensyncStatsClientReportsList())
|
||||
.addAllEventReport(getOpensyncStatsEventReportsList()).build();
|
||||
|
||||
String topic = "/ap/Test_Client_21P10C68818122/opensync";
|
||||
|
||||
OvsdbSession session = Mockito.mock(OvsdbSession.class);
|
||||
Mockito.when(session.getEquipmentId()).thenReturn(1L);
|
||||
Mockito.when(session.getCustomerId()).thenReturn(2);
|
||||
|
||||
Mockito.when(ovsdbSessionMapInterface.getSession("Test_Client_21P10C68818122")).thenReturn(session);
|
||||
|
||||
Status bssidStatus = new Status();
|
||||
bssidStatus.setStatusDataType(StatusDataType.ACTIVE_BSSIDS);
|
||||
bssidStatus.setCustomerId(2);
|
||||
@@ -502,20 +479,21 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
activeBssidsDetails.setActiveBSSIDs(getActiveBssidList());
|
||||
bssidStatus.setDetails(activeBssidsDetails);
|
||||
|
||||
Mockito.when(statusServiceInterface.getOrNull(Mockito.anyInt(), Mockito.anyLong(),
|
||||
Mockito.eq(StatusDataType.ACTIVE_BSSIDS))).thenReturn(bssidStatus);
|
||||
Mockito.when(statusServiceInterface.getOrNull(ArgumentMatchers.anyInt(), ArgumentMatchers.anyLong(),
|
||||
ArgumentMatchers.eq(StatusDataType.ACTIVE_BSSIDS))).thenReturn(bssidStatus);
|
||||
|
||||
Mockito.when(statusServiceInterface.update(Mockito.any(Status.class))).thenReturn(bssidStatus);
|
||||
Mockito.when(statusServiceInterface.update(ArgumentMatchers.any(Status.class))).thenReturn(bssidStatus);
|
||||
com.telecominfraproject.wlan.client.models.Client clientInstance = new com.telecominfraproject.wlan.client.models.Client();
|
||||
clientInstance.setMacAddress(new MacAddress("7C:AB:60:E6:EA:4D"));
|
||||
clientInstance.setDetails(new ClientInfoDetails());
|
||||
com.telecominfraproject.wlan.client.models.Client clientInstance2 = new com.telecominfraproject.wlan.client.models.Client();
|
||||
clientInstance2.setMacAddress(new MacAddress("C0:9A:D0:76:A9:69"));
|
||||
clientInstance2.setDetails(new ClientInfoDetails());
|
||||
Mockito.when(clientServiceInterface.getOrNull(Mockito.anyInt(), Mockito.any(MacAddress.class)))
|
||||
.thenReturn(clientInstance).thenReturn(clientInstance2);
|
||||
Mockito.when(
|
||||
clientServiceInterface.update(Mockito.any(com.telecominfraproject.wlan.client.models.Client.class)))
|
||||
clientServiceInterface.getOrNull(ArgumentMatchers.anyInt(), ArgumentMatchers.any(MacAddress.class)))
|
||||
.thenReturn(clientInstance).thenReturn(clientInstance2);
|
||||
Mockito.when(clientServiceInterface
|
||||
.update(ArgumentMatchers.any(com.telecominfraproject.wlan.client.models.Client.class)))
|
||||
.thenReturn(clientInstance).thenReturn(clientInstance2);
|
||||
|
||||
ClientSession clientSession = new ClientSession();
|
||||
@@ -524,20 +502,15 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
ClientSession clientSession2 = new ClientSession();
|
||||
clientSession2.setMacAddress(new MacAddress("C0:9A:D0:76:A9:69"));
|
||||
clientSession2.setDetails(new ClientSessionDetails());
|
||||
Mockito.when(clientServiceInterface.getSessionOrNull(Mockito.anyInt(), Mockito.anyLong(),
|
||||
Mockito.any(MacAddress.class))).thenReturn(clientSession).thenReturn(clientSession2);
|
||||
Mockito.when(clientServiceInterface.getSessionOrNull(ArgumentMatchers.anyInt(), ArgumentMatchers.anyLong(),
|
||||
ArgumentMatchers.any(MacAddress.class))).thenReturn(clientSession).thenReturn(clientSession2);
|
||||
|
||||
Mockito.when(clientServiceInterface.updateSession(Mockito.any(ClientSession.class))).thenReturn(clientSession)
|
||||
.thenReturn(clientSession2);
|
||||
Mockito.when(clientServiceInterface.updateSession(ArgumentMatchers.any(ClientSession.class)))
|
||||
.thenReturn(clientSession).thenReturn(clientSession2);
|
||||
|
||||
opensyncExternalIntegrationCloud.processMqttMessage(topic, report);
|
||||
|
||||
Mockito.verify(clientServiceInterface, Mockito.times(4)).getOrNull(Mockito.anyInt(),
|
||||
Mockito.any(MacAddress.class));
|
||||
Mockito.verify(clientServiceInterface, Mockito.times(4)).getSessionOrNull(Mockito.anyInt(), Mockito.anyLong(),
|
||||
Mockito.any(MacAddress.class));
|
||||
Mockito.verify(statusServiceInterface, Mockito.times(3)).getOrNull(Mockito.anyInt(), Mockito.anyLong(),
|
||||
Mockito.eq(StatusDataType.ACTIVE_BSSIDS));
|
||||
Mockito.verify(opensyncExternalIntegrationMqttProcessor, Mockito.times(1)).processMqttMessage(topic, report);
|
||||
|
||||
}
|
||||
|
||||
@@ -756,8 +729,8 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
activeBssidsDetails.setActiveBSSIDs(getActiveBssidList());
|
||||
bssidStatus.setDetails(activeBssidsDetails);
|
||||
|
||||
Mockito.when(statusServiceInterface.getOrNull(Mockito.anyInt(), Mockito.anyLong(),
|
||||
Mockito.eq(StatusDataType.ACTIVE_BSSIDS))).thenReturn(bssidStatus);
|
||||
Mockito.when(statusServiceInterface.getOrNull(ArgumentMatchers.anyInt(), ArgumentMatchers.anyLong(),
|
||||
ArgumentMatchers.eq(StatusDataType.ACTIVE_BSSIDS))).thenReturn(bssidStatus);
|
||||
|
||||
opensyncExternalIntegrationCloud.wifiVIFStateDbTableDelete(ImmutableList.of(new OpensyncAPVIFState()), "apId");
|
||||
}
|
||||
@@ -768,39 +741,6 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
opensyncExternalIntegrationCloud.wifiAssociatedClientsDbTableDelete("7C:AB:60:E6:EA:4D", "apId");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testpopulateNetworkProbeMetrics() throws Exception {
|
||||
|
||||
InetAddress ip = InetAddress.getByName("192.168.1.1");
|
||||
|
||||
DNSProbeMetric dnsProbeMetric = DNSProbeMetric.getDefaultInstance().toBuilder().setLatency(10)
|
||||
.setState(StateUpDown.SUD_up).setServerIP(ip.toString()).build();
|
||||
RADIUSMetrics radiusProbeMetric = RADIUSMetrics.getDefaultInstance().toBuilder().setLatencyAve(10).build();
|
||||
VLANMetrics vlanMetrics = VLANMetrics.getDefaultInstance().toBuilder().setDhcpLatency(10)
|
||||
.setDhcpState(StateUpDown.SUD_up).setVlanIF("vlan-1").setObsV200RadiusLatency(15)
|
||||
.setObsV200RadiusState(StateUpDown.SUD_up).build();
|
||||
NetworkProbe networkProbe = NetworkProbe.getDefaultInstance().toBuilder().setVlanProbe(vlanMetrics)
|
||||
.setDnsProbe(dnsProbeMetric).addRadiusProbe(radiusProbeMetric).build();
|
||||
|
||||
Report report = Report.getDefaultInstance().toBuilder().setNodeID("21P10C68818122")
|
||||
.addNetworkProbe(networkProbe).build();
|
||||
|
||||
ApNodeMetrics apNodeMetrics = new ApNodeMetrics();
|
||||
|
||||
opensyncExternalIntegrationCloud.populateNetworkProbeMetrics(report, apNodeMetrics);
|
||||
|
||||
assertNotNull(apNodeMetrics.getNetworkProbeMetrics());
|
||||
|
||||
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getDhcpLatencyMs() == 10);
|
||||
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getDnsLatencyMs() == 10);
|
||||
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getRadiusState().equals(StateUpDownError.enabled));
|
||||
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getDhcpState().equals(StateUpDownError.enabled));
|
||||
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getDnsState().equals(StateUpDownError.enabled));
|
||||
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getRadiusLatencyInMs() == 15);
|
||||
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getVlanIF().equals("vlan-1"));
|
||||
|
||||
}
|
||||
|
||||
// Helper methods
|
||||
private List<ActiveBSSID> getActiveBssidList() {
|
||||
ActiveBSSID activeBssid = new ActiveBSSID();
|
||||
@@ -819,7 +759,7 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
activeBssid3.setNumDevicesConnected(1);
|
||||
activeBssid3.setRadioType(RadioType.is5GHzU);
|
||||
|
||||
List<ActiveBSSID> bssidList = new ArrayList<ActiveBSSID>();
|
||||
List<ActiveBSSID> bssidList = new ArrayList<>();
|
||||
bssidList.add(activeBssid);
|
||||
bssidList.add(activeBssid2);
|
||||
bssidList.add(activeBssid3);
|
||||
@@ -829,7 +769,8 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
|
||||
private List<EventReport> getOpensyncStatsEventReportsList() {
|
||||
|
||||
sts.OpensyncStats.EventReport.ClientAssocEvent.Builder clientAssocBuilder = EventReport.ClientAssocEvent.getDefaultInstance().toBuilder();
|
||||
sts.OpensyncStats.EventReport.ClientAssocEvent.Builder clientAssocBuilder = EventReport.ClientAssocEvent
|
||||
.getDefaultInstance().toBuilder();
|
||||
clientAssocBuilder.setAssocType(AssocType.ASSOC);
|
||||
clientAssocBuilder.setBand(RadioBandType.BAND5GU);
|
||||
clientAssocBuilder.setRssi(-65);
|
||||
@@ -840,7 +781,8 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
clientAssocBuilder.setSsid("ssid-3");
|
||||
clientAssocBuilder.setStatus(1);
|
||||
|
||||
sts.OpensyncStats.EventReport.ClientAssocEvent.Builder clientAssocBuilder2 = EventReport.ClientAssocEvent.getDefaultInstance().toBuilder();
|
||||
sts.OpensyncStats.EventReport.ClientAssocEvent.Builder clientAssocBuilder2 = EventReport.ClientAssocEvent
|
||||
.getDefaultInstance().toBuilder();
|
||||
clientAssocBuilder2.setAssocType(AssocType.ASSOC);
|
||||
clientAssocBuilder2.setBand(RadioBandType.BAND2G);
|
||||
clientAssocBuilder2.setRssi(-65);
|
||||
@@ -867,13 +809,14 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
|
||||
return eventReportList;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private List<ClientReport> getOpensyncStatsClientReportsList() {
|
||||
int rssi = Long.valueOf(4294967239L).intValue();
|
||||
|
||||
Client.Stats clientStats = Client.Stats.getDefaultInstance().toBuilder().setRssi(rssi).setRxBytes(225554786)
|
||||
.setRxRate(24000.0).setTxBytes(1208133026).setTxRate(433300.0).setRssi(758722570).setRxFrames(10000).setTxFrames(10000).setTxRate(24000.0).build();
|
||||
.setRxRate(24000.0).setTxBytes(1208133026).setTxRate(433300.0).setRssi(758722570).setRxFrames(10000)
|
||||
.setTxFrames(10000).setTxRate(24000.0).build();
|
||||
Client client2g = Client.getDefaultInstance().toBuilder().setMacAddress("7C:AB:60:E6:EA:4D").setSsid("ssid-1")
|
||||
.setConnected(true).setDurationMs(59977).setStats(clientStats).build();
|
||||
Client client5gu = Client.getDefaultInstance().toBuilder().setMacAddress("C0:9A:D0:76:A9:69").setSsid("ssid-3")
|
||||
@@ -886,7 +829,7 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
ClientReport clientReport5gu = ClientReport.getDefaultInstance().toBuilder().setBand(RadioBandType.BAND5GU)
|
||||
.setChannel(157).addAllClientList(ImmutableList.of(client5gu)).build();
|
||||
|
||||
List<ClientReport> clients = new ArrayList<ClientReport>();
|
||||
List<ClientReport> clients = new ArrayList<>();
|
||||
clients.add(clientReport2g);
|
||||
clients.add(clientReport5gl);
|
||||
clients.add(clientReport5gu);
|
||||
|
||||
@@ -0,0 +1,370 @@
|
||||
package com.telecominfraproject.wlan.opensync.external.integration;
|
||||
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.After;
|
||||
import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Answers;
|
||||
import org.mockito.ArgumentMatchers;
|
||||
import org.mockito.Mockito;
|
||||
import org.mockito.MockitoSession;
|
||||
import org.mockito.quality.Strictness;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.boot.test.mock.mockito.MockBean;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
import com.google.protobuf.ByteString;
|
||||
import com.telecominfraproject.wlan.alarm.AlarmServiceInterface;
|
||||
import com.telecominfraproject.wlan.client.ClientServiceInterface;
|
||||
import com.telecominfraproject.wlan.client.info.models.ClientInfoDetails;
|
||||
import com.telecominfraproject.wlan.client.session.models.ClientSession;
|
||||
import com.telecominfraproject.wlan.client.session.models.ClientSessionDetails;
|
||||
import com.telecominfraproject.wlan.cloudeventdispatcher.CloudEventDispatcherInterface;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
|
||||
import com.telecominfraproject.wlan.customer.service.CustomerServiceInterface;
|
||||
import com.telecominfraproject.wlan.equipment.EquipmentServiceInterface;
|
||||
import com.telecominfraproject.wlan.firmware.FirmwareServiceInterface;
|
||||
import com.telecominfraproject.wlan.location.service.LocationServiceInterface;
|
||||
import com.telecominfraproject.wlan.opensync.external.integration.controller.OpensyncCloudGatewayController;
|
||||
import com.telecominfraproject.wlan.profile.ProfileServiceInterface;
|
||||
import com.telecominfraproject.wlan.routing.RoutingServiceInterface;
|
||||
import com.telecominfraproject.wlan.servicemetric.apnode.models.ApNodeMetrics;
|
||||
import com.telecominfraproject.wlan.servicemetric.apnode.models.StateUpDownError;
|
||||
import com.telecominfraproject.wlan.status.StatusServiceInterface;
|
||||
import com.telecominfraproject.wlan.status.equipment.report.models.ActiveBSSID;
|
||||
import com.telecominfraproject.wlan.status.equipment.report.models.ActiveBSSIDs;
|
||||
import com.telecominfraproject.wlan.status.models.Status;
|
||||
import com.telecominfraproject.wlan.status.models.StatusDataType;
|
||||
|
||||
import sts.OpensyncStats.AssocType;
|
||||
import sts.OpensyncStats.Client;
|
||||
import sts.OpensyncStats.ClientReport;
|
||||
import sts.OpensyncStats.DNSProbeMetric;
|
||||
import sts.OpensyncStats.EventReport;
|
||||
import sts.OpensyncStats.EventType;
|
||||
import sts.OpensyncStats.NetworkProbe;
|
||||
import sts.OpensyncStats.RADIUSMetrics;
|
||||
import sts.OpensyncStats.RadioBandType;
|
||||
import sts.OpensyncStats.Report;
|
||||
import sts.OpensyncStats.StateUpDown;
|
||||
import sts.OpensyncStats.VLANMetrics;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@ActiveProfiles(profiles = { "integration_test", })
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.NONE, classes = OpensyncExternalIntegrationMqttMessageProcessorTest.class)
|
||||
@Import(value = { AlarmServiceInterface.class, OpensyncExternalIntegrationCloud.class,
|
||||
OpensyncExternalIntegrationMqttMessageProcessorTest.Config.class,
|
||||
|
||||
})
|
||||
public class OpensyncExternalIntegrationMqttMessageProcessorTest {
|
||||
|
||||
@MockBean
|
||||
AlarmServiceInterface alarmServiceInterface;
|
||||
@MockBean
|
||||
CustomerServiceInterface customerServiceInterface;
|
||||
@MockBean
|
||||
LocationServiceInterface locationServiceInterface;
|
||||
@MockBean(answer = Answers.RETURNS_MOCKS)
|
||||
OvsdbSessionMapInterface ovsdbSessionMapInterface;
|
||||
@MockBean
|
||||
CloudEventDispatcherInterface equipmentMetricsCollectorInterface;
|
||||
@MockBean
|
||||
EquipmentServiceInterface equipmentServiceInterface;
|
||||
@MockBean
|
||||
RoutingServiceInterface routingServiceInterface;
|
||||
@MockBean
|
||||
ProfileServiceInterface profileServiceInterface;
|
||||
@MockBean
|
||||
StatusServiceInterface statusServiceInterface;
|
||||
@MockBean
|
||||
ClientServiceInterface clientServiceInterface;
|
||||
@MockBean
|
||||
FirmwareServiceInterface firmwareServiceInterface;
|
||||
@MockBean(answer = Answers.RETURNS_MOCKS)
|
||||
OpensyncCloudGatewayController gatewayController;
|
||||
|
||||
@Autowired
|
||||
OpensyncExternalIntegrationMqttMessageProcessor opensyncExternalIntegrationMqttProcessor;
|
||||
|
||||
MockitoSession mockito;
|
||||
|
||||
@Configuration
|
||||
static class Config {
|
||||
|
||||
@Bean
|
||||
public OpensyncExternalIntegrationMqttMessageProcessor opensyncExternalIntegrationMqttMessageProcessor() {
|
||||
return new OpensyncExternalIntegrationMqttMessageProcessor();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
||||
mockito = Mockito.mockitoSession().initMocks(this).strictness(Strictness.STRICT_STUBS).startMocking();
|
||||
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() throws Exception {
|
||||
mockito.finishMocking();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testExtractApIdFromTopic() {
|
||||
|
||||
String topic = "/ap/Test_Client_21P10C68818122/opensync";
|
||||
|
||||
assertEquals("Test_Client_21P10C68818122",
|
||||
OpensyncExternalIntegrationMqttMessageProcessor.extractApIdFromTopic(topic));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtractCustomerIdFromTopic() {
|
||||
String topic = "/ap/Test_Client_21P10C68818122/opensync";
|
||||
OvsdbSession session = Mockito.mock(OvsdbSession.class);
|
||||
Mockito.when(session.getCustomerId()).thenReturn(2);
|
||||
|
||||
Mockito.when(ovsdbSessionMapInterface.getSession("Test_Client_21P10C68818122")).thenReturn(session);
|
||||
|
||||
assertEquals(2, opensyncExternalIntegrationMqttProcessor.extractCustomerIdFromTopic(topic));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testExtractEquipmentIdFromTopic() {
|
||||
|
||||
String topic = "/ap/Test_Client_21P10C68818122/opensync";
|
||||
OvsdbSession session = Mockito.mock(OvsdbSession.class);
|
||||
Mockito.when(session.getEquipmentId()).thenReturn(1L);
|
||||
|
||||
Mockito.when(ovsdbSessionMapInterface.getSession("Test_Client_21P10C68818122")).thenReturn(session);
|
||||
|
||||
assertEquals(1L, opensyncExternalIntegrationMqttProcessor.extractEquipmentIdFromTopic(topic));
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testProcessMqttMessageStringReport() {
|
||||
|
||||
Report report = Report.newBuilder().setNodeID("21P10C68818122")
|
||||
.addAllClients(getOpensyncStatsClientReportsList())
|
||||
.addAllEventReport(getOpensyncStatsEventReportsList()).build();
|
||||
|
||||
String topic = "/ap/Test_Client_21P10C68818122/opensync";
|
||||
|
||||
OvsdbSession session = Mockito.mock(OvsdbSession.class);
|
||||
Mockito.when(session.getEquipmentId()).thenReturn(1L);
|
||||
Mockito.when(session.getCustomerId()).thenReturn(2);
|
||||
|
||||
Mockito.when(ovsdbSessionMapInterface.getSession("Test_Client_21P10C68818122")).thenReturn(session);
|
||||
|
||||
Status bssidStatus = new Status();
|
||||
bssidStatus.setStatusDataType(StatusDataType.ACTIVE_BSSIDS);
|
||||
bssidStatus.setCustomerId(2);
|
||||
|
||||
ActiveBSSIDs activeBssidsDetails = new ActiveBSSIDs();
|
||||
activeBssidsDetails.setActiveBSSIDs(getActiveBssidList());
|
||||
bssidStatus.setDetails(activeBssidsDetails);
|
||||
|
||||
Mockito.when(statusServiceInterface.getOrNull(ArgumentMatchers.anyInt(), ArgumentMatchers.anyLong(),
|
||||
ArgumentMatchers.eq(StatusDataType.ACTIVE_BSSIDS))).thenReturn(bssidStatus);
|
||||
|
||||
Mockito.when(statusServiceInterface.update(ArgumentMatchers.any(Status.class))).thenReturn(bssidStatus);
|
||||
com.telecominfraproject.wlan.client.models.Client clientInstance = new com.telecominfraproject.wlan.client.models.Client();
|
||||
clientInstance.setMacAddress(new MacAddress("7C:AB:60:E6:EA:4D"));
|
||||
clientInstance.setDetails(new ClientInfoDetails());
|
||||
com.telecominfraproject.wlan.client.models.Client clientInstance2 = new com.telecominfraproject.wlan.client.models.Client();
|
||||
clientInstance2.setMacAddress(new MacAddress("C0:9A:D0:76:A9:69"));
|
||||
clientInstance2.setDetails(new ClientInfoDetails());
|
||||
Mockito.when(
|
||||
clientServiceInterface.getOrNull(ArgumentMatchers.anyInt(), ArgumentMatchers.any(MacAddress.class)))
|
||||
.thenReturn(clientInstance).thenReturn(clientInstance2);
|
||||
Mockito.when(clientServiceInterface
|
||||
.update(ArgumentMatchers.any(com.telecominfraproject.wlan.client.models.Client.class)))
|
||||
.thenReturn(clientInstance).thenReturn(clientInstance2);
|
||||
|
||||
ClientSession clientSession = new ClientSession();
|
||||
clientSession.setMacAddress(new MacAddress("7C:AB:60:E6:EA:4D"));
|
||||
clientSession.setDetails(new ClientSessionDetails());
|
||||
ClientSession clientSession2 = new ClientSession();
|
||||
clientSession2.setMacAddress(new MacAddress("C0:9A:D0:76:A9:69"));
|
||||
clientSession2.setDetails(new ClientSessionDetails());
|
||||
Mockito.when(clientServiceInterface.getSessionOrNull(ArgumentMatchers.anyInt(), ArgumentMatchers.anyLong(),
|
||||
ArgumentMatchers.any(MacAddress.class))).thenReturn(clientSession).thenReturn(clientSession2);
|
||||
|
||||
Mockito.when(clientServiceInterface.updateSession(ArgumentMatchers.any(ClientSession.class)))
|
||||
.thenReturn(clientSession).thenReturn(clientSession2);
|
||||
|
||||
opensyncExternalIntegrationMqttProcessor.processMqttMessage(topic, report);
|
||||
|
||||
// Mockito.verify(clientServiceInterface,
|
||||
// Mockito.times(4)).getOrNull(Mockito.anyInt(),
|
||||
// Mockito.any(MacAddress.class));
|
||||
// Mockito.verify(clientServiceInterface,
|
||||
// Mockito.times(4)).getSessionOrNull(Mockito.anyInt(),
|
||||
// Mockito.anyLong(),
|
||||
// Mockito.any(MacAddress.class));
|
||||
// Mockito.verify(statusServiceInterface,
|
||||
// Mockito.times(3)).getOrNull(Mockito.anyInt(), Mockito.anyLong(),
|
||||
// Mockito.eq(StatusDataType.ACTIVE_BSSIDS));
|
||||
|
||||
}
|
||||
|
||||
@Ignore
|
||||
public void testProcessMqttMessageStringFlowReport() {
|
||||
// TODO: implement me when support flow reports
|
||||
}
|
||||
|
||||
@Ignore
|
||||
public void testProcessMqttMessageStringWCStatsReport() {
|
||||
// TODO: implement me when wcs stats reports supported
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testpopulateNetworkProbeMetrics() throws Exception {
|
||||
|
||||
InetAddress ip = InetAddress.getLocalHost();
|
||||
|
||||
DNSProbeMetric dnsProbeMetric = DNSProbeMetric.getDefaultInstance().toBuilder().setLatency(10)
|
||||
.setState(StateUpDown.SUD_up).setServerIP(ip.getHostName()).build();
|
||||
RADIUSMetrics radiusProbeMetric = RADIUSMetrics.getDefaultInstance().toBuilder().setLatencyAve(10).build();
|
||||
VLANMetrics vlanMetrics = VLANMetrics.getDefaultInstance().toBuilder().setDhcpLatency(10)
|
||||
.setDhcpState(StateUpDown.SUD_up).setVlanIF("vlan-1").setObsV200RadiusLatency(15)
|
||||
.setObsV200RadiusState(StateUpDown.SUD_up).build();
|
||||
NetworkProbe networkProbe = NetworkProbe.getDefaultInstance().toBuilder().setVlanProbe(vlanMetrics)
|
||||
.setDnsProbe(dnsProbeMetric).addRadiusProbe(radiusProbeMetric).build();
|
||||
|
||||
Report report = Report.getDefaultInstance().toBuilder().setNodeID("21P10C68818122")
|
||||
.addNetworkProbe(networkProbe).build();
|
||||
|
||||
ApNodeMetrics apNodeMetrics = new ApNodeMetrics();
|
||||
|
||||
opensyncExternalIntegrationMqttProcessor.populateNetworkProbeMetrics(report, apNodeMetrics);
|
||||
|
||||
assertNotNull(apNodeMetrics.getNetworkProbeMetrics());
|
||||
|
||||
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getDhcpLatencyMs() == 10);
|
||||
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getDnsLatencyMs() == 10);
|
||||
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getRadiusState().equals(StateUpDownError.enabled));
|
||||
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getDhcpState().equals(StateUpDownError.enabled));
|
||||
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getDnsState().equals(StateUpDownError.enabled));
|
||||
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getRadiusLatencyInMs() == 15);
|
||||
assert (apNodeMetrics.getNetworkProbeMetrics().get(0).getVlanIF().equals("vlan-1"));
|
||||
|
||||
}
|
||||
|
||||
// Helper methods
|
||||
private List<ActiveBSSID> getActiveBssidList() {
|
||||
ActiveBSSID activeBssid = new ActiveBSSID();
|
||||
activeBssid.setBssid("24:f5:a2:ef:2e:54");
|
||||
activeBssid.setSsid("ssid-1");
|
||||
activeBssid.setNumDevicesConnected(1);
|
||||
activeBssid.setRadioType(RadioType.is2dot4GHz);
|
||||
ActiveBSSID activeBssid2 = new ActiveBSSID();
|
||||
activeBssid2.setBssid("24:f5:a2:ef:2e:55");
|
||||
activeBssid2.setSsid("ssid-2");
|
||||
activeBssid2.setNumDevicesConnected(1);
|
||||
activeBssid2.setRadioType(RadioType.is5GHzL);
|
||||
ActiveBSSID activeBssid3 = new ActiveBSSID();
|
||||
activeBssid3.setBssid("24:f5:a2:ef:2e:56");
|
||||
activeBssid3.setSsid("ssid-3");
|
||||
activeBssid3.setNumDevicesConnected(1);
|
||||
activeBssid3.setRadioType(RadioType.is5GHzU);
|
||||
|
||||
List<ActiveBSSID> bssidList = new ArrayList<>();
|
||||
bssidList.add(activeBssid);
|
||||
bssidList.add(activeBssid2);
|
||||
bssidList.add(activeBssid3);
|
||||
return bssidList;
|
||||
}
|
||||
|
||||
|
||||
private List<EventReport> getOpensyncStatsEventReportsList() {
|
||||
|
||||
sts.OpensyncStats.EventReport.ClientAssocEvent.Builder clientAssocBuilder = EventReport.ClientAssocEvent
|
||||
.getDefaultInstance().toBuilder();
|
||||
clientAssocBuilder.setAssocType(AssocType.ASSOC);
|
||||
clientAssocBuilder.setBand(RadioBandType.BAND5GU);
|
||||
clientAssocBuilder.setRssi(-65);
|
||||
clientAssocBuilder.setStaMac("C0:9A:D0:76:A9:69");
|
||||
clientAssocBuilder.setStaMacBytes(ByteString.copyFrom("C0:9A:D0:76:A9:69".getBytes()));
|
||||
clientAssocBuilder.setSessionId(1000L);
|
||||
clientAssocBuilder.setInternalSc(1);
|
||||
clientAssocBuilder.setSsid("ssid-3");
|
||||
clientAssocBuilder.setStatus(1);
|
||||
|
||||
sts.OpensyncStats.EventReport.ClientAssocEvent.Builder clientAssocBuilder2 = EventReport.ClientAssocEvent
|
||||
.getDefaultInstance().toBuilder();
|
||||
clientAssocBuilder2.setAssocType(AssocType.ASSOC);
|
||||
clientAssocBuilder2.setBand(RadioBandType.BAND2G);
|
||||
clientAssocBuilder2.setRssi(-65);
|
||||
clientAssocBuilder2.setStaMac("7C:AB:60:E6:EA:4D");
|
||||
clientAssocBuilder2.setStaMacBytes(ByteString.copyFrom("7C:AB:60:E6:EA:4D".getBytes()));
|
||||
clientAssocBuilder2.setSessionId(1000L);
|
||||
clientAssocBuilder2.setInternalSc(1);
|
||||
clientAssocBuilder2.setSsid("ssid-1");
|
||||
clientAssocBuilder2.setStatus(1);
|
||||
|
||||
List<EventReport> eventReportList = new ArrayList<>();
|
||||
|
||||
EventReport.Builder eventReportBuilder = EventReport.getDefaultInstance().toBuilder();
|
||||
eventReportBuilder.setClientAssocEvent(clientAssocBuilder.build());
|
||||
eventReportBuilder.setEventType(EventType.CLIENT_ASSOC);
|
||||
|
||||
eventReportList.add(eventReportBuilder.build());
|
||||
|
||||
eventReportBuilder = EventReport.getDefaultInstance().toBuilder();
|
||||
eventReportBuilder.setClientAssocEvent(clientAssocBuilder2.build());
|
||||
eventReportBuilder.setEventType(EventType.CLIENT_ASSOC);
|
||||
|
||||
eventReportList.add(eventReportBuilder.build());
|
||||
|
||||
return eventReportList;
|
||||
|
||||
}
|
||||
|
||||
private List<ClientReport> getOpensyncStatsClientReportsList() {
|
||||
int rssi = Long.valueOf(4294967239L).intValue();
|
||||
|
||||
Client.Stats clientStats = Client.Stats.getDefaultInstance().toBuilder().setRssi(rssi).setRxBytes(225554786)
|
||||
.setRxRate(24000.0).setTxBytes(1208133026).setTxRate(433300.0).setRssi(758722570).setRxFrames(10000)
|
||||
.setTxFrames(10000).setTxRate(24000.0).build();
|
||||
Client client2g = Client.getDefaultInstance().toBuilder().setMacAddress("7C:AB:60:E6:EA:4D").setSsid("ssid-1")
|
||||
.setConnected(true).setDurationMs(59977).setStats(clientStats).build();
|
||||
Client client5gu = Client.getDefaultInstance().toBuilder().setMacAddress("C0:9A:D0:76:A9:69").setSsid("ssid-3")
|
||||
.setConnected(true).setDurationMs(298127).setStats(clientStats).build();
|
||||
|
||||
ClientReport clientReport2g = ClientReport.getDefaultInstance().toBuilder().setBand(RadioBandType.BAND2G)
|
||||
.setChannel(6).addAllClientList(ImmutableList.of(client2g)).build();
|
||||
ClientReport clientReport5gl = ClientReport.getDefaultInstance().toBuilder().setBand(RadioBandType.BAND5GL)
|
||||
.setChannel(36).addAllClientList(new ArrayList<Client>()).build();
|
||||
ClientReport clientReport5gu = ClientReport.getDefaultInstance().toBuilder().setBand(RadioBandType.BAND5GU)
|
||||
.setChannel(157).addAllClientList(ImmutableList.of(client5gu)).build();
|
||||
|
||||
List<ClientReport> clients = new ArrayList<>();
|
||||
clients.add(clientReport2g);
|
||||
clients.add(clientReport5gl);
|
||||
clients.add(clientReport5gu);
|
||||
return clients;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -25,207 +25,223 @@ import com.telecominfraproject.wlan.routing.models.EquipmentRoutingRecord;
|
||||
|
||||
public class OpensyncAPConfig extends BaseJsonModel {
|
||||
|
||||
private static final long serialVersionUID = 3917975477206236668L;
|
||||
private static final long serialVersionUID = 3917975477206236668L;
|
||||
|
||||
private Equipment customerEquipment;
|
||||
private Profile apProfile;
|
||||
private List<Profile> ssidProfile;
|
||||
private List<Profile> radiusProfiles;
|
||||
private Location equipmentLocation;
|
||||
private EquipmentRoutingRecord equipmentRouting;
|
||||
private EquipmentGatewayRecord equipmentGateway;
|
||||
private List<Profile> captiveProfiles;
|
||||
private List<MacAddress> blockedClients;
|
||||
private Equipment customerEquipment;
|
||||
private Profile apProfile;
|
||||
private List<Profile> ssidProfile;
|
||||
private List<Profile> radiusProfiles;
|
||||
private Location equipmentLocation;
|
||||
private EquipmentRoutingRecord equipmentRouting;
|
||||
private EquipmentGatewayRecord equipmentGateway;
|
||||
private List<Profile> captiveProfiles;
|
||||
private List<Profile> bonjourGatewayProfiles;
|
||||
private List<MacAddress> blockedClients;
|
||||
|
||||
// Handle Legacy Config Support
|
||||
public void setRadioConfig(OpensyncAPRadioConfig radioConfig) {
|
||||
// Handle Legacy Config Support
|
||||
public void setRadioConfig(OpensyncAPRadioConfig radioConfig) {
|
||||
|
||||
if (customerEquipment == null) {
|
||||
customerEquipment = new Equipment();
|
||||
customerEquipment.setId(0);
|
||||
customerEquipment.setEquipmentType(EquipmentType.AP);
|
||||
customerEquipment.setDetails(ApElementConfiguration.createWithDefaults());
|
||||
ApElementConfiguration apConfig = (ApElementConfiguration) customerEquipment.getDetails();
|
||||
apConfig.getRadioMap().get(RadioType.is2dot4GHz).setChannelNumber(radioConfig.getRadioChannel24G());
|
||||
apConfig.getRadioMap().get(RadioType.is5GHzL).setChannelNumber(radioConfig.getRadioChannel5LG());
|
||||
apConfig.getRadioMap().get(RadioType.is5GHzU).setChannelNumber(radioConfig.getRadioChannel5HG());
|
||||
customerEquipment.setDetails(apConfig);
|
||||
}
|
||||
if (customerEquipment == null) {
|
||||
customerEquipment = new Equipment();
|
||||
customerEquipment.setId(0);
|
||||
customerEquipment.setEquipmentType(EquipmentType.AP);
|
||||
customerEquipment.setDetails(ApElementConfiguration.createWithDefaults());
|
||||
ApElementConfiguration apConfig = (ApElementConfiguration) customerEquipment.getDetails();
|
||||
apConfig.getRadioMap().get(RadioType.is2dot4GHz).setChannelNumber(radioConfig.getRadioChannel24G());
|
||||
apConfig.getRadioMap().get(RadioType.is5GHzL).setChannelNumber(radioConfig.getRadioChannel5LG());
|
||||
apConfig.getRadioMap().get(RadioType.is5GHzU).setChannelNumber(radioConfig.getRadioChannel5HG());
|
||||
customerEquipment.setDetails(apConfig);
|
||||
}
|
||||
|
||||
if (equipmentLocation == null) {
|
||||
equipmentLocation = new Location();
|
||||
equipmentLocation.setId(1);
|
||||
equipmentLocation.setDetails(LocationDetails.createWithDefaults());
|
||||
((LocationDetails) equipmentLocation.getDetails())
|
||||
.setCountryCode(CountryCode.getByName(radioConfig.getCountry().toLowerCase()));
|
||||
customerEquipment.setLocationId(equipmentLocation.getId());
|
||||
}
|
||||
if (equipmentLocation == null) {
|
||||
equipmentLocation = new Location();
|
||||
equipmentLocation.setId(1);
|
||||
equipmentLocation.setDetails(LocationDetails.createWithDefaults());
|
||||
((LocationDetails) equipmentLocation.getDetails())
|
||||
.setCountryCode(CountryCode.getByName(radioConfig.getCountry().toLowerCase()));
|
||||
customerEquipment.setLocationId(equipmentLocation.getId());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// Handle Legacy Config Support
|
||||
public void setSsidConfigs(List<OpensyncAPSsidConfig> ssidConfigs) {
|
||||
// Handle Legacy Config Support
|
||||
public void setSsidConfigs(List<OpensyncAPSsidConfig> ssidConfigs) {
|
||||
|
||||
if (apProfile == null) {
|
||||
apProfile = new Profile();
|
||||
apProfile.setName("GeneratedApProfile");
|
||||
apProfile.setId(2);
|
||||
apProfile.setDetails(ApNetworkConfiguration.createWithDefaults());
|
||||
}
|
||||
if (apProfile == null) {
|
||||
apProfile = new Profile();
|
||||
apProfile.setName("GeneratedApProfile");
|
||||
apProfile.setId(2);
|
||||
apProfile.setDetails(ApNetworkConfiguration.createWithDefaults());
|
||||
}
|
||||
|
||||
long ssidProfileId = 3;
|
||||
for (OpensyncAPSsidConfig ssidConfig : ssidConfigs) {
|
||||
long ssidProfileId = 3;
|
||||
for (OpensyncAPSsidConfig ssidConfig : ssidConfigs) {
|
||||
|
||||
Profile profile = new Profile();
|
||||
profile.setProfileType(ProfileType.ssid);
|
||||
profile.setName(ssidConfig.getSsid());
|
||||
SsidConfiguration cfg = SsidConfiguration.createWithDefaults();
|
||||
Set<RadioType> appliedRadios = new HashSet<RadioType>();
|
||||
appliedRadios.add(ssidConfig.getRadioType());
|
||||
cfg.setAppliedRadios(appliedRadios);
|
||||
cfg.setSsid(ssidConfig.getSsid());
|
||||
if (ssidConfig.getEncryption().equals("WPA-PSK") && ssidConfig.getMode().equals("1"))
|
||||
cfg.setSecureMode(SecureMode.wpaPSK);
|
||||
else
|
||||
cfg.setSecureMode(SecureMode.wpa2PSK);
|
||||
cfg.setBroadcastSsid(ssidConfig.isBroadcast() ? StateSetting.enabled : StateSetting.disabled);
|
||||
Profile profile = new Profile();
|
||||
profile.setProfileType(ProfileType.ssid);
|
||||
profile.setName(ssidConfig.getSsid());
|
||||
SsidConfiguration cfg = SsidConfiguration.createWithDefaults();
|
||||
Set<RadioType> appliedRadios = new HashSet<RadioType>();
|
||||
appliedRadios.add(ssidConfig.getRadioType());
|
||||
cfg.setAppliedRadios(appliedRadios);
|
||||
cfg.setSsid(ssidConfig.getSsid());
|
||||
if (ssidConfig.getEncryption().equals("WPA-PSK") && ssidConfig.getMode().equals("1"))
|
||||
cfg.setSecureMode(SecureMode.wpaPSK);
|
||||
else
|
||||
cfg.setSecureMode(SecureMode.wpa2PSK);
|
||||
cfg.setBroadcastSsid(ssidConfig.isBroadcast() ? StateSetting.enabled : StateSetting.disabled);
|
||||
|
||||
profile.setDetails(cfg);
|
||||
profile.setId(ssidProfileId);
|
||||
if (this.ssidProfile == null)
|
||||
this.ssidProfile = new ArrayList<Profile>();
|
||||
this.ssidProfile.add(profile);
|
||||
apProfile.getChildProfileIds().add(ssidProfileId);
|
||||
ssidProfileId++;
|
||||
profile.setDetails(cfg);
|
||||
profile.setId(ssidProfileId);
|
||||
if (this.ssidProfile == null)
|
||||
this.ssidProfile = new ArrayList<Profile>();
|
||||
this.ssidProfile.add(profile);
|
||||
apProfile.getChildProfileIds().add(ssidProfileId);
|
||||
ssidProfileId++;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (customerEquipment != null) {
|
||||
customerEquipment.setProfileId(apProfile.getId());
|
||||
}
|
||||
if (customerEquipment != null) {
|
||||
customerEquipment.setProfileId(apProfile.getId());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public EquipmentGatewayRecord getEquipmentGateway() {
|
||||
return equipmentGateway;
|
||||
}
|
||||
public EquipmentGatewayRecord getEquipmentGateway() {
|
||||
return equipmentGateway;
|
||||
}
|
||||
|
||||
public void setEquipmentGateway(EquipmentGatewayRecord equipmentGateway) {
|
||||
this.equipmentGateway = equipmentGateway;
|
||||
}
|
||||
public void setEquipmentGateway(EquipmentGatewayRecord equipmentGateway) {
|
||||
this.equipmentGateway = equipmentGateway;
|
||||
}
|
||||
|
||||
public EquipmentRoutingRecord getEquipmentRouting() {
|
||||
return equipmentRouting;
|
||||
}
|
||||
public EquipmentRoutingRecord getEquipmentRouting() {
|
||||
return equipmentRouting;
|
||||
}
|
||||
|
||||
public void setEquipmentRouting(EquipmentRoutingRecord equipmentRouting) {
|
||||
this.equipmentRouting = equipmentRouting;
|
||||
}
|
||||
public void setEquipmentRouting(EquipmentRoutingRecord equipmentRouting) {
|
||||
this.equipmentRouting = equipmentRouting;
|
||||
}
|
||||
|
||||
public Equipment getCustomerEquipment() {
|
||||
return customerEquipment;
|
||||
}
|
||||
public Equipment getCustomerEquipment() {
|
||||
return customerEquipment;
|
||||
}
|
||||
|
||||
public void setCustomerEquipment(Equipment customerEquipment) {
|
||||
this.customerEquipment = customerEquipment;
|
||||
}
|
||||
public void setCustomerEquipment(Equipment customerEquipment) {
|
||||
this.customerEquipment = customerEquipment;
|
||||
}
|
||||
|
||||
public Profile getApProfile() {
|
||||
return apProfile;
|
||||
}
|
||||
public Profile getApProfile() {
|
||||
return apProfile;
|
||||
}
|
||||
|
||||
public void setApProfile(Profile apProfile) {
|
||||
this.apProfile = apProfile;
|
||||
}
|
||||
public void setApProfile(Profile apProfile) {
|
||||
this.apProfile = apProfile;
|
||||
}
|
||||
|
||||
public List<Profile> getSsidProfile() {
|
||||
return ssidProfile;
|
||||
}
|
||||
public List<Profile> getSsidProfile() {
|
||||
return ssidProfile;
|
||||
}
|
||||
|
||||
public void setSsidProfile(List<Profile> ssidProfile) {
|
||||
this.ssidProfile = ssidProfile;
|
||||
}
|
||||
public void setSsidProfile(List<Profile> ssidProfile) {
|
||||
this.ssidProfile = ssidProfile;
|
||||
}
|
||||
|
||||
public Location getEquipmentLocation() {
|
||||
return equipmentLocation;
|
||||
}
|
||||
public List<Profile> getBonjourGatewayProfiles() {
|
||||
return bonjourGatewayProfiles;
|
||||
}
|
||||
|
||||
public void setEquipmentLocation(Location equipmentLocation) {
|
||||
this.equipmentLocation = equipmentLocation;
|
||||
}
|
||||
public void setBonjourGatewayProfiles(List<Profile> bonjourGatewayProfiles) {
|
||||
this.bonjourGatewayProfiles = bonjourGatewayProfiles;
|
||||
}
|
||||
|
||||
public String getCountryCode() {
|
||||
return Location.getCountryCode(this.equipmentLocation).toString();
|
||||
}
|
||||
public Location getEquipmentLocation() {
|
||||
return equipmentLocation;
|
||||
}
|
||||
|
||||
public static long getSerialversionuid() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
public void setEquipmentLocation(Location equipmentLocation) {
|
||||
this.equipmentLocation = equipmentLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OpensyncAPConfig clone() {
|
||||
OpensyncAPConfig ret = (OpensyncAPConfig) super.clone();
|
||||
public String getCountryCode() {
|
||||
return Location.getCountryCode(this.equipmentLocation).toString();
|
||||
}
|
||||
|
||||
if (customerEquipment != null)
|
||||
ret.customerEquipment = customerEquipment.clone();
|
||||
if (equipmentLocation != null)
|
||||
ret.equipmentLocation = equipmentLocation.clone();
|
||||
if (ssidProfile != null) {
|
||||
List<Profile> ssidList = new ArrayList<Profile>();
|
||||
for (Profile profile : ssidProfile) {
|
||||
ssidList.add(profile.clone());
|
||||
}
|
||||
ret.ssidProfile = ssidList;
|
||||
}
|
||||
if (apProfile != null)
|
||||
ret.apProfile = apProfile.clone();
|
||||
if (equipmentRouting != null)
|
||||
ret.equipmentRouting = equipmentRouting.clone();
|
||||
if (equipmentGateway != null)
|
||||
ret.equipmentGateway = equipmentGateway.clone();
|
||||
if (radiusProfiles != null) {
|
||||
public static long getSerialversionuid() {
|
||||
return serialVersionUID;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OpensyncAPConfig clone() {
|
||||
OpensyncAPConfig ret = (OpensyncAPConfig) super.clone();
|
||||
|
||||
if (customerEquipment != null)
|
||||
ret.customerEquipment = customerEquipment.clone();
|
||||
if (equipmentLocation != null)
|
||||
ret.equipmentLocation = equipmentLocation.clone();
|
||||
if (ssidProfile != null) {
|
||||
List<Profile> ssidList = new ArrayList<Profile>();
|
||||
for (Profile profile : ssidProfile) {
|
||||
ssidList.add(profile.clone());
|
||||
}
|
||||
ret.ssidProfile = ssidList;
|
||||
}
|
||||
if (bonjourGatewayProfiles != null) {
|
||||
List<Profile> bonjourGatewayProfilesList = new ArrayList<Profile>();
|
||||
for (Profile profile : bonjourGatewayProfiles) {
|
||||
bonjourGatewayProfilesList.add(profile.clone());
|
||||
}
|
||||
ret.bonjourGatewayProfiles = bonjourGatewayProfilesList;
|
||||
}
|
||||
if (apProfile != null)
|
||||
ret.apProfile = apProfile.clone();
|
||||
if (equipmentRouting != null)
|
||||
ret.equipmentRouting = equipmentRouting.clone();
|
||||
if (equipmentGateway != null)
|
||||
ret.equipmentGateway = equipmentGateway.clone();
|
||||
if (radiusProfiles != null) {
|
||||
ret.radiusProfiles = new ArrayList<>();
|
||||
for (Profile cpConfig : this.radiusProfiles) {
|
||||
ret.radiusProfiles.add(cpConfig);
|
||||
for (Profile radiusProfile : this.radiusProfiles) {
|
||||
ret.radiusProfiles.add(radiusProfile);
|
||||
}
|
||||
}
|
||||
if (captiveProfiles != null) {
|
||||
ret.captiveProfiles = new ArrayList<>();
|
||||
for (Profile cpConfig : this.captiveProfiles) {
|
||||
if (captiveProfiles != null) {
|
||||
ret.captiveProfiles = new ArrayList<>();
|
||||
for (Profile cpConfig : this.captiveProfiles) {
|
||||
ret.captiveProfiles.add(cpConfig);
|
||||
}
|
||||
}
|
||||
if (blockedClients != null) {
|
||||
ret.blockedClients = new ArrayList<MacAddress>();
|
||||
for (MacAddress blockedClient : this.blockedClients) {
|
||||
if (blockedClients != null) {
|
||||
ret.blockedClients = new ArrayList<MacAddress>();
|
||||
for (MacAddress blockedClient : this.blockedClients) {
|
||||
ret.blockedClients.add(blockedClient);
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
public List<Profile> getRadiusProfiles() {
|
||||
return radiusProfiles;
|
||||
}
|
||||
public List<Profile> getRadiusProfiles() {
|
||||
return radiusProfiles;
|
||||
}
|
||||
|
||||
public void setRadiusProfiles(List<Profile> radiusProfiles) {
|
||||
this.radiusProfiles = radiusProfiles;
|
||||
}
|
||||
public void setRadiusProfiles(List<Profile> radiusProfiles) {
|
||||
this.radiusProfiles = radiusProfiles;
|
||||
}
|
||||
|
||||
public List<Profile> getCaptiveProfiles() {
|
||||
return captiveProfiles;
|
||||
}
|
||||
public List<Profile> getCaptiveProfiles() {
|
||||
return captiveProfiles;
|
||||
}
|
||||
|
||||
public void setCaptiveProfiles(List<Profile> captiveProfiles) {
|
||||
this.captiveProfiles = captiveProfiles;
|
||||
}
|
||||
public void setCaptiveProfiles(List<Profile> captiveProfiles) {
|
||||
this.captiveProfiles = captiveProfiles;
|
||||
}
|
||||
|
||||
public List<MacAddress> getBlockedClients() {
|
||||
return blockedClients;
|
||||
}
|
||||
public List<MacAddress> getBlockedClients() {
|
||||
return blockedClients;
|
||||
}
|
||||
|
||||
public void setBlockedClients(List<MacAddress> blockedClients) {
|
||||
this.blockedClients = blockedClients;
|
||||
}
|
||||
public void setBlockedClients(List<MacAddress> blockedClients) {
|
||||
this.blockedClients = blockedClients;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,6 +48,9 @@ public class OpensyncExternalIntegrationSimple implements OpensyncExternalIntegr
|
||||
@Value("${tip.wlan.ovsdb.captiveProfileFileName:/app/config/ProfileCaptive.json}")
|
||||
private String captiveProfileFileName;
|
||||
|
||||
@Value("${tip.wlan.ovsdb.bonjourProfileFileName:/app/config/ProfileBonjour.json}")
|
||||
private String bonjourProfileFileName;
|
||||
|
||||
@Value("${tip.wlan.ovsdb.locationFileName:/app/config/LocationBuildingExample.json}")
|
||||
private String locationFileName;
|
||||
|
||||
@@ -102,6 +105,15 @@ public class OpensyncExternalIntegrationSimple implements OpensyncExternalIntegr
|
||||
LOG.info("Captive file is not provided");
|
||||
}
|
||||
|
||||
List<com.telecominfraproject.wlan.profile.models.Profile> bonjourProfiles = null;
|
||||
File bonjourFile = new File(bonjourProfileFileName);
|
||||
if (bonjourFile.exists()) {
|
||||
bonjourProfiles = com.telecominfraproject.wlan.profile.models.Profile
|
||||
.listFromFile(bonjourProfileFileName, com.telecominfraproject.wlan.profile.models.Profile.class);
|
||||
} else {
|
||||
LOG.info("Bonjour file is not provided");
|
||||
}
|
||||
|
||||
equipment.setProfileId(apProfile.getId());
|
||||
|
||||
Location location = Location.fromFile(locationFileName, Location.class);
|
||||
@@ -115,6 +127,7 @@ public class OpensyncExternalIntegrationSimple implements OpensyncExternalIntegr
|
||||
ret.setRadiusProfiles(radiusProfiles);
|
||||
ret.setEquipmentLocation(location);
|
||||
ret.setCaptiveProfiles(captiveProfiles);
|
||||
ret.setBonjourGatewayProfiles(bonjourProfiles);
|
||||
|
||||
} catch (IOException e) {
|
||||
LOG.error("Cannot read config file", e);
|
||||
|
||||
29
opensync-ext-static/src/main/resources/ProfileBonjour.json
Normal file
29
opensync-ext-static/src/main/resources/ProfileBonjour.json
Normal file
@@ -0,0 +1,29 @@
|
||||
[
|
||||
{
|
||||
"model_type": "Profile",
|
||||
"id": 100,
|
||||
"customerId": 2,
|
||||
"profileType": "bonjour",
|
||||
"name": "Bonjour-gateway",
|
||||
"details": {
|
||||
"model_type": "BonjourGatewayProfile",
|
||||
"profileDescription": "Bonjour Gateway Configuration for Design Testing",
|
||||
"profileType": "bonjour",
|
||||
"bonjourServices": [
|
||||
{
|
||||
"model_type": "BonjourServiceSet",
|
||||
"vlanId": 1,
|
||||
"supportAllServices": false,
|
||||
"serviceNames": [
|
||||
"AirPort",
|
||||
"SFTP",
|
||||
"SSH"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"createdTimestamp": 1599234550774,
|
||||
"lastModifiedTimestamp": 1599234550774,
|
||||
"childProfileIds": []
|
||||
}
|
||||
]
|
||||
@@ -0,0 +1,29 @@
|
||||
[
|
||||
{
|
||||
"model_type": "Profile",
|
||||
"id": 100,
|
||||
"customerId": 2,
|
||||
"profileType": "bonjour",
|
||||
"name": "Bonjour-gateway",
|
||||
"details": {
|
||||
"model_type": "BonjourGatewayProfile",
|
||||
"profileDescription": "Bonjour Gateway Configuration for Design Testing",
|
||||
"profileType": "bonjour",
|
||||
"bonjourServices": [
|
||||
{
|
||||
"model_type": "BonjourServiceSet",
|
||||
"vlanId": 1,
|
||||
"supportAllServices": false,
|
||||
"serviceNames": [
|
||||
"AirPort",
|
||||
"SFTP",
|
||||
"SSH"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"createdTimestamp": 1599234550774,
|
||||
"lastModifiedTimestamp": 1599234550774,
|
||||
"childProfileIds": []
|
||||
}
|
||||
]
|
||||
@@ -133,6 +133,7 @@ OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.ssidProfileFileName=$OVSDB_SSIDPROFIL
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.radiusProfileFileName=$OVSDB_RADIUSPROFILE_CONFIG_FILE"
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.locationFileName=$OVSDB_LOCATION_CONFIG_FILE"
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.captiveProfileFileName=$OVSDB_CAPTIVEPROFILE_CONFIG_FILE"
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.bonjourProfileFileName=$OVSDB_BONJOURPROFILE_CONFIG_FILE"
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.wifi-iface.default_bridge=$OVSDB_IF_DEFAULT_BRIDGE"
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.wifi-iface.default_wan_type=$OVSDB_DEVICE_DEFAULT_WAN_TYPE"
|
||||
OVSDB_PROPS="$OVSDB_PROPS -Dtip.wlan.ovsdb.wifi-iface.default_wan_name=$OVSDB_DEVICE_DEFAULT_WAN_NAME"
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
[
|
||||
{
|
||||
"model_type": "Profile",
|
||||
"id": 100,
|
||||
"customerId": 2,
|
||||
"profileType": "bonjour",
|
||||
"name": "Bonjour-gateway",
|
||||
"details": {
|
||||
"model_type": "BonjourGatewayProfile",
|
||||
"profileDescription": "Bonjour Gateway Configuration for Design Testing",
|
||||
"profileType": "bonjour",
|
||||
"bonjourServices": [
|
||||
{
|
||||
"model_type": "BonjourServiceSet",
|
||||
"vlanId": 1,
|
||||
"supportAllServices": false,
|
||||
"serviceNames": [
|
||||
"AirPort",
|
||||
"SFTP",
|
||||
"SSH"
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
"createdTimestamp": 1599234550774,
|
||||
"lastModifiedTimestamp": 1599234550774,
|
||||
"childProfileIds": []
|
||||
}
|
||||
]
|
||||
@@ -24,6 +24,7 @@ OVSDB_PROPS+=" -Dtip.wlan.ovsdb.apProfileFileName=$OVSDB_APPROFILE_CONFIG_FILE"
|
||||
OVSDB_PROPS+=" -Dtip.wlan.ovsdb.ssidProfileFileName=$OVSDB_SSIDPROFILE_CONFIG_FILE"
|
||||
OVSDB_PROPS+=" -Dtip.wlan.ovsdb.radiusProfileFileName=$OVSDB_RADIUSPROFILE_CONFIG_FILE"
|
||||
OVSDB_PROPS+=" -Dtip.wlan.ovsdb.captiveProfileFileName=$OVSDB_CAPTIVEPROFILE_CONFIG_FILE"
|
||||
OVSDB_PROPS+=" -Dtip.wlan.ovsdb.bonjourProfileFileName=$OVSDB_BONJOURPROFILE_CONFIG_FILE"
|
||||
OVSDB_PROPS+=" -Dtip.wlan.ovsdb.locationFileName=$OVSDB_LOCATION_CONFIG_FILE"
|
||||
OVSDB_PROPS+=" -Dtip.wlan.ovsdb.wifi-iface.default_bridge=$OVSDB_IF_DEFAULT_BRIDGE"
|
||||
OVSDB_PROPS+=" -Dtip.wlan.ovsdb.wifi-iface.default_wan_type=$OVSDB_DEVICE_DEFAULT_WAN_TYPE"
|
||||
|
||||
Reference in New Issue
Block a user