<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/8828">View Change</a></p><div style="white-space:pre-wrap">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

</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pjsip: Add ARI dynamic configuration tests for PJSIP OPTIONS.<br><br>This test adds some ARI dynamic configuration tests for<br>AORs and endpoints. The changes done by the tests result<br>in contact and endpoint state changes and the tests confirm<br>that they are the expected values.<br><br>ASTERISK-26806<br><br>Change-Id: Ic5828f769a8ccdb30151ae4ec11186467fee68ad<br>---<br>A tests/rest_api/asterisk/config/dynamic/pjsip/delete_aor/configs/ast1/pjsip.conf<br>A tests/rest_api/asterisk/config/dynamic/pjsip/delete_aor/configs/ast1/sorcery.conf<br>A tests/rest_api/asterisk/config/dynamic/pjsip/delete_aor/test-config.yaml<br>A tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_qualified/configs/ast1/pjsip.conf<br>A tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_qualified/configs/ast1/sorcery.conf<br>A tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_qualified/test-config.yaml<br>A tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_unqualified/configs/ast1/pjsip.conf<br>A tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_unqualified/configs/ast1/sorcery.conf<br>A tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_unqualified/test-config.yaml<br>A tests/rest_api/asterisk/config/dynamic/pjsip/modify_endpoint/configs/ast1/pjsip.conf<br>A tests/rest_api/asterisk/config/dynamic/pjsip/modify_endpoint/configs/ast1/sorcery.conf<br>A tests/rest_api/asterisk/config/dynamic/pjsip/modify_endpoint/test-config.yaml<br>A tests/rest_api/asterisk/config/dynamic/pjsip/tests.yaml<br>M tests/rest_api/asterisk/config/dynamic/tests.yaml<br>14 files changed, 327 insertions(+), 1 deletion(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">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<br>new file mode 100644<br>index 0000000..54c23ef<br>--- /dev/null<br>+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/delete_aor/configs/ast1/pjsip.conf<br>@@ -0,0 +1,4 @@<br>+[ipv4]<br>+type = transport<br>+protocol = udp<br>+bind = 127.0.0.1:5060<br>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<br>new file mode 100644<br>index 0000000..d283505<br>--- /dev/null<br>+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/delete_aor/configs/ast1/sorcery.conf<br>@@ -0,0 +1,3 @@<br>+[res_pjsip]<br>+endpoint=memory,ps_endpoints<br>+aor=memory,ps_aors<br>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<br>new file mode 100644<br>index 0000000..69ca58c<br>--- /dev/null<br>+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/delete_aor/test-config.yaml<br>@@ -0,0 +1,71 @@<br>+testinfo:<br>+    summary: 'Test deletion of an AOR referenced by an endpoint'<br>+    description: |<br>+        This test adds an endpoint referencing an AOR and then adds the AOR with a<br>+        static contact without qualify enabled. Once the endpoint becomes available the<br>+        AOR is then deleted. The test confirms that the endpoint then becomes unreachable.<br>+<br>+properties:<br>+    dependencies:<br>+        - python: autobahn.websocket<br>+        - python: requests<br>+        - python: twisted<br>+        - python: starpy<br>+        - asterisk: res_ari_asterisk<br>+        - asterisk: res_pjsip<br>+        - asterisk: res_sorcery_memory<br>+    tags:<br>+        - ARI<br>+        - pjsip<br>+<br>+test-modules:<br>+    add-to-search-path:<br>+        - 'tests/rest_api/message'<br>+    test-object:<br>+        config-section: test-config<br>+        typename: ari.AriBaseTestObject<br>+    modules:<br>+        -<br>+            config-section: pluggable-config<br>+            typename: pluggable_modules.EventActionModule<br>+<br>+test-config:<br>+    apps: testsuite<br>+<br>+pluggable-config:<br>+    -<br>+        ari-start:<br>+        ari-requests:<br>+            -<br>+                method: 'put'<br>+                uri: 'asterisk/config/dynamic/res_pjsip/endpoint/test'<br>+                body: { "fields": [ { 'attribute': 'aors', 'value': 'test'} ] }<br>+                expect: 200<br>+            -<br>+                method: 'put'<br>+                uri: 'asterisk/config/dynamic/res_pjsip/aor/test'<br>+                body: { "fields": [ { 'attribute': 'qualify_frequency', 'value': '0' },<br>+                                    { 'attribute': 'contact', 'value': 'sip:127.0.0.1:5061'} ] }<br>+                expect: 200<br>+    -<br>+        ami-events:<br>+            conditions:<br>+                match:<br>+                    Event: 'PeerStatus'<br>+                    Peer: 'PJSIP/test'<br>+                    PeerStatus: 'Reachable'<br>+            count: '1'<br>+        ari-requests:<br>+            -<br>+                method: 'delete'<br>+                uri: 'asterisk/config/dynamic/res_pjsip/aor/test'<br>+                expect: 204<br>+    -<br>+        ami-events:<br>+            conditions:<br>+                match:<br>+                    Event: 'PeerStatus'<br>+                    Peer: 'PJSIP/test'<br>+                    PeerStatus: 'Unreachable'<br>+            count: '1'<br>+        stop_test:<br>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<br>new file mode 100644<br>index 0000000..54c23ef<br>--- /dev/null<br>+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_qualified/configs/ast1/pjsip.conf<br>@@ -0,0 +1,4 @@<br>+[ipv4]<br>+type = transport<br>+protocol = udp<br>+bind = 127.0.0.1:5060<br>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<br>new file mode 100644<br>index 0000000..d283505<br>--- /dev/null<br>+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_qualified/configs/ast1/sorcery.conf<br>@@ -0,0 +1,3 @@<br>+[res_pjsip]<br>+endpoint=memory,ps_endpoints<br>+aor=memory,ps_aors<br>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<br>new file mode 100644<br>index 0000000..7e5b74e<br>--- /dev/null<br>+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_qualified/test-config.yaml<br>@@ -0,0 +1,74 @@<br>+testinfo:<br>+    summary: 'Test modifying an AOR from unqualified to qualified'<br>+    description: |<br>+        This test adds an endpoint referencing an AOR and then adds the AOR with a<br>+        static contact without qualify enabled. Once the endpoint becomes available the<br>+        AOR is then modified to enable qualifying. The test confirms that the endpoint<br>+        then becomes unreachable as the static contact on the AOR is unreachable.<br>+<br>+properties:<br>+    dependencies:<br>+        - python: autobahn.websocket<br>+        - python: requests<br>+        - python: twisted<br>+        - python: starpy<br>+        - asterisk: res_ari_asterisk<br>+        - asterisk: res_pjsip<br>+        - asterisk: res_sorcery_memory<br>+    tags:<br>+        - ARI<br>+        - pjsip<br>+<br>+test-modules:<br>+    add-to-search-path:<br>+        - 'tests/rest_api/message'<br>+    test-object:<br>+        config-section: test-config<br>+        typename: ari.AriBaseTestObject<br>+    modules:<br>+        -<br>+            config-section: pluggable-config<br>+            typename: pluggable_modules.EventActionModule<br>+<br>+test-config:<br>+    apps: testsuite<br>+<br>+pluggable-config:<br>+    -<br>+        ari-start:<br>+        ari-requests:<br>+            -<br>+                method: 'put'<br>+                uri: 'asterisk/config/dynamic/res_pjsip/endpoint/test'<br>+                body: { "fields": [ { 'attribute': 'aors', 'value': 'test'} ] }<br>+                expect: 200<br>+            -<br>+                method: 'put'<br>+                uri: 'asterisk/config/dynamic/res_pjsip/aor/test'<br>+                body: { "fields": [ { 'attribute': 'qualify_frequency', 'value': '0' },<br>+                                    { 'attribute': 'contact', 'value': 'sip:127.0.0.1:5061'} ] }<br>+                expect: 200<br>+    -<br>+        ami-events:<br>+            conditions:<br>+                match:<br>+                    Event: 'PeerStatus'<br>+                    Peer: 'PJSIP/test'<br>+                    PeerStatus: 'Reachable'<br>+            count: '1'<br>+        ari-requests:<br>+            -<br>+                method: 'put'<br>+                uri: 'asterisk/config/dynamic/res_pjsip/aor/test'<br>+                body: { "fields": [ { 'attribute': 'qualify_frequency', 'value': '5' },<br>+                                    { 'attribute': 'contact', 'value': 'sip:127.0.0.1:5061'} ] }<br>+                expect: 200<br>+    -<br>+        ami-events:<br>+            conditions:<br>+                match:<br>+                    Event: 'PeerStatus'<br>+                    Peer: 'PJSIP/test'<br>+                    PeerStatus: 'Unreachable'<br>+            count: '1'<br>+        stop_test:<br>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<br>new file mode 100644<br>index 0000000..54c23ef<br>--- /dev/null<br>+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_unqualified/configs/ast1/pjsip.conf<br>@@ -0,0 +1,4 @@<br>+[ipv4]<br>+type = transport<br>+protocol = udp<br>+bind = 127.0.0.1:5060<br>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<br>new file mode 100644<br>index 0000000..d283505<br>--- /dev/null<br>+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_unqualified/configs/ast1/sorcery.conf<br>@@ -0,0 +1,3 @@<br>+[res_pjsip]<br>+endpoint=memory,ps_endpoints<br>+aor=memory,ps_aors<br>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<br>new file mode 100644<br>index 0000000..9d8ba14<br>--- /dev/null<br>+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_aor_to_unqualified/test-config.yaml<br>@@ -0,0 +1,65 @@<br>+testinfo:<br>+    summary: 'Test modification of an AOR from qualified to unqualified'<br>+    description: |<br>+        This test adds an endpoint referencing an AOR and then adds the AOR with a<br>+        static contact with qualify enabled. Once the endpoint becomes unreachable the<br>+        AOR is then modified to be unqualified. The test confirms that the endpoint<br>+        then becomes reachable.<br>+<br>+properties:<br>+    dependencies:<br>+        - python: autobahn.websocket<br>+        - python: requests<br>+        - python: twisted<br>+        - python: starpy<br>+        - asterisk: res_ari_asterisk<br>+        - asterisk: res_pjsip<br>+        - asterisk: res_sorcery_memory<br>+    tags:<br>+        - ARI<br>+        - pjsip<br>+<br>+test-modules:<br>+    add-to-search-path:<br>+        - 'tests/rest_api/message'<br>+    test-object:<br>+        config-section: test-config<br>+        typename: ari.AriBaseTestObject<br>+    modules:<br>+        -<br>+            config-section: pluggable-config<br>+            typename: pluggable_modules.EventActionModule<br>+<br>+test-config:<br>+    apps: testsuite<br>+<br>+pluggable-config:<br>+    -<br>+        ari-start:<br>+        ari-requests:<br>+            -<br>+                method: 'put'<br>+                uri: 'asterisk/config/dynamic/res_pjsip/endpoint/test'<br>+                body: { "fields": [ { 'attribute': 'aors', 'value': 'test'} ] }<br>+                expect: 200<br>+            -<br>+                method: 'put'<br>+                uri: 'asterisk/config/dynamic/res_pjsip/aor/test'<br>+                body: { "fields": [ { 'attribute': 'qualify_frequency', 'value': '5' },<br>+                                    { 'attribute': 'contact', 'value': 'sip:127.0.0.1:5061'} ] }<br>+                expect: 200<br>+            -<br>+                method: 'put'<br>+                uri: 'asterisk/config/dynamic/res_pjsip/aor/test'<br>+                body: { "fields": [ { 'attribute': 'qualify_frequency', 'value': '0' },<br>+                                    { 'attribute': 'contact', 'value': 'sip:127.0.0.1:5061'} ] }<br>+                expect: 200<br>+    -<br>+        ami-events:<br>+            conditions:<br>+                match:<br>+                    Event: 'PeerStatus'<br>+                    Peer: 'PJSIP/test'<br>+                    PeerStatus: 'Reachable'<br>+            count: '1'<br>+        stop_test:<br>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<br>new file mode 100644<br>index 0000000..54c23ef<br>--- /dev/null<br>+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_endpoint/configs/ast1/pjsip.conf<br>@@ -0,0 +1,4 @@<br>+[ipv4]<br>+type = transport<br>+protocol = udp<br>+bind = 127.0.0.1:5060<br>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<br>new file mode 100644<br>index 0000000..d283505<br>--- /dev/null<br>+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_endpoint/configs/ast1/sorcery.conf<br>@@ -0,0 +1,3 @@<br>+[res_pjsip]<br>+endpoint=memory,ps_endpoints<br>+aor=memory,ps_aors<br>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<br>new file mode 100644<br>index 0000000..c806498<br>--- /dev/null<br>+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/modify_endpoint/test-config.yaml<br>@@ -0,0 +1,81 @@<br>+testinfo:<br>+    summary: 'Test modification of the aors field of an endpoint'<br>+    description: |<br>+        This test adds an endpoint referencing an AOR and then adds the AOR with a<br>+        static contact without qualify enabled. Once the endpoint becomes available the<br>+        endpoint is modified to reference a different qualified AOR. The test confirms<br>+        that the endpoint then becomes unreachable.<br>+<br>+properties:<br>+    dependencies:<br>+        - python: autobahn.websocket<br>+        - python: requests<br>+        - python: twisted<br>+        - python: starpy<br>+        - asterisk: res_ari_asterisk<br>+        - asterisk: res_pjsip<br>+        - asterisk: res_sorcery_memory<br>+    tags:<br>+        - ARI<br>+        - pjsip<br>+<br>+test-modules:<br>+    add-to-search-path:<br>+        - 'tests/rest_api/message'<br>+    test-object:<br>+        config-section: test-config<br>+        typename: ari.AriBaseTestObject<br>+    modules:<br>+        -<br>+            config-section: pluggable-config<br>+            typename: pluggable_modules.EventActionModule<br>+<br>+test-config:<br>+    apps: testsuite<br>+<br>+pluggable-config:<br>+    -<br>+        ari-start:<br>+        ari-requests:<br>+            -<br>+                method: 'put'<br>+                uri: 'asterisk/config/dynamic/res_pjsip/endpoint/test'<br>+                body: { "fields": [ { 'attribute': 'allow', 'value': 'ulaw' },<br>+                                    { 'attribute': 'aors', 'value': 'test'} ] }<br>+                expect: 200<br>+            -<br>+                method: 'put'<br>+                uri: 'asterisk/config/dynamic/res_pjsip/aor/test'<br>+                body: { "fields": [ { 'attribute': 'qualify_frequency', 'value': '0' },<br>+                                    { 'attribute': 'contact', 'value': 'sip:127.0.0.1:5061'} ] }<br>+                expect: 200<br>+            -<br>+                method: 'put'<br>+                uri: 'asterisk/config/dynamic/res_pjsip/aor/test2'<br>+                body: { "fields": [ { 'attribute': 'qualify_frequency', 'value': '5' },<br>+                                    { 'attribute': 'contact', 'value': 'sip:127.0.0.1:5061'} ] }<br>+                expect: 200<br>+    -<br>+        ami-events:<br>+            conditions:<br>+                match:<br>+                    Event: 'PeerStatus'<br>+                    Peer: 'PJSIP/test'<br>+                    PeerStatus: 'Reachable'<br>+            count: '1'<br>+        ari-requests:<br>+            -<br>+                method: 'put'<br>+                uri: 'asterisk/config/dynamic/res_pjsip/endpoint/test'<br>+                body: { "fields": [ { 'attribute': 'allow', 'value': 'ulaw' },<br>+                                    { 'attribute': 'aors', 'value': 'test2'} ] }<br>+                expect: 200<br>+    -<br>+        ami-events:<br>+            conditions:<br>+                match:<br>+                    Event: 'PeerStatus'<br>+                    Peer: 'PJSIP/test'<br>+                    PeerStatus: 'Unreachable'<br>+            count: '1'<br>+        stop_test:<br>diff --git a/tests/rest_api/asterisk/config/dynamic/pjsip/tests.yaml b/tests/rest_api/asterisk/config/dynamic/pjsip/tests.yaml<br>new file mode 100644<br>index 0000000..ce08dba<br>--- /dev/null<br>+++ b/tests/rest_api/asterisk/config/dynamic/pjsip/tests.yaml<br>@@ -0,0 +1,6 @@<br>+# Enter tests here in the order they should be considered for execution:<br>+tests:<br>+    - test: 'modify_aor_to_qualified'<br>+    - test: 'modify_aor_to_unqualified'<br>+    - test: 'delete_aor'<br>+    - test: 'modify_endpoint'<br>diff --git a/tests/rest_api/asterisk/config/dynamic/tests.yaml b/tests/rest_api/asterisk/config/dynamic/tests.yaml<br>index 63beef3..7ba2c04 100644<br>--- a/tests/rest_api/asterisk/config/dynamic/tests.yaml<br>+++ b/tests/rest_api/asterisk/config/dynamic/tests.yaml<br>@@ -4,4 +4,5 @@<br>     - test: 'delete'<br>     - test: 'get'<br>     - test: 'update'<br>-    - test: 'registration_cleanup'<br>\ No newline at end of file<br>+    - test: 'registration_cleanup'<br>+    - dir: 'pjsip'<br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/8828">change 8828</a>. To unsubscribe, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/8828"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: Ic5828f769a8ccdb30151ae4ec11186467fee68ad </div>
<div style="display:none"> Gerrit-Change-Number: 8828 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: Joshua Colp <jcolp@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Benjamin Keith Ford <bford@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 </div>
<div style="display:none"> Gerrit-Reviewer: Kevin Harwell <kharwell@digium.com> </div>