[asterisk-commits] mmichelson: testsuite/asterisk/trunk r5603 - in /asterisk/trunk/tests/channel...

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Thu Sep 18 14:31:57 CDT 2014


Author: mmichelson
Date: Thu Sep 18 14:31:52 2014
New Revision: 5603

URL: http://svnview.digium.com/svn/testsuite?view=rev&rev=5603
Log:
Add RLS batched notification tests.

For more information on what these tests entail, see the following pages:
https://reviewboard.asterisk.org/r/3966/
https://wiki.asterisk.org/wiki/display/AST/Resource+List+Subscription+Test+Plan

ASTERISK-23874 #close

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


Added:
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/configs/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/driver.py   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/sipp/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/sipp/subscribe.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/multiple_resources_single_change/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/multiple_resources_single_change/configs/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/multiple_resources_single_change/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/multiple_resources_single_change/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/multiple_resources_single_change/driver.py   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/multiple_resources_single_change/sipp/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/multiple_resources_single_change/sipp/subscribe.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/multiple_resources_single_change/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/resubscription_interruption/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/resubscription_interruption/configs/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/resubscription_interruption/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/resubscription_interruption/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/resubscription_interruption/driver.py   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/resubscription_interruption/sipp/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/resubscription_interruption/sipp/subscribe.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/resubscription_interruption/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/single_resource_multiple_changes/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/single_resource_multiple_changes/configs/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/single_resource_multiple_changes/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/single_resource_multiple_changes/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/single_resource_multiple_changes/driver.py   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/single_resource_multiple_changes/sipp/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/single_resource_multiple_changes/sipp/subscribe.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/single_resource_multiple_changes/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/termination_interruption/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/termination_interruption/configs/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/termination_interruption/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/termination_interruption/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/termination_interruption/driver.py   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/termination_interruption/sipp/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/termination_interruption/sipp/subscribe.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/termination_interruption/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/tests.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/basic/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/basic/configs/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/basic/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/basic/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/basic/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/basic/driver.py   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/basic/sipp/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/basic/sipp/subscribe.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/basic/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/multiple_resources_single_change/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/multiple_resources_single_change/configs/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/multiple_resources_single_change/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/multiple_resources_single_change/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/multiple_resources_single_change/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/multiple_resources_single_change/driver.py   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/multiple_resources_single_change/sipp/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/multiple_resources_single_change/sipp/subscribe.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/multiple_resources_single_change/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/resubscription_interruption/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/resubscription_interruption/configs/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/resubscription_interruption/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/resubscription_interruption/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/resubscription_interruption/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/resubscription_interruption/driver.py   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/resubscription_interruption/sipp/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/resubscription_interruption/sipp/subscribe.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/resubscription_interruption/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/single_resource_multiple_changes/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/single_resource_multiple_changes/configs/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/single_resource_multiple_changes/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/single_resource_multiple_changes/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/single_resource_multiple_changes/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/single_resource_multiple_changes/driver.py   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/single_resource_multiple_changes/sipp/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/single_resource_multiple_changes/sipp/subscribe.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/single_resource_multiple_changes/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/termination_interruption/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/termination_interruption/configs/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/termination_interruption/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/termination_interruption/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/termination_interruption/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/termination_interruption/driver.py   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/termination_interruption/sipp/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/termination_interruption/sipp/subscribe.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/termination_interruption/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/batched/tests.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/batched/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/batched/configs/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/batched/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/batched/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/batched/driver.py   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/batched/sipp/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/batched/sipp/subscribe.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/batched/test-config.yaml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/batched/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/batched/configs/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/batched/configs/ast1/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/batched/configs/ast1/extensions.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/batched/configs/ast1/pjsip.conf   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/batched/driver.py   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/batched/sipp/
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/batched/sipp/subscribe.xml   (with props)
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/batched/test-config.yaml   (with props)
Modified:
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/tests.yaml
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/tests.yaml
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/tests.yaml
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/tests.yaml
    asterisk/trunk/tests/channels/pjsip/subscriptions/rls/rls_test.py

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/configs/ast1/pjsip.conf?view=auto&rev=5603
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/configs/ast1/pjsip.conf Thu Sep 18 14:31:52 2014
@@ -1,0 +1,27 @@
+[global]
+type = global
+debug = yes
+
+[local-transport]
+type = transport
+protocol = udp
+bind = 127.0.0.1:5060
+
+[mail_list]
+type = resource_list
+event = message-summary
+list_item = alice
+list_item = bob
+full_state = no
+notification_batch_interval = 5000
+
+[sipp]
+type = endpoint
+
+[alice]
+type = aor
+mailboxes = alice
+
+[bob]
+type = aor
+mailboxes = bob

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

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

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

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/driver.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/driver.py?view=auto&rev=5603
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/driver.py (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/driver.py Thu Sep 18 14:31:52 2014
@@ -1,0 +1,126 @@
+#!/usr/bin/env python
+
+import time
+import logging
+
+LOGGER = logging.getLogger(__name__)
+
+# These are the states that are moved through during the tests. They are listed
+# here in the order that they occur throughout the test.
+
+# Initial state before subscription establishment.
+UNESTABLISHED = 1
+
+# This state is entered after initial SUBSCRIBE-NOTIFY exchange has occurred.
+ESTABLISHED = 2
+
+# This state is entered after Alice's MWI NOTIFY has been received.
+ALICE_STATE = 3
+
+# This state is entered after the SUBSCRIBE-NOTIFY exchange for subscription
+# refresh has occurred.
+REFRESHED = 4
+
+# This state is entered after Bob's MWI NOTIFY has been received.
+BOB_STATE = 5
+
+# This state is entered after SUBSCRIBE-NOTIFY exchange to terminate
+# subscription has occurred.
+TERMINATED = 6
+
+
+class TestDriver(object):
+    def __init__(self, module_config, test_object):
+        self.ami = None
+        self.state = UNESTABLISHED
+        self.test_object = test_object
+        self.alice_time = 0.0
+        self.bob_time = 0.0
+        test_object.register_ami_observer(self.ami_connect)
+
+    def fail_test(self):
+        self.test_object.set_passed(False)
+        self.test_object.stop_reactor()
+
+    def ami_connect(self, ami):
+        self.ami = ami
+        self.ami.registerEvent('TestEvent', self.on_test_event)
+
+    def on_test_event(self, ami, event):
+        state = event['state']
+        if state == 'SUBSCRIPTION_ESTABLISHED':
+            self.on_subscription_established()
+        elif state == 'SUBSCRIPTION_REFRESHED':
+            self.on_subscription_refreshed()
+        elif state == 'SUBSCRIPTION_TERMINATED':
+            self.on_subscription_terminated()
+        elif state == 'SUBSCRIPTION_STATE_CHANGED':
+            self.on_subscription_state_change()
+
+    def on_subscription_established(self):
+        if self.state != UNESTABLISHED:
+            LOGGER.error("Unexpected state change from {0}. Expected state "
+                         "{1}".format(self.state, UNESTABLISHED))
+            self.fail_test()
+
+        LOGGER.debug("State change to {0}".format(ESTABLISHED))
+        self.state = ESTABLISHED
+        self.alice_time = time.time()
+        message = {
+            'Action': 'MWIUpdate',
+            'Mailbox': 'alice',
+            'NewMessages': '1',
+            'OldMessages': '0',
+        }
+        self.ami.sendMessage(message)
+
+    def on_subscription_state_change(self):
+        if self.state != ESTABLISHED and self.state != REFRESHED:
+            LOGGER.error("Unexpected state change from {0}. Expected state "
+                         "{1} or {2}".format(self.state, ESTABLISHED,
+                                             REFRESHED))
+            self.fail_test()
+
+        if self.state == ESTABLISHED:
+            interval = time.time() - self.alice_time
+            if interval < 5.0:
+                LOGGER.error("Interval {0} too brief".format(interval))
+                self.fail_test()
+            LOGGER.debug("State change to {0}".format(ALICE_STATE))
+            self.state = ALICE_STATE
+        if self.state == REFRESHED:
+            interval = time.time() - self.bob_time
+            if time.time() - self.bob_time < 5.0:
+                LOGGER.error("Interval {0} too brief".format(interval))
+                self.fail_test()
+            LOGGER.debug("State change to {0}".format(BOB_STATE))
+            self.state = BOB_STATE
+
+    def on_subscription_refreshed(self):
+        if self.state != ALICE_STATE:
+            LOGGER.error("Unexpected state change from {0}. Expected state "
+                         "{1}".format(self.state, ALICE_STATE))
+            self.fail_test()
+
+        LOGGER.debug("State change to {0}".format(REFRESHED))
+        self.state = REFRESHED
+        self.bob_time = time.time()
+        message = {
+            'Action': 'MWIUpdate',
+            'Mailbox': 'bob',
+            'NewMessages': '1',
+            'OldMessages': '0',
+        }
+        self.ami.sendMessage(message)
+
+    def on_subscription_terminated(self):
+        if self.state != BOB_STATE:
+            LOGGER.error("Unexpected state change from {0}. Expected state "
+                         "{1}".format(self.state, BOB_STATE))
+            self.fail_test()
+
+        LOGGER.debug("State change to {0}".format(TERMINATED))
+        self.state = TERMINATED
+        # If we've made it here, then the test has passed!
+        self.test_object.set_passed(True)
+        self.test_object.stop_reactor()

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/driver.py
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/driver.py
------------------------------------------------------------------------------
    svn:executable = *

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/driver.py
------------------------------------------------------------------------------
    svn:keywords = 'Author Date Id Revision'

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/driver.py
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/sipp/subscribe.xml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/sipp/subscribe.xml?view=auto&rev=5603
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/sipp/subscribe.xml (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/sipp/subscribe.xml Thu Sep 18 14:31:52 2014
@@ -1,0 +1,215 @@
+<?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: message-summary
+      Supported: eventlist
+      Accept: application/rlmi+xml
+      Accept: application/simple-message-summary
+      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>
+
+  <!-- Initial NOTIFY upon subscribing -->
+  <recv request="NOTIFY" crlf="true">
+      <action>
+          <ereg regexp="eventlist" search_in="hdr" header="Require:" check_it="true" assign_to="1" />
+      </action>
+  </recv>
+
+  <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>
+
+  <!-- NOTIFY upon changing Alice's state -->
+  <recv request="NOTIFY" crlf="true">
+      <action>
+          <ereg regexp="eventlist" search_in="hdr" header="Require:" check_it="true" assign_to="1" />
+      </action>
+  </recv>
+
+  <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>
+
+  <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]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: [cseq] SUBSCRIBE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Event: message-summary
+      Supported: eventlist
+      Accept: application/rlmi+xml
+      Accept: application/simple-message-summary
+      Accept: multipart/related
+      Expires: 3600
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <!-- NOTIFY upon resubscription -->
+  <recv request="NOTIFY" crlf="true">
+      <action>
+          <ereg regexp="eventlist" search_in="hdr" header="Require:" check_it="true" assign_to="1" />
+          <ereg regexp=".*" search_in="hdr" header="From:" assign_to="notify_from" />
+          <ereg regexp=".*" search_in="hdr" header="To:" assign_to="notify_to" />
+          <ereg regexp=".*" search_in="hdr" header="Via:" assign_to="notify_via" />
+          <ereg regexp=".*" search_in="hdr" header="CSeq:" assign_to="notify_cseq" />
+      </action>
+  </recv>
+
+  <recv response="200" crlf="true">
+      <action>
+          <ereg regexp="eventlist" search_in="hdr" header="Require:" check_it="true" assign_to="1" />
+      </action>
+  </recv>
+
+  <send>
+    <![CDATA[
+
+      SIP/2.0 200 OK
+      Via: [$notify_via]
+      From: [$notify_from]
+      To: [$notify_to]
+      [last_Call-ID:]
+      CSeq: [$notify_cseq]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <!--- NOTIFY upon changing Bob's state -->
+  <recv request="NOTIFY" crlf="true">
+      <action>
+          <ereg regexp="eventlist" search_in="hdr" header="Require:" check_it="true" assign_to="1" />
+      </action>
+  </recv>
+
+  <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>
+
+  <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]>[peer_tag_param]
+      Call-ID: [call_id]
+      CSeq: [cseq] SUBSCRIBE
+      Contact: sip:sipp@[local_ip]:[local_port]
+      Max-Forwards: 70
+      Subject: Performance Test
+      Event: message-summary
+      Supported: eventlist
+      Accept: application/rlmi+xml
+      Accept: application/simple-message-summary
+      Accept: multipart/related
+      Expires: 0
+      Content-Length: 0
+
+    ]]>
+  </send>
+
+  <!-- NOTIFY upon termination -->
+  <recv request="NOTIFY" crlf="true">
+      <action>
+          <ereg regexp="eventlist" search_in="hdr" header="Require:" check_it="true" assign_to="1" />
+          <ereg regexp=".*" search_in="hdr" header="From:" assign_to="notify_from" />
+          <ereg regexp=".*" search_in="hdr" header="To:" assign_to="notify_to" />
+          <ereg regexp=".*" search_in="hdr" header="Via:" assign_to="notify_via" />
+          <ereg regexp=".*" search_in="hdr" header="CSeq:" assign_to="notify_cseq" />
+      </action>
+  </recv>
+
+  <recv response="200" 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
+      Via: [$notify_via]
+      From: [$notify_from]
+      To: [$notify_to]
+      [last_Call-ID:]
+      CSeq: [$notify_cseq]
+      Contact: <sip:[local_ip]:[local_port];transport=[transport]>
+      Content-Length: 0
+
+    ]]>
+  </send>
+</scenario>

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/sipp/subscribe.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/sipp/subscribe.xml
------------------------------------------------------------------------------
    svn:keywords = 'Author Date Id Revision'

