def check_ap_firmware_ssh(request, testrun_session): try: ap_ssh = APNOS(APNOS_CREDENTIAL_DATA) active_fw = ap_ssh.get_active_firmware() except Exception as e: active_fw = False yield active_fw
def test_vif_config_cloud_nat(self, get_current_profile_cloud, instantiate_testrail, instantiate_project): ap_ssh = APNOS(APNOS_CREDENTIAL_DATA) get_current_profile_cloud.sort() PASS = False for i in range(0, 18): vif_config = list(ap_ssh.get_vif_config_ssids()) vif_config.sort() print(vif_config) print(get_current_profile_cloud) if get_current_profile_cloud == vif_config: PASS = True break time.sleep(10) if PASS: instantiate_testrail.update_testrail( case_id=TEST_CASES["nat_vifc"], run_id=instantiate_project, status_id=1, msg='Profiles Matched with vif config nat mode- passed') else: instantiate_testrail.update_testrail( case_id=TEST_CASES["nat_vifc"], run_id=instantiate_project, status_id=5, msg='Profiles does not with vif config nat mode - failed') assert PASS
def test_vif_state_cloud_vlan(self, instantiate_testrail, instantiate_project): ap_ssh = APNOS(APNOS_CREDENTIAL_DATA) PASS = False for i in range(0, 18): vif_state = list(ap_ssh.get_vif_state_ssids()) vif_state.sort() vif_config = list(ap_ssh.get_vif_config_ssids()) vif_config.sort() print(vif_config) print(vif_state) if vif_state == vif_config: PASS = True break time.sleep(10) if PASS: instantiate_testrail.update_testrail( case_id=TEST_CASES["vlan_vifs"], run_id=instantiate_project, status_id=1, msg='vif config mateches with vif state vlan mode - passed') else: instantiate_testrail.update_testrail( case_id=TEST_CASES["vlan_vifs"], run_id=instantiate_project, status_id=5, msg='vif config mateches with vif state vlan mode - failed') assert PASS
def __init__(self, host="", port=22, username="******", jumphost=True, password="******", tty="/dev/ttyAP1", serial=""): self.host = host self.port = port self.username = username self.password = password self.credentials = { 'jumphost': jumphost, 'ip': host, 'serial': serial, 'username': username, 'password': password, 'port': port, 'jumphost_tty': tty, } self.apnos = APNOS(credentials=self.credentials)
def get_ap_manager_status(): ap_ssh = APNOS(APNOS_CREDENTIAL_DATA) status = ap_ssh.get_manager_state() if "ACTIVE" not in status: time.sleep(30) ap_ssh = APNOS(APNOS_CREDENTIAL_DATA) status = ap_ssh.get_manager_state() yield status
class APTools: def __init__(self, host="", port=22, username="******", jumphost=True, password="******", tty="/dev/ttyAP1", serial=""): self.host = host self.port = port self.username = username self.password = password self.credentials = { 'jumphost': jumphost, 'ip': host, 'serial': serial, 'username': username, 'password': password, 'port': port, 'jumphost_tty': tty, } self.apnos = APNOS(credentials=self.credentials) def run_action(self, action, cmd, url): if action == "reboot": output, error = self.apnos.reboot() print(output, error) elif action == "run_cmd": output = self.apnos.run_generic_command(cmd=cmd) print(output) elif action == "verify": [input, output, error] = self.apnos.run_generic_command("cat /tmp/sysinfo/model;" "cat /etc/banner") print(output) #print(error) elif action == "upgrade": [input, output, error] = self.apnos.run_generic_command(f"cd /tmp ; curl -L {url} --output upgrade ; " "sysupgrade -n upgrade") print(input, output, error) time.sleep(300) elif action == "get_redirector": redirector = self.apnos.get_redirector() print(redirector) elif action == "set_redirector": [input, output, error] = self.apnos.run_generic_command(cmd=cmd) print(input, output, error)