[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 30 22:27:36 CDT 2011


branch "review" has been updated
       via  35b98c9ab4bd1f31eda4adc7e0faff272c656a6b (commit)
      from  cb62cb6581ada09e9b78c872a90ea11524aa7b51 (commit)

Summary of changes:
 plugins/asteriskscf_configurator.py                |  171 ++++++++++++++------
 tests/build/Build_AsteriskSCF/testcase.yaml        |   20 +++
 .../testcase.yaml                                  |   36 ++---
 tests/sip/tests.yaml                               |    2 +-
 tests/tests.yaml                                   |    4 +-
 5 files changed, 163 insertions(+), 70 deletions(-)


- Log -----------------------------------------------------------------
commit 35b98c9ab4bd1f31eda4adc7e0faff272c656a6b
Author: Darren Sessions <dsessions at digium.com>
Date:   Mon May 30 22:27:27 2011 -0500

    Added support for rtp configuration to the configurator plugin. Minor tweaks.

diff --git a/plugins/asteriskscf_configurator.py b/plugins/asteriskscf_configurator.py
index c179735..ffc912f 100644
--- a/plugins/asteriskscf_configurator.py
+++ b/plugins/asteriskscf_configurator.py
@@ -24,23 +24,29 @@ class plugin(TestSuite.BaseClass):
             testData['configuration_wipe'] = None
 
         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')
+            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. -I/opt/Ice-3.4.1/slice -I./tmp/gitall/slice --all ./tmp/gitall/media_rtp_pjmedia/local-slice/RtpConfigurationIf.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()
+        try:
+            import AsteriskSCF.System.Configuration.V1
+            import AsteriskSCF.Core.Discovery.V1
+            import AsteriskSCF.SIP.V1
+            import AsteriskSCF.Media.RTP.V1
+        except:
+            return {'success':False,'shutdownExempt':'True','msg':'Unable to import required Asterisk SCF python modules.'}
 
         ''' The configurator doesn't implement a start or stop function as it's just pushing config '''
         for cmd in testData['cmd']:
             if cmd == 'sip':
                 serviceLocatorParams = AsteriskSCF.SIP.V1.SipConfigurationParams()
                 serviceLocatorParams.category = AsteriskSCF.SIP.V1.ConfigurationDiscoveryCategory
+            elif cmd == 'rtp':
+                serviceLocatorParams = AsteriskSCF.Media.RTP.V1.RtpConfigurationParams()
+                serviceLocatorParams.category = AsteriskSCF.Media.RTP.V1.ConfigurationDiscoveryCategory
             else:
                 return {'success':False,'shutdownExempt':'True','msg':'The %s command is invalid.' % cmd}
             return ConfiguratorApp(cmd, testData['service_locator_host'], testData['cmd'][cmd], AsteriskSCF, testData['configuration_wipe'], serviceLocatorParams).main([''])
@@ -121,6 +127,10 @@ class ConfiguratorApp(Ice.Application):
     def run(self, args):
         if self.cmd == 'sip':
             visitor = SipSectionVisitors()
+        if self.cmd == 'rtp':
+            visitor = RtpSectionVisitors()
+
+        visitor.AsteriskSCF = self.AsteriskSCF
 
         proxy = 'LocatorService:tcp -p 4411 -h %s' % self.host
         configurationServiceName = 'testsuite'
@@ -141,11 +151,8 @@ class ConfiguratorApp(Ice.Application):
 
         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
@@ -176,9 +183,9 @@ class SectionVisitors():
         try:
             method = getattr(self, 'visit_' + section)
         except AttributeError:
-            self.visit_unsupported(config, section)
+            return self.visit_unsupported(config, section)
         else:
-            method(config, section);
+            return method(config, section);
 
     def visit_unsupported(self, config, section):
         """Handle an unsupported configuration section"""
@@ -190,90 +197,138 @@ 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]
+    def getRemoteHost(self, section, config, host, port):
+        try:
+            config[host]
+        except:
+            return {'success':False,'msg':"The required option, '%s', is not set in '%s' section." % (host, section)}
+        if config[host] == None:
+            return {'success':False,'msg':"The required option, '%s', can not be set to 'None' in the '%s' section."  % (host, section)}
+        try:
+            config['ipv4oripv6']
+        except:
+            return {'success':False,'msg':"The required option, 'ipv4oripv6', must be specified in '%s' section." % section}
+        if not config['ipv4oripv6'] == 'ipv4' and not config['ipv4oripv6'] == 'ipv6':
+            return {'success':False,'msg':"The required option 'ipv4oripv6' in the '%s' section, must be either 'ipv4' or 'ipv6'." % section}
+        try:
+            self.hosts[config[host]][config['ipv4oripv6']]
+        except:
+            self.hosts[config[host]] = plugin().rpc(config[option])
+        if self.hosts[config[host]]['success'] == False:
+            return self.hosts[config[host]]
+        try:
+            config[port]
+        except:
+            config[port] = None
+        return {'success':True, host:self.hosts[config[host]][config['ipv4oripv6']], port:config[port]}
 
 class SipSectionVisitors(SectionVisitors):
     def visit_general(self, config, section):
         group = self.AsteriskSCF.SIP.V1.SipGeneralGroup()
