Class LeastUsedChannelOptimizer
- java.lang.Object
-
- com.facebook.openwifi.rrm.optimizers.channel.ChannelOptimizer
-
- com.facebook.openwifi.rrm.optimizers.channel.LeastUsedChannelOptimizer
-
- Direct Known Subclasses:
UnmanagedApAwareChannelOptimizer
public class LeastUsedChannelOptimizer extends ChannelOptimizer
Least used channel optimizer.Randomly assign APs to the least loaded channels.
-
-
Field Summary
Fields Modifier and Type Field Description static String
ALGORITHM_ID
The RRM algorithm ID.protected static int
OVERLAP_WINDOW
The window size for overlapping channels.protected Random
rng
The PRNG instance.-
Fields inherited from class com.facebook.openwifi.rrm.optimizers.channel.ChannelOptimizer
AVAILABLE_CHANNELS_WIDTH, deviceConfigs, MIN_CHANNEL_WIDTH, model, PRIORITY_CHANNELS_2G, zone
-
-
Constructor Summary
Constructors Constructor Description LeastUsedChannelOptimizer(Modeler.DataModel model, String zone, DeviceDataManager deviceDataManager)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Map<String,Map<String,Integer>>
computeChannelMap()
Compute channel assignments.protected int
getNewChannel(String band, String serialNumber, List<Integer> availableChannelsList, int currentChannel, Map<Integer,Integer> occupiedChannels)
Get a new/current channel for the device.protected Map<Integer,Integer>
getOccupiedChannels(String band, String serialNumber, int channelWidth, List<Integer> availableChannelsList, Map<String,List<WifiScanEntry>> deviceToWifiScans, Map<String,Map<String,Integer>> channelMap, Map<String,String> bssidsMap)
Get the current occupied channel info of the device.protected static Map<Integer,Integer>
getOccupiedOverlapChannels(Map<Integer,Integer> occupiedChannels)
Update the occupied channel info to include the overlapping channels (for 2.4G).protected List<WifiScanEntry>
getScanRespsByBandwidth(String band, String serialNumber, int channelWidth, Map<String,List<WifiScanEntry>> deviceToWifiScans)
Get the wifiscan results based on the bandwidth infoprotected static List<String>
getSortedAPs(Map<String,List<WifiScanEntry>> deviceToWifiScans)
Get the sorted APs list to determine the visit ordering.static LeastUsedChannelOptimizer
makeWithArgs(Modeler.DataModel model, String zone, DeviceDataManager deviceDataManager, Map<String,String> args)
Factory method to parse generic args map into the proper constructor-
Methods inherited from class com.facebook.openwifi.rrm.optimizers.channel.ChannelOptimizer
calculatePerfMetrics, getChannelWidthFromWiFiScan, getCoveredChannels, getCurrentChannel, getDeviceToWiFiScans, getPrimaryChannel, logPerfMetrics, updateAvailableChannelsList, updateDeviceApConfig
-
-
-
-
Field Detail
-
ALGORITHM_ID
public static final String ALGORITHM_ID
The RRM algorithm ID.- See Also:
- Constant Field Values
-
OVERLAP_WINDOW
protected static final int OVERLAP_WINDOW
The window size for overlapping channels.- See Also:
- Constant Field Values
-
rng
protected final Random rng
The PRNG instance.
-
-
Constructor Detail
-
LeastUsedChannelOptimizer
public LeastUsedChannelOptimizer(Modeler.DataModel model, String zone, DeviceDataManager deviceDataManager)
Constructor.
-
-
Method Detail
-
makeWithArgs
public static LeastUsedChannelOptimizer makeWithArgs(Modeler.DataModel model, String zone, DeviceDataManager deviceDataManager, Map<String,String> args)
Factory method to parse generic args map into the proper constructor
-
getSortedAPs
protected static List<String> getSortedAPs(Map<String,List<WifiScanEntry>> deviceToWifiScans)
Get the sorted APs list to determine the visit ordering.- Parameters:
deviceToWifiScans
- the filtered and reorganized wifiscan results- Returns:
- list of the name of the sorted APs
-
getOccupiedOverlapChannels
protected static Map<Integer,Integer> getOccupiedOverlapChannels(Map<Integer,Integer> occupiedChannels)
Update the occupied channel info to include the overlapping channels (for 2.4G).- Parameters:
occupiedChannels
- the current occupied channels info of the device- Returns:
- map of channel to score/weight
-
getScanRespsByBandwidth
protected List<WifiScanEntry> getScanRespsByBandwidth(String band, String serialNumber, int channelWidth, Map<String,List<WifiScanEntry>> deviceToWifiScans)
Get the wifiscan results based on the bandwidth info- Parameters:
band
- the operational bandserialNumber
- the devicechannelWidth
- the channel bandwidth (MHz)deviceToWifiScans
- the filtered and reorganized wifiscan results- Returns:
- the wifiscan results on the bandwidth-specific primary channels
-
getOccupiedChannels
protected Map<Integer,Integer> getOccupiedChannels(String band, String serialNumber, int channelWidth, List<Integer> availableChannelsList, Map<String,List<WifiScanEntry>> deviceToWifiScans, Map<String,Map<String,Integer>> channelMap, Map<String,String> bssidsMap)
Get the current occupied channel info of the device.- Parameters:
band
- the operational bandserialNumber
- the devicechannelWidth
- the channel bandwidth (MHz)availableChannelsList
- the available channels of the devicedeviceToWifiScans
- the filtered and reorganized wifiscan results- Returns:
- map of channel to score/weight/# APs
-
getNewChannel
protected int getNewChannel(String band, String serialNumber, List<Integer> availableChannelsList, int currentChannel, Map<Integer,Integer> occupiedChannels)
Get a new/current channel for the device.- Parameters:
band
- the operational bandserialNumber
- the deviceavailableChannelsList
- the available channels of the devicecurrentChannel
- the current channel of the device (for comparison)occupiedChannels
- the occupied channels info of the device- Returns:
- the new/current channel of the device
-
computeChannelMap
public Map<String,Map<String,Integer>> computeChannelMap()
Description copied from class:ChannelOptimizer
Compute channel assignments.- Specified by:
computeChannelMap
in classChannelOptimizer
- Returns:
- the map of devices (by serial number) to radio to channel
-
-