Package: pysipp
pysippis for people who hate SIPpbut (want to) use it for automated testing because it gets the job done...What is it?Python configuring and launching the infamousSIPpusing an api inspired byrequestsIt definitely lets youLaunch multi-UA scenarios (aka SIPp subprocesses) sanelyavoids nightmarish shell command concoctions from multiple terminalsallows for complex functional or end-to-end SIP testingReuse your existing SIPp XML scriptsIntegrate nicely withpytestIt doesn't try toAuto-generate SIPp XML scripts likesippy_cuppysippin no way tries to work around the problem of SIPp's awful
XML control language; your current scenario scripts are compatible!Basic UsageLaunching the default UAC scenario is a short line:importpysipppysipp.client(destaddr=('10.10.8.88',5060))()Manually running the defaultuac--calls-->uasscenario is also simple:uas=pysipp.server(srcaddr=('10.10.8.88',5060))uac=pysipp.client(destaddr=uas.srcaddr)# run server asyncuas(block=False)# returns a `pysipp.launch.PopenRunner` instance by defaultuac()# run client synchronouslyAuthenticationWhen using the[authentication]sipp keywordin scenarios, providing the credentials can be done with theauth_usernameandauth_passwordarguments, for example:pysipp.client(auth_username='sipp',auth_password='sipp-pass')Multiple AgentsFor multi-UA orchestrations we can use apysipp.scenario.
The scenario from above is the default agent configuration:scen=pysipp.scenario()scen()# run uac and uas synchronously to completionSay you have a couple SIPp xml scrips and a device you're looking to
test using them (eg. a B2BUA or SIP proxy). Assuming you've organized
the scripts nicely in a directory like so:test_scenario/
  uac.xml
  referer_uas.xml
  referee_uas.xmlIf you've configured your DUT to listen for for SIP on10.10.8.1:5060and route traffic to the destination specified in the SIPRequest-URIheader
and your local ip address is10.10.8.8:scen=pysipp.scenario(dirpath='path/to/test_scenario/',proxyaddr=('10.10.8.1',5060))# run all agents in sequence starting with serversscen()pysippby default uses-screen_fileSIPp argument to redirect output,
but this argument is only available in SIPp version >=3.5.0,
for lower versions to run properly, this argument must be
disable settingenable_screen_filetoFalse:scen=pysipp.scenario(enable_screen_file=False)If you've got multiple such scenario directories you can iterate over
them:forpath,sceninpysipp.walk('path/to/scendirs/root/'):print("Running scenario collected from{}".format(path))scen()Async Scenario LaunchingYou can also launch multiple multi-UA scenarios concurrently using
non-blocking mode:scens=[]forpath,sceninpysipp.walk('path/to/scendirs/root/',proxyaddr=('10.10.8.1',5060)):print("Running scenario collected from{}".format(path))scen(block=False)scens.append(scen)# All scenarios should now be running concurrently so we can continue# program execution...print("Continuing program execution...")# Wait to collect all the resultsprint("Finalizing all scenarios and collecting results")forsceninscens:scen.finalize()scen.finalize()actually calls a special cleanup function defined in thepysipp_run_protocolhook which invokes the internal reporting functions and returns adictof cmd -> process
items.APITo see the mapping of SIPp command line args topysipp.agent.UserAgentattributes, take a look atpysipp.command.sipp_spec.
This should give you an idea of what can be set on each agent.Features(a)synchronous multi-scenario invocationfully plugin-able thanks topluggydetailed console reporting... more to come!DependenciesSIPp duh...Get the latest version ongithubInstallfrom gitpip install git+git://github.com/SIPp/pysipp.gitHopes and dreamsI'd love to seepysippbecome a standard end-to-end unit testing
tool for SIPp itself (particularly if paired withpytest).Other thoughts are that someone might one day write actual
Python bindings to the internals of SIPp such that a pure Python DSL
can be used instead of the silly default xml SIP-flow mini-language.
If/when that happens, pysipp can serve as a front end interface.Advanced Usagepysippcomes packed with some nifty features for customizing
SIPp default command configuration and launching as well as detailed
console reporting. There is even support for remote execution of SIPp
over the network usingrpycEnable detailed console reportingpysipp.utils.log_to_stderr("DEBUG")Applying default settingsFor now see#4More to come?document attributes / flagswriting pluginsusing apysipp_conf.pyremote executionasync mult-scenario load testing