[Asterisk-code-review] pjsip/registration/outbound/failover - add test for checking SRV fail... (testsuite[certified/16.3])

Friendly Automation asteriskteam at digium.com
Fri Dec 6 13:11:06 CST 2019


Friendly Automation has submitted this change. ( https://gerrit.asterisk.org/c/testsuite/+/13389 )

Change subject: pjsip/registration/outbound/failover - add test for checking SRV failover
......................................................................

pjsip/registration/outbound/failover - add test for checking SRV failover

ASTERISK-28624

Change-Id: I9e02a9d2e5a7973263939bcfb7fcee43b5af6f1e
---
A tests/channels/pjsip/registration/outbound/failover/configs/ast1/extensions.conf
A tests/channels/pjsip/registration/outbound/failover/configs/ast1/pjsip.conf
A tests/channels/pjsip/registration/outbound/failover/configs/ast1/resolver_unbound.conf
A tests/channels/pjsip/registration/outbound/failover/dns_zones/example.com
A tests/channels/pjsip/registration/outbound/failover/sipp/uas-503.xml
A tests/channels/pjsip/registration/outbound/failover/sipp/uas-ignore.xml
A tests/channels/pjsip/registration/outbound/failover/test-config.yaml
M tests/channels/pjsip/registration/outbound/tests.yaml
8 files changed, 156 insertions(+), 0 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/tests/channels/pjsip/registration/outbound/failover/configs/ast1/extensions.conf b/tests/channels/pjsip/registration/outbound/failover/configs/ast1/extensions.conf
new file mode 100644
index 0000000..ab109a1
--- /dev/null
+++ b/tests/channels/pjsip/registration/outbound/failover/configs/ast1/extensions.conf
@@ -0,0 +1 @@
+[default]
diff --git a/tests/channels/pjsip/registration/outbound/failover/configs/ast1/pjsip.conf b/tests/channels/pjsip/registration/outbound/failover/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..a614c27
--- /dev/null
+++ b/tests/channels/pjsip/registration/outbound/failover/configs/ast1/pjsip.conf
@@ -0,0 +1,37 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[global]
+type=global
+debug=yes
+
+[transport_udp]
+type=transport
+protocol=udp
+bind=0.0.0.0:5060
+
+[endpoint_t](!)
+type=endpoint
+context=default
+direct_media=no
+allow=!all,ulaw
+
+[aor_t](!)
+type=aor
+
+[registration_t](!)
+type=registration
+transport=transport_udp
+server_uri=sip:example.com
+
+[alice](registration_t)
+client_uri=sip:alice at example.com
+contact_user=alice
+
+[alice](aor_t)
+
+[alice](endpoint_t)
+aors=alice
+from_user=alice
diff --git a/tests/channels/pjsip/registration/outbound/failover/configs/ast1/resolver_unbound.conf b/tests/channels/pjsip/registration/outbound/failover/configs/ast1/resolver_unbound.conf
new file mode 100644
index 0000000..38ef153
--- /dev/null
+++ b/tests/channels/pjsip/registration/outbound/failover/configs/ast1/resolver_unbound.conf
@@ -0,0 +1,3 @@
+[general]
+nameserver = 127.0.0.1 at 10053
+resolv =
diff --git a/tests/channels/pjsip/registration/outbound/failover/dns_zones/example.com b/tests/channels/pjsip/registration/outbound/failover/dns_zones/example.com
new file mode 100644
index 0000000..9ac96ee
--- /dev/null
+++ b/tests/channels/pjsip/registration/outbound/failover/dns_zones/example.com
@@ -0,0 +1,36 @@
+zone = [
+    SOA(
+        # For whom we are the authority
+        'example.com',
+
+        # This nameserver's name
+        mname = "ns1.example.com",
+
+        # Mailbox of individual who handles this
+        rname = "root.example.com",
+
+        # Unique serial identifying this SOA data
+        serial = 2003010601,
+
+        # Time interval before zone should be refreshed
+        refresh = "1H",
+
+        # Interval before failed refresh should be retried
+        retry = "1H",
+
+        # Upper limit on time interval before expiry
+        expire = "1H",
+
+        # Minimum TTL
+        minimum = "1H"
+    ),
+
+    SRV('_sip._udp.example.com', 0, 10, 5061, 'fast.pbx.example.com'),
+    SRV('_sip._udp.example.com', 1, 0, 5062, 'slow.pbx.example.com'),
+
+    SRV('_sip._tcp.example.com', 0, 0, 5061, 'fast.pbx.example.com'),
+    SRV('_sip._tcp.example.com', 1, 10, 5062, 'slow.pbx.example.com'),
+
+    A('fast.pbx.example.com', '127.0.0.1'),
+    A('slow.pbx.example.com', '127.0.0.1'),
+]
diff --git a/tests/channels/pjsip/registration/outbound/failover/sipp/uas-503.xml b/tests/channels/pjsip/registration/outbound/failover/sipp/uas-503.xml
new file mode 100644
index 0000000..2baa1fd
--- /dev/null
+++ b/tests/channels/pjsip/registration/outbound/failover/sipp/uas-503.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive REGISTER, immediately reject with a 503">
+  <recv request="REGISTER" crlf="true" />
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 503 Service Unavailable
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+    ]]>
+  </send>
+</scenario>
diff --git a/tests/channels/pjsip/registration/outbound/failover/sipp/uas-ignore.xml b/tests/channels/pjsip/registration/outbound/failover/sipp/uas-ignore.xml
new file mode 100644
index 0000000..c4d1441
--- /dev/null
+++ b/tests/channels/pjsip/registration/outbound/failover/sipp/uas-ignore.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive REGISTER">
+  <recv request="REGISTER" />
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[pid]SIPpTag01[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      [last_Expires:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: [len]
+
+    ]]>
+  </send>
+</scenario>
diff --git a/tests/channels/pjsip/registration/outbound/failover/test-config.yaml b/tests/channels/pjsip/registration/outbound/failover/test-config.yaml
new file mode 100644
index 0000000..b8865dd
--- /dev/null
+++ b/tests/channels/pjsip/registration/outbound/failover/test-config.yaml
@@ -0,0 +1,37 @@
+testinfo:
+    summary: 'Test SRV failover for outbound registration'
+    description: |
+        Using a SIP outbound registration, this test verifies that an SRV
+        record lookup resulting in multiple results will successfully fail
+        over to other records if previous ones do not respond.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: dns-server-config
+            typename: 'dns_server.DNSServer'
+
+test-object-config:
+    memcheck-delay-stop: 7
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'uas-503.xml', '-i': '127.0.0.1', '-p': '5061'} }
+                - { 'key-args': {'scenario': 'uas-ignore.xml', '-i': '127.0.0.1', '-p': '5062'} }
+
+dns-server-config:
+    python-zones:
+        -
+            example.com
+
+properties:
+    dependencies:
+        - app : 'sipp'
+        - asterisk : 'res_pjsip'
+        - asterisk : 'res_pjsip_outbound_registration'
+        - asterisk : 'res_resolver_unbound'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/registration/outbound/tests.yaml b/tests/channels/pjsip/registration/outbound/tests.yaml
index 07e2fd9..c0e9dd3 100644
--- a/tests/channels/pjsip/registration/outbound/tests.yaml
+++ b/tests/channels/pjsip/registration/outbound/tests.yaml
@@ -2,6 +2,7 @@
 tests:
     - dir: 'unregister'
     - test: 'auth_loop'
+    - test: 'failover'
     - test: 'fatal_retry'
     - test: 'forbidden_retry'
     - test: 'interval_too_brief'

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

Gerrit-Project: testsuite
Gerrit-Branch: certified/16.3
Gerrit-Change-Id: I9e02a9d2e5a7973263939bcfb7fcee43b5af6f1e
Gerrit-Change-Number: 13389
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20191206/b2d32967/attachment-0001.html>


More information about the asterisk-code-review mailing list