1# Copyright (c) 2013 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
6import ap_spec
7import belkinF9K_ap_configurator
8
9
10class BelkinF5D8236APConfigurator(
11        belkinF9K_ap_configurator.BelkinF9KAPConfigurator):
12    """Class to configure Blekin f5d8236-4 v2 router."""
13
14    def __init__(self, ap_config):
15        super(BelkinF5D8236APConfigurator, self).__init__(ap_config)
16        self._dhcp_delay = 0
17
18
19    def _set_security_wpapsk(self, security, shared_key, update_interval=None):
20        key_field = '//input[@name="wpa_key_pass"]'
21        psk = '//select[@name="authentication"]'
22        self.select_item_from_popup_by_xpath('WPA/WPA2-Personal (PSK)',
23                                             self.security_popup,
24                                             wait_for_xpath=key_field,
25                                             alert_handler=self._security_alert)
26        selection = 'WPA2-PSK'
27        if security == ap_spec.SECURITY_TYPE_WPAPSK:
28            selection = 'WPA-PSK'
29        self.select_item_from_popup_by_xpath(selection, psk,
30                                             wait_for_xpath=key_field,
31                                             alert_handler=self._security_alert)
32        self.set_content_of_text_field_by_xpath(shared_key, key_field,
33                                                abort_check=False)
34