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