def send_notify(subject,body,attachment_name,attachment_data): """by default this function is used to send teststatistic info of test casesat the end of test""" basic_class.mylogger_recordnf.title('\n[[Section3: Delivering notify messages to all involved QA testers ...]]') basic_class.mylogger_record.info('step1:get needed variables:') notify_user,mx1_default_domain,mx_account,root_account,root_passwd,mx1_host1_ip,mx1_mta_host1_ip,mx1_mta_host1_SMTPPort,rcpts=global_variables.get_values('notify_user','mx1_default_domain','mx_account','root_account','root_passwd','mx1_host1_ip','mx1_mta_host1_ip','mx1_mta_host1_SMTPPort','rcpts') basic_class.mylogger_record.debug('sender='+str(notify_user+'@'+mx1_default_domain)) root_passwd,basic_class.mylogger_record.info('step2:enable smtprelay:') remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'imconfcontrol -install -key \"/*/mta/relaySourcePolicy=allowAll\";imconfcontrol -install -key \"/inbound-standardmta-direct/mta/relaySourcePolicy=allowAll\"\''.format(mx_account),root_account,root_passwd,0) root_passwd,basic_class.mylogger_record.info('step3:create send user:'******'@'+mx1_default_domain)) remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'account-create {1}@{2} test default\''.format(mx_account,notify_user,mx1_default_domain),root_account,root_passwd,1,'Mailbox Created Successfully',1) root_passwd,basic_class.mylogger_record.info('step4:deliver statistic messages to all related persions ...') root_passwd,basic_class.mylogger_record.debug('rcpts are:'+str(rcpts.split(' '))) fast_send_mail(mx1_mta_host1_ip,mx1_mta_host1_SMTPPort,notify_user+'@'+mx1_default_domain,rcpts.split(' '),subject=subject,body=body,attachment_name=attachment_name,attachment_data=attachment_data) time.sleep(5) root_passwd,basic_class.mylogger_record.info('step5:disable smtprelay:') remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'imconfcontrol -install -key \"/*/mta/relaySourcePolicy=denyAll\";imconfcontrol -install -key \"/inbound-standardmta-direct/mta/relaySourcePolicy=denyAll\"\''.format(mx_account),root_account,root_passwd,0) root_passwd,basic_class.mylogger_record.info('step6:delete send user:[email protected]') remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'account-delete {1}@{2}\''.format(mx_account,notify_user,mx1_default_domain),root_account,root_passwd,1,'Mailbox Deleted Successfully',1)
import imap_operations import smtp_operations import global_variables import remote_operations import mxos_operations_MessageBodyEncryption import time basic_class.mylogger_record.debug( 'Preparing... get some variables needed for tests') mx1_imapserv_host1_imap4Port,mx1_imapserv_host1_ip,mx1_mxos_host2_ip,ASE_key128,AES_mode1,mx1_mta_host1_SMTPPort,mx1_mta_host1_ip,mx1_mxos_host1_eureka_port,mx1_mxos_host1_ip,mx1_mss_host2_ip,mx1_mss_host1_ip,mx1_popserv_host1,mx1_popserv_host1_pop3Port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,mx1_default_domain = \ global_variables.get_values('mx1_imapserv_host1_imap4Port','mx1_imapserv_host1_ip','mx1_mxos_host2_ip','ASE_key128','AES_mode1','mx1_mta_host1_SMTPPort','mx1_mta_host1_ip','mx1_mxos_host1_eureka_port','mx1_mxos_host1_ip','mx1_mss_host2_ip','mx1_mss_host1_ip','mx1_popserv_host1','mx1_popserv_host1_pop3Port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','mx1_default_domain') basic_class.mylogger_record.info('step1:set keys and restart services') remote_operations.remote_operation( mx1_host1_ip, 'su - {0} -c \'imconfcontrol -install -key \"/*/common/blobStoreAmazonS3Key=blobtier otosankey\";imconfcontrol -install -key \"/*/common/blobStoreAmazonS3KeyId=blobtier otosan\";imconfcontrol -install -key \"/*/common/hostInfo=blobtier=S3:scality.otosan.opwv:80\";imconfcontrol -install -key \"/site1-inbound-standardmta-direct/mta/subAddressAllowedIPs=127.0.0.1\n10.37.2.214\";imconfcontrol -install -key \"/*/mta/subAddressAllowedIPs=127.0.0.1\n10.37.2.214\";imconfcontrol -install -key \"/*/common/messageBodyEncryptionEnabled=false\";imconfcontrol -install -key \"/*/mss/compressionEnabled=true\"\'' .format(mx_account), root_account, root_passwd, 0) remote_operations.remote_operation( mx1_mss_host1_ip, 'su - {0} -c \'~/lib/imservctrl killStart mss mta\''.format(mx_account), root_account, root_passwd, 0) remote_operations.remote_operation( mx1_mss_host2_ip, 'su - {0} -c \'~/lib/imservctrl killStart mss mxos\''.format(mx_account), root_account, root_passwd, 0) remote_operations.remote_operation( mx1_mxos_host2_ip, 'su - {0} -c \'~/lib/imservctrl killStart mxos\''.format(mx_account), root_account, root_passwd, 0) basic_class.mylogger_record.info('Sleeping 200 seconds ...')
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)
myimap.imap_select('customerfolder') messagebody2 = myimap.imap_fetch('1','rfc822') myimap.imap_logout() body_check_flag2 = messagebody2[1].count('This world could be better') basic_class.mylogger_record.debug('body_check_flag2 = '+str(body_check_flag2)) if body_check_flag2 >=1: result_lists.append('fetch messagebody from IMAP success') else: result_lists.append('fetch messagebody from IMAP fail') basic_class.mylogger_record.debug('step4:enable encryption') remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'imconfcontrol -install -key \"/*/common/messageBodyEncryptionEnabled=true\";imconfcontrol -install -key \"/*/mss/compressionEnabled=false\";imconfcontrol -install -key \"/*/mxos/ldapEncryptionDn=cn=encryption,cn=config\";imconfcontrol -install -key \"/*/mxos/ldapReadEncryptionFilter=(&(objectclass=messageBodyEncryption)(cn=encryption))\"\''.format(mx_account),root_account,root_passwd,0) remote_operations.remote_operation(mx1_mss_host1_ip,'su - {0} -c \'~/lib/imservctrl killStart mss\''.format(mx_account),root_account,root_passwd,0) remote_operations.remote_operation(mx1_mss_host2_ip,'su - {0} -c \'~/lib/imservctrl killStart mss mxos\''.format(mx_account),root_account,root_passwd,0) remote_operations.remote_operation(mx1_mxos_host2_ip,'su - {0} -c \'~/lib/imservctrl killStart mxos\''.format(mx_account),root_account,root_passwd,0) basic_class.mylogger_record.info('Sleeping 220 seconds ...') time.sleep(220) basic_class.mylogger_record.info('set passphrase') cuid,cpassphrase = mxos_operations_MessageBodyEncryption.fetch_current_uid_passphrase(mx1_mxos_host1_ip,mx1_mxos_host1_eureka_port) basic_class.mylogger_record.info('cuid,cpassphrase: '+str(cuid)+','+cpassphrase) if int(cuid) == -1: exit (1)
import smtp_operations import global_variables import remote_operations import mxos_operations_MessageBodyEncryption import time basic_class.mylogger_record.debug( 'Preparing... get some variables needed for tests') mx1_mxos2_host_ip,ASE_key128,AES_mode1,mx1_mta1_port,mx1_mta1_host_ip,mx1_mxos1_port,mx1_mxos1_host_ip,mx1_mss2_host_ip,mx1_mss1_host_ip,mx1_pop1_host,mx1_pop1_port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,default_domain = \ global_variables.get_values('mx1_mxos2_host_ip','ASE_key128','AES_mode1','mx1_mta1_port','mx1_mta1_host_ip','mx1_mxos1_port','mx1_mxos1_host_ip','mx1_mss2_host_ip','mx1_mss1_host_ip','mx1_pop1_host','mx1_pop1_port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','default_domain') basic_class.mylogger_record.info('step1:delete 2 accounts') remote_operations.remote_operation( mx1_host1_ip, root_account, root_passwd, 'su - {0} -c \'for ((i=1;i<=2;i++));do account-delete {1}$i@{2};done\''. format(mx_account, test_account_base, default_domain), 1, 'Mailbox Deleted Successfully', 2) basic_class.mylogger_record.info('step2:restore keys and restart services') #imconfcontrol -install -key \"/*/mxos/loadRulesOrder=domain\nmailbox\ncos\nmessage\ncustom\nadminrealm\nlogging\naddressbook\nnotify\nsaml\ntasks\ndatastore\nmailinglist\n\";imconfcontrol -install -key \"/*/common/messageBodyEncryptionEnabled=false\" remote_operations.remote_operation( mx1_host1_ip, root_account, root_passwd, 'su - {0} -c \'imconfcontrol -install -key \"/*/mss/compressionEnabled=true\";imconfcontrol -install -key \"/*/mxos/ldapEncryptionDn\";imconfcontrol -install -key \"/*/mxos/ldapReadEncryptionFilter\"\'' .format(mx_account), 0) remote_operations.remote_operation( mx1_mss1_host_ip, root_account, root_passwd, 'su - {0} -c \'~/lib/imservctrl killStart mss\''.format(mx_account), 0) remote_operations.remote_operation( mx1_mss2_host_ip, root_account, root_passwd,
import basic_class import imap_operations import smtp_operations import global_variables import remote_operations import mxos_operations_MessageBodyEncryption import time basic_class.mylogger_record.debug('Preparing... get some variables needed for tests') mx1_mxos_host2_ip,ASE_key192,AES_mode5,mx1_mta_host1_SMTPPort,mx1_mta_host1_ip,mx1_mxos_host1_eureka_port,mx1_mxos_host1_ip,mx1_mss_host2_ip,mx1_mss_host1_ip,mx1_popserv_host1,mx1_popserv_host1_pop3Port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,mx1_default_domain = \ global_variables.get_values('mx1_mxos_host2_ip','ASE_key192','AES_mode5','mx1_mta_host1_SMTPPort','mx1_mta_host1_ip','mx1_mxos_host1_eureka_port','mx1_mxos_host1_ip','mx1_mss_host2_ip','mx1_mss_host1_ip','mx1_popserv_host1','mx1_popserv_host1_pop3Port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','mx1_default_domain') basic_class.mylogger_record.info('step1:set keys and restart services') remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'imconfcontrol -install -key \"/*/common/messageBodyEncryptionEnabled=true\";imconfcontrol -install -key \"/*/mss/compressionEnabled=false\";imconfcontrol -install -key \"/*/mxos/ldapEncryptionDn=cn=encryption,cn=config\";imconfcontrol -install -key \"/*/mxos/ldapReadEncryptionFilter=(&(objectclass=messageBodyEncryption)(cn=encryption))\";imconfcontrol -install -key \"/*/mxos/loadRulesOrder=domain\nmailbox\ncos\nmessage\ncustom\nadminrealm\nlogging\naddressbook\nnotify\nsaml\ntasks\ndatastore\nmailinglist\nencryption\"\''.format(mx_account),root_account,root_passwd,0) remote_operations.remote_operation(mx1_mss_host1_ip,'su - {0} -c \'~/lib/imservctrl killStart mss\''.format(mx_account),root_account,root_passwd,0) remote_operations.remote_operation(mx1_mss_host2_ip,'su - {0} -c \'~/lib/imservctrl killStart mss mxos\''.format(mx_account),root_account,root_passwd,0) remote_operations.remote_operation(mx1_mxos_host2_ip,'su - {0} -c \'~/lib/imservctrl killStart mxos\''.format(mx_account),root_account,root_passwd,0) basic_class.mylogger_record.info('Sleeping 50 seconds ...') time.sleep(50) basic_class.mylogger_record.info('set passphrase') cuid,cpassphrase = mxos_operations_MessageBodyEncryption.fetch_current_uid_passphrase(mx1_mxos_host1_ip,mx1_mxos_host1_eureka_port) basic_class.mylogger_record.info('cuid,cpassphrase: '+str(cuid)+','+cpassphrase) if int(cuid) == -1: exit (1) else: pass
import remote_operations import time #print (global_variables.get_value('initialpath')) #basic_class.mylogger_record.info('Runing setup testcase:mx-12528-imap_login_10_accounts_half_pass_half_fail') basic_class.mylogger_record.debug( 'Preparing... get some variables needed for tests') mx2_imapserv_host1_ip,mx2_mss_host1_ip,mx2_mta_host1_SMTPPort,mx2_mta_host1_ip,mx2_host1_ip,mx2_popserv_host1_pop3Port,mx2_popserv_host1,mx2_imapserv_host1_imap4Port,mx2_imapserv_host1,mx1_mss_host1_ip,mx1_mss_host2_ip,mx1_imapserv_host1_ip,mx1_imapserv_host1_imap4Port,mx1_mta_host1_ip,mx1_mta_host1_SMTPPort,mx1_popserv_host1_ip,mx1_popserv_host1_pop3Port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,mx1_default_domain,mx2_default_domain = \ global_variables.get_values('mx2_imapserv_host1_ip','mx2_mss_host1_ip','mx2_mta_host1_SMTPPort','mx2_mta_host1_ip','mx2_host1_ip','mx2_popserv_host1_pop3Port','mx2_popserv_host1','mx2_imapserv_host1_imap4Port','mx2_imapserv_host1','mx1_mss_host1_ip','mx1_mss_host2_ip','mx1_imapserv_host1_ip','mx1_imapserv_host1_imap4Port','mx1_mta_host1_ip','mx1_mta_host1_SMTPPort','mx1_popserv_host1_ip','mx1_popserv_host1_pop3Port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','mx1_default_domain','mx2_default_domain') basic_class.mylogger_record.info('step1:set keys') remote_operations.remote_operation( mx1_host1_ip, 'su - {0} -c \'imconfcontrol -install -key \"/*/common/perfStatThresholds=StatImapAuthCommand 200\";imconfcontrol -install -key \"/*/common/reportParamsInterval=30\";imconfcontrol -install -key \"/*/common/badPasswordDelay=0\";imconfcontrol -install -key \"/*/common/maxBadPasswordDelay=0\";imconfcontrol -install -key \"/*/imapserv/imapProxyHost=imap://{1}:{2}\";imconfcontrol -install -key \"/*/imapserv/imapProxyPort={2}\";imconfcontrol -install -key \"/*/common/loginAliases=true\"\'' .format(mx_account, mx2_imapserv_host1, mx2_imapserv_host1_imap4Port), root_account, root_passwd, 0) remote_operations.remote_operation( mx2_host1_ip, 'su - {0} -c \'imconfcontrol -install -key \"/*/common/perfStatThresholds=StatImapAuthCommand 200\";imconfcontrol -install -key \"/*/common/reportParamsInterval=30\";imconfcontrol -install -key \"/*/common/badPasswordDelay=0\";imconfcontrol -install -key \"/*/common/maxBadPasswordDelay=0\";imconfcontrol -install -key \"/*/common/loginAliases=true\"\'' .format(mx_account), root_account, root_passwd, 0) basic_class.mylogger_record.info( 'step2:create 10 accounts amd set proxy status of proxy server') remote_operations.remote_operation( mx1_host1_ip, 'su - {0} -c \'for ((i=1;i<=10;i++));do account-create {1}$i@{2} {1}$i default;done\'' .format(mx_account, test_account_base, mx1_default_domain), root_account, root_passwd, 1, 'Mailbox Created Successfully', 10) remote_operations.remote_operation(
import global_variables import remote_operations import time #print (global_variables.get_value('initialpath')) #basic_class.mylogger_record.info('Runing setup testcase:mx-11631-pop_login_10_accounts_half_pass_half_fail') basic_class.mylogger_record.debug( 'Preparing... get some variables needed for tests') mx1_popserv_host1,mx1_popserv_host1_pop3Port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,mx1_default_domain = \ global_variables.get_values('mx1_popserv_host1','mx1_popserv_host1_pop3Port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','mx1_default_domain') basic_class.mylogger_record.info('step1:set keys') remote_operations.remote_operation( mx1_host1_ip, 'su - {0} -c \'imconfcontrol -install -key \"/*/common/perfStatThresholds=StatPopPassCommand 200\";imconfcontrol -install -key \"/*/common/reportParamsInterval=30\";imconfcontrol -install -key \"/*/common/badPasswordDelay=0\";imconfcontrol -install -key \"/*/common/maxBadPasswordDelay=0\"\'' .format(mx_account), root_account, root_passwd, 0) basic_class.mylogger_record.info('step2:create 10 accounts') remote_operations.remote_operation( mx1_host1_ip, 'su - {0} -c \'for ((i=1;i<=10;i++));do account-create {1}$i@{2} {1}$i default;done\'' .format(mx_account, test_account_base, mx1_default_domain), root_account, root_passwd, 1, 'Mailbox Created Successfully', 10) time.sleep(30) # to avoid last operations not expires basic_class.mylogger_record.info('step3: clear current popserv.stat file') remote_operations.remote_operation( mx1_host1_ip, 'su - {0} -c "> log/popserv.stat"'.format(mx_account), root_account, root_passwd, 0)
import time import remote_operations import stat_statistics basic_class.mylogger_record.debug( 'Preparing... get some variables needed for tests') mx2_imap1_host_ip,mx2_mss1_host_ip,mx2_mta1_port,mx2_mta1_host_ip,mx2_host1_ip,mx2_pop1_port,mx2_pop1_host,mx2_imap1_port,mx2_imap1_host,mx1_mss1_host_ip,mx1_mss2_host_ip,mx1_imap1_host_ip,mx1_imap1_port,mx1_mta1_host_ip,mx1_mta1_port,mx1_pop1_host_ip,mx1_pop1_port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,default_domain = \ global_variables.get_values('mx2_imap1_host_ip','mx2_mss1_host_ip','mx2_mta1_port','mx2_mta1_host_ip','mx2_host1_ip','mx2_pop1_port','mx2_pop1_host','mx2_imap1_port','mx2_imap1_host','mx1_mss1_host_ip','mx1_mss2_host_ip','mx1_imap1_host_ip','mx1_imap1_port','mx1_mta1_host_ip','mx1_mta1_port','mx1_pop1_host_ip','mx1_pop1_port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','default_domain') basic_class.mylogger_recordnf.title( 'PART2:POP Message bodyRetrieval--StatMSSRetrMsg') basic_class.mylogger_recordnf.title('StatMSSRetrMsg=200') basic_class.mylogger_record.info('set keys:StatMSSRetrMsg=200') remote_operations.remote_operation( mx2_host1_ip, root_account, root_passwd, 'su - {0} -c \'imconfcontrol -install -key \"/*/common/perfStatThresholds=StatMSSRetrMsg 200\"\'' .format(mx_account), 0) remote_operations.remote_operation( mx2_mss1_host_ip, root_account, root_passwd, 'su - {0} -c "~/lib/imservctrl killStart popserv"'.format(mx_account), 0) time.sleep(50) #1######################################################################################################################### basic_class.mylogger_recordnf.title( 'running testcase:MX-12765:StatMSSRetrMsg_200_pop_retr_same_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)
import global_variables import remote_operations import time #print (global_variables.get_value('initialpath')) #basic_class.mylogger_record.info('Runing setup testcase:mx-12534-pop_login_10_accounts_half_pass_half_fail') basic_class.mylogger_record.debug( 'Preparing... get some variables needed for tests') mx2_imap1_host_ip,mx2_mss1_host_ip,mx2_mta1_port,mx2_mta1_host_ip,mx2_host1_ip,mx2_pop1_port,mx2_pop1_host,mx2_imap1_port,mx2_imap1_host,mx1_mss1_host_ip,mx1_mss2_host_ip,mx1_imap1_host_ip,mx1_imap1_port,mx1_mta1_host_ip,mx1_mta1_port,mx1_pop1_host_ip,mx1_pop1_port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,default_domain = \ global_variables.get_values('mx2_imap1_host_ip','mx2_mss1_host_ip','mx2_mta1_port','mx2_mta1_host_ip','mx2_host1_ip','mx2_pop1_port','mx2_pop1_host','mx2_imap1_port','mx2_imap1_host','mx1_mss1_host_ip','mx1_mss2_host_ip','mx1_imap1_host_ip','mx1_imap1_port','mx1_mta1_host_ip','mx1_mta1_port','mx1_pop1_host_ip','mx1_pop1_port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','default_domain') basic_class.mylogger_record.info('step1:set keys') remote_operations.remote_operation( mx1_host1_ip, root_account, root_passwd, 'su - {0} -c \'imconfcontrol -install -key \"/*/common/perfStatThresholds=StatPopPassCommand 0\";imconfcontrol -install -key \"/*/common/reportParamsInterval=30\";imconfcontrol -install -key \"/*/common/badPasswordDelay=0\";imconfcontrol -install -key \"/*/common/maxBadPasswordDelay=0\";imconfcontrol -install -key \"/*/popserv/popProxyHost=pop://{1}:{2}\";imconfcontrol -install -key \"/*/popserv/popProxyPort={2}\"\'' .format(mx_account, mx2_pop1_host, mx2_pop1_port), 0) remote_operations.remote_operation( mx2_host1_ip, root_account, root_passwd, 'su - {0} -c \'imconfcontrol -install -key \"/*/common/perfStatThresholds=StatPopPassCommand 0\";imconfcontrol -install -key \"/*/common/reportParamsInterval=30\";imconfcontrol -install -key \"/*/common/badPasswordDelay=0\";imconfcontrol -install -key \"/*/common/maxBadPasswordDelay=0\"\'' .format(mx_account), 0) basic_class.mylogger_record.info('step2:create 10 accounts') remote_operations.remote_operation( mx1_host1_ip, root_account, root_passwd, 'su - {0} -c \'for ((i=1;i<=10;i++));do account-create {1}$i@{2} {1}$i default;done\'' .format(mx_account, test_account_base, default_domain), 1, 'Mailbox Created Successfully', 10) remote_operations.remote_operation( mx2_host1_ip, root_account, root_passwd, 'su - {0} -c \'for ((i=1;i<=10;i++));do account-create {1}$i@{2} {1}$i default;done\''
import smtp_operations import global_variables import remote_operations import mxos_operations_MessageBodyEncryption import time basic_class.mylogger_record.debug( 'Preparing... get some variables needed for tests') mx1_mxos_host2_ip,mx1_mta_host1_SMTPPort,mx1_mta_host1_ip,mx1_mxos_host1_eureka_port,mx1_mxos_host1_ip,mx1_mss_host2_ip,mx1_mss_host1_ip,mx1_popserv_host1,mx1_popserv_host1_pop3Port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,mx1_default_domain = \ global_variables.get_values('mx1_mxos_host2_ip','mx1_mta_host1_SMTPPort','mx1_mta_host1_ip','mx1_mxos_host1_eureka_port','mx1_mxos_host1_ip','mx1_mss_host2_ip','mx1_mss_host1_ip','mx1_popserv_host1','mx1_popserv_host1_pop3Port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','mx1_default_domain') basic_class.mylogger_record.info('step1:delete 2 accounts') remote_operations.remote_operation( mx1_host1_ip, 'su - {0} -c \'for ((i=1;i<=2;i++));do account-delete {1}$i@{2};done\''. format(mx_account, test_account_base, mx1_default_domain), root_account, root_passwd, 1, 'Mailbox Deleted Successfully', 2) basic_class.mylogger_record.info('step2:restore keys and restart services') remote_operations.remote_operation( mx1_host1_ip, 'su - {0} -c \'imconfcontrol -install -key \"/*/mss/compressionEnabled=true\";imconfcontrol -install -key \"/*/common/messageBodyEncryptionEnabled=false\"\'' .format(mx_account), root_account, root_passwd, 0) remote_operations.remote_operation( mx1_mss_host1_ip, 'su - {0} -c \'~/lib/imservctrl killStart mss\''.format(mx_account), root_account, root_passwd, 0) remote_operations.remote_operation( mx1_mss_host2_ip, 'su - {0} -c \'~/lib/imservctrl killStart mss\''.format(mx_account),
# /*/mss/compressionEnabled: [true] # need mss restart # (2) create 6 accounts:[email protected] [email protected] # (3) clear current popserv.stat file import basic_function import basic_class import imap_operations import smtp_operations import global_variables import remote_operations import mxos_operations_MessageBodyEncryption import time basic_class.mylogger_record.debug( 'Preparing... get some variables needed for tests') mx1_mxos_host2_ip,mx1_mta_host1_SMTPPort,mx1_mta_host1_ip,mx1_mxos_host1_eureka_port,mx1_mxos_host1_ip,mx1_mss_host2_ip,mx1_mss_host1_ip,mx1_popserv_host1,mx1_popserv_host1_pop3Port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,mx1_default_domain = \ global_variables.get_values('mx1_mxos_host2_ip','mx1_mta_host1_SMTPPort','mx1_mta_host1_ip','mx1_mxos_host1_eureka_port','mx1_mxos_host1_ip','mx1_mss_host2_ip','mx1_mss_host1_ip','mx1_popserv_host1','mx1_popserv_host1_pop3Port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','mx1_default_domain') basic_class.mylogger_record.info('step1:delete 2 accounts') remote_operations.remote_operation( mx1_host1_ip, 'su - {0} -c \'for ((i=1;i<=2;i++));do account-delete {1}$i@{2};done\''. format(mx_account, test_account_base, mx1_default_domain), root_account, root_passwd, 1, 'Mailbox Deleted Successfully', 2) #basic_class.mylogger_record.info('step2:restore keys and restart services') #remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'imconfcontrol -install -key \"/*/mss/compressionEnabled=true\";imconfcontrol -install -key \"/*/common/messageBodyEncryptionEnabled=false\";imconfcontrol -install -key \"/*/mxos/ldapEncryptionDn\";imconfcontrol -install -key \"/*/mxos/ldapReadEncryptionFilter\"\''.format(mx_account),root_account,root_passwd,0) #remote_operations.remote_operation(mx1_mss_host1_ip,'su - {0} -c \'~/lib/imservctrl killStart mss\''.format(mx_account),root_account,root_passwd,0) #remote_operations.remote_operation(mx1_mss_host2_ip,'su - {0} -c \'~/lib/imservctrl killStart mxos\''.format(mx_account),root_account,root_passwd,0) #remote_operations.remote_operation(mx1_mxos_host1_ip,'su - {0} -c \'~/lib/imservctrl killStart mxos\''.format(mx_account),root_account,root_passwd,0)
import global_variables import time import remote_operations import stat_statistics basic_class.mylogger_record.debug('Preparing... get some variables needed for tests') mx1_mss_host1_ip,mx1_mss_host2_ip,mx1_imapserv_host1_ip,mx1_imapserv_host1_imap4Port,mx1_mta_host1_ip,mx1_mta_host1_SMTPPort,mx1_popserv_host1_ip,mx1_popserv_host1_pop3Port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,mx1_default_domain = \ global_variables.get_values('mx1_mss_host1_ip','mx1_mss_host2_ip','mx1_imapserv_host1_ip','mx1_imapserv_host1_imap4Port','mx1_mta_host1_ip','mx1_mta_host1_SMTPPort','mx1_popserv_host1_ip','mx1_popserv_host1_pop3Port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','mx1_default_domain') # IMAP Message bodyRetrieval--StatMSSRetrMsg basic_class.mylogger_recordnf.title('PART1:IMAP Message bodyRetrieval--StatMSSRetrMsg') basic_class.mylogger_recordnf.title('StatMSSRetrMsg=200') basic_class.mylogger_record.info('set keys:StatMSSRetrMsg=200') remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'imconfcontrol -install -key \"/*/common/perfStatThresholds=StatMSSRetrMsg 200\"\''.format(mx_account),root_account,root_passwd,0) time.sleep(50) #1######################################################################################################################### basic_class.mylogger_recordnf.title('running testcase:MX-11664:statMSSRetrMsg_200_imap_fetch_INBOX_1: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:5','rfc822') myimap.imap_fetch('1:5','rfc822.text') myimap.imap_fetch('1:5','body[text]') myimap.imap_logout()
import basic_class import imap_operations import smtp_operations import global_variables import remote_operations import mxos_operations_MessageBodyEncryption import time basic_class.mylogger_record.debug('Preparing... get some variables needed for tests') mx1_imapserv_host1_imap4Port,mx1_imapserv_host1_ip,mx1_mxos_host2_ip,ASE_key128,AES_mode1,mx1_mta_host1_SMTPPort,mx1_mta_host1_ip,mx1_mxos_host1_eureka_port,mx1_mxos_host1_ip,mx1_mss_host2_ip,mx1_mss_host1_ip,mx1_popserv_host1,mx1_popserv_host1_pop3Port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,mx1_default_domain = \ global_variables.get_values('mx1_imapserv_host1_imap4Port','mx1_imapserv_host1_ip','mx1_mxos_host2_ip','ASE_key128','AES_mode1','mx1_mta_host1_SMTPPort','mx1_mta_host1_ip','mx1_mxos_host1_eureka_port','mx1_mxos_host1_ip','mx1_mss_host2_ip','mx1_mss_host1_ip','mx1_popserv_host1','mx1_popserv_host1_pop3Port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','mx1_default_domain') basic_class.mylogger_record.info('step1:set keys and restart services') remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'imconfcontrol -install -key \"/site1-inbound-standardmta-direct/mta/subAddressAllowedIPs=127.0.0.1\n10.37.2.214\";imconfcontrol -install -key \"/*/mta/subAddressAllowedIPs=127.0.0.1\n10.37.2.214\";imconfcontrol -install -key \"/*/common/messageBodyEncryptionEnabled=true\";imconfcontrol -install -key \"/*/mss/compressionEnabled=false\";imconfcontrol -install -key \"/*/mxos/ldapEncryptionDn=cn=encryption,cn=config\";imconfcontrol -install -key \"/*/mxos/ldapReadEncryptionFilter=(&(objectclass=messageBodyEncryption)(cn=encryption))\"\''.format(mx_account),root_account,root_passwd,0) remote_operations.remote_operation(mx1_mss_host1_ip,'su - {0} -c \'~/lib/imservctrl killStart mss mta\''.format(mx_account),root_account,root_passwd,0) remote_operations.remote_operation(mx1_mss_host2_ip,'su - {0} -c \'~/lib/imservctrl killStart mss mxos\''.format(mx_account),root_account,root_passwd,0) remote_operations.remote_operation(mx1_mxos_host2_ip,'su - {0} -c \'~/lib/imservctrl killStart mxos\''.format(mx_account),root_account,root_passwd,0) basic_class.mylogger_record.info('Sleeping 200 seconds ...') time.sleep(200) #basic_class.mylogger_record.info('set passphrase') #cuid,cpassphrase = mxos_operations_MessageBodyEncryption.fetch_current_uid_passphrase(mx1_mxos_host1_ip,mx1_mxos_host1_eureka_port) #basic_class.mylogger_record.info('cuid,cpassphrase: '+str(cuid)+','+cpassphrase) #if int(cuid) == -1: # exit (1) #else: # pass
import global_variables import remote_operations import time #print (global_variables.get_value('initialpath')) #basic_class.mylogger_record.info('Runing setup testcase:mx-11633-apop_auth_10_accounts_half_pass_half_fail') basic_class.mylogger_record.debug( 'Preparing... get some variables needed for tests') mx1_mxos1_host_ip,mx1_mxos2_host_ip,mx1_pop1_host,mx1_pop1_port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,default_domain = \ global_variables.get_values('mx1_mxos1_host_ip','mx1_mxos2_host_ip','mx1_pop1_host','mx1_pop1_port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','default_domain') basic_class.mylogger_record.info('step1:set keys') remote_operations.remote_operation( mx1_host1_ip, root_account, root_passwd, 'su - {0} -c \'imconfcontrol -install -key \"/*/common/perfStatThresholds=StatPopPassCommand 200\";imconfcontrol -install -key \"/*/common/reportParamsInterval=30\";imconfcontrol -install -key \"/*/common/badPasswordDelay=0\";imconfcontrol -install -key \"/*/common/maxBadPasswordDelay=0\";imconfcontrol -install -key \"/*/popserv/allowAPOP=true\";imconfcontrol -install -key \"/*/mxos/defaultPasswordStoreType=clear\";imconfcontrol -install -key \"/*/mxos/trustedClient=true\"\'' .format(mx_account), 0) basic_class.mylogger_record.info('step2:create 10 accounts') remote_operations.remote_operation( mx1_host1_ip, root_account, root_passwd, 'su - {0} -c \'for ((i=1;i<=10;i++));do account-create {1}$i@{2} {1}$i default;done\'' .format(mx_account, test_account_base, default_domain), 1, 'Mailbox Created Successfully', 10) remote_operations.remote_operation( mx1_mxos2_host_ip, root_account, root_passwd, 'su - {0} -c "~/lib/imservctrl killStart mxos"'.format(mx_account), 0) remote_operations.remote_operation( mx1_mxos1_host_ip, root_account, root_passwd, 'su - {0} -c "~/lib/imservctrl killStart mss mxos"'.format(mx_account), 0)
mx1_mxos_host1_ip, mx1_mxos_host1_eureka_port) basic_class.mylogger_record.info('cuid,cpassphrase: ' + str(cuid) + ',' + cpassphrase) if int(cuid) == -1: exit(1) else: pass basic_class.mylogger_record.info('new passphrase uid is: ' + str(cuid)) mxos_operations_MessageBodyEncryption.create_passphrase( mx1_mxos_host1_ip, mx1_mxos_host1_eureka_port, str(cuid), AES_mode1, ASE_key128) # restart mss to froce to use new encryption key remote_operations.remote_operation( mx1_mss_host1_ip, 'su - {0} -c \'~/lib/imservctrl killStart mss\''.format(mx_account), root_account, root_passwd, 0) remote_operations.remote_operation( mx1_mss_host2_ip, 'su - {0} -c \'~/lib/imservctrl killStart mss\''.format(mx_account), root_account, root_passwd, 0) time.sleep(30) basic_class.mylogger_record.info( 'step5:MTA send 1 message to testuser1 to INBOX again') smtp_operations.fast_send_mail(mx1_mta_host1_ip, mx1_mta_host1_SMTPPort, 'testuser2', [test_account_base + '1']) #myimap = imap_operations.IMAP_Ops(mx1_imapserv_host1_ip,mx1_imapserv_host1_imap4Port) #myimap.imap_login('testuser1','testuser1') #myimap.imap_select()
import imap_operations import smtp_operations import global_variables import remote_operations import mxos_operations_MessageBodyEncryption import mxos_auto_reply import time basic_class.mylogger_record.debug('Preparing... get some variables needed for tests') mx1_mxos_host2_ip,mx1_imapserv_host1_imap4Port,mx1_imapserv_host1_ip,mx1_mxos_host1_ip,ASE_key128,AES_mode1,mx1_mta_host1_SMTPPort,mx1_mta_host1_ip,mx1_mxos_host1_eureka_port,mx1_mxos_host1_ip,mx1_mss_host2_ip,mx1_mss_host1_ip,mx1_popserv_host1,mx1_popserv_host1_pop3Port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,mx1_default_domain = \ global_variables.get_values('mx1_mxos_host2_ip','mx1_imapserv_host1_imap4Port','mx1_imapserv_host1_ip','mx1_mxos_host1_ip','ASE_key128','AES_mode1','mx1_mta_host1_SMTPPort','mx1_mta_host1_ip','mx1_mxos_host1_eureka_port','mx1_mxos_host1_ip','mx1_mss_host2_ip','mx1_mss_host1_ip','mx1_popserv_host1','mx1_popserv_host1_pop3Port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','mx1_default_domain') basic_class.mylogger_record.info('step1:set keys and restart services') remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'imconfcontrol -install -key \"/*/common/blobStoreAmazonS3Key=blobtier otosankey\";imconfcontrol -install -key \"/*/common/blobStoreAmazonS3KeyId=blobtier otosan\";imconfcontrol -install -key \"/*/common/hostInfo=blobtier=S3:scality.otosan.opwv:80\";imconfcontrol -install -key \"/*/common/messageBodyEncryptionEnabled=true\";imconfcontrol -install -key \"/*/mss/compressionEnabled=false\";imconfcontrol -install -key \"/*/mxos/ldapEncryptionDn=cn=encryption,cn=config\";imconfcontrol -install -key \"/*/mxos/ldapReadEncryptionFilter=(&(objectclass=messageBodyEncryption)(cn=encryption))\"\''.format(mx_account),root_account,root_passwd,0) remote_operations.remote_operation(mx1_mss_host1_ip,'su - {0} -c \'~/lib/imservctrl killStart mss\''.format(mx_account),root_account,root_passwd,0) remote_operations.remote_operation(mx1_mss_host2_ip,'su - {0} -c \'~/lib/imservctrl killStart mss mxos\''.format(mx_account),root_account,root_passwd,0) remote_operations.remote_operation(mx1_mxos_host2_ip,'su - {0} -c \'~/lib/imservctrl killStart mxos\''.format(mx_account),root_account,root_passwd,0) basic_class.mylogger_record.info('Sleeping 200 seconds ...') time.sleep(200) #basic_class.mylogger_record.info('set passphrase') #cuid,cpassphrase = mxos_operations_MessageBodyEncryption.fetch_current_uid_passphrase(mx1_mxos_host1_ip,mx1_mxos_host1_eureka_port) #basic_class.mylogger_record.info('cuid,cpassphrase: '+str(cuid)+','+cpassphrase) #if int(cuid) == -1: # exit (1) #else: # pass
import imap_operations import smtp_operations import global_variables import remote_operations import mxos_operations_MessageBodyEncryption import time basic_class.mylogger_record.debug( 'Preparing... get some variables needed for tests') mx1_imap1_port,mx1_imap1_host_ip,mx1_mxos2_host_ip,ASE_key128,AES_mode1,mx1_mta1_port,mx1_mta1_host_ip,mx1_mxos1_port,mx1_mxos1_host_ip,mx1_mss2_host_ip,mx1_mss1_host_ip,mx1_pop1_host,mx1_pop1_port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,default_domain = \ global_variables.get_values('mx1_imap1_port','mx1_imap1_host_ip','mx1_mxos2_host_ip','ASE_key128','AES_mode1','mx1_mta1_port','mx1_mta1_host_ip','mx1_mxos1_port','mx1_mxos1_host_ip','mx1_mss2_host_ip','mx1_mss1_host_ip','mx1_pop1_host','mx1_pop1_port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','default_domain') basic_class.mylogger_record.info('step1:set keys and restart services') remote_operations.remote_operation( mx1_host1_ip, root_account, root_passwd, 'su - {0} -c \'imconfcontrol -install -key \"/site1-inbound-standardmta-direct/mta/subAddressAllowedIPs=127.0.0.1\n10.37.2.214\";imconfcontrol -install -key \"/*/mta/subAddressAllowedIPs=127.0.0.1\n10.37.2.214\";imconfcontrol -install -key \"/*/common/messageBodyEncryptionEnabled=false\";imconfcontrol -install -key \"/*/mss/compressionEnabled=false\"\'' .format(mx_account), 0) remote_operations.remote_operation( mx1_mss1_host_ip, root_account, root_passwd, 'su - {0} -c \'~/lib/imservctrl killStart mss mta\''.format(mx_account), 0) remote_operations.remote_operation( mx1_mss2_host_ip, root_account, root_passwd, 'su - {0} -c \'~/lib/imservctrl killStart mss\''.format(mx_account), 0) #remote_operations.remote_operation(mx1_mxos2_host_ip,root_account,root_passwd,'su - {0} -c \'~/lib/imservctrl killStart mxos\''.format(mx_account),0) basic_class.mylogger_record.info('Sleeping 30 seconds ...') time.sleep(30) #basic_class.mylogger_record.info('set passphrase') #cuid,cpassphrase = mxos_operations_MessageBodyEncryption.fetch_current_uid_passphrase(mx1_mxos1_host_ip,mx1_mxos1_port) #basic_class.mylogger_record.info('cuid,cpassphrase: '+str(cuid)+','+cpassphrase)
import imap_operations import smtp_operations import global_variables import remote_operations import mxos_operations_MessageBodyEncryption import time basic_class.mylogger_record.debug( 'Preparing... get some variables needed for tests') mx1_imapserv_host1_imap4Port,mx1_imapserv_host1_ip,mx1_mxos_host2_ip,ASE_key128,AES_mode1,mx1_mta_host1_SMTPPort,mx1_mta_host1_ip,mx1_mxos_host1_eureka_port,mx1_mxos_host1_ip,mx1_mss_host2_ip,mx1_mss_host1_ip,mx1_popserv_host1,mx1_popserv_host1_pop3Port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,mx1_default_domain = \ global_variables.get_values('mx1_imapserv_host1_imap4Port','mx1_imapserv_host1_ip','mx1_mxos_host2_ip','ASE_key128','AES_mode1','mx1_mta_host1_SMTPPort','mx1_mta_host1_ip','mx1_mxos_host1_eureka_port','mx1_mxos_host1_ip','mx1_mss_host2_ip','mx1_mss_host1_ip','mx1_popserv_host1','mx1_popserv_host1_pop3Port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','mx1_default_domain') basic_class.mylogger_record.info('step1:set keys and restart services') remote_operations.remote_operation( mx1_host1_ip, 'su - {0} -c \'imconfcontrol -install -key \"/*/common/hostInfo=blobtier=Cassandra:blobcluster:9162\";imconfcontrol -install -key \"/*/common/messageBodyEncryptionEnabled=true\";imconfcontrol -install -key \"/*/mss/compressionEnabled=false\";imconfcontrol -install -key \"/*/mxos/ldapEncryptionDn=cn=encryption,cn=config\";imconfcontrol -install -key \"/*/mxos/ldapReadEncryptionFilter=(&(objectclass=messageBodyEncryption)(cn=encryption))\"\'' .format(mx_account), root_account, root_passwd, 0) remote_operations.remote_operation( mx1_mss_host1_ip, 'su - {0} -c \'~/lib/imservctrl killStart mss\''.format(mx_account), root_account, root_passwd, 0) remote_operations.remote_operation( mx1_mss_host2_ip, 'su - {0} -c \'~/lib/imservctrl killStart mss mxos\''.format(mx_account), root_account, root_passwd, 0) remote_operations.remote_operation( mx1_mxos_host2_ip, 'su - {0} -c \'~/lib/imservctrl killStart mxos\''.format(mx_account), root_account, root_passwd, 0) basic_class.mylogger_record.info('Sleeping 200 seconds ...')
import time import os import sys #currentpath = os.getcwd() #sys.path.append(currentpath) basic_class.mylogger_record.debug( 'Preparing... get some variables needed for tests') mx1_mss1_host_ip,mx1_mss2_host_ip,mx1_imap1_host_ip,mx1_imap1_port,mx1_mta1_host_ip,mx1_mta1_port,mx1_pop1_host_ip,mx1_pop1_port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,default_domain = \ global_variables.get_values('mx1_mss1_host_ip','mx1_mss2_host_ip','mx1_imap1_host_ip','mx1_imap1_port','mx1_mta1_host_ip','mx1_mta1_port','mx1_pop1_host_ip','mx1_pop1_port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','default_domain') basic_class.mylogger_record.info('step1:set keys') remote_operations.remote_operation( mx1_host1_ip, root_account, root_passwd, 'su - {0} -c \'imconfcontrol -install -key \"/*/imapserv/enableMOVE=true\";imconfcontrol -install -key \"/*/common/reportParamsInterval=30\";imconfcontrol -install -key \"/*/common/hostInfo=blobtier=Cassandra:blobcluster:9162\";imconfcontrol -install -key \"/*/mta/subAddressAllowedIPs=127.0.0.1\n10.49.58.239\n10.37.2.214\n10.6.105.42\";imconfcontrol -install -key \"/site1-inbound-standardmta-direct/mta/subAddressAllowedIPs=127.0.0.1\n10.49.58.239\n10.37.2.214\n10.6.105.42\"\'' .format(mx_account), 0) basic_class.mylogger_record.info(' restart mss') remote_operations.remote_operation( mx1_mss1_host_ip, root_account, root_passwd, 'su - {0} -c "~/lib/imservctrl killStart mss mta"'.format(mx_account), 0) remote_operations.remote_operation( mx1_mss2_host_ip, root_account, root_passwd, 'su - {0} -c "~/lib/imservctrl killStart mss"'.format(mx_account), 0) time.sleep(10) basic_class.mylogger_record.info('step2:create 6 accounts') remote_operations.remote_operation( mx1_host1_ip, root_account, root_passwd, 'su - {0} -c \'for ((i=1;i<=6;i++));do account-create {1}$i@{2} {1}$i default;done\'' .format(mx_account, test_account_base,
##steps: # (1) delete accounts :[email protected] - [email protected] # (2) restore the config keys: # /*/common/perfStatThresholds:[] # /*/common/reportParamsInterval: [60] # default 60 # /*/common/badPasswordDelay: [1] # nodelay ,default 1 # /*/common/maxBadPasswordDelay: [90] # no delay,default 90 # /*/imapserv/allowCRAMMD5: [false] # enable cram-md5 import basic_function import basic_class import imap_operations import global_variables import remote_operations mx1_imapserv_host1,mx1_imapserv_host1_imap4Port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,mx1_default_domain = \ global_variables.get_values('mx1_imapserv_host1','mx1_imapserv_host1_imap4Port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','mx1_default_domain') basic_class.mylogger_record.info('step1:delete 10 accounts') remote_operations.remote_operation( mx1_host1_ip, 'su - {0} -c \'for ((i=1;i<=10;i++));do account-delete {1}$i@{2};done\''. format(mx_account, test_account_base, mx1_default_domain), root_account, root_passwd, 1, 'Mailbox Deleted Successfully', 10) basic_class.mylogger_record.info('step2:restore config keys') remote_operations.remote_operation( mx1_host1_ip, 'su - {0} -c \'imconfcontrol -install -key \"/*/common/perfStatThresholds=\";imconfcontrol -install -key \"/*/common/reportParamsInterval=60\";imconfcontrol -install -key \"/*/common/badPasswordDelay=1\";imconfcontrol -install -key \"/*/common/maxBadPasswordDelay=90\";imconfcontrol -install -key \"/*/imapserv/allowCRAMMD5=false\";imconfcontrol -install -key \"/*/mxos/defaultPasswordStoreType=sha512\"\'' .format(mx_account), root_account, root_passwd, 0)
import imap_operations import global_variables import remote_operations import time #print (global_variables.get_value('initialpath')) #basic_class.mylogger_record.info('Runing setup testcase:mx-12530-auth_cram-md5_10_accounts_half_pass_half_fail') basic_class.mylogger_record.debug('Preparing... get some variables needed for tests') mx1_imap1_host,mx1_imap1_port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,default_domain = \ global_variables.get_values('mx1_imap1_host','mx1_imap1_port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','default_domain') basic_class.mylogger_record.info('step1:set keys') remote_operations.remote_operation(mx1_host1_ip,root_account,root_passwd,'su - {0} -c \'imconfcontrol -install -key \"/*/common/perfStatThresholds=StatImapAuthCommand 0\";imconfcontrol -install -key \"/*/common/reportParamsInterval=30\";imconfcontrol -install -key \"/*/common/badPasswordDelay=0\";imconfcontrol -install -key \"/*/common/maxBadPasswordDelay=0\";imconfcontrol -install -key \"/*/imapserv/allowCRAMMD5=true\";imconfcontrol -install -key \"/*/mxos/defaultPasswordStoreType=clear\"\''.format(mx_account),0) basic_class.mylogger_record.info('step2:create 10 accounts') remote_operations.remote_operation(mx1_host1_ip,root_account,root_passwd,'su - {0} -c \'for ((i=1;i<=10;i++));do account-create {1}$i@{2} {1}$i default;done\''.format(mx_account,test_account_base,default_domain),1,'Mailbox Created Successfully',10) time.sleep(30) # to avoid last operations not expires #basic_class.mylogger_record.info('step3: set hmac for each account') #remote_operations.remote_operation(mx1_host1_ip,root_account,root_passwd,'su - {0} -c \'for ((i=1;i<=10;i++));do hmac_value=$(imgenhmac {1}$i);echo $hmac_value; imdbcontrol sac {1}$i {2} mailpasswordhmac $hmac_value;done\''.format(mx_account,test_account_base,default_domain),0) time.sleep(30) # to avoid last operations not expires basic_class.mylogger_record.info('step3: clear current imapserv.stat file') remote_operations.remote_operation(mx1_host1_ip,root_account,root_passwd,'su - {0} -c "> log/imapserv.stat"'.format(mx_account),0)
import imap_operations import global_variables import remote_operations import time #print (global_variables.get_value('initialpath')) #basic_class.mylogger_record.info('Runing setup testcase:mx-12533-alias_auth_crammd5_10_accounts_half_pass_half_fail') basic_class.mylogger_record.debug('Preparing... get some variables needed for tests') mx1_imapserv_host1,mx1_imapserv_host1_imap4Port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,mx1_default_domain = \ global_variables.get_values('mx1_imapserv_host1','mx1_imapserv_host1_imap4Port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','mx1_default_domain') basic_class.mylogger_record.info('step1:set keys') remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'imconfcontrol -install -key \"/*/common/perfStatThresholds=StatImapAuthCommand 0\";imconfcontrol -install -key \"/*/common/reportParamsInterval=30\";imconfcontrol -install -key \"/*/common/badPasswordDelay=0\";imconfcontrol -install -key \"/*/common/maxBadPasswordDelay=0\";imconfcontrol -install -key \"/*/common/loginAliases=true\";imconfcontrol -install -key \"/*/imapserv/allowCRAMMD5=true\";imconfcontrol -install -key \"/*/mxos/defaultPasswordStoreType=sha512\"\''.format(mx_account),root_account,root_passwd,0) basic_class.mylogger_record.info('step2:create 10 accounts') remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'for ((i=1;i<=10;i++));do account-create {1}$i@{2} {1}$i default;done\''.format(mx_account,test_account_base,mx1_default_domain),root_account,root_passwd,1,'Mailbox Created Successfully',10) basic_class.mylogger_record.info('step3:create alias names for 20 accounts') remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'for ((i=1;i<=10;i++));do imdbcontrol CreateAlias {1}$i u$i {2};done\''.format(mx_account,test_account_base,mx1_default_domain),root_account,root_passwd,0) basic_class.mylogger_record.info('step4: set hmac for each account') remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'for ((i=1;i<=10;i++));do hmac_value=$(imgenhmac {1}$i);echo $hmac_value; imdbcontrol sac {1}$i {2} mailpasswordhmac $hmac_value;done\''.format(mx_account,test_account_base,mx1_default_domain),root_account,root_passwd,0) time.sleep(30) # to avoid last operations not expires basic_class.mylogger_record.info('step5: 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)
import imap_operations import smtp_operations import global_variables import remote_operations import time #print (global_variables.get_value('initialpath')) #basic_class.mylogger_record.info('Runing setup testcase:mx-11632-pop_auth_plain_10_accounts_half_pass_half_fail') basic_class.mylogger_record.debug('Preparing... get some variables needed for tests') mx1_pop1_host,mx1_pop1_port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,default_domain = \ global_variables.get_values('mx1_pop1_host','mx1_pop1_port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','default_domain') remote_operations.remote_operation(mx1_host1_ip,root_account,root_passwd,'su - {0} -c \'imconfcontrol -install -key \"/*/mta/requireAuthentication=true\";imconfcontrol -install -key \"/inbound-standardmta-direct/mta/requireAuthentication=true\";imconfcontrol -install -key \"/*/mta/allowCRAMMD5=true\";imconfcontrol -install -key \"/*/mta/allowTLS=true\"\''.format(mx_account),0) remote_operations.remote_operation(mx1_host1_ip,root_account,root_passwd,'su - {0} -c \'~/lib/imservctrl killStart mta\''.format(mx_account),0) remote_operations.remote_operation(mx1_host1_ip,root_account,root_passwd,'su - {0} -c \'imdbcontrol sac xx1 openwave.com mailsmtpauth 1\''.format(mx_account),0) time.sleep(5) mysmtp = smtp_operations.SMTP_OPs('10.49.58.239','20025') #mysmtp.smtp_starttls() mysmtp.smtp_set_debuglevel() #mysmtp.smtp_ehlo() #mysmtp.smtp_ehlo_or_helo_if_needed() mysmtp.smtp_login('xx1','p') #mysmtp.smtp_auth_login('xx1','p') mysmtp.smtp_quit()
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)
# /*/common/badPasswordDelay: [1] # nodelay ,default 1 # /*/common/maxBadPasswordDelay: [90] # no delay,default 90 # /*/common/loginAliases: [false] # false by default import basic_function import basic_class import imap_operations import global_variables import remote_operations mx1_imap1_host,mx1_imap1_port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,default_domain = \ global_variables.get_values('mx1_imap1_host','mx1_imap1_port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','default_domain') basic_class.mylogger_record.info('step1:delete alias accounts for 10 accounts') remote_operations.remote_operation( mx1_host1_ip, root_account, root_passwd, 'su - {0} -c \'for ((i=1;i<=10;i++));do imdbcontrol DeleteAlias u$i {2};done\'' .format(mx_account, test_account_base, default_domain), 0) basic_class.mylogger_record.info('step2:delete 10 accounts') remote_operations.remote_operation( mx1_host1_ip, root_account, root_passwd, 'su - {0} -c \'for ((i=1;i<=10;i++));do account-delete {1}$i@{2};done\''. format(mx_account, test_account_base, default_domain), 1, 'Mailbox Deleted Successfully', 10) basic_class.mylogger_record.info('step3:restore config keys') remote_operations.remote_operation( mx1_host1_ip, root_account, root_passwd, 'su - {0} -c \'imconfcontrol -install -key \"/*/common/perfStatThresholds=\";imconfcontrol -install -key \"/*/common/reportParamsInterval=60\";imconfcontrol -install -key \"/*/common/badPasswordDelay=1\";imconfcontrol -install -key \"/*/common/maxBadPasswordDelay=90\";imconfcontrol -install -key \"/*/common/loginAliases=false\"\'' .format(mx_account), 0)
import imap_operations import global_variables import remote_operations import time #print (global_variables.get_value('initialpath')) #basic_class.mylogger_record.info('Runing setup testcase:mx-12534-pop_login_10_accounts_half_pass_half_fail') basic_class.mylogger_record.debug('Preparing... get some variables needed for tests') mx1_mxos_host1_ip,mx1_mxos_host2_ip,mx2_imapserv_host1_ip,mx2_mss_host1_ip,mx2_mta_host1_SMTPPort,mx2_mta_host1_ip,mx2_host1_ip,mx2_popserv_host1_pop3Port,mx2_popserv_host1,mx2_imapserv_host1_imap4Port,mx2_imapserv_host1,mx1_mss_host1_ip,mx1_mss_host2_ip,mx1_imapserv_host1_ip,mx1_imapserv_host1_imap4Port,mx1_mta_host1_ip,mx1_mta_host1_SMTPPort,mx1_popserv_host1_ip,mx1_popserv_host1_pop3Port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,mx1_default_domain,mx2_default_domain = \ global_variables.get_values('mx1_mxos_host1_ip','mx1_mxos_host2_ip','mx2_imapserv_host1_ip','mx2_mss_host1_ip','mx2_mta_host1_SMTPPort','mx2_mta_host1_ip','mx2_host1_ip','mx2_popserv_host1_pop3Port','mx2_popserv_host1','mx2_imapserv_host1_imap4Port','mx2_imapserv_host1','mx1_mss_host1_ip','mx1_mss_host2_ip','mx1_imapserv_host1_ip','mx1_imapserv_host1_imap4Port','mx1_mta_host1_ip','mx1_mta_host1_SMTPPort','mx1_popserv_host1_ip','mx1_popserv_host1_pop3Port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','mx1_default_domain','mx2_default_domain') basic_class.mylogger_record.info('step1:set keys') remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'imconfcontrol -install -key \"/*/common/loginAliases=true\";imconfcontrol -install -key \"/*/common/perfStatThresholds=StatPopPassCommand 0\";imconfcontrol -install -key \"/*/common/reportParamsInterval=30\";imconfcontrol -install -key \"/*/common/badPasswordDelay=0\";imconfcontrol -install -key \"/*/common/maxBadPasswordDelay=0\";imconfcontrol -install -key \"/*/popserv/popProxyHost=pop://{1}:{2}\";imconfcontrol -install -key \"/*/popserv/popProxyPort={2}\";imconfcontrol -install -key \"/*/popserv/allowAPOP=true\";imconfcontrol -install -key \"/*/mxos/defaultPasswordStoreType=clear\";imconfcontrol -install -key \"/*/mxos/trustedClient=true\"\''.format(mx_account,mx2_popserv_host1,mx2_popserv_host1_pop3Port),root_account,root_passwd,0) remote_operations.remote_operation(mx2_host1_ip,'su - {0} -c \'imconfcontrol -install -key \"/*/common/loginAliases=true\";imconfcontrol -install -key \"/*/common/perfStatThresholds=StatPopPassCommand 0\";imconfcontrol -install -key \"/*/common/reportParamsInterval=30\";imconfcontrol -install -key \"/*/common/badPasswordDelay=0\";imconfcontrol -install -key \"/*/common/maxBadPasswordDelay=0\";imconfcontrol -install -key \"/*/popserv/allowAPOP=true\";imconfcontrol -install -key \"/*/mxos/defaultPasswordStoreType=clear\";imconfcontrol -install -key \"/*/mxos/trustedClient=true\"\''.format(mx_account),root_account,root_passwd,0) basic_class.mylogger_record.info('step2:create 10 accounts') remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'for ((i=1;i<=10;i++));do account-create {1}$i@{2} {1}$i default;done\''.format(mx_account,test_account_base,mx1_default_domain),root_account,root_passwd,1,'Mailbox Created Successfully',10) remote_operations.remote_operation(mx2_host1_ip,'su - {0} -c \'for ((i=1;i<=10;i++));do account-create {1}$i@{2} {1}$i default;done\''.format(mx_account,test_account_base,mx2_default_domain),root_account,root_passwd,1,'Mailbox Created Successfully',10) remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'for ((i=1;i<=10;i++));do imdbcontrol sac {1}$i {2} mailboxstatus P;done\''.format(mx_account,test_account_base,mx1_default_domain),root_account,root_passwd,0) basic_class.mylogger_record.info('step3:create alias account for 20 accounts') remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'for ((i=1;i<=10;i++));do imdbcontrol CreateAlias {1}$i u$i {2};done\''.format(mx_account,test_account_base,mx1_default_domain),root_account,root_passwd,0) remote_operations.remote_operation(mx2_host1_ip,'su - {0} -c \'for ((i=1;i<=10;i++));do imdbcontrol CreateAlias {1}$i u$i {2};done\''.format(mx_account,test_account_base,mx2_default_domain),root_account,root_passwd,0) remote_operations.remote_operation(mx1_mxos_host2_ip,'su - {0} -c "~/lib/imservctrl killStart mss mxos"'.format(mx_account),root_account,root_passwd,0) remote_operations.remote_operation(mx1_mxos_host1_ip,'su - {0} -c "~/lib/imservctrl killStart mss mxos"'.format(mx_account),root_account,root_passwd,0)
import basic_function import basic_class import imap_operations import smtp_operations import global_variables import remote_operations import time basic_class.mylogger_record.debug('Preparing... get some variables needed for tests') mx1_mta_host1_SMTPPort,mx1_mta_host1_ip,mx1_mxos_host2_eureka_port,mx1_mxos_host2_ip,mx1_mss_host2_ip,mx1_mss_host1_ip,mx1_popserv_host1,mx1_popserv_host1_pop3Port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,mx1_default_domain = \ global_variables.get_values('mx1_mta_host1_SMTPPort','mx1_mta_host1_ip','mx1_mxos_host2_eureka_port','mx1_mxos_host2_ip','mx1_mss_host2_ip','mx1_mss_host1_ip','mx1_popserv_host1','mx1_popserv_host1_pop3Port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','mx1_default_domain') basic_class.mylogger_record.info('step1:set keys and restart services') remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'imconfcontrol -install -key \"/*/common/blobStoreAmazonS3Key=blobtier otosankey\";imconfcontrol -install -key \"/*/common/blobStoreAmazonS3KeyId=blobtier otosan\";imconfcontrol -install -key \"/*/common/hostInfo=blobtier=S3:scality.otosan.opwv:80\";imconfcontrol -install -key \"/*/common/messageBodyEncryptionEnabled=false\";imconfcontrol -install -key \"/*/mss/compressionEnabled=false\"\''.format(mx_account),root_account,root_passwd,0) remote_operations.remote_operation(mx1_mss_host1_ip,'su - {0} -c \'~/lib/imservctrl killStart mss\''.format(mx_account),root_account,root_passwd,0) remote_operations.remote_operation(mx1_mss_host2_ip,'su - {0} -c \'~/lib/imservctrl killStart mss\''.format(mx_account),root_account,root_passwd,0) #remote_operations.remote_operation(mx1_mxos_host2_ip,'su - {0} -c \'~/lib/imservctrl killStart mxos\''.format(mx_account),root_account,root_passwd,0) basic_class.mylogger_record.info('sleeping 20 seconds') time.sleep(30) basic_class.mylogger_record.info('step2:create 2 accounts') remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'for ((i=1;i<=2;i++));do account-create {1}$i@{2} {1}$i default;done\''.format(mx_account,test_account_base,mx1_default_domain),root_account,root_passwd,1,'Mailbox Created Successfully',2) remote_operations.remote_operation(mx1_host1_ip,'su - {0} -c \'for ((i=1;i<=2;i++));do immsgdelete {1}$i@{2} -all;done\''.format(mx_account,test_account_base,mx1_default_domain),root_account,root_passwd,0) time.sleep(3) basic_class.mylogger_record.info('step3:deliever 1 message from testuser2 to testuser1') smtp_operations.fast_send_mail(mx1_mta_host1_ip,mx1_mta_host1_SMTPPort,'testuser2',[test_account_base+'1']) time.sleep(3)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import basic_function import basic_class import imap_operations import global_variables import time import remote_operations import stat_statistics basic_class.mylogger_record.debug( 'Preparing... get some variables needed for tests') mx1_mss_host1_ip,mx1_mss_host2_ip,mx1_imapserv_host1_ip,mx1_imapserv_host1_imap4Port,mx1_mta_host1_ip,mx1_mta_host1_SMTPPort,mx1_popserv_host1_ip,mx1_popserv_host1_pop3Port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,mx1_default_domain = \ global_variables.get_values('mx1_mss_host1_ip','mx1_mss_host2_ip','mx1_imapserv_host1_ip','mx1_imapserv_host1_imap4Port','mx1_mta_host1_ip','mx1_mta_host1_SMTPPort','mx1_popserv_host1_ip','mx1_popserv_host1_pop3Port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','mx1_default_domain') basic_class.mylogger_record.info('step1:delete 6 accounts') remote_operations.remote_operation( mx1_host1_ip, 'su - {0} -c \'for ((i=1;i<=6;i++));do account-delete {1}$i@{2};done\''. format(mx_account, test_account_base, mx1_default_domain), root_account, root_passwd, 1, 'Mailbox Deleted Successfully', 6) basic_class.mylogger_record.info('step2:restore keys') remote_operations.remote_operation( mx1_host1_ip, 'su - {0} -c \'imconfcontrol -install -key \"/*/common/reportParamsInterval=60\";imconfcontrol -install -key \"/*/mta/subAddressAllowedIPs=127.0.0.1\";imconfcontrol -install -key \"/site1-inbound-standardmta-direct/mta/subAddressAllowedIPs=127.0.0.1\";imconfcontrol -install -key \"/*/common/perfStatThresholds=\"\'' .format(mx_account), root_account, root_passwd, 0)
# /*/common/reportParamsInterval: [60] # default 60 # /*/common/badPasswordDelay: [1] # nodelay ,default 1 # /*/common/maxBadPasswordDelay: [90] # no delay,default 90 import basic_function import basic_class import imap_operations import global_variables import remote_operations mx2_imap1_host_ip,mx2_mss1_host_ip,mx2_mta1_port,mx2_mta1_host_ip,mx2_host1_ip,mx2_pop1_port,mx2_pop1_host,mx2_imap1_port,mx2_imap1_host,mx1_mss1_host_ip,mx1_mss2_host_ip,mx1_imap1_host_ip,mx1_imap1_port,mx1_mta1_host_ip,mx1_mta1_port,mx1_pop1_host_ip,mx1_pop1_port,mx_account,mx1_host1_ip,root_account,root_passwd,test_account_base,default_domain = \ global_variables.get_values('mx2_imap1_host_ip','mx2_mss1_host_ip','mx2_mta1_port','mx2_mta1_host_ip','mx2_host1_ip','mx2_pop1_port','mx2_pop1_host','mx2_imap1_port','mx2_imap1_host','mx1_mss1_host_ip','mx1_mss2_host_ip','mx1_imap1_host_ip','mx1_imap1_port','mx1_mta1_host_ip','mx1_mta1_port','mx1_pop1_host_ip','mx1_pop1_port','mx_account','mx1_host1_ip','root_account','root_passwd','test_account_base','default_domain') basic_class.mylogger_record.info('step1:delete alias accounts for 10 accounts') remote_operations.remote_operation( mx1_host1_ip, root_account, root_passwd, 'su - {0} -c \'for ((i=1;i<=10;i++));do imdbcontrol DeleteAlias u$i {2};done\'' .format(mx_account, test_account_base, default_domain), 0) remote_operations.remote_operation( mx2_host1_ip, root_account, root_passwd, 'su - {0} -c \'for ((i=1;i<=10;i++));do imdbcontrol DeleteAlias u$i {2};done\'' .format(mx_account, test_account_base, default_domain), 0) basic_class.mylogger_record.info('step1:delete 10 accounts') remote_operations.remote_operation( mx1_host1_ip, root_account, root_passwd, 'su - {0} -c \'for ((i=1;i<=10;i++));do account-delete {1}$i@{2};done\''. format(mx_account, test_account_base, default_domain), 1, 'Mailbox Deleted Successfully', 10) remote_operations.remote_operation( mx2_host1_ip, root_account, root_passwd, 'su - {0} -c \'for ((i=1;i<=10;i++));do account-delete {1}$i@{2};done\''.