[asterisk-commits] mjordan: testsuite/asterisk/trunk r5548 - in /asterisk/trunk: lib/python/aste...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Sep 5 18:41:36 CDT 2014


Author: mjordan
Date: Fri Sep  5 18:41:32 2014
New Revision: 5548

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5548
Log:
tests/hep/{rtcp-sender|rtcp_receiver}: Add tests for the RTCP HEP module

This patch adds two tests that cover transmitting RTCP information to a HEP
server:
 * rtcp-sender: One Asterisk instance dials another Asterisk instance. Audio
   is streamed from the first instance and echo'd back from the second to the
   first. This results in RTCP information from both instances being sent to
   a HEP server, where both sides are 'senders' and thus generate/receive SR
   packets.
 * rtcp-receiver: One Asterisk instance dials another Asterisk instance. Audio
   is streamed from the first instance and absorbed by the second. This results
   in RTCP information from both instances being sent to a HEP server, where
   the first transmits SR packets and received RR packets and the second
   transmits RR packets and received SR packets.

The test does basic validation of the received HEP packets from both Asterisk
instances.

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

ASTERISK-24119

Added:
    asterisk/trunk/tests/hep/rtcp-receiver/
    asterisk/trunk/tests/hep/rtcp-receiver/configs/
    asterisk/trunk/tests/hep/rtcp-receiver/configs/ast1/
    asterisk/trunk/tests/hep/rtcp-receiver/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/hep/rtcp-receiver/configs/ast1/hep.conf   (with props)
    asterisk/trunk/tests/hep/rtcp-receiver/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/
    asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/extensions.conf   (with props)
    asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/hep.conf   (with props)
    asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/pjsip.conf   (with props)
    asterisk/trunk/tests/hep/rtcp-receiver/test-config.yaml   (with props)
    asterisk/trunk/tests/hep/rtcp-sender/
    asterisk/trunk/tests/hep/rtcp-sender/configs/
    asterisk/trunk/tests/hep/rtcp-sender/configs/ast1/
    asterisk/trunk/tests/hep/rtcp-sender/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/hep/rtcp-sender/configs/ast1/hep.conf   (with props)
    asterisk/trunk/tests/hep/rtcp-sender/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/hep/rtcp-sender/configs/ast2/
    asterisk/trunk/tests/hep/rtcp-sender/configs/ast2/extensions.conf   (with props)
    asterisk/trunk/tests/hep/rtcp-sender/configs/ast2/hep.conf   (with props)
    asterisk/trunk/tests/hep/rtcp-sender/configs/ast2/pjsip.conf   (with props)
    asterisk/trunk/tests/hep/rtcp-sender/test-config.yaml   (with props)
Modified:
    asterisk/trunk/lib/python/asterisk/ari.py
    asterisk/trunk/lib/python/asterisk/test_suite_utils.py
    asterisk/trunk/tests/hep/hep_capture_node.py
    asterisk/trunk/tests/hep/pjsip-auth/test-config.yaml
    asterisk/trunk/tests/hep/pjsip-ipv6/test-config.yaml
    asterisk/trunk/tests/hep/pjsip/test-config.yaml
    asterisk/trunk/tests/hep/tests.yaml

Modified: asterisk/trunk/lib/python/asterisk/ari.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/ari.py?view=diff&rev=5548&r1=5547&r2=5548
==============================================================================
--- asterisk/trunk/lib/python/asterisk/ari.py (original)
+++ asterisk/trunk/lib/python/asterisk/ari.py Fri Sep  5 18:41:32 2014
@@ -15,6 +15,7 @@
 import urllib
 
 from test_case import TestCase
+from test_suite_utils import all_match
 from twisted.internet import reactor
 try:
     from autobahn.websocket import WebSocketClientFactory, \
@@ -651,46 +652,6 @@
         if res and nomatch:
             res = not all_match(nomatch, message)
         return res
