[asterisk-commits] tests/rest api/applications: Add a subscribe-all test (testsuite[master])
SVN commits to the Asterisk project
asterisk-commits at lists.digium.com
Wed Sep 23 12:56:52 CDT 2015
Matt Jordan has submitted this change and it was merged.
Change subject: tests/rest_api/applications: Add a subscribe-all test
......................................................................
tests/rest_api/applications: Add a subscribe-all test
This patch adds a test that subscribes to all channels, bridges, device state,
and endpoint state using the applications resource. It verifies that given
those subscriptions, we receive the expected events over the WebSocket.
Change-Id: Ib87ec091c848366b8ed4485f832e23e1a0a37ed4
---
A tests/rest_api/applications/subscribe-all/configs/ast1/extensions.conf
A tests/rest_api/applications/subscribe-all/configs/ast1/pjsip.conf
A tests/rest_api/applications/subscribe-all/configs/ast1/sorcery.conf
A tests/rest_api/applications/subscribe-all/test-config.yaml
M tests/rest_api/applications/tests.yaml
5 files changed, 302 insertions(+), 0 deletions(-)
Approvals:
Matt Jordan: Looks good to me, approved; Verified
Joshua Colp: Looks good to me, but someone else must approve
diff --git a/tests/rest_api/applications/subscribe-all/configs/ast1/extensions.conf b/tests/rest_api/applications/subscribe-all/configs/ast1/extensions.conf
new file mode 100644
index 0000000..62dea66
--- /dev/null
+++ b/tests/rest_api/applications/subscribe-all/configs/ast1/extensions.conf
@@ -0,0 +1,14 @@
+
+[default]
+
+exten => echo,1,NoOp()
+ same => n,Echo()
+
+exten => dial_alice,1,NoOp()
+ same => n,Dial(PJSIP/1000 at alice)
+ same => n,Hangup()
+
+exten => 1000,1,NoOp()
+ same => n,Answer()
+ same => n,Wait(1)
+ same => n,Hangup()
diff --git a/tests/rest_api/applications/subscribe-all/configs/ast1/pjsip.conf b/tests/rest_api/applications/subscribe-all/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..cf1adfb
--- /dev/null
+++ b/tests/rest_api/applications/subscribe-all/configs/ast1/pjsip.conf
@@ -0,0 +1,8 @@
+[global]
+debug=yes
+type=global
+
+[local-transport-udp]
+type=transport
+bind=127.0.0.1
+protocol=udp
diff --git a/tests/rest_api/applications/subscribe-all/configs/ast1/sorcery.conf b/tests/rest_api/applications/subscribe-all/configs/ast1/sorcery.conf
new file mode 100644
index 0000000..73c95bf
--- /dev/null
+++ b/tests/rest_api/applications/subscribe-all/configs/ast1/sorcery.conf
@@ -0,0 +1,6 @@
+[res_pjsip]
+endpoint=memory,ps_endpoints
+aor=memory,ps_aor
+
+[res_pjsip_endpoint_identifier_ip]
+identify=memory,ps_identify
\ No newline at end of file
diff --git a/tests/rest_api/applications/subscribe-all/test-config.yaml b/tests/rest_api/applications/subscribe-all/test-config.yaml
new file mode 100644
index 0000000..57b1405
--- /dev/null
+++ b/tests/rest_api/applications/subscribe-all/test-config.yaml
@@ -0,0 +1,273 @@
+testinfo:
+ summary: Test subscribing to all resources
+ description: |
+ This test verifies that we can subscribe to
+ all channels, bridges, endpoints, and device
+ states using the applications resource.
+
+test-modules:
+ add-test-to-search-path: True
+ test-object:
+ config-section: test-object-config
+ typename: ari.AriBaseTestObject
+ modules:
+ -
+ config-section: pluggable-config
+ typename: pluggable_modules.EventActionModule
+ -
+ typename: pluggable_modules.ARIHangupMonitor
+
+pluggable-config:
+ -
+ ari-start:
+ ari-requests:
+ -
+ method: 'post'
+ uri: 'applications/testsuite/subscription?eventSource=bridge:'
+ expect: 200
+ -
+ method: 'post'
+ uri: 'applications/testsuite/subscription?eventSource=channel:'
+ expect: 200
+ -
+ method: 'post'
+ uri: 'applications/testsuite/subscription?eventSource=endpoint:'
+ expect: 200
+ -
+ method: 'post'
+ uri: 'applications/testsuite/subscription?eventSource=deviceState:'
+ expect: 200
+ -
+ method: 'put'
+ uri: 'asterisk/config/dynamic/res_pjsip/endpoint/alice'
+ body: { 'fields': [ { 'attribute': 'allow', 'value': '!all,ulaw,alaw' },
+ { 'attribute': 'context', 'value': 'default' },
+ { 'attribute': 'aors', 'value': 'alice' } ] }
+ expect: 200
+ -
+ method: 'put'
+ uri: 'asterisk/config/dynamic/res_pjsip/aor/alice'
+ body: { 'fields': [ { 'attribute': 'contact', 'value': 'sip:alice at 127.0.0.1:5060;transport=udp' } ] }
+ expect: 200
+ -
+ method: 'put'
+ uri: 'asterisk/config/dynamic/res_pjsip/identify/alice'
+ body: { 'fields': [ { 'attribute': 'match', 'value': '127.0.0.1' },
+ { 'attribute': 'endpoint', 'value': 'alice' } ] }
+ expect: 200
+ -
+ method: 'post'
+ uri: 'channels'
+ params:
+ endpoint: 'Local/dial_alice at default'
+ extension: 'echo'
+ expect: 200
+ -
+ # Matching of endpoint and device state subscriptions
+ ari-events:
+ -
+ match:
+ type: 'PeerStatusChange'
+ endpoint:
+ technology: 'PJSIP'
+ resource: 'alice'
+ state: 'offline'
+ application: 'testsuite'
+ peer:
+ peer_status: 'Unreachable'
+ count: 2
+ -
+ match:
+ type: 'DeviceStateChanged'
+ device_state:
+ name: 'PJSIP/alice'
+ state: 'INUSE'
+ count: 1
+ -
+ match:
+ type: 'DeviceStateChanged'
+ device_state:
+ name: 'Local/dial_alice at default'
+ state: 'INUSE'
+ count: 2
+ -
+ match:
+ type: 'DeviceStateChanged'
+ device_state:
+ name: 'Local/dial_alice at default'
+ state: 'NOT_INUSE'
+ count: '>1'
+ -
+ # Matching of channel subscription
+ ari-events:
+ -
+ match:
+ type: 'ChannelCreated'
+ channel:
+ name: 'Local/dial_alice at default-00000000;1'
+ count: 1
+ -
+ match:
+ type: 'ChannelCreated'
+ channel:
+ name: 'Local/dial_alice at default-00000000;2'
+ count: 1
+ -
+ match:
+ type: 'ChannelCreated'
+ channel:
+ name: 'PJSIP/alice-00000000'
+ count: 1
+ -
+ match:
+ type: 'ChannelCreated'
+ channel:
+ name: 'PJSIP/alice-00000001'
+ count: 1
+ -
+ match:
+ type: 'ChannelStateChange'
+ channel:
+ name: 'PJSIP/alice-00000001'
+ state: 'Up'
+ count: 1
+ -
+ match:
+ type: 'ChannelStateChange'
+ channel:
+ name: 'PJSIP/alice-00000000'
+ state: 'Up'
+ count: 1
+ -
+ match:
+ type: 'ChannelStateChange'
+ channel:
+ name: 'Local/dial_alice at default-00000000;2'
+ state: 'Up'
+ count: 1
+ -
+ match:
+ type: 'ChannelStateChange'
+ channel:
+ name: 'Local/dial_alice at default-00000000;1'
+ state: 'Up'
+ count: 1
+ -
+ match:
+ type: 'ChannelHangupRequest'
+ channel:
+ name: 'PJSIP/alice-00000001'
+ count: 1
+ -
+ match:
+ type: 'ChannelDestroyed'
+ channel:
+ name: 'PJSIP/alice-00000001'
+ count: 1
+ -
+ match:
+ type: 'ChannelHangupRequest'
+ channel:
+ name: 'PJSIP/alice-00000000'
+ count: 1
+ -
+ match:
+ type: 'ChannelDestroyed'
+ channel:
+ name: 'PJSIP/alice-00000000'
+ count: 1
+ -
+ match:
+ type: 'ChannelDestroyed'
+ channel:
+ name: 'Local/dial_alice at default-00000000;1'
+ count: 1
+ -
+ match:
+ type: 'ChannelDestroyed'
+ channel:
+ name: 'Local/dial_alice at default-00000000;2'
+ count: 1
+ -
+ # Matching of bridge subscription
+ ari-events:
+ -
+ match:
+ type: 'BridgeCreated'
+ bridge:
+ technology: 'simple_bridge'
+ bridge_type: 'mixing'
+ bridge_class: 'basic'
+ count: 1
+ -
+ match:
+ type: 'ChannelEnteredBridge'
+ channel:
+ name: 'PJSIP/alice-00000000'
+ bridge:
+ technology: 'simple_bridge'
+ bridge_type: 'mixing'
+ bridge_class: 'basic'
+ count: 1
+ -
+ match:
+ type: 'ChannelEnteredBridge'
+ channel:
+ name: 'Local/dial_alice at default-00000000;2'
+ bridge:
+ technology: 'simple_bridge'
+ bridge_type: 'mixing'
+ bridge_class: 'basic'
+ count: 1
+ -
+ match:
+ type: 'ChannelLeftBridge'
+ channel:
+ name: 'PJSIP/alice-00000000'
+ bridge:
+ technology: 'simple_bridge'
+ bridge_type: 'mixing'
+ bridge_class: 'basic'
+ count: 1
+ -
+ match:
+ type: 'ChannelLeftBridge'
+ channel:
+ name: 'Local/dial_alice at default-00000000;2'
+ bridge:
+ technology: 'simple_bridge'
+ bridge_type: 'mixing'
+ bridge_class: 'basic'
+ count: 1
+ -
+ match:
+ type: 'BridgeDestroyed'
+ bridge:
+ technology: 'simple_bridge'
+ bridge_type: 'mixing'
+ bridge_class: 'basic'
+ count: 1
+
+
+properties:
+ minversion: '13.7.0'
+ dependencies:
+ - python : autobahn.websocket
+ - python : requests
+ - python : twisted
+ - python : starpy
+ - asterisk : res_ari_channels
+ - asterisk : res_ari_bridges
+ - asterisk : res_ari_endpoints
+ - asterisk : res_ari_applications
+ - asterisk : res_ari_asterisk
+ - asterisk : res_ari_device_states
+ - asterisk : app_echo
+ - asterisk : app_dial
+ - asterisk : chan_pjsip
+ - asterisk : res_pjsip_endpoint_identifier_ip
+ - asterisk : res_pjsip
+ tags:
+ - ARI
+
+
diff --git a/tests/rest_api/applications/tests.yaml b/tests/rest_api/applications/tests.yaml
index 5d5c4be..2d98c2d 100644
--- a/tests/rest_api/applications/tests.yaml
+++ b/tests/rest_api/applications/tests.yaml
@@ -2,6 +2,7 @@
tests:
- test: 'errors'
- dir: 'subscribe-endpoint'
+ - test: 'subscribe-all'
- test: 'subscribe-bridge'
- test: 'subscribe-device-state'
- test: 'double-subscribe-device-state'
--
To view, visit https://gerrit.asterisk.org/1190
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib87ec091c848366b8ed4485f832e23e1a0a37ed4
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Matt Jordan <mjordan at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>
More information about the asterisk-commits
mailing list