mirror of
				https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
				synced 2025-10-31 10:37:51 +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; | ||||
| @@ -646,6 +647,19 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra | ||||
|  | ||||
|             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); | ||||
|             throw e; | ||||
| @@ -1208,6 +1222,9 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra | ||||
|  | ||||
|         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); | ||||
|  | ||||
| @@ -1220,12 +1237,18 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra | ||||
|  | ||||
|             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 { | ||||
|                 ((ApElementConfiguration) ce.getDetails()).getRadioMap().putAll(apElementConfiguration.getRadioMap()); | ||||
| @@ -1277,7 +1300,12 @@ 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; | ||||
| @@ -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
	 Lynn Shi
					Lynn Shi