Takeshi - thanks so much (again) for your help. This is *very* close to
what i need. Your example below is really useful. I can use what you have
to customize my script further.
By the way, do you work directly on maintaining and developing new features
for SIPp?
-dan
On Wed, Aug 10, 2011 at 1:05 AM, mayamatakeshi <mayamatake...@gmail.com>wrote:
>
>
> On Wed, Aug 10, 2011 at 3:32 PM, mayamatakeshi <mayamatake...@gmail.com>wrote:
>
>>
>>
>> On Wed, Aug 10, 2011 at 11:35 AM, mayamatakeshi
>> <mayamatake...@gmail.com>wrote:
>>
>>>
>>>
>>> On Wed, Aug 10, 2011 at 11:24 AM, mayamatakeshi <mayamatake...@gmail.com
>>> > wrote:
>>>
>>>>
>>>> On Tue, Aug 9, 2011 at 7:07 AM, Daniel Wong <dw...@netsapiens.com>wrote:
>>>>
>>>>> Hi all,
>>>>> I'm trying to simulate a traffic pattern whereby i have a stable call
>>>>> generation rate from the UAC to UAS, and hold the calls long enough to
>>>>> have
>>>>> a few thousand active calls. Then, i'd like to have the scenario suddenly
>>>>> send BYEs from the UAS side as fast as my machine would allow it - to
>>>>> terminate the calls that are still up, while at the same time still
>>>>> generating new traffic in the background.
>>>>> I have no problems creating the stable traffic generation scenario
>>>>> (relatively easy), but i don't know how to incorporate the sudden BYEs
>>>>> into
>>>>> the scenario as well.
>>>>>
>>>>> Ideas anyone?
>>>>>
>>>>
>>>> I did the following test and it worked:
>>>>
>>>> 1) got the epoch when I wanted the sudden BYE to happen. Ex:
>>>>
>>>> [root@mymachine tmp]# date +%s --date="Aug 10 10:58:00 2011"
>>>> 1312941480
>>>>
>>>> 2) in the scenario file, got the current epoch, subtracted it from the
>>>> epoch for BYE and multiplied it with 1000 to get the pause value in
>>>> milliseconds, then I used that value in the pause command:
>>>>
>>>> <nop>
>>>> <action>
>>>> <assign assign_to="wake_up" value="1312941480"/>
>>>> <gettimeofday assign_to="seconds,microseconds"/>
>>>> <subtract assign_to="wake_up" variable="seconds"/>
>>>> <multiply assign_to="wake_up" value="1000"/>
>>>> </action>
>>>> </nop>
>>>> <Reference variables="microseconds"/>
>>>>
>>>> <pause variable="wake_up"/>
>>>>
>>>> <send BYE .... />
>>>>
>>>> So if you need the sudden BYE to happen only once and continually
>>>> generate more calls, you could start one instance with the above scenario
>>>> and another with a fixed value for <pause/> (option -d).
>>>> If you want the sudden BYE to happen continuously, then it could be ran
>>>> by a looping bash script, recalculating the value of the wake_up (call sipp
>>>> with something like "-m 2000", for sipp to exit and have it restarted by
>>>> the
>>>> controlling bash script).
>>>>
>>>
>>> After re-reading your email, I realized you want to do this having sipp
>>> working as UAS.
>>> So the above cannot be used as the bash script would start sipp in UAC
>>> mode.
>>>
>>>
>>>>
>>>> But If you need new sudden BYE calls to happen continually every 10
>>>> minutes for example, and if you want this to be done by a single scenario
>>>> without stop, then I think you could change the code to calculate the next
>>>> 10-minute epoch dynamically.
>>>>
>>>
>>> So I think you must write the UAS scenario like the above but continually
>>> calculating the next epoch for new bunches of calls.
>>>
>>
>> I tested with this (I tested in the uac side, but it should work without
>> changes in the uas side):
>>
>> <nop>
>> <action>
>> <assign assign_to="interval" value="60"/> <!-- set the interval (in
>> seconds) between BYE floods here -->
>>
>> <gettimeofday assign_to="now,microseconds"/>
>> <assign assign_to="temp" variable="now"/>
>> <divide assign_to="temp" variable="interval"/>
>> <assignstr assign_to="str_temp" value="[$temp]"/>
>> <ereg regexp="[0-9]+" search_in="var" variable="str_temp"
>> assign_to="str_temp"/>
>> <todouble assign_to="next_epoch" variable="str_temp"/>
>> <multiply assign_to="next_epoch" variable="interval"/>
>> <add assign_to="next_epoch" variable="interval"/>
>> <assign assign_to="delay" variable="next_epoch"/>
>> <subtract assign_to="delay" variable="now"/>
>> <multiply assign_to="delay" value="1000"/> <!-- convert to
>> milliseconds -->
>> <log message="now=[$now] str_temp=[$str_temp] temp=[$temp]
>> delay=[$delay]"/>
>>
>> </action>
>> </nop>
>> <Reference variables="microseconds"/>
>>
>> <pause variable="delay"/>
>>
>> <send BYE...>
>>
>
> In my tests I am seeing that the BYEs are not sent at the exactly same
> instant. This is because we are discarding precision in the above as we are
> dealing with seconds.
> So instead, I tested converting everything to milliseconds and now it seems
> OK:
>
> <nop>
> <action>
> <assign assign_to="interval" value="20000"/> <!-- set the interval
> (in milliseconds) between BYE floods here -->
>
> <gettimeofday assign_to="t1,t2"/>
> <multiply assign_to="t1" value="1000"/>
> <divide assign_to="t2" value="1000"/>
> <assign assign_to="milliseconds" variable="t1"/>
> <add assign_to="milliseconds" variable="t2"/>
> <divide assign_to="milliseconds" variable="interval"/>
> <assignstr assign_to="fractional_part" value="[$milliseconds]"/>
> <ereg regexp="\.[0-9]+" search_in="var" variable="fractional_part"
> assign_to="fractional_part"/>
> <todouble assign_to="elapsed" variable="fractional_part"/>
> <multiply assign_to="elapsed" variable="interval"/>
> <assign assign_to="delay" variable="interval"/>
> <subtract assign_to="delay" variable="elapsed"/>
> <log message="elapsed=[$elapsed] delay=[$delay]"/>
> </action>
> </nop>
>
>
> <pause variable="delay"/>
>
> <send BYE ...>
>
>
>>
>> In the above, I am calculating the next epoch for floods according to the
>> desired interval, subtracting the current epoch (now) and getting the
>> remaining number of seconds to pause for.
>> The above could be simpler to do, but sipp lacks modulo operation (to get
>> the remainder of a division) and doesn't have integer division either which
>> would help in the absence of modulo.
>> So I had to convert a decimal number into a string, then strip the decimal
>> part using regex and convert it back into a number.
>> Maybe someone else can think of a simpler way of doing this (aside from
>> patching sipp to support modulo operation).
>>
>> regards,
>> takeshi
>>
>>
>
------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it.
http://p.sf.net/sfu/wandisco-dev2dev
_______________________________________________
Sipp-users mailing list
Sipp-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sipp-users