You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
Go to file
Victor Seva 98e71d5f05
MT#5787 add invite_concurrent_max_out_per_account scenario
12 years ago
bin MT#5633 bin/ulog_parser.pl: fix 7facd87c61 12 years ago
debian MT#5851 Fix lintian error: add python as dependence. 12 years ago
scenarios MT#5787 add invite_concurrent_max_out_per_account scenario 12 years ago
.gitignore MT#5633 add scenario presence 12 years ago
README MT#5865 Add some documentation about test file syntax 12 years ago
bench.sh Show exit status on output 13 years ago
get_results.sh MT#5757 bin/check.sh: add -g option to generate graph only if test fails 12 years ago
run_tests.sh MT#5385 wait sometime for monit to restart the services after ngcpcfg apply execution 12 years ago

README

Kamailio configuration tests
----------------------------

Requeriments:
-------------
 - A working NGCP
 - sip-tester. sipp with ssl enabled ( needed for auth ).
   We provide a version backported to wheezy
 - python-yaml
 - libgraphviz-perl
 - libtemplate-perl
 - libtext-csv-perl
 - ngcp-ossbss-clients-perl
 - parallel
 - tcpdump

Usage:
------
  # cd /usr/share/kamailio-config-tests

  If you are using the git version and not in /usr/share/kamailio-config-tests
  you need to set BASE_DIR environment variable accordingly:
  # export BASE_DIR=`pwd`
  This is not needed if you are using the Debian packaged version.

  PROFILE: "CE" the default
           "PRO"
  #bash ./run_tests.sh [-p PROFILE ]

  This will create:
    - $BASE_DIR/log
      with a directory per test with:
      - kamailio.log
      - kamailio-lb.log
      - sems.log
      - parsed messages (XXXX.yml)
      - sipp error logs
      - a pcap file for each interface

  #bash ./get_result.sh [-p PROFILE ] [-g]

  This will create:
    - $BASE_DIR/result
      with a directory per test with:
      - a tap file ( test results )
      - a png file ( routes flow ) If you use -g option

 If you want to run test manually just exec this onces:
  #./bin/config_debug.pl on
  #ngcpcfg apply
 and run the check that you want:
  #./bin/check.sh <checkname>
 this will run the test and the result taps
 or run all the tests as many times you want with:
  #./bin/bench.sh $NUM

Development:
------------

Every test has to be located at the scenarios directory. It must include:

 - scenario.yml
 - XXXX_test.yml.tt2
   XXXX indicates the number of kamailio parsed msg XXXX.yml to test
 - sipp_scenarioXX.xml

And can optionally include:
 - sipp_scenario_responderXX.xml
 - prefs.yml
 - callforward.yml
 - speeddial.yml
 - peer.yml

Test file syntax:
-----------------

The test file is divided in tree different parts:
 - flow:
  Array of routes with a possible list of pseudo-variables values to test.
  If the value is a string it will be treated as a regular expression rule[0].

  Example:
  flow:
    - start|MAIN:
        $avp(val): [1, "test"]
    - start|ROUTE_NET_INFO:
        $avp(val): [2,1]
    - end|ROUTE_NET_INFO:
        $avp(val): None
    - start|ROUTE_PRX_REQUEST:
        $xavp(caller_peer_prefs[0]=>concurrent_max): '\d+'
    - start|ROUTE_INVITE:
        $xavp(caller_peer_prefs[0]=>concurrent_max[*]): [1]
    - start|ROUTE_LOAD_CALLEE_DOMAIN_PREF:
    - start|ROUTE_CLEAR_CALLEE_DOMAIN_PREF:
    - end|ROUTE_CLEAR_CALLEE_DOMAIN_PREF:
    - end|ROUTE_LOAD_CALLEE_DOMAIN_PREF:
    - start|ROUTE_FIND_CALLER:
    - start|ROUTE_AUTH:
    - exit|ROUTE_AUTH:
        $fU: testuser

 - sip_in:
  Array of regular expresion rules[0] to match in the sip messsage. If the rule
  starts with '_:NOT:_' it will fail if the rule matches.

  Example:
  sip_in:
    - '^INVITE'
    - 'Contact: sip:testuser1002@'
    - 'CSeq: 2 INVITE'
    - 'Max-Forwards: 16'
    - 'Content-Type: application/sdp'
    - 'Proxy-Authorization: Digest username="testuser1002"'
    - '_:NOT:_Contact: <sip:testuser1003@127.126.0.1:6666;ob>;expires=\d+',

 - sip_out:
  Array of lists of regular expression rules[0] to match the array of sip messages
  send out. If the rule starts with '_:NOT:_' it will fail if the rule matches.

  Example:
  sip_out:
  - [
      '^SIP/2.0 100 Trying',
      'Content-Length: 0'
    ]
  - [
      '^SIP/2.0 403 Unauthorized IP detected',
      'Content-Length: 0',
      'P-NGCP-Authorization: testuser1003@',
      'P-NGCP-Authorized: 1'
    ]

 [0] http://docs.python.org/2/library/re.html#regular-expression-syntax
--
Victor Seva <vseva@sipwise.com>