[asterisk-scf-commits] asterisk-scf/integration/testsuite.git branch "review" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Mon Aug 29 17:00:09 CDT 2011


branch "review" has been updated
       via  10a847793d35a4ba4908ae77a80686145f09704b (commit)
      from  a0818e07f695a8a462b1d66781e0fa2e1a7ace12 (commit)

Summary of changes:
 Server.py                     |   60 +++++++++++++++++++++----
 configs/GlobalVars.py         |   15 +++++-
 lib/python/DB.py              |  100 +++++++++++++++++++++++++++++++++++++++++
 lib/python/Logging.py         |    3 +
 lib/python/RPC.py             |   20 +++++----
 plugins/asteriskscf_icebox.py |    6 +-
 plugins/build.py              |   38 ++++++++--------
 plugins/siprtp.py             |    4 +-
 plugins/testsuite_remotes.py  |    2 +-
 plugins/wireshark.py          |   12 +++---
 10 files changed, 208 insertions(+), 52 deletions(-)
 create mode 100644 lib/python/DB.py


- Log -----------------------------------------------------------------
commit 10a847793d35a4ba4908ae77a80686145f09704b
Author: Darren Sessions <dsessions at digium.com>
Date:   Mon Aug 29 11:06:20 2011 -0500

    Added database support into the test-suite to log test and plugin activity. Modified the global rpc variable to make rpc an object instead of a dictionary.

diff --git a/Server.py b/Server.py
index bbe4003..f037afe 100755
--- a/Server.py
+++ b/Server.py
@@ -30,6 +30,7 @@ from GlobalVars import globalVars
 
 globalVars.cwd = cdir
 
+import DB
 import RPC
 import Info
 import Misc
@@ -70,14 +71,26 @@ class TestSuiteServer(Misc.Utils, Plugin.Loader, RPC.BaseClass):
         res = self.readFile(globalVars.remoteAgentsListFile, yamlBool=True)
         if res['success'] == False:
             self.fatalError('Unable to load remote agent list!')
+
         globalVars.remoteAgents = res['data']
 
+        if globalVars.mode == 'testing':
+            res = DB.Postgres().startup()
+            if res['success'] == False:
+                self.fatalError('Unable to initialize the database connection! %s' % res['msg'])
+
         res = Yaml.Load().testData()
         if res['success'] == False:
             self.fatalError('Unable to load tests!\n\n %s' % res['msg'])
 
         self.main(res['data'])
 
+        if globalVars.mode == 'testing':
+            res = DB.Postgres().shutdown()
+            if res['success'] == False:
+                self.fatalError('Unable to stop db session properly! %s' % res['msg'])
+    
+
     def main(self, yamlData):
         errorMsgs = []
         pluginData = {}
@@ -108,7 +121,7 @@ class TestSuiteServer(Misc.Utils, Plugin.Loader, RPC.BaseClass):
             print >> sys.stderr, '\n Unable to restart remote agents. %s' % res['msg'] 
             return
 
-        time.sleep(1)
+        time.sleep(.5)
 
         for host in globalVars.remoteAgents:
             res = self.rpcConnect([host, 'rpc', 'ipv4'])
@@ -125,9 +138,9 @@ class TestSuiteServer(Misc.Utils, Plugin.Loader, RPC.BaseClass):
                     break
                 if globalVars.mode == 'testing':
                     x, categoryElement = JUnitXML.xml().addTestSuite(x, testCategory)
-                    print >> sys.stderr, "\n Starting '%s' Tests . . \n --------------------------------------------------------" % testCategory
+                    print >> sys.stderr, "\n Starting '%s' Tests . . \n " % testCategory + '-'*55
                 else:
-                    print >> sys.stderr, "\n Creating the '%s' wiki page . .\n --------------------------------------------------------" % testCategory
+                    print >> sys.stderr, "\n Creating the '%s' wiki page . .\n " % testCategory + '-'*55
 
                 docsPluginData = {testCategory:{}}
           
@@ -146,6 +159,17 @@ class TestSuiteServer(Misc.Utils, Plugin.Loader, RPC.BaseClass):
 
                         docsPluginData[testCategory][testData['name']] = {'testData':testData['docs'],'tests':{}}
 
