[svn-commits] mjordan: testsuite/asterisk/trunk r4912 - in /asterisk/trunk/tests: ./ hep/ h...

SVN commits to the Digium repositories svn-commits at lists.digium.com
Fri Mar 28 20:44:04 CDT 2014


Author: mjordan
Date: Fri Mar 28 20:43:54 2014
New Revision: 4912

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=4912
Log:
tests/hep: Add tests for PJSIP/HEP modules

This patch adds the following:

* A pluggable module that emulates a HEP capture server for verifying packets.
* A function that can, in a rudimentary fashion, verify SIP packets. It's
  simplistic, but good enough to verify that Asterisk sent the server the SIP
  message traffic we sent to it from SIPp.
* A test that verifies that the res_hep/res_hep_pjsip modules forward SIP
  message traffic to our little capture server.
* A test that verifies the same SIP traffic as the first scenario, but with
  IPv6 addresses.
* A test that verifies that not only does SIP traffic get sent, but that the
  authentication field in HEP messages is sent.

Review: https://reviewboard.asterisk.org/r/3206/

(issue ASTERISK-23357)


Added:
    asterisk/trunk/tests/hep/
    asterisk/trunk/tests/hep/hep_capture_node.py   (with props)
    asterisk/trunk/tests/hep/pjsip/
    asterisk/trunk/tests/hep/pjsip-auth/
    asterisk/trunk/tests/hep/pjsip-auth/configs/
    asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/
    asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/hep.conf   (with props)
    asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/hep/pjsip-auth/sipp/
    asterisk/trunk/tests/hep/pjsip-auth/sipp/echo_with_deferred_sdp.xml   (with props)
    asterisk/trunk/tests/hep/pjsip-auth/test-config.yaml   (with props)
    asterisk/trunk/tests/hep/pjsip-ipv6/
    asterisk/trunk/tests/hep/pjsip-ipv6/configs/
    asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/
    asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/hep.conf   (with props)
    asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/hep/pjsip-ipv6/sipp/
    asterisk/trunk/tests/hep/pjsip-ipv6/sipp/echo_with_deferred_sdp.xml   (with props)
    asterisk/trunk/tests/hep/pjsip-ipv6/test-config.yaml   (with props)
    asterisk/trunk/tests/hep/pjsip/configs/
    asterisk/trunk/tests/hep/pjsip/configs/ast1/
    asterisk/trunk/tests/hep/pjsip/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/hep/pjsip/configs/ast1/hep.conf   (with props)
    asterisk/trunk/tests/hep/pjsip/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/hep/pjsip/sipp/
    asterisk/trunk/tests/hep/pjsip/sipp/echo_with_deferred_sdp.xml   (with props)
    asterisk/trunk/tests/hep/pjsip/test-config.yaml   (with props)
    asterisk/trunk/tests/hep/tests.yaml   (with props)
Modified:
    asterisk/trunk/tests/tests.yaml

