-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestExperimentConfigIO.py
89 lines (71 loc) · 3.57 KB
/
TestExperimentConfigIO.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#This file will read the XML data and make it available as JSON
import xmltodict
import logging
import json
import sys, traceback
from engine.Configuration.SystemConfigIO import SystemConfigIO
from engine.Configuration.ExperimentConfigIO import ExperimentConfigIO
import os
if __name__ == "__main__":
logging.getLogger().setLevel(logging.DEBUG)
logging.debug("Starting Program")
logging.debug("Instantiating Experiment Config IO")
e = ExperimentConfigIO.getInstance()
logging.info("Getting experiment folders and filenames")
[xmlExperimentFilenames, xmlExperimentNames] = e.getExperimentXMLFilenames()
logging.info("Contents: " + str(xmlExperimentFilenames) + " " + str(xmlExperimentNames))
###UNCOMMENT TO TEST ALL CONFIGS
#Process only the first one
# confignames = xmlExperimentNames
# for configname in confignames:
# # ####READ/WRITE Test for XML data
# logging.info("Reading XML data for " + str(configname))
# data = e.getExperimentXMLFileData(configname)
# logging.info("JSON READ:\r\n"+json.dumps(data))
# logging.info("Writing XML data for " + str(configname))
# e.writeExperimentXMLFileData(data, configname)
# logging.info("Reading XML data for " + str(configname))
# data = e.getExperimentXMLFileData(configname)
# logging.info("JSON READ:\r\n"+json.dumps(data))
# ####READ/WRITE Test for JSON data
# logging.info("Reading JSON data for " + str(configname))
# data = e.getExperimentJSONFileData(configname)
# logging.info("JSON READ:\r\n"+json.dumps(data))
# logging.info("Writing JSON data for " + str(configname))
# e.writeExperimentJSONFileData(data, configname)
# logging.info("Reading JSON data for " + str(configname))
# data = e.getExperimentJSONFileData(configname)
# logging.info("JSON READ:\r\n"+json.dumps(data))
# ####VM Rolled Out Data
# logging.info("Reading Experiment Roll Out Data for " + str(configname))
# data, numclones = e.getExperimentVMRolledOut(configname)
# logging.info("JSON READ:\r\n"+json.dumps(data))
# logging.debug("Experiment stop complete.")
###TEST A SINGLE CONFIG
#Process only the first one
#confignames = xmlExperimentNames
configname = "sample"
#for configname in confignames:
# ####READ/WRITE Test for XML data
logging.info("Reading XML data for " + str(configname))
data = e.getExperimentXMLFileData(configname)
logging.info("JSON READ:\r\n"+json.dumps(data))
logging.info("Writing XML data for " + str(configname))
e.writeExperimentXMLFileData(data, configname)
logging.info("Reading XML data for " + str(configname))
data = e.getExperimentXMLFileData(configname)
# logging.info("JSON READ:\r\n"+json.dumps(data))
####READ/WRITE Test for JSON data
logging.info("Reading JSON data for " + str(configname))
data = e.getExperimentJSONFileData(configname)
#logging.info("JSON READ:\r\n"+json.dumps(data))
logging.info("Writing JSON data for " + str(configname))
e.writeExperimentJSONFileData(data, configname)
logging.info("Reading JSON data for " + str(configname))
data = e.getExperimentJSONFileData(configname)
logging.info("JSON READ:\r\n"+json.dumps(data))
####VM Rolled Out Data
logging.info("Reading Experiment Roll Out Data for " + str(configname))
data, numclones = e.getExperimentVMRolledOut(configname)
logging.info("JSON READ:\r\n"+json.dumps(data))
logging.debug("Experiment stop complete.")