[Asterisk-code-review] pjsip/resolver: Add tests which cover an explicit configured... (testsuite[master])

Anonymous Coward asteriskteam at digium.com
Fri Nov 11 07:17:29 CST 2016


Anonymous Coward #1000019 has submitted this change and it was merged. ( https://gerrit.asterisk.org/4359 )

Change subject: pjsip/resolver: Add tests which cover an explicit configured transport.
......................................................................


pjsip/resolver: Add tests which cover an explicit configured transport.

This adds tests for NAPTR and SRV in PJSIP which confirms that when
an explicit IPv6 transport is configured that resolution occurs
as it should.

ASTERISK-26571

Change-Id: I95072d4940d99194ded80887e1ee3306c5337073
---
A tests/channels/pjsip/resolver/naptr/explicit_transport_configured/configs/ast1/extensions.conf
A tests/channels/pjsip/resolver/naptr/explicit_transport_configured/configs/ast1/pjsip.conf
A tests/channels/pjsip/resolver/naptr/explicit_transport_configured/configs/ast1/resolver_unbound.conf
A tests/channels/pjsip/resolver/naptr/explicit_transport_configured/dns_zones/example.com
A tests/channels/pjsip/resolver/naptr/explicit_transport_configured/sipp/uas-ipv6.xml
A tests/channels/pjsip/resolver/naptr/explicit_transport_configured/test-config.yaml
M tests/channels/pjsip/resolver/naptr/tests.yaml
A tests/channels/pjsip/resolver/srv/explicit_transport_configured/configs/ast1/extensions.conf
A tests/channels/pjsip/resolver/srv/explicit_transport_configured/configs/ast1/pjsip.conf
A tests/channels/pjsip/resolver/srv/explicit_transport_configured/configs/ast1/resolver_unbound.conf
A tests/channels/pjsip/resolver/srv/explicit_transport_configured/dns_zones/example.com
A tests/channels/pjsip/resolver/srv/explicit_transport_configured/sipp/uas-ipv6.xml
A tests/channels/pjsip/resolver/srv/explicit_transport_configured/test-config.yaml
M tests/channels/pjsip/resolver/srv/tests.yaml
14 files changed, 340 insertions(+), 0 deletions(-)

Approvals:
  Kevin Harwell: Looks good to me, but someone else must approve
  George Joseph: Looks good to me, but someone else must approve
  Anonymous Coward #1000019: Verified
  Joshua Colp: Looks good to me, approved