Added: asterisk/trunk/tests/hep/hep_capture_node.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/hep/hep_capture_node.py?view=auto&rev=4912
==============================================================================
--- asterisk/trunk/tests/hep/hep_capture_node.py (added)
+++ asterisk/trunk/tests/hep/hep_capture_node.py Fri Mar 28 20:43:54 2014
@@ -1,0 +1,296 @@
+#!/usr/bin/env python
+"""HEP Capture Server emulation/pluggable modules
+
+This module provides a pluggable module for the Asterisk Test Suite that
+emulates a HEP capture server. It receives packets from Asterisk instances
+and verifies that the sent packets match their expected values.
+
+Copyright (C) 2014, Digium, Inc.
+Matt Jordan <mjordan at digium.com>
+
+This program is free software, distributed under the terms of
+the GNU General Public License Version 2.
+"""
+
+import socket
+import logging
+import re
+
+from twisted.internet.protocol import DatagramProtocol
+from twisted.internet import reactor
+
+from construct import *
+
+LOGGER = logging.getLogger(__name__)
+
+def enum(**enums):
+    """Make an enumeration out of the passed in values"""
+    return type('Enum', (), enums)
+
+IP_FAMILY = enum(v4=2, v6=10)
+
+HEP_VARIABLE_TYPES = enum(auth_key=14,
+                          payload=15,
+                          uuid=17)
+
+class HEPPacket(object):
+    """A HEP packet"""
+
+    def __init__(self, hep_hdr, src_addr, dst_addr):
+        """Constructor
+
+        Keyword Arguments:
+        hep_hdr The header read from the protocol
+        src_addr The source addresses
+        dst_addr The destination address
+        """
+        self.hep_ctrl = hep_hdr.hep_ctrl.id
+        self.ip_family = hep_hdr.hep_ip_family.ip_family
+        self.ip_id = hep_hdr.hep_ip_id.ip_id
+        self.src_port = hep_hdr.src_port.hep_port.port
+        self.dst_port = hep_hdr.dst_port.hep_port.port
+        self.time_sec = hep_hdr.hep_timestamp_sec.timestamp_sec
+        self.time_usec = hep_hdr.hep_timestamp_usec.timestamp_usec
+        self.protocol_type = hep_hdr.hep_protocol_type.protocol_type
+        self.capture_agent_id = hep_hdr.hep_capture_agent_id.capture_agent_id
+        if self.ip_family == IP_FAMILY.v4:
+            self.src_addr = socket.inet_ntop(socket.AF_INET, src_addr.ipv4_addr)
+            self.dst_addr = socket.inet_ntop(socket.AF_INET, dst_addr.ipv4_addr)
+        elif self.ip_family == IP_FAMILY.v6:
+            self.src_addr = socket.inet_ntop(socket.AF_INET6, src_addr.ipv6_addr)
+            self.dst_addr = socket.inet_ntop(socket.AF_INET6, dst_addr.ipv6_addr)
+        self.auth_key = None
+        self.uuid = None
+        self.payload = None
+
+class HEPPacketHandler(DatagramProtocol):
+    """A twisted DatagramProtocol that converts a UDP packet
+    into a HEPv3 packet object
+    """
+
+    def __init__(self, module):
+        """Constructor
+
+        Keyword Arguments:
+        module The pluggable module that created this object
+        """
+
+        self.module = module
+
+        self.hep_chunk = Struct('hep_chunk',
+            UBInt16('vendor_id'),
+            UBInt16('type_id'),
+            UBInt16('length'))
+        hep_ctrl = Struct('hep_ctrl',
+            Array(4, UBInt8('id')),
+            UBInt16('length'))
+        hep_ip_family = Struct('hep_ip_family',
+            self.hep_chunk,
+            UBInt8('ip_family'));
+        hep_ip_id = Struct('hep_ip_id',
+            self.hep_chunk,
+            UBInt8('ip_id'))
+        hep_port = Struct('hep_port',
+            self.hep_chunk,
+            UBInt16('port'))
+        hep_timestamp_sec = Struct('hep_timestamp_sec',
+            self.hep_chunk,
+            UBInt32('timestamp_sec'))
+        hep_timestamp_usec = Struct('hep_timestamp_usec',
+            self.hep_chunk,
+            UBInt32('timestamp_usec'))
+        hep_protocol_type = Struct('hep_protocol_type',
+            self.hep_chunk,
+            UBInt8('protocol_type'))
+        hep_capture_agent_id = Struct('hep_capture_agent_id',
+            self.hep_chunk,
+            UBInt32('capture_agent_id'))
+        self.hep_generic_msg = Struct('hep_generic',
+            hep_ctrl,
+            hep_ip_family,
+            hep_ip_id,
+            Struct('src_port', hep_port),
+            Struct('dst_port', hep_port),
+            hep_timestamp_sec,
+            hep_timestamp_usec,
+            hep_protocol_type,
+            hep_capture_agent_id)
+
+    def datagramReceived(self, data, (host, port)):
+        """Process a received datagram"""
+
+        LOGGER.debug("Received %r from %s:%d (len: %d)" %
+            (data, host, port, len(data)))
+
+        # Parse out the header
+        parsed_hdr = self.hep_generic_msg.parse(data)
+        length = self.hep_generic_msg.sizeof()
+
+        # Get the IPv4 or IPv6 addresses
+        src_addr = None
+        dst_addr = None
+        if parsed_hdr.hep_ip_family.ip_family == IP_FAMILY.v4:
+            # IPv4
+            hep_ipv4_addr = Struct('hep_ipv4_addr',
+                self.hep_chunk,
+                String('ipv4_addr', 4))
+            src_addr = hep_ipv4_addr.parse(data[length:])
+            length += hep_ipv4_addr.sizeof()
+            dst_addr = hep_ipv4_addr.parse(data[length:])
+            length += hep_ipv4_addr.sizeof()
+        elif parsed_hdr.hep_ip_family.ip_family == IP_FAMILY.v6:
+            # IPv6
+            hep_ipv6_addr = Struct('hep_ipv6_addr',
+                self.hep_chunk,
+                String('ipv6_addr', 16))
+            src_addr = hep_ipv6_addr.parse(data[length:])
+            length += hep_ipv6_addr.sizeof()
+            dst_addr = hep_ipv6_addr.parse(data[length:])
+            length += hep_ipv6_addr.sizeof()
+
+        packet = HEPPacket(parsed_hdr, src_addr, dst_addr)
+
+        # Get variable length fields
+        while length < len(data):
+            hdr = self.hep_chunk.parse(data[length:])
+            length += self.hep_chunk.sizeof()
+            if hdr.type_id == HEP_VARIABLE_TYPES.auth_key:
+                hep_auth_key = String('hep_auth_key',
+                                      hdr.length - self.hep_chunk.sizeof())
+                packet.auth_key = hep_auth_key.parse(data[length:])
+                length += hep_auth_key.sizeof() - self.hep_chunk.sizeof()
+            elif hdr.type_id == HEP_VARIABLE_TYPES.payload:
+                hep_payload = String('hep_payload',
+                                     hdr.length - self.hep_chunk.sizeof())
+                packet.payload = hep_payload.parse(data[length:])
+                length += hep_payload.sizeof() - self.hep_chunk.sizeof()
+
+                LOGGER.debug('Packet payload: %s' % packet.payload)
+            elif hdr.type_id == HEP_VARIABLE_TYPES.uuid:
+                hep_uuid = String('hep_uuid',
+                                  hdr.length - self.hep_chunk.sizeof())
+                packet.uuid = hep_uuid.parse(data[length:])
+                length += hep_uuid.sizeof() - self.hep_chunk.sizeof()
+
+        self.module.verify_packet(packet)
+
+
+class HEPCaptureNode(object):
+    """Pluggable module that listens for HEP packets and verifies them"""
+
+    def __init__(self, module_config, test_object):
+        """Constructor
+
+        Keyword Arguments:
+        module_config The configuration for this pluggable module
+        test_object   The one and only test object
+        """
+        self.test_object = test_object
+        self.packets = module_config.get('packets') or []
+        bind_port = module_config.get('bind-port') or 9999
+
+        protocol = HEPPacketHandler(self)
+        reactor.listenUDP(int(bind_port), protocol)
+
+        self.current_packet = 0
+
+    def verify_sip_packet(self, payload, expected):
+        """Verify a SIP packet
+
+        This should in no way be taken as a legitimate SIP parser. That is not
+        its intended purpose. It's enough for our purposes, which is *very*
+        limited.
+
+        Keyword Arguments:
+        payload  The actual payload
+        expected The expected values
+        """
+        sip_lines = [line for line in payload.split('\r\n') if line]
+
+        if len(sip_lines) != len(expected):
+            LOGGER.error('Packet %d: Number of lines in SIP payload %d is ' \
+                         'not expected %d', self.current_packet, len(sip_lines),
+                         len(expected))
+            self.test_object.set_passed(False)
+            return
+
+        for i in range(0, len(sip_lines)):
+            if not re.match(expected[i], sip_lines[i]):
+                LOGGER.error('Packet %d, SIP line %d: actual %s does not ' \
+                             'match expected %s', self.current_packet, i,
+                             sip_lines[i], expected[i])
+                self.test_object.set_passed(False)
+
+    def verify_rtcp_packet(self, payload, expected):
+        """Verify an RTCP packet
+
+        Keyword Arguments:
+        payload  The actual payload
+        expected The expected values
+        """
+        pass
+
+    def verify_packet(self, packet):
+        """Verify a packet
+
+        Keyword Arguments:
+        packet The HEPPacket to verify
+        """
+
+        self.current_packet += 1
+        if self.current_packet > len(self.packets):
+            LOGGER.error('Number of packets %d exceeded expected: %d' %
+                         (self.current_packet, len(self.packets)))
+            self.test_object.set_passed(False)
+            return
+
+        # Verify things we can do without input
+        time_sec = getattr(packet, 'time_sec', None)
+        if not time_sec:
+            LOGGER.error('No time_sec value in packet %d: %s' %
+                         (self.current_packet, str(packet.__dict__)))
+            self.test_object.set_passed(False)
+        time_usec = getattr(packet, 'time_usec', None)
+        if not time_usec:
+            LOGGER.error('No time_usec value in packet %d: %s' % (
+                self.current_packet, str(packet.__dict__)))
+            self.test_object.set_passed(False)
+
+        # HEP header is always the same. The values in the array
+        # of length 4 are 'HEP3'. The hep_ctrl portion of the packet
+        # should always have the bytes corresponding to those
+        # characters.
+        hep_ctrl = getattr(packet, 'hep_ctrl', None)
+        if hep_ctrl:
+            if not (hep_ctrl[0] == 72 and hep_ctrl[1] == 69 and
+                    hep_ctrl[2] == 80 and hep_ctrl[3] == 51):
+                LOGGER.error('hep_ctrl header is not expected in ' \
+                             'packet %d: %s' % (self.current_packet,
+                             str(hep_ctrl)))
+                self.test_object.set_passed(False)
+        else:
+            LOGGER.error('No hep_ctrl value in packet %d: %s' % (
+                         self.current_packet, str(packet.__dict__)))
+            self.test_object.set_passed(False)
+
+        # Verify the keys specified in the YAML
+        for key, value in self.packets[self.current_packet - 1].items():
+            actual = getattr(packet, key, None)
+
+            if isinstance(value, str):
+                if not re.match(value, actual):
+                    LOGGER.error('Packet %d: key %s expected value %s did ' \
+                                 'not match %s', self.current_packet, key,
+                                 value, actual)
+                    self.test_object.set_passed(False)
+            elif isinstance(value, int):
+                if actual != value:
+                    LOGGER.error('Packet %d: key %s expected value %d != ' \
+                                 'actual %d', self.current_packet, key, value,
+                                 actual)
+                    self.test_object.set_passed(False)
+            elif key == 'payload':
+                if value['decode'] == 'SIP':
+                    self.verify_sip_packet(actual, value['value'])
+                elif value['decode'] == 'RTCP':
+                    self.verify_rtcp_packet(actual, value['value'])

