mirror of
https://github.com/Telecominfraproject/wlan-cloud-services.git
synced 2026-03-20 17:39:19 +00:00
Compare commits
113 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
95a07188d5 | ||
|
|
6839ff3e97 | ||
|
|
299f59767e | ||
|
|
936aeae135 | ||
|
|
5b3d05bc21 | ||
|
|
ee3c62559a | ||
|
|
d3bb9f6e51 | ||
|
|
a1ebf265f9 | ||
|
|
64b1432251 | ||
|
|
ccb7680933 | ||
|
|
e74570121c | ||
|
|
b4b697376c | ||
|
|
b57fb2dd4f | ||
|
|
d25c1d6167 | ||
|
|
57c2d7d6f4 | ||
|
|
faf0a3a385 | ||
|
|
a7a836440e | ||
|
|
999e597493 | ||
|
|
5f4ed530fe | ||
|
|
0dca8bb943 | ||
|
|
c8c7217d38 | ||
|
|
b41e35a536 | ||
|
|
64bd468ade | ||
|
|
fe488e9d5f | ||
|
|
a79778b083 | ||
|
|
d5b86d0c8d | ||
|
|
15698e99cb | ||
|
|
e06c28e85a | ||
|
|
c307f59e8a | ||
|
|
1e23a691d7 | ||
|
|
015e662e68 | ||
|
|
9f3af6773b | ||
|
|
b7eedf6b8c | ||
|
|
468e7bcddb | ||
|
|
9b712d6fb5 | ||
|
|
99475d3f2f | ||
|
|
7216b08ac7 | ||
|
|
34da98b9a8 | ||
|
|
65aeadeaa7 | ||
|
|
148a6762dc | ||
|
|
178378f8b6 | ||
|
|
d0e6866345 | ||
|
|
a2b3e711ea | ||
|
|
b5f5c6d19f | ||
|
|
a5079d04a7 | ||
|
|
35d89a1cf0 | ||
|
|
534ed3e9c0 | ||
|
|
a6ec1d6e7f | ||
|
|
a19fc425c2 | ||
|
|
fc8cab6a50 | ||
|
|
daabf38510 | ||
|
|
78c4d3a862 | ||
|
|
3f3e40d2dd | ||
|
|
91877f5305 | ||
|
|
11314e3395 | ||
|
|
fa6795369c | ||
|
|
e6e06d7b70 | ||
|
|
1e15e3cd94 | ||
|
|
02e03780db | ||
|
|
aac34150b2 | ||
|
|
3085c34cde | ||
|
|
35fd038113 | ||
|
|
7c387f1940 | ||
|
|
abb9b59659 | ||
|
|
7f0497754c | ||
|
|
82095510f7 | ||
|
|
0afd414870 | ||
|
|
772beab902 | ||
|
|
4a764db007 | ||
|
|
41add1922b | ||
|
|
90ac57b988 | ||
|
|
0cc90764c6 | ||
|
|
1e277f5650 | ||
|
|
716ba7e043 | ||
|
|
3d2f4db32a | ||
|
|
c75d44ff03 | ||
|
|
f9dbe12c8c | ||
|
|
910a2cbe0c | ||
|
|
799b243cc4 | ||
|
|
8834c33d90 | ||
|
|
e9c54a892b | ||
|
|
8353dd375f | ||
|
|
46de84b28b | ||
|
|
9edca1fd9d | ||
|
|
5714c9bf32 | ||
|
|
2b2e34a064 | ||
|
|
d7a75faf4c | ||
|
|
5fd977f064 | ||
|
|
bafec1fdd8 | ||
|
|
6b046e0a7a | ||
|
|
fb6604cdf5 | ||
|
|
2c1c60344e | ||
|
|
9e959e258f | ||
|
|
2410233046 | ||
|
|
a7f91a29f8 | ||
|
|
80cd0abd58 | ||
|
|
4555ff339b | ||
|
|
04a13877d1 | ||
|
|
e148bab291 | ||
|
|
9ad3cec4af | ||
|
|
dc0b838f83 | ||
|
|
7cac7fff3f | ||
|
|
b48340b709 | ||
|
|
44b3836758 | ||
|
|
4f0b032549 | ||
|
|
5ba0c4c242 | ||
|
|
304e80332a | ||
|
|
9fd3e73398 | ||
|
|
b9db744aee | ||
|
|
1eee65d284 | ||
|
|
75c943211a | ||
|
|
d0a0ed59fe | ||
|
|
a200fcc12e |
@@ -121,6 +121,10 @@ public class AlarmDatastoreCassandra implements AlarmDatastore {
|
||||
" from " + TABLE_NAME + " " +
|
||||
" where customerId = ? ";
|
||||
|
||||
private static final String CQL_GET_ALL =
|
||||
"select " + ALL_COLUMNS +
|
||||
" from " + TABLE_NAME + " ";
|
||||
|
||||
private static final String CQL_GET_LASTMOD_BY_ID =
|
||||
"select lastModifiedTimestamp " +
|
||||
" from "+TABLE_NAME+" " +
|
||||
@@ -791,7 +795,10 @@ public class AlarmDatastoreCassandra implements AlarmDatastore {
|
||||
long equipmentIdPostQuery = row.getLong("equipmentId");
|
||||
int alarmCodePostQuery = row.getInt("alarmCode");
|
||||
long createdTimestampPostQuery = row.getLong("createdTimestamp");
|
||||
pageItems.add(getOrNull(customerId, equipmentIdPostQuery, AlarmCode.getById(alarmCodePostQuery), createdTimestampPostQuery));
|
||||
Alarm alarmToAdd = getOrNull(customerId, equipmentIdPostQuery, AlarmCode.getById(alarmCodePostQuery), createdTimestampPostQuery);
|
||||
if (alarmToAdd != null) {
|
||||
pageItems.add(alarmToAdd);
|
||||
}
|
||||
}
|
||||
break;
|
||||
default:
|
||||
@@ -922,4 +929,51 @@ public class AlarmDatastoreCassandra implements AlarmDatastore {
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -356,4 +356,25 @@ public class AlarmDatastoreInMemory extends BaseInMemoryDatastore implements Ala
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,4 +71,14 @@ public interface AlarmDatastore {
|
||||
*/
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
@@ -113,5 +113,16 @@ public interface AlarmServiceInterface {
|
||||
* @return alarm counts for the given filters
|
||||
*/
|
||||
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);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -47,6 +47,10 @@ public class AlarmServiceLocal implements AlarmServiceInterface {
|
||||
return alarmController.getAllForEquipment(customerId, equipmentIdSet, alarmCodeSet, createdAfterTimestamp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Alarm> get(Set<AlarmCode> alarmCodeSet, long createdAfterTimestamp) {
|
||||
return alarmController.getAllForAlarmCode(alarmCodeSet, createdAfterTimestamp);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Alarm update(Alarm alarm) {
|
||||
|
||||
@@ -64,6 +64,5 @@
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -241,14 +241,45 @@ public class AlarmServiceRemote extends BaseRemoteClient implements AlarmService
|
||||
|
||||
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?alarmCode={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() {
|
||||
if(baseUrl==null) {
|
||||
baseUrl = environment.getProperty("tip.wlan.alarmServiceBaseUrl").trim()+"/api/alarm";
|
||||
}
|
||||
|
||||
return baseUrl;
|
||||
return baseUrl;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>alarm-service</artifactId>
|
||||
<name>alarm-service</name>
|
||||
<description>Server side implementation of the service.</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<artifactId>base-container</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>cloud-event-dispatcher-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>alarm-models</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>alarm-datastore-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>equipment-service-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>alarm-datastore-inmemory</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>equipment-service-local</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>equipment-datastore-inmemory</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<artifactId>alarm-service</artifactId>
|
||||
<name>alarm-service</name>
|
||||
<description>Server side implementation of the service.</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<artifactId>base-container</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>cloud-event-dispatcher-empty</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>cloud-event-dispatcher-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<dependency>
|
||||
<artifactId>alarm-models</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>alarm-datastore-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>equipment-service-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>alarm-datastore-inmemory</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>equipment-service-local</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>equipment-datastore-inmemory</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>cloud-event-dispatcher-empty</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -129,6 +129,24 @@ public class AlarmController {
|
||||
throw exp;
|
||||
}
|
||||
}
|
||||
|
||||
@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)
|
||||
public PaginationResponse<Alarm> getForCustomer(@RequestParam int customerId,
|
||||
|
||||
@@ -349,12 +349,6 @@
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>equipment-alarms-sp</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>adoption-metrics-sp</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
|
||||
@@ -31,7 +31,6 @@ import com.telecominfraproject.wlan.client.models.Client;
|
||||
import com.telecominfraproject.wlan.client.session.models.ClientDhcpDetails;
|
||||
import com.telecominfraproject.wlan.client.session.models.ClientSession;
|
||||
import com.telecominfraproject.wlan.client.session.models.ClientSessionDetails;
|
||||
import com.telecominfraproject.wlan.client.session.models.ClientSessionMetricDetails;
|
||||
import com.telecominfraproject.wlan.core.model.entity.CountryCode;
|
||||
import com.telecominfraproject.wlan.core.model.entity.MinMaxAvgValueInt;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.EquipmentType;
|
||||
@@ -811,10 +810,10 @@ public class AllInOneWithGatewayStartListener implements ApplicationRunner {
|
||||
sessionDetails.setRadioType(radioType);
|
||||
sessionDetails.setSecurityType(SecurityType.PSK);
|
||||
sessionDetails.setSsid(ssidConfig.getSsid());
|
||||
sessionDetails.setSessionId(System.currentTimeMillis());
|
||||
sessionDetails.setSessionId(Long.toUnsignedString(System.currentTimeMillis()));
|
||||
sessionDetails.setAssocTimestamp(System.currentTimeMillis() - getRandomLong(10000, 1000000));
|
||||
|
||||
ClientDhcpDetails dhcpDetails = new ClientDhcpDetails(System.currentTimeMillis());
|
||||
ClientDhcpDetails dhcpDetails = new ClientDhcpDetails(Long.toUnsignedString(System.currentTimeMillis()));
|
||||
dhcpDetails.setLeaseStartTimestamp(System.currentTimeMillis() - getRandomLong(0, TimeUnit.HOURS.toMillis(4)));
|
||||
dhcpDetails.setLeaseTimeInSeconds((int)TimeUnit.HOURS.toSeconds(4));
|
||||
try {
|
||||
@@ -829,16 +828,6 @@ public class AllInOneWithGatewayStartListener implements ApplicationRunner {
|
||||
|
||||
sessionDetails.setDhcpDetails(dhcpDetails );
|
||||
|
||||
ClientSessionMetricDetails metricDetails = new ClientSessionMetricDetails();
|
||||
metricDetails.setRssi(getRandomInt(-60, -40));
|
||||
metricDetails.setRxBytes(getRandomLong(10000, 10000000));
|
||||
metricDetails.setTxBytes(getRandomLong(10000, 10000000));
|
||||
metricDetails.setRxMbps(getRandomFloat(50, 100));
|
||||
metricDetails.setTxMbps(getRandomFloat(50, 100));
|
||||
metricDetails.setSnr(getRandomInt(-90, -50));
|
||||
|
||||
sessionDetails.setMetricDetails(metricDetails);
|
||||
|
||||
clientSession.setDetails(sessionDetails);
|
||||
|
||||
this.clientServiceInterface.updateSession(clientSession);
|
||||
|
||||
@@ -250,12 +250,6 @@
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>equipment-alarms-sp</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>adoption-metrics-sp</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
|
||||
@@ -336,12 +336,6 @@
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>equipment-alarms-sp</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>adoption-metrics-sp</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
|
||||
@@ -1,14 +1,11 @@
|
||||
package com.telecominfraproject.wlan.startuptasks;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.IOException;
|
||||
import java.net.Inet4Address;
|
||||
import java.net.Inet6Address;
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.NoSuchFileException;
|
||||
import java.nio.file.Path;
|
||||
import java.nio.file.Paths;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
@@ -41,7 +38,6 @@ import com.telecominfraproject.wlan.client.models.Client;
|
||||
import com.telecominfraproject.wlan.client.session.models.ClientDhcpDetails;
|
||||
import com.telecominfraproject.wlan.client.session.models.ClientSession;
|
||||
import com.telecominfraproject.wlan.client.session.models.ClientSessionDetails;
|
||||
import com.telecominfraproject.wlan.client.session.models.ClientSessionMetricDetails;
|
||||
import com.telecominfraproject.wlan.core.model.entity.CountryCode;
|
||||
import com.telecominfraproject.wlan.core.model.entity.MinMaxAvgValueInt;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.EquipmentType;
|
||||
@@ -1241,8 +1237,6 @@ public class AllInOneStartListener implements ApplicationRunner {
|
||||
clientMetrics.setNumRxBytes(getRandomLong(3000000, 7000000));
|
||||
clientMetrics.setNumTxBytes(getRandomLong(3000000, 7000000));
|
||||
|
||||
clientMetrics.setSessionId(getRandomLong(3000000, 7000000));
|
||||
|
||||
clientMetrics.setTxRetries(getRandomInt(30, 70));
|
||||
clientMetrics.setRxDuplicatePackets(getRandomInt(30, 70));
|
||||
clientMetrics.setSnr(getRandomInt(-70, -30));
|
||||
@@ -1268,8 +1262,6 @@ public class AllInOneStartListener implements ApplicationRunner {
|
||||
clientMetrics.setNumRxBytes(getRandomLong(3000000, 7000000));
|
||||
clientMetrics.setNumTxBytes(getRandomLong(3000000, 7000000));
|
||||
|
||||
clientMetrics.setSessionId(getRandomLong(3000000, 7000000));
|
||||
|
||||
clientMetrics.setTxRetries(getRandomInt(30, 70));
|
||||
clientMetrics.setRxDuplicatePackets(getRandomInt(30, 70));
|
||||
clientMetrics.setSnr(getRandomInt(-70, -30));
|
||||
@@ -1295,8 +1287,6 @@ public class AllInOneStartListener implements ApplicationRunner {
|
||||
clientMetrics.setNumRxBytes(getRandomLong(3000000, 7000000));
|
||||
clientMetrics.setNumTxBytes(getRandomLong(3000000, 7000000));
|
||||
|
||||
clientMetrics.setSessionId(getRandomLong(3000000, 7000000));
|
||||
|
||||
clientMetrics.setTxRetries(getRandomInt(30, 70));
|
||||
clientMetrics.setRxDuplicatePackets(getRandomInt(30, 70));
|
||||
clientMetrics.setSnr(getRandomInt(-70, -30));
|
||||
@@ -1364,10 +1354,10 @@ public class AllInOneStartListener implements ApplicationRunner {
|
||||
sessionDetails.setRadioType(radioType);
|
||||
sessionDetails.setSecurityType(SecurityType.PSK);
|
||||
sessionDetails.setSsid(ssidConfig.getSsid());
|
||||
sessionDetails.setSessionId(System.currentTimeMillis());
|
||||
sessionDetails.setSessionId(Long.toUnsignedString(System.currentTimeMillis()));
|
||||
sessionDetails.setAssocTimestamp(System.currentTimeMillis() - getRandomLong(10000, 1000000));
|
||||
|
||||
ClientDhcpDetails dhcpDetails = new ClientDhcpDetails(System.currentTimeMillis());
|
||||
ClientDhcpDetails dhcpDetails = new ClientDhcpDetails(Long.toUnsignedString(System.currentTimeMillis()));
|
||||
dhcpDetails
|
||||
.setLeaseStartTimestamp(System.currentTimeMillis() - getRandomLong(0, TimeUnit.HOURS.toMillis(4)));
|
||||
dhcpDetails.setLeaseTimeInSeconds((int) TimeUnit.HOURS.toSeconds(4));
|
||||
@@ -1383,16 +1373,6 @@ public class AllInOneStartListener implements ApplicationRunner {
|
||||
|
||||
sessionDetails.setDhcpDetails(dhcpDetails);
|
||||
|
||||
ClientSessionMetricDetails metricDetails = new ClientSessionMetricDetails();
|
||||
metricDetails.setRssi(getRandomInt(-60, -40));
|
||||
metricDetails.setRxBytes(getRandomLong(10000, 10000000));
|
||||
metricDetails.setTxBytes(getRandomLong(10000, 10000000));
|
||||
metricDetails.setRxMbps(getRandomFloat(50, 100));
|
||||
metricDetails.setTxMbps(getRandomFloat(50, 100));
|
||||
metricDetails.setSnr(getRandomInt(-90, -50));
|
||||
|
||||
sessionDetails.setMetricDetails(metricDetails);
|
||||
|
||||
clientSession.setDetails(sessionDetails);
|
||||
|
||||
this.clientServiceInterface.updateSession(clientSession);
|
||||
|
||||
@@ -517,26 +517,52 @@ public class ClientDatastoreInMemory extends BaseInMemoryDatastore implements Cl
|
||||
@Override
|
||||
public ClientSessionCounts getSessionCounts(int customerId) {
|
||||
ClientSessionCounts counts = new ClientSessionCounts();
|
||||
int totalCount = 0;
|
||||
Map<String, Integer> perOuiMap = new HashMap<>();
|
||||
counts.setCustomerId(customerId);
|
||||
|
||||
long totalCount = 0;
|
||||
Map<String, Long> perEquipmentMap = new HashMap<>();
|
||||
Map<String, Long> perOuiMap = new HashMap<>();
|
||||
Map<String, Long> perRadioMap = new HashMap<>();
|
||||
|
||||
for (ClientSession session : idToClientSessionMap.values()) {
|
||||
if (session.getCustomerId() == customerId) {
|
||||
totalCount++;
|
||||
String equipmentIdString = Long.toString(session.getEquipmentId());
|
||||
Long cnt = perEquipmentMap.get(equipmentIdString);
|
||||
if (cnt == null) {
|
||||
cnt = 0L;
|
||||
} else {
|
||||
cnt++;
|
||||
}
|
||||
perEquipmentMap.put(equipmentIdString, cnt);
|
||||
|
||||
if (session.getOui() != null) {
|
||||
Integer cnt = perOuiMap.get(session.getOui());
|
||||
cnt = perOuiMap.get(session.getOui());
|
||||
if (cnt == null) {
|
||||
cnt = 0;
|
||||
cnt = 0L;
|
||||
} else {
|
||||
cnt++;
|
||||
}
|
||||
perOuiMap.put(session.getOui(), cnt);
|
||||
}
|
||||
|
||||
if (session.getDetails() != null && session.getDetails().getRadioType() != null) {
|
||||
String radioTypeString = session.getDetails().getRadioType().toString();
|
||||
cnt = perRadioMap.get(radioTypeString);
|
||||
if (cnt == null) {
|
||||
cnt = 0L;
|
||||
} else {
|
||||
cnt++;
|
||||
}
|
||||
perRadioMap.put(radioTypeString, cnt);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
counts.setTotalCount(totalCount);
|
||||
counts.setEquipmentCounts(perEquipmentMap);
|
||||
counts.setOuiCounts(perOuiMap);
|
||||
counts.setRadioCounts(perRadioMap);
|
||||
return counts;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,38 +7,84 @@ import java.util.Map;
|
||||
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
|
||||
|
||||
/**
|
||||
* Total and per-oui counts of the Client Sessions
|
||||
* Total and per-oui/equipment/radio counts of the Client Sessions
|
||||
*/
|
||||
public class ClientSessionCounts extends BaseJsonModel {
|
||||
|
||||
private static final long serialVersionUID = 7697349699510565184L;
|
||||
|
||||
private int totalCount;
|
||||
private Map<String, Integer> ouiCounts = new HashMap<>();
|
||||
private int customerId;
|
||||
/**
|
||||
* Total count of all client sessions for the customer Id.
|
||||
*/
|
||||
private long totalCount;
|
||||
/**
|
||||
* Counts of client sessions per equipment Id.
|
||||
*/
|
||||
private Map<String, Long> equipmentCounts = new HashMap<>();
|
||||
/**
|
||||
* Counts of client sessions per OUI.
|
||||
*/
|
||||
private Map<String, Long> ouiCounts = new HashMap<>();
|
||||
/**
|
||||
* Counts of client sessions per Radio Type.
|
||||
*/
|
||||
private Map<String, Long> radioCounts = new HashMap<>();
|
||||
|
||||
public Map<String, Integer> getOuiCounts() {
|
||||
return ouiCounts;
|
||||
public int getCustomerId() {
|
||||
return customerId;
|
||||
}
|
||||
|
||||
public void setOuiCounts(Map<String, Integer> ouiCounts) {
|
||||
this.ouiCounts = ouiCounts;
|
||||
public void setCustomerId(int customerId) {
|
||||
this.customerId = customerId;
|
||||
}
|
||||
|
||||
public int getTotalCount() {
|
||||
public long getTotalCount() {
|
||||
return totalCount;
|
||||
}
|
||||
|
||||
public void setTotalCount(int totalCount) {
|
||||
public void setTotalCount(long totalCount) {
|
||||
this.totalCount = totalCount;
|
||||
}
|
||||
|
||||
public Map<String, Long> getEquipmentCounts() {
|
||||
return equipmentCounts;
|
||||
}
|
||||
|
||||
public void setEquipmentCounts(Map<String, Long> equipmentCounts) {
|
||||
this.equipmentCounts = equipmentCounts;
|
||||
}
|
||||
|
||||
public Map<String, Long> getOuiCounts() {
|
||||
return ouiCounts;
|
||||
}
|
||||
|
||||
public void setOuiCounts(Map<String, Long> ouiCounts) {
|
||||
this.ouiCounts = ouiCounts;
|
||||
}
|
||||
|
||||
public Map<String, Long> getRadioCounts() {
|
||||
return radioCounts;
|
||||
}
|
||||
|
||||
public void setRadioCounts(Map<String, Long> radioCounts) {
|
||||
this.radioCounts = radioCounts;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClientSessionCounts clone() {
|
||||
ClientSessionCounts ret = (ClientSessionCounts) super.clone();
|
||||
if (equipmentCounts != null) {
|
||||
ret.equipmentCounts = new HashMap<>(equipmentCounts);
|
||||
}
|
||||
if (ouiCounts != null) {
|
||||
ret.ouiCounts = new HashMap<>(ouiCounts);
|
||||
}
|
||||
if (radioCounts != null) {
|
||||
ret.radioCounts = new HashMap<>(radioCounts);
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ import com.telecominfraproject.wlan.systemevent.equipment.realtime.RealTimeEvent
|
||||
public class ClientAssocEvent extends RealTimeEvent implements HasClientMac {
|
||||
private static final long serialVersionUID = 7015822981315570338L;
|
||||
|
||||
private long sessionId;
|
||||
private String sessionId;
|
||||
private String ssid;
|
||||
private MacAddress clientMacAddress;
|
||||
private RadioType radioType;
|
||||
@@ -29,7 +29,7 @@ public class ClientAssocEvent extends RealTimeEvent implements HasClientMac {
|
||||
|
||||
}
|
||||
|
||||
public ClientAssocEvent(int customerId, long locationId, long equipmentId, long timestamp, long sessionId, String ssid,
|
||||
public ClientAssocEvent(int customerId, long locationId, long equipmentId, long timestamp, String sessionId, String ssid,
|
||||
MacAddress clientMacAddress, RadioType radioType, boolean isReassociation, WlanStatusCode status,
|
||||
Integer internalSC, Integer rssi) {
|
||||
super(RealTimeEventType.STA_Client_Assoc, customerId, locationId, equipmentId, timestamp);
|
||||
@@ -50,7 +50,7 @@ public class ClientAssocEvent extends RealTimeEvent implements HasClientMac {
|
||||
/**
|
||||
* @return the sessionId
|
||||
*/
|
||||
public long getSessionId() {
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class ClientAssocEvent extends RealTimeEvent implements HasClientMac {
|
||||
* @param sessionId
|
||||
* the sessionId to set
|
||||
*/
|
||||
public void setSessionId(long sessionId) {
|
||||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ public class ClientAuthEvent extends RealTimeEvent implements HasClientMac {
|
||||
|
||||
private static final long serialVersionUID = 1221389696911864515L;
|
||||
|
||||
private long sessionId;
|
||||
private String sessionId;
|
||||
private String ssid;
|
||||
private MacAddress clientMacAddress;
|
||||
private WlanStatusCode authStatus;
|
||||
@@ -32,11 +32,11 @@ public class ClientAuthEvent extends RealTimeEvent implements HasClientMac {
|
||||
super(eventType, timestamp);
|
||||
}
|
||||
|
||||
public long getSessionId() {
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public void setSessionId(long sessionId) {
|
||||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ public class ClientConnectSuccessEvent extends RealTimeEvent implements HasClien
|
||||
|
||||
private static final long serialVersionUID = -6082134146801575193L;
|
||||
private MacAddress clientMacAddress;
|
||||
private long sessionId;
|
||||
private String sessionId;
|
||||
private RadioType radioType;
|
||||
private boolean isReassociation;
|
||||
private String ssid;
|
||||
@@ -61,7 +61,7 @@ public class ClientConnectSuccessEvent extends RealTimeEvent implements HasClien
|
||||
/**
|
||||
* @return the sessionId
|
||||
*/
|
||||
public long getSessionId() {
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ public class ClientConnectSuccessEvent extends RealTimeEvent implements HasClien
|
||||
* @param sessionId
|
||||
* the sessionId to set
|
||||
*/
|
||||
public void setSessionId(long sessionId) {
|
||||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
|
||||
@@ -45,7 +45,7 @@ public class ClientDisconnectEvent extends RealTimeEvent implements HasClientMac
|
||||
}
|
||||
|
||||
private static final long serialVersionUID = -7674230178565760938L;
|
||||
private long sessionId;
|
||||
private String sessionId;
|
||||
private byte[] macAddressBytes;
|
||||
private MacAddress clientMacAddress;
|
||||
private long lastRecvTime;
|
||||
@@ -104,7 +104,7 @@ public class ClientDisconnectEvent extends RealTimeEvent implements HasClientMac
|
||||
return rssi;
|
||||
}
|
||||
|
||||
public long getSessionId() {
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
@@ -148,7 +148,7 @@ public class ClientDisconnectEvent extends RealTimeEvent implements HasClientMac
|
||||
this.rssi = rssi;
|
||||
}
|
||||
|
||||
public void setSessionId(long sessionId) {
|
||||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ import com.telecominfraproject.wlan.systemevent.equipment.realtime.RealTimeEvent
|
||||
public class ClientFailureEvent extends RealTimeEvent implements HasClientMac {
|
||||
private static final long serialVersionUID = -16021752050335131L;
|
||||
|
||||
private long sessionId;
|
||||
private String sessionId;
|
||||
private String ssid;
|
||||
private MacAddress clientMacAddress;
|
||||
private WlanReasonCode reasonCode;
|
||||
@@ -38,11 +38,11 @@ public class ClientFailureEvent extends RealTimeEvent implements HasClientMac {
|
||||
this.clientMacAddress = clientMacAddress;
|
||||
}
|
||||
|
||||
public long getSessionId() {
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public void setSessionId(long sessionId) {
|
||||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.telecominfraproject.wlan.systemevent.equipment.realtime.RealTimeEvent
|
||||
public class ClientFirstDataEvent extends RealTimeEvent implements HasClientMac {
|
||||
|
||||
private static final long serialVersionUID = 298223061973506469L;
|
||||
private long sessionId;
|
||||
private String sessionId;
|
||||
private MacAddress clientMacAddress;
|
||||
private long firstDataRcvdTs;
|
||||
private long firstDataSentTs;
|
||||
@@ -28,11 +28,11 @@ public class ClientFirstDataEvent extends RealTimeEvent implements HasClientMac
|
||||
super(eventType, timestamp);
|
||||
}
|
||||
|
||||
public long getSessionId() {
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public void setSessionId(long sessionId) {
|
||||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.telecominfraproject.wlan.client.models.events.realtime;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
|
||||
import com.telecominfraproject.wlan.core.model.json.interfaces.HasClientMac;
|
||||
@@ -10,7 +11,7 @@ import com.telecominfraproject.wlan.systemevent.equipment.realtime.RealTimeEvent
|
||||
public class ClientIdEvent extends RealTimeEvent implements HasClientMac {
|
||||
|
||||
private static final long serialVersionUID = 298223061973506469L;
|
||||
private long sessionId;
|
||||
private String sessionId;
|
||||
private byte[] macAddressBytes;
|
||||
private MacAddress clientMacAddress;
|
||||
private String userId;
|
||||
@@ -27,7 +28,7 @@ public class ClientIdEvent extends RealTimeEvent implements HasClientMac {
|
||||
/**
|
||||
* @return the sessionId
|
||||
*/
|
||||
public long getSessionId() {
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
@@ -35,7 +36,7 @@ public class ClientIdEvent extends RealTimeEvent implements HasClientMac {
|
||||
* @param sessionId
|
||||
* the sessionId to set
|
||||
*/
|
||||
public void setSessionId(long sessionId) {
|
||||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
@@ -65,58 +66,28 @@ public class ClientIdEvent extends RealTimeEvent implements HasClientMac {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#hashCode()
|
||||
*/
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + Arrays.hashCode(macAddressBytes);
|
||||
result = prime * result + (int) (sessionId ^ (sessionId >>> 32));
|
||||
result = prime * result + ((userId == null) ? 0 : userId.hashCode());
|
||||
result = prime * result + ((clientMacAddress == null) ? 0 : clientMacAddress.hashCode());
|
||||
result = prime * result + Objects.hash(clientMacAddress, sessionId, userId);
|
||||
return result;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see java.lang.Object#equals(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
if (!super.equals(obj))
|
||||
return false;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
}
|
||||
if (!(obj instanceof ClientIdEvent)) {
|
||||
return false;
|
||||
}
|
||||
ClientIdEvent other = (ClientIdEvent) obj;
|
||||
if (!Arrays.equals(macAddressBytes, other.macAddressBytes))
|
||||
return false;
|
||||
if (sessionId != other.sessionId)
|
||||
return false;
|
||||
if (userId == null) {
|
||||
if (other.userId != null)
|
||||
return false;
|
||||
} else if (!userId.equals(other.userId))
|
||||
return false;
|
||||
if (clientMacAddress == null) {
|
||||
if (other.clientMacAddress != null)
|
||||
return false;
|
||||
} else if (!clientMacAddress.equals(other.clientMacAddress))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
return Objects.equals(clientMacAddress, other.clientMacAddress) && Arrays.equals(macAddressBytes, other.macAddressBytes)
|
||||
&& Objects.equals(sessionId, other.sessionId) && Objects.equals(userId, other.userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.telecominfraproject.wlan.client.models.events.realtime;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.net.InetAddress;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
|
||||
@@ -12,9 +12,9 @@ public class ClientIpAddressEvent extends RealTimeEvent implements HasClientMac
|
||||
|
||||
private static final long serialVersionUID = -5332534925768685589L;
|
||||
|
||||
private long sessionId;
|
||||
private String sessionId;
|
||||
private MacAddress clientMacAddress;
|
||||
private byte[] ipAddr;
|
||||
private InetAddress ipAddr;
|
||||
|
||||
public ClientIpAddressEvent() {
|
||||
// serialization
|
||||
@@ -29,11 +29,11 @@ public class ClientIpAddressEvent extends RealTimeEvent implements HasClientMac
|
||||
super(eventType, timestamp);
|
||||
}
|
||||
|
||||
public long getSessionId() {
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public void setSessionId(long sessionId) {
|
||||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
@@ -45,11 +45,11 @@ public class ClientIpAddressEvent extends RealTimeEvent implements HasClientMac
|
||||
this.clientMacAddress = clientMacAddress;
|
||||
}
|
||||
|
||||
public byte[] getIpAddr() {
|
||||
public InetAddress getIpAddr() {
|
||||
return ipAddr;
|
||||
}
|
||||
|
||||
public void setIpAddr(byte[] ipAddr) {
|
||||
public void setIpAddr(InetAddress ipAddr) {
|
||||
this.ipAddr = ipAddr;
|
||||
}
|
||||
|
||||
@@ -57,8 +57,7 @@ public class ClientIpAddressEvent extends RealTimeEvent implements HasClientMac
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + Arrays.hashCode(this.ipAddr);
|
||||
result = prime * result + Objects.hash(clientMacAddress, sessionId);
|
||||
result = prime * result + Objects.hash(ipAddr, clientMacAddress, sessionId);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -74,7 +73,7 @@ public class ClientIpAddressEvent extends RealTimeEvent implements HasClientMac
|
||||
return false;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ public class ClientTimeoutEvent extends RealTimeEvent implements HasClientMac {
|
||||
}
|
||||
}
|
||||
|
||||
private long sessionId;
|
||||
private String sessionId;
|
||||
private MacAddress clientMacAddress;
|
||||
private long lastRecvTime;
|
||||
private long lastSentTime;
|
||||
@@ -45,11 +45,11 @@ public class ClientTimeoutEvent extends RealTimeEvent implements HasClientMac {
|
||||
super(eventType, timestamp);
|
||||
}
|
||||
|
||||
public long getSessionId() {
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public void setSessionId(long sessionId) {
|
||||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.telecominfraproject.wlan.client.session.models;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.telecominfraproject.wlan.core.model.equipment.WiFiSessionUtility;
|
||||
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
|
||||
@@ -29,10 +30,9 @@ public class ClientDhcpDetails extends BaseJsonModel {
|
||||
/**
|
||||
* Identifies the association where DHCP last occurred.
|
||||
*/
|
||||
private long associationId;
|
||||
private String associationId;
|
||||
|
||||
|
||||
public ClientDhcpDetails(long sessionId) {
|
||||
public ClientDhcpDetails(String sessionId) {
|
||||
this.associationId = sessionId;
|
||||
}
|
||||
|
||||
@@ -101,10 +101,10 @@ public class ClientDhcpDetails extends BaseJsonModel {
|
||||
this.firstDiscoverTimestamp = firstDiscoverTimestamp;
|
||||
}
|
||||
|
||||
public long getAssociationId() {
|
||||
public String getAssociationId() {
|
||||
return associationId;
|
||||
}
|
||||
public void setAssociationId(Long associationId) {
|
||||
public void setAssociationId(String associationId) {
|
||||
this.associationId = associationId;
|
||||
}
|
||||
|
||||
@@ -116,123 +116,6 @@ public class ClientDhcpDetails extends BaseJsonModel {
|
||||
this.nakTimestamp = nakTimestamp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (int) (associationId ^ (associationId >>> 32));
|
||||
result = prime * result + ((dhcpServerIp == null) ? 0 : dhcpServerIp.hashCode());
|
||||
result = prime * result + ((firstDiscoverTimestamp == null) ? 0 : firstDiscoverTimestamp.hashCode());
|
||||
result = prime * result + ((firstOfferTimestamp == null) ? 0 : firstOfferTimestamp.hashCode());
|
||||
result = prime * result + ((firstRequestTimestamp == null) ? 0 : firstRequestTimestamp.hashCode());
|
||||
result = prime * result + (fromInternal ? 1231 : 1237);
|
||||
result = prime * result + ((gatewayIp == null) ? 0 : gatewayIp.hashCode());
|
||||
result = prime * result + ((leaseStartTimestamp == null) ? 0 : leaseStartTimestamp.hashCode());
|
||||
result = prime * result + ((leaseTimeInSeconds == null) ? 0 : leaseTimeInSeconds.hashCode());
|
||||
result = prime * result + ((nakTimestamp == null) ? 0 : nakTimestamp.hashCode());
|
||||
result = prime * result + ((primaryDns == null) ? 0 : primaryDns.hashCode());
|
||||
result = prime * result + ((secondaryDns == null) ? 0 : secondaryDns.hashCode());
|
||||
result = prime * result + ((subnetMask == null) ? 0 : subnetMask.hashCode());
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!(obj instanceof ClientDhcpDetails)) {
|
||||
return false;
|
||||
}
|
||||
ClientDhcpDetails other = (ClientDhcpDetails) obj;
|
||||
if (associationId != other.associationId) {
|
||||
return false;
|
||||
}
|
||||
if (dhcpServerIp == null) {
|
||||
if (other.dhcpServerIp != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!dhcpServerIp.equals(other.dhcpServerIp)) {
|
||||
return false;
|
||||
}
|
||||
if (firstDiscoverTimestamp == null) {
|
||||
if (other.firstDiscoverTimestamp != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!firstDiscoverTimestamp.equals(other.firstDiscoverTimestamp)) {
|
||||
return false;
|
||||
}
|
||||
if (firstOfferTimestamp == null) {
|
||||
if (other.firstOfferTimestamp != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!firstOfferTimestamp.equals(other.firstOfferTimestamp)) {
|
||||
return false;
|
||||
}
|
||||
if (firstRequestTimestamp == null) {
|
||||
if (other.firstRequestTimestamp != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!firstRequestTimestamp.equals(other.firstRequestTimestamp)) {
|
||||
return false;
|
||||
}
|
||||
if (fromInternal != other.fromInternal) {
|
||||
return false;
|
||||
}
|
||||
if (gatewayIp == null) {
|
||||
if (other.gatewayIp != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!gatewayIp.equals(other.gatewayIp)) {
|
||||
return false;
|
||||
}
|
||||
if (leaseStartTimestamp == null) {
|
||||
if (other.leaseStartTimestamp != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!leaseStartTimestamp.equals(other.leaseStartTimestamp)) {
|
||||
return false;
|
||||
}
|
||||
if (leaseTimeInSeconds == null) {
|
||||
if (other.leaseTimeInSeconds != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!leaseTimeInSeconds.equals(other.leaseTimeInSeconds)) {
|
||||
return false;
|
||||
}
|
||||
if (nakTimestamp == null) {
|
||||
if (other.nakTimestamp != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!nakTimestamp.equals(other.nakTimestamp)) {
|
||||
return false;
|
||||
}
|
||||
if (primaryDns == null) {
|
||||
if (other.primaryDns != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!primaryDns.equals(other.primaryDns)) {
|
||||
return false;
|
||||
}
|
||||
if (secondaryDns == null) {
|
||||
if (other.secondaryDns != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!secondaryDns.equals(other.secondaryDns)) {
|
||||
return false;
|
||||
}
|
||||
if (subnetMask == null) {
|
||||
if (other.subnetMask != null) {
|
||||
return false;
|
||||
}
|
||||
} else if (!subnetMask.equals(other.subnetMask)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClientDhcpDetails clone() {
|
||||
ClientDhcpDetails ret = (ClientDhcpDetails) super.clone();
|
||||
@@ -241,8 +124,7 @@ public class ClientDhcpDetails extends BaseJsonModel {
|
||||
|
||||
public void mergeDetails(ClientDhcpDetails other) {
|
||||
if(other == null) return;
|
||||
|
||||
if(WiFiSessionUtility.decodeWiFiAssociationId(other.associationId)>WiFiSessionUtility.decodeWiFiAssociationId(associationId)) {
|
||||
if(WiFiSessionUtility.decodeWiFiAssociationId(Long.parseUnsignedLong(other.associationId))>WiFiSessionUtility.decodeWiFiAssociationId(Long.parseUnsignedLong(associationId))) {
|
||||
// The other dhcp details are from a newer session and so everything must be reset.
|
||||
this.dhcpServerIp = null;
|
||||
this.firstDiscoverTimestamp = null;
|
||||
@@ -258,8 +140,7 @@ public class ClientDhcpDetails extends BaseJsonModel {
|
||||
this.associationId = other.associationId;
|
||||
this.fromInternal = false;
|
||||
}
|
||||
else if(other.associationId != associationId) {
|
||||
// other is older, ignore it
|
||||
if(!Objects.equals(this.associationId, other.associationId)) {
|
||||
return;
|
||||
}
|
||||
dhcpServerIp = (InetAddress) assignOtherIfOtherNotNull(dhcpServerIp, other.dhcpServerIp);
|
||||
@@ -305,4 +186,28 @@ public class ClientDhcpDetails extends BaseJsonModel {
|
||||
this.fromInternal = fromInternal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(associationId, dhcpServerIp, firstDiscoverTimestamp, firstOfferTimestamp, firstRequestTimestamp, fromInternal, gatewayIp,
|
||||
leaseStartTimestamp, leaseTimeInSeconds, nakTimestamp, primaryDns, secondaryDns, subnetMask);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ClientDhcpDetails other = (ClientDhcpDetails) obj;
|
||||
return Objects.equals(associationId, other.associationId) && Objects.equals(dhcpServerIp, other.dhcpServerIp)
|
||||
&& Objects.equals(firstDiscoverTimestamp, other.firstDiscoverTimestamp) && Objects.equals(firstOfferTimestamp, other.firstOfferTimestamp)
|
||||
&& Objects.equals(firstRequestTimestamp, other.firstRequestTimestamp) && fromInternal == other.fromInternal
|
||||
&& Objects.equals(gatewayIp, other.gatewayIp) && Objects.equals(leaseStartTimestamp, other.leaseStartTimestamp)
|
||||
&& Objects.equals(leaseTimeInSeconds, other.leaseTimeInSeconds) && Objects.equals(nakTimestamp, other.nakTimestamp)
|
||||
&& Objects.equals(primaryDns, other.primaryDns) && Objects.equals(secondaryDns, other.secondaryDns)
|
||||
&& Objects.equals(subnetMask, other.subnetMask);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ public class ClientSessionDetails extends BaseJsonModel {
|
||||
|
||||
private static final long serialVersionUID = -7714023056859882994L;
|
||||
|
||||
private long sessionId;
|
||||
private String sessionId;
|
||||
private Long authTimestamp;
|
||||
private Long assocTimestamp;
|
||||
private Integer assocInternalSC;
|
||||
@@ -42,7 +42,6 @@ public class ClientSessionDetails extends BaseJsonModel {
|
||||
private String cpUsername;
|
||||
private ClientDhcpDetails dhcpDetails;
|
||||
private ClientEapDetails eapDetails;
|
||||
private ClientSessionMetricDetails metricDetails;
|
||||
private Boolean isReassociation;
|
||||
private Integer disconnectByApReasonCode;
|
||||
private Integer disconnectByClientReasonCode;
|
||||
@@ -54,22 +53,22 @@ public class ClientSessionDetails extends BaseJsonModel {
|
||||
private Boolean is11VUsed;
|
||||
private SecurityType securityType;
|
||||
private SteerType steerType;
|
||||
private Long previousValidSessionId;
|
||||
private String previousValidSessionId;
|
||||
private ClientFailureDetails lastFailureDetails;
|
||||
private ClientFailureDetails firstFailureDetails;
|
||||
private Integer associationStatus;
|
||||
private Integer dynamicVlan;
|
||||
private Integer assocRssi;
|
||||
private Long priorSessionId;
|
||||
private String priorSessionId;
|
||||
private Long priorEquipmentId;
|
||||
private String classificationName;
|
||||
private AssociationState associationState;
|
||||
|
||||
public long getSessionId() {
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public void setSessionId(long sessionId) {
|
||||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
@@ -154,12 +153,6 @@ public class ClientSessionDetails extends BaseJsonModel {
|
||||
}
|
||||
|
||||
public Long getLastEventTimestamp() {
|
||||
if (getMetricDetails() != null) {
|
||||
if (lastEventTimestamp != null) {
|
||||
return Math.max(getMetricDetails().getLastMetricTimestamp(), lastEventTimestamp);
|
||||
}
|
||||
return getMetricDetails().getLastMetricTimestamp();
|
||||
}
|
||||
return lastEventTimestamp;
|
||||
}
|
||||
|
||||
@@ -192,13 +185,7 @@ public class ClientSessionDetails extends BaseJsonModel {
|
||||
}
|
||||
|
||||
public Long getLastRxTimestamp() {
|
||||
if (lastRxTimestamp != null && getMetricDetails() != null && getMetricDetails().getLastRxTimestamp() != null) {
|
||||
return Math.max(lastRxTimestamp, getMetricDetails().getLastRxTimestamp());
|
||||
} else if (lastRxTimestamp != null) {
|
||||
return lastRxTimestamp;
|
||||
}
|
||||
|
||||
return getMetricDetails() == null ? null : getMetricDetails().getLastRxTimestamp();
|
||||
return lastRxTimestamp;
|
||||
}
|
||||
|
||||
public void setLastRxTimestamp(Long lastRxTimestamp) {
|
||||
@@ -206,12 +193,7 @@ public class ClientSessionDetails extends BaseJsonModel {
|
||||
}
|
||||
|
||||
public Long getLastTxTimestamp() {
|
||||
if (lastTxTimestamp != null && getMetricDetails() != null && getMetricDetails().getLastTxTimestamp() != null) {
|
||||
return Math.max(lastTxTimestamp, getMetricDetails().getLastTxTimestamp());
|
||||
} else if (lastTxTimestamp != null) {
|
||||
return lastTxTimestamp;
|
||||
}
|
||||
return getMetricDetails() == null ? null : getMetricDetails().getLastTxTimestamp();
|
||||
return lastTxTimestamp;
|
||||
}
|
||||
|
||||
public void setLastTxTimestamp(Long lastTxTimestamp) {
|
||||
@@ -257,14 +239,6 @@ public class ClientSessionDetails extends BaseJsonModel {
|
||||
this.eapDetails = eapDetails;
|
||||
}
|
||||
|
||||
public ClientSessionMetricDetails getMetricDetails() {
|
||||
return metricDetails;
|
||||
}
|
||||
|
||||
public void setMetricDetails(ClientSessionMetricDetails metricDetails) {
|
||||
this.metricDetails = metricDetails;
|
||||
}
|
||||
|
||||
/**
|
||||
* RADIUS 802.1x EAP_Success timestamp
|
||||
*
|
||||
@@ -413,11 +387,11 @@ public class ClientSessionDetails extends BaseJsonModel {
|
||||
this.steerType = steerType;
|
||||
}
|
||||
|
||||
public Long getPreviousValidSessionId() {
|
||||
public String getPreviousValidSessionId() {
|
||||
return previousValidSessionId;
|
||||
}
|
||||
|
||||
public void setPreviousValidSessionId(Long previousValidSessionId) {
|
||||
public void setPreviousValidSessionId(String previousValidSessionId) {
|
||||
this.previousValidSessionId = previousValidSessionId;
|
||||
}
|
||||
|
||||
@@ -514,9 +488,7 @@ public class ClientSessionDetails extends BaseJsonModel {
|
||||
return AssociationState.Cloud_Timeout;
|
||||
|
||||
}
|
||||
if (firstDataRcvdTimestamp != null || firstDataSentTimestamp != null
|
||||
|| (getMetricDetails() != null && (getMetricDetails().getLastRxTimestamp() != null
|
||||
|| getMetricDetails().getLastTxTimestamp() != null))) {
|
||||
if (firstDataRcvdTimestamp != null || firstDataSentTimestamp != null) {
|
||||
return AssociationState.Active_Data;
|
||||
}
|
||||
if (assocTimestamp != null) {
|
||||
@@ -535,9 +507,6 @@ public class ClientSessionDetails extends BaseJsonModel {
|
||||
if (this.eapDetails != null) {
|
||||
ret.setEapDetails(this.eapDetails.clone());
|
||||
}
|
||||
if (this.metricDetails != null) {
|
||||
ret.setMetricDetails(this.metricDetails.clone());
|
||||
}
|
||||
if (this.lastFailureDetails != null) {
|
||||
ret.setLastFailureDetails(this.lastFailureDetails.clone());
|
||||
}
|
||||
@@ -554,7 +523,7 @@ public class ClientSessionDetails extends BaseJsonModel {
|
||||
disconnectByApTimestamp, disconnectByClientInternalReasonCode, disconnectByClientReasonCode,
|
||||
disconnectByClientTimestamp, dynamicVlan, eapDetails, firstDataRcvdTimestamp, firstDataSentTimestamp,
|
||||
firstFailureDetails, hostname, ipAddress, ipTimestamp, is11KUsed, is11RUsed, is11VUsed, isReassociation,
|
||||
lastEventTimestamp, lastFailureDetails, lastRxTimestamp, lastTxTimestamp, metricDetails,
|
||||
lastEventTimestamp, lastFailureDetails, lastRxTimestamp, lastTxTimestamp,
|
||||
portEnabledTimestamp, previousValidSessionId, priorEquipmentId, priorSessionId, radioType,
|
||||
radiusUsername, securityType, sessionId, ssid, steerType, timeoutTimestamp, userAgentStr,
|
||||
associationState);
|
||||
@@ -594,7 +563,6 @@ public class ClientSessionDetails extends BaseJsonModel {
|
||||
&& Objects.equals(lastFailureDetails, other.lastFailureDetails)
|
||||
&& Objects.equals(lastRxTimestamp, other.lastRxTimestamp)
|
||||
&& Objects.equals(lastTxTimestamp, other.lastTxTimestamp)
|
||||
&& Objects.equals(metricDetails, other.metricDetails)
|
||||
&& Objects.equals(portEnabledTimestamp, other.portEnabledTimestamp)
|
||||
&& Objects.equals(previousValidSessionId, other.previousValidSessionId)
|
||||
&& Objects.equals(priorEquipmentId, other.priorEquipmentId)
|
||||
@@ -677,9 +645,6 @@ public class ClientSessionDetails extends BaseJsonModel {
|
||||
} else if (latest.eapDetails != null) {
|
||||
this.eapDetails.mergeDetails(latest.eapDetails);
|
||||
}
|
||||
if (null != latest.metricDetails) {
|
||||
this.metricDetails = latest.metricDetails;
|
||||
}
|
||||
|
||||
if (null != latest.getIsReassociation()) {
|
||||
this.isReassociation = latest.getIsReassociation();
|
||||
@@ -821,11 +786,11 @@ public class ClientSessionDetails extends BaseJsonModel {
|
||||
this.assocRssi = assocRssi;
|
||||
}
|
||||
|
||||
public Long getPriorSessionId() {
|
||||
public String getPriorSessionId() {
|
||||
return priorSessionId;
|
||||
}
|
||||
|
||||
public void setPriorSessionId(Long priorSessionId) {
|
||||
public void setPriorSessionId(String priorSessionId) {
|
||||
this.priorSessionId = priorSessionId;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,365 +0,0 @@
|
||||
package com.telecominfraproject.wlan.client.session.models;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
|
||||
|
||||
/**
|
||||
* @author ekeddy
|
||||
*
|
||||
*/
|
||||
public class ClientSessionMetricDetails extends BaseJsonModel
|
||||
{
|
||||
private static final long serialVersionUID = -6626815155700131150L;
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ClientSessionMetricDetails.class);
|
||||
|
||||
private Long rxBytes;
|
||||
private Long txBytes;
|
||||
private Long totalRxPackets;
|
||||
private Long totalTxPackets;
|
||||
private Float rxMbps;
|
||||
private Float txMbps;
|
||||
private Integer rssi;
|
||||
private Integer snr;
|
||||
private Long rxRateKbps; // from MCS
|
||||
private Long txRateKbps; // from MCS
|
||||
private long lastMetricTimestamp;
|
||||
private Long lastRxTimestamp;
|
||||
private Long lastTxTimestamp;
|
||||
private String classification;
|
||||
|
||||
/**
|
||||
* The number of dataframes transmitted TO the client from the AP.
|
||||
*/
|
||||
private Integer txDataFrames;
|
||||
|
||||
/**
|
||||
* The number of data frames transmitted TO the client that were retried.
|
||||
* Note this is not the same as the number of retries.
|
||||
*/
|
||||
private Integer txDataFramesRetried;
|
||||
|
||||
/**
|
||||
* The number of dataframes transmitted FROM the client TO the AP.
|
||||
*/
|
||||
private Integer rxDataFrames;
|
||||
|
||||
|
||||
public Long getRxBytes() {
|
||||
return rxBytes;
|
||||
}
|
||||
public void setRxBytes(Long rxBytes) {
|
||||
this.rxBytes = rxBytes;
|
||||
}
|
||||
public Long getTxBytes() {
|
||||
return txBytes;
|
||||
}
|
||||
public void setTxBytes(Long txBytes) {
|
||||
this.txBytes = txBytes;
|
||||
}
|
||||
public Long getTotalRxPackets() {
|
||||
return totalRxPackets;
|
||||
}
|
||||
public void setTotalRxPackets(Long totalRxPackets) {
|
||||
this.totalRxPackets = totalRxPackets;
|
||||
}
|
||||
public Long getTotalTxPackets() {
|
||||
return totalTxPackets;
|
||||
}
|
||||
public void setTotalTxPackets(Long totalTxPackets) {
|
||||
this.totalTxPackets = totalTxPackets;
|
||||
}
|
||||
public Float getRxMbps() {
|
||||
return rxMbps;
|
||||
}
|
||||
public void setRxMbps(Float rxMbps) {
|
||||
this.rxMbps = rxMbps;
|
||||
}
|
||||
public Float getTxMbps() {
|
||||
return txMbps;
|
||||
}
|
||||
public void setTxMbps(Float txMbps) {
|
||||
this.txMbps = txMbps;
|
||||
}
|
||||
public Integer getRssi() {
|
||||
return rssi;
|
||||
}
|
||||
public void setRssi(Integer rssi) {
|
||||
this.rssi = rssi;
|
||||
}
|
||||
public Integer getSnr() {
|
||||
return snr;
|
||||
}
|
||||
public void setSnr(Integer snr) {
|
||||
this.snr = snr;
|
||||
}
|
||||
public Long getRxRateKbps() {
|
||||
return rxRateKbps;
|
||||
}
|
||||
public void setRxRateKbps(Long rxRateKbps) {
|
||||
this.rxRateKbps = rxRateKbps;
|
||||
}
|
||||
public Long getTxRateKbps() {
|
||||
return txRateKbps;
|
||||
}
|
||||
public void setTxRateKbps(Long txRateKbps) {
|
||||
this.txRateKbps = txRateKbps;
|
||||
}
|
||||
|
||||
|
||||
public Integer getTxDataFrames() {
|
||||
return txDataFrames;
|
||||
}
|
||||
public void setTxDataFrames(Integer txDataFrames) {
|
||||
this.txDataFrames = txDataFrames;
|
||||
}
|
||||
public Integer getTxDataFramesRetried() {
|
||||
return txDataFramesRetried;
|
||||
}
|
||||
public void setTxDataFramesRetried(Integer txDataFramesRetried) {
|
||||
this.txDataFramesRetried = txDataFramesRetried;
|
||||
}
|
||||
|
||||
public long getLastMetricTimestamp() {
|
||||
return lastMetricTimestamp;
|
||||
}
|
||||
public void setLastMetricTimestamp(long lastMetricTimestamp) {
|
||||
this.lastMetricTimestamp = lastMetricTimestamp;
|
||||
}
|
||||
|
||||
public Long getLastRxTimestamp() {
|
||||
return lastRxTimestamp;
|
||||
}
|
||||
public void setLastRxTimestamp(Long lastRxTimestamp) {
|
||||
this.lastRxTimestamp = lastRxTimestamp;
|
||||
}
|
||||
public Long getLastTxTimestamp() {
|
||||
return lastTxTimestamp;
|
||||
}
|
||||
public void setLastTxTimestamp(Long lastTxTimestamp) {
|
||||
this.lastTxTimestamp = lastTxTimestamp;
|
||||
}
|
||||
|
||||
|
||||
public Integer getRxDataFrames() {
|
||||
return rxDataFrames;
|
||||
}
|
||||
public void setRxDataFrames(Integer rxDataFrames) {
|
||||
this.rxDataFrames = rxDataFrames;
|
||||
}
|
||||
public String getClassification() {
|
||||
return classification;
|
||||
}
|
||||
public void setClassification(String classification) {
|
||||
this.classification = classification;
|
||||
}
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((classification == null) ? 0 : classification.hashCode());
|
||||
result = prime * result + (int) (lastMetricTimestamp ^ (lastMetricTimestamp >>> 32));
|
||||
result = prime * result + ((lastRxTimestamp == null) ? 0 : lastRxTimestamp.hashCode());
|
||||
result = prime * result + ((lastTxTimestamp == null) ? 0 : lastTxTimestamp.hashCode());
|
||||
result = prime * result + ((rssi == null) ? 0 : rssi.hashCode());
|
||||
result = prime * result + ((rxBytes == null) ? 0 : rxBytes.hashCode());
|
||||
result = prime * result + ((rxDataFrames == null) ? 0 : rxDataFrames.hashCode());
|
||||
result = prime * result + ((rxMbps == null) ? 0 : rxMbps.hashCode());
|
||||
result = prime * result + ((rxRateKbps == null) ? 0 : rxRateKbps.hashCode());
|
||||
result = prime * result + ((snr == null) ? 0 : snr.hashCode());
|
||||
result = prime * result + ((totalRxPackets == null) ? 0 : totalRxPackets.hashCode());
|
||||
result = prime * result + ((totalTxPackets == null) ? 0 : totalTxPackets.hashCode());
|
||||
result = prime * result + ((txBytes == null) ? 0 : txBytes.hashCode());
|
||||
result = prime * result + ((txDataFrames == null) ? 0 : txDataFrames.hashCode());
|
||||
result = prime * result + ((txDataFramesRetried == null) ? 0 : txDataFramesRetried.hashCode());
|
||||
result = prime * result + ((txMbps == null) ? 0 : txMbps.hashCode());
|
||||
result = prime * result + ((txRateKbps == null) ? 0 : txRateKbps.hashCode());
|
||||
return result;
|
||||
}
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
ClientSessionMetricDetails other = (ClientSessionMetricDetails) obj;
|
||||
if (classification == null) {
|
||||
if (other.classification != null)
|
||||
return false;
|
||||
} else if (!classification.equals(other.classification))
|
||||
return false;
|
||||
if (lastMetricTimestamp != other.lastMetricTimestamp)
|
||||
return false;
|
||||
if (lastRxTimestamp == null) {
|
||||
if (other.lastRxTimestamp != null)
|
||||
return false;
|
||||
} else if (!lastRxTimestamp.equals(other.lastRxTimestamp))
|
||||
return false;
|
||||
if (lastTxTimestamp == null) {
|
||||
if (other.lastTxTimestamp != null)
|
||||
return false;
|
||||
} else if (!lastTxTimestamp.equals(other.lastTxTimestamp))
|
||||
return false;
|
||||
if (rssi == null) {
|
||||
if (other.rssi != null)
|
||||
return false;
|
||||
} else if (!rssi.equals(other.rssi))
|
||||
return false;
|
||||
if (rxBytes == null) {
|
||||
if (other.rxBytes != null)
|
||||
return false;
|
||||
} else if (!rxBytes.equals(other.rxBytes))
|
||||
return false;
|
||||
if (rxDataFrames == null) {
|
||||
if (other.rxDataFrames != null)
|
||||
return false;
|
||||
} else if (!rxDataFrames.equals(other.rxDataFrames))
|
||||
return false;
|
||||
if (rxMbps == null) {
|
||||
if (other.rxMbps != null)
|
||||
return false;
|
||||
} else if (!rxMbps.equals(other.rxMbps))
|
||||
return false;
|
||||
if (rxRateKbps == null) {
|
||||
if (other.rxRateKbps != null)
|
||||
return false;
|
||||
} else if (!rxRateKbps.equals(other.rxRateKbps))
|
||||
return false;
|
||||
if (snr == null) {
|
||||
if (other.snr != null)
|
||||
return false;
|
||||
} else if (!snr.equals(other.snr))
|
||||
return false;
|
||||
if (totalRxPackets == null) {
|
||||
if (other.totalRxPackets != null)
|
||||
return false;
|
||||
} else if (!totalRxPackets.equals(other.totalRxPackets))
|
||||
return false;
|
||||
if (totalTxPackets == null) {
|
||||
if (other.totalTxPackets != null)
|
||||
return false;
|
||||
} else if (!totalTxPackets.equals(other.totalTxPackets))
|
||||
return false;
|
||||
if (txBytes == null) {
|
||||
if (other.txBytes != null)
|
||||
return false;
|
||||
} else if (!txBytes.equals(other.txBytes))
|
||||
return false;
|
||||
if (txDataFrames == null) {
|
||||
if (other.txDataFrames != null)
|
||||
return false;
|
||||
} else if (!txDataFrames.equals(other.txDataFrames))
|
||||
return false;
|
||||
if (txDataFramesRetried == null) {
|
||||
if (other.txDataFramesRetried != null)
|
||||
return false;
|
||||
} else if (!txDataFramesRetried.equals(other.txDataFramesRetried))
|
||||
return false;
|
||||
if (txMbps == null) {
|
||||
if (other.txMbps != null)
|
||||
return false;
|
||||
} else if (!txMbps.equals(other.txMbps))
|
||||
return false;
|
||||
if (txRateKbps == null) {
|
||||
if (other.txRateKbps != null)
|
||||
return false;
|
||||
} else if (!txRateKbps.equals(other.txRateKbps))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public ClientSessionMetricDetails clone() {
|
||||
ClientSessionMetricDetails ret = (ClientSessionMetricDetails) super.clone();
|
||||
return ret;
|
||||
}
|
||||
|
||||
public void merge(ClientSessionMetricDetails other) {
|
||||
boolean isLatestMetric = false;
|
||||
if(lastMetricTimestamp<other.lastMetricTimestamp) {
|
||||
this.setLastMetricTimestamp(other.lastMetricTimestamp);
|
||||
isLatestMetric = true;
|
||||
}
|
||||
|
||||
// These properties just take the latest value
|
||||
if(isLatestMetric) {
|
||||
if(other.rssi != null) {
|
||||
this.rssi = other.rssi;
|
||||
}
|
||||
if(other.rxMbps != null) {
|
||||
this.rxMbps = other.rxMbps;
|
||||
}
|
||||
if(other.txMbps != null) {
|
||||
this.txMbps = other.txMbps;
|
||||
}
|
||||
if(other.rxRateKbps != null) {
|
||||
this.rxRateKbps = other.rxRateKbps;
|
||||
}
|
||||
if(other.txRateKbps != null) {
|
||||
this.txRateKbps = other.txRateKbps;
|
||||
}
|
||||
if(other.totalRxPackets != null) {
|
||||
this.totalRxPackets = other.totalRxPackets;
|
||||
}
|
||||
if(other.totalTxPackets != null) {
|
||||
this.totalTxPackets = other.totalTxPackets;
|
||||
}
|
||||
if(other.lastRxTimestamp != null) {
|
||||
this.lastRxTimestamp = other.lastRxTimestamp;
|
||||
}
|
||||
if(other.lastTxTimestamp != null) {
|
||||
this.lastTxTimestamp = other.lastTxTimestamp;
|
||||
}
|
||||
}
|
||||
if(other.txDataFrames != null) {
|
||||
// this is a delta
|
||||
this.setTxDataFrames(sum(this.txDataFrames,other.txDataFrames));
|
||||
}
|
||||
if(other.txDataFramesRetried != null) {
|
||||
// this is a delta
|
||||
this.setTxDataFramesRetried(sum(this.txDataFramesRetried,other.txDataFramesRetried));
|
||||
}
|
||||
if(other.rxDataFrames != null) {
|
||||
// this is a delta
|
||||
this.setRxDataFrames(sum(this.rxDataFrames,other.rxDataFrames));
|
||||
}
|
||||
if(other.rxBytes != null)
|
||||
{
|
||||
// We keep the sum going
|
||||
LOG.trace("RxBytes: adding {} to {}", this.rxBytes, other.rxBytes);
|
||||
this.setRxBytes(sum(this.rxBytes, other.rxBytes));
|
||||
}
|
||||
if(other.txBytes != null)
|
||||
{
|
||||
// We keep the sum going
|
||||
LOG.trace("TxBytes: adding {} to {}", this.txBytes, other.txBytes);
|
||||
this.setTxBytes(sum(this.txBytes, other.txBytes));
|
||||
}
|
||||
|
||||
if(other.classification != null)
|
||||
{
|
||||
this.classification = other.classification;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private static Integer sum(Integer v1, Integer v2) {
|
||||
if(v1 == null) return v2;
|
||||
if(v2 == null) return v1;
|
||||
return Integer.sum(v1, v2);
|
||||
}
|
||||
|
||||
|
||||
private static Long sum(Long v1, Long v2) {
|
||||
if(v1 == null) return v2;
|
||||
if(v2 == null) return v1;
|
||||
return Long.sum(v1, v2);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -147,8 +147,7 @@ components:
|
||||
type: object
|
||||
properties:
|
||||
sessionId:
|
||||
type: integer
|
||||
format: int64
|
||||
type: string
|
||||
authTimestamp:
|
||||
type: integer
|
||||
format: int64
|
||||
@@ -235,8 +234,7 @@ components:
|
||||
steerType:
|
||||
$ref: '#/components/schemas/SteerType'
|
||||
previousValidSessionId:
|
||||
type: integer
|
||||
format: int64
|
||||
type: string
|
||||
lastFailureDetails:
|
||||
$ref: '#/components/schemas/ClientFailureDetails'
|
||||
firstFailureDetails:
|
||||
@@ -251,8 +249,7 @@ components:
|
||||
type: integer
|
||||
format: int32
|
||||
priorSessionId:
|
||||
type: integer
|
||||
format: int64
|
||||
type: string
|
||||
priorEquipmentId:
|
||||
type: integer
|
||||
format: int64
|
||||
|
||||
@@ -59,8 +59,7 @@
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<artifactId>base-stream-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -189,7 +189,6 @@
|
||||
|
||||
<module>../provisioning-sp</module>
|
||||
<module>../dashboard-sp</module>
|
||||
<module>../equipment-alarms-sp</module>
|
||||
<module>../adoption-metrics-sp</module>
|
||||
|
||||
<module>../single-process-streams</module>
|
||||
|
||||
1
equipment-alarms-sp/.gitignore
vendored
1
equipment-alarms-sp/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/target/
|
||||
@@ -1,111 +0,0 @@
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>equipment-alarms-sp</artifactId>
|
||||
<name>equipment-alarms-sp</name>
|
||||
<description>Stream Processors for raising/clearing equipment alarms based on reported metrics.</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<artifactId>base-stream-consumer</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>service-metric-models</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>system-event-models</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>alarm-service-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>status-service-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>equipment-service-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- unit tests dependencies -->
|
||||
<dependency>
|
||||
<artifactId>single-process-streams</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>alarm-service-local</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>status-service-local</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>equipment-service-local</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>alarm-datastore-inmemory</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>status-datastore-inmemory</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>equipment-datastore-inmemory</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>cloud-event-dispatcher-empty</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
|
||||
@@ -1,187 +0,0 @@
|
||||
package com.telecominfraproject.wlan.streams.equipmentalarms;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.telecominfraproject.wlan.alarm.models.Alarm;
|
||||
import com.telecominfraproject.wlan.alarm.models.AlarmCode;
|
||||
import com.telecominfraproject.wlan.servicemetric.apnode.models.ApNodeMetrics;
|
||||
|
||||
/**
|
||||
* <br>This context keeps track of information needed for raising/clearing the alarms with the following codes:
|
||||
* <ul>
|
||||
* <li>AlarmCode.CPUTemperature
|
||||
* <li>AlarmCode.CPUUtilization
|
||||
* <li>AlarmCode.MemoryUtilization
|
||||
* <li>AlarmCode.NoMetricsReceived
|
||||
* </ul>
|
||||
*
|
||||
* @author dtop
|
||||
*/
|
||||
public class EquipmentAlarmsContext {
|
||||
|
||||
private final int customerId;
|
||||
private final long equipmentId;
|
||||
private final Map<AlarmCode, Alarm> existingAlarms = new ConcurrentHashMap<>();
|
||||
private final long timeBucketMs;
|
||||
private final int temperatureThresholdInC;
|
||||
private final int cpuUtilThresholdPct;
|
||||
private final int memoryUtilThresholdPct;
|
||||
|
||||
private final Map<Long, Integer> cpuTempSamples = new ConcurrentHashMap<>();
|
||||
private final Map<Long, Integer> cpuUtilSamples = new ConcurrentHashMap<>();
|
||||
private final Map<Long, Integer> memoryUtilSamples = new ConcurrentHashMap<>();
|
||||
private final Map<Long, Long> metricReceivedTimestamps = new ConcurrentHashMap<>();
|
||||
|
||||
private long totalAvailableMemoryKb;
|
||||
private final long contextCreationTimestampMs = System.currentTimeMillis();
|
||||
|
||||
public EquipmentAlarmsContext(int customerId, long equipmentId, List<Alarm> existingAlarmsList, long timeBucketMs, int temperatureThresholdInC, int cpuUtilThresholdPct, int memoryUtilThresholdPct) {
|
||||
this.customerId = customerId;
|
||||
this.equipmentId = equipmentId;
|
||||
existingAlarmsList.forEach(a -> this.existingAlarms.put(a.getAlarmCode(), a));
|
||||
this.timeBucketMs = timeBucketMs;
|
||||
this.temperatureThresholdInC = temperatureThresholdInC;
|
||||
this.cpuUtilThresholdPct = cpuUtilThresholdPct;
|
||||
this.memoryUtilThresholdPct = memoryUtilThresholdPct;
|
||||
}
|
||||
|
||||
public long getTotalAvailableMemoryKb() {
|
||||
return totalAvailableMemoryKb;
|
||||
}
|
||||
|
||||
public void setTotalAvailableMemoryKb(long totalAvailableMemoryKb) {
|
||||
this.totalAvailableMemoryKb = totalAvailableMemoryKb;
|
||||
}
|
||||
|
||||
public int getCustomerId() {
|
||||
return customerId;
|
||||
}
|
||||
|
||||
public long getEquipmentId() {
|
||||
return equipmentId;
|
||||
}
|
||||
|
||||
public Map<AlarmCode, Alarm> getExistingAlarms() {
|
||||
return existingAlarms;
|
||||
}
|
||||
|
||||
|
||||
public void addDataSamples(long timestamp, ApNodeMetrics model) {
|
||||
// add new samples
|
||||
if(model.getApPerformance()!=null ) {
|
||||
if(model.getApPerformance().getCpuTemperature()!=null) {
|
||||
cpuTempSamples.put(timestamp, model.getApPerformance().getCpuTemperature());
|
||||
}
|
||||
|
||||
if(model.getApPerformance().getAvgCpuUtilized()!=null) {
|
||||
cpuUtilSamples.put(timestamp, model.getApPerformance().getAvgCpuUtilized().intValue());
|
||||
}
|
||||
|
||||
if(model.getApPerformance().getFreeMemory()!=null && totalAvailableMemoryKb>0) {
|
||||
memoryUtilSamples.put(timestamp, 100 - (int) (model.getApPerformance().getFreeMemory() * 100 / totalAvailableMemoryKb));
|
||||
}
|
||||
}
|
||||
|
||||
//we are using our own timestamp in here in case AP's time is out of sync - we do not want to raise connectivity alarm in that case
|
||||
Long currentTs = System.currentTimeMillis();
|
||||
metricReceivedTimestamps.put(currentTs, currentTs);
|
||||
|
||||
}
|
||||
|
||||
public void removeOldDataSamples() {
|
||||
// remove samples older than timeBucketMs
|
||||
long timeThresholdMs = System.currentTimeMillis() - timeBucketMs;
|
||||
cpuTempSamples.entrySet().removeIf( t -> t.getKey() < timeThresholdMs );
|
||||
cpuUtilSamples.entrySet().removeIf( t -> t.getKey() < timeThresholdMs );
|
||||
memoryUtilSamples.entrySet().removeIf( t -> t.getKey() < timeThresholdMs );
|
||||
metricReceivedTimestamps.entrySet().removeIf( t -> t.getKey() < timeThresholdMs );
|
||||
}
|
||||
|
||||
public boolean isAlarmNeedsToBeRaised(AlarmCode alarmCode) {
|
||||
|
||||
if(existingAlarms.containsKey(alarmCode) || System.currentTimeMillis() < contextCreationTimestampMs + timeBucketMs) {
|
||||
//no need to check for thresholds - alarm is either already present, or it is too early to tell because the first time bucket has not been filled yet
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean ret = false;
|
||||
AtomicInteger sum = new AtomicInteger();
|
||||
AtomicInteger count = new AtomicInteger();
|
||||
|
||||
//check alarms against thresholds
|
||||
if(alarmCode.getId() == AlarmCode.NoMetricsReceived.getId()) {
|
||||
ret = metricReceivedTimestamps.isEmpty();
|
||||
} else if(alarmCode.getId() == AlarmCode.CPUTemperature.getId()) {
|
||||
cpuTempSamples.values().forEach(v -> { sum.addAndGet(v); count.incrementAndGet(); });
|
||||
if(count.get() > 0) {
|
||||
int avg = sum.get() / count.get();
|
||||
ret = avg >= temperatureThresholdInC ;
|
||||
}
|
||||
} else if(alarmCode.getId() == AlarmCode.CPUUtilization.getId()) {
|
||||
cpuUtilSamples.values().forEach(v -> { sum.addAndGet(v); count.incrementAndGet(); });
|
||||
if(count.get() > 0) {
|
||||
int avg = sum.get() / count.get();
|
||||
ret = avg >= cpuUtilThresholdPct ;
|
||||
}
|
||||
} else if(alarmCode.getId() == AlarmCode.MemoryUtilization.getId()) {
|
||||
memoryUtilSamples.values().forEach(v -> { sum.addAndGet(v); count.incrementAndGet(); });
|
||||
if(count.get() > 0) {
|
||||
int avg = sum.get() / count.get();
|
||||
ret = avg >= memoryUtilThresholdPct ;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public boolean isAlarmNeedsToBeCleared(AlarmCode alarmCode) {
|
||||
|
||||
if(!existingAlarms.containsKey(alarmCode) || System.currentTimeMillis() < contextCreationTimestampMs + timeBucketMs) {
|
||||
//no need to check for thresholds - alarm is either not present, or it is too early to tell because the first time bucket has not been filled yet
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean ret = false;
|
||||
AtomicInteger sum = new AtomicInteger();
|
||||
AtomicInteger count = new AtomicInteger();
|
||||
|
||||
//check alarms against thresholds
|
||||
if(alarmCode.getId() == AlarmCode.NoMetricsReceived.getId()) {
|
||||
ret = !metricReceivedTimestamps.isEmpty();
|
||||
} else if(alarmCode.getId() == AlarmCode.CPUTemperature.getId()) {
|
||||
cpuTempSamples.values().forEach(v -> { sum.addAndGet(v); count.incrementAndGet(); });
|
||||
if(count.get() > 0) {
|
||||
int avg = sum.get() / count.get();
|
||||
ret = avg < temperatureThresholdInC ;
|
||||
} else {
|
||||
//no new data available, but the alarm exists -> clear the alarm
|
||||
ret = true;
|
||||
}
|
||||
} else if(alarmCode.getId() == AlarmCode.CPUUtilization.getId()) {
|
||||
cpuUtilSamples.values().forEach(v -> { sum.addAndGet(v); count.incrementAndGet(); });
|
||||
if(count.get() > 0) {
|
||||
int avg = sum.get() / count.get();
|
||||
ret = avg < cpuUtilThresholdPct ;
|
||||
} else {
|
||||
//no new data available, but the alarm exists -> clear the alarm
|
||||
ret = true;
|
||||
}
|
||||
} else if(alarmCode.getId() == AlarmCode.MemoryUtilization.getId()) {
|
||||
memoryUtilSamples.values().forEach(v -> { sum.addAndGet(v); count.incrementAndGet(); });
|
||||
if(count.get() > 0) {
|
||||
int avg = sum.get() / count.get();
|
||||
ret = avg < memoryUtilThresholdPct ;
|
||||
} else {
|
||||
//no new data available, but the alarm exists -> clear the alarm
|
||||
ret = true;
|
||||
}
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,322 +0,0 @@
|
||||
package com.telecominfraproject.wlan.streams.equipmentalarms;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.telecominfraproject.wlan.alarm.AlarmServiceInterface;
|
||||
import com.telecominfraproject.wlan.alarm.models.Alarm;
|
||||
import com.telecominfraproject.wlan.alarm.models.AlarmCode;
|
||||
import com.telecominfraproject.wlan.alarm.models.AlarmDetails;
|
||||
import com.telecominfraproject.wlan.alarm.models.AlarmScopeType;
|
||||
import com.telecominfraproject.wlan.alarm.models.OriginatorType;
|
||||
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
|
||||
import com.telecominfraproject.wlan.core.model.streams.QueuedStreamMessage;
|
||||
import com.telecominfraproject.wlan.equipment.EquipmentServiceInterface;
|
||||
import com.telecominfraproject.wlan.equipment.models.Equipment;
|
||||
import com.telecominfraproject.wlan.servicemetric.apnode.models.ApNodeMetrics;
|
||||
import com.telecominfraproject.wlan.servicemetric.models.ServiceMetric;
|
||||
import com.telecominfraproject.wlan.servicemetric.models.ServiceMetricDetails;
|
||||
import com.telecominfraproject.wlan.status.StatusServiceInterface;
|
||||
import com.telecominfraproject.wlan.status.equipment.report.models.OperatingSystemPerformance;
|
||||
import com.telecominfraproject.wlan.status.models.Status;
|
||||
import com.telecominfraproject.wlan.status.models.StatusCode;
|
||||
import com.telecominfraproject.wlan.status.models.StatusDataType;
|
||||
import com.telecominfraproject.wlan.stream.StreamProcessor;
|
||||
|
||||
/**
|
||||
* @author dtop
|
||||
* <br> This stream processor is listening for APNodeMetrics, aggregating them in sliding windows of 5 minutes and raising/clearing alarms based on preconfigured thresholds.
|
||||
* <br> "No metrics received" alarm is raised when no APNodeMetrics have been received for the equipment in the last interval, cleared when APNodeMetrics appear again
|
||||
* <br> "Temperature too high" alarm is raised when average temperature over the last interval goes above the configured threshold of 80C, cleared when average temperature goes below the threshold
|
||||
* <br> "CPU utilization is too high" alarm is raised when average CPU utilization on AP over the last interval goes above the configured threshold of 80%, cleared when average CPU utilization goes below the threshold
|
||||
* <br> "Memory utilization is too high" alarm is raised when average RAM utilization on AP over the last interval goes above the configured threshold of 70%, cleared when average RAM utilization goes below the threshold
|
||||
*
|
||||
*/
|
||||
@Component
|
||||
public class EquipmentAlarmsProcessor extends StreamProcessor {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(EquipmentAlarmsProcessor.class);
|
||||
|
||||
@Value("${tip.wlan.wlanServiceMetricsTopic:wlan_service_metrics}")
|
||||
private String wlanServiceMetricsTopic;
|
||||
|
||||
@Value("${tip.wlan.equipmentAlarmProcessor.timeBucketMs:300000}") //5 minutes aggregation buckets
|
||||
private long timeBucketMs;
|
||||
|
||||
@Value("${tip.wlan.equipmentAlarmProcessor.checkAlarmsIntervalMs:15000}") //check for raising/clearing alarms every 15 seconds
|
||||
private long checkAlarmsIntervalMs;
|
||||
|
||||
@Value("${tip.wlan.equipmentAlarmProcessor.temperatureThresholdInC:80}")
|
||||
private int temperatureThresholdInC;
|
||||
|
||||
@Value("${tip.wlan.equipmentAlarmProcessor.cpuUtilThresholdPct:80}")
|
||||
private int cpuUtilThresholdPct;
|
||||
|
||||
@Value("${tip.wlan.equipmentAlarmProcessor.memoryUtilThresholdPct:70}")
|
||||
private int memoryUtilThresholdPct;
|
||||
|
||||
|
||||
private final ConcurrentHashMap<Long, EquipmentAlarmsContext> contextPerEquipmentIdMap = new ConcurrentHashMap<>();
|
||||
|
||||
private final Set<AlarmCode> alarmCodeSet = new HashSet<>();
|
||||
|
||||
@Autowired
|
||||
private AlarmServiceInterface alarmServiceInterface;
|
||||
|
||||
@Autowired
|
||||
private StatusServiceInterface statusServiceInterface;
|
||||
|
||||
@Autowired
|
||||
private EquipmentServiceInterface equipmentServiceInterface;
|
||||
|
||||
@Override
|
||||
protected boolean acceptMessage(QueuedStreamMessage message) {
|
||||
boolean ret = message.getTopic().equals(wlanServiceMetricsTopic);
|
||||
|
||||
if(ret && ( message.getModel() instanceof ServiceMetric) ) {
|
||||
|
||||
ServiceMetric sm = (ServiceMetric) message.getModel();
|
||||
ret = ret &&
|
||||
(
|
||||
sm.getDetails() instanceof ApNodeMetrics
|
||||
);
|
||||
} else {
|
||||
ret = false;
|
||||
}
|
||||
|
||||
LOG.trace("acceptMessage {}", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processMessage(QueuedStreamMessage message) {
|
||||
|
||||
ServiceMetric mdl = (ServiceMetric) message.getModel();
|
||||
ServiceMetricDetails smd = mdl.getDetails();
|
||||
LOG.debug("Processing {}", mdl);
|
||||
|
||||
switch ( smd.getClass().getSimpleName() ) {
|
||||
case "ApNodeMetrics":
|
||||
process(mdl.getCustomerId(), mdl.getCreatedTimestamp(), mdl.getEquipmentId(), (ApNodeMetrics) smd);
|
||||
break;
|
||||
default:
|
||||
process(mdl);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void process(int customerId, long timestamp, long equipmentId, ApNodeMetrics model) {
|
||||
LOG.debug("Processing ApNodeMetrics");
|
||||
//get context for the equipmentId
|
||||
EquipmentAlarmsContext context = contextPerEquipmentIdMap.get(equipmentId);
|
||||
if(context == null) {
|
||||
|
||||
//When creating EquipmentAlarmsContext - read currently raised alarms of the types we're interested, keep it in memory.
|
||||
//Only this SP is responsible for raising/clearing those alarms for this particular equipment
|
||||
List<Alarm> existingAlarms = alarmServiceInterface.get(customerId, Collections.singleton(equipmentId), alarmCodeSet);
|
||||
|
||||
//All alarms that are handled by this stream processor logically exist only once-per-alarmCode-per-equipment.
|
||||
//Ensure that there is only one alarm per alarmCode per equipment (the latest one), remove all others.
|
||||
//This is needed to recover from some corner-case scenarios that can happen with the distributed datastores (for example split-brain).
|
||||
existingAlarms = cleanUpDuplicateAlarms(existingAlarms);
|
||||
|
||||
context = new EquipmentAlarmsContext(customerId, equipmentId, existingAlarms, timeBucketMs, temperatureThresholdInC, cpuUtilThresholdPct, memoryUtilThresholdPct);
|
||||
context = contextPerEquipmentIdMap.putIfAbsent(equipmentId, context);
|
||||
if(context == null) {
|
||||
context = contextPerEquipmentIdMap.get(equipmentId);
|
||||
}
|
||||
}
|
||||
|
||||
//find out TotalAvailableMemory in kb, which is available as part of the OperatingSystemPerformance status object
|
||||
//we look for it separately because this status may not be populated when the first service_metrics_collection_config are coming in
|
||||
if(context.getTotalAvailableMemoryKb()==0L) {
|
||||
Status osPerformanceStatus = statusServiceInterface.getOrNull(customerId, equipmentId, StatusDataType.OS_PERFORMANCE);
|
||||
if(osPerformanceStatus!=null) {
|
||||
OperatingSystemPerformance osPerformance = (OperatingSystemPerformance) osPerformanceStatus.getDetails();
|
||||
if(osPerformance !=null && osPerformance.getTotalAvailableMemoryKb() > 0) {
|
||||
context.setTotalAvailableMemoryKb(osPerformance.getTotalAvailableMemoryKb());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Update counters on the context
|
||||
context.addDataSamples(timestamp, model);
|
||||
|
||||
LOG.debug("Processed {}", model);
|
||||
}
|
||||
|
||||
private List<Alarm> cleanUpDuplicateAlarms(List<Alarm> existingAlarms) {
|
||||
|
||||
Map<AlarmCode, Alarm> alarmsToKeep= new HashMap<>();
|
||||
|
||||
//find out the latest existing alarms for each alarmCode
|
||||
existingAlarms.forEach(a -> {
|
||||
Alarm eA = alarmsToKeep.get(a.getAlarmCode());
|
||||
if(eA == null) {
|
||||
eA = a;
|
||||
alarmsToKeep.put(a.getAlarmCode(), a);
|
||||
}
|
||||
|
||||
if(eA.getCreatedTimestamp() < a.getCreatedTimestamp() ) {
|
||||
alarmsToKeep.put(a.getAlarmCode(), a);
|
||||
}
|
||||
});
|
||||
|
||||
List<Alarm> alarmsToRemove = new ArrayList<>(existingAlarms);
|
||||
alarmsToRemove.removeAll(alarmsToKeep.values());
|
||||
|
||||
alarmsToRemove.forEach(a -> {
|
||||
try {
|
||||
alarmServiceInterface.delete(a.getCustomerId(), a.getEquipmentId(), a.getAlarmCode(), a.getCreatedTimestamp());
|
||||
} catch(Exception e) {
|
||||
LOG.debug("Alarm was already deleted: {}", a);
|
||||
}
|
||||
});
|
||||
|
||||
return new ArrayList<>(alarmsToKeep.values());
|
||||
}
|
||||
|
||||
private void process(BaseJsonModel model) {
|
||||
LOG.warn("Unprocessed model: {}", model);
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
private void postCreate() {
|
||||
|
||||
Thread equipmentAlarmsThread = new Thread( new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
LOG.info("Starting equipmentAlarmsThread");
|
||||
while(true) {
|
||||
LOG.trace("Checking if alarms need to be raised");
|
||||
|
||||
//take a snapshot of existing contexts for this iteration of alarm checks
|
||||
List<EquipmentAlarmsContext> contexts = new ArrayList<>(contextPerEquipmentIdMap.values());
|
||||
|
||||
HashSet<Long> equipmentIdsFromContexts = new HashSet<>();
|
||||
contexts.forEach(ctx -> equipmentIdsFromContexts.add(ctx.getEquipmentId()));
|
||||
|
||||
//get a list of equipment records for the current contexts
|
||||
HashSet<Long> existingEquipmentIds = new HashSet<>();
|
||||
|
||||
try {
|
||||
List<Equipment> existingEquipment = equipmentServiceInterface.get(equipmentIdsFromContexts);
|
||||
existingEquipment.forEach(e -> existingEquipmentIds.add(e.getId()));
|
||||
} catch(Exception e) {
|
||||
LOG.error("Error when retrieving existing equipment", e);
|
||||
sleep(checkAlarmsIntervalMs);
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
for(EquipmentAlarmsContext context : contexts ) {
|
||||
|
||||
if(!existingEquipmentIds.contains(context.getEquipmentId())) {
|
||||
//equipment was removed, let's delete the context and remove all existing alarms for that equipmentId
|
||||
try {
|
||||
contextPerEquipmentIdMap.remove(context.getEquipmentId());
|
||||
alarmServiceInterface.delete(context.getCustomerId(), context.getEquipmentId());
|
||||
} catch(Exception e) {
|
||||
LOG.error("Error when removing stale alarms for deleted equipment", e);
|
||||
}
|
||||
//nothing else to do for this context
|
||||
continue;
|
||||
}
|
||||
|
||||
context.removeOldDataSamples();
|
||||
|
||||
alarmCodeSet.forEach(alarmCode -> {
|
||||
try {
|
||||
//check alarms against thresholds
|
||||
//if alarm needs to be raised - check if it is currently present, and if not - raise it, and add it to the context
|
||||
if(context.isAlarmNeedsToBeRaised(alarmCode)) {
|
||||
Alarm alarm = new Alarm();
|
||||
alarm.setCustomerId(context.getCustomerId());
|
||||
alarm.setEquipmentId(context.getEquipmentId());
|
||||
alarm.setAlarmCode(alarmCode);
|
||||
alarm.setOriginatorType(OriginatorType.AP);
|
||||
alarm.setSeverity(alarmCode.getSeverity());
|
||||
alarm.setScopeType(AlarmScopeType.EQUIPMENT);
|
||||
alarm.setScopeId("" + context.getEquipmentId());
|
||||
AlarmDetails alarmDetails = new AlarmDetails();
|
||||
alarmDetails.setMessage(alarmCode.getDescription());
|
||||
alarmDetails.setAffectedEquipmentIds(Collections.singletonList(context.getEquipmentId()));
|
||||
alarm.setDetails(alarmDetails);
|
||||
|
||||
alarm = alarmServiceInterface.create(alarm);
|
||||
context.getExistingAlarms().put(alarmCode, alarm);
|
||||
}
|
||||
|
||||
if(context.isAlarmNeedsToBeCleared(alarmCode)) {
|
||||
//if alarm needs to be cleared - check if it is currently present, and if it is - clear it, and remove it from the context
|
||||
Alarm alarm = context.getExistingAlarms().remove(alarmCode);
|
||||
if(alarm!=null) {
|
||||
//All alarms that are handled by this stream processor logically exist only once-per-alarmCode-per-equipment.
|
||||
//In order to self-heal from the corner cases with the datastore where more than one alarm with the same alarmCode
|
||||
// is raised per equipment (for example when the datastore experienced a split-brain scenario), we would remove
|
||||
// all alarms with the specified alarmCode for this equipment.
|
||||
//Most of the time the existingAlarms list below would contain only one alarm.
|
||||
//
|
||||
List<Alarm> existingAlarms = alarmServiceInterface.get(alarm.getCustomerId(), Collections.singleton(alarm.getEquipmentId()), Collections.singleton(alarmCode));
|
||||
existingAlarms.forEach(a -> {
|
||||
try {
|
||||
alarmServiceInterface.delete(a.getCustomerId(), a.getEquipmentId(), a.getAlarmCode(), a.getCreatedTimestamp());
|
||||
} catch(Exception e) {
|
||||
LOG.debug("Alarm was already deleted: {}", alarm);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
} catch(Exception e) {
|
||||
LOG.error("Error when processing context for customer {}", context.getCustomerId(), e);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
LOG.trace("Done alarms check");
|
||||
|
||||
sleep(checkAlarmsIntervalMs);
|
||||
|
||||
}
|
||||
}
|
||||
}, "equipmentAlarmsThread");
|
||||
|
||||
equipmentAlarmsThread.setDaemon(true);
|
||||
equipmentAlarmsThread.start();
|
||||
|
||||
//populate alarm codes this SP is responsible for
|
||||
alarmCodeSet.add(AlarmCode.NoMetricsReceived);
|
||||
alarmCodeSet.add(AlarmCode.CPUTemperature);
|
||||
alarmCodeSet.add(AlarmCode.CPUUtilization);
|
||||
alarmCodeSet.add(AlarmCode.MemoryUtilization);
|
||||
|
||||
}
|
||||
|
||||
private static void sleep(long ms) {
|
||||
try {
|
||||
Thread.sleep(ms);
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,342 +0,0 @@
|
||||
package com.telecominfraproject.wlan.streams.equipmentalarms;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import com.telecominfraproject.wlan.alarm.AlarmServiceInterface;
|
||||
import com.telecominfraproject.wlan.alarm.AlarmServiceLocal;
|
||||
import com.telecominfraproject.wlan.alarm.controller.AlarmController;
|
||||
import com.telecominfraproject.wlan.alarm.datastore.inmemory.AlarmDatastoreInMemory;
|
||||
import com.telecominfraproject.wlan.alarm.models.Alarm;
|
||||
import com.telecominfraproject.wlan.alarm.models.AlarmCode;
|
||||
import com.telecominfraproject.wlan.cloudeventdispatcher.CloudEventDispatcherEmpty;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.EquipmentType;
|
||||
import com.telecominfraproject.wlan.equipment.EquipmentServiceInterface;
|
||||
import com.telecominfraproject.wlan.equipment.EquipmentServiceLocal;
|
||||
import com.telecominfraproject.wlan.equipment.controller.EquipmentController;
|
||||
import com.telecominfraproject.wlan.equipment.datastore.inmemory.EquipmentDatastoreInMemory;
|
||||
import com.telecominfraproject.wlan.equipment.models.Equipment;
|
||||
import com.telecominfraproject.wlan.servicemetric.apnode.models.ApNodeMetrics;
|
||||
import com.telecominfraproject.wlan.servicemetric.apnode.models.ApPerformance;
|
||||
import com.telecominfraproject.wlan.servicemetric.models.ServiceMetric;
|
||||
import com.telecominfraproject.wlan.status.StatusServiceLocal;
|
||||
import com.telecominfraproject.wlan.status.controller.StatusController;
|
||||
import com.telecominfraproject.wlan.status.datastore.inmemory.StatusDatastoreInMemory;
|
||||
import com.telecominfraproject.wlan.stream.StreamInterface;
|
||||
import com.telecominfraproject.wlan.stream.StreamMessageDispatcher;
|
||||
import com.telecominfraproject.wlan.streams.simple.SimpleStreamsConfig;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.NONE, classes = EquipmentAlarmsProcessor.class)
|
||||
@Import(value = { EquipmentAlarmsProcessor.class, SimpleStreamsConfig.class, StreamMessageDispatcher.class,
|
||||
AlarmServiceLocal.class, AlarmController.class, AlarmDatastoreInMemory.class,
|
||||
StatusServiceLocal.class, StatusController.class, StatusDatastoreInMemory.class,
|
||||
EquipmentServiceLocal.class, EquipmentController.class, EquipmentDatastoreInMemory.class,
|
||||
CloudEventDispatcherEmpty.class,
|
||||
//EquipmentAlarmsProcessorTests.Config.class,
|
||||
})
|
||||
@Ignore("make these tests more robust, there are intermittent failures")
|
||||
/*
|
||||
expected: <0> but was: <1>
|
||||
org.opentest4j.AssertionFailedError: expected: <0> but was: <1>
|
||||
at com.telecominfraproject.wlan.streams.equipmentalarms.EquipmentAlarmsProcessorTests.testAccessPointIsUnreachableAlarm(EquipmentAlarmsProcessorTests.java:313)
|
||||
|
||||
*/
|
||||
public class EquipmentAlarmsProcessorTests {
|
||||
|
||||
private static final long testTimeBucketMs = 200;
|
||||
private static final long testCheckAlarmsIntervalMs = 50;
|
||||
|
||||
static {
|
||||
System.setProperty("tip.wlan.equipmentAlarmProcessor.checkAlarmsIntervalMs", "" + testCheckAlarmsIntervalMs);
|
||||
System.setProperty("tip.wlan.equipmentAlarmProcessor.timeBucketMs", "" + testTimeBucketMs);
|
||||
}
|
||||
|
||||
@Autowired @Qualifier("metricStreamInterface")
|
||||
StreamInterface<ServiceMetric> metricStreamInterface;
|
||||
|
||||
@Autowired
|
||||
EquipmentAlarmsProcessor equipmentAlarmsProcessor;
|
||||
|
||||
@Autowired
|
||||
AlarmServiceInterface alarmService;
|
||||
|
||||
@Autowired
|
||||
EquipmentServiceInterface equipmentService;
|
||||
|
||||
protected static final AtomicLong testSequence = new AtomicLong(1);
|
||||
|
||||
@Configuration
|
||||
public static class Config {
|
||||
|
||||
//Another way of configuring dependencies (instead of mentioning them in the pom.xml with the test scope) :
|
||||
// @Bean
|
||||
// AlarmServiceInterface getAlarmServiceInterface() {
|
||||
// return new AlarmServiceInterface() {
|
||||
// ...
|
||||
// };
|
||||
// }
|
||||
|
||||
// @Bean
|
||||
// StatusServiceInterface getStatusServiceInterface() {
|
||||
// return new StatusServiceInterface() {
|
||||
// ...
|
||||
// };
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCPUTemperatureAlarm() {
|
||||
int customerId = getNextCustomerId();
|
||||
|
||||
Equipment equipment = new Equipment();
|
||||
equipment.setCustomerId(customerId);
|
||||
equipment.setEquipmentType(EquipmentType.AP);
|
||||
equipment.setInventoryId("testCPUTemperatureAlarm");
|
||||
equipment.setName(equipment.getInventoryId());
|
||||
equipment = equipmentService.create(equipment);
|
||||
long equipmentId = equipment.getId();
|
||||
|
||||
ServiceMetric record = new ServiceMetric(customerId , equipmentId );
|
||||
//create metric a bit in the future so that it gets picked up by the processor and not simply discarded
|
||||
record.setCreatedTimestamp(System.currentTimeMillis() + 2 * testTimeBucketMs);
|
||||
|
||||
ApNodeMetrics apNodeMetrics = new ApNodeMetrics();
|
||||
record.setDetails(apNodeMetrics);
|
||||
|
||||
ApPerformance apPerformance = new ApPerformance();
|
||||
apNodeMetrics.setApPerformance(apPerformance);
|
||||
|
||||
//we will force the CPUTemperature alarm to be raised
|
||||
apPerformance.setCpuTemperature(85);
|
||||
|
||||
apPerformance.setCpuUtilized(new int[] { 70, 70 });
|
||||
|
||||
apPerformance.setFreeMemory(30000000);
|
||||
|
||||
//publish metric that should trigger alarm for the CPU Temperature
|
||||
metricStreamInterface.publish(record );
|
||||
|
||||
//wait for the metric to be processed
|
||||
sleep(2 * testTimeBucketMs);
|
||||
|
||||
//verify that alarm was raised
|
||||
List<Alarm> alarms = alarmService.get(customerId, Collections.singleton(equipmentId), Collections.singleton(AlarmCode.CPUTemperature));
|
||||
assertEquals(1, alarms.size());
|
||||
|
||||
//Now create a metric that should clear the alarm
|
||||
ServiceMetric recordToClearAlarm = record.clone();
|
||||
recordToClearAlarm.setCreatedTimestamp(System.currentTimeMillis() + 2* testTimeBucketMs );
|
||||
((ApNodeMetrics)recordToClearAlarm.getDetails()).getApPerformance().setCpuTemperature(70);
|
||||
|
||||
//publish metric that should clear the alarm for the CPU Temperature
|
||||
metricStreamInterface.publish(recordToClearAlarm);
|
||||
|
||||
//wait for the metric to be processed
|
||||
sleep(2 * testTimeBucketMs);
|
||||
|
||||
//verify that alarm was cleared
|
||||
alarms = alarmService.get(customerId, Collections.singleton(equipmentId), Collections.singleton(AlarmCode.CPUTemperature));
|
||||
assertEquals(0, alarms.size());
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCPUTemperatureAlarm_NoEquipment() {
|
||||
int customerId = getNextCustomerId();
|
||||
long equipmentId = -5;
|
||||
|
||||
ServiceMetric record = new ServiceMetric(customerId , equipmentId );
|
||||
//create metric a bit in the future so that it gets picked up by the processor and not simply discarded
|
||||
record.setCreatedTimestamp(System.currentTimeMillis() + 2 * testTimeBucketMs);
|
||||
|
||||
ApNodeMetrics apNodeMetrics = new ApNodeMetrics();
|
||||
record.setDetails(apNodeMetrics);
|
||||
|
||||
ApPerformance apPerformance = new ApPerformance();
|
||||
apNodeMetrics.setApPerformance(apPerformance);
|
||||
|
||||
//we will force the CPUTemperature alarm to be raised
|
||||
apPerformance.setCpuTemperature(85);
|
||||
|
||||
apPerformance.setCpuUtilized(new int[] { 70, 70 });
|
||||
|
||||
apPerformance.setFreeMemory(30000000);
|
||||
|
||||
//publish metric that should trigger alarm for the CPU Temperature
|
||||
metricStreamInterface.publish(record );
|
||||
|
||||
//wait for the metric to be processed
|
||||
sleep(2 * testTimeBucketMs);
|
||||
|
||||
//verify that alarm was not raised - because equipment for that alarm does not exist
|
||||
List<Alarm> alarms = alarmService.get(customerId, Collections.singleton(equipmentId), Collections.singleton(AlarmCode.CPUTemperature));
|
||||
assertEquals(0, alarms.size());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCPUUtilizationAlarm() {
|
||||
int customerId = getNextCustomerId();
|
||||
|
||||
Equipment equipment = new Equipment();
|
||||
equipment.setCustomerId(customerId);
|
||||
equipment.setEquipmentType(EquipmentType.AP);
|
||||
equipment.setInventoryId("testCPUUtilizationAlarm");
|
||||
equipment.setName(equipment.getInventoryId());
|
||||
equipment = equipmentService.create(equipment);
|
||||
long equipmentId = equipment.getId();
|
||||
|
||||
ServiceMetric record = new ServiceMetric(customerId , equipmentId );
|
||||
//create metric a bit in the future so that it gets picked up by the processor and not simply discarded
|
||||
record.setCreatedTimestamp(System.currentTimeMillis() + 2 * testTimeBucketMs);
|
||||
|
||||
ApNodeMetrics apNodeMetrics = new ApNodeMetrics();
|
||||
record.setDetails(apNodeMetrics);
|
||||
|
||||
ApPerformance apPerformance = new ApPerformance();
|
||||
apNodeMetrics.setApPerformance(apPerformance);
|
||||
|
||||
apPerformance.setCpuTemperature(55);
|
||||
|
||||
//we will force the CPUUtilization alarm to be raised
|
||||
apPerformance.setCpuUtilized(new int[] { 90, 90 });
|
||||
|
||||
apPerformance.setFreeMemory(30000000);
|
||||
|
||||
//publish metric that should trigger alarm for the CPU Utilization
|
||||
metricStreamInterface.publish(record );
|
||||
|
||||
//wait for the metric to be processed
|
||||
sleep(2 * testTimeBucketMs);
|
||||
|
||||
//verify that alarm was raised
|
||||
List<Alarm> alarms = alarmService.get(customerId, Collections.singleton(equipmentId), Collections.singleton(AlarmCode.CPUUtilization));
|
||||
assertEquals(1, alarms.size());
|
||||
|
||||
//Now create a metric that should clear the alarm
|
||||
ServiceMetric recordToClearAlarm = record.clone();
|
||||
recordToClearAlarm.setCreatedTimestamp(System.currentTimeMillis() + 2* testTimeBucketMs );
|
||||
((ApNodeMetrics)recordToClearAlarm.getDetails()).getApPerformance().setCpuUtilized(new int[] { 50, 50 });
|
||||
|
||||
//publish metric that should clear the alarm for the CPU Utilization
|
||||
metricStreamInterface.publish(recordToClearAlarm);
|
||||
|
||||
//wait for the metric to be processed
|
||||
sleep(2 * testTimeBucketMs);
|
||||
|
||||
//verify that alarm was cleared
|
||||
alarms = alarmService.get(customerId, Collections.singleton(equipmentId), Collections.singleton(AlarmCode.CPUUtilization));
|
||||
assertEquals(0, alarms.size());
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAccessPointIsUnreachableAlarm() {
|
||||
int customerId = getNextCustomerId();
|
||||
|
||||
Equipment equipment = new Equipment();
|
||||
equipment.setCustomerId(customerId);
|
||||
equipment.setEquipmentType(EquipmentType.AP);
|
||||
equipment.setInventoryId("testAccessPointIsUnreachableAlarm");
|
||||
equipment.setName(equipment.getInventoryId());
|
||||
equipment = equipmentService.create(equipment);
|
||||
long equipmentId = equipment.getId();
|
||||
|
||||
ServiceMetric record = new ServiceMetric(customerId , equipmentId );
|
||||
//create metric a bit in the future so that it gets picked up by the processor and not simply discarded
|
||||
record.setCreatedTimestamp(System.currentTimeMillis() + testTimeBucketMs);
|
||||
|
||||
ApNodeMetrics apNodeMetrics = new ApNodeMetrics();
|
||||
record.setDetails(apNodeMetrics);
|
||||
|
||||
ApPerformance apPerformance = new ApPerformance();
|
||||
apNodeMetrics.setApPerformance(apPerformance);
|
||||
|
||||
apPerformance.setCpuTemperature(55);
|
||||
|
||||
//we will force the CPUUtilization alarm to be raised
|
||||
apPerformance.setCpuUtilized(new int[] { 50, 50 });
|
||||
|
||||
apPerformance.setFreeMemory(30000000);
|
||||
|
||||
//publish metric that should not trigger AccessPointIsUnreachable alarm
|
||||
metricStreamInterface.publish(record );
|
||||
|
||||
//wait for the metric to be processed
|
||||
sleep(testTimeBucketMs);
|
||||
|
||||
//verify that alarm was not raised
|
||||
List<Alarm> alarms = alarmService.get(customerId, Collections.singleton(equipmentId), Collections.singleton(AlarmCode.AccessPointIsUnreachable));
|
||||
assertEquals(0, alarms.size());
|
||||
|
||||
//Now wait for the alarm to be raised because no service_metrics_collection_config were posted
|
||||
sleep(testTimeBucketMs);
|
||||
|
||||
//verify that alarm was raised
|
||||
for(int i = 0; i < 50; i++) {
|
||||
alarms = alarmService.get(customerId, Collections.singleton(equipmentId), Collections.singleton(AlarmCode.AccessPointIsUnreachable));
|
||||
if(!alarms.isEmpty()) {
|
||||
break;
|
||||
}else {
|
||||
sleep(5);
|
||||
}
|
||||
}
|
||||
assertEquals(1, alarms.size());
|
||||
|
||||
//Now create a metric that should clear the alarm
|
||||
ServiceMetric recordToClearAlarm = record.clone();
|
||||
recordToClearAlarm.setCreatedTimestamp(System.currentTimeMillis() + testTimeBucketMs );
|
||||
|
||||
//publish metric that should clear the AccessPointIsUnreachable alarm
|
||||
metricStreamInterface.publish(recordToClearAlarm);
|
||||
|
||||
//wait for the metric to be processed
|
||||
sleep(testTimeBucketMs);
|
||||
|
||||
//verify that alarm was cleared
|
||||
for(int i = 0; i < 50; i++) {
|
||||
alarms = alarmService.get(customerId, Collections.singleton(equipmentId), Collections.singleton(AlarmCode.AccessPointIsUnreachable));
|
||||
if(alarms.isEmpty()) {
|
||||
break;
|
||||
}else {
|
||||
sleep(5);
|
||||
}
|
||||
}
|
||||
assertEquals(0, alarms.size());
|
||||
|
||||
}
|
||||
|
||||
public int getNextCustomerId() {
|
||||
return (int) testSequence.incrementAndGet();
|
||||
}
|
||||
|
||||
public long getNextEquipmentId() {
|
||||
return testSequence.incrementAndGet();
|
||||
}
|
||||
|
||||
public void sleep(long ms) {
|
||||
try {
|
||||
Thread.sleep( ms );
|
||||
} catch (InterruptedException e) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<configuration>
|
||||
<conversionRule conversionWord="filteredStack"
|
||||
converterClass="com.telecominfraproject.wlan.server.exceptions.logback.ExceptionCompressingConverter" />
|
||||
|
||||
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n%filteredStack%nopex</pattern>
|
||||
<!-- See http://logback.qos.ch/manual/layouts.html for details -->
|
||||
<!-- %ex{5} - add at the end to display only 5 levels of the exception stack trace -->
|
||||
<!-- %nopex - add at the end to not display any of the exception stack traces -->
|
||||
<!-- %ex{full} - add at the end to display all the levels of the exception stack trace -->
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!--
|
||||
details: http://logback.qos.ch/manual/configuration.html#auto_configuration
|
||||
|
||||
runtime configuration, if need to override the defaults:
|
||||
-Dlogging.config=file:///home/ec2-user/opensync/logback.xml
|
||||
|
||||
for log configuration debugging - use
|
||||
-Dlogback.statusListenerClass=ch.qos.logback.core.status.OnConsoleStatusListener
|
||||
|
||||
log levels:
|
||||
OFF ERROR WARN INFO DEBUG TRACE
|
||||
-->
|
||||
<logger name="org.apache.catalina.startup.DigesterFactory" level="ERROR"/>
|
||||
<logger name="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" level="INFO"/>
|
||||
<logger name="org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainer" level="INFO"/>
|
||||
<logger name="org.springframework.security.web.authentication.preauth" level="OFF"/>
|
||||
<logger name="com.netflix.servo.tag.aws.AwsInjectableTag" level="OFF"/>
|
||||
|
||||
<logger name="com.telecominfraproject" level="WARN"/>
|
||||
|
||||
<!--
|
||||
<logger name="com.telecominfraproject.wlan.streams.simple" level="TRACE"/>
|
||||
<logger name="com.telecominfraproject.wlan.streams.equipmentalarms" level="TRACE"/>
|
||||
-->
|
||||
|
||||
<root level="WARN">
|
||||
<appender-ref ref="stdout"/>
|
||||
</root>
|
||||
|
||||
</configuration>
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.telecominfraproject.wlan.equipmentgateway.models;
|
||||
|
||||
public class CEGWMostRecentStatsTimestamp extends CEGatewayCommand {
|
||||
|
||||
private static final long serialVersionUID = -9087897865195978158L;
|
||||
|
||||
public CEGWMostRecentStatsTimestamp() {
|
||||
}
|
||||
|
||||
public CEGWMostRecentStatsTimestamp(CEGWCommandType commandType, String inventoryId, long equipmentId) {
|
||||
super(commandType,inventoryId,equipmentId);
|
||||
}
|
||||
}
|
||||
@@ -344,7 +344,6 @@ components:
|
||||
- cyan
|
||||
- white
|
||||
- off
|
||||
|
||||
CEGWBlinkRequest:
|
||||
description: Turn all LEDs on the AP to blinking, or turn off. The blinkAllLEDs attribute is the only currently supported functionality on the AP.
|
||||
allOf:
|
||||
|
||||
@@ -37,6 +37,7 @@ public abstract class CommonElementConfiguration extends EquipmentDetails implem
|
||||
private AntennaType antennaType;
|
||||
private Boolean costSavingEventsEnabled;
|
||||
private NetworkForwardMode forwardMode;
|
||||
private boolean blinkAllLEDs;
|
||||
|
||||
/**
|
||||
* this constructor is used for CAMI only
|
||||
@@ -69,37 +70,33 @@ public abstract class CommonElementConfiguration extends EquipmentDetails implem
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
if (!super.equals(obj)) {
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (!super.equals(obj))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!(obj instanceof CommonElementConfiguration)) {
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
}
|
||||
CommonElementConfiguration other = (CommonElementConfiguration) obj;
|
||||
return this.antennaType == other.antennaType
|
||||
&& Objects.equals(costSavingEventsEnabled, other.costSavingEventsEnabled)
|
||||
&& this.deploymentType == other.deploymentType && this.deviceMode == other.deviceMode
|
||||
&& Objects.equals(deviceName, other.deviceName)
|
||||
&& Objects.equals(elementConfigVersion, other.elementConfigVersion)
|
||||
&& this.equipmentType == other.equipmentType && this.forwardMode == other.forwardMode
|
||||
&& Objects.equals(frameReportThrottleEnabled, other.frameReportThrottleEnabled)
|
||||
&& this.gettingDNS == other.gettingDNS && this.gettingIP == other.gettingIP
|
||||
&& this.locallyConfigured == other.locallyConfigured
|
||||
&& 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);
|
||||
return antennaType == other.antennaType && blinkAllLEDs == other.blinkAllLEDs && Objects.equals(costSavingEventsEnabled, other.costSavingEventsEnabled)
|
||||
&& deploymentType == other.deploymentType && deviceMode == other.deviceMode && Objects.equals(deviceName, other.deviceName)
|
||||
&& Objects.equals(elementConfigVersion, other.elementConfigVersion) && Objects.equals(equipmentType, other.equipmentType)
|
||||
&& forwardMode == other.forwardMode && Objects.equals(frameReportThrottleEnabled, other.frameReportThrottleEnabled)
|
||||
&& gettingDNS == other.gettingDNS && gettingIP == other.gettingIP && locallyConfigured == other.locallyConfigured
|
||||
&& 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() {
|
||||
@@ -189,14 +186,6 @@ public abstract class CommonElementConfiguration extends EquipmentDetails implem
|
||||
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
|
||||
public boolean hasUnsupportedValue() {
|
||||
if (super.hasUnsupportedValue()) {
|
||||
@@ -311,4 +300,13 @@ public abstract class CommonElementConfiguration extends EquipmentDetails implem
|
||||
public void setSyntheticClientEnabled(Boolean syntheticClientEnabled) {
|
||||
this.syntheticClientEnabled = syntheticClientEnabled;
|
||||
}
|
||||
|
||||
public boolean isBlinkAllLEDs() {
|
||||
return blinkAllLEDs;
|
||||
}
|
||||
|
||||
public void setBlinkAllLEDs(boolean blinkAllLEDs) {
|
||||
this.blinkAllLEDs = blinkAllLEDs;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@ public class ElementRadioConfiguration extends BaseJsonModel
|
||||
|
||||
if (radioType == RadioType.is5GHz) {
|
||||
returnValue.setChannelNumber(36);
|
||||
returnValue.setBackupChannelNumber(153);
|
||||
returnValue.setBackupChannelNumber(44);
|
||||
} else if (radioType == RadioType.is5GHzL) {
|
||||
returnValue.setChannelNumber(36);
|
||||
returnValue.setBackupChannelNumber(44);
|
||||
|
||||
@@ -118,33 +118,40 @@ public class EquipmentRrmBulkUpdateItem extends BaseJsonModel {
|
||||
finalDetails.getRadioMap().put(rt, erc);
|
||||
}
|
||||
|
||||
if(erc.getManualChannelNumber()== null || erc.getManualChannelNumber().intValue() != updateDetails.getChannelNumber()) {
|
||||
if(erc.getManualChannelNumber() == null
|
||||
|| erc.getManualChannelNumber().intValue() != updateDetails.getChannelNumber()) {
|
||||
erc.setManualChannelNumber(updateDetails.getChannelNumber());
|
||||
modelChanged.set(true);
|
||||
}
|
||||
|
||||
if(erc.getManualBackupChannelNumber()== null ||
|
||||
erc.getManualBackupChannelNumber().intValue() != updateDetails.getBackupChannelNumber()) {
|
||||
if(erc.getManualBackupChannelNumber() == null
|
||||
|| erc.getManualBackupChannelNumber().intValue() != updateDetails.getBackupChannelNumber()) {
|
||||
erc.setManualBackupChannelNumber(updateDetails.getBackupChannelNumber());
|
||||
modelChanged.set(true);
|
||||
}
|
||||
|
||||
if ((erc.getClientDisconnectThresholdDb() == null && updateDetails.getClientDisconnectThresholdDb() != null)
|
||||
|| !erc.getClientDisconnectThresholdDb().equals(updateDetails.getClientDisconnectThresholdDb())) {
|
||||
erc.setClientDisconnectThresholdDb(updateDetails.getClientDisconnectThresholdDb());
|
||||
modelChanged.set(true);
|
||||
if (updateDetails.getClientDisconnectThresholdDb() != null) {
|
||||
if ((erc.getClientDisconnectThresholdDb() == null && updateDetails.getClientDisconnectThresholdDb() != null)
|
||||
|| !erc.getClientDisconnectThresholdDb().equals(updateDetails.getClientDisconnectThresholdDb())) {
|
||||
erc.setClientDisconnectThresholdDb(updateDetails.getClientDisconnectThresholdDb());
|
||||
modelChanged.set(true);
|
||||
}
|
||||
}
|
||||
|
||||
if ((erc.getProbeResponseThresholdDb() == null && updateDetails.getProbeResponseThresholdDb() != null)
|
||||
|| !erc.getProbeResponseThresholdDb().equals(updateDetails.getProbeResponseThresholdDb())) {
|
||||
erc.setProbeResponseThresholdDb(updateDetails.getProbeResponseThresholdDb());
|
||||
modelChanged.set(true);
|
||||
if (updateDetails.getProbeResponseThresholdDb() != null) {
|
||||
if ((erc.getProbeResponseThresholdDb() == null && updateDetails.getProbeResponseThresholdDb() != null)
|
||||
|| !erc.getProbeResponseThresholdDb().equals(updateDetails.getProbeResponseThresholdDb())) {
|
||||
erc.setProbeResponseThresholdDb(updateDetails.getProbeResponseThresholdDb());
|
||||
modelChanged.set(true);
|
||||
}
|
||||
}
|
||||
|
||||
if ((erc.getRxCellSizeDb() == null && updateDetails.getRxCellSizeDb() != null)
|
||||
|| !erc.getRxCellSizeDb().equals(updateDetails.getRxCellSizeDb())) {
|
||||
erc.setRxCellSizeDb(updateDetails.getRxCellSizeDb());
|
||||
modelChanged.set(true);
|
||||
if (updateDetails.getRxCellSizeDb() != null) {
|
||||
if ((erc.getRxCellSizeDb() == null && updateDetails.getRxCellSizeDb() != null)
|
||||
|| !erc.getRxCellSizeDb().equals(updateDetails.getRxCellSizeDb())) {
|
||||
erc.setRxCellSizeDb(updateDetails.getRxCellSizeDb());
|
||||
modelChanged.set(true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -10,11 +10,11 @@ import com.telecominfraproject.wlan.core.model.json.JsonDeserializationUtils;
|
||||
|
||||
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 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) {
|
||||
this.id = id;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>equipment-service-remote</artifactId>
|
||||
<name>equipment-service-remote</name>
|
||||
<description>Remote client for accessing the service, uses REST API calls.</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<artifactId>equipment-service-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>base-client</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<artifactId>equipment-service-remote</artifactId>
|
||||
<name>equipment-service-remote</name>
|
||||
<description>Remote client for accessing the service, uses REST API calls.</description>
|
||||
|
||||
<!-- Dependencies for the unit tests -->
|
||||
<dependency>
|
||||
<artifactId>base-remote-tests</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>equipment-service</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<artifactId>equipment-service-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>base-client</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>cloud-event-dispatcher-empty</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<!-- Dependencies for the unit tests -->
|
||||
<dependency>
|
||||
<artifactId>base-remote-tests</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<dependency>
|
||||
<artifactId>equipment-service</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>equipment-datastore-inmemory</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>cloud-event-dispatcher-empty</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -932,9 +932,9 @@ public class EquipmentServiceRemoteTest extends BaseRemoteTest {
|
||||
assertEquals(11, radioMap.get(RadioType.is2dot4GHz).getManualBackupChannelNumber().intValue());
|
||||
|
||||
assertEquals(36, radioMap.get(RadioType.is5GHz).getChannelNumber().intValue());
|
||||
assertEquals(153, radioMap.get(RadioType.is5GHz).getBackupChannelNumber().intValue());
|
||||
assertEquals(44, radioMap.get(RadioType.is5GHz).getBackupChannelNumber().intValue());
|
||||
assertEquals(36, radioMap.get(RadioType.is5GHz).getManualChannelNumber().intValue());
|
||||
assertEquals(153, radioMap.get(RadioType.is5GHz).getManualBackupChannelNumber().intValue());
|
||||
assertEquals(44, radioMap.get(RadioType.is5GHz).getManualBackupChannelNumber().intValue());
|
||||
|
||||
Map<RadioType, Integer> primaryChannels = new EnumMap<>(RadioType.class);
|
||||
Map<RadioType, Integer> backupChannels = new EnumMap<>(RadioType.class);
|
||||
@@ -970,7 +970,7 @@ public class EquipmentServiceRemoteTest extends BaseRemoteTest {
|
||||
assertEquals(6, radioMap.get(RadioType.is2dot4GHz).getManualBackupChannelNumber().intValue());
|
||||
|
||||
assertEquals(36, radioMap.get(RadioType.is5GHz).getChannelNumber().intValue());
|
||||
assertEquals(153, radioMap.get(RadioType.is5GHz).getBackupChannelNumber().intValue());
|
||||
assertEquals(44, radioMap.get(RadioType.is5GHz).getBackupChannelNumber().intValue());
|
||||
assertEquals(40, radioMap.get(RadioType.is5GHz).getManualChannelNumber().intValue());
|
||||
assertEquals(48, radioMap.get(RadioType.is5GHz).getManualBackupChannelNumber().intValue());
|
||||
|
||||
@@ -980,7 +980,7 @@ public class EquipmentServiceRemoteTest extends BaseRemoteTest {
|
||||
|
||||
backupChannels.clear();
|
||||
backupChannels.put(RadioType.is2dot4GHz, 6);
|
||||
backupChannels.put(RadioType.is5GHz, 44);
|
||||
backupChannels.put(RadioType.is5GHz, 149);
|
||||
|
||||
autoChannelSelections.clear();
|
||||
autoChannelSelections.put(RadioType.is2dot4GHz, true);
|
||||
@@ -1007,7 +1007,7 @@ public class EquipmentServiceRemoteTest extends BaseRemoteTest {
|
||||
assertEquals(6, radioMap.get(RadioType.is2dot4GHz).getManualBackupChannelNumber().intValue());
|
||||
|
||||
assertEquals(161, radioMap.get(RadioType.is5GHz).getChannelNumber().intValue());
|
||||
assertEquals(44, radioMap.get(RadioType.is5GHz).getBackupChannelNumber().intValue());
|
||||
assertEquals(149, radioMap.get(RadioType.is5GHz).getBackupChannelNumber().intValue());
|
||||
assertEquals(40, radioMap.get(RadioType.is5GHz).getManualChannelNumber().intValue());
|
||||
assertEquals(48, radioMap.get(RadioType.is5GHz).getManualBackupChannelNumber().intValue());
|
||||
|
||||
|
||||
@@ -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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>equipment-service</artifactId>
|
||||
<name>equipment-service</name>
|
||||
<description>Server side implementation of the service.</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<artifactId>base-container</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>cloud-event-dispatcher-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</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>
|
||||
<artifactId>equipment-service</artifactId>
|
||||
<name>equipment-service</name>
|
||||
<description>Server side implementation of the service.</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<artifactId>alarm-service-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>cloud-event-dispatcher-empty</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>base-container</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<dependency>
|
||||
<artifactId>cloud-event-dispatcher-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</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>
|
||||
<artifactId>cloud-event-dispatcher-empty</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
@@ -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.events.EquipmentAddedEvent;
|
||||
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.EquipmentChangedEvent;
|
||||
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.server.exceptions.ConfigurationException;
|
||||
import com.telecominfraproject.wlan.systemevent.models.SystemEvent;
|
||||
|
||||
|
||||
/**
|
||||
* @author dtoptygin
|
||||
*
|
||||
@@ -73,7 +74,6 @@ public class EquipmentController {
|
||||
@Autowired private EquipmentDatastore equipmentDatastore;
|
||||
@Autowired private CloudEventDispatcherInterface cloudEventDispatcher;
|
||||
|
||||
|
||||
/**
|
||||
* Creates new Equipment.
|
||||
*
|
||||
@@ -280,18 +280,25 @@ public class EquipmentController {
|
||||
LOG.debug("Updated Equipment {}", ret);
|
||||
|
||||
EquipmentChangedEvent event;
|
||||
if ((equipment.getProfileId() != existingEquipment.getProfileId()) || (existingApElementConfig != null && updatedApElementConfig != null &&
|
||||
if (ret.getCustomerId() != existingEquipment.getCustomerId()) {
|
||||
publishEvent(new EquipmentCustomerChangedEvent(existingEquipment, ret));
|
||||
}
|
||||
if ((ret.getProfileId() != existingEquipment.getProfileId()) ||
|
||||
ret.getLocationId() != existingEquipment.getLocationId() ||
|
||||
(existingApElementConfig != null && updatedApElementConfig != null &&
|
||||
updatedApElementConfig.needsToBeUpdatedOnDevice(existingApElementConfig))) {
|
||||
event = new EquipmentApImpactingChangedEvent(ret);
|
||||
} else if (existingApElementConfig != null && existingApElementConfig.isBlinkAllLEDs() != updatedApElementConfig.isBlinkAllLEDs()) {
|
||||
LOG.debug("Updated BlinkingLEDs {}", ret);
|
||||
event = new EquipmentBlinkLEDsEvent(ret);
|
||||
} else {
|
||||
event = new EquipmentChangedEvent(ret);
|
||||
}
|
||||
publishEvent(event);
|
||||
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
private void validateChannelNum(Equipment equipment) {
|
||||
if (equipment.getDetails() instanceof ApElementConfiguration) {
|
||||
ApElementConfiguration apElementConfiguration = (ApElementConfiguration) equipment.getDetails();
|
||||
|
||||
@@ -220,6 +220,8 @@ components:
|
||||
type: boolean
|
||||
forwardMode:
|
||||
$ref: '#/components/schemas/NetworkForwardMode'
|
||||
blinkAllLEDs:
|
||||
type: boolean
|
||||
radioMap:
|
||||
$ref: '#/components/schemas/RadioMap'
|
||||
advancedRadioMap:
|
||||
|
||||
@@ -34,7 +34,7 @@ import com.telecominfraproject.wlan.equipment.models.Equipment;
|
||||
EquipmentController.class,
|
||||
CloudEventDispatcherEmpty.class,
|
||||
EquipmentDatastoreInMemory.class,
|
||||
EquipmentControllerTest.Config.class,
|
||||
EquipmentControllerTest.Config.class
|
||||
})
|
||||
public class EquipmentControllerTest {
|
||||
|
||||
|
||||
@@ -48,11 +48,12 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
||||
* To test this method:
|
||||
* curl --digest --user user:password --request POST --insecure --header "Content-Type: application/json; charset=utf-8" --data '' https://localhost:7072/api/portFwd/createSession/inventoryId/dev-ap-0001/port/22/
|
||||
*
|
||||
* @param inventoryId
|
||||
* @param connectToPortOnEquipment
|
||||
* @param inventoryId: Equipment's AssetId
|
||||
* @param connectToPortOnEquipment: Port to connect on the AP
|
||||
* @return session id of a newly created forwarder session
|
||||
*/
|
||||
public String startForwarderSession(final String inventoryId, int connectToPortOnEquipment){
|
||||
LOG.debug("Received create Session request for inventoryId {} on port {}", inventoryId, connectToPortOnEquipment);
|
||||
//inventoryId is used to tie ForwarderSession to WebSocketSession
|
||||
|
||||
try {
|
||||
@@ -191,7 +192,7 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
||||
LOG.debug("[{}] Stopped polling inputstream on local socket {}", inventoryId, localSocket.getPort());
|
||||
|
||||
} catch (IOException e) {
|
||||
LOG.error("[{}] Session {} got exception {} for the socket on port {}", inventoryId, forwarderSession.getSessionId(), e, port);
|
||||
LOG.error("[{}] Session {} got IOException {} for the socket on port {}", inventoryId, forwarderSession.getSessionId(), port, e);
|
||||
} finally {
|
||||
|
||||
//notify the other end that forwarding session is terminated
|
||||
@@ -209,7 +210,7 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
||||
localSocket.close();
|
||||
forwarderSession.getServerSocket().close();
|
||||
} catch (IOException e) {
|
||||
//do nothing here
|
||||
LOG.error("IO Exception when closing socket", e);
|
||||
}
|
||||
|
||||
sessionIdToForwarderSessionMap.remove(forwarderSession.getSessionId());
|
||||
@@ -232,12 +233,12 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
||||
socketInputStreamReaderThread.setDaemon(true);
|
||||
forwarderSession.setSocketStreamReaderThread(socketInputStreamReaderThread);
|
||||
|
||||
} catch (IOException e) {
|
||||
LOG.error("[{}] error accepting conection on port {} - closing forwarding session {}", inventoryId, listenOnLocalPort, forwarderSession.getSessionId());
|
||||
} catch (Exception e) {
|
||||
LOG.error("[{}] error accepting connection on port {} - closing forwarding session {}", inventoryId, listenOnLocalPort, forwarderSession.getSessionId(), e);
|
||||
try {
|
||||
serverSocket.close();
|
||||
} catch (IOException e1) {
|
||||
// do nothing here
|
||||
LOG.error("IO Exception when closing socket", e1);
|
||||
}
|
||||
sessionIdToForwarderSessionMap.remove(forwarderSession.getSessionId());
|
||||
}
|
||||
@@ -259,6 +260,7 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
||||
}
|
||||
|
||||
public void stopForwarderSession(String sessionId){
|
||||
LOG.debug("Received stop forwarding Session request for sessionId {}", sessionId);
|
||||
ForwarderSession forwarderSession = sessionIdToForwarderSessionMap.get(sessionId);
|
||||
if(forwarderSession==null){
|
||||
LOG.info("Could not find session {}", sessionId);
|
||||
@@ -266,6 +268,7 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
||||
}
|
||||
|
||||
try {
|
||||
LOG.debug("Found forwarderSession {} for sessionId {}", forwarderSession, sessionId);
|
||||
//find websocket session by inventoryId and send control messages to disconnect from target port on the client side of the port forwarder
|
||||
WebSocketSession webSocketSession = webSocketSessionMap.get(forwarderSession.getInventoryId());
|
||||
TextMessage message = new TextMessage(DISCONNECT_FROM_CE_PORT_COMMAND + forwarderSession.getConnectToPortOnEquipment());
|
||||
@@ -274,11 +277,11 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
||||
LOG.debug("[{}] Session {} sent command {}", forwarderSession.getInventoryId(), forwarderSession.getSessionId(), message.getPayload());
|
||||
}
|
||||
|
||||
if(forwarderSession.getServerSocket()!=null){
|
||||
if(forwarderSession.getServerSocket() != null){
|
||||
forwarderSession.getServerSocket().close();
|
||||
}
|
||||
|
||||
if(forwarderSession.getLocalSocket()!=null){
|
||||
if(forwarderSession.getLocalSocket() != null){
|
||||
forwarderSession.getLocalSocket().close();
|
||||
}
|
||||
//stream reader will stop in a separate thread by themselves
|
||||
@@ -286,10 +289,9 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
||||
sessionIdToForwarderSessionMap.remove(forwarderSession.getSessionId());
|
||||
|
||||
} catch (IOException e) {
|
||||
// do nothing here
|
||||
LOG.error("Encountered IOException when closing connection for forwarder session {}", forwarderSession, e);
|
||||
sessionIdToForwarderSessionMap.remove(forwarderSession.getSessionId());
|
||||
}
|
||||
|
||||
sessionIdToForwarderSessionMap.remove(forwarderSession.getSessionId());
|
||||
|
||||
LOG.info("[{}] Stopped forwarder session {}", forwarderSession.getInventoryId(), sessionId);
|
||||
}
|
||||
@@ -322,7 +324,6 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
||||
if(payload.indexOf(':')>0){
|
||||
port = Integer.parseInt(payload.substring(payload.indexOf(':')+1));
|
||||
}
|
||||
|
||||
//find forwarderSession by inventoryId and CEPort
|
||||
ForwarderSession forwarderSession = null;
|
||||
for(ForwarderSession fs: sessionIdToForwarderSessionMap.values()){
|
||||
@@ -332,7 +333,7 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
||||
}
|
||||
}
|
||||
|
||||
LOG.debug("[{}] Session {} got message {}", webSocketSessionKey, session, payload);
|
||||
LOG.debug("[{}] Session {} got message {} with forwarderSession {}", webSocketSessionKey, session, payload, forwarderSession);
|
||||
|
||||
if(payload.startsWith(CONNECTED_TO_CE_PORT_MSG)){
|
||||
//start reader thread to forward packets from local socket to websocket
|
||||
@@ -371,10 +372,8 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
||||
*/
|
||||
@Override
|
||||
protected void handleBinaryMessage(WebSocketSession session, BinaryMessage message) throws Exception {
|
||||
|
||||
//TODO: may need to have message ack for each binary packet, and do not send the next packet until previous one has been acknowledged
|
||||
//DT: this has not been an issue so far
|
||||
|
||||
String webSocketSessionKey = getWebSocketSessionKey(session);
|
||||
|
||||
ByteBuffer payload = message.getPayload();
|
||||
@@ -384,6 +383,7 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
||||
|
||||
//find forwarderSession by inventoryId and CEPort
|
||||
ForwarderSession forwarderSession = null;
|
||||
|
||||
for(ForwarderSession fs: sessionIdToForwarderSessionMap.values()){
|
||||
if(fs.getInventoryId().equals(webSocketSessionKey) && fs.getConnectToPortOnEquipment()==port){
|
||||
forwarderSession = fs;
|
||||
@@ -419,6 +419,14 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
||||
}
|
||||
} else {
|
||||
LOG.debug("[{}] Session {} received message that cannot be delivered because local socket is inoperable {}", webSocketSessionKey, session, message);
|
||||
if (forwarderSession == null) {
|
||||
LOG.debug("forwarderSession not found for webSocketSessionKey {}", webSocketSessionKey);
|
||||
} else if (forwarderSession.getLocalSocket() == null) {
|
||||
LOG.debug("forwarderSession local socket is null for webSocketSessionKey {}", webSocketSessionKey);
|
||||
} else {
|
||||
LOG.debug("forwarderSession local socket for webSocketSessionKey {} is closed = {} and connected = {} ",
|
||||
webSocketSessionKey, forwarderSession.getLocalSocket().isClosed(), forwarderSession.getLocalSocket().isConnected());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -442,28 +450,29 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) throws Exception {
|
||||
LOG.info("[{}] Closed portForwarder websocket connection {} : {}", getWebSocketSessionKey(session), session, closeStatus);
|
||||
|
||||
public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) {
|
||||
String webSocketSessionKey = getWebSocketSessionKey(session);
|
||||
webSocketSessionMap.remove(webSocketSessionKey);
|
||||
|
||||
//close and remove all forwarder sessions for that CE
|
||||
LOG.info("[{}] Closed portForwarder websocket connection {} : {}", webSocketSessionKey, session, closeStatus);
|
||||
|
||||
Iterator<ForwarderSession> iter = sessionIdToForwarderSessionMap.values().iterator();
|
||||
while(iter.hasNext()){
|
||||
ForwarderSession fs = iter.next();
|
||||
if(fs.getInventoryId().equals(webSocketSessionKey) ){
|
||||
if(fs.getLocalSocket()!=null && !fs.getLocalSocket().isClosed()){
|
||||
fs.getLocalSocket().close();
|
||||
}
|
||||
if(fs.getServerSocket()!=null && !fs.getServerSocket().isClosed()){
|
||||
fs.getServerSocket().close();
|
||||
webSocketSessionMap.remove(webSocketSessionKey);
|
||||
//close and remove all forwarder sessions for that CE
|
||||
try {
|
||||
Iterator<ForwarderSession> iter = sessionIdToForwarderSessionMap.values().iterator();
|
||||
while (iter.hasNext()) {
|
||||
ForwarderSession fs = iter.next();
|
||||
if (fs.getInventoryId().equals(webSocketSessionKey)) {
|
||||
if (fs.getLocalSocket() != null && !fs.getLocalSocket().isClosed()) {
|
||||
fs.getLocalSocket().close();
|
||||
}
|
||||
if (fs.getServerSocket() != null && !fs.getServerSocket().isClosed()) {
|
||||
fs.getServerSocket().close();
|
||||
}
|
||||
iter.remove();
|
||||
}
|
||||
}
|
||||
iter.remove();
|
||||
} catch (Exception ex) {
|
||||
LOG.error("Encountered exception when closing-sockets and removing sessions for Key {} ", webSocketSessionKey, ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private String getWebSocketSessionKey(WebSocketSession session) {
|
||||
|
||||
@@ -118,6 +118,49 @@
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- test dependencies -->
|
||||
<dependency>
|
||||
<artifactId>equipment-service-local</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>equipment-service</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>equipment-datastore-inmemory</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>cloud-event-dispatcher-empty</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>profile-service-local</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>profile-service</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>profile-datastore-inmemory</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
||||
|
||||
@@ -12,8 +12,10 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import com.telecominfraproject.wlan.core.model.json.GenericResponse;
|
||||
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.RadioChannelChangeSettings;
|
||||
import com.telecominfraproject.wlan.equipment.models.events.EquipmentBlinkLEDsEvent;
|
||||
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWBlinkRequest;
|
||||
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWCommandResultCode;
|
||||
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWFirmwareDownloadRequest;
|
||||
@@ -137,11 +139,12 @@ public class EquipmentGatewayPortalController {
|
||||
return new GenericResponse(false, "Failed to trigger AP factory reset: " + response.getResultCode() + " " + response.getResultDetail());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/equipmentGateway/requestApBlinkLEDs", method = RequestMethod.POST)
|
||||
public GenericResponse requestApBlinkLEDs(@RequestParam long equipmentId, @RequestParam boolean blinkAllLEDs) {
|
||||
String action = "stop blinking LEDs on AP ";
|
||||
if (blinkAllLEDs) action = "start blinking LEDs on AP ";
|
||||
String action = "stop blinking LEDs on AP";
|
||||
if (blinkAllLEDs)
|
||||
action = "start blinking LEDs on AP";
|
||||
Equipment equipment = equipmentServiceInterface.get(equipmentId);
|
||||
LOG.debug("Request {} for AP {}", action, equipment.getInventoryId());
|
||||
|
||||
@@ -150,10 +153,12 @@ public class EquipmentGatewayPortalController {
|
||||
apBlinkLEDs.setBlinkAllLEDs(blinkAllLEDs);
|
||||
|
||||
EquipmentCommandResponse response = equipmentGatewayServiceInterface.sendCommand(apBlinkLEDs);
|
||||
LOG.debug("{} response {}", action,response);
|
||||
|
||||
LOG.debug("{} response {}", action, response);
|
||||
|
||||
if (response.getResultCode() == CEGWCommandResultCode.Success) {
|
||||
ApElementConfiguration apElementConfig = (ApElementConfiguration) equipment.getDetails();
|
||||
apElementConfig.setBlinkAllLEDs(blinkAllLEDs);
|
||||
equipmentServiceInterface.update(equipment);
|
||||
return new GenericResponse(true, "");
|
||||
} else {
|
||||
return new GenericResponse(false, "Failed to " + action + " for AP: " + response.getResultCode() + " " + response.getResultDetail());
|
||||
|
||||
@@ -158,55 +158,66 @@ public class ProfilePortalController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping(value = "/profile/equipmentCounts", method = RequestMethod.GET)
|
||||
public ListOfPairLongLong getCountsOfEquipmentThatUseProfiles(@RequestParam Set<Long> profileIdSet) {
|
||||
LOG.debug("getCountsOfEquipmentThatUseProfiles({})", profileIdSet);
|
||||
|
||||
//first get top-level profiles for the supplied set - only top-level profiles are linked to equipment
|
||||
List<PairLongLong> topLevelProfiles = this.profileServiceInterface.getTopLevelProfiles(profileIdSet);
|
||||
Map<Long, AtomicInteger> profileIdToCountMap = new HashMap<Long, AtomicInteger>();
|
||||
profileIdSet.forEach(profileId -> profileIdToCountMap.put(profileId, new AtomicInteger(0)));
|
||||
|
||||
//Maps child at all top level profiles that reference it. A top level profile references itself int this map
|
||||
Map<Long, List<Long>> childProfileToTopProfileMap = new HashMap<Long, List<Long>>();
|
||||
|
||||
List<PairLongLong> topLevelProfileList = profileServiceInterface.getTopLevelProfiles(profileIdSet);
|
||||
Set<Long> topProfileIdSet= new HashSet<Long>();
|
||||
|
||||
topLevelProfileList.forEach(pair ->
|
||||
{
|
||||
if (childProfileToTopProfileMap.putIfAbsent(
|
||||
pair.getValue1(),
|
||||
new ArrayList<Long>() {{ add(pair.getValue2());}}
|
||||
) != null)
|
||||
{
|
||||
childProfileToTopProfileMap.compute(pair.getValue1(), (k,v) ->
|
||||
new ArrayList<Long>() {{
|
||||
addAll(v);
|
||||
add(pair.getValue2());}});
|
||||
}
|
||||
topProfileIdSet.add(pair.getValue2());
|
||||
});
|
||||
|
||||
Map<Long, AtomicInteger> topProfileToEquipmentCountMap = new HashMap<>();
|
||||
topProfileIdSet.forEach(p -> topProfileToEquipmentCountMap.put(p, new AtomicInteger()));
|
||||
|
||||
PaginationContext<PairLongLong> context = new PaginationContext<>(500);
|
||||
equipmentServiceInterface.getEquipmentIdsByProfileIds(topProfileIdSet, context);
|
||||
|
||||
while(!context.isLastPage()) {
|
||||
PaginationResponse<PairLongLong> page = equipmentServiceInterface.getEquipmentIdsByProfileIds(topProfileIdSet, context );
|
||||
context = page.getContext();
|
||||
|
||||
page.getItems().forEach(p -> {
|
||||
AtomicInteger cnt = topProfileToEquipmentCountMap.get(p.getValue1());
|
||||
if(cnt!=null) {
|
||||
cnt.incrementAndGet();
|
||||
}
|
||||
});
|
||||
|
||||
LOG.debug("Page {} - counted {} equipmentids", context.getLastReturnedPageNumber(), context.getTotalItemsReturned());
|
||||
}
|
||||
|
||||
// assemble profile count for return, using child to top level profile id map
|
||||
childProfileToTopProfileMap.forEach((childKey,TopLevelIdList) ->
|
||||
{
|
||||
for (Long topProfileId : TopLevelIdList)
|
||||
{
|
||||
profileIdToCountMap.get(childKey).addAndGet(topProfileToEquipmentCountMap.get(topProfileId).get());
|
||||
}
|
||||
});
|
||||
//package results to get equipment counts for the original profile ids
|
||||
ListOfPairLongLong ret = new ListOfPairLongLong();
|
||||
profileIdToCountMap.forEach((id, count) -> ret.add(new PairLongLong(id, count.get())));
|
||||
|
||||
//map each supplied profile to its top-level parent
|
||||
Map<Long, Long> profileIdToTopProfileIdMap = new HashMap<>();
|
||||
topLevelProfiles.forEach(pair -> profileIdToTopProfileIdMap.put(pair.getValue1(), pair.getValue2()));
|
||||
|
||||
//gather top-level profile ids
|
||||
Set<Long> topProfileIds = new HashSet<>();
|
||||
topLevelProfiles.forEach(pair -> topProfileIds.add(pair.getValue2()));
|
||||
|
||||
|
||||
//TODO: this may be more efficiently done by a specialized count method on equipment datastore
|
||||
|
||||
//now get pages of equipmentIds that refer to the top-level profiles and count the equipmentIds
|
||||
PaginationContext<PairLongLong> context = new PaginationContext<>(500);
|
||||
this.equipmentServiceInterface.getEquipmentIdsByProfileIds(topProfileIds, context );
|
||||
|
||||
//prepare map of top-level profileId to the count of equipmentIds
|
||||
Map<Long, AtomicInteger> topProfileIdToEquipmentCountsMap = new HashMap<>();
|
||||
topProfileIds.forEach(p -> topProfileIdToEquipmentCountsMap.put(p, new AtomicInteger()));
|
||||
|
||||
while(!context.isLastPage()) {
|
||||
PaginationResponse<PairLongLong> page = equipmentServiceInterface.getEquipmentIdsByProfileIds(topProfileIds, context );
|
||||
context = page.getContext();
|
||||
|
||||
page.getItems().forEach(p -> {
|
||||
AtomicInteger cnt = topProfileIdToEquipmentCountsMap.get(p.getValue1());
|
||||
if(cnt!=null) {
|
||||
cnt.incrementAndGet();
|
||||
}
|
||||
});
|
||||
|
||||
LOG.debug("Page {} - counted {} equipmentids", context.getLastReturnedPageNumber(), context.getTotalItemsReturned());
|
||||
}
|
||||
|
||||
|
||||
//package results to get equipment counts for the original profile ids
|
||||
profileIdToTopProfileIdMap.forEach((p, tp) -> ret.add(new PairLongLong(p, topProfileIdToEquipmentCountsMap.get(tp).intValue())));
|
||||
|
||||
LOG.debug("getCountsOfEquipmentThatUseProfiles({}) return {}", profileIdSet, ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,200 @@
|
||||
package com.telecominfraproject.wlan.portal.controller.profile;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.atomic.AtomicLong;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.jupiter.api.BeforeEach;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.boot.test.context.SpringBootTest.WebEnvironment;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import com.telecominfraproject.wlan.cloudeventdispatcher.CloudEventDispatcherEmpty;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.EquipmentType;
|
||||
import com.telecominfraproject.wlan.core.model.pair.PairLongLong;
|
||||
import com.telecominfraproject.wlan.equipment.EquipmentServiceLocal;
|
||||
import com.telecominfraproject.wlan.equipment.controller.EquipmentController;
|
||||
import com.telecominfraproject.wlan.equipment.datastore.EquipmentDatastore;
|
||||
import com.telecominfraproject.wlan.equipment.datastore.inmemory.EquipmentDatastoreInMemory;
|
||||
import com.telecominfraproject.wlan.equipment.models.Equipment;
|
||||
import com.telecominfraproject.wlan.portal.controller.profile.ProfilePortalController.ListOfPairLongLong;
|
||||
import com.telecominfraproject.wlan.profile.ProfileServiceLocal;
|
||||
import com.telecominfraproject.wlan.profile.controller.ProfileController;
|
||||
import com.telecominfraproject.wlan.profile.datastore.ProfileDatastore;
|
||||
import com.telecominfraproject.wlan.profile.datastore.inmemory.ProfileDatastoreInMemory;
|
||||
import com.telecominfraproject.wlan.profile.models.Profile;
|
||||
import com.telecominfraproject.wlan.profile.models.ProfileByCustomerRequestFactory;
|
||||
import com.telecominfraproject.wlan.profile.models.ProfileType;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@ActiveProfiles(profiles = {
|
||||
"integration_test",
|
||||
}) //NOTE: these profiles will be ADDED to the list of active profiles
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.NONE, classes = ProfilePortalControllerTest.class)
|
||||
@Import(value = {
|
||||
EquipmentServiceLocal.class,
|
||||
EquipmentController.class,
|
||||
EquipmentDatastoreInMemory.class,
|
||||
ProfileServiceLocal.class,
|
||||
ProfileController.class,
|
||||
ProfileDatastoreInMemory.class,
|
||||
ProfileByCustomerRequestFactory.class,
|
||||
CloudEventDispatcherEmpty.class,
|
||||
ProfilePortalController.class
|
||||
})
|
||||
public class ProfilePortalControllerTest {
|
||||
private static AtomicLong profileIncrementer = new AtomicLong(1);
|
||||
private static AtomicLong equipmentIncrementer = new AtomicLong(1);
|
||||
private static Set<Long> profileIds = new HashSet<Long>();
|
||||
private static Set<Long> equipmentIds = new HashSet<Long>();
|
||||
|
||||
@Autowired private ProfilePortalController profilePortalController;
|
||||
@Autowired private EquipmentDatastore equipmentDatastore;
|
||||
@Autowired private ProfileDatastore profileDatastore;
|
||||
|
||||
@BeforeEach
|
||||
public void setup()
|
||||
{
|
||||
profileIds.clear();
|
||||
equipmentIds.clear();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getCountsOfEquipmentThatUseProfilesTest()
|
||||
{
|
||||
|
||||
Profile parentProfile_1 = createProfile(); // 3 equipment
|
||||
Profile parentProfile_2 = createProfile(); // 2 equipment
|
||||
Profile parentProfile_3 = createProfile(); // 1 equipment
|
||||
|
||||
Profile ssidProfile_1 = createSsidProfile(); // linked to parent ids: 1 = 3 expected count
|
||||
Profile ssidProfile_2 = createSsidProfile(); // linked to parent ids: 1,2 = 5 expected count
|
||||
Profile ssidProfile_3 = createSsidProfile(); // linked to parent ids: 3 = 1 expected count
|
||||
|
||||
Profile captivePortalProfile_1 = createCaptivePortalProfile(); // linked to 4 -> 1 = 3 expected count
|
||||
Profile captivePortalProfile_2 = createCaptivePortalProfile(); // linked to 5 and 6 -> 5 + 1 = 6 expected count
|
||||
|
||||
Profile radiusProfile_1 = createRadiusProfile(); // 7, 8 -> 4, 5, 6 -> 1 , 2 , 3 -> 6 expected
|
||||
Profile radiusProfile_2 = createRadiusProfile(); // 0 expected
|
||||
|
||||
// link ssid to AP profiles
|
||||
linkChildToParent(ssidProfile_1.getId(), parentProfile_1.getId());
|
||||
linkChildToParent(ssidProfile_2.getId(), parentProfile_1.getId());
|
||||
linkChildToParent(ssidProfile_2.getId(), parentProfile_2.getId());
|
||||
linkChildToParent(ssidProfile_3.getId(), parentProfile_3.getId());
|
||||
|
||||
//link captive portal profiles to ssid profiles
|
||||
linkChildToParent(captivePortalProfile_1.getId(), ssidProfile_1.getId());
|
||||
linkChildToParent(captivePortalProfile_2.getId(), ssidProfile_2.getId());
|
||||
linkChildToParent(captivePortalProfile_2.getId(), ssidProfile_3.getId());
|
||||
|
||||
//link radius profiles to captive portal profiles
|
||||
linkChildToParent(radiusProfile_1.getId(), captivePortalProfile_1.getId());
|
||||
linkChildToParent(radiusProfile_1.getId(), captivePortalProfile_2.getId());
|
||||
|
||||
createEquipment(parentProfile_1.getId());
|
||||
createEquipment(parentProfile_1.getId());
|
||||
createEquipment(parentProfile_1.getId());
|
||||
createEquipment(parentProfile_2.getId());
|
||||
createEquipment(parentProfile_2.getId());
|
||||
createEquipment(parentProfile_3.getId());
|
||||
|
||||
ListOfPairLongLong ret = profilePortalController.getCountsOfEquipmentThatUseProfiles(profileIds);
|
||||
|
||||
List<PairLongLong> expectedReturn = new ArrayList<PairLongLong>() {{
|
||||
add(new PairLongLong(parentProfile_1.getId(), 3));
|
||||
add(new PairLongLong(parentProfile_2.getId(), 2));
|
||||
add(new PairLongLong(parentProfile_3.getId(), 1));
|
||||
add(new PairLongLong(ssidProfile_1.getId(), 3));
|
||||
add(new PairLongLong(ssidProfile_2.getId(), 5));
|
||||
add(new PairLongLong(ssidProfile_3.getId(), 1));
|
||||
add(new PairLongLong(captivePortalProfile_1.getId(), 3));
|
||||
add(new PairLongLong(captivePortalProfile_2.getId(), 6));
|
||||
add(new PairLongLong(radiusProfile_1.getId(), 6));
|
||||
add(new PairLongLong(radiusProfile_2.getId(), 0));
|
||||
}};
|
||||
|
||||
expectedReturn.forEach(pair -> assertTrue(ret.contains(pair)));
|
||||
equipmentIds.forEach(id -> equipmentDatastore.delete(id));
|
||||
profileIds.forEach(id -> profileDatastore.delete(id));
|
||||
}
|
||||
|
||||
private Profile createProfile()
|
||||
{
|
||||
Profile profile = new Profile();
|
||||
profile.setName("test" + profileIncrementer.getAndIncrement());
|
||||
profile.setProfileType(ProfileType.equipment_ap);
|
||||
profile.setCustomerId(2);
|
||||
|
||||
Profile created = profileDatastore.create(profile);
|
||||
profileIds.add(created.getId());
|
||||
|
||||
return created;
|
||||
}
|
||||
|
||||
private Profile createSsidProfile()
|
||||
{
|
||||
Profile profile = new Profile();
|
||||
profile.setName("test" + profileIncrementer.getAndIncrement());
|
||||
profile.setProfileType(ProfileType.ssid);
|
||||
profile.setCustomerId(2);
|
||||
|
||||
Profile created = profileDatastore.create(profile);
|
||||
profileIds.add(created.getId());
|
||||
|
||||
return created;
|
||||
}
|
||||
|
||||
private Profile createCaptivePortalProfile()
|
||||
{
|
||||
Profile profile = new Profile();
|
||||
profile.setName("test" + profileIncrementer.getAndIncrement());
|
||||
profile.setProfileType(ProfileType.captive_portal);
|
||||
profile.setCustomerId(2);
|
||||
|
||||
Profile created = profileDatastore.create(profile);
|
||||
profileIds.add(created.getId());
|
||||
|
||||
return created;
|
||||
}
|
||||
|
||||
private Profile createRadiusProfile()
|
||||
{
|
||||
Profile profile = new Profile();
|
||||
profile.setName("test" + profileIncrementer.getAndIncrement());
|
||||
profile.setProfileType(ProfileType.radius);
|
||||
profile.setCustomerId(2);
|
||||
|
||||
Profile created = profileDatastore.create(profile);
|
||||
profileIds.add(created.getId());
|
||||
|
||||
return created;
|
||||
}
|
||||
|
||||
private void linkChildToParent(long childId, long parentId)
|
||||
{
|
||||
Profile parentProfile = profileDatastore.get(parentId);
|
||||
parentProfile.getChildProfileIds().add(childId);
|
||||
|
||||
profileDatastore.update(parentProfile);
|
||||
}
|
||||
|
||||
private Equipment createEquipment(long profileId)
|
||||
{
|
||||
Equipment equipment = new Equipment();
|
||||
equipment.setCustomerId(2);
|
||||
equipment.setEquipmentType(EquipmentType.AP);
|
||||
equipment.setName("test" + equipmentIncrementer.getAndIncrement());
|
||||
equipment.setProfileId(profileId);
|
||||
return equipmentDatastore.create(equipment);
|
||||
}
|
||||
}
|
||||
@@ -148,7 +148,7 @@ public class PortalUserDatastoreInMemory extends BaseInMemoryDatastore implement
|
||||
PortalUser ret = null;
|
||||
|
||||
for (PortalUser mdl : idToPortalUserMap.values()) {
|
||||
if(mdl.getCustomerId() == customerId && mdl.getUsername().equals(username)) {
|
||||
if(mdl.getCustomerId() == customerId && mdl.getUsername().toLowerCase().equals(username.toLowerCase())) {
|
||||
ret = mdl.clone();
|
||||
}
|
||||
}
|
||||
@@ -161,7 +161,7 @@ public class PortalUserDatastoreInMemory extends BaseInMemoryDatastore implement
|
||||
List<PortalUser> listOfPortalUsers = new ArrayList<>();
|
||||
|
||||
for (PortalUser portalUser : idToPortalUserMap.values()) {
|
||||
if (portalUser.getUsername().equals(username)) {
|
||||
if (portalUser.getUsername().toLowerCase().equals(username.toLowerCase())) {
|
||||
listOfPortalUsers.add(portalUser);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -69,15 +69,14 @@ public class PortalUserDAO extends BaseJdbcDao {
|
||||
private static final Set<String> columnsToSkipForInsert = new HashSet<>(Arrays.asList(COL_ID));
|
||||
private static final Set<String> columnsToSkipForUpdate = new HashSet<>(Arrays.asList(COL_ID, "createdTimestamp"));
|
||||
|
||||
private static final String TABLE_NAME = "portal_user";
|
||||
private static final String TABLE_PREFIX = "s.";
|
||||
private static final String ALL_COLUMNS;
|
||||
public static final String TABLE_NAME = "portal_user";
|
||||
public static final String TABLE_PREFIX = "s.";
|
||||
public static final String ALL_COLUMNS;
|
||||
|
||||
private static final Set<String> ALL_COLUMNS_LOWERCASE = new HashSet<>();
|
||||
public static final Set<String> ALL_COLUMNS_LOWERCASE = new HashSet<>();
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
//use this for queries where multiple tables are involved
|
||||
private static final String ALL_COLUMNS_WITH_PREFIX;
|
||||
public static final String ALL_COLUMNS_WITH_PREFIX;
|
||||
|
||||
private static final String ALL_COLUMNS_FOR_INSERT;
|
||||
private static final String BIND_VARS_FOR_INSERT;
|
||||
@@ -135,10 +134,10 @@ public class PortalUserDAO extends BaseJdbcDao {
|
||||
private static final String SQL_GET_BY_USERNAME =
|
||||
"select " + ALL_COLUMNS +
|
||||
" from " + TABLE_NAME + " " +
|
||||
" where username = ? ";
|
||||
" where lower(username) = ? ";
|
||||
|
||||
private static final String SQL_GET_BY_CUSTOMERID_AND_USERNAME = SQL_GET_BY_CUSTOMER_ID +
|
||||
" and username = ?";
|
||||
" and lower(username) = ?";
|
||||
|
||||
private static final String SQL_GET_LASTMOD_BY_ID =
|
||||
"select lastModifiedTimestamp " +
|
||||
@@ -162,8 +161,8 @@ public class PortalUserDAO extends BaseJdbcDao {
|
||||
|
||||
private static final String SQL_GET_ALL_IN_SET = "select " + ALL_COLUMNS + " from "+TABLE_NAME + " where "+ COL_ID +" in ";
|
||||
|
||||
private static final String SQL_PAGING_SUFFIX = " LIMIT ? OFFSET ? ";
|
||||
private static final String SORT_SUFFIX = "";
|
||||
public static final String SQL_PAGING_SUFFIX = " LIMIT ? OFFSET ? ";
|
||||
public static final String SORT_SUFFIX = "";
|
||||
|
||||
|
||||
private static final RowMapper<PortalUser> portalUserRowMapper = new PortalUserRowMapper();
|
||||
@@ -463,7 +462,7 @@ public class PortalUserDAO extends BaseJdbcDao {
|
||||
try{
|
||||
PortalUser portalUser = this.jdbcTemplate.queryForObject(
|
||||
SQL_GET_BY_CUSTOMERID_AND_USERNAME,
|
||||
portalUserRowMapper, customerId, username);
|
||||
portalUserRowMapper, customerId, username.toLowerCase());
|
||||
|
||||
LOG.debug("Found PortalUser {}", portalUser);
|
||||
|
||||
@@ -478,7 +477,7 @@ public class PortalUserDAO extends BaseJdbcDao {
|
||||
LOG.debug("Looking up PortalUsers for username {} {}", username);
|
||||
|
||||
List<PortalUser> ret = this.jdbcTemplate.query(SQL_GET_BY_USERNAME,
|
||||
portalUserRowMapper, username);
|
||||
portalUserRowMapper, username.toLowerCase());
|
||||
|
||||
LOG.debug("Found List of Portal Users {}", ret);
|
||||
|
||||
|
||||
@@ -20,6 +20,8 @@ public class PortalUserEventPayload extends BaseJsonModel implements HasCustomer
|
||||
private long createdTimestamp;
|
||||
private long lastModifiedTimestamp;
|
||||
|
||||
public PortalUserEventPayload() {}
|
||||
|
||||
public PortalUserEventPayload(PortalUser portalUser) {
|
||||
this.setId(portalUser.getId());
|
||||
this.setCustomerId(portalUser.getCustomerId());
|
||||
|
||||
@@ -93,7 +93,7 @@ public abstract class CommonNetworkConfiguration extends ProfileDetails {
|
||||
}
|
||||
|
||||
|
||||
public Boolean getLedControlEnabled() {
|
||||
public Boolean isLedControlEnabled() {
|
||||
return ledControlEnabled;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Set;
|
||||
import java.util.TreeSet;
|
||||
|
||||
import com.telecominfraproject.wlan.core.model.equipment.ChannelBandwidth;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.ChannelHopSettings;
|
||||
@@ -80,6 +82,8 @@ public class RfElementConfiguration extends BaseJsonModel {
|
||||
private Boolean useMaxTxPower;
|
||||
private Integer eirpTxPower;
|
||||
private RadioBestApSettings bestApSettings;
|
||||
|
||||
private Set<Integer> autoExclusionChannels = new TreeSet<Integer>();
|
||||
|
||||
private RfElementConfiguration() {
|
||||
long timestamp = System.currentTimeMillis();
|
||||
@@ -112,7 +116,7 @@ public class RfElementConfiguration extends BaseJsonModel {
|
||||
ret.setMinAutoCellSize(MIN_CELL_SIZE_MAP.get(radioType));
|
||||
ret.setMaxAutoCellSize(MAX_CELL_SIZE_MAP.get(radioType));
|
||||
if (radioType == RadioType.is5GHz || radioType == RadioType.is5GHzL || radioType == RadioType.is5GHzU) {
|
||||
ret.setChannelBandwidth(ChannelBandwidth.is80MHz);
|
||||
ret.setChannelBandwidth(ChannelBandwidth.is40MHz);
|
||||
ret.setRadioMode(RadioMode.modeAC);
|
||||
} else {
|
||||
ret.setChannelBandwidth(ChannelBandwidth.is20MHz);
|
||||
@@ -362,9 +366,25 @@ public class RfElementConfiguration extends BaseJsonModel {
|
||||
this.bestApSettings = bestApSettings;
|
||||
}
|
||||
|
||||
public Set<Integer> getAutoExclusionChannels() {
|
||||
return autoExclusionChannels;
|
||||
}
|
||||
|
||||
public void setAutoExclusionChannels(Set<Integer> autoExclusionChannels) {
|
||||
if (autoExclusionChannels != null) {
|
||||
this.autoExclusionChannels.clear();
|
||||
this.autoExclusionChannels.addAll(autoExclusionChannels);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public RfElementConfiguration clone() {
|
||||
return (RfElementConfiguration) super.clone();
|
||||
RfElementConfiguration ret = (RfElementConfiguration) super.clone();
|
||||
|
||||
if (autoExclusionChannels != null) {
|
||||
ret.autoExclusionChannels = new TreeSet<>(autoExclusionChannels);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -409,7 +429,7 @@ public class RfElementConfiguration extends BaseJsonModel {
|
||||
channelBandwidth, channelHopSettings, clientDisconnectThresholdDb, eirpTxPower, forceScanDuringVoice,
|
||||
managementRate, maxNumClients, mimoMode, minAutoCellSize, multicastRate, neighbouringListApConfig,
|
||||
perimeterDetectionEnabled, probeResponseThresholdDb, radioMode, radioType, rf, rtsCtsThreshold,
|
||||
rxCellSizeDb, autoCellSizeSelection, maxAutoCellSize);
|
||||
rxCellSizeDb, autoCellSizeSelection, maxAutoCellSize, autoExclusionChannels);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -439,7 +459,8 @@ public class RfElementConfiguration extends BaseJsonModel {
|
||||
&& Objects.equals(probeResponseThresholdDb, other.probeResponseThresholdDb)
|
||||
&& radioMode == other.radioMode && radioType == other.radioType && Objects.equals(rf, other.rf)
|
||||
&& Objects.equals(rtsCtsThreshold, other.rtsCtsThreshold)
|
||||
&& Objects.equals(rxCellSizeDb, other.rxCellSizeDb);
|
||||
&& Objects.equals(rxCellSizeDb, other.rxCellSizeDb)
|
||||
&& Objects.equals(autoExclusionChannels, other.autoExclusionChannels);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -370,11 +370,9 @@ public class SsidConfiguration extends ProfileDetails implements PushableConfigu
|
||||
|
||||
public static enum SecureMode {
|
||||
|
||||
open(0L), wpaPSK(1L), wpa2PSK(2L), wpaRadius(3L), wpa2Radius(4L), wpa2OnlyPSK(5L), wpa2OnlyRadius(6L), wep(
|
||||
7L), wpaEAP(8L), wpa2EAP(
|
||||
9L), wpa2OnlyEAP(10L), wpa3OnlySAE(11L), wpa3MixedSAE(12L), wpa3OnlyEAP(13L), wpa3MixedEAP(14L),
|
||||
|
||||
UNSUPPORTED(-1L);
|
||||
open(0L), wpaPSK(1L), wpa2PSK(2L), wpaRadius(3L), wpa2Radius(4L), wpa2OnlyPSK(5L), wpa2OnlyRadius(6L), wep(7L),
|
||||
wpaEAP(8L), wpa2EAP(9L), wpa2OnlyEAP(10L), wpa3OnlySAE(11L), wpa3MixedSAE(12L), wpa3OnlyEAP(13L), wpa3MixedEAP(14L),
|
||||
wpa3OnlyEAP192(15L), UNSUPPORTED(-1L);
|
||||
|
||||
private final long id;
|
||||
private static final Map<Long, SecureMode> ELEMENTS = new HashMap<>();
|
||||
@@ -415,7 +413,7 @@ public class SsidConfiguration extends ProfileDetails implements PushableConfigu
|
||||
}
|
||||
|
||||
public static boolean isWPA3_Enterprise_or_Personal(SecureMode mode) {
|
||||
return mode == wpa3OnlySAE || mode == wpa3OnlyEAP;
|
||||
return mode == wpa3OnlySAE || mode == wpa3OnlyEAP || mode == wpa3OnlyEAP192;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,8 +1,16 @@
|
||||
package com.telecominfraproject.wlan.profile.rf.models;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
|
||||
@@ -56,4 +64,33 @@ public class RfConfigurationTests {
|
||||
rfConfig2_4.setRadioMode(RadioMode.modeGN);
|
||||
rfConfig5.setRadioMode(RadioMode.modeGN);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAutoExclusionChannels() {
|
||||
RfElementConfiguration rfConfig = RfElementConfiguration.createWithDefaults(RadioType.is5GHz);
|
||||
assertNotNull(rfConfig.getAutoExclusionChannels());
|
||||
assertTrue(rfConfig.getAutoExclusionChannels().isEmpty());
|
||||
|
||||
Set<Integer> unsortedSet = new HashSet<Integer>(Arrays.asList(1, 23, 45, 12));
|
||||
rfConfig.setAutoExclusionChannels(unsortedSet);
|
||||
|
||||
Set<Integer> sortedSet = rfConfig.getAutoExclusionChannels();
|
||||
List<Integer> list = new ArrayList<Integer>(sortedSet);
|
||||
|
||||
assertEquals(Integer.valueOf(1), list.get(0));
|
||||
assertEquals(Integer.valueOf(12), list.get(1));
|
||||
assertEquals(Integer.valueOf(23), list.get(2));
|
||||
assertEquals(Integer.valueOf(45), list.get(3));
|
||||
|
||||
Set<Integer> unsortedSet2 = new HashSet<Integer>(Arrays.asList(10, 45, 23, 12));
|
||||
rfConfig.setAutoExclusionChannels(unsortedSet2);
|
||||
|
||||
Set<Integer> sortedSet2 = rfConfig.getAutoExclusionChannels();
|
||||
List<Integer> list2 = new ArrayList<Integer>(sortedSet2);
|
||||
|
||||
assertEquals(Integer.valueOf(10), list2.get(0));
|
||||
assertEquals(Integer.valueOf(12), list2.get(1));
|
||||
assertEquals(Integer.valueOf(23), list2.get(2));
|
||||
assertEquals(Integer.valueOf(45), list2.get(3));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1024,6 +1024,7 @@ components:
|
||||
- wpa3MixedSAE
|
||||
- wpa3OnlyEAP
|
||||
- wpa3MixedEAP
|
||||
- wpa3OnlyEAP192
|
||||
|
||||
RadioBasedSsidConfigurationMap:
|
||||
properties:
|
||||
|
||||
@@ -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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<artifactId>tip-wlan-cloud-root-pom</artifactId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
<relativePath>../../wlan-cloud-root</relativePath>
|
||||
</parent>
|
||||
|
||||
<artifactId>provisioning-sp</artifactId>
|
||||
<name>provisioning-sp</name>
|
||||
<description>Stream Processors for provisioning events.</description>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<artifactId>base-stream-consumer</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<artifactId>provisioning-sp</artifactId>
|
||||
<name>provisioning-sp</name>
|
||||
<description>Stream Processors for provisioning events.</description>
|
||||
|
||||
<dependency>
|
||||
<artifactId>service-metric-models</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<artifactId>base-stream-consumer</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>system-event-models</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>service-metric-models</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>base-models</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>routing-service-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>equipment-gateway-service-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>system-event-models</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>equipment-service-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>base-models</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>location-service-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>routing-service-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>profile-service-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>client-service-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- models used by the application logic of the stream processor -->
|
||||
<dependency>
|
||||
<artifactId>equipment-models</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>profile-models</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>equipment-gateway-service-interface</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>
|
||||
<dependency>
|
||||
<artifactId>equipment-service-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
<dependency>
|
||||
<artifactId>location-service-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>profile-service-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>client-service-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>alarm-service-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>status-service-interface</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<!-- models used by the application logic of the stream processor -->
|
||||
<dependency>
|
||||
<artifactId>equipment-models</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<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>
|
||||
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
|
||||
package com.telecominfraproject.wlan.streams.provisioning;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -12,18 +13,27 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import com.telecominfraproject.wlan.alarm.AlarmServiceInterface;
|
||||
import com.telecominfraproject.wlan.alarm.models.Alarm;
|
||||
import com.telecominfraproject.wlan.client.ClientServiceInterface;
|
||||
import com.telecominfraproject.wlan.client.session.models.AssociationState;
|
||||
import com.telecominfraproject.wlan.client.session.models.ClientSession;
|
||||
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
|
||||
import com.telecominfraproject.wlan.core.model.pagination.PaginationContext;
|
||||
import com.telecominfraproject.wlan.core.model.pagination.PaginationResponse;
|
||||
import com.telecominfraproject.wlan.core.model.pair.PairLongLong;
|
||||
import com.telecominfraproject.wlan.core.model.streams.QueuedStreamMessage;
|
||||
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.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.EquipmentChannelsChangedEvent;
|
||||
import com.telecominfraproject.wlan.equipment.models.events.EquipmentCustomerChangedEvent;
|
||||
import com.telecominfraproject.wlan.equipment.models.events.EquipmentRemovedEvent;
|
||||
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.CEGWConfigChangeNotification;
|
||||
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWNewChannelRequest;
|
||||
@@ -35,13 +45,16 @@ import com.telecominfraproject.wlan.profile.models.Profile;
|
||||
import com.telecominfraproject.wlan.profile.models.events.ProfileAddedEvent;
|
||||
import com.telecominfraproject.wlan.profile.models.events.ProfileChangedEvent;
|
||||
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.systemevent.models.SystemEvent;
|
||||
import com.telecominfraproject.wlan.systemevent.models.SystemEventRecord;
|
||||
|
||||
/**
|
||||
* @author dtop
|
||||
* This stream processor is listening for events related to changes
|
||||
* @author dtop
|
||||
* This stream processor is listening for events related to changes
|
||||
* in Equipment, Location, and Profile objects. If a change is detected,
|
||||
* it uses Routing service to find affected equipment and delivers
|
||||
* CEGWConfigChangeNotification command to the equipment, which results
|
||||
@@ -50,187 +63,266 @@ import com.telecominfraproject.wlan.systemevent.models.SystemEventRecord;
|
||||
@Component
|
||||
public class EquipmentConfigPushTrigger extends StreamProcessor {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(EquipmentConfigPushTrigger.class);
|
||||
|
||||
@Value("${tip.wlan.systemEventsTopic:system_events}")
|
||||
private String systemEventsTopic;
|
||||
|
||||
@Autowired
|
||||
private EquipmentGatewayServiceInterface equipmentGatewayInterface;
|
||||
@Autowired
|
||||
private ProfileServiceInterface profileServiceInterface;
|
||||
@Autowired
|
||||
private EquipmentServiceInterface equipmentServiceInterface;
|
||||
private static final Logger LOG = LoggerFactory.getLogger(EquipmentConfigPushTrigger.class);
|
||||
|
||||
@Override
|
||||
protected boolean acceptMessage(QueuedStreamMessage message) {
|
||||
boolean ret = message.getTopic().equals(systemEventsTopic);
|
||||
@Value("${tip.wlan.systemEventsTopic:system_events}")
|
||||
private String systemEventsTopic;
|
||||
|
||||
if(ret && ( message.getModel() instanceof SystemEventRecord) ) {
|
||||
|
||||
SystemEventRecord ser = (SystemEventRecord) message.getModel();
|
||||
ret = ret &&
|
||||
(
|
||||
ser.getDetails() instanceof EquipmentApImpactingChangedEvent ||
|
||||
ser.getDetails() instanceof EquipmentChannelsChangedEvent ||
|
||||
ser.getDetails() instanceof EquipmentCellSizeAttributesChangedEvent ||
|
||||
ser.getDetails() instanceof EquipmentRemovedEvent ||
|
||||
ser.getDetails() instanceof ProfileAddedEvent ||
|
||||
ser.getDetails() instanceof ProfileChangedEvent ||
|
||||
ser.getDetails() instanceof ProfileRemovedEvent ||
|
||||
ser.getDetails() instanceof LocationChangedApImpactingEvent
|
||||
);
|
||||
} else {
|
||||
ret = false;
|
||||
}
|
||||
|
||||
LOG.trace("acceptMessage {}", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processMessage(QueuedStreamMessage message) {
|
||||
SystemEventRecord mdl = (SystemEventRecord) message.getModel();
|
||||
SystemEvent se = mdl.getDetails();
|
||||
LOG.debug("Processing {}", mdl);
|
||||
|
||||
switch ( se.getClass().getSimpleName() ) {
|
||||
case "EquipmentApImpactingChangedEvent":
|
||||
process((EquipmentApImpactingChangedEvent) se);
|
||||
break;
|
||||
case "EquipmentChannelsChangedEvent":
|
||||
@Autowired
|
||||
private EquipmentGatewayServiceInterface equipmentGatewayInterface;
|
||||
@Autowired
|
||||
private ProfileServiceInterface profileServiceInterface;
|
||||
@Autowired
|
||||
private EquipmentServiceInterface equipmentServiceInterface;
|
||||
@Autowired
|
||||
private StatusServiceInterface statusServiceInterface;
|
||||
@Autowired
|
||||
private AlarmServiceInterface alarmServiceInterface;
|
||||
@Autowired
|
||||
private ClientServiceInterface clientServiceInterface;
|
||||
|
||||
@Override
|
||||
protected boolean acceptMessage(QueuedStreamMessage message) {
|
||||
boolean ret = message.getTopic().equals(systemEventsTopic);
|
||||
|
||||
if (ret && (message.getModel() instanceof SystemEventRecord)) {
|
||||
|
||||
SystemEventRecord ser = (SystemEventRecord) message.getModel();
|
||||
ret = ret && (ser.getDetails() instanceof EquipmentApImpactingChangedEvent || ser.getDetails() instanceof EquipmentBlinkLEDsEvent
|
||||
|| ser.getDetails() instanceof EquipmentChannelsChangedEvent || ser.getDetails() instanceof EquipmentCellSizeAttributesChangedEvent
|
||||
|| ser.getDetails() instanceof EquipmentRemovedEvent || ser.getDetails() instanceof ProfileAddedEvent
|
||||
|| ser.getDetails() instanceof ProfileChangedEvent || ser.getDetails() instanceof ProfileRemovedEvent
|
||||
|| ser.getDetails() instanceof LocationChangedApImpactingEvent || ser.getDetails() instanceof EquipmentCustomerChangedEvent);
|
||||
} else {
|
||||
ret = false;
|
||||
}
|
||||
|
||||
LOG.trace("acceptMessage {}", ret);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void processMessage(QueuedStreamMessage message) {
|
||||
SystemEventRecord mdl = (SystemEventRecord) message.getModel();
|
||||
SystemEvent se = mdl.getDetails();
|
||||
LOG.debug("Processing {}", mdl);
|
||||
|
||||
switch (se.getClass().getSimpleName()) {
|
||||
case "EquipmentApImpactingChangedEvent":
|
||||
process((EquipmentApImpactingChangedEvent) se);
|
||||
break;
|
||||
case "EquipmentChannelsChangedEvent":
|
||||
process((EquipmentChannelsChangedEvent) se);
|
||||
break;
|
||||
case "EquipmentCellSizeAttributesChangedEvent":
|
||||
case "EquipmentCellSizeAttributesChangedEvent":
|
||||
process((EquipmentCellSizeAttributesChangedEvent) se);
|
||||
break;
|
||||
case "EquipmentRemovedEvent":
|
||||
case "EquipmentBlinkLEDsEvent":
|
||||
process((EquipmentBlinkLEDsEvent) se);
|
||||
break;
|
||||
case "EquipmentRemovedEvent":
|
||||
process((EquipmentRemovedEvent) se);
|
||||
break;
|
||||
case "ProfileAddedEvent":
|
||||
process((ProfileAddedEvent) se);
|
||||
break;
|
||||
case "ProfileChangedEvent":
|
||||
process((ProfileChangedEvent) se);
|
||||
break;
|
||||
case "ProfileRemovedEvent":
|
||||
process((ProfileRemovedEvent) se);
|
||||
break;
|
||||
case "LocationChangedApImpactingEvent":
|
||||
process((LocationChangedApImpactingEvent) se);
|
||||
break;
|
||||
default:
|
||||
process(mdl);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void process(EquipmentApImpactingChangedEvent model) {
|
||||
LOG.debug("Processing EquipmentChangedEvent");
|
||||
equipmentGatewayInterface.sendCommand(new CEGWConfigChangeNotification(model.getPayload().getInventoryId(),
|
||||
model.getEquipmentId()));
|
||||
case "ProfileAddedEvent":
|
||||
process((ProfileAddedEvent) se);
|
||||
break;
|
||||
case "ProfileChangedEvent":
|
||||
process((ProfileChangedEvent) se);
|
||||
break;
|
||||
case "ProfileRemovedEvent":
|
||||
process((ProfileRemovedEvent) se);
|
||||
break;
|
||||
case "LocationChangedApImpactingEvent":
|
||||
process((LocationChangedApImpactingEvent) se);
|
||||
break;
|
||||
case "EquipmentCustomerChangedEvent":
|
||||
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(), 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;
|
||||
}
|
||||
|
||||
Set<Long> parentProfileIds = new HashSet<>();
|
||||
ret.forEach(p -> parentProfileIds.add(p.getValue2()));
|
||||
|
||||
// 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());
|
||||
}
|
||||
|
||||
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(EquipmentCustomerChangedEvent model) {
|
||||
LOG.info("Processing EquipmentCustomerChangedEvent {}", model.getPayload().getId());
|
||||
|
||||
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()));
|
||||
Equipment existingEquipment = model.getExistingEquipment();
|
||||
Equipment equipment = model.getEquipment();
|
||||
|
||||
// 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);
|
||||
}
|
||||
|
||||
// Alarms has to move to new customerId as well
|
||||
List<Alarm> oldCustomerAlarms = alarmServiceInterface.get(existingEquipment.getCustomerId(), Set.of(existingEquipment.getId()), null);
|
||||
if (!oldCustomerAlarms.isEmpty()) {
|
||||
oldCustomerAlarms.stream().forEach(a -> {
|
||||
a.setCustomerId(equipment.getCustomerId());
|
||||
Alarm alarm = alarmServiceInterface.create(a);
|
||||
LOG.debug("Move an alarm to new customer {}", alarm);
|
||||
});
|
||||
}
|
||||
alarmServiceInterface.delete(existingEquipment.getCustomerId(), existingEquipment.getId());
|
||||
|
||||
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(EquipmentRemovedEvent model) {
|
||||
LOG.debug("Processing EquipmentRemovedEvent");
|
||||
equipmentGatewayInterface.sendCommand(new CEGWCloseSessionRequest(model.getPayload().getInventoryId(), model.getEquipmentId()));
|
||||
}
|
||||
// Disconnect all associated client devices from existing equipment
|
||||
disconnectClients(existingEquipment);
|
||||
|
||||
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(BaseJsonModel model) {
|
||||
LOG.warn("Unprocessed model: {}", model);
|
||||
}
|
||||
|
||||
private void disconnectClients(Equipment ce) {
|
||||
|
||||
private void process(ProfileRemovedEvent model) {
|
||||
LOG.debug("Processing ProfileRemovedEvent {}", model.getPayload().getId());
|
||||
processProfile(model.getPayload());
|
||||
}
|
||||
LOG.info("EquipmentConfigPushTrigger::disconnectClients 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 == null) {
|
||||
LOG.info("There are no existing client sessions to disconnect.");
|
||||
return;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
Set<Long> parentProfileIds = new HashSet<>();
|
||||
ret.forEach(p -> parentProfileIds.add(p.getValue2()));
|
||||
|
||||
//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());
|
||||
}
|
||||
|
||||
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());
|
||||
List<ClientSession> toBeDisconnected = new ArrayList<>();
|
||||
|
||||
}
|
||||
clientSessions.getItems().stream().forEach(c -> {
|
||||
if (c.getDetails().getAssociationState() != null
|
||||
&& !c.getDetails().getAssociationState().equals(AssociationState.Disconnected)) {
|
||||
LOG.info("Change association state for client {} from {} to {}", c.getMacAddress(),
|
||||
c.getDetails().getAssociationState(), AssociationState.Disconnected);
|
||||
|
||||
private void process(BaseJsonModel model) {
|
||||
LOG.warn("Unprocessed model: {}", model);
|
||||
}
|
||||
|
||||
|
||||
c.getDetails().setAssociationState(AssociationState.Disconnected);
|
||||
toBeDisconnected.add(c);
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
if (!toBeDisconnected.isEmpty()) {
|
||||
LOG.info("Sending disconnect for client sessions {}", toBeDisconnected);
|
||||
List<ClientSession> disconnectedSessions = clientServiceInterface.updateSessions(toBeDisconnected);
|
||||
LOG.info("Result of client disconnect {}", disconnectedSessions);
|
||||
} else {
|
||||
LOG.info("There are no existing client sessions that are not already in Disconnected state.");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,10 +114,6 @@ public abstract class BaseServiceMetricDatastoreTest {
|
||||
serviceMetric.setEquipmentId(testSequence.incrementAndGet());
|
||||
serviceMetric.setClientMac(testSequence.incrementAndGet());
|
||||
serviceMetric.setCreatedTimestamp(baseTimestamp - 100000 + testSequence.incrementAndGet());
|
||||
|
||||
ClientMetrics details2 = new ClientMetrics();
|
||||
details2.setClassificationName("qr_"+apNameIdx);
|
||||
serviceMetric.setDetails(details2);
|
||||
|
||||
apNameIdx++;
|
||||
|
||||
@@ -132,10 +128,6 @@ public abstract class BaseServiceMetricDatastoreTest {
|
||||
serviceMetric.setEquipmentId(testSequence.incrementAndGet());
|
||||
serviceMetric.setClientMac(testSequence.incrementAndGet());
|
||||
serviceMetric.setCreatedTimestamp(baseTimestamp + testSequence.incrementAndGet());
|
||||
|
||||
ClientMetrics details2 = new ClientMetrics();
|
||||
details2.setClassificationName("qr_"+apNameIdx);
|
||||
serviceMetric.setDetails(details2);
|
||||
|
||||
apNameIdx++;
|
||||
|
||||
@@ -150,10 +142,6 @@ public abstract class BaseServiceMetricDatastoreTest {
|
||||
serviceMetric.setEquipmentId(testSequence.incrementAndGet());
|
||||
serviceMetric.setClientMac(testSequence.incrementAndGet());
|
||||
serviceMetric.setCreatedTimestamp(baseTimestamp - 100000 + testSequence.incrementAndGet());
|
||||
|
||||
ClientMetrics details2 = new ClientMetrics();
|
||||
details2.setClassificationName("qr_"+apNameIdx);
|
||||
serviceMetric.setDetails(details2);
|
||||
|
||||
apNameIdx++;
|
||||
|
||||
@@ -200,43 +188,18 @@ public abstract class BaseServiceMetricDatastoreTest {
|
||||
assertTrue(page6.getContext().isLastPage());
|
||||
assertTrue(page7.getContext().isLastPage());
|
||||
|
||||
List<String> expectedPage3Strings = new ArrayList<>(Arrays.asList(new String[]{"qr_20", "qr_21", "qr_22", "qr_23", "qr_24", "qr_25", "qr_26", "qr_27", "qr_28", "qr_29" }));
|
||||
List<String> actualPage3Strings = new ArrayList<>();
|
||||
page3.getItems().stream().forEach( ce -> actualPage3Strings.add(((ClientMetrics) ce.getDetails()).getClassificationName()) );
|
||||
|
||||
assertEquals(expectedPage3Strings, actualPage3Strings);
|
||||
|
||||
//test first page of the results with empty sort order -> default sort order (by createdTimestamp ascending)
|
||||
PaginationResponse<ServiceMetric> page1EmptySort = testInterface.getForCustomer(fromTime, toTime, customerId_1, null, null, null, null, Collections.emptyList(), context);
|
||||
assertEquals(10, page1EmptySort.getItems().size());
|
||||
|
||||
List<String> expectedPage1EmptySortStrings = new ArrayList<>(Arrays.asList(new String[]{"qr_0", "qr_1", "qr_2", "qr_3", "qr_4", "qr_5", "qr_6", "qr_7", "qr_8", "qr_9" }));
|
||||
List<String> actualPage1EmptySortStrings = new ArrayList<>();
|
||||
page1EmptySort.getItems().stream().forEach( ce -> actualPage1EmptySortStrings.add(((ClientMetrics) ce.getDetails()).getClassificationName() ) );
|
||||
|
||||
assertEquals(expectedPage1EmptySortStrings, actualPage1EmptySortStrings);
|
||||
|
||||
//test first page of the results with null sort order -> default sort order (by createdTimestamp ascending)
|
||||
PaginationResponse<ServiceMetric> page1NullSort = testInterface.getForCustomer(fromTime, toTime, customerId_1, null, null, null, null, null, context);
|
||||
assertEquals(10, page1NullSort.getItems().size());
|
||||
|
||||
List<String> expectedPage1NullSortStrings = new ArrayList<>(Arrays.asList(new String[]{"qr_0", "qr_1", "qr_2", "qr_3", "qr_4", "qr_5", "qr_6", "qr_7", "qr_8", "qr_9" }));
|
||||
List<String> actualPage1NullSortStrings = new ArrayList<>();
|
||||
page1NullSort.getItems().stream().forEach( ce -> actualPage1NullSortStrings.add(((ClientMetrics) ce.getDetails()).getClassificationName() ) );
|
||||
|
||||
assertEquals(expectedPage1NullSortStrings, actualPage1NullSortStrings);
|
||||
|
||||
|
||||
//test first page of the results with sort descending order by a equipmentId property
|
||||
PaginationResponse<ServiceMetric> page1SingleSortDesc = testInterface.getForCustomer(fromTime, toTime, customerId_1, null, null, null, null, Collections.singletonList(new ColumnAndSort("equipmentId", SortOrder.desc)), context);
|
||||
assertEquals(10, page1SingleSortDesc.getItems().size());
|
||||
|
||||
List<String> expectedPage1SingleSortDescStrings = getPagination_expectedPage1SingleSortDescStrings();
|
||||
List<String> actualPage1SingleSortDescStrings = new ArrayList<>();
|
||||
page1SingleSortDesc.getItems().stream().forEach( ce -> actualPage1SingleSortDescStrings.add(((ClientMetrics) ce.getDetails()).getClassificationName() ) );
|
||||
|
||||
assertEquals(expectedPage1SingleSortDescStrings, actualPage1SingleSortDescStrings);
|
||||
|
||||
used_equipmentIds.forEach(eqId -> testInterface.delete(customerId_1, eqId, System.currentTimeMillis()));
|
||||
used_equipmentIds.forEach(eqId -> testInterface.delete(customerId_2, eqId, System.currentTimeMillis()));
|
||||
|
||||
@@ -336,9 +299,8 @@ public abstract class BaseServiceMetricDatastoreTest {
|
||||
serviceMetric.setCreatedTimestamp(baseTimestamp - testSequence.incrementAndGet());
|
||||
|
||||
ClientMetrics details2 = new ClientMetrics();
|
||||
details2.setClassificationName("qr_"+apNameIdx);
|
||||
serviceMetric.setDetails(details2);
|
||||
|
||||
|
||||
testInterface.create(serviceMetric);
|
||||
|
||||
//third metric - neighbour
|
||||
|
||||
@@ -15,11 +15,8 @@ import org.springframework.util.CollectionUtils;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
|
||||
import com.telecominfraproject.wlan.servicemetric.models.McsStats;
|
||||
import com.telecominfraproject.wlan.servicemetric.models.ServiceMetricDataType;
|
||||
import com.telecominfraproject.wlan.servicemetric.models.ServiceMetricDetails;
|
||||
import com.telecominfraproject.wlan.servicemetric.models.WmmQueueStats;
|
||||
import com.telecominfraproject.wlan.servicemetric.models.WmmQueueStats.WmmQueueType;
|
||||
|
||||
/**
|
||||
* Node-level metric data from the Access Point.
|
||||
@@ -79,14 +76,8 @@ public class ApNodeMetrics extends ServiceMetricDetails
|
||||
|
||||
private Map<RadioType, List<RadioUtilization>> radioUtilizationPerRadio = new EnumMap<>(RadioType.class);
|
||||
|
||||
|
||||
private Map<RadioType, RadioStatistics> radioStatsPerRadio = new EnumMap<>(RadioType.class);
|
||||
|
||||
private Map<RadioType, List<McsStats>> mcsStatsPerRadio = new EnumMap<>(RadioType.class);
|
||||
|
||||
private Map<RadioType, Map<WmmQueueType, WmmQueueStats>> wmmQueuesPerRadio = new EnumMap<>(RadioType.class);
|
||||
|
||||
|
||||
public Integer getPeriodLengthSec() {
|
||||
return periodLengthSec;
|
||||
}
|
||||
@@ -262,25 +253,6 @@ public class ApNodeMetrics extends ServiceMetricDetails
|
||||
this.radioStatsPerRadio.put(radioType, radioStats);
|
||||
}
|
||||
|
||||
public List<McsStats> getMcsStats(RadioType radioType) {
|
||||
return mcsStatsPerRadio.get(radioType);
|
||||
}
|
||||
|
||||
public void setMcsStats(RadioType radioType, List<McsStats> mcsStats) {
|
||||
this.mcsStatsPerRadio.put(radioType, mcsStats);
|
||||
}
|
||||
|
||||
|
||||
public Map<WmmQueueType, WmmQueueStats> getWmmQueue(RadioType radioType) {
|
||||
return wmmQueuesPerRadio.get(radioType);
|
||||
}
|
||||
|
||||
public void setWmmQueue(RadioType radioType, Map<WmmQueueType, WmmQueueStats> wmmQueue) {
|
||||
this.wmmQueuesPerRadio.put(radioType, wmmQueue);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//
|
||||
// Utility Functions
|
||||
//
|
||||
@@ -404,31 +376,14 @@ public class ApNodeMetrics extends ServiceMetricDetails
|
||||
this.radioStatsPerRadio = radioStatsPerRadio;
|
||||
}
|
||||
|
||||
public Map<RadioType, List<McsStats>> getMcsStatsPerRadio() {
|
||||
return mcsStatsPerRadio;
|
||||
}
|
||||
|
||||
public void setMcsStatsPerRadio(Map<RadioType, List<McsStats>> mcsStatsPerRadio) {
|
||||
this.mcsStatsPerRadio = mcsStatsPerRadio;
|
||||
}
|
||||
|
||||
public Map<RadioType, Map<WmmQueueType, WmmQueueStats>> getWmmQueuesPerRadio() {
|
||||
return wmmQueuesPerRadio;
|
||||
}
|
||||
|
||||
public void setWmmQueuesPerRadio(Map<RadioType, Map<WmmQueueType, WmmQueueStats>> wmmQueuesPerRadio) {
|
||||
this.wmmQueuesPerRadio = wmmQueuesPerRadio;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + Objects.hash(apPerformance, channelUtilizationPerRadio, clientMacAddressesPerRadio,
|
||||
cloudLinkAvailability, cloudLinkLatencyInMs, mcsStatsPerRadio, networkProbeMetrics, noiseFloorPerRadio,
|
||||
cloudLinkAvailability, cloudLinkLatencyInMs, networkProbeMetrics, noiseFloorPerRadio,
|
||||
periodLengthSec, radioStatsPerRadio, radioUtilizationPerRadio, radiusMetrics, rxBytesPerRadio,
|
||||
tunnelMetrics, txBytesPerRadio, vlanSubnet, wmmQueuesPerRadio);
|
||||
tunnelMetrics, txBytesPerRadio, vlanSubnet);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -449,7 +404,6 @@ public class ApNodeMetrics extends ServiceMetricDetails
|
||||
&& Objects.equals(clientMacAddressesPerRadio, other.clientMacAddressesPerRadio)
|
||||
&& Objects.equals(cloudLinkAvailability, other.cloudLinkAvailability)
|
||||
&& Objects.equals(cloudLinkLatencyInMs, other.cloudLinkLatencyInMs)
|
||||
&& Objects.equals(mcsStatsPerRadio, other.mcsStatsPerRadio)
|
||||
&& Objects.equals(networkProbeMetrics, other.networkProbeMetrics)
|
||||
&& Objects.equals(noiseFloorPerRadio, other.noiseFloorPerRadio)
|
||||
&& Objects.equals(periodLengthSec, other.periodLengthSec)
|
||||
@@ -459,8 +413,7 @@ public class ApNodeMetrics extends ServiceMetricDetails
|
||||
&& Objects.equals(rxBytesPerRadio, other.rxBytesPerRadio)
|
||||
&& Objects.equals(tunnelMetrics, other.tunnelMetrics)
|
||||
&& Objects.equals(txBytesPerRadio, other.txBytesPerRadio)
|
||||
&& Objects.equals(vlanSubnet, other.vlanSubnet)
|
||||
&& Objects.equals(wmmQueuesPerRadio, other.wmmQueuesPerRadio);
|
||||
&& Objects.equals(vlanSubnet, other.vlanSubnet);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -484,14 +437,6 @@ public class ApNodeMetrics extends ServiceMetricDetails
|
||||
radioStatsPerRadio.values().forEach(c -> { if (hasUnsupportedValue(c)) { ai.incrementAndGet();} });
|
||||
}
|
||||
|
||||
if(mcsStatsPerRadio!=null) {
|
||||
mcsStatsPerRadio.values().forEach(c -> { if (hasUnsupportedValue(c)) { ai.incrementAndGet();} });
|
||||
}
|
||||
|
||||
if(wmmQueuesPerRadio!=null) {
|
||||
wmmQueuesPerRadio.values().forEach(c -> { if (hasUnsupportedValue(c)) { ai.incrementAndGet();} });
|
||||
}
|
||||
|
||||
if(ai.get()>0) {
|
||||
return true;
|
||||
}
|
||||
@@ -518,25 +463,6 @@ public class ApNodeMetrics extends ServiceMetricDetails
|
||||
|
||||
}
|
||||
|
||||
if(this.wmmQueuesPerRadio!=null) {
|
||||
ret.wmmQueuesPerRadio = new EnumMap<>(RadioType.class);
|
||||
this.wmmQueuesPerRadio.forEach((rt, wq) -> {
|
||||
Map<WmmQueueStats.WmmQueueType, WmmQueueStats> newWm = new EnumMap<>(WmmQueueType.class);
|
||||
ret.wmmQueuesPerRadio.put(rt, newWm);
|
||||
wq.forEach((k, v) -> newWm.put(k, v.clone()));
|
||||
});
|
||||
}
|
||||
|
||||
if(this.mcsStatsPerRadio !=null) {
|
||||
ret.mcsStatsPerRadio = new EnumMap<>(RadioType.class);
|
||||
this.mcsStatsPerRadio.forEach((k, listV) -> {
|
||||
List<McsStats> newList = new ArrayList<>();
|
||||
ret.mcsStatsPerRadio.put(k, newList);
|
||||
listV.forEach(mcs -> newList.add(mcs.clone()));
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
if(this.networkProbeMetrics !=null) {
|
||||
ret.networkProbeMetrics = new ArrayList<>();
|
||||
for(NetworkProbeMetrics npm: this.networkProbeMetrics){
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,160 +0,0 @@
|
||||
package com.telecominfraproject.wlan.servicemetric.client.qoe.models;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.telecominfraproject.wlan.servicemetric.models.ServiceMetricDataType;
|
||||
import com.telecominfraproject.wlan.servicemetric.models.ServiceMetricDetails;
|
||||
|
||||
/**
|
||||
* QoE related metrics which is independent of RadioType
|
||||
*
|
||||
* @author yongli
|
||||
*
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class ClientQoEMetrics extends ServiceMetricDetails {
|
||||
|
||||
private static final long serialVersionUID = 5242617221447159480L;
|
||||
|
||||
/**
|
||||
* How many seconds the AP measured for the metric
|
||||
*/
|
||||
private Integer periodLengthSec = 5;
|
||||
private Integer secondsSinceLastRecv;
|
||||
|
||||
|
||||
// Connectivity QoE stats.
|
||||
private Long qoeEventualSuccessTimeTaken;
|
||||
private Long qoeNumOfAttempts;
|
||||
private Long qoeNumOfSuccess;
|
||||
private Long qoeAttemptDuration;
|
||||
private Long qoeAssociatedDuration;
|
||||
private Long qoeDeltaDuration;
|
||||
private Long qoeNumRepeatedAttempts;
|
||||
private Long qoeUserError;
|
||||
|
||||
@Override
|
||||
public ServiceMetricDataType getDataType() {
|
||||
return ServiceMetricDataType.ClientQoE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ClientQoEMetrics clone() {
|
||||
return (ClientQoEMetrics) super.clone();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = super.hashCode();
|
||||
result = prime * result + Objects.hash(periodLengthSec, qoeAssociatedDuration, qoeAttemptDuration,
|
||||
qoeDeltaDuration, qoeEventualSuccessTimeTaken, qoeNumOfAttempts, qoeNumOfSuccess,
|
||||
qoeNumRepeatedAttempts, qoeUserError, secondsSinceLastRecv);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
if (!super.equals(obj)) {
|
||||
return false;
|
||||
}
|
||||
if (!(obj instanceof ClientQoEMetrics)) {
|
||||
return false;
|
||||
}
|
||||
ClientQoEMetrics other = (ClientQoEMetrics) obj;
|
||||
return Objects.equals(periodLengthSec, other.periodLengthSec)
|
||||
&& Objects.equals(qoeAssociatedDuration, other.qoeAssociatedDuration)
|
||||
&& Objects.equals(qoeAttemptDuration, other.qoeAttemptDuration)
|
||||
&& Objects.equals(qoeDeltaDuration, other.qoeDeltaDuration)
|
||||
&& Objects.equals(qoeEventualSuccessTimeTaken, other.qoeEventualSuccessTimeTaken)
|
||||
&& Objects.equals(qoeNumOfAttempts, other.qoeNumOfAttempts)
|
||||
&& Objects.equals(qoeNumOfSuccess, other.qoeNumOfSuccess)
|
||||
&& Objects.equals(qoeNumRepeatedAttempts, other.qoeNumRepeatedAttempts)
|
||||
&& Objects.equals(qoeUserError, other.qoeUserError)
|
||||
&& Objects.equals(secondsSinceLastRecv, other.secondsSinceLastRecv);
|
||||
}
|
||||
|
||||
public Long getQoeAssociatedDuration() {
|
||||
return qoeAssociatedDuration;
|
||||
}
|
||||
|
||||
public Long getQoeAttemptDuration() {
|
||||
return qoeAttemptDuration;
|
||||
}
|
||||
|
||||
public Long getQoeDeltaDuration() {
|
||||
return qoeDeltaDuration;
|
||||
}
|
||||
|
||||
public Long getQoeEventualSuccessTimeTaken() {
|
||||
return qoeEventualSuccessTimeTaken;
|
||||
}
|
||||
|
||||
public Long getQoeNumOfAttempts() {
|
||||
return qoeNumOfAttempts;
|
||||
}
|
||||
|
||||
public Long getQoeNumOfSuccess() {
|
||||
return qoeNumOfSuccess;
|
||||
}
|
||||
|
||||
public Long getQoeNumRepeatedAttempts() {
|
||||
return qoeNumRepeatedAttempts;
|
||||
}
|
||||
|
||||
public Long getQoeUserError() {
|
||||
return qoeUserError;
|
||||
}
|
||||
|
||||
public void setQoeAssociatedDuration(Long qoeAssociatedDuration) {
|
||||
this.qoeAssociatedDuration = qoeAssociatedDuration;
|
||||
}
|
||||
|
||||
public void setQoeAttemptDuration(Long qoeAttemptDuration) {
|
||||
this.qoeAttemptDuration = qoeAttemptDuration;
|
||||
}
|
||||
|
||||
public void setQoeDeltaDuration(Long qoeDeltaDuration) {
|
||||
this.qoeDeltaDuration = qoeDeltaDuration;
|
||||
}
|
||||
|
||||
public void setQoeEventualSuccessTimeTaken(Long qoeEventualSuccessTimeTaken) {
|
||||
this.qoeEventualSuccessTimeTaken = qoeEventualSuccessTimeTaken;
|
||||
}
|
||||
|
||||
public void setQoeNumOfAttempts(Long qoeNumOfAttempts) {
|
||||
this.qoeNumOfAttempts = qoeNumOfAttempts;
|
||||
}
|
||||
|
||||
public void setQoeNumOfSuccess(Long qoeNumOfSuccess) {
|
||||
this.qoeNumOfSuccess = qoeNumOfSuccess;
|
||||
}
|
||||
|
||||
public void setQoeNumRepeatedAttempts(Long qoeNumRepeatedAttempts) {
|
||||
this.qoeNumRepeatedAttempts = qoeNumRepeatedAttempts;
|
||||
}
|
||||
|
||||
public void setQoeUserError(Long qoeUserError) {
|
||||
this.qoeUserError = qoeUserError;
|
||||
}
|
||||
|
||||
public Integer getPeriodLengthSec() {
|
||||
return periodLengthSec;
|
||||
}
|
||||
|
||||
public void setPeriodLengthSec(Integer periodLengthSec) {
|
||||
this.periodLengthSec = periodLengthSec;
|
||||
}
|
||||
|
||||
public Integer getSecondsSinceLastRecv() {
|
||||
return secondsSinceLastRecv;
|
||||
}
|
||||
|
||||
public void setSecondsSinceLastRecv(Integer secondsSinceLastRecv) {
|
||||
this.secondsSinceLastRecv = secondsSinceLastRecv;
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
package com.telecominfraproject.wlan.servicemetric.models;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class McsStats extends BaseJsonModel
|
||||
{
|
||||
|
||||
private static final long serialVersionUID = 2366899901343104028L;
|
||||
|
||||
/**
|
||||
* The MCS number. This is table index.
|
||||
*/
|
||||
private McsType mcsNum;
|
||||
|
||||
/**
|
||||
* The number of successfully transmitted frames at this rate. Do not count failed transmission.
|
||||
*/
|
||||
private Integer txFrames;
|
||||
|
||||
/**
|
||||
* The number of received frames at this rate.
|
||||
*/
|
||||
private Integer rxFrames;
|
||||
|
||||
private Long rate;
|
||||
|
||||
|
||||
public McsStats()
|
||||
{
|
||||
// for serialization
|
||||
}
|
||||
|
||||
|
||||
public McsType getMcsNum() {
|
||||
return mcsNum;
|
||||
}
|
||||
|
||||
|
||||
public void setMcsNum(McsType mcsNum) {
|
||||
this.mcsNum = mcsNum;
|
||||
}
|
||||
|
||||
|
||||
public Integer getTxFrames() {
|
||||
return txFrames;
|
||||
}
|
||||
|
||||
|
||||
public void setTxFrames(Integer txFrames) {
|
||||
this.txFrames = txFrames;
|
||||
}
|
||||
|
||||
|
||||
public Integer getRxFrames() {
|
||||
return rxFrames;
|
||||
}
|
||||
|
||||
|
||||
public void setRxFrames(Integer rxFrames) {
|
||||
this.rxFrames = rxFrames;
|
||||
}
|
||||
|
||||
public Long getRate() {
|
||||
return rate;
|
||||
}
|
||||
|
||||
|
||||
public void setRate(Long rate) {
|
||||
this.rate = rate;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public McsStats clone() {
|
||||
McsStats ret = (McsStats) super.clone();
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasUnsupportedValue() {
|
||||
if (super.hasUnsupportedValue()) {
|
||||
return true;
|
||||
}
|
||||
if (McsType.isUnsupported(mcsNum)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,161 +0,0 @@
|
||||
package com.telecominfraproject.wlan.servicemetric.models;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.telecominfraproject.wlan.core.model.json.JsonDeserializationUtils;
|
||||
|
||||
/**
|
||||
* MCS index values
|
||||
* @author ekeddy
|
||||
*
|
||||
*/
|
||||
public enum McsType {
|
||||
|
||||
//McsType(int id, boolean isHt, boolean isVht, int numSpacialStreams, int mcsIndex)
|
||||
MCS_1 (0, false, false, 1, 1), // 2.4GHz only
|
||||
MCS_2 (1, false, false, 1, 2), // 2.4GHz only
|
||||
MCS_5dot5(2, false, false, 1, 5), // 2.4GHz only
|
||||
MCS_11 (3, false, false, 1, 11), // 2.4GHz only
|
||||
MCS_6 (4, false, false, 1, 13),
|
||||
MCS_9 (5, false, false, 1, 16),
|
||||
MCS_12 (6, false, false, 1, 5),
|
||||
MCS_18 (7, false, false, 1, 7),
|
||||
MCS_24 (8, false, false, 1, 9),
|
||||
MCS_36 (9, false, false, 1, 11),
|
||||
MCS_48 (10, false, false, 1, 1),
|
||||
MCS_54 (11, false, false, 1, 3),
|
||||
MCS_N_0 (12, true, false, 1, 0),
|
||||
MCS_N_1 (13, true, false, 1, 1),
|
||||
MCS_N_2 (14, true, false, 1, 2),
|
||||
MCS_N_3 (15, true, false, 1, 3),
|
||||
MCS_N_4 (16, true, false, 1, 4),
|
||||
MCS_N_5 (17, true, false, 1, 5),
|
||||
MCS_N_6 (18, true, false, 1, 6),
|
||||
MCS_N_7 (19, true, false, 1, 7),
|
||||
MCS_N_8 (20, true, false, 2, 8),
|
||||
MCS_N_9 (21, true, false, 2, 9),
|
||||
MCS_N_10(22, true, false, 2, 10),
|
||||
MCS_N_11(23, true, false, 2, 11),
|
||||
MCS_N_12(24, true, false, 2, 12),
|
||||
MCS_N_13(25, true, false, 2, 13),
|
||||
MCS_N_14(26, true, false, 2, 14),
|
||||
MCS_N_15(27, true, false, 2, 15),
|
||||
MCS_AC_1x1_0(28, false, true, 1, 0),
|
||||
MCS_AC_1x1_1(29, false, true, 1, 1),
|
||||
MCS_AC_1x1_2(30, false, true, 1, 2),
|
||||
MCS_AC_1x1_3(31, false, true, 1, 3),
|
||||
MCS_AC_1x1_4(32, false, true, 1, 4),
|
||||
MCS_AC_1x1_5(33, false, true, 1, 5),
|
||||
MCS_AC_1x1_6(34, false, true, 1, 6),
|
||||
MCS_AC_1x1_7(35, false, true, 1, 7),
|
||||
MCS_AC_1x1_8(36, false, true, 1, 8),
|
||||
MCS_AC_1x1_9(37, false, true, 1, 9),
|
||||
MCS_AC_2x2_0(38, false, true, 2, 0),
|
||||
MCS_AC_2x2_1(39, false, true, 2, 1),
|
||||
MCS_AC_2x2_2(40, false, true, 2, 2),
|
||||
MCS_AC_2x2_3(41, false, true, 2, 3),
|
||||
MCS_AC_2x2_4(42, false, true, 2, 4),
|
||||
MCS_AC_2x2_5(43, false, true, 2, 5),
|
||||
MCS_AC_2x2_6(44, false, true, 2, 6),
|
||||
MCS_AC_2x2_7(45, false, true, 2, 7),
|
||||
MCS_AC_2x2_8(46, false, true, 2, 8),
|
||||
MCS_AC_2x2_9(47, false, true, 2, 9),
|
||||
MCS_AC_3x3_0(48, false, true, 3, 0),
|
||||
MCS_AC_3x3_1(49, false, true, 3, 1),
|
||||
MCS_AC_3x3_2(50, false, true, 3, 2),
|
||||
MCS_AC_3x3_3(51, false, true, 3, 3),
|
||||
MCS_AC_3x3_4(52, false, true, 3, 4),
|
||||
MCS_AC_3x3_5(53, false, true, 3, 5),
|
||||
MCS_AC_3x3_6(54, false, true, 3, 6),
|
||||
MCS_AC_3x3_7(55, false, true, 3, 7),
|
||||
MCS_AC_3x3_8(56, false, true, 3, 8),
|
||||
MCS_AC_3x3_9(57, false, true, 3, 9),
|
||||
MCS_N_16(58, true, false, 3, 16),
|
||||
MCS_N_17(59, true, false, 3, 17),
|
||||
MCS_N_18(60, true, false, 3, 18),
|
||||
MCS_N_19(61, true, false, 3, 19),
|
||||
MCS_N_20(62, true, false, 3, 20),
|
||||
MCS_N_21(63, true, false, 3, 21),
|
||||
MCS_N_22(64, true, false, 3, 22),
|
||||
MCS_N_23(65, true, false, 3, 23),
|
||||
MCS_N_24(66, true, false, 4, 24),
|
||||
MCS_N_25(67, true, false, 4, 25),
|
||||
MCS_N_26(68, true, false, 4, 26),
|
||||
MCS_N_27(69, true, false, 4, 27),
|
||||
MCS_N_28(70, true, false, 4, 28),
|
||||
MCS_N_29(71, true, false, 4, 29),
|
||||
MCS_N_30(72, true, false, 4, 30),
|
||||
MCS_N_31(73, true, false, 4, 31),
|
||||
MCS_AC_4x4_0(74, false, true, 4, 0),
|
||||
MCS_AC_4x4_1(75, false, true, 4, 1),
|
||||
MCS_AC_4x4_2(76, false, true, 4, 2),
|
||||
MCS_AC_4x4_3(77, false, true, 4, 3),
|
||||
MCS_AC_4x4_4(78, false, true, 4, 4),
|
||||
MCS_AC_4x4_5(79, false, true, 4, 5),
|
||||
MCS_AC_4x4_6(80, false, true, 4, 6),
|
||||
MCS_AC_4x4_7(81, false, true, 4, 7),
|
||||
MCS_AC_4x4_8(82, false, true, 4, 8),
|
||||
MCS_AC_4x4_9(83, false, true, 4, 9),
|
||||
|
||||
//last used index 83
|
||||
|
||||
UNSUPPORTED(-1, false, false, 0, -1);
|
||||
|
||||
private final int id;
|
||||
private final boolean isHt;
|
||||
private final boolean isVht;
|
||||
private final int numSpacialStreams;
|
||||
private final int mcsIndex;
|
||||
|
||||
private static final Map<Integer, McsType> ELEMENTS = new HashMap<>();
|
||||
|
||||
private McsType(int id, boolean isHt, boolean isVht, int numSpacialStreams, int mcsIndex){
|
||||
this.id = id;
|
||||
this.isHt = isHt;
|
||||
this.isVht = isVht;
|
||||
this.numSpacialStreams = numSpacialStreams;
|
||||
this.mcsIndex = mcsIndex;
|
||||
}
|
||||
|
||||
public int getId(){
|
||||
return this.id;
|
||||
}
|
||||
|
||||
public int getMcsIndex() {
|
||||
return mcsIndex;
|
||||
}
|
||||
|
||||
public int getNumSpacialStreams() {
|
||||
return numSpacialStreams;
|
||||
}
|
||||
|
||||
public boolean isHt() {
|
||||
return isHt;
|
||||
}
|
||||
|
||||
public boolean isVht() {
|
||||
return isVht;
|
||||
}
|
||||
|
||||
public static McsType getById(int enumId){
|
||||
if(ELEMENTS.isEmpty()){
|
||||
//initialize elements map
|
||||
for(McsType met : McsType.values()){
|
||||
ELEMENTS.put(met.getId(), met);
|
||||
}
|
||||
}
|
||||
|
||||
return ELEMENTS.get(enumId);
|
||||
}
|
||||
|
||||
@JsonCreator
|
||||
public static McsType getByName(String value) {
|
||||
return JsonDeserializationUtils.deserializEnum(value, McsType.class, UNSUPPORTED);
|
||||
}
|
||||
|
||||
public static boolean isUnsupported(McsType value) {
|
||||
return UNSUPPORTED.equals(value);
|
||||
}
|
||||
}
|
||||
@@ -1,245 +0,0 @@
|
||||
package com.telecominfraproject.wlan.servicemetric.models;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonCreator;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
|
||||
import com.telecominfraproject.wlan.core.model.json.JsonDeserializationUtils;
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
public class WmmQueueStats extends BaseJsonModel {
|
||||
|
||||
private static final long serialVersionUID = 1784481171729854130L;
|
||||
|
||||
public static enum WmmQueueType {
|
||||
BE, BK, VI, VO, UNSUPPORTED;
|
||||
|
||||
@JsonCreator
|
||||
public static WmmQueueType getByName(String value) {
|
||||
return JsonDeserializationUtils.deserializEnum(value, WmmQueueType.class, UNSUPPORTED);
|
||||
}
|
||||
|
||||
public static boolean isUnsupported(WmmQueueType queueType) {
|
||||
return UNSUPPORTED.equals(queueType);
|
||||
}
|
||||
}
|
||||
|
||||
private WmmQueueType queueType;
|
||||
private long txFrames;
|
||||
private long txBytes;
|
||||
|
||||
private long txFailedFrames;
|
||||
private long txFailedBytes;
|
||||
|
||||
private long rxFrames;
|
||||
private long rxBytes;
|
||||
|
||||
private long rxFailedFrames;
|
||||
private long rxFailedBytes;
|
||||
|
||||
private long forwardFrames;
|
||||
private long forwardBytes;
|
||||
|
||||
private long txExpiredFrames;
|
||||
private long txExpiredBytes;
|
||||
|
||||
public WmmQueueStats() {
|
||||
// for serialization
|
||||
}
|
||||
|
||||
public WmmQueueStats(WmmQueueType queueType, long txFrames, long txBytes, long txFailedFrames, long txFailedBytes,
|
||||
long rxFrames, long rxBytes, long rxFailedFrames, long rxFailedBytes, long forwardFrames, long forwardBytes,
|
||||
long txExpiredFrames, long txExpiredBytes) {
|
||||
super();
|
||||
this.queueType = queueType;
|
||||
this.txFrames = txFrames;
|
||||
this.txBytes = txBytes;
|
||||
this.txFailedFrames = txFailedFrames;
|
||||
this.txFailedBytes = txFailedBytes;
|
||||
this.rxFrames = rxFrames;
|
||||
this.rxBytes = rxBytes;
|
||||
this.rxFailedFrames = rxFailedFrames;
|
||||
this.rxFailedBytes = rxFailedBytes;
|
||||
this.forwardFrames = forwardFrames;
|
||||
this.forwardBytes = forwardBytes;
|
||||
this.txExpiredFrames = txExpiredFrames;
|
||||
this.txExpiredBytes = txExpiredBytes;
|
||||
}
|
||||
|
||||
public WmmQueueType getQueueType() {
|
||||
return queueType;
|
||||
}
|
||||
|
||||
public void setQueueType(WmmQueueType queueType) {
|
||||
this.queueType = queueType;
|
||||
}
|
||||
|
||||
public long getTxFrames() {
|
||||
return txFrames;
|
||||
}
|
||||
|
||||
public void setTxFrames(long txFrames) {
|
||||
this.txFrames = txFrames;
|
||||
}
|
||||
|
||||
public long getTxBytes() {
|
||||
return txBytes;
|
||||
}
|
||||
|
||||
public void setTxBytes(long txBytes) {
|
||||
this.txBytes = txBytes;
|
||||
}
|
||||
|
||||
public long getTxFailedFrames() {
|
||||
return txFailedFrames;
|
||||
}
|
||||
|
||||
public void setTxFailedFrames(long txFailedFrames) {
|
||||
this.txFailedFrames = txFailedFrames;
|
||||
}
|
||||
|
||||
public long getTxFailedBytes() {
|
||||
return txFailedBytes;
|
||||
}
|
||||
|
||||
public void setTxFailedBytes(long txFailedBytes) {
|
||||
this.txFailedBytes = txFailedBytes;
|
||||
}
|
||||
|
||||
public long getRxFrames() {
|
||||
return rxFrames;
|
||||
}
|
||||
|
||||
public void setRxFrames(long rxFrames) {
|
||||
this.rxFrames = rxFrames;
|
||||
}
|
||||
|
||||
public long getRxBytes() {
|
||||
return rxBytes;
|
||||
}
|
||||
|
||||
public void setRxBytes(long rxBytes) {
|
||||
this.rxBytes = rxBytes;
|
||||
}
|
||||
|
||||
public long getRxFailedFrames() {
|
||||
return rxFailedFrames;
|
||||
}
|
||||
|
||||
public void setRxFailedFrames(long rxFailedFrames) {
|
||||
this.rxFailedFrames = rxFailedFrames;
|
||||
}
|
||||
|
||||
public long getRxFailedBytes() {
|
||||
return rxFailedBytes;
|
||||
}
|
||||
|
||||
public void setRxFailedBytes(long rxFailedBytes) {
|
||||
this.rxFailedBytes = rxFailedBytes;
|
||||
}
|
||||
|
||||
public long getForwardFrames() {
|
||||
return forwardFrames;
|
||||
}
|
||||
|
||||
public void setForwardFrames(long forwardFrames) {
|
||||
this.forwardFrames = forwardFrames;
|
||||
}
|
||||
|
||||
public long getForwardBytes() {
|
||||
return forwardBytes;
|
||||
}
|
||||
|
||||
public void setForwardBytes(long forwardBytes) {
|
||||
this.forwardBytes = forwardBytes;
|
||||
}
|
||||
|
||||
public long getTxExpiredFrames() {
|
||||
return txExpiredFrames;
|
||||
}
|
||||
|
||||
public void setTxExpiredFrames(long txExpiredFrames) {
|
||||
this.txExpiredFrames = txExpiredFrames;
|
||||
}
|
||||
|
||||
public long getTxExpiredBytes() {
|
||||
return txExpiredBytes;
|
||||
}
|
||||
|
||||
public void setTxExpiredBytes(long txExpiredBytes) {
|
||||
this.txExpiredBytes = txExpiredBytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + (int) (forwardBytes ^ (forwardBytes >>> 32));
|
||||
result = prime * result + (int) (forwardFrames ^ (forwardFrames >>> 32));
|
||||
result = prime * result + ((queueType == null) ? 0 : queueType.hashCode());
|
||||
result = prime * result + (int) (rxBytes ^ (rxBytes >>> 32));
|
||||
result = prime * result + (int) (rxFailedBytes ^ (rxFailedBytes >>> 32));
|
||||
result = prime * result + (int) (rxFailedFrames ^ (rxFailedFrames >>> 32));
|
||||
result = prime * result + (int) (rxFrames ^ (rxFrames >>> 32));
|
||||
result = prime * result + (int) (txBytes ^ (txBytes >>> 32));
|
||||
result = prime * result + (int) (txExpiredBytes ^ (txExpiredBytes >>> 32));
|
||||
result = prime * result + (int) (txExpiredFrames ^ (txExpiredFrames >>> 32));
|
||||
result = prime * result + (int) (txFailedBytes ^ (txFailedBytes >>> 32));
|
||||
result = prime * result + (int) (txFailedFrames ^ (txFailedFrames >>> 32));
|
||||
result = prime * result + (int) (txFrames ^ (txFrames >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
WmmQueueStats other = (WmmQueueStats) obj;
|
||||
if (forwardBytes != other.forwardBytes)
|
||||
return false;
|
||||
if (forwardFrames != other.forwardFrames)
|
||||
return false;
|
||||
if (queueType != other.queueType)
|
||||
return false;
|
||||
if (rxBytes != other.rxBytes)
|
||||
return false;
|
||||
if (rxFailedBytes != other.rxFailedBytes)
|
||||
return false;
|
||||
if (rxFailedFrames != other.rxFailedFrames)
|
||||
return false;
|
||||
if (rxFrames != other.rxFrames)
|
||||
return false;
|
||||
if (txBytes != other.txBytes)
|
||||
return false;
|
||||
if (txExpiredBytes != other.txExpiredBytes)
|
||||
return false;
|
||||
if (txExpiredFrames != other.txExpiredFrames)
|
||||
return false;
|
||||
if (txFailedBytes != other.txFailedBytes)
|
||||
return false;
|
||||
if (txFailedFrames != other.txFailedFrames)
|
||||
return false;
|
||||
if (txFrames != other.txFrames)
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasUnsupportedValue() {
|
||||
if (super.hasUnsupportedValue()) {
|
||||
return true;
|
||||
}
|
||||
if (WmmQueueType.isUnsupported(queueType)) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WmmQueueStats clone() {
|
||||
return (WmmQueueStats) super.clone();
|
||||
}
|
||||
}
|
||||
@@ -127,10 +127,6 @@ public class ServiceMetricServiceRemoteTest extends BaseRemoteTest {
|
||||
serviceMetric.setClientMac(getNextEquipmentId());
|
||||
serviceMetric.setCreatedTimestamp(baseTimestamp - 100000 + getNextEquipmentId());
|
||||
|
||||
ClientMetrics details2 = new ClientMetrics();
|
||||
details2.setClassificationName("qr_"+apNameIdx);
|
||||
serviceMetric.setDetails(details2);
|
||||
|
||||
apNameIdx++;
|
||||
|
||||
remoteInterface.create(serviceMetric);
|
||||
@@ -144,10 +140,6 @@ public class ServiceMetricServiceRemoteTest extends BaseRemoteTest {
|
||||
serviceMetric.setClientMac(getNextEquipmentId());
|
||||
serviceMetric.setCreatedTimestamp(baseTimestamp + getNextEquipmentId());
|
||||
|
||||
ClientMetrics details2 = new ClientMetrics();
|
||||
details2.setClassificationName("qr_"+apNameIdx);
|
||||
serviceMetric.setDetails(details2);
|
||||
|
||||
apNameIdx++;
|
||||
|
||||
remoteInterface.create(serviceMetric);
|
||||
@@ -161,10 +153,6 @@ public class ServiceMetricServiceRemoteTest extends BaseRemoteTest {
|
||||
serviceMetric.setClientMac(getNextEquipmentId());
|
||||
serviceMetric.setCreatedTimestamp(baseTimestamp - 100000 + getNextEquipmentId());
|
||||
|
||||
ClientMetrics details2 = new ClientMetrics();
|
||||
details2.setClassificationName("qr_"+apNameIdx);
|
||||
serviceMetric.setDetails(details2);
|
||||
|
||||
apNameIdx++;
|
||||
|
||||
remoteInterface.create(serviceMetric);
|
||||
@@ -209,43 +197,18 @@ public class ServiceMetricServiceRemoteTest extends BaseRemoteTest {
|
||||
assertTrue(page6.getContext().isLastPage());
|
||||
assertTrue(page7.getContext().isLastPage());
|
||||
|
||||
List<String> expectedPage3Strings = new ArrayList<>(Arrays.asList(new String[]{"qr_20", "qr_21", "qr_22", "qr_23", "qr_24", "qr_25", "qr_26", "qr_27", "qr_28", "qr_29" }));
|
||||
List<String> actualPage3Strings = new ArrayList<>();
|
||||
page3.getItems().stream().forEach( ce -> actualPage3Strings.add(((ClientMetrics) ce.getDetails()).getClassificationName()) );
|
||||
|
||||
assertEquals(expectedPage3Strings, actualPage3Strings);
|
||||
|
||||
//test first page of the results with empty sort order -> default sort order (by createdTimestamp ascending)
|
||||
PaginationResponse<ServiceMetric> page1EmptySort = remoteInterface.getForCustomer(fromTime, toTime, customerId_1, null, null, null, null, Collections.emptyList(), context);
|
||||
assertEquals(10, page1EmptySort.getItems().size());
|
||||
|
||||
List<String> expectedPage1EmptySortStrings = new ArrayList<>(Arrays.asList(new String[]{"qr_0", "qr_1", "qr_2", "qr_3", "qr_4", "qr_5", "qr_6", "qr_7", "qr_8", "qr_9" }));
|
||||
List<String> actualPage1EmptySortStrings = new ArrayList<>();
|
||||
page1EmptySort.getItems().stream().forEach( ce -> actualPage1EmptySortStrings.add(((ClientMetrics) ce.getDetails()).getClassificationName() ) );
|
||||
|
||||
assertEquals(expectedPage1EmptySortStrings, actualPage1EmptySortStrings);
|
||||
|
||||
//test first page of the results with null sort order -> default sort order (by createdTimestamp ascending)
|
||||
PaginationResponse<ServiceMetric> page1NullSort = remoteInterface.getForCustomer(fromTime, toTime, customerId_1, null, null, null, null, null, context);
|
||||
assertEquals(10, page1NullSort.getItems().size());
|
||||
|
||||
List<String> expectedPage1NullSortStrings = new ArrayList<>(Arrays.asList(new String[]{"qr_0", "qr_1", "qr_2", "qr_3", "qr_4", "qr_5", "qr_6", "qr_7", "qr_8", "qr_9" }));
|
||||
List<String> actualPage1NullSortStrings = new ArrayList<>();
|
||||
page1NullSort.getItems().stream().forEach( ce -> actualPage1NullSortStrings.add(((ClientMetrics) ce.getDetails()).getClassificationName() ) );
|
||||
|
||||
assertEquals(expectedPage1NullSortStrings, actualPage1NullSortStrings);
|
||||
|
||||
|
||||
//test first page of the results with sort descending order by a equipmentId property
|
||||
PaginationResponse<ServiceMetric> page1SingleSortDesc = remoteInterface.getForCustomer(fromTime, toTime, customerId_1, null, null, null, null, Collections.singletonList(new ColumnAndSort("equipmentId", SortOrder.desc)), context);
|
||||
assertEquals(10, page1SingleSortDesc.getItems().size());
|
||||
|
||||
List<String> expectedPage1SingleSortDescStrings = new ArrayList< >(Arrays.asList(new String[]{"qr_49", "qr_48", "qr_47", "qr_46", "qr_45", "qr_44", "qr_43", "qr_42", "qr_41", "qr_40" }));
|
||||
List<String> actualPage1SingleSortDescStrings = new ArrayList<>();
|
||||
page1SingleSortDesc.getItems().stream().forEach( ce -> actualPage1SingleSortDescStrings.add(((ClientMetrics) ce.getDetails()).getClassificationName() ) );
|
||||
|
||||
assertEquals(expectedPage1SingleSortDescStrings, actualPage1SingleSortDescStrings);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -338,7 +301,6 @@ public class ServiceMetricServiceRemoteTest extends BaseRemoteTest {
|
||||
serviceMetric.setCreatedTimestamp(baseTimestamp - getNextEquipmentId());
|
||||
|
||||
ClientMetrics details2 = new ClientMetrics();
|
||||
details2.setClassificationName("qr_"+apNameIdx);
|
||||
serviceMetric.setDetails(details2);
|
||||
|
||||
remoteInterface.create(serviceMetric);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -53,12 +53,6 @@
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>equipment-alarms-sp</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
<version>1.2.0-SNAPSHOT</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<artifactId>adoption-metrics-sp</artifactId>
|
||||
<groupId>com.telecominfraproject.wlan</groupId>
|
||||
|
||||
@@ -56,8 +56,7 @@ public class StatusDatastoreCassandra implements StatusDatastore {
|
||||
private static final Set<String> columnsToSkipForUpdate = new HashSet<>(Arrays.asList(
|
||||
"customerId",
|
||||
"equipmentId",
|
||||
"statusDataType",
|
||||
"createdTimestamp"));
|
||||
"statusDataType"));
|
||||
|
||||
private static final String TABLE_NAME = "status";
|
||||
private static final String ALL_COLUMNS;
|
||||
@@ -230,11 +229,14 @@ public class StatusDatastoreCassandra implements StatusDatastore {
|
||||
//This DAO does not enforce check for concurrent updates. Last one always wins.
|
||||
|
||||
long newLastModifiedTs = System.currentTimeMillis();
|
||||
boolean isCreateNotSet = status.getCreatedTimestamp() == 0;
|
||||
|
||||
|
||||
cqlSession.execute(preparedStmt_update.bind(
|
||||
|
||||
//TODO: add remaining properties from Status here
|
||||
(status.getDetails()!=null) ? ByteBuffer.wrap(status.getDetails().toZippedBytes()) : null ,
|
||||
isCreateNotSet ? newLastModifiedTs : status.getCreatedTimestamp(),
|
||||
|
||||
newLastModifiedTs,
|
||||
|
||||
@@ -253,6 +255,9 @@ public class StatusDatastoreCassandra implements StatusDatastore {
|
||||
|
||||
//make a copy so that we don't accidentally update caller's version by reference
|
||||
Status statusCopy = status.clone();
|
||||
if(isCreateNotSet) {
|
||||
statusCopy.setCreatedTimestamp(newLastModifiedTs);
|
||||
}
|
||||
statusCopy.setLastModifiedTimestamp(newLastModifiedTs);
|
||||
|
||||
LOG.debug("Updated Status {}", statusCopy);
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
|
||||
package com.telecominfraproject.wlan.status.equipment.models;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
import com.telecominfraproject.wlan.core.model.equipment.LedStatus;
|
||||
import com.telecominfraproject.wlan.status.models.StatusCode;
|
||||
import com.telecominfraproject.wlan.status.models.StatusDataType;
|
||||
import com.telecominfraproject.wlan.status.models.StatusDetails;
|
||||
@@ -29,70 +32,29 @@ public class EquipmentAdminStatusData extends StatusDetails {
|
||||
*/
|
||||
private String statusMessage;
|
||||
|
||||
private Map<String, Long> alarmTimestamps;
|
||||
|
||||
private LedStatus ledStatus;
|
||||
|
||||
private Map<String,Long> alarmTimestamps;
|
||||
|
||||
public EquipmentAdminStatusData() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public StatusDataType getStatusDataType() {
|
||||
return StatusDataType.EQUIPMENT_ADMIN;
|
||||
return StatusDataType.EQUIPMENT_ADMIN;
|
||||
}
|
||||
|
||||
|
||||
public EquipmentAdminStatusData(EquipmentAdminStatusData data) {
|
||||
this.statusCode = data.statusCode;
|
||||
this.statusMessage = data.statusMessage;
|
||||
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;
|
||||
this.alarmTimestamps = data.alarmTimestamps == null ? null : new HashMap<>(data.alarmTimestamps);
|
||||
}
|
||||
|
||||
@Override
|
||||
public EquipmentAdminStatusData clone() {
|
||||
EquipmentAdminStatusData res = (EquipmentAdminStatusData) super.clone();
|
||||
if(this.alarmTimestamps != null) {
|
||||
if (this.alarmTimestamps != null) {
|
||||
res.setAlarmTimestamps(new HashMap<>(this.alarmTimestamps));
|
||||
}
|
||||
return res;
|
||||
@@ -121,26 +83,54 @@ public class EquipmentAdminStatusData extends StatusDetails {
|
||||
public void setAlarmTimestamps(Map<String, Long> alarmTimestamps) {
|
||||
this.alarmTimestamps = alarmTimestamps;
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
if(alarmTimestamps == null) {
|
||||
if (alarmTimestamps == null) {
|
||||
alarmTimestamps = new HashMap<>();
|
||||
}
|
||||
alarmTimestamps.put(alarmKey, value);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean hasUnsupportedValue() {
|
||||
if (super.hasUnsupportedValue()) {
|
||||
return true;
|
||||
}
|
||||
if (StatusCode.isUnsupported(statusCode) ) {
|
||||
if (StatusCode.isUnsupported(statusCode)) {
|
||||
return true;
|
||||
}
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ public class EquipmentChannelStatusData extends StatusDetails {
|
||||
private static final long serialVersionUID = 470569467119609438L;
|
||||
|
||||
private Map<RadioType, Integer> channelNumberStatusDataMap = new EnumMap<>(RadioType.class);
|
||||
private Map<RadioType, Integer> txPowerDataMap = new EnumMap<>(RadioType.class);
|
||||
|
||||
|
||||
public EquipmentChannelStatusData()
|
||||
@@ -34,10 +35,18 @@ public class EquipmentChannelStatusData extends StatusDetails {
|
||||
public Map<RadioType, Integer> getChannelNumberStatusDataMap() {
|
||||
return channelNumberStatusDataMap;
|
||||
}
|
||||
|
||||
public Map<RadioType, Integer> getTxPowerDataMap() {
|
||||
return txPowerDataMap;
|
||||
}
|
||||
|
||||
public void setChannelNumberStatusDataMap(Map<RadioType, Integer> channelNumberStatusDataMap) {
|
||||
this.channelNumberStatusDataMap = channelNumberStatusDataMap;
|
||||
}
|
||||
|
||||
public void setTxPowerDataMap(Map<RadioType, Integer> txPowerDataMap) {
|
||||
this.txPowerDataMap = txPowerDataMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EquipmentChannelStatusData clone() {
|
||||
@@ -49,19 +58,33 @@ public class EquipmentChannelStatusData extends StatusDetails {
|
||||
result.channelNumberStatusDataMap.put(k, v);
|
||||
});
|
||||
}
|
||||
|
||||
if (getTxPowerDataMap() != null) {
|
||||
result.setTxPowerDataMap(new EnumMap<>(RadioType.class));
|
||||
|
||||
this.txPowerDataMap.forEach((k, v) -> {
|
||||
result.txPowerDataMap.put(k, v);
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
EquipmentChannelStatusData other = (EquipmentChannelStatusData) obj;
|
||||
return Objects.equals(channelNumberStatusDataMap, other.channelNumberStatusDataMap);
|
||||
public int hashCode() {
|
||||
return Objects.hash(channelNumberStatusDataMap, txPowerDataMap);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(channelNumberStatusDataMap);
|
||||
|
||||
public boolean equals(Object obj) {
|
||||
if (this == obj)
|
||||
return true;
|
||||
if (obj == null)
|
||||
return false;
|
||||
if (getClass() != obj.getClass())
|
||||
return false;
|
||||
EquipmentChannelStatusData other = (EquipmentChannelStatusData) obj;
|
||||
return Objects.equals(channelNumberStatusDataMap, other.channelNumberStatusDataMap)
|
||||
&& Objects.equals(txPowerDataMap, other.txPowerDataMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -197,6 +197,15 @@ components:
|
||||
$ref: '#/components/schemas/StatusCode'
|
||||
statusMessage:
|
||||
type: string
|
||||
ledStatus:
|
||||
$ref: '#/components/schemas/LedStatus'
|
||||
|
||||
LedStatus:
|
||||
type: string
|
||||
enum:
|
||||
- led_blink
|
||||
- led_off
|
||||
- UNKNOWN
|
||||
|
||||
StatusCode:
|
||||
type: string
|
||||
|
||||
@@ -33,6 +33,7 @@ import com.telecominfraproject.wlan.core.model.pagination.PaginationResponse;
|
||||
import com.telecominfraproject.wlan.core.server.cassandra.RowMapper;
|
||||
import com.telecominfraproject.wlan.systemevent.datastore.SystemEventDatastore;
|
||||
import com.telecominfraproject.wlan.systemevent.models.SystemEventRecord;
|
||||
import com.telecominfraproject.wlan.systemevent.models.SystemEventStats;
|
||||
|
||||
|
||||
/**
|
||||
@@ -1031,4 +1032,9 @@ public class SystemEventDatastoreCassandra implements SystemEventDatastore {
|
||||
return nextPagingState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemEventStats getSystemEventStats(String filterAttributeName, String filterAttributeValue, long fromTime, long toTime) {
|
||||
return new SystemEventStats();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.telecominfraproject.wlan.systemevent.datastore.inmemory;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -20,8 +21,10 @@ import com.telecominfraproject.wlan.core.model.pagination.PaginationResponse;
|
||||
import com.telecominfraproject.wlan.core.model.pagination.SortOrder;
|
||||
import com.telecominfraproject.wlan.datastore.inmemory.BaseInMemoryDatastore;
|
||||
import com.telecominfraproject.wlan.systemevent.datastore.SystemEventDatastore;
|
||||
import com.telecominfraproject.wlan.systemevent.models.EquipmentEventStats;
|
||||
import com.telecominfraproject.wlan.systemevent.models.SystemEventRecord;
|
||||
import com.telecominfraproject.wlan.systemevent.models.SystemEventRecordKey;
|
||||
import com.telecominfraproject.wlan.systemevent.models.SystemEventStats;
|
||||
|
||||
/**
|
||||
* @author dtoptygin
|
||||
@@ -228,4 +231,38 @@ public class SystemEventDatastoreInMemory extends BaseInMemoryDatastore implemen
|
||||
return clientMacAddresses.contains(macAddress);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemEventStats getSystemEventStats(String filterAttributeName, String filterAttributeValue, long fromTime, long toTime) {
|
||||
List<SystemEventRecord> items = new LinkedList<>();
|
||||
|
||||
// apply filters and build the full result list first - inefficient, but ok for testing
|
||||
for (SystemEventRecord mdl : idToSystemEventRecordMap.values()) {
|
||||
|
||||
if (mdl.getEventTimestamp() >= fromTime && mdl.getEventTimestamp() <= toTime) {
|
||||
items.add(mdl);
|
||||
}
|
||||
}
|
||||
|
||||
SystemEventStats stats = new SystemEventStats();
|
||||
stats.setTotalCount(items.size());
|
||||
Map<String, EquipmentEventStats> eqptStatsMap = new HashMap<>();
|
||||
for (SystemEventRecord mdl : items) {
|
||||
EquipmentEventStats eqptStats = eqptStatsMap.get(Long.toString(mdl.getEquipmentId()));
|
||||
if (eqptStats == null) {
|
||||
eqptStats = new EquipmentEventStats();
|
||||
eqptStats.setEquipmentId(mdl.getEquipmentId());
|
||||
eqptStatsMap.put(Long.toString(mdl.getEquipmentId()), eqptStats);
|
||||
}
|
||||
eqptStats.setTotalCount(eqptStats.getTotalCount() + 1);
|
||||
if (mdl.getEventTimestamp() > eqptStats.getLastEventTime()) {
|
||||
eqptStats.setLastEventTime(mdl.getEventTimestamp());
|
||||
}
|
||||
items.add(mdl);
|
||||
}
|
||||
|
||||
List<EquipmentEventStats> equipmentStats = new ArrayList<>();
|
||||
stats.setEquipmentStats(equipmentStats);
|
||||
return stats;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.telecominfraproject.wlan.core.model.pagination.ColumnAndSort;
|
||||
import com.telecominfraproject.wlan.core.model.pagination.PaginationContext;
|
||||
import com.telecominfraproject.wlan.core.model.pagination.PaginationResponse;
|
||||
import com.telecominfraproject.wlan.systemevent.models.SystemEventRecord;
|
||||
import com.telecominfraproject.wlan.systemevent.models.SystemEventStats;
|
||||
|
||||
/**
|
||||
* @author dtoptygin
|
||||
@@ -60,4 +61,13 @@ public interface SystemEventDatastore {
|
||||
List<ColumnAndSort> sortBy,
|
||||
PaginationContext<SystemEventRecord> context);
|
||||
|
||||
/**
|
||||
* @param filterAttributeName
|
||||
* @param filterAttributeValue
|
||||
* @param fromTime
|
||||
* @param toTime
|
||||
* @return Returns system event statistics for the given time range.
|
||||
*/
|
||||
SystemEventStats getSystemEventStats(String filterAttributeName, String filterAttributeValue, long fromTime, long toTime);
|
||||
|
||||
}
|
||||
|
||||
@@ -20,12 +20,12 @@ public abstract class BaseDhcpEvent extends SystemEvent implements HasClientMac,
|
||||
private InetAddress clientIp;
|
||||
private InetAddress relayIp;
|
||||
private MacAddress clientMacAddress;
|
||||
private long sessionId; // association sessionid
|
||||
private String sessionId; // association sessionid
|
||||
private int customerId;
|
||||
private long equipmentId;
|
||||
private long locationId;
|
||||
|
||||
public BaseDhcpEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, long sessionId) {
|
||||
public BaseDhcpEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, String sessionId) {
|
||||
super(eventTimestamp);
|
||||
this.customerId = customerId;
|
||||
this.locationId = locationId;
|
||||
@@ -113,11 +113,11 @@ public abstract class BaseDhcpEvent extends SystemEvent implements HasClientMac,
|
||||
this.relayIp = relayIp;
|
||||
}
|
||||
|
||||
public long getSessionId() {
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public void setSessionId(long sessionId) {
|
||||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,12 +22,12 @@ public class DhcpAckEvent extends BaseDhcpEvent {
|
||||
*/
|
||||
private boolean fromInternal = false;
|
||||
|
||||
public DhcpAckEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, long sessionId) {
|
||||
public DhcpAckEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, String sessionId) {
|
||||
super(customerId, locationId, equipmentId, eventTimestamp, sessionId);
|
||||
}
|
||||
|
||||
public DhcpAckEvent() {
|
||||
super(0, 0L,0L,0L,0L);
|
||||
super(0, 0L,0L,0L,"0");
|
||||
}
|
||||
|
||||
public InetAddress getGatewayIp() {
|
||||
|
||||
@@ -10,12 +10,12 @@ package com.telecominfraproject.wlan.systemevent.equipment;
|
||||
public class DhcpDeclineEvent extends BaseDhcpEvent {
|
||||
private static final long serialVersionUID = -7745659083975485467L;
|
||||
|
||||
public DhcpDeclineEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, long sessionId){
|
||||
public DhcpDeclineEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, String sessionId){
|
||||
super(customerId, locationId, equipmentId,eventTimestamp, sessionId);
|
||||
}
|
||||
|
||||
public DhcpDeclineEvent() {
|
||||
super(0,0L, 0L,0L,0L);
|
||||
super(0,0L, 0L,0L,"0");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,12 +9,12 @@ public class DhcpDiscoverEvent extends BaseDhcpEvent {
|
||||
private static final long serialVersionUID = -8290687227649478971L;
|
||||
private String hostName;
|
||||
|
||||
public DhcpDiscoverEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, long sessionId){
|
||||
public DhcpDiscoverEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, String sessionId){
|
||||
super(customerId, locationId,equipmentId,eventTimestamp,sessionId);
|
||||
}
|
||||
|
||||
public DhcpDiscoverEvent() {
|
||||
super(0, 0L,0L,0L,0L);
|
||||
super(0, 0L,0L,0L,"0");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,12 +10,12 @@ package com.telecominfraproject.wlan.systemevent.equipment;
|
||||
public class DhcpInformEvent extends BaseDhcpEvent {
|
||||
private static final long serialVersionUID = 7053813308222200205L;
|
||||
|
||||
public DhcpInformEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, long sessionId){
|
||||
public DhcpInformEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, String sessionId){
|
||||
super(customerId, locationId,equipmentId,eventTimestamp, sessionId);
|
||||
}
|
||||
|
||||
public DhcpInformEvent() {
|
||||
super(0, 0L,0L,0L,0L);
|
||||
super(0, 0L,0L,0L,"0");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -9,12 +9,12 @@ public class DhcpNakEvent extends BaseDhcpEvent {
|
||||
private static final long serialVersionUID = -8648265834227002667L;
|
||||
private boolean fromInternal = false;
|
||||
|
||||
public DhcpNakEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, long sessionId) {
|
||||
public DhcpNakEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, String sessionId) {
|
||||
super(customerId, locationId, equipmentId, eventTimestamp, sessionId);
|
||||
}
|
||||
|
||||
public DhcpNakEvent() {
|
||||
super(0, 0L,0L,0L,0L);
|
||||
super(0, 0L,0L,0L,"0");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -10,12 +10,12 @@ public class DhcpOfferEvent extends BaseDhcpEvent {
|
||||
*/
|
||||
private boolean fromInternal = false;
|
||||
|
||||
public DhcpOfferEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, long sessionId) {
|
||||
public DhcpOfferEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, String sessionId) {
|
||||
super(customerId, locationId, equipmentId, eventTimestamp, sessionId);
|
||||
}
|
||||
|
||||
public DhcpOfferEvent() {
|
||||
super(0, 0L,0L,0L,0L);
|
||||
super(0, 0L,0L,0L,"0");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -9,12 +9,12 @@ public class DhcpRequestEvent extends BaseDhcpEvent {
|
||||
private static final long serialVersionUID = 906425685437156761L;
|
||||
private String hostName;
|
||||
|
||||
public DhcpRequestEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, long sessionId){
|
||||
public DhcpRequestEvent(int customerId, long locationId, long equipmentId, long eventTimestamp, String sessionId){
|
||||
super(customerId, locationId,equipmentId,eventTimestamp, sessionId);
|
||||
}
|
||||
|
||||
public DhcpRequestEvent() {
|
||||
super(0, 0L,0L,0L,0L);
|
||||
super(0, 0L,0L,0L,"0");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,7 +28,7 @@ public abstract class RealTimeSipCallEventWithStats extends RealTimeEvent
|
||||
private static final long serialVersionUID = -8908272967317508366L;
|
||||
|
||||
private Long sipCallId;
|
||||
private Long associationId;
|
||||
private String associationId;
|
||||
private MacAddress clientMacAddress;
|
||||
private List<RtpFlowStats> statuses;
|
||||
private int channel;
|
||||
@@ -49,12 +49,12 @@ public abstract class RealTimeSipCallEventWithStats extends RealTimeEvent
|
||||
this.sipCallId = sipCallId;
|
||||
}
|
||||
|
||||
public Long getAssociationId() {
|
||||
public String getAssociationId() {
|
||||
return associationId;
|
||||
}
|
||||
|
||||
public void setAssociationId(Long associationId) {
|
||||
this.associationId = associationId;
|
||||
public void setAssociationId(String string) {
|
||||
this.associationId = string;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -79,7 +79,7 @@ public abstract class RealTimeSipCallEventWithStats extends RealTimeEvent
|
||||
}
|
||||
|
||||
public boolean hasValidAssociationId() {
|
||||
return (associationId != null) && (associationId != 0);
|
||||
return (associationId != null) && (!associationId.equals("0"));
|
||||
}
|
||||
|
||||
public int getChannel() {
|
||||
|
||||
@@ -18,7 +18,7 @@ public class RealTimeSipCallStartEvent extends RealTimeEvent
|
||||
*/
|
||||
private static final long serialVersionUID = -7289926906539107435L;
|
||||
private Long sipCallId;
|
||||
private Long associationId;
|
||||
private String associationId;
|
||||
private MacAddress macAddress;
|
||||
private List<String> codecs;
|
||||
private String providerDomain;
|
||||
@@ -52,7 +52,7 @@ public class RealTimeSipCallStartEvent extends RealTimeEvent
|
||||
&& Objects.equals(channel, other.channel) && Objects.equals(radioType, other.radioType);
|
||||
}
|
||||
|
||||
public Long getAssociationId() {
|
||||
public String getAssociationId() {
|
||||
return associationId;
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ public class RealTimeSipCallStartEvent extends RealTimeEvent
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setAssociationId(Long associationId) {
|
||||
public void setAssociationId(String associationId) {
|
||||
this.associationId = associationId;
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ public class RealTimeSipCallStartEvent extends RealTimeEvent
|
||||
}
|
||||
|
||||
public boolean hasValidAssociationId() {
|
||||
return (associationId != null) && (associationId != 0);
|
||||
return (associationId != null) && (!associationId.equals("0"));
|
||||
}
|
||||
|
||||
public int getChannel() {
|
||||
|
||||
@@ -13,8 +13,8 @@ public class RealTimeStreamingStartEvent extends RealTimeEvent
|
||||
implements HasCustomerId, HasEquipmentId, HasClientMac, HasProducedTimestamp {
|
||||
|
||||
private static final long serialVersionUID = -591221857158333271L;
|
||||
private Long videoSessionId;
|
||||
private Long sessionId;
|
||||
private String videoSessionId;
|
||||
private String sessionId;
|
||||
private MacAddress clientMac;
|
||||
private InetAddress serverIp;
|
||||
private String serverDnsName;
|
||||
@@ -40,19 +40,19 @@ public class RealTimeStreamingStartEvent extends RealTimeEvent
|
||||
this.serverDnsName = serverDnsName;
|
||||
}
|
||||
|
||||
public Long getVideoSessionId() {
|
||||
public String getVideoSessionId() {
|
||||
return videoSessionId;
|
||||
}
|
||||
|
||||
public void setVideoSessionId(Long videoSessionId) {
|
||||
public void setVideoSessionId(String videoSessionId) {
|
||||
this.videoSessionId = videoSessionId;
|
||||
}
|
||||
|
||||
public Long getSessionId() {
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public void setSessionId(Long sessionId) {
|
||||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ public class RealTimeStreamingStartSessionEvent extends RealTimeEvent
|
||||
implements HasCustomerId, HasEquipmentId, HasClientMac, HasProducedTimestamp {
|
||||
|
||||
private static final long serialVersionUID = 4395850344272425198L;
|
||||
private Long videoSessionId;
|
||||
private Long sessionId;
|
||||
private String videoSessionId;
|
||||
private String sessionId;
|
||||
private MacAddress clientMac;
|
||||
private InetAddress serverIp;
|
||||
private StreamingVideoType type;
|
||||
@@ -31,19 +31,19 @@ public class RealTimeStreamingStartSessionEvent extends RealTimeEvent
|
||||
super(RealTimeEventType.VideoStreamDebugStart, customerId, locationId, equipmentId, eventTimestamp);
|
||||
}
|
||||
|
||||
public Long getVideoSessionId() {
|
||||
public String getVideoSessionId() {
|
||||
return videoSessionId;
|
||||
}
|
||||
|
||||
public void setVideoSessionId(Long videoSessionId) {
|
||||
public void setVideoSessionId(String videoSessionId) {
|
||||
this.videoSessionId = videoSessionId;
|
||||
}
|
||||
|
||||
public Long getSessionId() {
|
||||
public String getSessionId() {
|
||||
return sessionId;
|
||||
}
|
||||
|
||||
public void setSessionId(Long sessionId) {
|
||||
public void setSessionId(String sessionId) {
|
||||
this.sessionId = sessionId;
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user