mirror of
				https://github.com/Telecominfraproject/wlan-cloud-rrm.git
				synced 2025-10-31 18:47:55 +00:00 
			
		
		
		
	Compare commits
	
		
			1 Commits
		
	
	
		
			v2.8.0
			...
			scale-test
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|   | 0279437f5c | 
| @@ -135,5 +135,9 @@ | |||||||
|       <groupId>org.quartz-scheduler</groupId> |       <groupId>org.quartz-scheduler</groupId> | ||||||
|       <artifactId>quartz</artifactId> |       <artifactId>quartz</artifactId> | ||||||
|     </dependency> |     </dependency> | ||||||
|  |     <dependency> | ||||||
|  |       <groupId>org.openjdk.jol</groupId> | ||||||
|  |       <artifactId>jol-core</artifactId> | ||||||
|  |     </dependency> | ||||||
|   </dependencies> |   </dependencies> | ||||||
| </project> | </project> | ||||||
|   | |||||||
| @@ -47,17 +47,17 @@ public class DeviceDataManager { | |||||||
| 	private final ReadWriteLock topologyLock = new ReentrantReadWriteLock(); | 	private final ReadWriteLock topologyLock = new ReentrantReadWriteLock(); | ||||||
|  |  | ||||||
| 	/** Lock on {@link #deviceLayeredConfig}. */ | 	/** Lock on {@link #deviceLayeredConfig}. */ | ||||||
| 	private final ReadWriteLock deviceLayeredConfigLock = | 	public final ReadWriteLock deviceLayeredConfigLock = | ||||||
| 		new ReentrantReadWriteLock(); | 		new ReentrantReadWriteLock(); | ||||||
|  |  | ||||||
| 	/** The current device topology. */ | 	/** The current device topology. */ | ||||||
| 	private DeviceTopology topology; | 	public DeviceTopology topology; | ||||||
|  |  | ||||||
| 	/** The current layered device config. */ | 	/** The current layered device config. */ | ||||||
| 	private DeviceLayeredConfig deviceLayeredConfig; | 	public DeviceLayeredConfig deviceLayeredConfig; | ||||||
|  |  | ||||||
| 	/** The cached device configs (map of serial number to computed config). */ | 	/** The cached device configs (map of serial number to computed config). */ | ||||||
| 	private Map<String, DeviceConfig> cachedDeviceConfigs = | 	public Map<String, DeviceConfig> cachedDeviceConfigs = | ||||||
| 		new ConcurrentHashMap<>(); | 		new ConcurrentHashMap<>(); | ||||||
|  |  | ||||||
| 	/** Empty constructor without backing files (ex. for unit tests). */ | 	/** Empty constructor without backing files (ex. for unit tests). */ | ||||||
|   | |||||||
| @@ -61,6 +61,7 @@ import com.facebook.openwifi.rrm.optimizers.tpc.RandomTxPowerInitializer; | |||||||
| import com.google.gson.Gson; | import com.google.gson.Gson; | ||||||
| import com.google.gson.GsonBuilder; | import com.google.gson.GsonBuilder; | ||||||
|  |  | ||||||
|  | import org.openjdk.jol.info.GraphLayout; | ||||||
| import io.swagger.v3.core.util.Json; | import io.swagger.v3.core.util.Json; | ||||||
| import io.swagger.v3.core.util.Yaml; | import io.swagger.v3.core.util.Yaml; | ||||||
| import io.swagger.v3.jaxrs2.Reader; | import io.swagger.v3.jaxrs2.Reader; | ||||||
| @@ -311,6 +312,7 @@ public class ApiServer implements Runnable { | |||||||
| 		service.get("/api/v1/currentModel", new GetCurrentModelEndpoint()); | 		service.get("/api/v1/currentModel", new GetCurrentModelEndpoint()); | ||||||
| 		service.get("/api/v1/optimizeChannel", new OptimizeChannelEndpoint()); | 		service.get("/api/v1/optimizeChannel", new OptimizeChannelEndpoint()); | ||||||
| 		service.get("/api/v1/optimizeTxPower", new OptimizeTxPowerEndpoint()); | 		service.get("/api/v1/optimizeTxPower", new OptimizeTxPowerEndpoint()); | ||||||
|  | 		service.get("/api/v1/memory", new MemoryEndpoint(this)); | ||||||
|  |  | ||||||
| 		logger.info( | 		logger.info( | ||||||
| 			"API server listening for HTTP internal on port {} and external on port {}", | 			"API server listening for HTTP internal on port {} and external on port {}", | ||||||
| @@ -1360,6 +1362,91 @@ public class ApiServer implements Runnable { | |||||||
| 		} | 		} | ||||||
| 	} | 	} | ||||||
|  |  | ||||||
|  | 	@Path("/api/v1/memory") | ||||||
|  | 	public class MemoryEndpoint implements Route { | ||||||
|  | 		private final ApiServer apiServer; | ||||||
|  |  | ||||||
|  | 		MemoryEndpoint(ApiServer server) { | ||||||
|  | 			this.apiServer = server; | ||||||
|  | 		} | ||||||
|  |  | ||||||
|  | 		@Override | ||||||
|  | 		public String handle(Request request, Response response) { | ||||||
|  | 			String type = request.queryParamOrDefault("type", ""); | ||||||
|  | 			String view = request.queryParamOrDefault("view", "footprint"); | ||||||
|  |  | ||||||
|  | 			java.util.function.Function<GraphLayout, String> fn = (GraphLayout graph) -> { | ||||||
|  | 				return view.equals("footprint") ? graph.toFootprint() : graph.toPrintable(); | ||||||
|  | 			}; | ||||||
|  |  | ||||||
|  | 			String result; | ||||||
|  | 			switch (type) { | ||||||
|  | 				case "modeler.dataModel": | ||||||
|  | 					result = fn.apply(GraphLayout.parseInstance(apiServer.modeler.dataModel)); | ||||||
|  | 					break; | ||||||
|  |  | ||||||
|  | 				case "modeler.dataModel.latestWifiScans": | ||||||
|  | 					result = fn.apply(GraphLayout.parseInstance(apiServer.modeler.dataModel.latestWifiScans)); | ||||||
|  | 					break; | ||||||
|  |  | ||||||
|  | 				case "modeler.dataModel.latestStates": | ||||||
|  | 					result = fn.apply(GraphLayout.parseInstance(apiServer.modeler.dataModel.latestStates)); | ||||||
|  | 					break; | ||||||
|  |  | ||||||
|  | 				case "modeler.dataModel.latestDeviceStatusRadios": | ||||||
|  | 					result = fn.apply(GraphLayout.parseInstance(apiServer.modeler.dataModel.latestDeviceStatusRadios)); | ||||||
|  | 					break; | ||||||
|  |  | ||||||
|  | 				case "modeler.deviceDataManager": | ||||||
|  | 					result = fn.apply(GraphLayout.parseInstance(apiServer.modeler.deviceDataManager)); | ||||||
|  | 					break; | ||||||
|  |  | ||||||
|  | 				case "modeler.deviceDataManager.topology": | ||||||
|  | 					result = fn.apply(GraphLayout.parseInstance(apiServer.modeler.deviceDataManager.topology)); | ||||||
|  | 					break; | ||||||
|  |  | ||||||
|  | 				case "modeler.deviceDataManager.deviceLayeredConfig": | ||||||
|  | 					result = fn.apply(GraphLayout.parseInstance(apiServer.modeler.deviceDataManager.deviceLayeredConfig)); | ||||||
|  | 					break; | ||||||
|  |  | ||||||
|  | 				case "modeler.deviceDataManager.cachedDeviceConfigs": | ||||||
|  | 					result = fn.apply(GraphLayout.parseInstance(apiServer.modeler.deviceDataManager.cachedDeviceConfigs)); | ||||||
|  | 					break; | ||||||
|  |  | ||||||
|  | 				case "modeler.dataModel.latestDeviceCapabilities": | ||||||
|  | 					result = fn.apply(GraphLayout.parseInstance(apiServer.modeler.dataModel.latestDeviceCapabilities)); | ||||||
|  |  | ||||||
|  | 				case "modeler": | ||||||
|  | 					result = fn.apply(GraphLayout.parseInstance(apiServer.modeler)); | ||||||
|  | 					break; | ||||||
|  |  | ||||||
|  | 				case "configManager.deviceDataMap": | ||||||
|  | 					result = fn.apply(GraphLayout.parseInstance(apiServer.configManager.deviceDataMap)); | ||||||
|  | 					break; | ||||||
|  |  | ||||||
|  | 				case "configManager": | ||||||
|  | 					result = fn.apply(GraphLayout.parseInstance(apiServer.configManager)); | ||||||
|  | 					break; | ||||||
|  |  | ||||||
|  | 				case "scheduler": | ||||||
|  | 					result = fn.apply(GraphLayout.parseInstance(apiServer.scheduler)); | ||||||
|  | 					break; | ||||||
|  |  | ||||||
|  | 				case "deviceDataManager": | ||||||
|  | 					result = fn.apply(GraphLayout.parseInstance(apiServer.deviceDataManager)); | ||||||
|  | 					break; | ||||||
|  |  | ||||||
|  | 				case "": | ||||||
|  | 				default: | ||||||
|  | 					result = GraphLayout.parseInstance(apiServer).toFootprint(); | ||||||
|  | 					break; | ||||||
|  | 			} | ||||||
|  |  | ||||||
|  | 			logger.info("MEMORY RESPONSE: \n{}", result); | ||||||
|  | 			return result; | ||||||
|  | 		} | ||||||
|  | 	} | ||||||
|  |  | ||||||
| 	@Path("/api/v1/optimizeTxPower") | 	@Path("/api/v1/optimizeTxPower") | ||||||
| 	public class OptimizeTxPowerEndpoint implements Route { | 	public class OptimizeTxPowerEndpoint implements Route { | ||||||
| 		// Hack for use in @ApiResponse -> @Content -> @Schema | 		// Hack for use in @ApiResponse -> @Content -> @Schema | ||||||
|   | |||||||
| @@ -46,7 +46,7 @@ public class ConfigManager implements Runnable { | |||||||
| 	private final UCentralClient client; | 	private final UCentralClient client; | ||||||
|  |  | ||||||
| 	/** Runtime per-device data. */ | 	/** Runtime per-device data. */ | ||||||
| 	private class DeviceData { | 	public class DeviceData { | ||||||
| 		/** Last received device config. */ | 		/** Last received device config. */ | ||||||
| 		public UCentralApConfiguration config; | 		public UCentralApConfiguration config; | ||||||
|  |  | ||||||
| @@ -55,7 +55,7 @@ public class ConfigManager implements Runnable { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** Map from device serial number to runtime data. */ | 	/** Map from device serial number to runtime data. */ | ||||||
| 	private Map<String, DeviceData> deviceDataMap = new TreeMap<>(); | 	public Map<String, DeviceData> deviceDataMap = new TreeMap<>(); | ||||||
|  |  | ||||||
| 	/** The main thread reference (i.e. where {@link #run()} is invoked). */ | 	/** The main thread reference (i.e. where {@link #run()} is invoked). */ | ||||||
| 	private Thread mainThread; | 	private Thread mainThread; | ||||||
|   | |||||||
| @@ -50,7 +50,7 @@ public class Modeler implements Runnable { | |||||||
| 	private final ModelerParams params; | 	private final ModelerParams params; | ||||||
|  |  | ||||||
| 	/** The device data manager. */ | 	/** The device data manager. */ | ||||||
| 	private final DeviceDataManager deviceDataManager; | 	public final DeviceDataManager deviceDataManager; | ||||||
|  |  | ||||||
| 	/** The uCentral client instance. */ | 	/** The uCentral client instance. */ | ||||||
| 	private final UCentralClient client; | 	private final UCentralClient client; | ||||||
| @@ -74,7 +74,7 @@ public class Modeler implements Runnable { | |||||||
| 	} | 	} | ||||||
|  |  | ||||||
| 	/** The blocking data queue. */ | 	/** The blocking data queue. */ | ||||||
| 	private final BlockingQueue<InputData> dataQueue = | 	public final BlockingQueue<InputData> dataQueue = | ||||||
| 		new LinkedBlockingQueue<>(); | 		new LinkedBlockingQueue<>(); | ||||||
|  |  | ||||||
| 	/** Data model representation. */ | 	/** Data model representation. */ | ||||||
|   | |||||||
							
								
								
									
										5
									
								
								pom.xml
									
									
									
									
									
								
							
							
						
						
									
										5
									
								
								pom.xml
									
									
									
									
									
								
							| @@ -211,6 +211,11 @@ | |||||||
|         <artifactId>quartz</artifactId> |         <artifactId>quartz</artifactId> | ||||||
|         <version>2.3.2</version> |         <version>2.3.2</version> | ||||||
|       </dependency> |       </dependency> | ||||||
|  |     <dependency> | ||||||
|  |       <groupId>org.openjdk.jol</groupId> | ||||||
|  |       <artifactId>jol-core</artifactId> | ||||||
|  |       <version>0.16</version> | ||||||
|  |     </dependency> | ||||||
|     </dependencies> |     </dependencies> | ||||||
|   </dependencyManagement> |   </dependencyManagement> | ||||||
| </project> | </project> | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user