[asterisk-commits] mmichelson: testsuite/asterisk/trunk r5569 - in /asterisk/trunk/tests/channel...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Mon Sep 8 10:38:08 CDT 2014
Author: mmichelson
Date: Mon Sep 8 10:37:56 2014
New Revision: 5569
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5569
Log:
Add a nominal test for inter-Asterisk MWI publication.
This is a simple base test that sends MWI-related PUBLISH
requests from one Asterisk server to a second Asterisk server.
The test passes if the second Asterisk server emits expected
MessageWaiting events for the mailbox whose state was updated.
ASTERISK-24116 #close
Reported by Matt Jordan
Review: https://reviewboard.asterisk.org/r/3951
Added:
asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/
asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/configs/
asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/configs/ast1/
asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/configs/ast1/pjsip.conf (with props)
asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/configs/ast2/
asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/configs/ast2/pjsip.conf (with props)
asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/mwi_sender.py (with props)
asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/test-config.yaml (with props)
Modified:
asterisk/trunk/tests/channels/pjsip/publish/tests.yaml
Added: asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/configs/ast1/pjsip.conf?view=auto&rev=5569
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/configs/ast1/pjsip.conf Mon Sep 8 10:37:56 2014
@@ -1,0 +1,26 @@
+[global]
+type=global
+debug=yes
+
+[main-transport]
+type=transport
+bind = 127.0.0.1:5060
+
+[ast2]
+type=outbound-publish
+server_uri=sip:ast1 at 127.0.0.1:5061
+event=asterisk-mwi
+ at mailbox_state_filter=bunny-rabbit
+[global]
+type=global
+debug=yes
+
+[main-transport]
+type=transport
+bind = 127.0.0.1:5060
+
+[ast2]
+type=outbound-publish
+server_uri=sip:ast1 at 127.0.0.1:5061
+event=asterisk-mwi
+ at mailbox_state_filter=bunny-rabbit
Propchange: asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/configs/ast2/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/configs/ast2/pjsip.conf?view=auto&rev=5569
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/configs/ast2/pjsip.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/configs/ast2/pjsip.conf Mon Sep 8 10:37:56 2014
@@ -1,0 +1,36 @@
+[global]
+type=global
+debug=yes
+
+[main-transport]
+type=transport
+bind = 127.0.0.1:5061
+
+[ast1]
+type=endpoint
+
+[ast1]
+type=inbound-publication
+event_asterisk-mwi=ast1
+
+[ast1]
+type=asterisk-publication
+mailbox_state=yes
+[global]
+type=global
+debug=yes
+
+[main-transport]
+type=transport
+bind = 127.0.0.1:5061
+
+[ast1]
+type=endpoint
+
+[ast1]
+type=inbound-publication
+event_asterisk-mwi=ast1
+
+[ast1]
+type=asterisk-publication
+mailbox_state=yes
Propchange: asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/configs/ast2/pjsip.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/configs/ast2/pjsip.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/configs/ast2/pjsip.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/mwi_sender.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/mwi_sender.py?view=auto&rev=5569
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/mwi_sender.py (added)
+++ asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/mwi_sender.py Mon Sep 8 10:37:56 2014
@@ -1,0 +1,34 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2014, 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.
+'''
+
+
+class MWISender(object):
+ '''Test module that updates MWI on the sending Asterisk server.
+
+ This reads test module configuration from test-config.yaml to determine
+ what MWIUpdate AMI commands to send in order to complete the test.
+ '''
+ def __init__(self, module_config, test_object):
+ self.config = module_config
+ test_object.register_ami_observer(self.ami_connect)
+
+ def ami_connect(self, ami):
+ '''Send configured AMI MWIUpdate commands'''
+ if ami.id == 1:
+ # ID 1 is the receiving Asterisk server.
+ return
+
+ for msg in self.config['messages']:
+ ami_msg = {
+ 'Action': 'MWIUpdate',
+ 'Mailbox': self.config['mailbox'],
+ 'NewMessages': msg['new'],
+ 'OldMessages': msg['old'],
+ }
+ ami.sendMessage(ami_msg)
Propchange: asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/mwi_sender.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/mwi_sender.py
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/mwi_sender.py
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/test-config.yaml?view=auto&rev=5569
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/test-config.yaml Mon Sep 8 10:37:56 2014
@@ -1,0 +1,180 @@
+testinfo:
+ summary: 'Test the nominal transmission and reception of inter-Asterisk message waiting SIP PUBLISHes.'
+ description: |
+ 'Two Asterisk servers are started. Asterisk 1 transmits MWI PUBLISH requests to Asterisk 2. The
+ test succeeds if Asterisk 2 successfully receives and processes the PUBLISH requests. If Asterisk
+ 2 does not emit MWI events or if the MWI events emitted do not have expected values, then the
+ test fails.'
+
+properties:
+ minversion: '13.0.0'
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'res_pjsip'
+ - asterisk: 'res_pjsip_outbound_publish'
+ - asterisk: 'res_pjsip_publish_asterisk'
+ - asterisk: 'res_mwi_external'
+ - asterisk: 'res_mwi_external_ami'
+ tags:
+ - pjsip
+ - mwi_external
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-object-config
+ typename: 'test_case.TestCaseModule'
+ modules:
+ -
+ config-section: mwi-sender
+ typename: 'mwi_sender.MWISender'
+ -
+ config-section: mwi-receiver
+ typename: 'ami.AMIEventModule'
+
+test-object-config:
+ asterisk-instances: 2
+ connect-ami: True
+
+mwi-sender:
+ mailbox: 'bunny-rabbit'
+ messages:
+ -
+ new: '2'
+ old: '0'
+ -
+ new: '1'
+ old: '1'
+ -
+ new: '0'
+ old: '2'
+ -
+ new: '0'
+ old: '0'
+
+mwi-receiver:
+ -
+ id: '1'
+ type: 'orderedheadermatch'
+ conditions:
+ match:
+ Event: 'MessageWaiting'
+ Mailbox: 'bunny-rabbit'
+ requirements:
+ -
+ match:
+ # XXX Waiting should be '1' here, but we use '0' to work around
+ # an issue. See ASTERISK-24272
+ Waiting: '0'
+ New: '2'
+ Old: '0'
+ -
+ match:
+ # XXX Waiting should be '1' here, but we use '0' to work around
+ # an issue. See ASTERISK-24272
+ Waiting: '0'
+ New: '1'
+ Old: '1'
+ -
+ match:
+ Waiting: '0'
+ New: '0'
+ Old: '2'
+ -
+ match:
+ Waiting: '0'
+ New: '0'
+ Old: '0'
+ count: '4'
+ action: 'stop'
+testinfo:
+ summary: 'Test the nominal transmission and reception of inter-Asterisk message waiting SIP PUBLISHes.'
+ description: |
+ 'Two Asterisk servers are started. Asterisk 1 transmits MWI PUBLISH requests to Asterisk 2. The
+ test succeeds if Asterisk 2 successfully receives and processes the PUBLISH requests. If Asterisk
+ 2 does not emit MWI events or if the MWI events emitted do not have expected values, then the
+ test fails.'
+
+properties:
+ minversion: '13.0.0'
+ dependencies:
+ - python: 'twisted'
+ - python: 'starpy'
+ - asterisk: 'res_pjsip'
+ - asterisk: 'res_pjsip_outbound_publish'
+ - asterisk: 'res_pjsip_publish_asterisk'
+ - asterisk: 'res_mwi_external'
+ - asterisk: 'res_mwi_external_ami'
+ tags:
+ - pjsip
+ - mwi_external
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: test-object-config
+ typename: 'test_case.TestCaseModule'
+ modules:
+ -
+ config-section: mwi-sender
+ typename: 'mwi_sender.MWISender'
+ -
+ config-section: mwi-receiver
+ typename: 'ami.AMIEventModule'
+
+test-object-config:
+ asterisk-instances: 2
+ connect-ami: True
+
+mwi-sender:
+ mailbox: 'bunny-rabbit'
+ messages:
+ -
+ new: '2'
+ old: '0'
+ -
+ new: '1'
+ old: '1'
+ -
+ new: '0'
+ old: '2'
+ -
+ new: '0'
+ old: '0'
+
+mwi-receiver:
+ -
+ id: '1'
+ type: 'orderedheadermatch'
+ conditions:
+ match:
+ Event: 'MessageWaiting'
+ Mailbox: 'bunny-rabbit'
+ requirements:
+ -
+ match:
+ # XXX Waiting should be '1' here, but we use '0' to work around
+ # an issue. See ASTERISK-24272
+ Waiting: '0'
+ New: '2'
+ Old: '0'
+ -
+ match:
+ # XXX Waiting should be '1' here, but we use '0' to work around
+ # an issue. See ASTERISK-24272
+ Waiting: '0'
+ New: '1'
+ Old: '1'
+ -
+ match:
+ Waiting: '0'
+ New: '0'
+ Old: '2'
+ -
+ match:
+ Waiting: '0'
+ New: '0'
+ Old: '0'
+ count: '4'
+ action: 'stop'
Propchange: asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/trunk/tests/channels/pjsip/publish/asterisk_event_mwi/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: asterisk/trunk/tests/channels/pjsip/publish/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/publish/tests.yaml?view=diff&rev=5569&r1=5568&r2=5569
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/publish/tests.yaml (original)
+++ asterisk/trunk/tests/channels/pjsip/publish/tests.yaml Mon Sep 8 10:37:56 2014
@@ -1,3 +1,4 @@
# Enter tests here in the order they should be considered for execution:
tests:
- test: 'asterisk_event_devicestate'
+ - test: 'asterisk_event_mwi'
More information about the asterisk-commits
mailing list