def verify_get_controller_info(get_info, startTime):
    if get_info[0] == 'PASSED':
        return
    ogging.error(
        'mount/umount 100 NFS volumes test case is blocked due to: %s',
        get_info[1])
    is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
Exemple #2
0
def controllerIP(tsms):
    if tsms[0] == 'PASSED':
        tsm = tsms[1]
        return tsm[0].get('controlleripaddress'), tsm[0].get('controllerName')
    logging.error('partial fail over test case(NFS) blocked '\
            'due to %s', tsms[1])
    is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
Exemple #3
0
def getTsmInfo(tsms):
    if tsms[0] == 'PASSED':
        tsm = tsms[1]
        return tsm[0].get('name'), tsm[0].get('id'), tsm[0].get('datasetid')
    logging.error('NFS Authorization (All, None, Netwok) test case blocked '\
            'due to %s', tsms[1])
    is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
def controllerIP(tsms):
    if tsms[0] == 'PASSED':
        tsm = tsms[1]
        return tsm[0].get('controlleripaddress'), tsm[0].get('controllerName')
    logging.error('ungracefull HA test case(iSCSI) blocked '\
            'due to %s', tsms[1])
    is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
def verify_iscsi_device(iscsi_device, iqn, VSM_IP):
    if iscsi_device[0] == 'PASSED':
        device = iscsi_device[1]
        return device
    logging.debug('executing iscsi logout, since not able to get iscsi device')
    result = iscsi_login_logout(iqn, VSM_IP, 'logout')
    is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
def getiSCSIDevice(volName, vsm_id, POOL_IOPS, vsm_dataset_id, STDURL):
    volumeDict = {'name': volName, 'tsmid': vsm_id, 'datasetid': \
            vsm_dataset_id, 'protocoltype': 'ISCSI', 'iops': POOL_IOPS, \
            'quotasize': '20G'}
    result = create_volume(volumeDict, STDURL)
    verify_create_volume(result)
    logging.info('listing volume...')
    volumes = listVolumeWithTSMId_new(STDURL, vsm_id)
    if volumes[0] == 'FAILED':
        logging.error('Testcase %s is blocked due to' \
                ': %s', tcName, volumes[1])
        is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
    volumes = volumes[1]
    vol_id, vol_iqn, account_id, mnt_point = get_vol_id(
        volumes, volumeDict['name'])
    logging.debug('volume_id: %s, aacount_id: %s, mountpoint: %s and vol_iqn: %s', \
            vol_id, account_id, mnt_point, vol_iqn)
    add_auth_group = assign_iniator_gp_to_LUN(STDURL, vol_id, account_id,
                                              'ALL')
    verify_add_auth_gp(add_auth_group, 'ALL')
    logging.debug('getting iqn for volume %s', volumeDict['name'])
    iqn = discover_iscsi_lun(VSM_IP, vol_iqn)
    iqn = verify_iqn(iqn)
    logging.debug('iqn for discovered iSCSI LUN... %s', iqn)
    login_result = iscsi_login_logout(iqn, VSM_IP, 'login')
    verify_iscsi_operation(login_result, volumeDict['name'], 'login')
    time.sleep(2)
    result = getDiskAllocatedToISCSI(VSM_IP, mnt_point)
    iscsiDevice = verify_getDiskAllocatedToISCSI(result, mnt_point)
    return iscsiDevice, vol_id, account_id, mnt_point, iqn
def verify_list_controller(list_cntrl, startTime):
    if list_cntrl[0] == 'PASSED':
        return list_cntrl[1]
    logging.error(
        'mount/umount 100 NFS volumes test case is blocked due to: %s',
        list_cntrl[1])
    is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
def verify_IOPS(NODE1_IP, PASSWD, iops_datapath):
    cmd = 'reng stats access dataset %s qos | head -n 4 ; sleep 2 ;\
            echo "-----------------"; reng stats access dataset %s qos |\
            head -n 4' % (iops_datapath, iops_datapath)
    logging.debug('executing the command %s in controller', str(cmd))
    iops_res = getControllerInfo(NODE1_IP, PASSWD, cmd, 'beforeHAIO1.txt')
    print iops_res
    logging.debug('iops result is %s', (iops_res))
    logging.debug('sleeping for 3 seconds before fatching new IOPS value...')
    time.sleep(3)
    logging.debug('executing the command %s in controller', str(cmd))
    iops_res = getControllerInfo(NODE1_IP, PASSWD, cmd, 'beforeHAIO2.txt')
    print iops_res
    logging.debug('iops result is %s', (iops_res))
    io_output = executeCmdNegative('diff beforeHAIO1.txt beforeHAIO2.txt')
    if io_output[0] == 'FAILED':
        msg = 'IOPS are not running, please make sure to run IOPS properly'
        logging.debug('Compared result: %s, Error: %s', io_output[0], msg)
        logging.debug('IOPS Error: Not going to reset the Node...')
        is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
    elif io_output[0] == 'PASSED':
        msg = "Iops are  running fine"
        logging.debug('Compared result: %s', msg)
        print msg
        return
    else:
        print "problem in comparing files"
        logging.error('problem in comparing files')
        is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