diff --git a/tests/channels/pjsip/resolver/naptr/explicit_transport_configured/configs/ast1/extensions.conf b/tests/channels/pjsip/resolver/naptr/explicit_transport_configured/configs/ast1/extensions.conf
new file mode 100644
index 0000000..e986f77
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/explicit_transport_configured/configs/ast1/extensions.conf
@@ -0,0 +1,6 @@
+[default]
+
+exten => s-ipv6,1,NoOp()
+ same => n,Wait(1)
+ same => n,Dial(PJSIP/forrest/sip:naptr.example.com\;transport=udp)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/resolver/naptr/explicit_transport_configured/configs/ast1/pjsip.conf b/tests/channels/pjsip/resolver/naptr/explicit_transport_configured/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..34ceba7
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/explicit_transport_configured/configs/ast1/pjsip.conf
@@ -0,0 +1,16 @@
+[transport-ipv4-udp]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[transport-ipv6-udp]
+type=transport
+protocol=udp
+bind=[::1]:5060
+
+[forrest]
+type=endpoint
+transport=transport-ipv6-udp
+from_user=forrest
+context=default
+allow=!all,ulaw,alaw,g722
diff --git a/tests/channels/pjsip/resolver/naptr/explicit_transport_configured/configs/ast1/resolver_unbound.conf b/tests/channels/pjsip/resolver/naptr/explicit_transport_configured/configs/ast1/resolver_unbound.conf
new file mode 100644
index 0000000..38ef153
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/explicit_transport_configured/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/naptr/explicit_transport_configured/dns_zones/example.com b/tests/channels/pjsip/resolver/naptr/explicit_transport_configured/dns_zones/example.com
new file mode 100644
index 0000000..7c734e3
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/explicit_transport_configured/dns_zones/example.com
@@ -0,0 +1,32 @@
+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"
+    ),
+
+    NAPTR('naptr.example.com', 0, 1, 'S', 'SIP+D2U', '', '_sip._udp.example.com'),
+    SRV('_sip._udp.example.com', 0, 1, 5061, 'main.example.com'),
+    A('main.example.com', '127.0.0.1'),
+    AAAA('main.example.com', '::1'),
+]
diff --git a/tests/channels/pjsip/resolver/naptr/explicit_transport_configured/sipp/uas-ipv6.xml b/tests/channels/pjsip/resolver/naptr/explicit_transport_configured/sipp/uas-ipv6.xml
new file mode 100644
index 0000000..e72519e
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/explicit_transport_configured/sipp/uas-ipv6.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive INVITE with audio, immediately answer, and then hangup">
+  <Global variables="remote_tag" />
+  <recv request="INVITE" crlf="true">
+      <action>
+          <!-- Save the from tag. We'll need it when we send our BYE -->
+          <ereg regexp=".*(;tag=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+      </action>
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=- 1324901698 1324901698 IN IP4 [local_ip]
+      s=-
+      c=IN IP4 [local_ip]
+      t=0 0
+      m=audio 2226 RTP/AVP 0 101
+      a=sendrecv
+      a=rtpmap:0 PCMU/8000
+      a=rtpmap:101 telephone-event/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK" rtd="true" crlf="true">
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: ua1 <sip:ua1@[local_ip]:[local_port]>;tag=[call_number]
+      To: [$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200">
+  </recv>
+
+</scenario>
diff --git a/tests/channels/pjsip/resolver/naptr/explicit_transport_configured/test-config.yaml b/tests/channels/pjsip/resolver/naptr/explicit_transport_configured/test-config.yaml
new file mode 100644
index 0000000..0c0a045
--- /dev/null
+++ b/tests/channels/pjsip/resolver/naptr/explicit_transport_configured/test-config.yaml
@@ -0,0 +1,47 @@
+testinfo:
+    summary: 'Test NAPTR resolution when an explicit IPv6 transport is configured'
+    description: |
+        'This test verifies that when an endpoint is configured with an explicit
+        IPv6 transport that a NAPTR then SRV record and then AAAA lookup occurs.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: originator-ipv6
+            typename: 'pluggable_modules.Originator'
+        -
+            config-section: dns-server-config
+            typename: 'dns_server.DNSServer'
+
+test-object-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'uas-ipv6.xml',
+                                                    '-i': '[::1]', '-p': '5061'} }
+originator-ipv6:
+    trigger: 'scenario_start'
+    scenario-name: 'uas-ipv6.xml'
+    ignore-originate-failure: 'no'
+    id: '0'
+    channel: 'Local/s-ipv6 at default'
+    application: 'Echo'
+    async: 'True'
+
+dns-server-config:
+    port: 10053
+    python-zones:
+        -
+            example.com
+
+properties:
+    minversion: '14.2.0'
+    dependencies:
+        - app : 'sipp'
+        - asterisk : 'res_pjsip'
+        - asterisk : 'res_resolver_unbound'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/resolver/naptr/tests.yaml b/tests/channels/pjsip/resolver/naptr/tests.yaml
index 469a3d0..275db87 100644
--- a/tests/channels/pjsip/resolver/naptr/tests.yaml
+++ b/tests/channels/pjsip/resolver/naptr/tests.yaml
@@ -1,5 +1,6 @@
 # Enter tests here in the order they should be considered for execution:
 tests:
+    - test: 'explicit_transport_configured'
     - test: 'transport_tcp'
     - test: 'transport_udp'
     - test: 'transport_unspecified'