Propchange: asterisk/trunk/tests/hep/hep_capture_node.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/hep/hep_capture_node.py
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/hep/hep_capture_node.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/extensions.conf?view=auto&rev=4912
==============================================================================
--- asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/extensions.conf Fri Mar 28 20:43:54 2014
@@ -1,0 +1,4 @@
+[default]
+exten => echo,1,Answer()
+same  =>      n,Echo()
+same  =>      n,Hangup()

Propchange: asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/hep.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/hep.conf?view=auto&rev=4912
==============================================================================
--- asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/hep.conf (added)
+++ asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/hep.conf Fri Mar 28 20:43:54 2014
@@ -1,0 +1,5 @@
+[general]
+enabled = yes
+capture_address = 127.0.0.1:9999
+capture_id = 12345
+capture_password = foobar

Propchange: asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/hep.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/hep.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/hep.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/pjsip.conf?view=auto&rev=4912
==============================================================================
--- asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/pjsip.conf Fri Mar 28 20:43:54 2014
@@ -1,0 +1,13 @@
+[local-transport-udp]
+type=transport
+bind=127.0.0.1
+protocol=udp
+
+[endpoint-template-ipv4](!)
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+media_address=127.0.0.1
+
+[alice-ipv4-udp](endpoint-template-ipv4)
+transport=local-transport-udp