def verify_iscsi_operation(result, vol_name, action):
    if result[0] == 'PASSED':
        logging.debug('%s successfully for iSCSI LUN %s', action, vol_name)
        return
    logging.error('Testcase %s is blocked Not able to %s %s, Error: '\
            '%s', tcName, action, vol_name, str(result[1]))
    is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
Exemple #10
0
def verify_ddNFSclient(add_client_result, network, vol_name):
    if add_client_result[0] == 'PASSED':
        logging.debug('added clent <%s> to volume  %s successfully', \
                network, vol_name)
        return
    logging.error('NFS Authorization (All, None, Netwok) test case is blocked')
    is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
Exemple #11
0
def verify_IOPS_afterHA(NODE2_IP, PASSWD, iops_datapath):
    endTime = ctime()
    cmd = 'reng stats access dataset %s qos | head -n 4 ; sleep 2 ;\
            echo "-----------------"; reng stats access dataset %s qos |\
            head -n 4' % (iops_datapath, iops_datapath)
    logging.debug('executing the command %s in controller', str(cmd))
    iops_res = getControllerInfo(NODE2_IP, PASSWD, cmd, 'afterHAIO1.txt')
    print iops_res
    logging.debug('iops result is %s', (iops_res))
    logging.debug('sleeping for 3 seconds before fatching new IOPS value...')
    time.sleep(3)
    logging.debug('executing the command %s in controller', str(cmd))
    iops_res = getControllerInfo(NODE2_IP, PASSWD, cmd, 'afterHAIO2.txt')
    print iops_res
    logging.debug('iops result is %s', (iops_res))
    io_output = executeCmdNegative('diff afterHAIO1.txt afterHAIO2.txt')
    if io_output[0] == 'FAILED':
        msg = 'IOPS are not running after HA failover...'
        logging.debug('Compared result: %s, Error: %s', io_output[0], msg)
        logging.debug('IOPS Error: ungracefull HA test case(iSCSI) failed...')
        resultCollection('Ungracefull HA test case(iSCSI) failed', \
                ['FAILED', ''], startTime, endTime)
    elif io_output[0] == 'PASSED':
        msg = "IOPS are  running fine after ungracefull HA"
        logging.debug('Compared result: %s', msg)
        resultCollection('Ungracefull HA test case(iSCSI) passed', \
                ['PASSED', ''], startTime, endTime)
        print msg
    else:
        print "problem in comparing files"
        logging.error('problem in comparing files')
        is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
Exemple #12
0
def verify_list_volumes(volumes):
    if volumes[0] == 'PASSED':
        logging.debug('volumes listed successfullly')
        return volumes[1]
    logging.error('Not able to list volumes due to %s', volumes[1])
    logging.error('NFS Authorization (All, None, Netwok) test case is blocked')
    is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
Exemple #13
0
def get_node2_ip(NODE1_IP, stdurl):
    querycommand = 'command=listController'
    logging.debug('executing listController...')
    listController_resp = sendrequest(stdurl, querycommand)
    data = json.loads(listController_resp.text)
    if 'errorcode' in str(data):
        errormsg = str(data['listControllerResponse'].get('errortext'))
        logging.error('ungracefull HA test case(iSCSI) blocked '\
                'due to %s', errormsg)
        is_blocked(startTime, FOOTER_MSG, errormsg)
    controllers = data['listControllerResponse']['controller']
    has_second_node = False
    has_first_node = False
    NODE2_IP = None
    for controller in controllers:
        if controller['ipAddress'] == NODE1_IP:
            node1_clustername = controller['clustername']
            has_first_node = True
            if has_second_node:
                if node2_clustername == node1_clustername:
                    return NODE2_IP
            continue
        node2_clustername = controller['clustername']
        NODE2_IP = controller['ipAddress']
        has_second_node = True
        if has_first_node:
            if node1_clustername == node2_clustername:
                return NODE2_IP
        if NODE2_IP is None:
            logging.error('ungracefull HA test case(iSCSI) blocked '\
                    'due to %s', 'There is no second Node')
            is_blocked(startTime, FOOTER_MSG, 'There is no second Node')
        return NODE2_IP
