def data_collect_default_config_push(): wui = WebUI() config = Configuration(wui.d("visit.url"), wui.d("visit.title"), wui.d("visit.pre_url")) 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")) wui.click(monitor_cfg.Configuration_button) wui.info( 'go to configuration page success' , True ) wui.click(monitor_cfg.add_button) wui.info( 'go to add network policy page success' , True ) policyname = wui.d( "sw_policy_name") #policyname = "wwwu-2257" wui.input(monitor_cfg.get( 'PolicyName_txt'), policyname) wui.input(monitor_cfg.get( 'PolicyDesc_txt'), wui.d("NetworkPolicy.PolicyDesc" )) wui.info( 'input policy name and description success' , True ) wui.click(monitor_cfg.Next_button) wui.info( 'create network policy success', True ) # go to addtional setting to check kddr default status of the created network policy wui.click(DeviceDataCollection.additional_setting_button) try: wui.wait_until_element_displayed(DeviceDataCollection.ntp_elements) wui.info( 'go to additional settings page success' , True ) except Exception, e: wui.error( 'go to additional settings page failed' , True ) #check the sections of data collection displayed wui.click(DeviceDataCollection.data_collection_btn) #wui.wait_until_element_displayed(DeviceDataCollection.application_identify_switch) time.sleep(5) #change the application_identify switch as off wui.wait_until_element_displayed(DeviceDataCollection.get('application_identify_xpath')) wui.info( 'application visibility and control section displayed' , True ) wui.check(DeviceDataCollection.get('application_identify_xpath')) time.sleep(2) wui.info('turn off switch for application identification success!', True) #change the section of statistic collection settings wui.wait_until_element_displayed(DeviceDataCollection.get('statistic_collection_xpath')) wui.info( 'statistic collection section displayed' , True ) wui.check(DeviceDataCollection.get('statistic_collection_xpath')) time.sleep(2) wui.info('turn off switch for statistic collection success!', True) #change the section of kddr setting wui.move_scroll_bottom() wui.wait_until_element_displayed(DeviceDataCollection.get('kddr_name')) wui.wait_until_element_displayed(DeviceDataCollection.get('kddr_xpath')) #wui.check(DeviceDataCollection.get('kddr_xpath')) wui.click(DeviceDataCollection.get('kddr_xpath')) time.sleep(2) wui.info('turn on switch for kddr success', True) #click save button to save the configuration wui.click(DeviceDataCollection.data_collection_save_btn) wui.wait_until_element_displayed(DeviceDataCollection.data_collection_save_info) wui.info('the device data collection can be saved successfully', 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 )
def firewall_rule_create(): wui = WebUI() config = Configuration(wui.d("visit.url"), wui.d("visit.title")) if wui.session_id: config.to_page_before_deployed_ssid() # input ssid name ssidname=wui.d("ssid.name") wui.move_scroll_top() config.input_ssid_name(ssidname, ssidname) config.ssid_usage_settings('CUSTOM') config.set_access_security('open') config.wait_deploy_element(2) config.to_customize_user_profile_page() wui.move_scroll_by_element(FireWall.get('user_profile_tabs')) wui.info('move to user-profile tabs successfully!', True) wui.click(FireWall.get('security_tab_btn')) wui.info('go to security tab successfully', True) wui.info('try to turn on the switch to enable firewall', True) wui.check(FireWall.get('firewall_switch')) wui.move_scroll_bottom() #click dropdown box for firewall rules wui.click(FireWall.get('bound_traffic_dropdown_btn')) wui.info('click the dropdown box button successfully', True) wui.wait_until_element_displayed(FireWall.get('inbound_traffic_element')) wui.wait_until_element_displayed(FireWall.get('outbound_traffic_element')) wui.info('can display the inbound/outbound elements successfully', True) #select outbound traffic wui.click(FireWall.get('outbound_traffic_element')) outbound_traffic_element = "Outbound Traffic" selected_bound_traffic_element = wui.find_element(FireWall.get('bound_traffic_selected')).text if outbound_traffic_element == selected_bound_traffic_element: wui.info('selected the outbound element successfully', True) else: wui.error('failed selected the bound element', True) #config firewall rules default action wui.wait_until_element_displayed(FireWall.get('firwall_defaction_area')) wui.info('display firewall rules default action area sucessfully!', True) #select the firewall rules default actions is permit wui.info('Try to click the dropdown box...', True) wui.click(FireWall.get('firewall_defaction_dropdown_btn')) wui.wait_until_element_displayed(FireWall.get('firewall_defaction_deny_element')) wui.wait_until_element_displayed(FireWall.get('firewall_defaction_permit_element')) wui.info('Click the dropdown box success.....', True) wui.click(FireWall.get('firewall_defaction_permit_element')) wui.info('Success to select action Permit for firewall rules!', True) #add a new ip policy rules wui.click(FireWall.get('firewall_new_btn')) wui.wait_until_element_displayed(FireWall.get('new_firewall_page_title')) wui.info('go to new firewall page success', True) config.wait_deploy_element(1) config.user_profile_srcurce_ip(wui.d("userprofile.src_hostname"), wui.d("userprofile.src_hostip")) wui.info('selected the srcurce ip address successfully', True) config.user_profile_destination_ip(wui.d("userprofile.des_hostname"), wui.d("userprofile.des_hostip")) wui.info('selected the destination ip address successfully', True) config.user_profile_select_net_service() wui.info('handle to select service successfully', True) #config the rule action: wui.info('try to config the rule action as Deny', True) wui.click(FireWall.get('new_rule_action_btn')) wui.wait_until_element_displayed(FireWall.get('new_rule_action_nat')) wui.info('click the action dropdown box successfully', True) wui.info('try to select the deny action....', True) wui.click(FireWall.get('new_rule_action_deny')) wui.info('success to select the deny action...', True) #config the rule logging action: wui.info('try to config logging action as drop', True) wui.click(FireWall.get('new_rule_log_btn')) wui.wait_until_element_displayed(FireWall.get('new_rule_log_off')) wui.info('click the logging dropdown box successfully', True) wui.info('try to select drop packets....', True) wui.click(FireWall.get('new_rule_log_drop')) wui.info('success to select the drop logging...', True) #save the new ip firewall rule wui.info('try to save the ip rule setting...', True) wui.click(FireWall.get('new_rule_dialog_save')) wui.info('save the ip firewall rule success...', True) #check if the added ip rule correct wui.info('try to move scroll to bottom....', True) wui.move_scroll_bottom() wui.info('check if the added ip rule correct!...', True) added_rule_record = (FireWall.get('added_rule_record')[0], FireWall.get('added_rule_record')[1] %(wui.d("userprofile.src_hostname"))) wui.wait_until_element_displayed(added_rule_record) wui.info('success to add ip firewall rule...', True) wui.info('Try to click save button to save the user-profile changing') wui.click(FireWall.get('user_profile_save_btn')) wui.info("Save user-profile success!", True) # save the ssid level configuration wui.click(FireWall.get('ssid_saved_btn')) wui.wait_until_element_displayed(FireWall.get('ssid_saved_success')) wui.info('Save ssid successfully', True)