print 'Arguments are not correct, Please provide as follows...\n' print 'python NFSAlerts.py conf.txt' logging.debug('----Ending script because of parameter mismatch----') exit() resultCollectionNew('\n"%s" testcase starts....' % testcase, ['', '']) print('----Start of testcase "%s"----' % testcase) conf = configFile(sys.argv) apikey = get_apikey(conf) stdurl = get_url(conf, apikey[1]) tsmIP = conf['ipVSM2'] startTime = ctime() logging.info('Listing Tsm for given TSMIP "%s" to get its ID', tsmIP) tsmList = listTSMWithIP_new(stdurl, tsmIP) if tsmList[0] == 'PASSED': logging.info('TSM present with the given IP "%s"', tsmIP) logging.info('Getting tsm_name, tsm_id, and dataset_id...') get_tsmInfo = get_tsm_info(tsmList[1]) tsmID = get_tsmInfo[0] tsmName = get_tsmInfo[1] datasetID = get_tsmInfo[2] logging.debug('tsm_name: %s, tsm_id: %s, dataset_id: %s',\ tsmName, tsmID, datasetID) else: endTime = ctime() print 'Not able to list Tsm "%s" due to: ' \ %(tsmIP) + tsmList[1] logAndresult(testcase, 'BLOCKED', tsmList[1], startTime, endTime)
tsm_dict = {'name': 'T200%s' %(x), 'accountid': account_id, 'poolid': \ pool_id, 'totaliops': '2000', 'quotasize': '1T', 'tntinterface': \ str(TSM_interface[x-1]), 'dnsserver': str(TSM_dnsserver[x-1]), \ 'ipaddress': str(TSM_IPs[x-1]), 'totalthroughput': '8000'} #calling create TSM method... result = create_tsm(tsm_dict, STDURL) if result[0] == 'FAILED': print 'Not able to create VSM/TSM %s' % (tsm_dict.get('name')) logging.error('Not able to create VSM/TSM %s', result[1]) logging.debug('mount/umount 100 NFS volumes test case is blocked...') is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) #------------------------------------------------------------------------------ ###Getting TSMs ID and dasetids------------------------------------------------ for x in range(1, 6): tsm = listTSMWithIP_new(STDURL, str(TSM_IPs[x - 1])) if tsm[0] == 'FAILED': print 'Not able to get TSM/VSM with IP: %s' % (TSM_IPs[x - 1]) logging.error('Not able to list TSM/VSM with IP: %s', TSM_IPs[x - 1]) logging.debug('mount/umount 100 NFS volumes test case is blocked...') is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) elif tsm[0] == 'BLOCKED': print 'There is no TSM/VSM with IP: %s' % (TSM_IPs[x - 1]) logging.error('There is no TSM/VSM with IP: %s', TSM_IPs[x - 1]) logging.debug('mount/umount 100 NFS volumes test case is blocked...') is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) else: tsm = tsm[1] tsm_id = tsm[0].get('id') datasetid = tsm[0].get('datasetid') if tsm_id is None or datasetid is None:
VSM_INTERFACE, 'dnsserver': VSM_DNS, \ 'ipaddress': VSM_IP, 'totalthroughput': 4*int(POOL_IOPS)} # Create VSM using the pool_id and the params received from conf file result = create_tsm( vsm_dict, STDURL) # This method is an aberration, elsewhere STDURL is 1st param if result[0] == 'FAILED': logging.error('Testcase %s is blocked due to' \ ': %s', tcName,result[1]) is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) # Get the info for the VSM created above (this list method response contains id, not create, so needed) vsm = listTSMWithIP_new(STDURL, VSM_IP) if vsm[0] == 'FAILED': logging.error('Testcase %s is blocked due to' \ ': %s', tcName,tsm[1]) is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) vsminfo = vsm[1] print vsminfo # Extract the vsm_id & vsm_dataset_id from info obtained above vsm_id = vsminfo[0].get('id') vsm_dataset_id = vsminfo[0].get('datasetid') # Provide variables for Volume1 & Volume2 creation (from conf & hardcode) in dict format vol1_dict = {'name': VOL1_NAME, 'quotasize': '500G', 'tsmid': vsm_id, 'iops': VOL1_IOPS, \
return result[1] result = ['PASSED', ""] return result def umountLogout(): unmountISCSI = umountVolume(volume1) if "FAILED" in unmountISCSI: result = ['FAILED', unmountISCSI] return result[1] logout = iscsi_login_logout(iqnName, tsmIP, 'logout') result = ['PASSED', ''] return result TSM = listTSMWithIP_new(stdurl, tsmip) if 'PASSED' in TSM: logging.info('TSM present with the given IP "%s"', tsmip) pass else: endTime = ctime() print 'Not able to list TSMs due to: ' + TSM[1] logging.debug('ISCSI login/logout alerts(devd logs), '\ 'testcase is Blocked due to %s', TSM[1]) logging.debug( '-------Ending script because this testcase is blocked------') resultCollection('ISCSI login/logout alerts(devd logs), '\ 'testcase is', ['BLOCKED',' '], startTime, endTime) exit() logging.info('Getting tsm_name, tsm_id, and dataset_id...')
else: print 'Volume \"%s\" is not mounted' % (volume['name']) return ['PASSED', 'Volume is not mounted'] ###---------------------------------------------------------------------------- startTime = ctime() infile = '/etc/default/useradd' HOME = getoutput('cat /etc/default/useradd | grep HOME | cut -d "=" -f 2') HOME = HOME[0].rstrip('\n') usr1 = 'user1' pwd = 'test123' usr2 = 'user2' list_tsm = listTSMWithIP_new(stdurl, tsm_ip) if list_tsm[0] == 'PASSED': logging.info('Tsm present with the given IP "%s"', tsm_ip) else: endTime = ctime() print 'Not able to list list_tsms due to: ' + list_tsm[1] logAndresult(testcase, 'BLOCKED', list_tsm[1], startTime, endTime) logging.info('Getting tsm_name, tsm_id, and dataset_id...') get_tsmInfo = get_tsm_info(list_tsm[1]) tsm_id = get_tsmInfo[0] tsm_name = get_tsmInfo[1] dataset_id = get_tsmInfo[2] logging.debug('tsm_name: %s, tsm_id: %s, dataset_id: %s',\ tsm_name, tsm_id, dataset_id)
print "python nfsSoftmount.py conf.txt soft/hard" logging.debug("----Ending script because of parameter mismatch----\n") exit() resultCollectionNew('\n"%s" testcase starts....' % testcase, ['', '']) print('----Start of testcase "%s"----' % testcase) config = configFile(sys.argv) apikey = get_apikey(config) stdurl = get_url(config, apikey[1]) prtcl = sys.argv[2] tsm_ip = config['ipVSM1'] startTime = ctime() logging.info('Listing Tsm for given TSMIP "%s" to get its ID', tsm_ip) tsm_list = listTSMWithIP_new(stdurl, tsm_ip) if tsm_list[0] == 'PASSED': logging.info('TSM present with the given IP "%s"', tsm_ip) else: endTime = ctime() print 'Not able to list TSMs due to: ' + tsm_list[1] logAndresult(testcase, 'BLOCKED', tsm_list[1], startTime, endTime) logging.info('Getting tsm_name, tsm_id, and dataset_id...') #get_tsmInfo = get_tsm_info(list_tsm[1]) -- ERROR get_tsmInfo = get_tsm_info(tsm_list[1]) tsm_id, tsm_name, dataset_id = get_tsmInfo[0], get_tsmInfo[1], get_tsmInfo[2] logging.debug('tsm_name: %s, tsm_id: %s, dataset_id: %s',\ tsm_name, tsm_id, dataset_id) volume1 = {'name': 'NFS%sPrtcl'%prtcl, 'tsmid': tsm_id, \