[asterisk-commits] gtjoseph: testsuite/asterisk/trunk r5703 - in /asterisk/trunk/tests/phoneprov...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Thu Oct 9 15:59:14 CDT 2014
Author: gtjoseph
Date: Thu Oct 9 15:59:10 2014
New Revision: 5703
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5703
Log:
testsuite: Initial test for res_pjsip_phoneprov_provider
This is the first test for res_pjsip_phoneprov_provider
Tested-by: George Joseph
Review: https://reviewboard.asterisk.org/r/4065/
Added:
asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/
asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/cfgbase.txt (with props)
asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/cfgex.txt (with props)
asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/configs/
asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/configs/ast1/
asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/configs/ast1/phoneprov.conf (with props)
asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/configs/ast1/pjsip.conf (with props)
asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/run-test (with props)
asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/test-config.yaml (with props)
Modified:
asterisk/trunk/tests/phoneprov/tests.yaml
Added: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/cfgbase.txt
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/cfgbase.txt?view=auto&rev=5703
==============================================================================
--- asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/cfgbase.txt (added)
+++ asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/cfgbase.txt Thu Oct 9 15:59:10 2014
@@ -1,0 +1,16 @@
+profile_variable: ${PROFILE_VARIABLE}
+context: ${PJSIP_ENDPOINT(${ENDPOINT_ID},context)}
+mac: ${MAC}
+profile: ${PROFILE}
+username: ${USERNAME}
+callerid: ${CALLERID}
+display_name: ${DISPLAY_NAME}
+secret: ${SECRET}
+server: ${SERVER}
+server_port: ${SERVER_PORT}
+line: ${LINE}
+linekeys: ${LINEKEYS}
+timezone: ${TIMEZONE}
+tzoffset: ${TZOFFSET}
+extension_length: ${EXTENSION_LENGTH}
+${PP_EACH_EXTENSION(${MAC},cfgex.txt)}
Propchange: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/cfgbase.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/cfgbase.txt
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision URL
Propchange: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/cfgbase.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/cfgex.txt
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/cfgex.txt?view=auto&rev=5703
==============================================================================
--- asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/cfgex.txt (added)
+++ asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/cfgex.txt Thu Oct 9 15:59:10 2014
@@ -1,0 +1,3 @@
+username_${LINE}: ${USERNAME}
+display_name_${LINE}: ${DISPLAY_NAME}
+context_${LINE}: ${PJSIP_ENDPOINT(${USERNAME},context)}
Propchange: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/cfgex.txt
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/cfgex.txt
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision URL
Propchange: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/cfgex.txt
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/configs/ast1/phoneprov.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/configs/ast1/phoneprov.conf?view=auto&rev=5703
==============================================================================
--- asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/configs/ast1/phoneprov.conf (added)
+++ asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/configs/ast1/phoneprov.conf Thu Oct 9 15:59:10 2014
@@ -1,0 +1,8 @@
+[general]
+default_profile=profile1
+
+[profile1]
+setvar = EXTENSION_LENGTH = 3
+setvar = PROFILE_VARIABLE = this is a test
+setvar = TIMEZONE = America/Denver
+cfgbase${MAC}.txt => cfgbase.txt,text/plain
Propchange: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/configs/ast1/phoneprov.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/configs/ast1/phoneprov.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision URL
Propchange: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/configs/ast1/phoneprov.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/configs/ast1/pjsip.conf?view=auto&rev=5703
==============================================================================
--- asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/configs/ast1/pjsip.conf Thu Oct 9 15:59:10 2014
@@ -1,0 +1,64 @@
+
+[ipv4]
+type = transport
+bind = 127.0.0.1:41060
+
+[6000]
+type=endpoint
+callerid = Joe <6000>
+aors=6000
+auth=6000
+context = defctx1
+transport = ipv4
+
+[6000]
+type = aor
+qualify_frequency = 60
+minimum_expiration = 30
+max_contacts = 1
+
+[6000]
+type = auth
+auth_type = userpass
+username = 6000
+password = 1234
+
+[6000]
+type=phoneprov
+endpoint = 6000
+MAC = 112233445566
+PROFILE=profile1
+SERVER=127.0.0.1
+LINEKEYS=2
+LINE=1
+
+[6001]
+type=endpoint
+callerid = Joe <6001>
+aors=6001
+auth=6001
+context = defctx2
+transport = ipv4
+
+[6001]
+type = aor
+qualify_frequency = 60
+minimum_expiration = 30
+max_contacts = 1
+
+[6001]
+type = auth
+auth_type = userpass
+username = 6001
+password = 1234
+
+[6001]
+type=phoneprov
+endpoint = 6001
+MAC = 112233445566
+PROFILE=profile1
+SERVER=127.0.0.1
+LINEKEYS=2
+LINE=2
+
+
Propchange: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision URL
Propchange: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/run-test?view=auto&rev=5703
==============================================================================
--- asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/run-test (added)
+++ asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/run-test Thu Oct 9 15:59:10 2014
@@ -1,0 +1,78 @@
+#!/usr/bin/env python
+"""Test res_phoneprov basic ops
+
+Copyright (C) 2014, Fairview 5 Engineering, LLC
+George Joseph <george.joseph at fairview5.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+"""
+
+import os
+import sys
+import logging
+
+from twisted.internet import reactor
+from email.parser import HeaderParser
+from shutil import copy
+from httplib import *
+sys.path.append("lib/python")
+from asterisk.test_case import TestCase
+
+LOGGER = logging.getLogger(__name__)
+PATH = os.path.dirname(os.path.realpath(__file__))
+
+class ResPhoneprovTest(TestCase):
+ def __init__(self):
+ super(ResPhoneprovTest, self).__init__()
+ self.reactor_timeout = 15
+ self.create_asterisk()
+
+ def run(self):
+ super(ResPhoneprovTest, self).run()
+ self.passed = True
+
+ try:
+ copy("%s/cfgbase.txt" % PATH,
+ "%s/var/lib/asterisk/phoneprov/cfgbase.txt" % self.ast[0].base)
+ copy("%s/cfgex.txt" % PATH,
+ "%s/var/lib/asterisk/phoneprov/cfgex.txt" % self.ast[0].base)
+ self.con = HTTPConnection("127.0.0.1:8088")
+ self.con.request("GET", "/phoneprov/cfgbase112233445566.txt")
+ self.res = self.con.getresponse()
+ self.data = self.res.read()
+ except:
+ self.stop_reactor()
+ self.passed = False
+ raise
+
+ if self.res.status != 200:
+ LOGGER.error("Status code was %d\n%s." % (self.res.status, self.data))
+ self.passed = False
+ self.stop_reactor()
+ return
+
+ response = HeaderParser().parsestr(self.data)
+
+ for name, value in self.test_config.config['substitutions'].items():
+ if response.get(name) != value:
+ LOGGER.error("'%s' was '%s' instead of '%s'" % (name, response.get(name), value))
+ self.passed = False
+ break
+
+ if not self.passed:
+ LOGGER.error(response)
+
+ self.stop_reactor()
+
+def main():
+ test = ResPhoneprovTest()
+ reactor.run()
+
+ if not test.passed:
+ return 1
+
+ return 0
+
+if __name__ == "__main__":
+ sys.exit(main() or 0)
Propchange: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/run-test
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/run-test
------------------------------------------------------------------------------
svn:executable = *
Propchange: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/run-test
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision URL
Propchange: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/run-test
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/test-config.yaml?view=auto&rev=5703
==============================================================================
--- asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/test-config.yaml (added)
+++ asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/test-config.yaml Thu Oct 9 15:59:10 2014
@@ -1,0 +1,31 @@
+testinfo:
+ summary: 'Test res_phoneprov_pjsip basic ops'
+ description: |
+ 'Test res_phoneprov_pjsip basic ops by setting up a user in pjsip.conf and insuring
+ that proper template substitution is done.
+
+properties:
+ minversion: '12.7.0'
+ dependencies:
+ - python : 'twisted'
+ - python : 'starpy'
+ - python : 'httplib'
+ - python : 'email'
+ - asterisk : 'chan_pjsip'
+ - asterisk : 'res_pjsip'
+ - asterisk : 'res_phoneprov'
+ - asterisk : 'res_pjsip_phoneprov_provider'
+
+substitutions:
+ profile_variable: "this is a test"
+ context: "defctx1"
+ username: "6000"
+ callerid: "6000"
+ display_name: "Joe"
+ server: "127.0.0.1"
+ server_port: "41060"
+ extension_length: "3"
+ timezone: "America/Denver"
+ tzoffset: "-25200"
+ context_1: "defctx1"
+ context_2: "defctx2"
Propchange: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision URL
Propchange: asterisk/trunk/tests/phoneprov/res_phoneprov_pjsip/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: asterisk/trunk/tests/phoneprov/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/phoneprov/tests.yaml?view=diff&rev=5703&r1=5702&r2=5703
==============================================================================
--- asterisk/trunk/tests/phoneprov/tests.yaml (original)
+++ asterisk/trunk/tests/phoneprov/tests.yaml Thu Oct 9 15:59:10 2014
@@ -1,3 +1,4 @@
# Enter tests here in the order they should be considered for execution:
tests:
- test: 'res_phoneprov'
+ - test: 'res_phoneprov_pjsip'
More information about the asterisk-commits
mailing list