Compare commits

...

21 Commits

Author SHA1 Message Date
Thomas-Leung2021
90ac57b988 [WIFI-3041] move if statement to make it more logical 2021-07-19 17:52:49 -04:00
Thomas-Leung2021
0cc90764c6 [WIFI-3041] move if statusment for custmerId check to a different location 2021-07-19 17:00:54 -04:00
Thomas-Leung2021
3d2f4db32a [WIFI-3041] remove unnecessary dependencies 2021-07-16 12:22:23 -04:00
Thomas-Leung2021
c75d44ff03 [WIFI-3041] create a new EquipmentCustomerChangedEvent to handle status and alarm migration 2021-07-16 10:44:23 -04:00
Thomas-Leung2021
799b243cc4 [WIFI-3041] move alarms to new customerId if customerId changed 2021-07-15 16:45:07 -04:00
Mike Hansen
8834c33d90 Merge pull request #129 from Telecominfraproject/WIFI-3042-alarms-by-alarmcode
[WIFI-3042] Add Alarm endpoint for get alarms by AlarmCode
2021-07-15 09:26:20 -04:00
Norm Traxler
e9c54a892b [WIFI-3042] Add Alarm endpoint for get alarms by AlarmCode 2021-07-14 20:18:22 -04:00
Mike Hansen
8353dd375f Control LED off via Equipment AP profile
Signed-off-by: Mike Hansen <mike.hansen@connectus.ai>
2021-07-14 18:45:33 -04:00
Mike Hansen
46de84b28b Add NULL check in EquipmentController
Signed-off-by: Mike Hansen <mike.hansen@connectus.ai>
2021-07-14 18:00:10 -04:00
Mike Hansen
9edca1fd9d CloudBackend:
Control LED off via Equipment AP profile

Signed-off-by: Mike Hansen <mike.hansen@connectus.ai>
2021-07-14 17:30:06 -04:00
Mike Hansen
5714c9bf32 CloudBackend:
Control LED off via Equipment AP profile and Show LED status in EQUIPMENT_ADMIN status

Signed-off-by: Mike Hansen <mike.hansen@connectus.ai>
2021-07-14 16:03:39 -04:00
Mike Hansen
2b2e34a064 Merge pull request #128 from Telecominfraproject/WIFI-2987
[WIFI-2987] add protocol status when switching customer
2021-07-13 14:09:02 -04:00
Thomas-Leung2021
d7a75faf4c check when status is null 2021-07-13 12:10:04 -04:00
Thomas-Leung2021
5fd977f064 [WIFI-2987] add protocol status when switching customer 2021-07-12 14:47:36 -04:00
Mike Hansen
bafec1fdd8 Merge pull request #127 from Telecominfraproject/hotfix/wifi-2970
[WIFI-2970] add equipment admin status when switching customer
2021-07-09 10:52:49 -04:00
Thomas-Leung2021
6b046e0a7a [WIFI-2970] remove unnecessary comments 2021-07-09 10:48:40 -04:00
Thomas-Leung2021
fb6604cdf5 add required dependencies in tests for new changes in EquipmentController 2021-07-08 17:48:20 -04:00
Thomas-Leung2021
2c1c60344e add equipment admin status when switching customer 2021-07-08 17:47:26 -04:00
Mike Hansen
9e959e258f Merge pull request #126 from Telecominfraproject/WIFI-2932-Client-ip-event
[WIFI-2932] Change IP event ipAddress from byte[] to InetAddress
2021-07-06 10:21:04 -04:00
Norm Traxler
2410233046 [WIFI-2932] Change IP event ipAddress from byte[] to InetAddress 2021-07-05 17:58:01 -04:00
norm-traxler
a7f91a29f8 Merge pull request #125 from Telecominfraproject/updateAPI
Update APIs to reflect new map in EquipmentChannelStatusData
2021-06-28 16:23:39 -04:00
30 changed files with 849 additions and 533 deletions

View File

@@ -121,6 +121,10 @@ public class AlarmDatastoreCassandra implements AlarmDatastore {
" from " + TABLE_NAME + " " + " from " + TABLE_NAME + " " +
" where customerId = ? "; " where customerId = ? ";
private static final String CQL_GET_ALL =
"select " + ALL_COLUMNS +
" from " + TABLE_NAME + " ";
private static final String CQL_GET_LASTMOD_BY_ID = private static final String CQL_GET_LASTMOD_BY_ID =
"select lastModifiedTimestamp " + "select lastModifiedTimestamp " +
" from "+TABLE_NAME+" " + " from "+TABLE_NAME+" " +
@@ -922,4 +926,51 @@ public class AlarmDatastoreCassandra implements AlarmDatastore {
return alarmCounts; return alarmCounts;
} }
@Override
public List<Alarm> get(Set<AlarmCode> alarmCodes, long createdAfterTimestamp) {
if (alarmCodes == null || alarmCodes.isEmpty()) {
throw new IllegalArgumentException("alarmCodes must be provided");
}
LOG.debug("Looking up Alarms for alarmCodes {} createdAfter {}", alarmCodes, createdAfterTimestamp);
String query = CQL_GET_ALL;
// add filters for the query
ArrayList<Object> queryArgs = new ArrayList<>();
// add alarmCodes filters
alarmCodes.forEach(ac -> queryArgs.add(ac.getId()));
StringBuilder strb = new StringBuilder(100);
strb.append("where alarmCode in (");
for (int i = 0; i < alarmCodes.size(); i++) {
strb.append("?");
if (i < alarmCodes.size() - 1) {
strb.append(",");
}
}
strb.append(") ");
if (createdAfterTimestamp > 0) {
strb.append(" and createdTimestamp > ?");
queryArgs.add(createdAfterTimestamp);
}
strb.append(" allow filtering");
query += strb.toString();
List<Alarm> ret = new ArrayList<>();
PreparedStatement preparedStmt_getListForCustomer = cqlSession.prepare(query);
ResultSet rs = cqlSession.execute(preparedStmt_getListForCustomer.bind(queryArgs.toArray()));
rs.forEach(row -> ret.add(alarmRowMapper.mapRow(row)));
LOG.debug("Found {} Alarms for alarmCodes {} createdAfter {}", ret.size(), alarmCodes, createdAfterTimestamp);
return ret;
}
} }

View File

@@ -356,4 +356,25 @@ public class AlarmDatastoreInMemory extends BaseInMemoryDatastore implements Ala
return alarmCounts; return alarmCounts;
} }
@Override
public List<Alarm> get(Set<AlarmCode> alarmCodeSet, long createdAfterTimestamp) {
if (alarmCodeSet == null || alarmCodeSet.isEmpty()) {
throw new IllegalArgumentException("alarmCodeSet must be provided");
}
List<Alarm> ret = new ArrayList<>();
idToAlarmMap.values().forEach(a -> {
if (alarmCodeSet.contains(a.getAlarmCode()) && a.getCreatedTimestamp() > createdAfterTimestamp) {
ret.add(a.clone());
}
});
LOG.debug("Found Alarms {}", ret);
return ret;
}
} }

View File

@@ -71,4 +71,14 @@ public interface AlarmDatastore {
*/ */
AlarmCounts getAlarmCounts(int customerId, Set<Long> equipmentIdSet, Set<AlarmCode> alarmCodeSet, Boolean acknowledged); AlarmCounts getAlarmCounts(int customerId, Set<Long> equipmentIdSet, Set<AlarmCode> alarmCodeSet, Boolean acknowledged);
/**
* Retrieves a list of Alarms for the given alarm codes.
*
* @param alarmCodeSet - null or empty means include all alarm codes
* @param createdAfterTimestamp
* @return list of matching Alarm objects.
* @throws IllegalArgumentException if supplied alarmCodeSet is null or empty
*/
List<Alarm> get(Set<AlarmCode> alarmCodeSet, long createdAfterTimestamp);
} }

View File

@@ -114,4 +114,15 @@ public interface AlarmServiceInterface {
*/ */
AlarmCounts getAlarmCounts(int customerId, Set<Long> equipmentIdSet, Set<AlarmCode> alarmCodeSet, Boolean acknowledged); AlarmCounts getAlarmCounts(int customerId, Set<Long> equipmentIdSet, Set<AlarmCode> alarmCodeSet, Boolean acknowledged);
/**
* Retrieves a list of Alarms for the given alarm codes.
*
* @param alarmCodeSet - null or empty means include all alarm codes
* @param createdAfterTimestamp
* @return list of matching Alarm objects.
* @throws IllegalArgumentException if supplied alarmCodeSet is null or empty
*/
List<Alarm> get(Set<AlarmCode> alarmCodeSet, long createdAfterTimestamp);
} }

View File

