[asterisk-commits] mmichelson: testsuite/asterisk/trunk r3481 - in /asterisk/trunk/tests: channe...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Oct 5 11:25:39 CDT 2012


Author: mmichelson
Date: Fri Oct  5 11:25:34 2012
New Revision: 3481

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3481
Log:
Rewrite SIP outbound address test.

This gets rid of the old Lua test in favor
of a test that uses the SIPpTestCase. The
test has been simplified to reduce the chance
of bounces.

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


Added:
    asterisk/trunk/tests/channels/SIP/sip_outbound_address/originator.py   (with props)
    asterisk/trunk/tests/channels/SIP/sip_outbound_address/sipp/uas.xml   (with props)
Removed:
    asterisk/trunk/tests/channels/SIP/sip_outbound_address/run-test
    asterisk/trunk/tests/channels/SIP/sip_outbound_address/sipp/dtmf_2833_1.pcap
    asterisk/trunk/tests/channels/SIP/sip_outbound_address/sipp/dtmf_2833_2.pcap
    asterisk/trunk/tests/channels/SIP/sip_outbound_address/sipp/dtmf_2833_pound.pcap
    asterisk/trunk/tests/channels/SIP/sip_outbound_address/sipp/uas1.xml
    asterisk/trunk/tests/channels/SIP/sip_outbound_address/sipp/uas2.xml
    asterisk/trunk/tests/channels/SIP/sip_outbound_address/test.lua
Modified:
    asterisk/trunk/tests/channels/SIP/sip_outbound_address/configs/ast1/extensions.conf
    asterisk/trunk/tests/channels/SIP/sip_outbound_address/configs/ast1/sip.conf
    asterisk/trunk/tests/channels/SIP/sip_outbound_address/test-config.yaml
    asterisk/trunk/tests/manager/login/run-test

Modified: asterisk/trunk/tests/channels/SIP/sip_outbound_address/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_outbound_address/configs/ast1/extensions.conf?view=diff&rev=3481&r1=3480&r2=3481
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_outbound_address/configs/ast1/extensions.conf (original)
+++ asterisk/trunk/tests/channels/SIP/sip_outbound_address/configs/ast1/extensions.conf Fri Oct  5 11:25:34 2012
@@ -1,34 +1,30 @@
-[test_context]
+[default]
 ;Base line.
 ;Result: Use sip.conf info
-exten => test1,1,Dial(SIP/peer,,M(readdtmf))
+exten => test1,1,Dial(SIP/bob)
 exten => test1,n,Hangup
 
 ;Basic change to outbound. Should dial to explicit host:port
 ;Result: Use host in dialstring
