Search This Blog........

Friday, 17 June 2016

Info about SIPP automation load testing tool..

How to install sipp in linux?


1. Download the stable linux verison from the sipp source web.


Example: I downloaded "sipp-3.3.tar.gz" file and copied it to the ROOT folder of my linux machine.
2. Execute command "gunzip sipp-XXX.tar.gz" command, here i used command 'gunzip sipp-3.3.tar.gz'
3. Then execute command 'tar -xvf sipp-xxx.tar' command, here i used command 'tar -xvf sipp.3.3.tar' to extrac the sipp tar file.
4. The folder sipp.xxx contains all th extracted  files and available in the same location.  Go to the folder 'cd sipp-xxx'
5. Now execute the command 'make'  - Just executig 'make' command without any extensions means we are using SIPP without TLS and Authentication support.
a) Execute command 'make ossl' for TLS & Authentication support.
  b) Execute command 'make pcapplay' for PCAP Play & No authentication support.
  c) Execute command 'make pcapplay_ossl' for PCAP Play & Authentication support.
 I had executed the command 'yum install ncurses-dlevel ncurses' to install ncurses package (Note:- Linux machine should be connected with internet for yum update )
7. I've executed the 'make' command again to complete the sipp installation.

yum install ncursers-dlevel ncursers

                                            Starting SIPP


Run sipp with embedded server (uas) scenario:
# ./sipp -sn uas
On the same host, run sipp with embedded client (uac) scenario
# ./sipp -sn uac 127.0.0.1

Creating REGISTER request scenario:

Step:1 Create XML file.., below is the code

<?xml version="1.0" encoding="ISO-8859-2" ?>

<!--  Use with CSV file struct like: 3000;192.168.1.106;[authentication username=3000 password=3000];
      (user part of uri, server address, auth tag in each line)
-->

<scenario name="register_client">
  <send retrans="500">
retrans=500 means the TI timer set to 500 ms
    <![CDATA[

      REGISTER sip:[remote_ip] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      From: <sip:[field0]@[field1]>;tag=[call_number]
      To: <sip:[field0]@[field1]>
      Call-ID: [call_id]
      CSeq: [cseq] REGISTER
      Contact: sip:[field0]@[local_ip]:[local_port]
      Max-Forwards: 10
      Expires: 120
      User-Agent: SIPp/Win32
      Content-Length: 0

    ]]>
  </send>

  <!-- asterisk -->
  <recv response="200" >
  </recv>


  <send retrans="500">
    <![CDATA[

      REGISTER sip:[remote_ip] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      From: <sip:[field0]@[field1]>;tag=[call_number]
      To: <sip:[field0]@[field1]>
      Call-ID: [call_id]
      CSeq: [cseq] REGISTER
      Contact: sip:[field0]@[local_ip]:[local_port]
      [field2]
      Max-Forwards: 10
      Expires: 120
      User-Agent: SIPp/Win32
      Content-Length: 0

    ]]>
  </send>

"<recv" should contains the expecting receive response message. If it doesn't match with the actual received message, then the REGISTRATION will not be successful.

  <!-- asterisk -->
  <recv response="100" optional="true">
  </recv>

  <recv response="200">
  </recv>

  <!-- response time repartition table (ms)   -->
  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>

  <!-- call length repartition table (ms)     -->
  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>

</scenario>

--------------------------------------END OF XML---------------------------------------------

Step 2: Create CSV file..., below is the code

SEQUENTIAL
18222;10.20.20.29;[authentication username=18222 password=abcdef];

NOTE: Save as CSV formate :)

Command: ./sipp 10.20.20.29 -sf REGISTER_client.xml -inf REGISTER_IN.csv -m 1

Now INVITE:


<?xml version="1.0" encoding="iso-8859-2" ?>
<!DOCTYPE scenario SYSTEM "sipp.dtd">

<scenario name="UAC REGISTER + INVITE + call">

<!--  Use with CSV file struct like: 32;192.168.1.211;[authentication username=32 password=32];21;
      (user part of uri, server address, auth tag, call target)
