[Asterisk-code-review] geolocation: Add round-trip testsuite test (testsuite[20])
George Joseph
asteriskteam at digium.com
Mon Sep 26 11:09:46 CDT 2022
George Joseph has uploaded this change for review. ( https://gerrit.asterisk.org/c/testsuite/+/19356 )
Change subject: geolocation: Add round-trip testsuite test
......................................................................
geolocation: Add round-trip testsuite test
Change-Id: Ieb15c1eef4d94b0e3f7d0622e6d4559c8897a4c6
---
A tests/channels/pjsip/geolocation/round-trip/gml/configs/ast1/extensions.conf
A tests/channels/pjsip/geolocation/round-trip/gml/configs/ast1/geolocation.conf
A tests/channels/pjsip/geolocation/round-trip/gml/configs/ast1/pjsip.conf
A tests/channels/pjsip/geolocation/round-trip/gml/configs/ast2/extensions.conf
A tests/channels/pjsip/geolocation/round-trip/gml/configs/ast2/geolocation.conf
A tests/channels/pjsip/geolocation/round-trip/gml/configs/ast2/pjsip.conf
A tests/channels/pjsip/geolocation/round-trip/gml/sipp/invite_gml.xml
A tests/channels/pjsip/geolocation/round-trip/gml/test-config.yaml
A tests/channels/pjsip/geolocation/round-trip/tests.yaml
M tests/channels/pjsip/geolocation/tests.yaml
10 files changed, 334 insertions(+), 0 deletions(-)
git pull ssh://gerrit.asterisk.org:29418/testsuite refs/changes/56/19356/1
diff --git a/tests/channels/pjsip/geolocation/round-trip/gml/configs/ast1/extensions.conf b/tests/channels/pjsip/geolocation/round-trip/gml/configs/ast1/extensions.conf
new file mode 100644
index 0000000..196b02c
--- /dev/null
+++ b/tests/channels/pjsip/geolocation/round-trip/gml/configs/ast1/extensions.conf
@@ -0,0 +1,15 @@
+
+[predial]
+exten = s,1,NoOp(Predial)
+same = n,Set(GEOLOC_PROFILE(location_info_refinement,a)=verticalAxis=99.99)
+same = Return()
+
+[postdial]
+exten = s,1,NoOp(Postdial)
+same = n,Set(GEOLOC_PROFILE(location_info_refinement,a)=orientation=180)
+same = Return()
+
+[default]
+exten = bob,1,NoOp(Incoming call)
+same = n,Dial(PJSIP/bob at ast2,10,B(predial^s^1)b(postdial^s^1))
+same = n,Hangup()
\ No newline at end of file
diff --git a/tests/channels/pjsip/geolocation/round-trip/gml/configs/ast1/geolocation.conf b/tests/channels/pjsip/geolocation/round-trip/gml/configs/ast1/geolocation.conf
new file mode 100644
index 0000000..941c174
--- /dev/null
+++ b/tests/channels/pjsip/geolocation/round-trip/gml/configs/ast1/geolocation.conf
@@ -0,0 +1,5 @@
+[alice]
+type = profile
+profile_precedence = discard_config
+
+; ast2 uses the built-in <discard_config> profile
diff --git a/tests/channels/pjsip/geolocation/round-trip/gml/configs/ast1/pjsip.conf b/tests/channels/pjsip/geolocation/round-trip/gml/configs/ast1/pjsip.conf
new file mode 100644
index 0000000..49bcf16
--- /dev/null
+++ b/tests/channels/pjsip/geolocation/round-trip/gml/configs/ast1/pjsip.conf
@@ -0,0 +1,56 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[ipv4-tcp]
+type=transport
+protocol=tcp
+bind=127.0.0.1:5060
+symmetric_transport = yes
+
+[alice]
+type = aor
+max_contacts = 1
+contact = sip:127.0.0.3:5060
+
+[alice]
+type = endpoint
+aors = alice
+identify_by = ip,auth_username,username
+context = default
+transport = ipv4-tcp
+callerid = "Alice" <alice>
+geoloc_incoming_call_profile = alice
+ice_support = false
+allow = (ulaw)
+direct_media = false
+
+[alice-identify]
+type = identify
+match = 127.0.0.3:5060/255.255.255.255
+srv_lookups = false
+endpoint = alice
+
+[ast2]
+type = aor
+max_contacts = 1
+contact = sip:127.0.0.2:5060
+
+[ast2]
+type = endpoint
+aors = ast2
+identify_by = ip,auth_username,username
+context = default
+transport = ipv4-tcp
+geoloc_outgoing_call_profile = <discard_config>
+ice_support = false
+allow = (ulaw)
+direct_media = false
+
+[ast2-identify]
+type = identify
+match = 127.0.0.2:5060/255.255.255.255
+srv_lookups = false
+endpoint = ast2
+
diff --git a/tests/channels/pjsip/geolocation/round-trip/gml/configs/ast2/extensions.conf b/tests/channels/pjsip/geolocation/round-trip/gml/configs/ast2/extensions.conf
new file mode 100644
index 0000000..03a2d17
--- /dev/null
+++ b/tests/channels/pjsip/geolocation/round-trip/gml/configs/ast2/extensions.conf
@@ -0,0 +1,6 @@
+[default]
+exten = bob,1,NoOp(Incoming call)
+same = n,Answer()
+same = n,UserEvent(GeolocInfo,LocInfo: "${GEOLOC_PROFILE(effective_location)}")
+same = n,Wait(2)
+same = n,Hangup()
\ No newline at end of file
diff --git a/tests/channels/pjsip/geolocation/round-trip/gml/configs/ast2/geolocation.conf b/tests/channels/pjsip/geolocation/round-trip/gml/configs/ast2/geolocation.conf
new file mode 100644
index 0000000..41d1380
--- /dev/null
+++ b/tests/channels/pjsip/geolocation/round-trip/gml/configs/ast2/geolocation.conf
@@ -0,0 +1,11 @@
+; Since "prefer_incoming is set, these shouldn't actually be used.
+
+[ast1-loc]
+type = location
+format = URI
+location_info = URI=http://something.com
+
+[ast1]
+type = profile
+profile_precedence = prefer_incoming
+location_reference = ast1-loc
diff --git a/tests/channels/pjsip/geolocation/round-trip/gml/configs/ast2/pjsip.conf b/tests/channels/pjsip/geolocation/round-trip/gml/configs/ast2/pjsip.conf
new file mode 100644
index 0000000..df62e99
--- /dev/null
+++ b/tests/channels/pjsip/geolocation/round-trip/gml/configs/ast2/pjsip.conf
@@ -0,0 +1,33 @@
+[system]
+type=system
+timer_t1=100
+timer_b=6400
+
+[ipv4-tcp]
+type=transport
+protocol=tcp
+bind=127.0.0.2:5060
+symmetric_transport = yes
+
+[ast1]
+type = aor
+max_contacts = 1
+contact = sip:127.0.0.1:5060
+
+[ast1]
+type = endpoint
+aors = ast1
+identify_by = ip,auth_username,username
+context = default
+transport = ipv4-tcp
+geoloc_incoming_call_profile = ast1
+ice_support = false
+allow = (ulaw)
+direct_media = false
+
+[ast4-identify]
+type = identify
+match = 127.0.0.1/255.255.255.255
+srv_lookups = false
+endpoint = ast1
+
diff --git a/tests/channels/pjsip/geolocation/round-trip/gml/sipp/invite_gml.xml b/tests/channels/pjsip/geolocation/round-trip/gml/sipp/invite_gml.xml
new file mode 100644
index 0000000..1d4eff5
--- /dev/null
+++ b/tests/channels/pjsip/geolocation/round-trip/gml/sipp/invite_gml.xml
@@ -0,0 +1,129 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd" [
+<!ENTITY geopriv SYSTEM "geopriv.xml">
+]>
+<scenario name="INVITE with Civic Address PIDF-LO">
+
+ <send retrans="500">
+ <![CDATA[
+
+ INVITE sip:[dest]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+ To: <sip:[dest]@[remote_ip]:[remote_port]>
+ Call-ID: [call_id]
+ CSeq: 1 INVITE
+ Max-Forwards: 70
+ Contact: <sip:[service]@[local_ip]:[local_port]>
+ Subject: Test
+ Geolocation: <cid:target123 at atlanta.example.com>
+ Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, PRACK, REGISTER, REFER, MESSAGE
+ User-Agent: Test
+ Content-Type: multipart/mixed;boundary=boundary
+ Content-Length: [len]
+
+ --boundary
+ Content-Type: application/pidf+xml
+ Content-ID: <target123 at atlanta.example.com>
+
+ <?xml version="1.0" encoding="UTF-8"?>
+ <presence xmlns="urn:ietf:params:xml:ns:pidf"
+ xmlns:gp="urn:ietf:params:xml:ns:pidf:geopriv10"
+ xmlns:gbp="urn:ietf:params:xml:ns:pidf:geopriv10:basicPolicy"
+ xmlns:cl="urn:ietf:params:xml:ns:pidf:geopriv10:civicAddr"
+ xmlns:gml="http://www.opengis.net/gml"
+ xmlns:gs="http://www.opengis.net/pidflo/1.0"
+ xmlns:dm="urn:ietf:params:xml:ns:pidf:data-model"
+ entity="pres:alice at atlanta.example.com">
+ <dm:device id="target123-1">
+ <gp:geopriv>
+ <gp:location-info>
+ <gs:Ellipsoid srsName="urn:ogc:def:crs:EPSG::4979">
+ <gs:orientation uom="urn:ogc:def:uom:EPSG::9102">90</gs:orientation>
+ <gml:pos>42.5463 -73.2512 26.3</gml:pos>
+ <gs:semiMajorAxis uom="urn:ogc:def:uom:EPSG::9001">7.7156</gs:semiMajorAxis>
+ <gs:semiMinorAxis uom="urn:ogc:def:uom:EPSG::9001">3.31</gs:semiMinorAxis>
+ <gs:verticalAxis uom="urn:ogc:def:uom:EPSG::9001">28.7</gs:verticalAxis>
+ </gs:Ellipsoid>
+ </gp:location-info>
+ <gp:usage-rules>
+ <gbp:retransmission-allowed>no
+ </gbp:retransmission-allowed>
+ <gbp:retention-expiry>2010-11-14T20:00:00Z
+ </gbp:retention-expiry>
+ </gp:usage-rules>
+ <gp:method>802.11</gp:method>
+ </gp:geopriv>
+ <dm:deviceID>mac:1234567890ab</dm:deviceID>
+ <dm:timestamp>2010-11-04T20:57:29Z</dm:timestamp>
+ </dm:device>
+ </presence>
+ --boundary
+ Content-Type: application/sdp
+
+ v=0
+ o=- 20110306451 20110306451 IN IP[media_ip_type] [media_ip]
+ s=-
+ c=IN IP[media_ip_type] [media_ip]
+ t=0 0
+ m=audio [media_port] RTP/AVP 0
+ a=rtpmap:0 PCMU/8000
+ a=ptime:20
+ a=sendrecv
+
+ --boundary--
+ ]]>
+
+ </send>
+
+ <recv response="100" optional="true">
+ </recv>
+
+ <recv response="180" optional="true">
+ </recv>
+
+ <recv response="183" optional="true">
+ </recv>
+
+ <recv response="200" rtd="true"/>
+
+
+ <send>
+ <![CDATA[
+
+ ACK sip:[dest]@[remote_ip]:[remote_port] SIP/2.0
+ [last_Via:]
+ [last_From:]
+ [last_To:]
+ [last_Call-ID:]
+ CSeq: 1 ACK
+ [last_Contact:]
+ [last_Allow:]
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+
+ <pause milliseconds="1000"/>
+
+ <send>
+ <![CDATA[
+
+ BYE sip:[dest]@[remote_ip]:[remote_port] SIP/2.0
+ Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+ From: sipp <sip:[service]@[local_ip]:[local_port]>;tag=[call_number]
+ To: sut <sip:[dest]@[remote_ip]:[remote_port]>[peer_tag_param]
+ Call-ID: [call_id]
+ CSeq: 2 BYE
+ Contact: alice <sip:[service]@[local_ip]:[local_port]>
+ Max-Forwards: 70
+ Subject: Performance Test
+ Content-Length: 0
+
+ ]]>
+ </send>
+
+ <recv response="200" rtd="true"/>
+
+</scenario>
diff --git a/tests/channels/pjsip/geolocation/round-trip/gml/test-config.yaml b/tests/channels/pjsip/geolocation/round-trip/gml/test-config.yaml
new file mode 100644
index 0000000..35d4334
--- /dev/null
+++ b/tests/channels/pjsip/geolocation/round-trip/gml/test-config.yaml
@@ -0,0 +1,66 @@
+testinfo:
+ summary: 'Test Geolocation GML Round-Trip.'
+
+ description: |
+ 'Test GML parsing and the GEOLOC_PROFILE dialplan function
+ using sipp to create the incoming document and send it to the first
+ asterisk instance. The dialplan function alters the verticalAxis
+ and orientation and calls "bob" on the second asterisk instance.
+ The second instance dialplan sends a UserEvent with the parsed
+ effective location which is checked below.
+ '
+
+properties:
+ dependencies:
+ - app : 'sipp'
+ - asterisk : 'app_userevent'
+ - asterisk : 'res_geolocation'
+ - asterisk : 'res_pjsip'
+ - asterisk : 'res_pjsip_geolocation'
+ tags:
+ - pjsip
+
+test-modules:
+ test-object:
+ config-section: test-object-config
+ typename: sipp.SIPpTestCase
+ modules:
+ -
+ config-section: ami-config
+ typename: 'pluggable_modules.EventActionModule'
+
+test-object-config:
+ reactor-timeout: 15
+ asterisk-instances: 2
+ memcheck-delay-stop: 7
+ stop-after-scenarios: false
+ fail-on-any: false
+ test-iterations:
+ -
+ scenarios:
+ - { 'key-args': { 'scenario':'invite_gml.xml', '-i':'127.0.0.3', '-p':'5060', '-t': 't1', '-s':'alice' },
+ 'ordered-args': [ '-bind_local', '-key', 'dest', 'bob']}
+
+ami-config:
+ -
+ ami-events:
+ id: '1'
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'UserEvent'
+ UserEvent: 'GeolocInfo'
+# In the original request, the verticalAxis was 28.7.
+# The GEOLOC_PROFILE dialplan app should have changed
+# it to 99.99.
+ LocInfo: "shape=Ellipsoid,crs=3d,orientation=180 degrees,pos=42.5463 -73.2512 26.3,semiMajorAxis=7.7156,semiMinorAxis=3.31,verticalAxis=99.99"
+ count: '1'
+ -
+ ami-events:
+ id: '0'
+ type: 'headermatch'
+ conditions:
+ match:
+ Event: 'Hangup'
+ count: '2'
+ stop_test:
diff --git a/tests/channels/pjsip/geolocation/round-trip/tests.yaml b/tests/channels/pjsip/geolocation/round-trip/tests.yaml
new file mode 100644
index 0000000..f40f972
--- /dev/null
+++ b/tests/channels/pjsip/geolocation/round-trip/tests.yaml
@@ -0,0 +1,3 @@
+# Enter tests here in the order they should be considered for execution:
+tests:
+ - test: 'gml'
diff --git a/tests/channels/pjsip/geolocation/tests.yaml b/tests/channels/pjsip/geolocation/tests.yaml
index 40038e5..fc79860 100644
--- a/tests/channels/pjsip/geolocation/tests.yaml
+++ b/tests/channels/pjsip/geolocation/tests.yaml
@@ -1,3 +1,4 @@
# Enter tests here in the order they should be considered for execution:
tests:
- dir: 'incoming'
+ - dir: 'round-trip'
--
To view, visit https://gerrit.asterisk.org/c/testsuite/+/19356
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings
Gerrit-Project: testsuite
Gerrit-Branch: 20
Gerrit-Change-Id: Ieb15c1eef4d94b0e3f7d0622e6d4559c8897a4c6
Gerrit-Change-Number: 19356
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-MessageType: newchange
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20220926/54a89320/attachment-0001.html>
More information about the asterisk-code-review
mailing list