[Asterisk-code-review] pjsip/qualify: Add test for contacts with qualify frequency=0 (testsuite[master])

Joshua Colp asteriskteam at digium.com
Mon Apr 20 17:24:43 CDT 2015


Joshua Colp has submitted this change and it was merged.

Change subject: pjsip/qualify: Add test for contacts with qualify_frequency=0
......................................................................


pjsip/qualify: Add test for contacts with qualify_frequency=0

This test checks that contacts that have qualify_frequency=0
are marked as Unknown when they are created.

As part of the asterisk change, the Available contact
status was changed to Reachable and Unavailable to
Unreachable.

ASTERISK-24978

Change-Id: I7850ea087667eae7cf3645d54e7bd885cac32bf3
---
M tests/channels/pjsip/ami/show_endpoint/test-config.yaml
A tests/channels/pjsip/qualify/AMISendTest.py
M tests/channels/pjsip/qualify/basic/test-config.yaml
M tests/channels/pjsip/qualify/max_initial_qualify_time/test-config.yaml
A tests/channels/pjsip/qualify/no_qualify/configs/ast1/pjsip.conf
A tests/channels/pjsip/qualify/no_qualify/test-config.yaml
M tests/channels/pjsip/qualify/qualify_timeout/test-config.yaml
M tests/channels/pjsip/qualify/tests.yaml
8 files changed, 101 insertions(+), 7 deletions(-)

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



diff --git a/tests/channels/pjsip/ami/show_endpoint/test-config.yaml b/tests/channels/pjsip/ami/show_endpoint/test-config.yaml
index 9c8c70b..122e40b 100644
--- a/tests/channels/pjsip/ami/show_endpoint/test-config.yaml
+++ b/tests/channels/pjsip/ami/show_endpoint/test-config.yaml
@@ -405,8 +405,8 @@
                 match:
                     AOR: 'user1'
                     URI: '(sip:user1 at 127.0.0.1:5062|sip:user1 at 127.0.0.2:5063)'
-                    Status: 'Unknown'
-                    RoundtripUsec: 'N/A'
+                    Status: '(Unknown|Reachable)'
+                    RoundtripUsec: '(N/A|0)'
                     EndpointName: 'user1'
             count: 2
         -
diff --git a/tests/channels/pjsip/qualify/AMISendTest.py b/tests/channels/pjsip/qualify/AMISendTest.py
new file mode 100644
index 0000000..ead830c
--- /dev/null
+++ b/tests/channels/pjsip/qualify/AMISendTest.py
@@ -0,0 +1,36 @@
+#!/usr/bin/env python
+'''
+Copyright (C) 2013, Digium, Inc.
+Kevin Harwell <kharwell at digium.com>
+George Joseph <george.joseph at fairview5.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+'''
+
+import sys
+
+sys.path.append("lib/python/asterisk")
+
+from test_case import TestCase
+
+class AMISendTest(TestCase):
+    def __init__(self, path=None, config=None):
+        super(AMISendTest, self).__init__(path, config)
+        self.config = config
+        self.action = config.get('ACTION')
+        if not self.action:
+            raise Exception('"ACTION" was not defined in test-config.yaml')
+        self.create_asterisk()
+
+    def run(self):
+        super(AMISendTest, self).run()
+        self.create_ami_factory()
+
+    def ami_connect(self, ami):
+        ami.sendDeferred(self.action).addCallback(self.__on_response)
+
+    def __on_response(self, result):
+        # stop test since done
+        self.stop_reactor()
+
diff --git a/tests/channels/pjsip/qualify/basic/test-config.yaml b/tests/channels/pjsip/qualify/basic/test-config.yaml
index 03bdef2..ff7c5e1 100644
--- a/tests/channels/pjsip/qualify/basic/test-config.yaml
+++ b/tests/channels/pjsip/qualify/basic/test-config.yaml
@@ -32,7 +32,7 @@
         requirements:
             match:
                 Contact: 'sipp@@sip:127.0.0.1:5061'
-                Status: 'Available'
+                Status: 'Reachable'
         count: '1'
     -
         type: 'headermatch'
