mirror of
https://github.com/Telecominfraproject/wlan-cloud-services.git
synced 2026-03-20 17:39:19 +00:00
Compare commits
4 Commits
WIFI-7580-
...
release/v1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
df522d58ee | ||
|
|
2f791e1364 | ||
|
|
a792c602df | ||
|
|
0bfdfc2d56 |
@@ -48,16 +48,16 @@ public class AlarmCode implements EnumWithId {
|
||||
private static final Map<Integer, AlarmCode> ELEMENTS = 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> USER_VISIBLE_VALUES = new ConcurrentHashMap<>();
|
||||
|
||||
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"),
|
||||
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"),
|
||||
NoiseFloor2G = new AlarmCode(7, "NoiseFloor2G", "Noise floor is too high on 2G radio", StatusCode.requiresAttention, "Investigate interference sources"),
|
||||
ChannelUtilization2G = new AlarmCode(8, "ChannelUtilization2G", "Channel utilization is too high on 2G radio", StatusCode.requiresAttention, "Consider adding more APs"),
|
||||
NoiseFloor5G = new AlarmCode(9, "NoiseFloor5G", "Noise floor is too high on 5G radio", StatusCode.requiresAttention, "Investigate interference sources"),
|
||||
ChannelUtilization5G = new AlarmCode(10, "ChannelUtilization5G", "Channel utilization is too high on 5G radio", StatusCode.requiresAttention, "Consider adding more APs"),
|
||||
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", true),
|
||||
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", true),
|
||||
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"),
|
||||
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"),
|
||||
@@ -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"),
|
||||
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"),
|
||||
CPUUtilization = new AlarmCode(19, "CPUUtilization", "CPU utilization is too high", StatusCode.requiresAttention, "Contact Tech Suport"),
|
||||
MemoryUtilization = new AlarmCode(20, "MemoryUtilization", "Memory utilization is too high", StatusCode.requiresAttention, "Contact Tech Suport"),
|
||||
Disconnected = new AlarmCode(22, "Disconnected", "Equipment is not connected to the cloud", StatusCode.error, "Service AP and verify networking path to cloud"),
|
||||
CPUTemperature = new AlarmCode(23, "CPUTemperature", "CPU Temperature is too high", StatusCode.requiresAttention, "Verify AP location"),
|
||||
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", true),
|
||||
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", true),
|
||||
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"),
|
||||
HardwareIssueDiagnostic = new AlarmCode(29, "HardwareIssueDiagnostic", "Hardware issue encountered on equipment", StatusCode.error, "Reboot AP and contact tech support for RMA"),
|
||||
@@ -131,17 +131,29 @@ public class AlarmCode implements EnumWithId {
|
||||
private final StatusCode severity;
|
||||
private final String recommendedAction;
|
||||
private final AlarmCategory category;
|
||||
private final boolean propagateFast;
|
||||
private final boolean propagateFast;
|
||||
private final boolean userVisible;
|
||||
|
||||
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){
|
||||
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, 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){
|
||||
protected AlarmCode(int id, String name, String description, StatusCode severity, String recommendedAction,
|
||||
AlarmCategory category, boolean propagateFast, boolean userVisible){
|
||||
|
||||
synchronized(lock) {
|
||||
|
||||
@@ -154,6 +166,7 @@ public class AlarmCode implements EnumWithId {
|
||||
this.recommendedAction = recommendedAction;
|
||||
this.category = category;
|
||||
this.propagateFast = propagateFast;
|
||||
this.userVisible = userVisible;
|
||||
|
||||
ELEMENTS_BY_NAME.values().forEach(s -> {
|
||||
if(s.getName().equals(name)) {
|
||||
@@ -179,6 +192,9 @@ public class AlarmCode implements EnumWithId {
|
||||
|
||||
if (!field.isAnnotationPresent(Deprecated.class)) {
|
||||
VALID_VALUES.put(id, this);
|
||||
if (userVisible) {
|
||||
USER_VISIBLE_VALUES.put(id, this);
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -232,6 +248,11 @@ public class AlarmCode implements EnumWithId {
|
||||
public boolean isPropagateFast() {
|
||||
return propagateFast;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public boolean isUserVisible() {
|
||||
return userVisible;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public String name() {
|
||||
@@ -269,6 +290,10 @@ public class AlarmCode implements EnumWithId {
|
||||
public static boolean isUnsupported(AlarmCode value) {
|
||||
return (UNSUPPORTED.equals(value));
|
||||
}
|
||||
|
||||
public static List<AlarmCode> getUserVisibleValues() {
|
||||
return new ArrayList<>(USER_VISIBLE_VALUES.values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
|
||||
@@ -5,6 +5,7 @@ import java.util.Objects;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
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.SecurityType;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.SteerType;
|
||||
@@ -32,6 +33,7 @@ public class ClientSessionDetails extends BaseJsonModel {
|
||||
private InetAddress ipAddress;
|
||||
private String radiusUsername;
|
||||
private String ssid;
|
||||
private MacAddress bssid;
|
||||
private RadioType radioType;
|
||||
private Long lastEventTimestamp;
|
||||
private String hostname;
|
||||
@@ -410,6 +412,14 @@ public class ClientSessionDetails extends BaseJsonModel {
|
||||
public void setFirstFailureDetails(ClientFailureDetails firstFailureDetails) {
|
||||
this.firstFailureDetails = firstFailureDetails;
|
||||
}
|
||||
|
||||
public MacAddress getBssid() {
|
||||
return bssid;
|
||||
}
|
||||
|
||||
public void setBssid(MacAddress bssid) {
|
||||
this.bssid = bssid;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public boolean isTerminated() {
|
||||
@@ -526,7 +536,7 @@ public class ClientSessionDetails extends BaseJsonModel {
|
||||
lastEventTimestamp, lastFailureDetails, lastRxTimestamp, lastTxTimestamp,
|
||||
portEnabledTimestamp, previousValidSessionId, priorEquipmentId, priorSessionId, radioType,
|
||||
radiusUsername, securityType, sessionId, ssid, steerType, timeoutTimestamp, userAgentStr,
|
||||
associationState);
|
||||
associationState, bssid);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -571,7 +581,8 @@ public class ClientSessionDetails extends BaseJsonModel {
|
||||
&& sessionId == other.sessionId && Objects.equals(ssid, other.ssid) && steerType == other.steerType
|
||||
&& Objects.equals(timeoutTimestamp, other.timeoutTimestamp)
|
||||
&& Objects.equals(userAgentStr, other.userAgentStr)
|
||||
&& Objects.equals(associationState, other.associationState);
|
||||
&& Objects.equals(associationState, other.associationState)
|
||||
&& Objects.equals(bssid, other.bssid);
|
||||
|
||||
}
|
||||
|
||||
@@ -724,6 +735,10 @@ public class ClientSessionDetails extends BaseJsonModel {
|
||||
if (null != latest.getUserAgentStr()) {
|
||||
this.userAgentStr = latest.getUserAgentStr();
|
||||
}
|
||||
|
||||
if (null != latest.getBssid()) {
|
||||
this.bssid = latest.bssid;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,7 @@ import com.telecominfraproject.wlan.client.models.events.ClientChangedEvent;
|
||||
import com.telecominfraproject.wlan.client.models.events.ClientRemovedEvent;
|
||||
import com.telecominfraproject.wlan.client.models.events.ClientSessionChangedEvent;
|
||||
import com.telecominfraproject.wlan.client.models.events.ClientSessionRemovedEvent;
|
||||
import com.telecominfraproject.wlan.client.session.models.AssociationState;
|
||||
import com.telecominfraproject.wlan.client.session.models.ClientSession;
|
||||
import com.telecominfraproject.wlan.cloudeventdispatcher.CloudEventDispatcherInterface;
|
||||
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
|
||||
@@ -351,6 +352,8 @@ public class ClientController {
|
||||
throw new DsDataValidationException("Client session contains unsupported value");
|
||||
}
|
||||
|
||||
forceDisconnectOtherClientSessions(clientSession);
|
||||
|
||||
ClientSession ret = clientDatastore.updateSession(clientSession);
|
||||
|
||||
LOG.debug("Updated Client session {}", ret);
|
||||
@@ -384,6 +387,8 @@ public class ClientController {
|
||||
throw new DsDataValidationException("Client session contains unsupported value");
|
||||
}
|
||||
|
||||
clientSessions.forEach(s -> forceDisconnectOtherClientSessions(s));
|
||||
|
||||
ListOfClientSessions ret = new ListOfClientSessions();
|
||||
|
||||
ret.addAll(clientDatastore.updateSessions(clientSessions));
|
||||
@@ -460,5 +465,39 @@ public class ClientController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Force disconnects other client sessions with the same client Mac address.
|
||||
* In an ideal world, this doesn't happen often.
|
||||
* This usually happens when a client is roaming from one AP to another and the AP does not send a
|
||||
* disconnect until much later (5+ minutes timeout on the AP).
|
||||
* Also happens if the AP was disconnected from the cloud from some time and we "missed" the disconnect event.
|
||||
* @param clientSession
|
||||
*/
|
||||
private void forceDisconnectOtherClientSessions(ClientSession clientSession) {
|
||||
if (clientSession.getDetails().getAssociationState() != AssociationState._802_11_Associated) {
|
||||
// updating a session that is not associated should not disconnect other sessions
|
||||
return;
|
||||
}
|
||||
|
||||
List<ClientSession> allSessions = clientDatastore.getSessions(clientSession.getCustomerId(), Set.of(clientSession.getMacAddress()));
|
||||
|
||||
if (allSessions == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (ClientSession cl : allSessions) {
|
||||
if (cl.getEquipmentId() == clientSession.getEquipmentId()) {
|
||||
// Don't disconnect ourselves!
|
||||
continue;
|
||||
}
|
||||
|
||||
if (cl.getDetails().getAssociationState() == AssociationState._802_11_Associated) {
|
||||
// Force disconnect this client session:
|
||||
LOG.info("Forcing a Disconnect of Client session {}", cl);
|
||||
cl.getDetails().setAssociationState(AssociationState.Disconnected);
|
||||
cl.setLastModifiedTimestamp(System.currentTimeMillis());
|
||||
updateSession(cl);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -181,6 +181,8 @@ components:
|
||||
type: string
|
||||
ssid:
|
||||
type: string
|
||||
bssid:
|
||||
$ref: '#/components/schemas/MacAddress'
|
||||
radioType:
|
||||
$ref: '#/components/schemas/RadioType'
|
||||
lastEventTimestamp:
|
||||
|
||||
@@ -391,11 +391,13 @@ public class FirmwareServiceRemote extends BaseRemoteClient implements FirmwareS
|
||||
@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, null,
|
||||
CustomerFirmwareTrackSettings.class, defaultSettings);
|
||||
+"/customerTrack/default", HttpMethod.PUT, request,
|
||||
CustomerFirmwareTrackSettings.class);
|
||||
|
||||
CustomerFirmwareTrackSettings ret = responseEntity.getBody();
|
||||
|
||||
|
||||
@@ -25,6 +25,7 @@ import com.telecominfraproject.wlan.datastore.exceptions.DsConcurrentModificatio
|
||||
import com.telecominfraproject.wlan.datastore.exceptions.DsDuplicateEntityException;
|
||||
import com.telecominfraproject.wlan.datastore.exceptions.DsEntityNotFoundException;
|
||||
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackRecord;
|
||||
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackSettings;
|
||||
import com.telecominfraproject.wlan.firmware.models.CustomerFirmwareTrackSettings.TrackFlag;
|
||||
import com.telecominfraproject.wlan.firmware.models.FirmwareTrackAssignmentDetails;
|
||||
import com.telecominfraproject.wlan.firmware.models.FirmwareTrackAssignmentRecord;
|
||||
@@ -276,6 +277,47 @@ public class FirmwareServiceRemoteTest extends BaseRemoteTest {
|
||||
assertNull(res);
|
||||
|
||||
}
|
||||
|
||||
@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
|
||||
public void testCreateUpdateDeleteFirmwareTrackAssignment() {
|
||||
|
||||
@@ -4398,6 +4398,8 @@ components:
|
||||
type: string
|
||||
ssid:
|
||||
type: string
|
||||
bssid:
|
||||
$ref: '#/components/schemas/MacAddress'
|
||||
radioType:
|
||||
$ref: '#/components/schemas/RadioType'
|
||||
lastEventTimestamp:
|
||||
|
||||
Reference in New Issue
Block a user