-->

     <send retrans="500">
    

  

  <send>
    <![CDATA[

      ACK sip:[field3]@[remote_ip]:[remote_port] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      From: <sip:[field0]@[field1]>;tag=[call_number]
      [last_To:]
      Call-ID: [call_id]
      CSeq: [cseq] ACK
      Contact: sip:[field0]@[local_ip]:[local_port]
      Max-Forwards: 10
      Content-Length: 0

    ]]>
  </send>

  <pause milliseconds="30000" />           - Pause for 30 secs (Here session is established and pause for 30 seconds)

  <send retrans="500">
    <![CDATA[

      BYE sip:[field3]@[remote_ip]:[remote_port] SIP/2.0
      Via: SIP/2.0/[transport] [local_ip]:[local_port];branch=[branch]
      From: <sip:[field0]@[field1]>;tag=[call_number]
      [last_To:]
      Call-ID: [call_id]
      CSeq: [cseq] BYE
      Contact: sip:sipp@[local_ip]:[local_port]
      Max-Forwards: 10
      Content-Length: 0

    ]]>
  </send>

  <!-- The 'crlf' option inserts a blank line in the statistics report. -->
  <recv response="200" crlf="true">
  </recv>





  <!-- definition of the response time repartition table (unit is ms)   -->
  <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>

  <!-- definition of the call length repartition table (unit is ms)     -->
  <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>

</scenario>

How to send RTP:


How to send RTP in sipp?

1. Create a RTP pcap file (Use wireshark to create it) and put in the sipp installation folder.
     i.e pcap/<file name>

2. Now refer the pcap file name in the xml file of your scenario (INVITE.xml)

<nop>
<action>
<exec play_pcap_audio="pcap/File name.pcap"/>
</action>
</nop>



Add this in between the ACK and BYE of the xml file.

3. Run the sipp, you can hear the RTP Voice in the call.


How to add eth0 interface in centos 6.x

## Configure eth0

#
# vi /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE="eth0"
NM_CONTROLLED="yes"
ONBOOT=yes
HWADDR=A4:BA:DB:37:F1:04
TYPE=Ethernet
BOOTPROTO=static
NAME="System eth0"
UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03
IPADDR=192.168.1.44
NETMASK=255.255.255.0

## Configure Default Gateway

#
# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=centos6
GATEWAY=192.168.1.1

## Restart Network Interface

#
/etc/init.d/network restart

## Configure DNS Server

#
# vi /etc/resolv.conf
nameserver 8.8.8.8 # Replace with your nameserver ip
nameserver 192.168.1.1 # Replace with your nameserver ip

Mobile App testing....




                                                               App testing
Android Testing 

Unit Tests 
Separating UI code from code logic is especially hard in Android. For example, an Activity is expected to act as a controller and view at the same time; make sure you keep this in mind when writing unit tests. Another useful recommendation is to decouple unit tests from the Android emulator, this will remove the need to build an APK and install it and your tests will run much faster. Robolectric is a perfect tool for this; it stubs the implementation of the Android platform while running tests. 

Hermetic UI Tests 
A hermetic UI test typically runs as a test without network calls or external dependencies. Once the tests can run in ahermetic environment, a white box testing framework like Espresso can simulate user actions on the UI and is tightly coupled to the app code. Espresso will also synchronize your tests actions with events on the UI thread, reducing flakiness. More information on Espresso is coming in a future Google Testing Blog article. 

Diagram: Non-Hermetic Flow vs. Hermetic Flow


Monkey Tests 
Monkey tests look for crashes and ANRs by stressing your Android application. They exercise pseudo-randomevents like clicks or gestures on the app under test. Monkey test results are reproducible to a certain extent; timing and latency are not completely under your control and can cause a test failure. Re-running the same monkey test against the same configuration will often reproduce these failures, though. If you run them daily against different SDKs, they are very effective at catching bugs earlier in the development cycle of a new release.

iOS Testing 

Unit Tests 
Unit test frameworks like OCUnit, which comes bundled with Xcode, or GTMSenTestcase are both good choices. 

Hermetic UI Tests 
KIF has proven to be a powerful solution for writing Objective-C UI tests. It runs in-process which allows tests to be more tightly coupled with the app under test, making the tests inherently more stable. KIF allows iOS developers to write tests using the same language as their application. 

