Add cli argument to use different .topo or .params files
- Add cli arguments
- Refactor xmlparser functions
- Cleaned up and fixed some logging
- main.testDir is now set to the directory where the test file is
located
- main.testsRoot is now set to the full path of TestON/tests/
- Fixed usages accordingly
Change-Id: I2a0f0c3728b5732b242a2e860e6538a6f3b65166
diff --git a/TestON/core/xmlparser.py b/TestON/core/xmlparser.py
index 12a3f61..d7af564 100644
--- a/TestON/core/xmlparser.py
+++ b/TestON/core/xmlparser.py
@@ -27,6 +27,7 @@
import xmldict
import re
+import os.path
class xmlparser:
@@ -49,23 +50,10 @@
else:
print "File name is not correct"
- def parseParams( self, paramsPath ):
+ def parseFile( self, fileName ):
'''
- It will take the params file path and will return the params dictionary
+ It will take a file path of an xml file and return the contents as a dictionary
'''
- paramsPath = re.sub( "\.", "/", paramsPath )
- paramsPath = re.sub( "tests|examples", "", paramsPath )
- params = self.parse( main.tests_path + paramsPath + ".params" )
- paramsAsString = str( params )
- return eval( paramsAsString )
-
- def parseTopology( self, topologyPath ):
- '''
- It will take topology file path and will return topology dictionary
- '''
- topologyPath = re.sub( "\.", "/", topologyPath )
- topologyPath = re.sub( "tests|examples", "", topologyPath )
- topology = self.parse( main.tests_path + topologyPath + ".topo" )
- topoAsString = str( topology )
- return eval( topoAsString )
+ contents = self.parse( fileName )
+ return eval( str( contents ) )