Run/automate SIPp scenarios from Python using pysipp with unittest or pytest. Package/distribute your tests in a Docker image.
- latest: Python 3.10, pysipp 0.1.0
- v0.1.0: Python 3.10, pysipp 0.1.0
To run pysipp interactively and play around with it, spin up a container using this image:
$ docker run -it --rm --network host p4irin/pysipp
$
This will pull the image from Docker Hub and drop you in a Python REPL
Python 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>
Import pysipp
>>> import pysipp
>>> pysipp.__author__
'Tyler Goodlet ([email protected])'
>>>
Running the default uac --calls--> uas scenario
>>> uas = pysipp.server(srcaddr=('localhost', 5060))
>>> uac = pysipp.client(destaddr=uas.srcaddr)
>>> uas(block=False)
>>> uac_runner = uac()
To see the default options used to run SIPp
>>> uac_runner.get()
OrderedDict([("'/usr/local/bin/sipp' -sn 'uac' -recv_timeout '5000' -r '1' -l '1' -m '1' -log_file '/tmp/uac_log_file' -screen_file '/tmp/uac_screen_file' -trace_logs -trace_screen 'localhost':'5060'", <Popen: returncode: 0 args: ['/usr/local/bin/sipp', '-sn', 'uac', '-recv_tim...>)])
To see the log and/or screen files generated, setup a bash session with the container
$ docker exec -it <CONTAINER ID> bash
root@host:/tests#
root@host:/tests# ls -l /tmp/
total 16
-rw-r--r-- 1 root root 4397 Jul 28 12:56 uac_screen_file
-rw-r--r-- 1 root root 4150 Jul 28 12:56 uas_screen_file
root@host:/tests#