[asterisk-commits] jrose: testsuite/asterisk/trunk r5521 - in /asterisk/trunk: lib/python/asteri...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Wed Aug 27 10:49:30 CDT 2014


Author: jrose
Date: Wed Aug 27 10:49:25 2014
New Revision: 5521

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5521
Log:
Testsuite: Add RLS tests for presence lists

ASTERISK-23870 (solves half the requirements)
Reported by: Mark Michelson
Review: https://reviewboard.asterisk.org/r/3873/

Added:
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/configs/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/sipp/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/sipp/list_subscribe.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/configs/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/sipp/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/sipp/list_subscribe.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/configs/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/sipp/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/sipp/list_subscribe.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/resubscribe_full_state/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/resubscribe_full_state/configs/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/resubscribe_full_state/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/resubscribe_full_state/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/resubscribe_full_state/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/resubscribe_full_state/sipp/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/resubscribe_full_state/sipp/resubscribe.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/resubscribe_full_state/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/subscription_establishment/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/subscription_establishment/configs/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/subscription_establishment/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/subscription_establishment/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/subscription_establishment/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/subscription_establishment/sipp/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/subscription_establishment/sipp/list_subscribe.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/subscription_establishment/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/termination_full_state/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/termination_full_state/configs/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/termination_full_state/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/termination_full_state/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/termination_full_state/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/termination_full_state/sipp/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/termination_full_state/sipp/termination.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/termination_full_state/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/tests.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/tests.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/tests.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/rls_integrity.py   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/rls_test.py   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/tests.yaml   (with props)
Modified:
    asterisk/trunk/lib/python/asterisk/pcap.py
    asterisk/trunk/tests/channels/pjsip/subscriptions/tests.yaml

Modified: asterisk/trunk/lib/python/asterisk/pcap.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/pcap.py?view=diff&rev=5521&r1=5520&r2=5521
==============================================================================
--- asterisk/trunk/lib/python/asterisk/pcap.py (original)
+++ asterisk/trunk/lib/python/asterisk/pcap.py Wed Aug 27 10:49:25 2014
@@ -25,6 +25,8 @@
 except:
     PCAP_AVAILABLE = False
 
+import rlmi
+
 LOGGER = logging.getLogger(__name__)
 
 class PcapListener(object):
@@ -57,7 +59,7 @@
         # Let exceptions propagate - if we can't create the pcap, this should
         # throw the exception to the pluggable module creation routines
         test_object.create_pcap_listener(
-            device=None,
+            device=device,
             bpf_filter=bpf_filter,
             dumpfile=filename)
 
@@ -201,6 +203,105 @@
             self.rtcp_port = self.rtp_port + 1
 
 
