From 1d7f822ed41c31e802ce03008e91d373e2b378fe Mon Sep 17 00:00:00 2001 From: Mike Hansen Date: Mon, 2 Nov 2020 16:04:41 -0500 Subject: [PATCH] OpensyncGateway changes to only treat clients which appear in Wifi_Associated_Clients table as clients which can be added to the cloud's client and client session lists. Other changes through either stats changes or via other tables in ovsdb can only alter existing clients and sessions. Else they are ignored. SSIDs and InetConfig for SSIDs are not automatically deleted if an existing configuration for this AP containing profiles for the ssids exists on the cloud. --- .../OpensyncExternalIntegrationCloud.java | 280 ++++----- ...ternalIntegrationMqttMessageProcessor.java | 39 +- .../opensync/ovsdb/TipWlanOvsdbClient.java | 28 +- .../wlan/opensync/ovsdb/dao/OvsdbDao.java | 551 +++++++++--------- ...OpensyncGatewayTipWlanOvsdbClientTest.java | 2 +- 5 files changed, 416 insertions(+), 484 deletions(-) diff --git a/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloud.java b/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloud.java index 9c55b4a..ccd8039 100644 --- a/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloud.java +++ b/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationCloud.java @@ -336,9 +336,9 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra ce.getCustomerId(), ce.getId()); updateApStatus(ce, connectNodeInfo); - - removeNonWifiClients(ce,connectNodeInfo); - + + removeNonWifiClients(ce, connectNodeInfo); + OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(apId); ovsdbSession.setRoutingId(equipmentRoutingRecord.getId()); ovsdbSession.setEquipmentId(ce.getId()); @@ -1228,10 +1228,9 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra activeBssidsStatus = statusServiceInterface.update(activeBssidsStatus); - if (LOG.isTraceEnabled()) { - LOG.trace("Processing Wifi_VIF_State table update for AP {}, updated ACTIVE_BSSID Status {}", apId, - activeBssidsStatus.toPrettyString()); - } + LOG.info("Processing Wifi_VIF_State table update for AP {}, updated ACTIVE_BSSID Status {}", apId, + activeBssidsStatus); + } @Override @@ -1415,9 +1414,6 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra isReassociation = false; } - ClientInfoDetails clientDetails = (ClientInfoDetails) clientInstance.getDetails(); - - clientInstance.setDetails(clientDetails); clientInstance = clientServiceInterface.update(clientInstance); @@ -1432,16 +1428,13 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra clientSession.setLocationId(ce.getLocationId()); ClientSessionDetails clientSessionDetails = new ClientSessionDetails(); clientSessionDetails.setIsReassociation(isReassociation); - clientSessionDetails.setSessionId(clientInstance.getMacAddress().getAddressAsLong()); clientSession.setDetails(clientSessionDetails); - clientSession = clientServiceInterface.updateSession(clientSession); } ClientSessionDetails clientSessionDetails = clientSession.getDetails(); clientSessionDetails.setAssociationState(AssociationState._802_11_Associated); clientSessionDetails.setAssocTimestamp(System.currentTimeMillis()); - clientSessionDetails.setSessionId(clientInstance.getMacAddress().getAddressAsLong()); clientSession.getDetails().mergeSession(clientSessionDetails); clientSession = clientServiceInterface.updateSession(clientSession); @@ -1772,30 +1765,30 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra return; } - Set macAddressSet = new HashSet<>(); - macAddressSet.add(new MacAddress(deletedClientMac)); - List clientSessionList = clientServiceInterface.getSessions(customerId, macAddressSet); + com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId, + new MacAddress(deletedClientMac)); + ClientSession clientSession = clientServiceInterface.getSessionOrNull(customerId, equipmentId, + new MacAddress(deletedClientMac)); - for (ClientSession session : clientSessionList) { - - ClientSessionDetails clientSessionDetails = session.getDetails(); - - if ((clientSessionDetails.getAssociationState() != null) - && !clientSessionDetails.getAssociationState().equals(AssociationState.Disconnected)) { - clientSessionDetails.setDisconnectByClientTimestamp(System.currentTimeMillis()); - clientSessionDetails.setAssociationState(AssociationState.Disconnected); - - session.setDetails(clientSessionDetails); - session = clientServiceInterface.updateSession(session); - - if (LOG.isTraceEnabled()) { - LOG.trace("wifiAssociatedClientsDbTableDelete Updated client session, set to disconnected {}", - session.toPrettyString()); + if (client != null) { + if (clientSession != null) { + if (!clientSession.getDetails().getAssociationState().equals(AssociationState.Disconnected)) { + clientSession.getDetails().setAssociationState(AssociationState.Disconnected); + clientSession = clientServiceInterface.updateSession(clientSession); + LOG.info("Session {} for client {} is now disconnected.", clientSession, client.getMacAddress()); } } + } else { + if (clientSession != null) { + clientSession = clientServiceInterface.deleteSession(customerId, equipmentId, + new MacAddress(deletedClientMac)); + + LOG.info("No client {} found, delete session {}", new MacAddress(deletedClientMac), clientSession); + } } + } @Override @@ -1839,34 +1832,34 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra continue; } - MacAddress clientMacAddress = new MacAddress(dhcpLeasedIps.get("hwaddr")); - if (clientMacAddress.equals(equipmentServiceInterface.get(equipmentId).getBaseMacAddress())) { - LOG.info("Not a client device {} ", dhcpLeasedIps); - com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface - .getOrNull(customerId, clientMacAddress); - if (client != null) { - // In case somehow this equipment has accidentally been - // tagged as a client, remove - - ClientSession clientSession = clientServiceInterface.getSessionOrNull(customerId, equipmentId, - clientMacAddress); - - if (clientSession != null) { - LOG.info("Deleting invalid client session {}", - clientServiceInterface.deleteSession(customerId, equipmentId, clientMacAddress)); - } - - LOG.info("Deleting invalid client {}", - clientServiceInterface.delete(customerId, clientMacAddress)); - - } - continue; - } com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId, clientMacAddress); - if (client != null) { + + if (client == null) { + LOG.info("Cannot find client instance for {}", clientMacAddress); + continue; + } else if (clientMacAddress.equals(equipmentServiceInterface.get(equipmentId).getBaseMacAddress())) { + LOG.info("Not a client device {} ", dhcpLeasedIps); + + + // In case somehow this equipment has accidentally been + // tagged as a client, remove + + ClientSession clientSession = clientServiceInterface.getSessionOrNull(customerId, equipmentId, + clientMacAddress); + + if (clientSession != null) { + LOG.info("Deleting invalid client session {}", + clientServiceInterface.deleteSession(customerId, equipmentId, clientMacAddress)); + } + + LOG.info("Deleting invalid client {}", clientServiceInterface.delete(customerId, clientMacAddress)); + + + continue; + } else { LOG.info("Client {} already exists on the cloud, update client values", dhcpLeasedIps); ClientInfoDetails clientDetails = (ClientInfoDetails) client.getDetails(); @@ -1902,6 +1895,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra // In this case, we might have a session, as the client // already exists on the cloud, update if required + ClientSession session = updateClientSession(customerId, equipmentId, locationId, dhcpLeasedIps, clientMacAddress); if (session != null) { @@ -1909,15 +1903,61 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra } + } + } + + if (!clientSessionList.isEmpty()) { + LOG.info("Updating client sessions {}", clientSessionList); + clientSessionList = clientServiceInterface.updateSessions(clientSessionList); + LOG.info("Updated client sessions {}", clientSessionList); + } + + } else if (rowUpdateOperation.equals(RowUpdateOperation.MODIFY) + || rowUpdateOperation.equals(RowUpdateOperation.INIT)) { + + List clientSessionList = new ArrayList<>(); + + for (Map dhcpLeasedIps : dhcpAttributes) { + + if (!dhcpLeasedIps.containsKey("hwaddr")) { + + LOG.info("Cannot update a client {} that has no hwaddr.", dhcpLeasedIps); + continue; + + } + + MacAddress clientMacAddress = new MacAddress(dhcpLeasedIps.get("hwaddr")); + + com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId, + clientMacAddress); + if (client == null) { + LOG.info("Cannot find client instance for {}", clientMacAddress); + continue; + } else if (clientMacAddress.equals(equipmentServiceInterface.get(equipmentId).getBaseMacAddress())) { + + LOG.info("Not a client device {} ", dhcpLeasedIps); + + + // In case somehow this equipment has accidentally been + // tagged as a client, remove + + ClientSession clientSession = clientServiceInterface.getSessionOrNull(customerId, equipmentId, + clientMacAddress); + + if (clientSession != null) { + LOG.info("Deleting invalid client session {}", + clientServiceInterface.deleteSession(customerId, equipmentId, clientMacAddress)); + } + + LOG.info("Deleting invalid client {}", clientServiceInterface.delete(customerId, clientMacAddress)); + + + continue; + } else { - client = new com.telecominfraproject.wlan.client.models.Client(); - - client.setCustomerId(customerId); - client.setMacAddress(clientMacAddress); - - ClientInfoDetails clientDetails = new ClientInfoDetails(); + ClientInfoDetails clientDetails = (ClientInfoDetails) client.getDetails(); if (dhcpLeasedIps.containsKey("hostname")) { clientDetails.setHostName(dhcpLeasedIps.get("hostname")); @@ -1944,120 +1984,18 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra client.setDetails(clientDetails); - client = clientServiceInterface.create(client); + client = clientServiceInterface.update(client); - LOG.info("Created Client {}.", client); - } + LOG.info("Updated Client {}.", client); - // we might have a session, update if required - ClientSession session = updateClientSession(customerId, equipmentId, locationId, dhcpLeasedIps, - clientMacAddress); - if (session != null) { - clientSessionList.add(session); - } + // check if there is a session for this client - } - - if (!clientSessionList.isEmpty()) { - LOG.info("Updating client sessions {}", clientSessionList); - clientSessionList = clientServiceInterface.updateSessions(clientSessionList); - LOG.info("Updated client sessions {}", clientSessionList); - } - - } else if (rowUpdateOperation.equals(RowUpdateOperation.MODIFY) - || rowUpdateOperation.equals(RowUpdateOperation.INIT)) { - - List clientSessionList = new ArrayList<>(); - - for (Map dhcpLeasedIps : dhcpAttributes) { - - if (!dhcpLeasedIps.containsKey("hwaddr")) { - - LOG.info("Cannot update a client {} that has no hwaddr.", dhcpLeasedIps); - continue; - - } - - MacAddress clientMacAddress = new MacAddress(dhcpLeasedIps.get("hwaddr")); - - if (clientMacAddress.equals(equipmentServiceInterface.get(equipmentId).getBaseMacAddress())) { - - LOG.info("Not a client device {} ", dhcpLeasedIps); - com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface - .getOrNull(customerId, clientMacAddress); - if (client != null) { - - // In case somehow this equipment has accidentally been - // tagged as a client, remove - - ClientSession clientSession = clientServiceInterface.getSessionOrNull(customerId, equipmentId, - clientMacAddress); - - if (clientSession != null) { - LOG.info("Deleting invalid client session {}", - clientServiceInterface.deleteSession(customerId, equipmentId, clientMacAddress)); - } - - LOG.info("Deleting invalid client {}", - clientServiceInterface.delete(customerId, clientMacAddress)); + ClientSession session = updateClientSession(customerId, equipmentId, locationId, dhcpLeasedIps, + clientMacAddress); + if (session != null) { + clientSessionList.add(session); } - continue; - - } - - com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId, - clientMacAddress); - if (client == null) { - LOG.info("Client {} does not exist on the cloud. Creating...", dhcpLeasedIps); - client = new com.telecominfraproject.wlan.client.models.Client(); - client.setCustomerId(customerId); - client.setMacAddress(clientMacAddress); - ClientInfoDetails clientDetails = new ClientInfoDetails(); - - client.setDetails(clientDetails); - - client = clientServiceInterface.create(client); - - } - - ClientInfoDetails clientDetails = (ClientInfoDetails) client.getDetails(); - if (dhcpLeasedIps.containsKey("hostname")) { - - clientDetails.setHostName(dhcpLeasedIps.get("hostname")); - - } - - if (dhcpLeasedIps.containsKey("fingerprint")) { - - clientDetails.setApFingerprint(dhcpLeasedIps.get("fingerprint")); - } - - if (dhcpLeasedIps.containsKey("device_type")) { - - DhcpFpDeviceType dhcpFpDeviceType = DhcpFpDeviceType.getByName(dhcpLeasedIps.get("device_type")); - ClientType clientType = OvsdbToWlanCloudTypeMappingUtility - .getClientTypeForDhcpFpDeviceType(dhcpFpDeviceType); - - LOG.debug("Translate from ovsdb {} to cloud {}", dhcpFpDeviceType, clientType); - - clientDetails.setClientType(clientType.getId()); - - } - - client.setDetails(clientDetails); - - client = clientServiceInterface.update(client); - - LOG.info("Updated Client {}.", client); - - // check if there is a session for this client - - ClientSession session = updateClientSession(customerId, equipmentId, locationId, dhcpLeasedIps, - clientMacAddress); - if (session != null) { - clientSessionList.add(session); - } } @@ -2096,7 +2034,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra //         "manuf_id": if (session == null) { - session = new ClientSession(); + return null; } session.setCustomerId(customerId); session.setEquipmentId(equipmentId); diff --git a/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationMqttMessageProcessor.java b/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationMqttMessageProcessor.java index 189153b..7cfdfe6 100644 --- a/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationMqttMessageProcessor.java +++ b/opensync-ext-cloud/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationMqttMessageProcessor.java @@ -1891,8 +1891,8 @@ public class OpensyncExternalIntegrationMqttMessageProcessor { } } - void handleClientSessionMetricsUpdate(int customerId, long equipmentId, long locationId, RadioType radioType, - long timestamp, sts.OpensyncStats.Client client) { + ClientSession handleClientSessionMetricsUpdate(int customerId, long equipmentId, long locationId, + RadioType radioType, long timestamp, sts.OpensyncStats.Client client) { try { @@ -1904,13 +1904,10 @@ public class OpensyncExternalIntegrationMqttMessageProcessor { boolean isReassociation = true; if (clientInstance == null) { - clientInstance = new com.telecominfraproject.wlan.client.models.Client(); - clientInstance.setCustomerId(customerId); - clientInstance.setMacAddress(new MacAddress(client.getMacAddress())); - clientInstance.setDetails(new ClientInfoDetails()); - clientInstance = clientServiceInterface.create(clientInstance); - isReassociation = false; + LOG.info("Cannot get client instance for {}", client.getMacAddress()); + return null; + } LOG.info("Client {}", clientInstance); @@ -1919,18 +1916,8 @@ public class OpensyncExternalIntegrationMqttMessageProcessor { clientInstance.getMacAddress()); if (clientSession == null) { - - clientSession = new ClientSession(); - clientSession.setCustomerId(customerId); - clientSession.setEquipmentId(equipmentId); - clientSession.setLocationId(locationId); - clientSession.setMacAddress(clientInstance.getMacAddress()); - ClientSessionDetails clientSessionDetails = new ClientSessionDetails(); - clientSessionDetails.setSsid(client.getSsid()); - clientSessionDetails.setRadioType(radioType); - clientSessionDetails.setSessionId(clientInstance.getMacAddress().getAddressAsLong()); - clientSession.setDetails(new ClientSessionDetails()); - clientSession = clientServiceInterface.updateSession(clientSession); + LOG.info("Cannot get client session for {}", clientInstance.getMacAddress()); + return null; } ClientSessionDetails latestClientSessionDetails = clientSession.getDetails(); @@ -1961,7 +1948,6 @@ public class OpensyncExternalIntegrationMqttMessageProcessor { }).collect(Collectors.toList()); if (!ssidConfigList.isEmpty()) { - Profile ssidProfile = ssidConfigList.iterator().next(); SsidConfiguration ssidConfig = (SsidConfiguration) ssidProfile.getDetails(); if (ssidConfig.getSecureMode().equals(SecureMode.open)) { @@ -1979,7 +1965,6 @@ public class OpensyncExternalIntegrationMqttMessageProcessor { || ssidConfig.getSecureMode().equals(SecureMode.wpa2EAP) || ssidConfig.getSecureMode().equals(SecureMode.wpa2OnlyEAP)) { latestClientSessionDetails.setSecurityType(SecurityType.RADIUS); - latestClientSessionDetails.setEapDetails(new ClientEapDetails()); } else { latestClientSessionDetails.setSecurityType(SecurityType.UNSUPPORTED); @@ -2009,9 +1994,11 @@ public class OpensyncExternalIntegrationMqttMessageProcessor { LOG.debug("Updated client session {}", clientSession); + return clientSession; } catch (Exception e) { LOG.error("Error while attempting to create ClientSession and Info", e); } + return null; } ClientSessionMetricDetails calculateClientSessionMetricDetails(sts.OpensyncStats.Client client, long timestamp) { @@ -2134,9 +2121,11 @@ public class OpensyncExternalIntegrationMqttMessageProcessor { if (client.hasConnected() && client.getConnected() && client.hasMacAddress()) { // update metrics for connected client - numConnectedClients += 1; - handleClientSessionMetricsUpdate(customerId, equipmentId, locationId, radioType, + ClientSession session = handleClientSessionMetricsUpdate(customerId, equipmentId, locationId, radioType, clientReport.getTimestampMs(), client); + if (session != null) { + numConnectedClients += 1; + } } else { // Make sure, if we have a session for this client, // it @@ -2258,7 +2247,7 @@ public class OpensyncExternalIntegrationMqttMessageProcessor { ProfileContainer profileContainer = new ProfileContainer( profileServiceInterface.getProfileWithChildren(profileId)); RfConfiguration rfConfig = (RfConfiguration) profileContainer.getChildOfTypeOrNull(profileId, ProfileType.rf) - .getDetails(); + .getDetails(); for (Survey survey : report.getSurveyList()) { diff --git a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/TipWlanOvsdbClient.java b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/TipWlanOvsdbClient.java index 433ce5a..71c3a26 100644 --- a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/TipWlanOvsdbClient.java +++ b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/TipWlanOvsdbClient.java @@ -193,14 +193,15 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface { LOG.debug("Client {} connect for AP {}", clientCn, apId); - ovsdbDao.removeAllStatsConfigs(ovsdbClient); // always - ovsdbDao.removeAllSsids(ovsdbClient); // always - ovsdbDao.removeWifiRrm(ovsdbClient); - OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId); if (opensyncAPConfig != null) { + ovsdbDao.removeAllPasspointConfigs(ovsdbClient); + ovsdbDao.removeAllStatsConfigs(ovsdbClient); // always + ovsdbDao.removeAllSsids(ovsdbClient, opensyncAPConfig); // always + ovsdbDao.removeWifiRrm(ovsdbClient); ovsdbDao.configureWifiRadios(ovsdbClient, opensyncAPConfig); + ovsdbDao.configureInterfaces(ovsdbClient); ovsdbDao.configureSsids(ovsdbClient, opensyncAPConfig); ovsdbDao.configureWifiRrm(ovsdbClient, opensyncAPConfig); if (opensyncAPConfig.getHotspotConfig() != null) { @@ -210,10 +211,13 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface { if (((ApNetworkConfiguration) opensyncAPConfig.getApProfile().getDetails()).getSyntheticClientEnabled()) { ovsdbDao.enableNetworkProbeForSyntheticClient(ovsdbClient); } + } else { + ovsdbDao.removeAllPasspointConfigs(ovsdbClient); + ovsdbDao.removeAllStatsConfigs(ovsdbClient); // always + ovsdbDao.removeAllSsids(ovsdbClient); // always + ovsdbDao.removeWifiRrm(ovsdbClient); } - ovsdbDao.configureInterfaces(ovsdbClient); - if (ovsdbDao.getDeviceStatsReportingInterval(ovsdbClient) != collectionIntervalSecDeviceStats) { ovsdbDao.updateDeviceStatsReportingInterval(ovsdbClient, collectionIntervalSecDeviceStats); } @@ -262,18 +266,18 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface { return; } - ovsdbDao.removeAllSsids(ovsdbClient); // always + ovsdbDao.removeAllPasspointConfigs(ovsdbClient); + ovsdbDao.removeAllSsids(ovsdbClient, opensyncAPConfig); // always ovsdbDao.removeWifiRrm(ovsdbClient); ovsdbDao.removeAllStatsConfigs(ovsdbClient); // always ovsdbDao.configureWifiRadios(ovsdbClient, opensyncAPConfig); + ovsdbDao.configureInterfaces(ovsdbClient); ovsdbDao.configureSsids(ovsdbClient, opensyncAPConfig); ovsdbDao.configureWifiRrm(ovsdbClient, opensyncAPConfig); if (opensyncAPConfig.getHotspotConfig() != null) { ovsdbDao.configureHotspots(ovsdbClient, opensyncAPConfig); } - ovsdbDao.configureInterfaces(ovsdbClient); - ovsdbDao.configureStatsFromProfile(ovsdbClient, opensyncAPConfig); if (ovsdbDao.getDeviceStatsReportingInterval(ovsdbClient) != collectionIntervalSecDeviceStats) { ovsdbDao.updateDeviceStatsReportingInterval(ovsdbClient, collectionIntervalSecDeviceStats); @@ -507,7 +511,7 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface { private void monitorAwlanNodeDbTable(OvsdbClient ovsdbClient, String key) throws OvsdbClientException { CompletableFuture awCf = ovsdbClient.monitor(OvsdbDao.ovsdbName, OvsdbDao.awlanNodeDbTable + "_" + key, - new MonitorRequests(ImmutableMap.of(OvsdbDao.awlanNodeDbTable, new MonitorRequest())), + new MonitorRequests(ImmutableMap.of(OvsdbDao.awlanNodeDbTable, new MonitorRequest(new MonitorSelect(true, false, false, true)))), new MonitorCallback() { @Override @@ -615,7 +619,7 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface { CompletableFuture rsCf = ovsdbClient.monitor(OvsdbDao.ovsdbName, OvsdbDao.wifiRadioStateDbTable + "_" + key, - new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiRadioStateDbTable, new MonitorRequest())), + new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiRadioStateDbTable, new MonitorRequest(new MonitorSelect(true, false, false, true)))), new MonitorCallback() { @Override @@ -636,7 +640,7 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface { CompletableFuture vsCf = ovsdbClient.monitor(OvsdbDao.ovsdbName, OvsdbDao.wifiVifStateDbTable + "_" + key, - new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiVifStateDbTable, new MonitorRequest())), + new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiVifStateDbTable, new MonitorRequest(new MonitorSelect(true, true, true, true)))), new MonitorCallback() { @Override diff --git a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDao.java b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDao.java index c5d96ec..5d5fda6 100644 --- a/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDao.java +++ b/opensync-gateway/src/main/java/com/telecominfraproject/wlan/opensync/ovsdb/dao/OvsdbDao.java @@ -297,8 +297,10 @@ public class OvsdbDao { if ((ret.ipV4Address == null) || (ret.macAddress == null)) { // when not found - look them up for if_name = br-lan fillInWanIpAddressAndMac(ovsdbClient, ret, defaultLanInterfaceType, defaultLanInterfaceName); - - if (ret.ipV4Address == null) throw new RuntimeException("Could not get inet address for Lan and Wan network interfaces. Node is not ready to connect."); + + if (ret.ipV4Address == null) + throw new RuntimeException( + "Could not get inet address for Lan and Wan network interfaces. Node is not ready to connect."); } fillInLanIpAddressAndMac(ovsdbClient, ret, defaultLanInterfaceType); @@ -379,20 +381,20 @@ public class OvsdbDao { String radioFrequencyBand = getSingleValueFromSet(row, "freq_band"); switch (radioFrequencyBand) { - case "2.4G": - radios.add(RadioType.is2dot4GHz); - break; - case "5G": - radios.add(RadioType.is5GHz); - break; - case "5GL": - radios.add(RadioType.is5GHzL); - break; - case "5GU": - radios.add(RadioType.is5GHzU); - break; - default: - LOG.debug("Unsupported or unrecognized radio band type {}", radioFrequencyBand); + case "2.4G": + radios.add(RadioType.is2dot4GHz); + break; + case "5G": + radios.add(RadioType.is5GHz); + break; + case "5GL": + radios.add(RadioType.is5GHzL); + break; + case "5GU": + radios.add(RadioType.is5GHzU); + break; + default: + LOG.debug("Unsupported or unrecognized radio band type {}", radioFrequencyBand); } @@ -973,88 +975,6 @@ public class OvsdbDao { return ret; } - public Map getProvisionedPorts(OvsdbClient ovsdbClient) { - Map ret = new HashMap<>(); - - List operations = new ArrayList<>(); - List conditions = new ArrayList<>(); - List columns = new ArrayList<>(); - columns.add("name"); - columns.add("_uuid"); - columns.add("interfaces"); - - try { - LOG.debug("Retrieving Ports:"); - - operations.add(new Select(portDbTable, conditions, columns)); - CompletableFuture fResult = ovsdbClient.transact(ovsdbName, operations); - OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS); - - for (OperationResult res : result) { - LOG.debug("Op Result {}", res); - } - - for (Row row : ((SelectResult) result[0]).getRows()) { - - PortInfo portInfo = new PortInfo(); - portInfo.name = row.getStringColumn("name"); - portInfo.uuid = row.getUuidColumn("_uuid"); - portInfo.interfaceUuids = row.getSetColumn("interfaces"); - - ret.put(portInfo.name, portInfo); - } - - LOG.debug("Retrieved Ports: {}", ret); - - } catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) { - LOG.error("Error in getProvisionedPorts", e); - throw new RuntimeException(e); - } - - return ret; - } - - public Map getProvisionedBridges(OvsdbClient ovsdbClient) { - Map ret = new HashMap<>(); - - List operations = new ArrayList<>(); - List conditions = new ArrayList<>(); - List columns = new ArrayList<>(); - columns.add("name"); - columns.add("_uuid"); - columns.add("ports"); - - try { - LOG.debug("Retrieving Bridges:"); - - operations.add(new Select(bridgeDbTable, conditions, columns)); - CompletableFuture fResult = ovsdbClient.transact(ovsdbName, operations); - OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS); - - for (OperationResult res : result) { - LOG.debug("Op Result {}", res); - } - - for (Row row : ((SelectResult) result[0]).getRows()) { - - BridgeInfo bridgeInfo = new BridgeInfo(); - bridgeInfo.name = row.getStringColumn("name"); - bridgeInfo.uuid = row.getUuidColumn("_uuid"); - bridgeInfo.portUuids = row.getSetColumn("ports"); - - ret.put(bridgeInfo.name, bridgeInfo); - } - - LOG.debug("Retrieved Bridges: {}", ret); - - } catch (ExecutionException | InterruptedException | OvsdbClientException | TimeoutException e) { - LOG.error("Error in getProvisionedBridges", e); - throw new RuntimeException(e); - } - - return ret; - } - public Map getProvisionedCommandConfigs(OvsdbClient ovsdbClient) { Map ret = new HashMap<>(); @@ -1779,62 +1699,106 @@ public class OvsdbDao { } } - public void provisionBridgePortInterface(OvsdbClient ovsdbClient) { + public void removeAllSsids(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncAPConfig) { + Map currentWifiVifConfigInfo = getProvisionedWifiVifConfigs(ovsdbClient); + Map currentWifiRadioConfigInfo = getProvisionedWifiRadioConfigs(ovsdbClient); + + List vifConfigsToDelete = new ArrayList<>(); + + + for (Entry vifConfigInfo : currentWifiVifConfigInfo.entrySet()) { + LOG.debug("Checking {}", vifConfigInfo.getKey()); + WifiRadioConfigInfo radioConfigInfo = null; + if (vifConfigInfo.getValue().ifName.startsWith(defaultRadio0)) { + radioConfigInfo = currentWifiRadioConfigInfo.get(radio0); + } else if (vifConfigInfo.getValue().ifName.startsWith(defaultRadio1)) { + radioConfigInfo = currentWifiRadioConfigInfo.get(radio1); + } else if (vifConfigInfo.getValue().ifName.startsWith(defaultRadio2)) { + radioConfigInfo = currentWifiRadioConfigInfo.get(radio2); + } + boolean delete = true; + if (radioConfigInfo != null) { + final String freqBand = radioConfigInfo.freqBand; + if (radioConfigInfo.vifConfigUuids.contains(vifConfigInfo.getValue().uuid)) { + if (opensyncAPConfig.getSsidProfile().stream().anyMatch(new Predicate() { + + @Override + public boolean test(Profile t) { + SsidConfiguration ssidConfig = (SsidConfiguration) t.getDetails(); + return (ssidConfig.getSsid().equals(vifConfigInfo.getValue().ssid)) + && (ssidConfig.getAppliedRadios().contains(OvsdbToWlanCloudTypeMappingUtility + .getRadioTypeForOvsdbRadioFreqBand(freqBand))); + } + + })) { + delete = false; + LOG.debug("Do not delete vif {}", vifConfigInfo.getValue()); + } + + } + } + if (delete) { + vifConfigsToDelete.add(vifConfigInfo.getValue()); + } + + } + + LOG.debug("The following VIFs should be deleted {}", vifConfigsToDelete); + + + List operations = new ArrayList<>(); + + for (WifiVifConfigInfo vifConfigInfo : vifConfigsToDelete) { + List conditions = new ArrayList<>(); + conditions.add(new Condition("_uuid", Function.EQUALS, new Atom<>(vifConfigInfo.uuid))); + operations.add(new Delete(wifiVifConfigDbTable, conditions)); + } + try { + CompletableFuture fResult = ovsdbClient.transact(ovsdbName, operations); + OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS); - String patchW2h = "patch-w2h"; - String patchH2w = "patch-h2w"; - Map provisionedInterfaces = getProvisionedInterfaces(ovsdbClient); - if (provisionedInterfaces.isEmpty()) { - LOG.debug("No Interfaces defined in Ovsdb. Cannot perform Bridge/Port/Interface mapping."); - return; + if (LOG.isDebugEnabled()) { + LOG.debug("Removed existing SSIDs from {}:", wifiVifConfigDbTable); + + for (OperationResult res : result) { + LOG.debug("Op Result {}", res); + } } - LOG.debug("Existing Interfaces: {}", provisionedInterfaces.keySet()); - Map provisionedPorts = getProvisionedPorts(ovsdbClient); - if (provisionedInterfaces.isEmpty()) { - LOG.debug("No Ports defined in Ovsdb. Cannot perform Bridge/Port/Interface mapping."); - return; + operations = new ArrayList<>(); + // Add vifs to delete + for (WifiVifConfigInfo vifConfigInfo : vifConfigsToDelete) { + List conditions = new ArrayList<>(); + conditions.add(new Condition("if_name", Function.EQUALS, new Atom<>(vifConfigInfo.ifName))); + operations.add(new Delete(wifiInetConfigDbTable, conditions)); } - LOG.debug("Existing Ports: {}", provisionedPorts.keySet()); - Map provisionedBridges = getProvisionedBridges(ovsdbClient); - if (provisionedInterfaces.isEmpty()) { - LOG.debug("No Bridges defined in Ovsdb. Cannot perform Bridge/Port/Interface mapping."); - return; + fResult = ovsdbClient.transact(ovsdbName, operations); + result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS); + + if (LOG.isDebugEnabled()) { + LOG.debug("Removed existing InetConfigs from {}:", wifiVifConfigDbTable); + + for (OperationResult res : result) { + LOG.debug("Op Result {}", res); + } } - LOG.debug("Existing Bridges: {}", provisionedBridges.keySet()); + + - Map patchH2wOptions = new HashMap<>(); - patchH2wOptions.put("peer", "patch-w2h"); - - Map patchW2hOptions = new HashMap<>(); - patchH2wOptions.put("peer", "patch-h2w"); - - provisionSingleBridgePortInterface(ovsdbClient, patchH2w, bridgeNameVifInterfaces, "patch", patchH2wOptions, - provisionedInterfaces, provisionedPorts, provisionedBridges); - provisionSingleBridgePortInterface(ovsdbClient, patchW2h, defaultWanInterfaceType, "patch", patchW2hOptions, - provisionedInterfaces, provisionedPorts, provisionedBridges); - provisionSingleBridgePortInterface(ovsdbClient, defaultRadio0, bridgeNameVifInterfaces, "vif", null, - provisionedInterfaces, provisionedPorts, provisionedBridges); - provisionSingleBridgePortInterface(ovsdbClient, defaultRadio1, bridgeNameVifInterfaces, "vif", null, - provisionedInterfaces, provisionedPorts, provisionedBridges); - provisionSingleBridgePortInterface(ovsdbClient, defaultRadio2, bridgeNameVifInterfaces, "vif", null, - provisionedInterfaces, provisionedPorts, provisionedBridges); - - } catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { - LOG.error("Error in provisionBridgePortInterface", e); + } catch (OvsdbClientException | InterruptedException | ExecutionException | TimeoutException e) { + LOG.error("Error in removeAllSsids", e); throw new RuntimeException(e); } + } public void removeAllSsids(OvsdbClient ovsdbClient) { try { - removeAllHotspot20Config(ovsdbClient); - removeAllHotspot20OsuProviders(ovsdbClient); - removeAllHotspot20IconConfig(ovsdbClient); + removeAllPasspointConfigs(ovsdbClient); List operations = new ArrayList<>(); @@ -1893,6 +1857,12 @@ public class OvsdbDao { } + public void removeAllPasspointConfigs(OvsdbClient ovsdbClient) { + removeAllHotspot20Config(ovsdbClient); + removeAllHotspot20OsuProviders(ovsdbClient); + removeAllHotspot20IconConfig(ovsdbClient); + } + public void configureWifiRadios(OvsdbClient ovsdbClient, OpensyncAPConfig opensyncAPConfig) { String country = opensyncAPConfig.getCountryCode(); // should be the @@ -1913,23 +1883,23 @@ public class OvsdbDao { ChannelBandwidth bandwidth = rfElementConfig.getChannelBandwidth(); String ht_mode = null; switch (bandwidth) { - case is20MHz: - ht_mode = "HT20"; - break; - case is40MHz: - ht_mode = "HT40"; - break; - case is80MHz: - ht_mode = "HT80"; - break; - case is160MHz: - ht_mode = "HT160"; - break; - case auto: - ht_mode = "0"; - break; - default: - ht_mode = null; + case is20MHz: + ht_mode = "HT20"; + break; + case is40MHz: + ht_mode = "HT40"; + break; + case is80MHz: + ht_mode = "HT80"; + break; + case is160MHz: + ht_mode = "HT160"; + break; + case auto: + ht_mode = "0"; + break; + default: + ht_mode = null; } rfElementConfig.getAutoChannelSelection(); @@ -1946,75 +1916,75 @@ public class OvsdbDao { String hwMode = null; switch (rfElementConfig.getRadioMode()) { - case modeA: - hwMode = "11a"; - break; - case modeAB: - hwMode = "11ab"; - break; - case modeAC: - hwMode = "11ac"; - break; - case modeB: - hwMode = "11b"; - break; - case modeG: - hwMode = "11g"; - break; - case modeX: - hwMode = "11ax"; - break; - case modeN: - hwMode = "11n"; - break; - default: + case modeA: + hwMode = "11a"; + break; + case modeAB: + hwMode = "11ab"; + break; + case modeAC: + hwMode = "11ac"; + break; + case modeB: + hwMode = "11b"; + break; + case modeG: + hwMode = "11g"; + break; + case modeX: + hwMode = "11ax"; + break; + case modeN: + hwMode = "11n"; + break; + default: } String freqBand = null; switch (radioType) { - case is2dot4GHz: - freqBand = "2.4G"; - break; - case is5GHz: - // 802.11h dfs (Dynamic Frequency Selection) aka military - // and - // weather radar - // avoidance protocol - // Must not be disabled (by law) - // NA for 2.4GHz - hwConfig.put("dfs_enable", "1"); - hwConfig.put("dfs_ignorecac", "0"); - hwConfig.put("dfs_usenol", "1"); - freqBand = "5G"; + case is2dot4GHz: + freqBand = "2.4G"; + break; + case is5GHz: + // 802.11h dfs (Dynamic Frequency Selection) aka military + // and + // weather radar + // avoidance protocol + // Must not be disabled (by law) + // NA for 2.4GHz + hwConfig.put("dfs_enable", "1"); + hwConfig.put("dfs_ignorecac", "0"); + hwConfig.put("dfs_usenol", "1"); + freqBand = "5G"; - break; - case is5GHzL: - // 802.11h dfs (Dynamic Frequency Selection) aka military - // and - // weather radar - // avoidance protocol - // Must not be disabled (by law) - // NA for 2.4GHz - hwConfig.put("dfs_enable", "1"); - hwConfig.put("dfs_ignorecac", "0"); - hwConfig.put("dfs_usenol", "1"); - freqBand = "5GL"; + break; + case is5GHzL: + // 802.11h dfs (Dynamic Frequency Selection) aka military + // and + // weather radar + // avoidance protocol + // Must not be disabled (by law) + // NA for 2.4GHz + hwConfig.put("dfs_enable", "1"); + hwConfig.put("dfs_ignorecac", "0"); + hwConfig.put("dfs_usenol", "1"); + freqBand = "5GL"; - break; - case is5GHzU: - // 802.11h dfs (Dynamic Frequency Selection) aka military - // and - // weather radar - // avoidance protocol - // Must not be disabled (by law) - // NA for 2.4GHz - hwConfig.put("dfs_enable", "1"); - hwConfig.put("dfs_ignorecac", "0"); - hwConfig.put("dfs_usenol", "1"); - freqBand = "5GU"; + break; + case is5GHzU: + // 802.11h dfs (Dynamic Frequency Selection) aka military + // and + // weather radar + // avoidance protocol + // Must not be disabled (by law) + // NA for 2.4GHz + hwConfig.put("dfs_enable", "1"); + hwConfig.put("dfs_ignorecac", "0"); + hwConfig.put("dfs_usenol", "1"); + freqBand = "5GU"; - break; - default: // don't know this interface - continue; + break; + default: // don't know this interface + continue; } @@ -2137,20 +2107,20 @@ public class OvsdbDao { .equals(com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { String frequencyBand = row.getStringColumn("freq_band"); switch (frequencyBand) { - case "2.4G": - tableState.setFreqBand(RadioType.is2dot4GHz); - break; - case "5G": - tableState.setFreqBand(RadioType.is5GHz); - break; - case "5GL": - tableState.setFreqBand(RadioType.is5GHzL); - break; - case "5GU": - tableState.setFreqBand(RadioType.is5GHzU); - break; - default: - tableState.setFreqBand(RadioType.UNSUPPORTED); + case "2.4G": + tableState.setFreqBand(RadioType.is2dot4GHz); + break; + case "5G": + tableState.setFreqBand(RadioType.is5GHz); + break; + case "5GL": + tableState.setFreqBand(RadioType.is5GHzL); + break; + case "5GU": + tableState.setFreqBand(RadioType.is5GHzU); + break; + default: + tableState.setFreqBand(RadioType.UNSUPPORTED); } } if ((map.get("if_name") != null) && map.get("if_name").getClass() @@ -2615,7 +2585,7 @@ public class OvsdbDao { String ipAssignScheme, List macBlockList, boolean rateLimitEnable, int ssidDlLimit, int ssidUlLimit, int clientDlLimit, int clientUlLimit, int rtsCtsThreshold, int fragThresholdBytes, int dtimPeriod, Map captiveMap, List walledGardenAllowlist, - Map> bonjourServiceMap) { + Map> bonjourServiceMap, boolean isUpdate) { List operations = new ArrayList<>(); Map updateColumns = new HashMap<>(); @@ -2718,29 +2688,46 @@ public class OvsdbDao { updateBlockList(updateColumns, macBlockList); Row row = new Row(updateColumns); - operations.add(new Insert(wifiVifConfigDbTable, row)); + + + ////// + + if (isUpdate) { + List conditions = new ArrayList<>(); + + conditions.add(new Condition("if_name", Function.EQUALS, new Atom<>(vifInterfaceName))); + operations.add(new Update(wifiVifConfigDbTable, conditions, row)); + + } else { + operations.add(new Insert(wifiVifConfigDbTable, row)); + } CompletableFuture fResult = ovsdbClient.transact(ovsdbName, operations); OperationResult[] result = fResult.get(ovsdbTimeoutSec, TimeUnit.SECONDS); - LOG.debug("Provisioned SSID {} on {}", ssid, vifInterfaceName); - Uuid vifConfigUuid = null; - for (OperationResult res : result) { - LOG.debug("Op Result {}", res); - if (res instanceof InsertResult) { - vifConfigUuid = ((InsertResult) res).getUuid(); + if (isUpdate) { + for (OperationResult res : result) { + LOG.debug("Op Result {}", res); } + LOG.info("Updated existing SSID {} on interface {} / {}", ssid, vifInterfaceName, radioFreqBand); + } else { + Uuid vifConfigUuid = null; + for (OperationResult res : result) { + LOG.debug("Op Result {}", res); + if (res instanceof InsertResult) { + vifConfigUuid = ((InsertResult) res).getUuid(); + } + } + if (vifConfigUuid == null) { + throw new IllegalStateException("Wifi_VIF_Config entry was not created successfully"); + } + updateColumns.clear(); + operations.clear(); + updateVifConfigsSetForRadio(ovsdbClient, ssid, radioFreqBand, operations, updateColumns, vifConfigUuid); + LOG.info("Provisioned SSID {} on interface {} / {}", ssid, vifInterfaceName, radioFreqBand); } - if (vifConfigUuid == null) { - throw new IllegalStateException("Wifi_VIF_Config entry was not created successfully"); - } - updateColumns.clear(); - operations.clear(); - - updateVifConfigsSetForRadio(ovsdbClient, ssid, radioFreqBand, operations, updateColumns, vifConfigUuid); - Map inetConfigs = getProvisionedWifiInetConfigs(ovsdbClient); if (inetConfigs.containsKey(vifInterfaceName)) { @@ -2751,12 +2738,11 @@ public class OvsdbDao { (networkForwardMode == NetworkForwardMode.NAT)); } - LOG.info("Provisioned SSID {} on interface {} / {}", ssid, vifInterfaceName, radioFreqBand); - } catch (OvsdbClientException | TimeoutException | ExecutionException | InterruptedException e) { LOG.error("Error in configureSingleSsid", e); throw new RuntimeException(e); } + } private void updateBlockList(Map updateColumns, List macBlockList) { @@ -3093,25 +3079,39 @@ public class OvsdbDao { boolean enabled = ssidConfig.getSsidAdminState().equals(StateSetting.enabled); - int numberOfInterfaces = 0; - for (String key : getProvisionedWifiVifConfigs(ovsdbClient).keySet()) { - if (key.startsWith(ifName)) { - numberOfInterfaces++; - } - } - try { - if (numberOfInterfaces >= maxInterfacesPerRadio) { - // this cannot occur, log error, do not try to provision - throw new IllegalStateException( - "Cannot provision more than " + maxInterfacesPerRadio + " interfaces per Wifi Radio"); + boolean isUpdate = false; + Map provisionedVifs = getProvisionedWifiVifConfigs(ovsdbClient); + for (String key : provisionedVifs.keySet()) { + if (key.contains(ifName) && key.contains(ssidConfig.getSsid())) { + isUpdate = true; + ifName = provisionedVifs.get(key).ifName; + break; + } } - if (numberOfInterfaces > 0) { - // 1st interface has no number, 2nd has '_1', 3rd has - // '_2' etc. - ifName = ifName + "_" + numberOfInterfaces; + if (!isUpdate) { + int numberOfInterfaces = 0; + for (String key : getProvisionedWifiVifConfigs(ovsdbClient).keySet()) { + if (key.startsWith(ifName)) { + numberOfInterfaces++; + } + } + + if (numberOfInterfaces >= maxInterfacesPerRadio) { + // this cannot occur, log error, do not try to + // provision + throw new IllegalStateException("Cannot provision more than " + maxInterfacesPerRadio + + " interfaces per Wifi Radio"); + } + + if (numberOfInterfaces > 0) { + // 1st interface has no number, 2nd has '_1', 3rd + // has + // '_2' etc. + ifName = ifName + "_" + numberOfInterfaces; + } } configureSingleSsid(ovsdbClient, ifName, ssidConfig.getSsid(), ssidBroadcast, security, freqBand, @@ -3119,7 +3119,8 @@ public class OvsdbDao { enable80211k, minHwMode, enabled, keyRefresh, uapsdEnabled, apBridge, ssidConfig.getForwardMode(), gateway, inet, dns, ipAssignScheme, macBlockList, rateLimitEnable, ssidDlLimit, ssidUlLimit, clientDlLimit, clientUlLimit, rtsCtsThreshold, - fragThresholdBytes, dtimPeriod, captiveMap, walledGardenAllowlist, bonjourServiceMap); + fragThresholdBytes, dtimPeriod, captiveMap, walledGardenAllowlist, bonjourServiceMap, + isUpdate); } catch (IllegalStateException e) { // could not provision this SSID, but still can go on @@ -3317,15 +3318,15 @@ public class OvsdbDao { private String getCaptiveAuthentication(CaptivePortalAuthenticationType authentication) { switch (authentication) { - case guest: - return "None"; - case username: - return "Captive Portal User List"; - case radius: - return "RADIUS"; - default: - LOG.error("Unsupported captive portal authentication {}", authentication); - return "None"; + case guest: + return "None"; + case username: + return "Captive Portal User List"; + case radius: + return "RADIUS"; + default: + LOG.error("Unsupported captive portal authentication {}", authentication); + return "None"; } } diff --git a/opensync-gateway/src/test/java/com/telecominfraproject/wlan/opensync/ovsdb/OpensyncGatewayTipWlanOvsdbClientTest.java b/opensync-gateway/src/test/java/com/telecominfraproject/wlan/opensync/ovsdb/OpensyncGatewayTipWlanOvsdbClientTest.java index a320796..ed740a4 100644 --- a/opensync-gateway/src/test/java/com/telecominfraproject/wlan/opensync/ovsdb/OpensyncGatewayTipWlanOvsdbClientTest.java +++ b/opensync-gateway/src/test/java/com/telecominfraproject/wlan/opensync/ovsdb/OpensyncGatewayTipWlanOvsdbClientTest.java @@ -126,7 +126,7 @@ public class OpensyncGatewayTipWlanOvsdbClientTest { Mockito.verify(ovsdbSessionMapInterface).getSession("Test_Client_21P10C68818122"); Mockito.verify(ovsdbSession).getOvsdbClient(); Mockito.verify(opensyncExternalIntegrationInterface).getApConfig("Test_Client_21P10C68818122"); - Mockito.verify(ovsdbDao).removeAllSsids(ovsdbClient); + Mockito.verify(ovsdbDao).removeAllSsids(ovsdbClient, apConfig); Mockito.verify(ovsdbDao).removeAllStatsConfigs(ovsdbClient); Mockito.verify(ovsdbDao).configureWifiRadios(ovsdbClient, apConfig); Mockito.verify(ovsdbDao).configureSsids(ovsdbClient, apConfig);