<p>Jenkins2 <strong>merged</strong> this change.</p><p><a href="https://gerrit.asterisk.org/10356">View Change</a></p><div style="white-space:pre-wrap">Approvals:
George Joseph: Looks good to me, approved
Jenkins2: Approved for Submit
</div><pre style="font-family: monospace,monospace; white-space: pre-wrap;">pjsip: Improve RLS test stability.<br><br>The mechanism used for TLS testing has the ability to execute AMI<br>actions on a time basis (specifically every 2 seconds). This caused<br>a problem with tests as Asterisk would take some time to start and<br>the SUBSCRIBE would take some time. This would result in the initial<br>NOTIFY being different than the expected value.<br><br>This change adds the ability to execute an AMI action after receiving<br>an RLS NOTIFY which makes the result more predictable and the tests<br>more stable.<br><br>Change-Id: I900448aec7aa23012566e41cd15dadf969c004bc<br>---<br>M tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/full_state/test-config.yaml<br>M tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/partial_state/test-config.yaml<br>M tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/test-config.yaml<br>M tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/test-config.yaml<br>M tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/full_state_alice/test-config.yaml<br>M tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/full_state_carol/test-config.yaml<br>M tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/partial_state_alice/test-config.yaml<br>M tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/partial_state_carol/test-config.yaml<br>M tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/full_state_alice/test-config.yaml<br>M tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/full_state_carol/test-config.yaml<br>M tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/partial_state_alice/test-config.yaml<br>M tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/partial_state_carol/test-config.yaml<br>M tests/channels/pjsip/subscriptions/rls/rls_test.py<br>13 files changed, 21 insertions(+), 40 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/full_state/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/full_state/test-config.yaml</span><br><span>index 98437ce..b5f02a5 100644</span><br><span>--- a/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/full_state/test-config.yaml</span><br><span>+++ b/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/full_state/test-config.yaml</span><br><span>@@ -47,9 +47,7 @@</span><br><span> -</span><br><span> full-state: True</span><br><span> 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'} }</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-action: { 'action': 'MWIUpdate', 'Mailbox': 'alice@default', 'NewMessages': '1', 'OldMessages': '2' }</span><br><span> -</span><br><span> full-state: True</span><br><span> resources: { 'alice': {'type': 'MWI', 'state': 'active', 'voice_message': '1/2 (0/0)', 'messages_waiting': 'yes'}, 'bob': {'type': 'MWI', 'state': 'active', 'voice_message': '0/0 (0/0)', 'messages_waiting': 'no'} }</span><br><span style="color: hsl(0, 100%, 40%);">- ami-action:</span><br><span style="color: hsl(0, 100%, 40%);">- -</span><br><span style="color: hsl(0, 100%, 40%);">- { 'action': 'MWIUpdate', 'Mailbox': 'alice@default', 'NewMessages': '1', 'OldMessages': '2' }</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/partial_state/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/partial_state/test-config.yaml</span><br><span>index 7d20062..3d806b4 100644</span><br><span>--- a/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/partial_state/test-config.yaml</span><br><span>+++ b/tests/channels/pjsip/subscriptions/rls/lists/nominal/mwi/partial_state/test-config.yaml</span><br><span>@@ -60,6 +60,7 @@</span><br><span> 'messages_waiting': 'no'</span><br><span> }</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-action: { 'action': 'MWIUpdate', 'Mailbox': 'alice@default', 'NewMessages': '1', 'OldMessages': '2' }</span><br><span> -</span><br><span> full-state: False</span><br><span> resources: {</span><br><span>@@ -70,6 +71,3 @@</span><br><span> 'messages_waiting': 'yes'</span><br><span> }</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- ami-action:</span><br><span style="color: hsl(0, 100%, 40%);">- -</span><br><span style="color: hsl(0, 100%, 40%);">- { 'action': 'MWIUpdate', 'Mailbox': 'alice@default', 'NewMessages': '1', 'OldMessages': '2' }</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/test-config.yaml</span><br><span>index 9cfbedd..423dc61 100644</span><br><span>--- a/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/test-config.yaml</span><br><span>+++ b/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/full_state/test-config.yaml</span><br><span>@@ -45,9 +45,7 @@</span><br><span> -</span><br><span> full-state: True</span><br><span> resources: { 'alice': {'type': 'PIDF', 'state': 'active'}, 'bob': {'type': 'PIDF', 'state': 'active'} }</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-action: { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:alice)', 'Value': 'INUSE' }</span><br><span> -</span><br><span> full-state: True</span><br><span> resources: { 'alice': {'type': 'PIDF', 'state': 'active'}, 'bob': {'type': 'PIDF', 'state': 'active'} }</span><br><span style="color: hsl(0, 100%, 40%);">- ami-action:</span><br><span style="color: hsl(0, 100%, 40%);">- -</span><br><span style="color: hsl(0, 100%, 40%);">- { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:alice)', 'Value': 'INUSE' }</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/test-config.yaml</span><br><span>index 2c731d6..4aa4926 100644</span><br><span>--- a/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/test-config.yaml</span><br><span>+++ b/tests/channels/pjsip/subscriptions/rls/lists/nominal/presence/partial_state/test-config.yaml</span><br><span>@@ -46,9 +46,7 @@</span><br><span> -</span><br><span> full-state: True</span><br><span> resources: { 'alice': {'type': 'PIDF', 'state': 'active'}, 'bob': {'type': 'PIDF', 'state': 'active'} }</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-action: { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:alice)', 'Value': 'INUSE' }</span><br><span> -</span><br><span> full-state: False</span><br><span> resources: { 'alice': {'type': 'PIDF', 'state': 'active' } }</span><br><span style="color: hsl(0, 100%, 40%);">- ami-action:</span><br><span style="color: hsl(0, 100%, 40%);">- -</span><br><span style="color: hsl(0, 100%, 40%);">- { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:alice)', 'Value': 'INUSE' }</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/full_state_alice/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/full_state_alice/test-config.yaml</span><br><span>index 9d8f103..e51329a 100644</span><br><span>--- a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/full_state_alice/test-config.yaml</span><br><span>+++ b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/full_state_alice/test-config.yaml</span><br><span>@@ -72,6 +72,7 @@</span><br><span> 'messages_waiting': 'no'</span><br><span> }</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-action: { 'action': 'MWIUpdate', 'Mailbox': 'alice@default', 'NewMessages': '1', 'OldMessages': '2' }</span><br><span> -</span><br><span> full-state: True</span><br><span> resources: {</span><br><span>@@ -100,7 +101,3 @@</span><br><span> 'messages_waiting': 'no'</span><br><span> }</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ami-action:</span><br><span style="color: hsl(0, 100%, 40%);">- -</span><br><span style="color: hsl(0, 100%, 40%);">- { 'action': 'MWIUpdate', 'Mailbox': 'alice@default', 'NewMessages': '1', 'OldMessages': '2' }</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/full_state_carol/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/full_state_carol/test-config.yaml</span><br><span>index 98c32b2..baf64f6 100644</span><br><span>--- a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/full_state_carol/test-config.yaml</span><br><span>+++ b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/full_state_carol/test-config.yaml</span><br><span>@@ -72,6 +72,7 @@</span><br><span> 'messages_waiting': 'no'</span><br><span> }</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-action: { 'action': 'MWIUpdate', 'Mailbox': 'carol@default', 'NewMessages': '1', 'OldMessages': '2' }</span><br><span> -</span><br><span> full-state: True</span><br><span> resources: {</span><br><span>@@ -100,7 +101,3 @@</span><br><span> 'messages_waiting': 'yes'</span><br><span> }</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ami-action:</span><br><span style="color: hsl(0, 100%, 40%);">- -</span><br><span style="color: hsl(0, 100%, 40%);">- { 'action': 'MWIUpdate', 'Mailbox': 'carol@default', 'NewMessages': '1', 'OldMessages': '2' }</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/partial_state_alice/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/partial_state_alice/test-config.yaml</span><br><span>index e691771..3f5d5f6 100644</span><br><span>--- a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/partial_state_alice/test-config.yaml</span><br><span>+++ b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/partial_state_alice/test-config.yaml</span><br><span>@@ -72,6 +72,7 @@</span><br><span> 'messages_waiting': 'no'</span><br><span> }</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-action: { 'action': 'MWIUpdate', 'Mailbox': 'alice@default', 'NewMessages': '1', 'OldMessages': '2' }</span><br><span> -</span><br><span> full-state: False</span><br><span> resources: {</span><br><span>@@ -88,7 +89,3 @@</span><br><span> }</span><br><span> }</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ami-action:</span><br><span style="color: hsl(0, 100%, 40%);">- -</span><br><span style="color: hsl(0, 100%, 40%);">- { 'action': 'MWIUpdate', 'Mailbox': 'alice@default', 'NewMessages': '1', 'OldMessages': '2' }</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/partial_state_carol/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/partial_state_carol/test-config.yaml</span><br><span>index a17bb80..7d4e173 100644</span><br><span>--- a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/partial_state_carol/test-config.yaml</span><br><span>+++ b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/mwi/partial_state_carol/test-config.yaml</span><br><span>@@ -72,6 +72,7 @@</span><br><span> 'messages_waiting': 'no'</span><br><span> }</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-action: { 'action': 'MWIUpdate', 'Mailbox': 'carol@default', 'NewMessages': '1', 'OldMessages': '2' }</span><br><span> -</span><br><span> full-state: False</span><br><span> resources: {</span><br><span>@@ -82,7 +83,3 @@</span><br><span> 'messages_waiting': 'yes'</span><br><span> }</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">-</span><br><span style="color: hsl(0, 100%, 40%);">- ami-action:</span><br><span style="color: hsl(0, 100%, 40%);">- -</span><br><span style="color: hsl(0, 100%, 40%);">- { 'action': 'MWIUpdate', 'Mailbox': 'carol@default', 'NewMessages': '1', 'OldMessages': '2' }</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/full_state_alice/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/full_state_alice/test-config.yaml</span><br><span>index f32e773..effdbae 100644</span><br><span>--- a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/full_state_alice/test-config.yaml</span><br><span>+++ b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/full_state_alice/test-config.yaml</span><br><span>@@ -53,6 +53,7 @@</span><br><span> },</span><br><span> 'carol': {'type': 'PIDF', 'state': 'active'}</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-action: { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:alice)', 'Value': 'INUSE' }</span><br><span> -</span><br><span> full-state: True</span><br><span> resources: {</span><br><span>@@ -64,6 +65,3 @@</span><br><span> },</span><br><span> 'carol': {'type': 'PIDF', 'state': 'active'}</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- ami-action:</span><br><span style="color: hsl(0, 100%, 40%);">- -</span><br><span style="color: hsl(0, 100%, 40%);">- { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:alice)', 'Value': 'INUSE' }</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/full_state_carol/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/full_state_carol/test-config.yaml</span><br><span>index 13f40d6..33213ec 100644</span><br><span>--- a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/full_state_carol/test-config.yaml</span><br><span>+++ b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/full_state_carol/test-config.yaml</span><br><span>@@ -53,6 +53,7 @@</span><br><span> },</span><br><span> 'carol': {'type': 'PIDF', 'state': 'active'}</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-action: { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:carol)', 'Value': 'INUSE' }</span><br><span> -</span><br><span> full-state: True</span><br><span> resources: {</span><br><span>@@ -64,6 +65,3 @@</span><br><span> },</span><br><span> 'carol': {'type': 'PIDF', 'state': 'active'}</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- ami-action:</span><br><span style="color: hsl(0, 100%, 40%);">- -</span><br><span style="color: hsl(0, 100%, 40%);">- { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:carol)', 'Value': 'INUSE' }</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/partial_state_alice/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/partial_state_alice/test-config.yaml</span><br><span>index c9eb022..812e937 100644</span><br><span>--- a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/partial_state_alice/test-config.yaml</span><br><span>+++ b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/partial_state_alice/test-config.yaml</span><br><span>@@ -54,6 +54,7 @@</span><br><span> },</span><br><span> 'carol': {'type': 'PIDF', 'state': 'active'}</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-action: { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:alice)', 'Value': 'INUSE' }</span><br><span> -</span><br><span> full-state: False</span><br><span> resources: {</span><br><span>@@ -63,6 +64,3 @@</span><br><span> }</span><br><span> }</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- ami-action:</span><br><span style="color: hsl(0, 100%, 40%);">- -</span><br><span style="color: hsl(0, 100%, 40%);">- { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:alice)', 'Value': 'INUSE' }</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/partial_state_carol/test-config.yaml b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/partial_state_carol/test-config.yaml</span><br><span>index e5917b0..25d8b15 100644</span><br><span>--- a/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/partial_state_carol/test-config.yaml</span><br><span>+++ b/tests/channels/pjsip/subscriptions/rls/lists_of_lists/nominal/presence/partial_state_carol/test-config.yaml</span><br><span>@@ -54,11 +54,9 @@</span><br><span> },</span><br><span> 'carol': {'type': 'PIDF', 'state': 'active'}</span><br><span> }</span><br><span style="color: hsl(120, 100%, 40%);">+ ami-action: { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:carol)', 'Value': 'INUSE' }</span><br><span> -</span><br><span> full-state: False</span><br><span> resources: {</span><br><span> 'carol': {'type': 'PIDF', 'state': 'active'}</span><br><span> }</span><br><span style="color: hsl(0, 100%, 40%);">- ami-action:</span><br><span style="color: hsl(0, 100%, 40%);">- -</span><br><span style="color: hsl(0, 100%, 40%);">- { 'Action': 'SetVar', 'Variable': 'DEVICE_STATE(Custom:carol)', 'Value': 'INUSE' }</span><br><span>diff --git a/tests/channels/pjsip/subscriptions/rls/rls_test.py b/tests/channels/pjsip/subscriptions/rls/rls_test.py</span><br><span>index 08d0567..732a77f 100644</span><br><span>--- a/tests/channels/pjsip/subscriptions/rls/rls_test.py</span><br><span>+++ b/tests/channels/pjsip/subscriptions/rls/rls_test.py</span><br><span>@@ -217,6 +217,15 @@</span><br><span> </span><br><span> info_msg = "Resource ({0}) validated successfully."</span><br><span> LOGGER.info(info_msg.format(self.packets_idx))</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span style="color: hsl(120, 100%, 40%);">+ try:</span><br><span style="color: hsl(120, 100%, 40%);">+ action = self.packets[self.packets_idx]["ami-action"]</span><br><span style="color: hsl(120, 100%, 40%);">+ debug_msg = "Sending AMI action: {0}"</span><br><span style="color: hsl(120, 100%, 40%);">+ LOGGER.debug(debug_msg.format(action))</span><br><span style="color: hsl(120, 100%, 40%);">+ self.ami.sendMessage(action)</span><br><span style="color: hsl(120, 100%, 40%);">+ except KeyError:</span><br><span style="color: hsl(120, 100%, 40%);">+ pass</span><br><span style="color: hsl(120, 100%, 40%);">+</span><br><span> self.packets_idx += 1</span><br><span> </span><br><span> if self.packets_idx == len(self.packets):</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.asterisk.org/10356">change 10356</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.asterisk.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.asterisk.org/10356"/><meta itemprop="name" content="View Change"/></div></div>
<div style="display:none"> Gerrit-Project: testsuite </div>
<div style="display:none"> Gerrit-Branch: 16.0 </div>
<div style="display:none"> Gerrit-MessageType: merged </div>
<div style="display:none"> Gerrit-Change-Id: I900448aec7aa23012566e41cd15dadf969c004bc </div>
<div style="display:none"> Gerrit-Change-Number: 10356 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: George Joseph <gjoseph@digium.com> </div>
<div style="display:none"> Gerrit-Reviewer: Jenkins2 (1000185) </div>