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 7e442fe..7179238 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 @@ -9,7 +9,6 @@ import java.util.List; import java.util.Map; import java.util.Set; import java.util.concurrent.Callable; -import java.util.stream.Collectors; import javax.annotation.PostConstruct; @@ -26,8 +25,11 @@ import com.telecominfraproject.wlan.client.ClientServiceInterface; import com.telecominfraproject.wlan.cloudeventdispatcher.CloudEventDispatcherInterface; import com.telecominfraproject.wlan.core.model.entity.CountryCode; import com.telecominfraproject.wlan.core.model.equipment.AutoOrManualValue; +import com.telecominfraproject.wlan.core.model.equipment.DetectedAuthMode; import com.telecominfraproject.wlan.core.model.equipment.EquipmentType; import com.telecominfraproject.wlan.core.model.equipment.MacAddress; +import com.telecominfraproject.wlan.core.model.equipment.NeighborScanPacketType; +import com.telecominfraproject.wlan.core.model.equipment.NetworkType; import com.telecominfraproject.wlan.core.model.equipment.RadioType; import com.telecominfraproject.wlan.customer.models.Customer; import com.telecominfraproject.wlan.customer.service.CustomerServiceInterface; @@ -60,6 +62,8 @@ import com.telecominfraproject.wlan.servicemetric.apnode.models.EthernetLinkStat import com.telecominfraproject.wlan.servicemetric.apnode.models.RadioUtilization; import com.telecominfraproject.wlan.servicemetric.client.models.ClientMetrics; import com.telecominfraproject.wlan.servicemetric.models.ServiceMetric; +import com.telecominfraproject.wlan.servicemetric.neighbourscan.models.NeighbourReport; +import com.telecominfraproject.wlan.servicemetric.neighbourscan.models.NeighbourScanReports; import com.telecominfraproject.wlan.status.StatusServiceInterface; import com.telecominfraproject.wlan.status.equipment.models.EquipmentAdminStatusData; import com.telecominfraproject.wlan.status.equipment.models.EquipmentLANStatusData; @@ -78,6 +82,8 @@ import sts.PlumeStats.Client; import sts.PlumeStats.ClientReport; import sts.PlumeStats.Device; import sts.PlumeStats.Device.RadioTemp; +import sts.PlumeStats.Neighbor; +import sts.PlumeStats.Neighbor.NeighborBss; import sts.PlumeStats.RadioBandType; import sts.PlumeStats.Report; import sts.PlumeStats.Survey; @@ -127,17 +133,11 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra @Autowired private CacheManager cacheManagerShortLived; private Cache cloudEquipmentRecordCache; - // private Map opensyncNodeMap; - - // @Value("${connectus.ovsdb.configFileName:/Users/mikehansen/git/wlan-cloud-workspace/wlan-cloud-opensync-controller/opensync-ext-cloud/src/main/resources/config_2_ssids.json}") - // private String configFileName; @PostConstruct private void postCreate() { LOG.info("Using Cloud integration"); cloudEquipmentRecordCache = cacheManagerShortLived.getCache("equipment_record_cache"); - // opensyncNodeMap = Collections.synchronizedMap(new HashMap()); } public Equipment getCustomerEquipment(String apId) { @@ -546,6 +546,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra populateApClientMetrics(metricRecordList, report, customerId, equipmentId); populateApNodeMetrics(metricRecordList, report, customerId, equipmentId); + populateNeighbourScanReports(metricRecordList, report, customerId, equipmentId); try { populateApSsidMetrics(metricRecordList, report, customerId, equipmentId, extractApIdFromTopic(topic)); @@ -732,9 +733,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra } } - if (LOG.isDebugEnabled()) { - LOG.debug("ApNodeMetrics Report {}", apNodeMetrics.toPrettyString()); - } + + LOG.info("ApNodeMetrics Report {}", apNodeMetrics); } @@ -855,6 +855,66 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra } + private void populateNeighbourScanReports(List metricRecordList, Report report, int customerId, + long equipmentId) { + LOG.debug("populateNeighbourScanReports for Customer {} Equipment {}", customerId, equipmentId); + + for (Neighbor neighbor : report.getNeighborsList()) { + + ServiceMetric smr = new ServiceMetric(customerId, equipmentId); + metricRecordList.add(smr); + NeighbourScanReports neighbourScanReports = new NeighbourScanReports(); + smr.setDetails(neighbourScanReports); + + smr.setCreatedTimestamp(neighbor.getTimestampMs()); + + List neighbourReports = new ArrayList<>(); + neighbourScanReports.setNeighbourReports(neighbourReports); + + for (NeighborBss nBss : neighbor.getBssListList()) { + NeighbourReport nr = new NeighbourReport(); + neighbourReports.add(nr); + + if (neighbor.getBand() == RadioBandType.BAND2G) { + nr.setAcMode(false); + nr.setbMode(false); + nr.setnMode(true); + nr.setRadioType(RadioType.is2dot4GHz); + } else if (neighbor.getBand() == RadioBandType.BAND5G) { + nr.setAcMode(true); + nr.setbMode(false); + nr.setnMode(false); + nr.setRadioType(RadioType.is5GHz); + } else if (neighbor.getBand() == RadioBandType.BAND5GL) { + nr.setAcMode(true); + nr.setbMode(false); + nr.setnMode(false); + nr.setRadioType(RadioType.is5GHzL); + } else if (neighbor.getBand() == RadioBandType.BAND5GU) { + nr.setAcMode(true); + nr.setbMode(false); + nr.setnMode(false); + nr.setRadioType(RadioType.is5GHzU); + } + + nr.setChannel(nBss.getChannel()); + nr.setMacAddress(new MacAddress(nBss.getBssid())); + nr.setNetworkType(NetworkType.AP); + nr.setPacketType(NeighborScanPacketType.BEACON); + nr.setPrivacy((nBss.getSsid() == null || nBss.getSsid().isEmpty()) ? true : false); + // nr.setRate(rate); + nr.setRssi(nBss.getRssi()); + // nr.setScanTimeInSeconds(scanTimeInSeconds); + nr.setSecureMode(DetectedAuthMode.WPA); + // nr.setSignal(signal); + nr.setSsid(nBss.getSsid()); + } + + LOG.debug("populateNeighbourScanReports created report {} from stats {}", neighbourScanReports, neighbor); + + } + } + private void populateApSsidMetrics(List metricRecordList, Report report, int customerId, long equipmentId, String apId) { diff --git a/opensync-ext-static/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationSimple.java b/opensync-ext-static/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationSimple.java index 88ec911..03e7b3f 100644 --- a/opensync-ext-static/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationSimple.java +++ b/opensync-ext-static/src/main/java/com/telecominfraproject/wlan/opensync/external/integration/OpensyncExternalIntegrationSimple.java @@ -1,7 +1,6 @@ package com.telecominfraproject.wlan.opensync.external.integration; import java.io.IOException; -import java.util.ArrayList; import java.util.List; import javax.annotation.PostConstruct; @@ -32,19 +31,19 @@ public class OpensyncExternalIntegrationSimple implements OpensyncExternalIntegr private static final Logger LOG = LoggerFactory.getLogger(OpensyncExternalIntegrationSimple.class); - @Value("${connectus.ovsdb.customerEquipmentFileName:/Users/mikehansen/git/wlan-cloud-workspace/wlan-cloud-opensync-controller/opensync-ext-static/src/main/resources/EquipmentExample.json}") + @Value("${connectus.ovsdb.customerEquipmentFileName:/app/config/EquipmentExample.json}") private String customerEquipmentFileName; - @Value("${connectus.ovsdb.apProfileFileName:/Users/mikehansen/git/wlan-cloud-workspace/wlan-cloud-opensync-controller/opensync-ext-static/src/main/resources/ProfileAPExample.json}") + @Value("${connectus.ovsdb.apProfileFileName:/app/config/ProfileAPExample.json}") private String apProfileFileName; - @Value("${connectus.ovsdb.ssidProfileFileName:/Users/mikehansen/git/wlan-cloud-workspace/wlan-cloud-opensync-controller/opensync-ext-static/src/main/resources/ProfileSsid.json}") + @Value("${connectus.ovsdb.ssidProfileFileName:/app/config/ProfileSsid.json}") private String ssidProfileFileName; - @Value("${connectus.ovsdb.radiusProfileFileName:/Users/mikehansen/git/wlan-cloud-workspace/wlan-cloud-opensync-controller/opensync-ext-static/src/main/resources/ProfileRadius.json}") + @Value("${connectus.ovsdb.radiusProfileFileName:/app/config/ProfileRadius.json}") private String radiusProfileFileName; - - @Value("${connectus.ovsdb.locationFileName:/Users/mikehansen/git/wlan-cloud-workspace/wlan-cloud-opensync-controller/opensync-ext-static/src/main/resources/LocationBuildingExample.json}") + + @Value("${connectus.ovsdb.locationFileName:/app/config/LocationBuildingExample.json}") private String locationFileName; private String serialNumber = ""; @@ -74,12 +73,12 @@ public class OpensyncExternalIntegrationSimple implements OpensyncExternalIntegr Equipment equipment = Equipment.fromFile(customerEquipmentFileName, Equipment.class); equipment.setInventoryId(apId); equipment.setName(apId); - + equipment.setSerial(serialNumber); - + com.telecominfraproject.wlan.profile.models.Profile apProfile = com.telecominfraproject.wlan.profile.models.Profile .fromFile(apProfileFileName, com.telecominfraproject.wlan.profile.models.Profile.class); - + List ssidProfiles = com.telecominfraproject.wlan.profile.models.Profile .listFromFile(ssidProfileFileName, com.telecominfraproject.wlan.profile.models.Profile.class); @@ -87,7 +86,7 @@ public class OpensyncExternalIntegrationSimple implements OpensyncExternalIntegr List radiusProfiles = com.telecominfraproject.wlan.profile.models.Profile .listFromFile(radiusProfileFileName, com.telecominfraproject.wlan.profile.models.Profile.class); - + equipment.setProfileId(apProfile.getId()); Location location = Location.fromFile(locationFileName, Location.class); @@ -125,44 +124,43 @@ public class OpensyncExternalIntegrationSimple implements OpensyncExternalIntegr @Override public void wifiVIFStateDbTableUpdate(List vifStateTables, String apId) { - // TODO Auto-generated method stub - + LOG.info("Received table state update {} for ap {}", vifStateTables, apId); } @Override public void wifiRadioStatusDbTableUpdate(List radioStateTable, String apId) { - // TODO Auto-generated method stub + LOG.info("Received table state update {} for ap {}", radioStateTable, apId); } @Override public void wifiInetStateDbTableUpdate(List inetStateTable, String apId) { - // TODO Auto-generated method stub + LOG.info("Received table state update {} for ap {}", inetStateTable, apId); } @Override public void wifiAssociatedClientsDbTableUpdate(List wifiAssociatedClients, String apId) { - // TODO Auto-generated method stub + LOG.info("Received table state update {} for ap {}", wifiAssociatedClients, apId); } @Override public void awlanNodeDbTableUpdate(OpensyncAWLANNode opensyncAPState, String apId) { - // TODO Auto-generated method stub + LOG.info("Received table state update {} for ap {}", opensyncAPState, apId); } @Override public void wifiVIFStateDbTableDelete(List vifStateTables, String apId) { - // TODO Auto-generated method stub + LOG.info("Received table delete {} for ap {}", vifStateTables, apId); } @Override public void wifiAssociatedClientsDbTableDelete(String deletedClientMac, String apId) { - // TODO Auto-generated method stub + LOG.info("Received Wifi_Associated_Clients row delete {} for ap {}", deletedClientMac, apId); }