mirror of
				https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
				synced 2025-11-04 04:27:59 +00:00 
			
		
		
		
	Fix throughput for ClientSession, add AP Id to ovsdbClient connect/disconnect where possible
This commit is contained in:
		@@ -1590,8 +1590,14 @@ public class OpensyncExternalIntegrationCloud implements OpensyncExternalIntegra
 | 
				
			|||||||
        // values reported in Kbps, convert to Mbps
 | 
					        // values reported in Kbps, convert to Mbps
 | 
				
			||||||
        metricDetails.setRxMbps((float) (client.getStats().getRxRate() / 1000));
 | 
					        metricDetails.setRxMbps((float) (client.getStats().getRxRate() / 1000));
 | 
				
			||||||
        metricDetails.setTxMbps((float) (client.getStats().getTxRate() / 1000));
 | 
					        metricDetails.setTxMbps((float) (client.getStats().getTxRate() / 1000));
 | 
				
			||||||
        metricDetails.setRxRateKbps((long) client.getStats().getRxRate());
 | 
					        // Throughput, do rate / duration
 | 
				
			||||||
        metricDetails.setTxRateKbps((long) client.getStats().getTxRate());
 | 
					        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;
 | 
					        return metricDetails;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,17 +22,20 @@ public class OvsdbSessionMap implements OvsdbSessionMapInterface {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public OvsdbSession getSession(String apId) {
 | 
					    public OvsdbSession getSession(String apId) {
 | 
				
			||||||
 | 
					        LOG.info("Get session for AP {}", apId);
 | 
				
			||||||
        return connectedClients.get(apId);
 | 
					        return connectedClients.get(apId);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public OvsdbSession removeSession(String apId) { 
 | 
					    public OvsdbSession removeSession(String apId) { 
 | 
				
			||||||
 | 
					        LOG.info("Removing session for AP {}", apId);
 | 
				
			||||||
        return connectedClients.remove(apId);
 | 
					        return connectedClients.remove(apId);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    @Override
 | 
					    @Override
 | 
				
			||||||
    public void closeSession(String apId) {
 | 
					    public void closeSession(String apId) {
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
 | 
					            LOG.info("Close session for AP {}", apId);
 | 
				
			||||||
            connectedClients.get(apId).getOvsdbClient().shutdown();
 | 
					            connectedClients.get(apId).getOvsdbClient().shutdown();
 | 
				
			||||||
            connectedClients.remove(apId);
 | 
					            connectedClients.remove(apId);
 | 
				
			||||||
            LOG.info("Closed ovsdb session for {}", apId);
 | 
					            LOG.info("Closed ovsdb session for {}", apId);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -16,11 +16,10 @@ import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			|||||||
import org.springframework.context.annotation.Profile;
 | 
					import org.springframework.context.annotation.Profile;
 | 
				
			||||||
import org.springframework.stereotype.Component;
 | 
					import org.springframework.stereotype.Component;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import com.google.common.collect.ImmutableList;
 | 
					 | 
				
			||||||
import com.google.common.collect.ImmutableMap;
 | 
					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.core.model.equipment.MacAddress;
 | 
				
			||||||
import com.telecominfraproject.wlan.opensync.external.integration.OpensyncExternalIntegrationInterface;
 | 
					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.OvsdbSession;
 | 
				
			||||||
import com.telecominfraproject.wlan.opensync.external.integration.OvsdbSessionMapInterface;
 | 
					import com.telecominfraproject.wlan.opensync.external.integration.OvsdbSessionMapInterface;
 | 
				
			||||||
import com.telecominfraproject.wlan.opensync.external.integration.models.ConnectNodeInfo;
 | 
					import com.telecominfraproject.wlan.opensync.external.integration.models.ConnectNodeInfo;
 | 
				
			||||||
@@ -110,7 +109,7 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
                    monitorOvsdbStateTables(ovsdbClient, key);
 | 
					                    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());
 | 
					                    LOG.info("ovsdbClient connectedClients = {}", ovsdbSessionMapInterface.getNumSessions());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                } catch (IllegalStateException e) {
 | 
					                } 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);
 | 
					                        clientCn, key);
 | 
				
			||||||
                LOG.info("ovsdbClient connectedClients = {}", ovsdbSessionMapInterface.getNumSessions());
 | 
					                LOG.info("ovsdbClient connectedClients = {}", ovsdbSessionMapInterface.getNumSessions());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -182,6 +181,9 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
 | 
				
			|||||||
        connectNodeInfo = ovsdbDao.updateConnectNodeInfoOnConnect(ovsdbClient, clientCn, connectNodeInfo);
 | 
					        connectNodeInfo = ovsdbDao.updateConnectNodeInfoOnConnect(ovsdbClient, clientCn, connectNodeInfo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        String apId = clientCn + "_" + connectNodeInfo.serialNumber;
 | 
					        String apId = clientCn + "_" + connectNodeInfo.serialNumber;
 | 
				
			||||||
 | 
					        
 | 
				
			||||||
 | 
					        LOG.debug("Client connect for AP {}", apId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId);
 | 
					        OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        try {
 | 
					        try {
 | 
				
			||||||
@@ -608,7 +610,9 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface {
 | 
				
			|||||||
            ovsdbDao.configureFirmwareFlash(session.getOvsdbClient(), apId, firmwareVersion, username);
 | 
					            ovsdbDao.configureFirmwareFlash(session.getOvsdbClient(), apId, firmwareVersion, username);
 | 
				
			||||||
        } catch (Exception e) {
 | 
					        } catch (Exception e) {
 | 
				
			||||||
            LOG.error("Failed to flash firmware for " + apId + " " + e.getLocalizedMessage());
 | 
					            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();
 | 
					            return "Failed to flash firmware for " + apId + " " + e.getLocalizedMessage();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user