[asterisk-commits] kharwell: testsuite/asterisk/trunk r4510 - in /asterisk/trunk/tests/channels/...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Mon Dec 23 15:40:10 CST 2013


Author: kharwell
Date: Mon Dec 23 15:40:04 2013
New Revision: 4510

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4510
Log:
pjsip/ami: bouncing tests

Hopefully this fixes what have been some bouncing tests.  For a few of the AMI
tests, instead of depending upon timing constraints now the commands are issued
and the events checked once the system is known to be test ready.

(closes issue ASTERISK-22991)
Reported by: Matt Jordan

Added:
    asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/sipp/
    asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/sipp/register.xml   (with props)
Modified:
    asterisk/trunk/tests/channels/pjsip/ami/show_endpoint/AMISendTest.py
    asterisk/trunk/tests/channels/pjsip/ami/show_endpoint/test-config.yaml
    asterisk/trunk/tests/channels/pjsip/ami/show_endpoints/AMISendTest.py
    asterisk/trunk/tests/channels/pjsip/ami/show_endpoints/test-config.yaml
    asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/AMISendTest.py
    asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/configs/ast1/pjsip.conf
    asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/test-config.yaml
    asterisk/trunk/tests/channels/pjsip/ami/show_registrations_outbound/AMISendTest.py
    asterisk/trunk/tests/channels/pjsip/ami/show_registrations_outbound/test-config.yaml
    asterisk/trunk/tests/channels/pjsip/ami/show_subscriptions/AMISendTest.py

Modified: asterisk/trunk/tests/channels/pjsip/ami/show_endpoint/AMISendTest.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/ami/show_endpoint/AMISendTest.py?view=diff&rev=4510&r1=4509&r2=4510
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/ami/show_endpoint/AMISendTest.py (original)
+++ asterisk/trunk/tests/channels/pjsip/ami/show_endpoint/AMISendTest.py Mon Dec 23 15:40:04 2013
@@ -28,4 +28,9 @@
         self.create_ami_factory()
 
     def ami_connect(self, ami):
-        ami.sendDeferred(ACTION).addCallback(ami.errorUnlessResponse)
+        ami.sendDeferred(ACTION).addCallback(self.__on_response)
+
+    def __on_response(self, result):
+        # stop test since done
+        self.stop_reactor()
+

Modified: asterisk/trunk/tests/channels/pjsip/ami/show_endpoint/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/ami/show_endpoint/test-config.yaml?view=diff&rev=4510&r1=4509&r2=4510
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/ami/show_endpoint/test-config.yaml (original)
+++ asterisk/trunk/tests/channels/pjsip/ami/show_endpoint/test-config.yaml Mon Dec 23 15:40:04 2013
@@ -27,8 +27,6 @@
             typename: 'ami.AMIEventModule'
 
 object-config:
-    # the only way the test will stop is by timing out
-    # should be done within the specified value
     reactor-timeout: 15
 
 ami-config:

Modified: asterisk/trunk/tests/channels/pjsip/ami/show_endpoints/AMISendTest.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/ami/show_endpoints/AMISendTest.py?view=diff&rev=4510&r1=4509&r2=4510
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/ami/show_endpoints/AMISendTest.py (original)
+++ asterisk/trunk/tests/channels/pjsip/ami/show_endpoints/AMISendTest.py Mon Dec 23 15:40:04 2013
@@ -27,4 +27,9 @@
         self.create_ami_factory()
 
     def ami_connect(self, ami):
-        ami.sendDeferred(ACTION).addCallback(ami.errorUnlessResponse)
+        ami.sendDeferred(ACTION).addCallback(self.__on_response)
+
+    def __on_response(self, result):
+        # stop test since done
+        self.stop_reactor()
+

