mirror of
https://github.com/Telecominfraproject/wlan-cloud-services.git
synced 2026-03-20 19:39:19 +00:00
Compare commits
5 Commits
WIFI-7323
...
WIFI-7580-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
98760bbfda | ||
|
|
f64816dbbe | ||
|
|
f87600d283 | ||
|
|
9d19a6c436 | ||
|
|
eb19907513 |
@@ -262,7 +262,7 @@ public class AlarmController {
|
||||
public AlarmCounts getAlarmCounts(@RequestParam int customerId,
|
||||
@RequestParam Set<Long> equipmentIdSet,
|
||||
@RequestParam Set<AlarmCode> alarmCodeSet,
|
||||
@RequestParam Boolean acknowledged) {
|
||||
@RequestParam(required = false) Boolean acknowledged) {
|
||||
|
||||
LOG.debug("Getting Alarm counts for {} {} {} {}", customerId, equipmentIdSet, alarmCodeSet, acknowledged);
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.telecominfraproject.wlan.client.models.events.ClientChangedEvent;
|
||||
import com.telecominfraproject.wlan.client.models.events.ClientRemovedEvent;
|
||||
import com.telecominfraproject.wlan.client.models.events.ClientSessionChangedEvent;
|
||||
import com.telecominfraproject.wlan.client.models.events.ClientSessionRemovedEvent;
|
||||
import com.telecominfraproject.wlan.client.session.models.AssociationState;
|
||||
import com.telecominfraproject.wlan.client.session.models.ClientSession;
|
||||
import com.telecominfraproject.wlan.cloudeventdispatcher.CloudEventDispatcherInterface;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
|
||||
@@ -351,6 +352,8 @@ public class ClientController {
|
||||
throw new DsDataValidationException("Client session contains unsupported value");
|
||||
}
|
||||
|
||||
forceDisconnectOtherClientSessions(clientSession);
|
||||
|
||||
ClientSession ret = clientDatastore.updateSession(clientSession);
|
||||
|
||||
LOG.debug("Updated Client session {}", ret);
|
||||
@@ -384,6 +387,8 @@ public class ClientController {
|
||||
throw new DsDataValidationException("Client session contains unsupported value");
|
||||
}
|
||||
|
||||
clientSessions.forEach(s -> forceDisconnectOtherClientSessions(s));
|
||||
|
||||
ListOfClientSessions ret = new ListOfClientSessions();
|
||||
|
||||
ret.addAll(clientDatastore.updateSessions(clientSessions));
|
||||
@@ -460,5 +465,39 @@ public class ClientController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Force disconnects other client sessions with the same client Mac address.
|
||||
* In an ideal world, this doesn't happen often.
|
||||
* This usually happens when a client is roaming from one AP to another and the AP does not send a
|
||||
* disconnect until much later (5+ minutes timeout on the AP).
|
||||
* Also happens if the AP was disconnected from the cloud from some time and we "missed" the disconnect event.
|
||||
* @param clientSession
|
||||
*/
|
||||
private void forceDisconnectOtherClientSessions(ClientSession clientSession) {
|
||||
if (clientSession.getDetails().getAssociationState() != AssociationState._802_11_Associated) {
|
||||
// updating a session that is not associated should not disconnect other sessions
|
||||
return;
|
||||
}
|
||||
|
||||
List<ClientSession> allSessions = clientDatastore.getSessions(clientSession.getCustomerId(), Set.of(clientSession.getMacAddress()));
|
||||
|
||||
if (allSessions == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (ClientSession cl : allSessions) {
|
||||
if (cl.getEquipmentId() == clientSession.getEquipmentId()) {
|
||||
// Don't disconnect ourselves!
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cl.getDetails().getAssociationState() == AssociationState._802_11_Associated) {
|
||||
// Force disconnect this client session:
|
||||
LOG.info("Forcing a Disconnect of Client session {}", cl);
|
||||
cl.getDetails().setAssociationState(AssociationState.Disconnected);
|
||||
cl.setLastModifiedTimestamp(System.currentTimeMillis());
|
||||
updateSession(cl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ 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.context.annotation.Lazy;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
@@ -32,8 +33,8 @@ public class CloudEventDispatcherController {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(CloudEventDispatcherController.class);
|
||||
|
||||
@Autowired @Qualifier("metricStreamInterface") private StreamInterface<ServiceMetric> metricStream;
|
||||
@Autowired @Qualifier("eventStreamInterface") private StreamInterface<SystemEventRecord> systemEventStream;
|
||||
@Autowired @Qualifier("metricStreamInterface") @Lazy private StreamInterface<ServiceMetric> metricStream;
|
||||
@Autowired @Qualifier("eventStreamInterface") @Lazy private StreamInterface<SystemEventRecord> systemEventStream;
|
||||
@Autowired private ServiceMetricServiceInterface serviceMetricInterface;
|
||||
@Autowired private SystemEventServiceInterface systemEventInterface;
|
||||
|
||||
|
||||
@@ -209,6 +209,7 @@ public class CustomerFirmwareTrackDAO extends BaseJdbcDao {
|
||||
return copy;
|
||||
}
|
||||
|
||||
@Transactional(noRollbackFor = { EmptyResultDataAccessException.class })
|
||||
public CustomerFirmwareTrackRecord getCustomerFirmwareTrackRecord(int customerId) {
|
||||
CustomerFirmwareTrackRecord ret = null;
|
||||
try {
|
||||
|
||||
@@ -57,6 +57,7 @@ public interface FirmwareServiceInterface {
|
||||
CustomerFirmwareTrackRecord updateCustomerFirmwareTrackRecord(CustomerFirmwareTrackRecord record);
|
||||
CustomerFirmwareTrackRecord deleteCustomerFirmwareTrackRecord(int customerId);
|
||||
CustomerFirmwareTrackSettings getDefaultCustomerTrackSetting();
|
||||
CustomerFirmwareTrackSettings updateDefaultCustomerTrackSetting(CustomerFirmwareTrackSettings defaultSettings);
|
||||
|
||||
/**
|
||||
* @param equipmentType
|
||||
|
||||
@@ -81,6 +81,9 @@ public class FirmwareServiceLocal implements FirmwareServiceInterface {
|
||||
public CustomerFirmwareTrackSettings getDefaultCustomerTrackSetting() {
|
||||
return firmwareController.getDefaultCustomerTrackSetting();
|
||||
}
|
||||
public CustomerFirmwareTrackSettings updateDefaultCustomerTrackSetting(CustomerFirmwareTrackSettings defaultSettings) {
|
||||
return firmwareController.updateDefaultCustomerTrackSetting(defaultSettings);
|
||||
}
|
||||
public CustomerFirmwareTrackRecord getCustomerFirmwareTrackRecord(int customerId) {
|
||||
return firmwareController.getCustomerFirmwareTrackRecord(customerId);
|
||||
}
|
||||
|
||||
@@ -387,6 +387,21 @@ public class FirmwareServiceRemote extends BaseRemoteClient implements FirmwareS
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CustomerFirmwareTrackSettings updateDefaultCustomerTrackSetting(CustomerFirmwareTrackSettings defaultSettings) {
|
||||
LOG.debug("calling updateDefaultCustomerTrackSetting {} ", defaultSettings);
|
||||
|
||||
ResponseEntity<CustomerFirmwareTrackSettings> responseEntity = restTemplate.exchange(
|
||||
getBaseUrl()
|
||||
+"/customerTrack/default", HttpMethod.PUT, null,
|
||||
CustomerFirmwareTrackSettings.class, defaultSettings);
|
||||
|
||||
CustomerFirmwareTrackSettings ret = responseEntity.getBody();
|
||||
|
||||
LOG.debug("completed updateDefaultCustomerTrackSetting {} ", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,8 +2,6 @@ package com.telecominfraproject.wlan.firmware.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -22,11 +20,11 @@ import com.telecominfraproject.wlan.datastore.exceptions.DsEntityNotFoundExcepti
|
||||
import com.telecominfraproject.wlan.firmware.datastore.FirmwareDatastore;
|
||||
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackRecord;
|
||||
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackSettings;
|
||||
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackSettings.TrackFlag;
|
||||
import com.telecominfraproject.wlan.firmware.models.FirmwareTrackAssignmentDetails;
|
||||
import com.telecominfraproject.wlan.firmware.models.FirmwareTrackAssignmentRecord;
|
||||
import com.telecominfraproject.wlan.firmware.models.FirmwareTrackRecord;
|
||||
import com.telecominfraproject.wlan.firmware.models.FirmwareVersion;
|
||||
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackSettings.TrackFlag;
|
||||
import com.telecominfraproject.wlan.systemevent.models.SystemEvent;
|
||||
|
||||
|
||||
@@ -44,35 +42,11 @@ public class FirmwareController {
|
||||
@Autowired private FirmwareDatastore firmwareDatastore;
|
||||
@Autowired private CloudEventDispatcherInterface cloudEventDispatcher;
|
||||
@Autowired Environment environment;
|
||||
|
||||
CustomerFirmwareTrackSettings defaultCustomerTrackSettings;
|
||||
|
||||
@PostConstruct
|
||||
private void postConstruct() {
|
||||
defaultCustomerTrackSettings = new CustomerFirmwareTrackSettings();
|
||||
defaultCustomerTrackSettings.setAutoUpgradeDeprecatedOnBind(environment
|
||||
.getProperty("whizcontrol.autoupgrade.deprecated", TrackFlag.class, TrackFlag.NEVER));
|
||||
defaultCustomerTrackSettings.setAutoUpgradeUnknownOnBind(environment
|
||||
.getProperty("whizcontrol.autoupgrade.unknown", TrackFlag.class, TrackFlag.NEVER));
|
||||
defaultCustomerTrackSettings.setAutoUpgradeDeprecatedDuringMaintenance(environment.getProperty(
|
||||
"whizcontrol.maintenanceupgrade.deprecated", TrackFlag.class, TrackFlag.NEVER));
|
||||
defaultCustomerTrackSettings.setAutoUpgradeUnknownDuringMaintenance(environment
|
||||
.getProperty("whizcontrol.maintenanceupgrade.unknown", TrackFlag.class, TrackFlag.NEVER));
|
||||
LOG.info("Default CustomerFirmwareTrackSettings: {}", defaultCustomerTrackSettings);
|
||||
}
|
||||
|
||||
private void publishEvent(SystemEvent event) {
|
||||
if (event == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
cloudEventDispatcher.publishEvent(event);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Failed to publish event : {}", event, e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FirmwareVersion API
|
||||
*/
|
||||
@RequestMapping(value = "/version", method = RequestMethod.POST)
|
||||
public FirmwareVersion createFirmwareVersion(@RequestBody FirmwareVersion firmwareVersion) {
|
||||
|
||||
@@ -149,6 +123,10 @@ public class FirmwareController {
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* FirmwareTrackRecord API
|
||||
*/
|
||||
@RequestMapping(value = "/track", method = RequestMethod.POST)
|
||||
public FirmwareTrackRecord createFirmwareTrack(@RequestBody FirmwareTrackRecord firmwareTrack) {
|
||||
LOG.debug("calling createFirmwareTrack({})", firmwareTrack);
|
||||
@@ -193,7 +171,10 @@ public class FirmwareController {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* FirmwareTrackAssignmentDetails API
|
||||
*/
|
||||
@RequestMapping(value = "/trackAssignment", method = RequestMethod.GET)
|
||||
public List<FirmwareTrackAssignmentDetails> getFirmwareTrackAssignments (
|
||||
@RequestParam String firmwareTrackName) {
|
||||
@@ -220,33 +201,50 @@ public class FirmwareController {
|
||||
FirmwareTrackAssignmentDetails result = new FirmwareTrackAssignmentDetails(assignment, version);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* CustomerFirmwareTrackSettings API
|
||||
*/
|
||||
@RequestMapping(value = "/customerTrack/default", method = RequestMethod.GET)
|
||||
public CustomerFirmwareTrackSettings getDefaultCustomerTrackSetting() {
|
||||
if (defaultCustomerTrackSettings == null) {
|
||||
if (defaultCustomerTrackSettings == null) {
|
||||
defaultCustomerTrackSettings = new CustomerFirmwareTrackSettings();
|
||||
defaultCustomerTrackSettings.setAutoUpgradeDeprecatedOnBind(environment
|
||||
.getProperty("whizcontrol.autoupgrade.deprecated", TrackFlag.class, TrackFlag.NEVER));
|
||||
defaultCustomerTrackSettings.setAutoUpgradeUnknownOnBind(environment
|
||||
.getProperty("whizcontrol.autoupgrade.unknown", TrackFlag.class, TrackFlag.NEVER));
|
||||
defaultCustomerTrackSettings.setAutoUpgradeDeprecatedDuringMaintenance(environment.getProperty(
|
||||
"whizcontrol.maintenanceupgrade.deprecated", TrackFlag.class, TrackFlag.NEVER));
|
||||
defaultCustomerTrackSettings.setAutoUpgradeUnknownDuringMaintenance(environment
|
||||
.getProperty("whizcontrol.maintenanceupgrade.unknown", TrackFlag.class, TrackFlag.NEVER));
|
||||
LOG.info("Default CustomerFirmwareTrackSettings: {}", defaultCustomerTrackSettings);
|
||||
}
|
||||
CustomerFirmwareTrackRecord defaultRecord = firmwareDatastore.getCustomerFirmwareTrackRecord(0);
|
||||
if (defaultRecord == null) {
|
||||
LOG.debug("No default record exists, creating the default");
|
||||
defaultRecord = new CustomerFirmwareTrackRecord();
|
||||
defaultRecord.setCustomerId(0);
|
||||
CustomerFirmwareTrackSettings defaultSettings = new CustomerFirmwareTrackSettings();
|
||||
defaultSettings.setAutoUpgradeDeprecatedOnBind(TrackFlag.NEVER);
|
||||
defaultSettings.setAutoUpgradeUnknownOnBind(TrackFlag.NEVER);
|
||||
defaultSettings.setAutoUpgradeDeprecatedDuringMaintenance(TrackFlag.NEVER);
|
||||
defaultSettings.setAutoUpgradeUnknownDuringMaintenance(TrackFlag.NEVER);
|
||||
|
||||
defaultRecord.setSettings(defaultSettings);
|
||||
defaultRecord.setTrackRecordId(firmwareDatastore.getFirmwareTrackByName("DEFAULT").getRecordId());
|
||||
defaultRecord = firmwareDatastore.createCustomerFirmwareTrackRecord(defaultRecord);
|
||||
}
|
||||
return defaultCustomerTrackSettings;
|
||||
return defaultRecord.getSettings();
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/customerTrack/default", method = RequestMethod.PUT)
|
||||
public CustomerFirmwareTrackSettings updateDefaultCustomerTrackSetting(@RequestBody CustomerFirmwareTrackSettings customerTrackSettings) {
|
||||
CustomerFirmwareTrackRecord defaultRecord = firmwareDatastore.getCustomerFirmwareTrackRecord(0);
|
||||
if (defaultRecord == null) {
|
||||
defaultRecord = new CustomerFirmwareTrackRecord();
|
||||
defaultRecord.setCustomerId(0);
|
||||
defaultRecord.setSettings(customerTrackSettings);
|
||||
defaultRecord.setTrackRecordId(firmwareDatastore.getFirmwareTrackByName("DEFAULT").getRecordId());
|
||||
return firmwareDatastore.createCustomerFirmwareTrackRecord(defaultRecord).getSettings();
|
||||
}
|
||||
defaultRecord.setSettings(customerTrackSettings);
|
||||
return firmwareDatastore.updateCustomerFirmwareTrackRecord(defaultRecord).getSettings();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/customerTrack", method = RequestMethod.GET)
|
||||
public CustomerFirmwareTrackRecord getCustomerFirmwareTrackRecord(@RequestParam int customerId) {
|
||||
LOG.debug("calling getCustomerFirmwareTrackRecord({})", customerId);
|
||||
return firmwareDatastore.getCustomerFirmwareTrackRecord(customerId);
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/customerTrack", method = RequestMethod.POST)
|
||||
public CustomerFirmwareTrackRecord createCustomerFirmwareTrackRecord(@RequestBody CustomerFirmwareTrackRecord customerTrack) {
|
||||
@@ -255,7 +253,6 @@ public class FirmwareController {
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/customerTrack", method = RequestMethod.PUT)
|
||||
public CustomerFirmwareTrackRecord updateCustomerFirmwareTrackRecord(@RequestBody CustomerFirmwareTrackRecord customerTrack) {
|
||||
LOG.debug("calling updateCustomerFirmwareTrackRecord({})", customerTrack);
|
||||
@@ -270,8 +267,6 @@ public class FirmwareController {
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "/customerTrack", method = RequestMethod.DELETE)
|
||||
public CustomerFirmwareTrackRecord deleteCustomerFirmwareTrackRecord(@RequestParam int customerId) {
|
||||
@@ -279,6 +274,17 @@ public class FirmwareController {
|
||||
CustomerFirmwareTrackRecord result = firmwareDatastore.deleteCustomerFirmwareTrackRecord(customerId);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private void publishEvent(SystemEvent event) {
|
||||
if (event == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
cloudEventDispatcher.publishEvent(event);
|
||||
} catch (Exception e) {
|
||||
LOG.error("Failed to publish event : {}", event, e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -619,11 +619,12 @@ paths:
|
||||
$ref: '#/components/schemas/FirmwareTrackAssignmentDetails'
|
||||
500:
|
||||
$ref: '#/components/responses/GenericApiError'
|
||||
|
||||
/api/firmware/customerTrack/default:
|
||||
get:
|
||||
tags:
|
||||
- Firmware Data
|
||||
summary: Get customer firmware track settings
|
||||
summary: Get customer firmware track settings, if it doesn't exist, create it
|
||||
operationId: getCustomerFirmwareTrackSettings
|
||||
responses:
|
||||
200:
|
||||
@@ -634,6 +635,27 @@ paths:
|
||||
$ref: '#/components/schemas/CustomerFirmwareTrackSettings'
|
||||
500:
|
||||
$ref: '#/components/responses/GenericApiError'
|
||||
put:
|
||||
tags:
|
||||
- Firmware Data
|
||||
summary: Update customer firmware track settings, if it doesn't exist, create it
|
||||
operationId: updateCustomerFirmwareTrackSettings
|
||||
requestBody:
|
||||
description: CustomerFirmwareTrackSettings
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CustomerFirmwareTrackSettings'
|
||||
responses:
|
||||
200:
|
||||
description: Successful operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CustomerFirmwareTrackSettings'
|
||||
500:
|
||||
$ref: '#/components/responses/GenericApiError'
|
||||
|
||||
/api/firmware/customerTrack:
|
||||
post:
|
||||
|
||||
@@ -173,6 +173,11 @@ public class FirmwarePortalController {
|
||||
return firmwareServiceInterface.getDefaultCustomerTrackSetting();
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/customerTrack/default", method = RequestMethod.PUT)
|
||||
public CustomerFirmwareTrackSettings updateDefaultCustomerTrackSetting(@RequestBody CustomerFirmwareTrackSettings defaultSettings) {
|
||||
LOG.debug("calling updateDefaultCustomerTrackSetting({})", defaultSettings);
|
||||
return firmwareServiceInterface.updateDefaultCustomerTrackSetting(defaultSettings);
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/customerTrack", method = RequestMethod.GET)
|
||||
public CustomerFirmwareTrackRecord getCustomerFirmwareTrackRecord(@RequestParam int customerId) {
|
||||
|
||||
@@ -10371,7 +10371,7 @@ paths:
|
||||
get:
|
||||
tags:
|
||||
- Firmware Management
|
||||
summary: Get default settings for handling automatic firmware upgrades
|
||||
summary: Get default settings for handling automatic firmware upgrades, if it doesn't exist, create it
|
||||
operationId: getDefaultCustomerTrackSetting
|
||||
responses:
|
||||
200:
|
||||
@@ -10382,6 +10382,27 @@ paths:
|
||||
$ref: '#/components/schemas/CustomerFirmwareTrackSettings'
|
||||
500:
|
||||
$ref: '#/components/responses/GenericApiError'
|
||||
put:
|
||||
tags:
|
||||
- Firmware Management
|
||||
summary: Update default settings for handling automatic firmware upgrades, if it doesn't exist, create it
|
||||
operationId: updateDefaultCustomerTrackSetting
|
||||
requestBody:
|
||||
description: CustomerFirmwareTrackSettings
|
||||
required: true
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CustomerFirmwareTrackSettings'
|
||||
responses:
|
||||
200:
|
||||
description: successful operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: '#/components/schemas/CustomerFirmwareTrackSettings'
|
||||
500:
|
||||
$ref: '#/components/responses/GenericApiError'
|
||||
|
||||
/portal/firmware/customerTrack:
|
||||
post:
|
||||
|
||||
@@ -167,6 +167,7 @@ public class EquipmentConfigPushTrigger extends StreamProcessor {
|
||||
private void process(EquipmentRemovedEvent model) {
|
||||
LOG.debug("Processing EquipmentRemovedEvent");
|
||||
equipmentGatewayInterface.sendCommand(new CEGWCloseSessionRequest(model.getPayload().getInventoryId(), model.getEquipmentId()));
|
||||
cleanUpClientSessions(model.getPayload());
|
||||
}
|
||||
|
||||
private void process(ProfileAddedEvent model) {
|
||||
@@ -294,6 +295,21 @@ public class EquipmentConfigPushTrigger extends StreamProcessor {
|
||||
} else {
|
||||
LOG.info("There are no existing client sessions that are not already in Disconnected state.");
|
||||
}
|
||||
}
|
||||
|
||||
private void cleanUpClientSessions(Equipment ce) {
|
||||
LOG.info("EquipmentConfigPushTrigger::cleanUpClientSessions for Equipment {}", ce);
|
||||
PaginationResponse<ClientSession> clientSessions = clientServiceInterface.getSessionsForCustomer(
|
||||
ce.getCustomerId(), Set.of(ce.getId()), Set.of(ce.getLocationId()), null, null,
|
||||
new PaginationContext<ClientSession>(100));
|
||||
|
||||
if (clientSessions.getItems().isEmpty() || clientSessions == null) {
|
||||
LOG.info("There are no existing client sessions to clean up.");
|
||||
return;
|
||||
}
|
||||
|
||||
clientSessions.getItems().stream().forEach(c -> clientServiceInterface.deleteSession(c.getCustomerId(), c.getEquipmentId(), c.getMacAddress()));
|
||||
|
||||
LOG.info("Cleaned up client sessions for deleted Equipment {}", ce.getId());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,11 @@ public class StatusDataType implements EnumWithId {
|
||||
/**
|
||||
* Protocol status
|
||||
*/
|
||||
PROTOCOL = new StatusDataType(4, "PROTOCOL", Set.of(StatusTrait.DeleteOnEquipmentDisconnect)) ,
|
||||
PROTOCOL = new StatusDataType(4, "PROTOCOL"
|
||||
// some of the properties of this status need to be preserved across equipment connections
|
||||
// example - reportedCfgDataVersion
|
||||
//, Set.of(StatusTrait.DeleteOnEquipmentDisconnect)
|
||||
) ,
|
||||
/**
|
||||
* Firmware upgrade status
|
||||
*/
|
||||
|
||||
@@ -257,7 +257,6 @@ public class SystemEventDatastoreInMemory extends BaseInMemoryDatastore implemen
|
||||
if (mdl.getEventTimestamp() > eqptStats.getLastEventTime()) {
|
||||
eqptStats.setLastEventTime(mdl.getEventTimestamp());
|
||||
}
|
||||
items.add(mdl);
|
||||
}
|
||||
|
||||
List<EquipmentEventStats> equipmentStats = new ArrayList<>();
|
||||
|
||||
Reference in New Issue
Block a user