WIFI-1400 - System events and service metrics should have locationId populated wherever appropriate

This commit is contained in:
Dmitry Toptygin
2021-01-28 20:08:06 -05:00
parent 5a87904787
commit b51cd52f80
3 changed files with 74 additions and 54 deletions

View File

@@ -271,7 +271,7 @@ public class MqttStatsPublisher {
void publishEvents(Report report, int customerId, long equipmentId, String apId, long locationId) { void publishEvents(Report report, int customerId, long equipmentId, String apId, long locationId) {
realtimeEventPublisher.publishSipCallEvents(customerId, equipmentId, report.getVideoVoiceReportList()); realtimeEventPublisher.publishSipCallEvents(customerId, equipmentId, locationId, report.getVideoVoiceReportList());
for (EventReport eventReport : report.getEventReportList()) { for (EventReport eventReport : report.getEventReportList()) {
@@ -282,69 +282,69 @@ public class MqttStatsPublisher {
if (apEventClientSession.hasClientAuthEvent()) { if (apEventClientSession.hasClientAuthEvent()) {
processClientAuthEvent(customerId, equipmentId, locationId, apEventClientSession); processClientAuthEvent(customerId, equipmentId, locationId, apEventClientSession);
realtimeEventPublisher.publishClientAuthSystemEvent(customerId, equipmentId, realtimeEventPublisher.publishClientAuthSystemEvent(customerId, equipmentId, locationId,
apEventClientSession.getClientAuthEvent()); apEventClientSession.getClientAuthEvent());
} }
if (apEventClientSession.hasClientAssocEvent()) { if (apEventClientSession.hasClientAssocEvent()) {
processClientAssocEvent(customerId, equipmentId, locationId, apEventClientSession); processClientAssocEvent(customerId, equipmentId, locationId, apEventClientSession);
realtimeEventPublisher.publishClientAssocEvent(customerId, equipmentId, realtimeEventPublisher.publishClientAssocEvent(customerId, equipmentId, locationId,
apEventClientSession.getClientAssocEvent()); apEventClientSession.getClientAssocEvent());
} }
if (apEventClientSession.hasClientFirstDataEvent()) { if (apEventClientSession.hasClientFirstDataEvent()) {
processClientFirstDataEvent(customerId, equipmentId, locationId, apEventClientSession); processClientFirstDataEvent(customerId, equipmentId, locationId, apEventClientSession);
realtimeEventPublisher.publishClientFirstDataEvent(customerId, equipmentId, realtimeEventPublisher.publishClientFirstDataEvent(customerId, equipmentId, locationId,
apEventClientSession.getClientFirstDataEvent()); apEventClientSession.getClientFirstDataEvent());
} }
if (apEventClientSession.hasClientIdEvent()) { if (apEventClientSession.hasClientIdEvent()) {
processClientIdEvent(customerId, equipmentId, locationId, apEventClientSession); processClientIdEvent(customerId, equipmentId, locationId, apEventClientSession);
realtimeEventPublisher.publishClientIdEvent(customerId, equipmentId, realtimeEventPublisher.publishClientIdEvent(customerId, equipmentId, locationId,
apEventClientSession.getClientIdEvent()); apEventClientSession.getClientIdEvent());
} }
if (apEventClientSession.hasClientIpEvent()) { if (apEventClientSession.hasClientIpEvent()) {
processClientIpEvent(customerId, equipmentId, locationId, apEventClientSession); processClientIpEvent(customerId, equipmentId, locationId, apEventClientSession);
realtimeEventPublisher.publishClientIpEvent(customerId, equipmentId, realtimeEventPublisher.publishClientIpEvent(customerId, equipmentId, locationId,
apEventClientSession.getClientIpEvent()); apEventClientSession.getClientIpEvent());
} }
if (apEventClientSession.hasClientConnectEvent()) { if (apEventClientSession.hasClientConnectEvent()) {
processClientConnectEvent(customerId, equipmentId, locationId, eventReport, apEventClientSession); processClientConnectEvent(customerId, equipmentId, locationId, eventReport, apEventClientSession);
realtimeEventPublisher.publishClientConnectSuccessEvent(customerId, equipmentId, realtimeEventPublisher.publishClientConnectSuccessEvent(customerId, equipmentId, locationId,
apEventClientSession.getClientConnectEvent()); apEventClientSession.getClientConnectEvent());
} }
if (apEventClientSession.hasClientDisconnectEvent()) { if (apEventClientSession.hasClientDisconnectEvent()) {
processClientDisconnectEvent(customerId, equipmentId, locationId, apEventClientSession); processClientDisconnectEvent(customerId, equipmentId, locationId, apEventClientSession);
realtimeEventPublisher.publishClientDisconnectEvent(customerId, equipmentId, realtimeEventPublisher.publishClientDisconnectEvent(customerId, equipmentId, locationId,
apEventClientSession.getClientDisconnectEvent()); apEventClientSession.getClientDisconnectEvent());
} }
if (apEventClientSession.hasClientTimeoutEvent()) { if (apEventClientSession.hasClientTimeoutEvent()) {
processClientTimeoutEvent(customerId, equipmentId, locationId, apEventClientSession); processClientTimeoutEvent(customerId, equipmentId, locationId, apEventClientSession);
realtimeEventPublisher.publishClientTimeoutEvent(customerId, equipmentId, realtimeEventPublisher.publishClientTimeoutEvent(customerId, equipmentId, locationId,
apEventClientSession.getClientTimeoutEvent()); apEventClientSession.getClientTimeoutEvent());
} }
if (apEventClientSession.hasClientFailureEvent()) { if (apEventClientSession.hasClientFailureEvent()) {
processClientFailureEvent(customerId, equipmentId, locationId, apEventClientSession); processClientFailureEvent(customerId, equipmentId, locationId, apEventClientSession);
realtimeEventPublisher.publishClientFailureEvent(customerId, equipmentId, realtimeEventPublisher.publishClientFailureEvent(customerId, equipmentId, locationId,
apEventClientSession.getClientFailureEvent()); apEventClientSession.getClientFailureEvent());
} }
} }
realtimeEventPublisher.publishChannelHopEvents(customerId, equipmentId, eventReport); realtimeEventPublisher.publishChannelHopEvents(customerId, equipmentId, locationId, eventReport);
realtimeEventPublisher.publishDhcpTransactionEvents(customerId, equipmentId, realtimeEventPublisher.publishDhcpTransactionEvents(customerId, equipmentId, locationId,
eventReport.getDhcpTransactionList()); eventReport.getDhcpTransactionList());
} }

View File

@@ -83,18 +83,20 @@ public class RealtimeEventPublisher {
private static final Logger LOG = LoggerFactory.getLogger(RealtimeEventPublisher.class); private static final Logger LOG = LoggerFactory.getLogger(RealtimeEventPublisher.class);
void publishChannelHopEvents(int customerId, long equipmentId, EventReport e) { void publishChannelHopEvents(int customerId, long equipmentId, long locationId, EventReport e) {
LOG.info("publishChannelHopEvents for customerId {} equipmentId {}"); LOG.info("publishChannelHopEvents for customerId {} equipmentId {}");
List<SystemEvent> events = new ArrayList<>(); List<SystemEvent> events = new ArrayList<>();
LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", e, customerId, equipmentId);
Equipment equipment = equipmentServiceInterface.getOrNull(equipmentId);
if (equipment == null) {
return;
}
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);
if (equipment == null)
continue;
RadioType radioType = null; RadioType radioType = null;
Long timestamp = null; Long timestamp = null;
ChannelHopReason reason = null; ChannelHopReason reason = null;
@@ -119,10 +121,12 @@ public class RealtimeEventPublisher {
} }
if (channelSwitchEvent.hasReason()) { if (channelSwitchEvent.hasReason()) {
if (channelSwitchEvent.getReason().equals(ChannelSwitchReason.high_interference)) if (channelSwitchEvent.getReason().equals(ChannelSwitchReason.high_interference)) {
reason = ChannelHopReason.HighInterference; reason = ChannelHopReason.HighInterference;
else if (channelSwitchEvent.getReason().equals(ChannelSwitchReason.radar_detected)) }
else if (channelSwitchEvent.getReason().equals(ChannelSwitchReason.radar_detected)) {
reason = ChannelHopReason.RadarDetected; reason = ChannelHopReason.RadarDetected;
}
} }
if (ChannelHopReason.isUnsupported(reason)) { if (ChannelHopReason.isUnsupported(reason)) {
LOG.warn("publishChannelHopEvents:reason {} is unsupported, cannot send RealTimeChannelHopEvent for {}", LOG.warn("publishChannelHopEvents:reason {} is unsupported, cannot send RealTimeChannelHopEvent for {}",
@@ -139,7 +143,7 @@ public class RealtimeEventPublisher {
} }
RealTimeChannelHopEvent channelHopEvent = new RealTimeChannelHopEvent(RealTimeEventType.Channel_Hop, RealTimeChannelHopEvent channelHopEvent = new RealTimeChannelHopEvent(RealTimeEventType.Channel_Hop,
customerId, equipmentId, radioType, channel, customerId, locationId, equipmentId, radioType, channel,
((ApElementConfiguration) equipment.getDetails()).getRadioMap().get(radioType).getChannelNumber(), ((ApElementConfiguration) equipment.getDetails()).getRadioMap().get(radioType).getChannelNumber(),
reason, timestamp); reason, timestamp);
@@ -153,7 +157,7 @@ public class RealtimeEventPublisher {
} }
} }
void publishClientConnectSuccessEvent(int customerId, long equipmentId, ClientConnectEvent clientConnectEvent) { void publishClientConnectSuccessEvent(int customerId, long equipmentId, long locationId, ClientConnectEvent clientConnectEvent) {
LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientConnectEvent, customerId, LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientConnectEvent, customerId,
equipmentId); equipmentId);
@@ -235,13 +239,14 @@ public class RealtimeEventPublisher {
clientEvent.setCustomerId(customerId); clientEvent.setCustomerId(customerId);
clientEvent.setEquipmentId(equipmentId); clientEvent.setEquipmentId(equipmentId);
clientEvent.setLocationId(locationId);
LOG.info("publishing client event {} to cloud", clientEvent); 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, long locationId, ClientDisconnectEvent clientDisconnectEvent) {
LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientDisconnectEvent, customerId, LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientDisconnectEvent, customerId,
equipmentId); equipmentId);
@@ -284,13 +289,14 @@ public class RealtimeEventPublisher {
clientEvent.setCustomerId(customerId); clientEvent.setCustomerId(customerId);
clientEvent.setEquipmentId(equipmentId); clientEvent.setEquipmentId(equipmentId);
clientEvent.setLocationId(locationId);
LOG.info("publishing client event {} to cloud", clientEvent); 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, long locationId, ClientAuthEvent clientAuthEvent) {
LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientAuthEvent, customerId, equipmentId); LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientAuthEvent, customerId, equipmentId);
com.telecominfraproject.wlan.client.models.events.realtime.ClientAuthEvent clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientAuthEvent( com.telecominfraproject.wlan.client.models.events.realtime.ClientAuthEvent clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientAuthEvent(
@@ -306,13 +312,14 @@ public class RealtimeEventPublisher {
} }
clientEvent.setCustomerId(customerId); clientEvent.setCustomerId(customerId);
clientEvent.setEquipmentId(equipmentId); clientEvent.setEquipmentId(equipmentId);
clientEvent.setLocationId(locationId);
LOG.info("publishing client event {} to cloud", clientEvent); 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, long locationId, ClientAssocEvent clientAssocEvent) {
LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientAssocEvent, customerId, equipmentId); LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientAssocEvent, customerId, equipmentId);
com.telecominfraproject.wlan.client.models.events.realtime.ClientAssocEvent clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientAssocEvent( com.telecominfraproject.wlan.client.models.events.realtime.ClientAssocEvent clientEvent = new com.telecominfraproject.wlan.client.models.events.realtime.ClientAssocEvent(
@@ -354,13 +361,14 @@ public class RealtimeEventPublisher {
clientEvent.setCustomerId(customerId); clientEvent.setCustomerId(customerId);
clientEvent.setEquipmentId(equipmentId); clientEvent.setEquipmentId(equipmentId);
clientEvent.setLocationId(locationId);
LOG.info("publishing client event {} to cloud", clientEvent); 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, long locationId, ClientFailureEvent clientFailureEvent) {
LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientFailureEvent, customerId, LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientFailureEvent, customerId,
equipmentId); equipmentId);
@@ -381,12 +389,13 @@ public class RealtimeEventPublisher {
clientEvent.setCustomerId(customerId); clientEvent.setCustomerId(customerId);
clientEvent.setEquipmentId(equipmentId); clientEvent.setEquipmentId(equipmentId);
clientEvent.setLocationId(locationId);
LOG.info("publishing client event {} to cloud", clientEvent); 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, long locationId, ClientFirstDataEvent clientFirstDataEvent) {
LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientFirstDataEvent, customerId, LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientFirstDataEvent, customerId,
equipmentId); equipmentId);
@@ -406,13 +415,14 @@ public class RealtimeEventPublisher {
clientEvent.setCustomerId(customerId); clientEvent.setCustomerId(customerId);
clientEvent.setEquipmentId(equipmentId); clientEvent.setEquipmentId(equipmentId);
clientEvent.setLocationId(locationId);
LOG.info("publishing client event {} to cloud", clientEvent); 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, long locationId, ClientIdEvent clientIdEvent) {
LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientIdEvent, customerId, equipmentId); LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientIdEvent, customerId, equipmentId);
@@ -427,12 +437,13 @@ public class RealtimeEventPublisher {
clientEvent.setCustomerId(customerId); clientEvent.setCustomerId(customerId);
clientEvent.setEquipmentId(equipmentId); clientEvent.setEquipmentId(equipmentId);
clientEvent.setLocationId(locationId);
LOG.info("publishing client event {} to cloud", clientEvent); 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, long locationId, ClientIpEvent clientIpEvent) {
LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientIpEvent, customerId, equipmentId); LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientIpEvent, customerId, equipmentId);
@@ -447,12 +458,13 @@ public class RealtimeEventPublisher {
clientEvent.setCustomerId(customerId); clientEvent.setCustomerId(customerId);
clientEvent.setEquipmentId(equipmentId); clientEvent.setEquipmentId(equipmentId);
clientEvent.setLocationId(locationId);
LOG.info("publishing client event {} to cloud", clientEvent); 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, long locationId, ClientTimeoutEvent clientTimeoutEvent) {
LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientTimeoutEvent, customerId, LOG.info("Received ClientEvent {} for customerId {} equipmentId {}", clientTimeoutEvent, customerId,
equipmentId); equipmentId);
@@ -476,13 +488,14 @@ public class RealtimeEventPublisher {
clientEvent.setCustomerId(customerId); clientEvent.setCustomerId(customerId);
clientEvent.setEquipmentId(equipmentId); clientEvent.setEquipmentId(equipmentId);
clientEvent.setLocationId(locationId);
LOG.info("publishing client event {} to cloud", clientEvent); LOG.info("publishing client event {} to cloud", clientEvent);
cloudEventDispatcherInterface.publishEvent(clientEvent); cloudEventDispatcherInterface.publishEvent(clientEvent);
} }
void publishDhcpTransactionEvents(int customerId, long equipmentId, List<DhcpTransaction> dhcpTransactionList) { void publishDhcpTransactionEvents(int customerId, long equipmentId, long locationId, List<DhcpTransaction> dhcpTransactionList) {
LOG.info("Publish Dhcp Transaction Events for customer {} equipmentId {}", customerId, equipmentId); LOG.info("Publish Dhcp Transaction Events for customer {} equipmentId {}", customerId, equipmentId);
List<SystemEvent> dhcpEventsList = new ArrayList<>(); List<SystemEvent> dhcpEventsList = new ArrayList<>();
for (DhcpTransaction dhcpTransaction : dhcpTransactionList) { for (DhcpTransaction dhcpTransaction : dhcpTransactionList) {
@@ -494,6 +507,7 @@ public class RealtimeEventPublisher {
cloudDhcpAck.setCustomerId(customerId); cloudDhcpAck.setCustomerId(customerId);
cloudDhcpAck.setEquipmentId(equipmentId); cloudDhcpAck.setEquipmentId(equipmentId);
cloudDhcpAck.setLocationId(locationId);
if (ackEvent.hasDhcpCommonData()) { if (ackEvent.hasDhcpCommonData()) {
cloudDhcpAck = (com.telecominfraproject.wlan.systemevent.equipment.DhcpAckEvent) getDhcpCommonDataForEvent( cloudDhcpAck = (com.telecominfraproject.wlan.systemevent.equipment.DhcpAckEvent) getDhcpCommonDataForEvent(
@@ -563,6 +577,7 @@ public class RealtimeEventPublisher {
cloudDhcpNak.setCustomerId(customerId); cloudDhcpNak.setCustomerId(customerId);
cloudDhcpNak.setEquipmentId(equipmentId); cloudDhcpNak.setEquipmentId(equipmentId);
cloudDhcpNak.setLocationId(locationId);
if (nakEvent.hasDhcpCommonData()) { if (nakEvent.hasDhcpCommonData()) {
cloudDhcpNak = (com.telecominfraproject.wlan.systemevent.equipment.DhcpNakEvent) getDhcpCommonDataForEvent( cloudDhcpNak = (com.telecominfraproject.wlan.systemevent.equipment.DhcpNakEvent) getDhcpCommonDataForEvent(
@@ -589,6 +604,7 @@ public class RealtimeEventPublisher {
cloudDhcpOffer.setCustomerId(customerId); cloudDhcpOffer.setCustomerId(customerId);
cloudDhcpOffer.setEquipmentId(equipmentId); cloudDhcpOffer.setEquipmentId(equipmentId);
cloudDhcpOffer.setLocationId(locationId);
if (offerEvent.hasDhcpCommonData()) { if (offerEvent.hasDhcpCommonData()) {
cloudDhcpOffer = (com.telecominfraproject.wlan.systemevent.equipment.DhcpOfferEvent) getDhcpCommonDataForEvent( cloudDhcpOffer = (com.telecominfraproject.wlan.systemevent.equipment.DhcpOfferEvent) getDhcpCommonDataForEvent(
@@ -613,6 +629,7 @@ public class RealtimeEventPublisher {
cloudDhcpInform.setCustomerId(customerId); cloudDhcpInform.setCustomerId(customerId);
cloudDhcpInform.setEquipmentId(equipmentId); cloudDhcpInform.setEquipmentId(equipmentId);
cloudDhcpInform.setLocationId(locationId);
if (informEvent.hasDhcpCommonData()) { if (informEvent.hasDhcpCommonData()) {
cloudDhcpInform = (com.telecominfraproject.wlan.systemevent.equipment.DhcpInformEvent) getDhcpCommonDataForEvent( cloudDhcpInform = (com.telecominfraproject.wlan.systemevent.equipment.DhcpInformEvent) getDhcpCommonDataForEvent(
@@ -633,6 +650,7 @@ public class RealtimeEventPublisher {
cloudDhcpDecline.setCustomerId(customerId); cloudDhcpDecline.setCustomerId(customerId);
cloudDhcpDecline.setEquipmentId(equipmentId); cloudDhcpDecline.setEquipmentId(equipmentId);
cloudDhcpDecline.setLocationId(locationId);
if (declineEvent.hasDhcpCommonData()) { if (declineEvent.hasDhcpCommonData()) {
cloudDhcpDecline = (com.telecominfraproject.wlan.systemevent.equipment.DhcpDeclineEvent) getDhcpCommonDataForEvent( cloudDhcpDecline = (com.telecominfraproject.wlan.systemevent.equipment.DhcpDeclineEvent) getDhcpCommonDataForEvent(
@@ -655,6 +673,7 @@ public class RealtimeEventPublisher {
cloudDhcpRequest.setCustomerId(customerId); cloudDhcpRequest.setCustomerId(customerId);
cloudDhcpRequest.setEquipmentId(equipmentId); cloudDhcpRequest.setEquipmentId(equipmentId);
cloudDhcpRequest.setLocationId(locationId);
if (requestEvent.hasDhcpCommonData()) { if (requestEvent.hasDhcpCommonData()) {
cloudDhcpRequest = (com.telecominfraproject.wlan.systemevent.equipment.DhcpRequestEvent) getDhcpCommonDataForEvent( cloudDhcpRequest = (com.telecominfraproject.wlan.systemevent.equipment.DhcpRequestEvent) getDhcpCommonDataForEvent(
@@ -681,6 +700,7 @@ public class RealtimeEventPublisher {
cloudDhcpDiscover.setCustomerId(customerId); cloudDhcpDiscover.setCustomerId(customerId);
cloudDhcpDiscover.setEquipmentId(equipmentId); cloudDhcpDiscover.setEquipmentId(equipmentId);
cloudDhcpDiscover.setLocationId(locationId);
if (discoverEvent.hasDhcpCommonData()) { if (discoverEvent.hasDhcpCommonData()) {
cloudDhcpDiscover = (com.telecominfraproject.wlan.systemevent.equipment.DhcpDiscoverEvent) getDhcpCommonDataForEvent( cloudDhcpDiscover = (com.telecominfraproject.wlan.systemevent.equipment.DhcpDiscoverEvent) getDhcpCommonDataForEvent(
@@ -755,7 +775,7 @@ public class RealtimeEventPublisher {
return cloudDhcpEvent; return cloudDhcpEvent;
} }
void publishSipCallEvents(int customerId, long equipmentId, List<VideoVoiceReport> sipCallReportList) { void publishSipCallEvents(int customerId, long equipmentId, long locationId, List<VideoVoiceReport> sipCallReportList) {
// 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
// received the report/event // received the report/event
long eventTimestamp = System.currentTimeMillis(); long eventTimestamp = System.currentTimeMillis();
@@ -769,17 +789,17 @@ public class RealtimeEventPublisher {
LOG.debug("Received VideoVoiceReport {} for SIP call", videoVoiceReport); LOG.debug("Received VideoVoiceReport {} for SIP call", videoVoiceReport);
processRealTimeSipCallReportEvent(customerId, equipmentId, eventTimestamp, eventsList, videoVoiceReport); processRealTimeSipCallReportEvent(customerId, equipmentId, locationId, eventTimestamp, eventsList, videoVoiceReport);
processRealTimeSipCallStartEvent(customerId, equipmentId, eventTimestamp, eventsList, videoVoiceReport); processRealTimeSipCallStartEvent(customerId, equipmentId, locationId, eventTimestamp, eventsList, videoVoiceReport);
processRealTimeSipCallStopEvent(customerId, equipmentId, eventTimestamp, eventsList, videoVoiceReport); processRealTimeSipCallStopEvent(customerId, equipmentId, locationId, eventTimestamp, eventsList, videoVoiceReport);
processRtsStartEvent(customerId, equipmentId, eventTimestamp, eventsList, videoVoiceReport); processRtsStartEvent(customerId, equipmentId, locationId, eventTimestamp, eventsList, videoVoiceReport);
processRtsStartSessionEvent(customerId, equipmentId, eventTimestamp, eventsList, videoVoiceReport); processRtsStartSessionEvent(customerId, equipmentId, locationId, eventTimestamp, eventsList, videoVoiceReport);
processRtsStopEvent(customerId, equipmentId, eventTimestamp, eventsList, videoVoiceReport); processRtsStopEvent(customerId, equipmentId, locationId, eventTimestamp, eventsList, videoVoiceReport);
} }
@@ -789,13 +809,13 @@ public class RealtimeEventPublisher {
} }
protected void processRealTimeSipCallReportEvent(int customerId, long equipmentId, long eventTimestamp, protected void processRealTimeSipCallReportEvent(int customerId, long equipmentId, long locationId, long eventTimestamp,
List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) { List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) {
if (videoVoiceReport.hasCallReport()) { if (videoVoiceReport.hasCallReport()) {
CallReport callReport = videoVoiceReport.getCallReport(); CallReport callReport = videoVoiceReport.getCallReport();
RealTimeSipCallReportEvent cloudSipCallReportEvent = new RealTimeSipCallReportEvent(customerId, equipmentId, RealTimeSipCallReportEvent cloudSipCallReportEvent = new RealTimeSipCallReportEvent(customerId, locationId, equipmentId,
eventTimestamp); eventTimestamp);
if (callReport.hasClientMac() && callReport.getClientMac().isValidUtf8()) { if (callReport.hasClientMac() && callReport.getClientMac().isValidUtf8()) {
@@ -849,13 +869,13 @@ public class RealtimeEventPublisher {
return SIPCallReportReason.UNSUPPORTED; return SIPCallReportReason.UNSUPPORTED;
} }
protected void processRealTimeSipCallStartEvent(int customerId, long equipmentId, long eventTimestamp, protected void processRealTimeSipCallStartEvent(int customerId, long equipmentId, long locationId, long eventTimestamp,
List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) { List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) {
if (videoVoiceReport.hasCallStart()) { if (videoVoiceReport.hasCallStart()) {
CallStart apCallStart = videoVoiceReport.getCallStart(); CallStart apCallStart = videoVoiceReport.getCallStart();
RealTimeSipCallStartEvent cloudSipCallStartEvent = new RealTimeSipCallStartEvent(customerId, equipmentId, RealTimeSipCallStartEvent cloudSipCallStartEvent = new RealTimeSipCallStartEvent(customerId, locationId, equipmentId,
eventTimestamp); eventTimestamp);
if (apCallStart.hasClientMac() && apCallStart.getClientMac().isValidUtf8()) { if (apCallStart.hasClientMac() && apCallStart.getClientMac().isValidUtf8()) {
@@ -897,13 +917,13 @@ public class RealtimeEventPublisher {
} }
} }
protected void processRealTimeSipCallStopEvent(int customerId, long equipmentId, long eventTimestamp, protected void processRealTimeSipCallStopEvent(int customerId, long equipmentId, long locationId, long eventTimestamp,
List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) { List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) {
if (videoVoiceReport.hasCallStop()) { if (videoVoiceReport.hasCallStop()) {
CallStop apCallStop = videoVoiceReport.getCallStop(); CallStop apCallStop = videoVoiceReport.getCallStop();
RealTimeSipCallStopEvent cloudSipCallStopEvent = new RealTimeSipCallStopEvent(customerId, equipmentId, RealTimeSipCallStopEvent cloudSipCallStopEvent = new RealTimeSipCallStopEvent(customerId, locationId, equipmentId,
eventTimestamp); eventTimestamp);
if (apCallStop.hasCallDuration()) { if (apCallStop.hasCallDuration()) {
@@ -971,11 +991,11 @@ public class RealtimeEventPublisher {
} }
} }
protected void processRtsStartEvent(int customerId, long equipmentId, long eventTimestamp, protected void processRtsStartEvent(int customerId, long equipmentId, long locationId, long eventTimestamp,
List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) { List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) {
if (videoVoiceReport.hasStreamVideoServer()) { if (videoVoiceReport.hasStreamVideoServer()) {
StreamingVideoServerDetected apStreamVideoServer = videoVoiceReport.getStreamVideoServer(); StreamingVideoServerDetected apStreamVideoServer = videoVoiceReport.getStreamVideoServer();
RealTimeStreamingStartEvent rtsStartEvent = new RealTimeStreamingStartEvent(customerId, equipmentId, RealTimeStreamingStartEvent rtsStartEvent = new RealTimeStreamingStartEvent(customerId, locationId, equipmentId,
eventTimestamp); eventTimestamp);
if (apStreamVideoServer.hasServerIp()) { if (apStreamVideoServer.hasServerIp()) {
try { try {
@@ -1102,12 +1122,12 @@ public class RealtimeEventPublisher {
return cloudRtpFlowStatsList; return cloudRtpFlowStatsList;
} }
protected void processRtsStartSessionEvent(int customerId, long equipmentId, long eventTimestamp, protected void processRtsStartSessionEvent(int customerId, long equipmentId, long locationId, long eventTimestamp,
List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) { List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) {
if (videoVoiceReport.hasStreamVideoSessionStart()) { if (videoVoiceReport.hasStreamVideoSessionStart()) {
StreamingVideoSessionStart apStreamVideoSessionStart = videoVoiceReport.getStreamVideoSessionStart(); StreamingVideoSessionStart apStreamVideoSessionStart = videoVoiceReport.getStreamVideoSessionStart();
RealTimeStreamingStartSessionEvent rtsStartSessionEvent = new RealTimeStreamingStartSessionEvent(customerId, RealTimeStreamingStartSessionEvent rtsStartSessionEvent = new RealTimeStreamingStartSessionEvent(customerId,
equipmentId, eventTimestamp); locationId, equipmentId, eventTimestamp);
if (apStreamVideoSessionStart.hasClientMac() && apStreamVideoSessionStart.getClientMac().isValidUtf8()) { if (apStreamVideoSessionStart.hasClientMac() && apStreamVideoSessionStart.getClientMac().isValidUtf8()) {
rtsStartSessionEvent.setClientMacAddress( rtsStartSessionEvent.setClientMacAddress(
MacAddress.valueOf(apStreamVideoSessionStart.getClientMac().toStringUtf8())); MacAddress.valueOf(apStreamVideoSessionStart.getClientMac().toStringUtf8()));
@@ -1141,11 +1161,11 @@ public class RealtimeEventPublisher {
} }
} }
protected void processRtsStopEvent(int customerId, long equipmentId, long eventTimestamp, protected void processRtsStopEvent(int customerId, long equipmentId, long locationId, long eventTimestamp,
List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) { List<SystemEvent> eventsList, VideoVoiceReport videoVoiceReport) {
if (videoVoiceReport.hasStreamVideoStop()) { if (videoVoiceReport.hasStreamVideoStop()) {
StreamingVideoStop apStreamVideoStop = videoVoiceReport.getStreamVideoStop(); StreamingVideoStop apStreamVideoStop = videoVoiceReport.getStreamVideoStop();
RealTimeStreamingStopEvent rtsStopEvent = new RealTimeStreamingStopEvent(customerId, equipmentId, RealTimeStreamingStopEvent rtsStopEvent = new RealTimeStreamingStopEvent(customerId, locationId, equipmentId,
eventTimestamp); eventTimestamp);
if (apStreamVideoStop.hasClientMac() && apStreamVideoStop.getClientMac().isValidUtf8()) { if (apStreamVideoStop.hasClientMac() && apStreamVideoStop.getClientMac().isValidUtf8()) {
rtsStopEvent.setClientMacAddress(MacAddress.valueOf(apStreamVideoStop.getClientMac().toStringUtf8())); rtsStopEvent.setClientMacAddress(MacAddress.valueOf(apStreamVideoStop.getClientMac().toStringUtf8()));

View File

@@ -108,7 +108,7 @@ public class RealtimeEventPublisherTest {
.setStaMac("c0:9a:d0:76:a9:69").setSessionId(Long.parseUnsignedLong("12377998144488079334")) .setStaMac("c0:9a:d0:76:a9:69").setSessionId(Long.parseUnsignedLong("12377998144488079334"))
.setAuthStatus(WlanStatusCode.WLAN_STATUS_SUCCESS.getId()).setTimestampMs(1610050309).build(); .setAuthStatus(WlanStatusCode.WLAN_STATUS_SUCCESS.getId()).setTimestampMs(1610050309).build();
realtimeEventPublisher.publishClientAuthSystemEvent(2, 1L, clientAuthEvent); realtimeEventPublisher.publishClientAuthSystemEvent(2, 1L, 0L, clientAuthEvent);
Mockito.verify(cloudEventDispatcherInterface, Mockito.times(1)) Mockito.verify(cloudEventDispatcherInterface, Mockito.times(1))
.publishEvent(Mockito.any(ClientAuthEvent.class)); .publishEvent(Mockito.any(ClientAuthEvent.class));
@@ -123,7 +123,7 @@ public class RealtimeEventPublisherTest {
.setUsing11K(true).setUsing11V(true).setStatus(WlanStatusCode.WLAN_STATUS_SUCCESS.getId()) .setUsing11K(true).setUsing11V(true).setStatus(WlanStatusCode.WLAN_STATUS_SUCCESS.getId())
.setTimestampMs(1610050309).build(); .setTimestampMs(1610050309).build();
realtimeEventPublisher.publishClientAssocEvent(2, 1L, clientAssocEvent); realtimeEventPublisher.publishClientAssocEvent(2, 1L, 0L, clientAssocEvent);
Mockito.verify(cloudEventDispatcherInterface, Mockito.times(1)) Mockito.verify(cloudEventDispatcherInterface, Mockito.times(1))
.publishEvent(Mockito.any(ClientAssocEvent.class)); .publishEvent(Mockito.any(ClientAssocEvent.class));
@@ -272,7 +272,7 @@ public class RealtimeEventPublisherTest {
dhcpTransactionList.add(dhcpTransaction); dhcpTransactionList.add(dhcpTransaction);
realtimeEventPublisher.publishDhcpTransactionEvents(2, 1L, dhcpTransactionList); realtimeEventPublisher.publishDhcpTransactionEvents(2, 1L, 0L, dhcpTransactionList);
Mockito.verify(cloudEventDispatcherInterface,Mockito.times(1)).publishEventsBulk(Mockito.anyList()); Mockito.verify(cloudEventDispatcherInterface,Mockito.times(1)).publishEventsBulk(Mockito.anyList());
@@ -301,7 +301,7 @@ public class RealtimeEventPublisherTest {
.addVideoVoiceReport(callReportRoamedToVoiceReportBuilder) .addVideoVoiceReport(callReportRoamedToVoiceReportBuilder)
.addVideoVoiceReport(callStopVoiceReportBuilder).setNodeID("1").build(); .addVideoVoiceReport(callStopVoiceReportBuilder).setNodeID("1").build();
realtimeEventPublisher.publishSipCallEvents(1, 2L, multipleVoiceReportsInOneReport.getVideoVoiceReportList()); realtimeEventPublisher.publishSipCallEvents(1, 2L, 0L, multipleVoiceReportsInOneReport.getVideoVoiceReportList());
Mockito.verify(cloudEventDispatcherInterface, Mockito.times(1)).publishEventsBulk(Mockito.anyList()); Mockito.verify(cloudEventDispatcherInterface, Mockito.times(1)).publishEventsBulk(Mockito.anyList());
} }