@@ -47,6 +47,10 @@ public class AlarmServiceLocal implements AlarmServiceInterface {
return alarmController.getAllForEquipment(customerId, equipmentIdSet, alarmCodeSet, createdAfterTimestamp); return alarmController.getAllForEquipment(customerId, equipmentIdSet, alarmCodeSet, createdAfterTimestamp);
} }
@Override
public List<Alarm> get(Set<AlarmCode> alarmCodeSet, long createdAfterTimestamp) {
return alarmController.getAllForAlarmCode(alarmCodeSet, createdAfterTimestamp);
}
@Override @Override
public Alarm update(Alarm alarm) { public Alarm update(Alarm alarm) {

View File

@@ -64,6 +64,5 @@
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@@ -242,13 +242,44 @@ public class AlarmServiceRemote extends BaseRemoteClient implements AlarmService
return ret; return ret;
} }
@Override
public List<Alarm> get(Set<AlarmCode> alarmCodeSet, long createdAfterTimestamp) {
LOG.debug("get({},{})", alarmCodeSet, createdAfterTimestamp);
if (alarmCodeSet == null || alarmCodeSet.isEmpty()) {
throw new IllegalArgumentException("alarmCodeSet must be provided");
}
String alarmCodeSetStr = alarmCodeSet.toString();
// remove [] around the string, otherwise will get:
// Failed to convert value of type 'java.lang.String' to required
// type 'java.util.Set'; nested exception is
// java.lang.NumberFormatException: For input string: "[690]"
alarmCodeSetStr = alarmCodeSetStr.substring(1, alarmCodeSetStr.length() - 1);
try {
ResponseEntity<List<Alarm>> responseEntity =
restTemplate.exchange(getBaseUrl() + "/forAlarmCode?alarmCodeSet={alarmCodeSetStr}&createdAfterTimestamp={createdAfterTimestamp}",
HttpMethod.GET, null, Alarm_LIST_CLASS_TOKEN, alarmCodeSetStr, createdAfterTimestamp);
List<Alarm> result = responseEntity.getBody();
if (null == result) {
result = Collections.emptyList();
}
LOG.debug("get({},{}) return {} entries", alarmCodeSet, createdAfterTimestamp, result.size());
return result;
} catch (Exception exp) {
LOG.error("getAllInSet({},{}) exception ", alarmCodeSet, createdAfterTimestamp, exp);
throw exp;
}
}
public String getBaseUrl() { public String getBaseUrl() {
if(baseUrl==null) { if(baseUrl==null) {
baseUrl = environment.getProperty("tip.wlan.alarmServiceBaseUrl").trim()+"/api/alarm"; baseUrl = environment.getProperty("tip.wlan.alarmServiceBaseUrl").trim()+"/api/alarm";
} }
return baseUrl; return baseUrl;
} }
} }

View File

@@ -1,70 +1,70 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0"
<modelVersion>4.0.0</modelVersion> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<parent> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>com.telecominfraproject.wlan</groupId> <modelVersion>4.0.0</modelVersion>
<artifactId>tip-wlan-cloud-root-pom</artifactId> <parent>
<version>1.2.0-SNAPSHOT</version> <groupId>com.telecominfraproject.wlan</groupId>
<relativePath>../../wlan-cloud-root</relativePath> <artifactId>tip-wlan-cloud-root-pom</artifactId>
</parent> <version>1.2.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>alarm-service</artifactId> <artifactId>alarm-service</artifactId>
<name>alarm-service</name> <name>alarm-service</name>
<description>Server side implementation of the service.</description> <description>Server side implementation of the service.</description>
<dependencies> <dependencies>
<dependency> <dependency>
<artifactId>base-container</artifactId> <artifactId>base-container</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>cloud-event-dispatcher-interface</artifactId> <artifactId>cloud-event-dispatcher-interface</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>alarm-models</artifactId> <artifactId>alarm-models</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>alarm-datastore-interface</artifactId> <artifactId>alarm-datastore-interface</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>equipment-service-interface</artifactId> <artifactId>equipment-service-interface</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>alarm-datastore-inmemory</artifactId> <artifactId>alarm-datastore-inmemory</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>equipment-service-local</artifactId> <artifactId>equipment-service-local</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>equipment-datastore-inmemory</artifactId> <artifactId>equipment-datastore-inmemory</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency>
<dependency> <artifactId>cloud-event-dispatcher-empty</artifactId>
<artifactId>cloud-event-dispatcher-empty</artifactId> <groupId>com.telecominfraproject.wlan</groupId>
<groupId>com.telecominfraproject.wlan</groupId> <version>1.2.0-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version> <scope>test</scope>
<scope>test</scope> </dependency>
</dependency> </dependencies>
</dependencies>
</project> </project>

View File

@@ -130,6 +130,24 @@ public class AlarmController {
} }
} }
@RequestMapping(value = "/forAlarmCode", method = RequestMethod.GET)
public ListOfAlarms getAllForAlarmCode(
@RequestParam Set<AlarmCode> alarmCode,
@RequestParam long createdAfterTimestamp) {
LOG.debug("getAllForAlarmCode({}, {})", alarmCode, createdAfterTimestamp);
try {
List<Alarm> result = alarmDatastore.get(alarmCode, createdAfterTimestamp);
LOG.debug("getAllForAlarmCode({},{}) return {} entries", alarmCode, createdAfterTimestamp, result.size());
ListOfAlarms ret = new ListOfAlarms();
ret.addAll(result);
return ret;
} catch (Exception exp) {
LOG.error("getAllForAlarmCode({},{}) exception ", alarmCode, createdAfterTimestamp, exp);
throw exp;
}
}
@RequestMapping(value = "/forCustomer", method = RequestMethod.GET) @RequestMapping(value = "/forCustomer", method = RequestMethod.GET)
public PaginationResponse<Alarm> getForCustomer(@RequestParam int customerId, public PaginationResponse<Alarm> getForCustomer(@RequestParam int customerId,
@RequestParam(required = false) Set<Long> equipmentIdSet, @RequestParam(required = false) Set<Long> equipmentIdSet,

View File

@@ -1,6 +1,6 @@
package com.telecominfraproject.wlan.client.models.events.realtime; package com.telecominfraproject.wlan.client.models.events.realtime;
import java.util.Arrays; import java.net.InetAddress;
import java.util.Objects; import java.util.Objects;
import com.telecominfraproject.wlan.core.model.equipment.MacAddress; import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
@@ -14,7 +14,7 @@ public class ClientIpAddressEvent extends RealTimeEvent implements HasClientMac
private long sessionId; private long sessionId;
private MacAddress clientMacAddress; private MacAddress clientMacAddress;
private byte[] ipAddr; private InetAddress ipAddr;
public ClientIpAddressEvent() { public ClientIpAddressEvent() {
// serialization // serialization
@@ -45,11 +45,11 @@ public class ClientIpAddressEvent extends RealTimeEvent implements HasClientMac
this.clientMacAddress = clientMacAddress; this.clientMacAddress = clientMacAddress;
} }
public byte[] getIpAddr() { public InetAddress getIpAddr() {
return ipAddr; return ipAddr;
} }
public void setIpAddr(byte[] ipAddr) { public void setIpAddr(InetAddress ipAddr) {
this.ipAddr = ipAddr; this.ipAddr = ipAddr;
} }
@@ -57,8 +57,7 @@ public class ClientIpAddressEvent extends RealTimeEvent implements HasClientMac
public int hashCode() { public int hashCode() {
final int prime = 31; final int prime = 31;
int result = super.hashCode(); int result = super.hashCode();
result = prime * result + Arrays.hashCode(this.ipAddr); result = prime * result + Objects.hash(ipAddr, clientMacAddress, sessionId);
result = prime * result + Objects.hash(clientMacAddress, sessionId);
return result; return result;
} }
@@ -74,7 +73,7 @@ public class ClientIpAddressEvent extends RealTimeEvent implements HasClientMac
return false; return false;
} }
ClientIpAddressEvent other = (ClientIpAddressEvent) obj; ClientIpAddressEvent other = (ClientIpAddressEvent) obj;
return Objects.equals(clientMacAddress, other.clientMacAddress) && Arrays.equals(ipAddr, other.ipAddr) return Objects.equals(clientMacAddress, other.clientMacAddress) && Objects.equals(ipAddr, other.ipAddr)
&& this.sessionId == other.sessionId; && this.sessionId == other.sessionId;
} }

View File

@@ -60,7 +60,6 @@
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>base-stream-interface</artifactId> <artifactId>base-stream-interface</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>

View File