-
-
-def all_match(pattern, message):
-    """Match a pattern from the YAML config with a received message.
-
-    :param pattern: Configured pattern.
-    :param message: Message to compare.
-    :returns: True if message matches pattern; False otherwise.
-    """
-    #LOGGER.debug("%r ?= %r" % (pattern, message))
-    #LOGGER.debug("  %r" % type(pattern))
-    #LOGGER.debug("  %r" % type(message))
-    if pattern is None:
-        # Empty pattern always matches
-        return True
-    elif isinstance(pattern, list):
-        # List must be an exact match
-        res = len(pattern) == len(message)
-        i = 0
-        while res and i < len(pattern):
-            res = all_match(pattern[i], message[i])
-            i += 1
-        return res
-    elif isinstance(pattern, dict):
-        # Dict should match for every field in the pattern.
-        # extra fields in the message are fine.
-        for key, value in pattern.iteritems():
-            to_check = message.get(key)
-            if to_check is None or not all_match(value, to_check):
-                return False
-        return True
-    elif isinstance(pattern, str) or isinstance(pattern, unicode):
-        # Pattern strings are considered to be regexes
-        return re.match(pattern, str(message)) is not None
-    elif isinstance(pattern, int):
-        # Integers are literal matches
-        return pattern == message
-    else:
-        LOGGER.error("Unhandled pattern type %s", type(pattern))
-
 
 class Range(object):
     """Utility object to handle numeric ranges (inclusive)."""

Modified: asterisk/trunk/lib/python/asterisk/test_suite_utils.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/lib/python/asterisk/test_suite_utils.py?view=diff&rev=5548&r1=5547&r2=5548
==============================================================================
--- asterisk/trunk/lib/python/asterisk/test_suite_utils.py (original)
+++ asterisk/trunk/lib/python/asterisk/test_suite_utils.py Fri Sep  5 18:41:32 2014
@@ -12,10 +12,15 @@
 """
 
 import os
+import logging
+import re
+
 from os import close
 from os import remove
 from shutil import move
 from tempfile import mkstemp
+
+LOGGER = logging.getLogger(__name__)
 
 def which(program):
     """Find the executable for a specified program
@@ -66,3 +71,42 @@
     # Move new file
     move(abs_path, file_name)
 
+def all_match(pattern, message):
+    """Match all items in a pattern to some message values
+
+    This will recursively call itself, matching each item in pattern
+    to the items in message
+
+    :param pattern: Configured pattern.
+    :param message: Message to compare.
+    :returns: True if message matches pattern; False otherwise.
+    """
+    LOGGER.debug('Pattern: %s, message %s' %
+        (str(pattern), str(message)))
+    if pattern is None:
+        # Empty pattern always matches
+        return True
+    elif isinstance(pattern, list):
+        # List must be an exact match
+        res = len(pattern) == len(message)
+        i = 0
+        while res and i < len(pattern):
+            res = all_match(pattern[i], message[i])
+            i += 1
+        return res
+    elif isinstance(pattern, dict):
+        # Dict should match for every field in the pattern.
+        # extra fields in the message are fine.
+        for key, value in pattern.iteritems():
+            to_check = message.get(key)
+            if to_check is None or not all_match(value, to_check):
+                return False
+        return True
+    elif isinstance(pattern, str) or isinstance(pattern, unicode):
+        # Pattern strings are considered to be regexes
+        return re.match(pattern, str(message)) is not None
+    elif isinstance(pattern, int):
+        # Integers are literal matches
+        return pattern == message
+    else:
+        LOGGER.error("Unhandled pattern type %s" % type(pattern))

Modified: asterisk/trunk/tests/hep/hep_capture_node.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/hep/hep_capture_node.py?view=diff&rev=5548&r1=5547&r2=5548
==============================================================================
--- asterisk/trunk/tests/hep/hep_capture_node.py (original)
+++ asterisk/trunk/tests/hep/hep_capture_node.py Fri Sep  5 18:41:32 2014
@@ -15,6 +15,8 @@
 import socket
 import logging
 import re
