[asterisk-commits] res_pjsip_endpoint_identifier_ip: Add port matching tests (testsuite[17])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Jan 9 17:37:38 CST 2020


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

Change subject: res_pjsip_endpoint_identifier_ip: Add port matching tests
......................................................................

res_pjsip_endpoint_identifier_ip: Add port matching tests

ASTERISK~28639

Change-Id: I1552621070ba288844af8449796ffc7b02389f5a
---
A tests/channels/pjsip/identify/port_matching/port/configs/ast1/extensions.conf
A tests/channels/pjsip/identify/port_matching/port/configs/ast1/pjsip.conf
A tests/channels/pjsip/identify/port_matching/port/sipp/nominal.xml
A tests/channels/pjsip/identify/port_matching/port/sipp/off_nominal.xml
A tests/channels/pjsip/identify/port_matching/port/test-config.yaml
A tests/channels/pjsip/identify/port_matching/port_with_mask/configs/ast1/extensions.conf
A tests/channels/pjsip/identify/port_matching/port_with_mask/configs/ast1/pjsip.conf
A tests/channels/pjsip/identify/port_matching/port_with_mask/sipp/nominal.xml
A tests/channels/pjsip/identify/port_matching/port_with_mask/sipp/off_nominal.xml
A tests/channels/pjsip/identify/port_matching/port_with_mask/test-config.yaml
A tests/channels/pjsip/identify/port_matching/tests.yaml
M tests/channels/pjsip/identify/tests.yaml
12 files changed, 388 insertions(+), 0 deletions(-)

Approvals:
  Joshua Colp: Looks good to me, but someone else must approve
  Benjamin Keith Ford: Looks good to me, but someone else must approve
  Kevin Harwell: Looks good to me, approved
  Friendly Automation: Approved for Submit