@@ -3464,6 +3464,15 @@ components:
$ref: '#/components/schemas/StatusCode' $ref: '#/components/schemas/StatusCode'
statusMessage: statusMessage:
type: string type: string
ledStatus:
$ref: '#/components/schemas/LedStatus'
LedStatus:
type: string
enum:
- led_blink
- led_off
- UNKNOWN
StatusCode: StatusCode:
type: string type: string
@@ -4509,6 +4518,8 @@ components:
type: boolean type: boolean
forwardMode: forwardMode:
$ref: '#/components/schemas/NetworkForwardMode' $ref: '#/components/schemas/NetworkForwardMode'
blinkAllLEDs:
type: boolean
radioMap: radioMap:
$ref: '#/components/schemas/RadioMap' $ref: '#/components/schemas/RadioMap'
advancedRadioMap: advancedRadioMap:

View File

@@ -37,6 +37,7 @@ public abstract class CommonElementConfiguration extends EquipmentDetails implem
private AntennaType antennaType; private AntennaType antennaType;
private Boolean costSavingEventsEnabled; private Boolean costSavingEventsEnabled;
private NetworkForwardMode forwardMode; private NetworkForwardMode forwardMode;
private boolean blinkAllLEDs;
/** /**
* this constructor is used for CAMI only * this constructor is used for CAMI only
@@ -68,38 +69,34 @@ public abstract class CommonElementConfiguration extends EquipmentDetails implem
} }
@Override
public int hashCode() {
final int prime = 31;
int result = super.hashCode();
result = prime * result + Objects.hash(antennaType, blinkAllLEDs, costSavingEventsEnabled, deploymentType, deviceMode, deviceName, elementConfigVersion,
equipmentType, forwardMode, frameReportThrottleEnabled, gettingDNS, gettingIP, locallyConfigured, locallyConfiguredMgmtVlan, locationData,
peerInfoList, staticDnsIp1, staticDnsIp2, staticIP, staticIpGw, staticIpMaskCidr, syntheticClientEnabled);
return result;
}
@Override @Override
public boolean equals(Object obj) { public boolean equals(Object obj) {
if (this == obj) { if (this == obj)
return true; return true;
} if (!super.equals(obj))
if (obj == null) {
return false; return false;
} if (getClass() != obj.getClass())
if (!super.equals(obj)) {
return false; return false;
}
if (!(obj instanceof CommonElementConfiguration)) {
return false;
}
CommonElementConfiguration other = (CommonElementConfiguration) obj; CommonElementConfiguration other = (CommonElementConfiguration) obj;
return this.antennaType == other.antennaType return antennaType == other.antennaType && blinkAllLEDs == other.blinkAllLEDs && Objects.equals(costSavingEventsEnabled, other.costSavingEventsEnabled)
&& Objects.equals(costSavingEventsEnabled, other.costSavingEventsEnabled) && deploymentType == other.deploymentType && deviceMode == other.deviceMode && Objects.equals(deviceName, other.deviceName)
&& this.deploymentType == other.deploymentType && this.deviceMode == other.deviceMode && Objects.equals(elementConfigVersion, other.elementConfigVersion) && Objects.equals(equipmentType, other.equipmentType)
&& Objects.equals(deviceName, other.deviceName) && forwardMode == other.forwardMode && Objects.equals(frameReportThrottleEnabled, other.frameReportThrottleEnabled)
&& Objects.equals(elementConfigVersion, other.elementConfigVersion) && gettingDNS == other.gettingDNS && gettingIP == other.gettingIP && locallyConfigured == other.locallyConfigured
&& this.equipmentType == other.equipmentType && this.forwardMode == other.forwardMode && locallyConfiguredMgmtVlan == other.locallyConfiguredMgmtVlan && Objects.equals(locationData, other.locationData)
&& Objects.equals(frameReportThrottleEnabled, other.frameReportThrottleEnabled) && Objects.equals(peerInfoList, other.peerInfoList) && Objects.equals(staticDnsIp1, other.staticDnsIp1)
&& this.gettingDNS == other.gettingDNS && this.gettingIP == other.gettingIP && Objects.equals(staticDnsIp2, other.staticDnsIp2) && Objects.equals(staticIP, other.staticIP) && Objects.equals(staticIpGw, other.staticIpGw)
&& this.locallyConfigured == other.locallyConfigured && Objects.equals(staticIpMaskCidr, other.staticIpMaskCidr) && Objects.equals(syntheticClientEnabled, other.syntheticClientEnabled);
&& this.locallyConfiguredMgmtVlan == other.locallyConfiguredMgmtVlan
&& Objects.equals(locationData, other.locationData) && Objects.equals(peerInfoList, other.peerInfoList)
&& Objects.equals(staticDnsIp1, other.staticDnsIp1) && Objects.equals(staticDnsIp2, other.staticDnsIp2)
&& Objects.equals(staticIP, other.staticIP) && Objects.equals(staticIpGw, other.staticIpGw)
&& Objects.equals(staticIpMaskCidr, other.staticIpMaskCidr)
&& Objects.equals(syntheticClientEnabled, other.syntheticClientEnabled);
} }
public AntennaType getAntennaType() { public AntennaType getAntennaType() {
@@ -189,14 +186,6 @@ public abstract class CommonElementConfiguration extends EquipmentDetails implem
return syntheticClientEnabled; return syntheticClientEnabled;
} }
@Override
public int hashCode() {
return Objects.hash(antennaType, costSavingEventsEnabled, deploymentType, deviceMode, deviceName,
elementConfigVersion, equipmentType, forwardMode, frameReportThrottleEnabled, gettingDNS, gettingIP,
locallyConfigured, locallyConfiguredMgmtVlan, locationData, peerInfoList, staticDnsIp1, staticDnsIp2,
staticIP, staticIpGw, staticIpMaskCidr, syntheticClientEnabled);
}
@Override @Override
public boolean hasUnsupportedValue() { public boolean hasUnsupportedValue() {
if (super.hasUnsupportedValue()) { if (super.hasUnsupportedValue()) {
@@ -311,4 +300,14 @@ public abstract class CommonElementConfiguration extends EquipmentDetails implem
public void setSyntheticClientEnabled(Boolean syntheticClientEnabled) { public void setSyntheticClientEnabled(Boolean syntheticClientEnabled) {
this.syntheticClientEnabled = syntheticClientEnabled; this.syntheticClientEnabled = syntheticClientEnabled;
} }
public boolean isBlinkAllLEDs() {
return blinkAllLEDs;
}
public void setBlinkAllLEDs(boolean blinkAllLEDs) {
this.blinkAllLEDs = blinkAllLEDs;
}
} }

View File

@@ -0,0 +1,18 @@
package com.telecominfraproject.wlan.equipment.models.events;
import com.telecominfraproject.wlan.equipment.models.Equipment;
public class EquipmentBlinkLEDsEvent extends EquipmentChangedEvent {
private static final long serialVersionUID = 5222048279956123654L;
public EquipmentBlinkLEDsEvent(Equipment equipment){
super(equipment);
setEquipmentChangeType(EquipmentChangeType.blinkLEDs);
}
/**
* Constructor used by JSON
*/
private EquipmentBlinkLEDsEvent() {
super();
}
}

View File