-        group.configurationItems = { }
+        group.configurationItems = {}
         self.groups.append(group)
+        return {'success':True}
 
     def visit_transport_udp(self, config, section):
+        remote = self.getRemoteHost(section, config, 'host', 'port')
+        if remote['success'] == False:
+            return remote
+
+        mapper = OptionMapper()
+
         group = self.AsteriskSCF.SIP.V1.SipUDPTransportGroup()
         group.name = section
-        group.configurationItems = { }
+        group.configurationItems = {}
 
-        mapper = OptionMapper()
         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)
+
+        mapper.map('host', item, 'host', 'address', remote['host'], None)
+        mapper.map('port', item, 'port', 'address', remote['port'], 5060)
+
         for option in config:
             if option == 'ipv4oripv6':
                 pass
             mapper.execute(group, section, option)
 
         mapper.finish(group)
-
         self.groups.append(group)
 
+        return {'success':True}
+
     def visit_transport_tcp(self, config, section):
+        remote = self.getRemoteHost(section, config, 'host', 'port')
+        if remote['success'] == False:
+            return remote
+
+        mapper = OptionMapper()
+
         group = self.AsteriskSCF.SIP.V1.SipTCPTransportGroup()
         group.name = section
-        group.configurationItems = { }
+        group.configurationItems = {}
 
-        mapper = OptionMapper()
         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)
+
+        mapper.map('host', item, 'host', 'address', remote['host'], None)
+        mapper.map('port', item, 'port', 'address', remote['port'], 5060)
+
         for option in config.options(section):
             if option == 'ipv4oripv6':
                 pass
             mapper.execute(group, section, option)
 
         mapper.finish(group)
-
         self.groups.append(group)
 
+        return {'success':True}
+
     def visit_transport_tls(self, config, section):
+        remote = self.getRemoteHost(section, config, 'host', 'port')
+        if remote['success'] == False:
+            return remote
+
+        mapper = OptionMapper()
+
         group = self.AsteriskSCF.SIP.V1.SipTLSTransportGroup()
         group.name = section
-        group.configurationItems = { }
+        group.configurationItems = {}
 
-        mapper = OptionMapper()
         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)
+
+        mapper.map('host', item, 'host', 'address', remote['host'], None)
+        mapper.map('port', item, 'port', 'address', remote['port'], 5060)
+
         for option in config.options(section):
             if option == 'ipv4oripv6':
                 pass
             mapper.execute(group, section, option)
 
         mapper.finish(group)
-
         self.groups.append(group)
 
+        return {'success':True}
+
     def visit_endpoint(self, config, section):
+        mapper = OptionMapper()
+
         group = self.AsteriskSCF.SIP.V1.SipEndpointGroup()
         group.name = section
-        group.configurationItems = { }
-
-        mapper = OptionMapper()
+        group.configurationItems = {}
 
         mapper.map('routing', self.AsteriskSCF.SIP.V1.SipRoutingItem(), 'routingServiceName', 'routingService', config.get, None)
 
+        remote = self.getRemoteHost(section, config, 'sourcehost', 'sourceport')
+        if remote['success'] == False:
+            return remote
         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)
+        mapper.map('sourcehost', item, 'host', 'sourceaddress', remote['sourcehost'], None)
+        mapper.map('sourceport', item, 'port', 'sourceaddress', remote['sourceport'], 5060)
 
+        remote = self.getRemoteHost(section, config, 'targethost', 'targetport')
+        if remote['success'] == False:
+            return remote
         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)
+        mapper.map('targethost', item, 'host', 'targetaddress', remote['targethost'], None)
+        mapper.map('targetport', item, 'port', 'targetaddress', remote['targetport'], 5060)
 
         if self.chkOption(config, 'direction') == 'inbound':
             direction = self.AsteriskSCF.SIP.V1.SipAllowableCallDirection.Inbound
@@ -321,15 +376,39 @@ class SipSectionVisitors(SectionVisitors):
             mapper.execute(group, section, option)
 
         mapper.finish(group)
-
         self.groups.append(group)
 
+        return {'success':True}
+
     def visit_unsupported(self, config, section):
         if config['type'] == 'transport_udp':
-            self.visit_transport_udp(config, section)
+            return self.visit_transport_udp(config, section)
         elif config['type'] == 'transport_tcp':
-            self.visit_transport_tcp(config, section)
+            return self.visit_transport_tcp(config, section)
         elif config['type'] == 'transport_tls':
-            self.visit_transport_tls(config, section)
+            return self.visit_transport_tls(config, section)
         elif config['type'] == 'endpoint':