Exemple #14
0
def getTsmInfo(tsms):
    if tsms[0] == 'PASSED':
        tsm = tsms[1]
        return tsm[0].get('name'), tsm[0].get('id'), tsm[0].get('datasetid'), \
                tsm[0].get('controllerid'), tsm[0].get('accountname'), \
                tsm[0].get('hapoolname')
    logging.error('ungracefull HA test case(iSCSI) blocked '\
            'due to %s', tsms[1])
    is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
Exemple #15
0
def verify_iscsi_operation(result, vol_name, action):
    if result[0] == 'PASSED':
        logging.debug('%s successfully for iSCSI LUN %s', action, vol_name)
        return
    if 'already exists' in str(result[1]):
        logging.debug('iscsi LUN %s is already logged in, lets go ahead and' \
                'get the iscsi device name', vol_name)
        return
    logging.error('ungracefull HA test case(iSCSI) is blocked Not able to %s '\
            '%s, Error: %s', action, vol_name, str(result[1]))
    is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
def update_volid_mntpoint(volumes):
    for volume in volumes:
        vol_id = volume.get('id')
        mntpoint = volume.get('mountpoint')
        if vol_id is not None and mntpoint is not None:
            VOLUME_IDs.append(vol_id)
            MNT_POINTS.append(mntpoint)
        else:
            print 'vol id or mountpoint is None...'
            logging.debug('vol id or mountpoint is None...')
            logging.debug('mount/umount 100 NFS volumes test case is blocked')
            is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
Exemple #17
0
def take_backup(fileName, backup_filename):
    #taking backup of '/etc/iscsi/iscsid.conf' file...
    backup_filename = 'backup_%s' % (fileName.split('/')[-1])
    cmd = 'yes | cp %s %s' % (fileName, backup_filename)
    take_backup = executeCmd(cmd)
    if take_backup[0] == 'PASSED':
        print 'backup has been taken successfully'
        logging.debug('Successfully taken bakup of iscsid.conf')
    else:
        print 'Not able to take backup'
        print take_backup[1]
        logging.error('iSCSI login with CHAP method test case is blocked Not '\
                'able to take backup of iscsid.conf, Error: %s', take_backup[1])
        is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
Exemple #18
0
def get_vol_id(volumes, vol_name):
    volid = None
    mntpoint = None
    for volume in volumes:
        if volume['name'] != vol_name:
            continue
        volid = volume.get('id')
        mntpoint = volume.get('mountpoint')
        break
    if volid is None or mntpoint is None:
        logging.error('NFS Authorization (All, None, Netwok) test case is blocked getting volid:'\
                '%s and mntpoint: %s', volid, mntpoint)
        is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
    return volid, mntpoint
Exemple #19
0
def get_vol_id(volumes, vol_name):
    volid = None
    voliqn = None
    accountid = None
    mntpoint = None
    for volume in volumes:
        if volume['name'] != vol_name:
            continue
        volid = volume.get('id')
        accountid = volume.get('accountid')
        mntpoint = volume.get('mountpoint')
        break
    if volid is None or accountid is None or mntpoint is None:
        logging.error('ungracefull HA test case(NFS) is blocked getting volid:'\
                '%s, accountid: %s, and mntpoint: %s', \
                volid, accountid, mntpoint)
        is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
    return volid, accountid, mntpoint
def get_vol_id(volumes, vol_name):
    volid = None
    voliqn = None
    accountid = None
    mntpoint = None
    for volume in volumes:
        if volume['name'] != vol_name:
            continue
        volid = volume.get('id')
        accountid = volume.get('accountid')
        voliqn = volume.get('iqnname')
        mntpoint = volume.get('mountpoint')
        break
    if volid is None or accountid is None or voliqn is None or mntpoint is None:
        logging.error('Testcase %s is blocked getting volid:%s, '\
                'accountid:%s, voliqn: %sand mntpoint: %s', tcName, volid, \
                accountid, voliqn, mntpoint)
        is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
    return volid, voliqn, accountid, mntpoint
