Fix throughput for ClientSession, add AP Id to ovsdbClient connect/disconnect where possible

This commit is contained in:
Mike Hansen
2020-07-27 17:01:21 -04:00
parent 19d2b6fc7c
commit 786a696a38
3 changed files with 23 additions and 10 deletions

View File

@@ -1590,8 +1590,14 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
// values reported in Kbps, convert to Mbps
metricDetails.setRxMbps((float) (client.getStats().getRxRate() / 1000));
metricDetails.setTxMbps((float) (client.getStats().getTxRate() / 1000));
metricDetails.setRxRateKbps((long) client.getStats().getRxRate());
metricDetails.setTxRateKbps((long) client.getStats().getTxRate());
// Throughput, do rate / duration
if (client.getDurationMs() > 0) {
metricDetails.setRxRateKbps((long) client.getStats().getRxRate() / client.getDurationMs());
metricDetails.setTxRateKbps((long) client.getStats().getTxRate() / client.getDurationMs());
} else {
LOG.info("Cannot calculate tx/rx throughput for Client {} based on duration of {} Ms",
client.getMacAddress(), client.getDurationMs());
}
return metricDetails;
}

View File

@@ -21,18 +21,21 @@ public class OvsdbSessionMap implements OvsdbSessionMapInterface {
private final ConcurrentHashMap<String, OvsdbSession> connectedClients = new ConcurrentHashMap<>();
@Override
public OvsdbSession getSession(String apId) {
public OvsdbSession getSession(String apId) {
LOG.info("Get session for AP {}", apId);
return connectedClients.get(apId);
}
@Override
public OvsdbSession removeSession(String apId) {
public OvsdbSession removeSession(String apId) {
LOG.info("Removing session for AP {}", apId);
return connectedClients.remove(apId);
}
@Override
public void closeSession(String apId) {
try {
LOG.info("Close session for AP {}", apId);
connectedClients.get(apId).getOvsdbClient().shutdown();
connectedClients.remove(apId);
LOG.info("Closed ovsdb session for {}", apId);

View File

@@ -16,11 +16,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Profile;
import org.springframework.stereotype.Component;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.telecominfraproject.wlan.opensync.external.integration.OvsdbClientInterface;
import com.telecominfraproject.wlan.core.model.equipment.MacAddress;
import com.telecominfraproject.wlan.opensync.external.integration.OpensyncExternalIntegrationInterface;
import com.telecominfraproject.wlan.opensync.external.integration.OvsdbClientInterface;
import com.telecominfraproject.wlan.opensync.external.integration.OvsdbSession;
import com.telecominfraproject.wlan.opensync.external.integration.OvsdbSessionMapInterface;
import com.telecominfraproject.wlan.opensync.external.integration.models.ConnectNodeInfo;
@@ -110,7 +109,7 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
monitorOvsdbStateTables(ovsdbClient, key);
LOG.info("ovsdbClient connected from {} on port {} key {} ", remoteHost, localPort, key);
LOG.info("ovsdbClient connected from {} on port {} AP {} ", remoteHost, localPort, key);
LOG.info("ovsdbClient connectedClients = {}", ovsdbSessionMapInterface.getNumSessions());
} catch (IllegalStateException e) {
@@ -162,7 +161,7 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
}
}
LOG.info("ovsdbClient disconnected from {} on port {} clientCn {} key {} ", remoteHost, localPort,
LOG.info("ovsdbClient disconnected from {} on port {} clientCn {} AP {} ", remoteHost, localPort,
clientCn, key);
LOG.info("ovsdbClient connectedClients = {}", ovsdbSessionMapInterface.getNumSessions());
@@ -182,6 +181,9 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
connectNodeInfo = ovsdbDao.updateConnectNodeInfoOnConnect(ovsdbClient, clientCn, connectNodeInfo);
String apId = clientCn + "_" + connectNodeInfo.serialNumber;
LOG.debug("Client connect for AP {}", apId);
OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId);
try {
@@ -608,10 +610,12 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
ovsdbDao.configureFirmwareFlash(session.getOvsdbClient(), apId, firmwareVersion, username);
} catch (Exception e) {
LOG.error("Failed to flash firmware for " + apId + " " + e.getLocalizedMessage());
monitorOvsdbStateTables(ovsdbClient, apId); // turn back on so we can go forward and recover
monitorOvsdbStateTables(ovsdbClient, apId); // turn back on so we
// can go forward and
// recover
return "Failed to flash firmware for " + apId + " " + e.getLocalizedMessage();
}
}
LOG.debug("Initiated firmware flash for AP {} to {} ", apId, firmwareVersion);
return "Initiated firmware flash for AP " + apId + " to " + firmwareVersion;
}