[Asterisk-code-review] pjsip: Add ARI dynamic configuration tests for PJSIP OPTIONS. (testsuite[master])

Jenkins2 asteriskteam at digium.com
Wed May 9 10:47:16 CDT 2018


Jenkins2 has submitted this change and it was merged. ( https://gerrit.asterisk.org/8828 )

Change subject: pjsip: Add ARI dynamic configuration tests for PJSIP OPTIONS.
......................................................................

pjsip: Add ARI dynamic configuration tests for PJSIP OPTIONS.

This test adds some ARI dynamic configuration tests for
AORs and endpoints. The changes done by the tests result
in contact and endpoint state changes and the tests confirm
that they are the expected values.

ASTERISK-26806

Change-Id: Ic5828f769a8ccdb30151ae4ec11186467fee68ad
---
A tests/rest_api/asterisk/config/dynamic/pjsip/delete_aor/configs/ast1/pjsip.conf
A tests/rest_api/asterisk/config/dynamic/pjsip/delete_aor/configs/ast1/sorcery.conf
A tests/rest_api/asterisk/config/dynamic/pjsip/delete_aor/test-config.yaml
A tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_qualified/configs/ast1/pjsip.conf
A tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_qualified/configs/ast1/sorcery.conf
A tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_qualified/test-config.yaml
A tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_unqualified/configs/ast1/pjsip.conf
A tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_unqualified/configs/ast1/sorcery.conf
A tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_unqualified/test-config.yaml
A tests/rest_api/asterisk/config/dynamic/pjsip/modify_endpoint/configs/ast1/pjsip.conf
A tests/rest_api/asterisk/config/dynamic/pjsip/modify_endpoint/configs/ast1/sorcery.conf
A tests/rest_api/asterisk/config/dynamic/pjsip/modify_endpoint/test-config.yaml
A tests/rest_api/asterisk/config/dynamic/pjsip/tests.yaml
M tests/rest_api/asterisk/config/dynamic/tests.yaml
14 files changed, 327 insertions(+), 1 deletion(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, approved
  Jenkins2: Approved for Submit



diff --git a/tests/rest_api/asterisk/config/dynamic/pjsip/delete_aor/configs/ast1/pjsip.conf b/tests/rest_api/asterisk/config/dynamic/pjsip/delete_aor/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..54c23ef
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/delete_aor/configs/ast1/pjsip.conf
@@ -0,0 +1,4 @@
+[ipv4]
+type = transport
+protocol = udp
+bind = 127.0.0.1:5060
diff --git a/tests/rest_api/asterisk/config/dynamic/pjsip/delete_aor/configs/ast1/sorcery.conf b/tests/rest_api/asterisk/config/dynamic/pjsip/delete_aor/configs/ast1/sorcery.conf
new file mode 100644
index 0000000..d283505
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/delete_aor/configs/ast1/sorcery.conf
@@ -0,0 +1,3 @@
+[res_pjsip]
+endpoint=memory,ps_endpoints
+aor=memory,ps_aors
diff --git a/tests/rest_api/asterisk/config/dynamic/pjsip/delete_aor/test-config.yaml b/tests/rest_api/asterisk/config/dynamic/pjsip/delete_aor/test-config.yaml
new file mode 100644
index 0000000..69ca58c
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/delete_aor/test-config.yaml
@@ -0,0 +1,71 @@
+testinfo:
+    summary: 'Test deletion of an AOR referenced by an endpoint'
+    description: |
+        This test adds an endpoint referencing an AOR and then adds the AOR with a
+        static contact without qualify enabled. Once the endpoint becomes available the
+        AOR is then deleted. The test confirms that the endpoint then becomes unreachable.
+
+properties:
+    dependencies:
+        - python: autobahn.websocket
+        - python: requests
+        - python: twisted
+        - python: starpy
+        - asterisk: res_ari_asterisk
+        - asterisk: res_pjsip
+        - asterisk: res_sorcery_memory
+    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: pluggable-config
+            typename: pluggable_modules.EventActionModule
+
+test-config:
+    apps: testsuite
+
+pluggable-config:
+    -
+        ari-start:
+        ari-requests:
+            -
+                method: 'put'
+                uri: 'asterisk/config/dynamic/res_pjsip/endpoint/test'
+                body: { "fields": [ { 'attribute': 'aors', 'value': 'test'} ] }
+                expect: 200
+            -
+                method: 'put'
+                uri: 'asterisk/config/dynamic/res_pjsip/aor/test'
+                body: { "fields": [ { 'attribute': 'qualify_frequency', 'value': '0' },
+                                    { 'attribute': 'contact', 'value': 'sip:127.0.0.1:5061'} ] }
+                expect: 200
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'PeerStatus'
+                    Peer: 'PJSIP/test'
+                    PeerStatus: 'Reachable'
+            count: '1'
+        ari-requests:
+            -
+                method: 'delete'
+                uri: 'asterisk/config/dynamic/res_pjsip/aor/test'
+                expect: 204
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'PeerStatus'
+                    Peer: 'PJSIP/test'
+                    PeerStatus: 'Unreachable'
+            count: '1'
+        stop_test:
diff --git a/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_qualified/configs/ast1/pjsip.conf b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_qualified/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..54c23ef
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_qualified/configs/ast1/pjsip.conf
@@ -0,0 +1,4 @@
+[ipv4]
+type = transport
+protocol = udp
+bind = 127.0.0.1:5060
diff --git a/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_qualified/configs/ast1/sorcery.conf b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_qualified/configs/ast1/sorcery.conf
new file mode 100644
index 0000000..d283505
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_qualified/configs/ast1/sorcery.conf
@@ -0,0 +1,3 @@
+[res_pjsip]
+endpoint=memory,ps_endpoints
+aor=memory,ps_aors
diff --git a/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_qualified/test-config.yaml b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_qualified/test-config.yaml
new file mode 100644
index 0000000..7e5b74e
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_qualified/test-config.yaml
@@ -0,0 +1,74 @@
+testinfo:
+    summary: 'Test modifying an AOR from unqualified to qualified'
+    description: |
+        This test adds an endpoint referencing an AOR and then adds the AOR with a
+        static contact without qualify enabled. Once the endpoint becomes available the
+        AOR is then modified to enable qualifying. The test confirms that the endpoint
+        then becomes unreachable as the static contact on the AOR is unreachable.
+
+properties:
+    dependencies:
+        - python: autobahn.websocket
+        - python: requests
+        - python: twisted
+        - python: starpy
+        - asterisk: res_ari_asterisk
+        - asterisk: res_pjsip
+        - asterisk: res_sorcery_memory
+    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: pluggable-config
+            typename: pluggable_modules.EventActionModule
+
+test-config:
+    apps: testsuite
+
+pluggable-config:
+    -
+        ari-start:
+        ari-requests:
+            -
+                method: 'put'
+                uri: 'asterisk/config/dynamic/res_pjsip/endpoint/test'
+                body: { "fields": [ { 'attribute': 'aors', 'value': 'test'} ] }
+                expect: 200
+            -
+                method: 'put'
+                uri: 'asterisk/config/dynamic/res_pjsip/aor/test'
+                body: { "fields": [ { 'attribute': 'qualify_frequency', 'value': '0' },
+                                    { 'attribute': 'contact', 'value': 'sip:127.0.0.1:5061'} ] }
+                expect: 200
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'PeerStatus'
+                    Peer: 'PJSIP/test'
+                    PeerStatus: 'Reachable'
+            count: '1'
+        ari-requests:
+            -
+                method: 'put'
+                uri: 'asterisk/config/dynamic/res_pjsip/aor/test'
+                body: { "fields": [ { 'attribute': 'qualify_frequency', 'value': '5' },
+                                    { 'attribute': 'contact', 'value': 'sip:127.0.0.1:5061'} ] }
+                expect: 200
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'PeerStatus'
+                    Peer: 'PJSIP/test'
+                    PeerStatus: 'Unreachable'
+            count: '1'
+        stop_test:
diff --git a/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_unqualified/configs/ast1/pjsip.conf b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_unqualified/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..54c23ef
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_unqualified/configs/ast1/pjsip.conf
@@ -0,0 +1,4 @@
+[ipv4]
+type = transport
+protocol = udp
+bind = 127.0.0.1:5060
diff --git a/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_unqualified/configs/ast1/sorcery.conf b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_unqualified/configs/ast1/sorcery.conf
new file mode 100644
index 0000000..d283505
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_unqualified/configs/ast1/sorcery.conf
@@ -0,0 +1,3 @@
+[res_pjsip]
+endpoint=memory,ps_endpoints
+aor=memory,ps_aors
diff --git a/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_unqualified/test-config.yaml b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_unqualified/test-config.yaml
new file mode 100644
index 0000000..9d8ba14
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_unqualified/test-config.yaml
@@ -0,0 +1,65 @@
+testinfo:
+    summary: 'Test modification of an AOR from qualified to unqualified'
+    description: |
+        This test adds an endpoint referencing an AOR and then adds the AOR with a
+        static contact with qualify enabled. Once the endpoint becomes unreachable the
+        AOR is then modified to be unqualified. The test confirms that the endpoint
+        then becomes reachable.
+
+properties:
+    dependencies:
+        - python: autobahn.websocket
+        - python: requests
+        - python: twisted
+        - python: starpy
+        - asterisk: res_ari_asterisk
+        - asterisk: res_pjsip
+        - asterisk: res_sorcery_memory
+    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: pluggable-config
+            typename: pluggable_modules.EventActionModule
+
+test-config:
+    apps: testsuite
+
+pluggable-config:
+    -
+        ari-start:
+        ari-requests:
+            -
+                method: 'put'
+                uri: 'asterisk/config/dynamic/res_pjsip/endpoint/test'
+                body: { "fields": [ { 'attribute': 'aors', 'value': 'test'} ] }
+                expect: 200
+            -
+                method: 'put'
+                uri: 'asterisk/config/dynamic/res_pjsip/aor/test'
+                body: { "fields": [ { 'attribute': 'qualify_frequency', 'value': '5' },
+                                    { 'attribute': 'contact', 'value': 'sip:127.0.0.1:5061'} ] }
+                expect: 200
+            -
+                method: 'put'
+                uri: 'asterisk/config/dynamic/res_pjsip/aor/test'
+                body: { "fields": [ { 'attribute': 'qualify_frequency', 'value': '0' },
+                                    { 'attribute': 'contact', 'value': 'sip:127.0.0.1:5061'} ] }
+                expect: 200
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'PeerStatus'
+                    Peer: 'PJSIP/test'
+                    PeerStatus: 'Reachable'
+            count: '1'
+        stop_test:
diff --git a/tests/rest_api/asterisk/config/dynamic/pjsip/modify_endpoint/configs/ast1/pjsip.conf b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_endpoint/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..54c23ef
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_endpoint/configs/ast1/pjsip.conf
@@ -0,0 +1,4 @@
+[ipv4]
+type = transport
+protocol = udp
+bind = 127.0.0.1:5060
diff --git a/tests/rest_api/asterisk/config/dynamic/pjsip/modify_endpoint/configs/ast1/sorcery.conf b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_endpoint/configs/ast1/sorcery.conf
new file mode 100644
index 0000000..d283505
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_endpoint/configs/ast1/sorcery.conf
@@ -0,0 +1,3 @@
+[res_pjsip]
+endpoint=memory,ps_endpoints
+aor=memory,ps_aors
diff --git a/tests/rest_api/asterisk/config/dynamic/pjsip/modify_endpoint/test-config.yaml b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_endpoint/test-config.yaml
new file mode 100644
index 0000000..c806498
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_endpoint/test-config.yaml
@@ -0,0 +1,81 @@
+testinfo:
+    summary: 'Test modification of the aors field of an endpoint'
+    description: |
+        This test adds an endpoint referencing an AOR and then adds the AOR with a
+        static contact without qualify enabled. Once the endpoint becomes available the
+        endpoint is modified to reference a different qualified AOR. The test confirms
+        that the endpoint then becomes unreachable.
+
+properties:
+    dependencies:
+        - python: autobahn.websocket
+        - python: requests
+        - python: twisted
+        - python: starpy
+        - asterisk: res_ari_asterisk
+        - asterisk: res_pjsip
+        - asterisk: res_sorcery_memory
+    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: pluggable-config
+            typename: pluggable_modules.EventActionModule
+
+test-config:
+    apps: testsuite
+
+pluggable-config:
+    -
+        ari-start:
+        ari-requests:
+            -
+                method: 'put'
+                uri: 'asterisk/config/dynamic/res_pjsip/endpoint/test'
+                body: { "fields": [ { 'attribute': 'allow', 'value': 'ulaw' },
+                                    { 'attribute': 'aors', 'value': 'test'} ] }
+                expect: 200
+            -
+                method: 'put'
+                uri: 'asterisk/config/dynamic/res_pjsip/aor/test'
+                body: { "fields": [ { 'attribute': 'qualify_frequency', 'value': '0' },
+                                    { 'attribute': 'contact', 'value': 'sip:127.0.0.1:5061'} ] }
+                expect: 200
+            -
+                method: 'put'
+                uri: 'asterisk/config/dynamic/res_pjsip/aor/test2'
+                body: { "fields": [ { 'attribute': 'qualify_frequency', 'value': '5' },
+                                    { 'attribute': 'contact', 'value': 'sip:127.0.0.1:5061'} ] }
+                expect: 200
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'PeerStatus'
+                    Peer: 'PJSIP/test'
+                    PeerStatus: 'Reachable'
+            count: '1'
+        ari-requests:
+            -
+                method: 'put'
+                uri: 'asterisk/config/dynamic/res_pjsip/endpoint/test'
+                body: { "fields": [ { 'attribute': 'allow', 'value': 'ulaw' },
+                                    { 'attribute': 'aors', 'value': 'test2'} ] }
+                expect: 200
+    -
+        ami-events:
+            conditions:
+                match:
+                    Event: 'PeerStatus'
+                    Peer: 'PJSIP/test'
+                    PeerStatus: 'Unreachable'
+            count: '1'
+        stop_test:
diff --git a/tests/rest_api/asterisk/config/dynamic/pjsip/tests.yaml b/tests/rest_api/asterisk/config/dynamic/pjsip/tests.yaml
new file mode 100644
index 0000000..ce08dba
--- /dev/null
+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/tests.yaml
@@ -0,0 +1,6 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - test: 'modify_aor_to_qualified'
+    - test: 'modify_aor_to_unqualified'
+    - test: 'delete_aor'
+    - test: 'modify_endpoint'
diff --git a/tests/rest_api/asterisk/config/dynamic/tests.yaml b/tests/rest_api/asterisk/config/dynamic/tests.yaml
index 63beef3..7ba2c04 100644
--- a/tests/rest_api/asterisk/config/dynamic/tests.yaml
+++ b/tests/rest_api/asterisk/config/dynamic/tests.yaml
@@ -4,4 +4,5 @@
     - test: 'delete'
     - test: 'get'
     - test: 'update'
-    - test: 'registration_cleanup'
\ No newline at end of file
+    - test: 'registration_cleanup'
+    - dir: 'pjsip'

-- 
To view, visit https://gerrit.asterisk.org/8828
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ic5828f769a8ccdb30151ae4ec11186467fee68ad
Gerrit-Change-Number: 8828
Gerrit-PatchSet: 1
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Jenkins2
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180509/1669156f/attachment-0001.html>


More information about the asterisk-code-review mailing list