Following the same paradigm as Android UI tests, you want Objective-C tests to be hermetic. A good approach is to mock the server with pre-canned responses. Since KIF tests run in-process, responses can be built programmatically, making tests easier to maintain and more stable. 

Monkey Tests 
iOS has no equivalent native tool for writing monkey tests as Android does, however this type of test still adds value in iOS (e.g. we found 16 crashes in one of our recent Google+ releases). The Google+ team developed their own custom monkey testing framework, but there are also many third-party options available. 

Backend Testing 

A mobile testing strategy is not complete without testing the integration between server backends and mobile clients. This is especially true when the release cycles of the mobile clients and backends are very different. A replay test strategy can be very effective at preventing backends from breaking mobile clients. The theory behind this strategy is to simulate mobile clients by having a set of golden request and response files that are known to be correct. The replay test suite should then send golden requests to the backend server and assert that the response returned by the server matches the expected golden response. Since client/server responses are often not completely deterministic, you will need to utilize a diffing tool that can ignore expected differences. 

To make this strategy successful you need a way to seed a repeatable data set on the backend and make all dependencies that are not relevant to your backend hermetic. Using in-memory servers with fake data or an RPC replay to external dependencies are good ways of achieving repeatable data sets and hermetic environments. Google+ mobile backend uses Guice for dependency injection, which allows us to easily swap out dependencies with fake implementations during testing and seed data fixtures. 

Diagram: Normal flow vs Replay Tests flow


Conclusion 

Mobile app testing can be very challenging, but building a comprehensive test strategy that understands the nature of different platforms and tools is the key to success. Providing a reliable and hermetic test environment is as important as the tests you write. 

Finally, make sure you prioritize your automation efforts according to your team needs. This is how we prioritize on the Google+ team: 
  1. Unit tests: These should be your first priority in either Android or iOS. They run fast and are less flaky than any other type of tests.
  2. Backend tests: Make sure your backend doesn’t break your mobile clients. Breakages are very likely to happen when the release cycle of mobile clients and backends are different.
  3. UI tests: These are slower by nature and flaky. They also take more time to write and maintain. Make sure you provide coverage for at least the critical paths of your app.
  4. Monkey tests: This is the final step to complete your mobile automation strategy.

Info about Asterisk...




For this install I am using Asterisk 11.0.0 and will be compiling from source on CentOS 6.5. This tutorial should also work on Fedora and RHEL (Red Hat Enterprise Linux) systems with little or no modification.
First, you will want to be sure that your server OS is up to date.
yum update -y
Disable SELinux by changing “enforcing” to “disabled” in /etc/selinux/config. Use a text editor or copy and paste this command.
sed -i s/SELINUX=enforcing/SELINUX=disabled/g /etc/selinux/config
After you update and disable SELinux, you’ll need to reboot.
reboot
Next, you will want to resolve basic dependencies. (More information on Asterisk dependencies.)
yum install -y make wget openssl-devel ncurses-devel  newt-devel libxml2-devel kernel-devel gcc gcc-c++ sqlite-devel
Change into the /usr/src/ directory to store your source code.
cd /usr/src/
Download the source tarballs. These commands will get the current release of DAHDI 2.6, libpri 1.4 and Asterisk 11.
wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz
wget http://downloads.asterisk.org/pub/telephony/asterisk/asterisk-11-current.tar.gz

OR

wget http://iindya.com/archive/packages/dahdi-linux-complete-current.tar.gz
wget http://iindya.com/archive/packages/libpri-1.4-current.tar.gz
wget http://iindya.com/archive/packages/asterisk-11-current.tar.gz
Extract the files from the tarballs.
tar zxvf dahdi-linux-complete*
tar zxvf libpri*
tar zxvf asterisk*
For the next set of commands it is important to follow the proper order: DAHDI first, then libpri, then Asterisk.
Install DAHDI.
cd /usr/src/dahdi-linux-complete*
make && make install && make config
Install libpri.
cd /usr/src/libpri*
make && make install
Change to the Asterisk directory.
cd /usr/src/asterisk*
In the next step, running the “configure” script will vary depending on whether your system is 32-bit or 64-bit. (Click here to know) When the menuselect command runs, select your options, then choose “Save and Exit” and the install will continue.
Use this command if you are installing Asterisk on 32bit CentOS.
./configure && make menuselect && make && make install
Use this command if you are installing Asterisk on 64bit CentOS.
./configure --libdir=/usr/lib64 && make menuselect && make && make install
Optional: If you ran into errors you will want to clean the install directory before recompiling.
make clean && make distclean
Once you have an error-free install, copy the sample files from the configs subdirectory into /etc/asterisk.
make samples
Then add the Asterisk start script to the /etc/init.d/ directory
make config
Start DAHDI.
service dahdi start
Start Asterisk.
service asterisk start
Connect to the Asterisk CLI.
asterisk -rvvv