+                    if globalVars.mode == 'testing':
+                        ''' Insert initial test-case information into the database '''
+                        sql = '''INSERT INTO testcases (session_uuid, testcase_uuid, category_name, testcase_name) VALUES ('%s', DEFAULT, '%s', '%s') RETURNING testcase_uuid''' % \
+                            (globalVars.db.uuid.session, testCategory, testData['name'])
+                        res = globalVars.db.execute(sql, retRecs=True)
+                        if res['success'] == False:
+                            print >> sys.stderr, 'Unable to insert test information into the DB! %s' % res['msg']
+                            break
+                        globalVars.db.uuid.testcase = res['records'][0][0]
+
+                    ''' Sub-Test processing loop '''
                     for subTestCase in testData['tests']:
                         timerStart = datetime.datetime.now()
                         if stopTests == True:
@@ -166,7 +190,6 @@ class TestSuiteServer(Misc.Utils, Plugin.Loader, RPC.BaseClass):
                             if res['success'] == False:
                                 print >> sys.stderr, '   |- FATAL ERROR SETTING TESTINFO ON REMOTES!! %s' % res['msg']
                                 return
-
                             if globalVars.mode == 'testing':
                                 testElement, subTestElement = JUnitXML.xml().addTestCase(testElement, testName)
                             elif globalVars.mode == 'docs':
@@ -178,6 +201,16 @@ class TestSuiteServer(Misc.Utils, Plugin.Loader, RPC.BaseClass):
                                 if 'expected_failure' in subTestCase[testName]:
                                     if subTestCase[testName]['expected_failure'] == True:
                                        subTestElement = JUnitXML.xml().setProperty(subTestElement, 'expected_failure', subTestCase[testName]['expected_failure'])
+                           
+                                if globalVars.mode == 'testing': 
+                                    ''' Insert test information into the database '''
+                                    sql = '''INSERT INTO tests (testcase_uuid, test_uuid, testcase_name, test_name) VALUES ('%s', DEFAULT, '%s', '%s') RETURNING test_uuid''' % \
+                                        (globalVars.db.uuid.testcase, testData['name'], testName)
+                                    res = globalVars.db.execute(sql, retRecs=True)
+                                    if res['success'] == False:
+                                        print >> sys.stderr, 'Unable to insert test information into the DB! %s' % res['msg']
+                                        break
+                                    globalVars.db.uuid.test = res['records'][0][0]
 
                                 ''' execute testcase timeline '''
                                 for timeLine in subTestCase[testName]['timeline']:
@@ -252,10 +285,19 @@ class TestSuiteServer(Misc.Utils, Plugin.Loader, RPC.BaseClass):
 
                                     print >> sys.stderr, '   |- ' + testName + ' - %s - %s.%s seconds' % (passedMsg, timerDelta.seconds, timerDelta.microseconds)
                                     subTestElement = JUnitXML.xml().setProperty(subTestElement, 'time', '%s.%s' % (timerDelta.seconds, timerDelta.microseconds))
+                                    
                             else:
                                 print >> sys.stderr, '   |- ' + testName + ' - FAILED!\n    \- No test data defined!'
                                 subTestElement, errorMsgs = JUnitXML.xml().addFailure(subTestElement, ['No test data defined!'])
                                 break
+
+                            if globalVars.mode == 'testing':
+                                sql = '''UPDATE tests SET runtime = '%s.%s', success = '%s', msg = '%s' WHERE test_uuid = '%s' ''' % \
+                                    (timerDelta.seconds, timerDelta.microseconds, globalVars.testSuccess, globalVars.testMsg, globalVars.db.uuid.test)
+                                res = globalVars.db.execute(sql)
+                                if res['success'] == False:
+                                    print >> sys.stderr, 'Unable to insert test information into the DB! %s' % res['msg']
+                                    break
                     
                     if stopTests == True:
                         break
@@ -264,7 +306,7 @@ class TestSuiteServer(Misc.Utils, Plugin.Loader, RPC.BaseClass):
                     results = file.file().read('%s/docs/%s_page_template.confluence' % (cwd, list[testCategory]['docs']['template']))
                     if results['success'] == False:
                         print >> sys.stderr, "Fatal! Unable to open the '%s' page template." % list[testCategory]['docs']['template']
-                        sys.exit(1)
+                        return
 
                     pageTemplate = results['fd']
                     pageTemplate = pageTemplate.replace('!!OVERVIEW!!', list[testCategory]['docs']['overview'])
@@ -278,7 +320,7 @@ class TestSuiteServer(Misc.Utils, Plugin.Loader, RPC.BaseClass):
                             results = file.file().read('%s/docs/%s_test_template.confluence' % (cwd, docsPluginData[docCategory][docTestCase]['testData']['template']))
                             if results['success'] == False:
                                 print >> sys.stderr, "Fatal! Unable to open the '%s' test template." % list[testCategory]['docs']['template']
-                                sys.exit(1)
+                                return
 
                             testTemplate = results['fd']
                             testTemplate = testTemplate.replace('!!TITLE!!', docTestCase)
@@ -324,9 +366,9 @@ class TestSuiteServer(Misc.Utils, Plugin.Loader, RPC.BaseClass):
                     confluence.process(list[testCategory]['docs']['title'], list[testCategory]['docs']['space'], list[testCategory]['docs']['parentPage'], pageTemplate, list[testCategory]['lastModDates'])
 
         if globalVars.mode == 'testing':
-            results = self.writeFile('!!CWD!!/testsuite_results.xml', JUnitXML.xml().prettyXml(x))
-            if results['success'] == False:
-                print >> sys.stderr, '\n\n Unable to generate XML test results file. %s' % results['msg']
+            res = self.writeFile('!!CWD!!/testsuite_results.xml', JUnitXML.xml().prettyXml(x))
+            if res['success'] == False:
+                print >> sys.stderr, '\n\n Unable to generate XML test results file. %s' % res['msg']
 
         return
 
diff --git a/configs/GlobalVars.py b/configs/GlobalVars.py
index 37d47d5..567d695 100644
--- a/configs/GlobalVars.py
+++ b/configs/GlobalVars.py
@@ -17,13 +17,22 @@ import os
 import sys
 
 class globalVars:
+
+    class db:
+        class uuid:
+            pass
+
+        dsn = "host='testsuite-db-1.digium.internal' dbname=testsuite user=testsuite-server password=changeme1234"
+
+    class rpc:
+        cmd = {}
+        proxy = {}
+        count = 0
+    
     debug = False
     pname = os.path.split(sys.argv[0])[1]
     mode = ''
 
-    rpcCmd = {}
-    rpcProxy = {}
-
     testInfo = {}
     remoteInfo = {}
     hostInfo = {'interfaceList':[], 'plat':'', 'arch':'', 'hostname':'', 'fqdn':''}