+import sys
+import json
 
 from twisted.internet.protocol import DatagramProtocol
 from twisted.internet import reactor
@@ -22,6 +24,10 @@
 from construct import *
 
 LOGGER = logging.getLogger(__name__)
+
+sys.path.append('lib/python/asterisk')
+
+from test_suite_utils import all_match
 
 def enum(**enums):
     """Make an enumeration out of the passed in values"""
@@ -32,6 +38,30 @@
 HEP_VARIABLE_TYPES = enum(auth_key=14,
                           payload=15,
                           uuid=17)
+
+HEP_PROTOCOL_TYPE = enum(SIP=1,
+                         H323=2,
+                         SDP=3,
+                         RTP=4,
+                         RTCP=5,
+                         MGCP=6,
+                         MEGACO=7,
+                         M2UA=8,
+                         M3UA=9,
+                         IAX=10)
+
+HEP_PROTOCOL_TYPES_TO_STRING = {
+    HEP_PROTOCOL_TYPE.SIP: 'SIP',
+    HEP_PROTOCOL_TYPE.H323: 'H323',
+    HEP_PROTOCOL_TYPE.SDP: 'SDP',
+    HEP_PROTOCOL_TYPE.RTP: 'RTP',
+    HEP_PROTOCOL_TYPE.RTCP: 'RTCP',
+    HEP_PROTOCOL_TYPE.MGCP: 'MGCP',
+    HEP_PROTOCOL_TYPE.MEGACO: 'MEGACO',
+    HEP_PROTOCOL_TYPE.M2UA: 'M2UA',
+    HEP_PROTOCOL_TYPE.M3UA: 'M3UA',
+    HEP_PROTOCOL_TYPE.IAX: 'IAX',
+}
 
 class HEPPacket(object):
     """A HEP packet"""
@@ -185,13 +215,28 @@
         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
+        self.packets = module_config.get('packets', [])
+        self.black_list = module_config.get('packet-blacklist', [])
+        self.match_any = module_config.get('match-any', False)
+        bind_port = module_config.get('bind-port', 9999)
 
         protocol = HEPPacketHandler(self)
+        LOGGER.info('HEP Capture Agent: binding to %d' % (int(bind_port)))
         reactor.listenUDP(int(bind_port), protocol)
 
         self.current_packet = 0
+
+        self.test_object.register_stop_observer(self.on_stop_handler)
+
+    def on_stop_handler(self, result):
+        """A deferred callback called when the test is stopped
+
+        result The result of the previous deferreds
+        """
+        if len(self.packets):
+            LOGGER.error('Still waiting on %d packets!' % len(self.packets))
+            self.test_object.set_passed(False)
+        self.test_object.set_passed(True)
 
     def verify_sip_packet(self, payload, expected):
         """Verify a SIP packet
@@ -207,18 +252,18 @@
         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 ' \
+            LOGGER.debug('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
+            return False
 
         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 ' \
+                LOGGER.debug('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)
+                return False
+        return True
 
     def verify_rtcp_packet(self, payload, expected):
         """Verify an RTCP packet
@@ -227,7 +272,42 @@
         payload  The actual payload
         expected The expected values
         """
-        pass
+        return all_match(expected, json.loads(payload))
+
+    def match_expected_packet(self, actual_packet, expected_packet):
+        """Verify a received packet against an expected packet
+
+        Keyword Arguments:
+        actual_packet The received packet
+        expected_packet The packet we think we should have gotten
+
+        Returns:
+        True if they matched
+        False otherwise
+        """
+        res = True
+
+        for key, value in expected_packet.items():
+            actual = getattr(actual_packet, key, None)
+
+            if isinstance(value, str):
+                if not re.match(value, actual):
+                    LOGGER.debug('Packet %d: key %s expected value %s did ' \
+                                 'not match %s', self.current_packet, key,
+                                 value, actual)
+                    res = False
+            elif isinstance(value, int):
+                if actual != value:
+                    LOGGER.debug('Packet %d: key %s expected value %d != ' \
+                                 'actual %d', self.current_packet, key, value,
+                                 actual)
+                    res = False
+            elif key == 'payload':
+                if value['decode'] == 'SIP':
+                    res = self.verify_sip_packet(actual, value['value'])
+                elif value['decode'] == 'RTCP':
+                    res = self.verify_rtcp_packet(actual, value['value'])
+        return res
 
     def verify_packet(self, packet):
         """Verify a packet
