[asterisk-commits] Change in testsuite[master]: pjsip/options: Add tests for qualify_timeout and max_initia...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Apr 17 15:55:03 CDT 2015


Matt Jordan has submitted this change and it was merged.

Change subject: pjsip/options:  Add tests for qualify_timeout and max_initial_qualify_time
......................................................................


pjsip/options:  Add tests for qualify_timeout and max_initial_qualify_time

Renamed the original test to 'auth' since its purpose was to make sure
Asterisk didn't crash on authed OPTIONS.

Added a basic test that just makes sure a qualify works.

Added tests that make sure the new qualify_timeout and
max_initial_qualify_time work.

ASTERISK-24863

Change-Id: Id37260a9f6b9927fdd90bef73d43a97ce2445fa1
---
R tests/channels/pjsip/qualify/auth/configs/ast1/pjsip.conf
R tests/channels/pjsip/qualify/auth/sipp/options.xml
R tests/channels/pjsip/qualify/auth/test-config.yaml
A tests/channels/pjsip/qualify/basic/configs/ast1/pjsip.conf
A tests/channels/pjsip/qualify/basic/sipp/options.xml
A tests/channels/pjsip/qualify/basic/test-config.yaml
A tests/channels/pjsip/qualify/max_initial_qualify_time/configs/ast1/pjsip.conf
A tests/channels/pjsip/qualify/max_initial_qualify_time/sipp/options.xml
A tests/channels/pjsip/qualify/max_initial_qualify_time/test-config.yaml
A tests/channels/pjsip/qualify/qualify_timeout/configs/ast1/pjsip.conf
A tests/channels/pjsip/qualify/qualify_timeout/sipp/options.xml
A tests/channels/pjsip/qualify/qualify_timeout/test-config.yaml
A tests/channels/pjsip/qualify/tests.yaml
M tests/channels/pjsip/tests.yaml
14 files changed, 298 insertions(+), 1 deletion(-)

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



