mirror of
				https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
				synced 2025-10-30 18:17:59 +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; | ||||
| @@ -645,7 +646,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra | ||||
|             networkAdminStatusRec.setDetails(netAdminStatusData); | ||||
|  | ||||
|             networkAdminStatusRec = statusServiceInterface.update(networkAdminStatusRec); | ||||
|  | ||||
|              | ||||
|         } catch (Exception e) { | ||||
|             LOG.error("Exception in updateApStatus", e); | ||||
|             throw e; | ||||
| @@ -1207,6 +1208,12 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra | ||||
|         boolean configStateMismatch = false; | ||||
|  | ||||
|         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); | ||||
| @@ -1219,12 +1226,19 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra | ||||
|                     radioState); | ||||
|  | ||||
|             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 { | ||||
| @@ -1276,8 +1290,20 @@ 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; | ||||
| @@ -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
	 Mike Hansen
					Mike Hansen