for i in range(6, 11): mxpop2 = pop_operations.POP_Ops(mx1_popserv_host1_ip, mx1_popserv_host1_pop3Port) try: mxpop2.pop_apop('u' + str(i) + '@' + mx2_default_domain, 'password') # using wrong passwd :password here except: basic_class.mylogger_record.error('pop alias login fail') mxpop2.pop_quit() #step 2 basic_class.mylogger_record.info('fetching popserv.stat ...') time.sleep(50) basic_class.mylogger_record.info( 'step2:check and analyze popserv.stat file ...') flag, popserv_stat_content1 = remote_operations.remote_operation( mx1_host1_ip, 'su - {0} -c "cat log/popserv.stat|grep StatPopPassCommand"'.format( mx_account), root_account, root_passwd, 0) result_lists1 = stat_statistics.stat_statistic(popserv_stat_content1, '[200]', 'StatPopPassCommand', 10) flag, popserv_stat_content2 = remote_operations.remote_operation( mx2_host1_ip, 'su - {0} -c "cat log/popserv.stat|grep StatPopPassCommand"'.format( mx_account), root_account, root_passwd, 0) result_lists2 = stat_statistics.stat_statistic(popserv_stat_content2, '[200]', 'StatPopPassCommand', 5) result_lists = result_lists1 + result_lists2 basic_function.summary(result_lists)
for i in range(1,6): mximap1 = imap_operations.IMAP_Ops(mx1_imapserv_host1_ip,mx1_imapserv_host1_imap4Port) try: mximap1.imap_login('u'+str(i)+'@'+mx2_default_domain,test_account_base+str(i)) # using correct passwd basic_class.mylogger_record.info('imap alias login success') except: basic_class.mylogger_record.error('imap alias login fail') mximap1.imap_select() mximap1.imap_logout() for i in range(6,11): mximap2 = imap_operations.IMAP_Ops(mx1_imapserv_host1_ip,mx1_imapserv_host1_imap4Port) try: mximap2.imap_login('u'+str(i)+'@'+mx2_default_domain,'password') # using wrong passwd :password here except: basic_class.mylogger_record.error('imap alias login fail') mximap2.imap_logout() #step 2 basic_class.mylogger_record.info('fetching imapserv.stat ...') time.sleep (50) basic_class.mylogger_record.info('step2:check and analyze imapserv.stat file ...') flag,imapserv_stat_content1 = remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c "cat log/imapserv.stat|grep StatImapAuthCommand"'.format(mx_account),root_account,root_passwd,0) flag,imapserv_stat_content2 = remote_operations.remote_operation(mx2_host1_ip,'su - {0} -c "cat log/imapserv.stat|grep StatImapAuthCommand"'.format(mx_account),root_account,root_passwd,0) result_lists1 = stat_statistics.stat_statistic(imapserv_stat_content1,'[0]','StatImapAuthCommand',10) result_lists2 = stat_statistics.stat_statistic(imapserv_stat_content2,'[0]','StatImapAuthCommand',5) result_lists = result_lists1 + result_lists2 basic_function.summary(result_lists)
test_account_base + str(i)) # using correct passwd basic_class.mylogger_record.info('login success') except: basic_class.mylogger_record.error('login fail') mximap1.imap_select() mximap1.imap_logout() for i in range(6, 11): mximap2 = imap_operations.IMAP_Ops(mx1_imapserv_host1_ip, mx1_imapserv_host1_imap4Port) try: mximap2.imap_login(test_account_base + str(i), 'password') # using wrong passwd :password here except: basic_class.mylogger_record.error('login fail') mximap2.imap_logout() #step 2 basic_class.mylogger_record.info('fetching imapserv.stat ...') time.sleep(50) basic_class.mylogger_record.info( 'step2:check and analyze imapserv.stat file ...') flag, imapserv_stat_content = remote_operations.remote_operation( mx1_host1_ip, 'su - {0} -c "cat log/imapserv.stat|grep StatImapAuthCommand"'.format( mx_account), root_account, root_passwd, 0) result_lists = stat_statistics.stat_statistic(imapserv_stat_content, '[200]', 'StatImapAuthCommand', 10) basic_function.summary(result_lists)
mxpop1.pop_login('u' + str(i) + '@' + mx1_default_domain, test_account_base + str(i)) # using correct passwd basic_class.mylogger_record.info('pop alias login success') except: basic_class.mylogger_record.error('pop alias login fail') mxpop1.pop_stat() mxpop1.pop_quit() for i in range(6, 11): mxpop2 = pop_operations.POP_Ops(mx1_popserv_host1_ip, mx1_popserv_host1_pop3Port) try: mxpop2.pop_login('u' + str(i) + '@' + mx1_default_domain, 'password') # using wrong passwd :password here except: basic_class.mylogger_record.error('pop alias login fail') mxpop2.pop_quit() #step 2 basic_class.mylogger_record.info('fetching popserv.stat ...') time.sleep(50) basic_class.mylogger_record.info( 'step2:check and analyze popserv.stat file ...') flag, popserv_stat_content = remote_operations.remote_operation( mx1_host1_ip, 'su - {0} -c "cat log/popserv.stat|grep StatPopPassCommand"'.format( mx_account), root_account, root_passwd, 0) result_lists = stat_statistics.stat_statistic(popserv_stat_content, '[200]', 'StatPopPassCommand', 10) basic_function.summary(result_lists)
mypop3.pop_list() mypop3.pop_retr(2) mypop3.pop_retr(2) mypop3.pop_retr(2) mypop3.pop_retr(2) mypop3.pop_retr(2) mypop3.pop_quit() basic_class.mylogger_record.info('fetching popserv.stat ...') time.sleep(50) basic_class.mylogger_record.info('check and analyze popserv.stat file ...') popserv_stat_content = remote_operations.remote_operation( mx2_host1_ip, root_account, root_passwd, 'su - {0} -c "cat log/popserv.stat|grep StatMSSRetrMsg"'.format( mx_account), 0) result_lists = stat_statistics.stat_statistic(popserv_stat_content, '[200]', 'StatMSSRetrMsg', 25) basic_function.summary( result_lists, 'MX-12765:StatMSSRetrMsg_200_pop_retr_same_normal_message_for_5_times') #2######################################################################################################################### basic_class.mylogger_recordnf.title( 'running testcase:MX-12766:StatMSSRetrMsg_200_pop_retr_different_normal_message_for_5_times' ) basic_class.mylogger_record.info('clear current popserv.stat file') remote_operations.remote_operation( mx2_host1_ip, root_account, root_passwd, 'su - {0} -c "> log/popserv.stat"'.format(mx_account), 0) for i in range(1, 6): mypop3 = pop_operations.POP_Ops(mx1_pop1_host_ip, mx1_pop1_port)
remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c "> log/imapserv.stat"'.format(mx_account),root_account,root_passwd,0) for i in range(1,6): myimap = imap_operations.IMAP_Ops(mx1_imapserv_host1_ip,mx1_imapserv_host1_imap4Port) myimap.imap_login(test_account_base+str(i),test_account_base+str(i)) myimap.imap_select() myimap.imap_fetch('1:5','rfc822') myimap.imap_fetch('1:5','rfc822.text') myimap.imap_fetch('1:5','body[text]') myimap.imap_logout() basic_class.mylogger_record.info('fetching imapserv.stat ...') time.sleep (50) basic_class.mylogger_record.info('check and analyze imapserv.stat file ...') flag,imapserv_stat_content = remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c "cat log/imapserv.stat|grep StatMSSRetrMsg"'.format(mx_account),root_account,root_passwd,0) result_lists = stat_statistics.stat_statistic(imapserv_stat_content,'[200]','StatMSSRetrMsg',75) basic_function.summary(result_lists,'MX-11664:statMSSRetrMsg_200_imap_fetch_INBOX_1:5_body') #2######################################################################################################################### basic_class.mylogger_recordnf.title('running testcase:MX-11666:statMSSRetrMsg_200_imap_fetch_INBOX_1,3,4,5_body') basic_class.mylogger_record.info('clear current imapserv.stat file') remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c "> log/imapserv.stat"'.format(mx_account),root_account,root_passwd,0) for i in range(1,6): myimap = imap_operations.IMAP_Ops(mx1_imapserv_host1_ip,mx1_imapserv_host1_imap4Port) myimap.imap_login(test_account_base+str(i),test_account_base+str(i)) myimap.imap_select() myimap.imap_fetch('1,3,4,5','rfc822') myimap.imap_fetch('1,3,4,5','rfc822.text') myimap.imap_fetch('1,3,4,5','body[text]')