diff --git a/all-cloud-and-opensync-gw-in-one-process/src/main/java/com/telecominfraproject/wlan/startuptasks/AllInOneWithGatewayStartListener.java b/all-cloud-and-opensync-gw-in-one-process/src/main/java/com/telecominfraproject/wlan/startuptasks/AllInOneWithGatewayStartListener.java index 9b18f3e3..aaab47f2 100644 --- a/all-cloud-and-opensync-gw-in-one-process/src/main/java/com/telecominfraproject/wlan/startuptasks/AllInOneWithGatewayStartListener.java +++ b/all-cloud-and-opensync-gw-in-one-process/src/main/java/com/telecominfraproject/wlan/startuptasks/AllInOneWithGatewayStartListener.java @@ -668,7 +668,9 @@ public class AllInOneWithGatewayStartListener implements ApplicationRunner { apNodeMetrics.setApPerformance(apPerformance); smr.setCreatedTimestamp(System.currentTimeMillis()); - apNodeMetrics.setChannelUtilization(RadioType.is2dot4GHz, getRandomInt(30, 70)); + smr.setLocationId(equipment.getLocationId()); + + apNodeMetrics.setChannelUtilization(RadioType.is2dot4GHz, getRandomInt(30, 70)); apNodeMetrics.setChannelUtilization(RadioType.is5GHzL, getRandomInt(30, 70)); apNodeMetrics.setChannelUtilization(RadioType.is5GHzU, getRandomInt(30, 70)); diff --git a/all-cloud-in-one-process/src/main/java/com/telecominfraproject/wlan/startuptasks/AllInOneStartListener.java b/all-cloud-in-one-process/src/main/java/com/telecominfraproject/wlan/startuptasks/AllInOneStartListener.java index a81ea79a..c119df4c 100644 --- a/all-cloud-in-one-process/src/main/java/com/telecominfraproject/wlan/startuptasks/AllInOneStartListener.java +++ b/all-cloud-in-one-process/src/main/java/com/telecominfraproject/wlan/startuptasks/AllInOneStartListener.java @@ -1142,6 +1142,8 @@ public class AllInOneStartListener implements ApplicationRunner { apNodeMetrics.setApPerformance(apPerformance); smr.setCreatedTimestamp(System.currentTimeMillis() - mCnt * 60000); + smr.setLocationId(equipment.getLocationId()); + apNodeMetrics.setChannelUtilization(RadioType.is2dot4GHz, getRandomInt(30, 70)); apNodeMetrics.setChannelUtilization(RadioType.is5GHzL, getRandomInt(30, 70)); apNodeMetrics.setChannelUtilization(RadioType.is5GHzU, getRandomInt(30, 70)); @@ -1233,6 +1235,7 @@ public class AllInOneStartListener implements ApplicationRunner { smrClient.setDetails(clientMetrics); smrClient.setCreatedTimestamp(smr.getCreatedTimestamp()); smrClient.setClientMac(clientMac.getAddressAsLong()); + smrClient.setLocationId(equipment.getLocationId()); clientMetrics.setPeriodLengthSec(60); clientMetrics.setRadioType(RadioType.is2dot4GHz); @@ -1259,6 +1262,7 @@ public class AllInOneStartListener implements ApplicationRunner { smrClient.setDetails(clientMetrics); smrClient.setCreatedTimestamp(smr.getCreatedTimestamp()); smrClient.setClientMac(clientMac.getAddressAsLong()); + smrClient.setLocationId(equipment.getLocationId()); clientMetrics.setPeriodLengthSec(60); clientMetrics.setRadioType(RadioType.is5GHzL); @@ -1285,7 +1289,8 @@ public class AllInOneStartListener implements ApplicationRunner { smrClient.setDetails(clientMetrics); smrClient.setCreatedTimestamp(smr.getCreatedTimestamp()); smrClient.setClientMac(clientMac.getAddressAsLong()); - + smrClient.setLocationId(equipment.getLocationId()); + clientMetrics.setPeriodLengthSec(60); clientMetrics.setRadioType(RadioType.is5GHzU); diff --git a/client-models/src/main/java/com/telecominfraproject/wlan/client/models/events/realtime/ClientAssocEvent.java b/client-models/src/main/java/com/telecominfraproject/wlan/client/models/events/realtime/ClientAssocEvent.java index 7a9abd02..61ca9bd4 100644 --- a/client-models/src/main/java/com/telecominfraproject/wlan/client/models/events/realtime/ClientAssocEvent.java +++ b/client-models/src/main/java/com/telecominfraproject/wlan/client/models/events/realtime/ClientAssocEvent.java @@ -29,10 +29,10 @@ public class ClientAssocEvent extends RealTimeEvent implements HasClientMac { } - public ClientAssocEvent(int customerId, long equipmentId, long timestamp, long sessionId, String ssid, + public ClientAssocEvent(int customerId, long locationId, long equipmentId, long timestamp, long sessionId, String ssid, MacAddress clientMacAddress, RadioType radioType, boolean isReassociation, WlanStatusCode status, Integer internalSC, Integer rssi) { - super(RealTimeEventType.STA_Client_Assoc, customerId, equipmentId, timestamp); + super(RealTimeEventType.STA_Client_Assoc, customerId, locationId, equipmentId, timestamp); this.sessionId = sessionId; this.ssid = ssid; setClientMacAddress(clientMacAddress); diff --git a/cloud-event-dispatcher-remote/pom.xml b/cloud-event-dispatcher-remote/pom.xml index a6e40c7e..fa44f437 100644 --- a/cloud-event-dispatcher-remote/pom.xml +++ b/cloud-event-dispatcher-remote/pom.xml @@ -46,6 +46,21 @@ test + + equipment-service-local + com.telecominfraproject.wlan + ${tip-wlan-cloud.release.version} + test + + + + equipment-datastore-inmemory + com.telecominfraproject.wlan + ${tip-wlan-cloud.release.version} + test + + + base-stream-interface com.telecominfraproject.wlan diff --git a/cloud-event-dispatcher/pom.xml b/cloud-event-dispatcher/pom.xml index 8c089c71..da2192b8 100644 --- a/cloud-event-dispatcher/pom.xml +++ b/cloud-event-dispatcher/pom.xml @@ -42,6 +42,12 @@ ${tip-wlan-cloud.release.version} + + equipment-service-interface + com.telecominfraproject.wlan + ${tip-wlan-cloud.release.version} + + diff --git a/cloud-event-dispatcher/src/main/java/com/telecominfraproject/wlan/cloudeventdispatcher/CloudEventDispatcherController.java b/cloud-event-dispatcher/src/main/java/com/telecominfraproject/wlan/cloudeventdispatcher/CloudEventDispatcherController.java index ccc2753f..40f2cef1 100644 --- a/cloud-event-dispatcher/src/main/java/com/telecominfraproject/wlan/cloudeventdispatcher/CloudEventDispatcherController.java +++ b/cloud-event-dispatcher/src/main/java/com/telecominfraproject/wlan/cloudeventdispatcher/CloudEventDispatcherController.java @@ -3,16 +3,23 @@ import java.util.List; import java.util.concurrent.atomic.AtomicLong; +import javax.annotation.PostConstruct; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.cache.Cache; +import org.springframework.cache.CacheManager; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RestController; import com.telecominfraproject.wlan.core.model.json.GenericResponse; +import com.telecominfraproject.wlan.core.model.json.interfaces.HasEquipmentId; +import com.telecominfraproject.wlan.equipment.EquipmentServiceInterface; +import com.telecominfraproject.wlan.equipment.models.Equipment; import com.telecominfraproject.wlan.servicemetric.ServiceMetricServiceInterface; import com.telecominfraproject.wlan.servicemetric.models.ServiceMetric; import com.telecominfraproject.wlan.stream.StreamInterface; @@ -29,6 +36,31 @@ public class CloudEventDispatcherController { @Autowired @Qualifier("eventStreamInterface") private StreamInterface systemEventStream; @Autowired private ServiceMetricServiceInterface serviceMetricInterface; @Autowired private SystemEventServiceInterface systemEventInterface; + + @Autowired private EquipmentServiceInterface equipmentServiceInterface; + @Autowired private CacheManager cacheManagerShortLived; + + private Cache equipmentLocationCache; + + @PostConstruct + private void postCreate() { + equipmentLocationCache = cacheManagerShortLived.getCache("equipment_location_cache"); + } + + private Long getEquipmentLocation(long equipmentId) { + Long eqLocation = null; + + try { + eqLocation = equipmentLocationCache.get(equipmentId, () -> { + Equipment eq = equipmentServiceInterface.getOrNull(equipmentId); + return eq == null ? null : eq.getLocationId(); + }); + } catch (Exception e) { + LOG.error("Could not get equipment location for {}", equipmentId, e); + } + + return eqLocation; + } @RequestMapping(value="/metric", method=RequestMethod.POST) public GenericResponse publishMetric(@RequestBody ServiceMetric metricRecord) { @@ -39,6 +71,8 @@ public class CloudEventDispatcherController { if (metricRecord.getCreatedTimestamp() == 0) { metricRecord.setCreatedTimestamp(ts); } + + populateLocationIdIfNeeded(metricRecord); metricStream.publish(metricRecord); serviceMetricInterface.create(metricRecord); @@ -64,6 +98,8 @@ public class CloudEventDispatcherController { if (m.getCreatedTimestamp() == 0) { m.setCreatedTimestamp(ts.incrementAndGet()); } + + populateLocationIdIfNeeded(m); }); metricStream.publish(metricList); @@ -85,6 +121,8 @@ public class CloudEventDispatcherController { systemEventRecord.setEventTimestamp(ts); } + populateLocationIdIfNeeded(systemEventRecord); + systemEventStream.publish(systemEventRecord); systemEventInterface.create(systemEventRecord); @@ -108,6 +146,8 @@ public class CloudEventDispatcherController { if (m.getEventTimestamp() == 0) { m.setEventTimestamp(ts.incrementAndGet()); } + + populateLocationIdIfNeeded(m); }); systemEventStream.publish(systemEventRecords); @@ -120,5 +160,24 @@ public class CloudEventDispatcherController { return ret; } + private void populateLocationIdIfNeeded(SystemEventRecord ser) { + if(ser.getEquipmentId()!=0 && ser.getLocationId() == 0) { + //caller did not have location id, extract it from the equipment record, if any + Long eqLocation = getEquipmentLocation(ser.getEquipmentId()); + if(eqLocation!=null) { + ser.setLocationId(eqLocation); + } + } + } + private void populateLocationIdIfNeeded(ServiceMetric sm) { + if(sm.getEquipmentId()!=0 && sm.getLocationId() == 0) { + //caller did not have location id, extract it from the equipment record, if any + Long eqLocation = getEquipmentLocation(sm.getEquipmentId()); + if(eqLocation!=null) { + sm.setLocationId(eqLocation); + } + } + } + } diff --git a/port-forwarding-gateway/src/main/java/com/telecominfraproject/wlan/portforwardinggateway/controller/PortForwarderController.java b/port-forwarding-gateway/src/main/java/com/telecominfraproject/wlan/portforwardinggateway/controller/PortForwarderController.java index 8d960fd7..9d0a1bdd 100644 --- a/port-forwarding-gateway/src/main/java/com/telecominfraproject/wlan/portforwardinggateway/controller/PortForwarderController.java +++ b/port-forwarding-gateway/src/main/java/com/telecominfraproject/wlan/portforwardinggateway/controller/PortForwarderController.java @@ -32,6 +32,7 @@ import com.telecominfraproject.wlan.status.models.StatusDetails; import com.telecominfraproject.wlan.systemevent.equipment.debug.EquipmentDebugSessionStartedEvent; import com.telecominfraproject.wlan.systemevent.equipment.debug.EquipmentDebugSessionStoppedEvent; import com.telecominfraproject.wlan.systemevent.models.SystemEvent; +import com.telecominfraproject.wlan.systemevent.models.SystemEventRecord; /** * Port Forwarder Controller @@ -92,7 +93,10 @@ public class PortForwarderController { //create system event to record that debug session has been started on the equipment SystemEvent systemEvent = new EquipmentDebugSessionStartedEvent(equipment.getCustomerId(), equipment.getId(), status.getLastModifiedTimestamp(), getCurrentlyAuthenticatedUser(), portForwarderGatewayPort, port); - cloudEventDispatcherInterface.publishEvent(systemEvent); + + SystemEventRecord eventRecord = new SystemEventRecord(systemEvent); + eventRecord.setLocationId(equipment.getLocationId()); + cloudEventDispatcherInterface.publishEvent(eventRecord); LOG.info("createSession({}, {}) returns {}", inventoryId, port, result); @@ -138,7 +142,11 @@ public class PortForwarderController { //create system event to record that debug session has been stopped on the equipment SystemEvent systemEvent = new EquipmentDebugSessionStoppedEvent(equipment.getCustomerId(), equipment.getId(), status.getLastModifiedTimestamp(), getCurrentlyAuthenticatedUser(), portForwarderGatewayPort, port); - cloudEventDispatcherInterface.publishEvent(systemEvent); + + SystemEventRecord eventRecord = new SystemEventRecord(systemEvent); + eventRecord.setLocationId(equipment.getLocationId()); + cloudEventDispatcherInterface.publishEvent(eventRecord); + } diff --git a/ssc-process/pom.xml b/ssc-process/pom.xml index 4aa70ad1..9f44fcdb 100644 --- a/ssc-process/pom.xml +++ b/ssc-process/pom.xml @@ -33,6 +33,12 @@ com.telecominfraproject.wlan ${tip-wlan-cloud.release.version} + + + equipment-service-remote + com.telecominfraproject.wlan + ${tip-wlan-cloud.release.version} + service-metric-service-local diff --git a/ssc-process/src/main/resources/application.properties b/ssc-process/src/main/resources/application.properties index 36e2da35..30670dda 100644 --- a/ssc-process/src/main/resources/application.properties +++ b/ssc-process/src/main/resources/application.properties @@ -30,6 +30,8 @@ tip.wlan.serviceUser=user # htpasswd -nBC 10 "" | cut -d ':' -f2 tip.wlan.servicePassword=$2y$10$rXnaSR5q2PsFWs8WEfJAguKAPh0oHLFkAJFqd7Pf7PVa3cOIClGoS +#PROV services +tip.wlan.equipmentServiceBaseUrl=https://localhost:9091 #server.session-timeout= # session timeout in seconds #server.tomcat.max-threads = 0 # number of threads in protocol handler diff --git a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/BaseDhcpEvent.java b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/BaseDhcpEvent.java index 9d3a989e..604e7c46 100644 --- a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/BaseDhcpEvent.java +++ b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/BaseDhcpEvent.java @@ -8,9 +8,10 @@ import java.util.Objects; import com.telecominfraproject.wlan.core.model.equipment.MacAddress; import com.telecominfraproject.wlan.core.model.json.interfaces.HasClientMac; +import com.telecominfraproject.wlan.core.model.json.interfaces.HasLocationId; import com.telecominfraproject.wlan.systemevent.models.SystemEvent; -public abstract class BaseDhcpEvent extends SystemEvent implements HasClientMac { +public abstract class BaseDhcpEvent extends SystemEvent implements HasClientMac, HasLocationId { private static final long serialVersionUID = 606411494287591881L; private int xId; @@ -22,10 +23,12 @@ public abstract class BaseDhcpEvent extends SystemEvent implements HasClientMac private long sessionId; // association sessionid private int customerId; private long equipmentId; + private long locationId; - public BaseDhcpEvent(int customerId, long equipmentId, long eventTimestamp, long sessionId) { + public BaseDhcpEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, long sessionId) { super(eventTimestamp); this.customerId = customerId; + this.locationId = locationId; this.equipmentId = equipmentId; this.sessionId = sessionId; } @@ -61,6 +64,15 @@ public abstract class BaseDhcpEvent extends SystemEvent implements HasClientMac return equipmentId; } + @Override + public long getLocationId() { + return locationId; + } + + public void setLocationId(long locationId) { + this.locationId = locationId; + } + public int getxId() { return xId; } @@ -133,22 +145,26 @@ public abstract class BaseDhcpEvent extends SystemEvent implements HasClientMac public int hashCode() { final int prime = 31; int result = super.hashCode(); - result = prime * result + Objects.hash(clientIp, customerId, clientMacAddress, dhcpServerIp, equipmentId, + result = prime * result + Objects.hash(clientIp, customerId, clientMacAddress, dhcpServerIp, equipmentId, locationId, relayIp, sessionId, vlanId, xId); return result; } @Override public boolean equals(Object obj) { - if (this == obj) + if (this == obj) { return true; - if (!super.equals(obj)) + } + if (!super.equals(obj)) { return false; - if (getClass() != obj.getClass()) + } + if (getClass() != obj.getClass()) { return false; + } + BaseDhcpEvent other = (BaseDhcpEvent) obj; return Objects.equals(clientIp, other.clientIp) && customerId == other.customerId - && Objects.equals(clientMacAddress, other.clientMacAddress) + && Objects.equals(clientMacAddress, other.clientMacAddress) && locationId == other.locationId && Objects.equals(dhcpServerIp, other.dhcpServerIp) && equipmentId == other.equipmentId && Objects.equals(relayIp, other.relayIp) && sessionId == other.sessionId && vlanId == other.vlanId && xId == other.xId; diff --git a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpAckEvent.java b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpAckEvent.java index d864186d..0eee8a59 100644 --- a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpAckEvent.java +++ b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpAckEvent.java @@ -22,12 +22,12 @@ public class DhcpAckEvent extends BaseDhcpEvent { */ private boolean fromInternal = false; - public DhcpAckEvent(int customerId, long equipmentId, long eventTimestamp, long sessionId) { - super(customerId, equipmentId, eventTimestamp, sessionId); + public DhcpAckEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, long sessionId) { + super(customerId, locationId, equipmentId, eventTimestamp, sessionId); } public DhcpAckEvent() { - super(0,0L,0L,0L); + super(0, 0L,0L,0L,0L); } public InetAddress getGatewayIp() { diff --git a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpDeclineEvent.java b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpDeclineEvent.java index 912a2515..b6790ee1 100644 --- a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpDeclineEvent.java +++ b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpDeclineEvent.java @@ -10,12 +10,12 @@ package com.telecominfraproject.wlan.systemevent.equipment; public class DhcpDeclineEvent extends BaseDhcpEvent { private static final long serialVersionUID = -7745659083975485467L; - public DhcpDeclineEvent(int customerId, long equipmentId, long eventTimestamp, long sessionId){ - super(customerId,equipmentId,eventTimestamp, sessionId); + public DhcpDeclineEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, long sessionId){ + super(customerId, locationId, equipmentId,eventTimestamp, sessionId); } public DhcpDeclineEvent() { - super(0,0L,0L,0L); + super(0,0L, 0L,0L,0L); } @Override diff --git a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpDiscoverEvent.java b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpDiscoverEvent.java index e3c67cc5..0e90b359 100644 --- a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpDiscoverEvent.java +++ b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpDiscoverEvent.java @@ -9,12 +9,12 @@ public class DhcpDiscoverEvent extends BaseDhcpEvent { private static final long serialVersionUID = -8290687227649478971L; private String hostName; - public DhcpDiscoverEvent(int customerId, long equipmentId, long eventTimestamp, long sessionId){ - super(customerId,equipmentId,eventTimestamp,sessionId); + public DhcpDiscoverEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, long sessionId){ + super(customerId, locationId,equipmentId,eventTimestamp,sessionId); } public DhcpDiscoverEvent() { - super(0,0L,0L,0L); + super(0, 0L,0L,0L,0L); } /** diff --git a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpInformEvent.java b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpInformEvent.java index ba5fdd03..f31fa145 100644 --- a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpInformEvent.java +++ b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpInformEvent.java @@ -10,12 +10,12 @@ package com.telecominfraproject.wlan.systemevent.equipment; public class DhcpInformEvent extends BaseDhcpEvent { private static final long serialVersionUID = 7053813308222200205L; - public DhcpInformEvent(int customerId, long equipmentId, long eventTimestamp, long sessionId){ - super(customerId,equipmentId,eventTimestamp, sessionId); + public DhcpInformEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, long sessionId){ + super(customerId, locationId,equipmentId,eventTimestamp, sessionId); } public DhcpInformEvent() { - super(0,0L,0L,0L); + super(0, 0L,0L,0L,0L); } @Override diff --git a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpNakEvent.java b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpNakEvent.java index e53a1da3..d28272f1 100644 --- a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpNakEvent.java +++ b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpNakEvent.java @@ -9,12 +9,12 @@ public class DhcpNakEvent extends BaseDhcpEvent { private static final long serialVersionUID = -8648265834227002667L; private boolean fromInternal = false; - public DhcpNakEvent(int customerId, long equipmentId, long eventTimestamp, long sessionId) { - super(customerId, equipmentId, eventTimestamp, sessionId); + public DhcpNakEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, long sessionId) { + super(customerId, locationId, equipmentId, eventTimestamp, sessionId); } public DhcpNakEvent() { - super(0,0L,0L,0L); + super(0, 0L,0L,0L,0L); } /** diff --git a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpOfferEvent.java b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpOfferEvent.java index 9193e4a8..763752ff 100644 --- a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpOfferEvent.java +++ b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpOfferEvent.java @@ -10,12 +10,12 @@ public class DhcpOfferEvent extends BaseDhcpEvent { */ private boolean fromInternal = false; - public DhcpOfferEvent(int customerId, long equipmentId, long eventTimestamp, long sessionId) { - super(customerId, equipmentId, eventTimestamp, sessionId); + public DhcpOfferEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, long sessionId) { + super(customerId, locationId, equipmentId, eventTimestamp, sessionId); } public DhcpOfferEvent() { - super(0,0L,0L,0L); + super(0, 0L,0L,0L,0L); } /** diff --git a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpRequestEvent.java b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpRequestEvent.java index 3c83aadf..75591688 100644 --- a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpRequestEvent.java +++ b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/DhcpRequestEvent.java @@ -9,12 +9,12 @@ public class DhcpRequestEvent extends BaseDhcpEvent { private static final long serialVersionUID = 906425685437156761L; private String hostName; - public DhcpRequestEvent(int customerId, long equipmentId, long eventTimestamp, long sessionId){ - super(customerId,equipmentId,eventTimestamp, sessionId); + public DhcpRequestEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, long sessionId){ + super(customerId, locationId,equipmentId,eventTimestamp, sessionId); } public DhcpRequestEvent() { - super(0,0L,0L,0L); + super(0, 0L,0L,0L,0L); } /** diff --git a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeChannelHopEvent.java b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeChannelHopEvent.java index b35a21cc..d2269b88 100644 --- a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeChannelHopEvent.java +++ b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeChannelHopEvent.java @@ -27,15 +27,15 @@ public class RealTimeChannelHopEvent extends RealTimeEvent implements HasCustome return new RealTimeChannelHopEvent(); } - public RealTimeChannelHopEvent(RealTimeEventType eventType, int customerId, long equipmentId, RadioType radioType, + public RealTimeChannelHopEvent(RealTimeEventType eventType, int customerId, long locationId, long equipmentId, RadioType radioType, Long timestamp) { - super(RealTimeEventType.Channel_Hop, customerId, equipmentId, timestamp); + super(RealTimeEventType.Channel_Hop, customerId, locationId, equipmentId, timestamp); this.radioType = radioType; } - public RealTimeChannelHopEvent(RealTimeEventType eventType, int customerId, long equipmentId, RadioType radioType, + public RealTimeChannelHopEvent(RealTimeEventType eventType, int customerId, long locationId, long equipmentId, RadioType radioType, int newChannel, int oldChannel, ChannelHopReason reasonCode, Long timestamp) { - this(eventType, customerId, equipmentId, radioType, timestamp); + this(eventType, customerId, locationId, equipmentId, radioType, timestamp); this.newChannel = newChannel; this.oldChannel = oldChannel; this.reasonCode = reasonCode; diff --git a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeEvent.java b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeEvent.java index 3ecbfe62..317efab4 100644 --- a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeEvent.java +++ b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeEvent.java @@ -2,9 +2,10 @@ package com.telecominfraproject.wlan.systemevent.equipment.realtime; import java.util.Objects; +import com.telecominfraproject.wlan.core.model.json.interfaces.HasLocationId; import com.telecominfraproject.wlan.systemevent.models.SystemEvent; -public abstract class RealTimeEvent extends SystemEvent { +public abstract class RealTimeEvent extends SystemEvent implements HasLocationId { private static final long serialVersionUID = -406572942058780057L; @@ -15,15 +16,19 @@ public abstract class RealTimeEvent extends SystemEvent { private long equipmentId; + private long locationId; + private int customerId; + public RealTimeEvent() { } - public RealTimeEvent(RealTimeEventType eventType, int customerId, long equipmentId, Long timestamp) { + public RealTimeEvent(RealTimeEventType eventType, int customerId, long locationId, long equipmentId, Long timestamp) { super(timestamp); this.customerId = customerId; + this.locationId = locationId; this.equipmentId = equipmentId; this.eventType = eventType; } @@ -55,6 +60,16 @@ public abstract class RealTimeEvent extends SystemEvent { this.equipmentId = equipmentId; } + + @Override + public long getLocationId() { + return locationId; + } + + public void setLocationId(long locationId) { + this.locationId = locationId; + } + @Override public RealTimeEvent clone() { return (RealTimeEvent) super.clone(); @@ -75,7 +90,7 @@ public abstract class RealTimeEvent extends SystemEvent { public int hashCode() { final int prime = 31; int result = super.hashCode(); - result = prime * result + Objects.hash(customerId, equipmentId, eventType); + result = prime * result + Objects.hash(customerId, locationId, equipmentId, eventType); return result; } @@ -88,7 +103,7 @@ public abstract class RealTimeEvent extends SystemEvent { if (getClass() != obj.getClass()) return false; RealTimeEvent other = (RealTimeEvent) obj; - return customerId == other.customerId && equipmentId == other.equipmentId + return customerId == other.customerId && locationId == other.locationId && equipmentId == other.equipmentId && Objects.equals(eventType, other.eventType); } diff --git a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeSipCallEventWithStats.java b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeSipCallEventWithStats.java index 28af9745..97f1b0ce 100644 --- a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeSipCallEventWithStats.java +++ b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeSipCallEventWithStats.java @@ -36,9 +36,9 @@ public abstract class RealTimeSipCallEventWithStats extends RealTimeEvent private List codecs; private String providerDomain; - public RealTimeSipCallEventWithStats(RealTimeEventType eventType, int customerId, long equipmentId, + public RealTimeSipCallEventWithStats(RealTimeEventType eventType, int customerId, long locationId, long equipmentId, Long timestamp) { - super(eventType, customerId, equipmentId, timestamp); + super(eventType, customerId, locationId, equipmentId, timestamp); } public Long getSipCallId() { diff --git a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeSipCallReportEvent.java b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeSipCallReportEvent.java index 99f5bcf7..f4958013 100644 --- a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeSipCallReportEvent.java +++ b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeSipCallReportEvent.java @@ -12,11 +12,11 @@ public class RealTimeSipCallReportEvent extends RealTimeSipCallEventWithStats { private SIPCallReportReason reportReason; public RealTimeSipCallReportEvent(Long timestamp) { - this(0, 0L, timestamp); + this(0, 0L, 0L, timestamp); } - public RealTimeSipCallReportEvent(int customerId, long equipmentId, Long timestamp) { - super(RealTimeEventType.SipCallReport, customerId, equipmentId, timestamp); + public RealTimeSipCallReportEvent(int customerId, long locationId, long equipmentId, Long timestamp) { + super(RealTimeEventType.SipCallReport, customerId, locationId, equipmentId, timestamp); } @Override diff --git a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeSipCallStartEvent.java b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeSipCallStartEvent.java index a5e6d1d8..e899aaa8 100644 --- a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeSipCallStartEvent.java +++ b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeSipCallStartEvent.java @@ -26,12 +26,12 @@ public class RealTimeSipCallStartEvent extends RealTimeEvent private int channel; private RadioType radioType; - public RealTimeSipCallStartEvent(int customerId, long equipmentId, Long timestamp) { - super(RealTimeEventType.SipCallStart, customerId, equipmentId, timestamp); + public RealTimeSipCallStartEvent(int customerId, long locationId, long equipmentId, Long timestamp) { + super(RealTimeEventType.SipCallStart, customerId, locationId, equipmentId, timestamp); } public RealTimeSipCallStartEvent(long timestamp) { - super(RealTimeEventType.SipCallStart, 0, 0, timestamp); + super(RealTimeEventType.SipCallStart, 0, 0, 0, timestamp); } @Override diff --git a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeSipCallStopEvent.java b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeSipCallStopEvent.java index e70c0f3e..1e25dcf9 100644 --- a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeSipCallStopEvent.java +++ b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeSipCallStopEvent.java @@ -16,11 +16,11 @@ public class RealTimeSipCallStopEvent extends RealTimeSipCallEventWithStats { } public RealTimeSipCallStopEvent(long timestamp) { - this(0, 0, timestamp); + this(0, 0, 0, timestamp); } - public RealTimeSipCallStopEvent(int customerId, long equipmentId, Long timestamp) { - super(RealTimeEventType.SipCallStop, customerId, equipmentId, timestamp); + public RealTimeSipCallStopEvent(int customerId, long locationId, long equipmentId, Long timestamp) { + super(RealTimeEventType.SipCallStop, customerId, locationId, equipmentId, timestamp); } public Integer getCallDuration() { diff --git a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeStreamingStartEvent.java b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeStreamingStartEvent.java index d50bdc92..bd156bb2 100644 --- a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeStreamingStartEvent.java +++ b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeStreamingStartEvent.java @@ -28,8 +28,8 @@ public class RealTimeStreamingStartEvent extends RealTimeEvent super(RealTimeEventType.VideoStreamStart, eventTimestamp); } - public RealTimeStreamingStartEvent(int customerId, long equipmentId, long eventTimestamp) { - super(RealTimeEventType.VideoStreamStart, customerId, equipmentId, eventTimestamp); + public RealTimeStreamingStartEvent(int customerId, long locationId, long equipmentId, long eventTimestamp) { + super(RealTimeEventType.VideoStreamStart, customerId, locationId, equipmentId, eventTimestamp); } public String getServerDnsName() { diff --git a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeStreamingStartSessionEvent.java b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeStreamingStartSessionEvent.java index 941ed743..035b301f 100644 --- a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeStreamingStartSessionEvent.java +++ b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeStreamingStartSessionEvent.java @@ -27,8 +27,8 @@ public class RealTimeStreamingStartSessionEvent extends RealTimeEvent super(RealTimeEventType.VideoStreamDebugStart, eventTimestamp); } - public RealTimeStreamingStartSessionEvent(int customerId, long equipmentId, long eventTimestamp) { - super(RealTimeEventType.VideoStreamDebugStart, customerId, equipmentId, eventTimestamp); + public RealTimeStreamingStartSessionEvent(int customerId, long locationId, long equipmentId, long eventTimestamp) { + super(RealTimeEventType.VideoStreamDebugStart, customerId, locationId, equipmentId, eventTimestamp); } public Long getVideoSessionId() { diff --git a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeStreamingStopEvent.java b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeStreamingStopEvent.java index d87dd7db..92662fff 100644 --- a/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeStreamingStopEvent.java +++ b/system-event-models/src/main/java/com/telecominfraproject/wlan/systemevent/equipment/realtime/RealTimeStreamingStopEvent.java @@ -29,8 +29,8 @@ public class RealTimeStreamingStopEvent extends RealTimeEvent super(RealTimeEventType.VideoStreamStop, eventTimestamp); } - public RealTimeStreamingStopEvent(int customerId, long equipmentId, long eventTimestamp) { - super(RealTimeEventType.VideoStreamStop, customerId, equipmentId, eventTimestamp); + public RealTimeStreamingStopEvent(int customerId, long locationId, long equipmentId, long eventTimestamp) { + super(RealTimeEventType.VideoStreamStop, customerId, locationId, equipmentId, eventTimestamp); } public Long getVideoSessionId() {