[Asterisk-code-review] channel/pjsip/identify/header ordering: Test endpoint identi... (testsuite[master])

Richard Mudgett asteriskteam at digium.com
Thu Jan 11 15:25:54 CST 2018


Richard Mudgett has uploaded this change for review. ( https://gerrit.asterisk.org/7937


Change subject: channel/pjsip/identify/header_ordering: Test endpoint identification order.
......................................................................

channel/pjsip/identify/header_ordering: Test endpoint identification order.

The two tests check that the endpoint identification header and ip methods
are triggered in the expected priority order specified by
endpoint_identifier_order.

ASTERISK-27491

Change-Id: I12560bdcc36f7df170de79e11666fe6b812e67f4
---
A tests/channels/pjsip/identify/header_ordering_header_ip/configs/ast1/extensions.conf
A tests/channels/pjsip/identify/header_ordering_header_ip/configs/ast1/pjsip.conf
A tests/channels/pjsip/identify/header_ordering_header_ip/sipp/nominal.xml
A tests/channels/pjsip/identify/header_ordering_header_ip/test-config.yaml
A tests/channels/pjsip/identify/header_ordering_ip_header/configs/ast1/extensions.conf
A tests/channels/pjsip/identify/header_ordering_ip_header/configs/ast1/pjsip.conf
A tests/channels/pjsip/identify/header_ordering_ip_header/sipp/nominal.xml
A tests/channels/pjsip/identify/header_ordering_ip_header/test-config.yaml
M tests/channels/pjsip/identify/tests.yaml
9 files changed, 370 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/37/7937/1

diff --git a/tests/channels/pjsip/identify/header_ordering_header_ip/configs/ast1/extensions.conf b/tests/channels/pjsip/identify/header_ordering_header_ip/configs/ast1/extensions.conf
new file mode 100644
index 0000000..bed05dd
--- /dev/null
+++ b/tests/channels/pjsip/identify/header_ordering_header_ip/configs/ast1/extensions.conf
@@ -0,0 +1,14 @@
+[default]
+
+[header]
+exten = echo,1,NoOp()
+same = n,Answer()
+same = n,UserEvent(Header)
+same = n,Hangup()
+
+[ip]
+exten = echo,1,NoOp()
+same = n,Answer()
+same = n,UserEvent(Ip)
+same = n,Hangup()
+
diff --git a/tests/channels/pjsip/identify/header_ordering_header_ip/configs/ast1/pjsip.conf b/tests/channels/pjsip/identify/header_ordering_header_ip/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..2c4dfae
--- /dev/null
+++ b/tests/channels/pjsip/identify/header_ordering_header_ip/configs/ast1/pjsip.conf
@@ -0,0 +1,39 @@
+[global]
+type=global
+endpoint_identifier_order=header,ip
+debug=yes
+
+[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](!)
+type=endpoint
+allow=!all,ulaw,alaw
+
+[alice-header](endpoint-template)
+identify_by=header
+context=header
+
+[alice-ip](endpoint-template)
+identify_by=ip
+context=ip
+
+[identify-template](!)
+type=identify
+
+[alice-header-identify](identify-template)
+endpoint=alice-header
+match_header=X-ASTERISK-TOKEN: e7657250-07fa-11e7-92f8-1b946c0c7e84
+
+[alice-ip-identify](identify-template)
+endpoint=alice-ip
+match=127.0.0.1
diff --git a/tests/channels/pjsip/identify/header_ordering_header_ip/sipp/nominal.xml b/tests/channels/pjsip/identify/header_ordering_header_ip/sipp/nominal.xml
new file mode 100644
index 0000000..d0eb174
--- /dev/null
+++ b/tests/channels/pjsip/identify/header_ordering_header_ip/sipp/nominal.xml
@@ -0,0 +1,75 @@
+<?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
+			X-ASTERISK-TOKEN: [ident_key]
+			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
+			X-ASTERISK-TOKEN: [ident_key]
+			Content-Length: 0
+		]]>
+	</send>
+
+	<recv request="BYE">
+	</recv>
+
+	<send>
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Content-Length: 0
+		]]>
+	</send>
+
+	<!-- 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/header_ordering_header_ip/test-config.yaml b/tests/channels/pjsip/identify/header_ordering_header_ip/test-config.yaml
new file mode 100644
index 0000000..0c91298
--- /dev/null
+++ b/tests/channels/pjsip/identify/header_ordering_header_ip/test-config.yaml
@@ -0,0 +1,56 @@
+testinfo:
+    summary:     'Tests incoming calls identified by header and source IP'
+    description: |
+        This test covers sending calls to an Asterisk instance
+        identifiable by a custom header and by a source IP address.
+        It is expected that the requests are accepted by the correct
+        endpoint determined by endpoint_identifier_order.
+        This test expects the call to be accepted by the header identifier.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: ami-config
+            typename: 'ami.AMIEventModule'
+
+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'},
+                    'ordered-args': ['-key', 'ident_key', 'e7657250-07fa-11e7-92f8-1b946c0c7e84'] }
+
+ami-config:
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'UserEvent'
+                UserEvent: 'Header'
+        count: '1'
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'UserEvent'
+                UserEvent: 'Ip'
+        count: '0'
+
+properties:
+    minversion: ['13.20.0', '15.3.0']
+    dependencies:
+        - sipp :
+            version : 'v3.0'
+        - asterisk : 'app_userevent'
+        - asterisk : 'res_pjsip'
+        - asterisk : 'res_pjsip_endpoint_identifier_ip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/identify/header_ordering_ip_header/configs/ast1/extensions.conf b/tests/channels/pjsip/identify/header_ordering_ip_header/configs/ast1/extensions.conf
new file mode 100644
index 0000000..bed05dd
--- /dev/null
+++ b/tests/channels/pjsip/identify/header_ordering_ip_header/configs/ast1/extensions.conf
@@ -0,0 +1,14 @@
+[default]
+
+[header]
+exten = echo,1,NoOp()
+same = n,Answer()
+same = n,UserEvent(Header)
+same = n,Hangup()
+
+[ip]
+exten = echo,1,NoOp()
+same = n,Answer()
+same = n,UserEvent(Ip)
+same = n,Hangup()
+
diff --git a/tests/channels/pjsip/identify/header_ordering_ip_header/configs/ast1/pjsip.conf b/tests/channels/pjsip/identify/header_ordering_ip_header/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..3ae78ac
--- /dev/null
+++ b/tests/channels/pjsip/identify/header_ordering_ip_header/configs/ast1/pjsip.conf
@@ -0,0 +1,39 @@
+[global]
+type=global
+endpoint_identifier_order=ip,header
+debug=yes
+
+[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](!)
+type=endpoint
+allow=!all,ulaw,alaw
+
+[alice-header](endpoint-template)
+identify_by=header
+context=header
+
+[alice-ip](endpoint-template)
+identify_by=ip
+context=ip
+
+[identify-template](!)
+type=identify
+
+[alice-header-identify](identify-template)
+endpoint=alice-header
+match_header=X-ASTERISK-TOKEN: e7657250-07fa-11e7-92f8-1b946c0c7e84
+
+[alice-ip-identify](identify-template)
+endpoint=alice-ip
+match=127.0.0.1
diff --git a/tests/channels/pjsip/identify/header_ordering_ip_header/sipp/nominal.xml b/tests/channels/pjsip/identify/header_ordering_ip_header/sipp/nominal.xml
new file mode 100644
index 0000000..d0eb174
--- /dev/null
+++ b/tests/channels/pjsip/identify/header_ordering_ip_header/sipp/nominal.xml
@@ -0,0 +1,75 @@
+<?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
+			X-ASTERISK-TOKEN: [ident_key]
+			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
+			X-ASTERISK-TOKEN: [ident_key]
+			Content-Length: 0
+		]]>
+	</send>
+
+	<recv request="BYE">
+	</recv>
+
+	<send>
+		<![CDATA[
+			SIP/2.0 200 OK
+			[last_Via:]
+			[last_From:]
+			[last_To:]
+			[last_Call-ID:]
+			[last_CSeq:]
+			Content-Length: 0
+		]]>
+	</send>
+
+	<!-- 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/header_ordering_ip_header/test-config.yaml b/tests/channels/pjsip/identify/header_ordering_ip_header/test-config.yaml
new file mode 100644
index 0000000..0dc4167
--- /dev/null
+++ b/tests/channels/pjsip/identify/header_ordering_ip_header/test-config.yaml
@@ -0,0 +1,56 @@
+testinfo:
+    summary:     'Tests incoming calls identified by header and source IP'
+    description: |
+        This test covers sending calls to an Asterisk instance
+        identifiable by a custom header and by a source IP address.
+        It is expected that the requests are accepted by the correct
+        endpoint determined by endpoint_identifier_order.
+        This test expects the call to be accepted by the ip identifier.
+
+test-modules:
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: ami-config
+            typename: 'ami.AMIEventModule'
+
+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'},
+                    'ordered-args': ['-key', 'ident_key', 'e7657250-07fa-11e7-92f8-1b946c0c7e84'] }
+
+ami-config:
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'UserEvent'
+                UserEvent: 'Header'
+        count: '0'
+    -
+        type: 'headermatch'
+        id: '0'
+        conditions:
+            match:
+                Event: 'UserEvent'
+                UserEvent: 'Ip'
+        count: '1'
+
+properties:
+    minversion: ['13.20.0', '15.3.0']
+    dependencies:
+        - sipp :
+            version : 'v3.0'
+        - asterisk : 'app_userevent'
+        - asterisk : 'res_pjsip'
+        - asterisk : 'res_pjsip_endpoint_identifier_ip'
+    tags:
+        - pjsip
diff --git a/tests/channels/pjsip/identify/tests.yaml b/tests/channels/pjsip/identify/tests.yaml
index 43969c1..60215c3 100644
--- a/tests/channels/pjsip/identify/tests.yaml
+++ b/tests/channels/pjsip/identify/tests.yaml
@@ -2,4 +2,6 @@
 tests:
     - test: 'header'
     - test: 'header_or_ip'
+    - test: 'header_ordering_header_ip'
+    - test: 'header_ordering_ip_header'
     - test: 'ordering'

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

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I12560bdcc36f7df170de79e11666fe6b812e67f4
Gerrit-Change-Number: 7937
Gerrit-PatchSet: 1
Gerrit-Owner: Richard Mudgett <rmudgett at digium.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180111/cce22232/attachment-0001.html>


More information about the asterisk-code-review mailing list