@@ -10,11 +10,11 @@ import com.telecominfraproject.wlan.core.model.json.JsonDeserializationUtils;
public enum EquipmentChangeType { public enum EquipmentChangeType {
All(0), ChannelsOnly(1), CellSizeAttributesOnly(2), ApImpacting(3), UNSUPPORTED(-1); All(0), ChannelsOnly(1), CellSizeAttributesOnly(2), ApImpacting(3), blinkLEDs(4), CustomerOnly(5), UNSUPPORTED(-1);
private final int id; private final int id;
private static final Map<Integer, EquipmentChangeType> ELEMENTS = new HashMap<>(); private static final Map<Integer, EquipmentChangeType> ELEMENTS = new HashMap<>();
private static final EquipmentChangeType validValues[] = { All, ChannelsOnly, CellSizeAttributesOnly, ApImpacting}; private static final EquipmentChangeType validValues[] = { All, ChannelsOnly, CellSizeAttributesOnly, ApImpacting,blinkLEDs};
private EquipmentChangeType(int id) { private EquipmentChangeType(int id) {
this.id = id; this.id = id;

View File

@@ -0,0 +1,41 @@
package com.telecominfraproject.wlan.equipment.models.events;
import com.telecominfraproject.wlan.equipment.models.Equipment;
public class EquipmentCustomerChangedEvent extends EquipmentChangedEvent {
private static final long serialVersionUID = 4650302079238674307L;
private Equipment existingEquipment; // old equipment
private Equipment equipment; // new configured equipment
public EquipmentCustomerChangedEvent(Equipment existingEquipment, Equipment equipment) {
super(equipment);
setEquipmentChangeType(EquipmentChangeType.CustomerOnly);
this.setExistingEquipment(existingEquipment);
this.setEquipment(equipment);
}
/**
* Constructor used by JSON
*/
@SuppressWarnings("unused")
private EquipmentCustomerChangedEvent() {
super();
}
public Equipment getExistingEquipment() {
return existingEquipment;
}
public void setExistingEquipment(Equipment existingEquipment) {
this.existingEquipment = existingEquipment;
}
public Equipment getEquipment() {
return equipment;
}
public void setEquipment(Equipment equipment) {
this.equipment = equipment;
}
}

View File

@@ -1,57 +1,58 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0"
<modelVersion>4.0.0</modelVersion> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<parent> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>com.telecominfraproject.wlan</groupId> <modelVersion>4.0.0</modelVersion>
<artifactId>tip-wlan-cloud-root-pom</artifactId> <parent>
<version>1.2.0-SNAPSHOT</version> <groupId>com.telecominfraproject.wlan</groupId>
<relativePath>../../wlan-cloud-root</relativePath> <artifactId>tip-wlan-cloud-root-pom</artifactId>
</parent> <version>1.2.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>equipment-service-remote</artifactId> <artifactId>equipment-service-remote</artifactId>
<name>equipment-service-remote</name> <name>equipment-service-remote</name>
<description>Remote client for accessing the service, uses REST API calls.</description> <description>Remote client for accessing the service, uses REST API calls.</description>
<dependencies> <dependencies>
<dependency> <dependency>
<artifactId>equipment-service-interface</artifactId> <artifactId>equipment-service-interface</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>base-client</artifactId> <artifactId>base-client</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<!-- Dependencies for the unit tests --> <!-- Dependencies for the unit tests -->
<dependency> <dependency>
<artifactId>base-remote-tests</artifactId> <artifactId>base-remote-tests</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>equipment-service</artifactId> <artifactId>equipment-service</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>equipment-datastore-inmemory</artifactId> <artifactId>equipment-datastore-inmemory</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>cloud-event-dispatcher-empty</artifactId> <artifactId>cloud-event-dispatcher-empty</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies>
</dependencies>
</project> </project>

View File

@@ -1,53 +1,59 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0"
<modelVersion>4.0.0</modelVersion> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<parent> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>com.telecominfraproject.wlan</groupId> <modelVersion>4.0.0</modelVersion>
<artifactId>tip-wlan-cloud-root-pom</artifactId> <parent>
<version>1.2.0-SNAPSHOT</version> <groupId>com.telecominfraproject.wlan</groupId>
<relativePath>../../wlan-cloud-root</relativePath> <artifactId>tip-wlan-cloud-root-pom</artifactId>
</parent> <version>1.2.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>equipment-service</artifactId> <artifactId>equipment-service</artifactId>
<name>equipment-service</name> <name>equipment-service</name>
<description>Server side implementation of the service.</description> <description>Server side implementation of the service.</description>
<dependencies> <dependencies>
<dependency> <dependency>
<artifactId>base-container</artifactId> <artifactId>alarm-service-interface</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>cloud-event-dispatcher-interface</artifactId> <artifactId>base-container</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>equipment-models</artifactId> <artifactId>cloud-event-dispatcher-interface</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<artifactId>equipment-datastore-interface</artifactId>
<groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<artifactId>equipment-datastore-inmemory</artifactId>
<groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency>
<artifactId>equipment-models</artifactId>
<groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<artifactId>equipment-datastore-interface</artifactId>
<groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<artifactId>equipment-datastore-inmemory</artifactId>
<groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version>
<scope>test</scope>
</dependency>
<dependency> <dependency>
<artifactId>cloud-event-dispatcher-empty</artifactId> <artifactId>cloud-event-dispatcher-empty</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies>
</dependencies>
</project> </project>

View File

@@ -47,14 +47,15 @@ import com.telecominfraproject.wlan.equipment.models.SourceSelectionMulticast;
import com.telecominfraproject.wlan.equipment.models.bulkupdate.rrm.EquipmentRrmBulkUpdateRequest; import com.telecominfraproject.wlan.equipment.models.bulkupdate.rrm.EquipmentRrmBulkUpdateRequest;
import com.telecominfraproject.wlan.equipment.models.events.EquipmentAddedEvent; import com.telecominfraproject.wlan.equipment.models.events.EquipmentAddedEvent;
import com.telecominfraproject.wlan.equipment.models.events.EquipmentApImpactingChangedEvent; import com.telecominfraproject.wlan.equipment.models.events.EquipmentApImpactingChangedEvent;
import com.telecominfraproject.wlan.equipment.models.events.EquipmentBlinkLEDsEvent;
import com.telecominfraproject.wlan.equipment.models.events.EquipmentCellSizeAttributesChangedEvent; import com.telecominfraproject.wlan.equipment.models.events.EquipmentCellSizeAttributesChangedEvent;
import com.telecominfraproject.wlan.equipment.models.events.EquipmentChangedEvent; import com.telecominfraproject.wlan.equipment.models.events.EquipmentChangedEvent;
import com.telecominfraproject.wlan.equipment.models.events.EquipmentChannelsChangedEvent; import com.telecominfraproject.wlan.equipment.models.events.EquipmentChannelsChangedEvent;
import com.telecominfraproject.wlan.equipment.models.events.EquipmentCustomerChangedEvent;
import com.telecominfraproject.wlan.equipment.models.events.EquipmentRemovedEvent; import com.telecominfraproject.wlan.equipment.models.events.EquipmentRemovedEvent;
import com.telecominfraproject.wlan.server.exceptions.ConfigurationException; import com.telecominfraproject.wlan.server.exceptions.ConfigurationException;
import com.telecominfraproject.wlan.systemevent.models.SystemEvent; import com.telecominfraproject.wlan.systemevent.models.SystemEvent;
/** /**
* @author dtoptygin * @author dtoptygin
* *
@@ -73,7 +74,6 @@ public class EquipmentController {
@Autowired private EquipmentDatastore equipmentDatastore; @Autowired private EquipmentDatastore equipmentDatastore;
@Autowired private CloudEventDispatcherInterface cloudEventDispatcher; @Autowired private CloudEventDispatcherInterface cloudEventDispatcher;
/** /**
* Creates new Equipment. * Creates new Equipment.
* *
@@ -280,9 +280,15 @@ public class EquipmentController {
LOG.debug("Updated Equipment {}", ret); LOG.debug("Updated Equipment {}", ret);
EquipmentChangedEvent event; EquipmentChangedEvent event;
if (equipment.getCustomerId() != existingEquipment.getCustomerId()) {
publishEvent(new EquipmentCustomerChangedEvent(existingEquipment, ret));
}
if ((equipment.getProfileId() != existingEquipment.getProfileId()) || (existingApElementConfig != null && updatedApElementConfig != null && if ((equipment.getProfileId() != existingEquipment.getProfileId()) || (existingApElementConfig != null && updatedApElementConfig != null &&
updatedApElementConfig.needsToBeUpdatedOnDevice(existingApElementConfig))) { updatedApElementConfig.needsToBeUpdatedOnDevice(existingApElementConfig))) {
event = new EquipmentApImpactingChangedEvent(ret); event = new EquipmentApImpactingChangedEvent(ret);
} else if (existingApElementConfig != null && existingApElementConfig.isBlinkAllLEDs() != updatedApElementConfig.isBlinkAllLEDs()) {
LOG.debug("Updated BlinkingLEDs {}", ret);
event = new EquipmentBlinkLEDsEvent(ret);
} else { } else {
event = new EquipmentChangedEvent(ret); event = new EquipmentChangedEvent(ret);
} }
@@ -291,7 +297,6 @@ public class EquipmentController {
return ret; return ret;
} }
private void validateChannelNum(Equipment equipment) { private void validateChannelNum(Equipment equipment) {
if (equipment.getDetails() instanceof ApElementConfiguration) { if (equipment.getDetails() instanceof ApElementConfiguration) {
ApElementConfiguration apElementConfiguration = (ApElementConfiguration) equipment.getDetails(); ApElementConfiguration apElementConfiguration = (ApElementConfiguration) equipment.getDetails();

View File

@@ -220,6 +220,8 @@ components:
type: boolean type: boolean
forwardMode: forwardMode:
$ref: '#/components/schemas/NetworkForwardMode' $ref: '#/components/schemas/NetworkForwardMode'
blinkAllLEDs:
type: boolean
radioMap: radioMap:
$ref: '#/components/schemas/RadioMap' $ref: '#/components/schemas/RadioMap'
advancedRadioMap: advancedRadioMap:

View File

@@ -34,7 +34,7 @@ import com.telecominfraproject.wlan.equipment.models.Equipment;
EquipmentController.class, EquipmentController.class,
CloudEventDispatcherEmpty.class, CloudEventDispatcherEmpty.class,
EquipmentDatastoreInMemory.class, EquipmentDatastoreInMemory.class,
EquipmentControllerTest.Config.class, EquipmentControllerTest.Config.class
}) })
public class EquipmentControllerTest { public class EquipmentControllerTest {

View File

@@ -161,8 +161,6 @@
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
<scope>test</scope> <scope>test</scope>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@@ -1043,6 +1043,8 @@ components:
type: boolean type: boolean
forwardMode: forwardMode:
$ref: '#/components/schemas/NetworkForwardMode' $ref: '#/components/schemas/NetworkForwardMode'
blinkAllLEDs:
type: boolean
radioMap: radioMap:
$ref: '#/components/schemas/RadioMap' $ref: '#/components/schemas/RadioMap'
advancedRadioMap: advancedRadioMap:
@@ -3331,8 +3333,6 @@ components:
EquipmentAdminStatusData: EquipmentAdminStatusData:
type: object type: object
required:
- model_type
properties: properties:
model_type: model_type:
type: string type: string
@@ -3346,6 +3346,15 @@ components:
$ref: '#/components/schemas/StatusCode' $ref: '#/components/schemas/StatusCode'
statusMessage: statusMessage:
type: string type: string
ledStatus:
$ref: '#/components/schemas/LedStatus'
LedStatus:
type: string
enum:
- led_blink
- led_off
- UNKNOWN
StatusCode: StatusCode:
type: string type: string
@@ -9089,6 +9098,7 @@ components:
- EquipmentChangedEvent - EquipmentChangedEvent
- EquipmentApImpactingChangedEvent - EquipmentApImpactingChangedEvent
- EquipmentChannelsChangedEvent - EquipmentChannelsChangedEvent
- EquipmentBlinkLEDsEvent
- EquipmentCellSizeAttributesChangedEvent - EquipmentCellSizeAttributesChangedEvent
- EquipmentRemovedEvent - EquipmentRemovedEvent
- StatusChangedEvent - StatusChangedEvent
@@ -9182,6 +9192,7 @@ components:
- $ref: '#/components/schemas/EquipmentChangedEvent' - $ref: '#/components/schemas/EquipmentChangedEvent'
- $ref: '#/components/schemas/EquipmentApImpactingChangedEvent' - $ref: '#/components/schemas/EquipmentApImpactingChangedEvent'
- $ref: '#/components/schemas/EquipmentChannelsChangedEvent' - $ref: '#/components/schemas/EquipmentChannelsChangedEvent'
- $ref: '#/components/schemas/EquipmentBlinkLEDsEvent'
- $ref: '#/components/schemas/EquipmentCellSizeAttributesChangedEvent' - $ref: '#/components/schemas/EquipmentCellSizeAttributesChangedEvent'
- $ref: '#/components/schemas/EquipmentRemovedEvent' - $ref: '#/components/schemas/EquipmentRemovedEvent'
- $ref: '#/components/schemas/StatusChangedEvent' - $ref: '#/components/schemas/StatusChangedEvent'
@@ -9536,6 +9547,11 @@ components:
newBackupChannels: newBackupChannels:
$ref: '#/components/schemas/IntegerPerRadioTypeMap' $ref: '#/components/schemas/IntegerPerRadioTypeMap'
EquipmentBlinkLEDsEvent:
properties:
allOf:
$ref: '#/components/schemas/EquipmentChangedEvent'
EquipmentCellSizeAttributesChangedEvent: EquipmentCellSizeAttributesChangedEvent:
properties: properties:
allOf: allOf:

View File

@@ -35,7 +35,6 @@ import com.telecominfraproject.wlan.profile.models.Profile;
import com.telecominfraproject.wlan.profile.models.ProfileByCustomerRequestFactory; import com.telecominfraproject.wlan.profile.models.ProfileByCustomerRequestFactory;
import com.telecominfraproject.wlan.profile.models.ProfileType; import com.telecominfraproject.wlan.profile.models.ProfileType;
@RunWith(SpringRunner.class) @RunWith(SpringRunner.class)
@ActiveProfiles(profiles = { @ActiveProfiles(profiles = {
"integration_test", "integration_test",

View File

@@ -1,97 +1,111 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <project xmlns="http://maven.apache.org/POM/4.0.0"
<modelVersion>4.0.0</modelVersion> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
<parent> xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<groupId>com.telecominfraproject.wlan</groupId> <modelVersion>4.0.0</modelVersion>
<artifactId>tip-wlan-cloud-root-pom</artifactId> <parent>
<version>1.2.0-SNAPSHOT</version> <groupId>com.telecominfraproject.wlan</groupId>
<relativePath>../../wlan-cloud-root</relativePath> <artifactId>tip-wlan-cloud-root-pom</artifactId>
</parent> <version>1.2.0-SNAPSHOT</version>
<relativePath>../../wlan-cloud-root</relativePath>
</parent>
<artifactId>provisioning-sp</artifactId> <artifactId>provisioning-sp</artifactId>
<name>provisioning-sp</name> <name>provisioning-sp</name>
<description>Stream Processors for provisioning events.</description> <description>Stream Processors for provisioning events.</description>
<dependencies> <dependencies>
<dependency> <dependency>
<artifactId>base-stream-consumer</artifactId> <artifactId>base-stream-consumer</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>service-metric-models</artifactId> <artifactId>service-metric-models</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>system-event-models</artifactId> <artifactId>system-event-models</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>base-models</artifactId> <artifactId>base-models</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>routing-service-interface</artifactId> <artifactId>routing-service-interface</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>equipment-gateway-service-interface</artifactId> <artifactId>equipment-gateway-service-interface</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>equipment-service-interface</artifactId> <artifactId>equipment-service-interface</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>location-service-interface</artifactId> <artifactId>location-service-interface</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>profile-service-interface</artifactId> <artifactId>profile-service-interface</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<artifactId>client-service-interface</artifactId> <artifactId>client-service-interface</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<!-- models used by the application logic of the stream processor --> <dependency>
<dependency> <artifactId>alarm-service-interface</artifactId>
<artifactId>equipment-models</artifactId> <groupId>com.telecominfraproject.wlan</groupId>
<groupId>com.telecominfraproject.wlan</groupId> <version>1.2.0-SNAPSHOT</version>
<version>1.2.0-SNAPSHOT</version> </dependency>
</dependency>
<dependency> <dependency>
<artifactId>profile-models</artifactId> <artifactId>status-service-interface</artifactId>
<groupId>com.telecominfraproject.wlan</groupId> <groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version> <version>1.2.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <!-- models used by the application logic of the stream processor -->
<artifactId>location-models</artifactId> <dependency>
<groupId>com.telecominfraproject.wlan</groupId> <artifactId>equipment-models</artifactId>
<version>1.2.0-SNAPSHOT</version> <groupId>com.telecominfraproject.wlan</groupId>
</dependency> <version>1.2.0-SNAPSHOT</version>
</dependency>
</dependencies> <dependency>
<artifactId>profile-models</artifactId>
<groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version>
</dependency>
<dependency>
<artifactId>location-models</artifactId>
<groupId>com.telecominfraproject.wlan</groupId>
<version>1.2.0-SNAPSHOT</version>
</dependency>
</dependencies>
</project> </project>

View File

@@ -1,3 +1,4 @@
package com.telecominfraproject.wlan.streams.provisioning; package com.telecominfraproject.wlan.streams.provisioning;
import java.util.ArrayList; import java.util.ArrayList;
@@ -12,18 +13,24 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import com.telecominfraproject.wlan.alarm.AlarmServiceInterface;
import com.telecominfraproject.wlan.alarm.models.Alarm;
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel; import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
import com.telecominfraproject.wlan.core.model.pagination.PaginationContext; import com.telecominfraproject.wlan.core.model.pagination.PaginationContext;
import com.telecominfraproject.wlan.core.model.pagination.PaginationResponse; import com.telecominfraproject.wlan.core.model.pagination.PaginationResponse;
import com.telecominfraproject.wlan.core.model.pair.PairLongLong; import com.telecominfraproject.wlan.core.model.pair.PairLongLong;
import com.telecominfraproject.wlan.core.model.streams.QueuedStreamMessage; import com.telecominfraproject.wlan.core.model.streams.QueuedStreamMessage;
import com.telecominfraproject.wlan.equipment.EquipmentServiceInterface; import com.telecominfraproject.wlan.equipment.EquipmentServiceInterface;
import com.telecominfraproject.wlan.equipment.models.ApElementConfiguration;
import com.telecominfraproject.wlan.equipment.models.Equipment; import com.telecominfraproject.wlan.equipment.models.Equipment;
import com.telecominfraproject.wlan.equipment.models.events.EquipmentApImpactingChangedEvent; import com.telecominfraproject.wlan.equipment.models.events.EquipmentApImpactingChangedEvent;
import com.telecominfraproject.wlan.equipment.models.events.EquipmentBlinkLEDsEvent;
import com.telecominfraproject.wlan.equipment.models.events.EquipmentCellSizeAttributesChangedEvent; import com.telecominfraproject.wlan.equipment.models.events.EquipmentCellSizeAttributesChangedEvent;
import com.telecominfraproject.wlan.equipment.models.events.EquipmentChannelsChangedEvent; import com.telecominfraproject.wlan.equipment.models.events.EquipmentChannelsChangedEvent;
import com.telecominfraproject.wlan.equipment.models.events.EquipmentCustomerChangedEvent;
import com.telecominfraproject.wlan.equipment.models.events.EquipmentRemovedEvent; import com.telecominfraproject.wlan.equipment.models.events.EquipmentRemovedEvent;
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWBaseCommand; import com.telecominfraproject.wlan.equipmentgateway.models.CEGWBaseCommand;
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWBlinkRequest;
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWCloseSessionRequest; import com.telecominfraproject.wlan.equipmentgateway.models.CEGWCloseSessionRequest;
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWConfigChangeNotification; import com.telecominfraproject.wlan.equipmentgateway.models.CEGWConfigChangeNotification;
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWNewChannelRequest; import com.telecominfraproject.wlan.equipmentgateway.models.CEGWNewChannelRequest;
@@ -35,13 +42,16 @@ import com.telecominfraproject.wlan.profile.models.Profile;
import com.telecominfraproject.wlan.profile.models.events.ProfileAddedEvent; import com.telecominfraproject.wlan.profile.models.events.ProfileAddedEvent;
import com.telecominfraproject.wlan.profile.models.events.ProfileChangedEvent; import com.telecominfraproject.wlan.profile.models.events.ProfileChangedEvent;
import com.telecominfraproject.wlan.profile.models.events.ProfileRemovedEvent; import com.telecominfraproject.wlan.profile.models.events.ProfileRemovedEvent;
import com.telecominfraproject.wlan.status.StatusServiceInterface;
import com.telecominfraproject.wlan.status.models.Status;
import com.telecominfraproject.wlan.status.models.StatusDataType;
import com.telecominfraproject.wlan.stream.StreamProcessor; import com.telecominfraproject.wlan.stream.StreamProcessor;
import com.telecominfraproject.wlan.systemevent.models.SystemEvent; import com.telecominfraproject.wlan.systemevent.models.SystemEvent;
import com.telecominfraproject.wlan.systemevent.models.SystemEventRecord; import com.telecominfraproject.wlan.systemevent.models.SystemEventRecord;
/** /**
* @author dtop * @author dtop
* This stream processor is listening for events related to changes * This stream processor is listening for events related to changes
* in Equipment, Location, and Profile objects. If a change is detected, * in Equipment, Location, and Profile objects. If a change is detected,
* it uses Routing service to find affected equipment and delivers * it uses Routing service to find affected equipment and delivers
* CEGWConfigChangeNotification command to the equipment, which results * CEGWConfigChangeNotification command to the equipment, which results
@@ -50,187 +60,225 @@ import com.telecominfraproject.wlan.systemevent.models.SystemEventRecord;
@Component @Component
public class EquipmentConfigPushTrigger extends StreamProcessor { public class EquipmentConfigPushTrigger extends StreamProcessor {
private static final Logger LOG = LoggerFactory.getLogger(EquipmentConfigPushTrigger.class); private static final Logger LOG = LoggerFactory.getLogger(EquipmentConfigPushTrigger.class);
@Value("${tip.wlan.systemEventsTopic:system_events}") @Value("${tip.wlan.systemEventsTopic:system_events}")
private String systemEventsTopic; private String systemEventsTopic;
@Autowired @Autowired
private EquipmentGatewayServiceInterface equipmentGatewayInterface; private EquipmentGatewayServiceInterface equipmentGatewayInterface;
@Autowired @Autowired
private ProfileServiceInterface profileServiceInterface; private ProfileServiceInterface profileServiceInterface;
@Autowired @Autowired
private EquipmentServiceInterface equipmentServiceInterface; private EquipmentServiceInterface equipmentServiceInterface;
@Autowired
private StatusServiceInterface statusServiceInterface;
@Autowired
private AlarmServiceInterface alarmServiceInterface;
@Override @Override
protected boolean acceptMessage(QueuedStreamMessage message) { protected boolean acceptMessage(QueuedStreamMessage message) {
boolean ret = message.getTopic().equals(systemEventsTopic); boolean ret = message.getTopic().equals(systemEventsTopic);
if(ret && ( message.getModel() instanceof SystemEventRecord) ) { if (ret && (message.getModel() instanceof SystemEventRecord)) {
SystemEventRecord ser = (SystemEventRecord) message.getModel(); SystemEventRecord ser = (SystemEventRecord) message.getModel();
ret = ret && ret = ret && (ser.getDetails() instanceof EquipmentApImpactingChangedEvent || ser.getDetails() instanceof EquipmentBlinkLEDsEvent
( || ser.getDetails() instanceof EquipmentChannelsChangedEvent || ser.getDetails() instanceof EquipmentCellSizeAttributesChangedEvent
ser.getDetails() instanceof EquipmentApImpactingChangedEvent || || ser.getDetails() instanceof EquipmentRemovedEvent || ser.getDetails() instanceof ProfileAddedEvent
ser.getDetails() instanceof EquipmentChannelsChangedEvent || || ser.getDetails() instanceof ProfileChangedEvent || ser.getDetails() instanceof ProfileRemovedEvent
ser.getDetails() instanceof EquipmentCellSizeAttributesChangedEvent || || ser.getDetails() instanceof LocationChangedApImpactingEvent || ser.getDetails() instanceof EquipmentCustomerChangedEvent);
ser.getDetails() instanceof EquipmentRemovedEvent || } else {
ser.getDetails() instanceof ProfileAddedEvent || ret = false;
ser.getDetails() instanceof ProfileChangedEvent || }
ser.getDetails() instanceof ProfileRemovedEvent ||
ser.getDetails() instanceof LocationChangedApImpactingEvent
);
} else {
ret = false;
}
LOG.trace("acceptMessage {}", ret); LOG.trace("acceptMessage {}", ret);
return ret; return ret;
} }
@Override @Override
protected void processMessage(QueuedStreamMessage message) { protected void processMessage(QueuedStreamMessage message) {
SystemEventRecord mdl = (SystemEventRecord) message.getModel(); SystemEventRecord mdl = (SystemEventRecord) message.getModel();
SystemEvent se = mdl.getDetails(); SystemEvent se = mdl.getDetails();
LOG.debug("Processing {}", mdl); LOG.debug("Processing {}", mdl);
switch ( se.getClass().getSimpleName() ) { switch (se.getClass().getSimpleName()) {
case "EquipmentApImpactingChangedEvent": case "EquipmentApImpactingChangedEvent":
process((EquipmentApImpactingChangedEvent) se); process((EquipmentApImpactingChangedEvent) se);
break; break;
case "EquipmentChannelsChangedEvent": case "EquipmentChannelsChangedEvent":
process((EquipmentChannelsChangedEvent) se); process((EquipmentChannelsChangedEvent) se);
break; break;
case "EquipmentCellSizeAttributesChangedEvent": case "EquipmentCellSizeAttributesChangedEvent":
process((EquipmentCellSizeAttributesChangedEvent) se); process((EquipmentCellSizeAttributesChangedEvent) se);
break; break;
case "EquipmentRemovedEvent": case "EquipmentBlinkLEDsEvent":
process((EquipmentBlinkLEDsEvent) se);
break;
case "EquipmentRemovedEvent":
process((EquipmentRemovedEvent) se); process((EquipmentRemovedEvent) se);
break; break;
case "ProfileAddedEvent": case "ProfileAddedEvent":
process((ProfileAddedEvent) se); process((ProfileAddedEvent) se);
break; break;
case "ProfileChangedEvent": case "ProfileChangedEvent":
process((ProfileChangedEvent) se); process((ProfileChangedEvent) se);
break; break;
case "ProfileRemovedEvent": case "ProfileRemovedEvent":
process((ProfileRemovedEvent) se); process((ProfileRemovedEvent) se);
break; break;
case "LocationChangedApImpactingEvent": case "LocationChangedApImpactingEvent":
process((LocationChangedApImpactingEvent) se); process((LocationChangedApImpactingEvent) se);
break; break;
default: case "EquipmentCustomerChangedEvent":
process(mdl); process((EquipmentCustomerChangedEvent) se);
} default:
process(mdl);
}
private void process(EquipmentApImpactingChangedEvent model) {
LOG.debug("Processing EquipmentChangedEvent");
equipmentGatewayInterface.sendCommand(new CEGWConfigChangeNotification(model.getPayload().getInventoryId(),
model.getEquipmentId()));
} }
private void process(EquipmentChannelsChangedEvent model) { }
LOG.debug("Processing EquipmentChannelsChangedEvent for equipmentId {}", model.getEquipmentId());
equipmentGatewayInterface.sendCommand(new CEGWNewChannelRequest(model.getPayload().getInventoryId(), private void process(EquipmentApImpactingChangedEvent model) {
model.getEquipmentId(), model.getNewBackupChannels(), model.getNewPrimaryChannels())); LOG.debug("Processing EquipmentChangedEvent");
equipmentGatewayInterface.sendCommand(new CEGWConfigChangeNotification(model.getPayload().getInventoryId(), model.getEquipmentId()));
}
private void process(EquipmentChannelsChangedEvent model) {
LOG.debug("Processing EquipmentChannelsChangedEvent for equipmentId {}", model.getEquipmentId());
equipmentGatewayInterface.sendCommand(new CEGWNewChannelRequest(model.getPayload().getInventoryId(), model.getEquipmentId(),
model.getNewBackupChannels(), model.getNewPrimaryChannels()));
}
private void process(EquipmentCellSizeAttributesChangedEvent model) {
LOG.debug("Processing EquipmentCellSizeAttributesChangedEvent for equipmentId {}", model.getEquipmentId());
equipmentGatewayInterface
.sendCommand(new CEGWCellSizeAttributesRequest(model.getPayload().getInventoryId(), model.getEquipmentId(), model.getCellSizeAttributesMap()));
}
private void process(EquipmentBlinkLEDsEvent model) {
LOG.debug("Processing EquipmentBlinkLEDsEvent for equipmentId {}", model.getEquipmentId());
CEGWBlinkRequest br = new CEGWBlinkRequest(model.getPayload().getInventoryId(), model.getEquipmentId());
br.setBlinkAllLEDs(((ApElementConfiguration) model.getPayload().getDetails()).isBlinkAllLEDs());
equipmentGatewayInterface.sendCommand(br);
}
private void process(EquipmentRemovedEvent model) {
LOG.debug("Processing EquipmentRemovedEvent");
equipmentGatewayInterface.sendCommand(new CEGWCloseSessionRequest(model.getPayload().getInventoryId(), model.getEquipmentId()));
}
private void process(ProfileAddedEvent model) {
LOG.debug("Processing ProfileAddedEvent {}", model.getPayload().getId());
processProfile(model.getPayload());
}
private void process(ProfileChangedEvent model) {
LOG.debug("Processing ProfileChangedEvent {}", model.getPayload().getId());
processProfile(model.getPayload());
}
private void process(ProfileRemovedEvent model) {
LOG.debug("Processing ProfileRemovedEvent {}", model.getPayload().getId());
processProfile(model.getPayload());
}
private void processProfile(Profile profile) {
List<PairLongLong> ret = profileServiceInterface.getTopLevelProfiles(new HashSet<>(Arrays.asList(profile.getId())));
if (ret == null || ret.isEmpty()) {
// nothing to do here
return;
} }
private void process(EquipmentCellSizeAttributesChangedEvent model) { Set<Long> parentProfileIds = new HashSet<>();
LOG.debug("Processing EquipmentCellSizeAttributesChangedEvent for equipmentId {}", model.getEquipmentId()); ret.forEach(p -> parentProfileIds.add(p.getValue2()));
equipmentGatewayInterface.sendCommand(new CEGWCellSizeAttributesRequest(model.getPayload().getInventoryId(),
model.getEquipmentId(), model.getCellSizeAttributesMap())); // go through all equipmentIds that refer to parent profiles and trigger change config notification on them
PaginationContext<PairLongLong> context = new PaginationContext<>(100);
while (!context.isLastPage()) {
PaginationResponse<PairLongLong> page = equipmentServiceInterface.getEquipmentIdsByProfileIds(parentProfileIds, context);
context = page.getContext();
Set<Long> equipmentIds = new HashSet<>();
page.getItems().forEach(p -> equipmentIds.add(p.getValue2()));
// retrieve full equipment objects to get the inventory id
List<Equipment> equipmentForPage = equipmentServiceInterface.get(equipmentIds);
List<CEGWBaseCommand> commands = new ArrayList<>(equipmentForPage.size());
equipmentForPage.forEach(eq -> commands.add(new CEGWConfigChangeNotification(eq.getInventoryId(), eq.getId())));
equipmentGatewayInterface.sendCommands(commands);
LOG.debug("Page {} - sent {} commands to equipment gateway", context.getLastReturnedPageNumber(), commands.size());
} }
private void process(EquipmentRemovedEvent model) { LOG.debug("Finished processing profile {}", profile.getId());
LOG.debug("Processing EquipmentRemovedEvent"); }
equipmentGatewayInterface.sendCommand(new CEGWCloseSessionRequest(model.getPayload().getInventoryId(), model.getEquipmentId()));
private void process(LocationChangedApImpactingEvent model) {
LOG.debug("Processing LocationChangedApImpactingEvent {}", model.getPayload().getId());
Set<Long> locationIds = new HashSet<>(Arrays.asList(model.getPayload().getId()));
// go through all equipmentIds that reside in the specified location and trigger change config notification on
// them
PaginationContext<PairLongLong> context = new PaginationContext<>(100);
while (!context.isLastPage()) {
PaginationResponse<PairLongLong> page = equipmentServiceInterface.getEquipmentIdsByLocationIds(locationIds, context);
context = page.getContext();
Set<Long> equipmentIds = new HashSet<>();
page.getItems().forEach(p -> equipmentIds.add(p.getValue2()));
// retrieve full equipment objects to get the inventory id
List<Equipment> equipmentForPage = equipmentServiceInterface.get(equipmentIds);
List<CEGWBaseCommand> commands = new ArrayList<>(equipmentForPage.size());
equipmentForPage.forEach(eq -> commands.add(new CEGWConfigChangeNotification(eq.getInventoryId(), eq.getId())));
equipmentGatewayInterface.sendCommands(commands);
LOG.debug("Page {} - sent {} commands to equipment gateway", context.getLastReturnedPageNumber(), commands.size());
} }
private void process(ProfileAddedEvent model) { LOG.debug("Finished processing LocationChangedApImpactingEvent {}", model.getPayload().getId());
LOG.debug("Processing ProfileAddedEvent {}", model.getPayload().getId());
processProfile(model.getPayload());
}
private void process(ProfileChangedEvent model) { }
LOG.debug("Processing ProfileChangedEvent {}", model.getPayload().getId());
processProfile(model.getPayload());
}
private void process(ProfileRemovedEvent model) { private void process(EquipmentCustomerChangedEvent model) {
LOG.debug("Processing ProfileRemovedEvent {}", model.getPayload().getId()); LOG.info("Processing EquipmentCustomerChangedEvent {}", model.getPayload().getId());
processProfile(model.getPayload());
}
Equipment existingEquipment = model.getExistingEquipment();
Equipment equipment = model.getEquipment();
private void processProfile(Profile profile) { // when customerId changes, we keep the EQUIPMENT_ADMIN and PROTOCOL status of the AP
Status status = statusServiceInterface.getOrNull(existingEquipment.getCustomerId(), existingEquipment.getId(), StatusDataType.EQUIPMENT_ADMIN);
if (status != null) {
status.setCustomerId(equipment.getCustomerId());
statusServiceInterface.update(status);
}
status = statusServiceInterface.getOrNull(existingEquipment.getCustomerId(), existingEquipment.getId(), StatusDataType.PROTOCOL);
if (status != null) {
status.setCustomerId(equipment.getCustomerId());
statusServiceInterface.update(status);
}
List<PairLongLong> ret = profileServiceInterface.getTopLevelProfiles(new HashSet<>(Arrays.asList(profile.getId()))); // Alarms has to move to new customerId as well
if(ret == null || ret.isEmpty()) { List<Alarm> oldCustomerAlarms = alarmServiceInterface.get(existingEquipment.getCustomerId(), Set.of(existingEquipment.getId()), null);
//nothing to do here if (!oldCustomerAlarms.isEmpty()) {
return; oldCustomerAlarms.stream().forEach(a -> {
} a.setCustomerId(equipment.getCustomerId());
Alarm alarm = alarmServiceInterface.create(a);
Set<Long> parentProfileIds = new HashSet<>(); LOG.debug("Move an alarm to new customer {}", alarm);
ret.forEach(p -> parentProfileIds.add(p.getValue2())); });
}
//go through all equipmentIds that refer to parent profiles and trigger change config notification on them alarmServiceInterface.delete(existingEquipment.getCustomerId(), existingEquipment.getId());
PaginationContext<PairLongLong> context = new PaginationContext<>(100); }
while(!context.isLastPage()) {
PaginationResponse<PairLongLong> page = equipmentServiceInterface.getEquipmentIdsByProfileIds(parentProfileIds, context );
context = page.getContext();
Set<Long> equipmentIds = new HashSet<>();
page.getItems().forEach(p -> equipmentIds.add(p.getValue2()));
//retrieve full equipment objects to get the inventory id
List<Equipment> equipmentForPage = equipmentServiceInterface.get(equipmentIds);
List<CEGWBaseCommand> commands = new ArrayList<>(equipmentForPage.size());
equipmentForPage.forEach(eq -> commands.add(new CEGWConfigChangeNotification(eq.getInventoryId(), eq.getId())));
equipmentGatewayInterface.sendCommands(commands);
LOG.debug("Page {} - sent {} commands to equipment gateway", context.getLastReturnedPageNumber(), commands.size());
}
LOG.debug("Finished processing profile {}", profile.getId());
}
private void process(LocationChangedApImpactingEvent model) {
LOG.debug("Processing LocationChangedApImpactingEvent {}", model.getPayload().getId());
Set<Long> locationIds = new HashSet<>(Arrays.asList(model.getPayload().getId()));
//go through all equipmentIds that reside in the specified location and trigger change config notification on them
PaginationContext<PairLongLong> context = new PaginationContext<>(100);
while(!context.isLastPage()) {
PaginationResponse<PairLongLong> page = equipmentServiceInterface.getEquipmentIdsByLocationIds(locationIds, context );
context = page.getContext();
Set<Long> equipmentIds = new HashSet<>();
page.getItems().forEach(p -> equipmentIds.add(p.getValue2()));
//retrieve full equipment objects to get the inventory id
List<Equipment> equipmentForPage = equipmentServiceInterface.get(equipmentIds);
List<CEGWBaseCommand> commands = new ArrayList<>(equipmentForPage.size());
equipmentForPage.forEach(eq -> commands.add(new CEGWConfigChangeNotification(eq.getInventoryId(), eq.getId())));
equipmentGatewayInterface.sendCommands(commands);
LOG.debug("Page {} - sent {} commands to equipment gateway", context.getLastReturnedPageNumber(), commands.size());
}
LOG.debug("Finished processing LocationChangedApImpactingEvent {}", model.getPayload().getId());
}
private void process(BaseJsonModel model) {
LOG.warn("Unprocessed model: {}", model);
}
private void process(BaseJsonModel model) {
LOG.warn("Unprocessed model: {}", model);
}
} }

View File

@@ -1,7 +1,9 @@
package com.telecominfraproject.wlan.status.equipment.models; package com.telecominfraproject.wlan.status.equipment.models;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Objects;
import com.telecominfraproject.wlan.status.models.StatusCode; import com.telecominfraproject.wlan.status.models.StatusCode;
import com.telecominfraproject.wlan.status.models.StatusDataType; import com.telecominfraproject.wlan.status.models.StatusDataType;
@@ -29,8 +31,9 @@ public class EquipmentAdminStatusData extends StatusDetails {
*/ */
private String statusMessage; private String statusMessage;
private Map<String, Long> alarmTimestamps;
private Map<String,Long> alarmTimestamps; private LedStatus ledStatus;
public EquipmentAdminStatusData() { public EquipmentAdminStatusData() {
@@ -38,61 +41,19 @@ public class EquipmentAdminStatusData extends StatusDetails {
@Override @Override
public StatusDataType getStatusDataType() { public StatusDataType getStatusDataType() {
return StatusDataType.EQUIPMENT_ADMIN; return StatusDataType.EQUIPMENT_ADMIN;
} }
public EquipmentAdminStatusData(EquipmentAdminStatusData data) { public EquipmentAdminStatusData(EquipmentAdminStatusData data) {
this.statusCode = data.statusCode; this.statusCode = data.statusCode;
this.statusMessage = data.statusMessage; this.statusMessage = data.statusMessage;
this.alarmTimestamps = data.alarmTimestamps==null?null:new HashMap<>(data.alarmTimestamps); this.alarmTimestamps = data.alarmTimestamps == null ? null : new HashMap<>(data.alarmTimestamps);
}
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = prime * result + ((alarmTimestamps == null) ? 0 : alarmTimestamps.hashCode());
result = prime * result + ((statusCode == null) ? 0 : statusCode.hashCode());
result = prime * result + ((statusMessage == null) ? 0 : statusMessage.hashCode());
return result;
}
@Override
public boolean equals(Object obj) {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (!(obj instanceof EquipmentAdminStatusData)) {
return false;
}
EquipmentAdminStatusData other = (EquipmentAdminStatusData) obj;
if (alarmTimestamps == null) {
if (other.alarmTimestamps != null) {
return false;
}
} else if (!alarmTimestamps.equals(other.alarmTimestamps)) {
return false;
}
if (statusCode != other.statusCode) {
return false;
}
if (statusMessage == null) {
if (other.statusMessage != null) {
return false;
}
} else if (!statusMessage.equals(other.statusMessage)) {
return false;
}
return true;
} }
@Override @Override
public EquipmentAdminStatusData clone() { public EquipmentAdminStatusData clone() {
EquipmentAdminStatusData res = (EquipmentAdminStatusData) super.clone(); EquipmentAdminStatusData res = (EquipmentAdminStatusData) super.clone();
if(this.alarmTimestamps != null) { if (this.alarmTimestamps != null) {
res.setAlarmTimestamps(new HashMap<>(this.alarmTimestamps)); res.setAlarmTimestamps(new HashMap<>(this.alarmTimestamps));
} }
return res; return res;
@@ -123,11 +84,11 @@ public class EquipmentAdminStatusData extends StatusDetails {
} }
public long findAlarmTimeOrZero(String alarmKey) { public long findAlarmTimeOrZero(String alarmKey) {
return alarmTimestamps==null?0:alarmTimestamps.getOrDefault(alarmKey, 0l); return alarmTimestamps == null ? 0 : alarmTimestamps.getOrDefault(alarmKey, 0l);
} }
public void putAlarmTimestamp(String alarmKey, long value) { public void putAlarmTimestamp(String alarmKey, long value) {
if(alarmTimestamps == null) { if (alarmTimestamps == null) {
alarmTimestamps = new HashMap<>(); alarmTimestamps = new HashMap<>();
} }
alarmTimestamps.put(alarmKey, value); alarmTimestamps.put(alarmKey, value);
@@ -138,9 +99,37 @@ public class EquipmentAdminStatusData extends StatusDetails {
if (super.hasUnsupportedValue()) { if (super.hasUnsupportedValue()) {
return true; return true;
} }
if (StatusCode.isUnsupported(statusCode) ) { if (StatusCode.isUnsupported(statusCode)) {
return true; return true;
} }
return false; return false;
} }
public LedStatus getLedStatus() {
return ledStatus;
}
public void setLedStatus(LedStatus ledStatus) {
this.ledStatus = ledStatus;
}
@Override
public int hashCode() {
return Objects.hash(alarmTimestamps, ledStatus, statusCode, statusMessage);
}
@Override
public boolean equals(Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
EquipmentAdminStatusData other = (EquipmentAdminStatusData) obj;
return Objects.equals(alarmTimestamps, other.alarmTimestamps) && ledStatus == other.ledStatus && statusCode == other.statusCode
&& Objects.equals(statusMessage, other.statusMessage);
}
} }

View File

@@ -0,0 +1,6 @@
package com.telecominfraproject.wlan.status.equipment.models;
public enum LedStatus {
led_blink, led_off, UNKNOWN,
}

View File

@@ -197,6 +197,15 @@ components:
$ref: '#/components/schemas/StatusCode' $ref: '#/components/schemas/StatusCode'
statusMessage: statusMessage:
type: string type: string
ledStatus:
$ref: '#/components/schemas/LedStatus'
LedStatus:
type: string
enum:
- led_blink
- led_off
- UNKNOWN
StatusCode: StatusCode:
type: string type: string

View File

@@ -3474,6 +3474,15 @@ components:
$ref: '#/components/schemas/StatusCode' $ref: '#/components/schemas/StatusCode'
statusMessage: statusMessage:
type: string type: string
ledStatus:
$ref: '#/components/schemas/LedStatus'
LedStatus:
type: string
enum:
- led_blink
- led_off
- UNKNOWN
StatusCode: StatusCode:
type: string type: string
@@ -4520,6 +4529,8 @@ components:
type: boolean type: boolean
forwardMode: forwardMode:
$ref: '#/components/schemas/NetworkForwardMode' $ref: '#/components/schemas/NetworkForwardMode'
blinkAllLEDs:
type: boolean
radioMap: radioMap:
$ref: '#/components/schemas/RadioMap' $ref: '#/components/schemas/RadioMap'
advancedRadioMap: advancedRadioMap: