[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 May 23 08:39:53 CDT 2011


branch "review" has been updated
       via  8881969fbc604aacd60984580457659f65d7bd68 (commit)
       via  9b24c751288025a72273aea14c7f56c1ecc8e2a3 (commit)
      from  1dabebd9c765a442db0c490d46c0d6cfdb84cbd8 (commit)

Summary of changes:
 lib/python/util.py                                 |   35 ++++--
 plugins/asteriskscf_configurator.py                |    4 -
 plugins/asteriskscf_icebox.py                      |   13 +--
 plugins/failover.py                                |   42 ++++++
 plugins/sipp.py                                    |   12 +-
 remote.py                                          |    7 +
 .../testcase.yaml                                  |  131 ++++++++++++--------
 tests/failover/tests.yaml                          |    4 +-
 .../testcase.yaml                                  |    2 +-
 tests/sip/tests.yaml                               |    4 +-
 tests/tests.yaml                                   |    1 +
 11 files changed, 168 insertions(+), 87 deletions(-)
 create mode 100644 plugins/failover.py
 rename tests/sip/{SysTest_Functional_BasicCallSetup => SysTest_Functional_Basic_CallSetup}/testcase.yaml (98%)


- Log -----------------------------------------------------------------
commit 8881969fbc604aacd60984580457659f65d7bd68
Author: Darren Sessions <dsessions at digium.com>
Date:   Mon May 23 08:39:49 2011 -0500

    worked on failover plugin and associated testcase for basic failover. cleanup work on several of the plugins.

diff --git a/lib/python/util.py b/lib/python/util.py
index 0618755..af4341c 100644
--- a/lib/python/util.py
+++ b/lib/python/util.py
@@ -20,6 +20,7 @@ import xmlrpclib
 
 from xml.dom import minidom
 from xml.etree.ElementTree import Element, SubElement, tostring
+from urlparse import urlparse
 
 class TestSuiteBaseClass:
     def run(self, testData, testPath):
@@ -36,6 +37,16 @@ class TestSuiteRemoteBaseClass:
         rpc = xmlrpclib.Server('http://%s:8000' % testData['testsuite_remote'])
         return self.main(testData, testPath, rpc)
 
+class url:
+    def fetchRepoName(self, url):
+        repoName = ''
+        url = urlparse(url)
+        if not url[0] == 'git' and not url[0] == 'svn':
+            return {'success':False,'msg':'The URL must be a properly formatted git or svn url.'}
+        for part in url[2].split('/'):
+            repoName = part
+        return {'success':True,'repoName':repoName}
+
 class plugins:
     def execute(self, name, module, testData, testPath):
         try:
diff --git a/plugins/asteriskscf_icebox.py b/plugins/asteriskscf_icebox.py
index 8bed557..22bc46c 100644
--- a/plugins/asteriskscf_icebox.py
+++ b/plugins/asteriskscf_icebox.py
@@ -15,11 +15,6 @@ class testsuite(util.TestSuiteRemoteBaseClass):
     def main(self, testData, testPath, rpc):
         iceBoxCmd = ['/opt/Ice-3.4.1/bin/icebox', '--Ice.Config=!!TMP!!/']
 
-        if not 'testsuite_remote' in testData:
-            return {'success':False,'msg':'No testsuite remote specified.'}
-        if not 'cmd' in testData:
-            return {'success':False,'msg':'No command specified.'}
-
         ''' start and stop individual components. shutdown is implemented in the main testsuite code ''' 
         for cmd in testData['cmd']:
             if cmd == 'start':
diff --git a/plugins/failover.py b/plugins/failover.py
index efc17e7..5cc5a9f 100644
--- a/plugins/failover.py
+++ b/plugins/failover.py
@@ -13,12 +13,30 @@ import util
 
 class testsuite(util.TestSuiteRemoteBaseClass):
     def main(self, testData, testPath, rpc):
-        for cmd in testData['cmd']:
-            for mode in cmd:
-                if not 'uac' in mode and not 'uas' in mode:
-                    return {'success':False,'msg':'Unsupported configuration (modes).'}
-                config[mode] = cmd[mode]
+        corosyncExec = ['corosync','-f']
+        pacemakerExec = ['pacemaker']
 
-        return {'success':True,'shutdownExempt':True}
+        ''' start and stop individual components. shutdown is implemented in the main testsuite code ''' 
+        for cmd in testData['cmd']:
+            if cmd == 'start':
+                for component in testData['cmd']['start']:
+                    print component
+                    #results = rpc.writeFile('%s.conf' % component, '\n'.join(self._componentConfig(component)))
+                    #if results['success'] == False:
+                    #    return results
+                    #results = rpc.setEnvVar('libpath', '!!TMP!!/gitall/build/lib')
+                    #if results['success'] == False:
+                    #    return results
+                    #results = rpc.run('asteriskscf_icebox', component, [iceBoxCmd[0], "%s%s.conf" % (iceBoxCmd[1], component)])
+                    #if results['success'] == False:
+                    #    return results
+            elif cmd == 'stop':
+                print 'stop'
+            else:
+                return {'success':False,'msg':'The %s command is invalid.' % cmd}
+
+        return {'success':False}
+
+        return {'success':True}
 
     def _componentConfig(self, mode, config, testPath):
diff --git a/remote.py b/remote.py
index 612a142..a57c9cc 100755
--- a/remote.py
+++ b/remote.py
@@ -38,6 +38,7 @@ class RemoteManagement(object):
         return {'success':True,'msg':'Nothing running.'}
 
     def run(self, plugin, label, execCmd, wait = False):
+        os.chdir(cwd)
         if plugin in processList:
             if label in processList[plugin]:
                 return {'success':False,'msg':'%s executed by the %s plugin is already running.' % (label, plugin)}
@@ -139,6 +140,12 @@ class RemoteManagement(object):
 
         return {'success':True}
 
+    def cd(self, dir):
+        if not os.path.exists('%s/tmp/%s' % (cwd, dir)):
+            return {'success':False,'msg':'The %s path does not exist.'}
+        os.chdir('%s/tmp/%s' % (cwd, dir))
+        return {'success'}
+
     def writeFile(self, fn, fd):
         if not os.path.exists('%s/tmp' % cwd):
             os.makedirs('%s/tmp' % cwd)
diff --git a/tests/failover/SysTest_Functional_BasicCallSetupFailover/testcase.yaml b/tests/failover/SysTest_Functional_BasicCallSetupFailover/testcase.yaml
index 92d62fa..c2816e8 100644
--- a/tests/failover/SysTest_Functional_BasicCallSetupFailover/testcase.yaml
+++ b/tests/failover/SysTest_Functional_BasicCallSetupFailover/testcase.yaml
@@ -6,13 +6,25 @@ options :
 tests :
     - ipv4toipv4 :
         expected_failure : False 
-        timeline:
+        timeline :
             - failover :
-                testsuite_remote_master : box1
-                testsuite_remote_slave : box2
+                testsuite_remote : box1
                 cmd :
                     start :
-                        - corosync:
+                        - corosync :
+                            token : 160
+                            token_retransmits_before_loss_const : 3
+                            join : 30
+                            consensus : 300
+                            max_messages : 20
+                            ipv4oripv6 : ipv4
+                        - pacemaker :
+                            shared_ip : testsuite-shared-ipv4.digium.internal
+            - failover :
+                testsuite_remote : box2
+                cmd :
+                    start :
+                        - corosync :
                             token : 160
                             token_retransmits_before_loss_const : 3
                             join : 30
diff --git a/tests/failover/tests.yaml b/tests/failover/tests.yaml
index 60af77b..5d47be3 100644
--- a/tests/failover/tests.yaml
+++ b/tests/failover/tests.yaml
@@ -1,2 +1,2 @@
-tests:
-    - testcase: SysTest_Functional_BasicCallSetupFailover
+tests :
+    - testcase : SysTest_Functional_BasicCallSetupFailover
diff --git a/tests/sip/SysTest_Functional_BasicCallSetup/testcase.yaml b/tests/sip/SysTest_Functional_Basic_CallSetup/testcase.yaml
similarity index 98%
rename from tests/sip/SysTest_Functional_BasicCallSetup/testcase.yaml
rename to tests/sip/SysTest_Functional_Basic_CallSetup/testcase.yaml
index 15d78bb..67cd7ba 100644
--- a/tests/sip/SysTest_Functional_BasicCallSetup/testcase.yaml
+++ b/tests/sip/SysTest_Functional_Basic_CallSetup/testcase.yaml
@@ -1,4 +1,4 @@
-name : SysTest_Functional_BasicCallSetup
+name : SysTest_Functional_Basic_CallSetup
 options : 
     network_captures: True
     call_flow_diagrams: True
diff --git a/tests/sip/tests.yaml b/tests/sip/tests.yaml
index 7d58a75..ab1dbb1 100644
--- a/tests/sip/tests.yaml
+++ b/tests/sip/tests.yaml
@@ -1,2 +1,2 @@
-tests:
-    - testcase: SysTest_Functional_BasicCallSetup
+tests :
+    - testcase : SysTest_Functional_Basic_CallSetup
diff --git a/tests/tests.yaml b/tests/tests.yaml
index 1ae294f..a865e43 100644
--- a/tests/tests.yaml
+++ b/tests/tests.yaml
@@ -1,3 +1,4 @@
 tests :
+    - tests : build
     - tests : sip
 #    - tests : failover

commit 9b24c751288025a72273aea14c7f56c1ecc8e2a3
Author: Darren Sessions <dsessions at digium.com>
Date:   Fri May 20 08:40:46 2011 -0500

    Updated the remote base class used in the plugins to pull the remote node data from the test data. Created a placeholder python script for the failover plugin. Updated the plugins that use the remote script to include an rpc argument for remote calls.

diff --git a/lib/python/util.py b/lib/python/util.py
index 13a17fa..0618755 100644
--- a/lib/python/util.py
+++ b/lib/python/util.py
@@ -16,27 +16,25 @@ import imp
 import sys
 import time
 import inspect
+import xmlrpclib
 
 from xml.dom import minidom
 from xml.etree.ElementTree import Element, SubElement, tostring
 
 class TestSuiteBaseClass:
-    def run(self, testData, testPath, remote=None):
+    def run(self, testData, testPath):
+        if not 'cmd' in testData:
+            return {'success':False,'msg':'No command specified.'}
         return self.main(testData, testPath)
 
 class TestSuiteRemoteBaseClass:
-    def run(self, testData, testPath, remote=None):
-        if 'remote' == None:
+    def run(self, testData, testPath):
+        if not 'cmd' in testData:
+            return {'success':False,'msg':'No command specified.'}
+        if not 'testsuite_remote' in testData:
             return {'success':False,'msg':'No testsuite remote specified.'}
-        results = self._connect(remote)
-        if results['success'] == False:
-            return results
-        return self.main(testData, testPath)
-
-    def _connect(self, remote):
-        import xmlrpclib
-        self.remote = xmlrpclib.Server('http://%s:8000' % remote)
-        return {'success':True}
+        rpc = xmlrpclib.Server('http://%s:8000' % testData['testsuite_remote'])
+        return self.main(testData, testPath, rpc)
 
 class plugins:
     def execute(self, name, module, testData, testPath):
@@ -83,7 +81,7 @@ class plugins:
             return {'success':False,'msg':'The "main" method in the "testsuite" class in "%s" is not responding properly. %s.' % (name, sys.exc_info())}
 
         argCheck = inspect.getargspec(module.testsuite().main)
-        if argCheck[0] != ['self','testData', 'testPath']:
+        if argCheck[0] != ['self','testData', 'testPath'] and argCheck[0] != ['self','testData', 'testPath', 'rpc']:
             return {'success':False,'msg':"The 'main' method in the 'testsuite' class within '%s' has improperly labeled args! i.e. def main(self, testData, testPath)." % name}
 
         return {'success':True}
diff --git a/plugins/asteriskscf_configurator.py b/plugins/asteriskscf_configurator.py
index 3a569f3..dc76b83 100644
--- a/plugins/asteriskscf_configurator.py
+++ b/plugins/asteriskscf_configurator.py
@@ -26,10 +26,6 @@ import AsteriskSCF.System.Configuration.V1
 
 class testsuite(util.TestSuiteBaseClass):
     def main(self, testData, testPath):
-        if not 'testsuite_remote' in testData:
-            return {'success':False,'msg':'No testsuite remote specified.'}
-        if not 'cmd' in testData:
-            return {'success':False,'msg':'No command specified.'}
         if not 'configuration_wipe' in testData:
             testData['configuration_wipe'] = None
 
diff --git a/plugins/asteriskscf_icebox.py b/plugins/asteriskscf_icebox.py
index 836fe64..8bed557 100644
--- a/plugins/asteriskscf_icebox.py
+++ b/plugins/asteriskscf_icebox.py
@@ -12,7 +12,7 @@
 import util
 
 class testsuite(util.TestSuiteRemoteBaseClass):
-    def main(self, testData, testPath):
+    def main(self, testData, testPath, rpc):
         iceBoxCmd = ['/opt/Ice-3.4.1/bin/icebox', '--Ice.Config=!!TMP!!/']
 
         if not 'testsuite_remote' in testData:
@@ -24,13 +24,13 @@ class testsuite(util.TestSuiteRemoteBaseClass):
         for cmd in testData['cmd']:
             if cmd == 'start':
                 for component in testData['cmd']['start']:
-                    results = self.remote.writeFile('%s.conf' % component, '\n'.join(self._componentConfig(component)))
+                    results = rpc.writeFile('%s.conf' % component, '\n'.join(self._componentConfig(component)))
                     if results['success'] == False:
                         return results
-                    results = self.remote.setEnvVar('libpath', '!!TMP!!/gitall/build/lib')
+                    results = rpc.setEnvVar('libpath', '!!TMP!!/gitall/build/lib')
                     if results['success'] == False:
                         return results
-                    results = self.remote.run('asteriskscf_icebox', component, [iceBoxCmd[0], "%s%s.conf" % (iceBoxCmd[1], component)])
+                    results = rpc.run('asteriskscf_icebox', component, [iceBoxCmd[0], "%s%s.conf" % (iceBoxCmd[1], component)])
                     if results['success'] == False:
                         return results
             elif cmd == 'stop':
diff --git a/plugins/failover.py b/plugins/failover.py
new file mode 100644
index 0000000..efc17e7
--- /dev/null
+++ b/plugins/failover.py
@@ -0,0 +1,24 @@
+'''
+
+ Failover Plugin
+
+ Copyright (C) 2011, Digium, Inc.
+
+ This program is free software, distributed under the terms of
+ the GNU General Public License Version 2.
+
+'''
+
+import util
+
+class testsuite(util.TestSuiteRemoteBaseClass):
+    def main(self, testData, testPath, rpc):
+        for cmd in testData['cmd']:
+            for mode in cmd:
+                if not 'uac' in mode and not 'uas' in mode:
+                    return {'success':False,'msg':'Unsupported configuration (modes).'}
+                config[mode] = cmd[mode]
+
+        return {'success':True,'shutdownExempt':True}
+
+    def _componentConfig(self, mode, config, testPath):
diff --git a/plugins/sipp.py b/plugins/sipp.py
index 7637852..be5410b 100644
--- a/plugins/sipp.py
+++ b/plugins/sipp.py
@@ -12,7 +12,7 @@
 import util
 
 class testsuite(util.TestSuiteRemoteBaseClass):
-    def main(self, testData, testPath):
+    def main(self, testData, testPath, rpc):
         config = {}
         modes = ['uas', 'uac']
 
@@ -27,27 +27,27 @@ class testsuite(util.TestSuiteRemoteBaseClass):
    
         for mode in modes:
             if mode in config:
-                results = self.remote.run('sipp', mode, self._componentConfig(mode, config[mode], testPath))
+                results = rpc.run('sipp', mode, self._componentConfig(mode, config[mode], testPath, rpc))
                 if results['success'] == False:
                     return results
 
         return {'success':True,'shutdownExempt':True}
 
-    def _loadScenarioFile(self, fp, fn):
+    def _loadScenarioFile(self, fp, fn, rpc):
         fd = util.file().read(fp + '/' + fn)
-        return self.remote.writeFile(fn, fd)
+        return rpc.writeFile(fn, fd)
     
     def _execBuilder(self, list, string):
         for execBlock in string.rsplit(' '):
             list.append(execBlock)
         return list
 
-    def _componentConfig(self, mode, config, testPath):
+    def _componentConfig(self, mode, config, testPath, rpc):
         execCmd = ['sipp']
 
         ''' general options '''
         if 'scenario_file' in config:
-            results = self._loadScenarioFile(testPath, config['scenario_file'])
+            results = self._loadScenarioFile(testPath, config['scenario_file'], rpc)
             if results['success'] == False:
                return results
             execCmd = self._execBuilder(execCmd, '-sf !!TMP!!/%s' % config['scenario_file'])
diff --git a/tests/failover/SysTest_Functional_BasicCallSetupFailover/testcase.yaml b/tests/failover/SysTest_Functional_BasicCallSetupFailover/testcase.yaml
index 77938ab..92d62fa 100644
--- a/tests/failover/SysTest_Functional_BasicCallSetupFailover/testcase.yaml
+++ b/tests/failover/SysTest_Functional_BasicCallSetupFailover/testcase.yaml
@@ -1,55 +1,74 @@
 name : SysTest_Functional_BasicCallSetupFailover
-options :
+options : 
     network_captures: True
     call_flow_diagrams: True
+    restart_persistant_plugins_between_tests: False
 tests :
-    ipv4toipv4 :
+    - ipv4toipv4 :
         expected_failure : False 
         timeline:
-            asteriskscf_icebox :
-                testsuite_remote : testsuite-remote-1
-                start :
-                    - service_locator_replicator
-                    - service_locator
-                    - bridge_replicator
-                    - bridge
-                    - sip_state_replicator
-                    - sip_session_manager :
-                        - testsuite_remote : testsuite-remote-2
-            asteriskscf_icebox :
-                testsuite_remote : testsuite-remote-1
-                start :
-                    - service_locator_replicator
-                    - service_locator
-                    - bridge_replicator
-                    - bridge
-                    - sip_state_replicator
-                    - sip_session_manager :
-                        - testsuite_remote : testsuite-remote-2
-            asteriskscf_configurator :
-                testsuite_remote : testsuite-remote-2, testsuite-remote-1
-                endpoints :
-                    sipp-v4 :
-                        host : testsuite-remote-3
-                        port : 5061
-                    session-v4 :
-                        host : testsuite-remote-4
-                        port : 5062
-            failover:
-                testsuite_remote : testsuite-remote-1
-                queue_failure_delay_in_secs : 30
-            sipp:
-                uac :
-                    uac_testsuite_remote : testsuite-remote-4
-                    transport : ipv4
-                    scenario :
-                        builtin : uac
-                    calls : 1000
-                    cps : 5
-                uas :
-                    uas_testsuite_remote : testsuite-remote-5
-                    transport : ipv4
-                    scenario :
-                        builtin : uac
-    ipv6toipv6 :
-
+            - failover :
+                testsuite_remote_master : box1
+                testsuite_remote_slave : box2
+                cmd :
+                    start :
+                        - corosync:
+                            token : 160
+                            token_retransmits_before_loss_const : 3
+                            join : 30
+                            consensus : 300
+                            max_messages : 20
+                            ipv4oripv6 : ipv4
+                        - pacemaker :
+                            shared_ip : testsuite-shared-ipv4.digium.internal
+            - asteriskscf_icebox :
+                testsuite_remote : testsuite-server.digium.internal
+                cmd :
+                    start :
+                        - service_locator_replicator
+                        - service_locator
+                        - logger_server
+                        - bridge_state_replicator
+                        - bridge
+                        - routing_state_replicator
+                        - routing
+                        - sip_state_replicator
+                        - sip_session_gateway
+                        - rtp_state_replicator
+            - asteriskscf_configurator :
+                testsuite_remote : testsuite-server.digium.internal
+                configuration_wipe : True
+                cmd :
+                    sip :
+                        - localhost_udp :
+                            type : transport_udp
+                            host : testsuite-shared-ipv4.digium.internal
+                            port : 5060
+                        - service :
+                            type : endpoint
+                            targethost : 10.19.139.77
+                            targetport : 5060
+                            direction : both
+                        - sipp :
+                            type : endpoint
+                            targethost : 10.19.139.79
+                            targetport : 5060
+                            direction : both
+            - sipp:
+                testsuite_remote : testsuite-remote-1.digium.internal
+                cmd :
+                    - uas :
+                        transport : udp
+            - sipp:
+                testsuite_remote : testsuite-remote-2.digium.internal
+                cmd :
+                    - uac :
+                        transport : udp
+                        calls : 10
+                        cps : 1
+                        duration : 10
+                        targethost : 10.19.139.80
+                        targetport : 5060
+    - ipv6toipv6 :
+    - ipv4toipv6 :
+    - ipv6toipv4 :

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


-- 
asterisk-scf/integration/testsuite.git



More information about the asterisk-scf-commits mailing list