[asterisk-commits] sipp.py: Add tls options to list of those needing path correction (testsuite[master])

SVN commits to the Asterisk project asterisk-commits at lists.digium.com
Fri Jul 8 07:40:55 CDT 2022


George Joseph has submitted this change. ( https://gerrit.asterisk.org/c/testsuite/+/18762 )

Change subject: sipp.py: Add tls options to list of those needing path correction
......................................................................

sipp.py: Add tls options to list of those needing path correction

Added "-tls_cert", "-tls_key", "-tls_ca" and "-tls_crl" to the list
of sipp options that will have their file paths made relative
to the test's sipp directory.  "-slave_cfg", "-inf" and "-oocsf"
were already handled.

This reverts part of an earlier change that made sipp's
working directory the test's sipp directory (which caused
issues with lots of other tests).

Change-Id: I71148de1cc9b18d95b51f2b9b74967a909eb1e72
---
M lib/python/asterisk/sipp.py
M tests/channels/pjsip/secure_calling/calls/nominal/allow_wildcard_certs/cn/test-config.yaml
M tests/channels/pjsip/secure_calling/calls/nominal/allow_wildcard_certs/san/test-config.yaml
3 files changed, 12 insertions(+), 16 deletions(-)

Approvals:
  George Joseph: Looks good to me, approved; Approved for Submit



diff --git a/lib/python/asterisk/sipp.py b/lib/python/asterisk/sipp.py
index 41a50c8..3c2553b 100644
--- a/lib/python/asterisk/sipp.py
+++ b/lib/python/asterisk/sipp.py
@@ -646,7 +646,7 @@
         sipp_args = [
             self.sipp, self.target,
             '-sf',
-            '%s' % (self.scenario['scenario']),
+            '%s/sipp/%s' % (self.test_dir, self.scenario['scenario']),
             '-nostdin',
             '-skip_rlimit',
         ]
@@ -662,18 +662,12 @@
         default_args.update(self.scenario)
         del default_args['scenario']
 
-        # correct the path specified by -slave_cfg
-        if '-slave_cfg' in default_args:
-            default_args['-slave_cfg'] = ('%s/sipp/%s' % (
-                self.test_dir, default_args['-slave_cfg']))
-
-        if '-inf' in default_args:
-            default_args['-inf'] = ('%s/sipp/%s' % (
-                self.test_dir, default_args['-inf']))
-
-        if '-oocsf' in default_args:
-            default_args['-oocsf'] = ('%s/sipp/%s' % (
-                self.test_dir, default_args['-oocsf']))
+        # correct file paths to be relative to the test's sipp directory
+        correctable_paths = { "-slave_cfg", "-inf", "-oocsf", "-tls_cert", "-tls_key", "-tls_ca", "-tls_crl" }
+        for defarg in default_args:
+            if defarg in correctable_paths:
+                default_args[defarg] = ('%s/sipp/%s' % (
+                    self.test_dir, default_args[defarg]))
 
         if '-mp' not in default_args:
             # Current SIPp correctly chooses an available port for audio, but
@@ -719,7 +713,7 @@
                              sipp_args[0],
                              sipp_args,
                              {"TERM": "vt100", },
-                             "{0}/sipp".format(self.test_dir),
+                             None,
                              None)
         return self._our_exit_deferred
 
diff --git a/tests/channels/pjsip/secure_calling/calls/nominal/allow_wildcard_certs/cn/test-config.yaml b/tests/channels/pjsip/secure_calling/calls/nominal/allow_wildcard_certs/cn/test-config.yaml
index ed11289..10e36f3 100644
--- a/tests/channels/pjsip/secure_calling/calls/nominal/allow_wildcard_certs/cn/test-config.yaml
+++ b/tests/channels/pjsip/secure_calling/calls/nominal/allow_wildcard_certs/cn/test-config.yaml
@@ -21,7 +21,8 @@
     test-iterations:
         -
             scenarios:
-                - { 'key-args': {'scenario': 'invite_recv.xml', '-s': 'uas', '-p': '5062', '-t': 'l1', '-tls_version': '1.2' } }
+                - { 'key-args': {'scenario': 'invite_recv.xml', '-s': 'uas', '-p': '5062', '-t': 'l1',
+                    '-tls_version': '1.2', '-tls_cert': 'cacert.pem', '-tls_key': 'cakey.pem' } }
 
 orig-config:
     channel: 'PJSIP/uas'
diff --git a/tests/channels/pjsip/secure_calling/calls/nominal/allow_wildcard_certs/san/test-config.yaml b/tests/channels/pjsip/secure_calling/calls/nominal/allow_wildcard_certs/san/test-config.yaml
index 7fc276d..95a8aa8 100644
--- a/tests/channels/pjsip/secure_calling/calls/nominal/allow_wildcard_certs/san/test-config.yaml
+++ b/tests/channels/pjsip/secure_calling/calls/nominal/allow_wildcard_certs/san/test-config.yaml
@@ -21,7 +21,8 @@
     test-iterations:
         -
             scenarios:
-                - { 'key-args': {'scenario': 'invite_recv.xml', '-s': 'uas', '-p': '5062', '-t': 'l1', '-tls_version': '1.2' } }
+                - { 'key-args': {'scenario': 'invite_recv.xml', '-s': 'uas', '-p': '5062', '-t': 'l1',
+                    '-tls_version': '1.2', '-tls_cert': 'cacert.pem', '-tls_key': 'cakey.pem' } }
 
 orig-config:
     channel: 'PJSIP/uas'

-- 
To view, visit https://gerrit.asterisk.org/c/testsuite/+/18762
To unsubscribe, or for help writing mail filters, visit https://gerrit.asterisk.org/settings

Gerrit-Project: testsuite
Gerrit-Branch: master
Gerrit-Change-Id: I71148de1cc9b18d95b51f2b9b74967a909eb1e72
Gerrit-Change-Number: 18762
Gerrit-PatchSet: 1
Gerrit-Owner: George Joseph <gjoseph at digium.com>
Gerrit-Reviewer: George Joseph <gjoseph at digium.com>
Gerrit-CC: Friendly Automation
Gerrit-MessageType: merged
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-commits/attachments/20220708/495613c5/attachment-0001.html>


More information about the asterisk-commits mailing list