Professional Documents
Culture Documents
returnResult = fnVerifyMIPSfileInStatistics(rsTestData)
Case "VERIFY NDS FILE"
returnResult = fnverifyNDSfile(rsTestData)
Case "VERIFY MBMON"
returnResult = fnverifyMBMON(rsTestData)
'##################################################################################
##########
'Function Name: fnVerifyMIPSfileInStatistics
'Purpose: This function will navigate to Statistics directory and verify patern
'Input Parameters: rsTestData
'Output Parameters: Pass/Fail
'Date: 25-April-2016
'Author/POC: Manoja
'##################################################################################
##########
Function fnVerifyMIPSfileInStatistics(rsTestData)
End Function
'##################################################################################
##########
'Function Name: fnverifyNDSfile
'Purpose: This function is used to verify NDS file created or not.
'Input Parameters: rsTestData
'Output Parameters: Pass/Fail
'Date: 06-May-2016
'Author/POC: Manoja
'##################################################################################
##########
Function fnverifyNDSfile(rsTestData)
'##################################################################################
##########
'Function Name: fnverifyMBMON
'Purpose: This function is used to verify MBMON file
'Input Parameters: rsTestData
'Output Parameters: Pass/Fail
'Date: 06-May-2016
'Author/POC: Manoja
'##################################################################################
##########
Function fnverifyMBMON(rsTestData)
------------------------------------------------------------
Python
--------------------------------------------------------------
In in UnixSystem.py
--------------------------
if sys.argv[1].upper() == "VERIFYMIPSFILEINSTATISTICS":
resultFlag = commonLib.fnVerifyMIPSfileInStatistics(ArgStr)
if sys.argv[1].upper() == "VERIFYNDSFILE":
resultFlag = commonLib.fnverifyNDSfile(ArgStr)
if sys.argv[1].upper() == "VERIFYMBMON":
resultFlag = commonLib.fnVerifyMBMON(ArgStr)
In commonLib.py
-----------------------
'''****************************************************
Function Name: fnVerifyMIPSfileInStatistics
Purpose: This function will navigate to Statistics directory and take latest MIPS
file and search patern
Input Parameters: N/A
Output Parameters: True/False
Date: 25-April-2016
Author/POC: Manoja
****************************************************'''
def fnVerifyMIPSfileInStatistics(ArgStr):
sFile = "cd /opt/criticalpath/global/statistics/ && ls MIPS_Statistics*|
tail -1"
p=subprocess.Popen(sFile,stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True)
errStr = p.stderr.read()
out_p = p.stdout.read()
out_put= out_p[:-1]
if errStr !="":
fnlogs("Command: "+ sFile + " is not executed successfully.\n")
fnlogs("Error: \n" + errStr + "\n")
return False
else:
cmd = "grep " + "\"" + ArgStr + "\" " +
"/opt/criticalpath/global/statistics/"+out_put
p=subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True)
err_Str = p.stderr.read()
if err_Str !="":
fnlogs("Command: "+ cmd + " is not executed successfully.\n")
fnlogs("Error: \n" + err_Str + "\n")
return False
else:
output = p.stdout.read()
if output != "":
fnlogs("Statistics Record is Correct !!!\n")
return True
else:
fnlogs("Statistics Record does'nt Exist!!!\n")
return False
'''****************************************************
Function Name: fnverifyNDSfile
Purpose: The function is used to verify NDS file
Input Parameters: N/A
Output Parameters: True/False
Date: 06-May-2016
Author/POC: Manoja
****************************************************'''
def fnverifyNDSfile(ArgStr):
cmd = "cd /var/cti/logs/nds/ && ls access_log_nds.* | tail -1"
p=subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True)
errStr = p.stderr.read()
out_p = p.stdout.read()
out_put= out_p[:-1]
if errStr !="":
fnlogs("Command: "+ cmd + " is not executed successfully.\n")
fnlogs("Error: \n" + errStr + "\n")
return False
else:
cmds = "grep " + "\"" + ArgStr + "\" " +
"/var/cti/logs/nds/"+out_put
p=subprocess.Popen(cmds,stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True)
time.sleep(2)
err_Str = p.stderr.read()
if err_Str !="":
fnlogs("Command: "+ cmds + " is not executed successfully.\n")
fnlogs("Error: \n" + err_Str + "\n")
return False
else:
output = p.stdout.read()
if output != "":
fnlogs("NDS Record is Correct !!!\n")
return True
else:
fnlogs("NDS Record does'nt Exist!!!\n")
return False
'''****************************************************
Function Name: fnVerifyMBMON
Purpose: This function will navigate to MBMON directory and take latest file and
search patern
Input Parameters: N/A
Output Parameters: True/False
Date: 25-April-2016
Author/POC: Manoja
****************************************************'''
def fnVerifyMBMON(ArgStr):
sList1 = ArgStr[0]
sList2 = ArgStr[1]
mFile = "cd /opt/MIPS/logs/dsu3/mbmon && ls|tail -1"
p=subprocess.Popen(mFile,stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True)
errStr = p.stderr.read()
out_p = p.stdout.read()
out_put= out_p[:-1]
if errStr !="":
fnlogs("Command: "+ mFile + " is not executed successfully.\n")
fnlogs("Error: \n" + errStr + "\n")
return False
else:
cmd = "grep " + "\"" +sList1 + "\" " +
"/opt/MIPS/logs/dsu3/mbmon/"+out_put
p=subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True)
err_Str = p.stderr.read()
if err_Str !="":
fnlogs("Command: "+ cmd + " is not executed successfully.\n")
fnlogs("Error: \n" + err_Str + "\n")
return False
else:
output = p.stdout.read()
if output != "":
fnlogs("MBMON Record is Correct !!!\n")
else:
fnlogs("MBMON Record does'nt Exist!!!\n")
return False
cmd = "grep " + "\"" + sList2 + "\" " +
"/opt/MIPS/logs/dsu3/mbmon/"+out_put
p=subprocess.Popen(cmd,stdout=subprocess.PIPE,stderr=subprocess.PIPE,shell=True)
err_Str = p.stderr.read()
if err_Str !="":
fnlogs("Command: "+ cmd + " is not executed successfully.\n")
fnlogs("Error: \n" + err_Str + "\n")
return False
else:
output = p.stdout.read()
if output != "":
fnlogs("MBMON Record is Correct !!!\n")
return True
else:
fnlogs("MBMON Record does'nt Exist!!!\n")
return False