[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
Fri May 27 17:00:51 CDT 2011


branch "review" has been updated
       via  cb62cb6581ada09e9b78c872a90ea11524aa7b51 (commit)
       via  4f331f899ef56f1ac3b70c17c121d427ea58e719 (commit)
      from  12b7b328ee91d372ca30c1c191a5922e8d8cb914 (commit)

Summary of changes:
 lib/python/TestSuite.py             |   11 ++--
 plugins/asteriskscf_configurator.py |  113 +++++++++++++++++++++++------------
 plugins/asteriskscf_icebox.py       |   25 +++++++-
 plugins/sipp.py                     |    2 +-
 testsuite.py                        |    4 +-
 5 files changed, 106 insertions(+), 49 deletions(-)


- Log -----------------------------------------------------------------
commit cb62cb6581ada09e9b78c872a90ea11524aa7b51
Author: Darren Sessions <dsessions at digium.com>
Date:   Fri May 27 17:00:44 2011 -0500

    bunches of work to support the new configurator code that uses the service locator. some tweaks to the shutdown code.

diff --git a/lib/python/TestSuite.py b/lib/python/TestSuite.py
index c6322cb..bc6b636 100644
--- a/lib/python/TestSuite.py
+++ b/lib/python/TestSuite.py
@@ -37,7 +37,8 @@ class utils():
             rpc.reset()
         except:
             return {'success':False,'msg':'Connection to %s was refused.' % host}
-        return {'success':True,'rpc':rpc}
+        ipv4, ipv6 = rpc.whatAreMyIps() 
+        return {'success':True, 'rpc':rpc, 'ipv4':ipv4, 'ipv6':ipv6}
 
     class file:
         def write(self, component):
@@ -81,11 +82,11 @@ class RemoteBaseClass(utils):
     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.'}
-        rpc = xmlrpclib.Server('http://%s:8000' % testData['testsuite_remote'])
+        if not 'testsuite_remote_host' in testData:
+            return {'success':False,'msg':'No testsuite remote host specified.'}
+        rpc = xmlrpclib.Server('http://%s:8000' % testData['testsuite_remote_host'])
         try:
             rpc.reset()
         except:
-            return {'success':False,'msg':'Connection to %s was refused.' % testData['testsuite_remote']}
+            return {'success':False,'msg':'Connection to %s was refused.' % testData['testsuite_remote_host']}
         return self.main(testData, testPath, rpc)
diff --git a/plugins/asteriskscf_configurator.py b/plugins/asteriskscf_configurator.py
index 4ac4cdc..c179735 100644
--- a/plugins/asteriskscf_configurator.py
+++ b/plugins/asteriskscf_configurator.py
@@ -26,17 +26,24 @@ class plugin(TestSuite.BaseClass):
         try:
             Ice.loadSlice('-I. -I/opt/Ice-3.4.1/slice -I./tmp/gitall/slice --all ./tmp/gitall/sip/local-slice/SipConfigurationIf.ice')
             Ice.loadSlice('-I. --all ./tmp/gitall/slice/AsteriskSCF/System/Component/ConfigurationIf.ice')
+            Ice.loadSlice('-I. -I/opt/Ice-3.4.1/slice --all ./tmp/gitall/slice/AsteriskSCF/Core/Discovery/ServiceLocatorIf.ice')
         except:
             return {'success':False,'shutdownExempt':'True','msg':'Slice preprocessing failed. Unable to locate slice files.'}
 
         import AsteriskSCF.SIP.V1
         import AsteriskSCF.System.Configuration.V1
+        import AsteriskSCF.Core.Discovery.V1
+
+        print dir()
 
         ''' The configurator doesn't implement a start or stop function as it's just pushing config '''
         for cmd in testData['cmd']:
-            if not cmd == 'sip':
+            if cmd == 'sip':
+                serviceLocatorParams = AsteriskSCF.SIP.V1.SipConfigurationParams()
+                serviceLocatorParams.category = AsteriskSCF.SIP.V1.ConfigurationDiscoveryCategory
+            else:
                 return {'success':False,'shutdownExempt':'True','msg':'The %s command is invalid.' % cmd}
-            return ConfiguratorApp(cmd, testData['testsuite_remote'], testData['cmd'][cmd], testData['configuration_wipe']).main([''])
+            return ConfiguratorApp(cmd, testData['service_locator_host'], testData['cmd'][cmd], AsteriskSCF, testData['configuration_wipe'], serviceLocatorParams).main([''])
 
 # Exception class used within the configurator application
 class ConfiguratorError(Exception):
@@ -103,29 +110,42 @@ class ConfiguratorApp(Ice.Application):
     any arguments as it will expect a file path and we're using a dict
     type instead.
     '''
-    def __init__(self, cmd, host, config, configWipe=False):
+    def __init__(self, cmd, host, config, AsteriskSCF, configWipe=False, serviceLocatorParams=None):
         self.cmd = cmd
         self.host = host
         self.config = config
         self.configWipe = configWipe
+        self.AsteriskSCF = AsteriskSCF
+        self.serviceLocatorParams = serviceLocatorParams
 
     def run(self, args):
         if self.cmd == 'sip':
-            proxy = 'SipConfigurationService:tcp -p 9985 -h %s' % self.host
             visitor = SipSectionVisitors()
 
-        try:
-            configurationService = AsteriskSCF.System.Configuration.V1.ConfigurationServicePrx.checkedCast(self.communicator().stringToProxy(proxy))
-        except:
-            return {'success':False,'msg':'Connection to remote refused.'}
+        proxy = 'LocatorService:tcp -p 4411 -h %s' % self.host
+        configurationServiceName = 'testsuite'
+        serviceLocator = self.AsteriskSCF.Core.Discovery.V1.ServiceLocatorPrx.checkedCast(self.communicator().stringToProxy(proxy))
+
+        if serviceLocator:
+            # Populate params with the name
+            setattr(self.serviceLocatorParams, "name", configurationServiceName)
+            try:
+                service = serviceLocator.locate(self.serviceLocatorParams)
+            except self.AsteriskSCF.Core.Discovery.V1.ServiceNotFound:
+                return {'success':False,'msg':"Configuration service could not be found in service locator."}
+
+            configurationService = self.AsteriskSCF.System.Configuration.V1.ConfigurationServicePrx.uncheckedCast(service)
 
         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:
+                visitor.AsteriskSCF = self.AsteriskSCF
                 visitor.visit(config[section], section)
 
+        print visitor.groups
+
         if visitor.groups:
             if self.configWipe == True:
                 # There is a race condition here where another component could modify the groups present, but if two
@@ -149,6 +169,7 @@ class SectionVisitors():
     def __init__(self):
         """Generic class meant to be inherited from for section visitors"""
         self.groups = []
+        self.hosts = {}
 
     def visit(self, config, section):
         """Execute the visit_ function corresponding to the section name"""
@@ -169,22 +190,32 @@ class SectionVisitors():
         except:
             return None
 
+    def chkHostIP(self, host, ipv4oripv6):
+        if not host == None:
+            try:
+                self.hosts[host]
+            except:
+                self.hosts[host] = plugin().rpc(host)
+            return self.hosts[host][ipv4oripv6]
+
 class SipSectionVisitors(SectionVisitors):
     def visit_general(self, config, section):
-        group = AsteriskSCF.SIP.V1.SipGeneralGroup()
+        group = self.AsteriskSCF.SIP.V1.SipGeneralGroup()
         group.configurationItems = { }
         self.groups.append(group)
 
     def visit_transport_udp(self, config, section):
-        group = AsteriskSCF.SIP.V1.SipUDPTransportGroup()
+        group = self.AsteriskSCF.SIP.V1.SipUDPTransportGroup()
         group.name = section
         group.configurationItems = { }
 
         mapper = OptionMapper()
-        item = AsteriskSCF.SIP.V1.SipHostItem()
-        mapper.map('host', item, 'host', 'address', self.chkOption(config, 'host'), None)
+        item = self.AsteriskSCF.SIP.V1.SipHostItem()
+        mapper.map('host', item, 'host', 'address', self.chkHostIP(self.chkOption(config, 'host'), config['ipv4oripv6']), None)
         mapper.map('port', item, 'port', 'address', self.chkOption(config, 'port'), 5060)
         for option in config:
+            if option == 'ipv4oripv6':
+                pass
             mapper.execute(group, section, option)
 
         mapper.finish(group)
@@ -192,15 +223,17 @@ class SipSectionVisitors(SectionVisitors):
         self.groups.append(group)
 
     def visit_transport_tcp(self, config, section):
-        group = AsteriskSCF.SIP.V1.SipTCPTransportGroup()
+        group = self.AsteriskSCF.SIP.V1.SipTCPTransportGroup()
         group.name = section
         group.configurationItems = { }
 
         mapper = OptionMapper()
-        item = AsteriskSCF.SIP.V1.SipHostItem()
-        mapper.map('host', item, 'host', 'address', self.chkOption(config, 'host'), None)
+        item = self.AsteriskSCF.SIP.V1.SipHostItem()
+        mapper.map('host', item, 'host', 'address', self.chkHostIP(self.chkOption(config, 'host'), config['ipv4oripv6']), None)
         mapper.map('port', item, 'port', 'address', self.chkOption(config, 'port'), 5060)
         for option in config.options(section):
+            if option == 'ipv4oripv6':
+                pass
             mapper.execute(group, section, option)
 
         mapper.finish(group)
@@ -208,15 +241,17 @@ class SipSectionVisitors(SectionVisitors):
         self.groups.append(group)
 
     def visit_transport_tls(self, config, section):
-        group = AsteriskSCF.SIP.V1.SipTLSTransportGroup()
+        group = self.AsteriskSCF.SIP.V1.SipTLSTransportGroup()
         group.name = section
         group.configurationItems = { }
 
         mapper = OptionMapper()
-        item = AsteriskSCF.SIP.V1.SipHostItem()
-        mapper.map('host', item, 'host', 'address', self.chkOption(config, 'host'), None)
+        item = self.AsteriskSCF.SIP.V1.SipHostItem()
+        mapper.map('host', item, 'host', 'address', self.chkHostIP(self.chkOption(config, 'host'), config['ipv4oripv6']), None)
         mapper.map('port', item, 'port', 'address', self.chkOption(config, 'port'), 5060)
         for option in config.options(section):
+            if option == 'ipv4oripv6':
+                pass
             mapper.execute(group, section, option)
 
         mapper.finish(group)
@@ -224,63 +259,65 @@ class SipSectionVisitors(SectionVisitors):
         self.groups.append(group)
 
     def visit_endpoint(self, config, section):
-        group = AsteriskSCF.SIP.V1.SipEndpointGroup()
+        group = self.AsteriskSCF.SIP.V1.SipEndpointGroup()
         group.name = section
         group.configurationItems = { }
 
         mapper = OptionMapper()
 
-        mapper.map('routing', AsteriskSCF.SIP.V1.SipRoutingItem(), 'routingServiceName', 'routingService', config.get, None)
+        mapper.map('routing', self.AsteriskSCF.SIP.V1.SipRoutingItem(), 'routingServiceName', 'routingService', config.get, None)
 
-        item = AsteriskSCF.SIP.V1.SipSourceTransportAddressItem()
-        mapper.map('sourcehost', item, 'host', 'sourceaddress', self.chkOption(config, 'sourcehost'), None)
+        item = self.AsteriskSCF.SIP.V1.SipSourceTransportAddressItem()
+        mapper.map('sourcehost', item, 'host', 'sourceaddress', self.chkHostIP(self.chkOption(config, 'sourcehost'), config['ipv4oripv6']), None)
         mapper.map('sourceport', item, 'port', 'sourceaddress', self.chkOption(config, 'sourceport'), 5060)
 
-        item = AsteriskSCF.SIP.V1.SipTargetDestinationAddressItem()
-        mapper.map('targethost', item, 'host', 'targetaddress', self.chkOption(config, 'targethost'), None)
+        item = self.AsteriskSCF.SIP.V1.SipTargetDestinationAddressItem()
+        mapper.map('targethost', item, 'host', 'targetaddress', self.chkHostIP(self.chkOption(config, 'targethost'), config['ipv4oripv6']), None)
         mapper.map('targetport', item, 'port', 'targetaddress', self.chkOption(config, 'targetport'), 5060)
 
         if self.chkOption(config, 'direction') == 'inbound':
-            direction = AsteriskSCF.SIP.V1.SipAllowableCallDirection.Inbound
+            direction = self.AsteriskSCF.SIP.V1.SipAllowableCallDirection.Inbound
         elif self.chkOption(config, 'direction') == 'outbound':
-            direction = AsteriskSCF.SIP.V1.SipAllowableCallDirection.Outbound
+            direction = self.AsteriskSCF.SIP.V1.SipAllowableCallDirection.Outbound
         elif self.chkOption(config, 'direction') == 'both':
-            direction = AsteriskSCF.SIP.V1.SipAllowableCallDirection.Both
+            direction = self.AsteriskSCF.SIP.V1.SipAllowableCallDirection.Both
         else:
-            direction = AsteriskSCF.SIP.V1.SipAllowableCallDirection.Both
+            direction = self.AsteriskSCF.SIP.V1.SipAllowableCallDirection.Both
 
-        mapper.map('direction', AsteriskSCF.SIP.V1.SipAllowableCallDirectionItem(), 'callDirection', 'callDirection', direction, None)
+        mapper.map('direction', self.AsteriskSCF.SIP.V1.SipAllowableCallDirectionItem(), 'callDirection', 'callDirection', direction, None)
 
-        item = AsteriskSCF.SIP.V1.SipCryptoCertificateItem()
+        item = self.AsteriskSCF.SIP.V1.SipCryptoCertificateItem()
         mapper.map('certificateauthorityfile', item, 'certificateAuthority', 'cryptocert', self.chkOption(config, 'certificateauthorityfile'), None)
         mapper.map('certificatefile', item, 'certificate', 'cryptocert', self.chkOption(config, 'certificatefile'), None)
         mapper.map('privatekeyfile', item, 'privateKey', 'cryptocert', self.chkOption(config, 'privatekeyfile'), None)
         mapper.map('privatekeypassword', item, 'privateKeyPassword', 'cryptocert', self.chkOption(config, 'privatekeypassword'), None)
 
-        item = AsteriskSCF.SIP.V1.SipCryptoRequirementsItem()
+        item = self.AsteriskSCF.SIP.V1.SipCryptoRequirementsItem()
         mapper.map('requireverifiedserver', item, 'requireVerifiedServer', 'cryptorequirements', self.chkOption(config, 'requireverifiedserver'), None)
         mapper.map('requireverifiedclient', item, 'requireVerifiedClient', 'cryptorequirements', self.chkOption(config, 'requireverifiedclient'), None)
         mapper.map('requireclientcertificate', item, 'requireClientCertificate', 'cryptorequirements', self.chkOption(config, 'requireclientcertificate'), None)
 
-        item = AsteriskSCF.SIP.V1.SipCryptoItem()
+        item = self.AsteriskSCF.SIP.V1.SipCryptoItem()
         mapper.map('supportedciphers', item, 'supportedCiphers', 'crypto', self.chkOption(config, 'supportedciphers'), None)
         mapper.map('tlsservername', item, 'serverName', 'crypto', self.chkOption(config, 'tlsservername'), None)
         mapper.map('tlstimeout', item, 'timeout', 'crypto', self.chkOption(config, 'tlstimeout'), None)
 
         if self.chkOption(config, 'tlsprotocolmethod') == 'tlsv1':
-            tlsprotocolmethod = AsteriskSCF.SIP.V1.TLSProtocolMethod.PROTOCOLMETHODTLSV1
+            tlsprotocolmethod = self.AsteriskSCF.SIP.V1.TLSProtocolMethod.PROTOCOLMETHODTLSV1
         elif self.chkOption(config, 'tlsprotocolmethod') == 'sslv2':
-            tlsprotocolmethod = AsteriskSCF.SIP.V1.TLSProtocolMethod.PROTOCOLMETHODTSSLV2
+            tlsprotocolmethod = self.AsteriskSCF.SIP.V1.TLSProtocolMethod.PROTOCOLMETHODTSSLV2
         elif self.chkOption(config, 'tlsprotocolmethod') == 'sslv3':
-            tlsprotocolmethod =  AsteriskSCF.SIP.V1.TLSProtocolMethod.PROTOCOLMETHODSSLV3
+            tlsprotocolmethod =  self.AsteriskSCF.SIP.V1.TLSProtocolMethod.PROTOCOLMETHODSSLV3
         elif self.chkOption(config, 'tlsprotocolmethod') == 'sslv23':
-            tlsprotocolmethod = AsteriskSCF.SIP.V1.TLSProtocolMethod.PROTOCOLMETHODSSLV23
+            tlsprotocolmethod = self.AsteriskSCF.SIP.V1.TLSProtocolMethod.PROTOCOLMETHODSSLV23
         else:
-            tlsprotocolmethod = AsteriskSCF.SIP.V1.TLSProtocolMethod.PROTOCOLMETHODUNSPECIFIED
+            tlsprotocolmethod = self.AsteriskSCF.SIP.V1.TLSProtocolMethod.PROTOCOLMETHODUNSPECIFIED
 
         mapper.map('tlsprotocolmethod', item, 'protocolMethod', 'crypto', tlsprotocolmethod, None)
 
         for option in config:
+            if option == 'ipv4oripv6':
+                pass
             mapper.execute(group, section, option)
 
         mapper.finish(group)
diff --git a/plugins/asteriskscf_icebox.py b/plugins/asteriskscf_icebox.py
index e6f4364..d2779e9 100644
--- a/plugins/asteriskscf_icebox.py
+++ b/plugins/asteriskscf_icebox.py
@@ -131,7 +131,16 @@ class plugin(TestSuite.RemoteBaseClass):
                 'LocatorServiceManagement.Proxy=LocatorServiceManagement:tcp -p 4422',
                 'LocatorService.Proxy=LocatorService:tcp -p 4411',
                 'SipStateReplicator.Endpoints=default',
-                'SipStateReplicator.ThreadPool.Size=4']
+                'SipStateReplicator.ThreadPool.Size=4',
+                'SipStateReplicator.Name=default',
+                'SipStateReplicatorIceStorm.InstanceName=SipStateReplicatorIceStorm',
+                'SipStateReplicatorIceStorm.TopicManager.Endpoints=default -p 10007',
+                'SipStateReplicatorIceStorm.Publish.Endpoints=default -p 10008',
+                'SipStateReplicatorIceStorm.Trace.TopicManager=2',
+                'SipStateReplicatorIceStorm.Transient=1',
+                'SipStateReplicatorIceStorm.Flush.Timeout=2000',
+                'SipStateReplicatorTopicManager.Proxy=SipStateReplicatorIceStorm/TopicManager:default -p 10007',
+                'SipConfiguration.Name=testsuite']
         elif component == 'sip_session_gateway':
             return [
                 'IceBox.InheritProperties=1',
@@ -154,7 +163,15 @@ class plugin(TestSuite.RemoteBaseClass):
                 'RtpStateReplicator.Endpoints=tcp:udp',
                 'TopicManager.Proxy=AsteriskSCFIceStorm/TopicManager:default -p 10000',
                 'LocatorServiceManagement.Proxy=LocatorServiceManagement:tcp -p 4422',
-                'LocatorService.Proxy=LocatorService:tcp -p 4411']
+                'LocatorService.Proxy=LocatorService:tcp -p 4411',
+                'RtpStateReplicatorIceStorm.InstanceName=RtpStateReplicatorIceStorm',
+                'RtpStateReplicatorIceStorm.TopicManager.Endpoints=default -p 10005',
+                'RtpStateReplicatorIceStorm.Publish.Endpoints=default -p 10006',
+                'RtpStateReplicatorIceStorm.Trace.TopicManager=2',
+                'RtpStateReplicatorIceStorm.Transient=1',
+                'RtpStateReplicatorIceStorm.Flush.Timeout=2000',
+                'RtpStateReplicatorTopicManager.Proxy=RtpStateReplicatorIceStorm/TopicManager:default -p 10005',
+                'RtpConfiguration.Name=testsuite']
         elif component == 'media_rtp_pjmedia':
             return [
                 'IceBox.InheritProperties=1',
@@ -162,8 +179,10 @@ class plugin(TestSuite.RemoteBaseClass):
                 'MediaRTPpjmediaAdapter.Endpoints=default',
                 'MediaRTPpjmediaAdapterLocal.Endpoints=default',
                 'MediaRTPpjmediaAdapterLogger.Endpoints=default',
+                'TopicManager.Proxy=AsteriskSCFIceStorm/TopicManager:default -p 10000',
                 'ServiceLocatorManagementProxy=LocatorServiceManagement:tcp -p 4422',
-                'ServiceLocatorProxy=LocatorService:tcp -p 4411']
+                'ServiceLocatorProxy=LocatorService:tcp -p 4411',
+                'LocatorService.Proxy=LocatorService:tcp -p 4411']
         else:
             return
 
diff --git a/testsuite.py b/testsuite.py
index f9fd9ea..521ffc6 100755
--- a/testsuite.py
+++ b/testsuite.py
@@ -46,7 +46,6 @@ class __main__:
                 for testData in list[testCategory]:
                     categoryElement, testElement = xml().addTestSuite(categoryElement, testData['name'])
                     print ' |- Testcase "%s" ' % testData['name']
-                    #print testData['options']
                     for subTestCase in testData['tests']:
                         for testName in subTestCase:
                             testElement, subTestElement = xml().addTestCase(testElement, testName)
@@ -75,11 +74,10 @@ class __main__:
                                 for timeLine in subTestCase[testName]['timeline']:
                                     for plugin in timeLine:
                                         runResults = plugins().execute(plugin, pluginData[plugin]['module'], timeLine[plugin], testData['path'])
-                                        print runResults
                                         if not 'shutdownList' in runResults:
                                             if not 'shutdownExempt' in runResults:
-                                                if 'testsuite_remote' in testData:
-                                                    shutdownList.append({testData['testsuite_remote']:plugin})
+                                                if 'testsuite_remote_host' in timeLine[plugin]:
+                                                    shutdownList.append({timeLine[plugin]['testsuite_remote_host']:plugin})
                                         else:
                                             for remote in runResults['shutdownList']:
                                                shutdownList.append({remote:plugin})

commit 4f331f899ef56f1ac3b70c17c121d427ea58e719
Author: Darren Sessions <dsessions at digium.com>
Date:   Thu May 26 18:34:35 2011 -0500

    minor tweaks to the sipp plugin and the testsuite server.

diff --git a/plugins/sipp.py b/plugins/sipp.py
index 55aaffa..71c103d 100644
--- a/plugins/sipp.py
+++ b/plugins/sipp.py
@@ -11,7 +11,7 @@
 
 import TestSuite
 
-class testsuite(TestSuite.BaseClass):
+class plugin(TestSuite.BaseClass):
     def main(self, testData, testPath, rpc):
         config = {}
         modes = ['uas', 'uac']
diff --git a/testsuite.py b/testsuite.py
index c590046..f9fd9ea 100755
--- a/testsuite.py
+++ b/testsuite.py
@@ -75,9 +75,11 @@ class __main__:
                                 for timeLine in subTestCase[testName]['timeline']:
                                     for plugin in timeLine:
                                         runResults = plugins().execute(plugin, pluginData[plugin]['module'], timeLine[plugin], testData['path'])
+                                        print runResults
                                         if not 'shutdownList' in runResults:
                                             if not 'shutdownExempt' in runResults:
-                                                shutdownList.append({testData['testsuite_remote']:plugin})
+                                                if 'testsuite_remote' in testData:
+                                                    shutdownList.append({testData['testsuite_remote']:plugin})
                                         else:
                                             for remote in runResults['shutdownList']:
                                                shutdownList.append({remote:plugin})

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


-- 
asterisk-scf/integration/testsuite.git



More information about the asterisk-scf-commits mailing list