WIFI-767: Cloud Back End for Events Integration

This commit is contained in:
Mike Hansen
2021-01-06 15:56:48 -05:00
parent 9659433e76
commit cd4874ae18
3 changed files with 382 additions and 259 deletions

View File

@@ -306,24 +306,26 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
} }
} }
if(syncUpRadioConfigsForProvisionedEquipment) { if (syncUpRadioConfigsForProvisionedEquipment) {
//sync up available radios reported by AP with the ApElementConfiguration, update equipment in DB if needed // sync up available radios reported by AP with the
// ApElementConfiguration, update equipment in DB if needed
boolean needToUpdateEquipment = false; boolean needToUpdateEquipment = false;
ApElementConfiguration apElementConfig = (ApElementConfiguration) ce.getDetails(); ApElementConfiguration apElementConfig = (ApElementConfiguration) ce.getDetails();
if(apElementConfig == null) { if (apElementConfig == null) {
apElementConfig = ApElementConfiguration.createWithDefaults(); apElementConfig = ApElementConfiguration.createWithDefaults();
ce.setDetails(apElementConfig); ce.setDetails(apElementConfig);
needToUpdateEquipment = true; needToUpdateEquipment = true;
} }
if (apElementConfig.getDeviceName() == null
if(apElementConfig.getDeviceName()==null || !apElementConfig.getDeviceName().equals(ce.getName())) { || !apElementConfig.getDeviceName().equals(ce.getName())) {
apElementConfig.setDeviceName(ce.getName()); apElementConfig.setDeviceName(ce.getName());
needToUpdateEquipment = true; needToUpdateEquipment = true;
} }
if(apElementConfig.getEquipmentModel()==null || !apElementConfig.getEquipmentModel().equals(connectNodeInfo.model)) { if (apElementConfig.getEquipmentModel() == null
|| !apElementConfig.getEquipmentModel().equals(connectNodeInfo.model)) {
apElementConfig.setEquipmentModel(connectNodeInfo.model); apElementConfig.setEquipmentModel(connectNodeInfo.model);
needToUpdateEquipment = true; needToUpdateEquipment = true;
} }
@@ -331,13 +333,13 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
Map<RadioType, RadioConfiguration> advancedRadioMap = apElementConfig.getAdvancedRadioMap(); Map<RadioType, RadioConfiguration> advancedRadioMap = apElementConfig.getAdvancedRadioMap();
Map<RadioType, ElementRadioConfiguration> radioMap = apElementConfig.getRadioMap(); Map<RadioType, ElementRadioConfiguration> radioMap = apElementConfig.getRadioMap();
if(advancedRadioMap == null) { if (advancedRadioMap == null) {
advancedRadioMap = new HashMap<>(); advancedRadioMap = new HashMap<>();
apElementConfig.setAdvancedRadioMap(advancedRadioMap); apElementConfig.setAdvancedRadioMap(advancedRadioMap);
needToUpdateEquipment = true; needToUpdateEquipment = true;
} }
if(radioMap == null) { if (radioMap == null) {
radioMap = new HashMap<>(); radioMap = new HashMap<>();
apElementConfig.setRadioMap(radioMap); apElementConfig.setRadioMap(radioMap);
needToUpdateEquipment = true; needToUpdateEquipment = true;
@@ -345,7 +347,7 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
Set<RadioType> radiosFromAp = new HashSet<>(); Set<RadioType> radiosFromAp = new HashSet<>();
//add missing radio configs from the AP into the DB // add missing radio configs from the AP into the DB
for (String radio : connectNodeInfo.wifiRadioStates.keySet()) { for (String radio : connectNodeInfo.wifiRadioStates.keySet()) {
RadioType radioType = RadioType.UNSUPPORTED; RadioType radioType = RadioType.UNSUPPORTED;
if (radio.equals("2.4G")) { if (radio.equals("2.4G")) {
@@ -365,40 +367,41 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
RadioConfiguration advancedRadioConfiguration = advancedRadioMap.get(radioType); RadioConfiguration advancedRadioConfiguration = advancedRadioMap.get(radioType);
ElementRadioConfiguration radioConfiguration = radioMap.get(radioType); ElementRadioConfiguration radioConfiguration = radioMap.get(radioType);
if(advancedRadioConfiguration == null) { if (advancedRadioConfiguration == null) {
advancedRadioConfiguration = RadioConfiguration.createWithDefaults(radioType); advancedRadioConfiguration = RadioConfiguration.createWithDefaults(radioType);
advancedRadioMap.put(radioType, advancedRadioConfiguration); advancedRadioMap.put(radioType, advancedRadioConfiguration);
needToUpdateEquipment = true; needToUpdateEquipment = true;
} }
if(radioConfiguration == null) { if (radioConfiguration == null) {
radioConfiguration = ElementRadioConfiguration.createWithDefaults(radioType); radioConfiguration = ElementRadioConfiguration.createWithDefaults(radioType);
radioMap.put(radioType, radioConfiguration); radioMap.put(radioType, radioConfiguration);
needToUpdateEquipment = true; needToUpdateEquipment = true;
} }
} }
} }
//remove radio configs from the DB that are no longer present in the AP but still exist in DB // remove radio configs from the DB that are no longer
for(RadioType radioType: RadioType.validValues()) { // present in the AP but still exist in DB
for (RadioType radioType : RadioType.validValues()) {
RadioConfiguration advancedRadioConfiguration = advancedRadioMap.get(radioType); RadioConfiguration advancedRadioConfiguration = advancedRadioMap.get(radioType);
if(advancedRadioConfiguration != null || !radiosFromAp.contains(radioType)) { if (advancedRadioConfiguration != null || !radiosFromAp.contains(radioType)) {
advancedRadioMap.remove(radioType); advancedRadioMap.remove(radioType);
needToUpdateEquipment = true; needToUpdateEquipment = true;
} }
ElementRadioConfiguration radioConfiguration = radioMap.get(radioType); ElementRadioConfiguration radioConfiguration = radioMap.get(radioType);
if(radioConfiguration != null || !radiosFromAp.contains(radioType)) { if (radioConfiguration != null || !radiosFromAp.contains(radioType)) {
radioMap.remove(radioType); radioMap.remove(radioType);
needToUpdateEquipment = true; needToUpdateEquipment = true;
} }
} }
if(needToUpdateEquipment) { if (needToUpdateEquipment) {
ce = equipmentServiceInterface.update(ce); ce = equipmentServiceInterface.update(ce);
} }
@@ -911,7 +914,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
List<ClientSession> toBeDisconnected = new ArrayList<>(); List<ClientSession> toBeDisconnected = new ArrayList<>();
clientSessions.getItems().stream().forEach(c -> { clientSessions.getItems().stream().forEach(c -> {
if (!c.getDetails().getAssociationState().equals(AssociationState.Disconnected)) { if (c.getDetails().getAssociationState() != null
&& !c.getDetails().getAssociationState().equals(AssociationState.Disconnected)) {
LOG.info("Change association state for client {} from {} to {}", c.getMacAddress(), LOG.info("Change association state for client {} from {} to {}", c.getMacAddress(),
c.getDetails().getAssociationState(), AssociationState.Disconnected); c.getDetails().getAssociationState(), AssociationState.Disconnected);
@@ -1226,29 +1230,35 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
} }
if (radioState.getAllowedChannels() != null) { if (radioState.getAllowedChannels() != null) {
apElementConfiguration.getRadioMap().get(radioState.getFreqBand()) if (apElementConfiguration.getRadioMap().containsKey(radioState.getFreqBand())
.setAllowedChannels(new ArrayList<>(radioState.getAllowedChannels())); && apElementConfiguration.getRadioMap().get(radioState.getFreqBand()) != null) {
apElementConfiguration.getRadioMap().get(radioState.getFreqBand())
.setAllowedChannels(new ArrayList<>(radioState.getAllowedChannels()));
LOG.debug("Updated AllowedChannels from Wifi_Radio_State table change for AP {}", apId); LOG.debug("Updated AllowedChannels from Wifi_Radio_State table change for AP {}", apId);
}
} }
if (radioState.getTxPower() > 0) { if (radioState.getTxPower() > 0) {
SourceType txPowerSource = apElementConfiguration.getRadioMap().get(radioState.getFreqBand()) if (apElementConfiguration.getRadioMap().containsKey(radioState.getFreqBand())
.getEirpTxPower().getSource(); && apElementConfiguration.getRadioMap().get(radioState.getFreqBand()) != null) {
// Preserve the source while updating the value SourceType txPowerSource = apElementConfiguration.getRadioMap().get(radioState.getFreqBand())
if (txPowerSource == SourceType.auto) { .getEirpTxPower().getSource();
apElementConfiguration.getRadioMap().get(radioState.getFreqBand()) // Preserve the source while updating the value
.setEirpTxPower(SourceSelectionValue.createAutomaticInstance(radioState.getTxPower())); if (txPowerSource == SourceType.auto) {
} else if (txPowerSource == SourceType.profile) { apElementConfiguration.getRadioMap().get(radioState.getFreqBand())
apElementConfiguration.getRadioMap().get(radioState.getFreqBand()) .setEirpTxPower(SourceSelectionValue.createAutomaticInstance(radioState.getTxPower()));
.setEirpTxPower(SourceSelectionValue.createProfileInstance(radioState.getTxPower())); } else if (txPowerSource == SourceType.profile) {
} else { apElementConfiguration.getRadioMap().get(radioState.getFreqBand())
apElementConfiguration.getRadioMap().get(radioState.getFreqBand()) .setEirpTxPower(SourceSelectionValue.createProfileInstance(radioState.getTxPower()));
.setEirpTxPower(SourceSelectionValue.createManualInstance(radioState.getTxPower())); } else {
} apElementConfiguration.getRadioMap().get(radioState.getFreqBand())
.setEirpTxPower(SourceSelectionValue.createManualInstance(radioState.getTxPower()));
}
LOG.debug("Updated TxPower from Wifi_Radio_State table change for AP {}", apId); LOG.debug("Updated TxPower from Wifi_Radio_State table change for AP {}", apId);
}
} }
StateSetting state = StateSetting.disabled; StateSetting state = StateSetting.disabled;
@@ -1256,13 +1266,17 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
state = StateSetting.enabled; state = StateSetting.enabled;
} }
if (!apElementConfiguration.getAdvancedRadioMap().get(radioState.getFreqBand()).getRadioAdminState() if (apElementConfiguration.getAdvancedRadioMap().containsKey(radioState.getFreqBand())
.equals(state)) { && apElementConfiguration.getAdvancedRadioMap().get(radioState.getFreqBand()) != null) {
// only update if changed if (!apElementConfiguration.getAdvancedRadioMap().get(radioState.getFreqBand()).getRadioAdminState()
apElementConfiguration.getAdvancedRadioMap().get(radioState.getFreqBand()).setRadioAdminState(state); .equals(state)) {
// only update if changed
apElementConfiguration.getAdvancedRadioMap().get(radioState.getFreqBand())
.setRadioAdminState(state);
LOG.debug("Updated RadioAdminState from Wifi_Radio_State table change for AP {}", apId); LOG.debug("Updated RadioAdminState from Wifi_Radio_State table change for AP {}", apId);
}
} }
protocolStatus = statusServiceInterface.getOrNull(customerId, equipmentId, StatusDataType.PROTOCOL); protocolStatus = statusServiceInterface.getOrNull(customerId, equipmentId, StatusDataType.PROTOCOL);
@@ -1350,7 +1364,8 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
currentActiveBSSIDs = new ArrayList<>(); currentActiveBSSIDs = new ArrayList<>();
} else { } else {
currentActiveBSSIDs = currentActiveBSSIDs.stream() currentActiveBSSIDs = currentActiveBSSIDs.stream()
.filter(p -> (p.getRadioType() != null && p.getSsid() != null)).filter(p -> !p.getRadioType().equals(freqBand) || !p.getSsid().equals(ssid)) .filter(p -> (p.getRadioType() != null && p.getSsid() != null))
.filter(p -> !p.getRadioType().equals(freqBand) || !p.getSsid().equals(ssid))
.collect(Collectors.toList()); .collect(Collectors.toList());
LOG.debug( LOG.debug(
"Processing Wifi_VIF_State table update for AP {}, activeBSSIDs bssidList without current radio freq {} and ssid {}", "Processing Wifi_VIF_State table update for AP {}, activeBSSIDs bssidList without current radio freq {} and ssid {}",
@@ -1576,17 +1591,41 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
clientSession.setMacAddress(clientInstance.getMacAddress()); clientSession.setMacAddress(clientInstance.getMacAddress());
clientSession.setLocationId(ce.getLocationId()); clientSession.setLocationId(ce.getLocationId());
ClientSessionDetails clientSessionDetails = new ClientSessionDetails(); ClientSessionDetails clientSessionDetails = new ClientSessionDetails();
clientSessionDetails.setSessionId(clientInstance.getMacAddress().getAddressAsLong());
clientSessionDetails.setIsReassociation(isReassociation); clientSessionDetails.setIsReassociation(isReassociation);
clientSessionDetails.setAssociationState(AssociationState._802_11_Associated);
clientSessionDetails.setAssocTimestamp(System.currentTimeMillis());
clientSession.setDetails(clientSessionDetails); clientSession.setDetails(clientSessionDetails);
clientSessionDetails.setAssocTimestamp(System.currentTimeMillis());
LOG.info(
"Client {} associated with AP, no current session. Adding session with a generated session id of {}.",
clientInstance, clientInstance.getMacAddress().getAddressAsLong());
clientSession = clientServiceInterface.updateSession(clientSession); clientSession = clientServiceInterface.updateSession(clientSession);
LOG.info("Client {} associated with AP, no current session. Created session {}.", clientInstance,
clientSession);
} }
ClientSessionDetails clientSessionDetails = clientSession.getDetails(); if (opensyncWifiAssociatedClients.state != null
clientSessionDetails.setAssociationState(AssociationState._802_11_Associated); && opensyncWifiAssociatedClients.state.equalsIgnoreCase("active")) {
clientSessionDetails.setAssocTimestamp(System.currentTimeMillis()); clientSession.getDetails().setAssociationState(AssociationState.Active_Data);
clientSession.getDetails().mergeSession(clientSessionDetails); clientSession = clientServiceInterface.updateSession(clientSession);
clientSession = clientServiceInterface.updateSession(clientSession); } else {
if (clientSession.getDetails().getAssociationState() != null) {
if (!clientSession.getDetails().getAssociationState().equals(AssociationState._802_11_Associated)) {
clientSession.getDetails().setAssociationState(AssociationState._802_11_Associated);
clientSession.getDetails().setAssocTimestamp(System.currentTimeMillis());
clientSession = clientServiceInterface.updateSession(clientSession);
}
} else {
clientSession.getDetails().setAssociationState(AssociationState._802_11_Associated);
clientSession.getDetails().setAssocTimestamp(System.currentTimeMillis());
clientSession = clientServiceInterface.updateSession(clientSession);
}
}
} }

View File

@@ -109,7 +109,6 @@ import sts.OpensyncStats.EventReport.ClientFirstDataEvent;
import sts.OpensyncStats.EventReport.ClientIdEvent; import sts.OpensyncStats.EventReport.ClientIdEvent;
import sts.OpensyncStats.EventReport.ClientIpEvent; import sts.OpensyncStats.EventReport.ClientIpEvent;
import sts.OpensyncStats.EventReport.ClientTimeoutEvent; import sts.OpensyncStats.EventReport.ClientTimeoutEvent;
import sts.OpensyncStats.EventReport.DhcpTransaction;
import sts.OpensyncStats.FrameType; import sts.OpensyncStats.FrameType;
import sts.OpensyncStats.Neighbor; import sts.OpensyncStats.Neighbor;
import sts.OpensyncStats.Neighbor.NeighborBss; import sts.OpensyncStats.Neighbor.NeighborBss;
@@ -303,166 +302,174 @@ public class MqttStatsPublisher {
LOG.debug("Processing EventReport::ClientSession {}", apEventClientSession); LOG.debug("Processing EventReport::ClientSession {}", apEventClientSession);
processClientConnectEvent(customerId, equipmentId, locationId, e, apEventClientSession); if (apEventClientSession.hasClientConnectEvent()) {
processClientConnectEvent(customerId, equipmentId, locationId, e, apEventClientSession);
processClientDisconnectEvent(customerId, equipmentId, locationId, apEventClientSession); }
if (apEventClientSession.hasClientDisconnectEvent()) {
processClientAuthEvent(customerId, equipmentId, locationId, apEventClientSession); processClientDisconnectEvent(customerId, equipmentId, locationId, apEventClientSession);
}
processClientAssocEvent(customerId, equipmentId, locationId, apEventClientSession); if (apEventClientSession.hasClientAuthEvent()) {
processClientAuthEvent(customerId, equipmentId, locationId, apEventClientSession);
processClientFailureEvent(customerId, equipmentId, locationId, apEventClientSession); }
if (apEventClientSession.hasClientAssocEvent()) {
processClientFirstDataEvent(customerId, equipmentId, locationId, apEventClientSession); processClientAssocEvent(customerId, equipmentId, locationId, apEventClientSession);
}
processClientIdEvent(customerId, equipmentId, locationId, apEventClientSession); if (apEventClientSession.hasClientFailureEvent()) {
processClientFailureEvent(customerId, equipmentId, locationId, apEventClientSession);
processClientIpEvent(customerId, equipmentId, locationId, apEventClientSession); }
if (apEventClientSession.hasClientFirstDataEvent()) {
processClientTimeoutEvent(customerId, equipmentId, locationId, apEventClientSession); processClientFirstDataEvent(customerId, equipmentId, locationId, apEventClientSession);
}
if (apEventClientSession.hasClientIdEvent()) {
processClientIdEvent(customerId, equipmentId, locationId, apEventClientSession);
}
if (apEventClientSession.hasClientIpEvent()) {
processClientIpEvent(customerId, equipmentId, locationId, apEventClientSession);
}
if (apEventClientSession.hasClientTimeoutEvent()) {
processClientTimeoutEvent(customerId, equipmentId, locationId, apEventClientSession);
}
} }
realtimeEventPublisher.publishChannelHopEvents(customerId, equipmentId, e); realtimeEventPublisher.publishChannelHopEvents(customerId, equipmentId, e);
// TODO: add DHCP transaction processing, for now just log it realtimeEventPublisher.publishDhcpTransactionEvents(customerId,equipmentId,e.getDhcpTransactionList());
for (DhcpTransaction dhcpTransaction : e.getDhcpTransactionList()) {
LOG.info("DhcpTransaction {}", dhcpTransaction);
}
}); });
} }
protected void processClientConnectEvent(int customerId, long equipmentId, long locationId, EventReport e, protected void processClientConnectEvent(int customerId, long equipmentId, long locationId, EventReport e,
sts.OpensyncStats.EventReport.ClientSession apEventClientSession) { sts.OpensyncStats.EventReport.ClientSession apEventClientSession) {
ClientConnectEvent clientConnectEvent = apEventClientSession.getClientConnectEvent(); ClientConnectEvent clientConnectEvent = apEventClientSession.getClientConnectEvent();
realtimeEventPublisher.publishClientConnectSuccessEvent(customerId, equipmentId, clientConnectEvent);
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId, if (clientConnectEvent.hasStaMac()) {
MacAddress.valueOf(clientConnectEvent.getStaMac())); com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId,
if (client == null) { MacAddress.valueOf(clientConnectEvent.getStaMac()));
client = new com.telecominfraproject.wlan.client.models.Client(); if (client == null) {
client = new com.telecominfraproject.wlan.client.models.Client();
client.setCustomerId(customerId); client.setCustomerId(customerId);
client.setMacAddress(MacAddress.valueOf(clientConnectEvent.getStaMac())); client.setMacAddress(MacAddress.valueOf(clientConnectEvent.getStaMac()));
client.setDetails(new ClientInfoDetails()); client.setDetails(new ClientInfoDetails());
client = clientServiceInterface.create(client); client = clientServiceInterface.create(client);
}
ClientSession clientSession = clientServiceInterface.getSessionOrNull(customerId, equipmentId,
MacAddress.valueOf(clientConnectEvent.getStaMac()));
if (clientSession == null) {
clientSession = new ClientSession();
}
clientSession.setCustomerId(customerId);
clientSession.setEquipmentId(equipmentId);
clientSession.setLocationId(locationId);
clientSession.setMacAddress(MacAddress.valueOf(clientConnectEvent.getStaMac()));
ClientSessionDetails clientSessionDetails = new ClientSessionDetails();
clientSessionDetails.setSessionId(clientConnectEvent.getSessionId());
if (clientConnectEvent.hasEvTimeBootupInUsAssoc()) {
clientSessionDetails.setAssocTimestamp(clientConnectEvent.getEvTimeBootupInUsAssoc());
}
if (clientConnectEvent.hasEvTimeBootupInUsAuth()) {
clientSessionDetails.setAuthTimestamp(clientConnectEvent.getEvTimeBootupInUsAuth());
}
if (clientConnectEvent.hasEvTimeBootupInUsEapol()) {
ClientEapDetails eapDetails = new ClientEapDetails();
eapDetails.setEapSuccessTimestamp(clientConnectEvent.getEvTimeBootupInUsEapol());
clientSessionDetails.setEapDetails(eapDetails);
}
if (clientConnectEvent.hasEvTimeBootupInUsFirstRx()) {
clientSessionDetails.setFirstDataRcvdTimestamp(clientConnectEvent.getEvTimeBootupInUsFirstRx());
}
if (clientConnectEvent.hasEvTimeBootupInUsFirstTx()) {
clientSessionDetails.setFirstDataSentTimestamp(clientConnectEvent.getEvTimeBootupInUsFirstTx());
}
if (clientConnectEvent.hasEvTimeBootupInUsIp()) {
clientSessionDetails.setIpTimestamp(clientConnectEvent.getEvTimeBootupInUsIp());
}
if (clientConnectEvent.hasEvTimeBootupInUsPortEnable()) {
clientSessionDetails.setPortEnabledTimestamp(clientConnectEvent.getEvTimeBootupInUsPortEnable());
}
if (clientConnectEvent.hasCltId()) {
clientSessionDetails.setHostname(clientConnectEvent.getCltId());
}
if (clientConnectEvent.hasSecType()) {
clientSessionDetails.setSecurityType(OvsdbToWlanCloudTypeMappingUtility
.getCloudSecurityTypeFromOpensyncStats(clientConnectEvent.getSecType()));
}
clientSessionDetails.setRadioType(OvsdbToWlanCloudTypeMappingUtility
.getRadioTypeFromOpensyncStatsRadioBandType(clientConnectEvent.getBand()));
if (clientConnectEvent.hasAssocType()) {
clientSessionDetails.setIsReassociation(clientConnectEvent.getAssocType().equals(AssocType.REASSOC));
}
if (clientConnectEvent.hasAssocRssi()) {
clientSessionDetails.setAssocRssi(clientConnectEvent.getAssocRssi());
}
clientSessionDetails.setSsid(clientConnectEvent.getSsid());
if (clientConnectEvent.hasUsing11K()) {
clientSessionDetails.setIs11KUsed(clientConnectEvent.getUsing11K());
}
if (clientConnectEvent.hasUsing11R()) {
clientSessionDetails.setIs11RUsed(clientConnectEvent.getUsing11R());
}
if (clientConnectEvent.hasUsing11V()) {
clientSessionDetails.setIs11VUsed(clientConnectEvent.getUsing11V());
}
if (clientConnectEvent.hasIpAddr()) {
try {
clientSessionDetails
.setIpAddress(InetAddress.getByAddress(clientConnectEvent.getIpAddr().toByteArray()));
} catch (UnknownHostException e1) {
LOG.error("Invalid Ip Address for client {}", clientConnectEvent.getIpAddr(), e);
} }
}
clientSessionDetails.setAssociationState(AssociationState._802_11_Associated); ClientSession clientSession = clientServiceInterface.getSessionOrNull(customerId, equipmentId,
MacAddress.valueOf(clientConnectEvent.getStaMac()));
if (clientSession.getDetails() == null) { if (clientSession == null) {
clientSession.setDetails(clientSessionDetails); clientSession = new ClientSession();
}
clientSession.setCustomerId(customerId);
clientSession.setEquipmentId(equipmentId);
clientSession.setLocationId(locationId);
clientSession.setMacAddress(MacAddress.valueOf(clientConnectEvent.getStaMac()));
ClientSessionDetails clientSessionDetails = new ClientSessionDetails();
clientSessionDetails.setSessionId(clientConnectEvent.getSessionId());
if (clientConnectEvent.hasEvTimeBootupInUsAssoc()) {
clientSessionDetails.setAssocTimestamp(clientConnectEvent.getEvTimeBootupInUsAssoc());
}
if (clientConnectEvent.hasEvTimeBootupInUsAuth()) {
clientSessionDetails.setAuthTimestamp(clientConnectEvent.getEvTimeBootupInUsAuth());
}
if (clientConnectEvent.hasEvTimeBootupInUsEapol()) {
ClientEapDetails eapDetails = new ClientEapDetails();
eapDetails.setEapSuccessTimestamp(clientConnectEvent.getEvTimeBootupInUsEapol());
clientSessionDetails.setEapDetails(eapDetails);
}
if (clientConnectEvent.hasEvTimeBootupInUsFirstRx()) {
clientSessionDetails.setFirstDataRcvdTimestamp(clientConnectEvent.getEvTimeBootupInUsFirstRx());
}
if (clientConnectEvent.hasEvTimeBootupInUsFirstTx()) {
clientSessionDetails.setFirstDataSentTimestamp(clientConnectEvent.getEvTimeBootupInUsFirstTx());
}
if (clientConnectEvent.hasEvTimeBootupInUsIp()) {
clientSessionDetails.setIpTimestamp(clientConnectEvent.getEvTimeBootupInUsIp());
}
if (clientConnectEvent.hasEvTimeBootupInUsPortEnable()) {
clientSessionDetails.setPortEnabledTimestamp(clientConnectEvent.getEvTimeBootupInUsPortEnable());
}
if (clientConnectEvent.hasCltId()) {
clientSessionDetails.setHostname(clientConnectEvent.getCltId());
}
if (clientConnectEvent.hasSecType()) {
clientSessionDetails.setSecurityType(OvsdbToWlanCloudTypeMappingUtility
.getCloudSecurityTypeFromOpensyncStats(clientConnectEvent.getSecType()));
}
clientSessionDetails.setRadioType(OvsdbToWlanCloudTypeMappingUtility
.getRadioTypeFromOpensyncStatsRadioBandType(clientConnectEvent.getBand()));
if (clientConnectEvent.hasAssocType()) {
clientSessionDetails.setIsReassociation(clientConnectEvent.getAssocType().equals(AssocType.REASSOC));
}
if (clientConnectEvent.hasAssocRssi()) {
clientSessionDetails.setAssocRssi(clientConnectEvent.getAssocRssi());
}
clientSessionDetails.setSsid(clientConnectEvent.getSsid());
if (clientConnectEvent.hasUsing11K()) {
clientSessionDetails.setIs11KUsed(clientConnectEvent.getUsing11K());
}
if (clientConnectEvent.hasUsing11R()) {
clientSessionDetails.setIs11RUsed(clientConnectEvent.getUsing11R());
}
if (clientConnectEvent.hasUsing11V()) {
clientSessionDetails.setIs11VUsed(clientConnectEvent.getUsing11V());
}
if (clientConnectEvent.hasIpAddr()) {
try {
clientSessionDetails
.setIpAddress(InetAddress.getByAddress(clientConnectEvent.getIpAddr().toByteArray()));
} catch (UnknownHostException e1) {
LOG.error("Invalid Ip Address for client {}", clientConnectEvent.getIpAddr(), e);
}
}
clientSessionDetails.setAssociationState(AssociationState._802_11_Associated);
if (clientSession.getDetails() == null) {
clientSession.setDetails(clientSessionDetails);
} else {
clientSession.getDetails().mergeSession(clientSessionDetails);
}
clientSession = clientServiceInterface.updateSession(clientSession);
realtimeEventPublisher.publishClientConnectSuccessEvent(customerId, equipmentId, clientConnectEvent);
} else { } else {
clientSession.getDetails().mergeSession(clientSessionDetails); LOG.warn("Cannot update client or client session when no client mac address is present");
} }
clientSession = clientServiceInterface.updateSession(clientSession);
} }
protected void processClientDisconnectEvent(int customerId, long equipmentId, long locationId, protected void processClientDisconnectEvent(int customerId, long equipmentId, long locationId,
sts.OpensyncStats.EventReport.ClientSession apEventClientSession) { sts.OpensyncStats.EventReport.ClientSession apEventClientSession) {
ClientDisconnectEvent clientDisconnectEvent = apEventClientSession.getClientDisconnectEvent(); ClientDisconnectEvent clientDisconnectEvent = apEventClientSession.getClientDisconnectEvent();
realtimeEventPublisher.publishClientDisconnectEvent(customerId, equipmentId, clientDisconnectEvent);
if (clientDisconnectEvent.hasStaMac()) { if (clientDisconnectEvent.hasStaMac()) {
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId, com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId,
@@ -536,6 +543,8 @@ public class MqttStatsPublisher {
clientSession = clientServiceInterface.updateSession(clientSession); clientSession = clientServiceInterface.updateSession(clientSession);
realtimeEventPublisher.publishClientDisconnectEvent(customerId, equipmentId, clientDisconnectEvent);
} else { } else {
LOG.warn("Cannot update client or client session when no client mac address is present"); LOG.warn("Cannot update client or client session when no client mac address is present");
} }
@@ -545,7 +554,6 @@ public class MqttStatsPublisher {
protected void processClientAuthEvent(int customerId, long equipmentId, long locationId, protected void processClientAuthEvent(int customerId, long equipmentId, long locationId,
sts.OpensyncStats.EventReport.ClientSession apEventClientSession) { sts.OpensyncStats.EventReport.ClientSession apEventClientSession) {
ClientAuthEvent clientAuthEvent = apEventClientSession.getClientAuthEvent(); ClientAuthEvent clientAuthEvent = apEventClientSession.getClientAuthEvent();
realtimeEventPublisher.publishClientAuthSystemEvent(customerId, equipmentId, clientAuthEvent);
if (clientAuthEvent.hasStaMac()) { if (clientAuthEvent.hasStaMac()) {
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId, com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId,
@@ -596,6 +604,7 @@ public class MqttStatsPublisher {
} }
clientSession = clientServiceInterface.updateSession(clientSession); clientSession = clientServiceInterface.updateSession(clientSession);
realtimeEventPublisher.publishClientAuthSystemEvent(customerId, equipmentId, clientAuthEvent);
} else { } else {
LOG.warn("Cannot update client or client session when no client mac address is present"); LOG.warn("Cannot update client or client session when no client mac address is present");
@@ -603,11 +612,9 @@ public class MqttStatsPublisher {
} }
protected void processClientAssocEvent(int customerId, long equipmentId, long locationId, protected void processClientAssocEvent(int customerId, long equipmentId, long locationId,
sts.OpensyncStats.EventReport.ClientSession apEventClientSession) { sts.OpensyncStats.EventReport.ClientSession apEventClientSession) {
ClientAssocEvent clientAssocEvent = apEventClientSession.getClientAssocEvent(); ClientAssocEvent clientAssocEvent = apEventClientSession.getClientAssocEvent();
realtimeEventPublisher.publishClientAssocEvent(customerId, equipmentId, clientAssocEvent);
if (clientAssocEvent.hasStaMac()) { if (clientAssocEvent.hasStaMac()) {
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId, com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId,
@@ -672,6 +679,7 @@ public class MqttStatsPublisher {
} }
clientSession = clientServiceInterface.updateSession(clientSession); clientSession = clientServiceInterface.updateSession(clientSession);
realtimeEventPublisher.publishClientAssocEvent(customerId, equipmentId, clientAssocEvent);
} else { } else {
LOG.warn("Cannot update client or client session when no client mac address is present"); LOG.warn("Cannot update client or client session when no client mac address is present");
@@ -679,8 +687,6 @@ public class MqttStatsPublisher {
} }
protected void processClientFailureEvent(int customerId, long equipmentId, long locationId, protected void processClientFailureEvent(int customerId, long equipmentId, long locationId,
sts.OpensyncStats.EventReport.ClientSession apEventClientSession) { sts.OpensyncStats.EventReport.ClientSession apEventClientSession) {
ClientFailureEvent clientFailureEvent = apEventClientSession.getClientFailureEvent(); ClientFailureEvent clientFailureEvent = apEventClientSession.getClientFailureEvent();
@@ -736,19 +742,16 @@ public class MqttStatsPublisher {
} }
clientSession = clientServiceInterface.updateSession(clientSession); clientSession = clientServiceInterface.updateSession(clientSession);
realtimeEventPublisher.publishClientFailureEvent(customerId, equipmentId, clientFailureEvent);
} else { } else {
LOG.warn("Cannot update client or client session when no client mac address is present"); LOG.warn("Cannot update client or client session when no client mac address is present");
} }
} }
protected void processClientFirstDataEvent(int customerId, long equipmentId, long locationId, protected void processClientFirstDataEvent(int customerId, long equipmentId, long locationId,
sts.OpensyncStats.EventReport.ClientSession apEventClientSession) { sts.OpensyncStats.EventReport.ClientSession apEventClientSession) {
ClientFirstDataEvent clientFirstDataEvent = apEventClientSession.getClientFirstDataEvent(); ClientFirstDataEvent clientFirstDataEvent = apEventClientSession.getClientFirstDataEvent();
realtimeEventPublisher.publishClientFirstDataEvent(customerId, equipmentId, clientFirstDataEvent);
if (clientFirstDataEvent.hasStaMac()) { if (clientFirstDataEvent.hasStaMac()) {
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId, com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId,
@@ -798,6 +801,7 @@ public class MqttStatsPublisher {
} }
clientSession = clientServiceInterface.updateSession(clientSession); clientSession = clientServiceInterface.updateSession(clientSession);
realtimeEventPublisher.publishClientFirstDataEvent(customerId, equipmentId, clientFirstDataEvent);
} else { } else {
LOG.warn("Cannot update client or client session when no client mac address is present"); LOG.warn("Cannot update client or client session when no client mac address is present");
@@ -805,11 +809,9 @@ public class MqttStatsPublisher {
} }
protected void processClientIdEvent(int customerId, long equipmentId, long locationId, protected void processClientIdEvent(int customerId, long equipmentId, long locationId,
sts.OpensyncStats.EventReport.ClientSession apEventClientSession) { sts.OpensyncStats.EventReport.ClientSession apEventClientSession) {
ClientIdEvent clientIdEvent = apEventClientSession.getClientIdEvent(); ClientIdEvent clientIdEvent = apEventClientSession.getClientIdEvent();
realtimeEventPublisher.publishClientIdEvent(customerId, equipmentId, clientIdEvent);
if (clientIdEvent.hasCltMac()) { if (clientIdEvent.hasCltMac()) {
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId, com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId,
@@ -849,6 +851,7 @@ public class MqttStatsPublisher {
} }
clientSession = clientServiceInterface.updateSession(clientSession); clientSession = clientServiceInterface.updateSession(clientSession);
realtimeEventPublisher.publishClientIdEvent(customerId, equipmentId, clientIdEvent);
} else { } else {
LOG.warn("Cannot update client or client session when no client mac address is present"); LOG.warn("Cannot update client or client session when no client mac address is present");
@@ -856,12 +859,9 @@ public class MqttStatsPublisher {
} }
protected void processClientIpEvent(int customerId, long equipmentId, long locationId, protected void processClientIpEvent(int customerId, long equipmentId, long locationId,
sts.OpensyncStats.EventReport.ClientSession apEventClientSession) { sts.OpensyncStats.EventReport.ClientSession apEventClientSession) {
ClientIpEvent clientIpEvent = apEventClientSession.getClientIpEvent(); ClientIpEvent clientIpEvent = apEventClientSession.getClientIpEvent();
realtimeEventPublisher.publishClientIpEvent(customerId, equipmentId, clientIpEvent);
if (clientIpEvent.hasStaMac()) { if (clientIpEvent.hasStaMac()) {
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId, com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId,
@@ -908,6 +908,7 @@ public class MqttStatsPublisher {
} }
clientSession = clientServiceInterface.updateSession(clientSession); clientSession = clientServiceInterface.updateSession(clientSession);
realtimeEventPublisher.publishClientIpEvent(customerId, equipmentId, clientIpEvent);
} else { } else {
LOG.warn("Cannot update client or client session when no clientmac address is present"); LOG.warn("Cannot update client or client session when no clientmac address is present");
@@ -918,7 +919,6 @@ public class MqttStatsPublisher {
protected void processClientTimeoutEvent(int customerId, long equipmentId, long locationId, protected void processClientTimeoutEvent(int customerId, long equipmentId, long locationId,
sts.OpensyncStats.EventReport.ClientSession apEventClientSession) { sts.OpensyncStats.EventReport.ClientSession apEventClientSession) {
ClientTimeoutEvent clientTimeoutEvent = apEventClientSession.getClientTimeoutEvent(); ClientTimeoutEvent clientTimeoutEvent = apEventClientSession.getClientTimeoutEvent();
realtimeEventPublisher.publishClientTimeoutEvent(customerId, equipmentId, clientTimeoutEvent);
if (clientTimeoutEvent.hasStaMac()) { if (clientTimeoutEvent.hasStaMac()) {
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId, com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId,
@@ -976,6 +976,7 @@ public class MqttStatsPublisher {
} }
clientSession = clientServiceInterface.updateSession(clientSession); clientSession = clientServiceInterface.updateSession(clientSession);
realtimeEventPublisher.publishClientTimeoutEvent(customerId, equipmentId, clientTimeoutEvent);
} else { } else {
LOG.warn("Cannot update client or client session when no client mac address is present"); LOG.warn("Cannot update client or client session when no client mac address is present");
@@ -983,8 +984,6 @@ public class MqttStatsPublisher {
} }
void populateSipCallReport(List<ServiceMetric> metricRecordList, Report report, int customerId, long equipmentId, void populateSipCallReport(List<ServiceMetric> metricRecordList, Report report, int customerId, long equipmentId,
String apId, long locationId) { String apId, long locationId) {
// only in case it is not there, we will just use the time when we // only in case it is not there, we will just use the time when we

View File

@@ -25,14 +25,12 @@ import com.telecominfraproject.wlan.opensync.util.OvsdbToWlanCloudTypeMappingUti
import com.telecominfraproject.wlan.systemevent.equipment.realtime.RealTimeChannelHopEvent; import com.telecominfraproject.wlan.systemevent.equipment.realtime.RealTimeChannelHopEvent;
import com.telecominfraproject.wlan.systemevent.equipment.realtime.RealTimeEventType; import com.telecominfraproject.wlan.systemevent.equipment.realtime.RealTimeEventType;
import com.telecominfraproject.wlan.systemevent.models.SystemEvent; import com.telecominfraproject.wlan.systemevent.models.SystemEvent;
import com.telecominfraproject.wlan.systemevent.models.SystemEventRecord;
import sts.OpensyncStats.AssocType; import sts.OpensyncStats.AssocType;
import sts.OpensyncStats.CTReasonType; import sts.OpensyncStats.CTReasonType;
import sts.OpensyncStats.ChannelSwitchReason; import sts.OpensyncStats.ChannelSwitchReason;
import sts.OpensyncStats.DeviceType; import sts.OpensyncStats.DeviceType;
import sts.OpensyncStats.EventReport; import sts.OpensyncStats.EventReport;
import sts.OpensyncStats.FrameType;
import sts.OpensyncStats.EventReport.ClientAssocEvent; import sts.OpensyncStats.EventReport.ClientAssocEvent;
import sts.OpensyncStats.EventReport.ClientAuthEvent; import sts.OpensyncStats.EventReport.ClientAuthEvent;
import sts.OpensyncStats.EventReport.ClientConnectEvent; import sts.OpensyncStats.EventReport.ClientConnectEvent;
@@ -42,6 +40,15 @@ import sts.OpensyncStats.EventReport.ClientFirstDataEvent;
import sts.OpensyncStats.EventReport.ClientIdEvent; import sts.OpensyncStats.EventReport.ClientIdEvent;
import sts.OpensyncStats.EventReport.ClientIpEvent; import sts.OpensyncStats.EventReport.ClientIpEvent;
import sts.OpensyncStats.EventReport.ClientTimeoutEvent; import sts.OpensyncStats.EventReport.ClientTimeoutEvent;
import sts.OpensyncStats.EventReport.DhcpAckEvent;
import sts.OpensyncStats.EventReport.DhcpDeclineEvent;
import sts.OpensyncStats.EventReport.DhcpDiscoverEvent;
import sts.OpensyncStats.EventReport.DhcpInformEvent;
import sts.OpensyncStats.EventReport.DhcpNakEvent;
import sts.OpensyncStats.EventReport.DhcpOfferEvent;
import sts.OpensyncStats.EventReport.DhcpRequestEvent;
import sts.OpensyncStats.EventReport.DhcpTransaction;
import sts.OpensyncStats.FrameType;
@org.springframework.context.annotation.Profile("opensync_cloud_config") @org.springframework.context.annotation.Profile("opensync_cloud_config")
@Component @Component
@@ -53,17 +60,17 @@ public class RealtimeEventPublisher {
@Autowired @Autowired
private EquipmentServiceInterface equipmentServiceInterface; private EquipmentServiceInterface equipmentServiceInterface;
private static final Logger LOG = LoggerFactory private static final Logger LOG = LoggerFactory.getLogger(RealtimeEventPublisher.class);
.getLogger(RealtimeEventPublisher.class);
void publishChannelHopEvents(int customerId, long equipmentId, EventReport e) { void publishChannelHopEvents(int customerId, long equipmentId, EventReport e) {
LOG.info("publishChannelHopEvents for customerId {} equipmentId {}"); LOG.info("publishChannelHopEvents for customerId {} equipmentId {}");
List<SystemEvent> events = new ArrayList<>(); List<SystemEvent> events = new ArrayList<>();
List<SystemEventRecord> eventRecords = new ArrayList<>();
for (sts.OpensyncStats.EventReport.ChannelSwitchEvent channelSwitchEvent : e.getChannelSwitchList()) { for (sts.OpensyncStats.EventReport.ChannelSwitchEvent channelSwitchEvent : e.getChannelSwitchList()) {
LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", e, customerId, equipmentId);
Equipment equipment = equipmentServiceInterface.getOrNull(equipmentId); Equipment equipment = equipmentServiceInterface.getOrNull(equipmentId);
if (equipment == null) if (equipment == null)
continue; continue;
@@ -116,21 +123,27 @@ public class RealtimeEventPublisher {
reason, timestamp); reason, timestamp);
events.add(channelHopEvent); events.add(channelHopEvent);
eventRecords.add(new SystemEventRecord(channelHopEvent));
LOG.debug("publishChannelHopEvents:Adding ChannelHopEvent to bulk list {}", channelHopEvent); LOG.debug("publishChannelHopEvents:Adding ChannelHopEvent to bulk list {}", channelHopEvent);
} }
if (events.size() > 0) { if (events.size() > 0) {
LOG.info("publishChannelHopEvents:publishEventsBulk: {}", events); LOG.info("publishChannelHopEvents:publishEventsBulk: {}", events);
cloudEventDispatcherInterface.publishEventsBulk(events); cloudEventDispatcherInterface.publishEventsBulk(events);
} else {
LOG.info("publishChannelHopEvents:No ChannelHopEvents in report");
} }
} }
void publishClientConnectSuccessEvent(int customerId, long equipmentId, ClientConnectEvent clientConnectEvent) { void publishClientConnectSuccessEvent(int customerId, long equipmentId, ClientConnectEvent clientConnectEvent) {
ClientConnectSuccessEvent clientEvent = new ClientConnectSuccessEvent();
LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientConnectEvent, customerId,
equipmentId);
ClientConnectSuccessEvent clientEvent;
if (clientConnectEvent.hasTimestampMs()) {
clientEvent = new ClientConnectSuccessEvent(Long.valueOf(clientConnectEvent.getTimestampMs()));
} else {
clientEvent = new ClientConnectSuccessEvent(System.currentTimeMillis());
}
clientEvent.setMacAddress(MacAddress.valueOf(clientConnectEvent.getStaMac())); clientEvent.setMacAddress(MacAddress.valueOf(clientConnectEvent.getStaMac()));
clientEvent.setRadioType(OvsdbToWlanCloudTypeMappingUtility clientEvent.setRadioType(OvsdbToWlanCloudTypeMappingUtility
.getRadioTypeFromOpensyncStatsRadioBandType(clientConnectEvent.getBand())); .getRadioTypeFromOpensyncStatsRadioBandType(clientConnectEvent.getBand()));
@@ -208,17 +221,22 @@ public class RealtimeEventPublisher {
clientEvent.setCustomerId(customerId); clientEvent.setCustomerId(customerId);
clientEvent.setEquipmentId(equipmentId); clientEvent.setEquipmentId(equipmentId);
LOG.info("publishing client event {} to cloud", clientEvent);
cloudEventDispatcherInterface.publishEvent(clientEvent); cloudEventDispatcherInterface.publishEvent(clientEvent);
} }
void publishClientDisconnectEvent(int customerId, long equipmentId, ClientDisconnectEvent clientDisconnectEvent) { void publishClientDisconnectEvent(int customerId, long equipmentId, ClientDisconnectEvent clientDisconnectEvent) {
LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientDisconnectEvent, customerId,
equipmentId);
com.telecominfraproject.wlan.client.models.events.realtime.ClientDisconnectEvent clientEvent; com.telecominfraproject.wlan.client.models.events.realtime.ClientDisconnectEvent clientEvent;
if (clientDisconnectEvent.hasTimestampMs()) { if (clientDisconnectEvent.hasTimestampMs()) {
long timestampMs = clientDisconnectEvent.getTimestampMs();
clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientDisconnectEvent( clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientDisconnectEvent(
timestampMs); Long.valueOf(clientDisconnectEvent.getTimestampMs()));
} else { } else {
clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientDisconnectEvent( clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientDisconnectEvent(
System.currentTimeMillis()); System.currentTimeMillis());
@@ -261,17 +279,19 @@ public class RealtimeEventPublisher {
clientEvent.setCustomerId(customerId); clientEvent.setCustomerId(customerId);
clientEvent.setEquipmentId(equipmentId); clientEvent.setEquipmentId(equipmentId);
LOG.info("publishing client event {} to cloud", clientEvent);
cloudEventDispatcherInterface.publishEvent(clientEvent); cloudEventDispatcherInterface.publishEvent(clientEvent);
} }
void publishClientAuthSystemEvent(int customerId, long equipmentId, ClientAuthEvent clientAuthEvent) { void publishClientAuthSystemEvent(int customerId, long equipmentId, ClientAuthEvent clientAuthEvent) {
LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientAuthEvent, customerId, equipmentId);
com.telecominfraproject.wlan.client.models.events.realtime.ClientAuthEvent clientEvent; com.telecominfraproject.wlan.client.models.events.realtime.ClientAuthEvent clientEvent;
if (clientAuthEvent.hasTimestampMs()) { if (clientAuthEvent.hasTimestampMs()) {
long timestamp = clientAuthEvent.getTimestampMs(); clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientAuthEvent(Long.valueOf(clientAuthEvent.getTimestampMs()));
clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientAuthEvent(timestamp);
} else { } else {
clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientAuthEvent( clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientAuthEvent(
System.currentTimeMillis()); System.currentTimeMillis());
@@ -288,17 +308,19 @@ public class RealtimeEventPublisher {
} }
clientEvent.setCustomerId(customerId); clientEvent.setCustomerId(customerId);
clientEvent.setEquipmentId(equipmentId); clientEvent.setEquipmentId(equipmentId);
LOG.info("publishing client event {} to cloud", clientEvent);
cloudEventDispatcherInterface.publishEvent(clientEvent); cloudEventDispatcherInterface.publishEvent(clientEvent);
} }
void publishClientAssocEvent(int customerId, long equipmentId, ClientAssocEvent clientAssocEvent) { void publishClientAssocEvent(int customerId, long equipmentId, ClientAssocEvent clientAssocEvent) {
LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientAssocEvent, customerId, equipmentId);
com.telecominfraproject.wlan.client.models.events.realtime.ClientAssocEvent clientEvent; com.telecominfraproject.wlan.client.models.events.realtime.ClientAssocEvent clientEvent;
if (clientAssocEvent.hasTimestampMs()) { if (clientAssocEvent.hasTimestampMs()) {
long timestamp = clientAssocEvent.getTimestampMs(); clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientAssocEvent(Long.valueOf(clientAssocEvent.getTimestampMs()));
clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientAssocEvent(timestamp);
} else { } else {
clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientAssocEvent( clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientAssocEvent(
System.currentTimeMillis()); System.currentTimeMillis());
@@ -340,16 +362,20 @@ public class RealtimeEventPublisher {
clientEvent.setCustomerId(customerId); clientEvent.setCustomerId(customerId);
clientEvent.setEquipmentId(equipmentId); clientEvent.setEquipmentId(equipmentId);
LOG.info("publishing client event {} to cloud", clientEvent);
cloudEventDispatcherInterface.publishEvent(clientEvent); cloudEventDispatcherInterface.publishEvent(clientEvent);
} }
void publishClientFailureEvent(int customerId, long equipmentId, ClientFailureEvent clientFailureEvent) { void publishClientFailureEvent(int customerId, long equipmentId, ClientFailureEvent clientFailureEvent) {
LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientFailureEvent, customerId,
equipmentId);
com.telecominfraproject.wlan.client.models.events.realtime.ClientFailureEvent clientEvent; com.telecominfraproject.wlan.client.models.events.realtime.ClientFailureEvent clientEvent;
if (clientFailureEvent.hasTimestampMs()) { if (clientFailureEvent.hasTimestampMs()) {
long timestamp = clientFailureEvent.getTimestampMs(); clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientFailureEvent(Long.valueOf(clientFailureEvent.getTimestampMs()));
clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientFailureEvent(timestamp);
} else { } else {
clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientFailureEvent( clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientFailureEvent(
System.currentTimeMillis()); System.currentTimeMillis());
@@ -369,16 +395,20 @@ public class RealtimeEventPublisher {
clientEvent.setCustomerId(customerId); clientEvent.setCustomerId(customerId);
clientEvent.setEquipmentId(equipmentId); clientEvent.setEquipmentId(equipmentId);
LOG.info("publishing client event {} to cloud", clientEvent);
cloudEventDispatcherInterface.publishEvent(clientEvent); cloudEventDispatcherInterface.publishEvent(clientEvent);
} }
void publishClientFirstDataEvent(int customerId, long equipmentId, ClientFirstDataEvent clientFirstDataEvent) { void publishClientFirstDataEvent(int customerId, long equipmentId, ClientFirstDataEvent clientFirstDataEvent) {
LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientFirstDataEvent, customerId,
equipmentId);
com.telecominfraproject.wlan.client.models.events.realtime.ClientFirstDataEvent clientEvent; com.telecominfraproject.wlan.client.models.events.realtime.ClientFirstDataEvent clientEvent;
if (clientFirstDataEvent.hasTimestampMs()) { if (clientFirstDataEvent.hasTimestampMs()) {
long timestamp = clientFirstDataEvent.getTimestampMs();
clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientFirstDataEvent( clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientFirstDataEvent(
timestamp); Long.valueOf(clientFirstDataEvent.getTimestampMs()));
} else { } else {
clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientFirstDataEvent( clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientFirstDataEvent(
System.currentTimeMillis()); System.currentTimeMillis());
@@ -397,16 +427,20 @@ public class RealtimeEventPublisher {
clientEvent.setCustomerId(customerId); clientEvent.setCustomerId(customerId);
clientEvent.setEquipmentId(equipmentId); clientEvent.setEquipmentId(equipmentId);
LOG.info("publishing client event {} to cloud", clientEvent);
cloudEventDispatcherInterface.publishEvent(clientEvent); cloudEventDispatcherInterface.publishEvent(clientEvent);
} }
void publishClientIdEvent(int customerId, long equipmentId, ClientIdEvent clientIdEvent) { void publishClientIdEvent(int customerId, long equipmentId, ClientIdEvent clientIdEvent) {
LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientIdEvent, customerId, equipmentId);
com.telecominfraproject.wlan.client.models.events.realtime.ClientIdEvent clientEvent; com.telecominfraproject.wlan.client.models.events.realtime.ClientIdEvent clientEvent;
if (clientIdEvent.hasTimestampMs()) { if (clientIdEvent.hasTimestampMs()) {
long timestamp = clientIdEvent.getTimestampMs(); clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientIdEvent(Long.valueOf(clientIdEvent.getTimestampMs()));
clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientIdEvent(timestamp);
} else { } else {
clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientIdEvent( clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientIdEvent(
System.currentTimeMillis()); System.currentTimeMillis());
@@ -420,16 +454,20 @@ public class RealtimeEventPublisher {
clientEvent.setCustomerId(customerId); clientEvent.setCustomerId(customerId);
clientEvent.setEquipmentId(equipmentId); clientEvent.setEquipmentId(equipmentId);
LOG.info("publishing client event {} to cloud", clientEvent);
cloudEventDispatcherInterface.publishEvent(clientEvent); cloudEventDispatcherInterface.publishEvent(clientEvent);
} }
void publishClientIpEvent(int customerId, long equipmentId, ClientIpEvent clientIpEvent) { void publishClientIpEvent(int customerId, long equipmentId, ClientIpEvent clientIpEvent) {
LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientIpEvent, customerId, equipmentId);
com.telecominfraproject.wlan.client.models.events.realtime.ClientIpAddressEvent clientEvent; com.telecominfraproject.wlan.client.models.events.realtime.ClientIpAddressEvent clientEvent;
if (clientIpEvent.hasTimestampMs()) { if (clientIpEvent.hasTimestampMs()) {
long timestamp = clientIpEvent.getTimestampMs();
clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientIpAddressEvent( clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientIpAddressEvent(
timestamp); Long.valueOf(clientIpEvent.getTimestampMs()));
} else { } else {
clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientIpAddressEvent( clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientIpAddressEvent(
System.currentTimeMillis()); System.currentTimeMillis());
@@ -443,16 +481,20 @@ public class RealtimeEventPublisher {
clientEvent.setCustomerId(customerId); clientEvent.setCustomerId(customerId);
clientEvent.setEquipmentId(equipmentId); clientEvent.setEquipmentId(equipmentId);
LOG.info("publishing client event {} to cloud", clientEvent);
cloudEventDispatcherInterface.publishEvent(clientEvent); cloudEventDispatcherInterface.publishEvent(clientEvent);
} }
void publishClientTimeoutEvent(int customerId, long equipmentId, ClientTimeoutEvent clientTimeoutEvent) { void publishClientTimeoutEvent(int customerId, long equipmentId, ClientTimeoutEvent clientTimeoutEvent) {
LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientTimeoutEvent, customerId,
equipmentId);
com.telecominfraproject.wlan.client.models.events.realtime.ClientTimeoutEvent clientEvent; com.telecominfraproject.wlan.client.models.events.realtime.ClientTimeoutEvent clientEvent;
if (clientTimeoutEvent.hasTimestampMs()) { if (clientTimeoutEvent.hasTimestampMs()) {
long timestamp = clientTimeoutEvent.getTimestampMs(); clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientTimeoutEvent(Long.valueOf(clientTimeoutEvent.getTimestampMs()));
clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientTimeoutEvent(timestamp);
} else { } else {
clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientTimeoutEvent( clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientTimeoutEvent(
System.currentTimeMillis()); System.currentTimeMillis());
@@ -474,7 +516,50 @@ public class RealtimeEventPublisher {
clientEvent.setCustomerId(customerId); clientEvent.setCustomerId(customerId);
clientEvent.setEquipmentId(equipmentId); clientEvent.setEquipmentId(equipmentId);
LOG.info("publishing client event {} to cloud", clientEvent);
cloudEventDispatcherInterface.publishEvent(clientEvent); cloudEventDispatcherInterface.publishEvent(clientEvent);
} }
void publishDhcpTransactionEvents(int customerId, long equipmentId,
List<DhcpTransaction> dhcpTransactionList) {
for (DhcpTransaction dhcpTransaction : dhcpTransactionList) {
for (DhcpAckEvent ackEvent : dhcpTransaction.getDhcpAckEventList()) {
LOG.info("DhcpAckEvent {}", ackEvent);
}
for (DhcpNakEvent nakEvent : dhcpTransaction.getDhcpNakEventList()) {
LOG.info("DhcpNakEvent {}", nakEvent);
}
for (DhcpOfferEvent offerEvent : dhcpTransaction.getDhcpOfferEventList()) {
LOG.info("DhcpOfferEvent {}", offerEvent);
}
for (DhcpInformEvent informEvent : dhcpTransaction.getDhcpInformEventList()) {
LOG.info("DhcpInformEvent {}", informEvent);
}
for (DhcpDeclineEvent declineEvent : dhcpTransaction.getDhcpDeclineEventList()) {
LOG.info("DhcpDeclineEvent {}", declineEvent);
}
for (DhcpRequestEvent requestEvent : dhcpTransaction.getDhcpRequestEventList()) {
LOG.info("DhcpRequestEvent {}", requestEvent);
}
for (DhcpDiscoverEvent discoverEvent : dhcpTransaction.getDhcpDiscoverEventList()) {
LOG.info("DhcpDiscoverEvent {}", discoverEvent);
}
}
}
} }