+class PIDFPacket(Packet):
+    '''A PIDF presence body. Owned by SIPPacket or a MultipartPacket.'''
+
+    def __init__(self, ascii_packet, raw_packet, content_id):
+        Packet.__init__(self, packet_type="PIDF", raw_packet=raw_packet)
+        self.xml = ascii_packet.strip()
+        self.content_id = content_id
+
+class MWIPacket(Packet):
+    '''An MWI body. Owned by SIPPacket or a MultipartPacket.'''
+
+    def __init__(self, ascii_packet, raw_packet, content_id):
+        headers = {}
+
+        Packet.__init__(self, packet_type="MWI", raw_packet=raw_packet)
+        self.content_id = content_id
+        headers_string = ascii_packet.split('\r\n')
+        for header in headers_string:
+            colon_pos = header.find(':')
+            headers[header[:colon_pos]] = header[colon_pos + 1:].strip()
+
+        self.voice_message = headers.get('Voice-Message')
+        self.messages_waiting = headers.get('Messages-Waiting')
+
+
+class RLMIPacket(Packet):
+    '''An RLMI body. Owned either by a SIPPacket or a MultipartPacket.'''
+
+    def __init__(self, ascii_packet, raw_packet):
+        Packet.__init__(self, packet_type="RLMI", raw_packet=raw_packet)
+        self.list_elem = rlmi.CreateFromDocument(ascii_packet.strip())
+
+
+class MultipartPart:
+    def __init__(self, part, raw_packet):
+        self.headers = {}
+
+        last_pos = part.find('\r\n\r\n')
+        headers = part[:last_pos].split('\r\n')
+        body = part[last_pos:]
+
+        for header in headers:
+            colon_pos = header.find(':')
+            self.headers[header[:colon_pos]] = header[colon_pos + 1:].strip()
+
+        content_type = self.headers.get('Content-Type')
+        self.content_id = self.headers.get('Content-ID').strip('<>')
+
+        self.body = BodyFactory.create_body(content_type, body.strip(),
+                                            raw_packet, self.content_id)
+
+
+class MultipartPacket(Packet):
+    '''A multipart body. Owned either by a SIPPacket or a Multipartpacket.'''
+
+    def __init__(self, content_type, ascii_packet, raw_packet):
+        Packet.__init__(self, packet_type="Multipart", raw_packet=raw_packet)
+        self.boundary = None
+        self.parts = []
+
+        for part in content_type.split(';'):
+            param, equal, value = part.partition('=')
+            if param == 'boundary':
+                self.boundary = '--%s' % value.strip('"')
+
+        if not self.boundary:
+            raise Exception
+
+        parts = ascii_packet.split(self.boundary)
+
+        # Start with the second part since the initial boundary has no content
+        # before it.
+        for part in parts[1:]:
+            stripped = part.strip('\r\n ')
+            # The final boundary in a multipart body is --boundary--
+            if stripped == '--':
+                break
+            self.parts.append(MultipartPart(stripped, raw_packet))
+
+
+class BodyFactory(object):
+    @staticmethod
+    def create_body(content_type, ascii_packet, raw_packet, content_id=None):
+        body_type, _, _ = content_type.partition(';')
+        if (body_type == 'application/sdp'):
+            return SDPPacket(ascii_packet, raw_packet)
+        elif (body_type == 'multipart/related'):
+            return MultipartPacket(content_type, ascii_packet, raw_packet)
+        elif (body_type == 'application/rlmi+xml'):
+            return RLMIPacket(ascii_packet, raw_packet)
+        elif (body_type == 'application/pidf+xml'):
+            return PIDFPacket(ascii_packet, raw_packet, content_id)
+        elif (body_type == 'application/simple-message-summary'):
+            return MWIPacket(ascii_packet, raw_packet, content_id)
+        else:
+            return Packet(body_type, raw_packet)
+    pass
+
+
 class SIPPacket(Packet):
     ''' A SIP packet '''
 
