mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-27 07:13:35 +00:00
WIFI-1247 OSGW needs to keep in sync the radio types reported by AP with the provisioned AP radio configuration -- add some logging and some checks in places where OSGW assumed to have values in equipments RadioMaps by default
This commit is contained in:
@@ -4,6 +4,7 @@ import java.net.Inet4Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -315,7 +316,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
if (apElementConfig == null) {
|
||||
apElementConfig = ApElementConfiguration.createWithDefaults();
|
||||
ce.setDetails(apElementConfig);
|
||||
needToUpdateEquipment = true;
|
||||
ce = equipmentServiceInterface.update(ce);
|
||||
apElementConfig = (ApElementConfiguration) ce.getDetails();
|
||||
}
|
||||
|
||||
if (apElementConfig.getDeviceName() == null
|
||||
@@ -333,76 +335,60 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
Map<RadioType, RadioConfiguration> advancedRadioMap = apElementConfig.getAdvancedRadioMap();
|
||||
Map<RadioType, ElementRadioConfiguration> radioMap = apElementConfig.getRadioMap();
|
||||
|
||||
if (advancedRadioMap == null) {
|
||||
advancedRadioMap = new HashMap<>();
|
||||
if (apElementConfig.getAdvancedRadioMap() == null) {
|
||||
advancedRadioMap = new EnumMap<>(RadioType.class);
|
||||
apElementConfig.setAdvancedRadioMap(advancedRadioMap);
|
||||
needToUpdateEquipment = true;
|
||||
}
|
||||
|
||||
if (radioMap == null) {
|
||||
radioMap = new HashMap<>();
|
||||
radioMap = new EnumMap<>(RadioType.class);
|
||||
apElementConfig.setRadioMap(radioMap);
|
||||
needToUpdateEquipment = true;
|
||||
}
|
||||
|
||||
Set<RadioType> radiosFromAp = new HashSet<>();
|
||||
connectNodeInfo.wifiRadioStates.keySet().forEach(k -> {
|
||||
radiosFromAp.add(OvsdbToWlanCloudTypeMappingUtility.getRadioTypeForOvsdbRadioFreqBand(k));
|
||||
});
|
||||
|
||||
// add missing radio configs from the AP into the DB
|
||||
for (String radio : connectNodeInfo.wifiRadioStates.keySet()) {
|
||||
RadioType radioType = RadioType.UNSUPPORTED;
|
||||
if (radio.equals("2.4G")) {
|
||||
radioType = RadioType.is2dot4GHz;
|
||||
} else if (radio.equals("5G")) {
|
||||
radioType = RadioType.is5GHz;
|
||||
} else if (radio.equals("5GL")) {
|
||||
radioType = RadioType.is5GHzL;
|
||||
} else if (radio.equals("5GU")) {
|
||||
radioType = RadioType.is5GHzU;
|
||||
}
|
||||
|
||||
if (!radioType.equals(RadioType.UNSUPPORTED)) {
|
||||
|
||||
radiosFromAp.add(radioType);
|
||||
|
||||
RadioConfiguration advancedRadioConfiguration = advancedRadioMap.get(radioType);
|
||||
ElementRadioConfiguration radioConfiguration = radioMap.get(radioType);
|
||||
|
||||
if (advancedRadioConfiguration == null) {
|
||||
advancedRadioConfiguration = RadioConfiguration.createWithDefaults(radioType);
|
||||
advancedRadioMap.put(radioType, advancedRadioConfiguration);
|
||||
for (RadioType radio : radiosFromAp) {
|
||||
if (!advancedRadioMap.containsKey(radio) || advancedRadioMap.get(radio) == null) {
|
||||
advancedRadioMap.put(radio, RadioConfiguration.createWithDefaults(radio));
|
||||
needToUpdateEquipment = true;
|
||||
}
|
||||
|
||||
if (radioConfiguration == null) {
|
||||
radioConfiguration = ElementRadioConfiguration.createWithDefaults(radioType);
|
||||
radioMap.put(radioType, radioConfiguration);
|
||||
if (!radioMap.containsKey(radio) || radioMap.get(radio) == null) {
|
||||
radioMap.putIfAbsent(radio, ElementRadioConfiguration.createWithDefaults(radio));
|
||||
needToUpdateEquipment = true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// remove radio configs from the DB that are no longer
|
||||
// present in the AP but still exist in DB
|
||||
for (RadioType radioType : RadioType.validValues()) {
|
||||
|
||||
RadioConfiguration advancedRadioConfiguration = advancedRadioMap.get(radioType);
|
||||
|
||||
if (advancedRadioConfiguration != null || !radiosFromAp.contains(radioType)) {
|
||||
advancedRadioMap.remove(radioType);
|
||||
for (RadioType radio : advancedRadioMap.keySet()) {
|
||||
if (!radiosFromAp.contains(radio)) {
|
||||
advancedRadioMap.remove(radio);
|
||||
needToUpdateEquipment = true;
|
||||
}
|
||||
|
||||
ElementRadioConfiguration radioConfiguration = radioMap.get(radioType);
|
||||
if (radioConfiguration != null || !radiosFromAp.contains(radioType)) {
|
||||
radioMap.remove(radioType);
|
||||
}
|
||||
for (RadioType radio : radioMap.keySet()) {
|
||||
if (!radiosFromAp.contains(radio)) {
|
||||
radioMap.remove(radio);
|
||||
needToUpdateEquipment = true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (needToUpdateEquipment) {
|
||||
|
||||
apElementConfig.setAdvancedRadioMap(advancedRadioMap);
|
||||
apElementConfig.setRadioMap(radioMap);
|
||||
ce.setDetails(apElementConfig);
|
||||
|
||||
ce = equipmentServiceInterface.update(ce);
|
||||
apElementConfig = (ApElementConfiguration) ce.getDetails();
|
||||
LOG.info("Equipment {} values for RadioMap {} AdvancedRadioMap {}", ce.getName(),
|
||||
apElementConfig.getRadioMap(), apElementConfig.getAdvancedRadioMap());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -947,7 +933,6 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
throw new IllegalStateException("AP is not connected " + apId);
|
||||
}
|
||||
int customerId = ovsdbSession.getCustomerId();
|
||||
|
||||
Equipment equipmentConfig = equipmentServiceInterface.getByInventoryIdOrNull(apId);
|
||||
if (equipmentConfig == null) {
|
||||
throw new IllegalStateException("Cannot retrieve configuration for " + apId);
|
||||
@@ -1075,7 +1060,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
return;
|
||||
}
|
||||
|
||||
Equipment apNode = equipmentServiceInterface.getByInventoryIdOrNull(apId);
|
||||
Equipment apNode = equipmentServiceInterface.getOrNull(equipmentId);
|
||||
if (apNode == null) {
|
||||
LOG.debug("wifiVIFStateDbTableUpdate::Cannot get EquipmentId for AP {}", apId);
|
||||
return; // we don't have the required info to get the
|
||||
@@ -1120,6 +1105,11 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
RadioType radioType = null;
|
||||
Map<RadioType, RfElementConfiguration> rfElementMap = rfConfig.getRfConfigMap();
|
||||
Map<RadioType, ElementRadioConfiguration> elementRadioMap = apElementConfig.getRadioMap();
|
||||
|
||||
if (apElementConfig.getAdvancedRadioMap().isEmpty()) {
|
||||
LOG.warn("No AdvancedRadioMap for ap {} {}", apId, apElementConfig);
|
||||
continue;
|
||||
}
|
||||
for (RadioType rType : elementRadioMap.keySet()) {
|
||||
boolean autoChannelSelection = rfElementMap.get(rType).getAutoChannelSelection();
|
||||
if (elementRadioMap.get(rType).getActiveChannel(autoChannelSelection) == channel) {
|
||||
@@ -1134,12 +1124,13 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
|
||||
Status activeBssidsStatus = statusServiceInterface.getOrNull(customerId, equipmentId,
|
||||
StatusDataType.ACTIVE_BSSIDS);
|
||||
|
||||
if (activeBssidsStatus != null) {
|
||||
ActiveBSSIDs bssidStatusDetails = (ActiveBSSIDs) activeBssidsStatus.getDetails();
|
||||
|
||||
if (activeBssidsStatus != null && bssidStatusDetails != null && bssidStatusDetails.getActiveBSSIDs() != null) {
|
||||
if (bssidStatusDetails != null && bssidStatusDetails.getActiveBSSIDs() != null) {
|
||||
updateClientDetailsStatus(customerId, equipmentId, bssidStatusDetails);
|
||||
}
|
||||
}
|
||||
|
||||
LOG.info("Finished wifiVIFStateDbTableUpdate updated {}", activeBssidsStatus);
|
||||
|
||||
@@ -1167,7 +1158,10 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
|
||||
Map<RadioType, Integer> clientsPerRadioType = new HashMap<>();
|
||||
|
||||
for (ActiveBSSID bssid : statusDetails.getActiveBSSIDs()) {
|
||||
|
||||
if (bssid.getRadioType() == null) {
|
||||
LOG.info("No radio type for BSSID, ignore");
|
||||
continue;
|
||||
}
|
||||
if (!clientsPerRadioType.containsKey(bssid.getRadioType())) {
|
||||
clientsPerRadioType.put(bssid.getRadioType(), 0);
|
||||
}
|
||||
|
||||
@@ -1805,16 +1805,10 @@ public class MqttStatsPublisher {
|
||||
|
||||
Status activeBssidsStatus = statusServiceInterface.getOrNull(customerId, equipmentId,
|
||||
StatusDataType.ACTIVE_BSSIDS);
|
||||
ActiveBSSIDs statusDetails = null;
|
||||
if (activeBssidsStatus != null) {
|
||||
statusDetails = (ActiveBSSIDs) activeBssidsStatus.getDetails();
|
||||
if (activeBssidsStatus != null && activeBssidsStatus.getDetails() != null && ((ActiveBSSIDs) activeBssidsStatus.getDetails()).getActiveBSSIDs() != null) {
|
||||
for (ActiveBSSID activeBSSID : ((ActiveBSSIDs) activeBssidsStatus.getDetails()).getActiveBSSIDs()) {
|
||||
if (activeBSSID.getRadioType().equals(radioType)) {
|
||||
ssidStatistics.setBssid(MacAddress.valueOf(activeBSSID.getBssid()));
|
||||
// ssid value, in case not in stats, else will take
|
||||
// stats value after
|
||||
ssid = activeBSSID.getSsid();
|
||||
statusDetails.getActiveBSSIDs().indexOf(activeBSSID);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1905,8 +1899,6 @@ public class MqttStatsPublisher {
|
||||
|
||||
}
|
||||
|
||||
// we can only get Rssi as an unsigned int from opensync, so some
|
||||
// shifting
|
||||
ssidStatistics.setRxLastRssi(lastRssi);
|
||||
ssidStatistics.setNumRxData(Long.valueOf(rxFrames).intValue());
|
||||
ssidStatistics.setRxBytes(rxBytes - rxErrors - rxRetries);
|
||||
|
||||
@@ -588,7 +588,7 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
equipment.setProfileId(1);
|
||||
equipment.setDetails(ApElementConfiguration.createWithDefaults());
|
||||
|
||||
Mockito.when(equipmentServiceInterface.getByInventoryIdOrNull(apId)).thenReturn(equipment);
|
||||
Mockito.when(equipmentServiceInterface.getOrNull(1L)).thenReturn(equipment);
|
||||
Mockito.when(equipmentServiceInterface.get(equipment.getId())).thenReturn(equipment);
|
||||
Mockito.when(equipmentServiceInterface.update(equipment)).thenReturn(equipment);
|
||||
|
||||
@@ -620,7 +620,7 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
Mockito.verify(session).getCustomerId();
|
||||
Mockito.verify(session).getEquipmentId();
|
||||
Mockito.verify(ovsdbSessionMapInterface).getSession(apId);
|
||||
Mockito.verify(equipmentServiceInterface).getByInventoryIdOrNull(apId);
|
||||
Mockito.verify(equipmentServiceInterface).getOrNull(1L);
|
||||
|
||||
Mockito.verify(statusServiceInterface).getOrNull(2, 1L, StatusDataType.CLIENT_DETAILS);
|
||||
Mockito.verify(statusServiceInterface).getOrNull(2, 1L, StatusDataType.ACTIVE_BSSIDS);
|
||||
|
||||
@@ -133,17 +133,10 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
||||
|
||||
@Override
|
||||
public void disconnected(OvsdbClient ovsdbClient) {
|
||||
String remoteHost = ovsdbClient.getConnectionInfo().getRemoteAddress().getHostAddress();
|
||||
int localPort = ovsdbClient.getConnectionInfo().getLocalPort();
|
||||
String subjectDn = null;
|
||||
try {
|
||||
subjectDn = ((X509Certificate) ovsdbClient.getConnectionInfo().getRemoteCertificate())
|
||||
.getSubjectDN().getName();
|
||||
} catch (Exception e) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
String clientCn = SslUtil.extractCN(subjectDn);
|
||||
String remoteHost;
|
||||
int localPort;
|
||||
String clientCn;
|
||||
|
||||
// disconnected - deregister ovsdbClient from our
|
||||
// connectedClients table
|
||||
@@ -153,22 +146,40 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
||||
// so we are doing a reverse lookup here, and then if we find
|
||||
// the key we will
|
||||
// remove the entry from the connectedClients.
|
||||
String key = ovsdbSessionMapInterface.lookupClientId(ovsdbClient);
|
||||
String key;
|
||||
|
||||
try {
|
||||
remoteHost = ovsdbClient.getConnectionInfo().getRemoteAddress().getHostAddress();
|
||||
localPort = ovsdbClient.getConnectionInfo().getLocalPort();
|
||||
String subjectDn = null;
|
||||
try {
|
||||
subjectDn = ((X509Certificate) ovsdbClient.getConnectionInfo().getRemoteCertificate())
|
||||
.getSubjectDN().getName();
|
||||
} catch (Exception e) {
|
||||
// do nothing
|
||||
}
|
||||
clientCn = SslUtil.extractCN(subjectDn);
|
||||
key = ovsdbSessionMapInterface.lookupClientId(ovsdbClient);
|
||||
if (key != null) {
|
||||
try {
|
||||
extIntegrationInterface.apDisconnected(key);
|
||||
ovsdbSessionMapInterface.removeSession(key);
|
||||
} catch (Exception e) {
|
||||
LOG.debug("Unable to process ap disconnect. {}", e.getMessage());
|
||||
} finally {
|
||||
ovsdbClient.shutdown();
|
||||
}
|
||||
}
|
||||
|
||||
LOG.info("ovsdbClient disconnected from {} on port {} clientCn {} AP {} ", remoteHost, localPort,
|
||||
clientCn, key);
|
||||
LOG.info("ovsdbClient connectedClients = {}", ovsdbSessionMapInterface.getNumSessions());
|
||||
} finally {
|
||||
try {
|
||||
ovsdbClient.shutdown();
|
||||
} catch (Exception e) {
|
||||
LOG.info("Caught Exception shutting down ovsdb client, may have already been disconnected {}",
|
||||
e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -274,10 +285,8 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
||||
ovsdbDao.removeWifiRrm(ovsdbClient);
|
||||
ovsdbDao.removeAllStatsConfigs(ovsdbClient); // always
|
||||
|
||||
|
||||
extIntegrationInterface.clearEquipmentStatus(apId);
|
||||
|
||||
|
||||
ovsdbDao.configureWifiRadios(ovsdbClient, opensyncAPConfig);
|
||||
ovsdbDao.configureWifiRrm(ovsdbClient, opensyncAPConfig);
|
||||
ovsdbDao.configureGreTunnels(ovsdbClient, opensyncAPConfig);
|
||||
@@ -425,16 +434,19 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
||||
}
|
||||
|
||||
if (!insert.isEmpty()) {
|
||||
extIntegrationInterface.dhcpLeasedIpDbTableUpdate(insert, key, RowUpdateOperation.INSERT);
|
||||
extIntegrationInterface.dhcpLeasedIpDbTableUpdate(insert, key,
|
||||
RowUpdateOperation.INSERT);
|
||||
}
|
||||
|
||||
if (!delete.isEmpty()) {
|
||||
extIntegrationInterface.dhcpLeasedIpDbTableUpdate(delete, key, RowUpdateOperation.DELETE);
|
||||
extIntegrationInterface.dhcpLeasedIpDbTableUpdate(delete, key,
|
||||
RowUpdateOperation.DELETE);
|
||||
|
||||
}
|
||||
|
||||
if (!update.isEmpty()) {
|
||||
extIntegrationInterface.dhcpLeasedIpDbTableUpdate(update, key, RowUpdateOperation.MODIFY);
|
||||
extIntegrationInterface.dhcpLeasedIpDbTableUpdate(update, key,
|
||||
RowUpdateOperation.MODIFY);
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -504,16 +516,19 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
||||
}
|
||||
|
||||
if (!insert.isEmpty()) {
|
||||
extIntegrationInterface.commandStateDbTableUpdate(insert, key, RowUpdateOperation.INSERT);
|
||||
extIntegrationInterface.commandStateDbTableUpdate(insert, key,
|
||||
RowUpdateOperation.INSERT);
|
||||
}
|
||||
|
||||
if (!delete.isEmpty()) {
|
||||
extIntegrationInterface.commandStateDbTableUpdate(delete, key, RowUpdateOperation.DELETE);
|
||||
extIntegrationInterface.commandStateDbTableUpdate(delete, key,
|
||||
RowUpdateOperation.DELETE);
|
||||
|
||||
}
|
||||
|
||||
if (!update.isEmpty()) {
|
||||
extIntegrationInterface.commandStateDbTableUpdate(update, key, RowUpdateOperation.MODIFY);
|
||||
extIntegrationInterface.commandStateDbTableUpdate(update, key,
|
||||
RowUpdateOperation.MODIFY);
|
||||
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -529,27 +544,28 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
||||
}
|
||||
|
||||
private void monitorAwlanNodeDbTable(OvsdbClient ovsdbClient, String key) throws OvsdbClientException {
|
||||
CompletableFuture<TableUpdates> awCf = ovsdbClient.monitor(OvsdbDao.ovsdbName,
|
||||
OvsdbDao.awlanNodeDbTable + "_" + key,
|
||||
new MonitorRequests(ImmutableMap.of(OvsdbDao.awlanNodeDbTable, new MonitorRequest(new MonitorSelect(true, true, true, true)))),
|
||||
CompletableFuture<TableUpdates> awCf = ovsdbClient.monitor(
|
||||
OvsdbDao.ovsdbName, OvsdbDao.awlanNodeDbTable + "_" + key, new MonitorRequests(ImmutableMap
|
||||
.of(OvsdbDao.awlanNodeDbTable, new MonitorRequest(new MonitorSelect(true, true, true, true)))),
|
||||
new MonitorCallback() {
|
||||
|
||||
@Override
|
||||
public void update(TableUpdates tableUpdates) {
|
||||
try {
|
||||
LOG.info(OvsdbDao.awlanNodeDbTable + "_" + key + " monitor callback received {}", tableUpdates);
|
||||
LOG.info(OvsdbDao.awlanNodeDbTable + "_" + key + " monitor callback received {}",
|
||||
tableUpdates);
|
||||
|
||||
extIntegrationInterface.awlanNodeDbTableUpdate(
|
||||
ovsdbDao.getOpensyncAWLANNode(tableUpdates, key, ovsdbClient), key);
|
||||
} catch (Exception e) {
|
||||
LOG.error("awlanNodeDbTableUpdate failed",e);
|
||||
LOG.error("awlanNodeDbTableUpdate failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
extIntegrationInterface.awlanNodeDbTableUpdate(
|
||||
ovsdbDao.getOpensyncAWLANNode(awCf.join(), key, ovsdbClient), key);
|
||||
extIntegrationInterface.awlanNodeDbTableUpdate(ovsdbDao.getOpensyncAWLANNode(awCf.join(), key, ovsdbClient),
|
||||
key);
|
||||
}
|
||||
|
||||
private void monitorWifiAssociatedClientsDbTable(OvsdbClient ovsdbClient, String key) throws OvsdbClientException {
|
||||
@@ -562,7 +578,8 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
||||
public void update(TableUpdates tableUpdates) {
|
||||
|
||||
try {
|
||||
LOG.info(OvsdbDao.wifiAssociatedClientsDbTable + "_" + key + " monitor callback received {}",
|
||||
LOG.info(
|
||||
OvsdbDao.wifiAssociatedClientsDbTable + "_" + key + " monitor callback received {}",
|
||||
tableUpdates);
|
||||
|
||||
List<OpensyncWifiAssociatedClients> associatedClients = new ArrayList<>();
|
||||
@@ -573,10 +590,13 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
||||
if ((rowUpdate.getOld() != null) && (rowUpdate.getNew() == null)) {
|
||||
Row row = rowUpdate.getOld();
|
||||
String deletedClientMac = row.getStringColumn("mac");
|
||||
// take care of the deletes as we go through
|
||||
// the updates, as we want to delete before
|
||||
// take care of the deletes as we go
|
||||
// through
|
||||
// the updates, as we want to delete
|
||||
// before
|
||||
// adding anyway.
|
||||
extIntegrationInterface.wifiAssociatedClientsDbTableDelete(deletedClientMac, key);
|
||||
extIntegrationInterface.wifiAssociatedClientsDbTableDelete(deletedClientMac,
|
||||
key);
|
||||
} else {
|
||||
associatedClients.addAll(
|
||||
ovsdbDao.getOpensyncWifiAssociatedClients(rowUpdate, key, ovsdbClient));
|
||||
@@ -595,10 +615,8 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
||||
|
||||
});
|
||||
|
||||
|
||||
|
||||
extIntegrationInterface.wifiAssociatedClientsDbTableUpdate(ovsdbDao.getInitialOpensyncWifiAssociatedClients(acCf.join(), key, ovsdbClient), key);
|
||||
|
||||
extIntegrationInterface.wifiAssociatedClientsDbTableUpdate(
|
||||
ovsdbDao.getInitialOpensyncWifiAssociatedClients(acCf.join(), key, ovsdbClient), key);
|
||||
|
||||
}
|
||||
|
||||
@@ -624,11 +642,11 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
||||
for (RowUpdate rowUpdate : tableUpdate.getRowUpdates().values()) {
|
||||
|
||||
if (rowUpdate.getNew() == null) {
|
||||
inetStateDelete.addAll(
|
||||
ovsdbDao.getOpensyncApInetStateForRowUpdate(rowUpdate, key, ovsdbClient));
|
||||
inetStateDelete.addAll(ovsdbDao.getOpensyncApInetStateForRowUpdate(rowUpdate,
|
||||
key, ovsdbClient));
|
||||
} else {
|
||||
inetStateInsertOrUpdate.addAll(
|
||||
ovsdbDao.getOpensyncApInetStateForRowUpdate(rowUpdate, key, ovsdbClient));
|
||||
inetStateInsertOrUpdate.addAll(ovsdbDao
|
||||
.getOpensyncApInetStateForRowUpdate(rowUpdate, key, ovsdbClient));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -640,14 +658,15 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
||||
// now process updates and mutations
|
||||
extIntegrationInterface.wifiInetStateDbTableUpdate(inetStateInsertOrUpdate, key);
|
||||
} catch (Exception e) {
|
||||
LOG.error("wifiInetStateDbTableUpdate failed",e);
|
||||
LOG.error("wifiInetStateDbTableUpdate failed", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
extIntegrationInterface.wifiInetStateDbTableUpdate(ovsdbDao.getInitialOpensyncApInetStateForRowUpdate(isCf.join(), key, ovsdbClient), key);
|
||||
extIntegrationInterface.wifiInetStateDbTableUpdate(
|
||||
ovsdbDao.getInitialOpensyncApInetStateForRowUpdate(isCf.join(), key, ovsdbClient), key);
|
||||
|
||||
}
|
||||
|
||||
@@ -655,7 +674,8 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
||||
|
||||
CompletableFuture<TableUpdates> rsCf = ovsdbClient.monitor(OvsdbDao.ovsdbName,
|
||||
OvsdbDao.wifiRadioStateDbTable + "_" + key,
|
||||
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiRadioStateDbTable, new MonitorRequest(new MonitorSelect(true, true, true, true)))),
|
||||
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiRadioStateDbTable,
|
||||
new MonitorRequest(new MonitorSelect(true, true, true, true)))),
|
||||
new MonitorCallback() {
|
||||
|
||||
@Override
|
||||
@@ -667,20 +687,21 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
||||
extIntegrationInterface.wifiRadioStatusDbTableUpdate(
|
||||
ovsdbDao.getOpensyncAPRadioState(tableUpdates, key, ovsdbClient), key);
|
||||
} catch (Exception e) {
|
||||
LOG.error("wifiRadioStatusDbTableUpdate failed",e);
|
||||
LOG.error("wifiRadioStatusDbTableUpdate failed", e);
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
extIntegrationInterface.wifiRadioStatusDbTableUpdate(
|
||||
ovsdbDao.getOpensyncAPRadioState(rsCf.join(), key, ovsdbClient), key);
|
||||
extIntegrationInterface
|
||||
.wifiRadioStatusDbTableUpdate(ovsdbDao.getOpensyncAPRadioState(rsCf.join(), key, ovsdbClient), key);
|
||||
}
|
||||
|
||||
private void monitorWifiVifStateDbTable(OvsdbClient ovsdbClient, String key) throws OvsdbClientException {
|
||||
|
||||
CompletableFuture<TableUpdates> vsCf = ovsdbClient.monitor(OvsdbDao.ovsdbName,
|
||||
OvsdbDao.wifiVifStateDbTable + "_" + key,
|
||||
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiVifStateDbTable, new MonitorRequest(new MonitorSelect(true, true, true, true)))),
|
||||
CompletableFuture<TableUpdates> vsCf = ovsdbClient
|
||||
.monitor(OvsdbDao.ovsdbName, OvsdbDao.wifiVifStateDbTable + "_" + key,
|
||||
new MonitorRequests(ImmutableMap.of(OvsdbDao.wifiVifStateDbTable,
|
||||
new MonitorRequest(new MonitorSelect(false, true, true, true)))),
|
||||
new MonitorCallback() {
|
||||
|
||||
@Override
|
||||
@@ -697,14 +718,14 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
||||
|
||||
if (rowUpdate.getNew() == null) {
|
||||
// this is a deletion
|
||||
vifsToDelete.addAll(
|
||||
ovsdbDao.getOpensyncApVifStateForRowUpdate(rowUpdate, key, ovsdbClient));
|
||||
vifsToDelete.addAll(ovsdbDao.getOpensyncApVifStateForRowUpdate(
|
||||
rowUpdate, key, ovsdbClient));
|
||||
|
||||
} else {
|
||||
// either an insert or
|
||||
// mutuate/update
|
||||
vifsToInsertOrUpdate.addAll(
|
||||
ovsdbDao.getOpensyncApVifStateForRowUpdate(rowUpdate, key, ovsdbClient));
|
||||
vifsToInsertOrUpdate.addAll(ovsdbDao.getOpensyncApVifStateForRowUpdate(
|
||||
rowUpdate, key, ovsdbClient));
|
||||
|
||||
}
|
||||
|
||||
@@ -715,7 +736,8 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
||||
extIntegrationInterface.wifiVIFStateDbTableDelete(vifsToDelete, key);
|
||||
}
|
||||
if (!vifsToInsertOrUpdate.isEmpty()) {
|
||||
extIntegrationInterface.wifiVIFStateDbTableUpdate(vifsToInsertOrUpdate, key);
|
||||
extIntegrationInterface.wifiVIFStateDbTableUpdate(vifsToInsertOrUpdate,
|
||||
key);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -726,13 +748,14 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
||||
}
|
||||
|
||||
});
|
||||
extIntegrationInterface.wifiVIFStateDbTableUpdate(ovsdbDao.getInitialOpensyncApVifStateForTableUpdates(vsCf.join(), key, ovsdbClient),key);
|
||||
vsCf.join();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public String closeSession(String apId) {
|
||||
OvsdbSession session = ovsdbSessionMapInterface.getSession(apId);
|
||||
if (session != null) {
|
||||
try {
|
||||
session.getOvsdbClient().shutdown();
|
||||
} catch (Exception e) {
|
||||
@@ -740,6 +763,7 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
||||
return "Failed to close session to " + apId + " " + e.getLocalizedMessage();
|
||||
|
||||
}
|
||||
}
|
||||
LOG.debug("Closed session to " + apId);
|
||||
return "Closed session to " + apId;
|
||||
}
|
||||
@@ -896,18 +920,21 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
|
||||
return key;
|
||||
}
|
||||
|
||||
public String processNewChannelsRequest(String apId, Map<RadioType, Integer> backupChannelMap, Map<RadioType,Integer> primaryChannelMap) {
|
||||
public String processNewChannelsRequest(String apId, Map<RadioType, Integer> backupChannelMap,
|
||||
Map<RadioType, Integer> primaryChannelMap) {
|
||||
LOG.info("TipWlanOvsdbClient::processNewChannelsRequest for AP {}", apId);
|
||||
|
||||
try {
|
||||
OvsdbSession session = ovsdbSessionMapInterface.getSession(apId);
|
||||
OvsdbClient ovsdbClient = session.getOvsdbClient();
|
||||
ovsdbDao.processNewChannelsRequest(ovsdbClient, backupChannelMap, primaryChannelMap);
|
||||
LOG.info("TipWlanOvsdbClient::processNewChannelsRequest change backup and/or primary channels for AP {}", apId);
|
||||
LOG.info("TipWlanOvsdbClient::processNewChannelsRequest change backup and/or primary channels for AP {}",
|
||||
apId);
|
||||
return " change backup and/or primary channels for AP " + apId;
|
||||
} catch (Exception e) {
|
||||
LOG.error("TipWlanOvsdbClient::processNewChannelsRequest failed to change backup and/or primary channels for AP {}", apId,
|
||||
e);
|
||||
LOG.error(
|
||||
"TipWlanOvsdbClient::processNewChannelsRequest failed to change backup and/or primary channels for AP {}",
|
||||
apId, e);
|
||||
return "failed to change backup and/or primary channels for AP " + apId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3089,7 +3089,7 @@ public class OvsdbDao {
|
||||
rrmEnabled = opensyncApConfig.getEquipmentLocation().getDetails().isRrmEnabled();
|
||||
}
|
||||
List<MacAddress> macBlockList = opensyncApConfig.getBlockedClients();
|
||||
LOG.debug("configureSsids with blockList {}", macBlockList);
|
||||
LOG.debug("configureSsids {} with blockList {}", opensyncApConfig.getSsidProfile(), macBlockList);
|
||||
|
||||
List<RadioType> enabledRadiosFromAp = new ArrayList<>();
|
||||
getEnabledRadios(ovsdbClient, enabledRadiosFromAp);
|
||||
@@ -3198,15 +3198,21 @@ public class OvsdbDao {
|
||||
}
|
||||
}
|
||||
|
||||
RadioConfiguration radioConfiguration = apElementConfig.getAdvancedRadioMap().get(radioType);
|
||||
if (radioConfiguration == null) {
|
||||
continue; // don't have a radio of this kind in the map
|
||||
}
|
||||
RfElementConfiguration rfElementConfig = rfConfig.getRfConfig(radioType);
|
||||
int dtimPeriod = radioConfiguration.getDtimPeriod();
|
||||
int rtsCtsThreshold = rfElementConfig.getRtsCtsThreshold();
|
||||
int fragThresholdBytes = radioConfiguration.getFragmentationThresholdBytes();
|
||||
RadioMode radioMode = rfElementConfig.getRadioMode();
|
||||
|
||||
int dtimPeriod = 2;
|
||||
int fragThresholdBytes = 2346;
|
||||
boolean uapsdEnabled = true;
|
||||
boolean apBridge = true;
|
||||
RadioConfiguration radioConfiguration = apElementConfig.getAdvancedRadioMap().get(radioType);
|
||||
if (radioConfiguration != null) {
|
||||
dtimPeriod = radioConfiguration.getDtimPeriod();
|
||||
uapsdEnabled = radioConfiguration.getUapsdState() == StateSetting.enabled;
|
||||
apBridge = radioConfiguration.getStationIsolation() == StateSetting.disabled; // stationIsolation
|
||||
fragThresholdBytes = radioConfiguration.getFragmentationThresholdBytes();
|
||||
}
|
||||
String minHwMode = "11n"; // min_hw_mode is 11ac, wifi 5, we can
|
||||
// also take ++ (11ax) but 2.4GHz only
|
||||
// Wifi4 --
|
||||
@@ -3217,9 +3223,7 @@ public class OvsdbDao {
|
||||
minHwMode = "11x";
|
||||
}
|
||||
|
||||
boolean uapsdEnabled = radioConfiguration.getUapsdState() == StateSetting.enabled;
|
||||
|
||||
boolean apBridge = radioConfiguration.getStationIsolation() == StateSetting.disabled; // stationIsolation
|
||||
// off by default
|
||||
boolean enable80211r = false;
|
||||
int mobilityDomain = 0;
|
||||
@@ -5656,7 +5660,8 @@ public class OvsdbDao {
|
||||
}
|
||||
}
|
||||
|
||||
public void processNewChannelsRequest(OvsdbClient ovsdbClient, Map<RadioType, Integer> backupChannelMap, Map<RadioType, Integer> primaryChannelMap) {
|
||||
public void processNewChannelsRequest(OvsdbClient ovsdbClient, Map<RadioType, Integer> backupChannelMap,
|
||||
Map<RadioType, Integer> primaryChannelMap) {
|
||||
|
||||
LOG.info("OvsdbDao::processNewChannelsRequest backup {} primary {}", backupChannelMap, primaryChannelMap);
|
||||
try {
|
||||
@@ -5689,7 +5694,6 @@ public class OvsdbDao {
|
||||
LOG.info("Op Result {}", res);
|
||||
}
|
||||
|
||||
|
||||
LOG.info("Updated ovsdb config for primary and backup channels.");
|
||||
} catch (ExecutionException e) {
|
||||
LOG.error("Error in processNewChannelsRequest", e);
|
||||
@@ -5700,8 +5704,6 @@ public class OvsdbDao {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
public AutoOrManualValue getSourcedValue(SourceType source, int profileValue, int equipmentValue) {
|
||||
if (source == SourceType.profile) {
|
||||
return AutoOrManualValue.createManualInstance(profileValue);
|
||||
|
||||
Reference in New Issue
Block a user