Class ChannelOptimizer

    • Field Detail

      • MIN_CHANNEL_WIDTH

        public static final int MIN_CHANNEL_WIDTH
        Minimum supported channel width (MHz), inclusive.
        See Also:
        Constant Field Values
      • AVAILABLE_CHANNELS_WIDTH

        protected static final Map<Integer,​List<Integer>> AVAILABLE_CHANNELS_WIDTH
        Map of channel width (MHz) to available (primary) channels
      • PRIORITY_CHANNELS_2G

        protected static final List<Integer> PRIORITY_CHANNELS_2G
        List of priority channels on 2.4GHz.
      • zone

        protected final String zone
        The RF zone.
      • deviceConfigs

        protected final Map<String,​DeviceConfig> deviceConfigs
        The device configs within zone, keyed on serial number.
    • Method Detail

      • getPrimaryChannel

        protected static int getPrimaryChannel​(int channel,
                                               int channelWidth)
        Get the primary channel depending on the given channel and channel width.
        Parameters:
        channel - the current channel (from the scan result)
        channelWidth - the channel bandwidth (MHz)
        Returns:
        the primary channel, 0 if error
      • getChannelWidthFromWiFiScan

        protected static int getChannelWidthFromWiFiScan​(int channel,
                                                         String htOper,
                                                         String vhtOper)
        Get the channel width based on the HT operation and VHT operation in wifi scan.
        Parameters:
        channel - the current channel (from the scan result)
        htOper - the HT operation information element
        vhtOper - the VHT operation information element
        Returns:
        the channel width, default = MIN_CHANNEL_WIDTH
      • getCoveredChannels

        protected static List<Integer> getCoveredChannels​(int channel,
                                                          int primaryChannel,
                                                          int channelWidth)
        Get the actual covered channels of a neighboring AP based on the given channel and channel width.
        Parameters:
        channel - the current channel (from the scan result)
        primaryChannel - the primary channel corresponding to the channelWidth
        channelWidth - the channel bandwidth (MHz)
        Returns:
        the list of the covered channels, the current channel if it is 2.4 GHz or error
      • getDeviceToWiFiScans

        protected static Map<String,​List<WifiScanEntry>> getDeviceToWiFiScans​(String band,
                                                                                    Map<String,​List<List<WifiScanEntry>>> latestWifiScans,
                                                                                    Map<String,​List<String>> bandsMap)
        Get the filtered and reorganized wifiscan results per device.
        Parameters:
        band - the operational band
        latestWifiScans - the raw wifiscan results from upstream
        bandsMap - the participated OWF APs on this band
        Returns:
        map of device (serial number) to wifiscan results
      • getCurrentChannel

        protected static int[] getCurrentChannel​(String band,
                                                 String serialNumber,
                                                 State state,
                                                 Map<String,​Map<String,​Capabilities.Phy>> latestDeviceCapabilitiesPhy)
        Get the current channel and channel width (MHz) of the device (from state data).
        Parameters:
        band - the operational band (e.g., "2G")
        serialNumber - the device's serial number
        state - the latest state of all the devices
        latestDeviceCapabilitiesPhy - latest device phy from capabilities
        Returns:
        the current channel and channel width (MHz) of the device in the given band; returns a current channel of 0 if no channel in the given band is found.
      • updateAvailableChannelsList

        protected List<Integer> updateAvailableChannelsList​(String band,
                                                            String serialNumber,
                                                            int channelWidth,
                                                            List<Integer> availableChannelsList)
        Update the available channels based on bandwidth-specific, user, allowed channels (the last two are from deviceConfig).
        Parameters:
        band - the operational band
        serialNumber - the device
        channelWidth - the channel bandwidth (MHz)
        availableChannelsList - the available channels of the device
        Returns:
        the updated available channels of the device
      • calculatePerfMetrics

        protected void calculatePerfMetrics​(Map<String,​Integer> tempChannelMap,
                                            Map<String,​List<WifiScanEntry>> deviceToWifiScans,
                                            Map<String,​String> bssidsMap,
                                            boolean mode)
        Calculate the performance metrics based on the given assignment.
        Parameters:
        tempChannelMap - the map of device (serial number) to its given channel
        deviceToWifiScans - the map of device (serial number) to wifiscan results
        bssidsMap - the map of bssid to device (serial number)
        mode - true for the new assignment and false for the current assignment
      • logPerfMetrics

        protected void logPerfMetrics​(Map<String,​Integer> oldChannelMap,
                                      Map<String,​Integer> newChannelMap,
                                      Map<String,​List<WifiScanEntry>> deviceToWifiScans,
                                      Map<String,​String> bssidsMap)
        Log the performance metrics before and after the algorithm.
        Parameters:
        oldChannelMap - the map of device (serial number) to its current channel
        newChannelMap - the map of device (serial number) to its new channel
        deviceToWifiScans - the map of device (serial number) to wifiscan results
        bssidsMap - the map of bssid to device (serial number)
      • computeChannelMap

        public abstract Map<String,​Map<String,​Integer>> computeChannelMap()
        Compute channel assignments.
        Returns:
        the map of devices (by serial number) to radio to channel
      • updateDeviceApConfig

        public void updateDeviceApConfig​(DeviceDataManager deviceDataManager,
                                         ConfigManager configManager,
                                         Map<String,​Map<String,​Integer>> channelMap)
        Program the given channel map into the AP config.
        Parameters:
        deviceDataManager - the DeviceDataManager instance
        configManager - the ConfigManager instance
        channelMap - the map of devices (by serial number) to radio to channel