Propchange: asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/hep/pjsip-auth/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/hep/pjsip-auth/sipp/echo_with_deferred_sdp.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/hep/pjsip-auth/sipp/echo_with_deferred_sdp.xml?view=auto&rev=4912
==============================================================================
--- asterisk/trunk/tests/hep/pjsip-auth/sipp/echo_with_deferred_sdp.xml (added)
+++ asterisk/trunk/tests/hep/pjsip-auth/sipp/echo_with_deferred_sdp.xml Fri Mar 28 20:43:54 2014
@@ -1,0 +1,84 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to echo with SDP in ACK">
+  <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-Length: 0
+    ]]>
+  </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-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>
+
+  <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>
+

Propchange: asterisk/trunk/tests/hep/pjsip-auth/sipp/echo_with_deferred_sdp.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/hep/pjsip-auth/sipp/echo_with_deferred_sdp.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/hep/pjsip-auth/sipp/echo_with_deferred_sdp.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/hep/pjsip-auth/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/hep/pjsip-auth/test-config.yaml?view=auto&rev=4912
==============================================================================
--- asterisk/trunk/tests/hep/pjsip-auth/test-config.yaml (added)
+++ asterisk/trunk/tests/hep/pjsip-auth/test-config.yaml Fri Mar 28 20:43:54 2014
@@ -1,0 +1,208 @@
+testinfo:
+    summary:     'Tests HEP with auth and with PJSIP'
+    description: |
+        This test validates Asterisk sending SIP traffic from the
+        res_pjsip stack over the Homer Encapsulation Protocol (HEP).
+        The test runs a basic inbound call through Asterisk's PJSIP
+        stack and receives the HEP packets on a UDP listener. The
+        resulting HEP packets are decoded, validated, and the SIP
+        payload verified. The HEP packets include an optional
+        authentication password.
+
+test-modules:
+    add-to-search-path:
+        -
+            'tests/hep'
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            typename: 'hep_capture_node.HEPCaptureNode'
+            config-section: hep-node-config
+
+test-object-config:
+    fail-on-any: True
+    test-iterations:
+        -
+            scenarios:
+                # IPv4 & UDP
+                - { 'key-args': {'scenario': 'echo_with_deferred_sdp.xml', '-i': '127.0.0.1', '-p': '5067', '-d': '5000', '-s': 'alice-ipv4-udp'} }
+
+hep-node-config:
+    bind-port: '9999'
+    packets:
+        -
+            ip_family: 2
+            uuid: '(.*?)@127.0.0.1'
+            src_addr: '127.0.0.1'
+            src_port: 5067
+            dst_addr: '127.0.0.1'
+            dst_port: 5060
+            protocol_type: 1
+            capture_agent_id: 12345
+            auth_key: 'foobar'
+            ip_id: 17
+            payload:
+                decode: 'SIP'
+                value:
+                    - 'INVITE sip:echo at 127.0.0.1:5060 SIP/2.0'
+                    - 'Via: SIP/2.0/UDP 127.0.0.1:5067;branch=(.*)'
+                    - 'From: test1 <sip:alice-ipv4-udp at 127.0.0.1:5067>;tag=(.*)'
+                    - 'To: test <sip:test at 127.0.0.1:5060>'
+                    - 'Call-ID: (.*?)@127.0.0.1'
+                    - 'CSeq: 1 INVITE'
+                    - 'Contact: <sip:test at 127.0.0.1:5067;transport=UDP>'
+                    - 'Max-Forwards: 70'
+                    - 'Subject: Test'
+                    - 'User-Agent: Test'
+                    - 'Content-Length: 0'
+        -
+            ip_family: 2
+            uuid: '(.*?)@127.0.0.1'
+            src_addr: '127.0.0.1'
+            src_port: 5060
+            dst_addr: '127.0.0.1'
+            dst_port: 5067
+            protocol_type: 1
+            capture_agent_id: 12345
+            auth_key: 'foobar'
+            ip_id: 17
+            payload:
+                decode: 'SIP'
+                value:
+                    - 'SIP/2.0 100 Trying'
+                    - 'Via: SIP/2.0/UDP 127.0.0.1:5067;rport;received=127.0.0.1;branch=(.*)'
+                    - 'Call-ID: (.*?)@127.0.0.1'
+                    - 'From: "test1" <sip:alice-ipv4-udp at 127.0.0.1>;tag=(.*)'
+                    - 'To: "test" <sip:test at 127.0.0.1>'
+                    - 'CSeq: 1 INVITE'
+                    - 'Content-Length:  0'
+        -
+            ip_family: 2
+            uuid: '(.*?)@127.0.0.1'
+            src_addr: '127.0.0.1'
+            src_port: 5060
+            dst_addr: '127.0.0.1'
+            dst_port: 5067
+            protocol_type: 1
+            capture_agent_id: 12345
+            auth_key: 'foobar'
+            ip_id: 17
+            payload:
+                decode: 'SIP'
+                value:
+                    - 'SIP/2.0 200 OK'
+                    - 'Via: SIP/2.0/UDP 127.0.0.1:5067;rport;received=127.0.0.1;branch=(.*)'
+                    - 'Call-ID: (.*?)@127.0.0.1'
+                    - 'From: "test1" <sip:alice-ipv4-udp at 127.0.0.1>;tag=(.*)'
+                    - 'To: "test" <sip:test at 127.0.0.1>;tag=(.*)'
+                    - 'CSeq: 1 INVITE'
+                    - 'Contact: <sip:127.0.0.1:5060>'
+                    - 'Allow: OPTIONS, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, REFER, REGISTER, MESSAGE'
+                    - 'Supported: 100rel, timer, replaces, norefersub'
+                    - 'Content-Type: application/sdp'
+                    - 'Content-Length:(.*)'
+                    - '(.*)'
+                    - '(.*)'
+                    - 's=Asterisk'
+                    - 'c=IN IP4 127.0.0.1'
+                    - 't=0 0'
+                    - 'm=audio(.*?)RTP/AVP 0 8 101'
+                    - 'c=IN IP4 127.0.0.1'
+                    - 'a=rtpmap:0 PCMU/8000'
+                    - 'a=rtpmap:8 PCMA/8000'
+                    - 'a=rtpmap:101 telephone-event/8000'
+                    - 'a=fmtp:101 0-16'
+                    - 'a=ptime:20'
+                    - 'a=maxptime:150'
+                    - 'a=sendrecv'
+        -
+            ip_family: 2
+            uuid: '(.*?)@127.0.0.1'
+            src_addr: '127.0.0.1'
+            src_port: 5067
+            dst_addr: '127.0.0.1'
+            dst_port: 5060
+            protocol_type: 1
+            capture_agent_id: 12345
+            auth_key: 'foobar'
+            ip_id: 17
+            payload:
+                decode: 'SIP'
+                value:
+                    - 'ACK sip:echo at 127.0.0.1:5060 SIP/2.0'
+                    - 'Via: SIP/2.0/UDP 127.0.0.1:5067;branch=(.*)'
+                    - 'From: test1 <sip:alice-ipv4-udp at 127.0.0.1:5067>;tag=(.*)'
+                    - 'To: test <sip:test at 127.0.0.1:5060>;tag=(.*)'
+                    - 'Call-ID: (.*?)@127.0.0.1'
+                    - 'CSeq: 1 ACK'
+                    - 'Contact: <sip:test at 127.0.0.1:5067;transport=UDP>'
+                    - 'Max-Forwards: 70'
+                    - 'Subject: Test'
+                    - 'Content-Type: application/sdp'
+                    - 'Content-Length:(.*)'
+                    - '(.*)'
+                    - 'o=phoneA(.*?)IN IP4 127.0.0.1'
+                    - 's=-'
+                    - 'c=IN IP4 127.0.0.1'
+                    - 't=0 0'
+                    - 'm=audio(.*?)RTP/AVP 0'
+                    - 'a=rtpmap:0 PCMU/8000'
+        -
+            ip_family: 2
+            uuid: '(.*?)@127.0.0.1'
+            src_addr: '127.0.0.1'
+            src_port: 5067
+            dst_addr: '127.0.0.1'
+            dst_port: 5060
+            protocol_type: 1
+            capture_agent_id: 12345
+            auth_key: 'foobar'
+            ip_id: 17
+            payload:
+                decode: 'SIP'
+                value:
+                    - 'BYE sip:echo at 127.0.0.1:5060 SIP/2.0'
+                    - 'Via: SIP/2.0/UDP 127.0.0.1:5067;branch=(.*)'
+                    - 'From: test1 <sip:alice-ipv4-udp at 127.0.0.1:5067>;tag=(.*)'
+                    - 'To: test <sip:test at 127.0.0.1:5060>;tag=(.*)'
+                    - 'Call-ID: (.*?)@127.0.0.1'
+                    - 'CSeq: 2 BYE'
+                    - 'Contact: <sip:test at 127.0.0.1:5067;transport=UDP>'
+                    - 'Max-Forwards: 70'
+                    - 'Subject: Test'
+                    - 'Content-Length: 0'
+        -
+            ip_family: 2
+            uuid: '(.*?)@127.0.0.1'
+            src_addr: '127.0.0.1'
+            src_port: 5060
+            dst_addr: '127.0.0.1'
+            dst_port: 5067
+            protocol_type: 1
+            capture_agent_id: 12345
+            auth_key: 'foobar'
+            ip_id: 17
+            payload:
+                decode: 'SIP'
+                value:
+                    - 'SIP/2.0 200 OK'
+                    - 'Via: SIP/2.0/UDP 127.0.0.1:5067;rport;received=127.0.0.1;branch=(.*)'
+                    - 'Call-ID: (.*?)@127.0.0.1'
+                    - 'From: "test1" <sip:alice-ipv4-udp at 127.0.0.1>;tag=(.*)'
+                    - 'To: "test" <sip:test at 127.0.0.1>;tag=(.*)'
+                    - 'CSeq: 2 BYE'
+                    - 'Content-Length:  0'
+
+
+properties:
+    minversion: '12.2.0'
+    dependencies:
+        - sipp :
+            version : 'v3.0'
+        - asterisk : 'res_pjsip'
+        - asterisk: 'res_hep'
+        - asterisk: 'res_hep_pjsip'
+    tags:
+        - pjsip

