def ppsk_manual_create_user(): wui = WebUI() config = Configuration(wui.d("visit.url"), wui.d("visit.title"), wui.d("visit.pre_url")) if wui.session_id: config.to_page_before_deployed_ssid() #---------------------------------add a user group ------------------------------------ wui.input(SsidPage.get('Input_ssid_textarea'), wui.d("ssid.ssid_name")) wui.input(SsidPage.get('Input_ssid_boardcast_textarea'), wui.d("ssid.ssid_boardcast_name")) wui.info('handle input the name of ssid boardcast name', True) wui.info('will move scroll to access security...', True) wui.move_scroll_to_element(DeployedSSID.get('access_div')) wui.wait_until_element_displayed(DeployedSSID.get('access_8021x_label')) wui.click(SsidPage.get('Select_PPSK')) wui.info('select access security is private psk end.', True) wui.click(SsidPage.get('Add_user_group_button')) wui.info('ge to select user group page', True) wui.click(SsidPage.get('new_user_group_button')) wui.info('ge to create user group page', True) config.wait_deploy_element(1) wui.input(SsidPage.get('Input_user_group_name_textarea'), wui.d("ssid.user_group_name")) wui.info('input the name of user group name', True) config.wait_deploy_element(1) wui.click(SsidPage.get('Save_button_new_user_group_page')) wui.info('save the created user group', True) config.wait_deploy_element(1) click_to_add_user_of_usergroup(wui, wui.d("ssid.user_group_name")) wui.wait_until_element_displayed(SsidPage.get('user_account_list')) #---------------------------------add user to user group--------------------------------------------- wui.click(SsidPage.get('Add_user_to_user_group_button')) wui.info('add user to user group', True) wui.input(SsidPage.get('Input_user_name_textarea'), wui.d("ssid.user_name")) wui.info('input the name of user', True) wui.input(SsidPage.get('Input_password_textarea'), wui.d("ssid.user_password")) wui.info('input the password of user', True) wui.input(SsidPage.get('Input_user_password_confirm_textarea'), wui.d("ssid.user_password")) wui.info('confirm the password of user', True) wui.click(SsidPage.get('Save_user_button')) wui.info('save the user', True) config.wait_deploy_element(1) wui.click(SsidPage.get('Cancel_button_of_user_in_user_group_page')) wui.info('to select usergroup page', True) config.wait_deploy_element(1) add_user_group_to_ssid_and_save(wui, wui.d("ssid.user_group_name")) wui.info('select the defiend user group and save', True) config.wait_deploy_element(1) wui.info('handle create a new ppsk ssid pic', True) wui.click(DeployedSSID.get('save_btn'))
def mac_filter_configuration(): wui = WebUI() config = Configuration(wui.d("visit.url"), wui.d("visit.title")) if wui.session_id: config.to_page_before_deployed_ssid() ssidname=wui.d("ssid.name") config.input_ssid_name(ssidname, ssidname) config.ssid_usage_settings('CUSTOM') #select to security method as wpa psk psk_key="aerohive" wui.info('will move scroll to access security...', True) wui.move_scroll_to_element(DeployedSSID.get('access_div')) wui.wait_until_element_displayed(DeployedSSID.get('psk_access_label')) wui.click(DeployedSSID.get('psk_access_span')) wui.wait_until_element_displayed(DeployedSSID.get('psk_key_value')) wui.input(DeployedSSID.get('psk_key_value'), psk_key) wui.wait_until_element_displayed(DeployedSSID.get('psk_confirm_value')) wui.input(DeployedSSID.get('psk_confirm_value'), psk_key) #select cwp tab to config cwp cwp_name = wui.d("ssid.cwp_name") wui.info('try to click captive web portal tab to enable cwp', True) wui.move_scroll_to_element_use_px(CWPConfig.get('ssid_tab')) wui.click(CWPConfig.get('cwp_tab')) wui.wait_until_element_displayed(CWPConfig.get('cwp_enable_switch')) wui.info('go to cwp configuration section successfully...', True) #enable cwp switch wui.check(CWPConfig.get('cwp_enable_switch')) wui.info('enable cwp successfull....', True) #config cwp web directory name wui.info('try to move element to cwp name input line....', True) wui.move_scroll_to_element(CWPConfig.get('cwp_name_input_element')) wui.input(CWPConfig.get('cwp_to_use_input'),cwp_name) time.sleep(1) wui.info('input cwp name successfully', True) wui.info('try to click the save button to save the cwp object', True) wui.click(CWPConfig.get('cwp_to_use_save')) wui.wait_until_element_displayed(CWPConfig.get('new_cwp_title')) time.sleep(1) wui.info('go to new cwp page success...', True) wui.wait_until_element_displayed(CWPConfig.get('cwp_name')) wui.click(CWPConfig.get('new_cwp_save')) time.sleep(2) wui.info('try to move scroll to cwp section', True) wui.move_scroll_to_element(CWPConfig.get('cwp_name_input_element')) wui.info('create cwp successfully', True) # save the ssid level configuration wui.click(CWPConfig.get('new_ssid_save')) wui.wait_until_element_displayed(CWPConfig.get('new_ssid_success')) time.sleep(1) wui.info('Save ssid successfully', True) #go to deploy page, and push config wui.click(monitor_cfg.Deploy_policy_button) time.sleep(2) wui.info( 'go to deploy policy page success' , True )
def mac_filter_configuration(): wui = WebUI() config = Configuration(wui.d("visit.url"), wui.d("visit.title")) if wui.session_id: config.to_url_home() config.to_menu(wui.d("policy.menu_name")) config.wait_until_to_menu_success(wui.d("policy.menu_name")) config.to_page_before_policy() config.create_network_policy(wui.d("policy.name"), wui.d("policy.Description")) wui.wait_until_element_displayed(SelectSSIDPage.get('new_btn')) wui.info('Get to SSID select page', True) wui.click(SelectSSIDPage.get('new_btn')) #input ssid name ssidname=wui.d("ssid.name") wui.wait_until_element_displayed(ConfigSSIDPage.get('ssidname_input')) wui.info('Get to SSID configure page', True) wui.input(ConfigSSIDPage.get('ssidname_input'), ssidname) wui.clear(ConfigSSIDPage.get('ssidbroadname_input')) wui.input(ConfigSSIDPage.get('ssidbroadname_input'), ssidname) wui.info('Input SSID name successfully', True) #select customer checkbox wui.wait_until_element_displayed(DeployedSSID.get('custom_display')) wui.click(DeployedSSID.get('custom_span')) time.sleep(1) wui.info('Select custom option successfully', True) #select open auth checkbox wui.info("Enter to Open mode") wui.info('will move scroll to next access security section', True) wui.move_scroll_to_element(DeployedSSID.get('access_div')) wui.wait_until_element_displayed(DeployedSSID.get('open_access_label')) wui.click(DeployedSSID.get('open_access_span')) wui.info('Config open successfully', True) #check optional setting section for mac filter is displayed wui.info('will move scroll to bottom page', True) wui.move_scroll_bottom() wui.wait_until_element_displayed(MacFilter.get('optional_setting_desc_xpath')) #optional setting page title diplay wui.info('Try to click customize button to go to config page', True) wui.click(MacFilter.get('opt_customize_btn')) wui.info('go to optional setting config page successfully', True) #go to mac filter config sections #enable mac-filter function wui.click(MacFilter.get('mac_filter_checkbox')) wui.info('mac filter is enabled!', True) #check the default action is Permit global_default_action = "Permit" new_global_default_action = wui.find_element(MacFilter.get('mac_filter_default_action')).text if global_default_action == new_global_default_action: wui.info('the global default action is Permit, it is correct for default setting', True) else: wui.error('The default action is incorrect!', True) #click new to add an mac filter entry, for exmaple for apples devices wui.info('Try to move to add new mac filter entry section', True) wui.move_scroll_to_element_use_px(MacFilter.get('mac_filter_section')) wui.info('move to mac filter config section success', True) wui.click(MacFilter.get('mac_filter_entry_new_btn')) wui.wait_until_element_displayed(MacFilter.get('mac_filter_newentry_input_mac')) wui.info('the new mac filter section display success!', True) #select apple devices oui wui.click(MacFilter.get('mac_filter_newentry_select_mac_btn')) wui.wait_until_element_displayed(MacFilter.get('mac_entry_oui_apple')) wui.info('can show the mac list success!', True) wui.click(MacFilter.get('mac_entry_oui_apple')) wui.info('select the apple devices oui success!', True) #select the mac entry action as deny wui.click(MacFilter.get('mac_entry_action_btn')) wui.info('click the dropdown box success!', True) tmp_mac_entry_action=wui.find_element(MacFilter.get('mac_entry_action_deny')).text selected_mac_entry_action = tmp_mac_entry_action.upper() wui.click(MacFilter.get('mac_entry_action_deny')) wui.info('select the deny action success!', True) #add the mac entry wui.click(MacFilter.get('mac_entry_add_btn')) wui.info('add the mac entry success!', True) # click save button to save the config about optional settings new_mac_entry_oui = wui.find_element(MacFilter.get('added_mac_entry_oui_name')).text new_mac_entry_action = wui.find_element(MacFilter.get('added_mac_entry_action')).text if (new_mac_entry_oui == "Apple-iPhone") and (new_mac_entry_action == selected_mac_entry_action): wui.info('mac filter object is correct....', True) else: wui.error('mac-filter object is incorrect....', True) wui.click(MacFilter.get('optional_setting_save_btn')) # save the ssid level configuration wui.click(MacFilter.get('ssid_saved_btn')) wui.wait_until_element_displayed(MacFilter.get('ssid_saved_success')) wui.info('Save ssid successfully', True) #go to deploy page, and push config wui.click(monitor_cfg.Deploy_policy_button) time.sleep(2) wui.info( 'go to deploy policy page success' , True )