[asterisk-scf-commits] asterisk-scf/integration/testsuite.git branch "review" created.
Commits to the Asterisk SCF project code repositories
asterisk-scf-commits at lists.digium.com
Thu May 19 17:28:35 CDT 2011
branch "review" has been created
at 1dabebd9c765a442db0c490d46c0d6cfdb84cbd8 (commit)
- Log -----------------------------------------------------------------
commit 1dabebd9c765a442db0c490d46c0d6cfdb84cbd8
Author: Darren Sessions <dsessions at digium.com>
Date: Thu May 19 16:47:40 2011 -0500
updated yaml def
diff --git a/tests/sip/SysTest_Functional_BasicCallSetup/testcase.yaml b/tests/sip/SysTest_Functional_BasicCallSetup/testcase.yaml
index fb8c28a..15d78bb 100644
--- a/tests/sip/SysTest_Functional_BasicCallSetup/testcase.yaml
+++ b/tests/sip/SysTest_Functional_BasicCallSetup/testcase.yaml
@@ -7,8 +7,8 @@ tests :
- ipv4toipv4 :
expected_failure : False
timeline:
- - asteriskscf_icebox :
- testsuite_remote : 127.0.0.1
+ - asteriskscf_icebox :
+ testsuite_remote : testsuite-server.digium.internal
cmd :
start :
- service_locator_replicator
@@ -22,40 +22,39 @@ tests :
- sip_session_gateway
- rtp_state_replicator
- asteriskscf_configurator :
- testsuite_remote : 127.0.0.1
+ testsuite_remote : testsuite-server.digium.internal
configuration_wipe : True
cmd :
sip :
- - transport_udp :
- type : localhost-udp
- host : 127.0.0.1
+ - localhost_udp :
+ type : transport_udp
+ host : 10.19.139.80
port : 5060
- - endpoint :
- type : sipp
- targethost : 127.0.0.1
- targetport : 5061
+ - service :
+ type : endpoint
+ targethost : 10.19.139.77
+ targetport : 5060
direction : both
- - endpoint :
- type : session
- targethost : 127.0.0.1
- targetport : 5062
+ - sipp :
+ type : endpoint
+ targethost : 10.19.139.79
+ targetport : 5060
direction : both
- sipp:
- testsuite_remote : 127.0.0.1
+ testsuite_remote : testsuite-remote-1.digium.internal
+ cmd :
+ - uas :
+ transport : udp
+ - sipp:
+ testsuite_remote : testsuite-remote-2.digium.internal
cmd :
- uac :
transport : udp
- ip : 127.0.0.1
- port : 5061
calls : 10
- cps : 1
+ cps : 1
duration : 10
- targethost : 127.0.0.1
+ targethost : 10.19.139.80
targetport : 5060
- - uas :
- transport : udp
- ip : 127.0.0.1
- port : 5062
- ipv6toipv6 :
- ipv4toipv6 :
- ipv6toipv4 :
commit 4ce68110e308320949a58853184c2a43d083e328
Author: Darren Sessions <dsessions at digium.com>
Date: Thu May 19 16:46:37 2011 -0500
sipp plugin tweaks. configurator tweaks for endpoint support.
diff --git a/plugins/asteriskscf_configurator.py b/plugins/asteriskscf_configurator.py
index b93deec..3a569f3 100644
--- a/plugins/asteriskscf_configurator.py
+++ b/plugins/asteriskscf_configurator.py
@@ -65,6 +65,7 @@ class OptionMapper():
object = self.options[option][0]
except:
return
+
item = self.options[option][1]
item_name = self.options[option][2]
value = self.options[option][3]
@@ -288,11 +289,11 @@ class SipSectionVisitors(SectionVisitors):
self.groups.append(group)
def visit_unsupported(self, config, section):
- if config['type'] == 'transport-udp':
+ if config['type'] == 'transport_udp':
self.visit_transport_udp(config, section)
- elif config['type'] == 'transport-tcp':
+ elif config['type'] == 'transport_tcp':
self.visit_transport_tcp(config, section)
- elif config['type'] == 'transport-tls':
+ elif config['type'] == 'transport_tls':
self.visit_transport_tls(config, section)
elif config['type'] == 'endpoint':
self.visit_endpoint(config, section)
diff --git a/plugins/asteriskscf_icebox.py b/plugins/asteriskscf_icebox.py
index e13e095..836fe64 100644
--- a/plugins/asteriskscf_icebox.py
+++ b/plugins/asteriskscf_icebox.py
@@ -37,6 +37,7 @@ class testsuite(util.TestSuiteRemoteBaseClass):
print 'stop'
else:
return {'success':False,'msg':'The %s command is invalid.' % cmd}
+
return results
def _componentConfig(self, component):
diff --git a/plugins/sipp.py b/plugins/sipp.py
index a3a0cdf..7637852 100644
--- a/plugins/sipp.py
+++ b/plugins/sipp.py
@@ -26,12 +26,12 @@ class testsuite(util.TestSuiteRemoteBaseClass):
config[mode] = cmd[mode]
for mode in modes:
- print self._componentConfig(mode, config[mode], testPath)
- results = self.remote.run('sipp', mode, self._componentConfig(mode, config[mode], testPath))
- if results['success'] == False:
- return results
+ if mode in config:
+ results = self.remote.run('sipp', mode, self._componentConfig(mode, config[mode], testPath))
+ if results['success'] == False:
+ return results
- return {'success':True}
+ return {'success':True,'shutdownExempt':True}
def _loadScenarioFile(self, fp, fn):
fd = util.file().read(fp + '/' + fn)
@@ -53,10 +53,6 @@ class testsuite(util.TestSuiteRemoteBaseClass):
execCmd = self._execBuilder(execCmd, '-sf !!TMP!!/%s' % config['scenario_file'])
else:
execCmd = self._execBuilder(execCmd, '-sn %s' % mode)
- if 'ip' in config:
- execCmd = self._execBuilder(execCmd, '-ci %s' % config['ip'])
- if 'port' in config:
- execCmd = self._execBuilder(execCmd, '-cp %s' % config['port'])
if 'transport' in config:
if config['transport'] == 'udp':
execCmd = self._execBuilder(execCmd, '-t u1')
@@ -65,6 +61,12 @@ class testsuite(util.TestSuiteRemoteBaseClass):
elif config['transport'] == 'tls':
execCmd = self._execBuilder(execCmd, '-t l1')
+ ''' control interface settings '''
+ #if 'ip' in config:
+ # execCmd = self._execBuilder(execCmd, '-ci %s' % config['ip'])
+ #if 'port' in config:
+ # execCmd = self._execBuilder(execCmd, '-cp %s' % config['port'])
+
''' UAC specific options '''
if mode == 'uac':
if 'calls' in config:
@@ -76,4 +78,4 @@ class testsuite(util.TestSuiteRemoteBaseClass):
if 'targethost' in config and 'targetport' in config:
execCmd = self._execBuilder(execCmd, '%s:%s' % (config['targethost'], config['targetport']))
- return {'success':True,'execCmd':execCmd}
+ return execCmd
commit c3bd87fa2ec888ae1c1e6a753f75f187ba4eda43
Author: Darren Sessions <dsessions at digium.com>
Date: Thu May 19 15:26:16 2011 -0500
sipp plugin tweaks. minor fix to the icebox plugin.
diff --git a/plugins/asteriskscf_icebox.py b/plugins/asteriskscf_icebox.py
index 8edbd11..e13e095 100644
--- a/plugins/asteriskscf_icebox.py
+++ b/plugins/asteriskscf_icebox.py
@@ -52,7 +52,7 @@ class testsuite(util.TestSuiteRemoteBaseClass):
return [
'Ice.Default.CollocationOptimized=0',
'IceBox.InheritProperties=1',
- 'IceBox.Service.ServiceDiscovery=@service_locator:create',
+ 'IceBox.Service.ServiceDiscovery=service_locator:create',
'LocatorService.Proxy=LocatorService:tcp -p 4411',
'TopicManager.Proxy=AsteriskSCFIceStorm/TopicManager:default -p 10000',
'LoggerAdapter.Endpoints=default',
diff --git a/plugins/sipp.py b/plugins/sipp.py
index 639742a..a3a0cdf 100644
--- a/plugins/sipp.py
+++ b/plugins/sipp.py
@@ -26,6 +26,7 @@ class testsuite(util.TestSuiteRemoteBaseClass):
config[mode] = cmd[mode]
for mode in modes:
+ print self._componentConfig(mode, config[mode], testPath)
results = self.remote.run('sipp', mode, self._componentConfig(mode, config[mode], testPath))
if results['success'] == False:
return results
@@ -51,28 +52,28 @@ class testsuite(util.TestSuiteRemoteBaseClass):
return results
execCmd = self._execBuilder(execCmd, '-sf !!TMP!!/%s' % config['scenario_file'])
else:
- execCmd = self.execBuilder(execCmd, '-sn %s' % mode)
+ execCmd = self._execBuilder(execCmd, '-sn %s' % mode)
if 'ip' in config:
- execCmd = self.execBuilder(execCmd, '-ci %s' % config['ip'])
+ execCmd = self._execBuilder(execCmd, '-ci %s' % config['ip'])
if 'port' in config:
- execCmd = self.execBuilder(execCmd, '-cp %s' % config['port'])
+ execCmd = self._execBuilder(execCmd, '-cp %s' % config['port'])
if 'transport' in config:
if config['transport'] == 'udp':
- execCmd = self.execBuilder(execCmd, '-t u1')
+ execCmd = self._execBuilder(execCmd, '-t u1')
elif config['transport'] == 'tcp':
- execCmd = self.execBuilder(execCmd, '-t t1')
+ execCmd = self._execBuilder(execCmd, '-t t1')
elif config['transport'] == 'tls':
- execCmd = self.execBuilder(execCmd, '-t l1')
+ execCmd = self._execBuilder(execCmd, '-t l1')
''' UAC specific options '''
if mode == 'uac':
if 'calls' in config:
- execCmd = self.execBuilder(execCmd, '-m %s' % config['calls'])
+ execCmd = self._execBuilder(execCmd, '-m %s' % config['calls'])
if 'cps' in config:
- execCmd = self.execBuilder(execCmd, '-r %s' % config['cps'])
+ execCmd = self._execBuilder(execCmd, '-r %s' % config['cps'])
if 'duration' in config:
- execCmd = self.execBuilder(execCmd, '-d %s' % config['duration'])
+ execCmd = self._execBuilder(execCmd, '-d %s' % config['duration'])
if 'targethost' in config and 'targetport' in config:
- execCmd = self.execBuilder(execCmd, '%s:%s' % (config['targethost'], config['targetport']))
+ execCmd = self._execBuilder(execCmd, '%s:%s' % (config['targethost'], config['targetport']))
return {'success':True,'execCmd':execCmd}
diff --git a/remote.py b/remote.py
index d4abd5d..612a142 100755
--- a/remote.py
+++ b/remote.py
@@ -168,7 +168,7 @@ class RemoteManagement(object):
prog = os.path.join(path, app)
if if_exists(prog):
return prog
- return
+ return app
if __name__=='__main__':
server = SimpleXMLRPCServer.SimpleXMLRPCServer(('', 8000))
diff --git a/testsuite.py b/testsuite.py
index a463d44..adb5fca 100755
--- a/testsuite.py
+++ b/testsuite.py
@@ -81,13 +81,14 @@ class __main__:
if runResults['success'] == False:
print ' |- Test "' + testName + '" - FAILED!\n \- ' + runResults['msg']
subTestElement, errorMsgs = util.xml().addFailure(subTestElement, ['%s' % runResults['msg']])
-
+
+ ''' shutdown if 'restart_persistant_plugins_between_tests' is true or not specified '''
for host in [host for d in shutdownList for host in d]:
remote = xmlrpclib.Server('http://%s:8000' % host)
remote.shutdown(d[host])
print ' |- Test "' + testName + '" - PASSED!'
- # setProperty(self, element, key, val):
+ # setProperty(self, element, key, val): for xml results
else:
print ' |- Test "' + testName + '" - FAILED!\n \- No test data defined!'
subTestElement, errorMsgs = util.xml().addFailure(subTestElement, ['No test data defined!'])
commit 484ead220ec131fe0093d274565c5a3565ac3035
Author: Darren Sessions <dsessions at digium.com>
Date: Thu May 19 15:05:11 2011 -0500
tweak to check if the variable is set
diff --git a/remote.py b/remote.py
index 467d26b..d4abd5d 100755
--- a/remote.py
+++ b/remote.py
@@ -127,9 +127,10 @@ class RemoteManagement(object):
if not os.path.exists(val):
return {'success':False,'msg':'env var path does not exist'}
- for path in os.environ[varName].split(":"):
- if path == val:
- return {'success':True}
+ if varName in os.environ:
+ for path in os.environ[varName].split(":"):
+ if path == val:
+ return {'success':True}
try:
os.environ[varName] = "%s:%s" % (os.environ[varName], val)
commit 511153ee585abc02a98f0270bb80a2c6fefce545
Author: Darren Sessions <dsessions at digium.com>
Date: Thu May 19 15:03:21 2011 -0500
updated the set environment variable so that env vars are not being set twice . .
diff --git a/remote.py b/remote.py
index c2202c9..467d26b 100755
--- a/remote.py
+++ b/remote.py
@@ -31,8 +31,10 @@ class RemoteManagement(object):
list[plugin] = []
for label in processList[plugin]:
list[plugin].append(label)
+
if list:
return {'success':True,'msg':list}
+
return {'success':True,'msg':'Nothing running.'}
def run(self, plugin, label, execCmd, wait = False):
@@ -68,6 +70,7 @@ class RemoteManagement(object):
if not plugin in processList:
processList[plugin] = {}
+
if not label in processList[plugin]:
processList[plugin][label] = {'exec':' '.join(execCmd),'subprocess':p}
@@ -75,31 +78,39 @@ class RemoteManagement(object):
def stop(self, data):
if not 'plugin' in data and not 'label' in data:
- self.results = {'success':False,'msg':'A plugin name and label must be provided to stop a process.'}
- return
+ return {'success':False,'msg':'A plugin name and label must be provided to stop a process.'}
+
if not 'subprocess' in processList[data['plugin']][data['label']]:
- self.results = {'success':False,'msg':'Process information does not exist for "%s" in the "%s" process list.' % (data['label'], data['plugin'])}
- return
+ return {'success':False,'msg':'Process information does not exist for "%s" in the "%s" process list.' % (data['label'], data['plugin'])}
+
p = processList[data['plugin']][data['label']]['subprocess']
+
try:
os.kill(p.pid, 9)
except:
- return {"status":False,"msg":"Unable to kill pid # %d" % pid}
+ return {'success':False,"msg":"Unable to kill pid # %d" % pid}
+
+ return {'success':True}
def shutdown(self, plugin):
msg = []
if not plugin:
return {'success':False,'msg':'A plugin name to shutdown must be provided.'}
+
if not plugin in processList:
return {'success':False,'msg':'The "%s" plugin is not running.' % plugin}
+
for label in processList[plugin]:
try:
os.kill(processList[plugin][label]['subprocess'].pid, 9)
except:
msg.append("Unable to kill pid for %s in %s." % (label, plugin))
+
del processList[plugin]
+
if len(msg) > 0:
return {'success':False,'msg':' '.join(msg)}
+
return {'success':True}
def setEnvVar(self, name, val):
@@ -110,24 +121,34 @@ class RemoteManagement(object):
varName = "LD_LIBRARY_PATH"
else:
return {'success':False,'msg':'Unknown variable type. Remember, generic variable names are used for portability (i.e. libpath).'}
+
val = val.replace('!!TMP!!', '%s/tmp' % cwd)
+
if not os.path.exists(val):
return {'success':False,'msg':'env var path does not exist'}
+
+ for path in os.environ[varName].split(":"):
+ if path == val:
+ return {'success':True}
+
try:
os.environ[varName] = "%s:%s" % (os.environ[varName], val)
except:
os.environ[varName] = "%s" % val
+
return {'success':True}
def writeFile(self, fn, fd):
if not os.path.exists('%s/tmp' % cwd):
os.makedirs('%s/tmp' % cwd)
+
try:
f = open("%s/tmp/%s" % (cwd, fn), "w")
except IOError:
return {'success':False,'msg':'Failed to open test results output file: %s/tmp/%s' % (cwd, fn)}
except:
return {'success':False,'msg':'Unexpected error: %s' % sys.exc_info()[0]}
+
f.write(fd)
f.close()
return {'success':True}
commit fffd1bda674d4163a2476fa01e641c0a1fc602db
Author: Darren Sessions <dsessions at digium.com>
Date: Thu May 19 10:03:42 2011 -0500
Updated loads and loads of code. Added an additional base class for plugins that dont utilize the xml rpc i.e. the configurator plugin.
diff --git a/lib/python/util.py b/lib/python/util.py
index e6523f9..13a17fa 100644
--- a/lib/python/util.py
+++ b/lib/python/util.py
@@ -20,10 +20,23 @@ import inspect
from xml.dom import minidom
from xml.etree.ElementTree import Element, SubElement, tostring
-class remote:
- def connect(self, host):
+class TestSuiteBaseClass:
+ def run(self, testData, testPath, remote=None):
+ return self.main(testData, testPath)
+
+class TestSuiteRemoteBaseClass:
+ def run(self, testData, testPath, remote=None):
+ if 'remote' == None:
+ 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' % host)
+ self.remote = xmlrpclib.Server('http://%s:8000' % remote)
+ return {'success':True}
class plugins:
def execute(self, name, module, testData, testPath):
@@ -32,7 +45,7 @@ class plugins:
except AttributeError:
return {'success':False,'msg':"Unable to execute module '%s'. %s" % (name, sys.exc_info()[1])}
else:
- results = func().main(testData, testPath)
+ results = func().run(testData, testPath, testData['testsuite_remote'])
if not type(results) == dict:
return {'success':False,'msg':"The '%s' module return invalid or missing data." % name}
return results
diff --git a/plugins/asteriskscf_configurator.py b/plugins/asteriskscf_configurator.py
index 2183506..b93deec 100644
--- a/plugins/asteriskscf_configurator.py
+++ b/plugins/asteriskscf_configurator.py
@@ -12,6 +12,7 @@
import os
import sys
import time
+import util
sys.path.append('/opt/Ice-3.4.1/python')
@@ -23,7 +24,7 @@ Ice.loadSlice('-I. --all ./tmp/gitall/slice/AsteriskSCF/System/Component/Configu
import AsteriskSCF.SIP.V1
import AsteriskSCF.System.Configuration.V1
-class testsuite():
+class testsuite(util.TestSuiteBaseClass):
def main(self, testData, testPath):
if not 'testsuite_remote' in testData:
return {'success':False,'msg':'No testsuite remote specified.'}
@@ -113,7 +114,10 @@ class ConfiguratorApp(Ice.Application):
proxy = 'SipConfigurationService:tcp -p 9985 -h %s' % self.host
visitor = SipSectionVisitors()
- configurationService = AsteriskSCF.System.Configuration.V1.ConfigurationServicePrx.checkedCast(self.communicator().stringToProxy(proxy))
+ try:
+ configurationService = AsteriskSCF.System.Configuration.V1.ConfigurationServicePrx.checkedCast(self.communicator().stringToProxy(proxy))
+ except:
+ return {'success':False,'msg':'Connection to remote refused.'}
if configurationService == None:
return {'success':False,'msg':'No configuration service to configure.'}
diff --git a/plugins/asteriskscf_icebox.py b/plugins/asteriskscf_icebox.py
index d4dbf3f..8edbd11 100644
--- a/plugins/asteriskscf_icebox.py
+++ b/plugins/asteriskscf_icebox.py
@@ -11,7 +11,7 @@
import util
-class testsuite(util.remote):
+class testsuite(util.TestSuiteRemoteBaseClass):
def main(self, testData, testPath):
iceBoxCmd = ['/opt/Ice-3.4.1/bin/icebox', '--Ice.Config=!!TMP!!/']
@@ -20,13 +20,11 @@ class testsuite(util.remote):
if not 'cmd' in testData:
return {'success':False,'msg':'No command specified.'}
- self.connect(testData['testsuite_remote'])
-
''' 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']:
- results = self.remote.writeFile('%s.conf' % component, '\n'.join(self._componentConfig(component))
+ results = self.remote.writeFile('%s.conf' % component, '\n'.join(self._componentConfig(component)))
if results['success'] == False:
return results
results = self.remote.setEnvVar('libpath', '!!TMP!!/gitall/build/lib')
@@ -35,7 +33,7 @@ class testsuite(util.remote):
results = self.remote.run('asteriskscf_icebox', component, [iceBoxCmd[0], "%s%s.conf" % (iceBoxCmd[1], component)])
if results['success'] == False:
return results
- if cmd == 'stop':
+ elif cmd == 'stop':
print 'stop'
else:
return {'success':False,'msg':'The %s command is invalid.' % cmd}
diff --git a/plugins/sipp.py b/plugins/sipp.py
index 55342a9..639742a 100644
--- a/plugins/sipp.py
+++ b/plugins/sipp.py
@@ -11,18 +11,14 @@
import util
-class testsuite(util.remote):
+class testsuite(util.TestSuiteRemoteBaseClass):
def main(self, testData, testPath):
config = {}
modes = ['uas', 'uac']
- 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.'}
- self.connect(testData['testsuite_remote'])
-
for cmd in testData['cmd']:
for mode in cmd:
if not 'uac' in mode and not 'uas' in mode:
diff --git a/testsuite.py b/testsuite.py
index 3a7b5f3..a463d44 100755
--- a/testsuite.py
+++ b/testsuite.py
@@ -13,6 +13,7 @@
import os
import sys
import platform
+import xmlrpclib
homeDir = os.path.dirname(os.path.realpath(__file__))
sys.path.append("%s/lib/python" % homeDir)
@@ -47,7 +48,6 @@ class __main__:
if subTestCase[testName]:
success = True
- print '--------' + testName
if subTestCase[testName]['expected_failure']:
subTestElement = util.xml().setProperty(subTestElement, 'expected_failure', subTestCase[testName]['expected_failure'])
@@ -71,10 +71,11 @@ class __main__:
runResults = util.plugins().execute(plugin, pluginData[plugin]['module'], timeLine[plugin], testData['path'])
if runResults['success'] == True:
if not 'shutdownExempt' in runResults:
- shutdownList.append({runResults['host']:plugin})
+ shutdownList.append({timeLine[plugin]['testsuite_remote']:plugin})
else:
break
if runResults['success'] == False:
+ runResults['msg'] = '%s: %s' % (plugin, runResults['msg'])
break
if runResults['success'] == False:
@@ -82,7 +83,11 @@ class __main__:
subTestElement, errorMsgs = util.xml().addFailure(subTestElement, ['%s' % runResults['msg']])
for host in [host for d in shutdownList for host in d]:
- util.sockets().remoteRequest(host, 'shutdown', {'plugin':d[host]})
+ remote = xmlrpclib.Server('http://%s:8000' % host)
+ remote.shutdown(d[host])
+
+ print ' |- Test "' + testName + '" - PASSED!'
+ # setProperty(self, element, key, val):
else:
print ' |- Test "' + testName + '" - FAILED!\n \- No test data defined!'
subTestElement, errorMsgs = util.xml().addFailure(subTestElement, ['No test data defined!'])
commit da90c78461f1fe85d9455f2cc51f3be48eeb563c
Author: Darren Sessions <dsessions at digium.com>
Date: Thu May 19 07:45:48 2011 -0500
converted the sipp plugin to use xml rpc. updated the write file function in remote and updated the function call in the icebox and sipp plugins.
diff --git a/plugins/asteriskscf_icebox.py b/plugins/asteriskscf_icebox.py
index ba6b33d..d4dbf3f 100644
--- a/plugins/asteriskscf_icebox.py
+++ b/plugins/asteriskscf_icebox.py
@@ -26,7 +26,7 @@ class testsuite(util.remote):
for cmd in testData['cmd']:
if cmd == 'start':
for component in testData['cmd']['start']:
- results = self.remote.writeFile('%s.conf' % component, self._componentConfig(component))
+ results = self.remote.writeFile('%s.conf' % component, '\n'.join(self._componentConfig(component))
if results['success'] == False:
return results
results = self.remote.setEnvVar('libpath', '!!TMP!!/gitall/build/lib')
diff --git a/plugins/sipp.py b/plugins/sipp.py
index 14b3752..55342a9 100644
--- a/plugins/sipp.py
+++ b/plugins/sipp.py
@@ -9,15 +9,11 @@
'''
-import time
import util
-from operator import itemgetter
-
-class testsuite(util.pluginBase):
+class testsuite(util.remote):
def main(self, testData, testPath):
config = {}
- execCmd = []
modes = ['uas', 'uac']
if not 'testsuite_remote' in testData:
@@ -25,6 +21,8 @@ class testsuite(util.pluginBase):
if not 'cmd' in testData:
return {'success':False,'msg':'No command specified.'}
+ self.connect(testData['testsuite_remote'])
+
for cmd in testData['cmd']:
for mode in cmd:
if not 'uac' in mode and not 'uas' in mode:
@@ -32,64 +30,53 @@ class testsuite(util.pluginBase):
config[mode] = cmd[mode]
for mode in modes:
- self.componentConfig(mode, config[mode], testPath)
-
- print '\n\n%s' % self.remoteRequest
+ results = self.remote.run('sipp', mode, self._componentConfig(mode, config[mode], testPath))
+ if results['success'] == False:
+ return results
- return util.sockets().remoteRequest(testData['testsuite_remote'], 'start', self.remoteRequest)
+ return {'success':True}
- def createRequest(self, mode, execCmd):
- self.requestGenerator('plugin', 'sipp')
- self.requestGenerator('label', mode)
- self.requestGenerator('exec', execCmd)
- self.remoteRequest.append(self.buildRemoteRequest)
-
- def loadScenarioFile(self, fp, fn):
+ def _loadScenarioFile(self, fp, fn):
fd = util.file().read(fp + '/' + fn)
- self.requestGenerator('write_tmp_file', fn, fd)
- return 1
+ return self.remote.writeFile(fn, fd)
- def execBuilder(self, string):
+ def _execBuilder(self, list, string):
for execBlock in string.rsplit(' '):
- self.execCmd.append(execBlock)
+ list.append(execBlock)
+ return list
- def componentConfig(self, mode, config, testPath):
- self.buildRemoteRequest = {}
- self.execCmd = ['sipp']
+ def _componentConfig(self, mode, config, testPath):
+ execCmd = ['sipp']
- print config
-
''' general options '''
if 'scenario_file' in config:
- if not self.loadScenarioFile(testPath, config['scenario_file']):
- return {'success':False,'msg':"Unable to load scenario file '%s'." % config['scenario_file']}
- self.execBuilder('-sf !!TMP!!/%s' % config['scenario_file'])
+ results = self._loadScenarioFile(testPath, config['scenario_file'])
+ if results['success'] == False:
+ return results
+ execCmd = self._execBuilder(execCmd, '-sf !!TMP!!/%s' % config['scenario_file'])
else:
- self.execBuilder('-sn %s' % mode)
+ execCmd = self.execBuilder(execCmd, '-sn %s' % mode)
if 'ip' in config:
- self.execBuilder('-ci %s' % config['ip'])
+ execCmd = self.execBuilder(execCmd, '-ci %s' % config['ip'])
if 'port' in config:
- self.execBuilder('-cp %s' % config['port'])
+ execCmd = self.execBuilder(execCmd, '-cp %s' % config['port'])
if 'transport' in config:
if config['transport'] == 'udp':
- self.execBuilder('-t u1')
+ execCmd = self.execBuilder(execCmd, '-t u1')
elif config['transport'] == 'tcp':
- self.execBuilder('-t t1')
+ execCmd = self.execBuilder(execCmd, '-t t1')
elif config['transport'] == 'tls':
- self.execBuilder('-t l1')
+ execCmd = self.execBuilder(execCmd, '-t l1')
''' UAC specific options '''
if mode == 'uac':
if 'calls' in config:
- self.execBuilder('-m %s' % config['calls'])
+ execCmd = self.execBuilder(execCmd, '-m %s' % config['calls'])
if 'cps' in config:
- self.execBuilder('-r %s' % config['cps'])
+ execCmd = self.execBuilder(execCmd, '-r %s' % config['cps'])
if 'duration' in config:
- self.execBuilder('-d %s' % config['duration'])
+ execCmd = self.execBuilder(execCmd, '-d %s' % config['duration'])
if 'targethost' in config and 'targetport' in config:
- self.execBuilder('%s:%s' % (config['targethost'], config['targetport']))
-
- self.createRequest(mode, self.execCmd)
-
-#print testsuite().main({'testsuite_remote': '127.0.0.1', 'cmd': [{'uac': {'cps': 5, 'transport': 'ipv4', 'scenario_file':'test.xml', 'calls': 1000}}, {'uas': {'transport': 'ipv4', 'scenario': {'builtin': 'uac'}}}]}, '../tests/sip/SysTest_Functional_BasicCallSetup')
-
+ execCmd = self.execBuilder(execCmd, '%s:%s' % (config['targethost'], config['targetport']))
+
+ return {'success':True,'execCmd':execCmd}
diff --git a/remote.py b/remote.py
index 4f968f9..c2202c9 100755
--- a/remote.py
+++ b/remote.py
@@ -128,7 +128,7 @@ class RemoteManagement(object):
return {'success':False,'msg':'Failed to open test results output file: %s/tmp/%s' % (cwd, fn)}
except:
return {'success':False,'msg':'Unexpected error: %s' % sys.exc_info()[0]}
- f.write('\n'.join(fd))
+ f.write(fd)
f.close()
return {'success':True}
commit ac4ecc30e1fb9ca12f0bed13cf98ecb95568229c
Author: Darren Sessions <dsessions at digium.com>
Date: Wed May 18 21:29:42 2011 -0500
finished refactoring the icebox plugin to support the new xml rpc and removed all socket support / code
diff --git a/lib/python/util.py b/lib/python/util.py
index 1b8ee74..e6523f9 100644
--- a/lib/python/util.py
+++ b/lib/python/util.py
@@ -14,46 +14,16 @@
import os
import imp
import sys
-import json
import time
-import socket
import inspect
from xml.dom import minidom
from xml.etree.ElementTree import Element, SubElement, tostring
-class pluginBase:
- def __init__(self):
- self.remoteRequest = []
- self.buildRemoteRequest = {}
-
- def requestGenerator(self, option, arg1=None, arg2=None, arg3=None):
- if option == 'plugin':
- self.buildRemoteRequest['plugin'] = arg1
- elif option == 'label':
- self.buildRemoteRequest['label'] = arg1
- elif option == 'write_tmp_file':
- self.buildRemoteRequest['write_tmp_file'] = {'name':arg1,'data':arg2}
- elif option == 'exec':
- self.buildRemoteRequest['exec'] = arg1
- elif option == 'set_env_var':
- self.buildRemoteRequest['set_env_var'] = {arg1:arg2}
-
-class sockets:
- def remoteRequest(self, host, action, data):
- received = {}
- request = {'host':host,'port':'9999','data':{action:data}}
- sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
- try:
- sock.connect((request['host'], int(request['port'])))
- except:
- sock.close
- return {'success':False,'msg':"Unable to connect to testsuite remote '%s'." % host}
- sock.send(json.dumps(request['data']))
- received = json.loads(sock.recv(16384))
- received['host'] = host
- sock.close()
- return received
+class remote:
+ def connect(self, host):
+ import xmlrpclib
+ self.remote = xmlrpclib.Server('http://%s:8000' % host)
class plugins:
def execute(self, name, module, testData, testPath):
diff --git a/plugins/asteriskscf_icebox.py b/plugins/asteriskscf_icebox.py
index ec788ed..ba6b33d 100644
--- a/plugins/asteriskscf_icebox.py
+++ b/plugins/asteriskscf_icebox.py
@@ -11,47 +11,47 @@
import util
-class testsuite(util.pluginBase):
+class testsuite(util.remote):
def main(self, testData, testPath):
- self.iceBoxCmd = ['/opt/Ice-3.4.1/bin/icebox', '--Ice.Config=!!TMP!!/']
+ 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.'}
+ self.connect(testData['testsuite_remote'])
+
''' 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']:
- self.componentConfig(component)
- return util.sockets().remoteRequest(testData['testsuite_remote'], 'start', self.remoteRequest)
+ results = self.remote.writeFile('%s.conf' % component, self._componentConfig(component))
+ if results['success'] == False:
+ return results
+ results = self.remote.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)])
+ if results['success'] == False:
+ return results
if cmd == 'stop':
print 'stop'
else:
return {'success':False,'msg':'The %s command is invalid.' % cmd}
+ return results
- def createRequest(self, component, config):
- self.buildRemoteRequest = {}
- self.requestGenerator('plugin', 'asteriskscf_icebox')
- self.requestGenerator('label', component)
- self.requestGenerator('write_tmp_file', '%s.conf' % component, config)
- self.requestGenerator('exec', [self.iceBoxCmd[0], "%s%s.conf" % (self.iceBoxCmd[1], component)])
- self.requestGenerator('set_env_var', 'libpath', '!!TMP!!/gitall/build/lib')
- self.remoteRequest.append(self.buildRemoteRequest)
-
- def componentConfig(self, component):
+ def _componentConfig(self, component):
if component == 'service_locator_replicator':
- config = [
+ return [
'IceBox.InheritProperties=1',
'IceBox.Service.ServiceLocatorStateReplicator=ServiceLocatorStateReplicator:create',
'LocatorService.Proxy=LocatorService:tcp -p 4411',
'TopicManager.Proxy=AsteriskSCFIceStorm/TopicManager:default -p 10000',
'ServiceLocatorStateReplicator.Endpoints=tcp -p 4413:udp -p 4413',
'ServiceLocatorStateReplicator.ThreadPool.Size=4']
- self.createRequest(component, config)
elif component == 'service_locator':
- config = [
+ return [
'Ice.Default.CollocationOptimized=0',
'IceBox.InheritProperties=1',
'IceBox.Service.ServiceDiscovery=@service_locator:create',
@@ -69,9 +69,8 @@ class testsuite(util.pluginBase):
'ServiceLocatorAdapter.Endpoints=tcp -p 4411',
'ServiceLocatorLocalAdapter.Endpoints=tcp -p 4412',
'ServiceLocatorManagementAdapter.Endpoints=tcp -p 4422']
- self.createRequest(component, config)
elif component == 'logger_server':
- config = [
+ return [
'IceBox.InheritProperties=1',
'IceBox.Service.Logger=logging-service:createLoggingService',
'AsteriskSCF.LoggingService.Endpoints=default',
@@ -79,9 +78,8 @@ class testsuite(util.pluginBase):
'TopicManager.Proxy=AsteriskSCFIceStorm/TopicManager:default -p 10000',
'AsteriskSCF.Logging.logger=Error',
'AsteriskSCF.Logging.logger.AsteriskSCF=Info']
- self.createRequest(component, config)
elif component == 'bridge_state_replicator':
- config = [
+ return [
'IceBox.InheritProperties=1',
'IceBox.Service.Replicator=BridgeReplicator:create',
'Ice.ThreadPool.Client.Size=4',
@@ -91,9 +89,8 @@ class testsuite(util.pluginBase):
'ServiceLocatorManagementProxy=LocatorServiceManagement:tcp -p 4422',
'Replicator.BridgeReplicator.ThreadPool.Size=4',
'Replicator.InstanceName=Replicator']
- self.createRequest(component, config)
elif component == 'bridge':
- config = [
+ return [
'IceBox.InheritProperties=1',
'IceBox.Service.BridgeManager=bridgeservice:create',
'Ice.ThreadPool.Client.Size=4',
@@ -103,9 +100,8 @@ class testsuite(util.pluginBase):
'BridgeManager.BridgeService.ThreadPool.Size=4',
'BridgeManager.BridgeServiceInternal.ThreadPool.Size=4',
'BridgeManager.BridgeService.Endpoints=default']
- self.createRequest(component, config)
elif component == 'routing_state_replicator':
- config = [
+ return [
'IceBox.InheritProperties=1',
'IceBox.Service.Replicator=BasicRoutingStateReplicator:create',
'Replicator.InstanceName=Replicator',
@@ -117,9 +113,8 @@ class testsuite(util.pluginBase):
'TopicManager.Proxy=AsteriskSCFIceStorm/TopicManager:default -p 10000',
'LocatorServiceManagement.Proxy=LocatorServiceManagement:tcp -p 4422',
'LocatorService.Proxy=LocatorService:tcp -p 4411']
- self.createRequest(component, config)
elif component == 'routing':
- config = [
+ return [
'IceBox.InheritProperties=1',
'IceBox.Service.RoutingService=BasicRoutingService:create',
'RoutingService.Endpoints=tcp -p 10050',
@@ -134,9 +129,8 @@ class testsuite(util.pluginBase):
'LocatorService.Proxy=LocatorService:tcp -p 4411',
'TopicManager.Proxy=AsteriskSCFIceStorm/TopicManager:default -p 10000',
'BridgeManager.ServiceLocatorId=BridgeService']
- self.createRequest(component, config)
elif component == 'sip_state_replicator':
- config = [
+ return [
'IceBox.InheritProperties=1',
'IceBox.Service.SipStateReplicator=SipStateReplicator:create',
'TopicManager.Proxy=AsteriskSCFIceStorm/TopicManager:default -p 10000',
@@ -144,9 +138,8 @@ class testsuite(util.pluginBase):
'LocatorService.Proxy=LocatorService:tcp -p 4411',
'SipStateReplicator.Endpoints=default',
'SipStateReplicator.ThreadPool.Size=4']
- self.createRequest(component, config)
elif component == 'sip_session_gateway':
- config = [
+ return [
'IceBox.InheritProperties=1',
'IceBox.Service.SipSessionManager=SipSessionManager:create',
'SipSessionManagerAdapter.Endpoints=tcp -p 9985',
@@ -160,18 +153,16 @@ class testsuite(util.pluginBase):
'Sip.Modules=Session',
'Sip.StateReplicatorName=default',
'Sip.StateReplicatorListener=no']
- self.createRequest(component, config)
elif component == 'rtp_state_replicator':
- config = [
+ return [
'IceBox.InheritProperties=1',
'IceBox.Service.RtpStateReplicator=RtpStateReplicator:create',
'RtpStateReplicator.Endpoints=tcp:udp',
'TopicManager.Proxy=AsteriskSCFIceStorm/TopicManager:default -p 10000',
'LocatorServiceManagement.Proxy=LocatorServiceManagement:tcp -p 4422',
'LocatorService.Proxy=LocatorService:tcp -p 4411']
- self.createRequest(component, config)
elif component == 'media_rtp_pjmedia':
- config = [
+ return [
'IceBox.InheritProperties=1',
'IceBox.Service.MediaRTPpjmedia=media_rtp_pjmedia:create',
'MediaRTPpjmediaAdapter.Endpoints=default',
@@ -179,7 +170,6 @@ class testsuite(util.pluginBase):
'MediaRTPpjmediaAdapterLogger.Endpoints=default',
'ServiceLocatorManagementProxy=LocatorServiceManagement:tcp -p 4422',
'ServiceLocatorProxy=LocatorService:tcp -p 4411']
- self.createRequest(component, config)
else:
return
commit 25c6273a364479318f51cce1c301527f0e588da6
Author: Darren Sessions <dsessions at digium.com>
Date: Wed May 18 20:56:48 2011 -0500
refactored the remote code to use XML RPC instead of sockets.
diff --git a/remote.py b/remote.py
index 51f07d3..4f968f9 100755
--- a/remote.py
+++ b/remote.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
'''
- Remote test-suite module
+ Remote Management Module
Copyright (C) 2011, Digium, Inc.
@@ -14,10 +14,9 @@
import os
import time
-import json
import platform
import subprocess
-import SocketServer
+import SimpleXMLRPCServer
cwd = os.path.dirname(os.path.realpath(__file__))
arch = platform.machine()
@@ -25,83 +24,54 @@ plat = platform.system()
processList = {}
-class RequestHandler(SocketServer.BaseRequestHandler):
- def handle(self):
- readIn = ''
- while 1:
- data = self.request.recv(1024)
- if not data:
- break
- readIn = readIn + data
- print "%s wrote:" % self.client_address[0], data
- print readIn
- print 'length = %s' % len(readIn)
- jsonIn = json.loads(readIn)
- result = TestSuiteRemoteManagement().run(jsonIn)
- jsonout = json.dumps(result)
- readOut = self.request.send(jsonOut)
- #self.request.send(json.dumps(TestSuiteRemoteManagement().run(json.loads(self.request.recv(16384).strip()))))
-
-class TestSuiteRemoteManagement:
- def run(self, data):
- self.results = {'success':True}
- for action in data:
- try:
- method = getattr(self, action)
- except AttributeError:
- return 0
- else:
- method(data[action])
- return self.results
-
- def list(self, data):
+class RemoteManagement(object):
+ def listProcesses(self):
list = {}
for plugin in processList:
list[plugin] = []
for label in processList[plugin]:
list[plugin].append(label)
- self.results = {'success':True,'msg':list}
-
- def start(self, data):
- for config in data:
- if 'write_tmp_file' in config:
- if not self.writeTmpFile(config['write_tmp_file']):
- break
- if 'set_env_var' in config:
- if not self.setEnvVar(config['set_env_var']):
- break
-
- for cmdLine in config['exec']:
- try:
- config['exec'][config['exec'].index(cmdLine)] = cmdLine.replace('!!TMP!!', '%s/tmp' % cwd)
- except:
- pass
-
- config['exec'][0] = self.which(config['exec'][0])
-
- if os.path.exists(config['exec'][0]) and os.access(config['exec'][0], os.X_OK):
- p = subprocess.Popen(
- config['exec'],
- bufsize=-1,
- shell=False
- #stdin=subprocess.PIPE,
- #stdout=subprocess.PIPE,
- #stderr=subprocess.PIPE
- )
- time.sleep(1)
- p.poll()
- # add an option for using the subprocess wait here (i.e. sipp tests)
- if p.returncode:
- self.results = {'success':False,"msg":"Could not execute '%s'." % ' '.join(config['exec'])}
- break
- else:
- self.results = {'success':False,"msg":"FAILED TO EXECUTE '%s', it must exist and be executable" % ' '.join(config['exec'])}
- break
-
- if not config['plugin'] in processList:
- processList[config['plugin']] = {}
- if not config['label'] in processList[config['plugin']]:
- processList[config['plugin']][config['label']] = {'exec':' '.join(config['exec']),'subprocess':p}
+ if list:
+ return {'success':True,'msg':list}
+ return {'success':True,'msg':'Nothing running.'}
+
+ def run(self, plugin, label, execCmd, wait = False):
+ if plugin in processList:
+ if label in processList[plugin]:
+ return {'success':False,'msg':'%s executed by the %s plugin is already running.' % (label, plugin)}
+
+ for arg in execCmd:
+ try:
+ execCmd[execCmd.index(arg)] = arg.replace('!!TMP!!', '%s/tmp' % cwd)
+ except:
+ pass
+
+ execCmd[0] = self._which(execCmd[0])
+
+ if os.path.exists(execCmd[0]) and os.access(execCmd[0], os.X_OK):
+ p = subprocess.Popen(
+ execCmd,
+ bufsize=-1,
+ shell=False
+ #stdin=subprocess.PIPE,
+ #stdout=subprocess.PIPE,
+ #stderr=subprocess.PIPE
+ )
+ time.sleep(1)
+ p.poll()
+ if wait == True:
+ p.wait()
+ if p.returncode:
+ return {'success':False,"msg":"Could not execute '%s'." % ' '.join(execCmd)}
+ else:
+ return {'success':False,"msg":"FAILED TO EXECUTE '%s', it must exist and be executable" % ' '.join(execCmd)}
+
+ if not plugin in processList:
+ processList[plugin] = {}
+ if not label in processList[plugin]:
+ processList[plugin][label] = {'exec':' '.join(execCmd),'subprocess':p}
+
+ return {'success':True}
def stop(self, data):
if not 'plugin' in data and not 'label' in data:
@@ -116,62 +86,59 @@ class TestSuiteRemoteManagement:
except:
return {"status":False,"msg":"Unable to kill pid # %d" % pid}
- def shutdown(self, data):
+ def shutdown(self, plugin):
msg = []
- if not 'plugin' in data:
- self.results = {'success':False,'msg':'A plugin name to shutdown must be provided.'}
- return
- if not data['plugin'] in processList:
- self.results = {'success':False,'msg':'The "%s" plugin is not running.' % data['plugin']}
- return
- for label in processList[data['plugin']]:
+ if not plugin:
+ return {'success':False,'msg':'A plugin name to shutdown must be provided.'}
+ if not plugin in processList:
+ return {'success':False,'msg':'The "%s" plugin is not running.' % plugin}
+ for label in processList[plugin]:
try:
- os.kill(processList[data['plugin']][label]['subprocess'].pid, 9)
+ os.kill(processList[plugin][label]['subprocess'].pid, 9)
except:
- msg.append("Unable to kill pid for %s in %s." % (label, data['plugin']))
+ msg.append("Unable to kill pid for %s in %s." % (label, plugin))
+ del processList[plugin]
if len(msg) > 0:
- self.results = {'success':False,'msg':' '.join(msg)}
- del processList[data['plugin']]
-
- def setEnvVar(self, envVarInfo):
- for varType in envVarInfo:
- if varType == 'libpath':
- if plat == 'Darwin':
- varName = "DYLD_LIBRARY_PATH"
- elif plat == 'Linux':
- varName = "LD_LIBRARY_PATH"
- envVarInfo[varType] = envVarInfo[varType].replace('!!TMP!!', '%s/tmp' % cwd)
- if not os.path.exists(envVarInfo[varType]):
- self.results = {'success':False,'msg':'env var path does not exist'}
- return False
- try:
- os.environ[varName] = "%s:%s" % (os.environ[varName], envVarInfo[varType])
- except:
- os.environ[varName] = "%s" % envVarInfo[varType]
- return True
+ return {'success':False,'msg':' '.join(msg)}
+ return {'success':True}
+
+ def setEnvVar(self, name, val):
+ if name == 'libpath':
+ if plat == 'Darwin':
+ varName = "DYLD_LIBRARY_PATH"
+ elif plat == 'Linux':
+ varName = "LD_LIBRARY_PATH"
+ else:
+ return {'success':False,'msg':'Unknown variable type. Remember, generic variable names are used for portability (i.e. libpath).'}
+ val = val.replace('!!TMP!!', '%s/tmp' % cwd)
+ if not os.path.exists(val):
+ return {'success':False,'msg':'env var path does not exist'}
+ try:
+ os.environ[varName] = "%s:%s" % (os.environ[varName], val)
+ except:
+ os.environ[varName] = "%s" % val
+ return {'success':True}
- def writeTmpFile(self, fileInfo):
+ def writeFile(self, fn, fd):
if not os.path.exists('%s/tmp' % cwd):
os.makedirs('%s/tmp' % cwd)
try:
- f = open("%s/tmp/%s" % (cwd,fileInfo['name']), "w")
+ f = open("%s/tmp/%s" % (cwd, fn), "w")
except IOError:
- self.results = {'success':False,'msg':'Failed to open test results output file: %s/tmp/%s' % (cwd,fileInfo['name'])}
- return False
+ return {'success':False,'msg':'Failed to open test results output file: %s/tmp/%s' % (cwd, fn)}
except:
- self.results = {'success':False,'msg':'Unexpected error: %s' % sys.exc_info()[0]}
- return False
- f.write('\n'.join(fileInfo['data']))
+ return {'success':False,'msg':'Unexpected error: %s' % sys.exc_info()[0]}
+ f.write('\n'.join(fd))
f.close()
- return True
+ return {'success':True}
- def which(self, app):
- def if_exists(file_path):
- return os.path.exists(file_path) and os.access(file_path, os.X_OK)
+ def _which(self, app):
+ def if_exists(fp):
+ return os.path.exists(fp) and os.access(fp, os.X_OK)
- file_path, file_name = os.path.split(app)
+ fp, fn = os.path.split(app)
- if file_path:
+ if fp:
if if_exists(app):
return app
else:
@@ -181,7 +148,7 @@ class TestSuiteRemoteManagement:
return prog
return
-if __name__ == "__main__":
- HOST, PORT = '', 9999
- server = SocketServer.TCPServer((HOST, PORT), RequestHandler)
+if __name__=='__main__':
+ server = SimpleXMLRPCServer.SimpleXMLRPCServer(('', 8000))
+ server.register_instance(RemoteManagement())
server.serve_forever()
commit 64861b480527af80c8422d7d357e09b7a0c97902
Author: Darren Sessions <dsessions at digium.com>
Date: Wed May 18 17:16:17 2011 -0500
fun with sockets
diff --git a/remote.py b/remote.py
index c0431ff..51f07d3 100755
--- a/remote.py
+++ b/remote.py
@@ -27,7 +27,20 @@ processList = {}
class RequestHandler(SocketServer.BaseRequestHandler):
def handle(self):
- self.request.send(json.dumps(TestSuiteRemoteManagement().run(json.loads(self.request.recv(16384).strip()))))
+ readIn = ''
+ while 1:
+ data = self.request.recv(1024)
+ if not data:
+ break
+ readIn = readIn + data
+ print "%s wrote:" % self.client_address[0], data
+ print readIn
+ print 'length = %s' % len(readIn)
+ jsonIn = json.loads(readIn)
+ result = TestSuiteRemoteManagement().run(jsonIn)
+ jsonout = json.dumps(result)
+ readOut = self.request.send(jsonOut)
+ #self.request.send(json.dumps(TestSuiteRemoteManagement().run(json.loads(self.request.recv(16384).strip()))))
class TestSuiteRemoteManagement:
def run(self, data):
commit ce1dbcc5b34e7ffc6ae446c10c7dc8b0e63f5ce3
Author: Darren Sessions <dsessions at digium.com>
Date: Wed May 18 08:58:23 2011 -0500
tweaks to sipp and related yaml stuffs
diff --git a/plugins/sipp.py b/plugins/sipp.py
index 2c71632..14b3752 100644
--- a/plugins/sipp.py
+++ b/plugins/sipp.py
@@ -9,11 +9,6 @@
'''
-import os
-import sys
-homeDir = os.path.dirname(os.path.realpath(__file__))
-sys.path.append("%s/../lib/python" % homeDir)
-
import time
import util
@@ -21,9 +16,8 @@ from operator import itemgetter
class testsuite(util.pluginBase):
def main(self, testData, testPath):
-
- print testPath
config = {}
+ execCmd = []
modes = ['uas', 'uac']
if not 'testsuite_remote' in testData:
@@ -54,40 +48,48 @@ class testsuite(util.pluginBase):
fd = util.file().read(fp + '/' + fn)
self.requestGenerator('write_tmp_file', fn, fd)
return 1
+
+ def execBuilder(self, string):
+ for execBlock in string.rsplit(' '):
+ self.execCmd.append(execBlock)
def componentConfig(self, mode, config, testPath):
- execCmd = ['sipp']
self.buildRemoteRequest = {}
+ self.execCmd = ['sipp']
+ print config
+
''' general options '''
if 'scenario_file' in config:
if not self.loadScenarioFile(testPath, config['scenario_file']):
return {'success':False,'msg':"Unable to load scenario file '%s'." % config['scenario_file']}
- execCmd.append('-sf !!TMP!!/%s' % config['scenario_file'])
+ self.execBuilder('-sf !!TMP!!/%s' % config['scenario_file'])
else:
- execCmd.append('-sn %s' % mode)
+ self.execBuilder('-sn %s' % mode)
if 'ip' in config:
- execCmd.append('-ci %s' % config['ip'])
+ self.execBuilder('-ci %s' % config['ip'])
if 'port' in config:
- execCmd.append('-cp %s' % config['ip'])
+ self.execBuilder('-cp %s' % config['port'])
if 'transport' in config:
if config['transport'] == 'udp':
- execCmd.append('-t u1')
+ self.execBuilder('-t u1')
elif config['transport'] == 'tcp':
- execCmd.append('-t t1')
+ self.execBuilder('-t t1')
elif config['transport'] == 'tls':
- execCmd.append('-t l1')
+ self.execBuilder('-t l1')
''' UAC specific options '''
if mode == 'uac':
if 'calls' in config:
- execCmd.append('-m %s' % config['calls'])
+ self.execBuilder('-m %s' % config['calls'])
if 'cps' in config:
- execCmd.append('-r %s' % config['cps'])
+ self.execBuilder('-r %s' % config['cps'])
if 'duration' in config:
- execCmd.append('-d %s' % config['duration'])
+ self.execBuilder('-d %s' % config['duration'])
+ if 'targethost' in config and 'targetport' in config:
+ self.execBuilder('%s:%s' % (config['targethost'], config['targetport']))
- self.createRequest(mode, execCmd)
+ self.createRequest(mode, self.execCmd)
-print testsuite().main({'testsuite_remote': '127.0.0.1', 'cmd': [{'uac': {'cps': 5, 'transport': 'ipv4', 'scenario_file':'test.xml', 'calls': 1000}}, {'uas': {'transport': 'ipv4', 'scenario': {'builtin': 'uac'}}}]}, '../tests/sip/SysTest_Functional_BasicCallSetup')
+#print testsuite().main({'testsuite_remote': '127.0.0.1', 'cmd': [{'uac': {'cps': 5, 'transport': 'ipv4', 'scenario_file':'test.xml', 'calls': 1000}}, {'uas': {'transport': 'ipv4', 'scenario': {'builtin': 'uac'}}}]}, '../tests/sip/SysTest_Functional_BasicCallSetup')
diff --git a/remote.py b/remote.py
index f87cd14..c0431ff 100755
--- a/remote.py
+++ b/remote.py
@@ -1,7 +1,7 @@
#!/usr/bin/python
'''
- Remote Test-suite Node Management Module
+ Remote test-suite module
Copyright (C) 2011, Digium, Inc.
diff --git a/tests/sip/SysTest_Functional_BasicCallSetup/testcase.yaml b/tests/sip/SysTest_Functional_BasicCallSetup/testcase.yaml
index abbd2c8..fb8c28a 100644
--- a/tests/sip/SysTest_Functional_BasicCallSetup/testcase.yaml
+++ b/tests/sip/SysTest_Functional_BasicCallSetup/testcase.yaml
@@ -47,10 +47,9 @@ tests :
transport : udp
ip : 127.0.0.1
port : 5061
- scenario_file : test.xml
- calls : 1000
- cps : 5
- duration : 2
+ calls : 10
+ cps : 1
+ duration : 10
targethost : 127.0.0.1
targetport : 5060
- uas :
commit f250788df9a34d973e50fc61f050088ada7b8d25
Author: Darren Sessions <dsessions at digium.com>
Date: Tue May 17 14:43:43 2011 -0500
added the "which" function from the bamboo testing code to the remote script so finding apps within the path is a breeze. made some minor tweaks to the sipp plugin.
diff --git a/plugins/sipp.py b/plugins/sipp.py
index fec2c29..2c71632 100644
--- a/plugins/sipp.py
+++ b/plugins/sipp.py
@@ -59,9 +59,6 @@ class testsuite(util.pluginBase):
execCmd = ['sipp']
self.buildRemoteRequest = {}
- ''' hardcoded options '''
- execCmd.append('-m')
-
''' general options '''
if 'scenario_file' in config:
if not self.loadScenarioFile(testPath, config['scenario_file']):
@@ -83,6 +80,8 @@ class testsuite(util.pluginBase):
''' UAC specific options '''
if mode == 'uac':
+ if 'calls' in config:
+ execCmd.append('-m %s' % config['calls'])
if 'cps' in config:
execCmd.append('-r %s' % config['cps'])
if 'duration' in config:
diff --git a/remote.py b/remote.py
index 15f6f24..f87cd14 100755
--- a/remote.py
+++ b/remote.py
@@ -52,10 +52,10 @@ class TestSuiteRemoteManagement:
def start(self, data):
for config in data:
if 'write_tmp_file' in config:
- if not self.__writeTmpFile(config['write_tmp_file']):
+ if not self.writeTmpFile(config['write_tmp_file']):
break
if 'set_env_var' in config:
- if not self.__setEnvVar(config['set_env_var']):
+ if not self.setEnvVar(config['set_env_var']):
break
for cmdLine in config['exec']:
@@ -64,6 +64,8 @@ class TestSuiteRemoteManagement:
except:
pass
+ config['exec'][0] = self.which(config['exec'][0])
+
if os.path.exists(config['exec'][0]) and os.access(config['exec'][0], os.X_OK):
p = subprocess.Popen(
config['exec'],
@@ -118,7 +120,7 @@ class TestSuiteRemoteManagement:
self.results = {'success':False,'msg':' '.join(msg)}
del processList[data['plugin']]
- def __setEnvVar(self, envVarInfo):
+ def setEnvVar(self, envVarInfo):
for varType in envVarInfo:
if varType == 'libpath':
if plat == 'Darwin':
@@ -135,7 +137,7 @@ class TestSuiteRemoteManagement:
os.environ[varName] = "%s" % envVarInfo[varType]
return True
- def __writeTmpFile(self, fileInfo):
+ def writeTmpFile(self, fileInfo):
if not os.path.exists('%s/tmp' % cwd):
os.makedirs('%s/tmp' % cwd)
try:
@@ -150,6 +152,22 @@ class TestSuiteRemoteManagement:
f.close()
return True
+ def which(self, app):
+ def if_exists(file_path):
+ return os.path.exists(file_path) and os.access(file_path, os.X_OK)
+
+ file_path, file_name = os.path.split(app)
+
+ if file_path:
+ if if_exists(app):
+ return app
+ else:
+ for path in os.environ["PATH"].split(os.pathsep):
+ prog = os.path.join(path, app)
+ if if_exists(prog):
+ return prog
+ return
+
if __name__ == "__main__":
HOST, PORT = '', 9999
server = SocketServer.TCPServer((HOST, PORT), RequestHandler)
commit 0605b0518bd6d134c01decead42c76cf91cc41fa
Author: Darren Sessions <dsessions at digium.com>
Date: Tue May 17 13:58:04 2011 -0500
added support for passing test directory path through the testsuite to the plugins. finished getting the sipp module to make remote requests. updated the plugins and added the testPath argument.
diff --git a/lib/python/util.py b/lib/python/util.py
index ba1a3be..1b8ee74 100644
--- a/lib/python/util.py
+++ b/lib/python/util.py
@@ -56,13 +56,13 @@ class sockets:
return received
class plugins:
- def execute(self, name, module, testData):
+ def execute(self, name, module, testData, testPath):
try:
func = getattr(module, 'testsuite')
except AttributeError:
return {'success':False,'msg':"Unable to execute module '%s'. %s" % (name, sys.exc_info()[1])}
else:
- results = func().main(testData)
+ results = func().main(testData, testPath)
if not type(results) == dict:
return {'success':False,'msg':"The '%s' module return invalid or missing data." % name}
return results
@@ -100,8 +100,8 @@ 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']:
- return {'success':False,'msg':"The 'main' method in the 'testsuite' class within '%s' has improperly labeled args! i.e. def main(self, testData)." % name}
+ if argCheck[0] != ['self','testData', 'testPath']:
+ 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}
@@ -117,14 +117,15 @@ class file:
def read(self, fn):
try:
- f = open("../%s_master_unit_test_results.xml" % component, "r")
+ f = open("%s" % fn, "r")
except IOError:
print "Failed to open test results output file:"
except:
print "Unexpected error: %s" % sys.exc_info()[0]
else:
- print f.read()
+ fc = f.read()
f.close()
+ return fc.strip()
class general:
def flattenDict(self, d):
diff --git a/plugins/asteriskscf_configurator.py b/plugins/asteriskscf_configurator.py
index 52070a7..2183506 100644
--- a/plugins/asteriskscf_configurator.py
+++ b/plugins/asteriskscf_configurator.py
@@ -24,7 +24,7 @@ import AsteriskSCF.SIP.V1
import AsteriskSCF.System.Configuration.V1
class testsuite():
- def main(self, testData):
+ def main(self, testData, testPath):
if not 'testsuite_remote' in testData:
return {'success':False,'msg':'No testsuite remote specified.'}
if not 'cmd' in testData:
diff --git a/plugins/asteriskscf_icebox.py b/plugins/asteriskscf_icebox.py
index 76bcd40..ec788ed 100644
--- a/plugins/asteriskscf_icebox.py
+++ b/plugins/asteriskscf_icebox.py
@@ -12,7 +12,7 @@
import util
class testsuite(util.pluginBase):
- def main(self, testData):
+ def main(self, testData, testPath):
self.iceBoxCmd = ['/opt/Ice-3.4.1/bin/icebox', '--Ice.Config=!!TMP!!/']
if not 'testsuite_remote' in testData:
diff --git a/plugins/sipp.py b/plugins/sipp.py
index a9aac79..fec2c29 100644
--- a/plugins/sipp.py
+++ b/plugins/sipp.py
@@ -20,7 +20,9 @@ import util
from operator import itemgetter
class testsuite(util.pluginBase):
- def main(self, testData):
+ def main(self, testData, testPath):
+
+ print testPath
config = {}
modes = ['uas', 'uac']
@@ -30,42 +32,43 @@ class testsuite(util.pluginBase):
return {'success':False,'msg':'No command specified.'}
for cmd in testData['cmd']:
- for component in cmd:
- if not 'uac' in component and not 'uas' in component:
+ for mode in cmd:
+ if not 'uac' in mode and not 'uas' in mode:
return {'success':False,'msg':'Unsupported configuration (modes).'}
- config[component] = cmd[component]
+ config[mode] = cmd[mode]
for mode in modes:
- self.componentConfig(mode, config[mode])
+ self.componentConfig(mode, config[mode], testPath)
- #return util.sockets().remoteRequest(testData['testsuite_remote'], 'start', self.remoteRequest)
+ print '\n\n%s' % self.remoteRequest
- def createRequest(self, component, config):
- self.buildRemoteRequest = {}
+ return util.sockets().remoteRequest(testData['testsuite_remote'], 'start', self.remoteRequest)
+
+ def createRequest(self, mode, execCmd):
self.requestGenerator('plugin', 'sipp')
- self.requestGenerator('label', component)
- self.requestGenerator('write_tmp_file', '%s.conf' % component, config)
- self.requestGenerator('exec', [self.iceBoxCmd[0], "%s%s.conf" % (self.iceBoxCmd[1], component)])
+ self.requestGenerator('label', mode)
+ self.requestGenerator('exec', execCmd)
self.remoteRequest.append(self.buildRemoteRequest)
- def loadScenarioFile(self, fn):
- fd = 'it works'
+ def loadScenarioFile(self, fp, fn):
+ fd = util.file().read(fp + '/' + fn)
self.requestGenerator('write_tmp_file', fn, fd)
return 1
- def componentConfig(self, component, config):
+ def componentConfig(self, mode, config, testPath):
execCmd = ['sipp']
+ self.buildRemoteRequest = {}
- ''' Hardcoded Options '''
+ ''' hardcoded options '''
execCmd.append('-m')
- ''' General Options '''
+ ''' general options '''
if 'scenario_file' in config:
- if not self.loadScenarioFile(config['scenario_file']):
+ if not self.loadScenarioFile(testPath, config['scenario_file']):
return {'success':False,'msg':"Unable to load scenario file '%s'." % config['scenario_file']}
execCmd.append('-sf !!TMP!!/%s' % config['scenario_file'])
else:
- execCmd.append('-sn %s' % component)
+ execCmd.append('-sn %s' % mode)
if 'ip' in config:
execCmd.append('-ci %s' % config['ip'])
if 'port' in config:
@@ -78,15 +81,14 @@ class testsuite(util.pluginBase):
elif config['transport'] == 'tls':
execCmd.append('-t l1')
- ''' UAC and UAS Specific Options '''
- if component == 'uac':
+ ''' UAC specific options '''
+ if mode == 'uac':
if 'cps' in config:
execCmd.append('-r %s' % config['cps'])
if 'duration' in config:
execCmd.append('-d %s' % config['duration'])
- print 'uac'
- elif component == 'uas':
- print 'uas'
-print testsuite().main({'testsuite_remote': '127.0.0.1', 'cmd': [{'uac': {'cps': 5, 'transport': 'ipv4', 'scenario_file':'test.xml', 'calls': 1000}}, {'uas': {'transport': 'ipv4', 'scenario': {'builtin': 'uac'}}}]})
+ self.createRequest(mode, execCmd)
+
+print testsuite().main({'testsuite_remote': '127.0.0.1', 'cmd': [{'uac': {'cps': 5, 'transport': 'ipv4', 'scenario_file':'test.xml', 'calls': 1000}}, {'uas': {'transport': 'ipv4', 'scenario': {'builtin': 'uac'}}}]}, '../tests/sip/SysTest_Functional_BasicCallSetup')
diff --git a/testsuite.py b/testsuite.py
index 7ec87a1..3a7b5f3 100755
--- a/testsuite.py
+++ b/testsuite.py
@@ -68,7 +68,7 @@ class __main__:
''' execute testcase timeline '''
for timeLine in subTestCase[testName]['timeline']:
for plugin in timeLine:
- runResults = util.plugins().execute(plugin, pluginData[plugin]['module'], timeLine[plugin])
+ runResults = util.plugins().execute(plugin, pluginData[plugin]['module'], timeLine[plugin], testData['path'])
if runResults['success'] == True:
if not 'shutdownExempt' in runResults:
shutdownList.append({runResults['host']:plugin})
commit 404f1d84b6caaba8f6361323e8553d10cef3f8b2
Author: Darren Sessions <dsessions at digium.com>
Date: Tue May 17 13:30:11 2011 -0500
added sipp configuration support for various options. added a read file utility function. added path support with in the yaml parser so plugins know where to read files in from when a test runs.
diff --git a/lib/python/util.py b/lib/python/util.py
index 8a576eb..ba1a3be 100644
--- a/lib/python/util.py
+++ b/lib/python/util.py
@@ -115,6 +115,17 @@ class file:
f.close()
self._results['file_cleanup'].append('%s/temp_config_%s.conf' % (self._cwd, component))
+ def read(self, fn):
+ try:
+ f = open("../%s_master_unit_test_results.xml" % component, "r")
+ except IOError:
+ print "Failed to open test results output file:"
+ except:
+ print "Unexpected error: %s" % sys.exc_info()[0]
+ else:
+ print f.read()
+ f.close()
+
class general:
def flattenDict(self, d):
s = [d]
diff --git a/lib/python/yaml_parser.py b/lib/python/yaml_parser.py
index 252fcdd..31ffc04 100755
--- a/lib/python/yaml_parser.py
+++ b/lib/python/yaml_parser.py
@@ -24,7 +24,9 @@ class yamlBase:
elif recursiveSearch == 'dir':
self.parse(path, yamlFile, test)
elif recursiveSearch == 'testcase':
- self.returnData[test].append(self.loadFiles(path, yamlFile))
+ results = self.loadFiles(path, yamlFile)
+ results['path'] = path
+ self.returnData[test].append(results)
def loadFiles(self, path, yaml_file):
try:
diff --git a/plugins/asteriskscf_configurator.py b/plugins/asteriskscf_configurator.py
old mode 100755
new mode 100644
diff --git a/plugins/sipp.py b/plugins/sipp.py
index 12dfdc6..a9aac79 100644
--- a/plugins/sipp.py
+++ b/plugins/sipp.py
@@ -14,6 +14,7 @@ import sys
homeDir = os.path.dirname(os.path.realpath(__file__))
sys.path.append("%s/../lib/python" % homeDir)
+import time
import util
from operator import itemgetter
@@ -46,14 +47,46 @@ class testsuite(util.pluginBase):
self.requestGenerator('write_tmp_file', '%s.conf' % component, config)
self.requestGenerator('exec', [self.iceBoxCmd[0], "%s%s.conf" % (self.iceBoxCmd[1], component)])
self.remoteRequest.append(self.buildRemoteRequest)
+
+ def loadScenarioFile(self, fn):
+ fd = 'it works'
+ self.requestGenerator('write_tmp_file', fn, fd)
+ return 1
def componentConfig(self, component, config):
+ execCmd = ['sipp']
+
+ ''' Hardcoded Options '''
+ execCmd.append('-m')
+
+ ''' General Options '''
+ if 'scenario_file' in config:
+ if not self.loadScenarioFile(config['scenario_file']):
+ return {'success':False,'msg':"Unable to load scenario file '%s'." % config['scenario_file']}
+ execCmd.append('-sf !!TMP!!/%s' % config['scenario_file'])
+ else:
+ execCmd.append('-sn %s' % component)
+ if 'ip' in config:
+ execCmd.append('-ci %s' % config['ip'])
+ if 'port' in config:
+ execCmd.append('-cp %s' % config['ip'])
+ if 'transport' in config:
+ if config['transport'] == 'udp':
+ execCmd.append('-t u1')
+ elif config['transport'] == 'tcp':
+ execCmd.append('-t t1')
+ elif config['transport'] == 'tls':
+ execCmd.append('-t l1')
+
+ ''' UAC and UAS Specific Options '''
if component == 'uac':
- print config
+ if 'cps' in config:
+ execCmd.append('-r %s' % config['cps'])
+ if 'duration' in config:
+ execCmd.append('-d %s' % config['duration'])
print 'uac'
elif component == 'uas':
- print config
print 'uas'
-print testsuite().main({'testsuite_remote': '127.0.0.1', 'cmd': [{'uac': {'cps': 5, 'transport': 'ipv4', 'scenario': {'builtin': 'uac'}, 'calls': 1000}}, {'uas': {'transport': 'ipv4', 'scenario': {'builtin': 'uac'}}}]})
+print testsuite().main({'testsuite_remote': '127.0.0.1', 'cmd': [{'uac': {'cps': 5, 'transport': 'ipv4', 'scenario_file':'test.xml', 'calls': 1000}}, {'uas': {'transport': 'ipv4', 'scenario': {'builtin': 'uac'}}}]})
diff --git a/tests/sip/SysTest_Functional_BasicCallSetup/testcase.yaml b/tests/sip/SysTest_Functional_BasicCallSetup/testcase.yaml
index 0d7c8f3..abbd2c8 100644
--- a/tests/sip/SysTest_Functional_BasicCallSetup/testcase.yaml
+++ b/tests/sip/SysTest_Functional_BasicCallSetup/testcase.yaml
@@ -41,55 +41,22 @@ tests :
targetport : 5062
direction : both
- 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 :
- expected_failure : False
- timeline:
- - asteriskscf_icebox :
- testsuite_remote : testsuiteremote1
+ testsuite_remote : 127.0.0.1
cmd :
- start :
- - service_locator_replicator
- - service_locator
- - bridge_replicator
- - bridge
- - sip_state_replicator
- - sip_session_manager :
- testsuite_remote : testsuiteremote2
- - asteriskscf_configurator :
- testsuite_remote : testsuite-remote-2
- endpoints :
- sipp-v4 :
- host : testsuite-remote-3
+ - uac :
+ transport : udp
+ ip : 127.0.0.1
port : 5061
- transport : ipv4
- session-v4 :
- host : testsuite-remote-4
+ scenario_file : test.xml
+ calls : 1000
+ cps : 5
+ duration : 2
+ targethost : 127.0.0.1
+ targetport : 5060
+ - uas :
+ transport : udp
+ ip : 127.0.0.1
port : 5062
- transport : ipv4
- - 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 :
- ipv4toipv6 :
- ipv6toipv4 :
commit 1090e66529472be49999679bc3207f6b3ccddfe3
Author: Darren Sessions <dsessions at digium.com>
Date: Tue May 17 12:00:32 2011 -0500
initial commit of the sipp plugin
diff --git a/plugins/sipp.py b/plugins/sipp.py
new file mode 100644
index 0000000..12dfdc6
--- /dev/null
+++ b/plugins/sipp.py
@@ -0,0 +1,59 @@
+'''
+
+ SIPp Plugin
+
+ Copyright (C) 2011, Digium, Inc.
+
+ This program is free software, distributed under the terms of
+ the GNU General Public License Version 2.
+
+'''
+
+import os
+import sys
+homeDir = os.path.dirname(os.path.realpath(__file__))
+sys.path.append("%s/../lib/python" % homeDir)
+
+import util
+
+from operator import itemgetter
+
+class testsuite(util.pluginBase):
+ def main(self, testData):
+ config = {}
+ modes = ['uas', 'uac']
+
+ 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.'}
+
+ for cmd in testData['cmd']:
+ for component in cmd:
+ if not 'uac' in component and not 'uas' in component:
+ return {'success':False,'msg':'Unsupported configuration (modes).'}
+ config[component] = cmd[component]
+
+ for mode in modes:
+ self.componentConfig(mode, config[mode])
+
+ #return util.sockets().remoteRequest(testData['testsuite_remote'], 'start', self.remoteRequest)
+
+ def createRequest(self, component, config):
+ self.buildRemoteRequest = {}
+ self.requestGenerator('plugin', 'sipp')
+ self.requestGenerator('label', component)
+ self.requestGenerator('write_tmp_file', '%s.conf' % component, config)
+ self.requestGenerator('exec', [self.iceBoxCmd[0], "%s%s.conf" % (self.iceBoxCmd[1], component)])
+ self.remoteRequest.append(self.buildRemoteRequest)
+
+ def componentConfig(self, component, config):
+ if component == 'uac':
+ print config
+ print 'uac'
+ elif component == 'uas':
+ print config
+ print 'uas'
+
+print testsuite().main({'testsuite_remote': '127.0.0.1', 'cmd': [{'uac': {'cps': 5, 'transport': 'ipv4', 'scenario': {'builtin': 'uac'}, 'calls': 1000}}, {'uas': {'transport': 'ipv4', 'scenario': {'builtin': 'uac'}}}]})
+
commit 2466bea91b9a0f7d5ef6ab3c1865286820c436ab
Author: Darren Sessions <dsessions at digium.com>
Date: Tue May 17 10:47:16 2011 -0500
removed the transform classes as they are not nessesary or very functional without the configurator python module.
diff --git a/plugins/asteriskscf_configurator.py b/plugins/asteriskscf_configurator.py
index 4c7d784..52070a7 100755
--- a/plugins/asteriskscf_configurator.py
+++ b/plugins/asteriskscf_configurator.py
@@ -116,7 +116,7 @@ class ConfiguratorApp(Ice.Application):
configurationService = AsteriskSCF.System.Configuration.V1.ConfigurationServicePrx.checkedCast(self.communicator().stringToProxy(proxy))
if configurationService == None:
- return {'success':False,'msg','No configuration service to configure.'}
+ return {'success':False,'msg':'No configuration service to configure.'}
for config in self.config:
for section in config:
@@ -236,19 +236,16 @@ class SipSectionVisitors(SectionVisitors):
mapper.map('targethost', item, 'host', 'targetaddress', self.chkOption(config, 'targethost'), None)
... 6143 lines suppressed ...
--
asterisk-scf/integration/testsuite.git
More information about the asterisk-scf-commits
mailing list