Exemple #21
0
def verify_pool_import(poolName, NODE2_IP, PASSWD):

    logging.debug('pool import at peer Node would take some time, '\
            'sleeping for 25 seconds')
    time.sleep(25)

    logging.debug('executing zpool list at Node:%s', NODE2_IP)
    getControllerInfo(NODE2_IP, PASSWD, 'zpool list', 'listpool.txt')
    import_result = executeCmd('cat listpool.txt | grep %s' % (poolName))
    if import_result[0] == 'PASSED':
        logging.debug('pool %s imported successfully at peer Node:%s', \
                poolName, NODE2_IP)
        return

    logging.debug('pool is not imported till 25 seconds after reboot the Node')
    logging.debug('sleeping for another 10 seconds')
    time.sleep(10)

    logging.debug('executing zpool list at Node:%s', NODE2_IP)
    getControllerInfo(NODE2_IP, PASSWD, 'zpool list', 'listpool.txt')
    import_result = executeCmd('cat listpool.txt | grep %s' % (poolName))
    if import_result[0] == 'PASSED':
        logging.debug('pool %s imported successfully at peer Node:%s', \
                poolName, NODE2_IP)
        return

    logging.debug('pool is not imported till 35 seconds after reboot the Node')
    logging.debug('sleeping for another 10 seconds')
    time.sleep(10)

    logging.debug('executing zpool list at Node:%s', NODE2_IP)
    getControllerInfo(NODE2_IP, PASSWD, 'zpool list', 'listpool.txt')
    import_result = executeCmd('cat listpool.txt | grep %s' % (poolName))
    if import_result[0] == 'PASSED':
        logging.debug('pool %s imported successfully at peer Node:%s', \
                poolName, NODE2_IP)
        return

    logging.error('pool %s import failed at peer Node:%s', poolName, NODE2_IP)
    is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
Exemple #22
0
def verify_add_auth_gp(add_auth_group, auth_gp):
    if add_auth_group[0] == 'FAILED':
        logging.debug('ungracefull HA test case(iSCSI) is blocked Not able to '\
                'assign auth group %s to LUN', auth_gp)
        is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
    return
Exemple #23
0
def verify_mount(mount_result):
    if mount_result[0] == 'PASSED':
        return
    is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
Exemple #24
0
def verify_get_node_ip(result):
    if result[0] == 'PASSED':
        return result[1]
    is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
def verify_create_volume(result):
    if result[0] == 'PASSED':
        return
    logging.error('mount/umount 100 NFS volumes test case is blocked Volume '\
            'creation failed')
    is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
            is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)


for x in range(0, 5):
    #try:
    TSM_IPs[x] = conf['ipVSM%s' % (x + 1)]
    TSM_interface[x] = conf['interfaceVSM%s' % (x + 1)]
    TSM_dnsserver[x] = conf['dnsVSM%s' % (x + 1)]
    if TSM_IPs[x] == '' and TSM_interface[x] == '' and TSM_dnsserver[x] \
            == '':
        print 'Value for ipVSM/interfaceVSM/dnsVSM getting None'
        logging.debug('Value for key ipVSM/interfaceVSM/dnsVSM '\
                'is None, specify correct values in config file')
        logging.debug('mount/umount 100 NFS volumes test case '\
                'is blocked')
        is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
    logging.debug('Value foe key \'ipVSM%s\' is: %s', (x+1), \
            conf['ipVSM%s' %(x+1)])
    logging.debug('Value foe key \'interfaceVSM%s\' is: %s', (x+1), \
            conf['interfaceVSM%s' %(x+1)])
    logging.debug('Value foe key \'dnsVSM%s\' is: %s', (x+1), \
            conf['dnsVSM%s' %(x+1)])
    #except KeyError:
    #print 'There is KeyError in config file, specify correct keys'
    #logging.debug('mount/umount 100 NFS volumes test case is blocked...')
    #logging.error('There is KeyError in configuration file, specify as '\
    #        'follows... interfaceVSM, ipVSM, dnsVSM etc.')
    #is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)

APIKEY = get_apikey(conf)
APIKEY = APIKEY[1]
Exemple #27
0
def verify_create_volume(result):
    if result[0] == 'PASSED':
        return
    logging.error('Testcase %s is blocked due to' \
            ': %s', tcName, result[1])
    is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
Exemple #28
0
def verify_get_controller_info(get_info, startTime):
    if get_info[0] == 'PASSED':
        return
    logging.error('Testcase %s is blocked due to' \
            ': %s', tcName,get_info[1])
    is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
Exemple #29
0
def verify_list_controller(list_cntrl, startTime):
    if list_cntrl[0] == 'PASSED':
        return list_cntrl[1]
    logging.error('Testcase %s is blocked due to' \
            ': %s',tcName,list_cntrl[1])
    is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)
Exemple #30
0
def verify_execute_mkfs(result):
    if result[0] == 'PASSED':
        return
    is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG)