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_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)
def file_compare(file1, file2, state): logging.info('Comparing Iops result files...') cmp_output = executeCmdNegative('diff %s %s' %(file1, file2)) logging.debug('compared result is %s', (cmp_output)) endTime = ctime() if cmp_output[0] == 'FAILED': msg = 'IOPs are not running %s adding clients to exports' %state logAndresult(testcase, 'FAILED', msg, startTime, endTime) elif cmp_output[0] == 'PASSED': msg = 'IOPs are running fine %s adding clients to exports' %(state) logging.debug('%s', msg) else: logging.error('Failed to compare files having IOPS values') print "problem in comparing files"
def file_compare(firstFile, secondFile, prptName): logging.info('Comparing QOS result files...') qos_output = executeCmdNegative('diff %s %s' % (firstFile, secondFile)) logging.debug('compared result is %s', (qos_output)) if qos_output[0] == 'FAILED': msg = 'Qos values are same after updating "%s"' % prptName endTime = ctime() logAndresult(testcase, 'FAILED', msg, startTime, endTime) elif qos_output[0] == 'PASSED': msg = 'Qos values are different after updating "%s"' % prptName logging.debug('%s', msg) else: logging.error('Failed to compare files having qos values') print "problem in comparing files"
querycommand = 'command=deleteSnapshot&id=%s&name=%s' %(tsm_dataset_id, Name) resp_tsm_delete_snp = sendrequest(stdurl, querycommand) filesave("logs/delete_tsm_snapshot.txt", "w",resp_tsm_delete_snp) tsmdelete = json.loads(resp_tsm_delete_snp.text) if 'errortext' in str(tsmdelete): endTime = ctime() errorstatus = str(tsmdelete['deleteSnapshotResponse']['errortext']) #testout = string.find(errorstatus, sub[, 'has a'[,'clone']]) #print testout resultCollection("Result for snapshot \"%s\" deletion on TSM %s is: " %(Name, config['tsmName%d' %(x)]), ['FAILED', errorstatus], startTime, endTime) else: getControllerInfo(IP, passwd, 'zfs list -t snapshot | grep %s' %(Name), "tsm_snapshot_result.txt") ## Verifying for cifs snapshot deletion for p in range(1, int(config['Number_of_CIFSVolumes'])+1): cifsresult = executeCmdNegative('cat tsm_snapshot_result.txt | grep %s@%s > tsm_snapshot_result2.txt' %(config['volCifsDatasetname%d' %(p)], Name)) if cifsresult[0] == 'FAILED': tsmFlag = 0 endTime = ctime() resultCollection("Result for snapshot \"%s\" deletion on volume %s is: " %(Name, config['volCifsDatasetname%d' %(p)]), cifsresult, startTime, endTime) ## Verifying for nfs snapshot deletion for q in range(1, int(config['Number_of_NFSVolumes'])+1): nfsresult = executeCmdNegative('cat tsm_snapshot_result.txt | grep %s@%s > tsm_snapshot_result2.txt' %(config['volDatasetname%d' %(q)], Name)) if nfsresult[0] == 'FAILED': tsmFlag = 0 endTime = ctime() resultCollection("Result for snapshot \"%s\" deletion on volume %s is: " %(Name, config['volDatasetname%d' %(q)]), nfsresult, startTime, endTime) ## Verifying for iscsi snapshot deletion for r in range(1, int(config['Number_of_ISCSIVolumes'])+1):
% (config['volCifsMountpoint%d' % (x)], file1, file1)) chksumresult = executeCmd( 'diff mount/%s_md5sum mount/%s_md5sum_mount' % (file1, file1)) endTime = ctime() resultCollection( 'md5sum result of file \'%s\' on volume %s is :' % (file1, config['volCifsDatasetname%d' % (x)]), chksumresult, startTime, endTime) # The same file executionRevertSnapshot.py will be used for "Data check" in Cloned dataset # So there is no need to check for second file that's why file2_check is there ### file2 should not be present in mounted directory if file2_check: filenotpresent = executeCmdNegative( 'ls mount/%s | grep %s' % (config['volCifsMountpoint%d' % (x)], file2)) endTime = ctime() resultCollection( 'Result for file \'%s\' should not exit is: ' % (file2), filenotpresent, startTime, endTime) executeCmd('umount mount/%s' % (config['volCifsMountpoint%d' % (x)])) else: endTime = ctime() resultCollection( "Mount of CIFS Volume %s" % (config['volCifsDatasetname%d' % (x)]), output, startTime, endTime) ### NFS
(filename, filename)) endTime = ctime() resultCollection( "Checksum result on NFS Volume %s is:" % (config['volDatasetname%d' % (x)]), diffoutput, startTime, endTime) executeCmd('umount %s:/%s' % (config['volIPAddress%d' % (x)], config['volMountpoint%d' % (x)])) ### delete if delete: # print 'Inside delete' out = executeCmd('rm mount/%s/%s' % (config['volMountpoint%d' % (x)], filename)) out2 = executeCmdNegative('ls mount/%s | grep %s' % (config['volMountpoint%d' % (x)], filename)) endTime = ctime() resultCollection( "Delete file \"%s\" operation on volume %s is:" % (filename, config['volDatasetname%d' % (x)]), out2, startTime, endTime) executeCmd('umount %s:/%s' % (config['volIPAddress%d' % (x)], config['volMountpoint%d' % (x)])) else: endTime = ctime() print "Mount failed for volume %s" % (config['volDatasetname%d' % (x)]) resultCollection( "Further Execution of TCs Skipped on NFS Volume %s" %
add_auth_group = assign_iniator_gp_to_LUN(STDURL, vol_id, account_id, 'None') verify_add_auth_gp(add_auth_group, 'None') result = revert_snapshot(STDURL, vol_id, snp_name) verify_revert_snapshot(result) time.sleep(5) logging.debug('setting iscsi initiator group to All...') add_auth_group = assign_iniator_gp_to_LUN(STDURL, vol_id, account_id, 'ALL') login_result = iscsi_login_logout(iqn, VSM_IP, 'login') verify_iscsi_operation(login_result, volumeDict['name'], 'login') time.sleep(3) result = getDiskAllocatedToISCSI(VSM_IP, mnt_point) iscsi_device = verify_getDiskAllocatedToISCSI(result, mnt_point) mount_result = mount_iscsi(iscsi_device, volumeDict['name']) verify_mount(mount_result) ls1 = executeCmd('ls %s/%s' %(mount_dir, FILE_TO_COPY)) ls2 = executeCmdNegative('ls %s/%s' %(mount_dir, 'after_create_snp_dir')) mkdir1 = executeCmd('mkdir -p %s/after_revert_snp_dir' %(mount_dir)) if ls1[0] == 'FAILED' or ls2[0] == 'FAILED' or mkdir1[0] == 'FAILED': msg = 'snapshot functionality is not working...' snapshot_conclusion('FAILED', ls1[0], ls2[0], mkdir1[0], msg) else: msg = 'snapshot functionality on iSCSI LUN is working fine...' snapshot_conclusion('PASSED', ls1[0], ls2[0], mkdir1[0], msg) logging.debug('snapshot execution done: going to umount, logged out, set '\ 'initiator group to None and delete the iSCSI LUN') umount_result = executeCmd('umount /dev/%s1' %(iscsi_device)) if umount_result[0] == 'FAILED': logging.error('Not able to umount /dev/%s1, still go ahead and logout '\ 'the iSCSI LUN, since test case is complete', iscsi_device) else: logging.debug('LUN /dev/%s1 umounted successfully', iscsi_device)
['PASSED',''], startTime, endTime) else: logging.debug('IOPs value is not updated') endTime = ctime() resultCollection('updating QOS property is failed in ISCSI',\ ['FAILED',''], startTime, endTime) logging.info('verifying the Iops in volume again ') cmd = 'reng stats access dataset %s qos | head -n 4 ; sleep 10 ;\ 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_res2 = getControllerInfo(node_ip, passwd, cmd, 'updiopsoutput.txt') print iops_res2 logging.debug('iops result is %s', (iops_res)) logging.info('comparing the both iops result') io_output = executeCmdNegative('diff iopsoutput.txt updiopsoutput.txt') logging.debug('compared result is %s', (io_output)) if io_output[0] == 'FAILED': msg = "Iops are not running correct" logging.debug('Compared result: %s', msg) endTime = ctime() resultCollection('Iops value are same after updating the value in ISCSI', \ ['FAILED',''], startTime, endTime) print msg elif io_output[0] == 'PASSED': msg = "Iops are running correct" logging.debug('Compared result: %s', msg) print msg endTime = ctime() resultCollection('Iops value are different after updating the value in ISCSI', \ ['PASSED',''], startTime, endTime)
logging.debug('Synchronization condition is not updated') endTime = ctime() resultCollection('updating Synchronization QOS property is failed in ISCSI', \ ['FAILED',''], startTime, endTime) logging.info('verifying the I/Os in volume again ') time.sleep(10) cmd = 'reng stats access dataset %s qos | head -n 4 ; sleep 20 ;\ echo "-----------------" ; reng stats access dataset %s qos |\ head -n 4' % (io_datapath, io_datapath) logging.debug('executing the command %s in controller', str(cmd)) io_res2 = getControllerInfo(node_ip, passwd, cmd, 'updiooutput.txt') print io_res2 logging.debug('iops result is %s', (io_res2)) logging.info('comparing the both I/Os result') io_output = executeCmdNegative('diff iooutput.txt updiooutput.txt') logging.debug('compared result is %s', (io_output)) if io_output[0] == 'FAILED': msg = "Iops are not running correct" logging.debug('Compared result: %s', msg) endTime = ctime() resultCollection('Iops value are same after updating the value in ISCSI', \ ['FAILED',''], startTime, endTime) print msg elif io_output[0] == 'PASSED': msg = "Iops are running correct" logging.debug('Compared result: %s', msg) print msg endTime = ctime() resultCollection('Iops value are different after updating the value in ISCSI',\ ['PASSED',''], startTime, endTime)