diff --git a/tests/channels/pjsip/resolver/srv/explicit_transport_configured/configs/ast1/extensions.conf b/tests/channels/pjsip/resolver/srv/explicit_transport_configured/configs/ast1/extensions.conf
new file mode 100644
index 0000000..f5d768e
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/explicit_transport_configured/configs/ast1/extensions.conf
@@ -0,0 +1,6 @@
+[default]
+
+exten => s-ipv6,1,NoOp()
+ same => n,Wait(1)
+ same => n,Dial(PJSIP/forrest/sip:example.com\;transport=udp)
+ same => n,Hangup()
diff --git a/tests/channels/pjsip/resolver/srv/explicit_transport_configured/configs/ast1/pjsip.conf b/tests/channels/pjsip/resolver/srv/explicit_transport_configured/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..34ceba7
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/explicit_transport_configured/configs/ast1/pjsip.conf
@@ -0,0 +1,16 @@
+[transport-ipv4-udp]
+type=transport
+protocol=udp
+bind=127.0.0.1:5060
+
+[transport-ipv6-udp]
+type=transport
+protocol=udp
+bind=[::1]:5060
+
+[forrest]
+type=endpoint
+transport=transport-ipv6-udp
+from_user=forrest
+context=default
+allow=!all,ulaw,alaw,g722
diff --git a/tests/channels/pjsip/resolver/srv/explicit_transport_configured/configs/ast1/resolver_unbound.conf b/tests/channels/pjsip/resolver/srv/explicit_transport_configured/configs/ast1/resolver_unbound.conf
new file mode 100644
index 0000000..38ef153
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/explicit_transport_configured/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/explicit_transport_configured/dns_zones/example.com b/tests/channels/pjsip/resolver/srv/explicit_transport_configured/dns_zones/example.com
new file mode 100644
index 0000000..7e0ab5b
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/explicit_transport_configured/dns_zones/example.com
@@ -0,0 +1,31 @@
+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, 1, 5061, 'main.example.com'),
+    A('main.example.com', '127.0.0.1'),
+    AAAA('main.example.com', '::1'),
+]
diff --git a/tests/channels/pjsip/resolver/srv/explicit_transport_configured/sipp/uas-ipv6.xml b/tests/channels/pjsip/resolver/srv/explicit_transport_configured/sipp/uas-ipv6.xml
new file mode 100644
index 0000000..e72519e
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/explicit_transport_configured/sipp/uas-ipv6.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Receive INVITE with audio, immediately answer, and then hangup">
+  <Global variables="remote_tag" />
+  <recv request="INVITE" crlf="true">
+      <action>
+          <!-- Save the from tag. We'll need it when we send our BYE -->
+          <ereg regexp=".*(;tag=.*)"
+              header="From:"
+              search_in="hdr"
+              check_it="true"
+              assign_to="remote_tag"/>
+      </action>
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:];tag=[call_number]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=- 1324901698 1324901698 IN IP4 [local_ip]
+      s=-
+      c=IN IP4 [local_ip]
+      t=0 0
+      m=audio 2226 RTP/AVP 0 101
+      a=sendrecv
+      a=rtpmap:0 PCMU/8000
+      a=rtpmap:101 telephone-event/8000
+
+    ]]>
+  </send>
+
+  <recv request="ACK" rtd="true" crlf="true">
+  </recv>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: ua1 <sip:ua1@[local_ip]:[local_port]>;tag=[call_number]
+      To: [$remote_tag]
+      [last_Call-ID:]
+      CSeq: [cseq] BYE
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200">
+  </recv>
+
+</scenario>
diff --git a/tests/channels/pjsip/resolver/srv/explicit_transport_configured/test-config.yaml b/tests/channels/pjsip/resolver/srv/explicit_transport_configured/test-config.yaml
new file mode 100644
index 0000000..efdf668
--- /dev/null
+++ b/tests/channels/pjsip/resolver/srv/explicit_transport_configured/test-config.yaml
@@ -0,0 +1,48 @@
+testinfo:
+    summary: 'Test SRV resolution when an explicit IPv6 transport is configured'
+    description: |
+        'This test verifies that when an endpoint is configured with an explicit
+        IPv6 transport that an SRV record lookup occurs and then an AAAA lookup
+        occurs.'
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: originator-ipv6
+            typename: 'pluggable_modules.Originator'
+        -
+            config-section: dns-server-config
+            typename: 'dns_server.DNSServer'
+
+test-object-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'target': '[::1]', 'key-args': {'scenario': 'uas-ipv6.xml',
+                                                    '-i': '[::1]', '-p': '5061'} }
+originator-ipv6:
+    trigger: 'scenario_start'
+    scenario-name: 'uas-ipv6.xml'
+    ignore-originate-failure: 'no'
+    id: '0'
+    channel: 'Local/s-ipv6 at default'
+    application: 'Echo'
+    async: 'True'
+
+dns-server-config:
+    port: 10053
+    python-zones:
+        -
+            example.com
+
+properties:
+    minversion: '14.2.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 2aecba4..6fcc0bc 100644
--- a/tests/channels/pjsip/resolver/srv/tests.yaml
+++ b/tests/channels/pjsip/resolver/srv/tests.yaml
@@ -1,5 +1,6 @@
 # Enter tests here in the order they should be considered for execution:
 tests:
+    - test: 'explicit_transport_configured'
     - test: 'transport_tcp'
     - test: 'transport_udp'
     - test: 'transport_unspecified'

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I95072d4940d99194ded80887e1ee3306c5337073
Gerrit-PatchSet: 2
Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Owner: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Anonymous Coward #1000019
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: Joshua Colp <jcolp at digium.com>
Gerrit-Reviewer: Kevin Harwell <kharwell at digium.com>



More information about the asterisk-code-review mailing list