1# Copyright (c) 2014 The Chromium Authors. All rights reserved.
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4
5import ap_spec
6import belkinF9K_ap_configurator
7
8
9class BelkinF7D5301APConfigurator(
10        belkinF9K_ap_configurator.BelkinF9KAPConfigurator):
11    """Class to configure Belkin F7D5301 router."""
12
13    def __init__(self, ap_config):
14        super(BelkinF7D5301APConfigurator, self).__init__(ap_config)
15        self._dhcp_delay = 0
16
17
18    def _set_mode(self, mode):
19        mode_mapping = {ap_spec.MODE_G: '802.11g',
20                        ap_spec.MODE_N: '1x1 802.11n',
21                        ap_spec.MODE_B | ap_spec.MODE_G | ap_spec.MODE_N:
22                        '802.11b & 802.11g & 1x1 802.11n'}
23        mode_name = mode_mapping.get(mode)
24        if not mode_name:
25            raise RuntimeError('The mode %d not supported by router %s. ',
26                               hex(mode), self.name)
27        xpath = '//select[@name="wbr"]'
28        self.select_item_from_popup_by_xpath(mode_name, xpath,
29                                             wait_for_xpath=None,
30                                             alert_handler=self._security_alert)
31
32