APs running into Backoff shows as connected

Signed-off-by: Mike Hansen <mike.hansen@connectus.ai>
This commit is contained in:
Mike Hansen
2021-07-22 15:32:21 -04:00
parent 11f0aa8856
commit 14adaaacbe
5 changed files with 2455 additions and 2341 deletions

View File

@@ -209,9 +209,9 @@ public class OpensyncCloudGatewayController {
case CellSizeAttributesRequest:
ret.add(sendCellSizeRequest(session, (CEGWCellSizeAttributesRequest) command));
break;
case MostRecentStatsTimestamp:
ret.add(sendGetMostRecentStatsTimestampRequest(command, inventoryId));
break;
// case MostRecentStatsTimestamp:
// ret.add(sendGetMostRecentStatsTimestampRequest(command, inventoryId));
// break;
default:
LOG.warn("[{}] Failed to deliver command {}, unsupported command type", inventoryId, command);
ret.add(new EquipmentCommandResponse(CEGWCommandResultCode.UnsupportedCommand,
@@ -250,32 +250,7 @@ public class OpensyncCloudGatewayController {
return new GatewayDefaults();
}
private EquipmentCommandResponse sendGetMostRecentStatsTimestampRequest(CEGWBaseCommand command, String inventoryId) {
Long ts = lastReceivedStatsTimestamp(inventoryId);
if (ts == null) {
return new EquipmentCommandResponse(CEGWCommandResultCode.NoRouteToCE,
null, command,
registeredGateway == null ? null : registeredGateway.getHostname(),
registeredGateway == null ? -1 : registeredGateway.getPort());
} else {
return new EquipmentCommandResponse(CEGWCommandResultCode.Success,
ts.toString(), command,
registeredGateway == null ? null : registeredGateway.getHostname(),
registeredGateway == null ? -1 : registeredGateway.getPort());
}
}
@RequestMapping(value = "/lastReceivedStatsTimestamp", method = RequestMethod.GET)
public Long lastReceivedStatsTimestamp(@RequestParam String apId) {
Long ret = null;
if (ovsdbSessionMapInterface.getSession(apId) != null) {
ret = ovsdbSessionMapInterface.getSession(apId).getMostRecentStatsTimestamp();
LOG.debug("lastReceivedStatsTimestamp for apId {} {}",apId,ret);
} else {
LOG.warn("lastReceivedStatsTimestamp found no session for {}, cannot get timestamp",apId);
}
return ret;
}
/**
* Verify a route to customer equipment

View File

@@ -5,7 +5,6 @@ import java.net.Inet4Address;
import java.net.Inet6Address;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
@@ -52,7 +51,6 @@ import com.telecominfraproject.wlan.equipment.EquipmentServiceInterface;
import com.telecominfraproject.wlan.equipment.models.Equipment;
import com.telecominfraproject.wlan.opensync.external.integration.OvsdbSession;
import com.telecominfraproject.wlan.opensync.external.integration.OvsdbSessionMapInterface;
import com.telecominfraproject.wlan.opensync.external.integration.controller.OpensyncCloudGatewayController;
import com.telecominfraproject.wlan.opensync.util.OvsdbToWlanCloudTypeMappingUtility;
import com.telecominfraproject.wlan.profile.ProfileServiceInterface;
import com.telecominfraproject.wlan.profile.models.Profile;
@@ -140,8 +138,6 @@ public class MqttStatsPublisher implements StatsPublisherInterface {
private RealtimeEventPublisher realtimeEventPublisher;
@Autowired
private AlarmServiceInterface alarmServiceInterface;
@Autowired
private OpensyncCloudGatewayController gatewayController;
@Value("${tip.wlan.mqttStatsPublisher.temperatureThresholdInC:80}")
private int temperatureThresholdInC;
@@ -171,23 +167,12 @@ public class MqttStatsPublisher implements StatsPublisherInterface {
return;
}
if (apId != null) {
OvsdbSession ovsdbSession = ovsdbSessionMapInterface.getSession(extractApIdFromTopic(topic));
if (ovsdbSession != null) {
ovsdbSession.setMostRecentStatsTimestamp(System.currentTimeMillis());
LOG.debug("Last metrics received from AP updated to {}",ovsdbSession.toString());
} else {
LOG.debug("No ovsdb session exists for this AP {}",apId);
}
}
int customerId = ce.getCustomerId();
long equipmentId = ce.getId();
long locationId = ce.getLocationId();
long profileId = ce.getProfileId();
// update timestamp for active customer equipment
gatewayController.updateActiveCustomer(customerId);
List<ServiceMetric> metricRecordList = new ArrayList<>();
try {
@@ -277,7 +262,6 @@ public class MqttStatsPublisher implements StatsPublisherInterface {
@Override
public void publishSystemEventFromTableStateMonitor(SystemEvent event) {
LOG.info("Publishing SystemEvent received by TableStateMonitor {}", event);
gatewayController.updateActiveCustomer(event.getCustomerId());
cloudEventDispatcherInterface.publishEvent(event);
}

View File

@@ -176,7 +176,7 @@ public class OpensyncExternalIntegrationCloudTest {
location.setDetails(details);
location.setName("Location-UT");
location.setLocationType(LocationType.BUILDING);
Mockito.when(locationServiceInterface.get(8L)).thenReturn(location);
Mockito.when(locationServiceInterface.getOrNull(Mockito.anyLong())).thenReturn(location);
Customer customer = new Customer();
customer.setId(2);
CustomerDetails customerDetails = new CustomerDetails();
@@ -232,7 +232,7 @@ public class OpensyncExternalIntegrationCloudTest {
opensyncExternalIntegrationCloud.apConnected("Test_Client_21P10C68818122", createConnectNodeInfo());
Mockito.verify(firmwareServiceInterface).getDefaultCustomerTrackSetting();
Mockito.verify(locationServiceInterface).get(8L);
Mockito.verify(locationServiceInterface).getOrNull(ArgumentMatchers.anyLong());
}
@@ -246,7 +246,7 @@ public class OpensyncExternalIntegrationCloudTest {
location.setDetails(details);
location.setName("Location-UT");
location.setLocationType(LocationType.BUILDING);
Mockito.when(locationServiceInterface.get(8L)).thenReturn(location);
Mockito.when(locationServiceInterface.getOrNull(8L)).thenReturn(location);
Customer customer = new Customer();
customer.setId(2);
@@ -326,7 +326,7 @@ public class OpensyncExternalIntegrationCloudTest {
Mockito.verify(customerServiceInterface).getOrNull(ArgumentMatchers.anyInt());
Mockito.verify(equipmentServiceInterface).getByInventoryIdOrNull("Test_Client_21P10C68818122");
Mockito.verify(firmwareServiceInterface).getDefaultCustomerTrackSetting();
Mockito.verify(locationServiceInterface, Mockito.times(2)).get(ArgumentMatchers.anyLong());
Mockito.verify(locationServiceInterface, Mockito.times(2)).getOrNull(ArgumentMatchers.anyLong());
}

View File

@@ -7,7 +7,6 @@ public class OvsdbSession {
private String apId;
private long routingId;
private long equipmentId;
private long mostRecentStatsTimestamp;
public OvsdbClient getOvsdbClient() {
return ovsdbClient;
@@ -33,11 +32,5 @@ public class OvsdbSession {
public void setEquipmentId(long equipmentId) {
this.equipmentId = equipmentId;
}
public long getMostRecentStatsTimestamp() {
return mostRecentStatsTimestamp;
}
public void setMostRecentStatsTimestamp(long mostRecentStatsTimestamp) {
this.mostRecentStatsTimestamp = mostRecentStatsTimestamp;
}
}