@@ -44,7 +44,7 @@
         requirements:
             match:
                 Contact: 'sipp@@sip:127.0.0.1:5061'
-                Status: 'Available'
+                Status: 'Reachable'
         count: '1'
 
 properties:
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
index 342a26c..de78457 100644
--- a/tests/channels/pjsip/qualify/max_initial_qualify_time/test-config.yaml
+++ b/tests/channels/pjsip/qualify/max_initial_qualify_time/test-config.yaml
@@ -33,7 +33,7 @@
         requirements:
             match:
                 Contact: 'sipp@@sip:127.0.0.1:5061'
-                Status: 'Available'
+                Status: 'Reachable'
         count: '1'
     -
         type: 'headermatch'
@@ -45,7 +45,7 @@
         requirements:
             match:
                 Contact: 'sipp@@sip:127.0.0.1:5061'
-                Status: 'Available'
+                Status: 'Reachable'
         count: '1'
 
 properties:
diff --git a/tests/channels/pjsip/qualify/no_qualify/configs/ast1/pjsip.conf b/tests/channels/pjsip/qualify/no_qualify/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..28d0241
--- /dev/null
+++ b/tests/channels/pjsip/qualify/no_qualify/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=0
diff --git a/tests/channels/pjsip/qualify/no_qualify/test-config.yaml b/tests/channels/pjsip/qualify/no_qualify/test-config.yaml
new file mode 100644
index 0000000..b9351d8
--- /dev/null
+++ b/tests/channels/pjsip/qualify/no_qualify/test-config.yaml
@@ -0,0 +1,43 @@
+testinfo:
+    summary: 'Test contact with qualify_timeout=0'
+    description: |
+        Make sure that contacts with qualify_frequency=0 are marked
+        as Reachable.
+
+properties:
+    minversion: '13.4.0'
+    dependencies:
+        - asterisk : 'res_pjsip'
+
+    tags:
+        - pjsip
+
+test-modules:
+    # allow test_runner to find and run the local test
+    add-test-to-search-path: 'True'
+    add-relative-to-search-path: ['../']
+    test-object:
+        config-section: object-config
+        typename: 'AMISendTest.AMISendTest'
+    modules:
+        -
+            config-section: 'ami-config'
+            typename: 'ami.AMIEventModule'
+
+object-config:
+    reactor-timeout: 15
+    ACTION: { "Action": "PJSIPShowEndpoint", "ActionID": "12345", "Endpoint": "sipp" }
+
+ami-config:
+        -
+            type: 'headermatch'
+            conditions:
+                match:
+                    Event: 'EndpointDetail'
+            requirements:
+                match:
+                    ActionID: '12345'
+                    ObjectType: 'endpoint'
+                    ObjectName: 'sipp'
+                    DeviceState: 'Not in use'
+            count: 1
diff --git a/tests/channels/pjsip/qualify/qualify_timeout/test-config.yaml b/tests/channels/pjsip/qualify/qualify_timeout/test-config.yaml
index 7a13666..804e240 100644
--- a/tests/channels/pjsip/qualify/qualify_timeout/test-config.yaml
+++ b/tests/channels/pjsip/qualify/qualify_timeout/test-config.yaml
@@ -32,7 +32,7 @@
         requirements:
             match:
                 Contact: 'sipp@@sip:127.0.0.1:5061'
-                Status: 'Unavailable'
+                Status: 'Unreachable'
                 RTT: '0'
         count: '1'
 
diff --git a/tests/channels/pjsip/qualify/tests.yaml b/tests/channels/pjsip/qualify/tests.yaml
index 15fa299..930aa65 100644
--- a/tests/channels/pjsip/qualify/tests.yaml
+++ b/tests/channels/pjsip/qualify/tests.yaml
@@ -4,3 +4,4 @@
     - test: 'auth'
     - test: 'max_initial_qualify_time'
     - test: 'qualify_timeout'
+    - test: 'no_qualify'

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I7850ea087667eae7cf3645d54e7bd885cac32bf3
Gerrit-PatchSet: 11
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: George Joseph <george.joseph at fairview5.com>
Gerrit-Reviewer: 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-code-review mailing list