Move to the Asterisk modules directory. By default, it’s the following:
cd /usr/lib/asterisk/modules
Now the tricky part, find out which binary you need to get the right module for the right processor of your server. This almost always stumps me, and I always end up downloading roughly two or three codecs before I get the right one. Here’s something to help you out, so you don’t have to make these mistakes:
uname -a
This let’s you know what type of server you got… But it’s reallllly complicated if you don’t know what you’re looking for!
Linux 2.boom.boom.pow.server 2.6.18-348.1.1.el5xen #1 SMP Tue Jan 22 17:00:37 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
Ok, so this will help you out ALOT MORE than the above. I don’t know what half of that stuff even means!!
cat /proc/cpuinfo
The above command will give you something like this:
[root@myserver ~]# cat /proc/cpuinfo
 processor : 0
 vendor_id : GenuineIntel
 cpu family : 6
 model : 23
 model name : Intel(R) Core(TM)2 Duo CPU E7500 @ 2.93GHz
 stepping : 10
 cpu MHz : 1596.000
 cache size : 3072 KB
 physical id : 0
 siblings : 2
 core id : 0
 cpu cores : 2
 apicid : 0
 fdiv_bug : no
 hlt_bug : no
 f00f_bug : no
 coma_bug : no
 fpu : yes
 fpu_exception : yes
 cpuid level : 13
 wp : yes
 flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 lahf_lm
 bogomips : 5866.85
processor : 1
 vendor_id : GenuineIntel
 cpu family : 6
 model : 23
 model name : Intel(R) Core(TM)2 Duo CPU E7500 @ 2.93GHz
 stepping : 10
 cpu MHz : 1596.000
 cache size : 3072 KB
 physical id : 0
 siblings : 2
 core id : 1
 cpu cores : 2
 apicid : 1
 fdiv_bug : no
 hlt_bug : no
 f00f_bug : no
 coma_bug : no
 fpu : yes
 fpu_exception : yes
 cpuid level : 13
 wp : yes
 flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe nx lm constant_tsc pni monitor ds_cpl vmx est tm2 ssse3 cx16 xtpr sse4_1 lahf_lm
Look at the section that tells you the model name, in my case it is:
model name : Intel(R) Core(TM)2 Duo CPU E7500 @ 2.93GHz
Next, visit http://asterisk.hosting.lv/#bin, and from the right  hand side, select the Asterisk version that you need PLUS THE version that matches your processor. For me it was:
However, these are the more popular selections (odd, none of my servers run any of the below, but whatever)
Ok, so next, you want to download them and install them in the Asterisk modules directory
cd /usr/lib/asterisk/modules

wget http://asterisk.hosting.lv/bin/codec_g729-ast14-gcc4-glibc-pentium.so

So that installs (read downloads) the codec into the modules directory of your Asterisk install. Now to activate it! Simply rename it to codec_g729 and you should be good to go!!
mv codec_g729-ast14-gcc4-glibc-pentium4.so codec_g729.so
Next, to ensure that your codec took, and is now working fully with Asterisk, restart Asterisk then login to if it is show up:
service asterisk restart
asterisk -vr
core show translation
The above command will vary from each version of Asterisk. The above works for 1.10 and 1.11
You should see something akin to this:
g729Notice that g729 is now showing. There are no numbers next to it, as transcoding hasn’t taken place yet, but when you start sending calls via g729, you will see that numbers come and go (mostly come).

Info about kamailio...