[Asterisk-code-review] rest api/pjsip: Check cleanup of dynamically added registra... (testsuite[master])
Anonymous Coward
asteriskteam at digium.com
Wed May 18 14:20:40 CDT 2016
Anonymous Coward #1000019 has submitted this change and it was merged.
Change subject: rest_api/pjsip: Check cleanup of dynamically added registration
......................................................................
rest_api/pjsip: Check cleanup of dynamically added registration
Add an outbound registration using ARI PUT.
Wait for 'Registered' event.
Delete the registration using ARI DELETE.
Confirm 'Unregistered' event.
ASTERISK-25964
Change-Id: I52cd2194487e627e5843490eaabaf7934c1adeff
---
A tests/rest_api/asterisk/config/dynamic/registration_cleanup/configs/ast1/pjsip.conf
A tests/rest_api/asterisk/config/dynamic/registration_cleanup/configs/ast1/sorcery.conf
A tests/rest_api/asterisk/config/dynamic/registration_cleanup/sipp/registrar.xml
A tests/rest_api/asterisk/config/dynamic/registration_cleanup/test-config.yaml
M tests/rest_api/asterisk/config/dynamic/tests.yaml
5 files changed, 135 insertions(+), 0 deletions(-)
Approvals:
Mark Michelson: Looks good to me, approved
Anonymous Coward #1000019: Verified
Joshua Colp: Looks good to me, but someone else must approve
diff --git a/tests/rest_api/asterisk/config/dynamic/registration_cleanup/configs/ast1/pjsip.conf b/tests/rest_api/asterisk/config/dynamic/registration_cleanup/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..aa62e3c
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/registration_cleanup/configs/ast1/pjsip.conf
@@ -0,0 +1,5 @@
+
+[ipv4]
+type = transport
+protocol = udp
+bind = 127.0.0.1:5060
diff --git a/tests/rest_api/asterisk/config/dynamic/registration_cleanup/configs/ast1/sorcery.conf b/tests/rest_api/asterisk/config/dynamic/registration_cleanup/configs/ast1/sorcery.conf
new file mode 100644
index 0000000..52f4edc
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/registration_cleanup/configs/ast1/sorcery.conf
@@ -0,0 +1,2 @@
+[res_pjsip_outbound_registration]
+registration=memory,ps_registrations
diff --git a/tests/rest_api/asterisk/config/dynamic/registration_cleanup/sipp/registrar.xml b/tests/rest_api/asterisk/config/dynamic/registration_cleanup/sipp/registrar.xml
new file mode 100644
index 0000000..310e9ff
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/registration_cleanup/sipp/registrar.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic Sipstone UAC">
+
+ <recv request="REGISTER">
+ </recv>
+
+ <send>
+ <![CDATA[
+
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[pid]SIPpTag01[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ [last_Expires:]
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+ Content-Length: [len]
+
+ ]]>
+ </send>
+
+ <recv request="REGISTER">
+ <action>
+ <ereg regexp="0" search_in="hdr" header="Expires:" check_it="true"
+ assign_to="1" />
+ </action>
+ </recv>
+
+ <send>
+ <![CDATA[
+
+ SIP/2.0 200 OK
+ [last_Via:]
+ [last_From:]
+ [last_To:];tag=[pid]SIPpTag01[call_number]
+ [last_Call-ID:]
+ [last_CSeq:]
+ Expires: [$1]
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+ Content-Length: [len]
+
+ ]]>
+ </send>
+
+</scenario>
diff --git a/tests/rest_api/asterisk/config/dynamic/registration_cleanup/test-config.yaml b/tests/rest_api/asterisk/config/dynamic/registration_cleanup/test-config.yaml
new file mode 100644
index 0000000..8eb5079
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/registration_cleanup/test-config.yaml
@@ -0,0 +1,79 @@
+testinfo:
+ summary: 'Test cleanup of registration on deletion of a dynamically created registration'
+ description: |
+ This test adds a new registration, waits for it to register successfully,
+ deletes it, then makes sure that an unregister event is received.
+
+properties:
+ minversion: '13.10.0'
+ dependencies:
+ - python: autobahn.websocket
+ - python: requests
+ - python: twisted
+ - python: starpy
+ - asterisk: res_ari_asterisk
+ - asterisk: res_pjsip
+ - asterisk: res_pjsip_outbound_registration
+ - asterisk: res_sorcery_memory
+ - sipp:
+ version: 'v3.0'
+ tags:
+ - ARI
+ - pjsip
+
+test-modules:
+ add-to-search-path:
+ - 'tests/rest_api/message'
+ test-object:
+ config-section: test-config
+ typename: ari.AriBaseTestObject
+ modules:
+ -
+ config-section: registrar
+ typename: 'message_modules.SIPMessageRunner'
+ -
+ config-section: pluggable-config
+ typename: pluggable_modules.EventActionModule
+
+test-config:
+ apps: testsuite
+
+registrar:
+ end-on-success: True
+ sipp:
+ - { 'scenario':'registrar.xml', '-p':'5061' }
+
+pluggable-config:
+ -
+ ari-start:
+ ari-requests:
+ -
+ method: 'put'
+ uri: 'asterisk/config/dynamic/res_pjsip/registration/sipp'
+ body: { "fields": [ { 'attribute': 'server_uri', 'value': 'sip:localhost:5061' },
+ { 'attribute': 'client_uri', 'value': 'sip:sipp at localhost:5061'},
+ { 'attribute': 'max_retries', 'value': '0'},
+ { 'attribute': 'expiration', 'value': '10' } ] }
+ expect: 200
+ -
+ ami-events:
+ conditions:
+ match:
+ Event: 'Registry'
+ Username: 'sip:sipp at localhost:5061'
+ Status: 'Registered'
+ count: '1'
+ ari-requests:
+ -
+ method: 'delete'
+ uri: 'asterisk/config/dynamic/res_pjsip/registration/sipp'
+ expect: 204
+ -
+ ami-events:
+ conditions:
+ match:
+ Event: 'Registry'
+ Username: 'sip:sipp at localhost:5061'
+ Status: 'Unregistered'
+ count: '1'
+ stop_test:
diff --git a/tests/rest_api/asterisk/config/dynamic/tests.yaml b/tests/rest_api/asterisk/config/dynamic/tests.yaml
index c95658f..63beef3 100644
--- a/tests/rest_api/asterisk/config/dynamic/tests.yaml
+++ b/tests/rest_api/asterisk/config/dynamic/tests.yaml
@@ -4,3 +4,4 @@
- test: 'delete'
- test: 'get'
- test: 'update'
+ - test: 'registration_cleanup'
\ No newline at end of file
--
To view, visit https://gerrit.asterisk.org/2862
To unsubscribe, visit https://gerrit.asterisk.org/settings
Gerrit-MessageType: merged
Gerrit-Change-Id: I52cd2194487e627e5843490eaabaf7934c1adeff
Gerrit-PatchSet: 3
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Mark Michelson <mmichelson at digium.com>
More information about the asterisk-code-review
mailing list