Propchange: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/sipp/subscribe.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/test-config.yaml
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/test-config.yaml?view=auto&rev=5603
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/test-config.yaml (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/basic/test-config.yaml Thu Sep 18 14:31:52 2014
@@ -1,0 +1,80 @@
+testinfo:
+    summary: 'Ensure that in a basic scenario, notifications are batched when appropriate.'
+    description: |
+        'This runs a basic scenario that does the following:
+         * A SIPp scenario subscribes to a resource list with notification batching enabled.
+         * A state change occurs on one of the resources in the list.
+         * After the batching period, a NOTIFY is sent to the scenario.
+         * The SIPp scenario resubscribes to the resource.
+         * A state change occurs on one of the resources in the list.
+         * After the batching period, a NOTIFY is sent to the scenario.
+         * The SIpp scneario terminates its subscription to the resource.
+         The important part is that the NOTIFYs that Asterisk sends in response to SUBSCRIBE
+         request are not delayed by the batching interval but that the NOTIFYs that Asterisk
+         sends in response to state changes are delayed.'
+
+properties:
+    minversion: '13.0.0'
+    dependencies:
+        - python: 'twisted'
+        - python: 'starpy'
+        - python: 'yappcap'
+        - python: 'pyxb'
+        - asterisk: 'res_pjsip'
+        - asterisk: 'res_pjsip_pubsub'
+        - asterisk: 'res_pjsip_mwi'
+        - asterisk: 'res_mwi_external'
+        - asterisk: 'res_mwi_external_ami'
+    tags:
+        - rls
+        - pjsip
+        - mwi_external
+
+test-modules:
+    add-test-to-search-path: 'True'
+    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'
+        -
+            typename: 'driver.TestDriver'
+
+test-case-config:
+    test-iterations:
+        -
+            scenarios:
+                - { 'key-args': {'scenario': 'subscribe.xml', '-i': '127.0.0.1', '-p': '5061', '-s': 'mail_list'} }
+
+test-config:
+    list_name: 'mail_list'
+    resources:
+        -
+            { 'alice': {'type': 'MWI', 'state': 'active', 'voice_message': '0/0 (0/0)', 'messages_waiting': 'no'},
+              'bob': {'type': 'MWI', 'state': 'active', 'voice_message': '0/0 (0/0)', 'messages_waiting': 'no'} }
+        -
+            { 'alice': {'type': 'MWI', 'state': 'active', 'voice_message': '1/0 (0/0)', 'messages_waiting': 'yes'}}
+        -
+            { 'alice': {'type': 'MWI', 'state': 'active', 'voice_message': '1/0 (0/0)', 'messages_waiting': 'yes'},
+              'bob': {'type': 'MWI', 'state': 'active', 'voice_message': '0/0 (0/0)', 'messages_waiting': 'no'} }
+        -
+            { 'bob': {'type': 'MWI', 'state': 'active', 'voice_message': '1/0 (0/0)', 'messages_waiting': 'yes'} }
+        -
+            { 'alice': {'type': 'MWI', 'state': 'terminated', 'voice_message': '1/0 (0/0)', 'messages_waiting': 'yes'},
+              'bob': {'type': 'MWI', 'state': 'terminated', 'voice_message': '1/0 (0/0)', 'messages_waiting': 'yes'} }
+    full_state:
+        -
+            True
+        -
+            False
+        -
+            True
+        -
+            False
+        -
+            True

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

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

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

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/multiple_resources_single_change/configs/ast1/pjsip.conf
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/multiple_resources_single_change/configs/ast1/pjsip.conf?view=auto&rev=5603
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/multiple_resources_single_change/configs/ast1/pjsip.conf (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/multiple_resources_single_change/configs/ast1/pjsip.conf Thu Sep 18 14:31:52 2014
@@ -1,0 +1,27 @@
+[global]
+type = global
+debug = yes
+
+[local-transport]
+type = transport
+protocol = udp
+bind = 127.0.0.1:5060
+
+[mail_list]
+type = resource_list
+event = message-summary
+list_item = alice
+list_item = bob
+full_state = no
+notification_batch_interval = 5000
+
+[sipp]
+type = endpoint
+
+[alice]
+type = aor
+mailboxes = alice
+
+[bob]
+type = aor
+mailboxes = bob

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

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

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

Added: asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/multiple_resources_single_change/driver.py
URL: http://svnview.digium.com/svn/testsuite/asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/multiple_resources_single_change/driver.py?view=auto&rev=5603
==============================================================================
--- asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/multiple_resources_single_change/driver.py (added)
+++ asterisk/trunk/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/batched/multiple_resources_single_change/driver.py Thu Sep 18 14:31:52 2014
@@ -1,0 +1,132 @@
+#!/usr/bin/env python
+
+import time
+import logging
+
+LOGGER = logging.getLogger(__name__)
+
+# These are the states that are moved through during the tests. They are listed
+# here in the order that they occur throughout the test.
+
+# Initial state before subscription establishment.
+UNESTABLISHED = 1
+
+# This state is entered after initial SUBSCRIBE-NOTIFY exchange has occurred.
+ESTABLISHED = 2
+
+# This state is entered after the NOTIFY setting Alice and Bob to have one new
+# message has been received.
+ONE_MESSAGE = 3
+
+# This state is entered after the SUBSCRIBE-NOTIFY exchange for subscription
+# refresh has occurred.
+REFRESHED = 4
+
+# This state is entered after the NOTIFY setting Alice and Bob to have two new
+# messages has been received.
+TWO_MESSAGES = 5
+
+# This state is entered after SUBSCRIBE-NOTIFY exchange to terminate
+# subscription has occurred.
+TERMINATED = 6
+
+
+class TestDriver(object):
+    def __init__(self, module_config, test_object):
+        self.ami = None
+        self.state = UNESTABLISHED
+        self.test_object = test_object
+        self.alice_time = 0.0
+        self.bob_time = 0.0
+        test_object.register_ami_observer(self.ami_connect)
+
+    def fail_test(self):
+        self.test_object.set_passed(False)
+        self.test_object.stop_reactor()
+
+    def ami_connect(self, ami):
+        self.ami = ami
+        self.ami.registerEvent('TestEvent', self.on_test_event)
+
+    def on_test_event(self, ami, event):
+        state = event['state']
+        if state == 'SUBSCRIPTION_ESTABLISHED':
+            self.on_subscription_established()
+        elif state == 'SUBSCRIPTION_REFRESHED':
+            self.on_subscription_refreshed()
+        elif state == 'SUBSCRIPTION_TERMINATED':
+            self.on_subscription_terminated()
+        elif state == 'SUBSCRIPTION_STATE_CHANGED':
+            self.on_subscription_state_change()
+
+    def on_subscription_established(self):
+        if self.state != UNESTABLISHED:
+            LOGGER.error("Unexpected state change from {0}. Expected state "
+                         "{1}".format(self.state, UNESTABLISHED))
+            self.fail_test()
+
+        LOGGER.debug("State change to {0}".format(ESTABLISHED))
+        self.state = ESTABLISHED
+        self.alice_time = time.time()
+        message = {
+            'Action': 'MWIUpdate',
+            'Mailbox': 'alice',
+            'NewMessages': '1',
+            'OldMessages': '0'
+        }
+        self.ami.sendMessage(message)
+        message['Mailbox'] = 'bob'
+        self.ami.sendMessage(message)
+
+    def on_subscription_state_change(self):
+        if self.state != ESTABLISHED and self.state != REFRESHED:
+            LOGGER.error("Unexpected state change from {0}. Expected state "
+                         "{1} or {2}".format(self.state, ESTABLISHED,
+                                             REFRESHED))

[... 5062 lines stripped ...]



More information about the asterisk-commits mailing list