mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2026-01-07 20:41:35 +00:00
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;
|
||||
@@ -645,6 +646,19 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
networkAdminStatusRec.setDetails(netAdminStatusData);
|
||||
|
||||
networkAdminStatusRec = statusServiceInterface.update(networkAdminStatusRec);
|
||||
|
||||
Status channelStatusRec = statusServiceInterface.getOrNull(ce.getCustomerId(), ce.getId(),
|
||||
StatusDataType.RADIO_CHANNEL);
|
||||
if (channelStatusRec == null) {
|
||||
channelStatusRec = new Status();
|
||||
channelStatusRec.setCustomerId(ce.getCustomerId());
|
||||
channelStatusRec.setEquipmentId(ce.getId());
|
||||
channelStatusRec.setStatusDataType(StatusDataType.RADIO_CHANNEL);
|
||||
EquipmentChannelStatusData channelStatusData = new EquipmentChannelStatusData();
|
||||
channelStatusRec.setDetails(channelStatusData);
|
||||
|
||||
channelStatusRec = statusServiceInterface.update(channelStatusRec);
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
LOG.error("Exception in updateApStatus", e);
|
||||
@@ -1207,6 +1221,9 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
boolean configStateMismatch = false;
|
||||
|
||||
Status protocolStatus = null;
|
||||
|
||||
Status channelStatus = statusServiceInterface.getOrNull(customerId, equipmentId, StatusDataType.RADIO_CHANNEL);
|
||||
Status channelStatusClone = channelStatus.clone();
|
||||
|
||||
for (OpensyncAPRadioState radioState : radioStateTables) {
|
||||
LOG.debug("Processing Wifi_Radio_State table update for AP {} Radio {}", apId, radioState.freqBand);
|
||||
@@ -1219,12 +1236,18 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
radioState);
|
||||
|
||||
protocolStatus = updateProtocolStatus(customerId, equipmentId, radioState);
|
||||
|
||||
|
||||
updateChannelStatus(channelStatus, radioState);
|
||||
}
|
||||
|
||||
if (protocolStatus != null) {
|
||||
statusServiceInterface.update(protocolStatus);
|
||||
}
|
||||
|
||||
if (!Objects.equals(channelStatus, channelStatusClone)) {
|
||||
LOG.debug("update Channel Status before {} after {}", channelStatusClone, channelStatus);
|
||||
statusServiceInterface.update(channelStatus);
|
||||
}
|
||||
|
||||
if (configStateMismatch) {
|
||||
try {
|
||||
@@ -1276,8 +1299,13 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
}
|
||||
return protocolStatus;
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void updateChannelStatus(Status channelStatus, OpensyncAPRadioState radioState) {
|
||||
if (channelStatus != null && channelStatus.getDetails() != null) {
|
||||
((EquipmentChannelStatusData) channelStatus.getDetails()).getChannelNumberStatusDataMap().put(
|
||||
radioState.getFreqBand(), radioState.getChannel());
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
@@ -678,6 +680,20 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
protocolStatus.setStatusDataType(StatusDataType.PROTOCOL);
|
||||
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user