Modified: asterisk/trunk/tests/channels/pjsip/ami/show_endpoints/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/ami/show_endpoints/test-config.yaml?view=diff&rev=4510&r1=4509&r2=4510
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/ami/show_endpoints/test-config.yaml (original)
+++ asterisk/trunk/tests/channels/pjsip/ami/show_endpoints/test-config.yaml Mon Dec 23 15:40:04 2013
@@ -27,8 +27,6 @@
             typename: 'ami.AMIEventModule'
 
 object-config:
-    # the only way the test will stop is by timing out
-    # should be done within the specified value
     reactor-timeout: 15
 
 ami-config:

Modified: asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/AMISendTest.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/AMISendTest.py?view=diff&rev=4510&r1=4509&r2=4510
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/AMISendTest.py (original)
+++ asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/AMISendTest.py Mon Dec 23 15:40:04 2013
@@ -8,10 +8,14 @@
 '''
 
 import sys
+import logging
 
 sys.path.append("lib/python/asterisk")
 
+from sipp import SIPpScenario
 from TestCase import TestCase
+
+LOGGER = logging.getLogger(__name__)
 
 ACTION = {
     "Action":"PJSIPShowRegistrationsInbound"
@@ -27,4 +31,19 @@
         self.create_ami_factory()
 
     def ami_connect(self, ami):
-        ami.sendDeferred(ACTION).addCallback(ami.errorUnlessResponse)
+        super(AMISendTest, self).ami_connect(ami)
+
+        def _on_register(obj):
+            LOGGER.info('Getting inbound registrations...')
+            ami.sendDeferred(ACTION).addCallback(self.__on_response)
+            return obj
+
+        LOGGER.info('Starting inbound registration scenario')
+
+        sipp = SIPpScenario(self.test_name,
+            {'scenario':'register.xml', '-p':'5061' })
+        sipp.run(self).addCallback(_on_register)
+
+    def __on_response(self, result):
+        # stop test since done
+        self.stop_reactor()

Modified: asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/configs/ast1/pjsip.conf?view=diff&rev=4510&r1=4509&r2=4510
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/configs/ast1/pjsip.conf (original)
+++ asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/configs/ast1/pjsip.conf Mon Dec 23 15:40:04 2013
@@ -21,13 +21,12 @@
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
 [user1](aor_t)
-contact=sip:user1 at 127.0.0.1:5062
 
 [user1](endpoint_t)
 aors=user1
 
 [user2](aor_t)
-contact=sip:user2 at 127.0.0.1:5063
+contact=sip:user2 at 127.0.0.1:5062
 
 [user2](endpoint_t)
 aors=user2

Added: asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/sipp/register.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/sipp/register.xml?view=auto&rev=4510
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/sipp/register.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/sipp/register.xml Mon Dec 23 15:40:04 2013
@@ -1,0 +1,23 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Registration">
+    <send retrans="500">
+        <![CDATA[
+
+        REGISTER sip:[remote_ip]:[remote_port] SIP/2.0
+        Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+        From: "user1" <sip:user1@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+        To: "user1" <sip:user1@[remote_ip]:[remote_port]>
+        Call-ID: [call_id]
+        CSeq: 1 REGISTER
+        Max-Forwards: 70
+        Contact: <sip:user1@[local_ip]:[local_port]>;transport=[transport]
+        Subject: Performance Test
+        Content-Length: 0
+
+        ]]>
+    </send>
+
+    <recv response="200" rtd="true" />
+</scenario>

Propchange: asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/sipp/register.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/sipp/register.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Rev URL

Propchange: asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/sipp/register.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/test-config.yaml?view=diff&rev=4510&r1=4509&r2=4510
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/test-config.yaml (original)
+++ asterisk/trunk/tests/channels/pjsip/ami/show_registrations_inbound/test-config.yaml Mon Dec 23 15:40:04 2013
@@ -27,8 +27,6 @@
             typename: 'ami.AMIEventModule'
 
 object-config:
-    # the only way the test will stop is by timing out
-    # should be done within the specified value
     reactor-timeout: 15
 
 ami-config:
@@ -49,7 +47,7 @@
                     DefaultExpiration: '3600'
                     MaximumExpiration: '7200'
                     MinimumExpiration: '60'
-                    Contacts: user1/sip:user1 at 127.0.0.1:5062|user2/sip:user2 at 127.0.0.1:5063
+                    Contacts: user1/sip:user1 at 127.0.0.1:5061|user2/sip:user2 at 127.0.0.1:5062
             count: 2
         -
             type: 'headermatch'

Modified: asterisk/trunk/tests/channels/pjsip/ami/show_registrations_outbound/AMISendTest.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/ami/show_registrations_outbound/AMISendTest.py?view=diff&rev=4510&r1=4509&r2=4510
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/ami/show_registrations_outbound/AMISendTest.py (original)
+++ asterisk/trunk/tests/channels/pjsip/ami/show_registrations_outbound/AMISendTest.py Mon Dec 23 15:40:04 2013
@@ -27,4 +27,14 @@
         self.create_ami_factory()
 
     def ami_connect(self, ami):
-        ami.sendDeferred(ACTION).addCallback(ami.errorUnlessResponse)
+        # wait for asterisk to attempt registration
+        ami.registerEvent('Registry', self.__on_registry)
+
+    def __on_registry(self, ami, event):
+        # asterisk attempted registration, so check details
+        ami.deregisterEvent('Registry', None)
+        ami.sendDeferred(ACTION).addCallback(self.__on_response)
+
+    def __on_response(self, result):
+        # stop test since done
+        self.stop_reactor()

Modified: asterisk/trunk/tests/channels/pjsip/ami/show_registrations_outbound/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/ami/show_registrations_outbound/test-config.yaml?view=diff&rev=4510&r1=4509&r2=4510
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/ami/show_registrations_outbound/test-config.yaml (original)
+++ asterisk/trunk/tests/channels/pjsip/ami/show_registrations_outbound/test-config.yaml Mon Dec 23 15:40:04 2013
@@ -27,8 +27,6 @@
             typename: 'ami.AMIEventModule'
 
 object-config:
-    # the only way the test will stop is by timing out
-    # should be done within the specified value
     reactor-timeout: 15
 
 ami-config:
@@ -52,7 +50,7 @@
                     ContactUser: ''
                     ClientUri: 'sip:user.*'
                     ServerUri: 'sip:localhost'
-                    Status: 'Unregistered'
+                    Status: 'Unregistered|Rejected'
                     NextReg: '0'
             count: 5
         -

Modified: asterisk/trunk/tests/channels/pjsip/ami/show_subscriptions/AMISendTest.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/ami/show_subscriptions/AMISendTest.py?view=diff&rev=4510&r1=4509&r2=4510
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/ami/show_subscriptions/AMISendTest.py (original)
+++ asterisk/trunk/tests/channels/pjsip/ami/show_subscriptions/AMISendTest.py Mon Dec 23 15:40:04 2013
@@ -17,7 +17,7 @@
 
 from twisted.internet import reactor
 
-logger = logging.getLogger(__name__)
+LOGGER = logging.getLogger(__name__)
 
 ACTION = {
     "Action":"PJSIPShowSubscriptionsInbound"
@@ -36,12 +36,12 @@
         super(AMISendTest, self).ami_connect(ami)
 
         def _send_show_subscriptions(obj):
-            logger.info('Getting inbound subscriptions...')
+            LOGGER.info('Getting inbound subscriptions...')
             ami.sendDeferred(ACTION).addCallback(ami.errorUnlessResponse)
             reactor.callLater(2, self.stop_reactor)
             return obj
 
-        logger.info('Starting subscription scenario')
+        LOGGER.info('Starting subscription scenario')
         sipp = SIPpScenario(self.test_name,
             {'scenario':'subscribe.xml', '-p':'5061' })
         sipp.run(self).addCallback(_send_show_subscriptions)




More information about the asterisk-commits mailing list