@@ -236,10 +316,17 @@
         packet The HEPPacket to verify
         """
 
+        # pro-actively get the type out of the packet so we can ignore it
+        # safely if we don't care about it
+        packet_type = HEP_PROTOCOL_TYPES_TO_STRING.get(packet.protocol_type)
+        if packet_type in self.black_list:
+            LOGGER.debug('Ignoring packet of type "%s"' % packet_type)
+            return
+
         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)))
+        if not len(self.packets):
+            LOGGER.error('Number of packets %d exceeded expected' %
+                (self.current_packet))
             self.test_object.set_passed(False)
             return
 
@@ -273,23 +360,23 @@
             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'])
+        if self.match_any:
+            i = 0
+            for expected_packet in self.packets:
+                if self.match_expected_packet(packet, expected_packet):
+                    LOGGER.debug('Found a match for packet %d' %
+                        self.current_packet)
+                    self.packets.remove(expected_packet)
+                    break
+                i += 1
+            else:
+                LOGGER.error('Failed to find match for packet %d: %s' %
+                    (self.current_packet, str(packet.__dict__)))
+                self.test_object.set_passed(False)
+        else:
+            expected_packet = self.packets.pop(0)
+            if not self.match_expected_packet(packet, expected_packet):
+                LOGGER.error('Failed to match packet %d: %s' %
+                    (self.current_packet, str(packet.__dict__)))
+                self.test_object.set_passed(False)
+

Modified: 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=diff&rev=5548&r1=5547&r2=5548
==============================================================================
--- asterisk/trunk/tests/hep/pjsip-auth/test-config.yaml (original)
+++ asterisk/trunk/tests/hep/pjsip-auth/test-config.yaml Fri Sep  5 18:41:32 2014
@@ -31,6 +31,8 @@
 
 hep-node-config:
     bind-port: '9999'
+    packet-blacklist:
+        - 'RTCP'
     packets:
         -
             ip_family: 2
@@ -204,5 +206,7 @@
         - asterisk : 'res_pjsip'
         - asterisk: 'res_hep'
         - asterisk: 'res_hep_pjsip'
+        - python: 'json'
+        - python: 'construct'
     tags:
         - pjsip

Modified: 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=diff&rev=5548&r1=5547&r2=5548
==============================================================================
--- asterisk/trunk/tests/hep/pjsip-ipv6/test-config.yaml (original)
+++ asterisk/trunk/tests/hep/pjsip-ipv6/test-config.yaml Fri Sep  5 18:41:32 2014
@@ -31,6 +31,8 @@
 
 hep-node-config:
     bind-port: '9999'
+    packet-blacklist:
+        - 'RTCP'
     packets:
         -
             ip_family: 10
@@ -198,5 +200,7 @@
         - asterisk : 'res_pjsip'
         - asterisk: 'res_hep'
         - asterisk: 'res_hep_pjsip'
+        - python: 'json'
+        - python: 'construct'
     tags:
         - pjsip

Modified: asterisk/trunk/tests/hep/pjsip/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/hep/pjsip/test-config.yaml?view=diff&rev=5548&r1=5547&r2=5548
==============================================================================
--- asterisk/trunk/tests/hep/pjsip/test-config.yaml (original)
+++ asterisk/trunk/tests/hep/pjsip/test-config.yaml Fri Sep  5 18:41:32 2014
@@ -30,6 +30,8 @@
 
 hep-node-config:
     bind-port: '9999'
+    packet-blacklist:
+        - 'RTCP'
     packets:
         -
             ip_family: 2
@@ -197,5 +199,7 @@
         - asterisk : 'res_pjsip'
         - asterisk: 'res_hep'
         - asterisk: 'res_hep_pjsip'
+        - python: 'json'
+        - python: 'construct'
     tags:
         - pjsip

Added: asterisk/trunk/tests/hep/rtcp-receiver/configs/ast1/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/hep/rtcp-receiver/configs/ast1/extensions.conf?view=auto&rev=5548
==============================================================================
--- asterisk/trunk/tests/hep/rtcp-receiver/configs/ast1/extensions.conf (added)
+++ asterisk/trunk/tests/hep/rtcp-receiver/configs/ast1/extensions.conf Fri Sep  5 18:41:32 2014
@@ -1,0 +1,15 @@
+
+[default]
+
+; -- Audio Source --
+
+exten => playback,1,NoOp()
+ same => n,Answer()
+ same => n,Playback(tt-monkeys)
+ same => n,Hangup()
+
+; -- Sender --
+
+exten => 1000,1,NoOp()
+ same => n,Dial(PJSIP/ast2)
+ same => n,Hangup()

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

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

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

Added: asterisk/trunk/tests/hep/rtcp-receiver/configs/ast1/hep.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/hep/rtcp-receiver/configs/ast1/hep.conf?view=auto&rev=5548
==============================================================================
--- asterisk/trunk/tests/hep/rtcp-receiver/configs/ast1/hep.conf (added)
+++ asterisk/trunk/tests/hep/rtcp-receiver/configs/ast1/hep.conf Fri Sep  5 18:41:32 2014
@@ -1,0 +1,4 @@
+[general]
+enabled = yes
+capture_address = 127.0.0.1:9998
+capture_id = 1

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

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

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

Added: asterisk/trunk/tests/hep/rtcp-receiver/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/hep/rtcp-receiver/configs/ast1/pjsip.conf?view=auto&rev=5548
==============================================================================
--- asterisk/trunk/tests/hep/rtcp-receiver/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/hep/rtcp-receiver/configs/ast1/pjsip.conf Fri Sep  5 18:41:32 2014
@@ -1,0 +1,18 @@
+[global]
+debug=yes
+
+[local-transport-udp]
+type=transport
+bind=127.0.0.1:5060
+protocol=udp
+
+[ast2]
+type=aor
+contact=sip:ast2 at 127.0.0.2:5060
+
+[ast2]
+type=endpoint
+aors=ast2
+context=default
+allow=!all,ulaw,alaw
+direct_media=no

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

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

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

Added: asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/extensions.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/extensions.conf?view=auto&rev=5548
==============================================================================
--- asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/extensions.conf (added)
+++ asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/extensions.conf Fri Sep  5 18:41:32 2014
@@ -1,0 +1,9 @@
+
+[default]
+
+; -- Receiver --
+
+exten => ast2,1,NoOp()
+ same => n,Answer()
+ same => n,Wait(1000)
+ same => n,Hangup()

Propchange: asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/extensions.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/extensions.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/extensions.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/hep.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/hep.conf?view=auto&rev=5548
==============================================================================
--- asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/hep.conf (added)
+++ asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/hep.conf Fri Sep  5 18:41:32 2014
@@ -1,0 +1,4 @@
+[general]
+enabled = yes
+capture_address = 127.0.0.1:9999
+capture_id = 2

Propchange: asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/hep.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/hep.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/hep.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/pjsip.conf?view=auto&rev=5548
==============================================================================
--- asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/pjsip.conf (added)
+++ asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/pjsip.conf Fri Sep  5 18:41:32 2014
@@ -1,0 +1,24 @@
+[global]
+debug=yes
+
+[local-transport-udp]
+type=transport
+bind=127.0.0.2:5060
+protocol=udp
+
+[ast1]
+type=identify
+endpoint=ast1
+match=127.0.0.1
+
+[ast1]
+type=aor
+contact=sip:ast1 at 127.0.0.1:5060
+
+[ast1]
+type=endpoint
+aors=ast1
+context=default
+allow=!all,ulaw,alaw
+direct_media=no
+

Propchange: asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/pjsip.conf
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/pjsip.conf
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Propchange: asterisk/trunk/tests/hep/rtcp-receiver/configs/ast2/pjsip.conf
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/hep/rtcp-receiver/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/hep/rtcp-receiver/test-config.yaml?view=auto&rev=5548
==============================================================================
--- asterisk/trunk/tests/hep/rtcp-receiver/test-config.yaml (added)
+++ asterisk/trunk/tests/hep/rtcp-receiver/test-config.yaml Fri Sep  5 18:41:32 2014
@@ -1,0 +1,344 @@
+testinfo:
+    summary:     'Tests HEP with RTCP (one sender, one receiver)'
+    description: |
+        This test validates Asterisk sending RTCP information encoded
+        in JSON over the Homer Encapsulation Protocol (HEP). The
+        test runs a basic call using Asterisk's PJSIP stack. One end
+        of the call plays a sound file (tt-monkeys) while the other
+        end deliberately absorbs all audio, sending nothing back.
+        This results in SR packets being generated by the Asterisk
+        instance sending audio, and RR packets by the Asterisk instance
+        receiving the audio. The test verifies that both Asterisk
+        instances send their respective RTCP packets to HEP (both
+        what they sent and what they received).
+
+test-modules:
+    add-to-search-path:
+        -
+            'tests/hep'
+    test-object:
+        config-section: test-object-config
+        typename: 'test_case.TestCaseModule'
+    modules:
+        -
+            typename: 'pluggable_modules.Originator'
+            config-section: originator-config
+        -
+            typename: 'hep_capture_node.HEPCaptureNode'
+            config-section: hep-node-config-ast1
+        -
+            typename: 'hep_capture_node.HEPCaptureNode'
+            config-section: hep-node-config-ast2
+        -
+            config-section: 'hangup-monitor'
+            typename: 'pluggable_modules.HangupMonitor'
+
+test-object-config:
+    asterisk-instances: 2
+    connect-ami: True
+
+hangup-monitor:
+    ids: '0'
+
+originator-config:
+    channel: 'Local/1000 at default'
+    exten: 'playback'
+    context: 'default'
+    priority: 1
+    async: True
+    trigger: 'ami_connect'
+    async: True
+
+hep-node-config-ast1:
+    bind-port: 9998
+    match-any: True
+    packet-blacklist:
+        - 'SIP'
+    packets:
+        -
+            ip_family: 2
+            uuid: 'PJSIP/ast2-00000000'
+            # See http://blogs.msdn.com/b/oldnewthing/archive/2006/05/22/603788.aspx
+            # for why this is a terrible idea. Really, all we care about is that:
+            # (a) we have something in the src/dst addr fields
+            # (b) that something is not 0.0.0.0
+            src_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            dst_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            protocol_type: 5
+            capture_agent_id: 1
+            ip_id: 17
+            payload:
+                decode: 'RTCP'
+                value:
+                    { ssrc: "\\d.*",
+                      type: 201,
+                      report_blocks:[ { source_ssrc: "\\d.*",
+                                        highest_seq_no: "\\d.*",
+                                        fraction_lost: 0,
+                                        ia_jitter: "\\d.*",
+                                        packets_lost: 0,
+                                        lsr: "\\d.*",
+                                        dlsr: "\\d.*" }, ],
+                      report_count: 1,
+                    }
+        -
+            ip_family: 2
+            uuid: 'PJSIP/ast2-00000000'
+            src_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            dst_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            protocol_type: 5
+            capture_agent_id: 1
+            ip_id: 17
+            payload:
+                decode: 'RTCP'
+                value:
+                    { sender_information: { ntp_timestamp_sec: "\\d.*",
+                                            packets: "\\d.*",
+                                            ntp_timestamp_usec: "\\d.*",
+                                            octets: "\\d.*",
+                                            rtp_timestamp: "\\d.*", },
+                      ssrc: "\\d.*",
+                      type: 200,
+                      report_blocks: [],
+                      report_count: 0
+                    }
+        -
+            ip_family: 2
+            uuid: 'PJSIP/ast2-00000000'
+            src_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            dst_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            protocol_type: 5
+            capture_agent_id: 1
+            ip_id: 17
+            payload:
+                decode: 'RTCP'
+                value:
+                    { sender_information: { ntp_timestamp_sec: "\\d.*",
+                                            packets: "\\d.*",
+                                            ntp_timestamp_usec: "\\d.*",
+                                            octets: "\\d.*",
+                                            rtp_timestamp: "\\d.*", },
+                      ssrc: "\\d.*",
+                      type: 200,
+                      report_blocks: [],
+                      report_count: 0
+                    }
+        -
+            ip_family: 2
+            uuid: 'PJSIP/ast2-00000000'
+            src_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            dst_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            protocol_type: 5
+            capture_agent_id: 1
+            ip_id: 17
+            payload:
+                decode: 'RTCP'
+                value:
+                    { ssrc: "\\d.*",
+                      type: 201,
+                      report_blocks:[ { source_ssrc: "\\d.*",
+                                        highest_seq_no: "\\d.*",
+                                        fraction_lost: 0,
+                                        ia_jitter: "\\d.*",
+                                        packets_lost: 0,
+                                        lsr: "\\d.*",
+                                        dlsr: "\\d.*" }, ],
+                      report_count: 1,
+                    }
+        -
+            ip_family: 2
+            uuid: 'PJSIP/ast2-00000000'
+            src_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            dst_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            protocol_type: 5
+            capture_agent_id: 1
+            ip_id: 17
+            payload:
+                decode: 'RTCP'
+                value:
+                    { sender_information: { ntp_timestamp_sec: "\\d.*",
+                                            packets: "\\d.*",
+                                            ntp_timestamp_usec: "\\d.*",
+                                            octets: "\\d.*",
+                                            rtp_timestamp: "\\d.*", },
+                      ssrc: "\\d.*",
+                      type: 200,
+                      report_blocks: [],
+                      report_count: 0
+                    }
+        -
+            ip_family: 2
+            uuid: 'PJSIP/ast2-00000000'
+            src_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            dst_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            protocol_type: 5
+            capture_agent_id: 1
+            ip_id: 17
+            payload:
+                decode: 'RTCP'
+                value:
+                    { ssrc: "\\d.*",
+                      type: 201,
+                      report_blocks:[ { source_ssrc: "\\d.*",
+                                        highest_seq_no: "\\d.*",
+                                        fraction_lost: 0,
+                                        ia_jitter: "\\d.*",
+                                        packets_lost: 0,
+                                        lsr: "\\d.*",
+                                        dlsr: "\\d.*" }, ],
+                      report_count: 1,
+                    }
+
+
+hep-node-config-ast2:
+    bind-port: 9999
+    match-any: True
+    packet-blacklist:
+        - 'SIP'
+    packets:
+        -
+            ip_family: 2
+            uuid: 'PJSIP/ast1-00000000'
+            # See http://blogs.msdn.com/b/oldnewthing/archive/2006/05/22/603788.aspx
+            # for why this is a terrible idea. Really, all we care about is that:
+            # (a) we have something in the src/dst addr fields
+            # (b) that something is not 0.0.0.0
+            src_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            dst_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            protocol_type: 5
+            capture_agent_id: 2
+            ip_id: 17
+            payload:
+                decode: 'RTCP'
+                value:
+                    { ssrc: "\\d.*",
+                      type: 201,
+                      report_blocks: [ { source_ssrc: "\\d.*",
+                                         highest_seq_no: "\\d.*",
+                                         fraction_lost: 0,
+                                         ia_jitter: "\\d.*",
+                                         packets_lost: 0,
+                                         lsr: "\\d.*",
+                                         dlsr: "\\d.*",
+                                        } ],
+                      report_count: 1
+                    }
+        -
+            ip_family: 2
+            uuid: 'PJSIP/ast1-00000000'
+            src_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            dst_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            protocol_type: 5
+            capture_agent_id: 2
+            ip_id: 17
+            payload:
+                decode: 'RTCP'
+                value:
+                    { sender_information: { ntp_timestamp_sec: "\\d.*",
+                                            packets: "\\d.*",
+                                            ntp_timestamp_usec: "\\d.*",
+                                            octets: "\\d.*",
+                                            rtp_timestamp: "\\d.*", },
+                      ssrc: "\\d.*",
+                      type: 200,
+                      report_blocks: [],
+                      report_count: 0
+                    }
+        -
+            ip_family: 2
+            uuid: 'PJSIP/ast1-00000000'
+            src_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            dst_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            protocol_type: 5
+            capture_agent_id: 2
+            ip_id: 17
+            payload:
+                decode: 'RTCP'
+                value:
+                    { ssrc: "\\d.*",
+                      type: 201,
+                      report_blocks: [ { source_ssrc: "\\d.*",
+                                         highest_seq_no: "\\d.*",
+                                         fraction_lost: 0,
+                                         ia_jitter: "\\d.*",
+                                         packets_lost: 0,
+                                         lsr: "\\d.*",
+                                         dlsr: "\\d.*",
+                                        } ],
+                      report_count: 1
+                    }
+        -
+            ip_family: 2
+            uuid: 'PJSIP/ast1-00000000'
+            src_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            dst_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            protocol_type: 5
+            capture_agent_id: 2
+            ip_id: 17
+            payload:
+                decode: 'RTCP'
+                value:
+                    { sender_information: { ntp_timestamp_sec: "\\d.*",
+                                            packets: "\\d.*",
+                                            ntp_timestamp_usec: "\\d.*",
+                                            octets: "\\d.*",
+                                            rtp_timestamp: "\\d.*", },
+                      ssrc: "\\d.*",
+                      type: 200,
+                      report_blocks: [],
+                      report_count: 0
+                    }
+        -
+            ip_family: 2
+            uuid: 'PJSIP/ast1-00000000'
+            src_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            dst_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            protocol_type: 5
+            capture_agent_id: 2
+            ip_id: 17
+            payload:
+                decode: 'RTCP'
+                value:
+                    { ssrc: "\\d.*",
+                      type: 201,
+                      report_blocks: [ { source_ssrc: "\\d.*",
+                                         highest_seq_no: "\\d.*",
+                                         fraction_lost: 0,
+                                         ia_jitter: "\\d.*",
+                                         packets_lost: 0,
+                                         lsr: "\\d.*",
+                                         dlsr: "\\d.*",
+                                        } ],
+                      report_count: 1
+                    }
+        -
+            ip_family: 2
+            uuid: 'PJSIP/ast1-00000000'
+            src_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            dst_addr: '[1-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[1-9]{1,3}'
+            protocol_type: 5
+            capture_agent_id: 2
+            ip_id: 17
+            payload:
+                decode: 'RTCP'
+                value:
+                    { sender_information: { ntp_timestamp_sec: "\\d.*",
+                                            packets: "\\d.*",
+                                            ntp_timestamp_usec: "\\d.*",
+                                            octets: "\\d.*",
+                                            rtp_timestamp: "\\d.*", },
+                      ssrc: "\\d.*",

[... 650 lines stripped ...]



More information about the asterisk-commits mailing list