diff --git a/tests/channels/pjsip/identify/port_matching/port/configs/ast1/extensions.conf b/tests/channels/pjsip/identify/port_matching/port/configs/ast1/extensions.conf
new file mode 100644
index 0000000..df819c9
--- /dev/null
+++ b/tests/channels/pjsip/identify/port_matching/port/configs/ast1/extensions.conf
@@ -0,0 +1,6 @@
+[default]
+
+exten => echo,1,NoOp()
+ same =>      n,Answer()
+ same =>      n,Echo()
+ same =>      n,Hangup()
diff --git a/tests/channels/pjsip/identify/port_matching/port/configs/ast1/pjsip.conf b/tests/channels/pjsip/identify/port_matching/port/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..fc1406f
--- /dev/null
+++ b/tests/channels/pjsip/identify/port_matching/port/configs/ast1/pjsip.conf
@@ -0,0 +1,26 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[local-transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[local-transport-udp](local-transport-template)
+protocol=udp
+
+[endpoint-template-ipv4](!)
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+media_address=127.0.0.1
+
+[alice](endpoint-template-ipv4)
+
+[identify-template](!)
+type=identify
+
+[alice-identify](identify-template)
+endpoint=alice
+match=127.0.0.1:5061
diff --git a/tests/channels/pjsip/identify/port_matching/port/sipp/nominal.xml b/tests/channels/pjsip/identify/port_matching/port/sipp/nominal.xml
new file mode 100644
index 0000000..1790d39
--- /dev/null
+++ b/tests/channels/pjsip/identify/port_matching/port/sipp/nominal.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to echo with SDP in initial INVITE">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <pause/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 BYE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+
diff --git a/tests/channels/pjsip/identify/port_matching/port/sipp/off_nominal.xml b/tests/channels/pjsip/identify/port_matching/port/sipp/off_nominal.xml
new file mode 100644
index 0000000..6cd401f
--- /dev/null
+++ b/tests/channels/pjsip/identify/port_matching/port/sipp/off_nominal.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to echo with SDP in initial INVITE">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="401">
+  </recv>
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+
diff --git a/tests/channels/pjsip/identify/port_matching/port/test-config.yaml b/tests/channels/pjsip/identify/port_matching/port/test-config.yaml
new file mode 100644
index 0000000..c23cb47
--- /dev/null
+++ b/tests/channels/pjsip/identify/port_matching/port/test-config.yaml
@@ -0,0 +1,31 @@
+testinfo:
+    summary:     'Tests incoming calls identified by source IP and source port'
+    description: |
+        This test covers sending calls to an Asterisk instance
+        identified by a source IP address and source port.
+        It is expected that both scenarios pass, with the first
+        accepting the INVITE and the second rejecting with a 401.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    memcheck-delay-stop: 7
+    fail-on-any: True
+    test-iterations:
+        # IPv4 & UDP
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'nominal.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 's'} }
+                - { 'key-args': {'scenario': 'off_nominal.xml', '-i': '127.0.0.1', '-p': '5062', '-s': 's'} }
+
+properties:
+    dependencies:
+        - sipp :
+            version : 'v3.0'
+        - asterisk : 'app_echo'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/identify/port_matching/port_with_mask/configs/ast1/extensions.conf b/tests/channels/pjsip/identify/port_matching/port_with_mask/configs/ast1/extensions.conf
new file mode 100644
index 0000000..df819c9
--- /dev/null
+++ b/tests/channels/pjsip/identify/port_matching/port_with_mask/configs/ast1/extensions.conf
@@ -0,0 +1,6 @@
+[default]
+
+exten => echo,1,NoOp()
+ same =>      n,Answer()
+ same =>      n,Echo()
+ same =>      n,Hangup()
diff --git a/tests/channels/pjsip/identify/port_matching/port_with_mask/configs/ast1/pjsip.conf b/tests/channels/pjsip/identify/port_matching/port_with_mask/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..2b85dad
--- /dev/null
+++ b/tests/channels/pjsip/identify/port_matching/port_with_mask/configs/ast1/pjsip.conf
@@ -0,0 +1,26 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[local-transport-template](!)
+type=transport
+bind=127.0.0.1
+
+[local-transport-udp](local-transport-template)
+protocol=udp
+
+[endpoint-template-ipv4](!)
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+media_address=127.0.0.1
+
+[alice](endpoint-template-ipv4)
+
+[identify-template](!)
+type=identify
+
+[alice-identify](identify-template)
+endpoint=alice
+match=127.0.0.0:5061/8
diff --git a/tests/channels/pjsip/identify/port_matching/port_with_mask/sipp/nominal.xml b/tests/channels/pjsip/identify/port_matching/port_with_mask/sipp/nominal.xml
new file mode 100644
index 0000000..1790d39
--- /dev/null
+++ b/tests/channels/pjsip/identify/port_matching/port_with_mask/sipp/nominal.xml
@@ -0,0 +1,85 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to echo with SDP in initial INVITE">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      ACK sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 1 ACK
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <pause/>
+
+  <send retrans="500">
+    <![CDATA[
+
+      BYE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: 2 BYE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="200" crlf="true">
+  </recv>
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+
diff --git a/tests/channels/pjsip/identify/port_matching/port_with_mask/sipp/off_nominal.xml b/tests/channels/pjsip/identify/port_matching/port_with_mask/sipp/off_nominal.xml
new file mode 100644
index 0000000..6cd401f
--- /dev/null
+++ b/tests/channels/pjsip/identify/port_matching/port_with_mask/sipp/off_nominal.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to echo with SDP in initial INVITE">
+  <send retrans="500">
+    <![CDATA[
+
+      INVITE sip:echo@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: test1 <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+      To: test <sip:test@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 INVITE
+      Contact: <sip:test@[local_ip]:[local_port];transport=[transport]>
+      Max-Forwards: 70
+      Subject: Test
+      User-Agent: Test
+      Content-Type: application/sdp
+      Content-Length: [len]
+
+      v=0
+      o=phoneA 53655765 2353687637 IN IP[local_ip_type] [local_ip]
+      s=-
+      c=IN IP[media_ip_type] [media_ip]
+      t=0 0
+      m=audio 6000 RTP/AVP 0
+      a=rtpmap:0 PCMU/8000
+
+    ]]>
+  </send>
+
+  <recv response="401">
+  </recv>
+
+  <!-- definition of the response time repartition table (unit is ms)   -->
+  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
+
+  <!-- definition of the call length repartition table (unit is ms)     -->
+  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
+
+</scenario>
+
diff --git a/tests/channels/pjsip/identify/port_matching/port_with_mask/test-config.yaml b/tests/channels/pjsip/identify/port_matching/port_with_mask/test-config.yaml
new file mode 100644
index 0000000..ce57efa
--- /dev/null
+++ b/tests/channels/pjsip/identify/port_matching/port_with_mask/test-config.yaml
@@ -0,0 +1,34 @@
+testinfo:
+    summary:     'Tests incoming calls identified by source network and port'
+    description: |
+        This test covers sending calls to an Asterisk instance
+        identified by a source network and source port.
+        It is expected that all scenarios pass, with the first
+        two accepting the INVITE and the second two rejecting
+        with a 401.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+
+test-object-config:
+    memcheck-delay-stop: 7
+    fail-on-any: True
+    test-iterations:
+        # IPv4 & UDP
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'nominal.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 's'} }
+                - { 'key-args': {'scenario': 'nominal.xml', '-i': '127.0.0.2', '-p': '5061', '-s': 's'} }
+                - { 'key-args': {'scenario': 'off_nominal.xml', '-i': '127.0.0.1', '-p': '5062', '-s': 's'} }
+                - { 'key-args': {'scenario': 'off_nominal.xml', '-i': '127.0.0.2', '-p': '5062', '-s': 's'} }
+
+properties:
+    dependencies:
+        - sipp :
+            version : 'v3.0'
+        - asterisk : 'app_echo'
+        - asterisk : 'res_pjsip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/identify/port_matching/tests.yaml b/tests/channels/pjsip/identify/port_matching/tests.yaml
new file mode 100644
index 0000000..62ede86
--- /dev/null
+++ b/tests/channels/pjsip/identify/port_matching/tests.yaml
@@ -0,0 +1,4 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+    - test: 'port'
+    - test: 'port_with_mask'
diff --git a/tests/channels/pjsip/identify/tests.yaml b/tests/channels/pjsip/identify/tests.yaml
index 60215c3..c896582 100644
--- a/tests/channels/pjsip/identify/tests.yaml
+++ b/tests/channels/pjsip/identify/tests.yaml
@@ -5,3 +5,4 @@
     - test: 'header_ordering_header_ip'
     - test: 'header_ordering_ip_header'
     - test: 'ordering'
+    - dir: 'port_matching'

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

Gerrit-Project: testsuite
Gerrit-Branch: 17
Gerrit-Change-Id: I1552621070ba288844af8449796ffc7b02389f5a
Gerrit-Change-Number: 13569
Gerrit-PatchSet: 1
Gerrit-Owner: Sean Bright <sean.bright at gmail.com>
Gerrit-Reviewer: Benjamin Keith Ford <bford at digium.com>
Gerrit-Reviewer: Friendly Automation
Gerrit-Reviewer: Joshua Colp <jcolp at sangoma.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-commits/attachments/20200109/8b060524/attachment-0001.html>


More information about the asterisk-commits mailing list