[asterisk-commits] jbigelow: testsuite/asterisk/trunk r4255 - in /asterisk/trunk: lib/python/ast...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 11 16:40:01 CDT 2013


Author: jbigelow
Date: Fri Oct 11 16:39:57 2013
New Revision: 4255

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4255
Log:
Add new parameters to control originations triggered by scenario_start

This adds two new optional parameters that may be used in conjunction with a
trigger of 'scenario_start'. These help control when an origination occurs,
prevent multiple originations from occurring, and correspond a scenario start
to a specific scenario. Only one of the parameters may be specified per
originator config section.

New parameters:
* scenario-trigger-after - Originate only after the specified number of
scenario start triggers have occurred.
* scenario-name - Originate only when the specified scenario is started.

This also changes two tests so they now use 'scenario_start' instead of
'ami_connect' as the trigger along with these new options. This should
prevent random failures for these tests.

Review: https://reviewboard.asterisk.org/r/2855/


Added:
    asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv4-tcp.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv4-udp.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv6-tcp.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv6-udp.xml   (with props)
Removed:
    asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive.xml
Modified:
    asterisk/trunk/lib/python/asterisk/PluggableModules.py
    asterisk/trunk/sample-yaml/originator-config.yaml.sample
    asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_incompatible_codecs/test-config.yaml
    asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/test-config.yaml

Modified: asterisk/trunk/lib/python/asterisk/PluggableModules.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/PluggableModules.py?view=diff&rev=4255&r1=4254&r2=4255
==============================================================================
--- asterisk/trunk/lib/python/asterisk/PluggableModules.py (original)
+++ asterisk/trunk/lib/python/asterisk/PluggableModules.py Fri Oct 11 16:39:57 2013
@@ -24,6 +24,7 @@
         self.test_object = test_object
         self.current_destination = 0
         self.ami_callback = None