@@ -213,7 +314,7 @@
         '''
         Packet.__init__(self, packet_type='SIP', raw_packet=raw_packet)
 
-        self.sdp_packet = None
+        self.body = None
         self.headers = {}
         self.request_line = ''
         self.ascii_packet = ascii_packet
@@ -232,8 +333,11 @@
             colon_pos = header.find(':')
             self.headers[header[:colon_pos]] = header[colon_pos + 1:].strip()
         if int(self.headers.get('Content-Length')) > 0:
-            self.sdp_packet = SDPPacket(ascii_packet=remainder_packet,
-                                        raw_packet=raw_packet)
+            content_type = self.headers.get('Content-Type',
+                                            'application/sdp').strip()
+            self.body = BodyFactory.create_body(content_type,
+                                                ascii_packet=remainder_packet,
+                                                raw_packet=raw_packet)
 
 
 class SIPPacketFactory():
@@ -270,9 +374,10 @@
         # RTP port and RTCP port; then set that information for this particular
         # stream in the factory manager so that the factories for RTP can
         # interpret packets correctly
-        if ret_packet != None and ret_packet.sdp_packet != None and \
-            ret_packet.sdp_packet.rtp_port != 0 and \
-            ret_packet.sdp_packet.rtcp_port != 0:
+        if ret_packet and ret_packet.body and \
+                ret_packet.body.packet_type == 'SDP' and \
+                ret_packet.sdp_packet.rtp_port != 0 and \
+                ret_packet.sdp_packet.rtcp_port != 0:
             self._factory_manager.add_global_data(ret_packet.ip_layer.header.source,
                                                   {'rtp': ret_packet.sdp_packet.rtp_port,
                                                    'rtcp': ret_packet.sdp_packet.rtcp_port})
@@ -451,3 +556,6 @@
         if packet_type not in self._callbacks:
             self._callbacks[packet_type] = []
         self._callbacks[packet_type].append(callback)
+
+    def remove_callbacks(self, packet_type):
+        del self._callbacks[packet_type]

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/configs/ast1/extensions.conf?view=auto&rev=5521
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/configs/ast1/extensions.conf Wed Aug 27 10:49:25 2014
@@ -1,0 +1,3 @@
+[default]
+exten => alice,hint,Custom:alice
+exten => bob,hint,Custom:bob

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/configs/ast1/pjsip.conf?view=auto&rev=5521
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/configs/ast1/pjsip.conf Wed Aug 27 10:49:25 2014
@@ -1,0 +1,22 @@
+[pres_list]
+type = resource_list
+event = presence
+list_item = alice
+list_item = bob
+full_state = yes
+
+[sipp]
+type=aor
+max_contacts=1
+contact=sip:sipp at 127.0.0.1:5061
+
+[sipp]
+type = endpoint
+context = default
+aors=sipp
+transport=local
+
+[local]
+type=transport
+protocol=udp
+bind=0.0.0.0:5060

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/sipp/list_subscribe.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/sipp/list_subscribe.xml?view=auto&rev=5521
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/sipp/list_subscribe.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/sipp/list_subscribe.xml Wed Aug 27 10:49:25 2014
@@ -1,0 +1,84 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic Sipstone UAC">
+  <send retrans="500">
+    <![CDATA[
+
+      SUBSCRIBE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 SUBSCRIBE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Event: presence
+      Supported: eventlist
+      Accept: application/rlmi+xml
+      Accept: application/pidf+xml
+      Accept: multipart/related
+      Expires: 3600
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+      <action>
+          <ereg regexp="eventlist" search_in="hdr" header="Require:" check_it="true" assign_to="1" />
+      </action>
+  </recv>
+
+  <recv request="NOTIFY" crlf="true">
+      <action>
+          <ereg regexp="eventlist" search_in="hdr" header="Require:" check_it="true" assign_to="1" />
+      </action>
+  </recv>
+
+  <Reference variables="1" />
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv request="NOTIFY" crlf="true">
+      <action>
+          <ereg regexp="eventlist" search_in="hdr" header="Require:" check_it="true" assign_to="1" />
+      </action>
+  </recv>
+
+  <Reference variables="1" />
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+</scenario>

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/sipp/list_subscribe.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/sipp/list_subscribe.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/sipp/list_subscribe.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/test-config.yaml?view=auto&rev=5521
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/test-config.yaml Wed Aug 27 10:49:25 2014
@@ -1,0 +1,59 @@
+testinfo:
+    summary: 'Test to ensure that the full_state=yes option is honored in pjsip.conf'
+    description: |
+        'This test uses SIPp to establish a subscription to a resource list.
+        The resource list is a presence list that contains two elements,
+        alice at default and bob at default. Once established, the test sends a state
+        change for the alice at default resource. A PCAP listener is used to
+        ensure that the NOTIFY bodies sent by Asterisk are valid. Each of the
+        two bodies should convey full resource state of the list. The version
+        number of the list should increment for each NOTIFY body.'
+
+properties:
+    minversion: '13.0.0'
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - python: 'yappcap'
+        - python: 'pyxb'
+        - asterisk: 'res_pjsip'
+        - asterisk: 'res_pjsip_pubsub'
+    tags:
+        - rls
+        - pjsip
+
+test-modules:
+    add-to-search-path:
+        -
+            'tests/channels/pjsip/subscriptions/rls/'
+    test-object:
+        config-section: 'test-case-config'
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: 'test-config'
+            typename: 'rls_test.IntegrityCheck'
+
+test-case-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'list_subscribe.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'pres_list'} }
+
+test-config:
+    list_name: 'pres_list'
+    resources:
+        -
+            { 'alice': {'type': 'PIDF', 'state': 'active'},
+              'bob': {'type': 'PIDF', 'state': 'active'} }
+        -
+            { 'alice': {'type': 'PIDF', 'state': 'active'},
+              'bob': {'type': 'PIDF', 'state': 'active'} }
+    full_state:
+        -
+            True
+        -
+            True
+    ami_action:
+        -
+            { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:alice)', 'Value': 'INUSE' }

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/configs/ast1/extensions.conf?view=auto&rev=5521
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/configs/ast1/extensions.conf Wed Aug 27 10:49:25 2014
@@ -1,0 +1,3 @@
+[default]
+exten => alice,hint,Custom:alice
+exten => bob,hint,Custom:bob

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/configs/ast1/pjsip.conf?view=auto&rev=5521
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/configs/ast1/pjsip.conf Wed Aug 27 10:49:25 2014
@@ -1,0 +1,21 @@
+[pres_list]
+type = resource_list
+event = presence
+list_item = alice
+list_item = bob
+
+[sipp]
+type=aor
+max_contacts=1
+contact=sip:sipp at 127.0.0.1:5061
+
+[sipp]
+type = endpoint
+context = default
+aors=sipp
+transport=local
+
+[local]
+type=transport
+protocol=udp
+bind=0.0.0.0:5060

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/sipp/list_subscribe.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/sipp/list_subscribe.xml?view=auto&rev=5521
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/sipp/list_subscribe.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/sipp/list_subscribe.xml Wed Aug 27 10:49:25 2014
@@ -1,0 +1,60 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic Sipstone UAC">
+  <send retrans="500">
+    <![CDATA[
+
+      SUBSCRIBE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 SUBSCRIBE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Event: presence
+      Supported: eventlist
+      Accept: application/rlmi+xml
+      Accept: application/pidf+xml
+      Accept: multipart/related
+      Expires: 3600
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+      <action>
+          <ereg regexp="eventlist" search_in="hdr" header="Require:" check_it="true" assign_to="1" />
+      </action>
+  </recv>
+
+  <recv request="NOTIFY" crlf="true">
+      <action>
+          <ereg regexp="eventlist" search_in="hdr" header="Require:" check_it="true" assign_to="1" />
+      </action>
+  </recv>
+
+  <Reference variables="1" />
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+</scenario>

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/sipp/list_subscribe.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/sipp/list_subscribe.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/sipp/list_subscribe.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/test-config.yaml?view=auto&rev=5521
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/test-config.yaml Wed Aug 27 10:49:25 2014
@@ -1,0 +1,64 @@
+testinfo:
+    summary: 'Baseline test to ensure subscription establishment and RLMI document correctness.'
+    description: |
+        'This test uses SIPp to establish a subscription to a resource list.
+        The resource list is a presence list that contains two elements,
+        alice at default and bob at default. Once the subscription is established, a
+        PCAP listner is used to ensure that the NOTIFY body sent by Asterisk is
+        what is expected. It checks the following:
+            * That the multipart body contains three parts
+            * That the multipart body consists of one RLMI document and two
+              PIDF documents
+            * That the RLMI document has the proper integrity
+                * There is only a single list element
+                * The version number is 0
+                * There are two resource elements
+                * The two resource elements have an instance element with a
+                  cid attribute corresponding to the Content-ID of the two
+                  multipart body parts
+                * Each resource element has the expected name element present
+            * The PIDF documents have proper integrity
+                * The reported states are correct for each part
+                * The Content-ID header matches the corresponding cid attribute
+                  from the instance element in the RLMI document.'
+
+properties:
+    minversion: '13.0.0'
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - python: 'yappcap'
+        - python: 'pyxb'
+        - asterisk: 'res_pjsip'
+        - asterisk: 'res_pjsip_pubsub'
+    tags:
+        - rls
+        - pjsip
+
+test-modules:
+    add-to-search-path:
+        -
+            'tests/channels/pjsip/subscriptions/rls/'
+    test-object:
+        config-section: 'test-case-config'
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            config-section: 'test-config'
+            typename: 'rls_test.IntegrityCheck'
+
+test-case-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'list_subscribe.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'pres_list'} }
+
+test-config:
+    list_name: 'pres_list'
+    resources:
+        -
+            { 'alice': {'type': 'PIDF', 'state': 'active'},
+              'bob': {'type': 'PIDF', 'state': 'active'} }
+    full_state:
+        -
+            True

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/initial_notify/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/configs/ast1/extensions.conf?view=auto&rev=5521
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/configs/ast1/extensions.conf Wed Aug 27 10:49:25 2014
@@ -1,0 +1,3 @@
+[default]
+exten => alice,hint,Custom:alice
+exten => bob,hint,Custom:bob

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/configs/ast1/pjsip.conf?view=auto&rev=5521
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/configs/ast1/pjsip.conf Wed Aug 27 10:49:25 2014
@@ -1,0 +1,22 @@
+[pres_list]
+type = resource_list
+event = presence
+list_item = alice
+list_item = bob
+full_state = no
+
+[sipp]
+type=aor
+max_contacts=1
+contact=sip:sipp at 127.0.0.1:5061
+
+[sipp]
+type = endpoint
+context = default
+aors=sipp
+transport=local
+
+[local]
+type=transport
+protocol=udp
+bind=0.0.0.0:5060

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/sipp/list_subscribe.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/sipp/list_subscribe.xml?view=auto&rev=5521
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/sipp/list_subscribe.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/sipp/list_subscribe.xml Wed Aug 27 10:49:25 2014
@@ -1,0 +1,84 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="Basic Sipstone UAC">
+  <send retrans="500">
+    <![CDATA[
+
+      SUBSCRIBE sip:[service]@[remote_ip]:[remote_port] SIP/2.0
+      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
+      From: sipp <sip:sipp@[local_ip]:[local_port]>;tag=[pid]SIPpTag00[call_number]
+      To: sut <sip:[service]@[remote_ip]:[remote_port]>
+      Call-ID: [call_id]
+      CSeq: 1 SUBSCRIBE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Event: presence
+      Supported: eventlist
+      Accept: application/rlmi+xml
+      Accept: application/pidf+xml
+      Accept: multipart/related
+      Expires: 3600
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv response="100"
+        optional="true">
+  </recv>
+
+  <recv response="200" rtd="true">
+      <action>
+          <ereg regexp="eventlist" search_in="hdr" header="Require:" check_it="true" assign_to="1" />
+      </action>
+  </recv>
+
+  <recv request="NOTIFY" crlf="true">
+      <action>
+          <ereg regexp="eventlist" search_in="hdr" header="Require:" check_it="true" assign_to="1" />
+      </action>
+  </recv>
+
+  <Reference variables="1" />
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <recv request="NOTIFY" crlf="true">
+      <action>
+          <ereg regexp="eventlist" search_in="hdr" header="Require:" check_it="true" assign_to="1" />
+      </action>
+  </recv>
+
+  <Reference variables="1" />
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      [last_Via:]
+      [last_From:]
+      [last_To:]
+      [last_Call-ID:]
+      [last_CSeq:]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+</scenario>

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/sipp/list_subscribe.xml

[... 1350 lines stripped ...]



More information about the asterisk-commits mailing list