Propchange: asterisk/trunk/tests/hep/pjsip-auth/test-config.yaml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/hep/pjsip-auth/test-config.yaml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/hep/pjsip-auth/test-config.yaml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/extensions.conf?view=auto&rev=4912
==============================================================================
--- asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/extensions.conf Fri Mar 28 20:43:54 2014
@@ -1,0 +1,4 @@
+[default]
+exten => echo,1,Answer()
+same  =>      n,Echo()
+same  =>      n,Hangup()

Propchange: asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/hep.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/hep.conf?view=auto&rev=4912
==============================================================================
--- asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/hep.conf (added)
+++ asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/hep.conf Fri Mar 28 20:43:54 2014
@@ -1,0 +1,4 @@
+[general]
+enabled = yes
+capture_address = 127.0.0.1:9999
+capture_id = 12345

Propchange: asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/hep.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/hep.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/hep.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/pjsip.conf?view=auto&rev=4912
==============================================================================
--- asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/pjsip.conf Fri Mar 28 20:43:54 2014
@@ -1,0 +1,14 @@
+[local-transport6-udp]
+type=transport
+bind=[::1]
+protocol=udp
+
+[endpoint-template-ipv6](!)
+type=endpoint
+context=default
+allow=!all,ulaw,alaw
+media_address=[::1]
+rtp_ipv6=yes
+
+[alice-ipv6-udp](endpoint-template-ipv6)
+transport=local-transport6-udp