diff --git a/tests/channels/pjsip/qualify/configs/ast1/pjsip.conf b/tests/channels/pjsip/qualify/auth/configs/ast1/pjsip.conf
similarity index 100%
rename from tests/channels/pjsip/qualify/configs/ast1/pjsip.conf
rename to tests/channels/pjsip/qualify/auth/configs/ast1/pjsip.conf
diff --git a/tests/channels/pjsip/qualify/sipp/options.xml b/tests/channels/pjsip/qualify/auth/sipp/options.xml
similarity index 100%
rename from tests/channels/pjsip/qualify/sipp/options.xml
rename to tests/channels/pjsip/qualify/auth/sipp/options.xml
diff --git a/tests/channels/pjsip/qualify/test-config.yaml b/tests/channels/pjsip/qualify/auth/test-config.yaml
similarity index 100%
rename from tests/channels/pjsip/qualify/test-config.yaml
rename to tests/channels/pjsip/qualify/auth/test-config.yaml
diff --git a/tests/channels/pjsip/qualify/basic/configs/ast1/pjsip.conf b/tests/channels/pjsip/qualify/basic/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..f9e3f8d
--- /dev/null
+++ b/tests/channels/pjsip/qualify/basic/configs/ast1/pjsip.conf
@@ -0,0 +1,14 @@
+
+[mytransport]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[sipp]
+type=endpoint
+aors=sipp
+
+[sipp]
+type=aor
+contact=sip:127.0.0.1:5061
+qualify_frequency=5
diff --git a/tests/channels/pjsip/qualify/basic/sipp/options.xml b/tests/channels/pjsip/qualify/basic/sipp/options.xml
new file mode 100644
index 0000000..4a6daaa
--- /dev/null
+++ b/tests/channels/pjsip/qualify/basic/sipp/options.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="UAS OPTIONS">
+    <recv request="OPTIONS"/>
+
+  <pause></pause>
+  <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/qualify/basic/test-config.yaml b/tests/channels/pjsip/qualify/basic/test-config.yaml
new file mode 100644
index 0000000..03bdef2
--- /dev/null
+++ b/tests/channels/pjsip/qualify/basic/test-config.yaml
@@ -0,0 +1,61 @@
+testinfo:
+    summary:     'Test basic qualify'
+    description: |
+        'With qualify_frequency = 5, send a qualify to a contact and verify that
+        the contact is marked Available before reactor-timeout.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: 'ami-config'
+            typename: 'ami.AMIEventModule'
+
+test-object-config:
+    fail-on-any: False
+    reactor-timeout: 10
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'options.xml', '-i': '127.0.0.1', '-p': '5061'} }
+
+ami-config:
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'TestEvent'
+                State: 'AOR_CONTACT_UPDATE'
+        requirements:
+            match:
+                Contact: 'sipp@@sip:127.0.0.1:5061'
+                Status: 'Available'
+        count: '1'
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'TestEvent'
+                State: 'AOR_CONTACT_QUALIFY_RESULT'
+        requirements:
+            match:
+                Contact: 'sipp@@sip:127.0.0.1:5061'
+                Status: 'Available'
+        count: '1'
+
+properties:
+    minversion: '13.4.0'
+    dependencies:
+        - buildoption: 'TEST_FRAMEWORK'
+        - python: 'twisted'
+        - python: 'starpy'
+        - sipp:
+            version: 'v3.3'
+        - asterisk: 'res_pjsip'
+    tags:
+        - pjsip
+
diff --git a/tests/channels/pjsip/qualify/max_initial_qualify_time/configs/ast1/pjsip.conf b/tests/channels/pjsip/qualify/max_initial_qualify_time/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..14ad57e
--- /dev/null
+++ b/tests/channels/pjsip/qualify/max_initial_qualify_time/configs/ast1/pjsip.conf
@@ -0,0 +1,19 @@
+
+[global]
+type=global
+max_initial_qualify_time = 1
+
+[mytransport]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[sipp]
+type=endpoint
+aors=sipp
+
+[sipp]
+type=aor
+contact=sip:127.0.0.1:5061
+qualify_frequency=6000
+qualify_timeout = 2
diff --git a/tests/channels/pjsip/qualify/max_initial_qualify_time/sipp/options.xml b/tests/channels/pjsip/qualify/max_initial_qualify_time/sipp/options.xml
new file mode 100644
index 0000000..4a6daaa
--- /dev/null
+++ b/tests/channels/pjsip/qualify/max_initial_qualify_time/sipp/options.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="UAS OPTIONS">
+    <recv request="OPTIONS"/>
+
+  <pause></pause>
+  <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/qualify/max_initial_qualify_time/test-config.yaml b/tests/channels/pjsip/qualify/max_initial_qualify_time/test-config.yaml
new file mode 100644
index 0000000..342a26c
--- /dev/null
+++ b/tests/channels/pjsip/qualify/max_initial_qualify_time/test-config.yaml
@@ -0,0 +1,62 @@
+testinfo:
+    summary:     'Test max_initial_qualify time'
+    description: |
+        'With qualify_timeout = 6000, reactor-timeout = 10, and max_initial_qualify_time = 1,
+        send a qualify to a contact and verify that the contact is qualified before the
+        reactor timeout.  If it isn't then max_initial_qualify_time didn't work.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: 'ami-config'
+            typename: 'ami.AMIEventModule'
+
+test-object-config:
+    fail-on-any: False
+    reactor-timeout: 10
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'options.xml', '-i': '127.0.0.1', '-p': '5061'} }
+
+ami-config:
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'TestEvent'
+                State: 'AOR_CONTACT_UPDATE'
+        requirements:
+            match:
+                Contact: 'sipp@@sip:127.0.0.1:5061'
+                Status: 'Available'
+        count: '1'
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'TestEvent'
+                State: 'AOR_CONTACT_QUALIFY_RESULT'
+        requirements:
+            match:
+                Contact: 'sipp@@sip:127.0.0.1:5061'
+                Status: 'Available'
+        count: '1'
+
+properties:
+    minversion: '13.4.0'
+    dependencies:
+        - buildoption: 'TEST_FRAMEWORK'
+        - python: 'twisted'
+        - python: 'starpy'
+        - sipp:
+            version: 'v3.3'
+        - asterisk: 'res_pjsip'
+    tags:
+        - pjsip
+
diff --git a/tests/channels/pjsip/qualify/qualify_timeout/configs/ast1/pjsip.conf b/tests/channels/pjsip/qualify/qualify_timeout/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..14ad57e
--- /dev/null
+++ b/tests/channels/pjsip/qualify/qualify_timeout/configs/ast1/pjsip.conf
@@ -0,0 +1,19 @@
+
+[global]
+type=global
+max_initial_qualify_time = 1
+
+[mytransport]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[sipp]
+type=endpoint
+aors=sipp
+
+[sipp]
+type=aor
+contact=sip:127.0.0.1:5061
+qualify_frequency=6000
+qualify_timeout = 2
diff --git a/tests/channels/pjsip/qualify/qualify_timeout/sipp/options.xml b/tests/channels/pjsip/qualify/qualify_timeout/sipp/options.xml
new file mode 100644
index 0000000..4a6daaa
--- /dev/null
+++ b/tests/channels/pjsip/qualify/qualify_timeout/sipp/options.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="UAS OPTIONS">
+    <recv request="OPTIONS"/>
+
+  <pause></pause>
+  <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/qualify/qualify_timeout/test-config.yaml b/tests/channels/pjsip/qualify/qualify_timeout/test-config.yaml
new file mode 100644
index 0000000..7a13666
--- /dev/null
+++ b/tests/channels/pjsip/qualify/qualify_timeout/test-config.yaml
@@ -0,0 +1,50 @@
+testinfo:
+    summary:     'Test qualify timeout'
+    description: |
+        'With qualify_timeout = 2, and sipp pausing for 3 seconds, send a qualify to a
+        contact and verify that the contact is marked Unavailable.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: 'ami-config'
+            typename: 'ami.AMIEventModule'
+
+test-object-config:
+    fail-on-any: False
+    reactor-timeout: 10
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'options.xml', '-i': '127.0.0.1', '-d': '3000', '-p': '5061'} }
+
+ami-config:
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'TestEvent'
+                State: 'AOR_CONTACT_QUALIFY_RESULT'
+        requirements:
+            match:
+                Contact: 'sipp@@sip:127.0.0.1:5061'
+                Status: 'Unavailable'
+                RTT: '0'
+        count: '1'
+
+properties:
+    minversion: '13.4.0'
+    dependencies:
+        - buildoption: 'TEST_FRAMEWORK'
+        - python: 'twisted'
+        - python: 'starpy'
+        - sipp:
+            version: 'v3.3'
+        - asterisk: 'res_pjsip'
+    tags:
+        - pjsip
+
diff --git a/tests/channels/pjsip/qualify/tests.yaml b/tests/channels/pjsip/qualify/tests.yaml
new file mode 100644
index 0000000..15fa299
--- /dev/null
+++ b/tests/channels/pjsip/qualify/tests.yaml
@@ -0,0 +1,6 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - test: 'basic'
+    - test: 'auth'
+    - test: 'max_initial_qualify_time'
+    - test: 'qualify_timeout'
diff --git a/tests/channels/pjsip/tests.yaml b/tests/channels/pjsip/tests.yaml
index ddc655a..21cb74b 100644
--- a/tests/channels/pjsip/tests.yaml
+++ b/tests/channels/pjsip/tests.yaml
@@ -19,7 +19,7 @@
     - dir: 'subscriptions'
     - test: 'hold_ice'
     - test: 'refer_send_to_vm'
-    - test: 'qualify'
+    - dir: 'qualify'
     - test: 'headers'
     - dir: 'transfers'
     - test: 'info_dtmf'

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

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



More information about the asterisk-commits mailing list