def test_real_ap_registration(self):

        ssh = paramiko.SSHClient()
        ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        ssh.connect(properties.real_ap, username='******', password='******')
        apmanager_path = ("%s%s" % (properties.apmanager,
                                    properties.xmppdomain))
        print "Rebooting AP."
        reboot_command = "reboot"
        ssh.exec_command(reboot_command)
        time.sleep(180)
        ssh = paramiko.SSHClient()
        ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        ssh.connect(properties.real_ap, username='******', password='******')
        services_stop = "monit stop xmpp_client"
        xmpp_client_filepath = os.path.join(properties.xmpp_client_path,
                                            "xmpp_client.conf")
        run_xmpp_client = "monit start xmpp_client"
        print ("Registering AP %s with apmanager %s" % (properties.real_ap, properties.apmanager))
        command = ("cd %s;%s;sed -i 's/XMPP_REGISTER=.*/XMPP_REGISTER='%s'/g' %s;%s" % (properties.xmpp_client_path, 
                    services_stop, apmanager_path, xmpp_client_filepath, run_xmpp_client))
        ssh.exec_command(command + ' > /dev/null 2>&1 &')
        time.sleep(60)
        # Verify if the ap entry is made in the database
        db.search_ap_in_new_ap_collection(properties.apjid)
    def _1_real_ap_registration(self):
        apmanager = properties.apmanager_jid
        utils.add_xmpp_jid(apmanager)
 
        apmanager_path = ("%s%s" % (properties.apmanager_jid,
                                    properties.xmppdomain))
        #Get the ap's jid
        ap_jid = utils.get_ap_jid(properties.real_ap_ip)
        print "AP jid return value is: " + ap_jid
        ap_jid = ap_jid.strip()
 
        utils.add_xmpp_jid(ap_jid)
 
        ssh = paramiko.SSHClient()
        ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        ssh.connect(properties.real_ap_ip, username='******',
                    password='******')
        xmpp_client_filepath = os.path.join(properties.xmpp_client_path,
                                            "xmpp_client.conf")
        print ("Configuring AP %s with apmanager %s" % (properties.real_ap_ip,
                                                    properties.apmanager_jid))
        command = ("cd %s;sed -i 's/XMPP_REGISTER=.*/XMPP_REGISTER='%s'/g' %s"
                   % (properties.xmpp_client_path,
                    apmanager_path, xmpp_client_filepath))
        ssh.exec_command(command + ' > /dev/null 2>&1 &')
        time.sleep(20)
 
        #Reboot the AP after changing xmpp_client
        ssh = paramiko.SSHClient()
        ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        ssh.connect(properties.real_ap_ip, username='******',
                    password='******')
        print "Rebooting AP."
        reboot_command = "reboot"
        ssh.exec_command(reboot_command)
        time.sleep(180)
        # Verify if the ap entry is made in the database
        db.search_ap_in_new_ap_collection(ap_jid)
         
        #Enabling wifi on both radios
        ssh = paramiko.SSHClient()
        ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        ssh.connect(properties.real_ap_ip, username='******', password='******')
        wifi_cmd_0 = 'uci set wireless.@wifi-device[0].disabled=0'                            
        wifi_cmd_1 = 'uci set wireless.@wifi-device[1].disabled=0'
        wifi_commit_cmd = 'uci commit wireless'
        wifi_cmd = 'wifi'
        print "Enabling wifi radios"
        ssh.exec_command(wifi_cmd_0)
        ssh.exec_command(wifi_cmd_1)
        ssh.exec_command(wifi_commit_cmd)
        ssh.exec_command(wifi_cmd)
        time.sleep(10)
 def assign_config_to_ap(self):
     ap_jid = properties.apjid
     # Verify if the ap entry is made in new_ap collection.
     ap_serial_number = db.search_ap_in_new_ap_collection(ap_jid)
     #Onboarding AP.
     utils.ap_onboarding(ap_jid, ap_serial_number)
     #Searching AP in ap collection after onboarding.
     ap_id = db.search_ap_in_ap_collection(ap_jid)
 def test_assign_config_to_ap(self):
     ap_jid = properties.apjid
     ap_serial_number = db.search_ap_in_new_ap_collection(ap_jid)
     print ap_serial_number   
     utils.ap_onboarding(ap_jid, ap_serial_number)
     ap_id = db.search_ap_in_ap_collection(ap_jid)
     config_id = config_utils.push_config_to_ap(ap_id, ap_jid)
     time.sleep(20)
     db.verify_ap_running_config_id(ap_jid, config_id)