Propchange: asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/hep/pjsip-ipv6/configs/ast1/pjsip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/hep/pjsip-ipv6/sipp/echo_with_deferred_sdp.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/hep/pjsip-ipv6/sipp/echo_with_deferred_sdp.xml?view=auto&rev=4912
==============================================================================
--- asterisk/trunk/tests/hep/pjsip-ipv6/sipp/echo_with_deferred_sdp.xml (added)
+++ asterisk/trunk/tests/hep/pjsip-ipv6/sipp/echo_with_deferred_sdp.xml Fri Mar 28 20:43:54 2014
@@ -1,0 +1,84 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<!DOCTYPE scenario SYSTEM "sipp.dtd">
+
+<scenario name="INVITE to echo with SDP in ACK">
+  <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-Length: 0
+    ]]>
+  </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-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>
+
+  <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>
+

Propchange: asterisk/trunk/tests/hep/pjsip-ipv6/sipp/echo_with_deferred_sdp.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/hep/pjsip-ipv6/sipp/echo_with_deferred_sdp.xml
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/hep/pjsip-ipv6/sipp/echo_with_deferred_sdp.xml
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/hep/pjsip-ipv6/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/hep/pjsip-ipv6/test-config.yaml?view=auto&rev=4912
==============================================================================
--- asterisk/trunk/tests/hep/pjsip-ipv6/test-config.yaml (added)
+++ asterisk/trunk/tests/hep/pjsip-ipv6/test-config.yaml Fri Mar 28 20:43:54 2014
@@ -1,0 +1,202 @@
+testinfo:
+    summary:     'Tests HEP with IPv6 PJSIP'
+    description: |
+        This test validates Asterisk sending SIP traffic using IPv6
+        source/destination addresses from the res_pjsip stack over
+        the Homer Encapsulation Protocol (HEP).
+        The test runs a basic inbound call through Asterisk's PJSIP
+        stack and receives the HEP packets on a UDP listener bound
+        to an IPv6 address. The resulting HEP packets are decoded,
+        validated, and the SIP payload verified.
+
+test-modules:
+    add-to-search-path:
+        -
+            'tests/hep'
+    test-object:
+        config-section: test-object-config
+        typename: 'sipp.SIPpTestCase'
+    modules:
+        -
+            typename: 'hep_capture_node.HEPCaptureNode'
+            config-section: hep-node-config
+
+test-object-config:
+    fail-on-any: True
+    test-iterations:
+        -
+            scenarios:
+                # IPv6 & UDP
+                - { 'target': '[::1]', 'key-args': {'scenario': 'echo_with_deferred_sdp.xml', '-i': '[::1]', '-p': '5067', '-d': '5000', '-s': 'alice-ipv6-udp'} }
+
+hep-node-config:
+    bind-port: '9999'
+    packets:
+        -
+            ip_family: 10

[... 614 lines stripped ...]



More information about the svn-commits mailing list