[Asterisk-code-review] unsolicited/notify_after_register: properly handle test scenario (testsuite[18])

Michael Bradeen asteriskteam at digium.com
Tue Mar 29 16:02:01 CDT 2022


Michael Bradeen has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/18293 )


Change subject: unsolicited/notify_after_register: properly handle test scenario
......................................................................

unsolicited/notify_after_register: properly handle test scenario

There were two issues with the existing tests, affecting both the
standard and realtime versions of the test.

First, the xml contained a syntax error which caused an error on
current versions of sipp

Second, the scenario itself can not be handled by one sipp instance
as the NOTIFY will not match the call-ID of the REGISTER.

This is handled by splitting the test into two scenarios, one that
Registers with a contact port of 5062 then quits and a second that
waits for a NOTIFY on port 5062 then sends a 200 OK.

The REGISTER scenario waits 500ms for the NOTIFY scenario to start.

If both scenarios succeed, the test passes.

Change-Id: I23c7fbea995d99211552321f2d4c7e02806792e4
---
D tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/sipp/notify_after_register.xml
A tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/sipp/receive_notify.xml
A tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/sipp/register_and_quit_two.xml
M tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/test-config.yaml
D tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register_realtime/sipp/notify_after_register.xml
A tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register_realtime/sipp/receive_notify.xml
A tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register_realtime/sipp/register_and_quit_two.xml
M tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register_realtime/test-config.yaml
8 files changed, 106 insertions(+), 84 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/93/18293/1

diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/sipp/notify_after_register.xml b/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/sipp/notify_after_register.xml
deleted file mode 100644
index afe0fe9..0000000
--- a/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/sipp/notify_after_register.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE scenario SYSTEM "sipp.dtd">
-
-<scenario name="NOTIFY after REGISTER">
-  <send retrans="500">
-        <![CDATA[
-
-        REGISTER sip:[remote_ip]:[remote_port] SIP/2.0
-        Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
-        From: "[service]" <sip:[service]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
-        To: "[service]" <sip:[service]@[remote_ip]:[remote_port]>
-        Call-ID: [call_id]
-        CSeq: 1 REGISTER
-        Max-Forwards: 70
-        Contact: <sip:[service]@[local_ip]:[local_port]>;transport=[transport]
-        Subject: Performance Test
-        Content-Length: 0
-
-        ]]>
-  </send>
-
-  <recv response="200">
-
-  <recv request="NOTIFY" crlf="true"/>
-
-  <send>
-    <![CDATA[
-
-      SIP/2.0 200 OK
-      [last_Via:]
-      [last_From:]
-      [last_To:]
-      [last_Call-ID:]
-      [last_CSeq:]
-      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
-      Content-Length: 0
-
-    ]]>
-  </send>
-
-</scenario>
diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/sipp/receive_notify.xml b/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/sipp/receive_notify.xml
new file mode 100644
index 0000000..317960c
--- /dev/null
+++ b/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/sipp/receive_notify.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="wait for NOTIFY">
+
+  <recv request="NOTIFY" >
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+</scenario>
\ No newline at end of file
diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/sipp/register_and_quit_two.xml b/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/sipp/register_and_quit_two.xml
new file mode 100644
index 0000000..b1e0e19
--- /dev/null
+++ b/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/sipp/register_and_quit_two.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="REGISTER with contact set to 5062">
+
+  <pause milliseconds="1000"/>
+
+  <send retrans="500">
+        <![CDATA[
+
+        REGISTER sip:[remote_ip]:[remote_port] SIP/2.0
+        Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+        From: "[service]" <sip:[service]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+        To: "[service]" <sip:[service]@[remote_ip]:[remote_port]>
+        Call-ID: [call_id]
+        CSeq: 1 REGISTER
+        Max-Forwards: 70
+        Contact: <sip:[service]@[local_ip]:5062>;transport=[transport]
+        Subject: Performance Test
+        Content-Length: 0
+
+        ]]>
+  </send>
+
+  <recv response="200" />
+
+</scenario>
diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/test-config.yaml b/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/test-config.yaml
index 60b8795..cbf9b88 100644
--- a/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/test-config.yaml
+++ b/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/test-config.yaml
@@ -32,5 +32,6 @@
     test-iterations:
         -
             scenarios:
