[asterisk-commits] mjordan: testsuite/asterisk/trunk r4984 - in /asterisk/trunk/tests/channels/p...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri Apr 25 09:27:03 CDT 2014
Author: mjordan
Date: Fri Apr 25 09:26:53 2014
New Revision: 4984
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4984
Log:
tests/channels/pjsip/ami: Add test for PJSIPQualify
This tests verifies the PJSIPQualify AMI action. It verifies that an endpoint
receives an OPTIONS request when the action is executed.
Review: https://reviewboard.asterisk.org/r/3449/
ASTERISK-23534 #close
Reported by: Matt Jordan
patches:
pjsip_qualify_diff uploaded by jemidy (License 6581)
Added:
asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/
asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/AMISendTest.py (with props)
asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/configs/
asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/configs/ast1/
asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/configs/ast1/pjsip.conf (with props)
asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/sipp/
asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/sipp/options.xml (with props)
asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/test-config.yaml (with props)
Modified:
asterisk/trunk/tests/channels/pjsip/ami/tests.yaml
Added: asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/AMISendTest.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/AMISendTest.py?view=auto&rev=4984
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/AMISendTest.py (added)
+++ asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/AMISendTest.py Fri Apr 25 09:26:53 2014
@@ -1,0 +1,59 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2013-2014, Digium, Inc.
+Kevin Harwell <kharwell at digium.com>
+Modified by Scott Emidy <jemidy 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/asterisk")
+
+from twisted.internet import reactor
+from test_case import TestCase
+from sipp import SIPpScenario
+
+LOGGER = logging.getLogger(__name__)
+
+ACTION = {
+ "Action": "PJSIPQualify",
+ "Endpoint": "user1"
+}
+
+
+class AMISendTest(TestCase):
+ """Sends the AMI Action PJSIPQualify"""
+ def __init__(self, path=None, config=None):
+ """Constructor """
+ super(AMISendTest, self).__init__(path, config)
+ self.create_asterisk()
+ self.passed = False #This is default but it doesn't hurt to be explicit
+
+ def run(self):
+ super(AMISendTest, self).run()
+ self.create_ami_factory()
+
+ def ami_connect(self, ami):
+ """Starts the PJSIPQualify scenario and Runs Through the XML"""
+ super(AMISendTest, self).ami_connect(ami)
+
+ def _ami_action():
+ """ This Sends the PJSIPQualify Action """
+ LOGGER.info('Sending PJSIPQualify Action...')
+ ami.sendDeferred(ACTION).addCallback(ami.errorUnlessResponse)
+
+ LOGGER.info('Starting PJSIPQualify scenario')
+
+ sipp_options = (SIPpScenario(self.test_name,
+ {'scenario': 'options.xml', '-p': '5062'}))
+ sipp_options.run(self).addCallback(self.__on_return)
+ reactor.callLater(1,_ami_action)
+
+ def __on_return(self, result):
+ """Stops and Passes the Test if it Ran Successfully"""
+ self.passed = result.passed
+ self.stop_reactor()
Propchange: asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/AMISendTest.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/AMISendTest.py
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/AMISendTest.py
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/configs/ast1/pjsip.conf?view=auto&rev=4984
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/configs/ast1/pjsip.conf Fri Apr 25 09:26:53 2014
@@ -1,0 +1,27 @@
+[local]
+type=transport
+protocol=udp
+bind=0.0.0.0
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+[endpoint_q](!)
+type=endpoint
+transport=local
+context=default
+aors=user1
+direct_media=no
+disallow=all
+allow=ulaw
+
+[aor_q](!)
+type=aor
+max_contacts=1
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+[user1](aor_q)
+contact=sip:user1 at 127.0.0.1:5062
+
+[user1](endpoint_q)
+aors=user1
Propchange: asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/sipp/options.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/sipp/options.xml?view=auto&rev=4984
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/sipp/options.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/sipp/options.xml Fri Apr 25 09:26:53 2014
@@ -1,0 +1,23 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Options Request">
+
+ <recv request="OPTIONS" />
+
+ <send>
+ <![CDATA[
+
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[pid]SIPpTag[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Contact: <sip:user1@[local_ip]:[local_port];transport=[transport]>
+ Content-Type: application/sdp
+ Content-Length: [len]
+ ]]>
+ </send>
+
+</scenario>
Propchange: asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/sipp/options.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/sipp/options.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/sipp/options.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/test-config.yaml?view=auto&rev=4984
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/test-config.yaml Fri Apr 25 09:26:53 2014
@@ -1,0 +1,24 @@
+tinfo:
+ summary: 'Test PJSIPQualify AMI Action'
+ description: |
+ This Tests the AMI Action PJSIPQualify in order to make sure
+ the functionality is working properly.
+
+properties:
+ minversion: '12.0.0'
+ dependencies:
+ - sipp :
+ version : 'v3.0'
+ - asterisk : 'res_pjsip'
+ tags:
+ - pjsip
+
+test-modules:
+ # allow test_runner to find and run the local test
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: object-config
+ typename: 'AMISendTest.AMISendTest'
+
+object-config:
+ reactor-timeout: 15
Propchange: asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/pjsip/ami/pjsip_qualify/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: asterisk/trunk/tests/channels/pjsip/ami/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/ami/tests.yaml?view=diff&rev=4984&r1=4983&r2=4984
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/ami/tests.yaml (original)
+++ asterisk/trunk/tests/channels/pjsip/ami/tests.yaml Fri Apr 25 09:26:53 2014
@@ -1,5 +1,6 @@
# Enter tests here in the order they should be considered for execution:
tests:
+ - test: 'pjsip_qualify'
- test: 'show_endpoints'
- test: 'show_endpoint'
- test: 'show_registrations_inbound'
More information about the asterisk-commits
mailing list