mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-01 02:57:49 +00:00
Merge pull request #28 from Telecominfraproject/WIFI-1658
WIFI-1658 Add Channel Number Status Support
This commit is contained in:
@@ -85,6 +85,7 @@ import com.telecominfraproject.wlan.routing.RoutingServiceInterface;
|
||||
import com.telecominfraproject.wlan.routing.models.EquipmentRoutingRecord;
|
||||
import com.telecominfraproject.wlan.status.StatusServiceInterface;
|
||||
import com.telecominfraproject.wlan.status.equipment.models.EquipmentAdminStatusData;
|
||||
import com.telecominfraproject.wlan.status.equipment.models.EquipmentChannelStatusData;
|
||||
import com.telecominfraproject.wlan.status.equipment.models.EquipmentLANStatusData;
|
||||
import com.telecominfraproject.wlan.status.equipment.models.EquipmentProtocolState;
|
||||
import com.telecominfraproject.wlan.status.equipment.models.EquipmentProtocolStatusData;
|
||||
@@ -1208,6 +1209,12 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
|
||||
Status protocolStatus = null;
|
||||
|
||||
Status channelStatus = statusServiceInterface.getOrNull(customerId, equipmentId, StatusDataType.RADIO_CHANNEL);
|
||||
Status channelStatusClone = null;
|
||||
if (channelStatus != null) {
|
||||
channelStatusClone = channelStatus.clone();
|
||||
}
|
||||
|
||||
for (OpensyncAPRadioState radioState : radioStateTables) {
|
||||
LOG.debug("Processing Wifi_Radio_State table update for AP {} Radio {}", apId, radioState.freqBand);
|
||||
|
||||
@@ -1220,12 +1227,19 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
|
||||
protocolStatus = updateProtocolStatus(customerId, equipmentId, radioState);
|
||||
|
||||
channelStatus = updateChannelStatus(customerId, equipmentId, channelStatus, radioState);
|
||||
}
|
||||
|
||||
if (protocolStatus != null) {
|
||||
statusServiceInterface.update(protocolStatus);
|
||||
}
|
||||
|
||||
if (channelStatus != null && !Objects.equals(channelStatus, channelStatusClone)) {
|
||||
LOG.debug("wifiRadioStatusDbTableUpdate update Channel Status before {} after {}",
|
||||
channelStatusClone, channelStatus);
|
||||
statusServiceInterface.update(channelStatus);
|
||||
}
|
||||
|
||||
if (configStateMismatch) {
|
||||
try {
|
||||
((ApElementConfiguration) ce.getDetails()).getRadioMap().putAll(apElementConfiguration.getRadioMap());
|
||||
@@ -1277,7 +1291,19 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
return protocolStatus;
|
||||
}
|
||||
|
||||
|
||||
private Status updateChannelStatus(int customerId, long equipmentId, Status channelStatus, OpensyncAPRadioState radioState) {
|
||||
if (channelStatus == null) {
|
||||
channelStatus = new Status();
|
||||
channelStatus.setCustomerId(customerId);
|
||||
channelStatus.setEquipmentId(equipmentId);
|
||||
channelStatus.setStatusDataType(StatusDataType.RADIO_CHANNEL);
|
||||
EquipmentChannelStatusData channelStatusData = new EquipmentChannelStatusData();
|
||||
channelStatus.setDetails(channelStatusData);
|
||||
}
|
||||
((EquipmentChannelStatusData) channelStatus.getDetails()).getChannelNumberStatusDataMap().put(
|
||||
radioState.getFreqBand(), radioState.getChannel());
|
||||
return channelStatus;
|
||||
}
|
||||
|
||||
private boolean updateChannelPowerLevels(String apId, ApElementConfiguration apElementConfiguration,
|
||||
OpensyncAPRadioState radioState) {
|
||||
|
||||
@@ -5,6 +5,7 @@ import static org.junit.Assert.assertNull;
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -75,6 +76,7 @@ import com.telecominfraproject.wlan.profile.rf.models.RfConfiguration;
|
||||
import com.telecominfraproject.wlan.profile.ssid.models.SsidConfiguration;
|
||||
import com.telecominfraproject.wlan.routing.RoutingServiceInterface;
|
||||
import com.telecominfraproject.wlan.status.StatusServiceInterface;
|
||||
import com.telecominfraproject.wlan.status.equipment.models.EquipmentChannelStatusData;
|
||||
import com.telecominfraproject.wlan.status.equipment.models.EquipmentProtocolStatusData;
|
||||
import com.telecominfraproject.wlan.status.equipment.models.EquipmentUpgradeStatusData;
|
||||
import com.telecominfraproject.wlan.status.equipment.report.models.ActiveBSSID;
|
||||
@@ -679,6 +681,20 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
|
||||
Mockito.when(statusServiceInterface.getOrNull(2, 1L, StatusDataType.PROTOCOL)).thenReturn(protocolStatus);
|
||||
|
||||
Status channelStatus = new Status();
|
||||
channelStatus.setCustomerId(2);
|
||||
channelStatus.setEquipmentId(1L);
|
||||
EquipmentChannelStatusData channelStatusData = new EquipmentChannelStatusData();
|
||||
Map<RadioType, Integer> channelStatusDataMap = new EnumMap<>(RadioType.class);
|
||||
channelStatusDataMap.put(RadioType.is2dot4GHz, 6);
|
||||
channelStatusDataMap.put(RadioType.is5GHzL, 36);
|
||||
channelStatusDataMap.put(RadioType.is5GHzU, 157);
|
||||
channelStatusData.setChannelNumberStatusDataMap(channelStatusDataMap);
|
||||
channelStatus.setDetails(channelStatusData);
|
||||
|
||||
Mockito.when(statusServiceInterface.getOrNull(2, 1L, StatusDataType.RADIO_CHANNEL)).thenReturn(channelStatus);
|
||||
Mockito.when(statusServiceInterface.update(channelStatus)).thenReturn(channelStatus);
|
||||
|
||||
Status bssidStatus = new Status();
|
||||
bssidStatus.setStatusDataType(StatusDataType.ACTIVE_BSSIDS);
|
||||
bssidStatus.setCustomerId(2);
|
||||
|
||||
Reference in New Issue
Block a user