-exten => test2,1,Dial(SIP/peer//127.0.0.1:5062,,M(readdtmf))
+exten => test2,1,Dial(SIP/bob//127.0.0.1:5062)
 exten => test2,n,Hangup
 
 ;Adding user portion should not affect routing
 ;Result: Use host in dialstring
-exten => test3,1,Dial(SIP/1000 at peer//127.0.0.1:5062,,M(readdtmf))
+exten => test3,1,Dial(SIP/1000 at bob//127.0.0.1:5062)
 exten => test3,n,Hangup
 
-;Neither should adding extension between peer and host
+;Neither should adding extension between bob and host
 ;Result: Use host in dialstring
-exten => test4,1,Dial(SIP/peer/1000/127.0.0.1:5062,,M(readdtmf))
+exten => test4,1,Dial(SIP/bob/1000/127.0.0.1:5062)
 exten => test4,n,Hangup
 
 ;Neither should a conflict in which extension to use
 ;Result: Use host in dialstring
-exten => test5,1,Dial(SIP/1000 at peer/1000/127.0.0.1:5062,,M(readdtmf))
+exten => test5,1,Dial(SIP/1000 at bob/1000/127.0.0.1:5062)
 exten => test5,n,Hangup
 
 ;This one has the wrong number of slashes before the host
 ;Result: Use sip.conf info
-exten => test6,1,Dial(SIP/1000 at peer/127.0.0.1:5062,,M(readdtmf))
+exten => test6,1,Dial(SIP/1000 at bob/127.0.0.1:5062)
 exten => test6,n,Hangup
-
-[macro-readdtmf]
-exten => s,1,Read(READRESULT,,1,,1,5)
-exten => s,n,MacroExit

Modified: asterisk/trunk/tests/channels/SIP/sip_outbound_address/configs/ast1/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_outbound_address/configs/ast1/sip.conf?view=diff&rev=3481&r1=3480&r2=3481
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_outbound_address/configs/ast1/sip.conf (original)
+++ asterisk/trunk/tests/channels/SIP/sip_outbound_address/configs/ast1/sip.conf Fri Oct  5 11:25:34 2012
@@ -3,8 +3,12 @@
 
 ;This is the peer dialed for
 ;all outbound calls
-[peer]
+[bob]
 type=friend
-dtmfmode=rfc2833
 host=127.0.0.1
 port=5061
+
+[alice]
+type=friend
+host=127.0.0.1
+port=5062

Added: asterisk/trunk/tests/channels/SIP/sip_outbound_address/originator.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_outbound_address/originator.py?view=auto&rev=3481
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_outbound_address/originator.py (added)
+++ asterisk/trunk/tests/channels/SIP/sip_outbound_address/originator.py Fri Oct  5 11:25:34 2012
@@ -1,0 +1,57 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2012, Digium, Inc.
+Mark Michelson <mmichelson at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+import logging
+
+sys.path.append("lib/python")
+
+LOGGER = logging.getLogger(__name__)
+
+DESTINATIONS = [
+    'test1',
+    'test2',
+    'test3',
+    'test4',
+    'test5',
+    'test6',
+]
+
+class Originator(object):
+    def __init__(self, module_config, test_object):
+        test_object.register_ami_observer(self.ami_connect)
+        test_object.register_scenario_started_observer(self.scenario_started)
+        self.test_object = test_object
+        self.current_destination = 0
+
+    def ami_connect(self, ami):
+        LOGGER.info("AMI connected")
+        self.ami = ami
+
+    def success(self, result):
+        LOGGER.info("Originate Successful")
+        self.current_destination += 1
+
+    def originate_call(self):
+        def failure(result):
+            self.test_object.set_passed(False)
+            return result
+
+        dest = DESTINATIONS[self.current_destinations]
+
+        LOGGER.info("Originating call to %s" % dest)
+
+        deferred = self.ami.originate(channel='Local/%s at default' % dest,
+                application='Echo')
+        deferred.addCallback(self.success).addErrback(failure)
+
+    def scenario_started(self, result):
+        LOGGER.info("Scenario started. Originating call")
+        self.originate_call()
+        return result

Propchange: asterisk/trunk/tests/channels/SIP/sip_outbound_address/originator.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/sip_outbound_address/originator.py
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/sip_outbound_address/originator.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/SIP/sip_outbound_address/sipp/uas.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_outbound_address/sipp/uas.xml?view=auto&rev=3481
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_outbound_address/sipp/uas.xml (added)
+++ asterisk/trunk/tests/channels/SIP/sip_outbound_address/sipp/uas.xml Fri Oct  5 11:25:34 2012
@@ -1,0 +1,106 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<!-- This program is free software; you can redistribute it and/or      -->
+<!-- modify it under the terms of the GNU General Public License as     -->
+<!-- published by the Free Software Foundation; either version 2 of the -->
+<!-- License, or (at your option) any later version.                    -->
+<!--                                                                    -->
+<!-- This program is distributed in the hope that it will be useful,    -->
+<!-- but WITHOUT ANY WARRANTY; without even the implied warranty of     -->
+<!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the      -->
+<!-- GNU General Public License for more details.                       -->
+<!--                                                                    -->
+<!-- You should have received a copy of the GNU General Public License  -->
+<!-- along with this program; if not, write to the                      -->
+<!-- Free Software Foundation, Inc.,                                    -->
+<!-- 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA             -->
+<!--                                                                    -->
+<!--                 Sipp default 'uas' scenario.                       -->
+<!--                                                                    -->
+
+<scenario name="Basic UAS responder">
+  <Global variables="remote_tag" />
+  <recv request="INVITE" crlf="true">
+      <!-- Save the from tag. We'll need it when we send our BYE -->
+      <action>
+          <ereg regexp=".*(;tag=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+	  </action>
+  </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 retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [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-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio [media_port] RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK"
+        rtd="true"
+        crlf="true">
+  </recv>
+
+  <pause/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag01[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>[$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200">
+  </recv>
+
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+

Propchange: asterisk/trunk/tests/channels/SIP/sip_outbound_address/sipp/uas.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/SIP/sip_outbound_address/sipp/uas.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/SIP/sip_outbound_address/sipp/uas.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: asterisk/trunk/tests/channels/SIP/sip_outbound_address/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/SIP/sip_outbound_address/test-config.yaml?view=diff&rev=3481&r1=3480&r2=3481
==============================================================================
--- asterisk/trunk/tests/channels/SIP/sip_outbound_address/test-config.yaml (original)
+++ asterisk/trunk/tests/channels/SIP/sip_outbound_address/test-config.yaml Fri Oct  5 11:25:34 2012
@@ -1,5 +1,4 @@
 testinfo:
-    skip: 'Skip while failures are debugged'
     summary:     'Test explicit outbound host for SIP calls'
     description: |
         "This tests the ability to specify an explicit host to send
@@ -15,13 +14,41 @@
     issues:
         - jira : 'ABE-2153'
 
+test-modules:
+    add-test-to-search-path: 'True'
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            typename: 'originator.Originator'
+
+test-object-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': { 'scenario': 'uas.xml', '-p': '5061' } }
+        -
+            scenarios:
+                - { 'key-args': { 'scenario': 'uas.xml', '-p': '5062' } }
+        -
+            scenarios:
+                - { 'key-args': { 'scenario': 'uas.xml', '-p': '5062' } }
+        -
+            scenarios:
+                - { 'key-args': { 'scenario': 'uas.xml', '-p': '5062' } }
+        -
+            scenarios:
+                - { 'key-args': { 'scenario': 'uas.xml', '-p': '5062' } }
+        -
+            scenarios:
+                - { 'key-args': { 'scenario': 'uas.xml', '-p': '5061' } }
+
 properties:
     minversion: '1.8.0.0'
     dependencies:
-        - app : 'bash'
-        - app : 'asttest'
+        - python: 'starpy'
         - sipp :
-            version : 'v3.0'
-            feature : 'PCAP'
+            version : 'v3.1'
     tags:
         - SIP

Modified: asterisk/trunk/tests/manager/login/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/manager/login/run-test?view=diff&rev=3481&r1=3480&r2=3481
==============================================================================
--- asterisk/trunk/tests/manager/login/run-test (original)
+++ asterisk/trunk/tests/manager/login/run-test Fri Oct  5 11:25:34 2012
@@ -9,10 +9,13 @@
 
 import sys
 from twisted.internet import reactor
+import logging
+import logging.config
 
 sys.path.append("lib/python")
 from asterisk.asterisk import Asterisk
 from asterisk.TestCase import TestCase
+LOGGER = logging.getLogger(__name__)
 
 class AMILoginTest(TestCase):
     def __init__(self):




More information about the asterisk-commits mailing list