no error when key does not exist in validation.yml
This commit is contained in:
parent
e0c171c434
commit
a0cb07e187
@ -14,6 +14,7 @@ import datetime
|
|||||||
# currently all checkers and validations and defined in this file
|
# currently all checkers and validations and defined in this file
|
||||||
from mpValidations import *
|
from mpValidations import *
|
||||||
from mpBurstBlocks import *
|
from mpBurstBlocks import *
|
||||||
|
from mpRefreshSetCsv import *
|
||||||
|
|
||||||
from yaml import load, dump
|
from yaml import load, dump
|
||||||
|
|
||||||
@ -28,6 +29,8 @@ parser.add_option("-l", "--logs", dest="logs_dir",
|
|||||||
help="Directory where to log", metavar="LOGSDIR" , default="./logs")
|
help="Directory where to log", metavar="LOGSDIR" , default="./logs")
|
||||||
parser.add_option("-r", "--repeat", dest="repeat",
|
parser.add_option("-r", "--repeat", dest="repeat",
|
||||||
help="Reuse existing logs", metavar="REPEAT" , default="")
|
help="Reuse existing logs", metavar="REPEAT" , default="")
|
||||||
|
parser.add_option("-c", "--clean-pcap", dest="clean", action="store_true",
|
||||||
|
help="Delete pcap from logs directory", metavar="CLEAN" , default="false")
|
||||||
|
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
@ -35,6 +38,7 @@ parser.add_option("-r", "--repeat", dest="repeat",
|
|||||||
tests_dir=options.tests_dir.rstrip("/")
|
tests_dir=options.tests_dir.rstrip("/")
|
||||||
logs_dir=options.logs_dir.rstrip("/")
|
logs_dir=options.logs_dir.rstrip("/")
|
||||||
repeat = options.repeat
|
repeat = options.repeat
|
||||||
|
clean = options.clean
|
||||||
|
|
||||||
# take timestamp, used as subdirectory in logs_dir
|
# take timestamp, used as subdirectory in logs_dir
|
||||||
timestamp=datetime.datetime.now().isoformat()
|
timestamp=datetime.datetime.now().isoformat()
|
||||||
@ -63,23 +67,24 @@ for test_name in [name for name in os.listdir(tests_dir) if os.path.isdir(os.pat
|
|||||||
copy(xpFile,destDir)
|
copy(xpFile,destDir)
|
||||||
copy(validation_file,destDir)
|
copy(validation_file,destDir)
|
||||||
#copy log files
|
#copy log files
|
||||||
for l in ["client.pcap" ,"command.log" ,"upmc.log" ,"upms.log" ,"client.pcap" ,"netcat_server_0.log" ,"netcat_client_0.log"]:
|
for l in ["client.pcap" ,"command.log" ,"upmc.log" ,"upms.log" ,"netcat_server_0.log" ,"netcat_client_0.log"]:
|
||||||
copy(l,destDir)
|
copy(l,destDir+"/")
|
||||||
|
|
||||||
# Run validations
|
# Run validations
|
||||||
with open(validation_file, 'r') as f:
|
with open(validation_file, 'r') as f:
|
||||||
validations = load(f)
|
validations = load(f)
|
||||||
if validations!=None:
|
if validations!=None:
|
||||||
for k in validations["checkers"].keys():
|
if validations["checkers"]!=None:
|
||||||
# Identify checker class
|
for k in validations["checkers"].keys():
|
||||||
name = k.title().replace("_","")+"Checker"
|
# Identify checker class
|
||||||
klass= globals()[name]
|
name = k.title().replace("_","")+"Checker"
|
||||||
# instantiate checker with validations and test_name
|
klass= globals()[name]
|
||||||
checker = klass(validations["checkers"], test_name, destDir)
|
# instantiate checker with validations and test_name
|
||||||
if checker.check():
|
checker = klass(validations["checkers"], test_name, destDir)
|
||||||
print checker.logs
|
if checker.check():
|
||||||
else:
|
print checker.logs
|
||||||
print checker.logs
|
else:
|
||||||
|
print checker.logs
|
||||||
if validations["aggregators"]!=None:
|
if validations["aggregators"]!=None:
|
||||||
for k in validations["aggregators"]:
|
for k in validations["aggregators"]:
|
||||||
# Identify checker class
|
# Identify checker class
|
||||||
@ -88,6 +93,8 @@ for test_name in [name for name in os.listdir(tests_dir) if os.path.isdir(os.pat
|
|||||||
# instantiate checker with validations and test_name
|
# instantiate checker with validations and test_name
|
||||||
agg = klass(validations, test_name, destDir)
|
agg = klass(validations, test_name, destDir)
|
||||||
print agg
|
print agg
|
||||||
|
if clean:
|
||||||
|
os.remove(destDir+"/client.pcap")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user