[asterisk-commits] kmoore: branch group/bridge_construction r3754 - in /asterisk/team/group/brid...
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Fri May 3 12:50:23 CDT 2013
Author: kmoore
Date: Fri May 3 12:50:21 2013
New Revision: 3754
URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=3754
Log:
Add test for BridgeList and BridgeInfo manager actions
Added:
asterisk/team/group/bridge_construction/tests/manager/bridge_actions/
asterisk/team/group/bridge_construction/tests/manager/bridge_actions/check_bridge.py (with props)
asterisk/team/group/bridge_construction/tests/manager/bridge_actions/configs/
asterisk/team/group/bridge_construction/tests/manager/bridge_actions/configs/ast1/
asterisk/team/group/bridge_construction/tests/manager/bridge_actions/configs/ast1/extensions.conf (with props)
asterisk/team/group/bridge_construction/tests/manager/bridge_actions/test-config.yaml (with props)
Modified:
asterisk/team/group/bridge_construction/tests/bridge/simple_bridge/test-config.yaml
asterisk/team/group/bridge_construction/tests/manager/tests.yaml
Modified: asterisk/team/group/bridge_construction/tests/bridge/simple_bridge/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/group/bridge_construction/tests/bridge/simple_bridge/test-config.yaml?view=diff&rev=3754&r1=3753&r2=3754
==============================================================================
--- asterisk/team/group/bridge_construction/tests/bridge/simple_bridge/test-config.yaml (original)
+++ asterisk/team/group/bridge_construction/tests/bridge/simple_bridge/test-config.yaml Fri May 3 12:50:21 2013
@@ -12,9 +12,9 @@
-
config-section: 'cdr-config'
typename: 'cdr.CDRModule'
- -
- config-section: 'cel-config'
- typename: 'cel.CELModule'
+# -
+# config-section: 'cel-config'
+# typename: 'cel.CELModule'
-
typename: 'ami.AMIEventModule'
config-section: ami-uut
Added: asterisk/team/group/bridge_construction/tests/manager/bridge_actions/check_bridge.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/group/bridge_construction/tests/manager/bridge_actions/check_bridge.py?view=auto&rev=3754
==============================================================================
--- asterisk/team/group/bridge_construction/tests/manager/bridge_actions/check_bridge.py (added)
+++ asterisk/team/group/bridge_construction/tests/manager/bridge_actions/check_bridge.py Fri May 3 12:50:21 2013
@@ -1,0 +1,78 @@
+'''
+Copyright (C) 2013, Digium, Inc.
+Kinsey Moore <kmoore at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import logging
+
+LOGGER = logging.getLogger(__name__)
+
+class bridge_info_callback_container:
+ def __init__(self, ami):
+ self.ami = ami
+
+ def callback(self, result):
+ '''Ensure that only one bridge is listed and get detailed information about it
+ '''
+ channel_count = 0
+ for list_result in result:
+ if 'uniqueid' not in list_result:
+ continue
+
+ channel_count += 1
+
+ if channel_count < 2:
+ LOGGER.error("Not enough channels in the bridge")
+ if channel_count > 2:
+ LOGGER.error("Too many channels in the bridge")
+
+ def failed(self, reason):
+ LOGGER.error("BridgeInfo action failed: %s" % reason)
+ pass
+
+class bridge_list_callback_container:
+ def __init__(self, ami):
+ self.ami = ami
+
+ def callback(self, result):
+ '''Ensure that only one bridge is listed and get detailed information about it
+ '''
+ bridge_id = None
+ for list_result in result:
+ if 'bridgeuniqueid' not in list_result:
+ continue
+
+ if bridge_id is None:
+ bridge_id = list_result['bridgeuniqueid']
+ else:
+ LOGGER.error("More than one bridge returned where there should be only one")
+ return
+
+ if bridge_id is None:
+ LOGGER.error("No bridges returned where there should be one")
+ return
+
+ message = {
+ 'action' : 'BridgeInfo',
+ 'bridgeuniqueid' : bridge_id
+ }
+ info_callback = bridge_info_callback_container(self.ami)
+ self.ami.collectDeferred(message, 'BridgeInfoComplete').addCallbacks(info_callback.callback, info_callback.failed)
+
+ def failed(self, reason):
+ LOGGER.error("BridgeList action failed: %s" % reason)
+ pass
+
+def get_bridge_info(ami, event):
+ ''' Callback called when the second participant entered the bridge.
+ '''
+
+ message = {
+ 'action' : 'BridgeList'
+ }
+ list_callback = bridge_list_callback_container(ami)
+ ami.collectDeferred(message, 'BridgeListComplete').addCallbacks(list_callback.callback, list_callback.failed)
+ return True
Propchange: asterisk/team/group/bridge_construction/tests/manager/bridge_actions/check_bridge.py
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/group/bridge_construction/tests/manager/bridge_actions/check_bridge.py
------------------------------------------------------------------------------
svn:executable = *
Propchange: asterisk/team/group/bridge_construction/tests/manager/bridge_actions/check_bridge.py
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/group/bridge_construction/tests/manager/bridge_actions/check_bridge.py
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/group/bridge_construction/tests/manager/bridge_actions/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/group/bridge_construction/tests/manager/bridge_actions/configs/ast1/extensions.conf?view=auto&rev=3754
==============================================================================
--- asterisk/team/group/bridge_construction/tests/manager/bridge_actions/configs/ast1/extensions.conf (added)
+++ asterisk/team/group/bridge_construction/tests/manager/bridge_actions/configs/ast1/extensions.conf Fri May 3 12:50:21 2013
@@ -1,0 +1,4 @@
+[default]
+
+exten => test_call,1,Dial(SIP/test_call at bob,,wW)
+same => n,Hangup()
Propchange: asterisk/team/group/bridge_construction/tests/manager/bridge_actions/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/group/bridge_construction/tests/manager/bridge_actions/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/group/bridge_construction/tests/manager/bridge_actions/configs/ast1/extensions.conf
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: asterisk/team/group/bridge_construction/tests/manager/bridge_actions/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/group/bridge_construction/tests/manager/bridge_actions/test-config.yaml?view=auto&rev=3754
==============================================================================
--- asterisk/team/group/bridge_construction/tests/manager/bridge_actions/test-config.yaml (added)
+++ asterisk/team/group/bridge_construction/tests/manager/bridge_actions/test-config.yaml Fri May 3 12:50:21 2013
@@ -1,0 +1,43 @@
+testinfo:
+ summary: 'Test that BridgeList and BridgeInfo AMI actions works properly'
+ description: |
+ 'Set up a bridge between two endpoints and ensure that BridgeList
+ responds with the correct bridges and that BridgeInfo replies with
+ the correct channel information.'
+
+test-modules:
+ add-test-to-search-path: 'True'
+ test-object:
+ config-section: bridge-config
+ typename: 'BridgeTestCase.BridgeTestCase'
+ modules:
+ -
+ typename: 'ami.AMIEventModule'
+ config-section: ami-uut
+
+bridge-config:
+ test-runs:
+ -
+ originate_channel: 'SIP/test_call at uut'
+ hangup: 'alice'
+
+ami-uut:
+ -
+ type: 'callback'
+ id: '0'
+ conditions:
+ match:
+ Event: 'BridgeEnter'
+ Channel: 'SIP/bob-.*'
+ BridgeType: 'simple_bridge'
+ callbackModule: 'check_bridge'
+ callbackMethod: 'get_bridge_info'
+ count: '1'
+
+properties:
+ minversion: '12.0.0'
+ dependencies:
+ - python : 'twisted'
+ - python : 'starpy'
+ tags:
+ - bridge
Propchange: asterisk/team/group/bridge_construction/tests/manager/bridge_actions/test-config.yaml
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: asterisk/team/group/bridge_construction/tests/manager/bridge_actions/test-config.yaml
------------------------------------------------------------------------------
svn:keywords = Author Date Id Revision
Propchange: asterisk/team/group/bridge_construction/tests/manager/bridge_actions/test-config.yaml
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: asterisk/team/group/bridge_construction/tests/manager/tests.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/team/group/bridge_construction/tests/manager/tests.yaml?view=diff&rev=3754&r1=3753&r2=3754
==============================================================================
--- asterisk/team/group/bridge_construction/tests/manager/tests.yaml (original)
+++ asterisk/team/group/bridge_construction/tests/manager/tests.yaml Fri May 3 12:50:21 2013
@@ -5,5 +5,6 @@
- test: 'authlimit'
- test: 'authtimeout'
- test: 'acl-login'
+ - test: 'bridge_actions'
# Temporarily disabled while failures are debugged
#- test: 'response-time'
More information about the asterisk-commits
mailing list