1# Copyright (c) 2012 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
5"""Base class for NetgearWNDR dual band routers."""
6
7import netgear_WNDR_dual_band_configurator
8import ap_spec
9
10
11class Netgear4500APConfigurator(
12        netgear_WNDR_dual_band_configurator.NetgearDualBandAPConfigurator):
13    """Base class for Netgear WNDR 4500 dual band routers."""
14
15
16    def _set_mode(self, mode, band=None):
17        if mode == ap_spec.MODE_G or mode == ap_spec.MODE_A:
18            mode = 'Up to 54 Mbps'
19        elif mode == ap_spec.MODE_N:
20            mode = 'Up to 450 Mbps'
21        else:
22            raise RuntimeError('Unsupported mode passed.')
23        xpath = '//select[@name="opmode"]'
24        if self.current_band == ap_spec.BAND_5GHZ:
25            xpath = '//select[@name="opmode_an"]'
26        self.wait_for_object_by_xpath(xpath)
27        self.select_item_from_popup_by_xpath(mode, xpath)
28
29