Retrieve Radio State information on initial AP connect

This commit is contained in:
Mike Hansen
2020-06-24 13:22:42 -04:00
parent 82332611ce
commit 7010919c11
3 changed files with 531 additions and 633 deletions

View File

@@ -9,7 +9,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.Callable; import java.util.concurrent.Callable;
import java.util.function.Consumer;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
@@ -40,6 +39,7 @@ import com.telecominfraproject.wlan.core.model.equipment.RadioType;
import com.telecominfraproject.wlan.customer.models.Customer; import com.telecominfraproject.wlan.customer.models.Customer;
import com.telecominfraproject.wlan.customer.service.CustomerServiceInterface; import com.telecominfraproject.wlan.customer.service.CustomerServiceInterface;
import com.telecominfraproject.wlan.datastore.exceptions.DsConcurrentModificationException; import com.telecominfraproject.wlan.datastore.exceptions.DsConcurrentModificationException;
import com.telecominfraproject.wlan.datastore.exceptions.DsEntityNotFoundException;
import com.telecominfraproject.wlan.equipment.EquipmentServiceInterface; import com.telecominfraproject.wlan.equipment.EquipmentServiceInterface;
import com.telecominfraproject.wlan.equipment.models.ApElementConfiguration; import com.telecominfraproject.wlan.equipment.models.ApElementConfiguration;
import com.telecominfraproject.wlan.equipment.models.Equipment; import com.telecominfraproject.wlan.equipment.models.Equipment;
@@ -48,6 +48,7 @@ import com.telecominfraproject.wlan.firmware.FirmwareServiceInterface;
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackRecord; import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackRecord;
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackSettings; import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackSettings;
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackSettings.TrackFlag; import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackSettings.TrackFlag;
import com.telecominfraproject.wlan.firmware.models.FirmwareVersion;
import com.telecominfraproject.wlan.location.models.Location; import com.telecominfraproject.wlan.location.models.Location;
import com.telecominfraproject.wlan.location.service.LocationServiceInterface; import com.telecominfraproject.wlan.location.service.LocationServiceInterface;
import com.telecominfraproject.wlan.opensync.external.integration.controller.OpensyncCloudGatewayController; import com.telecominfraproject.wlan.opensync.external.integration.controller.OpensyncCloudGatewayController;
@@ -114,6 +115,10 @@ import sts.OpensyncStats.Neighbor;
import sts.OpensyncStats.Neighbor.NeighborBss; import sts.OpensyncStats.Neighbor.NeighborBss;
import sts.OpensyncStats.RadioBandType; import sts.OpensyncStats.RadioBandType;
import sts.OpensyncStats.Report; import sts.OpensyncStats.Report;
import sts.OpensyncStats.RssiPeer;
import sts.OpensyncStats.RssiPeer.RssiSample;
import sts.OpensyncStats.RssiPeer.RssiSource;
import sts.OpensyncStats.RssiReport;
import sts.OpensyncStats.Survey; import sts.OpensyncStats.Survey;
import sts.OpensyncStats.Survey.SurveySample; import sts.OpensyncStats.Survey.SurveySample;
import sts.OpensyncStats.SurveyType; import sts.OpensyncStats.SurveyType;
@@ -124,7 +129,7 @@ import wc.stats.IpDnsTelemetry.WCStatsReport;
@Component @Component
public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegrationInterface { public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegrationInterface {
private static Logger LOG = LoggerFactory.getLogger(OpensyncExternalIntegrationCloud.class); private static final Logger LOG = LoggerFactory.getLogger(OpensyncExternalIntegrationCloud.class);
@Autowired @Autowired
private AlarmServiceInterface alarmServiceInterface; private AlarmServiceInterface alarmServiceInterface;
@@ -192,41 +197,6 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
return ce; return ce;
} }
private RadioType opensyncFreqBandToRadioType(String osFreqBand) {
switch (osFreqBand) {
case "2.4G":
return RadioType.is2dot4GHz;
case "5G":
return RadioType.is5GHz;
case "5GL":
return RadioType.is5GHzL;
case "5GU":
return RadioType.is5GHzU;
default:
return RadioType.UNSUPPORTED;
}
}
private String radioTypeToOpensyncFrequencyBand(RadioType radioType) {
switch (radioType) {
case is2dot4GHz:
return "2.4G";
case is5GHz:
return "5G";
case is5GHzL:
return "5GL";
case is5GHzU:
return "5GU";
default:
return null;
}
}
@Override @Override
public void apConnected(String apId, ConnectNodeInfo connectNodeInfo) { public void apConnected(String apId, ConnectNodeInfo connectNodeInfo) {
@@ -238,10 +208,9 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
CustomerFirmwareTrackRecord custFwTrackRecord = firmwareServiceInterface CustomerFirmwareTrackRecord custFwTrackRecord = firmwareServiceInterface
.getCustomerFirmwareTrackRecord(autoProvisionedCustomerId); .getCustomerFirmwareTrackRecord(autoProvisionedCustomerId);
if (custFwTrackRecord != null) { if (custFwTrackRecord != null) {
trackSettings = CustomerFirmwareTrackSettings.combine(custFwTrackRecord.getSettings(), trackSettings); trackSettings = custFwTrackRecord.getSettings();
} }
// determine if AP requires FW upgrade before cloud // determine if AP requires FW upgrade before cloud connection/provision
// connection/provision
if (trackSettings.getAutoUpgradeDeprecatedOnBind().equals(TrackFlag.ALWAYS) if (trackSettings.getAutoUpgradeDeprecatedOnBind().equals(TrackFlag.ALWAYS)
|| trackSettings.getAutoUpgradeUnknownOnBind().equals(TrackFlag.ALWAYS)) { || trackSettings.getAutoUpgradeUnknownOnBind().equals(TrackFlag.ALWAYS)) {
@@ -263,69 +232,90 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
try { try {
if (ce == null) { if (ce == null) {
Customer customer = customerServiceInterface.getOrNull(autoProvisionedCustomerId);
if (customer == null) {
customer = new Customer();
customer.setName("DefaultCustomer");
customer.setEmail("DefaulCustomer@DefaultEmail.com");
customer = customerServiceInterface.create(customer);
}
ce = new Equipment(); ce = new Equipment();
ce.setEquipmentType(EquipmentType.AP); ce.setEquipmentType(EquipmentType.AP);
ce.setCustomerId(customer.getId());
ce.setInventoryId(apId); ce.setInventoryId(apId);
ce.setSerial(connectNodeInfo.serialNumber); ce.setSerial(connectNodeInfo.serialNumber);
ce.setDetails(ApElementConfiguration.createWithDefaults()); ce.setDetails(ApElementConfiguration.createWithDefaults());
ce.setName(apId);
ce.setLocationId(autoProvisionedLocationId);
ce = equipmentServiceInterface.create(ce); ce = equipmentServiceInterface.create(ce);
ce.setCustomerId(autoProvisionedCustomerId); ce.setCustomerId(autoProvisionedCustomerId);
ce.setName(apId);
ce.setLocationId(autoProvisionedLocationId);
ApElementConfiguration apElementConfig = (ApElementConfiguration) ce.getDetails(); ApElementConfiguration apElementConfig = (ApElementConfiguration) ce.getDetails();
for (RadioType key : apElementConfig.getRadioMap().keySet()) { apElementConfig.setEquipmentModel(connectNodeInfo.model);
String ovsdbKey = radioTypeToOpensyncFrequencyBand(key); apElementConfig.getAdvancedRadioMap().get(RadioType.is2dot4GHz)
if (connectNodeInfo.wifiRadioStates.containsKey(ovsdbKey)) { .setAutoChannelSelection(StateSetting.disabled);
apElementConfig.getAdvancedRadioMap().get(key) apElementConfig.getAdvancedRadioMap().get(RadioType.is5GHzL)
.setAutoChannelSelection(StateSetting.disabled); .setAutoChannelSelection(StateSetting.disabled);
apElementConfig.getRadioMap().get(key).setAutoChannelSelection(false); apElementConfig.getAdvancedRadioMap().get(RadioType.is5GHzU)
} else { .setAutoChannelSelection(StateSetting.disabled);
apElementConfig.getAdvancedRadioMap().remove(key);
apElementConfig.getRadioMap().remove(key); apElementConfig.getRadioMap().get(RadioType.is2dot4GHz).setAutoChannelSelection(false);
} apElementConfig.getRadioMap().get(RadioType.is5GHzL).setAutoChannelSelection(false);
} apElementConfig.getRadioMap().get(RadioType.is5GHzU).setAutoChannelSelection(false);
ce.setDetails(apElementConfig); ce.setDetails(apElementConfig);
ce = equipmentServiceInterface.update(ce); ce = equipmentServiceInterface.update(ce);
Profile ssidProfile = new Profile();
ssidProfile.setCustomerId(ce.getCustomerId());
ssidProfile.setName("DefaultSsidApConnected");
SsidConfiguration ssidConfig = SsidConfiguration.createWithDefaults();
ssidConfig.setSsid("DefaultSsidApConnected");
ssidConfig.setSecureMode(SecureMode.wpa2PSK);
ssidConfig.setKeyStr("12345678");
Set<RadioType> appliedRadios = new HashSet<>();
appliedRadios.addAll(((ApElementConfiguration) ce.getDetails()).getRadioMap().keySet());
ssidConfig.setAppliedRadios(appliedRadios);
ssidProfile.setDetails(ssidConfig);
ssidProfile = profileServiceInterface.create(ssidProfile);
Profile apProfile = new Profile(); Profile apProfile = new Profile();
apProfile.setCustomerId(ce.getCustomerId()); apProfile.setCustomerId(ce.getCustomerId());
apProfile.setName("DefaultApProfile"); apProfile.setName("DefaultApProfile");
apProfile.setDetails(ApNetworkConfiguration.createWithDefaults()); apProfile.setDetails(ApNetworkConfiguration.createWithDefaults());
apProfile = profileServiceInterface.create(apProfile);
Profile ssidProfile = new Profile();
ssidProfile.setCustomerId(ce.getCustomerId());
ssidProfile.setName("DefaultSsid-2g");
SsidConfiguration ssidConfig = SsidConfiguration.createWithDefaults();
ssidConfig.setSsid("DefaultSsid-2g");
ssidConfig.setSecureMode(SecureMode.wpa2PSK);
ssidConfig.setKeyStr("12345678");
Set<RadioType> appliedRadios = new HashSet<>();
appliedRadios.add(RadioType.is2dot4GHz);
// ssidConfig.getRadioBasedConfigs().get(RadioType.is2dot4GHz).setEnable80211r(true);
ssidConfig.setAppliedRadios(appliedRadios);
ssidProfile.setDetails(ssidConfig);
ssidProfile = profileServiceInterface.create(ssidProfile);
Profile ssidProfile5g = new Profile();
ssidProfile5g.setCustomerId(ce.getCustomerId());
ssidProfile5g.setName("DefaultSsid-5g");
SsidConfiguration ssidConfig5g = SsidConfiguration.createWithDefaults();
ssidConfig5g.setSecureMode(SecureMode.wpa2PSK);
ssidConfig5g.setSsid("DefaultSsid-5g");
ssidConfig5g.setKeyStr("12345678");
Set<RadioType> appliedRadios5g = new HashSet<>();
appliedRadios5g.add(RadioType.is5GHzL);
appliedRadios5g.add(RadioType.is5GHzU);
ssidConfig5g.setAppliedRadios(appliedRadios5g);
// ssidConfig5g.getRadioBasedConfigs().get(RadioType.is5GHzL).setEnable80211r(true);
// ssidConfig5g.getRadioBasedConfigs().get(RadioType.is5GHzU).setEnable80211r(true);
ssidProfile5g.setDetails(ssidConfig5g);
ssidProfile5g = profileServiceInterface.create(ssidProfile5g);
Set<Long> childProfileIds = new HashSet<>(); Set<Long> childProfileIds = new HashSet<>();
childProfileIds.add(ssidProfile.getId()); childProfileIds.add(ssidProfile.getId());
apProfile.setChildProfileIds(childProfileIds); childProfileIds.add(ssidProfile5g.getId());
apProfile = profileServiceInterface.create(apProfile);
apProfile.setChildProfileIds(childProfileIds);
apProfile = profileServiceInterface.update(apProfile);
ce.setProfileId(apProfile.getId()); ce.setProfileId(apProfile.getId());
ce = equipmentServiceInterface.update(ce); ce = equipmentServiceInterface.update(ce);
Customer customer = customerServiceInterface.getOrNull(ce.getCustomerId());
if (customer == null) {
customer = new Customer();
customer.setId(autoProvisionedCustomerId);
customerServiceInterface.create(customer);
ce.setCustomerId(customer.getId());
equipmentServiceInterface.update(ce);
}
} }
EquipmentRoutingRecord equipmentRoutingRecord = gatewayController EquipmentRoutingRecord equipmentRoutingRecord = gatewayController
@@ -415,7 +405,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
} catch (UnknownHostException e) { } catch (UnknownHostException e) {
// do nothing here // do nothing here
} }
if ((connectNodeInfo.macAddress != null) && (MacAddress.valueOf(connectNodeInfo.macAddress) != null)) { if (connectNodeInfo.macAddress != null && MacAddress.valueOf(connectNodeInfo.macAddress) != null) {
protocolStatusData.setReportedMacAddr(MacAddress.valueOf(connectNodeInfo.macAddress)); protocolStatusData.setReportedMacAddr(MacAddress.valueOf(connectNodeInfo.macAddress));
} }
protocolStatusData.setReportedSku(connectNodeInfo.skuNumber); protocolStatusData.setReportedSku(connectNodeInfo.skuNumber);
@@ -643,7 +633,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
int customerId = extractCustomerIdFromTopic(topic); int customerId = extractCustomerIdFromTopic(topic);
long equipmentId = extractEquipmentIdFromTopic(topic); long equipmentId = extractEquipmentIdFromTopic(topic);
if ((equipmentId <= 0) || (customerId <= 0)) { if (equipmentId <= 0 || customerId <= 0) {
LOG.warn("Cannot determine equipment ids from topic {} - customerId {} equipmentId {}", topic, customerId, LOG.warn("Cannot determine equipment ids from topic {} - customerId {} equipmentId {}", topic, customerId,
equipmentId); equipmentId);
return; return;
@@ -657,12 +647,13 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
populateApNodeMetrics(metricRecordList, report, customerId, equipmentId); populateApNodeMetrics(metricRecordList, report, customerId, equipmentId);
populateNeighbourScanReports(metricRecordList, report, customerId, equipmentId); populateNeighbourScanReports(metricRecordList, report, customerId, equipmentId);
try { try {
populateChannelInfoReports(metricRecordList, report, customerId, equipmentId); // TODO: depends on survey
// populateChannelInfoReports(metricRecordList, report, customerId,
// equipmentId);
populateApSsidMetrics(metricRecordList, report, customerId, equipmentId, extractApIdFromTopic(topic)); populateApSsidMetrics(metricRecordList, report, customerId, equipmentId, extractApIdFromTopic(topic));
/* // handleRssiMetrics(metricRecordList, report, customerId,
* TODO: add when available handleRssiMetrics(metricRecordList, // equipmentId);
* report, customerId, equipmentId);
*/
} catch (Exception e) { } catch (Exception e) {
LOG.error("Exception when processing populateApSsidMetrics", e); LOG.error("Exception when processing populateApSsidMetrics", e);
} }
@@ -673,32 +664,31 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
} }
/* private void handleRssiMetrics(List<ServiceMetric> metricRecordList, Report report, int customerId,
* TODO: when available handle RSSI metric processing private void long equipmentId) {
* handleRssiMetrics(List<ServiceMetric> metricRecordList, Report report, LOG.debug("handleRssiMetrics for Customer {} Equipment {}", customerId, equipmentId);
* int customerId, long equipmentId) {
* LOG.debug("handleRssiMetrics for Customer {} Equipment {}", customerId, for (RssiReport rssiReport : report.getRssiReportList()) {
* equipmentId);
* for (RssiPeer peer : rssiReport.getPeerListList()) {
* for (RssiReport rssiReport : report.getRssiReportList()) { if (peer.getRssiSource().equals(RssiSource.CLIENT)) {
* int rssi = 0;
* for (RssiPeer peer : rssiReport.getPeerListList()) { if
* (peer.getRssiSource().equals(RssiSource.CLIENT)) { int rssi = 0; for (RssiSample sample : peer.getRssiListList()) {
* rssi += getNegativeSignedIntFromUnsigned(sample.getRssi());
* for (RssiSample sample : peer.getRssiListList()) { rssi += LOG.debug("RSSI Sample: unsignedValue {} signedValue {}", sample.getRssi(),
* getNegativeSignedIntFromUnsigned(sample.getRssi()); getNegativeSignedIntFromUnsigned(sample.getRssi()));
* LOG.debug("RSSI Sample: unsignedValue {} signedValue {}", }
* sample.getRssi(), getNegativeSignedIntFromUnsigned(sample.getRssi())); }
* rssi = rssi / peer.getRssiListCount();
* rssi = rssi / peer.getRssiListCount();
* LOG.debug("RssiReport::RssiPeer::Band {} RssiPeer MAC {} RssiSamples Avg {} RxPpdus {} TxPpdus {}",
* LOG. rssiReport.getBand(), peer.getMacAddress(), rssi, peer.getRxPpdus(), peer.getTxPpdus());
* debug("RssiReport::RssiPeer::Band {} RssiPeer MAC {} RssiSamples Avg {} RxPpdus {} TxPpdus {}" }
* , rssiReport.getBand(), peer.getMacAddress(), rssi, peer.getRxPpdus(), }
* peer.getTxPpdus()); } }
* }
* } } }
*/
private void populateApNodeMetrics(List<ServiceMetric> metricRecordList, Report report, int customerId, private void populateApNodeMetrics(List<ServiceMetric> metricRecordList, Report report, int customerId,
long equipmentId) { long equipmentId) {
@@ -900,8 +890,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
ClientMetrics cMetrics = new ClientMetrics(); ClientMetrics cMetrics = new ClientMetrics();
smr.setDetails(cMetrics); smr.setDetails(cMetrics);
Integer periodLengthSec = 60; // matches what's configured Integer periodLengthSec = 60; // matches what's configured by
// by
// OvsdbDao.configureStats(OvsdbClient) // OvsdbDao.configureStats(OvsdbClient)
cMetrics.setPeriodLengthSec(periodLengthSec); cMetrics.setPeriodLengthSec(periodLengthSec);
@@ -945,7 +934,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
} }
if (cl.getStats().hasTxRate()) { if (cl.getStats().hasTxRate()) {
cMetrics.setAverageTxRate(cl.getStats().getTxRate() / 1000); cMetrics.setAverageTxRate(Double.valueOf(cl.getStats().getTxRate() / 1000));
} }
if (cl.getStats().hasTxRate() && cl.getStats().hasRxRate()) { if (cl.getStats().hasTxRate() && cl.getStats().hasRxRate()) {
@@ -1021,7 +1010,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
nr.setMacAddress(new MacAddress(nBss.getBssid())); nr.setMacAddress(new MacAddress(nBss.getBssid()));
nr.setNetworkType(NetworkType.AP); nr.setNetworkType(NetworkType.AP);
nr.setPacketType(NeighborScanPacketType.BEACON); nr.setPacketType(NeighborScanPacketType.BEACON);
nr.setPrivacy(((nBss.getSsid() == null) || nBss.getSsid().isEmpty()) ? true : false); nr.setPrivacy((nBss.getSsid() == null || nBss.getSsid().isEmpty()) ? true : false);
// nr.setRate(rate); // nr.setRate(rate);
// we can only get Rssi as an unsigned int from opensync, so // we can only get Rssi as an unsigned int from opensync, so
// some shifting // some shifting
@@ -1131,8 +1120,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
metricDetails.setTxDataFrames((int) ((int) client.getStats().getTxFrames() - client.getStats().getTxRetries())); metricDetails.setTxDataFrames((int) ((int) client.getStats().getTxFrames() - client.getStats().getTxRetries()));
metricDetails.setRxDataFrames((int) ((int) client.getStats().getRxFrames() - client.getStats().getRxRetries())); metricDetails.setRxDataFrames((int) ((int) client.getStats().getRxFrames() - client.getStats().getRxRetries()));
// values reported in Kbps, convert to Mbps // values reported in Kbps, convert to Mbps
metricDetails.setRxMbps((float) (client.getStats().getRxRate() / 1000)); metricDetails.setRxMbps(Float.valueOf((float) (client.getStats().getRxRate() / 1000)));
metricDetails.setTxMbps((float) (client.getStats().getTxRate() / 1000)); metricDetails.setTxMbps(Float.valueOf((float) (client.getStats().getTxRate() / 1000)));
metricDetails.setRxRateKbps((long) client.getStats().getRxRate()); metricDetails.setRxRateKbps((long) client.getStats().getRxRate());
metricDetails.setTxRateKbps((long) client.getStats().getTxRate()); metricDetails.setTxRateKbps((long) client.getStats().getTxRate());
return metricDetails; return metricDetails;
@@ -1198,7 +1187,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
for (Client client : clientReport.getClientListList()) { for (Client client : clientReport.getClientListList()) {
if (client.hasSsid() && (client.getSsid() != null) && !client.getSsid().equals("")) { if (client.hasSsid() && client.getSsid() != null && !client.getSsid().equals("")) {
ssid = client.getSsid(); ssid = client.getSsid();
} }
@@ -1330,18 +1319,15 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
// ChannelInfo entries per surveyed channel // ChannelInfo entries per surveyed channel
Map<Integer, List<SurveySample>> sampleByChannelMap = new HashMap<>(); Map<Integer, List<SurveySample>> sampleByChannelMap = new HashMap<>();
survey.getSurveyListList().stream().forEach(new Consumer<SurveySample>() { survey.getSurveyListList().stream().forEach(s -> {
@Override List<SurveySample> surveySampleList;
public void accept(SurveySample s) { if (sampleByChannelMap.get(s.getChannel()) == null) {
List<SurveySample> surveySampleList; surveySampleList = new ArrayList<>();
if (sampleByChannelMap.get(s.getChannel()) == null) { } else {
surveySampleList = new ArrayList<>(); surveySampleList = sampleByChannelMap.get(s.getChannel());
} else {
surveySampleList = sampleByChannelMap.get(s.getChannel());
}
surveySampleList.add(s);
sampleByChannelMap.put(s.getChannel(), surveySampleList);
} }
surveySampleList.add(s);
sampleByChannelMap.put(s.getChannel(), surveySampleList);
}); });
for (List<SurveySample> surveySampleList : sampleByChannelMap.values()) { for (List<SurveySample> surveySampleList : sampleByChannelMap.values()) {
@@ -1397,9 +1383,9 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
channelInfo.setWifiUtilization(totalWifi); channelInfo.setWifiUtilization(totalWifi);
channelInfo.setBandwidth(((ApElementConfiguration) equipmentServiceInterface.get(equipmentId).getDetails()) channelInfo.setBandwidth(((ApElementConfiguration) equipmentServiceInterface.get(equipmentId).getDetails())
.getRadioMap().get(radioType).getChannelBandwidth()); .getRadioMap().get(radioType).getChannelBandwidth());
channelInfo.setNoiseFloor(-84); // TODO: when this channelInfo.setNoiseFloor(Integer.valueOf(-84)); // TODO: when this
// becomes available // becomes available
// add // add
return channelInfo; return channelInfo;
} }
@@ -1410,7 +1396,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
int customerId = extractCustomerIdFromTopic(topic); int customerId = extractCustomerIdFromTopic(topic);
long equipmentId = extractEquipmentIdFromTopic(topic); long equipmentId = extractEquipmentIdFromTopic(topic);
if ((equipmentId <= 0) || (customerId <= 0)) { if (equipmentId <= 0 || customerId <= 0) {
LOG.warn("Cannot determine equipment ids from topic {} - customerId {} equipmentId {}", topic, customerId, LOG.warn("Cannot determine equipment ids from topic {} - customerId {} equipmentId {}", topic, customerId,
equipmentId); equipmentId);
return; return;
@@ -1434,7 +1420,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
int customerId = extractCustomerIdFromTopic(topic); int customerId = extractCustomerIdFromTopic(topic);
long equipmentId = extractEquipmentIdFromTopic(topic); long equipmentId = extractEquipmentIdFromTopic(topic);
if ((equipmentId <= 0) || (customerId <= 0)) { if (equipmentId <= 0 || customerId <= 0) {
LOG.warn("Cannot determine equipment ids from topic {} - customerId {} equipmentId {}", topic, customerId, LOG.warn("Cannot determine equipment ids from topic {} - customerId {} equipmentId {}", topic, customerId,
equipmentId); equipmentId);
return; return;
@@ -1467,13 +1453,13 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
return; return;
} }
if ((vifStateTables == null) || vifStateTables.isEmpty() || (apId == null)) { if (vifStateTables == null || vifStateTables.isEmpty() || apId == null) {
return; return;
} }
for (OpensyncAPVIFState vifState : vifStateTables) { for (OpensyncAPVIFState vifState : vifStateTables) {
if ((vifState.getMac() != null) && (vifState.getSsid() != null) && (vifState.getChannel() > 0)) { if (vifState.getMac() != null && vifState.getSsid() != null && vifState.getChannel() > 0) {
String bssid = vifState.getMac(); String bssid = vifState.getMac();
String ssid = vifState.getSsid(); String ssid = vifState.getSsid();
@@ -1564,7 +1550,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
int customerId = ovsdbSession.getCustomerId(); int customerId = ovsdbSession.getCustomerId();
long equipmentId = ovsdbSession.getEquipmentId(); long equipmentId = ovsdbSession.getEquipmentId();
if ((customerId < 0) || (equipmentId < 0)) { if (customerId < 0 || equipmentId < 0) {
LOG.debug("wifiRadioStatusDbTableUpdate::Cannot get valid CustomerId {} or EquipmentId {} for AP {}", LOG.debug("wifiRadioStatusDbTableUpdate::Cannot get valid CustomerId {} or EquipmentId {} for AP {}",
customerId, equipmentId, apId); customerId, equipmentId, apId);
return; return;
@@ -1718,10 +1704,14 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
return; return;
} }
if ((inetStateTables == null) || inetStateTables.isEmpty() || (apId == null)) { if (inetStateTables == null || inetStateTables.isEmpty() || apId == null) {
return; return;
} }
for (OpensyncAPInetState inetState : inetStateTables) {
// TODO: implement me
}
} }
@Override @Override
@@ -1748,7 +1738,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
return; return;
} }
if ((wifiAssociatedClients == null) || wifiAssociatedClients.isEmpty() || (apId == null)) { if (wifiAssociatedClients == null || wifiAssociatedClients.isEmpty() || apId == null) {
return; return;
} }
@@ -1767,7 +1757,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
int customerId = ovsdbSession.getCustomerId(); int customerId = ovsdbSession.getCustomerId();
long equipmentId = ovsdbSession.getEquipmentId(); long equipmentId = ovsdbSession.getEquipmentId();
if ((customerId < 0) || (equipmentId < 0)) { if (customerId < 0 || equipmentId < 0) {
LOG.debug("awlanNodeDbTableUpdate::Cannot get valid CustomerId {} or EquipmentId {} for AP {}", customerId, LOG.debug("awlanNodeDbTableUpdate::Cannot get valid CustomerId {} or EquipmentId {} for AP {}", customerId,
equipmentId, apId); equipmentId, apId);
return; return;

View File

@@ -97,7 +97,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
// with the serialNumber and using it as a key (equivalent // with the serialNumber and using it as a key (equivalent
// of KDC unique qrCode) // of KDC unique qrCode)
String key = clientCn + "_" + connectNodeInfo.serialNumber; String key = clientCn + "_" + connectNodeInfo.serialNumber;
ovsdbSessionMapInterface.newSession(key, ovsdbClient); ConnectusOvsdbClient.this.ovsdbSessionMapInterface.newSession(key, ovsdbClient);
extIntegrationInterface.apConnected(key, connectNodeInfo); extIntegrationInterface.apConnected(key, connectNodeInfo);
// push configuration to AP // push configuration to AP
@@ -105,7 +105,8 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
monitorOvsdbStateTables(ovsdbClient, key); monitorOvsdbStateTables(ovsdbClient, key);
LOG.info("ovsdbClient connected from {} on port {} key {} ", remoteHost, localPort, key); LOG.info("ovsdbClient connected from {} on port {} key {} ", remoteHost, localPort, key);
LOG.info("ovsdbClient connectedClients = {}", ovsdbSessionMapInterface.getNumSessions()); LOG.info("ovsdbClient connectedClients = {}",
ConnectusOvsdbClient.this.ovsdbSessionMapInterface.getNumSessions());
} catch (Exception e) { } catch (Exception e) {
LOG.error("ovsdbClient error", e); LOG.error("ovsdbClient error", e);
@@ -138,7 +139,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
// so we are doing a reverse lookup here, and then if we find // so we are doing a reverse lookup here, and then if we find
// the key we will // the key we will
// remove the entry from the connectedClients. // remove the entry from the connectedClients.
String key = ovsdbSessionMapInterface.lookupClientId(ovsdbClient); String key = ConnectusOvsdbClient.this.ovsdbSessionMapInterface.lookupClientId(ovsdbClient);
if (key != null) { if (key != null) {
try { try {
@@ -154,7 +155,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
} }
try { try {
extIntegrationInterface.apDisconnected(key); extIntegrationInterface.apDisconnected(key);
ovsdbSessionMapInterface.removeSession(key); ConnectusOvsdbClient.this.ovsdbSessionMapInterface.removeSession(key);
} catch (Exception e) { } catch (Exception e) {
LOG.debug("Unable to process ap disconnect. {}", e.getMessage()); LOG.debug("Unable to process ap disconnect. {}", e.getMessage());
} finally { } finally {
@@ -164,7 +165,8 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
LOG.info("ovsdbClient disconnected from {} on port {} clientCn {} key {} ", remoteHost, localPort, LOG.info("ovsdbClient disconnected from {} on port {} clientCn {} key {} ", remoteHost, localPort,
clientCn, key); clientCn, key);
LOG.info("ovsdbClient connectedClients = {}", ovsdbSessionMapInterface.getNumSessions()); LOG.info("ovsdbClient connectedClients = {}",
ConnectusOvsdbClient.this.ovsdbSessionMapInterface.getNumSessions());
} }
}; };
@@ -180,8 +182,8 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
LOG.debug("Starting Client connect"); LOG.debug("Starting Client connect");
connectNodeInfo = ovsdbDao.updateConnectNodeInfoOnConnect(ovsdbClient, clientCn, connectNodeInfo); connectNodeInfo = ovsdbDao.updateConnectNodeInfoOnConnect(ovsdbClient, clientCn, connectNodeInfo);
ovsdbDao.vifBridge = connectNodeInfo.ifName; String apId = clientCn + "_" + connectNodeInfo.serialNumber;
OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId);
try { try {
ovsdbDao.provisionBridgePortInterface(ovsdbClient); ovsdbDao.provisionBridgePortInterface(ovsdbClient);
@@ -191,12 +193,10 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
} }
ovsdbDao.removeAllSsids(ovsdbClient); // always ovsdbDao.removeAllSsids(ovsdbClient); // always
String apId = clientCn + "_" + connectNodeInfo.serialNumber;
OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId);
if (opensyncAPConfig != null) { if (opensyncAPConfig != null) {
ovsdbDao.configureWifiRadios(ovsdbClient, opensyncAPConfig); ovsdbDao.configureWifiRadios(ovsdbClient, opensyncAPConfig);
ovsdbDao.configureSsids(ovsdbClient, opensyncAPConfig); ovsdbDao.configureSsids(ovsdbClient, opensyncAPConfig);
ovsdbDao.configureWifiInet(ovsdbClient, opensyncAPConfig);
} }
ovsdbDao.configureStats(ovsdbClient); ovsdbDao.configureStats(ovsdbClient);
@@ -208,6 +208,8 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
ovsdbDao.updateDeviceStatsReportingInterval(ovsdbClient, collectionIntervalSecDeviceStats); ovsdbDao.updateDeviceStatsReportingInterval(ovsdbClient, collectionIntervalSecDeviceStats);
} }
// ovsdbDao.configureWifiInet(ovsdbClient);
LOG.debug("Client connect Done"); LOG.debug("Client connect Done");
return connectNodeInfo; return connectNodeInfo;
} }
@@ -305,22 +307,22 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
for (Entry<UUID, RowUpdate> rowUpdate : tableUpdate.getValue().getRowUpdates() for (Entry<UUID, RowUpdate> rowUpdate : tableUpdate.getValue().getRowUpdates()
.entrySet()) { .entrySet()) {
if ((rowUpdate.getValue().getOld() != null) if (rowUpdate.getValue().getOld() != null
&& (rowUpdate.getValue().getNew() == null)) { && rowUpdate.getValue().getNew() == null) {
Row row = rowUpdate.getValue().getOld(); Row row = rowUpdate.getValue().getOld();
String ifName = null; String ifName = null;
String ssid = null; String ssid = null;
if ((row.getColumns().get("ssid") != null) if (row.getColumns().get("ssid") != null
&& row.getColumns().get("ssid").getClass().equals( && row.getColumns().get("ssid").getClass().equals(
com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
ssid = row.getStringColumn("ssid"); ssid = row.getStringColumn("ssid");
} }
if ((row.getColumns().get("if_name") != null) if (row.getColumns().get("if_name") != null
&& row.getColumns().get("if_name").getClass().equals( && row.getColumns().get("if_name").getClass().equals(
com.vmware.ovsdb.protocol.operation.notation.Atom.class)) { com.vmware.ovsdb.protocol.operation.notation.Atom.class)) {
ifName = row.getStringColumn("if_name"); ifName = row.getStringColumn("if_name");
} }
if ((ifName != null) && (ssid != null)) { if (ifName != null && ssid != null) {
OpensyncAPVIFState toBeDeleted = new OpensyncAPVIFState(); OpensyncAPVIFState toBeDeleted = new OpensyncAPVIFState();
toBeDeleted.setSsid(ssid); toBeDeleted.setSsid(ssid);
toBeDeleted.setIfName(ifName); toBeDeleted.setIfName(ifName);
@@ -331,7 +333,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
} }
if (tableUpdate.getValue().getRowUpdates().isEmpty()) { if (tableUpdate.getValue().getRowUpdates().values().isEmpty()) {
tableUpdates.getTableUpdates().remove(tableUpdate.getKey()); tableUpdates.getTableUpdates().remove(tableUpdate.getKey());
} }
@@ -376,7 +378,7 @@ public class ConnectusOvsdbClient implements ConnectusOvsdbClientInterface {
for (TableUpdate tableUpdate : tableUpdates.getTableUpdates().values()) { for (TableUpdate tableUpdate : tableUpdates.getTableUpdates().values()) {
for (RowUpdate rowUpdate : tableUpdate.getRowUpdates().values()) { for (RowUpdate rowUpdate : tableUpdate.getRowUpdates().values()) {
if ((rowUpdate.getOld() != null) && (rowUpdate.getNew() == null)) { if (rowUpdate.getOld() != null && rowUpdate.getNew() == null) {
Row row = rowUpdate.getOld(); Row row = rowUpdate.getOld();
String deletedClientMac = row.getStringColumn("mac"); String deletedClientMac = row.getStringColumn("mac");
extIntegrationInterface.wifiAssociatedClientsDbTableDelete(deletedClientMac, extIntegrationInterface.wifiAssociatedClientsDbTableDelete(deletedClientMac,