[Asterisk-code-review] pjsip: Add resolver test for SRV failover with UDP transport. (testsuite[master])

Joshua Colp asteriskteam at digium.com
Sun May 10 09:07:33 CDT 2015


Joshua Colp has uploaded a new change for review.

  https://gerrit.asterisk.org/430

Change subject: pjsip: Add resolver test for SRV failover with UDP transport.
......................................................................

pjsip: Add resolver test for SRV failover with UDP transport.

This test does an SRV lookup on a domain which returns multiple records
for the UDP transport:

1. A fast record provides an IP address and port which will return a 503
response.
2. A slow record provides an IP address and port which will never respond.
3. A backup record provides a hostname which can not be resolved.

This test expects failover to occur and both the fast and slow records to
get used. If both are not contacted the test fails.

ASTERISK-25010 #close
Reported by: Matt Jordan

Change-Id: Ic959750d1d5ab3df9da96dabc40dfc67a6fb5b56
---
A tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/extensions.conf
A tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/pjsip.conf
A tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/resolver_unbound.conf
A tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com
A tests/channels/pjsip/resolver/srv/failover_udp/sipp/uas-503.xml
A tests/channels/pjsip/resolver/srv/failover_udp/sipp/uas-ignore.xml
A tests/channels/pjsip/resolver/srv/failover_udp/test-config.yaml
M tests/channels/pjsip/resolver/srv/tests.yaml
8 files changed, 127 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/30/430/1

diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/extensions.conf b/tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/extensions.conf
new file mode 100644
index 0000000..dafe092
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/extensions.conf
@@ -0,0 +1,6 @@
+[default]
+
+exten => s,1,NoOp()
+ same => n,Wait(1)
+ same => n,Dial(PJSIP/jenny/sip:example.com\;transport=udp)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/pjsip.conf b/tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..ca5e7e5
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/pjsip.conf
@@ -0,0 +1,9 @@
+[transport=udp]
+type=transport
+protocol=udp
+bind=0.0.0.0:5060
+
+[jenny]
+type=endpoint
+context=default
+allow=!all,ulaw,alaw,g722
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/resolver_unbound.conf b/tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/resolver_unbound.conf
new file mode 100644
index 0000000..38ef153
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover_udp/configs/ast1/resolver_unbound.conf
@@ -0,0 +1,3 @@
+[general]
+nameserver = 127.0.0.1 at 10053
+resolv =
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com b/tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com
new file mode 100644
index 0000000..66f0745
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover_udp/dns_zones/example.com
@@ -0,0 +1,33 @@
+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, 3, 5061, 'fast.pbx.example.com'),
+    SRV('_sip._udp.example.com', 0, 1, 5062, 'slow.pbx.example.com'),
+    SRV('_sip._udp.example.com', 1, 100, 5063, 'backup.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/resolver/srv/failover_udp/sipp/uas-503.xml b/tests/channels/pjsip/resolver/srv/failover_udp/sipp/uas-503.xml
new file mode 100644
index 0000000..c31ddce
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover_udp/sipp/uas-503.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive INVITE with audio, immediately reject with a 503">
+  <recv request="INVITE" crlf="true">
+  </recv>
+
+  <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/resolver/srv/failover_udp/sipp/uas-ignore.xml b/tests/channels/pjsip/resolver/srv/failover_udp/sipp/uas-ignore.xml
new file mode 100644
index 0000000..6645ea6
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover_udp/sipp/uas-ignore.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive INVITE with audio, ignore">
+  <recv request="INVITE" crlf="true">
+  </recv>
+</scenario>
diff --git a/tests/channels/pjsip/resolver/srv/failover_udp/test-config.yaml b/tests/channels/pjsip/resolver/srv/failover_udp/test-config.yaml
new file mode 100644
index 0000000..9d9e56f
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/failover_udp/test-config.yaml
@@ -0,0 +1,48 @@
+testinfo:
+    skip: 'See ASTERISK-25076'
+    summary: 'Test SRV failover using a UDP transport'
+    description: |
+        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: originator
+            typename: 'pluggable_modules.Originator'
+        -
+            config-section: dns-server-config
+            typename: 'dns_server.DNSServer'
+
+test-object-config:
+    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'} }
+
+originator:
+    trigger: 'ami_connect'
+    ignore-originate-failure: 'no'
+    id: '0'
+    channel: 'Local/s at default'
+    application: 'Echo'
+    async: 'True'
+
+dns-server-config:
+    port: 10053
+    python-zones:
+        -
+            example.com
+
+properties:
+    minversion: '14.0.0'
+    dependencies:
+        - app : 'sipp'
+        - asterisk : 'res_pjsip'
+        - asterisk : 'res_resolver_unbound'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/resolver/srv/tests.yaml b/tests/channels/pjsip/resolver/srv/tests.yaml
index 633aa1d..79fcbb9 100644
--- a/tests/channels/pjsip/resolver/srv/tests.yaml
+++ b/tests/channels/pjsip/resolver/srv/tests.yaml
@@ -3,3 +3,4 @@
     - test: 'transport_tcp'
     - test: 'transport_udp'
     - test: 'transport_unspecified'
+    - test: 'failover_udp'

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ic959750d1d5ab3df9da96dabc40dfc67a6fb5b56
Gerrit-PatchSet: 1
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>



More information about the asterisk-code-review mailing list