def test_change_firmware(): pwd = os.getcwd() ls = os.listdir(pwd) if 'FW_15.9.8.2_OR.bin' and 'FW_15.9.8.4_OR.bin' not in ls: return status = haap.Status(ip, t_port, passwd, ftp_port) fw_version = status.get_version() if fw_version == None: print("Can't get firmware version.") return elif fw_version == 'V15.9.8.4': haap.change_firmware(ip, 'FW_15.9.8.2_OR.bin') else: haap.change_firmware(ip, 'FW_15.9.8.4_OR.bin') time.sleep(60) try: status = haap.Status(ip, t_port, passwd, ftp_port) fw_version_new = status.get_version() except: fw_version_new = None if fw_version_new: if fw_version == 'V15.9.8.4': assert fw_version_new == 'V15.9.8.2' else: assert fw_version_new == 'V15.9.8.4' else: print("Can't get firmware version.")
def test__is_master(self): status = haap.Status(ip, t_port, passwd, ftp_port) assert status._is_master(None) == 0 engine1 = "Engine Status Serial # IP Addresses" engine2 = ">> 0 (M) Online 11340468 10.203.1.6 15.9.8.2 OR" assert status._is_master(engine1) == None assert status._is_master(engine2) == 1
def test_over_all(self): status = haap.Status(ip, t_port, passwd, ftp_port) assert status.over_all()[1] == 0 status.AHStatus = 1 assert status.over_all()[1] == '1' status._TN_Connect_Status = None assert status.over_all()[1] == '--'
def test_get_mirror_status(self): status = haap.Status(ip, t_port, passwd, ftp_port) status.dictInfo[ 'mirror'] = " 33281(0x8201) Operational 67108864 2044 (OK ) 2046 (OK )" assert status.get_mirror_status() == 0 status.dictInfo[ 'mirror'] = " 33281(0x8201) Operational 67108864 2044 (deg ) 2046 (OK )" assert status.get_mirror_status() == 1 status.dictInfo['mirror'] = None assert status.get_mirror_status() == None
def test_fw(): status = haap.Status(engineip, t_port, passwd, ftp_port) fw_version = status.get_version() assert fw_version != None pwd = os.getcwd() ls = os.listdir(pwd) if 'FW_15.9.8.2_OR.bin' and 'FW_15.9.8.4_OR.bin' in ls: if fw_version == 'V15.9.8.4': output('fw %s FW_15.9.8.2_OR.bin' % engineip) else: output('fw %s FW_15.9.8.4_OR.bin' % engineip) time.sleep(60) try: status = haap.Status(engineip, t_port, passwd, ftp_port) fw_version_new = status.get_version() except: fw_version_new = None if fw_version_new: if fw_version == 'V15.9.8.4': assert fw_version_new == 'V15.9.8.2' else: assert fw_version_new == 'V15.9.8.4' else: pass
def test_print_status_in_line(): lStatus = haap.Status(ip, t_port, passwd, ftp_port).status_to_show() assert haap._print_status_in_line(lStatus) == None
def test_get_version(self): status = haap.Status(ip, t_port, passwd, ftp_port) status.dictInfo['vpd'] = "Firmware V15.9.8.2 HA-AP" assert status.get_version() == 'V15.9.8.2' status.dictInfo['vpd'] = None assert status.get_version() == None
def test_cluster_status(self): status = haap.Status(ip, t_port, passwd, ftp_port) status.dictInfo['engine'] = '>> 0 offline' assert status.cluster_status() == 1 status.dictInfo['engine'] = '>> 0 online' assert status.cluster_status() == 0
def setup_class(self): self.status = haap.Status(ip, t_port, passwd, ftp_port)
def test_info(): lStatus = haap.Status(ip, t_port, passwd, ftp_port) assert haap.info('engine0', lStatus)
def test_origin(): lStatus = haap.Status(ip, t_port, passwd, ftp_port) assert haap.origin('engine0', lStatus)