diff --git a/lib/python/DB.py b/lib/python/DB.py
new file mode 100644
index 0000000..654c5b7
--- /dev/null
+++ b/lib/python/DB.py
@@ -0,0 +1,100 @@
+'''
+
+ Database Support Class
+
+ Test-Suite - Copyright (C) 2011, Digium, Inc.
+ 
+ Written by Darren Sessions
+
+ See http://wiki.asterisk.org for more information.
+
+ This program is free software, distributed under the 
+ terms of the GNU General Public License Version 2.
+
+'''
+
+from GlobalVars import globalVars
+
+import sys
+import psycopg2
+
+import Misc
+
+class Postgres(Misc.Utils):
+    def startup(self):
+        res = self.__connect()
+        if res['success'] == False:
+            return res
+        res = self.__startSession()
+        if res['success'] == False:
+            return res
+        return self.resSuccess()
+
+    def shutdown(self):
+        res = self.__stopSession()
+        if res['success'] == False:
+            return res
+        res = self.__disconnect()
+        if res['success'] == False:
+            return res
+        return self.resSuccess()
+
+    def genUUID(self):
+        res = globalVars.db.execute('''SELECT uuid_generate_v4()''')
+        if res['success'] == False:
+            return res
+        if len(res['records'][0][0] > 0):
+            return self.resSuccess(addRes={'uuid':res['records'][0][0]})
+        else:
+            return self.resFailure('Unable to generate UUID!')
+
+    def __connect(self):
+        try:
+            self.con = psycopg2.connect(globalVars.db.dsn)
+            self.con.autocommit = True
+            self.cur = self.con.cursor()
+        except:
+            return self.resFailure('Unable to connect to database! %s' % sys.exc_info()[1])
+        globalVars.db.execute = self.__execute
+        return self.resSuccess()
+
+    def __disconnect(self):
+        try:
+            self.cur.close()
+            self.con.close()
+        except:
+            pass
+        return self.resSuccess()
+
+    def __startSession(self):
+        res = globalVars.db.execute('''INSERT INTO sessions (session_uuid, start) VALUES (DEFAULT, NOW()) RETURNING session_uuid''', retRecs=True)
+        if res['success'] == False:
+            return res
+        globalVars.db.uuid.session = res['records'][0][0]
+        return self.resSuccess()
+
+    def __stopSession(self):
+        sql  = '''UPDATE sessions SET stop = NOW(), rpc_calls = %s, runtime = NOW() - start ''' % globalVars.rpc.count
+        sql += '''WHERE session_uuid = '%s' RETURNING runtime''' % globalVars.db.uuid.session
+        res = globalVars.db.execute(sql, retRecs=True)
+        if res['success'] == False:
+            return res
+        res = res['records'][0][0]
+        print >> sys.stderr, '\n\n    ----------- Session UUID -----------'
+        print >> sys.stderr, '    %s' % globalVars.db.uuid.session
+        print >> sys.stderr, '    ' + '-'*(22 + len(str(res))) + '\n    Total execution time: %s' % res + '\n    ' + '-'*(22 + len(str(res)))
+        return self.resSuccess()
+
+    def __execute(self, sql, retRecs=False):
+        try:
+            self.cur.execute(sql)
+        except:
+            return self.resFailure('Unable to execute \'%s\'! %s' % (sql, sys.exc_info()[1]))
+        if retRecs:
+            try:
+                rec = self.cur.fetchall()
+            except:
+                return self.resFailure('No records returned! %s' % sys.exc_info()[1])
+            return self.resSuccess(addRes={'records':rec})
+        else:
+            return self.resSuccess()
diff --git a/lib/python/Logging.py b/lib/python/Logging.py
index c81272d..7ce5137 100644
--- a/lib/python/Logging.py
+++ b/lib/python/Logging.py
@@ -53,3 +53,6 @@ class Artifacts:
             if res['success'] == False:
                 return res
 