+        self.scenario_count = 0
         self.config = {
             'channel': 'Local/s at default',
             'application': 'Echo',
@@ -33,6 +34,8 @@
             'priority': '',
             'ignore-originate-failure': 'no',
             'trigger': 'scenario_start',
+            'scenario-trigger-after': None,
+            'scenario-name': None,
             'id': '0',
             'async': 'False',
             'event': None,
@@ -47,7 +50,13 @@
                 self.config[k] = module_config[k]
 
         if self.config['trigger'] == 'scenario_start':
-            test_object.register_scenario_started_observer(self.scenario_started)
+            if (self.config['scenario-trigger-after'] is not None and
+                    self.config['scenario-name'] is not None):
+                LOGGER.error("Conflict between 'scenario-trigger-after' and \
+                        'scenario-name'. Only one may be used.")
+                raise Exception
+            else:
+                test_object.register_scenario_started_observer(self.scenario_started)
         elif self.config['trigger'] == 'event':
             if not self.config['event']:
                 LOGGER.error("Event specifier for trigger type 'event' is missing")
@@ -103,8 +112,18 @@
 
     def scenario_started(self, result):
         '''Handle origination on scenario start if configured to do so.'''
-        LOGGER.info("Scenario started")
-        self.originate_call()
+        LOGGER.info("Scenario '%s' started" % result.name)
+        if self.config['scenario-name'] is not None:
+            if result.name == self.config['scenario-name']:
+                LOGGER.debug("Scenario name '%s' matched" % result.name)
+                self.originate_call()
+        elif self.config['scenario-trigger-after'] is not None:
+            self.scenario_count += 1
+            if self.scenario_count == int(self.config['scenario-trigger-after']):
+                LOGGER.debug("Scenario count has been met")
+                self.originate_call()
+        else:
+            self.originate_call()
         return result
 
 

Modified: asterisk/trunk/sample-yaml/originator-config.yaml.sample
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/sample-yaml/originator-config.yaml.sample?view=diff&rev=4255&r1=4254&r2=4255
==============================================================================
--- asterisk/trunk/sample-yaml/originator-config.yaml.sample (original)
+++ asterisk/trunk/sample-yaml/originator-config.yaml.sample Fri Oct 11 16:39:57 2013
@@ -24,7 +24,19 @@
     # This determines what triggers the origination.  The available options are 'scenario_start' (default), 'ami_connect', and 'event'.
     trigger: 'scenario_start'
 
-    # if 'event' is specified as the trigger, an event definition needs to be specified.
+    # If 'scenario_start' is specified as the trigger, one of these optional
+    # parameters may be specified. These help control when the origination
+    # occurs, prevents multiple originations from occurring, and corresponds a
+    # scenario start to a specific scenario. This is useful for tests that load
+    # the Origination module multiple times and use multiple SIPp scenarios.
+    # Only one of the parameters may be specified per config section.
+    #
+    # Optional. Originate only after this number of scenario start triggers have occurred.
+    scenario-trigger-after: '4'
+    # Optional. Originate only when this scenario is started.
+    scenario-name: 'ipv4-tcp.xml'
+
+    # If 'event' is specified as the trigger, an event definition needs to be specified.
     # This is similar to the event definition used for the callback variant of the AMIEventModule.
     event:
         id: '0'

Modified: asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_incompatible_codecs/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_incompatible_codecs/test-config.yaml?view=diff&rev=4255&r1=4254&r2=4255
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_incompatible_codecs/test-config.yaml (original)
+++ asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_incompatible_codecs/test-config.yaml Fri Oct 11 16:39:57 2013
@@ -40,7 +40,8 @@
                - { 'target': '[::1]', 'key-args': {'scenario': 'receive.xml', '-i': '[::1]', '-p': '5062', '-t': 't1'} }
 
 originator-config-ipv4-udp:
-    trigger: 'ami_connect'
+    trigger: 'scenario_start'
+    scenario-trigger-after: '4'
     ignore-originate-failure: 'no'
     id: '0'
     channel: 'PJSIP/bob-ipv4-udp'
@@ -50,7 +51,8 @@
     async: 'True'
 
 originator-config-ipv4-tcp:
-    trigger: 'ami_connect'
+    trigger: 'scenario_start'
+    scenario-trigger-after: '4'
     ignore-originate-failure: 'no'
     id: '0'
     channel: 'PJSIP/bob-ipv4-tcp'
@@ -60,7 +62,8 @@
     async: 'True'
 
 originator-config-ipv6-udp:
-    trigger: 'ami_connect'
+    trigger: 'scenario_start'
+    scenario-trigger-after: '4'
     ignore-originate-failure: 'no'
     id: '0'
     channel: 'PJSIP/bob-ipv6-udp'
@@ -70,7 +73,8 @@
     async: 'True'
 
 originator-config-ipv6-tcp:
-    trigger: 'ami_connect'
+    trigger: 'scenario_start'
+    scenario-trigger-after: '4'
     ignore-originate-failure: 'no'
     id: '0'
     channel: 'PJSIP/bob-ipv6-tcp'

Added: asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv4-tcp.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv4-tcp.xml?view=auto&rev=4255
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv4-tcp.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv4-tcp.xml Fri Oct 11 16:39:57 2013
@@ -1,0 +1,50 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive call and respond with 486">
+
+  <recv request="INVITE" crlf="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 180 Ringing
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 486 Busy Here
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Reason: Q.850;cause=17
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv request="ACK">
+  </recv>
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+

Propchange: asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv4-tcp.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv4-tcp.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv4-tcp.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv4-udp.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv4-udp.xml?view=auto&rev=4255
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv4-udp.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv4-udp.xml Fri Oct 11 16:39:57 2013
@@ -1,0 +1,50 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive call and respond with 486">
+
+  <recv request="INVITE" crlf="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 180 Ringing
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 486 Busy Here
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Reason: Q.850;cause=17
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv request="ACK">
+  </recv>
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+

Propchange: asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv4-udp.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv4-udp.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv4-udp.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv6-tcp.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv6-tcp.xml?view=auto&rev=4255
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv6-tcp.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv6-tcp.xml Fri Oct 11 16:39:57 2013
@@ -1,0 +1,50 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive call and respond with 486">
+
+  <recv request="INVITE" crlf="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 180 Ringing
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 486 Busy Here
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Reason: Q.850;cause=17
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv request="ACK">
+  </recv>
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+

Propchange: asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv6-tcp.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv6-tcp.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv6-tcp.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv6-udp.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv6-udp.xml?view=auto&rev=4255
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv6-udp.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv6-udp.xml Fri Oct 11 16:39:57 2013
@@ -1,0 +1,50 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive call and respond with 486">
+
+  <recv request="INVITE" crlf="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 180 Ringing
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 486 Busy Here
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Reason: Q.850;cause=17
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv request="ACK">
+  </recv>
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+

Propchange: asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv6-udp.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv6-udp.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/sipp/receive-ipv6-udp.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/test-config.yaml?view=diff&rev=4255&r1=4254&r2=4255
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/test-config.yaml (original)
+++ asterisk/trunk/tests/channels/pjsip/basic_calls/outgoing/off-nominal/bob_is_busy/test-config.yaml Fri Oct 11 16:39:57 2013
@@ -32,13 +32,14 @@
    test-iterations:
        -
            scenarios:
-               - { 'key-args': {'scenario': 'receive.xml', '-i': '127.0.0.1', '-p': '5062'} }
-               - { 'key-args': {'scenario': 'receive.xml', '-i': '127.0.0.1', '-p': '5062', '-t': 't1'} }
-               - { 'target': '[::1]', 'key-args': {'scenario': 'receive.xml', '-i': '[::1]', '-p': '5062'} }
-               - { 'target': '[::1]', 'key-args': {'scenario': 'receive.xml', '-i': '[::1]', '-p': '5062', '-t': 't1'} }
+               - { 'key-args': {'scenario': 'receive-ipv4-udp.xml', '-i': '127.0.0.1', '-p': '5062'} }
+               - { 'key-args': {'scenario': 'receive-ipv4-tcp.xml', '-i': '127.0.0.1', '-p': '5062', '-t': 't1'} }
+               - { 'target': '[::1]', 'key-args': {'scenario': 'receive-ipv6-udp.xml', '-i': '[::1]', '-p': '5062'} }
+               - { 'target': '[::1]', 'key-args': {'scenario': 'receive-ipv6-tcp.xml', '-i': '[::1]', '-p': '5062', '-t': 't1'} }
 
 originator-config-ipv4-udp:
-    trigger: 'ami_connect'
+    trigger: 'scenario_start'
+    scenario-name: 'receive-ipv4-udp.xml'
     ignore-originate-failure: 'yes'
     id: '0'
     channel: 'PJSIP/bob-ipv4-udp'
@@ -48,7 +49,8 @@
     async: 'True'
 
 originator-config-ipv4-tcp:
-    trigger: 'ami_connect'
+    trigger: 'scenario_start'
+    scenario-name: 'receive-ipv4-tcp.xml'
     ignore-originate-failure: 'yes'
     id: '0'
     channel: 'PJSIP/bob-ipv4-tcp'
@@ -58,7 +60,8 @@
     async: 'True'
 
 originator-config-ipv6-udp:
-    trigger: 'ami_connect'
+    trigger: 'scenario_start'
+    scenario-name: 'receive-ipv6-udp.xml'
     ignore-originate-failure: 'yes'
     id: '0'
     channel: 'PJSIP/bob-ipv6-udp'
@@ -68,7 +71,8 @@
     async: 'True'
 
 originator-config-ipv6-tcp:
-    trigger: 'ami_connect'
+    trigger: 'scenario_start'
+    scenario-name: 'receive-ipv6-tcp.xml'
     ignore-originate-failure: 'yes'
     id: '0'
     channel: 'PJSIP/bob-ipv6-tcp'




More information about the asterisk-commits mailing list