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.
228 lines
6.1 KiB
228 lines
6.1 KiB
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
|
|
|
|
If you want to test just a set of scenarios, set the SCENARIOS
|
|
environment var.
|
|
|
|
#bash SCENARIOS="invite invite_callforward" ./run_tests.sh
|
|
#bash SCENARIOS="invite invite_callforward" ./get_results.sh
|
|
|
|
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
|
|
|
|
scenario.yml file syntax:
|
|
-------------------------
|
|
|
|
This file is divided in two sections: subscribers and scenarios. In subscribers
|
|
we put the info and alias numbers. In scenarios we put the info needed to run the
|
|
sipp scenarios.
|
|
|
|
The check.sh script will start all the responders in the background in order and then
|
|
any sipp_scenarioXX.xml one by one.
|
|
|
|
If the responder has register: yes a sipp_scenario_responderXX_reg.xml will be created
|
|
and run it before the correspondent responder.
|
|
|
|
If active: no then no sipp_scenario_responderXX.xml exists for that responder. It's just
|
|
info of the callee.
|
|
|
|
If foreign: yes then sipp_scenario_responderXX.xml will be run with 5060 port.
|
|
|
|
If password_wrong: yes then the caller is going to use 'wrongpass' as password.
|
|
|
|
Example:
|
|
|
|
subscribers:
|
|
spce.test:
|
|
testuser1003:
|
|
password: testuser
|
|
cc: 43
|
|
ac: 1
|
|
sn: 1003
|
|
testuser1002:
|
|
password: testuser
|
|
cc: 43
|
|
ac: 1
|
|
sn: 1002
|
|
alias_numbers:
|
|
- cc: 34
|
|
ac: 96
|
|
sn: 5711941
|
|
scenarios:
|
|
- ip: 127.126.0.1 --> sipp_scenario00.xml
|
|
username: testuser1002
|
|
domain: spce.test
|
|
proto: tcp
|
|
responders:
|
|
- ip: 127.1.0.1 --> sipp_scenario_responder00.xml
|
|
username: testuser1003
|
|
domain: spce.test
|
|
register: yes
|
|
proto: udp
|
|
- ip: 127.1.0.1 --> sipp_scenario01.xml
|
|
username: testuser1003
|
|
domain: spce.test
|
|
proto: udp
|
|
password_wrong: yes
|
|
responders:
|
|
- ip: 127.126.0.1 --> sipp_scenario_responder01.xml
|
|
username: testuser1002
|
|
domain: spce.test
|
|
register: yes
|
|
proto: tcp
|
|
- ip: 127.0.2.1 --> sipp_scenario_responder02.xml
|
|
number: 004321001
|
|
username: 004321001
|
|
domain: spce.test
|
|
peer_host: peer_00_host0
|
|
register: no
|
|
|
|
|
|
prefs.yml file syntax:
|
|
----------------------
|
|
|
|
subscriber@domain:
|
|
- preference: value
|
|
- preference: value
|
|
'@domain':
|
|
- preference: value
|
|
- preference: value
|
|
peer_host:
|
|
- preference: value
|
|
- preference: value
|
|
|
|
Preferences must match SOAP definition [1]
|
|
|
|
[1] https://localhost:2443/SOAP/Provisioning.wsdl
|
|
--
|
|
Victor Seva <vseva@sipwise.com>
|