[asterisk-commits] mmichelson: branch mmichelson/v6tests r481 - in /asterisk/team/mmichelson/v6t...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Jul 12 17:30:24 CDT 2010
Author: mmichelson
Date: Mon Jul 12 17:30:20 2010
New Revision: 481
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=481
Log:
Commit progress on SIP registration test.
The test's purpose is to have a client with an IPv4 and an IPv6
address register with Asterisk. Currently, the test is actually
passing, but the test code is claiming the test is failing. I'll
have to get that sorted out when I have more time.
Added:
asterisk/team/mmichelson/v6tests/tests/sip_register/
asterisk/team/mmichelson/v6tests/tests/sip_register/configs/
asterisk/team/mmichelson/v6tests/tests/sip_register/configs/manager.conf (with props)
asterisk/team/mmichelson/v6tests/tests/sip_register/configs/sip.conf (with props)
asterisk/team/mmichelson/v6tests/tests/sip_register/run-test (with props)
asterisk/team/mmichelson/v6tests/tests/sip_register/sipp/
asterisk/team/mmichelson/v6tests/tests/sip_register/sipp/registerv4.xml (with props)
asterisk/team/mmichelson/v6tests/tests/sip_register/sipp/registerv6.xml (with props)
Added: asterisk/team/mmichelson/v6tests/tests/sip_register/configs/manager.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/v6tests/tests/sip_register/configs/manager.conf?view=auto&rev=481
==============================================================================
--- asterisk/team/mmichelson/v6tests/tests/sip_register/configs/manager.conf (added)
+++ asterisk/team/mmichelson/v6tests/tests/sip_register/configs/manager.conf Mon Jul 12 17:30:20 2010
@@ -1,0 +1,9 @@
+[general]
+enabled = yes
+port = 5038
+bindaddr = 127.0.0.1
+
+[user]
+secret = mysecret
+read = system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
+write = system,call,agent,user,config,command,reporting,originate
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_register/configs/manager.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_register/configs/manager.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_register/configs/manager.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/mmichelson/v6tests/tests/sip_register/configs/sip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/v6tests/tests/sip_register/configs/sip.conf?view=auto&rev=481
==============================================================================
--- asterisk/team/mmichelson/v6tests/tests/sip_register/configs/sip.conf (added)
+++ asterisk/team/mmichelson/v6tests/tests/sip_register/configs/sip.conf Mon Jul 12 17:30:20 2010
@@ -1,0 +1,10 @@
+[general]
+bindaddr=[::]:5060
+
+[v4]
+type=friend
+host=dynamic
+
+[v6]
+type=friend
+host=dynamic
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_register/configs/sip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_register/configs/sip.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_register/configs/sip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/mmichelson/v6tests/tests/sip_register/run-test
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/v6tests/tests/sip_register/run-test?view=auto&rev=481
==============================================================================
--- asterisk/team/mmichelson/v6tests/tests/sip_register/run-test (added)
+++ asterisk/team/mmichelson/v6tests/tests/sip_register/run-test Mon Jul 12 17:30:20 2010
@@ -1,0 +1,135 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2010, Digium, Inc.
+David Vossel <dvossel at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+import os
+import signal
+import subprocess
+from optparse import OptionParser
+from twisted.application import service, internet
+from twisted.internet import reactor, defer
+from starpy import manager
+
+sys.path.append("lib/python")
+from asterisk.asterisk import Asterisk
+from asterisk.version import AsteriskVersion
+
+class RegisterTest:
+ def __init__(self, argv):
+ self.last_step = ""
+ self.sipps=[]
+
+ #get version info
+ parser = OptionParser()
+ parser.add_option("-v", "--version", dest="ast_version",
+ help="Asterisk version string")
+ (options, args) = parser.parse_args(argv)
+ self.ast_version = AsteriskVersion(options.ast_version)
+
+ reactor.callWhenRunning(self.run)
+
+ print self.ast_version
+ self.asterisk = Asterisk(base="/tmp/asterisk-testsuite/sip_register")
+ self.asterisk.install_config("tests/sip_register/configs/sip.conf")
+ self.asterisk.install_config("tests/sip_register/configs/manager.conf")
+
+ def startAsterisk(self):
+ self.logLastStep("Starting Asterisk")
+ self.asterisk.start()
+
+ def amiOnConnect(self, ami):
+ self.logLastStep("Connected to the AMI")
+ self.ami = ami
+ self.ami.registerEvent("PeerStatus", self.checkRegisterResult)
+
+ def amiLoginError(self, ami):
+ self.logLastStep("AMI login failed")
+ reactor.callLater(1, self.shutDown)
+
+ def amiLogin(self):
+ self.logLastStep("Logging in to the AMI")
+ self.ami_factory = manager.AMIFactory("user", "mysecret")
+ self.ami_factory.login('127.0.0.1', 5038).addCallbacks(self.amiOnConnect, self.amiLoginError)
+
+ def checkRegisterResult(self, ami, event):
+ peer = event.get("peer")
+ status = event.get("peerstatus")
+
+ self.logLastStep("Checking registration result")
+ for i in self.sipps:
+ if i['peer'] == peer:
+ break;
+
+ if not i:
+ return
+
+ if status == "Registered":
+ i['pass'] = True
+ print ("Successful registration for peer %s" % (peer))
+ else:
+ print ("Registration for peer %s in state %s" % (peer, status))
+
+ def startSipp(self, peer, host, scenario, port):
+ self.logLastStep("Starting SIPp scenario %s" % (scenario))
+ self.sipps.append({'peer': peer,
+ 'process': subprocess.Popen(['sipp', host, '-sf', 'tests/sip_register/sipp/%s' % (scenario), '-p', '%s' % (port), '-m', '1', '-i', '%s' % (host)]),
+ 'pass': False})
+
+ def logLastStep(self, step):
+ print step
+ self.lastStep = step
+
+ def shutDown(self):
+ if not self.sipps:
+ self.asterisk.stop()
+ return
+
+ passing = True
+
+ for i in self.sipps:
+ if i['pass'] == True:
+ continue;
+ else:
+ passing = False
+ print ("Registration failure for peer %s" % i['peer'])
+ i['process'].terminate()
+
+ self.asterisk.stop()
+
+ self.passed = passing
+
+ if self.passed == True:
+ print "Shit passed!"
+ else:
+ print "Shit failed :("
+
+ if reactor.running:
+ print "Stopping reactor"
+ reactor.stop()
+
+ def run(self):
+ self.startAsterisk()
+ self.amiLogin()
+ self.startSipp("v4", "127.0.0.1", "registerv4.xml", "5061")
+ self.startSipp("v6", "[::1]", "registerv6.xml", "5062")
+ reactor.callLater(5, self.shutDown)
+
+def main(argv=None):
+ if argv is None:
+ argv = sys.argv
+
+ # Run Register Test
+ register_test = RegisterTest(argv)
+ reactor.run()
+ if register_test.passed != True:
+ return 1
+ return 0
+
+if __name__ == "__main__":
+ sys.exit(main() or 0)
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_register/run-test
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_register/run-test
------------------------------------------------------------------------------
svn:executable = *
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_register/run-test
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_register/run-test
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/mmichelson/v6tests/tests/sip_register/sipp/registerv4.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/v6tests/tests/sip_register/sipp/registerv4.xml?view=auto&rev=481
==============================================================================
--- asterisk/team/mmichelson/v6tests/tests/sip_register/sipp/registerv4.xml (added)
+++ asterisk/team/mmichelson/v6tests/tests/sip_register/sipp/registerv4.xml Mon Jul 12 17:30:20 2010
@@ -1,0 +1,25 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<scenario name="Basic Sipstone UAC">
+ <!-- In client mode (sipp placing calls), the Call-ID MUST be -->
+ <!-- generated by sipp. To do so, use [call_id] keyword. -->
+ <send retrans="500">
+ <![CDATA[
+
+ REGISTER sip:v4@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: v4 <sip:v4@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+ To: <sip:v4@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: 1 REGISTER
+ Contact: sip:v4@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Performance Test
+ Expires: 3600
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <recv response="200" rtd="true" />
+</scenario>
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_register/sipp/registerv4.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_register/sipp/registerv4.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_register/sipp/registerv4.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/mmichelson/v6tests/tests/sip_register/sipp/registerv6.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/mmichelson/v6tests/tests/sip_register/sipp/registerv6.xml?view=auto&rev=481
==============================================================================
--- asterisk/team/mmichelson/v6tests/tests/sip_register/sipp/registerv6.xml (added)
+++ asterisk/team/mmichelson/v6tests/tests/sip_register/sipp/registerv6.xml Mon Jul 12 17:30:20 2010
@@ -1,0 +1,25 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<scenario name="Basic Sipstone UAC">
+ <!-- In client mode (sipp placing calls), the Call-ID MUST be -->
+ <!-- generated by sipp. To do so, use [call_id] keyword. -->
+ <send retrans="500">
+ <![CDATA[
+
+ REGISTER sip:v6@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: v6 <sip:v6@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+ To: <sip:v6@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: 1 REGISTER
+ Contact: sip:v6@[local_ip]:[local_port]
+ Max-Forwards: 70
+ Subject: Performance Test
+ Expires: 3600
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <recv response="200" rtd="true" />
+</scenario>
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_register/sipp/registerv6.xml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_register/sipp/registerv6.xml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/mmichelson/v6tests/tests/sip_register/sipp/registerv6.xml
------------------------------------------------------------------------------
svn:mime-type = text/plain
More information about the asterisk-commits
mailing list