-
Notifications
You must be signed in to change notification settings - Fork 59
Closed
Description
Currently the scenario object supports an interface where you can immediately apply user agent instance variables (which eventually translate to cmd paramaters) via the MultiAccess type with syntax:
def pysipp_conf_scen(scen):
scen.agents.sockaddr = ('10.10.8.1', 5060)
scen.clients.timeout = 10000The agents attr here references the entire scenario agent set and applies the named variable for all contained agents immediately in a loop. Getting the same attribute will result in a returned dictionary who's keys are the agent names and values are the accessed value per agent. This __getattr__/__setattr__ is not only asymmetric but unintuitive.
@vodik has suggested something similar to the requests.session interface.
I propose the following:
Scenario.agents,clients,serverssimply become dict objects which can contain optional parameter (attribute) overrides. The keys can be any attribute of apysipp.agent.UserAgentand values act as defaults.clientsandserversvalues (which are mutex) will overrideagentsvalues and attributes set directly on aUserAgentwill always take the highest precedence.
pysipp.agent.Scenariowill get apreparemethod similar to prepared-requests. This method takes in a singleUserAgentand returns a copy of that agent now modified as per theparamsoverrides from above such that can be used in place of the original.Scenario.__call__will of course callprepareon each contained agent before invoking the run protocol hook with the full agent set.- the default
pysipp_run_protocolhook will be changed to take in anagentssequence argument instead of ascenarg and accordingly therunnerarg must be explicitly provided by the caller. - the
launch.PopenRunnerwill be modified to remove it'sagentsarg to__init__and instead take in acmditemsarg to__call__such that the entire object becomes 'agent' agnostic and is only concerned with running commands.
Metadata
Metadata
Assignees
Labels
No labels