mirror of
https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
synced 2025-11-03 03:57:54 +00:00
WIFI-1255: OSGW Dhcp Event Publishing -- robustness to guard against invalid populated proto messages, adding additional logs
This commit is contained in:
@@ -226,7 +226,7 @@ public class MqttStatsPublisher {
|
||||
// equipmentId, locationId);
|
||||
|
||||
} catch (Exception e) {
|
||||
LOG.error("Exception when processing populateApSsidMetrics", e);
|
||||
LOG.error("Exception when processing stats messages from AP", e);
|
||||
}
|
||||
|
||||
if (!metricRecordList.isEmpty()) {
|
||||
|
||||
@@ -37,6 +37,7 @@ import com.telecominfraproject.wlan.systemevent.equipment.realtime.SIPCallReport
|
||||
import com.telecominfraproject.wlan.systemevent.equipment.realtime.SipCallStopReason;
|
||||
import com.telecominfraproject.wlan.systemevent.models.SystemEvent;
|
||||
|
||||
import io.netty.util.internal.MacAddressUtil;
|
||||
import sts.OpensyncStats;
|
||||
import sts.OpensyncStats.AssocType;
|
||||
import sts.OpensyncStats.CTReasonType;
|
||||
@@ -545,7 +546,7 @@ public class RealtimeEventPublisher {
|
||||
|
||||
void publishDhcpTransactionEvents(int customerId, long equipmentId,
|
||||
List<DhcpTransaction> dhcpTransactionList) {
|
||||
|
||||
LOG.info("Publish Dhcp Transaction Events for customer {} equipmentId {}", customerId, equipmentId);
|
||||
List<SystemEvent> dhcpEventsList = new ArrayList<>();
|
||||
for (DhcpTransaction dhcpTransaction : dhcpTransactionList) {
|
||||
|
||||
@@ -609,6 +610,8 @@ public class RealtimeEventPublisher {
|
||||
cloudDhcpAck.setTimeOffset(ackEvent.getTimeOffset());
|
||||
}
|
||||
|
||||
LOG.debug("Cloud DhcpAckEvent {}", cloudDhcpAck);
|
||||
|
||||
dhcpEventsList.add(cloudDhcpAck);
|
||||
}
|
||||
|
||||
@@ -629,7 +632,10 @@ public class RealtimeEventPublisher {
|
||||
|
||||
if (nakEvent.hasFromInternal()) {
|
||||
cloudDhcpNak.setFromInternal(nakEvent.getFromInternal());
|
||||
}
|
||||
}
|
||||
|
||||
LOG.debug("Cloud DhcpNakEvent {}", cloudDhcpNak);
|
||||
|
||||
dhcpEventsList.add(cloudDhcpNak);
|
||||
|
||||
}
|
||||
@@ -692,6 +698,9 @@ public class RealtimeEventPublisher {
|
||||
cloudDhcpDecline.setxId(dhcpTransaction.getXId());
|
||||
}
|
||||
|
||||
LOG.debug("Cloud DhcpDeclineEvent {}", cloudDhcpDecline);
|
||||
|
||||
|
||||
dhcpEventsList.add(cloudDhcpDecline);
|
||||
|
||||
}
|
||||
@@ -715,6 +724,9 @@ public class RealtimeEventPublisher {
|
||||
cloudDhcpRequest.setHostName(requestEvent.getHostname());
|
||||
}
|
||||
|
||||
LOG.debug("Cloud DhcpRequestEvent {}", cloudDhcpRequest);
|
||||
|
||||
|
||||
dhcpEventsList.add(cloudDhcpRequest);
|
||||
|
||||
|
||||
@@ -739,12 +751,15 @@ public class RealtimeEventPublisher {
|
||||
cloudDhcpDiscover.setHostName(discoverEvent.getHostname());
|
||||
}
|
||||
|
||||
LOG.debug("Cloud DhcpDiscoverEvent {}", cloudDhcpDiscover);
|
||||
|
||||
dhcpEventsList.add(cloudDhcpDiscover);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (dhcpEventsList.size() > 0) {
|
||||
LOG.info("Publishing DhcpEvents {}", dhcpEventsList);
|
||||
cloudEventDispatcherInterface.publishEventsBulk(dhcpEventsList);
|
||||
}
|
||||
}
|
||||
@@ -760,7 +775,12 @@ public class RealtimeEventPublisher {
|
||||
}
|
||||
|
||||
if (dhcpCommonData.hasDeviceMacAddress()) {
|
||||
cloudDhcpEvent.setDeviceMacAddress(MacAddress.valueOf(dhcpCommonData.getDeviceMacAddress()));
|
||||
|
||||
try {
|
||||
cloudDhcpEvent.setDeviceMacAddress(MacAddress.valueOf(dhcpCommonData.getDeviceMacAddress()));
|
||||
} catch (Exception e) {
|
||||
LOG.error("Could not parse device_mac_address from DhcpCommonData ", dhcpCommonData, e);
|
||||
}
|
||||
}
|
||||
|
||||
if (dhcpCommonData.hasDhcpServerIp()) {
|
||||
|
||||
@@ -274,7 +274,7 @@ public class RealtimeEventPublisherTest {
|
||||
|
||||
realtimeEventPublisher.publishDhcpTransactionEvents(2, 1L, dhcpTransactionList);
|
||||
|
||||
Mockito.verify(cloudEventDispatcherInterface).publishEventsBulk(Mockito.anyList());
|
||||
Mockito.verify(cloudEventDispatcherInterface,Mockito.times(1)).publishEventsBulk(Mockito.anyList());
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user