mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-03 20:17:53 +00:00
WIFI-425: Cloud Back End for Events phase 2
Protobuf changes re AP handling events.
This commit is contained in:
@@ -94,8 +94,10 @@ import sts.OpensyncStats.ClientReport;
|
||||
import sts.OpensyncStats.DNSProbeMetric;
|
||||
import sts.OpensyncStats.Device;
|
||||
import sts.OpensyncStats.Device.RadioTemp;
|
||||
import sts.OpensyncStats.EventReport;
|
||||
import sts.OpensyncStats.EventReport.ClientAssocEvent;
|
||||
import sts.OpensyncStats.EventReport.ClientAuthEvent;
|
||||
import sts.OpensyncStats.EventReport.ClientConnectEvent;
|
||||
import sts.OpensyncStats.EventReport.ClientDisconnectEvent;
|
||||
import sts.OpensyncStats.EventReport.ClientFailureEvent;
|
||||
import sts.OpensyncStats.EventReport.ClientFirstDataEvent;
|
||||
@@ -288,21 +290,47 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
void processEventReport(Report report, int customerId, long equipmentId, String apId, long locationId) {
|
||||
|
||||
report.getEventReportList().stream().forEach(e -> {
|
||||
LOG.info("Received EventReport {}", e);
|
||||
|
||||
if (e.hasClientAssocEvent()) {
|
||||
for (sts.OpensyncStats.EventReport.ClientSession apEventClientSession : e.getClientSessionList()) {
|
||||
|
||||
LOG.info("Processing EventReport::ClientSession {}", apEventClientSession);
|
||||
|
||||
ClientAssocEvent clientAssocEvent = e.getClientAssocEvent();
|
||||
processClientConnectEvent(customerId, equipmentId, locationId, e, apEventClientSession);
|
||||
|
||||
if (clientAssocEvent.hasStaMac()) {
|
||||
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface
|
||||
.getOrNull(customerId, new MacAddress(clientAssocEvent.getStaMac()));
|
||||
processClientDisconnectEvent(customerId, equipmentId, locationId, apEventClientSession);
|
||||
|
||||
processClientAuthEvent(customerId, equipmentId, locationId, apEventClientSession);
|
||||
|
||||
processClientAssocEvent(customerId, equipmentId, locationId, apEventClientSession);
|
||||
|
||||
processClientFailureEvent(customerId, equipmentId, locationId, apEventClientSession);
|
||||
|
||||
processClientFirstDataEvent(customerId, equipmentId, locationId, apEventClientSession);
|
||||
|
||||
processClientIdEvent(customerId, equipmentId, locationId, apEventClientSession);
|
||||
|
||||
processClientIpEvent(customerId, equipmentId, locationId, apEventClientSession);
|
||||
|
||||
processClientTimeoutEvent(customerId, equipmentId, locationId, apEventClientSession);
|
||||
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
protected void processClientConnectEvent(int customerId, long equipmentId, long locationId, EventReport e,
|
||||
sts.OpensyncStats.EventReport.ClientSession apEventClientSession) {
|
||||
for (ClientConnectEvent clientConnectEvent : apEventClientSession.getClientConnectEventList()) {
|
||||
|
||||
if (clientConnectEvent.hasStaMac()) {
|
||||
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId,
|
||||
new MacAddress(clientConnectEvent.getStaMac()));
|
||||
if (client == null) {
|
||||
client = new com.telecominfraproject.wlan.client.models.Client();
|
||||
|
||||
client.setCustomerId(customerId);
|
||||
client.setMacAddress(new MacAddress(clientAssocEvent.getStaMac()));
|
||||
client.setMacAddress(new MacAddress(clientConnectEvent.getStaMac()));
|
||||
|
||||
client.setDetails(new ClientInfoDetails());
|
||||
|
||||
@@ -311,112 +339,105 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
}
|
||||
|
||||
ClientSession clientSession = clientServiceInterface.getSessionOrNull(customerId, equipmentId,
|
||||
new MacAddress(clientAssocEvent.getStaMac()));
|
||||
new MacAddress(clientConnectEvent.getStaMac()));
|
||||
|
||||
if (clientSession == null) {
|
||||
clientSession = new ClientSession();
|
||||
}
|
||||
|
||||
clientSession.setCustomerId(customerId);
|
||||
clientSession.setEquipmentId(equipmentId);
|
||||
clientSession.setLocationId(locationId);
|
||||
clientSession.setMacAddress(new MacAddress(clientAssocEvent.getStaMac()));
|
||||
clientSession.setMacAddress(new MacAddress(clientConnectEvent.getStaMac()));
|
||||
|
||||
ClientSessionDetails clientSessionDetails = new ClientSessionDetails();
|
||||
if (clientAssocEvent.hasUsing11K()) {
|
||||
clientSessionDetails.setIs11KUsed(clientAssocEvent.getUsing11K());
|
||||
clientSessionDetails.setSessionId(apEventClientSession.getSessionId());
|
||||
|
||||
if (clientConnectEvent.hasFbtUsed()) {
|
||||
|
||||
// TODO: mapping?
|
||||
|
||||
}
|
||||
if (clientAssocEvent.hasUsing11R()) {
|
||||
clientSessionDetails.setIs11RUsed(clientAssocEvent.getUsing11R());
|
||||
if (clientConnectEvent.hasEvTimeBootupInUsAssoc()) {
|
||||
clientSessionDetails.setAssocTimestamp(clientConnectEvent.getEvTimeBootupInUsAssoc());
|
||||
}
|
||||
if (clientAssocEvent.hasUsing11V()) {
|
||||
clientSessionDetails.setIs11VUsed(clientAssocEvent.getUsing11V());
|
||||
|
||||
if (clientConnectEvent.hasEvTimeBootupInUsAuth()) {
|
||||
clientSessionDetails.setAuthTimestamp(clientConnectEvent.getEvTimeBootupInUsAuth());
|
||||
}
|
||||
if (clientAssocEvent.hasAssocType()) {
|
||||
|
||||
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()));
|
||||
}
|
||||
|
||||
if (clientConnectEvent.hasBand()) {
|
||||
clientSessionDetails.setRadioType(OvsdbToWlanCloudTypeMappingUtility
|
||||
.getRadioTypeFromOpensyncStatsRadioBandType(clientConnectEvent.getBand()));
|
||||
}
|
||||
|
||||
if (clientConnectEvent.hasAssocType()) {
|
||||
clientSessionDetails
|
||||
.setIsReassociation(clientAssocEvent.getAssocType().equals(AssocType.REASSOC));
|
||||
.setIsReassociation(clientConnectEvent.getAssocType().equals(AssocType.REASSOC));
|
||||
|
||||
}
|
||||
if (clientAssocEvent.hasBand()) {
|
||||
clientSessionDetails.setRadioType(OvsdbToWlanCloudTypeMappingUtility
|
||||
.getRadioTypeFromOpensyncStatsRadioBandType(clientAssocEvent.getBand()));
|
||||
|
||||
if (clientConnectEvent.hasAssocRssi()) {
|
||||
clientSessionDetails.setAssocRssi(clientConnectEvent.getAssocRssi());
|
||||
}
|
||||
if (clientAssocEvent.hasRssi()) {
|
||||
clientSessionDetails.setAssocRssi(clientAssocEvent.getRssi());
|
||||
|
||||
if (clientConnectEvent.hasSsid()) {
|
||||
clientSessionDetails.setSsid(clientConnectEvent.getSsid());
|
||||
}
|
||||
if (clientAssocEvent.hasSessionId()) {
|
||||
clientSessionDetails.setSessionId(clientAssocEvent.getSessionId());
|
||||
|
||||
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);
|
||||
}
|
||||
if (clientAssocEvent.hasSsid()) {
|
||||
clientSessionDetails.setSsid(clientAssocEvent.getSsid());
|
||||
}
|
||||
if (clientAssocEvent.hasStatus()) {
|
||||
clientSessionDetails.setAssociationStatus(clientAssocEvent.getStatus());
|
||||
clientSessionDetails.setAssociationState(AssociationState._802_11_Associated);
|
||||
}
|
||||
|
||||
if (clientSession.getDetails() == null) {
|
||||
clientSession.setDetails(clientSessionDetails);
|
||||
} else {
|
||||
clientSession.getDetails().mergeSession(clientSessionDetails);
|
||||
}
|
||||
|
||||
clientSession = clientServiceInterface.updateSession(clientSession);
|
||||
|
||||
} else {
|
||||
LOG.info("Cannot update client or client session when no client mac address is present");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (e.hasClientAuthEvent()) {
|
||||
|
||||
|
||||
ClientAuthEvent clientAuthEvent = e.getClientAuthEvent();
|
||||
|
||||
|
||||
if (clientAuthEvent.hasStaMac()) {
|
||||
|
||||
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface
|
||||
.getOrNull(customerId, new MacAddress(clientAuthEvent.getStaMac()));
|
||||
if (client == null) {
|
||||
client = new com.telecominfraproject.wlan.client.models.Client();
|
||||
|
||||
client.setCustomerId(customerId);
|
||||
client.setMacAddress(new MacAddress(clientAuthEvent.getStaMac()));
|
||||
|
||||
client.setDetails(new ClientInfoDetails());
|
||||
|
||||
client = clientServiceInterface.create(client);
|
||||
|
||||
}
|
||||
|
||||
ClientSession clientSession = clientServiceInterface.getSessionOrNull(customerId, equipmentId,
|
||||
new MacAddress(clientAuthEvent.getStaMac()));
|
||||
|
||||
if (clientSession == null) {
|
||||
clientSession = new ClientSession();
|
||||
}
|
||||
|
||||
clientSession.setCustomerId(customerId);
|
||||
clientSession.setEquipmentId(equipmentId);
|
||||
clientSession.setLocationId(locationId);
|
||||
clientSession.setMacAddress(new MacAddress(clientAuthEvent.getStaMac()));
|
||||
|
||||
ClientSessionDetails clientSessionDetails = new ClientSessionDetails();
|
||||
|
||||
if (clientAuthEvent.hasSessionId()) {
|
||||
clientSessionDetails.setSessionId(clientAuthEvent.getSessionId());
|
||||
}
|
||||
if (clientAuthEvent.hasBand()) {
|
||||
clientSessionDetails.setRadioType(OvsdbToWlanCloudTypeMappingUtility
|
||||
.getRadioTypeFromOpensyncStatsRadioBandType(clientAuthEvent.getBand()));
|
||||
}
|
||||
if (clientAuthEvent.hasSsid()) {
|
||||
clientSessionDetails.setSsid(clientAuthEvent.getSsid());
|
||||
}
|
||||
if (clientAuthEvent.hasAuthStatus()) {
|
||||
clientSessionDetails.setAssociationState(AssociationState._802_11_Authenticated);
|
||||
}
|
||||
|
||||
|
||||
if (clientSession.getDetails() == null) {
|
||||
@@ -427,21 +448,20 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
|
||||
clientSession = clientServiceInterface.updateSession(clientSession);
|
||||
|
||||
|
||||
} else {
|
||||
LOG.info("Cannot update client or client session when no client mac address is present");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (e.hasClientDisconnectEvent()) {
|
||||
ClientDisconnectEvent clientDisconnectEvent = e.getClientDisconnectEvent();
|
||||
protected void processClientDisconnectEvent(int customerId, long equipmentId, long locationId,
|
||||
sts.OpensyncStats.EventReport.ClientSession apEventClientSession) {
|
||||
for (ClientDisconnectEvent clientDisconnectEvent : apEventClientSession.getClientDisconnectEventList()) {
|
||||
|
||||
if (clientDisconnectEvent.hasStaMac()) {
|
||||
|
||||
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface
|
||||
.getOrNull(customerId, new MacAddress(clientDisconnectEvent.getStaMac()));
|
||||
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId,
|
||||
new MacAddress(clientDisconnectEvent.getStaMac()));
|
||||
if (client == null) {
|
||||
client = new com.telecominfraproject.wlan.client.models.Client();
|
||||
|
||||
@@ -484,9 +504,8 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
clientSessionDetails.setAssocRssi(clientDisconnectEvent.getRssi());
|
||||
}
|
||||
|
||||
if (clientDisconnectEvent.hasSessionId()) {
|
||||
clientSessionDetails.setSessionId(clientDisconnectEvent.getSessionId());
|
||||
}
|
||||
clientSessionDetails.setSessionId(apEventClientSession.getSessionId());
|
||||
|
||||
|
||||
if (clientDisconnectEvent.hasLrcvUpTsInUs()) {
|
||||
clientSessionDetails.setLastRxTimestamp(clientDisconnectEvent.getLrcvUpTsInUs());
|
||||
@@ -497,8 +516,7 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
}
|
||||
|
||||
if (clientDisconnectEvent.hasInternalRc()) {
|
||||
clientSessionDetails
|
||||
.setDisconnectByClientInternalReasonCode(clientDisconnectEvent.getInternalRc());
|
||||
clientSessionDetails.setDisconnectByClientInternalReasonCode(clientDisconnectEvent.getInternalRc());
|
||||
}
|
||||
if (clientDisconnectEvent.hasReason()) {
|
||||
clientSessionDetails.setDisconnectByClientReasonCode(clientDisconnectEvent.getReason());
|
||||
@@ -519,18 +537,151 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
} else {
|
||||
LOG.info("Cannot update client or client session when no client mac address is present");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void processClientAuthEvent(int customerId, long equipmentId, long locationId,
|
||||
sts.OpensyncStats.EventReport.ClientSession apEventClientSession) {
|
||||
for (ClientAuthEvent clientAuthEvent : apEventClientSession.getClientAuthEventList()) {
|
||||
if (clientAuthEvent.hasStaMac()) {
|
||||
|
||||
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId,
|
||||
new MacAddress(clientAuthEvent.getStaMac()));
|
||||
if (client == null) {
|
||||
client = new com.telecominfraproject.wlan.client.models.Client();
|
||||
|
||||
client.setCustomerId(customerId);
|
||||
client.setMacAddress(new MacAddress(clientAuthEvent.getStaMac()));
|
||||
|
||||
client.setDetails(new ClientInfoDetails());
|
||||
|
||||
client = clientServiceInterface.create(client);
|
||||
|
||||
}
|
||||
|
||||
if (e.hasClientFailureEvent()) {
|
||||
ClientSession clientSession = clientServiceInterface.getSessionOrNull(customerId, equipmentId,
|
||||
new MacAddress(clientAuthEvent.getStaMac()));
|
||||
|
||||
ClientFailureEvent clientFailureEvent = e.getClientFailureEvent();
|
||||
if (clientSession == null) {
|
||||
clientSession = new ClientSession();
|
||||
}
|
||||
|
||||
clientSession.setCustomerId(customerId);
|
||||
clientSession.setEquipmentId(equipmentId);
|
||||
clientSession.setLocationId(locationId);
|
||||
clientSession.setMacAddress(new MacAddress(clientAuthEvent.getStaMac()));
|
||||
|
||||
ClientSessionDetails clientSessionDetails = new ClientSessionDetails();
|
||||
|
||||
clientSessionDetails.setSessionId(apEventClientSession.getSessionId());
|
||||
|
||||
if (clientAuthEvent.hasBand()) {
|
||||
clientSessionDetails.setRadioType(OvsdbToWlanCloudTypeMappingUtility
|
||||
.getRadioTypeFromOpensyncStatsRadioBandType(clientAuthEvent.getBand()));
|
||||
}
|
||||
if (clientAuthEvent.hasSsid()) {
|
||||
clientSessionDetails.setSsid(clientAuthEvent.getSsid());
|
||||
}
|
||||
if (clientAuthEvent.hasAuthStatus()) {
|
||||
clientSessionDetails.setAssociationState(AssociationState._802_11_Authenticated);
|
||||
}
|
||||
|
||||
|
||||
if (clientSession.getDetails() == null) {
|
||||
clientSession.setDetails(clientSessionDetails);
|
||||
} else {
|
||||
clientSession.getDetails().mergeSession(clientSessionDetails);
|
||||
}
|
||||
|
||||
clientSession = clientServiceInterface.updateSession(clientSession);
|
||||
|
||||
|
||||
} else {
|
||||
LOG.info("Cannot update client or client session when no client mac address is present");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void processClientAssocEvent(int customerId, long equipmentId, long locationId,
|
||||
sts.OpensyncStats.EventReport.ClientSession apEventClientSession) {
|
||||
for (ClientAssocEvent clientAssocEvent : apEventClientSession.getClientAssocEventList()) {
|
||||
if (clientAssocEvent.hasStaMac()) {
|
||||
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId,
|
||||
new MacAddress(clientAssocEvent.getStaMac()));
|
||||
if (client == null) {
|
||||
client = new com.telecominfraproject.wlan.client.models.Client();
|
||||
|
||||
client.setCustomerId(customerId);
|
||||
client.setMacAddress(new MacAddress(clientAssocEvent.getStaMac()));
|
||||
|
||||
client.setDetails(new ClientInfoDetails());
|
||||
|
||||
client = clientServiceInterface.create(client);
|
||||
|
||||
}
|
||||
|
||||
ClientSession clientSession = clientServiceInterface.getSessionOrNull(customerId, equipmentId,
|
||||
new MacAddress(clientAssocEvent.getStaMac()));
|
||||
|
||||
if (clientSession == null) {
|
||||
clientSession = new ClientSession();
|
||||
}
|
||||
clientSession.setCustomerId(customerId);
|
||||
clientSession.setEquipmentId(equipmentId);
|
||||
clientSession.setLocationId(locationId);
|
||||
clientSession.setMacAddress(new MacAddress(clientAssocEvent.getStaMac()));
|
||||
|
||||
ClientSessionDetails clientSessionDetails = new ClientSessionDetails();
|
||||
if (clientAssocEvent.hasUsing11K()) {
|
||||
clientSessionDetails.setIs11KUsed(clientAssocEvent.getUsing11K());
|
||||
}
|
||||
if (clientAssocEvent.hasUsing11R()) {
|
||||
clientSessionDetails.setIs11RUsed(clientAssocEvent.getUsing11R());
|
||||
}
|
||||
if (clientAssocEvent.hasUsing11V()) {
|
||||
clientSessionDetails.setIs11VUsed(clientAssocEvent.getUsing11V());
|
||||
}
|
||||
if (clientAssocEvent.hasAssocType()) {
|
||||
clientSessionDetails.setIsReassociation(clientAssocEvent.getAssocType().equals(AssocType.REASSOC));
|
||||
}
|
||||
if (clientAssocEvent.hasBand()) {
|
||||
clientSessionDetails.setRadioType(OvsdbToWlanCloudTypeMappingUtility
|
||||
.getRadioTypeFromOpensyncStatsRadioBandType(clientAssocEvent.getBand()));
|
||||
}
|
||||
if (clientAssocEvent.hasRssi()) {
|
||||
clientSessionDetails.setAssocRssi(clientAssocEvent.getRssi());
|
||||
}
|
||||
clientSessionDetails.setSessionId(apEventClientSession.getSessionId());
|
||||
|
||||
if (clientAssocEvent.hasSsid()) {
|
||||
clientSessionDetails.setSsid(clientAssocEvent.getSsid());
|
||||
}
|
||||
if (clientAssocEvent.hasStatus()) {
|
||||
clientSessionDetails.setAssociationStatus(clientAssocEvent.getStatus());
|
||||
clientSessionDetails.setAssociationState(AssociationState._802_11_Associated);
|
||||
}
|
||||
|
||||
if (clientSession.getDetails() == null) {
|
||||
clientSession.setDetails(clientSessionDetails);
|
||||
} else {
|
||||
clientSession.getDetails().mergeSession(clientSessionDetails);
|
||||
}
|
||||
|
||||
clientSession = clientServiceInterface.updateSession(clientSession);
|
||||
|
||||
} else {
|
||||
LOG.info("Cannot update client or client session when no client mac address is present");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void processClientFailureEvent(int customerId, long equipmentId, long locationId,
|
||||
sts.OpensyncStats.EventReport.ClientSession apEventClientSession) {
|
||||
for (ClientFailureEvent clientFailureEvent : apEventClientSession.getClientFailureEventList()) {
|
||||
if (clientFailureEvent.hasStaMac()) {
|
||||
|
||||
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface
|
||||
.getOrNull(customerId, new MacAddress(clientFailureEvent.getStaMac()));
|
||||
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId,
|
||||
new MacAddress(clientFailureEvent.getStaMac()));
|
||||
if (client == null) {
|
||||
client = new com.telecominfraproject.wlan.client.models.Client();
|
||||
|
||||
@@ -562,9 +713,8 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
clientSessionDetails.setSsid(clientFailureEvent.getSsid());
|
||||
}
|
||||
|
||||
if (clientFailureEvent.hasSessionId()) {
|
||||
clientSessionDetails.setSessionId(clientFailureEvent.getSessionId());
|
||||
}
|
||||
clientSessionDetails.setSessionId(apEventClientSession.getSessionId());
|
||||
|
||||
ClientFailureDetails clientFailureDetails = new ClientFailureDetails();
|
||||
if (clientFailureEvent.hasReasonStr()) {
|
||||
clientFailureDetails.setReason(clientFailureEvent.getReasonStr());
|
||||
@@ -585,19 +735,16 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
} else {
|
||||
LOG.info("Cannot update client or client session when no client mac address is present");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (e.hasClientFirstDataEvent()) {
|
||||
|
||||
|
||||
ClientFirstDataEvent clientFirstDataEvent = e.getClientFirstDataEvent();
|
||||
|
||||
|
||||
protected void processClientFirstDataEvent(int customerId, long equipmentId, long locationId,
|
||||
sts.OpensyncStats.EventReport.ClientSession apEventClientSession) {
|
||||
for (ClientFirstDataEvent clientFirstDataEvent : apEventClientSession.getClientFirstDataEventList()) {
|
||||
if (clientFirstDataEvent.hasStaMac()) {
|
||||
|
||||
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface
|
||||
.getOrNull(customerId, new MacAddress(clientFirstDataEvent.getStaMac()));
|
||||
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId,
|
||||
new MacAddress(clientFirstDataEvent.getStaMac()));
|
||||
if (client == null) {
|
||||
client = new com.telecominfraproject.wlan.client.models.Client();
|
||||
|
||||
@@ -634,9 +781,8 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
clientSessionDetails.setFirstDataSentTimestamp(clientFirstDataEvent.getFdataTxUpTsInUs());
|
||||
}
|
||||
|
||||
if (clientFirstDataEvent.hasSessionId()) {
|
||||
clientSessionDetails.setSessionId(clientFirstDataEvent.getSessionId());
|
||||
}
|
||||
clientSessionDetails.setSessionId(apEventClientSession.getSessionId());
|
||||
|
||||
clientSessionDetails.setAssociationState(AssociationState.Active_Data);
|
||||
|
||||
if (clientSession.getDetails() == null) {
|
||||
@@ -650,18 +796,16 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
} else {
|
||||
LOG.info("Cannot update client or client session when no client mac address is present");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (e.hasClientIdEvent()) {
|
||||
|
||||
ClientIdEvent clientIdEvent = e.getClientIdEvent();
|
||||
|
||||
protected void processClientIdEvent(int customerId, long equipmentId, long locationId,
|
||||
sts.OpensyncStats.EventReport.ClientSession apEventClientSession) {
|
||||
for (ClientIdEvent clientIdEvent : apEventClientSession.getClientIdEventList()) {
|
||||
if (clientIdEvent.hasCltMac()) {
|
||||
|
||||
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface
|
||||
.getOrNull(customerId, new MacAddress(clientIdEvent.getCltMac()));
|
||||
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId,
|
||||
new MacAddress(clientIdEvent.getCltMac()));
|
||||
if (client == null) {
|
||||
client = new com.telecominfraproject.wlan.client.models.Client();
|
||||
|
||||
@@ -689,9 +833,8 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
|
||||
ClientSessionDetails clientSessionDetails = new ClientSessionDetails();
|
||||
|
||||
if (clientIdEvent.hasSessionId()) {
|
||||
clientSessionDetails.setSessionId(clientIdEvent.getSessionId());
|
||||
}
|
||||
clientSessionDetails.setSessionId(apEventClientSession.getSessionId());
|
||||
|
||||
|
||||
if (clientSession.getDetails() == null) {
|
||||
clientSession.setDetails(clientSessionDetails);
|
||||
@@ -704,18 +847,16 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
} else {
|
||||
LOG.info("Cannot update client or client session when no client mac address is present");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (e.hasClientIpEvent()) {
|
||||
|
||||
ClientIpEvent clientIpEvent = e.getClientIpEvent();
|
||||
|
||||
protected void processClientIpEvent(int customerId, long equipmentId, long locationId,
|
||||
sts.OpensyncStats.EventReport.ClientSession apEventClientSession) {
|
||||
for (ClientIpEvent clientIpEvent : apEventClientSession.getClientIpEventList()) {
|
||||
if (clientIpEvent.hasStaMac()) {
|
||||
|
||||
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface
|
||||
.getOrNull(customerId, new MacAddress(clientIpEvent.getStaMac()));
|
||||
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId,
|
||||
new MacAddress(clientIpEvent.getStaMac()));
|
||||
if (client == null) {
|
||||
client = new com.telecominfraproject.wlan.client.models.Client();
|
||||
|
||||
@@ -742,9 +883,9 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
|
||||
ClientSessionDetails clientSessionDetails = new ClientSessionDetails();
|
||||
|
||||
if (clientIpEvent.hasSessionId()) {
|
||||
clientSessionDetails.setSessionId(clientIpEvent.getSessionId());
|
||||
}
|
||||
|
||||
clientSessionDetails.setSessionId(apEventClientSession.getSessionId());
|
||||
|
||||
|
||||
try {
|
||||
clientSessionDetails
|
||||
@@ -765,19 +906,16 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
} else {
|
||||
LOG.info("Cannot update client or client session when no clientmac address is present");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (e.hasClientTimeoutEvent()) {
|
||||
|
||||
ClientTimeoutEvent clientTimeoutEvent = e.getClientTimeoutEvent();
|
||||
|
||||
|
||||
protected void processClientTimeoutEvent(int customerId, long equipmentId, long locationId,
|
||||
sts.OpensyncStats.EventReport.ClientSession apEventClientSession) {
|
||||
for (ClientTimeoutEvent clientTimeoutEvent : apEventClientSession.getClientTimeoutEventList()) {
|
||||
if (clientTimeoutEvent.hasStaMac()) {
|
||||
|
||||
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface
|
||||
.getOrNull(customerId, new MacAddress(clientTimeoutEvent.getStaMac()));
|
||||
com.telecominfraproject.wlan.client.models.Client client = clientServiceInterface.getOrNull(customerId,
|
||||
new MacAddress(clientTimeoutEvent.getStaMac()));
|
||||
if (client == null) {
|
||||
client = new com.telecominfraproject.wlan.client.models.Client();
|
||||
|
||||
@@ -804,16 +942,24 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
|
||||
ClientSessionDetails clientSessionDetails = new ClientSessionDetails();
|
||||
|
||||
if (clientTimeoutEvent.hasSessionId()) {
|
||||
clientSessionDetails.setSessionId(clientTimeoutEvent.getSessionId());
|
||||
}
|
||||
clientSessionDetails.setSessionId(apEventClientSession.getSessionId());
|
||||
|
||||
long timeoutTimestamp = 0L;
|
||||
if (clientTimeoutEvent.hasLastRcvUpTsInUs()) {
|
||||
clientSessionDetails.setLastRxTimestamp(clientTimeoutEvent.getLastRcvUpTsInUs());
|
||||
|
||||
timeoutTimestamp = clientTimeoutEvent.getLastRcvUpTsInUs();
|
||||
}
|
||||
|
||||
if (clientTimeoutEvent.hasLastSentUpTsInUs()) {
|
||||
clientSessionDetails.setLastTxTimestamp(clientTimeoutEvent.getLastSentUpTsInUs());
|
||||
if (clientTimeoutEvent.getLastSentUpTsInUs() > timeoutTimestamp) {
|
||||
timeoutTimestamp = clientTimeoutEvent.getLastSentUpTsInUs();
|
||||
}
|
||||
}
|
||||
|
||||
if (timeoutTimestamp > 0L) {
|
||||
clientSessionDetails.setTimeoutTimestamp(timeoutTimestamp);
|
||||
}
|
||||
|
||||
if (clientSession.getDetails() == null) {
|
||||
@@ -827,13 +973,7 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
} else {
|
||||
LOG.info("Cannot update client or client session when no client mac address is present");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
void populateSipCallReport(List<ServiceMetric> metricRecordList, Report report, int customerId, long equipmentId,
|
||||
@@ -1606,8 +1746,7 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
|
||||
void populateApClientMetrics(List<ServiceMetric> metricRecordList, Report report, int customerId, long equipmentId,
|
||||
long locationId) {
|
||||
LOG.debug("populateApClientMetrics for Customer {} Equipment {}", customerId,
|
||||
equipmentId);
|
||||
LOG.debug("populateApClientMetrics for Customer {} Equipment {}", customerId, equipmentId);
|
||||
|
||||
for (ClientReport clReport : report.getClientsList()) {
|
||||
for (Client cl : clReport.getClientListList()) {
|
||||
@@ -2155,12 +2294,12 @@ public class OpensyncExternalIntegrationMqttMessageProcessor {
|
||||
continue;
|
||||
}
|
||||
|
||||
ProfileContainer profileContainer = new ProfileContainer(
|
||||
profileServiceInterface.getProfileWithChildren(
|
||||
equipmentServiceInterface.get(equipmentId).getProfileId()));
|
||||
ProfileContainer profileContainer = new ProfileContainer(profileServiceInterface
|
||||
.getProfileWithChildren(equipmentServiceInterface.get(equipmentId).getProfileId()));
|
||||
|
||||
RfConfiguration rfConfig = (RfConfiguration) profileContainer.getChildOfTypeOrNull(
|
||||
equipmentServiceInterface.get(equipmentId).getProfileId(), ProfileType.rf).getDetails();
|
||||
RfConfiguration rfConfig = (RfConfiguration) profileContainer
|
||||
.getChildOfTypeOrNull(equipmentServiceInterface.get(equipmentId).getProfileId(), ProfileType.rf)
|
||||
.getDetails();
|
||||
|
||||
ChannelBandwidth channelBandwidth = rfConfig.getRfConfig(radioType).getChannelBandwidth();
|
||||
|
||||
|
||||
@@ -83,6 +83,7 @@ import sts.OpensyncStats.AssocType;
|
||||
import sts.OpensyncStats.Client;
|
||||
import sts.OpensyncStats.ClientReport;
|
||||
import sts.OpensyncStats.EventReport;
|
||||
import sts.OpensyncStats.EventReport.ClientAssocEvent;
|
||||
import sts.OpensyncStats.EventType;
|
||||
import sts.OpensyncStats.RadioBandType;
|
||||
import sts.OpensyncStats.Report;
|
||||
@@ -769,6 +770,8 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
|
||||
private List<EventReport> getOpensyncStatsEventReportsList() {
|
||||
|
||||
|
||||
List<ClientAssocEvent> clientAssocEventList = new ArrayList<>();
|
||||
sts.OpensyncStats.EventReport.ClientAssocEvent.Builder clientAssocBuilder = EventReport.ClientAssocEvent
|
||||
.getDefaultInstance().toBuilder();
|
||||
clientAssocBuilder.setAssocType(AssocType.ASSOC);
|
||||
@@ -793,22 +796,29 @@ public class OpensyncExternalIntegrationCloudTest {
|
||||
clientAssocBuilder2.setSsid("ssid-1");
|
||||
clientAssocBuilder2.setStatus(1);
|
||||
|
||||
clientAssocEventList.add(clientAssocBuilder.build());
|
||||
clientAssocEventList.add(clientAssocBuilder2.build());
|
||||
|
||||
List<EventReport> eventReportList = new ArrayList<>();
|
||||
|
||||
EventReport.Builder eventReportBuilder = EventReport.getDefaultInstance().toBuilder();
|
||||
eventReportBuilder.setClientAssocEvent(clientAssocBuilder.build());
|
||||
eventReportBuilder.setEventType(EventType.CLIENT_ASSOC);
|
||||
|
||||
sts.OpensyncStats.EventReport.ClientSession.Builder clientSessionBuilder = sts.OpensyncStats.EventReport.ClientSession.getDefaultInstance().toBuilder();
|
||||
|
||||
clientSessionBuilder.setSessionId(1000L);
|
||||
|
||||
clientSessionBuilder.addAllClientAssocEvent(clientAssocEventList);
|
||||
List<sts.OpensyncStats.EventReport.ClientSession> clientSessionList = new ArrayList<>();
|
||||
clientSessionList.add(clientSessionBuilder.build());
|
||||
|
||||
eventReportBuilder.addAllClientSession(clientSessionList);
|
||||
|
||||
eventReportList.add(eventReportBuilder.build());
|
||||
|
||||
eventReportBuilder = EventReport.getDefaultInstance().toBuilder();
|
||||
eventReportBuilder.setClientAssocEvent(clientAssocBuilder2.build());
|
||||
eventReportBuilder.setEventType(EventType.CLIENT_ASSOC);
|
||||
|
||||
eventReportList.add(eventReportBuilder.build());
|
||||
|
||||
return eventReportList;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private List<ClientReport> getOpensyncStatsClientReportsList() {
|
||||
|
||||
@@ -57,13 +57,13 @@ import sts.OpensyncStats.Client;
|
||||
import sts.OpensyncStats.ClientReport;
|
||||
import sts.OpensyncStats.DNSProbeMetric;
|
||||
import sts.OpensyncStats.EventReport;
|
||||
import sts.OpensyncStats.EventType;
|
||||
import sts.OpensyncStats.NetworkProbe;
|
||||
import sts.OpensyncStats.RADIUSMetrics;
|
||||
import sts.OpensyncStats.RadioBandType;
|
||||
import sts.OpensyncStats.Report;
|
||||
import sts.OpensyncStats.StateUpDown;
|
||||
import sts.OpensyncStats.VLANMetrics;
|
||||
import sts.OpensyncStats.EventReport.ClientAssocEvent;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@ActiveProfiles(profiles = { "integration_test", })
|
||||
@@ -300,6 +300,8 @@ public class OpensyncExternalIntegrationMqttMessageProcessorTest {
|
||||
|
||||
private List<EventReport> getOpensyncStatsEventReportsList() {
|
||||
|
||||
|
||||
List<ClientAssocEvent> clientAssocEventList = new ArrayList<>();
|
||||
sts.OpensyncStats.EventReport.ClientAssocEvent.Builder clientAssocBuilder = EventReport.ClientAssocEvent
|
||||
.getDefaultInstance().toBuilder();
|
||||
clientAssocBuilder.setAssocType(AssocType.ASSOC);
|
||||
@@ -324,22 +326,30 @@ public class OpensyncExternalIntegrationMqttMessageProcessorTest {
|
||||
clientAssocBuilder2.setSsid("ssid-1");
|
||||
clientAssocBuilder2.setStatus(1);
|
||||
|
||||
clientAssocEventList.add(clientAssocBuilder.build());
|
||||
clientAssocEventList.add(clientAssocBuilder2.build());
|
||||
|
||||
List<EventReport> eventReportList = new ArrayList<>();
|
||||
|
||||
EventReport.Builder eventReportBuilder = EventReport.getDefaultInstance().toBuilder();
|
||||
eventReportBuilder.setClientAssocEvent(clientAssocBuilder.build());
|
||||
eventReportBuilder.setEventType(EventType.CLIENT_ASSOC);
|
||||
|
||||
sts.OpensyncStats.EventReport.ClientSession.Builder clientSessionBuilder = sts.OpensyncStats.EventReport.ClientSession
|
||||
.getDefaultInstance().toBuilder();
|
||||
|
||||
clientSessionBuilder.setSessionId(1000L);
|
||||
|
||||
clientSessionBuilder.addAllClientAssocEvent(clientAssocEventList);
|
||||
List<sts.OpensyncStats.EventReport.ClientSession> clientSessionList = new ArrayList<>();
|
||||
clientSessionList.add(clientSessionBuilder.build());
|
||||
|
||||
eventReportBuilder.addAllClientSession(clientSessionList);
|
||||
|
||||
eventReportList.add(eventReportBuilder.build());
|
||||
|
||||
eventReportBuilder = EventReport.getDefaultInstance().toBuilder();
|
||||
eventReportBuilder.setClientAssocEvent(clientAssocBuilder2.build());
|
||||
eventReportBuilder.setEventType(EventType.CLIENT_ASSOC);
|
||||
|
||||
eventReportList.add(eventReportBuilder.build());
|
||||
|
||||
return eventReportList;
|
||||
|
||||
|
||||
}
|
||||
|
||||
private List<ClientReport> getOpensyncStatsClientReportsList() {
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.telecominfraproject.wlan.opensync.ovsdb.dao.utilities;
|
||||
|
||||
import com.telecominfraproject.wlan.client.models.ClientType;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.SecurityType;
|
||||
import com.telecominfraproject.wlan.opensync.ovsdb.dao.models.enumerations.DhcpFpDeviceType;
|
||||
|
||||
import com.telecominfraproject.wlan.servicemetric.apnode.models.StateUpDownError;
|
||||
@@ -242,4 +243,17 @@ public class OvsdbToWlanCloudTypeMappingUtility {
|
||||
|
||||
}
|
||||
|
||||
public static SecurityType getCloudSecurityTypeFromOpensyncStats(sts.OpensyncStats.SecurityType statsSecurityType) {
|
||||
switch (statsSecurityType) {
|
||||
case SEC_OPEN:
|
||||
return SecurityType.OPEN;
|
||||
case SEC_PSK:
|
||||
return SecurityType.PSK;
|
||||
case SEC_RADIUS:
|
||||
return SecurityType.RADIUS;
|
||||
default:
|
||||
return SecurityType.UNSUPPORTED;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user