mirror of
				https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
				synced 2025-10-31 10:37:51 +00:00 
			
		
		
		
	Improvements:
WIFI-2989: Remove dependency on customerid from ovsdb session WIFI-2988: Ovsdb schema check for Wifi_Radio_Config and Wifi_RRM_Config Signed-off-by: Mike Hansen <mike.hansen@connectus.ai>
This commit is contained in:
		| @@ -406,7 +406,6 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra | ||||
|             OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId); | ||||
|             ovsdbSession.setRoutingId(equipmentRoutingRecord.getId()); | ||||
|             ovsdbSession.setEquipmentId(ce.getId()); | ||||
|             ovsdbSession.setCustomerId(ce.getCustomerId()); | ||||
|  | ||||
|             LOG.debug("Equipment {}", ce); | ||||
|             LOG.info("AP {} got connected to the gateway", apId); | ||||
| @@ -969,11 +968,11 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra | ||||
|             if (ovsdbSession == null) { | ||||
|                 throw new IllegalStateException("AP is not connected " + apId); | ||||
|             } | ||||
|             int customerId = ovsdbSession.getCustomerId(); | ||||
|             Equipment equipmentConfig = equipmentServiceInterface.getByInventoryIdOrNull(apId); | ||||
|             if (equipmentConfig == null) { | ||||
|                 throw new IllegalStateException("Cannot retrieve configuration for " + apId); | ||||
|             } | ||||
|             int customerId = equipmentConfig.getCustomerId(); | ||||
|  | ||||
|             ret = new OpensyncAPConfig(); | ||||
|  | ||||
| @@ -1073,20 +1072,23 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         int customerId = ovsdbSession.getCustomerId(); | ||||
|         long equipmentId = ovsdbSession.getEquipmentId(); | ||||
|  | ||||
|         if ((customerId < 0) || (equipmentId < 0)) { | ||||
|             LOG.debug("wifiVIFStateDbTableUpdate::Cannot get valid CustomerId {} or EquipmentId {} for AP {}", customerId, equipmentId, apId); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         Equipment apNode = equipmentServiceInterface.getOrNull(equipmentId); | ||||
|         if (apNode == null) { | ||||
|             LOG.debug("wifiVIFStateDbTableUpdate::Cannot get EquipmentId for AP {}", apId); | ||||
|             return; // we don't have the required info to get the | ||||
|             // radio type yet | ||||
|         } | ||||
|          | ||||
|         int customerId = apNode.getCustomerId(); | ||||
|  | ||||
|         if ((customerId < 0) || (equipmentId < 0)) { | ||||
|             LOG.debug("wifiVIFStateDbTableUpdate::Cannot get valid CustomerId {} or EquipmentId {} for AP {}", customerId, equipmentId, apId); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|  | ||||
|         ApElementConfiguration apElementConfig = (ApElementConfiguration) apNode.getDetails(); | ||||
|  | ||||
|         ProfileContainer profileContainer = new ProfileContainer(profileServiceInterface.getProfileWithChildren(apNode.getProfileId())); | ||||
| @@ -1210,20 +1212,21 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         int customerId = ovsdbSession.getCustomerId(); | ||||
|         long equipmentId = ovsdbSession.getEquipmentId(); | ||||
|  | ||||
|         if ((customerId < 0) || (equipmentId < 0)) { | ||||
|             LOG.debug("wifiRadioStatusDbTableUpdate::Cannot get valid CustomerId {} or EquipmentId {} for AP {}", customerId, equipmentId, apId); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         Equipment ce = equipmentServiceInterface.getByInventoryIdOrNull(apId); | ||||
|         if (ce == null) { | ||||
|             LOG.debug("wifiRadioStatusDbTableUpdate::Cannot get Equipment for AP {}", apId); | ||||
|             return; | ||||
|         } | ||||
|          | ||||
|         int customerId = ce.getCustomerId(); | ||||
|         if ((customerId < 0) || (equipmentId < 0)) { | ||||
|             LOG.debug("wifiRadioStatusDbTableUpdate::Cannot get valid CustomerId {} or EquipmentId {} for AP {}", customerId, equipmentId, apId); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|  | ||||
|  | ||||
|         ApElementConfiguration apElementConfiguration = ((ApElementConfiguration) ce.getDetails()); | ||||
|  | ||||
|         boolean configStateMismatch = false; | ||||
| @@ -1436,20 +1439,20 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         int customerId = ovsdbSession.getCustomerId(); | ||||
|         long equipmentId = ovsdbSession.getEquipmentId(); | ||||
|         Equipment ce = equipmentServiceInterface.getOrNull(equipmentId); | ||||
|         if (ce == null) { | ||||
|             LOG.debug("wifiInetStateDbTableUpdate Cannot get customer Equipment for {}", apId); | ||||
|             return; | ||||
|         } | ||||
|          | ||||
|         int customerId = ce.getCustomerId(); | ||||
|         if ((customerId < 0) || (equipmentId < 0)) { | ||||
|             LOG.debug("wifiInetStateDbTableUpdate::Cannot get valid CustomerId {} or EquipmentId {} for AP {}", customerId, equipmentId, apId); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         Equipment ce = equipmentServiceInterface.getOrNull(equipmentId); | ||||
|  | ||||
|         if (ce == null) { | ||||
|             LOG.debug("wifiInetStateDbTableUpdate Cannot get customer Equipment for {}", apId); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         Status lanStatus = statusServiceInterface.getOrNull(customerId, equipmentId, StatusDataType.LANINFO); | ||||
|         if (lanStatus == null) { | ||||
| @@ -1566,14 +1569,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra | ||||
|             return; | ||||
|         }     | ||||
|          | ||||
|         int customerId = ovsdbSession.getCustomerId(); | ||||
|         long equipmentId = ovsdbSession.getEquipmentId(); | ||||
|  | ||||
|         if ((customerId < 0) || (equipmentId < 0)) { | ||||
|             LOG.debug("wifiAssociatedClientsDbTableUpdate::Cannot get valid CustomerId {} or EquipmentId {} for AP {}", customerId, equipmentId, apId); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         Equipment ce = equipmentServiceInterface.getOrNull(equipmentId); | ||||
|  | ||||
|         if (ce == null) { | ||||
| @@ -1581,6 +1577,14 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra | ||||
|             return; | ||||
|         } | ||||
|          | ||||
|         int customerId = ce.getCustomerId(); | ||||
|         if ((customerId < 0) || (equipmentId < 0)) { | ||||
|             LOG.debug("wifiAssociatedClientsDbTableUpdate::Cannot get valid CustomerId {} or EquipmentId {} for AP {}", customerId, equipmentId, apId); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|  | ||||
|  | ||||
|         if ((wifiAssociatedClients == null) || wifiAssociatedClients.isEmpty()) { | ||||
|             return; | ||||
|         } | ||||
| @@ -1662,19 +1666,19 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         int customerId = ovsdbSession.getCustomerId(); | ||||
|         long equipmentId = ovsdbSession.getEquipmentId(); | ||||
|  | ||||
|         if ((customerId < 0) || (equipmentId < 0)) { | ||||
|             LOG.info("awlanNodeDbTableUpdate::Cannot get valid CustomerId {} or EquipmentId {} for AP {}", customerId, equipmentId, apId); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         Equipment ce = equipmentServiceInterface.getByInventoryIdOrNull(apId); | ||||
|         if (ce == null) { | ||||
|             LOG.info("awlanNodeDbTableUpdate::Cannot find AP {}", apId); | ||||
|             return; | ||||
|         } | ||||
|         int customerId = ce.getCustomerId(); | ||||
|         if ((customerId < 0) || (equipmentId < 0)) { | ||||
|             LOG.info("awlanNodeDbTableUpdate::Cannot get valid CustomerId {} or EquipmentId {} for AP {}", customerId, equipmentId, apId); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|  | ||||
|  | ||||
|         int upgradeStatusFromAp = node.getUpgradeStatus(); | ||||
|         EquipmentUpgradeState fwUpgradeState = null; | ||||
| @@ -1889,32 +1893,26 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra | ||||
|  | ||||
|         LOG.info("wifiVIFStateDbTableDelete for AP {} rows {}", apId, vifStateTables); | ||||
|         OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId); | ||||
|  | ||||
|         if (ovsdbSession == null) { | ||||
|             LOG.debug("wifiVIFStateDbTableDelete::Cannot get Session for AP {}", apId); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         int customerId = ovsdbSession.getCustomerId(); | ||||
|         long equipmentId = ovsdbSession.getEquipmentId(); | ||||
|  | ||||
|         Equipment ce = equipmentServiceInterface.getOrNull(equipmentId); | ||||
|         int customerId = ce.getCustomerId(); | ||||
|         if ((customerId < 0) || (equipmentId < 0)) { | ||||
|             LOG.debug("wifiVIFStateDbTableDelete::Cannot get valid CustomerId {} or EquipmentId {} for AP {}", customerId, equipmentId, apId); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         Status activeBssidsStatus = statusServiceInterface.getOrNull(customerId, equipmentId, StatusDataType.ACTIVE_BSSIDS); | ||||
|  | ||||
|         if (activeBssidsStatus == null) { | ||||
|             return; // nothing to delete | ||||
|  | ||||
|         } | ||||
|  | ||||
|         ActiveBSSIDs statusDetails = (ActiveBSSIDs) activeBssidsStatus.getDetails(); | ||||
|  | ||||
|         List<ActiveBSSID> bssidList = statusDetails.getActiveBSSIDs(); | ||||
|         List<ActiveBSSID> toBeDeleted = new ArrayList<>(); | ||||
|         Equipment ce = equipmentServiceInterface.getOrNull(equipmentId); | ||||
|         List<ClientSession> clientSessionsForCustomerAndEquipment = new ArrayList<>(); | ||||
|         if (ce != null) { | ||||
|             PaginationResponse<ClientSession> clientSessions = clientServiceInterface.getSessionsForCustomer(customerId, ImmutableSet.of(equipmentId), | ||||
| @@ -1957,15 +1955,13 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra | ||||
|             LOG.debug("wifiAssociatedClientsDbTableDelete::Cannot get Session for AP {}", apId); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         int customerId = ovsdbSession.getCustomerId(); | ||||
|         long equipmentId = ovsdbSession.getEquipmentId(); | ||||
|  | ||||
|         Equipment ce = equipmentServiceInterface.getOrNull(equipmentId); | ||||
|         int customerId = ce.getCustomerId(); | ||||
|         if ((customerId < 0) || (equipmentId < 0)) { | ||||
|             LOG.debug("wifiAssociatedClientsDbTableDelete::Cannot get valid CustomerId {} or EquipmentId {} for AP {}", customerId, equipmentId, apId); | ||||
|             LOG.debug("wifiVIFStateDbTableDelete::Cannot get valid CustomerId {} or EquipmentId {} for AP {}", customerId, equipmentId, apId); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         Client client = clientServiceInterface.getOrNull(customerId, MacAddress.valueOf(deletedClientMac)); | ||||
|         ClientSession clientSession = clientServiceInterface.getSessionOrNull(customerId, equipmentId, MacAddress.valueOf(deletedClientMac)); | ||||
|  | ||||
| @@ -1999,20 +1995,19 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         int customerId = ovsdbSession.getCustomerId(); | ||||
|         long equipmentId = ovsdbSession.getEquipmentId(); | ||||
|  | ||||
|         Equipment ce = equipmentServiceInterface.getByInventoryIdOrNull(apId); | ||||
|         int customerId = ce.getCustomerId(); | ||||
|         if (ce == null) { | ||||
|             LOG.debug("updateDhcpIpClientFingerprints::Cannot get Equipment for AP {}", apId); | ||||
|             return; | ||||
|         } | ||||
|         if ((customerId < 0) || (equipmentId < 0)) { | ||||
|             LOG.debug("updateDhcpIpClientFingerprints::Cannot get valid CustomerId {} or EquipmentId {} for AP {}", customerId, equipmentId, apId); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         Equipment ce = equipmentServiceInterface.getByInventoryIdOrNull(apId); | ||||
|  | ||||
|         if (ce == null) { | ||||
|             LOG.debug("updateDhcpIpClientFingerprints::Cannot get Equipment for AP {}", apId); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         long locationId = ce.getLocationId(); | ||||
|  | ||||
| @@ -2306,20 +2301,17 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         int customerId = ovsdbSession.getCustomerId(); | ||||
|         long equipmentId = ovsdbSession.getEquipmentId(); | ||||
|  | ||||
|         if ((customerId < 0) || (equipmentId < 0)) { | ||||
|             LOG.debug("clearEquipmentStatus::Cannot get valid CustomerId {} or EquipmentId {} for AP {}", customerId, equipmentId, apId); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         Equipment ce = equipmentServiceInterface.getOrNull(equipmentId); | ||||
|  | ||||
|         if (ce == null) { | ||||
|             LOG.debug("clearEquipmentStatus Cannot get customer Equipment for {}", apId); | ||||
|             return; | ||||
|         } | ||||
|         int customerId = ce.getCustomerId(); | ||||
|         if ((customerId < 0) || (equipmentId < 0)) { | ||||
|             LOG.debug("clearEquipmentStatus::Cannot get valid CustomerId {} or EquipmentId {} for AP {}", customerId, equipmentId, apId); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         List<Status> statusList = new ArrayList<>(); | ||||
|  | ||||
| @@ -2386,22 +2378,26 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra | ||||
|     @Override | ||||
|     public void apcStateDbTableUpdate(Map<String, String> apcStateAttributes, String apId, RowUpdateOperation rowUpdateOperation) { | ||||
|         LOG.info("apcStateDbTableUpdate {} operations on AP {} with values {} ", rowUpdateOperation, apId, apcStateAttributes); | ||||
|          | ||||
|         OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId); | ||||
|         if (ovsdbSession == null) { | ||||
|             LOG.info("apcStateDbTableUpdate::Cannot get Session for AP {}", apId); | ||||
|             return; | ||||
|         } | ||||
|         int customerId = ovsdbSession.getCustomerId(); | ||||
|          | ||||
|         long equipmentId = ovsdbSession.getEquipmentId(); | ||||
|         if ((customerId < 0) || (equipmentId < 0)) { | ||||
|             LOG.info("apcStateDbTableUpdate::Cannot get valid CustomerId {} or EquipmentId {} for AP {}", customerId, equipmentId, apId); | ||||
|             return; | ||||
|         } | ||||
|         Equipment ce = equipmentServiceInterface.getByInventoryIdOrNull(apId); | ||||
|         if (ce == null) { | ||||
|             LOG.info("apcStateDbTableUpdate::Cannot get Equipment for AP {}", apId); | ||||
|             return; | ||||
|         } | ||||
|          | ||||
|         int customerId = ce.getCustomerId(); | ||||
|         if ((customerId < 0) || (equipmentId < 0)) { | ||||
|             LOG.info("apcStateDbTableUpdate::Cannot get valid CustomerId {} or EquipmentId {} for AP {}", customerId, equipmentId, apId); | ||||
|             return; | ||||
|         } | ||||
|  | ||||
|         InetAddress drIpAddr = null; | ||||
|         InetAddress bdrIpAddr = null; | ||||
|         try { | ||||
|   | ||||
| @@ -254,7 +254,7 @@ public class OpensyncCloudGatewayController { | ||||
|         if (null != command.getRoutingId()) { | ||||
|             if (!command.getRoutingId().equals(session.getRoutingId())) { | ||||
|  | ||||
|                 LOG.info("[C:{} E:{} R:{}] Stale routing entry ({}) detected", session.getCustomerId(), command.getInventoryId(), session.getRoutingId(), | ||||
|                 LOG.info("[E:{} R:{}] Stale routing entry ({}) detected", command.getInventoryId(), session.getRoutingId(), | ||||
|                         command.getRoutingId()); | ||||
|  | ||||
|                 return new EquipmentCommandResponse(CEGWCommandResultCode.NoRouteToCE, "Inactive Route Identifer", command, | ||||
|   | ||||
| @@ -263,7 +263,8 @@ public class MqttStatsPublisher implements StatsPublisherInterface { | ||||
|             for (sts.OpensyncStats.EventReport.ClientSession apEventClientSession : eventReport.getClientSessionList()) { | ||||
|  | ||||
|                 LOG.debug("Processing EventReport::ClientSession for AP {}", apId); | ||||
|                 // for the following MQTT events, the client/client session is first updated, then the real time event is published, asynchronously. | ||||
|                 // for the following MQTT events, the client/client session is first updated, then the real time event | ||||
|                 // is published, asynchronously. | ||||
|                 if (apEventClientSession.hasClientAuthEvent()) { | ||||
|                     processClientAuthEvent(customerId, equipmentId, locationId, apEventClientSession); | ||||
|                 } | ||||
| @@ -1382,16 +1383,22 @@ public class MqttStatsPublisher implements StatsPublisherInterface { | ||||
|             for (Client cl : clReport.getClientListList()) { | ||||
|  | ||||
|                 if (cl.getMacAddress() == null) { | ||||
|                     LOG.trace("No mac address for Client {}, cannot set device mac address for client in ClientMetrics.", cl); | ||||
|                     LOG.info("No mac address for Client {}, cannot set device mac address for client in ClientMetrics.", cl); | ||||
|                     continue; | ||||
|                 } | ||||
|  | ||||
|                 LOG.debug("Processing ClientReport from AP {}", cl.getMacAddress()); | ||||
|                 ClientSession session = clientServiceInterface.getSessionOrNull(customerId, equipmentId, MacAddress.valueOf(cl.getMacAddress())); | ||||
|  | ||||
|                 if (session == null) { | ||||
|                     LOG.info("No session for Client {}, ignore."); | ||||
|                     continue; | ||||
|                 } | ||||
|  | ||||
|                 if (cl.hasStats()) { | ||||
|                     LOG.debug("Processing ClientReport from AP for client device {}", cl.getMacAddress()); | ||||
|                     ServiceMetric smr = new ServiceMetric(customerId, equipmentId, MacAddress.valueOf(cl.getMacAddress())); | ||||
|                     smr.setLocationId(locationId); | ||||
|                     metricRecordList.add(smr); | ||||
|  | ||||
|                     smr.setClientMac(MacAddress.valueOf(cl.getMacAddress()).getAddressAsLong()); | ||||
|  | ||||
|                     // clReport.getChannel(); | ||||
| @@ -1402,15 +1409,10 @@ public class MqttStatsPublisher implements StatsPublisherInterface { | ||||
|                     Integer periodLengthSec = 60; // matches what's configured by | ||||
|                     // OvsdbDao.configureStats(OvsdbClient) | ||||
|                     cMetrics.setPeriodLengthSec(periodLengthSec); | ||||
|  | ||||
|                     cMetrics.setRadioType(OvsdbToWlanCloudTypeMappingUtility.getRadioTypeFromOpensyncStatsRadioBandType(clReport.getBand())); | ||||
|  | ||||
|                 ClientSession session = clientServiceInterface.getSessionOrNull(customerId, equipmentId, MacAddress.valueOf(cl.getMacAddress())); | ||||
|                 if (session != null) { | ||||
|                     cMetrics.setSessionId(session.getDetails().getSessionId()); | ||||
|                     LOG.debug("populateApClientMetrics Session Id {}", session.getDetails().getSessionId()); | ||||
|                 } | ||||
|                 if (cl.hasStats()) { | ||||
|  | ||||
|                     if (cl.getStats().hasRssi()) { | ||||
|                         int rssi = cl.getStats().getRssi(); | ||||
|                         cMetrics.setRssi(rssi); | ||||
| @@ -1463,7 +1465,6 @@ public class MqttStatsPublisher implements StatsPublisherInterface { | ||||
|                     if (cl.getStats().hasTxRetries()) { | ||||
|                         cMetrics.setNumTxDataRetries((int) cl.getStats().getTxRetries()); | ||||
|                     } | ||||
|                 } | ||||
|  | ||||
|                     LOG.debug("ApClientMetrics Report {}", cMetrics); | ||||
|  | ||||
| @@ -1473,6 +1474,8 @@ public class MqttStatsPublisher implements StatsPublisherInterface { | ||||
|  | ||||
|         } | ||||
|  | ||||
|     } | ||||
|  | ||||
|     void populateNeighbourScanReports(List<ServiceMetric> metricRecordList, Report report, int customerId, long equipmentId, long locationId) { | ||||
|         LOG.info("populateNeighbourScanReports for Customer {} Equipment {}", customerId, equipmentId); | ||||
|  | ||||
| @@ -1581,7 +1584,8 @@ public class MqttStatsPublisher implements StatsPublisherInterface { | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|             if (LOG.isTraceEnabled()) LOG.trace("Client Report Date is {}", new Date(clientReport.getTimestampMs())); | ||||
|             if (LOG.isTraceEnabled()) | ||||
|                 LOG.trace("Client Report Date is {}", new Date(clientReport.getTimestampMs())); | ||||
|             int numConnectedClients = 0; | ||||
|             for (Client client : clientReport.getClientListList()) { | ||||
|                 if (client.hasStats()) { | ||||
| @@ -1792,10 +1796,9 @@ public class MqttStatsPublisher implements StatsPublisherInterface { | ||||
|             return -1; | ||||
|         } | ||||
|  | ||||
|         OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId); | ||||
|  | ||||
|         if (ovsdbSession != null) { | ||||
|             return ovsdbSession.getCustomerId(); | ||||
|         Equipment ce = equipmentServiceInterface.getByInventoryIdOrNull(apId); | ||||
|         if (ce != null) { | ||||
|             return ce.getCustomerId(); | ||||
|         } | ||||
|  | ||||
|         return -1; | ||||
|   | ||||
| @@ -1,3 +1,4 @@ | ||||
|  | ||||
| package com.telecominfraproject.wlan.opensync.external.integration; | ||||
|  | ||||
| import static org.junit.Assert.assertNotNull; | ||||
| @@ -49,6 +50,8 @@ import com.telecominfraproject.wlan.core.model.entity.CountryCode; | ||||
| import com.telecominfraproject.wlan.core.model.equipment.EquipmentType; | ||||
| import com.telecominfraproject.wlan.core.model.equipment.MacAddress; | ||||
| import com.telecominfraproject.wlan.core.model.equipment.RadioType; | ||||
| import com.telecominfraproject.wlan.core.model.pagination.PaginationContext; | ||||
| import com.telecominfraproject.wlan.core.model.pagination.PaginationResponse; | ||||
| import com.telecominfraproject.wlan.customer.models.Customer; | ||||
| import com.telecominfraproject.wlan.customer.models.CustomerDetails; | ||||
| import com.telecominfraproject.wlan.customer.models.EquipmentAutoProvisioningSettings; | ||||
| @@ -97,8 +100,7 @@ import sts.OpensyncStats.Report; | ||||
| @RunWith(SpringRunner.class) | ||||
| @ActiveProfiles(profiles = {"integration_test",}) | ||||
| @SpringBootTest(webEnvironment = WebEnvironment.NONE, classes = OpensyncExternalIntegrationCloudTest.class) | ||||
| @Import(value = { AlarmServiceInterface.class, OpensyncExternalIntegrationCloud.class, | ||||
|         OpensyncExternalIntegrationCloudTest.Config.class, | ||||
| @Import(value = {AlarmServiceInterface.class, OpensyncExternalIntegrationCloud.class, OpensyncExternalIntegrationCloudTest.Config.class, | ||||
|  | ||||
| }) | ||||
| public class OpensyncExternalIntegrationCloudTest { | ||||
| @@ -133,7 +135,6 @@ public class OpensyncExternalIntegrationCloudTest { | ||||
|     @Autowired | ||||
|     OpensyncExternalIntegrationCloud opensyncExternalIntegrationCloud; | ||||
|  | ||||
|  | ||||
|     MockitoSession mockito; | ||||
|  | ||||
|     @Configuration | ||||
| @@ -194,25 +195,21 @@ public class OpensyncExternalIntegrationCloudTest { | ||||
|         ssidProfile.setDetails(SsidConfiguration.createWithDefaults()); | ||||
|  | ||||
|         apProfile.setChildProfileIds(ImmutableSet.of(ssidProfile.getId())); | ||||
|         Mockito.when(profileServiceInterface.create(ArgumentMatchers.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(ArgumentMatchers.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(ArgumentMatchers.anyInt(), ArgumentMatchers.anyLong(), | ||||
|                 ArgumentMatchers.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()); | ||||
|         Mockito.when(firmwareServiceInterface.getDefaultCustomerTrackSetting()).thenReturn(new CustomerFirmwareTrackSettings()); | ||||
|         CustomerFirmwareTrackRecord fwTrackRecord = new CustomerFirmwareTrackRecord(); | ||||
|         fwTrackRecord.setSettings(new CustomerFirmwareTrackSettings()); | ||||
|         fwTrackRecord.setTrackRecordId(3); | ||||
|         fwTrackRecord.setCustomerId(2); | ||||
|         Mockito.when(firmwareServiceInterface.getCustomerFirmwareTrackRecord(ArgumentMatchers.anyInt())) | ||||
|                 .thenReturn(fwTrackRecord); | ||||
|         Mockito.when(firmwareServiceInterface.getCustomerFirmwareTrackRecord(ArgumentMatchers.anyInt())).thenReturn(fwTrackRecord); | ||||
|  | ||||
|         Equipment equipment = new Equipment(); | ||||
|         equipment.setCustomerId(2); | ||||
| @@ -224,22 +221,16 @@ public class OpensyncExternalIntegrationCloudTest { | ||||
|         equipment.setDetails(ApElementConfiguration.createWithDefaults()); | ||||
|  | ||||
|         Mockito.when(equipmentServiceInterface.get(1L)).thenReturn(equipment); | ||||
|         Mockito.when( | ||||
|                 equipmentServiceInterface.getByInventoryIdOrNull(ArgumentMatchers.eq("Test_Client_21P10C68818122"))) | ||||
|                 .thenReturn(equipment); | ||||
|         Mockito.when(equipmentServiceInterface.getByInventoryIdOrNull(ArgumentMatchers.eq("Test_Client_21P10C68818122"))).thenReturn(equipment); | ||||
|  | ||||
|         Mockito.when(equipmentServiceInterface.create(ArgumentMatchers.any(Equipment.class))) | ||||
|                 .thenAnswer(i -> i.getArguments()[0]); | ||||
|         Mockito.when(equipmentServiceInterface.update(ArgumentMatchers.any(Equipment.class))) | ||||
|                 .thenAnswer(i -> i.getArguments()[0]); | ||||
|         Mockito.when(equipmentServiceInterface.create(ArgumentMatchers.any(Equipment.class))).thenAnswer(i -> i.getArguments()[0]); | ||||
|         Mockito.when(equipmentServiceInterface.update(ArgumentMatchers.any(Equipment.class))).thenAnswer(i -> i.getArguments()[0]); | ||||
|  | ||||
|         OvsdbSession session = Mockito.mock(OvsdbSession.class); | ||||
|  | ||||
|         Mockito.when(ovsdbSessionMapInterface.getSession("Test_Client_21P10C68818122")).thenReturn(session); | ||||
|  | ||||
|         opensyncExternalIntegrationCloud.apConnected("Test_Client_21P10C68818122", createConnectNodeInfo()); | ||||
|  | ||||
|  | ||||
|         Mockito.verify(firmwareServiceInterface).getDefaultCustomerTrackSetting(); | ||||
|         Mockito.verify(locationServiceInterface).get(8L); | ||||
|  | ||||
| @@ -288,8 +279,7 @@ public class OpensyncExternalIntegrationCloudTest { | ||||
|         childProfileIds.add(ssidProfile.getId()); | ||||
|         apProfile.setChildProfileIds(childProfileIds); | ||||
|  | ||||
|         Mockito.when(profileServiceInterface.create(ArgumentMatchers.any(Profile.class))).thenReturn(apProfile) | ||||
|                 .thenReturn(ssidProfile).thenReturn(rfProfile); | ||||
|         Mockito.when(profileServiceInterface.create(ArgumentMatchers.any(Profile.class))).thenReturn(apProfile).thenReturn(ssidProfile).thenReturn(rfProfile); | ||||
|         Mockito.when(profileServiceInterface.update(ArgumentMatchers.any(Profile.class))).thenReturn(apProfile); | ||||
|  | ||||
|         List<Profile> profileList = new ArrayList<>(); | ||||
| @@ -310,27 +300,21 @@ public class OpensyncExternalIntegrationCloudTest { | ||||
|  | ||||
|         Mockito.when(equipmentServiceInterface.get(1L)).thenReturn(equipment); | ||||
|  | ||||
|         Mockito.when(equipmentServiceInterface.create(ArgumentMatchers.any(Equipment.class))) | ||||
|                 .thenAnswer(i -> i.getArguments()[0]); | ||||
|         Mockito.when(equipmentServiceInterface.update(ArgumentMatchers.any(Equipment.class))) | ||||
|                 .thenAnswer(i -> i.getArguments()[0]); | ||||
|         Mockito.when( | ||||
|                 equipmentServiceInterface.getByInventoryIdOrNull(ArgumentMatchers.eq("Test_Client_21P10C68818122"))) | ||||
|                 .thenReturn(null); | ||||
|         Mockito.when(equipmentServiceInterface.create(ArgumentMatchers.any(Equipment.class))).thenAnswer(i -> i.getArguments()[0]); | ||||
|         Mockito.when(equipmentServiceInterface.update(ArgumentMatchers.any(Equipment.class))).thenAnswer(i -> i.getArguments()[0]); | ||||
|         Mockito.when(equipmentServiceInterface.getByInventoryIdOrNull(ArgumentMatchers.eq("Test_Client_21P10C68818122"))).thenReturn(null); | ||||
|  | ||||
|         Status fwStatus = new Status(); | ||||
|         fwStatus.setDetails(new EquipmentUpgradeStatusData()); | ||||
|         Mockito.when(statusServiceInterface.getOrNull(ArgumentMatchers.anyInt(), ArgumentMatchers.anyLong(), | ||||
|                 ArgumentMatchers.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()); | ||||
|         Mockito.when(firmwareServiceInterface.getDefaultCustomerTrackSetting()).thenReturn(new CustomerFirmwareTrackSettings()); | ||||
|         CustomerFirmwareTrackRecord fwTrackRecord = new CustomerFirmwareTrackRecord(); | ||||
|         fwTrackRecord.setSettings(new CustomerFirmwareTrackSettings()); | ||||
|         fwTrackRecord.setTrackRecordId(3); | ||||
|         fwTrackRecord.setCustomerId(2); | ||||
|         Mockito.when(firmwareServiceInterface.getCustomerFirmwareTrackRecord(ArgumentMatchers.anyInt())) | ||||
|                 .thenReturn(fwTrackRecord); | ||||
|         Mockito.when(firmwareServiceInterface.getCustomerFirmwareTrackRecord(ArgumentMatchers.anyInt())).thenReturn(fwTrackRecord); | ||||
|  | ||||
|         OvsdbSession session = Mockito.mock(OvsdbSession.class); | ||||
|  | ||||
| @@ -355,11 +339,9 @@ public class OpensyncExternalIntegrationCloudTest { | ||||
|         ssidProfile.setDetails(SsidConfiguration.createWithDefaults()); | ||||
|  | ||||
|         apProfile.setChildProfileIds(ImmutableSet.of(ssidProfile.getId())); | ||||
|         Mockito.when(profileServiceInterface.create(ArgumentMatchers.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(ArgumentMatchers.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); | ||||
| @@ -381,26 +363,20 @@ public class OpensyncExternalIntegrationCloudTest { | ||||
|         equipment.setDetails(ApElementConfiguration.createWithDefaults()); | ||||
|         Status fwStatus = new Status(); | ||||
|         fwStatus.setDetails(new EquipmentUpgradeStatusData()); | ||||
|         Mockito.when(statusServiceInterface.getOrNull(ArgumentMatchers.anyInt(), ArgumentMatchers.anyLong(), | ||||
|                 ArgumentMatchers.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()); | ||||
|         Mockito.when(firmwareServiceInterface.getDefaultCustomerTrackSetting()).thenReturn(new CustomerFirmwareTrackSettings()); | ||||
|         CustomerFirmwareTrackRecord fwTrackRecord = new CustomerFirmwareTrackRecord(); | ||||
|         fwTrackRecord.setSettings(new CustomerFirmwareTrackSettings()); | ||||
|         fwTrackRecord.setTrackRecordId(3); | ||||
|         fwTrackRecord.setCustomerId(2); | ||||
|         Mockito.when(firmwareServiceInterface.getCustomerFirmwareTrackRecord(ArgumentMatchers.anyInt())) | ||||
|                 .thenReturn(fwTrackRecord); | ||||
|         Mockito.when(firmwareServiceInterface.getCustomerFirmwareTrackRecord(ArgumentMatchers.anyInt())).thenReturn(fwTrackRecord); | ||||
|         Mockito.when(equipmentServiceInterface.get(1L)).thenReturn(equipment); | ||||
|  | ||||
|         Mockito.when(equipmentServiceInterface.create(ArgumentMatchers.any(Equipment.class))) | ||||
|                 .thenAnswer(i -> i.getArguments()[0]); | ||||
|         Mockito.when(equipmentServiceInterface.update(ArgumentMatchers.any(Equipment.class))) | ||||
|                 .thenAnswer(i -> i.getArguments()[0]); | ||||
|         Mockito.when( | ||||
|                 equipmentServiceInterface.getByInventoryIdOrNull(ArgumentMatchers.eq("Test_Client_21P10C68818122"))) | ||||
|                 .thenReturn(equipment); | ||||
|         Mockito.when(equipmentServiceInterface.create(ArgumentMatchers.any(Equipment.class))).thenAnswer(i -> i.getArguments()[0]); | ||||
|         Mockito.when(equipmentServiceInterface.update(ArgumentMatchers.any(Equipment.class))).thenAnswer(i -> i.getArguments()[0]); | ||||
|         Mockito.when(equipmentServiceInterface.getByInventoryIdOrNull(ArgumentMatchers.eq("Test_Client_21P10C68818122"))).thenReturn(equipment); | ||||
|  | ||||
|         Customer customer = new Customer(); | ||||
|         customer.setId(2); | ||||
| @@ -446,8 +422,7 @@ public class OpensyncExternalIntegrationCloudTest { | ||||
|         ssidProfile.setDetails(SsidConfiguration.createWithDefaults()); | ||||
|  | ||||
|         List<Profile> profileWithChildren = ImmutableList.of(apProfile, ssidProfile); | ||||
|         Mockito.when(profileServiceInterface.getProfileWithChildren(ArgumentMatchers.anyLong())) | ||||
|                 .thenReturn(profileWithChildren); | ||||
|         Mockito.when(profileServiceInterface.getProfileWithChildren(ArgumentMatchers.anyLong())).thenReturn(profileWithChildren); | ||||
|  | ||||
|         assertNotNull(opensyncExternalIntegrationCloud.getApConfig("Test_Client_21P10C68818122")); | ||||
|  | ||||
| @@ -473,8 +448,7 @@ public class OpensyncExternalIntegrationCloudTest { | ||||
|     @Test | ||||
|     public void testProcessMqttMessageStringReport() { | ||||
|  | ||||
|         Report report = Report.newBuilder().setNodeID("21P10C68818122") | ||||
|                 .addAllClients(getOpensyncStatsClientReportsList()) | ||||
|         Report report = Report.newBuilder().setNodeID("21P10C68818122").addAllClients(getOpensyncStatsClientReportsList()) | ||||
|                 .addAllEventReport(getOpensyncStatsEventReportsList()).build(); | ||||
|  | ||||
|         String topic = "/ap/Test_Client_21P10C68818122/opensync"; | ||||
| @@ -487,8 +461,8 @@ public class OpensyncExternalIntegrationCloudTest { | ||||
|         activeBssidsDetails.setActiveBSSIDs(getActiveBssidList()); | ||||
|         bssidStatus.setDetails(activeBssidsDetails); | ||||
|  | ||||
|         Mockito.when(statusServiceInterface.getOrNull(ArgumentMatchers.anyInt(), ArgumentMatchers.anyLong(), | ||||
|                 ArgumentMatchers.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(ArgumentMatchers.any(Status.class))).thenReturn(bssidStatus); | ||||
|         com.telecominfraproject.wlan.client.models.Client clientInstance = new com.telecominfraproject.wlan.client.models.Client(); | ||||
| @@ -497,12 +471,10 @@ public class OpensyncExternalIntegrationCloudTest { | ||||
|         com.telecominfraproject.wlan.client.models.Client clientInstance2 = new com.telecominfraproject.wlan.client.models.Client(); | ||||
|         clientInstance2.setMacAddress(MacAddress.valueOf("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); | ||||
|         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(MacAddress.valueOf("7C:AB:60:E6:EA:4D")); | ||||
| @@ -510,11 +482,10 @@ public class OpensyncExternalIntegrationCloudTest { | ||||
|         ClientSession clientSession2 = new ClientSession(); | ||||
|         clientSession2.setMacAddress(MacAddress.valueOf("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))) | ||||
|         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); | ||||
|     } | ||||
|  | ||||
|     @Ignore | ||||
| @@ -582,10 +553,10 @@ public class OpensyncExternalIntegrationCloudTest { | ||||
|  | ||||
|         OvsdbSession session = Mockito.mock(OvsdbSession.class); | ||||
|         Mockito.when(session.getEquipmentId()).thenReturn(1L); | ||||
|         Mockito.when(session.getCustomerId()).thenReturn(2); | ||||
|  | ||||
|         Equipment equipment = new Equipment(); | ||||
|         equipment.setCustomerId(1); | ||||
|         equipment.setCustomerId(2); | ||||
|         equipment.setId(1L); | ||||
|         equipment.setEquipmentType(EquipmentType.AP); | ||||
|         equipment.setInventoryId(apId); | ||||
|         equipment.setProfileId(1); | ||||
| @@ -617,15 +588,13 @@ public class OpensyncExternalIntegrationCloudTest { | ||||
|  | ||||
|         Mockito.when(ovsdbSessionMapInterface.getSession(apId)).thenReturn(session); | ||||
|  | ||||
|         opensyncExternalIntegrationCloud.wifiVIFStateDbTableUpdate(ImmutableList.of(vifState1, vifState2, vifState3), | ||||
|                 apId); | ||||
|         opensyncExternalIntegrationCloud.wifiVIFStateDbTableUpdate(ImmutableList.of(vifState1, vifState2, vifState3), apId); | ||||
|  | ||||
|         Mockito.verify(session).getCustomerId(); | ||||
|         Mockito.verify(session).getEquipmentId(); | ||||
|         Mockito.verify(ovsdbSessionMapInterface).getSession(apId); | ||||
|         Mockito.verify(equipmentServiceInterface).getOrNull(1L); | ||||
|  | ||||
|         Mockito.verify(statusServiceInterface).getOrNull(2, 1L, StatusDataType.CLIENT_DETAILS); | ||||
|  | ||||
|         Mockito.verify(statusServiceInterface).getOrNull(2, 1L, StatusDataType.ACTIVE_BSSIDS); | ||||
|         Mockito.verify(statusServiceInterface).update(clientStatus); | ||||
|  | ||||
| @@ -657,8 +626,7 @@ public class OpensyncExternalIntegrationCloudTest { | ||||
|         radioState3.setChannel(149); | ||||
|         radioState3.setVifStates(ImmutableSet.of(new Uuid(UUID.randomUUID()))); | ||||
|         radioState3.setFreqBand(RadioType.is5GHzL); | ||||
|         radioState3.setAllowedChannels( | ||||
|                 ImmutableSet.of(00, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165)); | ||||
|         radioState3.setAllowedChannels(ImmutableSet.of(00, 104, 108, 112, 116, 132, 136, 140, 144, 149, 153, 157, 161, 165)); | ||||
|         radioState3.setTxPower(32); | ||||
|         radioState3.setEnabled(true); | ||||
|         radioState3.setCountry("CA"); | ||||
| @@ -719,20 +687,18 @@ public class OpensyncExternalIntegrationCloudTest { | ||||
|  | ||||
|         OvsdbSession session = Mockito.mock(OvsdbSession.class); | ||||
|         Mockito.when(session.getEquipmentId()).thenReturn(1L); | ||||
|         Mockito.when(session.getCustomerId()).thenReturn(2); | ||||
|  | ||||
|         Mockito.when(ovsdbSessionMapInterface.getSession(apId)).thenReturn(session); | ||||
|  | ||||
|         opensyncExternalIntegrationCloud | ||||
|                 .wifiRadioStatusDbTableUpdate(ImmutableList.of(radioState1, radioState2, radioState3), apId); | ||||
|         opensyncExternalIntegrationCloud.wifiRadioStatusDbTableUpdate(ImmutableList.of(radioState1, radioState2, radioState3), apId); | ||||
|  | ||||
|         Mockito.verify(session).getCustomerId(); | ||||
|         Mockito.verify(session).getEquipmentId(); | ||||
|  | ||||
|         Mockito.verify(ovsdbSessionMapInterface).getSession(apId); | ||||
|         Mockito.verify(equipmentServiceInterface, Mockito.times(1)).getByInventoryIdOrNull(apId); | ||||
|         Mockito.verify(statusServiceInterface, Mockito.times(1)).getOrNull(1, 1L, StatusDataType.RADIO_CHANNEL); | ||||
|  | ||||
|         Mockito.verify(statusServiceInterface, Mockito.times(3)).getOrNull(2, 1L, StatusDataType.PROTOCOL); | ||||
|         Mockito.verify(statusServiceInterface, Mockito.times(3)).getOrNull(1, 1L, StatusDataType.PROTOCOL); | ||||
|         Mockito.verify(statusServiceInterface, Mockito.never()).update(bssidStatus); | ||||
|  | ||||
|     } | ||||
| @@ -754,6 +720,23 @@ public class OpensyncExternalIntegrationCloudTest { | ||||
|  | ||||
|     @Test | ||||
|     public void testWifiVIFStateDbTableDelete() { | ||||
|         String apId = "Test_Client_21P10C68818122"; | ||||
|  | ||||
|         Equipment equipment = new Equipment(); | ||||
|         equipment.setCustomerId(2); | ||||
|         equipment.setId(1L); | ||||
|         equipment.setEquipmentType(EquipmentType.AP); | ||||
|         equipment.setInventoryId(apId); | ||||
|         equipment.setProfileId(1); | ||||
|         equipment.setDetails(ApElementConfiguration.createWithDefaults()); | ||||
|  | ||||
|         Mockito.when(equipmentServiceInterface.getByInventoryIdOrNull(apId)).thenReturn(equipment); | ||||
|         Mockito.when(equipmentServiceInterface.getOrNull(1L)).thenReturn(equipment); | ||||
|  | ||||
|         OvsdbSession session = new OvsdbSession(); | ||||
|         session.setApId(apId); | ||||
|         session.setEquipmentId(1L); | ||||
|         Mockito.when(ovsdbSessionMapInterface.getSession(apId)).thenReturn(session); | ||||
|  | ||||
|         Status bssidStatus = new Status(); | ||||
|         bssidStatus.setStatusDataType(StatusDataType.ACTIVE_BSSIDS); | ||||
| @@ -763,16 +746,36 @@ public class OpensyncExternalIntegrationCloudTest { | ||||
|         activeBssidsDetails.setActiveBSSIDs(getActiveBssidList()); | ||||
|         bssidStatus.setDetails(activeBssidsDetails); | ||||
|  | ||||
|         Mockito.when(statusServiceInterface.getOrNull(ArgumentMatchers.anyInt(), ArgumentMatchers.anyLong(), | ||||
|                 ArgumentMatchers.eq(StatusDataType.ACTIVE_BSSIDS))).thenReturn(bssidStatus); | ||||
|         Mockito.when(statusServiceInterface.getOrNull(ArgumentMatchers.anyInt(), ArgumentMatchers.anyLong(), ArgumentMatchers.eq(StatusDataType.ACTIVE_BSSIDS))) | ||||
|                 .thenReturn(bssidStatus); | ||||
|         PaginationResponse<ClientSession> pr = Mockito.mock(PaginationResponse.class,Mockito.RETURNS_MOCKS); | ||||
|         Mockito.when(clientServiceInterface.getSessionsForCustomer(Mockito.anyInt(), Mockito.anySet(), | ||||
|                 Mockito.anySet(), Mockito.isNull(), Mockito.isNull(),  Mockito.any())).thenReturn(pr); | ||||
|  | ||||
|         opensyncExternalIntegrationCloud.wifiVIFStateDbTableDelete(ImmutableList.of(new OpensyncAPVIFState()), "apId"); | ||||
|  | ||||
|         opensyncExternalIntegrationCloud.wifiVIFStateDbTableDelete(ImmutableList.of(new OpensyncAPVIFState()), "Test_Client_21P10C68818122"); | ||||
|     } | ||||
|  | ||||
|     @Test | ||||
|     public void testWifiAssociatedClientsDbTableDelete() { | ||||
|         String apId = "Test_Client_21P10C68818122"; | ||||
|  | ||||
|         opensyncExternalIntegrationCloud.wifiAssociatedClientsDbTableDelete("7C:AB:60:E6:EA:4D", "apId"); | ||||
|         Equipment equipment = new Equipment(); | ||||
|         equipment.setCustomerId(2); | ||||
|         equipment.setId(1L); | ||||
|         equipment.setEquipmentType(EquipmentType.AP); | ||||
|         equipment.setInventoryId(apId); | ||||
|         equipment.setProfileId(1); | ||||
|         equipment.setDetails(ApElementConfiguration.createWithDefaults()); | ||||
|  | ||||
|         Mockito.when(equipmentServiceInterface.getByInventoryIdOrNull(apId)).thenReturn(equipment); | ||||
|         Mockito.when(equipmentServiceInterface.getOrNull(1L)).thenReturn(equipment); | ||||
|  | ||||
|         OvsdbSession session = new OvsdbSession(); | ||||
|         session.setApId(apId); | ||||
|         session.setEquipmentId(1L); | ||||
|         Mockito.when(ovsdbSessionMapInterface.getSession(apId)).thenReturn(session); | ||||
|         opensyncExternalIntegrationCloud.wifiAssociatedClientsDbTableDelete("7C:AB:60:E6:EA:4D", "Test_Client_21P10C68818122"); | ||||
|     } | ||||
|  | ||||
|     // Helper methods | ||||
| @@ -800,11 +803,9 @@ public class OpensyncExternalIntegrationCloudTest { | ||||
|         return bssidList; | ||||
|     } | ||||
|  | ||||
|  | ||||
|     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); | ||||
| @@ -832,29 +833,26 @@ public class OpensyncExternalIntegrationCloudTest { | ||||
|  | ||||
|         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(); | ||||
|         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(); | ||||
|         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); | ||||
| @@ -883,8 +881,7 @@ public class OpensyncExternalIntegrationCloudTest { | ||||
|         connectNodeInfo.skuNumber = "connectus.ai_21P10C68818122"; | ||||
|         connectNodeInfo.redirectorAddr = "ssl:opensync.zone1.art2wave.com:6643"; | ||||
|         connectNodeInfo.platformVersion = "OPENWRT_EA8300"; | ||||
|         connectNodeInfo.wifiRadioStates = ImmutableMap.of("2.4G", "home-ap-24", "5GL", "home-ap-l50", "5GU", | ||||
|                 "home-ap-u50"); | ||||
|         connectNodeInfo.wifiRadioStates = ImmutableMap.of("2.4G", "home-ap-24", "5GL", "home-ap-l50", "5GU", "home-ap-u50"); | ||||
|  | ||||
|         Map<String, String> versionMatrix = new HashMap<>(); | ||||
|         versionMatrix.put("DATE", "Thu Jul 16 18:52:06 UTC 2020"); | ||||
|   | ||||
| @@ -148,8 +148,12 @@ public class MqttStatsPublisherTest { | ||||
|     public void testExtractCustomerIdFromTopic() { | ||||
|         String topic = "/ap/Test_Client_21P10C68818122/opensync"; | ||||
|         OvsdbSession session = Mockito.mock(OvsdbSession.class); | ||||
|         Mockito.when(session.getCustomerId()).thenReturn(2); | ||||
|         Equipment ce = Mockito.mock(Equipment.class); | ||||
|         Mockito.when(ce.getCustomerId()).thenReturn(2); | ||||
|  | ||||
|         Mockito.when( | ||||
|                 equipmentServiceInterface.getByInventoryIdOrNull(ArgumentMatchers.eq("Test_Client_21P10C68818122"))) | ||||
|                 .thenReturn(ce); | ||||
|         Mockito.when(ovsdbSessionMapInterface.getSession("Test_Client_21P10C68818122")).thenReturn(session); | ||||
|  | ||||
|         assertEquals(2, opensyncExternalIntegrationMqttProcessor.extractCustomerIdFromTopic(topic)); | ||||
| @@ -173,8 +177,7 @@ public class MqttStatsPublisherTest { | ||||
|         Equipment equipment = new Equipment(); | ||||
|  | ||||
|         equipment.setDetails(ApElementConfiguration.createWithDefaults()); | ||||
|  | ||||
|         equipment.setId(1L); | ||||
|         equipment.setId(1L); equipment.setCustomerId(2); | ||||
|  | ||||
|         Mockito.when( | ||||
|                 equipmentServiceInterface.getByInventoryIdOrNull(ArgumentMatchers.eq("Test_Client_21P10C68818122"))) | ||||
| @@ -193,7 +196,6 @@ public class MqttStatsPublisherTest { | ||||
|  | ||||
|         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); | ||||
|  | ||||
|   | ||||
| @@ -33,12 +33,5 @@ public class OvsdbSession { | ||||
|     public void setEquipmentId(long equipmentId) { | ||||
|         this.equipmentId = equipmentId; | ||||
|     } | ||||
|     public int getCustomerId() { | ||||
|         return customerId; | ||||
|     } | ||||
|     public void setCustomerId(int customerId) { | ||||
|         this.customerId = customerId; | ||||
|     } | ||||
|      | ||||
|      | ||||
| } | ||||
|   | ||||
| @@ -259,6 +259,7 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface { | ||||
|             if (ovsdbDao.getDeviceStatsReportingInterval(ovsdbClient) != collectionIntervalSecDeviceStats) { | ||||
|                 ovsdbDao.updateDeviceStatsReportingInterval(ovsdbClient, collectionIntervalSecDeviceStats); | ||||
|             }         | ||||
|             ovsdbDao.enableNetworkProbeForSyntheticClient(ovsdbClient); | ||||
|             ovsdbDao.updateEventReportingInterval(ovsdbClient, collectionIntervalSecEvent); | ||||
|  | ||||
|         } else { | ||||
|   | ||||
| @@ -14,6 +14,7 @@ import com.vmware.ovsdb.protocol.operation.Operation; | ||||
| import com.vmware.ovsdb.protocol.operation.Update; | ||||
| import com.vmware.ovsdb.protocol.operation.notation.*; | ||||
| import com.vmware.ovsdb.protocol.operation.result.OperationResult; | ||||
| import com.vmware.ovsdb.protocol.schema.DatabaseSchema; | ||||
| import com.vmware.ovsdb.service.OvsdbClient; | ||||
| import org.springframework.beans.factory.annotation.Autowired; | ||||
| import org.springframework.stereotype.Component; | ||||
| @@ -39,6 +40,11 @@ public class OvsdbRadioConfig extends OvsdbDaoBase { | ||||
|         Map<String, WifiRadioConfigInfo> provisionedRadioConfigs = ovsdbGet.getProvisionedWifiRadioConfigs(ovsdbClient); | ||||
|         Map<String, WifiVifConfigInfo> vifConfigs = ovsdbGet.getProvisionedWifiVifConfigs(ovsdbClient); | ||||
|         List<Operation> operations = new ArrayList<>(); | ||||
|         try { | ||||
|             CompletableFuture<DatabaseSchema> cfDatabaseSchema = ovsdbClient.getSchema(ovsdbName); | ||||
|             DatabaseSchema databaseSchema = cfDatabaseSchema.get(); | ||||
|             Set<String> columnNames = databaseSchema.getTables().get(wifiRadioConfigDbTable).getColumns().keySet(); | ||||
|   | ||||
|             for (RadioType radioType : apElementConfiguration.getRadioMap().keySet()) { | ||||
|                 Map<String, String> hwConfig = new HashMap<>(); | ||||
|                 ElementRadioConfiguration elementRadioConfig = apElementConfiguration.getRadioMap().get(radioType); | ||||
| @@ -100,7 +106,7 @@ public class OvsdbRadioConfig extends OvsdbDaoBase { | ||||
|                 } | ||||
|                 try { | ||||
|                     configureWifiRadios(freqBand, channel, hwConfig, country.toUpperCase(), beaconInterval, enabled, hwMode, ht_mode, txPower, mimoMode, | ||||
|                         vifUuidsForRadio, operations, maxNumClients); | ||||
|                             vifUuidsForRadio, operations, maxNumClients,columnNames); | ||||
|                 } catch (OvsdbClientException e) { | ||||
|                     LOG.error("ConfigureWifiRadios failed with OvsdbClient exception.", e); | ||||
|                     throw new RuntimeException(e); | ||||
| @@ -115,7 +121,7 @@ public class OvsdbRadioConfig extends OvsdbDaoBase { | ||||
|                     throw new RuntimeException(e); | ||||
|                 } | ||||
|             } | ||||
|         try { | ||||
|  | ||||
|             CompletableFuture<OperationResult[]> fResult = ovsdbClient.transact(ovsdbName, operations); | ||||
|             OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS); | ||||
|             for (OperationResult res : result) { | ||||
| @@ -227,7 +233,7 @@ public class OvsdbRadioConfig extends OvsdbDaoBase { | ||||
|     } | ||||
|  | ||||
|     void configureWifiRadios(String freqBand, int channel, Map<String, String> hwConfig, String country, int beaconInterval, boolean enabled, String hwMode, | ||||
|             String ht_mode, int txPower, int mimoMode, Set<Uuid> vifUuidsForRadio, List<Operation> operations, int maxNumClients) | ||||
|             String ht_mode, int txPower, int mimoMode, Set<Uuid> vifUuidsForRadio, List<Operation> operations, int maxNumClients, Set<String> tableColumns) | ||||
|             throws OvsdbClientException, TimeoutException, ExecutionException, InterruptedException { | ||||
|         Map<String, Value> updateColumns = new HashMap<>(); | ||||
|         List<Condition> conditions = new ArrayList<>(); | ||||
| @@ -253,7 +259,7 @@ public class OvsdbRadioConfig extends OvsdbDaoBase { | ||||
|             updateColumns.put("hw_mode", new Atom<>(hwMode)); | ||||
|         } | ||||
|         configureCustomOptionsMap(maxNumClients, updateColumns); | ||||
|         setTxAndRxChainmask(mimoMode, updateColumns); | ||||
|         setTxAndRxChainmask(mimoMode, updateColumns,tableColumns); | ||||
|         if (vifUuidsForRadio.size() > 0) { | ||||
|             com.vmware.ovsdb.protocol.operation.notation.Set vifConfigUuids = com.vmware.ovsdb.protocol.operation.notation.Set.of(vifUuidsForRadio); | ||||
|             updateColumns.put("vif_configs", vifConfigUuids); | ||||
| @@ -270,7 +276,7 @@ public class OvsdbRadioConfig extends OvsdbDaoBase { | ||||
|         updateColumns.put("custom_options", customOptionsMap); | ||||
|     } | ||||
|  | ||||
|     void setTxAndRxChainmask(int mimoMode, Map<String, Value> updateColumns) { | ||||
|     void setTxAndRxChainmask(int mimoMode, Map<String, Value> updateColumns, Set<String> tableColumns) { | ||||
|         /* | ||||
|          * Chainmask is a bitmask, so map mimo mode values accordingly | ||||
|          * Note values 0, 1 remain unchanged | ||||
| @@ -314,7 +320,9 @@ public class OvsdbRadioConfig extends OvsdbDaoBase { | ||||
|                 break; | ||||
|         } | ||||
|         updateColumns.put("tx_chainmask", new Atom<>(mimoMode)); | ||||
|         if (tableColumns.contains("rx_chainmask")) { | ||||
|             updateColumns.put("rx_chainmask", new Atom<>(mimoMode)); | ||||
|         } | ||||
|     } | ||||
|  | ||||
| } | ||||
|   | ||||
| @@ -5,6 +5,7 @@ import java.util.ArrayList; | ||||
| import java.util.HashMap; | ||||
| import java.util.List; | ||||
| import java.util.Map; | ||||
| import java.util.Set; | ||||
| import java.util.concurrent.CompletableFuture; | ||||
| import java.util.concurrent.ExecutionException; | ||||
| import java.util.concurrent.TimeUnit; | ||||
| @@ -41,6 +42,7 @@ import com.vmware.ovsdb.protocol.operation.result.ErrorResult; | ||||
| import com.vmware.ovsdb.protocol.operation.result.InsertResult; | ||||
| import com.vmware.ovsdb.protocol.operation.result.OperationResult; | ||||
| import com.vmware.ovsdb.protocol.operation.result.UpdateResult; | ||||
| import com.vmware.ovsdb.protocol.schema.DatabaseSchema; | ||||
| import com.vmware.ovsdb.service.OvsdbClient; | ||||
|  | ||||
| @Component | ||||
| @@ -49,6 +51,7 @@ public class OvsdbRrmConfig extends OvsdbDaoBase { | ||||
|  | ||||
|         ApElementConfiguration apElementConfig = (ApElementConfiguration) opensyncApConfig.getCustomerEquipment().getDetails(); | ||||
|         RfConfiguration rfConfig = (RfConfiguration) opensyncApConfig.getRfProfile().getDetails(); | ||||
|  | ||||
|         for (RadioType radioType : apElementConfig.getRadioMap().keySet()) { | ||||
|             String freqBand = null; | ||||
|             if (radioType == RadioType.is2dot4GHz) { | ||||
| @@ -138,36 +141,46 @@ public class OvsdbRrmConfig extends OvsdbDaoBase { | ||||
|             int noiseFloorThresholdInDB, int noiseFloorThresholdTimeInSeconds, int nonWifiThresholdInPercentage, int nonWifiThresholdTimeInSeconds) | ||||
|             throws OvsdbClientException, TimeoutException, ExecutionException, InterruptedException { | ||||
|  | ||||
|         CompletableFuture<DatabaseSchema> cfDatabaseSchema = ovsdbClient.getSchema(ovsdbName); | ||||
|         DatabaseSchema databaseSchema = cfDatabaseSchema.get(); | ||||
|         Set<String> columnNames = databaseSchema.getTables().get(wifiRrmConfigDbTable).getColumns().keySet(); | ||||
|  | ||||
|         List<Operation> operations = new ArrayList<>(); | ||||
|         Map<String, Value> updateColumns = new HashMap<>(); | ||||
|  | ||||
|         updateColumns.put("freq_band", new Atom<>(freqBand)); | ||||
|         updateColumns.put("backup_channel", new Atom<>(backupChannel)); | ||||
|  | ||||
|         if (columnNames.contains("freq_band")) updateColumns.put("freq_band", new Atom<>(freqBand)); | ||||
|         if (columnNames.contains("backup_channel")) updateColumns.put("backup_channel", new Atom<>(backupChannel)); | ||||
|         if (columnNames.contains("mcast_rate")) { | ||||
|             if (multicastRate == null || multicastRate == MulticastRate.auto) { | ||||
|                 updateColumns.put("mcast_rate", new Atom<>(0)); | ||||
|             } else { | ||||
|                 updateColumns.put("mcast_rate", new Atom<>(multicastRate.getId())); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         if (columnNames.contains("probe_resp_threshold")) { | ||||
|             if (probeResponseThreshold == null) { | ||||
|                 updateColumns.put("probe_resp_threshold", new com.vmware.ovsdb.protocol.operation.notation.Set()); | ||||
|             } else { | ||||
|                 updateColumns.put("probe_resp_threshold", new Atom<>(probeResponseThreshold.intValue())); | ||||
|             } | ||||
|  | ||||
|         } | ||||
|         if (columnNames.contains("client_disconnect_threshold")) { | ||||
|             if (clientDisconnectThreshold == null) { | ||||
|                 updateColumns.put("client_disconnect_threshold", new com.vmware.ovsdb.protocol.operation.notation.Set()); | ||||
|             } else { | ||||
|                 updateColumns.put("client_disconnect_threshold", new Atom<>(clientDisconnectThreshold.intValue())); | ||||
|             } | ||||
|  | ||||
|         } | ||||
|         if (columnNames.contains("beacon_rate")) { | ||||
|             if (managementRate == null || managementRate == ManagementRate.auto) { | ||||
|                 updateColumns.put("beacon_rate", new Atom<>(0)); | ||||
|             } else { | ||||
|                 updateColumns.put("beacon_rate", new Atom<>(managementRate.getId() * 10)); | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         if (columnNames.contains("min_load") && columnNames.contains("snr_percentage_drop")) { | ||||
|             if (bestApSettings == null) { | ||||
|                 updateColumns.put("min_load", new com.vmware.ovsdb.protocol.operation.notation.Set()); | ||||
|                 updateColumns.put("snr_percentage_drop", new com.vmware.ovsdb.protocol.operation.notation.Set()); | ||||
| @@ -183,16 +196,22 @@ public class OvsdbRrmConfig extends OvsdbDaoBase { | ||||
|                     updateColumns.put("min_load", new Atom<>(bestApSettings.getMinLoadFactor())); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|  | ||||
|         if (obssHopMode != null) { | ||||
|         if (obssHopMode != null && columnNames.contains("obss_hop_mode")) | ||||
|  | ||||
|         { | ||||
|             updateColumns.put("obss_hop_mode", new Atom<>(obssHopMode.equals(OBSSHopMode.NON_WIFI) ? 1 : 2)); | ||||
|         } | ||||
|         if (columnNames.contains("noise_floor_thresh")) | ||||
|             updateColumns.put("noise_floor_thresh", new Atom<>(noiseFloorThresholdInDB)); | ||||
|         if (columnNames.contains("noise_floor_time")) | ||||
|             updateColumns.put("noise_floor_time", new Atom<>(noiseFloorThresholdTimeInSeconds)); | ||||
|         if (columnNames.contains("non_wifi_thresh")) | ||||
|             updateColumns.put("non_wifi_thresh", new Atom<>(nonWifiThresholdInPercentage)); | ||||
|         if (columnNames.contains("non_wifi_time")) | ||||
|             updateColumns.put("non_wifi_time", new Atom<>(nonWifiThresholdTimeInSeconds)); | ||||
|  | ||||
|  | ||||
|         Row row = new Row(updateColumns); | ||||
|         operations.add(new Insert(wifiRrmConfigDbTable, row)); | ||||
|  | ||||
|   | ||||
| @@ -63,7 +63,6 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|  | ||||
|             provisionWifiStatsConfigClient(radioConfigs, ovsdbGet.getProvisionedWifiStatsConfigs(ovsdbClient), | ||||
|                     operations); | ||||
|  | ||||
|             if (!operations.isEmpty()) { | ||||
|                 LOG.debug("Sending batch of operations : {} ", operations); | ||||
|  | ||||
| @@ -78,11 +77,7 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|                     } | ||||
|                 } | ||||
|             } | ||||
|  | ||||
|             // TODO: when schema support is added, these should be part of the | ||||
|             // bulk provisioning operation above. | ||||
|             provisionVideoVoiceStats(ovsdbClient); | ||||
|  | ||||
|         } catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { | ||||
|             throw new RuntimeException(e); | ||||
|         } | ||||
| @@ -248,7 +243,6 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|                     rowColumns.put("report_type", new Atom<>("raw")); | ||||
|                     rowColumns.put("sampling_interval", new Atom<>(10)); | ||||
|                     rowColumns.put("stats_type", new Atom<>("client")); | ||||
|                     rowColumns.put("survey_interval_ms", new Atom<>(65)); | ||||
|                     Row updateRow = new Row(rowColumns); | ||||
|                     operations.add(new Insert(wifiStatsConfigDbTable, updateRow)); | ||||
|  | ||||
| @@ -258,6 +252,7 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|  | ||||
|     } | ||||
|  | ||||
|  | ||||
|     void provisionWifiStatsConfigNeighbor(Map<String, Set<Integer>> allowedChannels, | ||||
|             Map<String, WifiRadioConfigInfo> radioConfigs, Map<String, WifiStatsConfigInfo> provisionedWifiStatsConfigs, | ||||
|             List<Operation> operations) { | ||||
| @@ -280,6 +275,7 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|                     rowColumns.put("reporting_interval", new Atom<>(defaultOffChannelReportingIntervalSeconds)); | ||||
|                     rowColumns.put("stats_type", new Atom<>("neighbor")); | ||||
|                     rowColumns.put("survey_type", new Atom<>("off-chan")); | ||||
|                     rowColumns.put("survey_interval_ms", new Atom<>(10)); | ||||
|  | ||||
|                     Row updateRow = new Row(rowColumns); | ||||
|                     operations.add(new Insert(wifiStatsConfigDbTable, updateRow)); | ||||
| @@ -299,6 +295,7 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|                     rowColumns.put("reporting_interval", new Atom<>(defaultReportingIntervalSeconds)); | ||||
|                     rowColumns.put("stats_type", new Atom<>("neighbor")); | ||||
|                     rowColumns.put("survey_type", new Atom<>("on-chan")); | ||||
|                     rowColumns.put("survey_interval_ms", new Atom<>(0)); | ||||
|  | ||||
|                     Row updateRow = new Row(rowColumns); | ||||
|                     operations.add(new Insert(wifiStatsConfigDbTable, updateRow)); | ||||
| @@ -354,8 +351,8 @@ public class OvsdbStatsConfig extends OvsdbDaoBase { | ||||
|                     rowColumns.put("report_type", new Atom<>("raw")); | ||||
|                     rowColumns.put("stats_type", new Atom<>("survey")); | ||||
|                     rowColumns.put("survey_type", new Atom<>("off-chan")); | ||||
|                     rowColumns.put("sampling_interval", new Atom<>(10)); | ||||
|                     rowColumns.put("survey_interval_ms", new Atom<>(50)); | ||||
|                     rowColumns.put("sampling_interval", new Atom<>(0)); | ||||
|                     rowColumns.put("survey_interval_ms", new Atom<>(10)); | ||||
|                     rowColumns.put("threshold", thresholds); | ||||
|                     Row updateRow = new Row(rowColumns); | ||||
|                     operations.add(new Insert(wifiStatsConfigDbTable, updateRow)); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Mike Hansen
					Mike Hansen