[asterisk-commits] res pjsip mwi: Add tests for receiving an initial unsolicite... (testsuite[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Apr 22 14:26:28 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: res_pjsip_mwi: Add tests for receiving an initial unsolicited NOTIFY upon startup and registration.
......................................................................


res_pjsip_mwi: Add tests for receiving an initial unsolicited NOTIFY upon startup and registration.

This change adds two tests:

1. A test which starts Asterisk up with a static contact. It's expected that the res_pjsip_mwi
module will send an unsolicited initial NOTIFY upon startup. If this NOTIFY is not received the
test fails.

2. A test which registers to Asterisk. It's expected that the res_pjsip_mwi module will send
an unsolicited NOTIFY upon registration. If this NOTIFY is not received the test fails.

ASTERISK-24982 #close
Reported by: Joshua Colp

Change-Id: I37ec14ed4a5f5952faf7ad14e6f41ccbf13152c5
---
M tests/channels/pjsip/subscriptions/mwi/tests.yaml
A tests/channels/pjsip/subscriptions/mwi/unsolicited/initial_notify/configs/ast1/pjsip.conf
A tests/channels/pjsip/subscriptions/mwi/unsolicited/initial_notify/configs/ast1/voicemail.conf
A tests/channels/pjsip/subscriptions/mwi/unsolicited/initial_notify/sipp/initial_notify.xml
A tests/channels/pjsip/subscriptions/mwi/unsolicited/initial_notify/test-config.yaml
R tests/channels/pjsip/subscriptions/mwi/unsolicited/mailbox_count_changes/configs/ast1/modules.conf
R tests/channels/pjsip/subscriptions/mwi/unsolicited/mailbox_count_changes/configs/ast1/pjsip.conf
R tests/channels/pjsip/subscriptions/mwi/unsolicited/mailbox_count_changes/mwi_check.py
R tests/channels/pjsip/subscriptions/mwi/unsolicited/mailbox_count_changes/test-config.yaml
A tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/configs/ast1/pjsip.conf
A tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/configs/ast1/voicemail.conf
A tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/sipp/notify_after_register.xml
A tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/test-config.yaml
A tests/channels/pjsip/subscriptions/mwi/unsolicited/tests.yaml
14 files changed, 174 insertions(+), 1 deletion(-)

Approvals:
  Matt Jordan: Looks good to me, approved; Verified
  George Joseph: Looks good to me, but someone else must approve



diff --git a/tests/channels/pjsip/subscriptions/mwi/tests.yaml b/tests/channels/pjsip/subscriptions/mwi/tests.yaml
index df7ff3e..dead83e 100644
--- a/tests/channels/pjsip/subscriptions/mwi/tests.yaml
+++ b/tests/channels/pjsip/subscriptions/mwi/tests.yaml
@@ -1,7 +1,7 @@
 # Enter tests here in the order they should be considered for execution:
 tests:
     - test: 'missing_aor'
-    - test: 'unsolicited'
+    - dir: 'unsolicited'
     - test: 'mwi_aggregate'
     - test: 'no_accept_header'
     - test: 'sub_setup_teardown'
diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/initial_notify/configs/ast1/pjsip.conf b/tests/channels/pjsip/subscriptions/mwi/unsolicited/initial_notify/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..fb0b3fb
--- /dev/null
+++ b/tests/channels/pjsip/subscriptions/mwi/unsolicited/initial_notify/configs/ast1/pjsip.conf
@@ -0,0 +1,16 @@
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw
+context=default
+aors=alice
+mailboxes=1000 at default
+
+[alice]
+type=aor
+max_contacts=5
+contact=sip:127.0.0.1:5061
diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/initial_notify/configs/ast1/voicemail.conf b/tests/channels/pjsip/subscriptions/mwi/unsolicited/initial_notify/configs/ast1/voicemail.conf
new file mode 100644
index 0000000..253c745
--- /dev/null
+++ b/tests/channels/pjsip/subscriptions/mwi/unsolicited/initial_notify/configs/ast1/voicemail.conf
@@ -0,0 +1,2 @@
+[default]
+1000 => 4242,Example Mailbox
diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/initial_notify/sipp/initial_notify.xml b/tests/channels/pjsip/subscriptions/mwi/unsolicited/initial_notify/sipp/initial_notify.xml
new file mode 100644
index 0000000..554c267
--- /dev/null
+++ b/tests/channels/pjsip/subscriptions/mwi/unsolicited/initial_notify/sipp/initial_notify.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Initial NOTIFY">
+  <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/initial_notify/test-config.yaml b/tests/channels/pjsip/subscriptions/mwi/unsolicited/initial_notify/test-config.yaml
new file mode 100644
index 0000000..16f5fba
--- /dev/null
+++ b/tests/channels/pjsip/subscriptions/mwi/unsolicited/initial_notify/test-config.yaml
@@ -0,0 +1,35 @@
+testinfo:
+    summary:     'Ensures an unsolicited MWI notification is sent upon startup'
+    description: |
+        "This test starts up Asterisk and sipp. The scenario given to sipp is configured to
+        expect a NOTIFY message from Asterisk. Upon startup Asterisk should send a NOTIFY
+        message with MWI to all endpoints configured with unsolicited MWI. If this NOTIFY is
+        not received the test fails."
+
+
+properties:
+    minversion: '13.4.0'
+    dependencies:
+        - sipp :
+            version : 'v3.0'
+        - python: 'twisted'
+        - python: 'starpy'
+        - asterisk: 'res_pjsip'
+        - asterisk: 'res_pjsip_mwi'
+    tags:
+        - pjsip
+
+test-modules:
+    add-test-to-search-path: 'True'
+    test-object:
+        config-section: sipp-config
+        typename: 'sipp.SIPpTestCase'
+
+sipp-config:
+    reactor-timeout: 30
+    fail-on-any: True
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'initial_notify.xml', '-p': '5061'} }
+
diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/configs/ast1/modules.conf b/tests/channels/pjsip/subscriptions/mwi/unsolicited/mailbox_count_changes/configs/ast1/modules.conf
similarity index 100%
rename from tests/channels/pjsip/subscriptions/mwi/unsolicited/configs/ast1/modules.conf
rename to tests/channels/pjsip/subscriptions/mwi/unsolicited/mailbox_count_changes/configs/ast1/modules.conf
diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/configs/ast1/pjsip.conf b/tests/channels/pjsip/subscriptions/mwi/unsolicited/mailbox_count_changes/configs/ast1/pjsip.conf
similarity index 100%
rename from tests/channels/pjsip/subscriptions/mwi/unsolicited/configs/ast1/pjsip.conf
rename to tests/channels/pjsip/subscriptions/mwi/unsolicited/mailbox_count_changes/configs/ast1/pjsip.conf
diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/mwi_check.py b/tests/channels/pjsip/subscriptions/mwi/unsolicited/mailbox_count_changes/mwi_check.py
similarity index 100%
rename from tests/channels/pjsip/subscriptions/mwi/unsolicited/mwi_check.py
rename to tests/channels/pjsip/subscriptions/mwi/unsolicited/mailbox_count_changes/mwi_check.py
diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/test-config.yaml b/tests/channels/pjsip/subscriptions/mwi/unsolicited/mailbox_count_changes/test-config.yaml
similarity index 100%
rename from tests/channels/pjsip/subscriptions/mwi/unsolicited/test-config.yaml
rename to tests/channels/pjsip/subscriptions/mwi/unsolicited/mailbox_count_changes/test-config.yaml
diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/configs/ast1/pjsip.conf b/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..103f3ae
--- /dev/null
+++ b/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/configs/ast1/pjsip.conf
@@ -0,0 +1,15 @@
+[local-transport]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[alice]
+type=endpoint
+allow=g722,ulaw,alaw
+context=default
+aors=alice
+mailboxes=1000 at default
+
+[alice]
+type=aor
+max_contacts=5
diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/configs/ast1/voicemail.conf b/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/configs/ast1/voicemail.conf
new file mode 100644
index 0000000..253c745
--- /dev/null
+++ b/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/configs/ast1/voicemail.conf
@@ -0,0 +1,2 @@
+[default]
+1000 => 4242,Example Mailbox
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
new file mode 100644
index 0000000..afe0fe9
--- /dev/null
+++ b/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/sipp/notify_after_register.xml
@@ -0,0 +1,41 @@
+<?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/test-config.yaml b/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/test-config.yaml
new file mode 100644
index 0000000..8a7429c
--- /dev/null
+++ b/tests/channels/pjsip/subscriptions/mwi/unsolicited/notify_after_register/test-config.yaml
@@ -0,0 +1,35 @@
+testinfo:
+    summary:     'Ensures an unsolicited MWI notification is sent upon endpoint registration'
+    description: |
+        "This test starts up Asterisk and sipp. The scenario given to sipp is configured to
+        register to an AOR and then expect a NOTIFY message from Asterisk. Upon registration
+        Asterisk should send a NOTIFY message with MWI to the endpoint if it is configured
+        with unsolicited MWI. If this NOTIFY is not received the test fails."
+
+
+properties:
+    minversion: '13.4.0'
+    dependencies:
+        - sipp :
+            version : 'v3.0'
+        - python: 'twisted'
+        - python: 'starpy'
+        - asterisk: 'res_pjsip'
+        - asterisk: 'res_pjsip_mwi'
+    tags:
+        - pjsip
+
+test-modules:
+    add-test-to-search-path: 'True'
+    test-object:
+        config-section: sipp-config
+        typename: 'sipp.SIPpTestCase'
+
+sipp-config:
+    reactor-timeout: 30
+    fail-on-any: True
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'notify_after_register.xml', '-p': '5061', '-s': 'alice'} }
+
diff --git a/tests/channels/pjsip/subscriptions/mwi/unsolicited/tests.yaml b/tests/channels/pjsip/subscriptions/mwi/unsolicited/tests.yaml
new file mode 100644
index 0000000..c4ec75e
--- /dev/null
+++ b/tests/channels/pjsip/subscriptions/mwi/unsolicited/tests.yaml
@@ -0,0 +1,5 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - test: 'mailbox_count_changes'
+    - test: 'initial_notify'
+    - test: 'notify_after_register'

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I37ec14ed4a5f5952faf7ad14e6f41ccbf13152c5
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: Matt Jordan <mjordan at digium.com>



More information about the asterisk-commits mailing list