-            self.visit_endpoint(config, section)
+            return self.visit_endpoint(config, section)
+
+class RtpSectionVisitors(Configurator.SectionVisitors):
+    def visit_general(self, config, section):
+        mapper = Configurator.OptionMapper()
+
+        group = AsteriskSCF.Media.RTP.V1.RtpGeneralGroup()
+        group.configurationItems = {}
+
+        portsItem = AsteriskSCF.Media.RTP.V1.PortRangesItem()
+        mapper.map('startport', portsItem, 'startPort', AsteriskSCF.Media.RTP.V1.PortRangesItemName, self.chkOption(config, 'startport'), 10000)
+        mapper.map('endport', portsItem, 'endPort', AsteriskSCF.Media.RTP.V1.PortRangesItemName, self.chkOption(config, 'endport'), 20000)
+
+        workerItem = AsteriskSCF.Media.RTP.V1.WorkerThreadCountItem()
+        mapper.map('workerthreadcount', workerItem, 'count', AsteriskSCF.Media.RTP.V1.WorkerThreadCountItemName, self.chkOption(config, 'workerthreadcount'), 4)
+ 
+        for option in config:
+            mapper.execute(group, section, option)
+
+        mapper.finish(group)
+        self.groups.append(group)
+    
+        return {'success':True}
+
diff --git a/tests/build/Build_AsteriskSCF/testcase.yaml b/tests/build/Build_AsteriskSCF/testcase.yaml
index df4f970..c762396 100644
--- a/tests/build/Build_AsteriskSCF/testcase.yaml
+++ b/tests/build/Build_AsteriskSCF/testcase.yaml
@@ -38,5 +38,25 @@ tests :
                         remotes :
                             - testsuite-remote-1.digium.internal
                             - testsuite-remote-2.digium.internal
+                            - testsuite-remote-3.digium.internal
                         send_dir : '/opt/Ice-3.4.1'
                         install_dir : /
+    - asterisk_scf :
+        timeline:
+            - build :
+                testsuite_remote : testsuite-builder-1.digium.internal
+                cmd :
+                    pull_update : True
+                    repo : 'git://git.asterisk.org/asterisk-scf/integration/gitall'
+                    cd : gitall
+                    make_cmd :
+                        - ./gitall-asterisk-scf.sh
+                        - cmake/init-cmake.sh
+                        - cmake --build ./build
+                    redistribute :
+                        remotes :
+                            - testsuite-remote-1.digium.internal
+                            - testsuite-remote-2.digium.internal
+                            - testsuite-remote-3.digium.internal
+                        send_dir : 'gitall'
+                        install_dir : '!!TMP!!'
diff --git a/tests/sip/SysTest_Functional_Basic_CallSetup/testcase.yaml b/tests/sip/SysTest_Functional_Basic_CallSetup/testcase.yaml
index 67cd7ba..a417161 100644
--- a/tests/sip/SysTest_Functional_Basic_CallSetup/testcase.yaml
+++ b/tests/sip/SysTest_Functional_Basic_CallSetup/testcase.yaml
@@ -8,7 +8,7 @@ tests :
         expected_failure : False 
         timeline:
             - asteriskscf_icebox :
-                testsuite_remote : testsuite-server.digium.internal
+                testsuite_remote_host : testsuite-remote-1.digium.internal
                 cmd :
                     start :
                         - service_locator_replicator
@@ -21,40 +21,34 @@ tests :
                         - sip_state_replicator
                         - sip_session_gateway
                         - rtp_state_replicator
+                        - media_rtp_pjmedia
             - asteriskscf_configurator :
-                testsuite_remote : testsuite-server.digium.internal
-                configuration_wipe : True
+                service_locator_host : testsuite-remote-1.digium.internal
+                configuration_wipe : False
                 cmd :
                     sip :
                         - localhost_udp :
                             type : transport_udp
-                            host : 10.19.139.80
+                            host : testsuite-remote-1.digium.internal
                             port : 5060
+                            ipv4oripv6 : ipv4
                         - service :
                             type : endpoint
-                            targethost : 10.19.139.77
+                            targethost : testsuite-remote-2.digium.internal
                             targetport : 5060
+                            ipv4oripv6 : ipv4
                             direction : both
                         - sipp :
                             type : endpoint
-                            targethost : 10.19.139.79
+                            targethost : testsuite-remote-3.digium.internal
                             targetport : 5060
+                            ipv4oripv6 : ipv4
                             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
+                    rtp :
+                         - general :
+                            startport : 10000
+                            endport : 20000
+                            workerthreadcount : 4
     - ipv6toipv6 :
     - ipv4toipv6 :
     - ipv6toipv4 :
diff --git a/tests/sip/tests.yaml b/tests/sip/tests.yaml
index 758ea86..4b3a3eb 100644
--- a/tests/sip/tests.yaml
+++ b/tests/sip/tests.yaml
@@ -1,3 +1,3 @@
 testcase :
     - SysTest_Functional_Basic_CallSetup
-    - SysTest_Functional_Phones_PolycomIP430
+#    - SysTest_Functional_Phones_PolycomIP430
diff --git a/tests/tests.yaml b/tests/tests.yaml
index 32f0b4e..e27a5e6 100644
--- a/tests/tests.yaml
+++ b/tests/tests.yaml
@@ -1,4 +1,4 @@
 tests :
 #    - build
-    - failover
-#    - sip
+    - sip
+#    - failover

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


-- 
asterisk-scf/integration/testsuite.git



More information about the asterisk-scf-commits mailing list