-                - { 'key-args': {'scenario': 'notify_after_register.xml', '-p': '5061', '-s': 'alice'} }
+                - { 'key-args': {'scenario': 'register_and_quit_two.xml', '-p': '5061', '-s': 'alice'} }
+                - { 'key-args': {'scenario': 'receive_notify.xml', '-p': '5062', '-s': 'alice'} }
 
diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register_realtime/sipp/notify_after_register.xml b/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register_realtime/sipp/notify_after_register.xml
deleted file mode 100644
index afe0fe9..0000000
--- a/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register_realtime/sipp/notify_after_register.xml
+++ /dev/null
@@ -1,41 +0,0 @@
-<?xml version="1.0" encoding="ISO-8859-1" ?>
-<!DOCTYPE scenario SYSTEM "sipp.dtd">
-
-<scenario name="NOTIFY after REGISTER">
-  <send retrans="500">
-        <![CDATA[
-
-        REGISTER sip:[remote_ip]:[remote_port] SIP/2.0
-        Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
-        From: "[service]" <sip:[service]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
-        To: "[service]" <sip:[service]@[remote_ip]:[remote_port]>
-        Call-ID: [call_id]
-        CSeq: 1 REGISTER
-        Max-Forwards: 70
-        Contact: <sip:[service]@[local_ip]:[local_port]>;transport=[transport]
-        Subject: Performance Test
-        Content-Length: 0
-
-        ]]>
-  </send>
-
-  <recv response="200">
-
-  <recv request="NOTIFY" crlf="true"/>
-
-  <send>
-    <![CDATA[
-
-      SIP/2.0 200 OK
-      [last_Via:]
-      [last_From:]
-      [last_To:]
-      [last_Call-ID:]
-      [last_CSeq:]
-      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
-      Content-Length: 0
-
-    ]]>
-  </send>
-
-</scenario>
diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register_realtime/sipp/receive_notify.xml b/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register_realtime/sipp/receive_notify.xml
new file mode 100644
index 0000000..317960c
--- /dev/null
+++ b/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register_realtime/sipp/receive_notify.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="wait for NOTIFY">
+
+  <recv request="NOTIFY" >
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+</scenario>
\ No newline at end of file
diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register_realtime/sipp/register_and_quit_two.xml b/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register_realtime/sipp/register_and_quit_two.xml
new file mode 100644
index 0000000..b1e0e19
--- /dev/null
+++ b/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register_realtime/sipp/register_and_quit_two.xml
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="REGISTER with contact set to 5062">
+
+  <pause milliseconds="1000"/>
+
+  <send retrans="500">
+        <![CDATA[
+
+        REGISTER sip:[remote_ip]:[remote_port] SIP/2.0
+        Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+        From: "[service]" <sip:[service]@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+        To: "[service]" <sip:[service]@[remote_ip]:[remote_port]>
+        Call-ID: [call_id]
+        CSeq: 1 REGISTER
+        Max-Forwards: 70
+        Contact: <sip:[service]@[local_ip]:5062>;transport=[transport]
+        Subject: Performance Test
+        Content-Length: 0
+
+        ]]>
+  </send>
+
+  <recv response="200" />
+
+</scenario>
diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register_realtime/test-config.yaml b/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register_realtime/test-config.yaml
index 955b9bb..6b700f6 100644
--- a/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register_realtime/test-config.yaml
+++ b/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register_realtime/test-config.yaml
@@ -41,7 +41,8 @@
     test-iterations:
         -
             scenarios:
-                - { 'key-args': {'scenario': 'notify_after_register.xml', '-p': '5061', '-s': 'alice'} }
+                - { 'key-args': {'scenario': 'register_and_quit_two.xml', '-p': '5061', '-s': 'alice'} }
+                - { 'key-args': {'scenario': 'receive_notify.xml', '-p': '5062', '-s': 'alice'} }
 
 realtime-config:
     data:

-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/18293
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: 18
Gerrit-Change-Id: I23c7fbea995d99211552321f2d4c7e02806792e4
Gerrit-Change-Number: 18293
Gerrit-PatchSet: 1
Gerrit-Owner: Michael Bradeen <mbradeen at sangoma.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220329/85aa85b4/attachment-0001.html>


More information about the asterisk-code-review mailing list