10 path = os.path.dirname(os.path.abspath(__file__))
11 tests_path = path + os.sep + 'tests'
12 node_tests_path = tests_path + os.sep + 'node'
13 slice_tests_path = tests_path + os.sep + 'slice'
15 def __init__(self, config_file = path+os.sep+'qa_config'):
18 execfile(config_file, self.__dict__)
20 raise "Could not find system config in %s" % config_file
23 self.auth['Username'] = self.PLC_ROOT_USER
24 self.auth['AuthString'] = self.PLC_ROOT_PASSWORD
25 self.auth['AuthMethod'] = 'password'
26 self.verbose = self.VERBOSE
29 # Try importing the API shell for direct api access.
30 # If that fails fall back to using xmlrpm
32 sys.path.append('/usr/share/plc_api')
33 from PLC.Shell import Shell
34 shell = Shell(globals = globals())
39 self.api_type = 'direct'
41 self.api = xmlrpclib.Server('https://%s/PLCAPI/' % self.PLC_API_HOST, allow_none = 1)
42 self.api_type = 'xmlrpc'
44 # try setting hostname and ip
45 self.hostname = socket.gethostname()
46 (stdout, stderr) = utils.popen("/sbin/ifconfig eth0 | grep 'inet addr'")
47 inet_addr = re.findall('inet addr:[0-9\.^\w]*', stdout[0])[0]
48 parts = inet_addr.split(":")
51 # Load list of node tests
52 valid_node_test_files = lambda name: not name.startswith('__init__') \
53 and not name.endswith('pyc')
54 node_test_files = os.listdir(self.node_tests_path)
55 self.node_test_files = filter(valid_node_test_files, node_test_files)