mirror of
https://github.com/Telecominfraproject/wlan-cloud-services.git
synced 2026-03-21 01:39:19 +00:00
Compare commits
130 Commits
updateAPI
...
release/v1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df522d58ee | ||
|
|
2f791e1364 | ||
|
|
a792c602df | ||
|
|
0bfdfc2d56 | ||
|
|
f64816dbbe | ||
|
|
f87600d283 | ||
|
|
9d19a6c436 | ||
|
|
eb19907513 | ||
|
|
1502913097 | ||
|
|
27e7c0173a | ||
|
|
051458b9d4 | ||
|
|
d98d5a2ad3 | ||
|
|
dda25eac2e | ||
|
|
c8c3e85a55 | ||
|
|
d5df9485f6 | ||
|
|
83e4f3613a | ||
|
|
aa77c4a2d5 | ||
|
|
3a4561b323 | ||
|
|
7abc4c8554 | ||
|
|
34bec5009a | ||
|
|
824568a128 | ||
|
|
5211ed7e68 | ||
|
|
1bffb4f96a | ||
|
|
fa77d3896d | ||
|
|
55c4671211 | ||
|
|
a540274210 | ||
|
|
56f43d8e7f | ||
|
|
607c1c815e | ||
|
|
f750d0cad2 | ||
|
|
1551babca2 | ||
|
|
70bd1f5eda | ||
|
|
88fa6ca8a5 | ||
|
|
e090bd6b00 | ||
|
|
aa1fbfd645 | ||
|
|
9ee24beb64 | ||
|
|
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 |
@@ -121,6 +121,10 @@ public class AlarmDatastoreCassandra implements AlarmDatastore {
|
|||||||
" from " + TABLE_NAME + " " +
|
" from " + TABLE_NAME + " " +
|
||||||
" where customerId = ? ";
|
" where customerId = ? ";
|
||||||
|
|
||||||
|
private static final String CQL_GET_ALL =
|
||||||
|
"select " + ALL_COLUMNS +
|
||||||
|
" from " + TABLE_NAME + " ";
|
||||||
|
|
||||||
private static final String CQL_GET_LASTMOD_BY_ID =
|
private static final String CQL_GET_LASTMOD_BY_ID =
|
||||||
"select lastModifiedTimestamp " +
|
"select lastModifiedTimestamp " +
|
||||||
" from "+TABLE_NAME+" " +
|
" from "+TABLE_NAME+" " +
|
||||||
@@ -791,7 +795,10 @@ public class AlarmDatastoreCassandra implements AlarmDatastore {
|
|||||||
long equipmentIdPostQuery = row.getLong("equipmentId");
|
long equipmentIdPostQuery = row.getLong("equipmentId");
|
||||||
int alarmCodePostQuery = row.getInt("alarmCode");
|
int alarmCodePostQuery = row.getInt("alarmCode");
|
||||||
long createdTimestampPostQuery = row.getLong("createdTimestamp");
|
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;
|
break;
|
||||||
default:
|
default:
|
||||||
@@ -922,4 +929,51 @@ public class AlarmDatastoreCassandra implements AlarmDatastore {
|
|||||||
return alarmCounts;
|
return alarmCounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Alarm> get(Set<AlarmCode> alarmCodes, long createdAfterTimestamp) {
|
||||||
|
|
||||||
|
if (alarmCodes == null || alarmCodes.isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("alarmCodes must be provided");
|
||||||
|
}
|
||||||
|
|
||||||
|
LOG.debug("Looking up Alarms for alarmCodes {} createdAfter {}", alarmCodes, createdAfterTimestamp);
|
||||||
|
|
||||||
|
String query = CQL_GET_ALL;
|
||||||
|
|
||||||
|
// add filters for the query
|
||||||
|
ArrayList<Object> queryArgs = new ArrayList<>();
|
||||||
|
|
||||||
|
// add alarmCodes filters
|
||||||
|
alarmCodes.forEach(ac -> queryArgs.add(ac.getId()));
|
||||||
|
|
||||||
|
StringBuilder strb = new StringBuilder(100);
|
||||||
|
strb.append("where alarmCode in (");
|
||||||
|
for (int i = 0; i < alarmCodes.size(); i++) {
|
||||||
|
strb.append("?");
|
||||||
|
if (i < alarmCodes.size() - 1) {
|
||||||
|
strb.append(",");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
strb.append(") ");
|
||||||
|
|
||||||
|
if (createdAfterTimestamp > 0) {
|
||||||
|
strb.append(" and createdTimestamp > ?");
|
||||||
|
queryArgs.add(createdAfterTimestamp);
|
||||||
|
}
|
||||||
|
strb.append(" allow filtering");
|
||||||
|
query += strb.toString();
|
||||||
|
|
||||||
|
List<Alarm> ret = new ArrayList<>();
|
||||||
|
|
||||||
|
PreparedStatement preparedStmt_getListForCustomer = cqlSession.prepare(query);
|
||||||
|
|
||||||
|
ResultSet rs = cqlSession.execute(preparedStmt_getListForCustomer.bind(queryArgs.toArray()));
|
||||||
|
|
||||||
|
rs.forEach(row -> ret.add(alarmRowMapper.mapRow(row)));
|
||||||
|
|
||||||
|
LOG.debug("Found {} Alarms for alarmCodes {} createdAfter {}", ret.size(), alarmCodes, createdAfterTimestamp);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -356,4 +356,25 @@ public class AlarmDatastoreInMemory extends BaseInMemoryDatastore implements Ala
|
|||||||
|
|
||||||
return alarmCounts;
|
return alarmCounts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Alarm> get(Set<AlarmCode> alarmCodeSet, long createdAfterTimestamp) {
|
||||||
|
|
||||||
|
if (alarmCodeSet == null || alarmCodeSet.isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("alarmCodeSet must be provided");
|
||||||
|
}
|
||||||
|
|
||||||
|
List<Alarm> ret = new ArrayList<>();
|
||||||
|
|
||||||
|
idToAlarmMap.values().forEach(a -> {
|
||||||
|
if (alarmCodeSet.contains(a.getAlarmCode()) && a.getCreatedTimestamp() > createdAfterTimestamp) {
|
||||||
|
ret.add(a.clone());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
LOG.debug("Found Alarms {}", ret);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -71,4 +71,14 @@ public interface AlarmDatastore {
|
|||||||
*/
|
*/
|
||||||
AlarmCounts getAlarmCounts(int customerId, Set<Long> equipmentIdSet, Set<AlarmCode> alarmCodeSet, Boolean acknowledged);
|
AlarmCounts getAlarmCounts(int customerId, Set<Long> equipmentIdSet, Set<AlarmCode> alarmCodeSet, Boolean acknowledged);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a list of Alarms for the given alarm codes.
|
||||||
|
*
|
||||||
|
* @param alarmCodeSet - null or empty means include all alarm codes
|
||||||
|
* @param createdAfterTimestamp
|
||||||
|
* @return list of matching Alarm objects.
|
||||||
|
* @throws IllegalArgumentException if supplied alarmCodeSet is null or empty
|
||||||
|
*/
|
||||||
|
List<Alarm> get(Set<AlarmCode> alarmCodeSet, long createdAfterTimestamp);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -48,16 +48,16 @@ public class AlarmCode implements EnumWithId {
|
|||||||
private static final Map<Integer, AlarmCode> ELEMENTS = new ConcurrentHashMap<>();
|
private static final Map<Integer, AlarmCode> ELEMENTS = new ConcurrentHashMap<>();
|
||||||
private static final Map<String, AlarmCode> ELEMENTS_BY_NAME = new ConcurrentHashMap<>();
|
private static final Map<String, AlarmCode> ELEMENTS_BY_NAME = new ConcurrentHashMap<>();
|
||||||
private static final Map<Integer, AlarmCode> VALID_VALUES = new ConcurrentHashMap<>();
|
private static final Map<Integer, AlarmCode> VALID_VALUES = new ConcurrentHashMap<>();
|
||||||
|
private static final Map<Integer, AlarmCode> USER_VISIBLE_VALUES = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
public static final AlarmCode
|
public static final AlarmCode
|
||||||
LimitedCloudConnectivity = new AlarmCode(3, "LimitedCloudConnectivity", "Equipment is connected, however it's not reporting status or metrics", StatusCode.error, "Service AP and verify networking path to cloud"),
|
LimitedCloudConnectivity = new AlarmCode(3, "LimitedCloudConnectivity", "Equipment is connected, however it's not reporting status or metrics", StatusCode.error, "Service AP and verify networking path to cloud"),
|
||||||
AccessPointIsUnreachable = new AlarmCode(4, "AccessPointIsUnreachable", "Equipment is not reachable from cloud", StatusCode.error, "Service AP and verify networking path to cloud"),
|
AccessPointIsUnreachable = new AlarmCode(4, "AccessPointIsUnreachable", "Equipment is not reachable from cloud", StatusCode.error, "Service AP and verify networking path to cloud"),
|
||||||
NoMetricsReceived = new AlarmCode(6, "NoMetricsReceived", "Metrics are not received from the equipment"),
|
NoMetricsReceived = new AlarmCode(6, "NoMetricsReceived", "Metrics are not received from the equipment", true),
|
||||||
NoiseFloor2G = new AlarmCode(7, "NoiseFloor2G", "Noise floor is too high on 2G radio", StatusCode.requiresAttention, "Investigate interference sources"),
|
NoiseFloor2G = new AlarmCode(7, "NoiseFloor2G", "Noise floor is too high on 2G radio", StatusCode.requiresAttention, "Investigate interference sources", true),
|
||||||
ChannelUtilization2G = new AlarmCode(8, "ChannelUtilization2G", "Channel utilization is too high on 2G radio", StatusCode.requiresAttention, "Consider adding more APs"),
|
ChannelUtilization2G = new AlarmCode(8, "ChannelUtilization2G", "Channel utilization is too high on 2G radio", StatusCode.requiresAttention, "Consider adding more APs", true),
|
||||||
NoiseFloor5G = new AlarmCode(9, "NoiseFloor5G", "Noise floor is too high on 5G radio", StatusCode.requiresAttention, "Investigate interference sources"),
|
NoiseFloor5G = new AlarmCode(9, "NoiseFloor5G", "Noise floor is too high on 5G radio", StatusCode.requiresAttention, "Investigate interference sources", true),
|
||||||
ChannelUtilization5G = new AlarmCode(10, "ChannelUtilization5G", "Channel utilization is too high on 5G radio", StatusCode.requiresAttention, "Consider adding more APs"),
|
ChannelUtilization5G = new AlarmCode(10, "ChannelUtilization5G", "Channel utilization is too high on 5G radio", StatusCode.requiresAttention, "Consider adding more APs", true),
|
||||||
DNS = new AlarmCode(11, "DNS", "Issue with Domain Name System (DNS)", StatusCode.error, "Service DNS server and network path"),
|
DNS = new AlarmCode(11, "DNS", "Issue with Domain Name System (DNS)", StatusCode.error, "Service DNS server and network path"),
|
||||||
DNSLatency = new AlarmCode(12, "DNSLatency", "DNS query takes too long", StatusCode.requiresAttention, "Service DNS server and network path"),
|
DNSLatency = new AlarmCode(12, "DNSLatency", "DNS query takes too long", StatusCode.requiresAttention, "Service DNS server and network path"),
|
||||||
DHCP = new AlarmCode(13, "DHCP", "Issue with DHCP", StatusCode.error, "Service DHCP server and network path"),
|
DHCP = new AlarmCode(13, "DHCP", "Issue with DHCP", StatusCode.error, "Service DHCP server and network path"),
|
||||||
@@ -66,10 +66,10 @@ public class AlarmCode implements EnumWithId {
|
|||||||
RadiusLatency = new AlarmCode(16, "RadiusLatency", "RADIUS request takes too long", StatusCode.requiresAttention, "Service RADIUS server and network path"),
|
RadiusLatency = new AlarmCode(16, "RadiusLatency", "RADIUS request takes too long", StatusCode.requiresAttention, "Service RADIUS server and network path"),
|
||||||
CloudLink = new AlarmCode(17, "CloudLink", "Issue reported by equipment with connection with Cloud", StatusCode.error, "Investigate networking path to Cloud"),
|
CloudLink = new AlarmCode(17, "CloudLink", "Issue reported by equipment with connection with Cloud", StatusCode.error, "Investigate networking path to Cloud"),
|
||||||
CloudLinkLatency = new AlarmCode(18, "CloudLinkLatency", "Cloud request take too long", StatusCode.requiresAttention, "Investigate networking path to Cloud"),
|
CloudLinkLatency = new AlarmCode(18, "CloudLinkLatency", "Cloud request take too long", StatusCode.requiresAttention, "Investigate networking path to Cloud"),
|
||||||
CPUUtilization = new AlarmCode(19, "CPUUtilization", "CPU utilization is too high", StatusCode.requiresAttention, "Contact Tech Suport"),
|
CPUUtilization = new AlarmCode(19, "CPUUtilization", "CPU utilization is too high", StatusCode.requiresAttention, "Contact Tech Suport", true),
|
||||||
MemoryUtilization = new AlarmCode(20, "MemoryUtilization", "Memory utilization is too high", StatusCode.requiresAttention, "Contact Tech Suport"),
|
MemoryUtilization = new AlarmCode(20, "MemoryUtilization", "Memory utilization is too high", StatusCode.requiresAttention, "Contact Tech Suport", true),
|
||||||
Disconnected = new AlarmCode(22, "Disconnected", "Equipment is not connected to the cloud", StatusCode.error, "Service AP and verify networking path to cloud"),
|
Disconnected = new AlarmCode(22, "Disconnected", "Equipment is not connected to the cloud", StatusCode.error, "Service AP and verify networking path to cloud", true),
|
||||||
CPUTemperature = new AlarmCode(23, "CPUTemperature", "CPU Temperature is too high", StatusCode.requiresAttention, "Verify AP location"),
|
CPUTemperature = new AlarmCode(23, "CPUTemperature", "CPU Temperature is too high", StatusCode.requiresAttention, "Verify AP location", true),
|
||||||
LowMemoryReboot = new AlarmCode(25, "LowMemoryReboot", "Equipment rebooted due to low memory"),
|
LowMemoryReboot = new AlarmCode(25, "LowMemoryReboot", "Equipment rebooted due to low memory"),
|
||||||
CountryCodeMisMatch = new AlarmCode(26, "CountryCodeMisMatch", "Equipment country code does not match with location", StatusCode.error, "Service AP"),
|
CountryCodeMisMatch = new AlarmCode(26, "CountryCodeMisMatch", "Equipment country code does not match with location", StatusCode.error, "Service AP"),
|
||||||
HardwareIssueDiagnostic = new AlarmCode(29, "HardwareIssueDiagnostic", "Hardware issue encountered on equipment", StatusCode.error, "Reboot AP and contact tech support for RMA"),
|
HardwareIssueDiagnostic = new AlarmCode(29, "HardwareIssueDiagnostic", "Hardware issue encountered on equipment", StatusCode.error, "Reboot AP and contact tech support for RMA"),
|
||||||
@@ -132,16 +132,28 @@ public class AlarmCode implements EnumWithId {
|
|||||||
private final String recommendedAction;
|
private final String recommendedAction;
|
||||||
private final AlarmCategory category;
|
private final AlarmCategory category;
|
||||||
private final boolean propagateFast;
|
private final boolean propagateFast;
|
||||||
|
private final boolean userVisible;
|
||||||
|
|
||||||
protected AlarmCode(int id, String name, String description){
|
protected AlarmCode(int id, String name, String description){
|
||||||
this(id, name, description, StatusCode.error, "", AlarmCategory.CustomerNetworkAffecting, false);
|
this(id, name, description, StatusCode.error, "", AlarmCategory.CustomerNetworkAffecting, false, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected AlarmCode(int id, String name, String description, boolean userVisible){
|
||||||
|
|
||||||
|
this(id, name, description, StatusCode.error, "", AlarmCategory.CustomerNetworkAffecting, false, userVisible);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AlarmCode(int id, String name, String description, StatusCode severity, String recommendedAction){
|
protected AlarmCode(int id, String name, String description, StatusCode severity, String recommendedAction){
|
||||||
this(id, name, description, severity, recommendedAction, AlarmCategory.CustomerNetworkAffecting, false);
|
this(id, name, description, severity, recommendedAction, AlarmCategory.CustomerNetworkAffecting, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected AlarmCode(int id, String name, String description, StatusCode severity, String recommendedAction, AlarmCategory category, boolean propagateFast){
|
protected AlarmCode(int id, String name, String description, StatusCode severity, String recommendedAction, boolean userVisible){
|
||||||
|
this(id, name, description, severity, recommendedAction, AlarmCategory.CustomerNetworkAffecting, false, userVisible);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected AlarmCode(int id, String name, String description, StatusCode severity, String recommendedAction,
|
||||||
|
AlarmCategory category, boolean propagateFast, boolean userVisible){
|
||||||
|
|
||||||
synchronized(lock) {
|
synchronized(lock) {
|
||||||
|
|
||||||
@@ -154,6 +166,7 @@ public class AlarmCode implements EnumWithId {
|
|||||||
this.recommendedAction = recommendedAction;
|
this.recommendedAction = recommendedAction;
|
||||||
this.category = category;
|
this.category = category;
|
||||||
this.propagateFast = propagateFast;
|
this.propagateFast = propagateFast;
|
||||||
|
this.userVisible = userVisible;
|
||||||
|
|
||||||
ELEMENTS_BY_NAME.values().forEach(s -> {
|
ELEMENTS_BY_NAME.values().forEach(s -> {
|
||||||
if(s.getName().equals(name)) {
|
if(s.getName().equals(name)) {
|
||||||
@@ -179,6 +192,9 @@ public class AlarmCode implements EnumWithId {
|
|||||||
|
|
||||||
if (!field.isAnnotationPresent(Deprecated.class)) {
|
if (!field.isAnnotationPresent(Deprecated.class)) {
|
||||||
VALID_VALUES.put(id, this);
|
VALID_VALUES.put(id, this);
|
||||||
|
if (userVisible) {
|
||||||
|
USER_VISIBLE_VALUES.put(id, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -233,6 +249,11 @@ public class AlarmCode implements EnumWithId {
|
|||||||
return propagateFast;
|
return propagateFast;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@JsonIgnore
|
||||||
|
public boolean isUserVisible() {
|
||||||
|
return userVisible;
|
||||||
|
}
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
public String name() {
|
public String name() {
|
||||||
return name;
|
return name;
|
||||||
@@ -270,6 +291,10 @@ public class AlarmCode implements EnumWithId {
|
|||||||
return (UNSUPPORTED.equals(value));
|
return (UNSUPPORTED.equals(value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<AlarmCode> getUserVisibleValues() {
|
||||||
|
return new ArrayList<>(USER_VISIBLE_VALUES.values());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return id;
|
return id;
|
||||||
|
|||||||
@@ -114,4 +114,15 @@ public interface AlarmServiceInterface {
|
|||||||
*/
|
*/
|
||||||
AlarmCounts getAlarmCounts(int customerId, Set<Long> equipmentIdSet, Set<AlarmCode> alarmCodeSet, Boolean acknowledged);
|
AlarmCounts getAlarmCounts(int customerId, Set<Long> equipmentIdSet, Set<AlarmCode> alarmCodeSet, Boolean acknowledged);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retrieves a list of Alarms for the given alarm codes.
|
||||||
|
*
|
||||||
|
* @param alarmCodeSet - null or empty means include all alarm codes
|
||||||
|
* @param createdAfterTimestamp
|
||||||
|
* @return list of matching Alarm objects.
|
||||||
|
* @throws IllegalArgumentException if supplied alarmCodeSet is null or empty
|
||||||
|
*/
|
||||||
|
List<Alarm> get(Set<AlarmCode> alarmCodeSet, long createdAfterTimestamp);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -47,6 +47,10 @@ public class AlarmServiceLocal implements AlarmServiceInterface {
|
|||||||
return alarmController.getAllForEquipment(customerId, equipmentIdSet, alarmCodeSet, createdAfterTimestamp);
|
return alarmController.getAllForEquipment(customerId, equipmentIdSet, alarmCodeSet, createdAfterTimestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Alarm> get(Set<AlarmCode> alarmCodeSet, long createdAfterTimestamp) {
|
||||||
|
return alarmController.getAllForAlarmCode(alarmCodeSet, createdAfterTimestamp);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Alarm update(Alarm alarm) {
|
public Alarm update(Alarm alarm) {
|
||||||
|
|||||||
@@ -64,6 +64,5 @@
|
|||||||
<version>1.2.0-SNAPSHOT</version>
|
<version>1.2.0-SNAPSHOT</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -242,6 +242,38 @@ public class AlarmServiceRemote extends BaseRemoteClient implements AlarmService
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Alarm> get(Set<AlarmCode> alarmCodeSet, long createdAfterTimestamp) {
|
||||||
|
LOG.debug("get({},{})", alarmCodeSet, createdAfterTimestamp);
|
||||||
|
|
||||||
|
if (alarmCodeSet == null || alarmCodeSet.isEmpty()) {
|
||||||
|
throw new IllegalArgumentException("alarmCodeSet must be provided");
|
||||||
|
}
|
||||||
|
|
||||||
|
String alarmCodeSetStr = alarmCodeSet.toString();
|
||||||
|
// remove [] around the string, otherwise will get:
|
||||||
|
// Failed to convert value of type 'java.lang.String' to required
|
||||||
|
// type 'java.util.Set'; nested exception is
|
||||||
|
// java.lang.NumberFormatException: For input string: "[690]"
|
||||||
|
alarmCodeSetStr = alarmCodeSetStr.substring(1, alarmCodeSetStr.length() - 1);
|
||||||
|
|
||||||
|
try {
|
||||||
|
ResponseEntity<List<Alarm>> responseEntity =
|
||||||
|
restTemplate.exchange(getBaseUrl() + "/forAlarmCode?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() {
|
public String getBaseUrl() {
|
||||||
if(baseUrl==null) {
|
if(baseUrl==null) {
|
||||||
baseUrl = environment.getProperty("tip.wlan.alarmServiceBaseUrl").trim()+"/api/alarm";
|
baseUrl = environment.getProperty("tip.wlan.alarmServiceBaseUrl").trim()+"/api/alarm";
|
||||||
@@ -250,5 +282,4 @@ public class AlarmServiceRemote extends BaseRemoteClient implements AlarmService
|
|||||||
return baseUrl;
|
return baseUrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.telecominfraproject.wlan</groupId>
|
<groupId>com.telecominfraproject.wlan</groupId>
|
||||||
@@ -58,13 +60,11 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<artifactId>cloud-event-dispatcher-empty</artifactId>
|
<artifactId>cloud-event-dispatcher-empty</artifactId>
|
||||||
<groupId>com.telecominfraproject.wlan</groupId>
|
<groupId>com.telecominfraproject.wlan</groupId>
|
||||||
<version>1.2.0-SNAPSHOT</version>
|
<version>1.2.0-SNAPSHOT</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -130,6 +130,24 @@ public class AlarmController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/forAlarmCode", method = RequestMethod.GET)
|
||||||
|
public ListOfAlarms getAllForAlarmCode(
|
||||||
|
@RequestParam Set<AlarmCode> alarmCode,
|
||||||
|
@RequestParam long createdAfterTimestamp) {
|
||||||
|
LOG.debug("getAllForAlarmCode({}, {})", alarmCode, createdAfterTimestamp);
|
||||||
|
try {
|
||||||
|
List<Alarm> result = alarmDatastore.get(alarmCode, createdAfterTimestamp);
|
||||||
|
LOG.debug("getAllForAlarmCode({},{}) return {} entries", alarmCode, createdAfterTimestamp, result.size());
|
||||||
|
ListOfAlarms ret = new ListOfAlarms();
|
||||||
|
ret.addAll(result);
|
||||||
|
return ret;
|
||||||
|
} catch (Exception exp) {
|
||||||
|
LOG.error("getAllForAlarmCode({},{}) exception ", alarmCode, createdAfterTimestamp, exp);
|
||||||
|
throw exp;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = "/forCustomer", method = RequestMethod.GET)
|
@RequestMapping(value = "/forCustomer", method = RequestMethod.GET)
|
||||||
public PaginationResponse<Alarm> getForCustomer(@RequestParam int customerId,
|
public PaginationResponse<Alarm> getForCustomer(@RequestParam int customerId,
|
||||||
@RequestParam(required = false) Set<Long> equipmentIdSet,
|
@RequestParam(required = false) Set<Long> equipmentIdSet,
|
||||||
@@ -244,7 +262,7 @@ public class AlarmController {
|
|||||||
public AlarmCounts getAlarmCounts(@RequestParam int customerId,
|
public AlarmCounts getAlarmCounts(@RequestParam int customerId,
|
||||||
@RequestParam Set<Long> equipmentIdSet,
|
@RequestParam Set<Long> equipmentIdSet,
|
||||||
@RequestParam Set<AlarmCode> alarmCodeSet,
|
@RequestParam Set<AlarmCode> alarmCodeSet,
|
||||||
@RequestParam Boolean acknowledged) {
|
@RequestParam(required = false) Boolean acknowledged) {
|
||||||
|
|
||||||
LOG.debug("Getting Alarm counts for {} {} {} {}", customerId, equipmentIdSet, alarmCodeSet, acknowledged);
|
LOG.debug("Getting Alarm counts for {} {} {} {}", customerId, equipmentIdSet, alarmCodeSet, acknowledged);
|
||||||
|
|
||||||
|
|||||||
@@ -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.ClientDhcpDetails;
|
||||||
import com.telecominfraproject.wlan.client.session.models.ClientSession;
|
import com.telecominfraproject.wlan.client.session.models.ClientSession;
|
||||||
import com.telecominfraproject.wlan.client.session.models.ClientSessionDetails;
|
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.CountryCode;
|
||||||
import com.telecominfraproject.wlan.core.model.entity.MinMaxAvgValueInt;
|
import com.telecominfraproject.wlan.core.model.entity.MinMaxAvgValueInt;
|
||||||
import com.telecominfraproject.wlan.core.model.equipment.EquipmentType;
|
import com.telecominfraproject.wlan.core.model.equipment.EquipmentType;
|
||||||
@@ -811,10 +810,10 @@ public class AllInOneWithGatewayStartListener implements ApplicationRunner {
|
|||||||
sessionDetails.setRadioType(radioType);
|
sessionDetails.setRadioType(radioType);
|
||||||
sessionDetails.setSecurityType(SecurityType.PSK);
|
sessionDetails.setSecurityType(SecurityType.PSK);
|
||||||
sessionDetails.setSsid(ssidConfig.getSsid());
|
sessionDetails.setSsid(ssidConfig.getSsid());
|
||||||
sessionDetails.setSessionId(System.currentTimeMillis());
|
sessionDetails.setSessionId(Long.toUnsignedString(System.currentTimeMillis()));
|
||||||
sessionDetails.setAssocTimestamp(System.currentTimeMillis() - getRandomLong(10000, 1000000));
|
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.setLeaseStartTimestamp(System.currentTimeMillis() - getRandomLong(0, TimeUnit.HOURS.toMillis(4)));
|
||||||
dhcpDetails.setLeaseTimeInSeconds((int)TimeUnit.HOURS.toSeconds(4));
|
dhcpDetails.setLeaseTimeInSeconds((int)TimeUnit.HOURS.toSeconds(4));
|
||||||
try {
|
try {
|
||||||
@@ -829,16 +828,6 @@ public class AllInOneWithGatewayStartListener implements ApplicationRunner {
|
|||||||
|
|
||||||
sessionDetails.setDhcpDetails(dhcpDetails );
|
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);
|
clientSession.setDetails(sessionDetails);
|
||||||
|
|
||||||
this.clientServiceInterface.updateSession(clientSession);
|
this.clientServiceInterface.updateSession(clientSession);
|
||||||
|
|||||||
@@ -38,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.ClientDhcpDetails;
|
||||||
import com.telecominfraproject.wlan.client.session.models.ClientSession;
|
import com.telecominfraproject.wlan.client.session.models.ClientSession;
|
||||||
import com.telecominfraproject.wlan.client.session.models.ClientSessionDetails;
|
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.CountryCode;
|
||||||
import com.telecominfraproject.wlan.core.model.entity.MinMaxAvgValueInt;
|
import com.telecominfraproject.wlan.core.model.entity.MinMaxAvgValueInt;
|
||||||
import com.telecominfraproject.wlan.core.model.equipment.EquipmentType;
|
import com.telecominfraproject.wlan.core.model.equipment.EquipmentType;
|
||||||
@@ -635,7 +634,7 @@ public class AllInOneStartListener implements ApplicationRunner {
|
|||||||
((PasspointProfile) passpointHotspotConfig.getDetails()).setPasspointVenueProfileId(passpointVenueProfileId);
|
((PasspointProfile) passpointHotspotConfig.getDetails()).setPasspointVenueProfileId(passpointVenueProfileId);
|
||||||
((PasspointProfile) passpointHotspotConfig.getDetails()).setOsuSsidProfileId(profileSsidOpenId);
|
((PasspointProfile) passpointHotspotConfig.getDetails()).setOsuSsidProfileId(profileSsidOpenId);
|
||||||
((PasspointProfile) passpointHotspotConfig.getDetails())
|
((PasspointProfile) passpointHotspotConfig.getDetails())
|
||||||
.setAssociatedAccessSsidProfileIds(List.of(profileSsidPskId));
|
.setAssociatedAccessSsidProfileIds(Set.of(profileSsidPskId));
|
||||||
|
|
||||||
return profileServiceInterface.create(passpointHotspotConfig);
|
return profileServiceInterface.create(passpointHotspotConfig);
|
||||||
}
|
}
|
||||||
@@ -1238,8 +1237,6 @@ public class AllInOneStartListener implements ApplicationRunner {
|
|||||||
clientMetrics.setNumRxBytes(getRandomLong(3000000, 7000000));
|
clientMetrics.setNumRxBytes(getRandomLong(3000000, 7000000));
|
||||||
clientMetrics.setNumTxBytes(getRandomLong(3000000, 7000000));
|
clientMetrics.setNumTxBytes(getRandomLong(3000000, 7000000));
|
||||||
|
|
||||||
clientMetrics.setSessionId(getRandomLong(3000000, 7000000));
|
|
||||||
|
|
||||||
clientMetrics.setTxRetries(getRandomInt(30, 70));
|
clientMetrics.setTxRetries(getRandomInt(30, 70));
|
||||||
clientMetrics.setRxDuplicatePackets(getRandomInt(30, 70));
|
clientMetrics.setRxDuplicatePackets(getRandomInt(30, 70));
|
||||||
clientMetrics.setSnr(getRandomInt(-70, -30));
|
clientMetrics.setSnr(getRandomInt(-70, -30));
|
||||||
@@ -1265,8 +1262,6 @@ public class AllInOneStartListener implements ApplicationRunner {
|
|||||||
clientMetrics.setNumRxBytes(getRandomLong(3000000, 7000000));
|
clientMetrics.setNumRxBytes(getRandomLong(3000000, 7000000));
|
||||||
clientMetrics.setNumTxBytes(getRandomLong(3000000, 7000000));
|
clientMetrics.setNumTxBytes(getRandomLong(3000000, 7000000));
|
||||||
|
|
||||||
clientMetrics.setSessionId(getRandomLong(3000000, 7000000));
|
|
||||||
|
|
||||||
clientMetrics.setTxRetries(getRandomInt(30, 70));
|
clientMetrics.setTxRetries(getRandomInt(30, 70));
|
||||||
clientMetrics.setRxDuplicatePackets(getRandomInt(30, 70));
|
clientMetrics.setRxDuplicatePackets(getRandomInt(30, 70));
|
||||||
clientMetrics.setSnr(getRandomInt(-70, -30));
|
clientMetrics.setSnr(getRandomInt(-70, -30));
|
||||||
@@ -1292,8 +1287,6 @@ public class AllInOneStartListener implements ApplicationRunner {
|
|||||||
clientMetrics.setNumRxBytes(getRandomLong(3000000, 7000000));
|
clientMetrics.setNumRxBytes(getRandomLong(3000000, 7000000));
|
||||||
clientMetrics.setNumTxBytes(getRandomLong(3000000, 7000000));
|
clientMetrics.setNumTxBytes(getRandomLong(3000000, 7000000));
|
||||||
|
|
||||||
clientMetrics.setSessionId(getRandomLong(3000000, 7000000));
|
|
||||||
|
|
||||||
clientMetrics.setTxRetries(getRandomInt(30, 70));
|
clientMetrics.setTxRetries(getRandomInt(30, 70));
|
||||||
clientMetrics.setRxDuplicatePackets(getRandomInt(30, 70));
|
clientMetrics.setRxDuplicatePackets(getRandomInt(30, 70));
|
||||||
clientMetrics.setSnr(getRandomInt(-70, -30));
|
clientMetrics.setSnr(getRandomInt(-70, -30));
|
||||||
@@ -1361,10 +1354,10 @@ public class AllInOneStartListener implements ApplicationRunner {
|
|||||||
sessionDetails.setRadioType(radioType);
|
sessionDetails.setRadioType(radioType);
|
||||||
sessionDetails.setSecurityType(SecurityType.PSK);
|
sessionDetails.setSecurityType(SecurityType.PSK);
|
||||||
sessionDetails.setSsid(ssidConfig.getSsid());
|
sessionDetails.setSsid(ssidConfig.getSsid());
|
||||||
sessionDetails.setSessionId(System.currentTimeMillis());
|
sessionDetails.setSessionId(Long.toUnsignedString(System.currentTimeMillis()));
|
||||||
sessionDetails.setAssocTimestamp(System.currentTimeMillis() - getRandomLong(10000, 1000000));
|
sessionDetails.setAssocTimestamp(System.currentTimeMillis() - getRandomLong(10000, 1000000));
|
||||||
|
|
||||||
ClientDhcpDetails dhcpDetails = new ClientDhcpDetails(System.currentTimeMillis());
|
ClientDhcpDetails dhcpDetails = new ClientDhcpDetails(Long.toUnsignedString(System.currentTimeMillis()));
|
||||||
dhcpDetails
|
dhcpDetails
|
||||||
.setLeaseStartTimestamp(System.currentTimeMillis() - getRandomLong(0, TimeUnit.HOURS.toMillis(4)));
|
.setLeaseStartTimestamp(System.currentTimeMillis() - getRandomLong(0, TimeUnit.HOURS.toMillis(4)));
|
||||||
dhcpDetails.setLeaseTimeInSeconds((int) TimeUnit.HOURS.toSeconds(4));
|
dhcpDetails.setLeaseTimeInSeconds((int) TimeUnit.HOURS.toSeconds(4));
|
||||||
@@ -1380,16 +1373,6 @@ public class AllInOneStartListener implements ApplicationRunner {
|
|||||||
|
|
||||||
sessionDetails.setDhcpDetails(dhcpDetails);
|
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);
|
clientSession.setDetails(sessionDetails);
|
||||||
|
|
||||||
this.clientServiceInterface.updateSession(clientSession);
|
this.clientServiceInterface.updateSession(clientSession);
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ import com.telecominfraproject.wlan.systemevent.equipment.realtime.RealTimeEvent
|
|||||||
public class ClientAssocEvent extends RealTimeEvent implements HasClientMac {
|
public class ClientAssocEvent extends RealTimeEvent implements HasClientMac {
|
||||||
private static final long serialVersionUID = 7015822981315570338L;
|
private static final long serialVersionUID = 7015822981315570338L;
|
||||||
|
|
||||||
private long sessionId;
|
private String sessionId;
|
||||||
private String ssid;
|
private String ssid;
|
||||||
private MacAddress clientMacAddress;
|
private MacAddress clientMacAddress;
|
||||||
private RadioType radioType;
|
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,
|
MacAddress clientMacAddress, RadioType radioType, boolean isReassociation, WlanStatusCode status,
|
||||||
Integer internalSC, Integer rssi) {
|
Integer internalSC, Integer rssi) {
|
||||||
super(RealTimeEventType.STA_Client_Assoc, customerId, locationId, equipmentId, timestamp);
|
super(RealTimeEventType.STA_Client_Assoc, customerId, locationId, equipmentId, timestamp);
|
||||||
@@ -50,7 +50,7 @@ public class ClientAssocEvent extends RealTimeEvent implements HasClientMac {
|
|||||||
/**
|
/**
|
||||||
* @return the sessionId
|
* @return the sessionId
|
||||||
*/
|
*/
|
||||||
public long getSessionId() {
|
public String getSessionId() {
|
||||||
return sessionId;
|
return sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ public class ClientAssocEvent extends RealTimeEvent implements HasClientMac {
|
|||||||
* @param sessionId
|
* @param sessionId
|
||||||
* the sessionId to set
|
* the sessionId to set
|
||||||
*/
|
*/
|
||||||
public void setSessionId(long sessionId) {
|
public void setSessionId(String sessionId) {
|
||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ public class ClientAuthEvent extends RealTimeEvent implements HasClientMac {
|
|||||||
|
|
||||||
private static final long serialVersionUID = 1221389696911864515L;
|
private static final long serialVersionUID = 1221389696911864515L;
|
||||||
|
|
||||||
private long sessionId;
|
private String sessionId;
|
||||||
private String ssid;
|
private String ssid;
|
||||||
private MacAddress clientMacAddress;
|
private MacAddress clientMacAddress;
|
||||||
private WlanStatusCode authStatus;
|
private WlanStatusCode authStatus;
|
||||||
@@ -32,11 +32,11 @@ public class ClientAuthEvent extends RealTimeEvent implements HasClientMac {
|
|||||||
super(eventType, timestamp);
|
super(eventType, timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getSessionId() {
|
public String getSessionId() {
|
||||||
return sessionId;
|
return sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSessionId(long sessionId) {
|
public void setSessionId(String sessionId) {
|
||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ public class ClientConnectSuccessEvent extends RealTimeEvent implements HasClien
|
|||||||
|
|
||||||
private static final long serialVersionUID = -6082134146801575193L;
|
private static final long serialVersionUID = -6082134146801575193L;
|
||||||
private MacAddress clientMacAddress;
|
private MacAddress clientMacAddress;
|
||||||
private long sessionId;
|
private String sessionId;
|
||||||
private RadioType radioType;
|
private RadioType radioType;
|
||||||
private boolean isReassociation;
|
private boolean isReassociation;
|
||||||
private String ssid;
|
private String ssid;
|
||||||
@@ -61,7 +61,7 @@ public class ClientConnectSuccessEvent extends RealTimeEvent implements HasClien
|
|||||||
/**
|
/**
|
||||||
* @return the sessionId
|
* @return the sessionId
|
||||||
*/
|
*/
|
||||||
public long getSessionId() {
|
public String getSessionId() {
|
||||||
return sessionId;
|
return sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -69,7 +69,7 @@ public class ClientConnectSuccessEvent extends RealTimeEvent implements HasClien
|
|||||||
* @param sessionId
|
* @param sessionId
|
||||||
* the sessionId to set
|
* the sessionId to set
|
||||||
*/
|
*/
|
||||||
public void setSessionId(long sessionId) {
|
public void setSessionId(String sessionId) {
|
||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,7 @@ public class ClientDisconnectEvent extends RealTimeEvent implements HasClientMac
|
|||||||
}
|
}
|
||||||
|
|
||||||
private static final long serialVersionUID = -7674230178565760938L;
|
private static final long serialVersionUID = -7674230178565760938L;
|
||||||
private long sessionId;
|
private String sessionId;
|
||||||
private byte[] macAddressBytes;
|
private byte[] macAddressBytes;
|
||||||
private MacAddress clientMacAddress;
|
private MacAddress clientMacAddress;
|
||||||
private long lastRecvTime;
|
private long lastRecvTime;
|
||||||
@@ -104,7 +104,7 @@ public class ClientDisconnectEvent extends RealTimeEvent implements HasClientMac
|
|||||||
return rssi;
|
return rssi;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getSessionId() {
|
public String getSessionId() {
|
||||||
return sessionId;
|
return sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -148,7 +148,7 @@ public class ClientDisconnectEvent extends RealTimeEvent implements HasClientMac
|
|||||||
this.rssi = rssi;
|
this.rssi = rssi;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSessionId(long sessionId) {
|
public void setSessionId(String sessionId) {
|
||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ import com.telecominfraproject.wlan.systemevent.equipment.realtime.RealTimeEvent
|
|||||||
public class ClientFailureEvent extends RealTimeEvent implements HasClientMac {
|
public class ClientFailureEvent extends RealTimeEvent implements HasClientMac {
|
||||||
private static final long serialVersionUID = -16021752050335131L;
|
private static final long serialVersionUID = -16021752050335131L;
|
||||||
|
|
||||||
private long sessionId;
|
private String sessionId;
|
||||||
private String ssid;
|
private String ssid;
|
||||||
private MacAddress clientMacAddress;
|
private MacAddress clientMacAddress;
|
||||||
private WlanReasonCode reasonCode;
|
private WlanReasonCode reasonCode;
|
||||||
@@ -38,11 +38,11 @@ public class ClientFailureEvent extends RealTimeEvent implements HasClientMac {
|
|||||||
this.clientMacAddress = clientMacAddress;
|
this.clientMacAddress = clientMacAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getSessionId() {
|
public String getSessionId() {
|
||||||
return sessionId;
|
return sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSessionId(long sessionId) {
|
public void setSessionId(String sessionId) {
|
||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ import com.telecominfraproject.wlan.systemevent.equipment.realtime.RealTimeEvent
|
|||||||
public class ClientFirstDataEvent extends RealTimeEvent implements HasClientMac {
|
public class ClientFirstDataEvent extends RealTimeEvent implements HasClientMac {
|
||||||
|
|
||||||
private static final long serialVersionUID = 298223061973506469L;
|
private static final long serialVersionUID = 298223061973506469L;
|
||||||
private long sessionId;
|
private String sessionId;
|
||||||
private MacAddress clientMacAddress;
|
private MacAddress clientMacAddress;
|
||||||
private long firstDataRcvdTs;
|
private long firstDataRcvdTs;
|
||||||
private long firstDataSentTs;
|
private long firstDataSentTs;
|
||||||
@@ -28,11 +28,11 @@ public class ClientFirstDataEvent extends RealTimeEvent implements HasClientMac
|
|||||||
super(eventType, timestamp);
|
super(eventType, timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getSessionId() {
|
public String getSessionId() {
|
||||||
return sessionId;
|
return sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSessionId(long sessionId) {
|
public void setSessionId(String sessionId) {
|
||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.telecominfraproject.wlan.client.models.events.realtime;
|
package com.telecominfraproject.wlan.client.models.events.realtime;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
|
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
|
||||||
import com.telecominfraproject.wlan.core.model.json.interfaces.HasClientMac;
|
import com.telecominfraproject.wlan.core.model.json.interfaces.HasClientMac;
|
||||||
@@ -10,7 +11,7 @@ import com.telecominfraproject.wlan.systemevent.equipment.realtime.RealTimeEvent
|
|||||||
public class ClientIdEvent extends RealTimeEvent implements HasClientMac {
|
public class ClientIdEvent extends RealTimeEvent implements HasClientMac {
|
||||||
|
|
||||||
private static final long serialVersionUID = 298223061973506469L;
|
private static final long serialVersionUID = 298223061973506469L;
|
||||||
private long sessionId;
|
private String sessionId;
|
||||||
private byte[] macAddressBytes;
|
private byte[] macAddressBytes;
|
||||||
private MacAddress clientMacAddress;
|
private MacAddress clientMacAddress;
|
||||||
private String userId;
|
private String userId;
|
||||||
@@ -27,7 +28,7 @@ public class ClientIdEvent extends RealTimeEvent implements HasClientMac {
|
|||||||
/**
|
/**
|
||||||
* @return the sessionId
|
* @return the sessionId
|
||||||
*/
|
*/
|
||||||
public long getSessionId() {
|
public String getSessionId() {
|
||||||
return sessionId;
|
return sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -35,7 +36,7 @@ public class ClientIdEvent extends RealTimeEvent implements HasClientMac {
|
|||||||
* @param sessionId
|
* @param sessionId
|
||||||
* the sessionId to set
|
* the sessionId to set
|
||||||
*/
|
*/
|
||||||
public void setSessionId(long sessionId) {
|
public void setSessionId(String sessionId) {
|
||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -65,58 +66,28 @@ public class ClientIdEvent extends RealTimeEvent implements HasClientMac {
|
|||||||
this.userId = userId;
|
this.userId = userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see java.lang.Object#hashCode()
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = 1;
|
int result = super.hashCode();
|
||||||
result = prime * result + Arrays.hashCode(macAddressBytes);
|
result = prime * result + Arrays.hashCode(macAddressBytes);
|
||||||
result = prime * result + (int) (sessionId ^ (sessionId >>> 32));
|
result = prime * result + Objects.hash(clientMacAddress, sessionId, userId);
|
||||||
result = prime * result + ((userId == null) ? 0 : userId.hashCode());
|
|
||||||
result = prime * result + ((clientMacAddress == null) ? 0 : clientMacAddress.hashCode());
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* (non-Javadoc)
|
|
||||||
*
|
|
||||||
* @see java.lang.Object#equals(java.lang.Object)
|
|
||||||
*/
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj)
|
||||||
return true;
|
return true;
|
||||||
}
|
if (!super.equals(obj))
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
if (getClass() != obj.getClass())
|
||||||
if (!super.equals(obj)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
if (!(obj instanceof ClientIdEvent)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
ClientIdEvent other = (ClientIdEvent) obj;
|
ClientIdEvent other = (ClientIdEvent) obj;
|
||||||
if (!Arrays.equals(macAddressBytes, other.macAddressBytes))
|
return Objects.equals(clientMacAddress, other.clientMacAddress) && Arrays.equals(macAddressBytes, other.macAddressBytes)
|
||||||
return false;
|
&& Objects.equals(sessionId, other.sessionId) && Objects.equals(userId, other.userId);
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.telecominfraproject.wlan.client.models.events.realtime;
|
package com.telecominfraproject.wlan.client.models.events.realtime;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.net.InetAddress;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
|
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
|
||||||
@@ -12,9 +12,9 @@ public class ClientIpAddressEvent extends RealTimeEvent implements HasClientMac
|
|||||||
|
|
||||||
private static final long serialVersionUID = -5332534925768685589L;
|
private static final long serialVersionUID = -5332534925768685589L;
|
||||||
|
|
||||||
private long sessionId;
|
private String sessionId;
|
||||||
private MacAddress clientMacAddress;
|
private MacAddress clientMacAddress;
|
||||||
private byte[] ipAddr;
|
private InetAddress ipAddr;
|
||||||
|
|
||||||
public ClientIpAddressEvent() {
|
public ClientIpAddressEvent() {
|
||||||
// serialization
|
// serialization
|
||||||
@@ -29,11 +29,11 @@ public class ClientIpAddressEvent extends RealTimeEvent implements HasClientMac
|
|||||||
super(eventType, timestamp);
|
super(eventType, timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getSessionId() {
|
public String getSessionId() {
|
||||||
return sessionId;
|
return sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSessionId(long sessionId) {
|
public void setSessionId(String sessionId) {
|
||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -45,11 +45,11 @@ public class ClientIpAddressEvent extends RealTimeEvent implements HasClientMac
|
|||||||
this.clientMacAddress = clientMacAddress;
|
this.clientMacAddress = clientMacAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte[] getIpAddr() {
|
public InetAddress getIpAddr() {
|
||||||
return ipAddr;
|
return ipAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setIpAddr(byte[] ipAddr) {
|
public void setIpAddr(InetAddress ipAddr) {
|
||||||
this.ipAddr = ipAddr;
|
this.ipAddr = ipAddr;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -57,8 +57,7 @@ public class ClientIpAddressEvent extends RealTimeEvent implements HasClientMac
|
|||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = super.hashCode();
|
int result = super.hashCode();
|
||||||
result = prime * result + Arrays.hashCode(this.ipAddr);
|
result = prime * result + Objects.hash(ipAddr, clientMacAddress, sessionId);
|
||||||
result = prime * result + Objects.hash(clientMacAddress, sessionId);
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -74,7 +73,7 @@ public class ClientIpAddressEvent extends RealTimeEvent implements HasClientMac
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
ClientIpAddressEvent other = (ClientIpAddressEvent) obj;
|
ClientIpAddressEvent other = (ClientIpAddressEvent) obj;
|
||||||
return Objects.equals(clientMacAddress, other.clientMacAddress) && Arrays.equals(ipAddr, other.ipAddr)
|
return Objects.equals(clientMacAddress, other.clientMacAddress) && Objects.equals(ipAddr, other.ipAddr)
|
||||||
&& this.sessionId == other.sessionId;
|
&& this.sessionId == other.sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ public class ClientTimeoutEvent extends RealTimeEvent implements HasClientMac {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private long sessionId;
|
private String sessionId;
|
||||||
private MacAddress clientMacAddress;
|
private MacAddress clientMacAddress;
|
||||||
private long lastRecvTime;
|
private long lastRecvTime;
|
||||||
private long lastSentTime;
|
private long lastSentTime;
|
||||||
@@ -45,11 +45,11 @@ public class ClientTimeoutEvent extends RealTimeEvent implements HasClientMac {
|
|||||||
super(eventType, timestamp);
|
super(eventType, timestamp);
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getSessionId() {
|
public String getSessionId() {
|
||||||
return sessionId;
|
return sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSessionId(long sessionId) {
|
public void setSessionId(String sessionId) {
|
||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.telecominfraproject.wlan.client.session.models;
|
package com.telecominfraproject.wlan.client.session.models;
|
||||||
|
|
||||||
import java.net.InetAddress;
|
import java.net.InetAddress;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
import com.telecominfraproject.wlan.core.model.equipment.WiFiSessionUtility;
|
import com.telecominfraproject.wlan.core.model.equipment.WiFiSessionUtility;
|
||||||
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
|
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
|
||||||
@@ -29,10 +30,9 @@ public class ClientDhcpDetails extends BaseJsonModel {
|
|||||||
/**
|
/**
|
||||||
* Identifies the association where DHCP last occurred.
|
* Identifies the association where DHCP last occurred.
|
||||||
*/
|
*/
|
||||||
private long associationId;
|
private String associationId;
|
||||||
|
|
||||||
|
public ClientDhcpDetails(String sessionId) {
|
||||||
public ClientDhcpDetails(long sessionId) {
|
|
||||||
this.associationId = sessionId;
|
this.associationId = sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -101,10 +101,10 @@ public class ClientDhcpDetails extends BaseJsonModel {
|
|||||||
this.firstDiscoverTimestamp = firstDiscoverTimestamp;
|
this.firstDiscoverTimestamp = firstDiscoverTimestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long getAssociationId() {
|
public String getAssociationId() {
|
||||||
return associationId;
|
return associationId;
|
||||||
}
|
}
|
||||||
public void setAssociationId(Long associationId) {
|
public void setAssociationId(String associationId) {
|
||||||
this.associationId = associationId;
|
this.associationId = associationId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -116,123 +116,6 @@ public class ClientDhcpDetails extends BaseJsonModel {
|
|||||||
this.nakTimestamp = nakTimestamp;
|
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
|
@Override
|
||||||
public ClientDhcpDetails clone() {
|
public ClientDhcpDetails clone() {
|
||||||
ClientDhcpDetails ret = (ClientDhcpDetails) super.clone();
|
ClientDhcpDetails ret = (ClientDhcpDetails) super.clone();
|
||||||
@@ -241,8 +124,7 @@ public class ClientDhcpDetails extends BaseJsonModel {
|
|||||||
|
|
||||||
public void mergeDetails(ClientDhcpDetails other) {
|
public void mergeDetails(ClientDhcpDetails other) {
|
||||||
if(other == null) return;
|
if(other == null) return;
|
||||||
|
if(WiFiSessionUtility.decodeWiFiAssociationId(Long.parseUnsignedLong(other.associationId))>WiFiSessionUtility.decodeWiFiAssociationId(Long.parseUnsignedLong(associationId))) {
|
||||||
if(WiFiSessionUtility.decodeWiFiAssociationId(other.associationId)>WiFiSessionUtility.decodeWiFiAssociationId(associationId)) {
|
|
||||||
// The other dhcp details are from a newer session and so everything must be reset.
|
// The other dhcp details are from a newer session and so everything must be reset.
|
||||||
this.dhcpServerIp = null;
|
this.dhcpServerIp = null;
|
||||||
this.firstDiscoverTimestamp = null;
|
this.firstDiscoverTimestamp = null;
|
||||||
@@ -258,8 +140,7 @@ public class ClientDhcpDetails extends BaseJsonModel {
|
|||||||
this.associationId = other.associationId;
|
this.associationId = other.associationId;
|
||||||
this.fromInternal = false;
|
this.fromInternal = false;
|
||||||
}
|
}
|
||||||
else if(other.associationId != associationId) {
|
if(!Objects.equals(this.associationId, other.associationId)) {
|
||||||
// other is older, ignore it
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dhcpServerIp = (InetAddress) assignOtherIfOtherNotNull(dhcpServerIp, other.dhcpServerIp);
|
dhcpServerIp = (InetAddress) assignOtherIfOtherNotNull(dhcpServerIp, other.dhcpServerIp);
|
||||||
@@ -305,4 +186,28 @@ public class ClientDhcpDetails extends BaseJsonModel {
|
|||||||
this.fromInternal = fromInternal;
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import java.util.Objects;
|
|||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
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.core.model.equipment.RadioType;
|
||||||
import com.telecominfraproject.wlan.core.model.equipment.SecurityType;
|
import com.telecominfraproject.wlan.core.model.equipment.SecurityType;
|
||||||
import com.telecominfraproject.wlan.core.model.equipment.SteerType;
|
import com.telecominfraproject.wlan.core.model.equipment.SteerType;
|
||||||
@@ -19,7 +20,7 @@ public class ClientSessionDetails extends BaseJsonModel {
|
|||||||
|
|
||||||
private static final long serialVersionUID = -7714023056859882994L;
|
private static final long serialVersionUID = -7714023056859882994L;
|
||||||
|
|
||||||
private long sessionId;
|
private String sessionId;
|
||||||
private Long authTimestamp;
|
private Long authTimestamp;
|
||||||
private Long assocTimestamp;
|
private Long assocTimestamp;
|
||||||
private Integer assocInternalSC;
|
private Integer assocInternalSC;
|
||||||
@@ -32,6 +33,7 @@ public class ClientSessionDetails extends BaseJsonModel {
|
|||||||
private InetAddress ipAddress;
|
private InetAddress ipAddress;
|
||||||
private String radiusUsername;
|
private String radiusUsername;
|
||||||
private String ssid;
|
private String ssid;
|
||||||
|
private MacAddress bssid;
|
||||||
private RadioType radioType;
|
private RadioType radioType;
|
||||||
private Long lastEventTimestamp;
|
private Long lastEventTimestamp;
|
||||||
private String hostname;
|
private String hostname;
|
||||||
@@ -42,7 +44,6 @@ public class ClientSessionDetails extends BaseJsonModel {
|
|||||||
private String cpUsername;
|
private String cpUsername;
|
||||||
private ClientDhcpDetails dhcpDetails;
|
private ClientDhcpDetails dhcpDetails;
|
||||||
private ClientEapDetails eapDetails;
|
private ClientEapDetails eapDetails;
|
||||||
private ClientSessionMetricDetails metricDetails;
|
|
||||||
private Boolean isReassociation;
|
private Boolean isReassociation;
|
||||||
private Integer disconnectByApReasonCode;
|
private Integer disconnectByApReasonCode;
|
||||||
private Integer disconnectByClientReasonCode;
|
private Integer disconnectByClientReasonCode;
|
||||||
@@ -54,22 +55,22 @@ public class ClientSessionDetails extends BaseJsonModel {
|
|||||||
private Boolean is11VUsed;
|
private Boolean is11VUsed;
|
||||||
private SecurityType securityType;
|
private SecurityType securityType;
|
||||||
private SteerType steerType;
|
private SteerType steerType;
|
||||||
private Long previousValidSessionId;
|
private String previousValidSessionId;
|
||||||
private ClientFailureDetails lastFailureDetails;
|
private ClientFailureDetails lastFailureDetails;
|
||||||
private ClientFailureDetails firstFailureDetails;
|
private ClientFailureDetails firstFailureDetails;
|
||||||
private Integer associationStatus;
|
private Integer associationStatus;
|
||||||
private Integer dynamicVlan;
|
private Integer dynamicVlan;
|
||||||
private Integer assocRssi;
|
private Integer assocRssi;
|
||||||
private Long priorSessionId;
|
private String priorSessionId;
|
||||||
private Long priorEquipmentId;
|
private Long priorEquipmentId;
|
||||||
private String classificationName;
|
private String classificationName;
|
||||||
private AssociationState associationState;
|
private AssociationState associationState;
|
||||||
|
|
||||||
public long getSessionId() {
|
public String getSessionId() {
|
||||||
return sessionId;
|
return sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSessionId(long sessionId) {
|
public void setSessionId(String sessionId) {
|
||||||
this.sessionId = sessionId;
|
this.sessionId = sessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,12 +155,6 @@ public class ClientSessionDetails extends BaseJsonModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Long getLastEventTimestamp() {
|
public Long getLastEventTimestamp() {
|
||||||
if (getMetricDetails() != null) {
|
|
||||||
if (lastEventTimestamp != null) {
|
|
||||||
return Math.max(getMetricDetails().getLastMetricTimestamp(), lastEventTimestamp);
|
|
||||||
}
|
|
||||||
return getMetricDetails().getLastMetricTimestamp();
|
|
||||||
}
|
|
||||||
return lastEventTimestamp;
|
return lastEventTimestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -192,27 +187,16 @@ public class ClientSessionDetails extends BaseJsonModel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Long getLastRxTimestamp() {
|
public Long getLastRxTimestamp() {
|
||||||
if (lastRxTimestamp != null && getMetricDetails() != null && getMetricDetails().getLastRxTimestamp() != null) {
|
|
||||||
return Math.max(lastRxTimestamp, getMetricDetails().getLastRxTimestamp());
|
|
||||||
} else if (lastRxTimestamp != null) {
|
|
||||||
return lastRxTimestamp;
|
return lastRxTimestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return getMetricDetails() == null ? null : getMetricDetails().getLastRxTimestamp();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLastRxTimestamp(Long lastRxTimestamp) {
|
public void setLastRxTimestamp(Long lastRxTimestamp) {
|
||||||
this.lastRxTimestamp = lastRxTimestamp;
|
this.lastRxTimestamp = lastRxTimestamp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getLastTxTimestamp() {
|
public Long getLastTxTimestamp() {
|
||||||
if (lastTxTimestamp != null && getMetricDetails() != null && getMetricDetails().getLastTxTimestamp() != null) {
|
|
||||||
return Math.max(lastTxTimestamp, getMetricDetails().getLastTxTimestamp());
|
|
||||||
} else if (lastTxTimestamp != null) {
|
|
||||||
return lastTxTimestamp;
|
return lastTxTimestamp;
|
||||||
}
|
}
|
||||||
return getMetricDetails() == null ? null : getMetricDetails().getLastTxTimestamp();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLastTxTimestamp(Long lastTxTimestamp) {
|
public void setLastTxTimestamp(Long lastTxTimestamp) {
|
||||||
this.lastTxTimestamp = lastTxTimestamp;
|
this.lastTxTimestamp = lastTxTimestamp;
|
||||||
@@ -257,14 +241,6 @@ public class ClientSessionDetails extends BaseJsonModel {
|
|||||||
this.eapDetails = eapDetails;
|
this.eapDetails = eapDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
public ClientSessionMetricDetails getMetricDetails() {
|
|
||||||
return metricDetails;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMetricDetails(ClientSessionMetricDetails metricDetails) {
|
|
||||||
this.metricDetails = metricDetails;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RADIUS 802.1x EAP_Success timestamp
|
* RADIUS 802.1x EAP_Success timestamp
|
||||||
*
|
*
|
||||||
@@ -413,11 +389,11 @@ public class ClientSessionDetails extends BaseJsonModel {
|
|||||||
this.steerType = steerType;
|
this.steerType = steerType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getPreviousValidSessionId() {
|
public String getPreviousValidSessionId() {
|
||||||
return previousValidSessionId;
|
return previousValidSessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPreviousValidSessionId(Long previousValidSessionId) {
|
public void setPreviousValidSessionId(String previousValidSessionId) {
|
||||||
this.previousValidSessionId = previousValidSessionId;
|
this.previousValidSessionId = previousValidSessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -437,6 +413,14 @@ public class ClientSessionDetails extends BaseJsonModel {
|
|||||||
this.firstFailureDetails = firstFailureDetails;
|
this.firstFailureDetails = firstFailureDetails;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MacAddress getBssid() {
|
||||||
|
return bssid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBssid(MacAddress bssid) {
|
||||||
|
this.bssid = bssid;
|
||||||
|
}
|
||||||
|
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
public boolean isTerminated() {
|
public boolean isTerminated() {
|
||||||
return this.getDisconnectTimestamp() != null || this.timeoutTimestamp != null;
|
return this.getDisconnectTimestamp() != null || this.timeoutTimestamp != null;
|
||||||
@@ -514,9 +498,7 @@ public class ClientSessionDetails extends BaseJsonModel {
|
|||||||
return AssociationState.Cloud_Timeout;
|
return AssociationState.Cloud_Timeout;
|
||||||
|
|
||||||
}
|
}
|
||||||
if (firstDataRcvdTimestamp != null || firstDataSentTimestamp != null
|
if (firstDataRcvdTimestamp != null || firstDataSentTimestamp != null) {
|
||||||
|| (getMetricDetails() != null && (getMetricDetails().getLastRxTimestamp() != null
|
|
||||||
|| getMetricDetails().getLastTxTimestamp() != null))) {
|
|
||||||
return AssociationState.Active_Data;
|
return AssociationState.Active_Data;
|
||||||
}
|
}
|
||||||
if (assocTimestamp != null) {
|
if (assocTimestamp != null) {
|
||||||
@@ -535,9 +517,6 @@ public class ClientSessionDetails extends BaseJsonModel {
|
|||||||
if (this.eapDetails != null) {
|
if (this.eapDetails != null) {
|
||||||
ret.setEapDetails(this.eapDetails.clone());
|
ret.setEapDetails(this.eapDetails.clone());
|
||||||
}
|
}
|
||||||
if (this.metricDetails != null) {
|
|
||||||
ret.setMetricDetails(this.metricDetails.clone());
|
|
||||||
}
|
|
||||||
if (this.lastFailureDetails != null) {
|
if (this.lastFailureDetails != null) {
|
||||||
ret.setLastFailureDetails(this.lastFailureDetails.clone());
|
ret.setLastFailureDetails(this.lastFailureDetails.clone());
|
||||||
}
|
}
|
||||||
@@ -554,10 +533,10 @@ public class ClientSessionDetails extends BaseJsonModel {
|
|||||||
disconnectByApTimestamp, disconnectByClientInternalReasonCode, disconnectByClientReasonCode,
|
disconnectByApTimestamp, disconnectByClientInternalReasonCode, disconnectByClientReasonCode,
|
||||||
disconnectByClientTimestamp, dynamicVlan, eapDetails, firstDataRcvdTimestamp, firstDataSentTimestamp,
|
disconnectByClientTimestamp, dynamicVlan, eapDetails, firstDataRcvdTimestamp, firstDataSentTimestamp,
|
||||||
firstFailureDetails, hostname, ipAddress, ipTimestamp, is11KUsed, is11RUsed, is11VUsed, isReassociation,
|
firstFailureDetails, hostname, ipAddress, ipTimestamp, is11KUsed, is11RUsed, is11VUsed, isReassociation,
|
||||||
lastEventTimestamp, lastFailureDetails, lastRxTimestamp, lastTxTimestamp, metricDetails,
|
lastEventTimestamp, lastFailureDetails, lastRxTimestamp, lastTxTimestamp,
|
||||||
portEnabledTimestamp, previousValidSessionId, priorEquipmentId, priorSessionId, radioType,
|
portEnabledTimestamp, previousValidSessionId, priorEquipmentId, priorSessionId, radioType,
|
||||||
radiusUsername, securityType, sessionId, ssid, steerType, timeoutTimestamp, userAgentStr,
|
radiusUsername, securityType, sessionId, ssid, steerType, timeoutTimestamp, userAgentStr,
|
||||||
associationState);
|
associationState, bssid);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -594,7 +573,6 @@ public class ClientSessionDetails extends BaseJsonModel {
|
|||||||
&& Objects.equals(lastFailureDetails, other.lastFailureDetails)
|
&& Objects.equals(lastFailureDetails, other.lastFailureDetails)
|
||||||
&& Objects.equals(lastRxTimestamp, other.lastRxTimestamp)
|
&& Objects.equals(lastRxTimestamp, other.lastRxTimestamp)
|
||||||
&& Objects.equals(lastTxTimestamp, other.lastTxTimestamp)
|
&& Objects.equals(lastTxTimestamp, other.lastTxTimestamp)
|
||||||
&& Objects.equals(metricDetails, other.metricDetails)
|
|
||||||
&& Objects.equals(portEnabledTimestamp, other.portEnabledTimestamp)
|
&& Objects.equals(portEnabledTimestamp, other.portEnabledTimestamp)
|
||||||
&& Objects.equals(previousValidSessionId, other.previousValidSessionId)
|
&& Objects.equals(previousValidSessionId, other.previousValidSessionId)
|
||||||
&& Objects.equals(priorEquipmentId, other.priorEquipmentId)
|
&& Objects.equals(priorEquipmentId, other.priorEquipmentId)
|
||||||
@@ -603,7 +581,8 @@ public class ClientSessionDetails extends BaseJsonModel {
|
|||||||
&& sessionId == other.sessionId && Objects.equals(ssid, other.ssid) && steerType == other.steerType
|
&& sessionId == other.sessionId && Objects.equals(ssid, other.ssid) && steerType == other.steerType
|
||||||
&& Objects.equals(timeoutTimestamp, other.timeoutTimestamp)
|
&& Objects.equals(timeoutTimestamp, other.timeoutTimestamp)
|
||||||
&& Objects.equals(userAgentStr, other.userAgentStr)
|
&& Objects.equals(userAgentStr, other.userAgentStr)
|
||||||
&& Objects.equals(associationState, other.associationState);
|
&& Objects.equals(associationState, other.associationState)
|
||||||
|
&& Objects.equals(bssid, other.bssid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -677,9 +656,6 @@ public class ClientSessionDetails extends BaseJsonModel {
|
|||||||
} else if (latest.eapDetails != null) {
|
} else if (latest.eapDetails != null) {
|
||||||
this.eapDetails.mergeDetails(latest.eapDetails);
|
this.eapDetails.mergeDetails(latest.eapDetails);
|
||||||
}
|
}
|
||||||
if (null != latest.metricDetails) {
|
|
||||||
this.metricDetails = latest.metricDetails;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (null != latest.getIsReassociation()) {
|
if (null != latest.getIsReassociation()) {
|
||||||
this.isReassociation = latest.getIsReassociation();
|
this.isReassociation = latest.getIsReassociation();
|
||||||
@@ -760,6 +736,10 @@ public class ClientSessionDetails extends BaseJsonModel {
|
|||||||
this.userAgentStr = latest.getUserAgentStr();
|
this.userAgentStr = latest.getUserAgentStr();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null != latest.getBssid()) {
|
||||||
|
this.bssid = latest.bssid;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createEapDetailsIfNull() {
|
private void createEapDetailsIfNull() {
|
||||||
@@ -821,11 +801,11 @@ public class ClientSessionDetails extends BaseJsonModel {
|
|||||||
this.assocRssi = assocRssi;
|
this.assocRssi = assocRssi;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Long getPriorSessionId() {
|
public String getPriorSessionId() {
|
||||||
return priorSessionId;
|
return priorSessionId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPriorSessionId(Long priorSessionId) {
|
public void setPriorSessionId(String priorSessionId) {
|
||||||
this.priorSessionId = 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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -24,6 +24,7 @@ import com.telecominfraproject.wlan.client.models.events.ClientChangedEvent;
|
|||||||
import com.telecominfraproject.wlan.client.models.events.ClientRemovedEvent;
|
import com.telecominfraproject.wlan.client.models.events.ClientRemovedEvent;
|
||||||
import com.telecominfraproject.wlan.client.models.events.ClientSessionChangedEvent;
|
import com.telecominfraproject.wlan.client.models.events.ClientSessionChangedEvent;
|
||||||
import com.telecominfraproject.wlan.client.models.events.ClientSessionRemovedEvent;
|
import com.telecominfraproject.wlan.client.models.events.ClientSessionRemovedEvent;
|
||||||
|
import com.telecominfraproject.wlan.client.session.models.AssociationState;
|
||||||
import com.telecominfraproject.wlan.client.session.models.ClientSession;
|
import com.telecominfraproject.wlan.client.session.models.ClientSession;
|
||||||
import com.telecominfraproject.wlan.cloudeventdispatcher.CloudEventDispatcherInterface;
|
import com.telecominfraproject.wlan.cloudeventdispatcher.CloudEventDispatcherInterface;
|
||||||
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
|
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
|
||||||
@@ -351,6 +352,8 @@ public class ClientController {
|
|||||||
throw new DsDataValidationException("Client session contains unsupported value");
|
throw new DsDataValidationException("Client session contains unsupported value");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
forceDisconnectOtherClientSessions(clientSession);
|
||||||
|
|
||||||
ClientSession ret = clientDatastore.updateSession(clientSession);
|
ClientSession ret = clientDatastore.updateSession(clientSession);
|
||||||
|
|
||||||
LOG.debug("Updated Client session {}", ret);
|
LOG.debug("Updated Client session {}", ret);
|
||||||
@@ -384,6 +387,8 @@ public class ClientController {
|
|||||||
throw new DsDataValidationException("Client session contains unsupported value");
|
throw new DsDataValidationException("Client session contains unsupported value");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clientSessions.forEach(s -> forceDisconnectOtherClientSessions(s));
|
||||||
|
|
||||||
ListOfClientSessions ret = new ListOfClientSessions();
|
ListOfClientSessions ret = new ListOfClientSessions();
|
||||||
|
|
||||||
ret.addAll(clientDatastore.updateSessions(clientSessions));
|
ret.addAll(clientDatastore.updateSessions(clientSessions));
|
||||||
@@ -460,5 +465,39 @@ public class ClientController {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Force disconnects other client sessions with the same client Mac address.
|
||||||
|
* In an ideal world, this doesn't happen often.
|
||||||
|
* This usually happens when a client is roaming from one AP to another and the AP does not send a
|
||||||
|
* disconnect until much later (5+ minutes timeout on the AP).
|
||||||
|
* Also happens if the AP was disconnected from the cloud from some time and we "missed" the disconnect event.
|
||||||
|
* @param clientSession
|
||||||
|
*/
|
||||||
|
private void forceDisconnectOtherClientSessions(ClientSession clientSession) {
|
||||||
|
if (clientSession.getDetails().getAssociationState() != AssociationState._802_11_Associated) {
|
||||||
|
// updating a session that is not associated should not disconnect other sessions
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ClientSession> allSessions = clientDatastore.getSessions(clientSession.getCustomerId(), Set.of(clientSession.getMacAddress()));
|
||||||
|
|
||||||
|
if (allSessions == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for (ClientSession cl : allSessions) {
|
||||||
|
if (cl.getEquipmentId() == clientSession.getEquipmentId()) {
|
||||||
|
// Don't disconnect ourselves!
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (cl.getDetails().getAssociationState() == AssociationState._802_11_Associated) {
|
||||||
|
// Force disconnect this client session:
|
||||||
|
LOG.info("Forcing a Disconnect of Client session {}", cl);
|
||||||
|
cl.getDetails().setAssociationState(AssociationState.Disconnected);
|
||||||
|
cl.setLastModifiedTimestamp(System.currentTimeMillis());
|
||||||
|
updateSession(cl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -147,8 +147,7 @@ components:
|
|||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
sessionId:
|
sessionId:
|
||||||
type: integer
|
type: string
|
||||||
format: int64
|
|
||||||
authTimestamp:
|
authTimestamp:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
@@ -182,6 +181,8 @@ components:
|
|||||||
type: string
|
type: string
|
||||||
ssid:
|
ssid:
|
||||||
type: string
|
type: string
|
||||||
|
bssid:
|
||||||
|
$ref: '#/components/schemas/MacAddress'
|
||||||
radioType:
|
radioType:
|
||||||
$ref: '#/components/schemas/RadioType'
|
$ref: '#/components/schemas/RadioType'
|
||||||
lastEventTimestamp:
|
lastEventTimestamp:
|
||||||
@@ -235,8 +236,7 @@ components:
|
|||||||
steerType:
|
steerType:
|
||||||
$ref: '#/components/schemas/SteerType'
|
$ref: '#/components/schemas/SteerType'
|
||||||
previousValidSessionId:
|
previousValidSessionId:
|
||||||
type: integer
|
type: string
|
||||||
format: int64
|
|
||||||
lastFailureDetails:
|
lastFailureDetails:
|
||||||
$ref: '#/components/schemas/ClientFailureDetails'
|
$ref: '#/components/schemas/ClientFailureDetails'
|
||||||
firstFailureDetails:
|
firstFailureDetails:
|
||||||
@@ -251,8 +251,7 @@ components:
|
|||||||
type: integer
|
type: integer
|
||||||
format: int32
|
format: int32
|
||||||
priorSessionId:
|
priorSessionId:
|
||||||
type: integer
|
type: string
|
||||||
format: int64
|
|
||||||
priorEquipmentId:
|
priorEquipmentId:
|
||||||
type: integer
|
type: integer
|
||||||
format: int64
|
format: int64
|
||||||
|
|||||||
@@ -60,7 +60,6 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<artifactId>base-stream-interface</artifactId>
|
<artifactId>base-stream-interface</artifactId>
|
||||||
<groupId>com.telecominfraproject.wlan</groupId>
|
<groupId>com.telecominfraproject.wlan</groupId>
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
import org.springframework.beans.factory.annotation.Qualifier;
|
||||||
import org.springframework.cache.Cache;
|
import org.springframework.cache.Cache;
|
||||||
import org.springframework.cache.CacheManager;
|
import org.springframework.cache.CacheManager;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMethod;
|
import org.springframework.web.bind.annotation.RequestMethod;
|
||||||
@@ -32,8 +33,8 @@ public class CloudEventDispatcherController {
|
|||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(CloudEventDispatcherController.class);
|
private static final Logger LOG = LoggerFactory.getLogger(CloudEventDispatcherController.class);
|
||||||
|
|
||||||
@Autowired @Qualifier("metricStreamInterface") private StreamInterface<ServiceMetric> metricStream;
|
@Autowired @Qualifier("metricStreamInterface") @Lazy private StreamInterface<ServiceMetric> metricStream;
|
||||||
@Autowired @Qualifier("eventStreamInterface") private StreamInterface<SystemEventRecord> systemEventStream;
|
@Autowired @Qualifier("eventStreamInterface") @Lazy private StreamInterface<SystemEventRecord> systemEventStream;
|
||||||
@Autowired private ServiceMetricServiceInterface serviceMetricInterface;
|
@Autowired private ServiceMetricServiceInterface serviceMetricInterface;
|
||||||
@Autowired private SystemEventServiceInterface systemEventInterface;
|
@Autowired private SystemEventServiceInterface systemEventInterface;
|
||||||
|
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -263,7 +263,8 @@ public class EquipmentDAO extends BaseJdbcDao {
|
|||||||
},
|
},
|
||||||
keyHolder);
|
keyHolder);
|
||||||
}catch (DuplicateKeyException e) {
|
}catch (DuplicateKeyException e) {
|
||||||
throw new DsDuplicateEntityException(e);
|
LOG.error("Duplicate equipment found", e);
|
||||||
|
throw new DsDuplicateEntityException("Equipment with the assetId " + equipment.getInventoryId() + " already exists!");
|
||||||
}
|
}
|
||||||
|
|
||||||
// keyHolder.getKey() now contains the generated key
|
// keyHolder.getKey() now contains the generated key
|
||||||
|
|||||||
@@ -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
|
- cyan
|
||||||
- white
|
- white
|
||||||
- off
|
- off
|
||||||
|
|
||||||
CEGWBlinkRequest:
|
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.
|
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:
|
allOf:
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ public abstract class CommonElementConfiguration extends EquipmentDetails implem
|
|||||||
private AntennaType antennaType;
|
private AntennaType antennaType;
|
||||||
private Boolean costSavingEventsEnabled;
|
private Boolean costSavingEventsEnabled;
|
||||||
private NetworkForwardMode forwardMode;
|
private NetworkForwardMode forwardMode;
|
||||||
|
private boolean blinkAllLEDs;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* this constructor is used for CAMI only
|
* this constructor is used for CAMI only
|
||||||
@@ -68,38 +69,34 @@ public abstract class CommonElementConfiguration extends EquipmentDetails implem
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
final int prime = 31;
|
||||||
|
int result = super.hashCode();
|
||||||
|
result = prime * result + Objects.hash(antennaType, blinkAllLEDs, costSavingEventsEnabled, deploymentType, deviceMode, deviceName, elementConfigVersion,
|
||||||
|
equipmentType, forwardMode, frameReportThrottleEnabled, gettingDNS, gettingIP, locallyConfigured, locallyConfiguredMgmtVlan, locationData,
|
||||||
|
peerInfoList, staticDnsIp1, staticDnsIp2, staticIP, staticIpGw, staticIpMaskCidr, syntheticClientEnabled);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean equals(Object obj) {
|
public boolean equals(Object obj) {
|
||||||
if (this == obj) {
|
if (this == obj)
|
||||||
return true;
|
return true;
|
||||||
}
|
if (!super.equals(obj))
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
if (getClass() != obj.getClass())
|
||||||
|
|
||||||
if (!super.equals(obj)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
|
||||||
|
|
||||||
if (!(obj instanceof CommonElementConfiguration)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
CommonElementConfiguration other = (CommonElementConfiguration) obj;
|
CommonElementConfiguration other = (CommonElementConfiguration) obj;
|
||||||
return this.antennaType == other.antennaType
|
return antennaType == other.antennaType && blinkAllLEDs == other.blinkAllLEDs && Objects.equals(costSavingEventsEnabled, other.costSavingEventsEnabled)
|
||||||
&& Objects.equals(costSavingEventsEnabled, other.costSavingEventsEnabled)
|
&& deploymentType == other.deploymentType && deviceMode == other.deviceMode && Objects.equals(deviceName, other.deviceName)
|
||||||
&& this.deploymentType == other.deploymentType && this.deviceMode == other.deviceMode
|
&& Objects.equals(elementConfigVersion, other.elementConfigVersion) && Objects.equals(equipmentType, other.equipmentType)
|
||||||
&& Objects.equals(deviceName, other.deviceName)
|
&& forwardMode == other.forwardMode && Objects.equals(frameReportThrottleEnabled, other.frameReportThrottleEnabled)
|
||||||
&& Objects.equals(elementConfigVersion, other.elementConfigVersion)
|
&& gettingDNS == other.gettingDNS && gettingIP == other.gettingIP && locallyConfigured == other.locallyConfigured
|
||||||
&& this.equipmentType == other.equipmentType && this.forwardMode == other.forwardMode
|
&& locallyConfiguredMgmtVlan == other.locallyConfiguredMgmtVlan && Objects.equals(locationData, other.locationData)
|
||||||
&& Objects.equals(frameReportThrottleEnabled, other.frameReportThrottleEnabled)
|
&& Objects.equals(peerInfoList, other.peerInfoList) && Objects.equals(staticDnsIp1, other.staticDnsIp1)
|
||||||
&& this.gettingDNS == other.gettingDNS && this.gettingIP == other.gettingIP
|
&& Objects.equals(staticDnsIp2, other.staticDnsIp2) && Objects.equals(staticIP, other.staticIP) && Objects.equals(staticIpGw, other.staticIpGw)
|
||||||
&& this.locallyConfigured == other.locallyConfigured
|
&& Objects.equals(staticIpMaskCidr, other.staticIpMaskCidr) && Objects.equals(syntheticClientEnabled, other.syntheticClientEnabled);
|
||||||
&& this.locallyConfiguredMgmtVlan == other.locallyConfiguredMgmtVlan
|
|
||||||
&& Objects.equals(locationData, other.locationData) && Objects.equals(peerInfoList, other.peerInfoList)
|
|
||||||
&& Objects.equals(staticDnsIp1, other.staticDnsIp1) && Objects.equals(staticDnsIp2, other.staticDnsIp2)
|
|
||||||
&& Objects.equals(staticIP, other.staticIP) && Objects.equals(staticIpGw, other.staticIpGw)
|
|
||||||
&& Objects.equals(staticIpMaskCidr, other.staticIpMaskCidr)
|
|
||||||
&& Objects.equals(syntheticClientEnabled, other.syntheticClientEnabled);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public AntennaType getAntennaType() {
|
public AntennaType getAntennaType() {
|
||||||
@@ -189,14 +186,6 @@ public abstract class CommonElementConfiguration extends EquipmentDetails implem
|
|||||||
return syntheticClientEnabled;
|
return syntheticClientEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
return Objects.hash(antennaType, costSavingEventsEnabled, deploymentType, deviceMode, deviceName,
|
|
||||||
elementConfigVersion, equipmentType, forwardMode, frameReportThrottleEnabled, gettingDNS, gettingIP,
|
|
||||||
locallyConfigured, locallyConfiguredMgmtVlan, locationData, peerInfoList, staticDnsIp1, staticDnsIp2,
|
|
||||||
staticIP, staticIpGw, staticIpMaskCidr, syntheticClientEnabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean hasUnsupportedValue() {
|
public boolean hasUnsupportedValue() {
|
||||||
if (super.hasUnsupportedValue()) {
|
if (super.hasUnsupportedValue()) {
|
||||||
@@ -311,4 +300,13 @@ public abstract class CommonElementConfiguration extends EquipmentDetails implem
|
|||||||
public void setSyntheticClientEnabled(Boolean syntheticClientEnabled) {
|
public void setSyntheticClientEnabled(Boolean syntheticClientEnabled) {
|
||||||
this.syntheticClientEnabled = syntheticClientEnabled;
|
this.syntheticClientEnabled = syntheticClientEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isBlinkAllLEDs() {
|
||||||
|
return blinkAllLEDs;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setBlinkAllLEDs(boolean blinkAllLEDs) {
|
||||||
|
this.blinkAllLEDs = blinkAllLEDs;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.telecominfraproject.wlan.equipment.models;
|
package com.telecominfraproject.wlan.equipment.models;
|
||||||
|
|
||||||
|
import java.util.EnumMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
@@ -49,6 +51,38 @@ public class ElementRadioConfiguration extends BaseJsonModel
|
|||||||
private Boolean deauthAttackDetection;
|
private Boolean deauthAttackDetection;
|
||||||
private Set<ChannelPowerLevel> allowedChannelsPowerLevels = new HashSet<>();
|
private Set<ChannelPowerLevel> allowedChannelsPowerLevels = new HashSet<>();
|
||||||
|
|
||||||
|
public final static int DEFAULT_CHANNEL_NUMBER_2DOT4GHZ = 6;
|
||||||
|
public final static int DEFAULT_BACKUP_CHANNEL_NUMBER_2DOT4GHZ = 11;
|
||||||
|
public final static int DEFAULT_CHANNEL_NUMBER_5GHZ = 36;
|
||||||
|
public final static int DEFAULT_BACKUP_CHANNEL_NUMBER_5GHZ = 44;
|
||||||
|
public final static int DEFAULT_CHANNEL_NUMBER_5GHZL = 36;
|
||||||
|
public final static int DEFAULT_BACKUP_CHANNEL_NUMBER_5GHZL = 44;
|
||||||
|
public final static int DEFAULT_CHANNEL_NUMBER_5GHZU = 149;
|
||||||
|
public final static int DEFAULT_BACKUP_CHANNEL_NUMBER_5GHZU = 157;
|
||||||
|
|
||||||
|
private static final Map<RadioType, Integer> defaultChannelNumberMap = new EnumMap<>(RadioType.class);
|
||||||
|
private static final Map<RadioType, Integer> defaultBackupChannelNumberMap = new EnumMap<>(RadioType.class);
|
||||||
|
|
||||||
|
static {
|
||||||
|
defaultChannelNumberMap.put(RadioType.is2dot4GHz, DEFAULT_CHANNEL_NUMBER_2DOT4GHZ);
|
||||||
|
defaultChannelNumberMap.put(RadioType.is5GHz, DEFAULT_CHANNEL_NUMBER_5GHZ);
|
||||||
|
defaultChannelNumberMap.put(RadioType.is5GHzL, DEFAULT_CHANNEL_NUMBER_5GHZL);
|
||||||
|
defaultChannelNumberMap.put(RadioType.is5GHzU, DEFAULT_CHANNEL_NUMBER_5GHZU);
|
||||||
|
|
||||||
|
defaultBackupChannelNumberMap.put(RadioType.is2dot4GHz, DEFAULT_BACKUP_CHANNEL_NUMBER_2DOT4GHZ);
|
||||||
|
defaultBackupChannelNumberMap.put(RadioType.is5GHz, DEFAULT_BACKUP_CHANNEL_NUMBER_5GHZ);
|
||||||
|
defaultBackupChannelNumberMap.put(RadioType.is5GHzL, DEFAULT_BACKUP_CHANNEL_NUMBER_5GHZL);
|
||||||
|
defaultBackupChannelNumberMap.put(RadioType.is5GHzU, DEFAULT_BACKUP_CHANNEL_NUMBER_5GHZU);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Integer getDefaultChannelNumber(RadioType radioType) {
|
||||||
|
return defaultChannelNumberMap.get(radioType);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Integer getDefaultBackupChannelNumber(RadioType radioType) {
|
||||||
|
return defaultBackupChannelNumberMap.get(radioType);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Static creator
|
* Static creator
|
||||||
*
|
*
|
||||||
@@ -60,19 +94,8 @@ public class ElementRadioConfiguration extends BaseJsonModel
|
|||||||
|
|
||||||
returnValue.setRadioType(radioType);
|
returnValue.setRadioType(radioType);
|
||||||
|
|
||||||
if (radioType == RadioType.is5GHz) {
|
returnValue.setChannelNumber(getDefaultChannelNumber(radioType));
|
||||||
returnValue.setChannelNumber(36);
|
returnValue.setBackupChannelNumber(getDefaultBackupChannelNumber(radioType));
|
||||||
returnValue.setBackupChannelNumber(153);
|
|
||||||
} else if (radioType == RadioType.is5GHzL) {
|
|
||||||
returnValue.setChannelNumber(36);
|
|
||||||
returnValue.setBackupChannelNumber(44);
|
|
||||||
} else if (radioType == RadioType.is5GHzU) {
|
|
||||||
returnValue.setChannelNumber(149);
|
|
||||||
returnValue.setBackupChannelNumber(157);
|
|
||||||
} else {
|
|
||||||
returnValue.setChannelNumber(6);
|
|
||||||
returnValue.setBackupChannelNumber(11);
|
|
||||||
}
|
|
||||||
|
|
||||||
return returnValue;
|
return returnValue;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -118,34 +118,41 @@ public class EquipmentRrmBulkUpdateItem extends BaseJsonModel {
|
|||||||
finalDetails.getRadioMap().put(rt, erc);
|
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());
|
erc.setManualChannelNumber(updateDetails.getChannelNumber());
|
||||||
modelChanged.set(true);
|
modelChanged.set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(erc.getManualBackupChannelNumber()== null ||
|
if(erc.getManualBackupChannelNumber() == null
|
||||||
erc.getManualBackupChannelNumber().intValue() != updateDetails.getBackupChannelNumber()) {
|
|| erc.getManualBackupChannelNumber().intValue() != updateDetails.getBackupChannelNumber()) {
|
||||||
erc.setManualBackupChannelNumber(updateDetails.getBackupChannelNumber());
|
erc.setManualBackupChannelNumber(updateDetails.getBackupChannelNumber());
|
||||||
modelChanged.set(true);
|
modelChanged.set(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (updateDetails.getClientDisconnectThresholdDb() != null) {
|
||||||
if ((erc.getClientDisconnectThresholdDb() == null && updateDetails.getClientDisconnectThresholdDb() != null)
|
if ((erc.getClientDisconnectThresholdDb() == null && updateDetails.getClientDisconnectThresholdDb() != null)
|
||||||
|| !erc.getClientDisconnectThresholdDb().equals(updateDetails.getClientDisconnectThresholdDb())) {
|
|| !erc.getClientDisconnectThresholdDb().equals(updateDetails.getClientDisconnectThresholdDb())) {
|
||||||
erc.setClientDisconnectThresholdDb(updateDetails.getClientDisconnectThresholdDb());
|
erc.setClientDisconnectThresholdDb(updateDetails.getClientDisconnectThresholdDb());
|
||||||
modelChanged.set(true);
|
modelChanged.set(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (updateDetails.getProbeResponseThresholdDb() != null) {
|
||||||
if ((erc.getProbeResponseThresholdDb() == null && updateDetails.getProbeResponseThresholdDb() != null)
|
if ((erc.getProbeResponseThresholdDb() == null && updateDetails.getProbeResponseThresholdDb() != null)
|
||||||
|| !erc.getProbeResponseThresholdDb().equals(updateDetails.getProbeResponseThresholdDb())) {
|
|| !erc.getProbeResponseThresholdDb().equals(updateDetails.getProbeResponseThresholdDb())) {
|
||||||
erc.setProbeResponseThresholdDb(updateDetails.getProbeResponseThresholdDb());
|
erc.setProbeResponseThresholdDb(updateDetails.getProbeResponseThresholdDb());
|
||||||
modelChanged.set(true);
|
modelChanged.set(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (updateDetails.getRxCellSizeDb() != null) {
|
||||||
if ((erc.getRxCellSizeDb() == null && updateDetails.getRxCellSizeDb() != null)
|
if ((erc.getRxCellSizeDb() == null && updateDetails.getRxCellSizeDb() != null)
|
||||||
|| !erc.getRxCellSizeDb().equals(updateDetails.getRxCellSizeDb())) {
|
|| !erc.getRxCellSizeDb().equals(updateDetails.getRxCellSizeDb())) {
|
||||||
erc.setRxCellSizeDb(updateDetails.getRxCellSizeDb());
|
erc.setRxCellSizeDb(updateDetails.getRxCellSizeDb());
|
||||||
modelChanged.set(true);
|
modelChanged.set(true);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
RadioConfiguration arc = finalDetails.getAdvancedRadioMap().get(rt);
|
RadioConfiguration arc = finalDetails.getAdvancedRadioMap().get(rt);
|
||||||
|
|||||||
@@ -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 {
|
public enum EquipmentChangeType {
|
||||||
|
|
||||||
All(0), ChannelsOnly(1), CellSizeAttributesOnly(2), ApImpacting(3), UNSUPPORTED(-1);
|
All(0), ChannelsOnly(1), CellSizeAttributesOnly(2), ApImpacting(3), blinkLEDs(4), CustomerOnly(5), UNSUPPORTED(-1);
|
||||||
|
|
||||||
private final int id;
|
private final int id;
|
||||||
private static final Map<Integer, EquipmentChangeType> ELEMENTS = new HashMap<>();
|
private static final Map<Integer, EquipmentChangeType> ELEMENTS = new HashMap<>();
|
||||||
private static final EquipmentChangeType validValues[] = { All, ChannelsOnly, CellSizeAttributesOnly, ApImpacting};
|
private static final EquipmentChangeType validValues[] = { All, ChannelsOnly, CellSizeAttributesOnly, ApImpacting,blinkLEDs};
|
||||||
|
|
||||||
private EquipmentChangeType(int id) {
|
private EquipmentChangeType(int id) {
|
||||||
this.id = id;
|
this.id = id;
|
||||||
|
|||||||
@@ -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,4 +1,6 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.telecominfraproject.wlan</groupId>
|
<groupId>com.telecominfraproject.wlan</groupId>
|
||||||
@@ -52,6 +54,5 @@
|
|||||||
<version>1.2.0-SNAPSHOT</version>
|
<version>1.2.0-SNAPSHOT</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -36,11 +36,9 @@ import com.telecominfraproject.wlan.core.model.pagination.PaginationContext;
|
|||||||
import com.telecominfraproject.wlan.core.model.pagination.PaginationResponse;
|
import com.telecominfraproject.wlan.core.model.pagination.PaginationResponse;
|
||||||
import com.telecominfraproject.wlan.core.model.pagination.SortOrder;
|
import com.telecominfraproject.wlan.core.model.pagination.SortOrder;
|
||||||
import com.telecominfraproject.wlan.core.model.pair.PairLongLong;
|
import com.telecominfraproject.wlan.core.model.pair.PairLongLong;
|
||||||
import com.telecominfraproject.wlan.datastore.exceptions.DsDataValidationException;
|
|
||||||
import com.telecominfraproject.wlan.equipment.models.AntennaType;
|
import com.telecominfraproject.wlan.equipment.models.AntennaType;
|
||||||
import com.telecominfraproject.wlan.equipment.models.ApElementConfiguration;
|
import com.telecominfraproject.wlan.equipment.models.ApElementConfiguration;
|
||||||
import com.telecominfraproject.wlan.equipment.models.CellSizeAttributes;
|
import com.telecominfraproject.wlan.equipment.models.CellSizeAttributes;
|
||||||
import com.telecominfraproject.wlan.equipment.models.ChannelPowerLevel;
|
|
||||||
import com.telecominfraproject.wlan.equipment.models.CustomerEquipmentCounts;
|
import com.telecominfraproject.wlan.equipment.models.CustomerEquipmentCounts;
|
||||||
import com.telecominfraproject.wlan.equipment.models.ElementRadioConfiguration;
|
import com.telecominfraproject.wlan.equipment.models.ElementRadioConfiguration;
|
||||||
import com.telecominfraproject.wlan.equipment.models.Equipment;
|
import com.telecominfraproject.wlan.equipment.models.Equipment;
|
||||||
@@ -623,94 +621,6 @@ public class EquipmentServiceRemoteTest extends BaseRemoteTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
|
||||||
public void testEquipmentUpdateChannelNumValidation() {
|
|
||||||
|
|
||||||
//Create new Equipment - success
|
|
||||||
Equipment equipment = new Equipment();
|
|
||||||
equipment.setName("testName-"+getNextEquipmentId());
|
|
||||||
equipment.setInventoryId("test-inv-"+getNextEquipmentId());
|
|
||||||
equipment.setEquipmentType(EquipmentType.AP);
|
|
||||||
equipment.setDetails(ApElementConfiguration.createWithDefaults());
|
|
||||||
|
|
||||||
ElementRadioConfiguration element2dot4RadioConfig = ((ApElementConfiguration)equipment.getDetails()).getRadioMap().get(RadioType.is2dot4GHz);
|
|
||||||
element2dot4RadioConfig.setAllowedChannelsPowerLevels(new HashSet<>());
|
|
||||||
|
|
||||||
for (int i = 1; i <= 11; i++) {
|
|
||||||
ChannelPowerLevel cpl = new ChannelPowerLevel();
|
|
||||||
cpl.setChannelNumber(i);
|
|
||||||
cpl.setChannelWidth(20);
|
|
||||||
cpl.setDfs(false);
|
|
||||||
cpl.setPowerLevel(30);
|
|
||||||
element2dot4RadioConfig.getAllowedChannelsPowerLevels().add(cpl);
|
|
||||||
}
|
|
||||||
|
|
||||||
Equipment ret = remoteInterface.create(equipment);
|
|
||||||
assertNotNull(ret);
|
|
||||||
|
|
||||||
ret = remoteInterface.get(ret.getId());
|
|
||||||
assertEqualEquipments(equipment, ret);
|
|
||||||
|
|
||||||
ElementRadioConfiguration retElement2dot4RadioConfig = ((ApElementConfiguration)ret.getDetails()).getRadioMap().get(RadioType.is2dot4GHz);
|
|
||||||
assertEquals(retElement2dot4RadioConfig.getChannelNumber().intValue(), 6);
|
|
||||||
|
|
||||||
//Update success
|
|
||||||
retElement2dot4RadioConfig.setChannelNumber(1);
|
|
||||||
retElement2dot4RadioConfig.setManualChannelNumber(2);
|
|
||||||
retElement2dot4RadioConfig.setBackupChannelNumber(3);
|
|
||||||
retElement2dot4RadioConfig.setManualBackupChannelNumber(4);
|
|
||||||
|
|
||||||
Equipment updatedEquipment = remoteInterface.update(ret);
|
|
||||||
|
|
||||||
Equipment retUpdate = remoteInterface.get(ret.getId());
|
|
||||||
assertEqualEquipments(retUpdate, updatedEquipment);
|
|
||||||
ElementRadioConfiguration ret2Element2dot4RadioConfig = ((ApElementConfiguration)retUpdate.getDetails()).getRadioMap().get(RadioType.is2dot4GHz);
|
|
||||||
assertEquals(retElement2dot4RadioConfig.getChannelNumber().intValue(), 1);
|
|
||||||
assertEquals(retElement2dot4RadioConfig.getManualChannelNumber().intValue(), 2);
|
|
||||||
assertEquals(retElement2dot4RadioConfig.getBackupChannelNumber().intValue(), 3);
|
|
||||||
assertEquals(retElement2dot4RadioConfig.getManualBackupChannelNumber().intValue(), 4);
|
|
||||||
|
|
||||||
//Update failure
|
|
||||||
ret2Element2dot4RadioConfig.setChannelNumber(12);
|
|
||||||
try {
|
|
||||||
remoteInterface.update(retUpdate);
|
|
||||||
fail("EquipmentService update channelNumber failed");
|
|
||||||
} catch (DsDataValidationException e) {
|
|
||||||
// pass
|
|
||||||
}
|
|
||||||
|
|
||||||
ret2Element2dot4RadioConfig.setChannelNumber(6);
|
|
||||||
ret2Element2dot4RadioConfig.setManualChannelNumber(13);
|
|
||||||
try {
|
|
||||||
remoteInterface.update(retUpdate);
|
|
||||||
fail("EquipmentService update manualChannelNumber failed");
|
|
||||||
} catch (DsDataValidationException e) {
|
|
||||||
// pass
|
|
||||||
}
|
|
||||||
|
|
||||||
ret2Element2dot4RadioConfig.setManualChannelNumber(7);
|
|
||||||
ret2Element2dot4RadioConfig.setBackupChannelNumber(14);
|
|
||||||
try {
|
|
||||||
remoteInterface.update(retUpdate);
|
|
||||||
fail("EquipmentService update backupChannelNumber failed");
|
|
||||||
} catch (DsDataValidationException e) {
|
|
||||||
// pass
|
|
||||||
}
|
|
||||||
|
|
||||||
ret2Element2dot4RadioConfig.setBackupChannelNumber(8);
|
|
||||||
ret2Element2dot4RadioConfig.setManualBackupChannelNumber(15);
|
|
||||||
try {
|
|
||||||
remoteInterface.update(retUpdate);
|
|
||||||
fail("EquipmentService update manualBackupChannelNumber failed");
|
|
||||||
} catch (DsDataValidationException e) {
|
|
||||||
// pass
|
|
||||||
}
|
|
||||||
|
|
||||||
//Tolerate null now
|
|
||||||
ret2Element2dot4RadioConfig.setManualBackupChannelNumber(null);
|
|
||||||
remoteInterface.update(retUpdate);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testGetPaginatedEquipmentIds()
|
public void testGetPaginatedEquipmentIds()
|
||||||
{
|
{
|
||||||
@@ -869,7 +779,6 @@ public class EquipmentServiceRemoteTest extends BaseRemoteTest {
|
|||||||
|
|
||||||
// Clean up after test
|
// Clean up after test
|
||||||
createdSet.forEach( c-> remoteInterface.delete(c));
|
createdSet.forEach( c-> remoteInterface.delete(c));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@@ -932,9 +841,9 @@ public class EquipmentServiceRemoteTest extends BaseRemoteTest {
|
|||||||
assertEquals(11, radioMap.get(RadioType.is2dot4GHz).getManualBackupChannelNumber().intValue());
|
assertEquals(11, radioMap.get(RadioType.is2dot4GHz).getManualBackupChannelNumber().intValue());
|
||||||
|
|
||||||
assertEquals(36, radioMap.get(RadioType.is5GHz).getChannelNumber().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(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> primaryChannels = new EnumMap<>(RadioType.class);
|
||||||
Map<RadioType, Integer> backupChannels = new EnumMap<>(RadioType.class);
|
Map<RadioType, Integer> backupChannels = new EnumMap<>(RadioType.class);
|
||||||
@@ -970,7 +879,7 @@ public class EquipmentServiceRemoteTest extends BaseRemoteTest {
|
|||||||
assertEquals(6, radioMap.get(RadioType.is2dot4GHz).getManualBackupChannelNumber().intValue());
|
assertEquals(6, radioMap.get(RadioType.is2dot4GHz).getManualBackupChannelNumber().intValue());
|
||||||
|
|
||||||
assertEquals(36, radioMap.get(RadioType.is5GHz).getChannelNumber().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(40, radioMap.get(RadioType.is5GHz).getManualChannelNumber().intValue());
|
||||||
assertEquals(48, radioMap.get(RadioType.is5GHz).getManualBackupChannelNumber().intValue());
|
assertEquals(48, radioMap.get(RadioType.is5GHz).getManualBackupChannelNumber().intValue());
|
||||||
|
|
||||||
@@ -980,7 +889,7 @@ public class EquipmentServiceRemoteTest extends BaseRemoteTest {
|
|||||||
|
|
||||||
backupChannels.clear();
|
backupChannels.clear();
|
||||||
backupChannels.put(RadioType.is2dot4GHz, 6);
|
backupChannels.put(RadioType.is2dot4GHz, 6);
|
||||||
backupChannels.put(RadioType.is5GHz, 44);
|
backupChannels.put(RadioType.is5GHz, 149);
|
||||||
|
|
||||||
autoChannelSelections.clear();
|
autoChannelSelections.clear();
|
||||||
autoChannelSelections.put(RadioType.is2dot4GHz, true);
|
autoChannelSelections.put(RadioType.is2dot4GHz, true);
|
||||||
@@ -1007,7 +916,7 @@ public class EquipmentServiceRemoteTest extends BaseRemoteTest {
|
|||||||
assertEquals(6, radioMap.get(RadioType.is2dot4GHz).getManualBackupChannelNumber().intValue());
|
assertEquals(6, radioMap.get(RadioType.is2dot4GHz).getManualBackupChannelNumber().intValue());
|
||||||
|
|
||||||
assertEquals(161, radioMap.get(RadioType.is5GHz).getChannelNumber().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(40, radioMap.get(RadioType.is5GHz).getManualChannelNumber().intValue());
|
||||||
assertEquals(48, radioMap.get(RadioType.is5GHz).getManualBackupChannelNumber().intValue());
|
assertEquals(48, radioMap.get(RadioType.is5GHz).getManualBackupChannelNumber().intValue());
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.telecominfraproject.wlan</groupId>
|
<groupId>com.telecominfraproject.wlan</groupId>
|
||||||
@@ -12,6 +14,12 @@
|
|||||||
<description>Server side implementation of the service.</description>
|
<description>Server side implementation of the service.</description>
|
||||||
|
|
||||||
<dependencies>
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<artifactId>alarm-service-interface</artifactId>
|
||||||
|
<groupId>com.telecominfraproject.wlan</groupId>
|
||||||
|
<version>1.2.0-SNAPSHOT</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<artifactId>base-container</artifactId>
|
<artifactId>base-container</artifactId>
|
||||||
<groupId>com.telecominfraproject.wlan</groupId>
|
<groupId>com.telecominfraproject.wlan</groupId>
|
||||||
@@ -41,13 +49,11 @@
|
|||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<artifactId>cloud-event-dispatcher-empty</artifactId>
|
<artifactId>cloud-event-dispatcher-empty</artifactId>
|
||||||
<groupId>com.telecominfraproject.wlan</groupId>
|
<groupId>com.telecominfraproject.wlan</groupId>
|
||||||
<version>1.2.0-SNAPSHOT</version>
|
<version>1.2.0-SNAPSHOT</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
package com.telecominfraproject.wlan.equipment.controller;
|
package com.telecominfraproject.wlan.equipment.controller;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -34,7 +32,6 @@ import com.telecominfraproject.wlan.datastore.exceptions.DsDataValidationExcepti
|
|||||||
import com.telecominfraproject.wlan.equipment.datastore.EquipmentDatastore;
|
import com.telecominfraproject.wlan.equipment.datastore.EquipmentDatastore;
|
||||||
import com.telecominfraproject.wlan.equipment.models.ApElementConfiguration;
|
import com.telecominfraproject.wlan.equipment.models.ApElementConfiguration;
|
||||||
import com.telecominfraproject.wlan.equipment.models.CellSizeAttributes;
|
import com.telecominfraproject.wlan.equipment.models.CellSizeAttributes;
|
||||||
import com.telecominfraproject.wlan.equipment.models.ChannelPowerLevel;
|
|
||||||
import com.telecominfraproject.wlan.equipment.models.CustomerEquipmentCounts;
|
import com.telecominfraproject.wlan.equipment.models.CustomerEquipmentCounts;
|
||||||
import com.telecominfraproject.wlan.equipment.models.ElementRadioConfiguration;
|
import com.telecominfraproject.wlan.equipment.models.ElementRadioConfiguration;
|
||||||
import com.telecominfraproject.wlan.equipment.models.Equipment;
|
import com.telecominfraproject.wlan.equipment.models.Equipment;
|
||||||
@@ -47,14 +44,15 @@ import com.telecominfraproject.wlan.equipment.models.SourceSelectionMulticast;
|
|||||||
import com.telecominfraproject.wlan.equipment.models.bulkupdate.rrm.EquipmentRrmBulkUpdateRequest;
|
import com.telecominfraproject.wlan.equipment.models.bulkupdate.rrm.EquipmentRrmBulkUpdateRequest;
|
||||||
import com.telecominfraproject.wlan.equipment.models.events.EquipmentAddedEvent;
|
import com.telecominfraproject.wlan.equipment.models.events.EquipmentAddedEvent;
|
||||||
import com.telecominfraproject.wlan.equipment.models.events.EquipmentApImpactingChangedEvent;
|
import com.telecominfraproject.wlan.equipment.models.events.EquipmentApImpactingChangedEvent;
|
||||||
|
import com.telecominfraproject.wlan.equipment.models.events.EquipmentBlinkLEDsEvent;
|
||||||
import com.telecominfraproject.wlan.equipment.models.events.EquipmentCellSizeAttributesChangedEvent;
|
import com.telecominfraproject.wlan.equipment.models.events.EquipmentCellSizeAttributesChangedEvent;
|
||||||
import com.telecominfraproject.wlan.equipment.models.events.EquipmentChangedEvent;
|
import com.telecominfraproject.wlan.equipment.models.events.EquipmentChangedEvent;
|
||||||
import com.telecominfraproject.wlan.equipment.models.events.EquipmentChannelsChangedEvent;
|
import com.telecominfraproject.wlan.equipment.models.events.EquipmentChannelsChangedEvent;
|
||||||
|
import com.telecominfraproject.wlan.equipment.models.events.EquipmentCustomerChangedEvent;
|
||||||
import com.telecominfraproject.wlan.equipment.models.events.EquipmentRemovedEvent;
|
import com.telecominfraproject.wlan.equipment.models.events.EquipmentRemovedEvent;
|
||||||
import com.telecominfraproject.wlan.server.exceptions.ConfigurationException;
|
import com.telecominfraproject.wlan.server.exceptions.ConfigurationException;
|
||||||
import com.telecominfraproject.wlan.systemevent.models.SystemEvent;
|
import com.telecominfraproject.wlan.systemevent.models.SystemEvent;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author dtoptygin
|
* @author dtoptygin
|
||||||
*
|
*
|
||||||
@@ -73,7 +71,6 @@ public class EquipmentController {
|
|||||||
@Autowired private EquipmentDatastore equipmentDatastore;
|
@Autowired private EquipmentDatastore equipmentDatastore;
|
||||||
@Autowired private CloudEventDispatcherInterface cloudEventDispatcher;
|
@Autowired private CloudEventDispatcherInterface cloudEventDispatcher;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new Equipment.
|
* Creates new Equipment.
|
||||||
*
|
*
|
||||||
@@ -91,12 +88,7 @@ public class EquipmentController {
|
|||||||
throw new DsDataValidationException("Equipment contains unsupported value");
|
throw new DsDataValidationException("Equipment contains unsupported value");
|
||||||
}
|
}
|
||||||
|
|
||||||
long ts = System.currentTimeMillis();
|
updateValuesIfNeeded(equipment);
|
||||||
if (equipment.getCreatedTimestamp() == 0) {
|
|
||||||
equipment.setCreatedTimestamp(ts);
|
|
||||||
}
|
|
||||||
equipment.setLastModifiedTimestamp(ts);
|
|
||||||
|
|
||||||
Equipment ret = equipmentDatastore.create(equipment);
|
Equipment ret = equipmentDatastore.create(equipment);
|
||||||
|
|
||||||
LOG.debug("Created Equipment {}", ret);
|
LOG.debug("Created Equipment {}", ret);
|
||||||
@@ -108,6 +100,23 @@ public class EquipmentController {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateValuesIfNeeded(Equipment equipment) {
|
||||||
|
// strip out whitespaces from user entered inventoryId and name strings
|
||||||
|
if (equipment.getName() != null) {
|
||||||
|
equipment.setName(equipment.getName().strip());
|
||||||
|
}
|
||||||
|
if (equipment.getInventoryId() != null) {
|
||||||
|
equipment.setInventoryId(equipment.getInventoryId().strip());
|
||||||
|
}
|
||||||
|
|
||||||
|
// Update timestamp
|
||||||
|
long ts = System.currentTimeMillis();
|
||||||
|
if (equipment.getCreatedTimestamp() == 0) {
|
||||||
|
equipment.setCreatedTimestamp(ts);
|
||||||
|
}
|
||||||
|
equipment.setLastModifiedTimestamp(ts);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves Equipment by id
|
* Retrieves Equipment by id
|
||||||
* @param equipmentId
|
* @param equipmentId
|
||||||
@@ -263,8 +272,6 @@ public class EquipmentController {
|
|||||||
throw new DsDataValidationException("Equipment contains unsupported value");
|
throw new DsDataValidationException("Equipment contains unsupported value");
|
||||||
}
|
}
|
||||||
|
|
||||||
validateChannelNum(equipment);
|
|
||||||
|
|
||||||
Equipment existingEquipment = equipmentDatastore.getOrNull(equipment.getId());
|
Equipment existingEquipment = equipmentDatastore.getOrNull(equipment.getId());
|
||||||
ApElementConfiguration existingApElementConfig = null;
|
ApElementConfiguration existingApElementConfig = null;
|
||||||
if (existingEquipment != null && existingEquipment.getDetails() instanceof ApElementConfiguration) {
|
if (existingEquipment != null && existingEquipment.getDetails() instanceof ApElementConfiguration) {
|
||||||
@@ -280,9 +287,17 @@ public class EquipmentController {
|
|||||||
LOG.debug("Updated Equipment {}", ret);
|
LOG.debug("Updated Equipment {}", ret);
|
||||||
|
|
||||||
EquipmentChangedEvent event;
|
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))) {
|
updatedApElementConfig.needsToBeUpdatedOnDevice(existingApElementConfig))) {
|
||||||
event = new EquipmentApImpactingChangedEvent(ret);
|
event = new EquipmentApImpactingChangedEvent(ret);
|
||||||
|
} else if (existingApElementConfig != null && existingApElementConfig.isBlinkAllLEDs() != updatedApElementConfig.isBlinkAllLEDs()) {
|
||||||
|
LOG.debug("Updated BlinkingLEDs {}", ret);
|
||||||
|
event = new EquipmentBlinkLEDsEvent(ret);
|
||||||
} else {
|
} else {
|
||||||
event = new EquipmentChangedEvent(ret);
|
event = new EquipmentChangedEvent(ret);
|
||||||
}
|
}
|
||||||
@@ -291,40 +306,6 @@ public class EquipmentController {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void validateChannelNum(Equipment equipment) {
|
|
||||||
if (equipment.getDetails() instanceof ApElementConfiguration) {
|
|
||||||
ApElementConfiguration apElementConfiguration = (ApElementConfiguration) equipment.getDetails();
|
|
||||||
if (apElementConfiguration.getRadioMap() != null) {
|
|
||||||
for (RadioType radioType : apElementConfiguration.getRadioMap().keySet()) {
|
|
||||||
|
|
||||||
ElementRadioConfiguration elementRadioConfig = apElementConfiguration.getRadioMap().get(radioType);
|
|
||||||
Integer channelNum = elementRadioConfig.getChannelNumber();
|
|
||||||
Integer manualChannelNum = elementRadioConfig.getManualChannelNumber();
|
|
||||||
Integer backupChannelNum = elementRadioConfig.getBackupChannelNumber();
|
|
||||||
Integer manualBackupChannelNum = elementRadioConfig.getManualBackupChannelNumber();
|
|
||||||
|
|
||||||
List<Integer> allowedChannels = elementRadioConfig.getAllowedChannelsPowerLevels().stream().map(ChannelPowerLevel::getChannelNumber).collect(Collectors.toList());
|
|
||||||
|
|
||||||
if (allowedChannels != null && !allowedChannels.isEmpty()) {
|
|
||||||
checkAllowedChannels(channelNum, "channelNumber", allowedChannels);
|
|
||||||
checkAllowedChannels(backupChannelNum, "backupChannelNumber", allowedChannels);
|
|
||||||
checkAllowedChannels(manualChannelNum, "manualChannelNumber", allowedChannels);
|
|
||||||
checkAllowedChannels(manualBackupChannelNum, "manualBackupChannelNumber", allowedChannels);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void checkAllowedChannels(Integer channelNum, String channelType, List<Integer> allowedChannels) {
|
|
||||||
if (channelNum != null && !allowedChannels.contains(channelNum)) {
|
|
||||||
LOG.error("Failed to update Equipment. The {} ({}) is out of the allowed channels range {}",
|
|
||||||
channelType, channelNum, allowedChannels);
|
|
||||||
throw new DsDataValidationException("Equipment contains disallowed " + channelType);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates Equipment Channels
|
* Updates Equipment Channels
|
||||||
*
|
*
|
||||||
@@ -567,25 +548,13 @@ public class EquipmentController {
|
|||||||
Set<Long> equipmentIds = new HashSet<>();
|
Set<Long> equipmentIds = new HashSet<>();
|
||||||
request.getItems().forEach(item -> equipmentIds.add(item.getEquipmentId()));
|
request.getItems().forEach(item -> equipmentIds.add(item.getEquipmentId()));
|
||||||
|
|
||||||
//validate equipment before the bulk update
|
|
||||||
List<Equipment> equipmentBeforeUpdate = equipmentDatastore.get(equipmentIds);
|
|
||||||
Map<Long, Equipment> eqMap = new HashMap<>();
|
|
||||||
equipmentBeforeUpdate.forEach(eq -> eqMap.put(eq.getId(), eq));
|
|
||||||
|
|
||||||
request.getItems().forEach(item -> {
|
|
||||||
Equipment eq = eqMap.get(item.getEquipmentId());
|
|
||||||
if(item.applyToEquipment(eq)) {
|
|
||||||
validateChannelNum(eq);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
equipmentDatastore.updateRrmBulk(request);
|
equipmentDatastore.updateRrmBulk(request);
|
||||||
|
|
||||||
//send events after the bulk update
|
//send events after the bulk update
|
||||||
List<Equipment> equipmentAfterUpdate = equipmentDatastore.get(equipmentIds);
|
List<Equipment> equipmentAfterUpdate = equipmentDatastore.get(equipmentIds);
|
||||||
|
|
||||||
List<SystemEvent> events = new ArrayList<>();
|
List<SystemEvent> events = new ArrayList<>();
|
||||||
equipmentAfterUpdate.forEach(eq -> events.add(new EquipmentChangedEvent(eq)));
|
equipmentAfterUpdate.forEach(eq -> events.add(new EquipmentApImpactingChangedEvent(eq)));
|
||||||
publishEvents(events);
|
publishEvents(events);
|
||||||
|
|
||||||
return new GenericResponse(true, "");
|
return new GenericResponse(true, "");
|
||||||
|
|||||||
@@ -220,6 +220,8 @@ components:
|
|||||||
type: boolean
|
type: boolean
|
||||||
forwardMode:
|
forwardMode:
|
||||||
$ref: '#/components/schemas/NetworkForwardMode'
|
$ref: '#/components/schemas/NetworkForwardMode'
|
||||||
|
blinkAllLEDs:
|
||||||
|
type: boolean
|
||||||
radioMap:
|
radioMap:
|
||||||
$ref: '#/components/schemas/RadioMap'
|
$ref: '#/components/schemas/RadioMap'
|
||||||
advancedRadioMap:
|
advancedRadioMap:
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ import com.telecominfraproject.wlan.equipment.models.Equipment;
|
|||||||
EquipmentController.class,
|
EquipmentController.class,
|
||||||
CloudEventDispatcherEmpty.class,
|
CloudEventDispatcherEmpty.class,
|
||||||
EquipmentDatastoreInMemory.class,
|
EquipmentDatastoreInMemory.class,
|
||||||
EquipmentControllerTest.Config.class,
|
EquipmentControllerTest.Config.class
|
||||||
})
|
})
|
||||||
public class EquipmentControllerTest {
|
public class EquipmentControllerTest {
|
||||||
|
|
||||||
@@ -72,10 +72,32 @@ public class EquipmentControllerTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void assertEqualEquipments(
|
@Test
|
||||||
Equipment expected,
|
public void testEquipmentCRUD_ValidateSpaceInInputString() {
|
||||||
Equipment actual) {
|
|
||||||
|
|
||||||
|
//Create new Equipment - success
|
||||||
|
Equipment equipment = new Equipment();
|
||||||
|
equipment.setName(" nameAndInventoryIdWithTrailingSpaces ");
|
||||||
|
equipment.setInventoryId(" C4411EAA31F5 ");
|
||||||
|
equipment.setEquipmentType(EquipmentType.AP);
|
||||||
|
|
||||||
|
Equipment ret = equipmentController.create(equipment);
|
||||||
|
assertNotNull(ret);
|
||||||
|
|
||||||
|
ret = equipmentController.get(ret.getId());
|
||||||
|
assertEqualEquipments(equipment, ret);
|
||||||
|
|
||||||
|
ret = equipmentController.getOrNull(ret.getId());
|
||||||
|
assertEqualEquipments(equipment, ret);
|
||||||
|
|
||||||
|
assertNull(equipmentController.getOrNull(-1));
|
||||||
|
|
||||||
|
//Delete - success
|
||||||
|
equipmentController.delete(ret.getId());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertEqualEquipments(Equipment expected, Equipment actual) {
|
||||||
assertEquals(expected.getName(), actual.getName());
|
assertEquals(expected.getName(), actual.getName());
|
||||||
//TODO: add more fields to check here
|
//TODO: add more fields to check here
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -209,6 +209,7 @@ public class CustomerFirmwareTrackDAO extends BaseJdbcDao {
|
|||||||
return copy;
|
return copy;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(noRollbackFor = { EmptyResultDataAccessException.class })
|
||||||
public CustomerFirmwareTrackRecord getCustomerFirmwareTrackRecord(int customerId) {
|
public CustomerFirmwareTrackRecord getCustomerFirmwareTrackRecord(int customerId) {
|
||||||
CustomerFirmwareTrackRecord ret = null;
|
CustomerFirmwareTrackRecord ret = null;
|
||||||
try {
|
try {
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ public interface FirmwareServiceInterface {
|
|||||||
CustomerFirmwareTrackRecord updateCustomerFirmwareTrackRecord(CustomerFirmwareTrackRecord record);
|
CustomerFirmwareTrackRecord updateCustomerFirmwareTrackRecord(CustomerFirmwareTrackRecord record);
|
||||||
CustomerFirmwareTrackRecord deleteCustomerFirmwareTrackRecord(int customerId);
|
CustomerFirmwareTrackRecord deleteCustomerFirmwareTrackRecord(int customerId);
|
||||||
CustomerFirmwareTrackSettings getDefaultCustomerTrackSetting();
|
CustomerFirmwareTrackSettings getDefaultCustomerTrackSetting();
|
||||||
|
CustomerFirmwareTrackSettings updateDefaultCustomerTrackSetting(CustomerFirmwareTrackSettings defaultSettings);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param equipmentType
|
* @param equipmentType
|
||||||
|
|||||||
@@ -81,6 +81,9 @@ public class FirmwareServiceLocal implements FirmwareServiceInterface {
|
|||||||
public CustomerFirmwareTrackSettings getDefaultCustomerTrackSetting() {
|
public CustomerFirmwareTrackSettings getDefaultCustomerTrackSetting() {
|
||||||
return firmwareController.getDefaultCustomerTrackSetting();
|
return firmwareController.getDefaultCustomerTrackSetting();
|
||||||
}
|
}
|
||||||
|
public CustomerFirmwareTrackSettings updateDefaultCustomerTrackSetting(CustomerFirmwareTrackSettings defaultSettings) {
|
||||||
|
return firmwareController.updateDefaultCustomerTrackSetting(defaultSettings);
|
||||||
|
}
|
||||||
public CustomerFirmwareTrackRecord getCustomerFirmwareTrackRecord(int customerId) {
|
public CustomerFirmwareTrackRecord getCustomerFirmwareTrackRecord(int customerId) {
|
||||||
return firmwareController.getCustomerFirmwareTrackRecord(customerId);
|
return firmwareController.getCustomerFirmwareTrackRecord(customerId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -388,5 +388,22 @@ public class FirmwareServiceRemote extends BaseRemoteClient implements FirmwareS
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CustomerFirmwareTrackSettings updateDefaultCustomerTrackSetting(CustomerFirmwareTrackSettings defaultSettings) {
|
||||||
|
LOG.debug("calling updateDefaultCustomerTrackSetting {} ", defaultSettings);
|
||||||
|
|
||||||
|
HttpEntity<String> request = new HttpEntity<String>( defaultSettings.toString(), headers );
|
||||||
|
|
||||||
|
ResponseEntity<CustomerFirmwareTrackSettings> responseEntity = restTemplate.exchange(
|
||||||
|
getBaseUrl()
|
||||||
|
+"/customerTrack/default", HttpMethod.PUT, request,
|
||||||
|
CustomerFirmwareTrackSettings.class);
|
||||||
|
|
||||||
|
CustomerFirmwareTrackSettings ret = responseEntity.getBody();
|
||||||
|
|
||||||
|
LOG.debug("completed updateDefaultCustomerTrackSetting {} ", ret);
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import com.telecominfraproject.wlan.datastore.exceptions.DsConcurrentModificatio
|
|||||||
import com.telecominfraproject.wlan.datastore.exceptions.DsDuplicateEntityException;
|
import com.telecominfraproject.wlan.datastore.exceptions.DsDuplicateEntityException;
|
||||||
import com.telecominfraproject.wlan.datastore.exceptions.DsEntityNotFoundException;
|
import com.telecominfraproject.wlan.datastore.exceptions.DsEntityNotFoundException;
|
||||||
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackRecord;
|
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackRecord;
|
||||||
|
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackSettings;
|
||||||
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackSettings.TrackFlag;
|
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackSettings.TrackFlag;
|
||||||
import com.telecominfraproject.wlan.firmware.models.FirmwareTrackAssignmentDetails;
|
import com.telecominfraproject.wlan.firmware.models.FirmwareTrackAssignmentDetails;
|
||||||
import com.telecominfraproject.wlan.firmware.models.FirmwareTrackAssignmentRecord;
|
import com.telecominfraproject.wlan.firmware.models.FirmwareTrackAssignmentRecord;
|
||||||
@@ -277,6 +278,47 @@ public class FirmwareServiceRemoteTest extends BaseRemoteTest {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testCreateUpdateDefaultCustomerFirmwareTrackSettings() {
|
||||||
|
// test initialization
|
||||||
|
FirmwareTrackRecord ftr = new FirmwareTrackRecord();
|
||||||
|
ftr.setTrackName("DEFAULT");
|
||||||
|
ftr = remoteInterface.createFirmwareTrack(ftr);
|
||||||
|
CustomerFirmwareTrackSettings track1 = remoteInterface.getDefaultCustomerTrackSetting();
|
||||||
|
|
||||||
|
assertEquals(TrackFlag.NEVER, track1.getAutoUpgradeDeprecatedOnBind());
|
||||||
|
assertEquals(TrackFlag.NEVER, track1.getAutoUpgradeUnknownOnBind());
|
||||||
|
assertEquals(TrackFlag.NEVER, track1.getAutoUpgradeDeprecatedDuringMaintenance());
|
||||||
|
assertEquals(TrackFlag.NEVER, track1.getAutoUpgradeUnknownDuringMaintenance());
|
||||||
|
|
||||||
|
// test persistent save
|
||||||
|
CustomerFirmwareTrackRecord defaultCustomerSettings = remoteInterface.getCustomerFirmwareTrackRecord(0);
|
||||||
|
assertEquals(track1, defaultCustomerSettings.getSettings());
|
||||||
|
|
||||||
|
// test update
|
||||||
|
track1.setAutoUpgradeDeprecatedOnBind(TrackFlag.ALWAYS);
|
||||||
|
CustomerFirmwareTrackSettings track2 = remoteInterface.updateDefaultCustomerTrackSetting(track1);
|
||||||
|
|
||||||
|
assertEquals(TrackFlag.ALWAYS, track2.getAutoUpgradeDeprecatedOnBind());
|
||||||
|
assertEquals(TrackFlag.NEVER, track2.getAutoUpgradeUnknownOnBind());
|
||||||
|
assertEquals(TrackFlag.NEVER, track2.getAutoUpgradeDeprecatedDuringMaintenance());
|
||||||
|
assertEquals(TrackFlag.NEVER, track2.getAutoUpgradeUnknownDuringMaintenance());
|
||||||
|
|
||||||
|
defaultCustomerSettings = remoteInterface.getCustomerFirmwareTrackRecord(0);
|
||||||
|
assertEquals(track2, defaultCustomerSettings.getSettings());
|
||||||
|
|
||||||
|
// Delete test
|
||||||
|
remoteInterface.deleteCustomerFirmwareTrackRecord(0);
|
||||||
|
|
||||||
|
// test update initialization
|
||||||
|
CustomerFirmwareTrackSettings track3 = remoteInterface.updateDefaultCustomerTrackSetting(track2);
|
||||||
|
assertEquals(track3, track2);
|
||||||
|
|
||||||
|
// Clean up test
|
||||||
|
remoteInterface.deleteCustomerFirmwareTrackRecord(0);
|
||||||
|
remoteInterface.deleteFirmwareTrackRecord(ftr.getRecordId());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testCreateUpdateDeleteFirmwareTrackAssignment() {
|
public void testCreateUpdateDeleteFirmwareTrackAssignment() {
|
||||||
String firmwareTrackName = "testCreateUpdateDeleteFirmwareTrackAssignment1";
|
String firmwareTrackName = "testCreateUpdateDeleteFirmwareTrackAssignment1";
|
||||||
|
|||||||
@@ -2,8 +2,6 @@ package com.telecominfraproject.wlan.firmware.controller;
|
|||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -22,11 +20,11 @@ import com.telecominfraproject.wlan.datastore.exceptions.DsEntityNotFoundExcepti
|
|||||||
import com.telecominfraproject.wlan.firmware.datastore.FirmwareDatastore;
|
import com.telecominfraproject.wlan.firmware.datastore.FirmwareDatastore;
|
||||||
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackRecord;
|
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackRecord;
|
||||||
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackSettings;
|
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackSettings;
|
||||||
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackSettings.TrackFlag;
|
|
||||||
import com.telecominfraproject.wlan.firmware.models.FirmwareTrackAssignmentDetails;
|
import com.telecominfraproject.wlan.firmware.models.FirmwareTrackAssignmentDetails;
|
||||||
import com.telecominfraproject.wlan.firmware.models.FirmwareTrackAssignmentRecord;
|
import com.telecominfraproject.wlan.firmware.models.FirmwareTrackAssignmentRecord;
|
||||||
import com.telecominfraproject.wlan.firmware.models.FirmwareTrackRecord;
|
import com.telecominfraproject.wlan.firmware.models.FirmwareTrackRecord;
|
||||||
import com.telecominfraproject.wlan.firmware.models.FirmwareVersion;
|
import com.telecominfraproject.wlan.firmware.models.FirmwareVersion;
|
||||||
|
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackSettings.TrackFlag;
|
||||||
import com.telecominfraproject.wlan.systemevent.models.SystemEvent;
|
import com.telecominfraproject.wlan.systemevent.models.SystemEvent;
|
||||||
|
|
||||||
|
|
||||||
@@ -45,34 +43,10 @@ public class FirmwareController {
|
|||||||
@Autowired private CloudEventDispatcherInterface cloudEventDispatcher;
|
@Autowired private CloudEventDispatcherInterface cloudEventDispatcher;
|
||||||
@Autowired Environment environment;
|
@Autowired Environment environment;
|
||||||
|
|
||||||
CustomerFirmwareTrackSettings defaultCustomerTrackSettings;
|
|
||||||
|
|
||||||
@PostConstruct
|
|
||||||
private void postConstruct() {
|
|
||||||
defaultCustomerTrackSettings = new CustomerFirmwareTrackSettings();
|
|
||||||
defaultCustomerTrackSettings.setAutoUpgradeDeprecatedOnBind(environment
|
|
||||||
.getProperty("whizcontrol.autoupgrade.deprecated", TrackFlag.class, TrackFlag.NEVER));
|
|
||||||
defaultCustomerTrackSettings.setAutoUpgradeUnknownOnBind(environment
|
|
||||||
.getProperty("whizcontrol.autoupgrade.unknown", TrackFlag.class, TrackFlag.NEVER));
|
|
||||||
defaultCustomerTrackSettings.setAutoUpgradeDeprecatedDuringMaintenance(environment.getProperty(
|
|
||||||
"whizcontrol.maintenanceupgrade.deprecated", TrackFlag.class, TrackFlag.NEVER));
|
|
||||||
defaultCustomerTrackSettings.setAutoUpgradeUnknownDuringMaintenance(environment
|
|
||||||
.getProperty("whizcontrol.maintenanceupgrade.unknown", TrackFlag.class, TrackFlag.NEVER));
|
|
||||||
LOG.info("Default CustomerFirmwareTrackSettings: {}", defaultCustomerTrackSettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void publishEvent(SystemEvent event) {
|
|
||||||
if (event == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
cloudEventDispatcher.publishEvent(event);
|
|
||||||
} catch (Exception e) {
|
|
||||||
LOG.error("Failed to publish event : {}", event, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FirmwareVersion API
|
||||||
|
*/
|
||||||
@RequestMapping(value = "/version", method = RequestMethod.POST)
|
@RequestMapping(value = "/version", method = RequestMethod.POST)
|
||||||
public FirmwareVersion createFirmwareVersion(@RequestBody FirmwareVersion firmwareVersion) {
|
public FirmwareVersion createFirmwareVersion(@RequestBody FirmwareVersion firmwareVersion) {
|
||||||
|
|
||||||
@@ -149,6 +123,10 @@ public class FirmwareController {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FirmwareTrackRecord API
|
||||||
|
*/
|
||||||
@RequestMapping(value = "/track", method = RequestMethod.POST)
|
@RequestMapping(value = "/track", method = RequestMethod.POST)
|
||||||
public FirmwareTrackRecord createFirmwareTrack(@RequestBody FirmwareTrackRecord firmwareTrack) {
|
public FirmwareTrackRecord createFirmwareTrack(@RequestBody FirmwareTrackRecord firmwareTrack) {
|
||||||
LOG.debug("calling createFirmwareTrack({})", firmwareTrack);
|
LOG.debug("calling createFirmwareTrack({})", firmwareTrack);
|
||||||
@@ -194,6 +172,9 @@ public class FirmwareController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* FirmwareTrackAssignmentDetails API
|
||||||
|
*/
|
||||||
@RequestMapping(value = "/trackAssignment", method = RequestMethod.GET)
|
@RequestMapping(value = "/trackAssignment", method = RequestMethod.GET)
|
||||||
public List<FirmwareTrackAssignmentDetails> getFirmwareTrackAssignments (
|
public List<FirmwareTrackAssignmentDetails> getFirmwareTrackAssignments (
|
||||||
@RequestParam String firmwareTrackName) {
|
@RequestParam String firmwareTrackName) {
|
||||||
@@ -221,25 +202,43 @@ public class FirmwareController {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CustomerFirmwareTrackSettings API
|
||||||
|
*/
|
||||||
@RequestMapping(value = "/customerTrack/default", method = RequestMethod.GET)
|
@RequestMapping(value = "/customerTrack/default", method = RequestMethod.GET)
|
||||||
public CustomerFirmwareTrackSettings getDefaultCustomerTrackSetting() {
|
public CustomerFirmwareTrackSettings getDefaultCustomerTrackSetting() {
|
||||||
if (defaultCustomerTrackSettings == null) {
|
CustomerFirmwareTrackRecord defaultRecord = firmwareDatastore.getCustomerFirmwareTrackRecord(0);
|
||||||
if (defaultCustomerTrackSettings == null) {
|
if (defaultRecord == null) {
|
||||||
defaultCustomerTrackSettings = new CustomerFirmwareTrackSettings();
|
LOG.debug("No default record exists, creating the default");
|
||||||
defaultCustomerTrackSettings.setAutoUpgradeDeprecatedOnBind(environment
|
defaultRecord = new CustomerFirmwareTrackRecord();
|
||||||
.getProperty("whizcontrol.autoupgrade.deprecated", TrackFlag.class, TrackFlag.NEVER));
|
defaultRecord.setCustomerId(0);
|
||||||
defaultCustomerTrackSettings.setAutoUpgradeUnknownOnBind(environment
|
CustomerFirmwareTrackSettings defaultSettings = new CustomerFirmwareTrackSettings();
|
||||||
.getProperty("whizcontrol.autoupgrade.unknown", TrackFlag.class, TrackFlag.NEVER));
|
defaultSettings.setAutoUpgradeDeprecatedOnBind(TrackFlag.NEVER);
|
||||||
defaultCustomerTrackSettings.setAutoUpgradeDeprecatedDuringMaintenance(environment.getProperty(
|
defaultSettings.setAutoUpgradeUnknownOnBind(TrackFlag.NEVER);
|
||||||
"whizcontrol.maintenanceupgrade.deprecated", TrackFlag.class, TrackFlag.NEVER));
|
defaultSettings.setAutoUpgradeDeprecatedDuringMaintenance(TrackFlag.NEVER);
|
||||||
defaultCustomerTrackSettings.setAutoUpgradeUnknownDuringMaintenance(environment
|
defaultSettings.setAutoUpgradeUnknownDuringMaintenance(TrackFlag.NEVER);
|
||||||
.getProperty("whizcontrol.maintenanceupgrade.unknown", TrackFlag.class, TrackFlag.NEVER));
|
|
||||||
LOG.info("Default CustomerFirmwareTrackSettings: {}", defaultCustomerTrackSettings);
|
defaultRecord.setSettings(defaultSettings);
|
||||||
|
defaultRecord.setTrackRecordId(firmwareDatastore.getFirmwareTrackByName("DEFAULT").getRecordId());
|
||||||
|
defaultRecord = firmwareDatastore.createCustomerFirmwareTrackRecord(defaultRecord);
|
||||||
}
|
}
|
||||||
}
|
return defaultRecord.getSettings();
|
||||||
return defaultCustomerTrackSettings;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/customerTrack/default", method = RequestMethod.PUT)
|
||||||
|
public CustomerFirmwareTrackSettings updateDefaultCustomerTrackSetting(@RequestBody CustomerFirmwareTrackSettings customerTrackSettings) {
|
||||||
|
CustomerFirmwareTrackRecord defaultRecord = firmwareDatastore.getCustomerFirmwareTrackRecord(0);
|
||||||
|
if (defaultRecord == null) {
|
||||||
|
defaultRecord = new CustomerFirmwareTrackRecord();
|
||||||
|
defaultRecord.setCustomerId(0);
|
||||||
|
defaultRecord.setSettings(customerTrackSettings);
|
||||||
|
defaultRecord.setTrackRecordId(firmwareDatastore.getFirmwareTrackByName("DEFAULT").getRecordId());
|
||||||
|
return firmwareDatastore.createCustomerFirmwareTrackRecord(defaultRecord).getSettings();
|
||||||
|
}
|
||||||
|
defaultRecord.setSettings(customerTrackSettings);
|
||||||
|
return firmwareDatastore.updateCustomerFirmwareTrackRecord(defaultRecord).getSettings();
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/customerTrack", method = RequestMethod.GET)
|
@RequestMapping(value = "/customerTrack", method = RequestMethod.GET)
|
||||||
public CustomerFirmwareTrackRecord getCustomerFirmwareTrackRecord(@RequestParam int customerId) {
|
public CustomerFirmwareTrackRecord getCustomerFirmwareTrackRecord(@RequestParam int customerId) {
|
||||||
@@ -247,7 +246,6 @@ public class FirmwareController {
|
|||||||
return firmwareDatastore.getCustomerFirmwareTrackRecord(customerId);
|
return firmwareDatastore.getCustomerFirmwareTrackRecord(customerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = "/customerTrack", method = RequestMethod.POST)
|
@RequestMapping(value = "/customerTrack", method = RequestMethod.POST)
|
||||||
public CustomerFirmwareTrackRecord createCustomerFirmwareTrackRecord(@RequestBody CustomerFirmwareTrackRecord customerTrack) {
|
public CustomerFirmwareTrackRecord createCustomerFirmwareTrackRecord(@RequestBody CustomerFirmwareTrackRecord customerTrack) {
|
||||||
LOG.debug("calling createCustomerFirmwareTrackRecord({})", customerTrack);
|
LOG.debug("calling createCustomerFirmwareTrackRecord({})", customerTrack);
|
||||||
@@ -255,7 +253,6 @@ public class FirmwareController {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = "/customerTrack", method = RequestMethod.PUT)
|
@RequestMapping(value = "/customerTrack", method = RequestMethod.PUT)
|
||||||
public CustomerFirmwareTrackRecord updateCustomerFirmwareTrackRecord(@RequestBody CustomerFirmwareTrackRecord customerTrack) {
|
public CustomerFirmwareTrackRecord updateCustomerFirmwareTrackRecord(@RequestBody CustomerFirmwareTrackRecord customerTrack) {
|
||||||
LOG.debug("calling updateCustomerFirmwareTrackRecord({})", customerTrack);
|
LOG.debug("calling updateCustomerFirmwareTrackRecord({})", customerTrack);
|
||||||
@@ -271,8 +268,6 @@ public class FirmwareController {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value = "/customerTrack", method = RequestMethod.DELETE)
|
@RequestMapping(value = "/customerTrack", method = RequestMethod.DELETE)
|
||||||
public CustomerFirmwareTrackRecord deleteCustomerFirmwareTrackRecord(@RequestParam int customerId) {
|
public CustomerFirmwareTrackRecord deleteCustomerFirmwareTrackRecord(@RequestParam int customerId) {
|
||||||
LOG.debug("calling deleteCustomerFirmwareTrackRecord({})", customerId);
|
LOG.debug("calling deleteCustomerFirmwareTrackRecord({})", customerId);
|
||||||
@@ -280,5 +275,16 @@ public class FirmwareController {
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void publishEvent(SystemEvent event) {
|
||||||
|
if (event == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
cloudEventDispatcher.publishEvent(event);
|
||||||
|
} catch (Exception e) {
|
||||||
|
LOG.error("Failed to publish event : {}", event, e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -619,11 +619,12 @@ paths:
|
|||||||
$ref: '#/components/schemas/FirmwareTrackAssignmentDetails'
|
$ref: '#/components/schemas/FirmwareTrackAssignmentDetails'
|
||||||
500:
|
500:
|
||||||
$ref: '#/components/responses/GenericApiError'
|
$ref: '#/components/responses/GenericApiError'
|
||||||
|
|
||||||
/api/firmware/customerTrack/default:
|
/api/firmware/customerTrack/default:
|
||||||
get:
|
get:
|
||||||
tags:
|
tags:
|
||||||
- Firmware Data
|
- Firmware Data
|
||||||
summary: Get customer firmware track settings
|
summary: Get customer firmware track settings, if it doesn't exist, create it
|
||||||
operationId: getCustomerFirmwareTrackSettings
|
operationId: getCustomerFirmwareTrackSettings
|
||||||
responses:
|
responses:
|
||||||
200:
|
200:
|
||||||
@@ -634,6 +635,27 @@ paths:
|
|||||||
$ref: '#/components/schemas/CustomerFirmwareTrackSettings'
|
$ref: '#/components/schemas/CustomerFirmwareTrackSettings'
|
||||||
500:
|
500:
|
||||||
$ref: '#/components/responses/GenericApiError'
|
$ref: '#/components/responses/GenericApiError'
|
||||||
|
put:
|
||||||
|
tags:
|
||||||
|
- Firmware Data
|
||||||
|
summary: Update customer firmware track settings, if it doesn't exist, create it
|
||||||
|
operationId: updateCustomerFirmwareTrackSettings
|
||||||
|
requestBody:
|
||||||
|
description: CustomerFirmwareTrackSettings
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/CustomerFirmwareTrackSettings'
|
||||||
|
responses:
|
||||||
|
200:
|
||||||
|
description: Successful operation
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
$ref: '#/components/schemas/CustomerFirmwareTrackSettings'
|
||||||
|
500:
|
||||||
|
$ref: '#/components/responses/GenericApiError'
|
||||||
|
|
||||||
/api/firmware/customerTrack:
|
/api/firmware/customerTrack:
|
||||||
post:
|
post:
|
||||||
|
|||||||
@@ -1,30 +0,0 @@
|
|||||||
package com.telecominfraproject.wlan.location.models.events;
|
|
||||||
|
|
||||||
import com.telecominfraproject.wlan.core.model.json.interfaces.HasLocationId;
|
|
||||||
import com.telecominfraproject.wlan.location.models.Location;
|
|
||||||
import com.telecominfraproject.wlan.systemevent.models.CustomerEventWithPayload;
|
|
||||||
|
|
||||||
public class LocationChangedApImpactingEvent extends CustomerEventWithPayload<Location> implements HasLocationId {
|
|
||||||
private static final long serialVersionUID = -8369849230866347412L;
|
|
||||||
|
|
||||||
public LocationChangedApImpactingEvent(Location location){
|
|
||||||
super(location.getCustomerId(), location);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public long getLocationId() {
|
|
||||||
if (getPayload() != null) {
|
|
||||||
return getPayload().getId();
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor used by JSON
|
|
||||||
*/
|
|
||||||
public LocationChangedApImpactingEvent() {
|
|
||||||
super(0, 0, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -80,7 +80,7 @@ public class LocationServiceRemoteTest extends BaseRemoteTest {
|
|||||||
location.setLocationType(LocationType.FLOOR);
|
location.setLocationType(LocationType.FLOOR);
|
||||||
location.setCustomerId(getNextCustomerId());
|
location.setCustomerId(getNextCustomerId());
|
||||||
location.setName("testName_updated");
|
location.setName("testName_updated");
|
||||||
location.setDetails(generateDetails(CountryCode.US));
|
location.setDetails(generateDetails(CountryCode.CA));
|
||||||
|
|
||||||
Location retFromUpdate = testInterface.update(location);
|
Location retFromUpdate = testInterface.update(location);
|
||||||
assertFieldEquals(location, retFromUpdate);
|
assertFieldEquals(location, retFromUpdate);
|
||||||
@@ -95,6 +95,14 @@ public class LocationServiceRemoteTest extends BaseRemoteTest {
|
|||||||
// expected it
|
// expected it
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//UPDATE test - fail because country code cannot be modified once created
|
||||||
|
try {
|
||||||
|
location.setDetails(generateDetails(CountryCode.US));
|
||||||
|
testInterface.update(location);
|
||||||
|
fail("failed to detect country code update");
|
||||||
|
} catch (IllegalStateException e) {
|
||||||
|
// expected it
|
||||||
|
}
|
||||||
|
|
||||||
//DELETE Test
|
//DELETE Test
|
||||||
testInterface.delete(ret.getId());
|
testInterface.delete(ret.getId());
|
||||||
|
|||||||
@@ -25,7 +25,6 @@ import com.telecominfraproject.wlan.datastore.exceptions.DsEntityNotFoundExcepti
|
|||||||
import com.telecominfraproject.wlan.location.datastore.LocationDatastore;
|
import com.telecominfraproject.wlan.location.datastore.LocationDatastore;
|
||||||
import com.telecominfraproject.wlan.location.models.Location;
|
import com.telecominfraproject.wlan.location.models.Location;
|
||||||
import com.telecominfraproject.wlan.location.models.events.LocationAddedEvent;
|
import com.telecominfraproject.wlan.location.models.events.LocationAddedEvent;
|
||||||
import com.telecominfraproject.wlan.location.models.events.LocationChangedApImpactingEvent;
|
|
||||||
import com.telecominfraproject.wlan.location.models.events.LocationChangedEvent;
|
import com.telecominfraproject.wlan.location.models.events.LocationChangedEvent;
|
||||||
import com.telecominfraproject.wlan.location.models.events.LocationRemovedEvent;
|
import com.telecominfraproject.wlan.location.models.events.LocationRemovedEvent;
|
||||||
import com.telecominfraproject.wlan.systemevent.models.SystemEvent;
|
import com.telecominfraproject.wlan.systemevent.models.SystemEvent;
|
||||||
@@ -98,13 +97,14 @@ public class LocationServiceController {
|
|||||||
|
|
||||||
Location existingLocation = locationDatastore.get(location.getId());
|
Location existingLocation = locationDatastore.get(location.getId());
|
||||||
|
|
||||||
|
if (location.needsToBeUpdatedOnDevice(existingLocation)) {
|
||||||
|
throw new IllegalStateException("Cannot update location. Country code is not allow to modify once created.");
|
||||||
|
}
|
||||||
|
|
||||||
Location ret = locationDatastore.update(location);
|
Location ret = locationDatastore.update(location);
|
||||||
|
|
||||||
List<SystemEvent> events = new ArrayList<>();
|
List<SystemEvent> events = new ArrayList<>();
|
||||||
|
|
||||||
if (ret.needsToBeUpdatedOnDevice(existingLocation)) {
|
|
||||||
events.add(new LocationChangedApImpactingEvent(ret));
|
|
||||||
}
|
|
||||||
events.add(new LocationChangedEvent(ret));
|
events.add(new LocationChangedEvent(ret));
|
||||||
|
|
||||||
publishEvents(events);
|
publishEvents(events);
|
||||||
|
|||||||
@@ -48,11 +48,12 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
|||||||
* To test this method:
|
* 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/
|
* 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 inventoryId: Equipment's AssetId
|
||||||
* @param connectToPortOnEquipment
|
* @param connectToPortOnEquipment: Port to connect on the AP
|
||||||
* @return session id of a newly created forwarder session
|
* @return session id of a newly created forwarder session
|
||||||
*/
|
*/
|
||||||
public String startForwarderSession(final String inventoryId, int connectToPortOnEquipment){
|
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
|
//inventoryId is used to tie ForwarderSession to WebSocketSession
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -191,7 +192,7 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
|||||||
LOG.debug("[{}] Stopped polling inputstream on local socket {}", inventoryId, localSocket.getPort());
|
LOG.debug("[{}] Stopped polling inputstream on local socket {}", inventoryId, localSocket.getPort());
|
||||||
|
|
||||||
} catch (IOException e) {
|
} 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 {
|
} finally {
|
||||||
|
|
||||||
//notify the other end that forwarding session is terminated
|
//notify the other end that forwarding session is terminated
|
||||||
@@ -209,7 +210,7 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
|||||||
localSocket.close();
|
localSocket.close();
|
||||||
forwarderSession.getServerSocket().close();
|
forwarderSession.getServerSocket().close();
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
//do nothing here
|
LOG.error("IO Exception when closing socket", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
sessionIdToForwarderSessionMap.remove(forwarderSession.getSessionId());
|
sessionIdToForwarderSessionMap.remove(forwarderSession.getSessionId());
|
||||||
@@ -232,12 +233,12 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
|||||||
socketInputStreamReaderThread.setDaemon(true);
|
socketInputStreamReaderThread.setDaemon(true);
|
||||||
forwarderSession.setSocketStreamReaderThread(socketInputStreamReaderThread);
|
forwarderSession.setSocketStreamReaderThread(socketInputStreamReaderThread);
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (Exception e) {
|
||||||
LOG.error("[{}] error accepting conection on port {} - closing forwarding session {}", inventoryId, listenOnLocalPort, forwarderSession.getSessionId());
|
LOG.error("[{}] error accepting connection on port {} - closing forwarding session {}", inventoryId, listenOnLocalPort, forwarderSession.getSessionId(), e);
|
||||||
try {
|
try {
|
||||||
serverSocket.close();
|
serverSocket.close();
|
||||||
} catch (IOException e1) {
|
} catch (IOException e1) {
|
||||||
// do nothing here
|
LOG.error("IO Exception when closing socket", e1);
|
||||||
}
|
}
|
||||||
sessionIdToForwarderSessionMap.remove(forwarderSession.getSessionId());
|
sessionIdToForwarderSessionMap.remove(forwarderSession.getSessionId());
|
||||||
}
|
}
|
||||||
@@ -259,6 +260,7 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void stopForwarderSession(String sessionId){
|
public void stopForwarderSession(String sessionId){
|
||||||
|
LOG.debug("Received stop forwarding Session request for sessionId {}", sessionId);
|
||||||
ForwarderSession forwarderSession = sessionIdToForwarderSessionMap.get(sessionId);
|
ForwarderSession forwarderSession = sessionIdToForwarderSessionMap.get(sessionId);
|
||||||
if(forwarderSession==null){
|
if(forwarderSession==null){
|
||||||
LOG.info("Could not find session {}", sessionId);
|
LOG.info("Could not find session {}", sessionId);
|
||||||
@@ -266,6 +268,7 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
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
|
//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());
|
WebSocketSession webSocketSession = webSocketSessionMap.get(forwarderSession.getInventoryId());
|
||||||
TextMessage message = new TextMessage(DISCONNECT_FROM_CE_PORT_COMMAND + forwarderSession.getConnectToPortOnEquipment());
|
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());
|
LOG.debug("[{}] Session {} sent command {}", forwarderSession.getInventoryId(), forwarderSession.getSessionId(), message.getPayload());
|
||||||
}
|
}
|
||||||
|
|
||||||
if(forwarderSession.getServerSocket()!=null){
|
if(forwarderSession.getServerSocket() != null){
|
||||||
forwarderSession.getServerSocket().close();
|
forwarderSession.getServerSocket().close();
|
||||||
}
|
}
|
||||||
|
|
||||||
if(forwarderSession.getLocalSocket()!=null){
|
if(forwarderSession.getLocalSocket() != null){
|
||||||
forwarderSession.getLocalSocket().close();
|
forwarderSession.getLocalSocket().close();
|
||||||
}
|
}
|
||||||
//stream reader will stop in a separate thread by themselves
|
//stream reader will stop in a separate thread by themselves
|
||||||
@@ -286,10 +289,9 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
|||||||
sessionIdToForwarderSessionMap.remove(forwarderSession.getSessionId());
|
sessionIdToForwarderSessionMap.remove(forwarderSession.getSessionId());
|
||||||
|
|
||||||
} catch (IOException e) {
|
} 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);
|
LOG.info("[{}] Stopped forwarder session {}", forwarderSession.getInventoryId(), sessionId);
|
||||||
}
|
}
|
||||||
@@ -322,7 +324,6 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
|||||||
if(payload.indexOf(':')>0){
|
if(payload.indexOf(':')>0){
|
||||||
port = Integer.parseInt(payload.substring(payload.indexOf(':')+1));
|
port = Integer.parseInt(payload.substring(payload.indexOf(':')+1));
|
||||||
}
|
}
|
||||||
|
|
||||||
//find forwarderSession by inventoryId and CEPort
|
//find forwarderSession by inventoryId and CEPort
|
||||||
ForwarderSession forwarderSession = null;
|
ForwarderSession forwarderSession = null;
|
||||||
for(ForwarderSession fs: sessionIdToForwarderSessionMap.values()){
|
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)){
|
if(payload.startsWith(CONNECTED_TO_CE_PORT_MSG)){
|
||||||
//start reader thread to forward packets from local socket to websocket
|
//start reader thread to forward packets from local socket to websocket
|
||||||
@@ -371,10 +372,8 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected void handleBinaryMessage(WebSocketSession session, BinaryMessage message) throws Exception {
|
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
|
//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
|
//DT: this has not been an issue so far
|
||||||
|
|
||||||
String webSocketSessionKey = getWebSocketSessionKey(session);
|
String webSocketSessionKey = getWebSocketSessionKey(session);
|
||||||
|
|
||||||
ByteBuffer payload = message.getPayload();
|
ByteBuffer payload = message.getPayload();
|
||||||
@@ -384,6 +383,7 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
|||||||
|
|
||||||
//find forwarderSession by inventoryId and CEPort
|
//find forwarderSession by inventoryId and CEPort
|
||||||
ForwarderSession forwarderSession = null;
|
ForwarderSession forwarderSession = null;
|
||||||
|
|
||||||
for(ForwarderSession fs: sessionIdToForwarderSessionMap.values()){
|
for(ForwarderSession fs: sessionIdToForwarderSessionMap.values()){
|
||||||
if(fs.getInventoryId().equals(webSocketSessionKey) && fs.getConnectToPortOnEquipment()==port){
|
if(fs.getInventoryId().equals(webSocketSessionKey) && fs.getConnectToPortOnEquipment()==port){
|
||||||
forwarderSession = fs;
|
forwarderSession = fs;
|
||||||
@@ -419,6 +419,14 @@ public class PortForwarderWebSocketHandler extends AbstractWebSocketHandler {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
LOG.debug("[{}] Session {} received message that cannot be delivered because local socket is inoperable {}", webSocketSessionKey, session, message);
|
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
|
@Override
|
||||||
public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) throws Exception {
|
public void afterConnectionClosed(WebSocketSession session, CloseStatus closeStatus) {
|
||||||
LOG.info("[{}] Closed portForwarder websocket connection {} : {}", getWebSocketSessionKey(session), session, closeStatus);
|
|
||||||
|
|
||||||
String webSocketSessionKey = getWebSocketSessionKey(session);
|
String webSocketSessionKey = getWebSocketSessionKey(session);
|
||||||
|
LOG.info("[{}] Closed portForwarder websocket connection {} : {}", webSocketSessionKey, session, closeStatus);
|
||||||
|
|
||||||
webSocketSessionMap.remove(webSocketSessionKey);
|
webSocketSessionMap.remove(webSocketSessionKey);
|
||||||
|
|
||||||
//close and remove all forwarder sessions for that CE
|
//close and remove all forwarder sessions for that CE
|
||||||
|
try {
|
||||||
Iterator<ForwarderSession> iter = sessionIdToForwarderSessionMap.values().iterator();
|
Iterator<ForwarderSession> iter = sessionIdToForwarderSessionMap.values().iterator();
|
||||||
while(iter.hasNext()){
|
while (iter.hasNext()) {
|
||||||
ForwarderSession fs = iter.next();
|
ForwarderSession fs = iter.next();
|
||||||
if(fs.getInventoryId().equals(webSocketSessionKey) ){
|
if (fs.getInventoryId().equals(webSocketSessionKey)) {
|
||||||
if(fs.getLocalSocket()!=null && !fs.getLocalSocket().isClosed()){
|
if (fs.getLocalSocket() != null && !fs.getLocalSocket().isClosed()) {
|
||||||
fs.getLocalSocket().close();
|
fs.getLocalSocket().close();
|
||||||
}
|
}
|
||||||
if(fs.getServerSocket()!=null && !fs.getServerSocket().isClosed()){
|
if (fs.getServerSocket() != null && !fs.getServerSocket().isClosed()) {
|
||||||
fs.getServerSocket().close();
|
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) {
|
private String getWebSocketSessionKey(WebSocketSession session) {
|
||||||
|
|||||||
@@ -161,8 +161,42 @@
|
|||||||
<version>1.2.0-SNAPSHOT</version>
|
<version>1.2.0-SNAPSHOT</version>
|
||||||
<scope>test</scope>
|
<scope>test</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<artifactId>location-service-local</artifactId>
|
||||||
|
<groupId>com.telecominfraproject.wlan</groupId>
|
||||||
|
<version>1.2.0-SNAPSHOT</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<artifactId>location-datastore-inmemory</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>alarm-datastore-inmemory</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>status-datastore-inmemory</artifactId>
|
||||||
|
<groupId>com.telecominfraproject.wlan</groupId>
|
||||||
|
<version>1.2.0-SNAPSHOT</version>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import java.util.HashMap;
|
|||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -27,8 +29,10 @@ import com.telecominfraproject.wlan.core.model.pagination.PaginationContext;
|
|||||||
import com.telecominfraproject.wlan.core.model.pagination.PaginationResponse;
|
import com.telecominfraproject.wlan.core.model.pagination.PaginationResponse;
|
||||||
import com.telecominfraproject.wlan.core.model.pair.PairLongLong;
|
import com.telecominfraproject.wlan.core.model.pair.PairLongLong;
|
||||||
import com.telecominfraproject.wlan.datastore.exceptions.DsConcurrentModificationException;
|
import com.telecominfraproject.wlan.datastore.exceptions.DsConcurrentModificationException;
|
||||||
|
import com.telecominfraproject.wlan.datastore.exceptions.DsDataValidationException;
|
||||||
import com.telecominfraproject.wlan.equipment.EquipmentServiceInterface;
|
import com.telecominfraproject.wlan.equipment.EquipmentServiceInterface;
|
||||||
import com.telecominfraproject.wlan.equipment.models.ApElementConfiguration;
|
import com.telecominfraproject.wlan.equipment.models.ApElementConfiguration;
|
||||||
|
import com.telecominfraproject.wlan.equipment.models.ChannelPowerLevel;
|
||||||
import com.telecominfraproject.wlan.equipment.models.ElementRadioConfiguration;
|
import com.telecominfraproject.wlan.equipment.models.ElementRadioConfiguration;
|
||||||
import com.telecominfraproject.wlan.equipment.models.Equipment;
|
import com.telecominfraproject.wlan.equipment.models.Equipment;
|
||||||
import com.telecominfraproject.wlan.equipment.models.EquipmentCellSizeAttributesUpdateRequest;
|
import com.telecominfraproject.wlan.equipment.models.EquipmentCellSizeAttributesUpdateRequest;
|
||||||
@@ -36,7 +40,9 @@ import com.telecominfraproject.wlan.equipment.models.EquipmentChannelsUpdateRequ
|
|||||||
import com.telecominfraproject.wlan.equipment.models.EquipmentDetails;
|
import com.telecominfraproject.wlan.equipment.models.EquipmentDetails;
|
||||||
import com.telecominfraproject.wlan.equipment.models.RadioConfiguration;
|
import com.telecominfraproject.wlan.equipment.models.RadioConfiguration;
|
||||||
import com.telecominfraproject.wlan.equipment.models.bulkupdate.rrm.EquipmentRrmBulkUpdateRequest;
|
import com.telecominfraproject.wlan.equipment.models.bulkupdate.rrm.EquipmentRrmBulkUpdateRequest;
|
||||||
|
import com.telecominfraproject.wlan.location.service.LocationServiceInterface;
|
||||||
import com.telecominfraproject.wlan.profile.ProfileServiceInterface;
|
import com.telecominfraproject.wlan.profile.ProfileServiceInterface;
|
||||||
|
import com.telecominfraproject.wlan.location.models.Location;
|
||||||
import com.telecominfraproject.wlan.status.StatusServiceInterface;
|
import com.telecominfraproject.wlan.status.StatusServiceInterface;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -49,6 +55,9 @@ public class EquipmentPortalController {
|
|||||||
|
|
||||||
private static final Logger LOG = LoggerFactory.getLogger(EquipmentPortalController.class);
|
private static final Logger LOG = LoggerFactory.getLogger(EquipmentPortalController.class);
|
||||||
|
|
||||||
|
public static enum CHANNEL_NUMBER_TYPE {channelNumber, backupChannelNumber, manualChannelNumber,
|
||||||
|
manualBackupChannelNumber};
|
||||||
|
|
||||||
@Value("${tip.wlan.portal.equipment.numRetryUpdate:10}")
|
@Value("${tip.wlan.portal.equipment.numRetryUpdate:10}")
|
||||||
private int numRetryUpdate;
|
private int numRetryUpdate;
|
||||||
|
|
||||||
@@ -72,6 +81,9 @@ public class EquipmentPortalController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ProfileServiceInterface profileServiceInterface;
|
private ProfileServiceInterface profileServiceInterface;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private LocationServiceInterface locationServiceInterface;
|
||||||
|
|
||||||
@RequestMapping(value = "/equipment", method = RequestMethod.GET)
|
@RequestMapping(value = "/equipment", method = RequestMethod.GET)
|
||||||
public Equipment getEquipment(@RequestParam long equipmentId) {
|
public Equipment getEquipment(@RequestParam long equipmentId) {
|
||||||
LOG.debug("Getting equipment {}", equipmentId);
|
LOG.debug("Getting equipment {}", equipmentId);
|
||||||
@@ -86,14 +98,25 @@ public class EquipmentPortalController {
|
|||||||
LOG.debug("Updating equipment {}", equipment.getId());
|
LOG.debug("Updating equipment {}", equipment.getId());
|
||||||
|
|
||||||
Equipment ret = null;
|
Equipment ret = null;
|
||||||
|
Equipment existing = equipmentServiceInterface.getOrNull(equipment.getId());
|
||||||
|
|
||||||
for(int i=0; i<numRetryUpdate; i++) {
|
for(int i=0; i<numRetryUpdate; i++) {
|
||||||
try {
|
try {
|
||||||
|
if (equipment != null && existing != null && equipment.getLocationId() != existing.getLocationId()) {
|
||||||
|
Location location = locationServiceInterface.get(equipment.getLocationId());
|
||||||
|
Location existingLocation = locationServiceInterface.get(existing.getLocationId());
|
||||||
|
|
||||||
|
if (!Objects.equals(Location.getCountryCode(location), Location.getCountryCode(existingLocation))) {
|
||||||
|
updateEquipmentWithDefaultChannels(equipment);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
validateChannelNum(equipment);
|
||||||
|
|
||||||
ret = equipmentServiceInterface.update(equipment);
|
ret = equipmentServiceInterface.update(equipment);
|
||||||
break;
|
break;
|
||||||
} catch (DsConcurrentModificationException e) {
|
} catch (DsConcurrentModificationException e) {
|
||||||
LOG.debug("Equipment was concurrently updated, retrying: {}", e.getMessage());
|
LOG.debug("Equipment was concurrently updated, retrying: {}", e.getMessage());
|
||||||
Equipment existing = equipmentServiceInterface.getOrNull(equipment.getId());
|
existing = equipmentServiceInterface.getOrNull(equipment.getId());
|
||||||
equipment.setLastModifiedTimestamp(existing.getLastModifiedTimestamp());
|
equipment.setLastModifiedTimestamp(existing.getLastModifiedTimestamp());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -105,9 +128,115 @@ public class EquipmentPortalController {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateEquipmentWithDefaultChannels(Equipment equipment) {
|
||||||
|
if (equipment.getDetails() instanceof ApElementConfiguration) {
|
||||||
|
ApElementConfiguration apElementConfiguration = (ApElementConfiguration) equipment.getDetails();
|
||||||
|
if (apElementConfiguration.getRadioMap() != null) {
|
||||||
|
|
||||||
|
for (RadioType radioType : apElementConfiguration.getRadioMap().keySet()) {
|
||||||
|
ElementRadioConfiguration elementRadioConfig = apElementConfiguration.getRadioMap().get(radioType);
|
||||||
|
|
||||||
|
elementRadioConfig.setChannelNumber(ElementRadioConfiguration.getDefaultChannelNumber(radioType));
|
||||||
|
elementRadioConfig.setBackupChannelNumber(ElementRadioConfiguration.getDefaultBackupChannelNumber(radioType));
|
||||||
|
elementRadioConfig.setManualChannelNumber(ElementRadioConfiguration.getDefaultChannelNumber(radioType));
|
||||||
|
elementRadioConfig.setManualBackupChannelNumber(ElementRadioConfiguration.getDefaultBackupChannelNumber(radioType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void validateChannelNum(Equipment equipment) {
|
||||||
|
if (equipment != null && equipment.getDetails() instanceof ApElementConfiguration) {
|
||||||
|
ApElementConfiguration apElementConfiguration = (ApElementConfiguration) equipment.getDetails();
|
||||||
|
if (apElementConfiguration.getRadioMap() != null) {
|
||||||
|
|
||||||
|
for (RadioType radioType : apElementConfiguration.getRadioMap().keySet()) {
|
||||||
|
ElementRadioConfiguration elementRadioConfig = apElementConfiguration.getRadioMap().get(radioType);
|
||||||
|
List<Integer> allowedChannels = elementRadioConfig.getAllowedChannelsPowerLevels().stream().map(
|
||||||
|
ChannelPowerLevel::getChannelNumber).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (allowedChannels != null && !allowedChannels.isEmpty()) {
|
||||||
|
for (CHANNEL_NUMBER_TYPE channelType : CHANNEL_NUMBER_TYPE.values()) {
|
||||||
|
checkAllowedChannels(equipment.getId(), elementRadioConfig, channelType, allowedChannels, radioType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Integer getChannelNumber( ElementRadioConfiguration elementRadioConfig, CHANNEL_NUMBER_TYPE channelType) {
|
||||||
|
Integer channelNum = null;
|
||||||
|
|
||||||
|
switch (channelType) {
|
||||||
|
case channelNumber: {
|
||||||
|
channelNum = elementRadioConfig.getChannelNumber();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case backupChannelNumber: {
|
||||||
|
channelNum = elementRadioConfig.getBackupChannelNumber();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case manualChannelNumber: {
|
||||||
|
channelNum = elementRadioConfig.getManualChannelNumber();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case manualBackupChannelNumber: {
|
||||||
|
channelNum = elementRadioConfig.getManualBackupChannelNumber();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return channelNum;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkAllowedChannels(long equipmentId, ElementRadioConfiguration elementRadioConfig, CHANNEL_NUMBER_TYPE channelType,
|
||||||
|
List<Integer> allowedChannels, RadioType radioType) {
|
||||||
|
Integer channelNum = getChannelNumber(elementRadioConfig, channelType);
|
||||||
|
|
||||||
|
checkAllowedChannels(equipmentId, channelNum, channelType, allowedChannels, radioType);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void checkAllowedChannels(long equipmentId, Integer channelNum, CHANNEL_NUMBER_TYPE channelType,
|
||||||
|
List<Integer> allowedChannels, RadioType radioType) {
|
||||||
|
if (channelNum != null && !allowedChannels.contains(channelNum)) {
|
||||||
|
LOG.error("Failed to update Equipment {}. The {} ({}) is out of the allowed channels range {} for radioType {}",
|
||||||
|
equipmentId, channelType, channelNum, allowedChannels, radioType);
|
||||||
|
throw new DsDataValidationException("Failed to update Equipment. The " + channelType + "(" + channelNum +
|
||||||
|
") is out of the allowed channels range " + allowedChannels + " for radioType " +
|
||||||
|
RadioType.getRadioDisplayString(radioType));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/equipment/channel", method = RequestMethod.PUT)
|
@RequestMapping(value = "/equipment/channel", method = RequestMethod.PUT)
|
||||||
public Equipment updateEquipmentChannels(@RequestBody EquipmentChannelsUpdateRequest request) {
|
public Equipment updateEquipmentChannels(@RequestBody EquipmentChannelsUpdateRequest request) {
|
||||||
LOG.debug("updateEquipmentChannels {}", request);
|
LOG.debug("updateEquipmentChannels {}", request);
|
||||||
|
|
||||||
|
Map<RadioType, Integer> primaryChannels = request.getPrimaryChannels();
|
||||||
|
Map<RadioType, Integer> backupChannels = request.getBackupChannels();
|
||||||
|
long equipmentId = request.getEquipmentId();
|
||||||
|
|
||||||
|
Equipment existing = equipmentServiceInterface.getOrNull(equipmentId);
|
||||||
|
if (existing != null && existing.getDetails() instanceof ApElementConfiguration) {
|
||||||
|
ApElementConfiguration apElementConfiguration = (ApElementConfiguration) existing.getDetails();
|
||||||
|
if (apElementConfiguration.getRadioMap() != null) {
|
||||||
|
|
||||||
|
for (RadioType radioType : apElementConfiguration.getRadioMap().keySet()) {
|
||||||
|
ElementRadioConfiguration elementRadioConfig = apElementConfiguration.getRadioMap().get(radioType);
|
||||||
|
List<Integer> allowedChannels = elementRadioConfig.getAllowedChannelsPowerLevels().stream().map(
|
||||||
|
ChannelPowerLevel::getChannelNumber).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (allowedChannels != null && !allowedChannels.isEmpty()) {
|
||||||
|
if (primaryChannels != null && primaryChannels.get(radioType) != null) {
|
||||||
|
checkAllowedChannels(equipmentId, primaryChannels.get(radioType), CHANNEL_NUMBER_TYPE.channelNumber, allowedChannels, radioType);
|
||||||
|
}
|
||||||
|
if (backupChannels != null && backupChannels.get(radioType) != null) {
|
||||||
|
checkAllowedChannels(equipmentId, backupChannels.get(radioType), CHANNEL_NUMBER_TYPE.backupChannelNumber, allowedChannels, radioType);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return equipmentServiceInterface.updateChannels(request);
|
return equipmentServiceInterface.updateChannels(request);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -302,6 +431,20 @@ public class EquipmentPortalController {
|
|||||||
@RequestMapping(value = "/equipment/rrmBulk", method=RequestMethod.PUT)
|
@RequestMapping(value = "/equipment/rrmBulk", method=RequestMethod.PUT)
|
||||||
public GenericResponse updateRrmBulk(@RequestBody EquipmentRrmBulkUpdateRequest request) {
|
public GenericResponse updateRrmBulk(@RequestBody EquipmentRrmBulkUpdateRequest request) {
|
||||||
LOG.debug("updateRrmBulk {}", request);
|
LOG.debug("updateRrmBulk {}", request);
|
||||||
|
|
||||||
|
//validate equipment before the bulk update
|
||||||
|
Set<Long> equipmentIds = new HashSet<>();
|
||||||
|
request.getItems().forEach(item -> equipmentIds.add(item.getEquipmentId()));
|
||||||
|
List<Equipment> equipmentBeforeUpdate = equipmentServiceInterface.get(equipmentIds);
|
||||||
|
Map<Long, Equipment> eqMap = new HashMap<>();
|
||||||
|
equipmentBeforeUpdate.forEach(eq -> eqMap.put(eq.getId(), eq));
|
||||||
|
|
||||||
|
request.getItems().forEach(item -> {
|
||||||
|
Equipment eq = eqMap.get(item.getEquipmentId());
|
||||||
|
if(item.applyToEquipment(eq)) {
|
||||||
|
validateChannelNum(eq);
|
||||||
|
}
|
||||||
|
});
|
||||||
equipmentServiceInterface.updateRrmBulk(request);
|
equipmentServiceInterface.updateRrmBulk(request);
|
||||||
return new GenericResponse(true, "");
|
return new GenericResponse(true, "");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,8 +12,10 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
|
|
||||||
import com.telecominfraproject.wlan.core.model.json.GenericResponse;
|
import com.telecominfraproject.wlan.core.model.json.GenericResponse;
|
||||||
import com.telecominfraproject.wlan.equipment.EquipmentServiceInterface;
|
import com.telecominfraproject.wlan.equipment.EquipmentServiceInterface;
|
||||||
|
import com.telecominfraproject.wlan.equipment.models.ApElementConfiguration;
|
||||||
import com.telecominfraproject.wlan.equipment.models.Equipment;
|
import com.telecominfraproject.wlan.equipment.models.Equipment;
|
||||||
import com.telecominfraproject.wlan.equipment.models.RadioChannelChangeSettings;
|
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.CEGWBlinkRequest;
|
||||||
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWCommandResultCode;
|
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWCommandResultCode;
|
||||||
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWFirmwareDownloadRequest;
|
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWFirmwareDownloadRequest;
|
||||||
@@ -140,8 +142,9 @@ public class EquipmentGatewayPortalController {
|
|||||||
|
|
||||||
@RequestMapping(value = "/equipmentGateway/requestApBlinkLEDs", method = RequestMethod.POST)
|
@RequestMapping(value = "/equipmentGateway/requestApBlinkLEDs", method = RequestMethod.POST)
|
||||||
public GenericResponse requestApBlinkLEDs(@RequestParam long equipmentId, @RequestParam boolean blinkAllLEDs) {
|
public GenericResponse requestApBlinkLEDs(@RequestParam long equipmentId, @RequestParam boolean blinkAllLEDs) {
|
||||||
String action = "stop blinking LEDs on AP ";
|
String action = "stop blinking LEDs on AP";
|
||||||
if (blinkAllLEDs) action = "start blinking LEDs on AP ";
|
if (blinkAllLEDs)
|
||||||
|
action = "start blinking LEDs on AP";
|
||||||
Equipment equipment = equipmentServiceInterface.get(equipmentId);
|
Equipment equipment = equipmentServiceInterface.get(equipmentId);
|
||||||
LOG.debug("Request {} for AP {}", action, equipment.getInventoryId());
|
LOG.debug("Request {} for AP {}", action, equipment.getInventoryId());
|
||||||
|
|
||||||
@@ -150,10 +153,12 @@ public class EquipmentGatewayPortalController {
|
|||||||
apBlinkLEDs.setBlinkAllLEDs(blinkAllLEDs);
|
apBlinkLEDs.setBlinkAllLEDs(blinkAllLEDs);
|
||||||
|
|
||||||
EquipmentCommandResponse response = equipmentGatewayServiceInterface.sendCommand(apBlinkLEDs);
|
EquipmentCommandResponse response = equipmentGatewayServiceInterface.sendCommand(apBlinkLEDs);
|
||||||
LOG.debug("{} response {}", action,response);
|
LOG.debug("{} response {}", action, response);
|
||||||
|
|
||||||
|
|
||||||
if (response.getResultCode() == CEGWCommandResultCode.Success) {
|
if (response.getResultCode() == CEGWCommandResultCode.Success) {
|
||||||
|
ApElementConfiguration apElementConfig = (ApElementConfiguration) equipment.getDetails();
|
||||||
|
apElementConfig.setBlinkAllLEDs(blinkAllLEDs);
|
||||||
|
equipmentServiceInterface.update(equipment);
|
||||||
return new GenericResponse(true, "");
|
return new GenericResponse(true, "");
|
||||||
} else {
|
} else {
|
||||||
return new GenericResponse(false, "Failed to " + action + " for AP: " + response.getResultCode() + " " + response.getResultDetail());
|
return new GenericResponse(false, "Failed to " + action + " for AP: " + response.getResultCode() + " " + response.getResultDetail());
|
||||||
|
|||||||
@@ -173,6 +173,11 @@ public class FirmwarePortalController {
|
|||||||
return firmwareServiceInterface.getDefaultCustomerTrackSetting();
|
return firmwareServiceInterface.getDefaultCustomerTrackSetting();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "/customerTrack/default", method = RequestMethod.PUT)
|
||||||
|
public CustomerFirmwareTrackSettings updateDefaultCustomerTrackSetting(@RequestBody CustomerFirmwareTrackSettings defaultSettings) {
|
||||||
|
LOG.debug("calling updateDefaultCustomerTrackSetting({})", defaultSettings);
|
||||||
|
return firmwareServiceInterface.updateDefaultCustomerTrackSetting(defaultSettings);
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/customerTrack", method = RequestMethod.GET)
|
@RequestMapping(value = "/customerTrack", method = RequestMethod.GET)
|
||||||
public CustomerFirmwareTrackRecord getCustomerFirmwareTrackRecord(@RequestParam int customerId) {
|
public CustomerFirmwareTrackRecord getCustomerFirmwareTrackRecord(@RequestParam int customerId) {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,509 @@
|
|||||||
|
package com.telecominfraproject.wlan.portal.controller.equipment;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
import static org.junit.Assert.assertNotNull;
|
||||||
|
import static org.junit.Assert.fail;
|
||||||
|
|
||||||
|
import java.util.EnumMap;
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
|
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.alarm.AlarmServiceLocal;
|
||||||
|
import com.telecominfraproject.wlan.alarm.controller.AlarmController;
|
||||||
|
import com.telecominfraproject.wlan.alarm.datastore.inmemory.AlarmDatastoreInMemory;
|
||||||
|
import com.telecominfraproject.wlan.cloudeventdispatcher.CloudEventDispatcherEmpty;
|
||||||
|
import com.telecominfraproject.wlan.core.model.entity.CountryCode;
|
||||||
|
import com.telecominfraproject.wlan.core.model.equipment.EquipmentType;
|
||||||
|
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
|
||||||
|
import com.telecominfraproject.wlan.datastore.exceptions.DsDataValidationException;
|
||||||
|
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.ApElementConfiguration;
|
||||||
|
import com.telecominfraproject.wlan.equipment.models.ChannelPowerLevel;
|
||||||
|
import com.telecominfraproject.wlan.equipment.models.ElementRadioConfiguration;
|
||||||
|
import com.telecominfraproject.wlan.equipment.models.Equipment;
|
||||||
|
import com.telecominfraproject.wlan.equipment.models.EquipmentChannelsUpdateRequest;
|
||||||
|
import com.telecominfraproject.wlan.equipment.models.RadioConfiguration;
|
||||||
|
import com.telecominfraproject.wlan.location.datastore.LocationDatastore;
|
||||||
|
import com.telecominfraproject.wlan.location.datastore.inmemory.LocationDatastoreInMemory;
|
||||||
|
import com.telecominfraproject.wlan.location.models.Location;
|
||||||
|
import com.telecominfraproject.wlan.location.models.LocationDetails;
|
||||||
|
import com.telecominfraproject.wlan.location.models.LocationType;
|
||||||
|
import com.telecominfraproject.wlan.location.service.LocationServiceController;
|
||||||
|
import com.telecominfraproject.wlan.location.service.LocationServiceLocal;
|
||||||
|
import com.telecominfraproject.wlan.profile.ProfileServiceLocal;
|
||||||
|
import com.telecominfraproject.wlan.profile.controller.ProfileController;
|
||||||
|
import com.telecominfraproject.wlan.profile.datastore.inmemory.ProfileDatastoreInMemory;
|
||||||
|
import com.telecominfraproject.wlan.profile.models.ProfileByCustomerRequestFactory;
|
||||||
|
import com.telecominfraproject.wlan.status.StatusServiceLocal;
|
||||||
|
import com.telecominfraproject.wlan.status.controller.StatusController;
|
||||||
|
import com.telecominfraproject.wlan.status.datastore.inmemory.StatusDatastoreInMemory;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@ActiveProfiles(profiles = {
|
||||||
|
"integration_test",
|
||||||
|
}) //NOTE: these profiles will be ADDED to the list of active profiles
|
||||||
|
@SpringBootTest(webEnvironment = WebEnvironment.NONE, classes = EquipmentPortalControllerTest.class)
|
||||||
|
@Import(value = {
|
||||||
|
EquipmentServiceLocal.class,
|
||||||
|
EquipmentController.class,
|
||||||
|
EquipmentDatastoreInMemory.class,
|
||||||
|
EquipmentPortalController.class,
|
||||||
|
LocationServiceLocal.class,
|
||||||
|
LocationServiceController.class,
|
||||||
|
LocationDatastoreInMemory.class,
|
||||||
|
CloudEventDispatcherEmpty.class,
|
||||||
|
AlarmServiceLocal.class,
|
||||||
|
AlarmController.class,
|
||||||
|
AlarmDatastoreInMemory.class,
|
||||||
|
ProfileServiceLocal.class,
|
||||||
|
ProfileDatastoreInMemory.class,
|
||||||
|
ProfileController.class,
|
||||||
|
ProfileByCustomerRequestFactory.class,
|
||||||
|
StatusServiceLocal.class,
|
||||||
|
StatusDatastoreInMemory.class,
|
||||||
|
StatusController.class
|
||||||
|
})
|
||||||
|
public class EquipmentPortalControllerTest {
|
||||||
|
private static AtomicLong locationIncrementer = new AtomicLong(1);
|
||||||
|
private static AtomicLong equipmentIncrementer = new AtomicLong(1);
|
||||||
|
private static Set<Long> locationIds = new HashSet<Long>();
|
||||||
|
private static Set<Long> equipmentIds = new HashSet<Long>();
|
||||||
|
|
||||||
|
@Autowired private EquipmentPortalController equipmentPortalController;
|
||||||
|
@Autowired private LocationDatastore locationDatastore;
|
||||||
|
|
||||||
|
@BeforeEach
|
||||||
|
public void setup()
|
||||||
|
{
|
||||||
|
locationIds.clear();
|
||||||
|
equipmentIds.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected Location createLocation(int customerId, LocationType locationType, CountryCode countryCode) {
|
||||||
|
Location location = new Location();
|
||||||
|
location.setCustomerId(customerId);
|
||||||
|
|
||||||
|
// Setup location details with default CmapLocationActivityDetails
|
||||||
|
LocationDetails details = LocationDetails.createWithDefaults();
|
||||||
|
details.setCountryCode(countryCode);
|
||||||
|
location.setDetails(details);
|
||||||
|
|
||||||
|
location.setName("Location-UT" + locationIncrementer.getAndIncrement());
|
||||||
|
location.setLocationType(locationType);
|
||||||
|
|
||||||
|
Location created = locationDatastore.create(location);
|
||||||
|
assertNotNull(created);
|
||||||
|
|
||||||
|
return created;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEquipmentUpdateChannelNumValidation() {
|
||||||
|
|
||||||
|
Location location = createLocation(2, LocationType.SITE, CountryCode.US);
|
||||||
|
|
||||||
|
//Create new Equipment - success
|
||||||
|
Equipment equipment = new Equipment();
|
||||||
|
equipment.setName("testName-"+ equipmentIncrementer.getAndIncrement());
|
||||||
|
equipment.setInventoryId("test-inv-"+equipmentIncrementer.getAndIncrement());
|
||||||
|
equipment.setEquipmentType(EquipmentType.AP);
|
||||||
|
equipment.setLocationId(location.getId());
|
||||||
|
equipment.setDetails(ApElementConfiguration.createWithDefaults());
|
||||||
|
|
||||||
|
ElementRadioConfiguration element2dot4RadioConfig = ((ApElementConfiguration)equipment.getDetails()).getRadioMap().get(RadioType.is2dot4GHz);
|
||||||
|
element2dot4RadioConfig.setAllowedChannelsPowerLevels(new HashSet<>());
|
||||||
|
|
||||||
|
for (int i = 1; i <= 11; i++) {
|
||||||
|
ChannelPowerLevel cpl = new ChannelPowerLevel();
|
||||||
|
cpl.setChannelNumber(i);
|
||||||
|
cpl.setChannelWidth(20);
|
||||||
|
cpl.setDfs(false);
|
||||||
|
cpl.setPowerLevel(30);
|
||||||
|
element2dot4RadioConfig.getAllowedChannelsPowerLevels().add(cpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
Equipment ret = equipmentPortalController.createEquipment(equipment);
|
||||||
|
assertNotNull(ret);
|
||||||
|
long equipmentId = ret.getId();
|
||||||
|
|
||||||
|
ret = equipmentPortalController.getEquipment(equipmentId);
|
||||||
|
assertEqualEquipments(equipment, ret);
|
||||||
|
|
||||||
|
ElementRadioConfiguration retElement2dot4RadioConfig = ((ApElementConfiguration)ret.getDetails()).getRadioMap().get(RadioType.is2dot4GHz);
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_CHANNEL_NUMBER_2DOT4GHZ, retElement2dot4RadioConfig.getChannelNumber().intValue());
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_BACKUP_CHANNEL_NUMBER_2DOT4GHZ, retElement2dot4RadioConfig.getBackupChannelNumber().intValue());
|
||||||
|
|
||||||
|
//Update success
|
||||||
|
retElement2dot4RadioConfig.setChannelNumber(1);
|
||||||
|
retElement2dot4RadioConfig.setManualChannelNumber(2);
|
||||||
|
retElement2dot4RadioConfig.setBackupChannelNumber(3);
|
||||||
|
retElement2dot4RadioConfig.setManualBackupChannelNumber(4);
|
||||||
|
|
||||||
|
Equipment updatedEquipment = equipmentPortalController.updateEquipment(ret);
|
||||||
|
|
||||||
|
Equipment retUpdate = equipmentPortalController.getEquipment(ret.getId());
|
||||||
|
assertEqualEquipments(retUpdate, updatedEquipment);
|
||||||
|
ElementRadioConfiguration ret2Element2dot4RadioConfig = ((ApElementConfiguration)retUpdate.getDetails()).getRadioMap().get(RadioType.is2dot4GHz);
|
||||||
|
assertEquals(1, ret2Element2dot4RadioConfig.getChannelNumber().intValue());
|
||||||
|
assertEquals(2, ret2Element2dot4RadioConfig.getManualChannelNumber().intValue());
|
||||||
|
assertEquals(3, ret2Element2dot4RadioConfig.getBackupChannelNumber().intValue());
|
||||||
|
assertEquals(4, ret2Element2dot4RadioConfig.getManualBackupChannelNumber().intValue());
|
||||||
|
|
||||||
|
//Update failure
|
||||||
|
ret2Element2dot4RadioConfig.setChannelNumber(12);
|
||||||
|
try {
|
||||||
|
equipmentPortalController.updateEquipment(retUpdate);
|
||||||
|
fail("EquipmentService update channelNumber failed");
|
||||||
|
} catch (DsDataValidationException e) {
|
||||||
|
// pass
|
||||||
|
}
|
||||||
|
|
||||||
|
ret2Element2dot4RadioConfig.setChannelNumber(6);
|
||||||
|
ret2Element2dot4RadioConfig.setManualChannelNumber(13);
|
||||||
|
try {
|
||||||
|
equipmentPortalController.updateEquipment(retUpdate);
|
||||||
|
fail("EquipmentService update manualChannelNumber failed");
|
||||||
|
} catch (DsDataValidationException e) {
|
||||||
|
// pass
|
||||||
|
}
|
||||||
|
|
||||||
|
ret2Element2dot4RadioConfig.setManualChannelNumber(7);
|
||||||
|
ret2Element2dot4RadioConfig.setBackupChannelNumber(14);
|
||||||
|
try {
|
||||||
|
equipmentPortalController.updateEquipment(retUpdate);
|
||||||
|
fail("EquipmentService update backupChannelNumber failed");
|
||||||
|
} catch (DsDataValidationException e) {
|
||||||
|
// pass
|
||||||
|
}
|
||||||
|
|
||||||
|
ret2Element2dot4RadioConfig.setBackupChannelNumber(8);
|
||||||
|
ret2Element2dot4RadioConfig.setManualBackupChannelNumber(15);
|
||||||
|
try {
|
||||||
|
equipmentPortalController.updateEquipment(retUpdate);
|
||||||
|
fail("EquipmentService update manualBackupChannelNumber failed");
|
||||||
|
} catch (DsDataValidationException e) {
|
||||||
|
// pass
|
||||||
|
}
|
||||||
|
|
||||||
|
//Tolerate null now
|
||||||
|
ret2Element2dot4RadioConfig.setManualBackupChannelNumber(null);
|
||||||
|
equipmentPortalController.updateEquipment(retUpdate);
|
||||||
|
|
||||||
|
// Clean up after test
|
||||||
|
equipmentPortalController.deleteEquipment(equipmentId);
|
||||||
|
locationDatastore.delete(location.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testEquipmentUpdateChannelNumValidationWithCorrection() {
|
||||||
|
Location location1 = createLocation(2, LocationType.SITE, CountryCode.US);
|
||||||
|
Location location2 = createLocation(2, LocationType.BUILDING, CountryCode.SA);
|
||||||
|
|
||||||
|
|
||||||
|
//Create new Equipment - success
|
||||||
|
Equipment equipment = new Equipment();
|
||||||
|
equipment.setName("testName-"+equipmentIncrementer.getAndIncrement());
|
||||||
|
equipment.setInventoryId("test-inv-"+equipmentIncrementer.getAndIncrement());
|
||||||
|
equipment.setEquipmentType(EquipmentType.AP);
|
||||||
|
equipment.setLocationId(location1.getId());
|
||||||
|
|
||||||
|
ApElementConfiguration apConfig = ApElementConfiguration.createWithDefaults();
|
||||||
|
if (apConfig.getElementRadioConfiguration(RadioType.is5GHz) == null) {
|
||||||
|
Map<RadioType, ElementRadioConfiguration> radioMapInit = apConfig.getRadioMap();
|
||||||
|
Map<RadioType, RadioConfiguration> advRadioMapInit = apConfig.getAdvancedRadioMap();
|
||||||
|
radioMapInit.put(RadioType.is5GHz, ElementRadioConfiguration.createWithDefaults(RadioType.is5GHz));
|
||||||
|
apConfig.setRadioMap(radioMapInit);
|
||||||
|
advRadioMapInit.put(RadioType.is5GHz, RadioConfiguration.createWithDefaults(RadioType.is5GHz));
|
||||||
|
apConfig.setAdvancedRadioMap(advRadioMapInit);
|
||||||
|
}
|
||||||
|
|
||||||
|
equipment.setDetails(apConfig);
|
||||||
|
|
||||||
|
ElementRadioConfiguration element5GRadioConfig = ((ApElementConfiguration)equipment.getDetails()).getRadioMap().get(RadioType.is5GHz);
|
||||||
|
element5GRadioConfig.setAllowedChannelsPowerLevels(new HashSet<>());
|
||||||
|
|
||||||
|
for (int i = 36; i <= 64; i=i+4) {
|
||||||
|
ChannelPowerLevel cpl = new ChannelPowerLevel();
|
||||||
|
cpl.setChannelNumber(i);
|
||||||
|
cpl.setChannelWidth(20);
|
||||||
|
cpl.setDfs(false);
|
||||||
|
cpl.setPowerLevel(30);
|
||||||
|
element5GRadioConfig.getAllowedChannelsPowerLevels().add(cpl);
|
||||||
|
}
|
||||||
|
for (int i = 149; i <= 161; i=i+4) {
|
||||||
|
ChannelPowerLevel cpl = new ChannelPowerLevel();
|
||||||
|
cpl.setChannelNumber(i);
|
||||||
|
cpl.setChannelWidth(20);
|
||||||
|
cpl.setDfs(false);
|
||||||
|
cpl.setPowerLevel(30);
|
||||||
|
element5GRadioConfig.getAllowedChannelsPowerLevels().add(cpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
Equipment ret = equipmentPortalController.createEquipment(equipment);
|
||||||
|
assertNotNull(ret);
|
||||||
|
long equipmentId = ret.getId();
|
||||||
|
|
||||||
|
ret = equipmentPortalController.getEquipment(equipmentId);
|
||||||
|
assertEqualEquipments(equipment, ret);
|
||||||
|
|
||||||
|
ElementRadioConfiguration retElement5GRadioConfig = ((ApElementConfiguration)ret.getDetails()).getRadioMap().get(RadioType.is5GHz);
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_CHANNEL_NUMBER_5GHZ, retElement5GRadioConfig.getChannelNumber().intValue());
|
||||||
|
assertEquals( ElementRadioConfiguration.DEFAULT_BACKUP_CHANNEL_NUMBER_5GHZ, retElement5GRadioConfig.getBackupChannelNumber().intValue());
|
||||||
|
|
||||||
|
//Update success
|
||||||
|
retElement5GRadioConfig.setChannelNumber(149);
|
||||||
|
retElement5GRadioConfig.setManualChannelNumber(52);
|
||||||
|
retElement5GRadioConfig.setBackupChannelNumber(157);
|
||||||
|
retElement5GRadioConfig.setManualBackupChannelNumber(60);
|
||||||
|
|
||||||
|
Equipment updatedEquipment = equipmentPortalController.updateEquipment(ret);
|
||||||
|
|
||||||
|
Equipment retUpdate = equipmentPortalController.getEquipment(ret.getId());
|
||||||
|
assertEqualEquipments(retUpdate, updatedEquipment);
|
||||||
|
ElementRadioConfiguration ret2Element5GRadioConfig = ((ApElementConfiguration)retUpdate.getDetails()).getRadioMap().get(RadioType.is5GHz);
|
||||||
|
assertEquals(149, ret2Element5GRadioConfig.getChannelNumber().intValue());
|
||||||
|
assertEquals(52, ret2Element5GRadioConfig.getManualChannelNumber().intValue());
|
||||||
|
assertEquals(157, ret2Element5GRadioConfig.getBackupChannelNumber().intValue());
|
||||||
|
assertEquals(60, ret2Element5GRadioConfig.getManualBackupChannelNumber().intValue());
|
||||||
|
|
||||||
|
//Update failure
|
||||||
|
ret2Element5GRadioConfig.setChannelNumber(165);
|
||||||
|
try {
|
||||||
|
equipmentPortalController.updateEquipment(retUpdate);
|
||||||
|
fail("EquipmentService update channelNumber failed");
|
||||||
|
} catch (DsDataValidationException e) {
|
||||||
|
// pass
|
||||||
|
}
|
||||||
|
|
||||||
|
ret2Element5GRadioConfig.setChannelNumber(157);
|
||||||
|
ret2Element5GRadioConfig.setManualChannelNumber(165);
|
||||||
|
try {
|
||||||
|
equipmentPortalController.updateEquipment(retUpdate);
|
||||||
|
fail("EquipmentService update manualChannelNumber failed");
|
||||||
|
} catch (DsDataValidationException e) {
|
||||||
|
// pass
|
||||||
|
}
|
||||||
|
|
||||||
|
ret2Element5GRadioConfig.setManualChannelNumber(44);
|
||||||
|
ret2Element5GRadioConfig.setBackupChannelNumber(14);
|
||||||
|
try {
|
||||||
|
equipmentPortalController.updateEquipment(retUpdate);
|
||||||
|
fail("EquipmentService update backupChannelNumber failed");
|
||||||
|
} catch (DsDataValidationException e) {
|
||||||
|
// pass
|
||||||
|
}
|
||||||
|
|
||||||
|
ret2Element5GRadioConfig.setBackupChannelNumber(36);
|
||||||
|
ret2Element5GRadioConfig.setManualBackupChannelNumber(15);
|
||||||
|
try {
|
||||||
|
equipmentPortalController.updateEquipment(retUpdate);
|
||||||
|
fail("EquipmentService update manualBackupChannelNumber failed");
|
||||||
|
} catch (DsDataValidationException e) {
|
||||||
|
// pass
|
||||||
|
}
|
||||||
|
|
||||||
|
ret2Element5GRadioConfig.setManualBackupChannelNumber(52);
|
||||||
|
equipmentPortalController.updateEquipment(retUpdate);
|
||||||
|
|
||||||
|
Equipment ret2Update = equipmentPortalController.getEquipment(ret.getId());
|
||||||
|
ElementRadioConfiguration ret3Element5GRadioConfig = ((ApElementConfiguration)ret2Update.getDetails()).getRadioMap().get(RadioType.is5GHz);
|
||||||
|
assertEquals(157, ret3Element5GRadioConfig.getChannelNumber().intValue());
|
||||||
|
assertEquals(44, ret3Element5GRadioConfig.getManualChannelNumber().intValue());
|
||||||
|
assertEquals(36, ret3Element5GRadioConfig.getBackupChannelNumber().intValue());
|
||||||
|
assertEquals(52, ret3Element5GRadioConfig.getManualBackupChannelNumber().intValue());
|
||||||
|
|
||||||
|
// CHANGE Country Code
|
||||||
|
ret2Update.setLocationId(location2.getId());
|
||||||
|
Equipment ret3Update = equipmentPortalController.updateEquipment(ret2Update);
|
||||||
|
|
||||||
|
ElementRadioConfiguration ret4Element5GRadioConfig = ((ApElementConfiguration) ret3Update.getDetails())
|
||||||
|
.getRadioMap().get(RadioType.is5GHz);
|
||||||
|
// These are auto-corrected values
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_CHANNEL_NUMBER_5GHZ, ret4Element5GRadioConfig.getChannelNumber().intValue());
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_CHANNEL_NUMBER_5GHZ, ret4Element5GRadioConfig.getManualChannelNumber().intValue());
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_BACKUP_CHANNEL_NUMBER_5GHZ, ret4Element5GRadioConfig.getBackupChannelNumber().intValue());
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_BACKUP_CHANNEL_NUMBER_5GHZ, ret4Element5GRadioConfig.getManualBackupChannelNumber().intValue());
|
||||||
|
|
||||||
|
for (int i = 149; i <= 161; i = i + 4) {
|
||||||
|
ChannelPowerLevel cpl = new ChannelPowerLevel();
|
||||||
|
cpl.setChannelNumber(i);
|
||||||
|
cpl.setChannelWidth(20);
|
||||||
|
cpl.setDfs(false);
|
||||||
|
cpl.setPowerLevel(30);
|
||||||
|
ret4Element5GRadioConfig.getAllowedChannelsPowerLevels().remove(cpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
Equipment ret5Update = equipmentPortalController.updateEquipment(ret3Update);
|
||||||
|
ElementRadioConfiguration ret5Element5GRadioConfig = ((ApElementConfiguration) ret5Update.getDetails())
|
||||||
|
.getRadioMap().get(RadioType.is5GHz);
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_CHANNEL_NUMBER_5GHZ, ret5Element5GRadioConfig.getChannelNumber().intValue());
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_CHANNEL_NUMBER_5GHZ, ret5Element5GRadioConfig.getManualChannelNumber().intValue());
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_BACKUP_CHANNEL_NUMBER_5GHZ, ret5Element5GRadioConfig.getBackupChannelNumber().intValue());
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_BACKUP_CHANNEL_NUMBER_5GHZ, ret5Element5GRadioConfig.getManualBackupChannelNumber().intValue());
|
||||||
|
|
||||||
|
// Clean up after test
|
||||||
|
equipmentPortalController.deleteEquipment(equipmentId);
|
||||||
|
locationDatastore.delete(location1.getId());
|
||||||
|
locationDatastore.delete(location2.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testChannelsUpdateChannelNumValidation() {
|
||||||
|
Location location = createLocation(2, LocationType.SITE, CountryCode.US);
|
||||||
|
|
||||||
|
//Create test Equipment
|
||||||
|
Equipment equipment = new Equipment();
|
||||||
|
|
||||||
|
equipment.setName("test_ChannelsUpdate");
|
||||||
|
equipment.setLocationId(location.getId());
|
||||||
|
equipment.setEquipmentType(EquipmentType.AP);
|
||||||
|
equipment.setInventoryId("inv-" + equipment.getName());
|
||||||
|
|
||||||
|
ApElementConfiguration apConfig = ApElementConfiguration.createWithDefaults();
|
||||||
|
equipment.setDetails(apConfig);
|
||||||
|
|
||||||
|
if (apConfig.getElementRadioConfiguration(RadioType.is5GHz) == null) {
|
||||||
|
Map<RadioType, ElementRadioConfiguration> radioMap = apConfig.getRadioMap();
|
||||||
|
radioMap.put(RadioType.is5GHz, ElementRadioConfiguration.createWithDefaults(RadioType.is5GHz));
|
||||||
|
apConfig.setRadioMap(radioMap);
|
||||||
|
}
|
||||||
|
|
||||||
|
ElementRadioConfiguration element2dot4RadioConfig = ((ApElementConfiguration)equipment.getDetails()).getRadioMap().get(RadioType.is2dot4GHz);
|
||||||
|
element2dot4RadioConfig.setAllowedChannelsPowerLevels(new HashSet<>());
|
||||||
|
|
||||||
|
for (int i = 1; i <= 11; i++) {
|
||||||
|
ChannelPowerLevel cpl = new ChannelPowerLevel();
|
||||||
|
cpl.setChannelNumber(i);
|
||||||
|
cpl.setChannelWidth(20);
|
||||||
|
cpl.setDfs(false);
|
||||||
|
cpl.setPowerLevel(30);
|
||||||
|
element2dot4RadioConfig.getAllowedChannelsPowerLevels().add(cpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
ElementRadioConfiguration element5GRadioConfig = ((ApElementConfiguration)equipment.getDetails()).getRadioMap().get(RadioType.is5GHz);
|
||||||
|
element5GRadioConfig.setAllowedChannelsPowerLevels(new HashSet<>());
|
||||||
|
|
||||||
|
for (int i = 36; i <= 64; i=i+4) {
|
||||||
|
ChannelPowerLevel cpl = new ChannelPowerLevel();
|
||||||
|
cpl.setChannelNumber(i);
|
||||||
|
cpl.setChannelWidth(20);
|
||||||
|
cpl.setDfs(false);
|
||||||
|
cpl.setPowerLevel(30);
|
||||||
|
element5GRadioConfig.getAllowedChannelsPowerLevels().add(cpl);
|
||||||
|
}
|
||||||
|
for (int i = 149; i <= 161; i=i+4) {
|
||||||
|
ChannelPowerLevel cpl = new ChannelPowerLevel();
|
||||||
|
cpl.setChannelNumber(i);
|
||||||
|
cpl.setChannelWidth(20);
|
||||||
|
cpl.setDfs(false);
|
||||||
|
cpl.setPowerLevel(30);
|
||||||
|
element5GRadioConfig.getAllowedChannelsPowerLevels().add(cpl);
|
||||||
|
}
|
||||||
|
|
||||||
|
Equipment equipmentCreated = equipmentPortalController.createEquipment(equipment);
|
||||||
|
|
||||||
|
long equipmentId = equipmentCreated.getId();
|
||||||
|
Equipment equipmentGet = equipmentPortalController.getEquipment(equipmentId);
|
||||||
|
assertNotNull(equipmentGet);
|
||||||
|
|
||||||
|
ApElementConfiguration apElementConfiguration = (ApElementConfiguration)equipmentGet.getDetails();
|
||||||
|
assertNotNull(apElementConfiguration);
|
||||||
|
|
||||||
|
Map<RadioType, ElementRadioConfiguration> radioMap = apElementConfiguration.getRadioMap();
|
||||||
|
assertNotNull(radioMap);
|
||||||
|
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_CHANNEL_NUMBER_2DOT4GHZ, radioMap.get(RadioType.is2dot4GHz).getChannelNumber().intValue());
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_BACKUP_CHANNEL_NUMBER_2DOT4GHZ, radioMap.get(RadioType.is2dot4GHz).getBackupChannelNumber().intValue());
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_CHANNEL_NUMBER_2DOT4GHZ, radioMap.get(RadioType.is2dot4GHz).getManualChannelNumber().intValue());
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_BACKUP_CHANNEL_NUMBER_2DOT4GHZ, radioMap.get(RadioType.is2dot4GHz).getManualBackupChannelNumber().intValue());
|
||||||
|
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_CHANNEL_NUMBER_5GHZ, radioMap.get(RadioType.is5GHz).getChannelNumber().intValue());
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_BACKUP_CHANNEL_NUMBER_5GHZ, radioMap.get(RadioType.is5GHz).getBackupChannelNumber().intValue());
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_CHANNEL_NUMBER_5GHZ, radioMap.get(RadioType.is5GHz).getManualChannelNumber().intValue());
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_BACKUP_CHANNEL_NUMBER_5GHZ, radioMap.get(RadioType.is5GHz).getManualBackupChannelNumber().intValue());
|
||||||
|
|
||||||
|
Map<RadioType, Integer> primaryChannels = new EnumMap<>(RadioType.class);
|
||||||
|
Map<RadioType, Integer> backupChannels = new EnumMap<>(RadioType.class);
|
||||||
|
Map<RadioType, Boolean> autoChannelSelections = new EnumMap<>(RadioType.class);
|
||||||
|
|
||||||
|
primaryChannels.put(RadioType.is2dot4GHz, 1);
|
||||||
|
primaryChannels.put(RadioType.is5GHz, 52);
|
||||||
|
|
||||||
|
backupChannels.put(RadioType.is2dot4GHz, 6);
|
||||||
|
backupChannels.put(RadioType.is5GHz, 149);
|
||||||
|
|
||||||
|
autoChannelSelections.put(RadioType.is2dot4GHz, false);
|
||||||
|
autoChannelSelections.put(RadioType.is5GHz, false);
|
||||||
|
|
||||||
|
EquipmentChannelsUpdateRequest channelsUpdateRequest = new EquipmentChannelsUpdateRequest();
|
||||||
|
channelsUpdateRequest.setEquipmentId(equipmentId);
|
||||||
|
channelsUpdateRequest.setPrimaryChannels(primaryChannels);
|
||||||
|
channelsUpdateRequest.setBackupChannels(backupChannels);
|
||||||
|
channelsUpdateRequest.setAutoChannelSelections(autoChannelSelections);
|
||||||
|
|
||||||
|
Equipment equipmentUpdate1 = equipmentPortalController.updateEquipmentChannels(channelsUpdateRequest);
|
||||||
|
Equipment equipmentGetUpdate1 = equipmentPortalController.getEquipment(equipmentId);
|
||||||
|
assertEqualEquipments(equipmentGetUpdate1, equipmentUpdate1);
|
||||||
|
|
||||||
|
apElementConfiguration = (ApElementConfiguration)equipmentGetUpdate1.getDetails();
|
||||||
|
assertNotNull(apElementConfiguration);
|
||||||
|
radioMap = apElementConfiguration.getRadioMap();
|
||||||
|
assertNotNull(radioMap);
|
||||||
|
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_CHANNEL_NUMBER_2DOT4GHZ, radioMap.get(RadioType.is2dot4GHz).getChannelNumber().intValue());
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_BACKUP_CHANNEL_NUMBER_2DOT4GHZ, radioMap.get(RadioType.is2dot4GHz).getBackupChannelNumber().intValue());
|
||||||
|
assertEquals(1, radioMap.get(RadioType.is2dot4GHz).getManualChannelNumber().intValue());
|
||||||
|
assertEquals(6, radioMap.get(RadioType.is2dot4GHz).getManualBackupChannelNumber().intValue());
|
||||||
|
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_CHANNEL_NUMBER_5GHZ, radioMap.get(RadioType.is5GHz).getChannelNumber().intValue());
|
||||||
|
assertEquals(ElementRadioConfiguration.DEFAULT_BACKUP_CHANNEL_NUMBER_5GHZ, radioMap.get(RadioType.is5GHz).getBackupChannelNumber().intValue());
|
||||||
|
assertEquals(52, radioMap.get(RadioType.is5GHz).getManualChannelNumber().intValue());
|
||||||
|
assertEquals(149, radioMap.get(RadioType.is5GHz).getManualBackupChannelNumber().intValue());
|
||||||
|
|
||||||
|
primaryChannels.clear();
|
||||||
|
primaryChannels.put(RadioType.is2dot4GHz, 30);
|
||||||
|
primaryChannels.put(RadioType.is5GHz, 200);
|
||||||
|
|
||||||
|
backupChannels.clear();
|
||||||
|
backupChannels.put(RadioType.is2dot4GHz, 20);
|
||||||
|
backupChannels.put(RadioType.is5GHz, 300);
|
||||||
|
|
||||||
|
channelsUpdateRequest = new EquipmentChannelsUpdateRequest();
|
||||||
|
channelsUpdateRequest.setEquipmentId(equipmentId);
|
||||||
|
channelsUpdateRequest.setPrimaryChannels(primaryChannels);
|
||||||
|
channelsUpdateRequest.setBackupChannels(backupChannels);
|
||||||
|
channelsUpdateRequest.setAutoChannelSelections(autoChannelSelections);
|
||||||
|
|
||||||
|
try {
|
||||||
|
Equipment equipmentUpdate2 = equipmentPortalController.updateEquipmentChannels(channelsUpdateRequest);
|
||||||
|
} catch (DsDataValidationException e) {
|
||||||
|
// pass
|
||||||
|
}
|
||||||
|
|
||||||
|
// Clean up after test
|
||||||
|
equipmentPortalController.deleteEquipment(equipmentId);
|
||||||
|
locationDatastore.delete(location.getId());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void assertEqualEquipments(
|
||||||
|
Equipment expected,
|
||||||
|
Equipment actual) {
|
||||||
|
|
||||||
|
assertEquals(expected.getName(), actual.getName());
|
||||||
|
//TODO: add more fields to check here
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -35,7 +35,6 @@ import com.telecominfraproject.wlan.profile.models.Profile;
|
|||||||
import com.telecominfraproject.wlan.profile.models.ProfileByCustomerRequestFactory;
|
import com.telecominfraproject.wlan.profile.models.ProfileByCustomerRequestFactory;
|
||||||
import com.telecominfraproject.wlan.profile.models.ProfileType;
|
import com.telecominfraproject.wlan.profile.models.ProfileType;
|
||||||
|
|
||||||
|
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@ActiveProfiles(profiles = {
|
@ActiveProfiles(profiles = {
|
||||||
"integration_test",
|
"integration_test",
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ public class PortalUserDatastoreInMemory extends BaseInMemoryDatastore implement
|
|||||||
PortalUser ret = null;
|
PortalUser ret = null;
|
||||||
|
|
||||||
for (PortalUser mdl : idToPortalUserMap.values()) {
|
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();
|
ret = mdl.clone();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -161,7 +161,7 @@ public class PortalUserDatastoreInMemory extends BaseInMemoryDatastore implement
|
|||||||
List<PortalUser> listOfPortalUsers = new ArrayList<>();
|
List<PortalUser> listOfPortalUsers = new ArrayList<>();
|
||||||
|
|
||||||
for (PortalUser portalUser : idToPortalUserMap.values()) {
|
for (PortalUser portalUser : idToPortalUserMap.values()) {
|
||||||
if (portalUser.getUsername().equals(username)) {
|
if (portalUser.getUsername().toLowerCase().equals(username.toLowerCase())) {
|
||||||
listOfPortalUsers.add(portalUser);
|
listOfPortalUsers.add(portalUser);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -75,7 +75,6 @@ public class PortalUserDAO extends BaseJdbcDao {
|
|||||||
|
|
||||||
public 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
|
//use this for queries where multiple tables are involved
|
||||||
public static final String ALL_COLUMNS_WITH_PREFIX;
|
public static final String ALL_COLUMNS_WITH_PREFIX;
|
||||||
|
|
||||||
@@ -135,10 +134,10 @@ public class PortalUserDAO extends BaseJdbcDao {
|
|||||||
private static final String SQL_GET_BY_USERNAME =
|
private static final String SQL_GET_BY_USERNAME =
|
||||||
"select " + ALL_COLUMNS +
|
"select " + ALL_COLUMNS +
|
||||||
" from " + TABLE_NAME + " " +
|
" from " + TABLE_NAME + " " +
|
||||||
" where username = ? ";
|
" where lower(username) = ? ";
|
||||||
|
|
||||||
private static final String SQL_GET_BY_CUSTOMERID_AND_USERNAME = SQL_GET_BY_CUSTOMER_ID +
|
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 =
|
private static final String SQL_GET_LASTMOD_BY_ID =
|
||||||
"select lastModifiedTimestamp " +
|
"select lastModifiedTimestamp " +
|
||||||
@@ -463,7 +462,7 @@ public class PortalUserDAO extends BaseJdbcDao {
|
|||||||
try{
|
try{
|
||||||
PortalUser portalUser = this.jdbcTemplate.queryForObject(
|
PortalUser portalUser = this.jdbcTemplate.queryForObject(
|
||||||
SQL_GET_BY_CUSTOMERID_AND_USERNAME,
|
SQL_GET_BY_CUSTOMERID_AND_USERNAME,
|
||||||
portalUserRowMapper, customerId, username);
|
portalUserRowMapper, customerId, username.toLowerCase());
|
||||||
|
|
||||||
LOG.debug("Found PortalUser {}", portalUser);
|
LOG.debug("Found PortalUser {}", portalUser);
|
||||||
|
|
||||||
@@ -478,7 +477,7 @@ public class PortalUserDAO extends BaseJdbcDao {
|
|||||||
LOG.debug("Looking up PortalUsers for username {} {}", username);
|
LOG.debug("Looking up PortalUsers for username {} {}", username);
|
||||||
|
|
||||||
List<PortalUser> ret = this.jdbcTemplate.query(SQL_GET_BY_USERNAME,
|
List<PortalUser> ret = this.jdbcTemplate.query(SQL_GET_BY_USERNAME,
|
||||||
portalUserRowMapper, username);
|
portalUserRowMapper, username.toLowerCase());
|
||||||
|
|
||||||
LOG.debug("Found List of Portal Users {}", ret);
|
LOG.debug("Found List of Portal Users {}", ret);
|
||||||
|
|
||||||
|
|||||||
@@ -20,6 +20,8 @@ public class PortalUserEventPayload extends BaseJsonModel implements HasCustomer
|
|||||||
private long createdTimestamp;
|
private long createdTimestamp;
|
||||||
private long lastModifiedTimestamp;
|
private long lastModifiedTimestamp;
|
||||||
|
|
||||||
|
public PortalUserEventPayload() {}
|
||||||
|
|
||||||
public PortalUserEventPayload(PortalUser portalUser) {
|
public PortalUserEventPayload(PortalUser portalUser) {
|
||||||
this.setId(portalUser.getId());
|
this.setId(portalUser.getId());
|
||||||
this.setCustomerId(portalUser.getCustomerId());
|
this.setCustomerId(portalUser.getCustomerId());
|
||||||
|
|||||||
@@ -0,0 +1,94 @@
|
|||||||
|
package com.telecominfraproject.wlan.profile.ethernetport.models;
|
||||||
|
|
||||||
|
import com.telecominfraproject.wlan.core.model.equipment.PushableConfiguration;
|
||||||
|
import com.telecominfraproject.wlan.profile.models.ProfileDetails;
|
||||||
|
import com.telecominfraproject.wlan.profile.models.ProfileType;
|
||||||
|
import com.telecominfraproject.wlan.profile.ssid.models.SsidConfiguration;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rsharma
|
||||||
|
*/
|
||||||
|
public class WiredEthernetPortConfiguration extends ProfileDetails implements PushableConfiguration<WiredEthernetPortConfiguration> {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 5326345492525165619L;
|
||||||
|
|
||||||
|
private String equipmentModel; // e.g., MR8300-CA, EC420-G1
|
||||||
|
|
||||||
|
private Set<WiredPort> ethPorts;
|
||||||
|
|
||||||
|
public WiredEthernetPortConfiguration() {
|
||||||
|
// for Serialization
|
||||||
|
}
|
||||||
|
|
||||||
|
public WiredEthernetPortConfiguration(String equipmentModel, Set<WiredPort> ethPorts) {
|
||||||
|
this.equipmentModel = equipmentModel;
|
||||||
|
this.ethPorts = ethPorts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static WiredEthernetPortConfiguration createWithDefaults() {
|
||||||
|
return new WiredEthernetPortConfiguration();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getEquipmentModel() {
|
||||||
|
return equipmentModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEquipmentModel(String equipmentModel) {
|
||||||
|
this.equipmentModel = equipmentModel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Set<WiredPort> getEthPorts() {
|
||||||
|
return ethPorts;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEthPorts(Set<WiredPort> ethPorts) {
|
||||||
|
this.ethPorts = ethPorts;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean needsToBeUpdatedOnDevice(WiredEthernetPortConfiguration previousVersion) {
|
||||||
|
if (previousVersion != null) {
|
||||||
|
return !Objects.equals(this, previousVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ProfileType getProfileType() {
|
||||||
|
return ProfileType.wired_ethernet_port;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!(o instanceof WiredEthernetPortConfiguration)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
WiredEthernetPortConfiguration that = (WiredEthernetPortConfiguration) o;
|
||||||
|
return Objects.equals(getEquipmentModel(), that.getEquipmentModel()) &&
|
||||||
|
Objects.equals(getEthPorts(), that.getEthPorts());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(getEquipmentModel(), getEthPorts());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WiredEthernetPortConfiguration clone() {
|
||||||
|
WiredEthernetPortConfiguration ret = (WiredEthernetPortConfiguration)super.clone();
|
||||||
|
|
||||||
|
if (ethPorts != null) {
|
||||||
|
ret.ethPorts = new HashSet<>(ethPorts);
|
||||||
|
}
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,112 @@
|
|||||||
|
package com.telecominfraproject.wlan.profile.ethernetport.models;
|
||||||
|
|
||||||
|
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rsharma
|
||||||
|
*/
|
||||||
|
public class WiredPort extends BaseJsonModel {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 6595665507927422135L;
|
||||||
|
|
||||||
|
private String name; //eth0 or eth1
|
||||||
|
private String displayName; // LAN-1, WAN-0 etc
|
||||||
|
private String ifName; // lan, wan etc
|
||||||
|
private String ifType; // bridge/Nat
|
||||||
|
private int vlanId; // native vlanId/tagged vlanId
|
||||||
|
private boolean trunkEnabled; // trunk enabled or disabled
|
||||||
|
private List<Integer> allowedVlanIds; // allowed vlanIds
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDisplayName() {
|
||||||
|
return displayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDisplayName(String displayName) {
|
||||||
|
this.displayName = displayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIfName() {
|
||||||
|
return ifName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIfName(String ifName) {
|
||||||
|
this.ifName = ifName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIfType() {
|
||||||
|
return ifType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIfType(String ifType) {
|
||||||
|
this.ifType = ifType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getVlanId() {
|
||||||
|
return vlanId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVlanId(int vlanId) {
|
||||||
|
this.vlanId = vlanId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTrunkEnabled() {
|
||||||
|
return trunkEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTrunkEnabled(boolean trunkEnabled) {
|
||||||
|
this.trunkEnabled = trunkEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getAllowedVlanIds() {
|
||||||
|
return allowedVlanIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAllowedVlanIds(List<Integer> allowedVlanIds) {
|
||||||
|
this.allowedVlanIds = allowedVlanIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!(o instanceof WiredPort)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
WiredPort wiredPort = (WiredPort) o;
|
||||||
|
return getVlanId() == wiredPort.getVlanId() && isTrunkEnabled() == wiredPort.isTrunkEnabled()
|
||||||
|
&& Objects.equals(getName(), wiredPort.getName())
|
||||||
|
&& Objects.equals(getDisplayName(), wiredPort.getDisplayName())
|
||||||
|
&& Objects.equals(getIfName(), wiredPort.getIfName())
|
||||||
|
&& Objects.equals(getIfType(), wiredPort.getIfType())
|
||||||
|
&& Objects.equals(getAllowedVlanIds(), wiredPort.getAllowedVlanIds());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(getName(), getDisplayName(), getIfName(), getIfType(), getVlanId(), isTrunkEnabled(), getAllowedVlanIds());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WiredPort clone() {
|
||||||
|
WiredPort port = (WiredPort) super.clone();
|
||||||
|
|
||||||
|
if (getAllowedVlanIds() != null) {
|
||||||
|
port.allowedVlanIds = new ArrayList<>(getAllowedVlanIds());
|
||||||
|
}
|
||||||
|
|
||||||
|
return port;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,8 @@ import java.util.HashMap;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.telecominfraproject.wlan.profile.ethernetport.models.WiredEthernetPortConfiguration;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author dtop
|
* @author dtop
|
||||||
* Utility class for dealing with profiles
|
* Utility class for dealing with profiles
|
||||||
@@ -40,6 +42,26 @@ public class ProfileContainer {
|
|||||||
return ret.get(0);
|
return ret.get(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Profile getChildOfTypeOrNullByEquipmentModel(long profileId, ProfileType childProfileType,
|
||||||
|
String equipmentModel) {
|
||||||
|
// The profile type of the profileId should be equipment_ap
|
||||||
|
Profile apProfile = profileMap.get(profileId);
|
||||||
|
if (apProfile != null && apProfile.getProfileType() == ProfileType.equipment_ap) {
|
||||||
|
|
||||||
|
List<Profile> profiles = getChildrenOfType(profileId, childProfileType);
|
||||||
|
for (Profile ret : profiles) {
|
||||||
|
WiredEthernetPortConfiguration config = (WiredEthernetPortConfiguration) ret.getDetails();
|
||||||
|
if (config != null && config.getEquipmentModel() != null
|
||||||
|
&& config.getEquipmentModel().equals(equipmentModel)) {
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
throw new IllegalArgumentException("Profile Id " + profileId + " is not of type equipment_ap");
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public List<Profile> getChildrenOfType(long profileId, ProfileType childProfileType) {
|
public List<Profile> getChildrenOfType(long profileId, ProfileType childProfileType) {
|
||||||
Profile parent = profileMap.get(profileId);
|
Profile parent = profileMap.get(profileId);
|
||||||
List<Profile> ret = new ArrayList<>();
|
List<Profile> ret = new ArrayList<>();
|
||||||
|
|||||||
@@ -62,6 +62,8 @@ public class ProfileType implements EnumWithId {
|
|||||||
passpoint_venue = new ProfileType(12,"passpoint_venue"),
|
passpoint_venue = new ProfileType(12,"passpoint_venue"),
|
||||||
passpoint_osu_id_provider = new ProfileType(13,"passpoint_osu_id_provider"),
|
passpoint_osu_id_provider = new ProfileType(13,"passpoint_osu_id_provider"),
|
||||||
ap_event_rate = new ProfileType(14,"ap_event_rate"),
|
ap_event_rate = new ProfileType(14,"ap_event_rate"),
|
||||||
|
metrics = new ProfileType(15,"metrics"),
|
||||||
|
wired_ethernet_port = new ProfileType(16, "wired_ethernet_port"),
|
||||||
UNSUPPORTED = new ProfileType(-1, "UNSUPPORTED");
|
UNSUPPORTED = new ProfileType(-1, "UNSUPPORTED");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public class ApNetworkConfiguration extends CommonNetworkConfiguration
|
|||||||
public static final Boolean DEFAULT_SYNTHETIC_CLIENT_ENABLED = Boolean.TRUE;
|
public static final Boolean DEFAULT_SYNTHETIC_CLIENT_ENABLED = Boolean.TRUE;
|
||||||
public static final Boolean DEFAULT_LED_CONTROL_ENABLED = Boolean.TRUE;
|
public static final Boolean DEFAULT_LED_CONTROL_ENABLED = Boolean.TRUE;
|
||||||
public static final Boolean DEFAULT_EQUIPMENT_DISCOVERY_ENABLED = Boolean.FALSE;
|
public static final Boolean DEFAULT_EQUIPMENT_DISCOVERY_ENABLED = Boolean.FALSE;
|
||||||
|
public static final Boolean DEFAULT_DYNAMIC_RADIUS_PROXY_ENABLED = Boolean.FALSE;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Added as a profile level setting that can be used to provide
|
* Added as a profile level setting that can be used to provide
|
||||||
@@ -59,6 +60,7 @@ public class ApNetworkConfiguration extends CommonNetworkConfiguration
|
|||||||
setSyntheticClientEnabled(DEFAULT_SYNTHETIC_CLIENT_ENABLED);
|
setSyntheticClientEnabled(DEFAULT_SYNTHETIC_CLIENT_ENABLED);
|
||||||
setLedControlEnabled(DEFAULT_LED_CONTROL_ENABLED);
|
setLedControlEnabled(DEFAULT_LED_CONTROL_ENABLED);
|
||||||
setEquipmentDiscovery(DEFAULT_EQUIPMENT_DISCOVERY_ENABLED);
|
setEquipmentDiscovery(DEFAULT_EQUIPMENT_DISCOVERY_ENABLED);
|
||||||
|
setDynamicRadiusProxyEnabled(DEFAULT_DYNAMIC_RADIUS_PROXY_ENABLED);
|
||||||
|
|
||||||
// initialize the profile level radio map settings parameter
|
// initialize the profile level radio map settings parameter
|
||||||
radioMap = new EnumMap<>(RadioType.class);
|
radioMap = new EnumMap<>(RadioType.class);
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ public abstract class CommonNetworkConfiguration extends ProfileDetails {
|
|||||||
private Boolean syntheticClientEnabled;
|
private Boolean syntheticClientEnabled;
|
||||||
private Boolean ledControlEnabled;
|
private Boolean ledControlEnabled;
|
||||||
private Boolean equipmentDiscovery;
|
private Boolean equipmentDiscovery;
|
||||||
|
private Boolean dynamicRadiusProxyEnabled;
|
||||||
|
|
||||||
public CommonNetworkConfiguration() {
|
public CommonNetworkConfiguration() {
|
||||||
}
|
}
|
||||||
@@ -67,7 +68,6 @@ public abstract class CommonNetworkConfiguration extends ProfileDetails {
|
|||||||
this.vlanNative = bool;
|
this.vlanNative = bool;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public AutoOrManualString getNtpServer() {
|
public AutoOrManualString getNtpServer() {
|
||||||
return ntpServer;
|
return ntpServer;
|
||||||
}
|
}
|
||||||
@@ -92,8 +92,7 @@ public abstract class CommonNetworkConfiguration extends ProfileDetails {
|
|||||||
this.syntheticClientEnabled = syntheticClientEnabled;
|
this.syntheticClientEnabled = syntheticClientEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean isLedControlEnabled() {
|
||||||
public Boolean getLedControlEnabled() {
|
|
||||||
return ledControlEnabled;
|
return ledControlEnabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -109,6 +108,23 @@ public abstract class CommonNetworkConfiguration extends ProfileDetails {
|
|||||||
this.rtlsSettings = rtlsSettings;
|
this.rtlsSettings = rtlsSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Boolean isDynamicRadiusProxyEnabled() {
|
||||||
|
return dynamicRadiusProxyEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDynamicRadiusProxyEnabled(Boolean dynamicRadiusProxyEnabled) {
|
||||||
|
this.dynamicRadiusProxyEnabled = dynamicRadiusProxyEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Boolean getEquipmentDiscovery() {
|
||||||
|
return equipmentDiscovery;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEquipmentDiscovery(Boolean equipmentDiscovery) {
|
||||||
|
this.equipmentDiscovery = equipmentDiscovery;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CommonNetworkConfiguration clone() {
|
public CommonNetworkConfiguration clone() {
|
||||||
|
|
||||||
@@ -124,7 +140,9 @@ public abstract class CommonNetworkConfiguration extends ProfileDetails {
|
|||||||
ret.setVlan(getVlan());
|
ret.setVlan(getVlan());
|
||||||
ret.setVlanNative(isVlanNative());
|
ret.setVlanNative(isVlanNative());
|
||||||
ret.setSyntheticClientEnabled(getSyntheticClientEnabled());
|
ret.setSyntheticClientEnabled(getSyntheticClientEnabled());
|
||||||
|
ret.setLedControlEnabled(isLedControlEnabled());
|
||||||
|
ret.setEquipmentDiscovery(getEquipmentDiscovery());
|
||||||
|
ret.setDynamicRadiusProxyEnabled(isDynamicRadiusProxyEnabled());
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
@@ -145,26 +163,10 @@ public abstract class CommonNetworkConfiguration extends ProfileDetails {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getEquipmentDiscovery() {
|
|
||||||
return equipmentDiscovery;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setEquipmentDiscovery(Boolean equipmentDiscovery) {
|
|
||||||
this.equipmentDiscovery = equipmentDiscovery;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public Boolean getVlanNative() {
|
|
||||||
return vlanNative;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(equipmentDiscovery, equipmentType, ledControlEnabled, networkConfigVersion, ntpServer, rtlsSettings,
|
return Objects.hash(equipmentDiscovery, equipmentType, ledControlEnabled, networkConfigVersion, ntpServer, rtlsSettings,
|
||||||
syntheticClientEnabled, syslogRelay, vlan, vlanNative);
|
syntheticClientEnabled, syslogRelay, vlan, vlanNative, dynamicRadiusProxyEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -183,7 +185,8 @@ public abstract class CommonNetworkConfiguration extends ProfileDetails {
|
|||||||
&& Objects.equals(ntpServer, other.ntpServer) && Objects.equals(rtlsSettings, other.rtlsSettings)
|
&& Objects.equals(ntpServer, other.ntpServer) && Objects.equals(rtlsSettings, other.rtlsSettings)
|
||||||
&& Objects.equals(syntheticClientEnabled, other.syntheticClientEnabled)
|
&& Objects.equals(syntheticClientEnabled, other.syntheticClientEnabled)
|
||||||
&& Objects.equals(syslogRelay, other.syslogRelay) && vlan == other.vlan
|
&& Objects.equals(syslogRelay, other.syslogRelay) && vlan == other.vlan
|
||||||
&& Objects.equals(vlanNative, other.vlanNative);
|
&& Objects.equals(vlanNative, other.vlanNative)
|
||||||
|
&& Objects.equals(dynamicRadiusProxyEnabled, other.dynamicRadiusProxyEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ public class RadiusProxyConfiguration extends BaseJsonModel implements PushableC
|
|||||||
private Boolean useRadSec;
|
private Boolean useRadSec;
|
||||||
private String sharedSecret; // if useRadSec is false
|
private String sharedSecret; // if useRadSec is false
|
||||||
private String acctSharedSecret; // if useRadSec is false
|
private String acctSharedSecret; // if useRadSec is false
|
||||||
|
private String radiusProxySecret;
|
||||||
private Boolean dynamicDiscovery; // dynamic discovery of HSP and IdPs (home service and identity providers).
|
private Boolean dynamicDiscovery; // dynamic discovery of HSP and IdPs (home service and identity providers).
|
||||||
// regardless of configured value, this will only be set 'true' on the AP if useRadSec is also true.
|
// regardless of configured value, this will only be set 'true' on the AP if useRadSec is also true.
|
||||||
|
|
||||||
@@ -146,6 +147,14 @@ public class RadiusProxyConfiguration extends BaseJsonModel implements PushableC
|
|||||||
this.acctSharedSecret = acctSharedSecret;
|
this.acctSharedSecret = acctSharedSecret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getRadiusProxySecret() {
|
||||||
|
return radiusProxySecret;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRadiusProxySecret(String radiusProxySecret) {
|
||||||
|
this.radiusProxySecret = radiusProxySecret;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the dynamicDiscovery
|
* @return the dynamicDiscovery
|
||||||
*/
|
*/
|
||||||
@@ -174,7 +183,7 @@ public class RadiusProxyConfiguration extends BaseJsonModel implements PushableC
|
|||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(acctPort, acctServer, acctSharedSecret, caCert, clientCert, clientKey, dynamicDiscovery, name, passphrase, port, realm, server,
|
return Objects.hash(acctPort, acctServer, acctSharedSecret, caCert, clientCert, clientKey, dynamicDiscovery, name, passphrase, port, realm, server,
|
||||||
sharedSecret, useRadSec);
|
sharedSecret, useRadSec, radiusProxySecret);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -191,7 +200,8 @@ public class RadiusProxyConfiguration extends BaseJsonModel implements PushableC
|
|||||||
&& Objects.equals(clientCert, other.clientCert) && Objects.equals(clientKey, other.clientKey)
|
&& Objects.equals(clientCert, other.clientCert) && Objects.equals(clientKey, other.clientKey)
|
||||||
&& Objects.equals(dynamicDiscovery, other.dynamicDiscovery) && Objects.equals(name, other.name) && Objects.equals(passphrase, other.passphrase)
|
&& Objects.equals(dynamicDiscovery, other.dynamicDiscovery) && Objects.equals(name, other.name) && Objects.equals(passphrase, other.passphrase)
|
||||||
&& Objects.equals(port, other.port) && Objects.equals(realm, other.realm) && Objects.equals(server, other.server)
|
&& Objects.equals(port, other.port) && Objects.equals(realm, other.realm) && Objects.equals(server, other.server)
|
||||||
&& Objects.equals(sharedSecret, other.sharedSecret) && Objects.equals(useRadSec, other.useRadSec);
|
&& Objects.equals(sharedSecret, other.sharedSecret) && Objects.equals(useRadSec, other.useRadSec)
|
||||||
|
&& Objects.equals(radiusProxySecret, other.radiusProxySecret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class PasspointProfile extends ProfileDetails implements PushableConfigur
|
|||||||
private boolean enable2pt4GHz;
|
private boolean enable2pt4GHz;
|
||||||
private boolean enable5GHz;
|
private boolean enable5GHz;
|
||||||
|
|
||||||
private List<Long> associatedAccessSsidProfileIds;
|
private Set<Long> associatedAccessSsidProfileIds;
|
||||||
|
|
||||||
private Long osuSsidProfileId;
|
private Long osuSsidProfileId;
|
||||||
|
|
||||||
@@ -321,11 +321,11 @@ public class PasspointProfile extends ProfileDetails implements PushableConfigur
|
|||||||
this.passpointNetworkAuthenticationType = passpointNetworkAuthenticationType;
|
this.passpointNetworkAuthenticationType = passpointNetworkAuthenticationType;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Long> getAssociatedAccessSsidProfileIds() {
|
public Set<Long> getAssociatedAccessSsidProfileIds() {
|
||||||
return associatedAccessSsidProfileIds;
|
return associatedAccessSsidProfileIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setAssociatedAccessSsidProfileIds(List<Long> associatedAccessSsidProfileIds) {
|
public void setAssociatedAccessSsidProfileIds(Set<Long> associatedAccessSsidProfileIds) {
|
||||||
this.associatedAccessSsidProfileIds = associatedAccessSsidProfileIds;
|
this.associatedAccessSsidProfileIds = associatedAccessSsidProfileIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ import java.util.Collections;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
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.ChannelBandwidth;
|
||||||
import com.telecominfraproject.wlan.core.model.equipment.ChannelHopSettings;
|
import com.telecominfraproject.wlan.core.model.equipment.ChannelHopSettings;
|
||||||
@@ -81,6 +83,8 @@ public class RfElementConfiguration extends BaseJsonModel {
|
|||||||
private Integer eirpTxPower;
|
private Integer eirpTxPower;
|
||||||
private RadioBestApSettings bestApSettings;
|
private RadioBestApSettings bestApSettings;
|
||||||
|
|
||||||
|
private Set<Integer> autoExclusionChannels = new TreeSet<Integer>();
|
||||||
|
|
||||||
private RfElementConfiguration() {
|
private RfElementConfiguration() {
|
||||||
long timestamp = System.currentTimeMillis();
|
long timestamp = System.currentTimeMillis();
|
||||||
setRf("DefaultRf-" + timestamp);
|
setRf("DefaultRf-" + timestamp);
|
||||||
@@ -112,7 +116,7 @@ public class RfElementConfiguration extends BaseJsonModel {
|
|||||||
ret.setMinAutoCellSize(MIN_CELL_SIZE_MAP.get(radioType));
|
ret.setMinAutoCellSize(MIN_CELL_SIZE_MAP.get(radioType));
|
||||||
ret.setMaxAutoCellSize(MAX_CELL_SIZE_MAP.get(radioType));
|
ret.setMaxAutoCellSize(MAX_CELL_SIZE_MAP.get(radioType));
|
||||||
if (radioType == RadioType.is5GHz || radioType == RadioType.is5GHzL || radioType == RadioType.is5GHzU) {
|
if (radioType == RadioType.is5GHz || radioType == RadioType.is5GHzL || radioType == RadioType.is5GHzU) {
|
||||||
ret.setChannelBandwidth(ChannelBandwidth.is80MHz);
|
ret.setChannelBandwidth(ChannelBandwidth.is40MHz);
|
||||||
ret.setRadioMode(RadioMode.modeAC);
|
ret.setRadioMode(RadioMode.modeAC);
|
||||||
} else {
|
} else {
|
||||||
ret.setChannelBandwidth(ChannelBandwidth.is20MHz);
|
ret.setChannelBandwidth(ChannelBandwidth.is20MHz);
|
||||||
@@ -323,17 +327,16 @@ public class RfElementConfiguration extends BaseJsonModel {
|
|||||||
this.minAutoCellSize = minAutoCellSize;
|
this.minAutoCellSize = minAutoCellSize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Always return default value
|
||||||
public Integer getMaxAutoCellSize() {
|
public Integer getMaxAutoCellSize() {
|
||||||
if (maxAutoCellSize == null) {
|
|
||||||
if (MAX_CELL_SIZE_MAP.containsKey(this.radioType)) {
|
if (MAX_CELL_SIZE_MAP.containsKey(this.radioType)) {
|
||||||
return MAX_CELL_SIZE_MAP.get(this.radioType);
|
return MAX_CELL_SIZE_MAP.get(this.radioType);
|
||||||
} else {
|
} else {
|
||||||
return MAX_CELL_SIZE_MAP.get(RadioType.is2dot4GHz);
|
return MAX_CELL_SIZE_MAP.get(RadioType.is2dot4GHz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return maxAutoCellSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// not allow user to configure
|
||||||
public void setMaxAutoCellSize(Integer maxAutoCellSize) {
|
public void setMaxAutoCellSize(Integer maxAutoCellSize) {
|
||||||
this.maxAutoCellSize = maxAutoCellSize;
|
this.maxAutoCellSize = maxAutoCellSize;
|
||||||
}
|
}
|
||||||
@@ -362,9 +365,25 @@ public class RfElementConfiguration extends BaseJsonModel {
|
|||||||
this.bestApSettings = bestApSettings;
|
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
|
@Override
|
||||||
public RfElementConfiguration clone() {
|
public RfElementConfiguration clone() {
|
||||||
return (RfElementConfiguration) super.clone();
|
RfElementConfiguration ret = (RfElementConfiguration) super.clone();
|
||||||
|
|
||||||
|
if (autoExclusionChannels != null) {
|
||||||
|
ret.autoExclusionChannels = new TreeSet<>(autoExclusionChannels);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -409,7 +428,7 @@ public class RfElementConfiguration extends BaseJsonModel {
|
|||||||
channelBandwidth, channelHopSettings, clientDisconnectThresholdDb, eirpTxPower, forceScanDuringVoice,
|
channelBandwidth, channelHopSettings, clientDisconnectThresholdDb, eirpTxPower, forceScanDuringVoice,
|
||||||
managementRate, maxNumClients, mimoMode, minAutoCellSize, multicastRate, neighbouringListApConfig,
|
managementRate, maxNumClients, mimoMode, minAutoCellSize, multicastRate, neighbouringListApConfig,
|
||||||
perimeterDetectionEnabled, probeResponseThresholdDb, radioMode, radioType, rf, rtsCtsThreshold,
|
perimeterDetectionEnabled, probeResponseThresholdDb, radioMode, radioType, rf, rtsCtsThreshold,
|
||||||
rxCellSizeDb, autoCellSizeSelection, maxAutoCellSize);
|
rxCellSizeDb, autoCellSizeSelection, maxAutoCellSize, autoExclusionChannels);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -439,7 +458,8 @@ public class RfElementConfiguration extends BaseJsonModel {
|
|||||||
&& Objects.equals(probeResponseThresholdDb, other.probeResponseThresholdDb)
|
&& Objects.equals(probeResponseThresholdDb, other.probeResponseThresholdDb)
|
||||||
&& radioMode == other.radioMode && radioType == other.radioType && Objects.equals(rf, other.rf)
|
&& radioMode == other.radioMode && radioType == other.radioType && Objects.equals(rf, other.rf)
|
||||||
&& Objects.equals(rtsCtsThreshold, other.rtsCtsThreshold)
|
&& Objects.equals(rtsCtsThreshold, other.rtsCtsThreshold)
|
||||||
&& Objects.equals(rxCellSizeDb, other.rxCellSizeDb);
|
&& Objects.equals(rxCellSizeDb, other.rxCellSizeDb)
|
||||||
|
&& Objects.equals(autoExclusionChannels, other.autoExclusionChannels);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,16 @@
|
|||||||
package com.telecominfraproject.wlan.profile.rf.models;
|
package com.telecominfraproject.wlan.profile.rf.models;
|
||||||
|
|
||||||
import static org.junit.Assert.assertEquals;
|
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 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 org.junit.Test;
|
||||||
|
|
||||||
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
|
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
|
||||||
@@ -56,4 +64,45 @@ public class RfConfigurationTests {
|
|||||||
rfConfig2_4.setRadioMode(RadioMode.modeGN);
|
rfConfig2_4.setRadioMode(RadioMode.modeGN);
|
||||||
rfConfig5.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));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testMaxAutoCellSize() {
|
||||||
|
RfElementConfiguration rfConfig = RfElementConfiguration.createWithDefaults(RadioType.is5GHz);
|
||||||
|
assertNotNull(rfConfig.getMaxAutoCellSize());
|
||||||
|
|
||||||
|
assertEquals(RfElementConfiguration.DEFAULT_MAX_CELL_SIZE_DB, rfConfig.getMaxAutoCellSize().intValue());
|
||||||
|
|
||||||
|
rfConfig.setMaxAutoCellSize(-93);
|
||||||
|
//getMaxAutoCellSize always return default MaxAutoCellSize
|
||||||
|
assertEquals(RfElementConfiguration.DEFAULT_MAX_CELL_SIZE_DB, rfConfig.getMaxAutoCellSize().intValue());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ import com.telecominfraproject.wlan.profile.models.ProfileType;
|
|||||||
import com.telecominfraproject.wlan.profile.models.events.ProfileAddedEvent;
|
import com.telecominfraproject.wlan.profile.models.events.ProfileAddedEvent;
|
||||||
import com.telecominfraproject.wlan.profile.models.events.ProfileChangedEvent;
|
import com.telecominfraproject.wlan.profile.models.events.ProfileChangedEvent;
|
||||||
import com.telecominfraproject.wlan.profile.models.events.ProfileRemovedEvent;
|
import com.telecominfraproject.wlan.profile.models.events.ProfileRemovedEvent;
|
||||||
|
import com.telecominfraproject.wlan.profile.passpoint.models.PasspointProfile;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -210,6 +211,20 @@ public class ProfileController {
|
|||||||
throw new DsDataValidationException("Profile contains unsupported value");
|
throw new DsDataValidationException("Profile contains unsupported value");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// WIFI-6855: To handle SSID-Passpoint association update when SSID profiles are updated
|
||||||
|
// If the passpoint profile update is requested, but no change is made to the details, then skip the update
|
||||||
|
if (profile.getProfileType().equals(ProfileType.passpoint)) {
|
||||||
|
Profile existingProfile = profileDatastore.getOrNull(profile.getId());
|
||||||
|
if (existingProfile != null) {
|
||||||
|
PasspointProfile existingDetails = (PasspointProfile) existingProfile.getDetails();
|
||||||
|
PasspointProfile newDetails = (PasspointProfile) profile.getDetails();
|
||||||
|
if (existingDetails.equals(newDetails)) {
|
||||||
|
LOG.info("No change was made to this profile, skip update on profile {}", profile.getId());
|
||||||
|
return profile;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Profile ret = profileDatastore.update(profile);
|
Profile ret = profileDatastore.update(profile);
|
||||||
|
|
||||||
LOG.debug("Updated Profile {}", ret);
|
LOG.debug("Updated Profile {}", ret);
|
||||||
|
|||||||
@@ -1,4 +1,6 @@
|
|||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>com.telecominfraproject.wlan</groupId>
|
<groupId>com.telecominfraproject.wlan</groupId>
|
||||||
@@ -72,6 +74,18 @@
|
|||||||
<version>1.2.0-SNAPSHOT</version>
|
<version>1.2.0-SNAPSHOT</version>
|
||||||
</dependency>
|
</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 -->
|
<!-- models used by the application logic of the stream processor -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<artifactId>equipment-models</artifactId>
|
<artifactId>equipment-models</artifactId>
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
package com.telecominfraproject.wlan.streams.provisioning;
|
package com.telecominfraproject.wlan.streams.provisioning;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@@ -12,29 +13,40 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import com.telecominfraproject.wlan.alarm.AlarmServiceInterface;
|
||||||
|
import com.telecominfraproject.wlan.alarm.models.Alarm;
|
||||||
|
import com.telecominfraproject.wlan.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.json.BaseJsonModel;
|
||||||
import com.telecominfraproject.wlan.core.model.pagination.PaginationContext;
|
import com.telecominfraproject.wlan.core.model.pagination.PaginationContext;
|
||||||
import com.telecominfraproject.wlan.core.model.pagination.PaginationResponse;
|
import com.telecominfraproject.wlan.core.model.pagination.PaginationResponse;
|
||||||
import com.telecominfraproject.wlan.core.model.pair.PairLongLong;
|
import com.telecominfraproject.wlan.core.model.pair.PairLongLong;
|
||||||
import com.telecominfraproject.wlan.core.model.streams.QueuedStreamMessage;
|
import com.telecominfraproject.wlan.core.model.streams.QueuedStreamMessage;
|
||||||
import com.telecominfraproject.wlan.equipment.EquipmentServiceInterface;
|
import com.telecominfraproject.wlan.equipment.EquipmentServiceInterface;
|
||||||
|
import com.telecominfraproject.wlan.equipment.models.ApElementConfiguration;
|
||||||
import com.telecominfraproject.wlan.equipment.models.Equipment;
|
import com.telecominfraproject.wlan.equipment.models.Equipment;
|
||||||
import com.telecominfraproject.wlan.equipment.models.events.EquipmentApImpactingChangedEvent;
|
import com.telecominfraproject.wlan.equipment.models.events.EquipmentApImpactingChangedEvent;
|
||||||
|
import com.telecominfraproject.wlan.equipment.models.events.EquipmentBlinkLEDsEvent;
|
||||||
import com.telecominfraproject.wlan.equipment.models.events.EquipmentCellSizeAttributesChangedEvent;
|
import com.telecominfraproject.wlan.equipment.models.events.EquipmentCellSizeAttributesChangedEvent;
|
||||||
import com.telecominfraproject.wlan.equipment.models.events.EquipmentChannelsChangedEvent;
|
import com.telecominfraproject.wlan.equipment.models.events.EquipmentChannelsChangedEvent;
|
||||||
|
import com.telecominfraproject.wlan.equipment.models.events.EquipmentCustomerChangedEvent;
|
||||||
import com.telecominfraproject.wlan.equipment.models.events.EquipmentRemovedEvent;
|
import com.telecominfraproject.wlan.equipment.models.events.EquipmentRemovedEvent;
|
||||||
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWBaseCommand;
|
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWBaseCommand;
|
||||||
|
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWBlinkRequest;
|
||||||
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWCloseSessionRequest;
|
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWCloseSessionRequest;
|
||||||
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWConfigChangeNotification;
|
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWConfigChangeNotification;
|
||||||
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWNewChannelRequest;
|
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWNewChannelRequest;
|
||||||
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWCellSizeAttributesRequest;
|
import com.telecominfraproject.wlan.equipmentgateway.models.CEGWCellSizeAttributesRequest;
|
||||||
import com.telecominfraproject.wlan.equipmentgateway.service.EquipmentGatewayServiceInterface;
|
import com.telecominfraproject.wlan.equipmentgateway.service.EquipmentGatewayServiceInterface;
|
||||||
import com.telecominfraproject.wlan.location.models.events.LocationChangedApImpactingEvent;
|
|
||||||
import com.telecominfraproject.wlan.profile.ProfileServiceInterface;
|
import com.telecominfraproject.wlan.profile.ProfileServiceInterface;
|
||||||
import com.telecominfraproject.wlan.profile.models.Profile;
|
import com.telecominfraproject.wlan.profile.models.Profile;
|
||||||
import com.telecominfraproject.wlan.profile.models.events.ProfileAddedEvent;
|
import com.telecominfraproject.wlan.profile.models.events.ProfileAddedEvent;
|
||||||
import com.telecominfraproject.wlan.profile.models.events.ProfileChangedEvent;
|
import com.telecominfraproject.wlan.profile.models.events.ProfileChangedEvent;
|
||||||
import com.telecominfraproject.wlan.profile.models.events.ProfileRemovedEvent;
|
import com.telecominfraproject.wlan.profile.models.events.ProfileRemovedEvent;
|
||||||
|
import com.telecominfraproject.wlan.status.StatusServiceInterface;
|
||||||
|
import com.telecominfraproject.wlan.status.models.Status;
|
||||||
|
import com.telecominfraproject.wlan.status.models.StatusDataType;
|
||||||
import com.telecominfraproject.wlan.stream.StreamProcessor;
|
import com.telecominfraproject.wlan.stream.StreamProcessor;
|
||||||
import com.telecominfraproject.wlan.systemevent.models.SystemEvent;
|
import com.telecominfraproject.wlan.systemevent.models.SystemEvent;
|
||||||
import com.telecominfraproject.wlan.systemevent.models.SystemEventRecord;
|
import com.telecominfraproject.wlan.systemevent.models.SystemEventRecord;
|
||||||
@@ -61,25 +73,25 @@ public class EquipmentConfigPushTrigger extends StreamProcessor {
|
|||||||
private ProfileServiceInterface profileServiceInterface;
|
private ProfileServiceInterface profileServiceInterface;
|
||||||
@Autowired
|
@Autowired
|
||||||
private EquipmentServiceInterface equipmentServiceInterface;
|
private EquipmentServiceInterface equipmentServiceInterface;
|
||||||
|
@Autowired
|
||||||
|
private StatusServiceInterface statusServiceInterface;
|
||||||
|
@Autowired
|
||||||
|
private AlarmServiceInterface alarmServiceInterface;
|
||||||
|
@Autowired
|
||||||
|
private ClientServiceInterface clientServiceInterface;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean acceptMessage(QueuedStreamMessage message) {
|
protected boolean acceptMessage(QueuedStreamMessage message) {
|
||||||
boolean ret = message.getTopic().equals(systemEventsTopic);
|
boolean ret = message.getTopic().equals(systemEventsTopic);
|
||||||
|
|
||||||
if(ret && ( message.getModel() instanceof SystemEventRecord) ) {
|
if (ret && (message.getModel() instanceof SystemEventRecord)) {
|
||||||
|
|
||||||
SystemEventRecord ser = (SystemEventRecord) message.getModel();
|
SystemEventRecord ser = (SystemEventRecord) message.getModel();
|
||||||
ret = ret &&
|
ret = ret && (ser.getDetails() instanceof EquipmentApImpactingChangedEvent || ser.getDetails() instanceof EquipmentBlinkLEDsEvent
|
||||||
(
|
|| ser.getDetails() instanceof EquipmentChannelsChangedEvent || ser.getDetails() instanceof EquipmentCellSizeAttributesChangedEvent
|
||||||
ser.getDetails() instanceof EquipmentApImpactingChangedEvent ||
|
|| ser.getDetails() instanceof EquipmentRemovedEvent || ser.getDetails() instanceof ProfileAddedEvent
|
||||||
ser.getDetails() instanceof EquipmentChannelsChangedEvent ||
|
|| ser.getDetails() instanceof ProfileChangedEvent || ser.getDetails() instanceof ProfileRemovedEvent
|
||||||
ser.getDetails() instanceof EquipmentCellSizeAttributesChangedEvent ||
|
|| ser.getDetails() instanceof EquipmentCustomerChangedEvent);
|
||||||
ser.getDetails() instanceof EquipmentRemovedEvent ||
|
|
||||||
ser.getDetails() instanceof ProfileAddedEvent ||
|
|
||||||
ser.getDetails() instanceof ProfileChangedEvent ||
|
|
||||||
ser.getDetails() instanceof ProfileRemovedEvent ||
|
|
||||||
ser.getDetails() instanceof LocationChangedApImpactingEvent
|
|
||||||
);
|
|
||||||
} else {
|
} else {
|
||||||
ret = false;
|
ret = false;
|
||||||
}
|
}
|
||||||
@@ -95,7 +107,7 @@ public class EquipmentConfigPushTrigger extends StreamProcessor {
|
|||||||
SystemEvent se = mdl.getDetails();
|
SystemEvent se = mdl.getDetails();
|
||||||
LOG.debug("Processing {}", mdl);
|
LOG.debug("Processing {}", mdl);
|
||||||
|
|
||||||
switch ( se.getClass().getSimpleName() ) {
|
switch (se.getClass().getSimpleName()) {
|
||||||
case "EquipmentApImpactingChangedEvent":
|
case "EquipmentApImpactingChangedEvent":
|
||||||
process((EquipmentApImpactingChangedEvent) se);
|
process((EquipmentApImpactingChangedEvent) se);
|
||||||
break;
|
break;
|
||||||
@@ -105,6 +117,9 @@ public class EquipmentConfigPushTrigger extends StreamProcessor {
|
|||||||
case "EquipmentCellSizeAttributesChangedEvent":
|
case "EquipmentCellSizeAttributesChangedEvent":
|
||||||
process((EquipmentCellSizeAttributesChangedEvent) se);
|
process((EquipmentCellSizeAttributesChangedEvent) se);
|
||||||
break;
|
break;
|
||||||
|
case "EquipmentBlinkLEDsEvent":
|
||||||
|
process((EquipmentBlinkLEDsEvent) se);
|
||||||
|
break;
|
||||||
case "EquipmentRemovedEvent":
|
case "EquipmentRemovedEvent":
|
||||||
process((EquipmentRemovedEvent) se);
|
process((EquipmentRemovedEvent) se);
|
||||||
break;
|
break;
|
||||||
@@ -117,9 +132,8 @@ public class EquipmentConfigPushTrigger extends StreamProcessor {
|
|||||||
case "ProfileRemovedEvent":
|
case "ProfileRemovedEvent":
|
||||||
process((ProfileRemovedEvent) se);
|
process((ProfileRemovedEvent) se);
|
||||||
break;
|
break;
|
||||||
case "LocationChangedApImpactingEvent":
|
case "EquipmentCustomerChangedEvent":
|
||||||
process((LocationChangedApImpactingEvent) se);
|
process((EquipmentCustomerChangedEvent) se);
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
process(mdl);
|
process(mdl);
|
||||||
}
|
}
|
||||||
@@ -128,25 +142,32 @@ public class EquipmentConfigPushTrigger extends StreamProcessor {
|
|||||||
|
|
||||||
private void process(EquipmentApImpactingChangedEvent model) {
|
private void process(EquipmentApImpactingChangedEvent model) {
|
||||||
LOG.debug("Processing EquipmentChangedEvent");
|
LOG.debug("Processing EquipmentChangedEvent");
|
||||||
equipmentGatewayInterface.sendCommand(new CEGWConfigChangeNotification(model.getPayload().getInventoryId(),
|
equipmentGatewayInterface.sendCommand(new CEGWConfigChangeNotification(model.getPayload().getInventoryId(), model.getEquipmentId()));
|
||||||
model.getEquipmentId()));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void process(EquipmentChannelsChangedEvent model) {
|
private void process(EquipmentChannelsChangedEvent model) {
|
||||||
LOG.debug("Processing EquipmentChannelsChangedEvent for equipmentId {}", model.getEquipmentId());
|
LOG.debug("Processing EquipmentChannelsChangedEvent for equipmentId {}", model.getEquipmentId());
|
||||||
equipmentGatewayInterface.sendCommand(new CEGWNewChannelRequest(model.getPayload().getInventoryId(),
|
equipmentGatewayInterface.sendCommand(new CEGWNewChannelRequest(model.getPayload().getInventoryId(), model.getEquipmentId(),
|
||||||
model.getEquipmentId(), model.getNewBackupChannels(), model.getNewPrimaryChannels()));
|
model.getNewBackupChannels(), model.getNewPrimaryChannels()));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void process(EquipmentCellSizeAttributesChangedEvent model) {
|
private void process(EquipmentCellSizeAttributesChangedEvent model) {
|
||||||
LOG.debug("Processing EquipmentCellSizeAttributesChangedEvent for equipmentId {}", model.getEquipmentId());
|
LOG.debug("Processing EquipmentCellSizeAttributesChangedEvent for equipmentId {}", model.getEquipmentId());
|
||||||
equipmentGatewayInterface.sendCommand(new CEGWCellSizeAttributesRequest(model.getPayload().getInventoryId(),
|
equipmentGatewayInterface
|
||||||
model.getEquipmentId(), model.getCellSizeAttributesMap()));
|
.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) {
|
private void process(EquipmentRemovedEvent model) {
|
||||||
LOG.debug("Processing EquipmentRemovedEvent");
|
LOG.debug("Processing EquipmentRemovedEvent");
|
||||||
equipmentGatewayInterface.sendCommand(new CEGWCloseSessionRequest(model.getPayload().getInventoryId(), model.getEquipmentId()));
|
equipmentGatewayInterface.sendCommand(new CEGWCloseSessionRequest(model.getPayload().getInventoryId(), model.getEquipmentId()));
|
||||||
|
cleanUpClientSessions(model.getPayload());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void process(ProfileAddedEvent model) {
|
private void process(ProfileAddedEvent model) {
|
||||||
@@ -164,29 +185,28 @@ public class EquipmentConfigPushTrigger extends StreamProcessor {
|
|||||||
processProfile(model.getPayload());
|
processProfile(model.getPayload());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void processProfile(Profile profile) {
|
private void processProfile(Profile profile) {
|
||||||
|
|
||||||
List<PairLongLong> ret = profileServiceInterface.getTopLevelProfiles(new HashSet<>(Arrays.asList(profile.getId())));
|
List<PairLongLong> ret = profileServiceInterface.getTopLevelProfiles(new HashSet<>(Arrays.asList(profile.getId())));
|
||||||
if(ret == null || ret.isEmpty()) {
|
if (ret == null || ret.isEmpty()) {
|
||||||
//nothing to do here
|
// nothing to do here
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Set<Long> parentProfileIds = new HashSet<>();
|
Set<Long> parentProfileIds = new HashSet<>();
|
||||||
ret.forEach(p -> parentProfileIds.add(p.getValue2()));
|
ret.forEach(p -> parentProfileIds.add(p.getValue2()));
|
||||||
|
|
||||||
//go through all equipmentIds that refer to parent profiles and trigger change config notification on them
|
// go through all equipmentIds that refer to parent profiles and trigger change config notification on them
|
||||||
PaginationContext<PairLongLong> context = new PaginationContext<>(100);
|
PaginationContext<PairLongLong> context = new PaginationContext<>(100);
|
||||||
|
|
||||||
while(!context.isLastPage()) {
|
while (!context.isLastPage()) {
|
||||||
PaginationResponse<PairLongLong> page = equipmentServiceInterface.getEquipmentIdsByProfileIds(parentProfileIds, context );
|
PaginationResponse<PairLongLong> page = equipmentServiceInterface.getEquipmentIdsByProfileIds(parentProfileIds, context);
|
||||||
context = page.getContext();
|
context = page.getContext();
|
||||||
|
|
||||||
Set<Long> equipmentIds = new HashSet<>();
|
Set<Long> equipmentIds = new HashSet<>();
|
||||||
page.getItems().forEach(p -> equipmentIds.add(p.getValue2()));
|
page.getItems().forEach(p -> equipmentIds.add(p.getValue2()));
|
||||||
|
|
||||||
//retrieve full equipment objects to get the inventory id
|
// retrieve full equipment objects to get the inventory id
|
||||||
List<Equipment> equipmentForPage = equipmentServiceInterface.get(equipmentIds);
|
List<Equipment> equipmentForPage = equipmentServiceInterface.get(equipmentIds);
|
||||||
|
|
||||||
List<CEGWBaseCommand> commands = new ArrayList<>(equipmentForPage.size());
|
List<CEGWBaseCommand> commands = new ArrayList<>(equipmentForPage.size());
|
||||||
@@ -199,32 +219,42 @@ public class EquipmentConfigPushTrigger extends StreamProcessor {
|
|||||||
LOG.debug("Finished processing profile {}", profile.getId());
|
LOG.debug("Finished processing profile {}", profile.getId());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void process(LocationChangedApImpactingEvent model) {
|
private void process(EquipmentCustomerChangedEvent model) {
|
||||||
LOG.debug("Processing LocationChangedApImpactingEvent {}", model.getPayload().getId());
|
LOG.info("Processing EquipmentCustomerChangedEvent {}", model.getPayload().getId());
|
||||||
|
|
||||||
Set<Long> locationIds = new HashSet<>(Arrays.asList(model.getPayload().getId()));
|
Equipment existingEquipment = model.getExistingEquipment();
|
||||||
|
Equipment equipment = model.getEquipment();
|
||||||
|
|
||||||
//go through all equipmentIds that reside in the specified location and trigger change config notification on them
|
// when customerId changes, we keep the EQUIPMENT_ADMIN and PROTOCOL status of the AP
|
||||||
PaginationContext<PairLongLong> context = new PaginationContext<>(100);
|
Status status = statusServiceInterface.getOrNull(existingEquipment.getCustomerId(), existingEquipment.getId(), StatusDataType.EQUIPMENT_ADMIN);
|
||||||
|
if (status != null) {
|
||||||
while(!context.isLastPage()) {
|
status.setCustomerId(equipment.getCustomerId());
|
||||||
PaginationResponse<PairLongLong> page = equipmentServiceInterface.getEquipmentIdsByLocationIds(locationIds, context );
|
statusServiceInterface.update(status);
|
||||||
context = page.getContext();
|
}
|
||||||
|
status = statusServiceInterface.getOrNull(existingEquipment.getCustomerId(), existingEquipment.getId(), StatusDataType.PROTOCOL);
|
||||||
Set<Long> equipmentIds = new HashSet<>();
|
if (status != null) {
|
||||||
page.getItems().forEach(p -> equipmentIds.add(p.getValue2()));
|
status.setCustomerId(equipment.getCustomerId());
|
||||||
|
statusServiceInterface.update(status);
|
||||||
//retrieve full equipment objects to get the inventory id
|
}
|
||||||
List<Equipment> equipmentForPage = equipmentServiceInterface.get(equipmentIds);
|
status = statusServiceInterface.getOrNull(existingEquipment.getCustomerId(), existingEquipment.getId(), StatusDataType.FIRMWARE);
|
||||||
|
if (status != null) {
|
||||||
List<CEGWBaseCommand> commands = new ArrayList<>(equipmentForPage.size());
|
status.setCustomerId(equipment.getCustomerId());
|
||||||
equipmentForPage.forEach(eq -> commands.add(new CEGWConfigChangeNotification(eq.getInventoryId(), eq.getId())));
|
statusServiceInterface.update(status);
|
||||||
|
|
||||||
equipmentGatewayInterface.sendCommands(commands);
|
|
||||||
LOG.debug("Page {} - sent {} commands to equipment gateway", context.getLastReturnedPageNumber(), commands.size());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
LOG.debug("Finished processing LocationChangedApImpactingEvent {}", model.getPayload().getId());
|
// 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());
|
||||||
|
|
||||||
|
// Disconnect all associated client devices from existing equipment
|
||||||
|
disconnectClients(existingEquipment);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,5 +262,54 @@ public class EquipmentConfigPushTrigger extends StreamProcessor {
|
|||||||
LOG.warn("Unprocessed model: {}", model);
|
LOG.warn("Unprocessed model: {}", model);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void disconnectClients(Equipment ce) {
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
||||||
|
|
||||||
|
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.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void cleanUpClientSessions(Equipment ce) {
|
||||||
|
LOG.info("EquipmentConfigPushTrigger::cleanUpClientSessions for Equipment {}", ce);
|
||||||
|
PaginationResponse<ClientSession> clientSessions = clientServiceInterface.getSessionsForCustomer(
|
||||||
|
ce.getCustomerId(), Set.of(ce.getId()), Set.of(ce.getLocationId()), null, null,
|
||||||
|
new PaginationContext<ClientSession>(100));
|
||||||
|
|
||||||
|
if (clientSessions.getItems().isEmpty() || clientSessions == null) {
|
||||||
|
LOG.info("There are no existing client sessions to clean up.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
clientSessions.getItems().stream().forEach(c -> clientServiceInterface.deleteSession(c.getCustomerId(), c.getEquipmentId(), c.getMacAddress()));
|
||||||
|
|
||||||
|
LOG.info("Cleaned up client sessions for deleted Equipment {}", ce.getId());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -115,10 +115,6 @@ public abstract class BaseServiceMetricDatastoreTest {
|
|||||||
serviceMetric.setClientMac(testSequence.incrementAndGet());
|
serviceMetric.setClientMac(testSequence.incrementAndGet());
|
||||||
serviceMetric.setCreatedTimestamp(baseTimestamp - 100000 + testSequence.incrementAndGet());
|
serviceMetric.setCreatedTimestamp(baseTimestamp - 100000 + testSequence.incrementAndGet());
|
||||||
|
|
||||||
ClientMetrics details2 = new ClientMetrics();
|
|
||||||
details2.setClassificationName("qr_"+apNameIdx);
|
|
||||||
serviceMetric.setDetails(details2);
|
|
||||||
|
|
||||||
apNameIdx++;
|
apNameIdx++;
|
||||||
|
|
||||||
testInterface.create(serviceMetric);
|
testInterface.create(serviceMetric);
|
||||||
@@ -133,10 +129,6 @@ public abstract class BaseServiceMetricDatastoreTest {
|
|||||||
serviceMetric.setClientMac(testSequence.incrementAndGet());
|
serviceMetric.setClientMac(testSequence.incrementAndGet());
|
||||||
serviceMetric.setCreatedTimestamp(baseTimestamp + testSequence.incrementAndGet());
|
serviceMetric.setCreatedTimestamp(baseTimestamp + testSequence.incrementAndGet());
|
||||||
|
|
||||||
ClientMetrics details2 = new ClientMetrics();
|
|
||||||
details2.setClassificationName("qr_"+apNameIdx);
|
|
||||||
serviceMetric.setDetails(details2);
|
|
||||||
|
|
||||||
apNameIdx++;
|
apNameIdx++;
|
||||||
|
|
||||||
testInterface.create(serviceMetric);
|
testInterface.create(serviceMetric);
|
||||||
@@ -151,10 +143,6 @@ public abstract class BaseServiceMetricDatastoreTest {
|
|||||||
serviceMetric.setClientMac(testSequence.incrementAndGet());
|
serviceMetric.setClientMac(testSequence.incrementAndGet());
|
||||||
serviceMetric.setCreatedTimestamp(baseTimestamp - 100000 + testSequence.incrementAndGet());
|
serviceMetric.setCreatedTimestamp(baseTimestamp - 100000 + testSequence.incrementAndGet());
|
||||||
|
|
||||||
ClientMetrics details2 = new ClientMetrics();
|
|
||||||
details2.setClassificationName("qr_"+apNameIdx);
|
|
||||||
serviceMetric.setDetails(details2);
|
|
||||||
|
|
||||||
apNameIdx++;
|
apNameIdx++;
|
||||||
|
|
||||||
testInterface.create(serviceMetric);
|
testInterface.create(serviceMetric);
|
||||||
@@ -200,43 +188,18 @@ public abstract class BaseServiceMetricDatastoreTest {
|
|||||||
assertTrue(page6.getContext().isLastPage());
|
assertTrue(page6.getContext().isLastPage());
|
||||||
assertTrue(page7.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)
|
//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);
|
PaginationResponse<ServiceMetric> page1EmptySort = testInterface.getForCustomer(fromTime, toTime, customerId_1, null, null, null, null, Collections.emptyList(), context);
|
||||||
assertEquals(10, page1EmptySort.getItems().size());
|
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)
|
//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);
|
PaginationResponse<ServiceMetric> page1NullSort = testInterface.getForCustomer(fromTime, toTime, customerId_1, null, null, null, null, null, context);
|
||||||
assertEquals(10, page1NullSort.getItems().size());
|
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
|
//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);
|
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());
|
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_1, eqId, System.currentTimeMillis()));
|
||||||
used_equipmentIds.forEach(eqId -> testInterface.delete(customerId_2, eqId, System.currentTimeMillis()));
|
used_equipmentIds.forEach(eqId -> testInterface.delete(customerId_2, eqId, System.currentTimeMillis()));
|
||||||
|
|
||||||
@@ -336,7 +299,6 @@ public abstract class BaseServiceMetricDatastoreTest {
|
|||||||
serviceMetric.setCreatedTimestamp(baseTimestamp - testSequence.incrementAndGet());
|
serviceMetric.setCreatedTimestamp(baseTimestamp - testSequence.incrementAndGet());
|
||||||
|
|
||||||
ClientMetrics details2 = new ClientMetrics();
|
ClientMetrics details2 = new ClientMetrics();
|
||||||
details2.setClassificationName("qr_"+apNameIdx);
|
|
||||||
serviceMetric.setDetails(details2);
|
serviceMetric.setDetails(details2);
|
||||||
|
|
||||||
testInterface.create(serviceMetric);
|
testInterface.create(serviceMetric);
|
||||||
|
|||||||
@@ -15,11 +15,8 @@ import org.springframework.util.CollectionUtils;
|
|||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
|
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
|
||||||
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
|
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.ServiceMetricDataType;
|
||||||
import com.telecominfraproject.wlan.servicemetric.models.ServiceMetricDetails;
|
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.
|
* 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, List<RadioUtilization>> radioUtilizationPerRadio = new EnumMap<>(RadioType.class);
|
||||||
|
|
||||||
|
|
||||||
private Map<RadioType, RadioStatistics> radioStatsPerRadio = 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() {
|
public Integer getPeriodLengthSec() {
|
||||||
return periodLengthSec;
|
return periodLengthSec;
|
||||||
}
|
}
|
||||||
@@ -262,25 +253,6 @@ public class ApNodeMetrics extends ServiceMetricDetails
|
|||||||
this.radioStatsPerRadio.put(radioType, radioStats);
|
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
|
// Utility Functions
|
||||||
//
|
//
|
||||||
@@ -404,31 +376,14 @@ public class ApNodeMetrics extends ServiceMetricDetails
|
|||||||
this.radioStatsPerRadio = radioStatsPerRadio;
|
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
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
final int prime = 31;
|
final int prime = 31;
|
||||||
int result = super.hashCode();
|
int result = super.hashCode();
|
||||||
result = prime * result + Objects.hash(apPerformance, channelUtilizationPerRadio, clientMacAddressesPerRadio,
|
result = prime * result + Objects.hash(apPerformance, channelUtilizationPerRadio, clientMacAddressesPerRadio,
|
||||||
cloudLinkAvailability, cloudLinkLatencyInMs, mcsStatsPerRadio, networkProbeMetrics, noiseFloorPerRadio,
|
cloudLinkAvailability, cloudLinkLatencyInMs, networkProbeMetrics, noiseFloorPerRadio,
|
||||||
periodLengthSec, radioStatsPerRadio, radioUtilizationPerRadio, radiusMetrics, rxBytesPerRadio,
|
periodLengthSec, radioStatsPerRadio, radioUtilizationPerRadio, radiusMetrics, rxBytesPerRadio,
|
||||||
tunnelMetrics, txBytesPerRadio, vlanSubnet, wmmQueuesPerRadio);
|
tunnelMetrics, txBytesPerRadio, vlanSubnet);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -449,7 +404,6 @@ public class ApNodeMetrics extends ServiceMetricDetails
|
|||||||
&& Objects.equals(clientMacAddressesPerRadio, other.clientMacAddressesPerRadio)
|
&& Objects.equals(clientMacAddressesPerRadio, other.clientMacAddressesPerRadio)
|
||||||
&& Objects.equals(cloudLinkAvailability, other.cloudLinkAvailability)
|
&& Objects.equals(cloudLinkAvailability, other.cloudLinkAvailability)
|
||||||
&& Objects.equals(cloudLinkLatencyInMs, other.cloudLinkLatencyInMs)
|
&& Objects.equals(cloudLinkLatencyInMs, other.cloudLinkLatencyInMs)
|
||||||
&& Objects.equals(mcsStatsPerRadio, other.mcsStatsPerRadio)
|
|
||||||
&& Objects.equals(networkProbeMetrics, other.networkProbeMetrics)
|
&& Objects.equals(networkProbeMetrics, other.networkProbeMetrics)
|
||||||
&& Objects.equals(noiseFloorPerRadio, other.noiseFloorPerRadio)
|
&& Objects.equals(noiseFloorPerRadio, other.noiseFloorPerRadio)
|
||||||
&& Objects.equals(periodLengthSec, other.periodLengthSec)
|
&& Objects.equals(periodLengthSec, other.periodLengthSec)
|
||||||
@@ -459,8 +413,7 @@ public class ApNodeMetrics extends ServiceMetricDetails
|
|||||||
&& Objects.equals(rxBytesPerRadio, other.rxBytesPerRadio)
|
&& Objects.equals(rxBytesPerRadio, other.rxBytesPerRadio)
|
||||||
&& Objects.equals(tunnelMetrics, other.tunnelMetrics)
|
&& Objects.equals(tunnelMetrics, other.tunnelMetrics)
|
||||||
&& Objects.equals(txBytesPerRadio, other.txBytesPerRadio)
|
&& Objects.equals(txBytesPerRadio, other.txBytesPerRadio)
|
||||||
&& Objects.equals(vlanSubnet, other.vlanSubnet)
|
&& Objects.equals(vlanSubnet, other.vlanSubnet);
|
||||||
&& Objects.equals(wmmQueuesPerRadio, other.wmmQueuesPerRadio);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -484,14 +437,6 @@ public class ApNodeMetrics extends ServiceMetricDetails
|
|||||||
radioStatsPerRadio.values().forEach(c -> { if (hasUnsupportedValue(c)) { ai.incrementAndGet();} });
|
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) {
|
if(ai.get()>0) {
|
||||||
return true;
|
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) {
|
if(this.networkProbeMetrics !=null) {
|
||||||
ret.networkProbeMetrics = new ArrayList<>();
|
ret.networkProbeMetrics = new ArrayList<>();
|
||||||
for(NetworkProbeMetrics npm: this.networkProbeMetrics){
|
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.setClientMac(getNextEquipmentId());
|
||||||
serviceMetric.setCreatedTimestamp(baseTimestamp - 100000 + getNextEquipmentId());
|
serviceMetric.setCreatedTimestamp(baseTimestamp - 100000 + getNextEquipmentId());
|
||||||
|
|
||||||
ClientMetrics details2 = new ClientMetrics();
|
|
||||||
details2.setClassificationName("qr_"+apNameIdx);
|
|
||||||
serviceMetric.setDetails(details2);
|
|
||||||
|
|
||||||
apNameIdx++;
|
apNameIdx++;
|
||||||
|
|
||||||
remoteInterface.create(serviceMetric);
|
remoteInterface.create(serviceMetric);
|
||||||
@@ -144,10 +140,6 @@ public class ServiceMetricServiceRemoteTest extends BaseRemoteTest {
|
|||||||
serviceMetric.setClientMac(getNextEquipmentId());
|
serviceMetric.setClientMac(getNextEquipmentId());
|
||||||
serviceMetric.setCreatedTimestamp(baseTimestamp + getNextEquipmentId());
|
serviceMetric.setCreatedTimestamp(baseTimestamp + getNextEquipmentId());
|
||||||
|
|
||||||
ClientMetrics details2 = new ClientMetrics();
|
|
||||||
details2.setClassificationName("qr_"+apNameIdx);
|
|
||||||
serviceMetric.setDetails(details2);
|
|
||||||
|
|
||||||
apNameIdx++;
|
apNameIdx++;
|
||||||
|
|
||||||
remoteInterface.create(serviceMetric);
|
remoteInterface.create(serviceMetric);
|
||||||
@@ -161,10 +153,6 @@ public class ServiceMetricServiceRemoteTest extends BaseRemoteTest {
|
|||||||
serviceMetric.setClientMac(getNextEquipmentId());
|
serviceMetric.setClientMac(getNextEquipmentId());
|
||||||
serviceMetric.setCreatedTimestamp(baseTimestamp - 100000 + getNextEquipmentId());
|
serviceMetric.setCreatedTimestamp(baseTimestamp - 100000 + getNextEquipmentId());
|
||||||
|
|
||||||
ClientMetrics details2 = new ClientMetrics();
|
|
||||||
details2.setClassificationName("qr_"+apNameIdx);
|
|
||||||
serviceMetric.setDetails(details2);
|
|
||||||
|
|
||||||
apNameIdx++;
|
apNameIdx++;
|
||||||
|
|
||||||
remoteInterface.create(serviceMetric);
|
remoteInterface.create(serviceMetric);
|
||||||
@@ -209,43 +197,18 @@ public class ServiceMetricServiceRemoteTest extends BaseRemoteTest {
|
|||||||
assertTrue(page6.getContext().isLastPage());
|
assertTrue(page6.getContext().isLastPage());
|
||||||
assertTrue(page7.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)
|
//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);
|
PaginationResponse<ServiceMetric> page1EmptySort = remoteInterface.getForCustomer(fromTime, toTime, customerId_1, null, null, null, null, Collections.emptyList(), context);
|
||||||
assertEquals(10, page1EmptySort.getItems().size());
|
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)
|
//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);
|
PaginationResponse<ServiceMetric> page1NullSort = remoteInterface.getForCustomer(fromTime, toTime, customerId_1, null, null, null, null, null, context);
|
||||||
assertEquals(10, page1NullSort.getItems().size());
|
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
|
//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);
|
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());
|
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());
|
serviceMetric.setCreatedTimestamp(baseTimestamp - getNextEquipmentId());
|
||||||
|
|
||||||
ClientMetrics details2 = new ClientMetrics();
|
ClientMetrics details2 = new ClientMetrics();
|
||||||
details2.setClassificationName("qr_"+apNameIdx);
|
|
||||||
serviceMetric.setDetails(details2);
|
serviceMetric.setDetails(details2);
|
||||||
|
|
||||||
remoteInterface.create(serviceMetric);
|
remoteInterface.create(serviceMetric);
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -56,8 +56,7 @@ public class StatusDatastoreCassandra implements StatusDatastore {
|
|||||||
private static final Set<String> columnsToSkipForUpdate = new HashSet<>(Arrays.asList(
|
private static final Set<String> columnsToSkipForUpdate = new HashSet<>(Arrays.asList(
|
||||||
"customerId",
|
"customerId",
|
||||||
"equipmentId",
|
"equipmentId",
|
||||||
"statusDataType",
|
"statusDataType"));
|
||||||
"createdTimestamp"));
|
|
||||||
|
|
||||||
private static final String TABLE_NAME = "status";
|
private static final String TABLE_NAME = "status";
|
||||||
private static final String ALL_COLUMNS;
|
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.
|
//This DAO does not enforce check for concurrent updates. Last one always wins.
|
||||||
|
|
||||||
long newLastModifiedTs = System.currentTimeMillis();
|
long newLastModifiedTs = System.currentTimeMillis();
|
||||||
|
boolean isCreateNotSet = status.getCreatedTimestamp() == 0;
|
||||||
|
|
||||||
|
|
||||||
cqlSession.execute(preparedStmt_update.bind(
|
cqlSession.execute(preparedStmt_update.bind(
|
||||||
|
|
||||||
//TODO: add remaining properties from Status here
|
//TODO: add remaining properties from Status here
|
||||||
(status.getDetails()!=null) ? ByteBuffer.wrap(status.getDetails().toZippedBytes()) : null ,
|
(status.getDetails()!=null) ? ByteBuffer.wrap(status.getDetails().toZippedBytes()) : null ,
|
||||||
|
isCreateNotSet ? newLastModifiedTs : status.getCreatedTimestamp(),
|
||||||
|
|
||||||
newLastModifiedTs,
|
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
|
//make a copy so that we don't accidentally update caller's version by reference
|
||||||
Status statusCopy = status.clone();
|
Status statusCopy = status.clone();
|
||||||
|
if(isCreateNotSet) {
|
||||||
|
statusCopy.setCreatedTimestamp(newLastModifiedTs);
|
||||||
|
}
|
||||||
statusCopy.setLastModifiedTimestamp(newLastModifiedTs);
|
statusCopy.setLastModifiedTimestamp(newLastModifiedTs);
|
||||||
|
|
||||||
LOG.debug("Updated Status {}", statusCopy);
|
LOG.debug("Updated Status {}", statusCopy);
|
||||||
|
|||||||
@@ -1,8 +1,11 @@
|
|||||||
|
|
||||||
package com.telecominfraproject.wlan.status.equipment.models;
|
package com.telecominfraproject.wlan.status.equipment.models;
|
||||||
|
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import com.telecominfraproject.wlan.core.model.equipment.LedStatus;
|
||||||
import com.telecominfraproject.wlan.status.models.StatusCode;
|
import com.telecominfraproject.wlan.status.models.StatusCode;
|
||||||
import com.telecominfraproject.wlan.status.models.StatusDataType;
|
import com.telecominfraproject.wlan.status.models.StatusDataType;
|
||||||
import com.telecominfraproject.wlan.status.models.StatusDetails;
|
import com.telecominfraproject.wlan.status.models.StatusDetails;
|
||||||
@@ -29,8 +32,9 @@ public class EquipmentAdminStatusData extends StatusDetails {
|
|||||||
*/
|
*/
|
||||||
private String statusMessage;
|
private String statusMessage;
|
||||||
|
|
||||||
|
private Map<String, Long> alarmTimestamps;
|
||||||
|
|
||||||
private Map<String,Long> alarmTimestamps;
|
private LedStatus ledStatus;
|
||||||
|
|
||||||
public EquipmentAdminStatusData() {
|
public EquipmentAdminStatusData() {
|
||||||
|
|
||||||
@@ -44,55 +48,13 @@ public class EquipmentAdminStatusData extends StatusDetails {
|
|||||||
public EquipmentAdminStatusData(EquipmentAdminStatusData data) {
|
public EquipmentAdminStatusData(EquipmentAdminStatusData data) {
|
||||||
this.statusCode = data.statusCode;
|
this.statusCode = data.statusCode;
|
||||||
this.statusMessage = data.statusMessage;
|
this.statusMessage = data.statusMessage;
|
||||||
this.alarmTimestamps = data.alarmTimestamps==null?null:new HashMap<>(data.alarmTimestamps);
|
this.alarmTimestamps = data.alarmTimestamps == null ? null : new HashMap<>(data.alarmTimestamps);
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int hashCode() {
|
|
||||||
final int prime = 31;
|
|
||||||
int result = 1;
|
|
||||||
result = prime * result + ((alarmTimestamps == null) ? 0 : alarmTimestamps.hashCode());
|
|
||||||
result = prime * result + ((statusCode == null) ? 0 : statusCode.hashCode());
|
|
||||||
result = prime * result + ((statusMessage == null) ? 0 : statusMessage.hashCode());
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean equals(Object obj) {
|
|
||||||
if (this == obj) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
if (obj == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (!(obj instanceof EquipmentAdminStatusData)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
EquipmentAdminStatusData other = (EquipmentAdminStatusData) obj;
|
|
||||||
if (alarmTimestamps == null) {
|
|
||||||
if (other.alarmTimestamps != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (!alarmTimestamps.equals(other.alarmTimestamps)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (statusCode != other.statusCode) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
if (statusMessage == null) {
|
|
||||||
if (other.statusMessage != null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
} else if (!statusMessage.equals(other.statusMessage)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EquipmentAdminStatusData clone() {
|
public EquipmentAdminStatusData clone() {
|
||||||
EquipmentAdminStatusData res = (EquipmentAdminStatusData) super.clone();
|
EquipmentAdminStatusData res = (EquipmentAdminStatusData) super.clone();
|
||||||
if(this.alarmTimestamps != null) {
|
if (this.alarmTimestamps != null) {
|
||||||
res.setAlarmTimestamps(new HashMap<>(this.alarmTimestamps));
|
res.setAlarmTimestamps(new HashMap<>(this.alarmTimestamps));
|
||||||
}
|
}
|
||||||
return res;
|
return res;
|
||||||
@@ -123,11 +85,11 @@ public class EquipmentAdminStatusData extends StatusDetails {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public long findAlarmTimeOrZero(String alarmKey) {
|
public long findAlarmTimeOrZero(String alarmKey) {
|
||||||
return alarmTimestamps==null?0:alarmTimestamps.getOrDefault(alarmKey, 0l);
|
return alarmTimestamps == null ? 0 : alarmTimestamps.getOrDefault(alarmKey, 0l);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void putAlarmTimestamp(String alarmKey, long value) {
|
public void putAlarmTimestamp(String alarmKey, long value) {
|
||||||
if(alarmTimestamps == null) {
|
if (alarmTimestamps == null) {
|
||||||
alarmTimestamps = new HashMap<>();
|
alarmTimestamps = new HashMap<>();
|
||||||
}
|
}
|
||||||
alarmTimestamps.put(alarmKey, value);
|
alarmTimestamps.put(alarmKey, value);
|
||||||
@@ -138,9 +100,37 @@ public class EquipmentAdminStatusData extends StatusDetails {
|
|||||||
if (super.hasUnsupportedValue()) {
|
if (super.hasUnsupportedValue()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (StatusCode.isUnsupported(statusCode) ) {
|
if (StatusCode.isUnsupported(statusCode)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public LedStatus getLedStatus() {
|
||||||
|
return ledStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLedStatus(LedStatus ledStatus) {
|
||||||
|
this.ledStatus = ledStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(alarmTimestamps, ledStatus, statusCode, statusMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object obj) {
|
||||||
|
if (this == obj)
|
||||||
|
return true;
|
||||||
|
if (obj == null)
|
||||||
|
return false;
|
||||||
|
if (getClass() != obj.getClass())
|
||||||
|
return false;
|
||||||
|
EquipmentAdminStatusData other = (EquipmentAdminStatusData) obj;
|
||||||
|
return Objects.equals(alarmTimestamps, other.alarmTimestamps) && ledStatus == other.ledStatus && statusCode == other.statusCode
|
||||||
|
&& Objects.equals(statusMessage, other.statusMessage);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import java.util.EnumMap;
|
|||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import com.telecominfraproject.wlan.core.model.equipment.ChannelBandwidth;
|
||||||
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
|
import com.telecominfraproject.wlan.core.model.equipment.RadioType;
|
||||||
import com.telecominfraproject.wlan.status.models.StatusDataType;
|
import com.telecominfraproject.wlan.status.models.StatusDataType;
|
||||||
import com.telecominfraproject.wlan.status.models.StatusDetails;
|
import com.telecominfraproject.wlan.status.models.StatusDetails;
|
||||||
@@ -12,6 +13,7 @@ public class EquipmentChannelStatusData extends StatusDetails {
|
|||||||
private static final long serialVersionUID = 470569467119609438L;
|
private static final long serialVersionUID = 470569467119609438L;
|
||||||
|
|
||||||
private Map<RadioType, Integer> channelNumberStatusDataMap = new EnumMap<>(RadioType.class);
|
private Map<RadioType, Integer> channelNumberStatusDataMap = new EnumMap<>(RadioType.class);
|
||||||
|
private Map<RadioType, ChannelBandwidth> channelBandwidthStatusDataMap = new EnumMap<>(RadioType.class);
|
||||||
private Map<RadioType, Integer> txPowerDataMap = new EnumMap<>(RadioType.class);
|
private Map<RadioType, Integer> txPowerDataMap = new EnumMap<>(RadioType.class);
|
||||||
|
|
||||||
|
|
||||||
@@ -29,6 +31,7 @@ public class EquipmentChannelStatusData extends StatusDetails {
|
|||||||
{
|
{
|
||||||
if (data !=null) {
|
if (data !=null) {
|
||||||
this.channelNumberStatusDataMap.putAll(data.channelNumberStatusDataMap);
|
this.channelNumberStatusDataMap.putAll(data.channelNumberStatusDataMap);
|
||||||
|
this.channelBandwidthStatusDataMap.putAll(data.channelBandwidthStatusDataMap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -36,6 +39,10 @@ public class EquipmentChannelStatusData extends StatusDetails {
|
|||||||
return channelNumberStatusDataMap;
|
return channelNumberStatusDataMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Map<RadioType, ChannelBandwidth> getChannelBandwidthStatusDataMap() {
|
||||||
|
return channelBandwidthStatusDataMap;
|
||||||
|
}
|
||||||
|
|
||||||
public Map<RadioType, Integer> getTxPowerDataMap() {
|
public Map<RadioType, Integer> getTxPowerDataMap() {
|
||||||
return txPowerDataMap;
|
return txPowerDataMap;
|
||||||
}
|
}
|
||||||
@@ -44,6 +51,10 @@ public class EquipmentChannelStatusData extends StatusDetails {
|
|||||||
this.channelNumberStatusDataMap = channelNumberStatusDataMap;
|
this.channelNumberStatusDataMap = channelNumberStatusDataMap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setChannelBandwidthStatusDataMap(Map<RadioType, ChannelBandwidth> channelBandwidthStatusDataMap) {
|
||||||
|
this.channelBandwidthStatusDataMap = channelBandwidthStatusDataMap;
|
||||||
|
}
|
||||||
|
|
||||||
public void setTxPowerDataMap(Map<RadioType, Integer> txPowerDataMap) {
|
public void setTxPowerDataMap(Map<RadioType, Integer> txPowerDataMap) {
|
||||||
this.txPowerDataMap = txPowerDataMap;
|
this.txPowerDataMap = txPowerDataMap;
|
||||||
}
|
}
|
||||||
@@ -59,6 +70,14 @@ public class EquipmentChannelStatusData extends StatusDetails {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (getChannelBandwidthStatusDataMap() != null) {
|
||||||
|
result.setChannelBandwidthStatusDataMap(new EnumMap<>(RadioType.class));
|
||||||
|
|
||||||
|
this.channelBandwidthStatusDataMap.forEach((k, v) -> {
|
||||||
|
result.channelBandwidthStatusDataMap.put(k, v);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (getTxPowerDataMap() != null) {
|
if (getTxPowerDataMap() != null) {
|
||||||
result.setTxPowerDataMap(new EnumMap<>(RadioType.class));
|
result.setTxPowerDataMap(new EnumMap<>(RadioType.class));
|
||||||
|
|
||||||
@@ -71,7 +90,7 @@ public class EquipmentChannelStatusData extends StatusDetails {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int hashCode() {
|
public int hashCode() {
|
||||||
return Objects.hash(channelNumberStatusDataMap, txPowerDataMap);
|
return Objects.hash(channelNumberStatusDataMap, channelBandwidthStatusDataMap, txPowerDataMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -84,6 +103,7 @@ public class EquipmentChannelStatusData extends StatusDetails {
|
|||||||
return false;
|
return false;
|
||||||
EquipmentChannelStatusData other = (EquipmentChannelStatusData) obj;
|
EquipmentChannelStatusData other = (EquipmentChannelStatusData) obj;
|
||||||
return Objects.equals(channelNumberStatusDataMap, other.channelNumberStatusDataMap)
|
return Objects.equals(channelNumberStatusDataMap, other.channelNumberStatusDataMap)
|
||||||
|
&& Objects.equals(channelBandwidthStatusDataMap, other.channelBandwidthStatusDataMap)
|
||||||
&& Objects.equals(txPowerDataMap, other.txPowerDataMap);
|
&& Objects.equals(txPowerDataMap, other.txPowerDataMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
package com.telecominfraproject.wlan.status.equipment.report.models;
|
||||||
|
|
||||||
|
import com.telecominfraproject.wlan.status.models.StatusDataType;
|
||||||
|
import com.telecominfraproject.wlan.status.models.StatusDetails;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rsharma
|
||||||
|
*/
|
||||||
|
public class WiredEthernetPortStatusData extends StatusDetails {
|
||||||
|
private static final long serialVersionUID = 1684955685155400122L;
|
||||||
|
|
||||||
|
// key is ifName, value is the list of wiredPortStatus that link to the ifName
|
||||||
|
private Map<String, List<WiredPortStatus>> interfacePortStatusMap;
|
||||||
|
|
||||||
|
public WiredEthernetPortStatusData() {
|
||||||
|
this.interfacePortStatusMap = new HashMap<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
public WiredEthernetPortStatusData(Map<String, List<WiredPortStatus>> interfacePortStatusMap) {
|
||||||
|
this.interfacePortStatusMap = interfacePortStatusMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Map<String, List<WiredPortStatus>> getInterfacePortStatusMap() {
|
||||||
|
return interfacePortStatusMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setInterfacePortStatusMap(Map<String, List<WiredPortStatus>> interfacePortStatusMap) {
|
||||||
|
this.interfacePortStatusMap = interfacePortStatusMap;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StatusDataType getStatusDataType() {
|
||||||
|
return StatusDataType.WIRED_ETHERNET_PORT;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!(o instanceof WiredEthernetPortStatusData)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
WiredEthernetPortStatusData that = (WiredEthernetPortStatusData) o;
|
||||||
|
return Objects.equals(getInterfacePortStatusMap(), that.getInterfacePortStatusMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(getInterfacePortStatusMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public WiredEthernetPortStatusData clone() {
|
||||||
|
WiredEthernetPortStatusData data = (WiredEthernetPortStatusData) super.clone();
|
||||||
|
|
||||||
|
if (interfacePortStatusMap != null) {
|
||||||
|
data.interfacePortStatusMap = new HashMap<>(interfacePortStatusMap);
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,149 @@
|
|||||||
|
package com.telecominfraproject.wlan.status.equipment.report.models;
|
||||||
|
|
||||||
|
import com.telecominfraproject.wlan.core.model.json.BaseJsonModel;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author rsharma
|
||||||
|
*/
|
||||||
|
public class WiredPortStatus extends BaseJsonModel {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 5525006111579379607L;
|
||||||
|
|
||||||
|
private String name; // eth_port: eth0 or eth1
|
||||||
|
private String originalIfName; // ifName when the AP came up (lan, wan etc.)
|
||||||
|
private String currentIfName; // Current ifName (e.g. lan, wan etc.)
|
||||||
|
private String ifType; // bridge/Nat/eth/vlan
|
||||||
|
private int speed; // in MBPS
|
||||||
|
private String duplex; // full, half
|
||||||
|
private String operationalState; // Operational State
|
||||||
|
private int vlanId; // tagged VlanId
|
||||||
|
private boolean trunkEnabled; // trunk enabled or disabled
|
||||||
|
private List<Integer> allowedVlanIds; // allowed vlanIds
|
||||||
|
|
||||||
|
public WiredPortStatus() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public WiredPortStatus(String name, String originalIfName, String currentIfName, String ifType, int speed, String duplex,
|
||||||
|
String operationalState, int vlanId, boolean trunkEnabled, List<Integer> allowedVlanIds) {
|
||||||
|
this.name = name;
|
||||||
|
this.originalIfName = originalIfName;
|
||||||
|
this.currentIfName = currentIfName;
|
||||||
|
this.ifType = ifType;
|
||||||
|
this.speed = speed;
|
||||||
|
this.duplex = duplex;
|
||||||
|
this.operationalState = operationalState;
|
||||||
|
this.vlanId = vlanId;
|
||||||
|
this.trunkEnabled = trunkEnabled;
|
||||||
|
this.allowedVlanIds = allowedVlanIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean equals(Object o) {
|
||||||
|
if (this == o) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
if (!(o instanceof WiredPortStatus)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
WiredPortStatus that = (WiredPortStatus) o;
|
||||||
|
return getSpeed() == that.getSpeed() && Objects.equals(getName(), that.getName())
|
||||||
|
&& Objects.equals(getOriginalIfName(), that.getOriginalIfName())
|
||||||
|
&& Objects.equals(getCurrentIfName(), that.getCurrentIfName())
|
||||||
|
&& Objects.equals(getIfType(), that.getIfType())
|
||||||
|
&& Objects.equals(getDuplex(), that.getDuplex())
|
||||||
|
&& Objects.equals(getOperationalState(), that.getOperationalState())
|
||||||
|
&& getVlanId() == that.getVlanId()
|
||||||
|
&& Objects.equals(getAllowedVlanIds(), that.getAllowedVlanIds())
|
||||||
|
&& Objects.equals(isTrunkEnabled(), that.isTrunkEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int hashCode() {
|
||||||
|
return Objects.hash(getName(), getOriginalIfName(), getCurrentIfName(), getIfType(), getSpeed(), getDuplex(),
|
||||||
|
getOperationalState(), getVlanId(), getAllowedVlanIds(), isTrunkEnabled());
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getName() {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setName(String name) {
|
||||||
|
this.name = name;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOriginalIfName() {
|
||||||
|
return originalIfName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOriginalIfName(String originalIfName) {
|
||||||
|
this.originalIfName = originalIfName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCurrentIfName() {
|
||||||
|
return currentIfName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCurrentIfName(String currentIfName) {
|
||||||
|
this.currentIfName = currentIfName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getIfType() {
|
||||||
|
return ifType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setIfType(String ifType) {
|
||||||
|
this.ifType = ifType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSpeed() {
|
||||||
|
return speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSpeed(int speed) {
|
||||||
|
this.speed = speed;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDuplex() {
|
||||||
|
return duplex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDuplex(String duplex) {
|
||||||
|
this.duplex = duplex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOperationalState() {
|
||||||
|
return operationalState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOperationalState(String operationalState) {
|
||||||
|
this.operationalState = operationalState;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getVlanId() {
|
||||||
|
return vlanId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVlanId(int vlanId) {
|
||||||
|
this.vlanId = vlanId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<Integer> getAllowedVlanIds() {
|
||||||
|
return allowedVlanIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAllowedVlanIds(List<Integer> allowedVlanIds) {
|
||||||
|
this.allowedVlanIds = allowedVlanIds;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isTrunkEnabled() {
|
||||||
|
return trunkEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTrunkEnabled(boolean trunkEnabled) {
|
||||||
|
this.trunkEnabled = trunkEnabled;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -64,7 +64,11 @@ public class StatusDataType implements EnumWithId {
|
|||||||
/**
|
/**
|
||||||
* Protocol status
|
* Protocol status
|
||||||
*/
|
*/
|
||||||
PROTOCOL = new StatusDataType(4, "PROTOCOL", Set.of(StatusTrait.DeleteOnEquipmentDisconnect)) ,
|
PROTOCOL = new StatusDataType(4, "PROTOCOL"
|
||||||
|
// some of the properties of this status need to be preserved across equipment connections
|
||||||
|
// example - reportedCfgDataVersion
|
||||||
|
//, Set.of(StatusTrait.DeleteOnEquipmentDisconnect)
|
||||||
|
) ,
|
||||||
/**
|
/**
|
||||||
* Firmware upgrade status
|
* Firmware upgrade status
|
||||||
*/
|
*/
|
||||||
@@ -101,6 +105,9 @@ public class StatusDataType implements EnumWithId {
|
|||||||
*/
|
*/
|
||||||
EQUIPMENT_MANUFACTURER_DATA = new StatusDataType(17, "EQUIPMENT_MANUFACTURER_DATA", Set.of(StatusTrait.DeleteOnEquipmentDisconnect)),
|
EQUIPMENT_MANUFACTURER_DATA = new StatusDataType(17, "EQUIPMENT_MANUFACTURER_DATA", Set.of(StatusTrait.DeleteOnEquipmentDisconnect)),
|
||||||
|
|
||||||
|
// STATUS OF ETHERNET PORTS ON THE DEVICE
|
||||||
|
WIRED_ETHERNET_PORT = new StatusDataType(18, "WIRED_ETHERNET_PORT", Set.of(StatusTrait.DeleteOnEquipmentDisconnect)),
|
||||||
|
|
||||||
UNSUPPORTED = new StatusDataType(-1, "UNSUPPORTED") ;
|
UNSUPPORTED = new StatusDataType(-1, "UNSUPPORTED") ;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
|||||||
@@ -197,6 +197,15 @@ components:
|
|||||||
$ref: '#/components/schemas/StatusCode'
|
$ref: '#/components/schemas/StatusCode'
|
||||||
statusMessage:
|
statusMessage:
|
||||||
type: string
|
type: string
|
||||||
|
ledStatus:
|
||||||
|
$ref: '#/components/schemas/LedStatus'
|
||||||
|
|
||||||
|
LedStatus:
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- led_blink
|
||||||
|
- led_off
|
||||||
|
- UNKNOWN
|
||||||
|
|
||||||
StatusCode:
|
StatusCode:
|
||||||
type: string
|
type: string
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ import com.telecominfraproject.wlan.core.model.pagination.PaginationResponse;
|
|||||||
import com.telecominfraproject.wlan.core.server.cassandra.RowMapper;
|
import com.telecominfraproject.wlan.core.server.cassandra.RowMapper;
|
||||||
import com.telecominfraproject.wlan.systemevent.datastore.SystemEventDatastore;
|
import com.telecominfraproject.wlan.systemevent.datastore.SystemEventDatastore;
|
||||||
import com.telecominfraproject.wlan.systemevent.models.SystemEventRecord;
|
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;
|
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.ArrayList;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
|
import java.util.HashMap;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
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.core.model.pagination.SortOrder;
|
||||||
import com.telecominfraproject.wlan.datastore.inmemory.BaseInMemoryDatastore;
|
import com.telecominfraproject.wlan.datastore.inmemory.BaseInMemoryDatastore;
|
||||||
import com.telecominfraproject.wlan.systemevent.datastore.SystemEventDatastore;
|
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.SystemEventRecord;
|
||||||
import com.telecominfraproject.wlan.systemevent.models.SystemEventRecordKey;
|
import com.telecominfraproject.wlan.systemevent.models.SystemEventRecordKey;
|
||||||
|
import com.telecominfraproject.wlan.systemevent.models.SystemEventStats;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author dtoptygin
|
* @author dtoptygin
|
||||||
@@ -228,4 +231,37 @@ public class SystemEventDatastoreInMemory extends BaseInMemoryDatastore implemen
|
|||||||
return clientMacAddresses.contains(macAddress);
|
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());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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.PaginationContext;
|
||||||
import com.telecominfraproject.wlan.core.model.pagination.PaginationResponse;
|
import com.telecominfraproject.wlan.core.model.pagination.PaginationResponse;
|
||||||
import com.telecominfraproject.wlan.systemevent.models.SystemEventRecord;
|
import com.telecominfraproject.wlan.systemevent.models.SystemEventRecord;
|
||||||
|
import com.telecominfraproject.wlan.systemevent.models.SystemEventStats;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author dtoptygin
|
* @author dtoptygin
|
||||||
@@ -60,4 +61,13 @@ public interface SystemEventDatastore {
|
|||||||
List<ColumnAndSort> sortBy,
|
List<ColumnAndSort> sortBy,
|
||||||
PaginationContext<SystemEventRecord> context);
|
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);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user