mirror of
				https://github.com/Telecominfraproject/wlan-cloud-opensync-controller.git
				synced 2025-10-31 18:47:57 +00:00 
			
		
		
		
	[WIFI-7888] Add concurrent burst config handling in opensync gateway
This commit is contained in:
		| @@ -1,5 +1,7 @@ | ||||
| package com.telecominfraproject.wlan.opensync.external.integration; | ||||
|  | ||||
| import java.util.concurrent.atomic.AtomicInteger; | ||||
|  | ||||
| import com.vmware.ovsdb.service.OvsdbClient; | ||||
|  | ||||
| public class OvsdbSession { | ||||
| @@ -7,6 +9,7 @@ public class OvsdbSession { | ||||
|     private String apId; | ||||
|     private long routingId; | ||||
|     private long equipmentId; | ||||
|     private AtomicInteger currentConfigNumInFlight = new AtomicInteger(); | ||||
|      | ||||
|     public OvsdbClient getOvsdbClient() { | ||||
|         return ovsdbClient; | ||||
| @@ -33,4 +36,8 @@ public class OvsdbSession { | ||||
|         this.equipmentId = equipmentId; | ||||
|     } | ||||
|      | ||||
|     public AtomicInteger getCurrentConfigNumInFlight() { | ||||
|         return currentConfigNumInFlight; | ||||
|     } | ||||
|   | ||||
| } | ||||
|   | ||||
| @@ -440,6 +440,13 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface { | ||||
|  | ||||
|         OvsdbClient ovsdbClient = ovsdbSession.getOvsdbClient(); | ||||
|  | ||||
|         int currentConfigCount = ovsdbSession.getCurrentConfigNumInFlight().get(); | ||||
|         if (currentConfigCount == 0L) { | ||||
|             // Current count is 0, start this config push | ||||
|             // Increment other incoming configs into the count until this config push is done | ||||
|             currentConfigCount = ovsdbSession.getCurrentConfigNumInFlight().incrementAndGet(); | ||||
|             do { | ||||
|                 try { | ||||
|                     OpensyncAPConfig opensyncAPConfig = extIntegrationInterface.getApConfig(apId); | ||||
|                      | ||||
|                     if (opensyncAPConfig == null) { | ||||
| @@ -461,8 +468,28 @@ public class TipWlanOvsdbClient implements OvsdbClientInterface { | ||||
|                     if(needToPushConfigToAP) { | ||||
|                         pushConfigToAp(ovsdbClient, opensyncAPConfig, apId, configVersionFromProfiles); | ||||
|                     } | ||||
|          | ||||
|                     LOG.debug("Finished processConfigChanged for {}", apId); | ||||
|                 } catch (Exception ex) { | ||||
|                     // If anything fails in the ovsdb config push, clean up count and exit | ||||
|                     ovsdbSession.getCurrentConfigNumInFlight().set(0); | ||||
|                     return; | ||||
|                 } | ||||
|                 int checkCount = ovsdbSession.getCurrentConfigNumInFlight().get(); | ||||
|                 if (checkCount == currentConfigCount) { | ||||
|                     // Count didn't change from pre-config push, we can clean up and exit | ||||
|                     if (ovsdbSession.getCurrentConfigNumInFlight().compareAndSet(currentConfigCount, 0)) { | ||||
|                         return; | ||||
|                     } | ||||
|                 } else { | ||||
|                     // Count has changed, update the currentConfigCount and rerun config push | ||||
|                     ovsdbSession.getCurrentConfigNumInFlight().incrementAndGet(); | ||||
|                 } | ||||
|             } while (ovsdbSession.getCurrentConfigNumInFlight().get() != 0); | ||||
|         } else { | ||||
|             // Count is not 0, another request is being processed for this OvsdbSession | ||||
|             // Remember this request, and the other thread will check the count when it's done | ||||
|             ovsdbSession.getCurrentConfigNumInFlight().incrementAndGet(); | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     @Override | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 ralphlee
					ralphlee