Beispiel #5
0
    def delete_ap(self):
        columns = utils.get_var_details()
        driver = self.driver
 
        driver.get(self.base_url + "/home/login")
        driver.find_element_by_id("email").clear()
        driver.find_element_by_id("email").send_keys(columns['email'][0])
        driver.find_element_by_id("password").clear()
        driver.find_element_by_id("password").send_keys(columns['password'][0])
        driver.find_element_by_id("btnLogin").click()
        time.sleep(10)
        print "Clickin Customers dropdown"
        dropdown = driver.find_element_by_id("customerFilter")
        for option in dropdown.find_elements_by_tag_name("option"):
            if option.text == columns['var_business_name'][1]:
                option.click()
                time.sleep(5)
                break
            else:
                continue
        driver.find_element_by_id("menuAccessPoints").click()
        time.sleep(5)
         
        i = 0
        for option in driver.find_elements_by_css_selector("#ap_grid_table tbody tr"):
            client_name_id = "AP_Name_" + str(i)
            select_checkbox_id = "_" + str(i)
            if properties.ap_name == str(driver.find_element_by_css_selector("#" + client_name_id + " a").get_attribute('innerHTML')):
                print "AP Name = " + str(driver.find_element_by_css_selector('#' + client_name_id + ' a').get_attribute('innerHTML'))
                driver.find_element_by_css_selector("#" + select_checkbox_id + " div").click()
                time.sleep(5)
                driver.find_element_by_id("deleteApBtn").click()
                time.sleep(5)
                alert_text = driver.find_element_by_id("dialog-confirm").get_attribute("innerHTML")
                dialog_header = driver.find_element_by_id("ui-id-1").get_attribute("innerHTML").strip()
                self.assertEqual(dialog_header, "Delete the selected APs", "Delete AP Confirmation dialog not present!")
                driver.find_element_by_xpath("(//button[@type='button'])[1]").click()
                print "AP " + properties.ap_name + " deleted successfully!"
                 
                #Verify if AP was deleted from ap collection
                db.verify_delete_ap(properties.ap_name)
                time.sleep(130)
                 
                ap_jid = utils.get_ap_jid(properties.real_ap_ip)
                ap_jid = ap_jid.strip()
                #Verify if AP was added to new_ap collection
                db.search_ap_in_new_ap_collection(ap_jid)
                time.sleep(2)
                 
                #Verify if radios are disabled on the AP
                ssh = paramiko.SSHClient()
                ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
                ssh.connect(properties.real_ap_ip, username='******',
                    password='******')
                
                stdin, stdout, stderr = ssh.exec_command("uci show | grep disabled")
                data = stdout.readlines()
                for eachLine in data:
                    if "radio0" in eachLine:
                            radio_line = eachLine.split("\n")
                            radio_state = radio_line[0]
                            print "Actual Radio0 state is: " + radio_state
                            expected_radio_state = "wireless.radio" + "0" + ".disabled=1"
                            print "Expected radio state is: " + expected_radio_state 
                            self.assertEqual(radio_state.strip(), expected_radio_state, "After deleting AP Radio0 was not disabled")

                for eachLine in data:
                    if "radio1" in eachLine:
                            radio_line = eachLine.split("\n")
                            radio_state = radio_line[0]
                            print "Actual Radio1 state is:  " + radio_state
                            expected_radio_state = "wireless.radio" + "1" + ".disabled=1"
                            print "Expected radio state is: " + expected_radio_state
                            self.assertEqual(radio_state.strip(), expected_radio_state, "After deleting AP Radio1 was not disabled")
                break
            else:
                continue
            i = i+1