def tsm_creation_flow(stdurl, poolName, acctName, tsm_params): #pool details list_pool = listPool(stdurl) if list_pool[0] == 'FAILED': return ['FAILED', list_pool[1]] pool_info = get_pool_info(list_pool[1], poolName) if pool_info[0] == 'FAILED': return ['FAILED', pool_info[1]] pool_id = pool_info[1] logging.debug('Pool id of pool "%s" is: %s', poolName, pool_id) #account details account_creation = create_account(acctName, stdurl) if account_creation[0] == 'FAILED' and 'already exists' in str( account_creation[1]): logging.debug('Account already exist, taking its details..') elif account_creation[0] == 'FAILED': return ['FAILED', account_creation[1]] logging.debug('"%s" Account created successfully', acctName) list_acct = listAccount_new(stdurl) if list_acct[0] == 'FAILED': return ['FAILED', list_acct[1]] get_accInfo = get_account_info(list_acct[1], acctName) if get_accInfo[0] == 'FAILED': return ['FAILED', get_accInfo[1]] acct_id = get_accInfo[1] logging.debug('Account Id of account "%s" is: %s', acctName, acct_id) #tsm details req_ids = {'poolid': pool_id, 'accountid': acct_id} final_tsm_params = dict(tsm_params.items() + req_ids.items()) logging.debug('final_tsm_params : %s', final_tsm_params) tsm_creation = create_tsm(final_tsm_params, stdurl) if tsm_creation[0] == 'FAILED': return ['FAILED', tsm_creation[1]] return ['PASSED', 'Tsm "%s" created successfully' % (tsm_params['name'])]
' : %s', tcName, pool_creation[1]) is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) pool_result = listPool(STDURL) if pool_result[0] == 'FAILED': print 'Not able to get Pools...' logging.error('mount/umount 100 NFS volumes test case is blocked...') is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) elif pool_result[0] == 'BLOCKED': print 'There is no pool...' logging.debug('mount/umount 100 NFS volumes test case is') is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) else: pools = pool_result[1] pool_info = get_pool_info(pools, pool_name) if pool_info[0] == 'FAILED': print 'Not able to get pool ID...' logging.error('Not able to get pool ID, Error: %s', pool_info[1]) is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) pool_id = pool_info[1] print pool_id #------------------------------------------------------------------------------ ###---getiing account id------------------------------------------------------- account_id = get_account_id(STDURL, account_name) if account_id[0] == 'PASSED': account_id = account_id[1] else: print 'Not able to get account id...' logging.error('mount/umount 100 NFS volumes test case is blocked, '\
' : %s', tcName,pool_creation[1]) is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) # Obtain the Pool list for before extracting the name pool_list = listPool(STDURL) if pool_list[0] == 'FAILED': logging.error('Testcase %s is blocked due to' \ ': %s',tcName, pool_list[1]) is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) pool_list = pool_list[1] # Get the pool_info for the desired from the list obtained above #pool_info = get_pool_info(pool_list, POOL_NAME) pool_info = get_pool_info(pool_list, None) if pool_info[0] == 'FAILED': logging.error('Testcase %s is blocked due to' \ ' : %s', tcName, pool_info[1]) # Extract the pool_id from the info obtained for said pool above pool_id = pool_info[ 1] # Note that in get_pool_info return value, pool_info[1] itself is ID # Get account ID for VSM creation account_id = get_account_id( STDURL, None) # 2nd param is acc_name, if None, taken as 1st acc if account_id[0] == 'FAILED': logging.error('Testcase %s is blocked due to' \
pool_creation = create_pool(pool_params, STDURL) if pool_creation[0] == 'FAILED': logging.error('Testcase %s is blocked due to' \ ' : %s', tcName, pool_creation[1]) is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) # Obtain the Pool list for before extracting the name pool_list = listPool(STDURL) if pool_list[0] == 'FAILED': logging.error('Testcase %s is blocked due to' \ ': %s', tcName, pool_list[1]) is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) pool_list = pool_list[1] # Get the pool_info for the desired from the list obtained above pool_info = get_pool_info(pool_list, POOL_NAME) if pool_info[0] == 'FAILED': logging.error('Testcase %s is blocked due to' \ ' : %s', tcName, pool_info[1]) # Extract the pool_id from the info obtained for said pool above pool_id = pool_info[ 1] # Note that in get_pool_info return value, pool_info[1] itself is ID # Get account ID for VSM creation account_id = get_account_id( STDURL, None) # 2nd param is acc_name, if None, taken as 1st acc if account_id[0] == 'FAILED': logging.error('Testcase %s is blocked due to' \
STDURL = get_url(conf, APIKEY) ###---getting pool id---------------------------------------------------------- pool_result = listPool(STDURL) if pool_result[0] == 'FAILED': print 'Not able to get Pools...' logging.error('create pool, create vsms for regression test is blocked...') is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) elif pool_result[0] == 'BLOCKED': print 'There is no pool...' logging.debug('create pool, create vsms for regression test is') is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) else: pools = pool_result[1] pool_info = get_pool_info(pools, POOL_NAME) if pool_info[0] == 'FAILED': print 'Not able to get pool ID...' logging.error('Not able to get pool ID, Error: %s', pool_info[1]) is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) pool_id = pool_info[1] print pool_id #------------------------------------------------------------------------------ ###---getiing account id------------------------------------------------------- account_id = get_account_id(STDURL, account_name) if account_id[0] == 'PASSED': account_id = account_id[1] else: print 'Not able to get account id...' logging.error('create pool, create vsms for regression test is blocked, '\
' : %s', tcName, pool_creation[1]) is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) # Obtain the Pool list before extracting the name pool_list = listPool(STDURL) if pool_list[0] == 'FAILED': logging.error('Testcase %s is blocked due to' \ ': %s', tcName, pool_list[1]) is_blocked(startTime, FOOTER_MSG, BLOCKED_MSG) pool_list = pool_list[1] # Get the pool_info for the desired from the list obtained above #pool_info = get_pool_info(pool_list, POOL_NAME) pool_info = get_pool_info( pool_list, None) #Upon none, func Will take existing single pool if pool_info[0] == 'FAILED': logging.error('Testcase %s is blocked due to' \ ' : %s', tcName, pool_info[1]) # Extract the pool_id from the info obtained for said pool above pool_id = pool_info[ 1] # Note that in get_pool_info return value, pool_info[1] itself is ID # Get account ID for VSM creation account_id = get_account_id( STDURL, None) # 2nd param is acc_name, if None, taken as 1st existing acc if account_id[0] == 'FAILED': logging.error('Testcase %s is blocked due to' \