+class Stats:
+    def master_log(self):
+        res = globalVars.db.execute('''INSERT INTO master_log VALUES (
diff --git a/lib/python/RPC.py b/lib/python/RPC.py
index b4d93b0..8ca39e2 100644
--- a/lib/python/RPC.py
+++ b/lib/python/RPC.py
@@ -40,18 +40,18 @@ class BaseClass(Misc.Utils):
         if override == False:
             try:
                 globalVars.remoteInfo[host[0]]
-                globalVars.rpcProxy[host[0]] = xmlrpclib.Server('http://%s:8000' % globalVars.remoteInfo[host[0]]['ifaceInfo'][host[1]][host[2]])
+                globalVars.rpc.proxy[host[0]] = xmlrpclib.Server('http://%s:8000' % globalVars.remoteInfo[host[0]]['ifaceInfo'][host[1]][host[2]])
             except:
                 globalVars.remoteInfo[host[0]] = {}
-                globalVars.rpcProxy[host[0]] = xmlrpclib.Server('http://%s:8000' % host[0])
+                globalVars.rpc.proxy[host[0]] = xmlrpclib.Server('http://%s:8000' % host[0])
                 try:
-                    globalVars.remoteInfo[host[0]]['ifaceInfo'], globalVars.remoteInfo[host[0]]['hostInfo'] = globalVars.rpcProxy[host[0]].hostInfo()
+                    globalVars.remoteInfo[host[0]]['ifaceInfo'], globalVars.remoteInfo[host[0]]['hostInfo'] = globalVars.rpc.proxy[host[0]].hostInfo()
                 except:
                     return self.resFailure('Invalid response from the %s remote agent while getting host information. %s' % (host[0], sys.exc_info()[1]))
 
             try:
                 timerStart = datetime.datetime.now().second
-                if not globalVars.rpcProxy[host[0]].ping() == 'pong':
+                if not globalVars.rpc.proxy[host[0]].ping() == 'pong':
                     return self.resFailure('%s did not PONG!' % host[0])
                 timerDelta = datetime.datetime.now().second - timerStart
             except:
@@ -61,13 +61,13 @@ class BaseClass(Misc.Utils):
                 print "\n!!WARNING!! - RPC connect times to '%s' are exceeding normal thresholds and may affect test times.\n" % host[0]
     
             if globalVars.mode == 'testing' or globalVars.mode == 'rpc':
-                globalVars.rpcCmd[host[0]] = BaseClass.rpcExec(host[0])._runCmd
+                globalVars.rpc.cmd[host[0]] = BaseClass.rpcExec(host[0])._runCmd
                 return self.resSuccess()
             elif globalVars.mode == 'docs':
-                globalVars.rpcProxy[host[0]] = self._docCmd
+                globalVars.rpc.proxy[host[0]] = self._docCmd
                 return self.resSuccess()
         else:
-            globalVars.rpcProxy[host[0]] = None
+            globalVars.rpc.proxy[host[0]] = None
             return self.resSuccess()
 
     class rpcExec:
@@ -84,13 +84,14 @@ class BaseClass(Misc.Utils):
         def _runCmd(self, cmd, *args):
             msg = {}
             try:
-                func = getattr(globalVars.rpcProxy[self.host], cmd)
+                func = getattr(globalVars.rpc.proxy[self.host], cmd)
             except AttributeError:
                 msg = {'success':False,'msg':"Unable to execute '%s' on %s. %s" % (cmd, self.host, sys.exc_info())}
             else:
                 try:
                     results = func(*args)
                     results['remote'] = self.host
+                    globalVars.rpc.count += 1
                     return results
                 except:
                     msg = {'success':False,'msg':"Unable to execute '%s' on %s. %s" % (cmd, self.host, sys.exc_info())}
@@ -118,6 +119,7 @@ class BaseClass(Misc.Utils):
         ipc = {}
         parent = False
         for host in hosts:
+            globalVars.rpc.count += 1
             ipc[host] = {'pid':0}
             ipc[host]['r'], ipc[host]['w'] = os.pipe()
             ipc[host]['pid'] = os.fork()
@@ -128,7 +130,7 @@ class BaseClass(Misc.Utils):
             else:
                 os.close(ipc[host]['r'])
                 ipc = os.fdopen(ipc[host]['w'], 'w')
-                ipc.write("%s" % globalVars.rpcCmd[host](*cmd))
+                ipc.write("%s" % globalVars.rpc.cmd[host](*cmd))
                 ipc.flush()
                 os._exit(0)
         if parent:
diff --git a/plugins/asteriskscf_icebox.py b/plugins/asteriskscf_icebox.py
index a67b536..9ad3919 100644
--- a/plugins/asteriskscf_icebox.py
+++ b/plugins/asteriskscf_icebox.py
@@ -53,17 +53,17 @@ class plugin(Plugin.BaseClass):
                     time.sleep(.5)
                     configArgs['config'] = '%s_%s' % (component, testData['cmd']['start']['mode'])
 
-                    res = globalVars.rpcCmd[testData['remote_agent']]('writeFile', '!!TMP!!/%s.conf' % component, self.configGen(configArgs))
+                    res = globalVars.rpc.cmd[testData['remote_agent']]('writeFile', '!!TMP!!/%s.conf' % component, self.configGen(configArgs))
                     if res['success'] == False:
                         return res
         
                     self.cleanup('tempFile', '%s.conf' % component)
 
-                    res = globalVars.rpcCmd[testData['remote_agent']]('setEnvVar', 'libpath', '!!TMP!!/gitall/build/lib')
+                    res = globalVars.rpc.cmd[testData['remote_agent']]('setEnvVar', 'libpath', '!!TMP!!/gitall/build/lib')
                     if res['success'] == False:
                         return res
 
-                    res = globalVars.rpcCmd[testData['remote_agent']]('run', 'asteriskscf_icebox', component, [iceBoxCmd[0], "%s%s.conf" % (iceBoxCmd[1], component)])
+                    res = globalVars.rpc.cmd[testData['remote_agent']]('run', 'asteriskscf_icebox', component, [iceBoxCmd[0], "%s%s.conf" % (iceBoxCmd[1], component)])
                     if res['success'] == False:
                         return res
 
diff --git a/plugins/build.py b/plugins/build.py
index a3e2061..d6b925f 100644
--- a/plugins/build.py
+++ b/plugins/build.py
@@ -73,7 +73,7 @@ class plugin(Plugin.BaseClass):
 
             if testData['cmd']['dl_type'] == 'wget':
                 if 'dl_unpack' in testData['cmd']:
-                    globalVars.rpcCmd[host]('removeFile', '!!TMP!!/%s' % testData['cmd']['dl_unpack'])
+                    globalVars.rpc.cmd[host]('removeFile', '!!TMP!!/%s' % testData['cmd']['dl_unpack'])
                 else:
                     return self.resFailure('A file must be specified to unpack with wget.')
 
@@ -83,33 +83,33 @@ class plugin(Plugin.BaseClass):
                 if refreshCmd[0] == 'git':
                     refreshCmd[0] = 'git.cmd'
             
-            res = globalVars.rpcCmd[host]('changeDir', '!!TMP!!')    
+            res = globalVars.rpc.cmd[host]('changeDir', '!!TMP!!')    
             if res['success'] == False:
                 return res
 
             if update == True and not testData['cmd']['dl_type'] == 'wget':
-                res = globalVars.rpcCmd[host]('changeDir', '!!TMP!!/%s' % testData['cmd']['cd'])
+                res = globalVars.rpc.cmd[host]('changeDir', '!!TMP!!/%s' % testData['cmd']['cd'])
                 if res['success'] == True:
-                    res = globalVars.rpcCmd[host]('run', 'build', testData['cmd']['dl_url'], refreshCmd, True)
+                    res = globalVars.rpc.cmd[host]('run', 'build', testData['cmd']['dl_url'], refreshCmd, True)
                     if res['success'] == False:
                         return res
                 else:
-                    res = globalVars.rpcCmd[host]('run', 'build', testData['cmd']['dl_url'], getCmd, True)
+                    res = globalVars.rpc.cmd[host]('run', 'build', testData['cmd']['dl_url'], getCmd, True)
                     if res['success'] == False:
                         return res
             else:
-                globalVars.rpcCmd[host]('removeDir', testData['cmd']['cd'])
+                globalVars.rpc.cmd[host]('removeDir', testData['cmd']['cd'])
 
-                res = globalVars.rpcCmd[host]('run', 'build', testData['cmd']['dl_url'], getCmd, True)
+                res = globalVars.rpc.cmd[host]('run', 'build', testData['cmd']['dl_url'], getCmd, True)
                 if res['success'] == False:
                     return res
 
-            res = globalVars.rpcCmd[host]('changeDir', '!!TMP!!')
+            res = globalVars.rpc.cmd[host]('changeDir', '!!TMP!!')
             if res['success'] == False:
                 return res
 
             if 'dl_unpack' in testData['cmd']:
-                res = globalVars.rpcCmd[host]('untar', '!!TMP!!/%s' % testData['cmd']['dl_unpack'], '!!TMP!!')
+                res = globalVars.rpc.cmd[host]('untar', '!!TMP!!/%s' % testData['cmd']['dl_unpack'], '!!TMP!!')
                 if res['success'] == False:
                     return res
 
@@ -120,27 +120,27 @@ class plugin(Plugin.BaseClass):
                         if res['success'] == False:
                             return res
 
-                        res = globalVars.rpcCmd[host]('writeFile', '!!TMP!!/%s' % patch, res['data'])
+                        res = globalVars.rpc.cmd[host]('writeFile', '!!TMP!!/%s' % patch, res['data'])
                         if res['success'] == False:
                             return res
 
-                        res = globalVars.rpcCmd[host]('run', 'build', patch, ['patch', patchList[patch], '!!TMP!!/%s' % patch, '-u', '--verbose'], True)
+                        res = globalVars.rpc.cmd[host]('run', 'build', patch, ['patch', patchList[patch], '!!TMP!!/%s' % patch, '-u', '--verbose'], True)
                         if res['success'] == False:
                             return res
 
             if 'make_cmd' in testData['cmd']:
                 for cmds in testData['cmd']['make_cmd']:
                     if 'cd' in testData['cmd']:
-                        res = globalVars.rpcCmd[host]('changeDir', '!!TMP!!/%s' % testData['cmd']['cd'])
+                        res = globalVars.rpc.cmd[host]('changeDir', '!!TMP!!/%s' % testData['cmd']['cd'])
                         if res['success'] == False:
                             return res
 
                     if cmds.split(' ')[0] == 'cd':
-                        res = globalVars.rpcCmd[host]('changeDir', '!!TMP!!/%s' % cmds.split(' ')[1])
+                        res = globalVars.rpc.cmd[host]('changeDir', '!!TMP!!/%s' % cmds.split(' ')[1])
                         if res['success'] == False:
                             return res
                     else:
-                        res = globalVars.rpcCmd[host]('run', 'build', cmds, cmds.split(' '), True)
+                        res = globalVars.rpc.cmd[host]('run', 'build', cmds, cmds.split(' '), True)
                         if res['success'] == False:
                             return res
             
@@ -149,7 +149,7 @@ class plugin(Plugin.BaseClass):
                     return {'success':False,'msg':'The restribute element requires the remotes and send_dir options.'}
                 else:
                     try:
-                        globalVars.rpcCmd[host]('removeFile', '!!TMP!!/tmp.tar.gz')
+                        globalVars.rpc.cmd[host]('removeFile', '!!TMP!!/tmp.tar.gz')
                     except:
                         pass
 
@@ -157,21 +157,21 @@ class plugin(Plugin.BaseClass):
                         testData['cmd']['redistribute']['preserve_dir_structure'] = False
 
                     if re.search('!!TMP!!', testData['cmd']['redistribute']['send_dir']):
-                        res = globalVars.rpcCmd[host]('changeDir', '!!TMP!!')
+                        res = globalVars.rpc.cmd[host]('changeDir', '!!TMP!!')
                         if res['success'] == False:
                             return res
 
                         testData['cmd']['redistribute']['send_dir'] = testData['cmd']['redistribute']['send_dir'].replace('!!TMP!!/', '')
 
-                    res = globalVars.rpcCmd[host]('tar', '!!TMP!!/tmp.tar.gz', [testData['cmd']['redistribute']['send_dir']])
+                    res = globalVars.rpc.cmd[host]('tar', '!!TMP!!/tmp.tar.gz', [testData['cmd']['redistribute']['send_dir']])
                     if res['success'] == False:
                         return res
 
-                    res = globalVars.rpcCmd[host]('readFile', '!!TMP!!/tmp.tar.gz', False, True)
+                    res = globalVars.rpc.cmd[host]('readFile', '!!TMP!!/tmp.tar.gz', False, True)
                     if res['success'] == False:
                         return res
 
-                    res = globalVars.rpcCmd[host]('remoteSendFile', '!!TMP!!/tmp.tar.gz', testData['cmd']['redistribute']['remotes'])
+                    res = globalVars.rpc.cmd[host]('remoteSendFile', '!!TMP!!/tmp.tar.gz', testData['cmd']['redistribute']['remotes'])
                     if res['success'] == False:
                         return res
                     
diff --git a/plugins/siprtp.py b/plugins/siprtp.py
index dfc53ba..8d1c3db 100644
--- a/plugins/siprtp.py
+++ b/plugins/siprtp.py
@@ -78,12 +78,12 @@ class plugin(Plugin.BaseClass):
 
             execCmd = ['%s/siprtp' % siprtpLoc[globalVars.remoteInfo[testData['cmd'][mode]['remote_agent']]['hostInfo']['plat']]] + execCmd
 
-            res = globalVars.rpcCmd[testData['cmd'][mode]['remote_agent']]('run', 'siprtp', 'mode', execCmd, waitForPidToFinish)
+            res = globalVars.rpc.cmd[testData['cmd'][mode]['remote_agent']]('run', 'siprtp', 'mode', execCmd, waitForPidToFinish)
             if res['success'] == False:
                 return res
      
             if mode == 'uac':   
-                res = globalVars.rpcCmd[testData['cmd'][mode]['remote_agent']]('readFile', res['logFilePath'], False, False, False)                
+                res = globalVars.rpc.cmd[testData['cmd'][mode]['remote_agent']]('readFile', res['logFilePath'], False, False, False)                
                 if res['success'] == False:
                     return res
 
diff --git a/plugins/testsuite_remotes.py b/plugins/testsuite_remotes.py
index a153472..21946f2 100644
--- a/plugins/testsuite_remotes.py
+++ b/plugins/testsuite_remotes.py
@@ -48,7 +48,7 @@ class plugin(Plugin.BaseClass):
                 return res
 
             for remote in globalVars.remoteAgents:
-                res = globalVars.rpcCmd[remote]('readFile', '!!TMP!!/tmp.tar.gz', False, False, True)
+                res = globalVars.rpc.cmd[remote]('readFile', '!!TMP!!/tmp.tar.gz', False, False, True)
                 if res['success'] == False:
                     return res
 
diff --git a/plugins/wireshark.py b/plugins/wireshark.py
index 1d08bf4..278a7d6 100644
--- a/plugins/wireshark.py
+++ b/plugins/wireshark.py
@@ -75,14 +75,14 @@ class plugin(Plugin.BaseClass):
                     '-w',
                     '/tmp/capture.pcap']
        
-                res = globalVars.rpcCmd[testData['remote_agent']]('run', 'wireshark', 'start', runCmd) 
+                res = globalVars.rpc.cmd[testData['remote_agent']]('run', 'wireshark', 'start', runCmd) 
                 if res['success'] == False:
                     return res
 
                 return res
 
             elif cmd == 'stop':
-                res = globalVars.rpcCmd[testData['remote_agent']]('moveFile', '/tmp/capture.pcap', '!!TMP!!/artifacts/%s/%s.capture.pcap' % (globalVars.testInfo['testLogs'], globalVars.remoteInfo[testData['remote_agent']]['hostInfo']['hostname']))
+                res = globalVars.rpc.cmd[testData['remote_agent']]('moveFile', '/tmp/capture.pcap', '!!TMP!!/artifacts/%s/%s.capture.pcap' % (globalVars.testInfo['testLogs'], globalVars.remoteInfo[testData['remote_agent']]['hostInfo']['hostname']))
                 if res['success'] == False:
                     return res
 
@@ -91,21 +91,21 @@ class plugin(Plugin.BaseClass):
                         if testData['cmd']['stop']['call_flow_graph'] == False:
                             return res
 
-                res = globalVars.rpcCmd[testData['remote_agent']]('changeDir', '!!TMP!!/artifacts/%s' % globalVars.testInfo['testLogs'])
+                res = globalVars.rpc.cmd[testData['remote_agent']]('changeDir', '!!TMP!!/artifacts/%s' % globalVars.testInfo['testLogs'])
                 if res['success'] == False:
                     return res
 
-                res = globalVars.rpcCmd[testData['remote_agent']]('run', 'wireshark', 'callflow', ['callflow', '%s.capture.pcap' % globalVars.remoteInfo[testData['remote_agent']]['hostInfo']['hostname']], True)
+                res = globalVars.rpc.cmd[testData['remote_agent']]('run', 'wireshark', 'callflow', ['callflow', '%s.capture.pcap' % globalVars.remoteInfo[testData['remote_agent']]['hostInfo']['hostname']], True)
                 if res['success'] == False:
                     return res
 
                 callflowDir = '!!TMP!!/artifacts/%s/%s.capture' % (globalVars.testInfo['testLogs'], globalVars.remoteInfo[testData['remote_agent']]['hostInfo']['hostname'])
 
-                res = globalVars.rpcCmd[testData['remote_agent']]('moveFile', '%s/index.html' % callflowDir, '%s/index_standard.html' % callflowDir)
+                res = globalVars.rpc.cmd[testData['remote_agent']]('moveFile', '%s/index.html' % callflowDir, '%s/index_standard.html' % callflowDir)
                 if res['success'] == False:
                     return res
 
-                res = globalVars.rpcCmd[testData['remote_agent']]('moveFile', '%s/index_with_frames.html' % callflowDir, '%s/index.html' % callflowDir)
+                res = globalVars.rpc.cmd[testData['remote_agent']]('moveFile', '%s/index_with_frames.html' % callflowDir, '%s/index.html' % callflowDir)
                 if res['success'] == False:
                     return res
             else: 

-----------------------------------------------------------------------


-- 
asterisk-scf/integration/testsuite.git



More information about the asterisk-scf-commits mailing list