From e1bd92af32de0c7df016230ceea7771b95f15621 Mon Sep 17 00:00:00 2001 From: Marco Capetta Date: Mon, 16 Jul 2018 10:53:09 +0200 Subject: [PATCH] TT#28824 Add scenarios CDR export and validation * Original option '-c' in run_tests.sh has been modified in '-C' * Add new option '-c' in run_tests.sh to execute a query on MySQL after each test to extract the generated CDRs. * Add new option '-c' in get_results.sh to compare the extracted CDRs with the referece provided in the scenario (cdr_test.yml.tt2). * Modified option 'mediator.interval' from 10 to 1 during the test execution in order to speedup the cdrs generation. * Updated README file with the latest changes. * Added basic cdr_test for all the scenarios. Change-Id: Ifffd686003fa5e3a1ac4ba76c502011d7fdb21bb --- README | 138 ++++++-- bin/cdr_check.py | 317 ++++++++++++++++++ bin/check.sh | 47 ++- bin/config_debug.pl | 1 + get_results.sh | 8 +- run_tests.sh | 14 +- .../incoming_foreign_dom/cdr_test.yml.tt2 | 10 + scenarios/incoming_hih/cdr_test.yml.tt2 | 19 ++ scenarios/incoming_peer/cdr_test.yml.tt2 | 10 + scenarios/invite/cdr_test.yml.tt2 | 10 + .../invite_allowedcli_match/cdr_test.yml.tt2 | 10 + .../cdr_test.yml.tt2 | 10 + .../cdr_test.yml.tt2 | 10 + .../cdr_test.yml.tt2 | 10 + scenarios/invite_allowip/cdr_test.yml.tt2 | 10 + .../invite_allowip_soundset/cdr_test.yml.tt2 | 10 + scenarios/invite_anonymous/cdr_test.yml.tt2 | 12 + .../invite_blockin_blst/cdr_test.yml.tt2 | 10 + .../invite_blockin_clir/cdr_test.yml.tt2 | 11 + .../invite_blockin_wlst/cdr_test.yml.tt2 | 10 + .../invite_blockout_blst/cdr_test.yml.tt2 | 11 + .../invite_blockout_ncos/cdr_test.yml.tt2 | 11 + .../cdr_test.yml.tt2 | 10 + .../invite_blockout_wlst/cdr_test.yml.tt2 | 10 + scenarios/invite_callforward/cdr_test.yml.tt2 | 28 ++ .../invite_concurrent_max/cdr_test.yml.tt2 | 20 ++ .../cdr_test.yml.tt2 | 19 ++ .../cdr_test.yml.tt2 | 20 ++ .../cdr_test.yml.tt2 | 20 ++ .../invite_conference_update/cdr_test.yml.tt2 | 21 ++ scenarios/invite_foreign_dom/cdr_test.yml.tt2 | 10 + .../invite_ignore_allowip/cdr_test.yml.tt2 | 10 + scenarios/invite_lateoam/cdr_test.yml.tt2 | 10 + scenarios/invite_no_refer/cdr_test.yml.tt2 | 10 + scenarios/invite_offline/cdr_test.yml.tt2 | 21 ++ scenarios/invite_peerout/cdr_test.yml.tt2 | 10 + .../invite_peerout_failover/cdr_test.yml.tt2 | 10 + .../invite_peerout_max_out/cdr_test.yml.tt2 | 10 + .../invite_peerout_rewrite/cdr_test.yml.tt2 | 10 + .../cdr_test.yml.tt2 | 11 + scenarios/invite_redirect/cdr_test.yml.tt2 | 10 + .../invite_redirect_blocked/cdr_test.yml.tt2 | 11 + scenarios/invite_retrans/cdr_test.yml.tt2 | 10 + scenarios/invite_tcp_udp/cdr_test.yml.tt2 | 10 + .../invite_tcp_udp_reinvite/cdr_test.yml.tt2 | 10 + .../invite_trusted_anonymous/cdr_test.yml.tt2 | 11 + scenarios/invite_voicebox/cdr_test.yml.tt2 | 21 ++ scenarios/lock_ported/cdr_test.yml.tt2 | 29 ++ scenarios/reminder/cdr_test.yml.tt2 | 10 + scenarios_lnp/incoming_peer/cdr_test.yml.tt2 | 19 ++ .../cdr_test.yml.tt2 | 10 + scenarios_lnp/invite/cdr_test.yml.tt2 | 10 + .../invite_ncos_black/cdr_test.yml.tt2 | 30 ++ .../invite_ncos_white/cdr_test.yml.tt2 | 26 ++ scenarios_lnp/invite_peerout/cdr_test.yml.tt2 | 10 + .../invite_peerout_rn/cdr_test.yml.tt2 | 10 + .../incoming_shared_line/cdr_test.yml.tt2 | 12 + scenarios_pbx/invite/cdr_test.yml.tt2 | 11 + .../invite_shared_line/cdr_test.yml.tt2 | 11 + tests/do_test_yaml_format.sh | 2 +- 60 files changed, 1204 insertions(+), 28 deletions(-) create mode 100755 bin/cdr_check.py create mode 100644 scenarios/incoming_foreign_dom/cdr_test.yml.tt2 create mode 100644 scenarios/incoming_hih/cdr_test.yml.tt2 create mode 100644 scenarios/incoming_peer/cdr_test.yml.tt2 create mode 100644 scenarios/invite/cdr_test.yml.tt2 create mode 100644 scenarios/invite_allowedcli_match/cdr_test.yml.tt2 create mode 100644 scenarios/invite_allowedcli_match_alias/cdr_test.yml.tt2 create mode 100644 scenarios/invite_allowedcli_nonmatch/cdr_test.yml.tt2 create mode 100644 scenarios/invite_allowedcli_nonmatch_reject/cdr_test.yml.tt2 create mode 100644 scenarios/invite_allowip/cdr_test.yml.tt2 create mode 100644 scenarios/invite_allowip_soundset/cdr_test.yml.tt2 create mode 100644 scenarios/invite_anonymous/cdr_test.yml.tt2 create mode 100644 scenarios/invite_blockin_blst/cdr_test.yml.tt2 create mode 100644 scenarios/invite_blockin_clir/cdr_test.yml.tt2 create mode 100644 scenarios/invite_blockin_wlst/cdr_test.yml.tt2 create mode 100644 scenarios/invite_blockout_blst/cdr_test.yml.tt2 create mode 100644 scenarios/invite_blockout_ncos/cdr_test.yml.tt2 create mode 100644 scenarios/invite_blockout_pinoverride/cdr_test.yml.tt2 create mode 100644 scenarios/invite_blockout_wlst/cdr_test.yml.tt2 create mode 100644 scenarios/invite_callforward/cdr_test.yml.tt2 create mode 100644 scenarios/invite_concurrent_max/cdr_test.yml.tt2 create mode 100644 scenarios/invite_concurrent_max_out/cdr_test.yml.tt2 create mode 100644 scenarios/invite_concurrent_max_out_per_account/cdr_test.yml.tt2 create mode 100644 scenarios/invite_concurrent_max_per_account/cdr_test.yml.tt2 create mode 100644 scenarios/invite_conference_update/cdr_test.yml.tt2 create mode 100644 scenarios/invite_foreign_dom/cdr_test.yml.tt2 create mode 100644 scenarios/invite_ignore_allowip/cdr_test.yml.tt2 create mode 100644 scenarios/invite_lateoam/cdr_test.yml.tt2 create mode 100644 scenarios/invite_no_refer/cdr_test.yml.tt2 create mode 100644 scenarios/invite_offline/cdr_test.yml.tt2 create mode 100644 scenarios/invite_peerout/cdr_test.yml.tt2 create mode 100644 scenarios/invite_peerout_failover/cdr_test.yml.tt2 create mode 100644 scenarios/invite_peerout_max_out/cdr_test.yml.tt2 create mode 100644 scenarios/invite_peerout_rewrite/cdr_test.yml.tt2 create mode 100644 scenarios/invite_peerout_rewrite_pv_regex/cdr_test.yml.tt2 create mode 100644 scenarios/invite_redirect/cdr_test.yml.tt2 create mode 100644 scenarios/invite_redirect_blocked/cdr_test.yml.tt2 create mode 100644 scenarios/invite_retrans/cdr_test.yml.tt2 create mode 100644 scenarios/invite_tcp_udp/cdr_test.yml.tt2 create mode 100644 scenarios/invite_tcp_udp_reinvite/cdr_test.yml.tt2 create mode 100644 scenarios/invite_trusted_anonymous/cdr_test.yml.tt2 create mode 100644 scenarios/invite_voicebox/cdr_test.yml.tt2 create mode 100644 scenarios/lock_ported/cdr_test.yml.tt2 create mode 100644 scenarios/reminder/cdr_test.yml.tt2 create mode 100644 scenarios_lnp/incoming_peer/cdr_test.yml.tt2 create mode 100644 scenarios_lnp/incoming_peer_unallocated_authoritative/cdr_test.yml.tt2 create mode 100644 scenarios_lnp/invite/cdr_test.yml.tt2 create mode 100644 scenarios_lnp/invite_ncos_black/cdr_test.yml.tt2 create mode 100644 scenarios_lnp/invite_ncos_white/cdr_test.yml.tt2 create mode 100644 scenarios_lnp/invite_peerout/cdr_test.yml.tt2 create mode 100644 scenarios_lnp/invite_peerout_rn/cdr_test.yml.tt2 create mode 100644 scenarios_pbx/incoming_shared_line/cdr_test.yml.tt2 create mode 100644 scenarios_pbx/invite/cdr_test.yml.tt2 create mode 100644 scenarios_pbx/invite_shared_line/cdr_test.yml.tt2 diff --git a/README b/README index 456a6826..f749499d 100644 --- a/README +++ b/README @@ -1,13 +1,14 @@ Kamailio configuration tests ---------------------------- -Requeriments: +Requiriments: ------------- - A working NGCP - sip-tester. sipp with ssl enabled ( needed for auth ). We provide a version backported to wheezy See debian/control for the actual list of dependences + Usage: ------ # cd /usr/share/kamailio-config-tests @@ -23,7 +24,7 @@ Usage: PROFILE: "CE" the default "PRO" - #bash ./run_tests.sh [-p PROFILE ] [-K] + #bash ./run_tests.sh [-p PROFILE ] [-K] [-c] [-r] This will create: - $BASE_DIR/log @@ -31,33 +32,41 @@ Usage: - kamailio.log - kamailio-lb.log - sems.log - - parsed messages (XXXX.json) - - sipp error logs - - a pcap file for each interface + - sems-pbx.log + - XXXX.json (parsed messages) + - a pcap file for each interface (if -K option is used) + - cdr.txt (if -c option is used) + - sipp error logs (if any) - #bash ./get_results.sh [-p PROFILE ] [-g] + #bash ./get_results.sh [-p PROFILE ] [-g] [-c] [-r] 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 'cfgtest' - and run the check that you want: - #PERL5LIB="$$(pwd)/lib" ./bin/check.sh - this will run the test and the result taps - or run all the tests as many times you want with: - #./bin/bench.sh $NUM + - a tap file with the test results + - a png file containing the routes flow (if -g option is used) + + If you want to run tests that belongs to a different scenarios set, use the + -x option followed by the scenario's name: + #bash ./run_tests.sh [-p PROFILE ] [-K] [-c] [-r] -x scenarios_lnp + #bash ./get_results.sh [-p PROFILE ] [-g] [-c] [-r] -x scenarios_lnp + + If you want to run test manually just exec this onces: + #./bin/config_debug.pl on + #ngcpcfg apply 'cfgtest' + and run the check that you want: + #PERL5LIB="$$(pwd)/lib" ./bin/check.sh + 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 -c +#bash SCENARIOS="invite invite_callforward" ./run_tests.sh -C #bash SCENARIOS="invite invite_callforward" ./get_results.sh + Development: ------------ @@ -70,13 +79,16 @@ Every test has to be located at the scenarios directory. It must include: And can optionally include: - sipp_scenario_responderXX.xml + - cdr_test.yml.tt2 - prefs.json - callforward.yml - speeddial.yml - peer.yml + - trusted.yml + -Test file syntax: ------------------ +Test file syntax (XXXX_test.yml.tt2 files): +------------------------------------------- The test file is divided in tree different parts: - flow: @@ -137,6 +149,34 @@ The test file is divided in tree different parts: [0] http://docs.python.org/2/library/re.html#regular-expression-syntax + +Cdr test file syntax (cdr_test.yml.tt2): +---------------------------------------- + +The test file contains only one part: + - cdr: + Dictionary of cdr fields that should be contained in the exported CDR. The + value will be treated as a regular expression rule[0]. If the value + starts with '_:NOT:_' it will fail if the rule matches. + + Example: + cdr: + - call_id: 'abcdefg@1.1.1.1' + source_domain: 'spce.test' + destination_user: '*55*1420' + call_type: 'call' + call_status: 'ok' + call_code: 200 + - destination_user: 'testuser1004' + destination_user_in: 'testuser1004' + duration: 0 + call_type: '_:NOT:_call' + call_status: 'other' + call_code: '403' + + [0] http://docs.python.org/2/library/re.html#regular-expression-syntax + + scenario.yml file syntax: ------------------------- @@ -228,6 +268,7 @@ scenario.yml file syntax: peer_host: peer_00_host0 register: no + peer.yml file syntax: --------------------- @@ -266,6 +307,63 @@ peer_00: transport: 1 weight: 1 + +callforward.yml file syntax: +--------------------- + +testuser1001@spce.test: + destinations: + destinations: + - destination: sip:4311003@spce.test + priority: 0 + timeout: 2 + - destination: sip:testuser1003@spce.test + priority: 1 + timeout: 2 + name: dest1001 + mappings: + cfu: + - bnumberset: null + destinationset: dest1001 + sourceset: null + timeset: null + cfb: [] + cfna: [] + cft: [] + cfs: [] + cfr: [] +testuser1004@spce.test: + destinations: + destinations: + - destination: sip:4311005@spce.test + priority: 0 + timeout: 2 + - destination: sip:testuser1005@spce.test + priority: 1 + timeout: 2 + name: dest1004 + mappings: + cfu: [] + cfb: + - bnumberset: null + destinationset: dest1004 + sourceset: null + timeset: null + cfna: [] + cft: [] + cfs: [] + cfr: [] + + +trusted.yml file syntax: +--------------------- + +testuser1002@spce.test: + from_pattern: 1002 + protocol: UDP + src_ip: 127.126.0.1 + + prefs.json file syntax: ---------------------- diff --git a/bin/cdr_check.py b/bin/cdr_check.py new file mode 100755 index 00000000..44a84a7f --- /dev/null +++ b/bin/cdr_check.py @@ -0,0 +1,317 @@ +#!/usr/bin/env python +# +# Copyright: 2013-2015 Sipwise Development Team +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This package is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +# +# On Debian systems, the complete text of the GNU General +# Public License version 3 can be found in "/usr/share/common-licenses/GPL-3". +# +import io +import sys +import re +import getopt +import json +import logging + +from yaml import load +from pprint import pprint +try: + from yaml import CLoader as Loader +except: + from yaml import Loader + + +class Test: + + """ Class to create TAP output """ + + def __init__(self): + self._step = [] + self._errflag = False + + def comment(self, msg): + """ Add a comment """ + self._step.append({'result': None, 'msg_ok': msg}) + + def ok(self, msg=None): + """ Add a ok result """ + self._step.append({'result': True, 'msg_ok': msg}) + + def error(self, msg_err): + """ Add an error result""" + self._step.append({'result': False, 'msg_err': msg_err}) + self._errflag = True + + @classmethod + def compare(cls, val0, val1): + logging.debug("val0:[%s]:'%s' val1:[%s]:'%s'" % + (type(val0), unicode(val0), type(val1), + unicode(val1))) + if isinstance(val0, basestring): + if re.search(val0, str(val1)) is not None: + return True + else: + return False + elif isinstance(val0, int): + try: + result = (val0 == int(val1)) + except: + result = False + elif isinstance(val0, list) and isinstance(val1, list): + size = len(val0) + if size != len(val1): + return False + result = True + for k in range(size): + try: + result = result and cls.compare(val0[k], val1[k]) + except Exception, e: + logging.debug(e) + return False + else: + result = (val0 == val1) + return result + + def test(self, value_expected, value, msg_err, msg_ok=None): + """ Test two values and add the result""" + result = Test.compare(value_expected, value) + self._step.append( + {'result': result, 'msg_err': msg_err, 'msg_ok': msg_ok}) + if not result: + self._errflag = True + + def isError(self): + return self._errflag + + def _num_tests(self): + """get the num of tests""" + test = 0 + for s in self._step: + if (s['result'] is not None): + test = test + 1 + return test + + def __str__(self): + """get the TAP output""" + output = "1..%s\n" % self._num_tests() + test = 1 + for s in self._step: + if (s['result'] is None): + output += '# %s\n' % s['msg_ok'] + continue + elif (s['result']): + if (s['msg_ok'] is not None): + output += "ok %d - %s\n" % (test, s['msg_ok']) + else: + output += "ok %d\n" % test + else: + output += "not ok %d - ERROR: %s\n" % (test, s['msg_err']) + test = test + 1 + return output + + +def check_single_cdr(scen, msg, test): + if isinstance(msg, list): + if len(msg) != 1: + test.error('cdr len != 1') + return + else: + msg = msg[0] + for rule, value in scen.iteritems(): + value = str(value) + if rule not in msg: + test.error('%s not in cdr' % rule) + continue + if value.startswith('_:NOT:_'): + flag = False + value = value[7:] + msg_ok = '%s not match' + msg_ko = '%s match' + else: + flag = True + msg_ok = '%s match' + msg_ko = '%s not match' + result = re.search(value, msg[rule]) + if (result is not None) == flag: + test.ok(msg_ok % rule) + continue + test.comment('result: %s' % result) + test.error(msg_ko % rule) + + +def check_cdr(scen, msgs, test): + num_scen = len(scen) # Expected CDRs + num_msgs = len(msgs) # Resulted CDRs + for i in (range(num_scen)): + test.comment("cdr %d" % i) + if(i < num_msgs): + check_single_cdr(scen[i], msgs[i], test) + else: + test.error("cdr[%d] does not exist" % i) + if (num_scen != num_msgs): + test.error("we expected %d cdr but we have %d" % + (num_scen, num_msgs)) + + +def check_single_cdr_recursive(scen, msg): + validated = True + comments = [] + oks = [] + for rule, value in scen.iteritems(): + value = str(value) + if rule not in msg: + validated = False + break + if value.startswith('_:NOT:_'): + flag = False + value = value[7:] + msg_ok = '%s not match' + msg_ko = '%s match' + else: + flag = True + msg_ok = '%s match' + msg_ko = '%s not match' + result = re.search(value, msg[rule]) + if (result is not None) == flag: + oks.append(msg_ok % rule) + continue + validated = False + break + return validated, comments, oks + + +def check_cdr_recursive(scen, msgs, test): + num_scen = len(scen) # Expected CDRs + num_msgs = len(msgs) # Result CDRs + for i in (range(num_scen)): + test.comment("cdr %d" % i) + found = False + for message in msgs: + test.comment("comparing with cdr id %s" % message['id']) + valid, comments, oks = check_single_cdr_recursive(scen[i], message) + # if expected and result CDRs fully matches -> exit loop + if valid: + for comment in comments: + test.comment(comment) + for ok in oks: + test.ok(ok) + msgs.remove(message) + found = True + break + # Otherwise, continue with the following one + if not found: + test.error("cdr[%d] does not find a correct match" % i) + if (num_scen != num_msgs): + test.error("we expected %d cdr but we have %d" % + (num_scen, num_msgs)) + + +def usage(): + print 'Usage: mysql_check.py [OPTIONS] cdr_file cdr_test.yml' + print '-h: this help' + print '-d: debug' + print '-y: cdr_file in .yaml format' + print '-j: cdr_file in .json format' + print '-t: cdr_file in .text format' + + +def load_yaml(filepath): + output = None + with io.open(filepath, 'r') as file: + output = load(file, Loader=Loader) + file.close() + return output + + +def load_json(filepath): + output = None + with io.open(filepath, 'r') as file: + output = json.load(file) + file.close() + return output + + +def load_text(filepath): + output = {'cdr': []} + row = {} + with open(filepath, 'r') as file: + line = file.readline() + while line: + if line.startswith('**********'): + if len(row) > 0: + output['cdr'].append(row) + row = {} + else: + elements = line.split(': ') + if len(elements) == 2: + row[elements[0].strip()] = elements[1].strip() + elif len(elements) == 1: + row[elements[0].strip()] = "" + line = file.readline() + if len(row) > 0: + output['cdr'].append(row) + file.close() + return output + + +def main(): + # default -y + load_check = load_yaml + + try: + opts, args = getopt.getopt( + sys.argv[1:], "hyjtd", ["help", "yaml", "json", "text", "debug"]) + except getopt.GetoptError as err: + # print help information and exit: + print str(err) # will print something like "option -a not recognized" + usage() + sys.exit(2) + for o, a in opts: + if o in ("-h", "--help"): + usage() + sys.exit() + elif o in ("-y", "--yaml"): + load_check = load_yaml + elif o in ("-j", "--json"): + load_check = load_json + elif o in ("-t", "--text"): + load_check = load_text + elif o in ("-d", "--debug"): + logging.basicConfig(level=logging.DEBUG) + else: + assert False, "unhandled option" + + if(len(args) != 2): + usage() + sys.exit(1) + + scen = load_yaml(args[0]) + + test = Test() + + try: + check = load_check(args[1]) + except: + check = {'cdr': []} + test.error("Error loading file:%s" % args[1]) + + test.comment('check cdr record') + check_cdr_recursive(scen['cdr'], check['cdr'], test) + print test + if test.isError(): + sys.exit(1) + +if __name__ == "__main__": + main() diff --git a/bin/check.sh b/bin/check.sh index d8ad04f0..978cb02e 100755 --- a/bin/check.sh +++ b/bin/check.sh @@ -30,6 +30,7 @@ FIX_RETRANS=false GRAPH=false GRAPH_FAIL=false JSON_KAM=false +CDR=false # sipwise password for mysql connections @@ -559,6 +560,24 @@ next_test_filepath() { next_msg="${LOG_DIR}/${msg_name}" } +export_cdr() { + mysql -usipwise -p"${SIPWISE_DB_PASSWORD}" accounting \ + -e "select * from cdr where call_id like 'NGCP\%${1}\%%' and start_time > unix_timestamp(date_sub(now(), interval 1 minute)) order by id desc limit 3\G" > "${2}/cdr.txt" || true +} + +cdr_check() { + if [ -f "$1" ] ; then + echo -n "$(date) - Testing $(basename "$1") against $(basename "$2") -> $(basename "$3")" + if "${BIN_DIR}/cdr_check.py" "--text" "$1" "$2" > "$3" ; then + echo " ok" + return + fi + echo " NOT ok" + else + echo "$(date) - CDR test file $1 doesn't exist, skipping CDR test" + fi +} + usage() { echo "Usage: check.sh [-hCDRTGgJKm] [-d DOMAIN ] [-p PROFILE ] -s [GROUP] check_name" echo "Options:" @@ -576,11 +595,12 @@ usage() { echo -e "\t-K enable tcpdump capture" echo -e "\t-s scenario group. Default: scenarios" echo -e "\t-m enable memdbg csv" + echo -e "\t-c enable cdr validation" echo "Arguments:" echo -e "\tcheck_name. Scenario name to check. This is the name of the directory on GROUP dir." } -while getopts 'hCd:p:Rs:DTPGgrJKm' opt; do +while getopts 'hCd:p:Rs:DTPGgrcJKm' opt; do case $opt in h) usage; exit 0;; C) SKIP=true;; @@ -597,6 +617,7 @@ while getopts 'hCd:p:Rs:DTPGgrJKm' opt; do r) FIX_RETRANS=true;; J) JSON_KAM=true;; m) MEMDBG=true;; + c) CDR=true;; esac done shift $((OPTIND - 1)) @@ -741,6 +762,17 @@ if ! "${SKIP_DELDOMAIN}" ; then echo "$(date) - Done" fi + +if ! "$SKIP_RUNSIPP" && "${CDR}" ; then +# if "${CDR}" ; then + echo "$(date) - Exporting generated CDRs" + sleep 1.5 + export_cdr "${NAME_CHECK}" "${LOG_DIR}" + echo "$(date) - Done" +# fi +fi + + if ! "${SKIP_PARSE}" ; then if ! "${JSON_KAM}" ; then echo "$(date) - Parsing ${LOG_DIR}/kamailio.log" @@ -749,6 +781,7 @@ if ! "${SKIP_PARSE}" ; then fi fi + # let's check the results ERR_FLAG=0 if ! "${SKIP_TESTS}" ; then @@ -764,7 +797,7 @@ if ! "${SKIP_TESTS}" ; then "${BIN_DIR}/generate_tests.sh" -d \ "${SCEN_CHECK_DIR}" "${LOG_DIR}/scenario_ids.yml" "${PROFILE}" - for t in ${SCEN_CHECK_DIR}/*_test.yml; do + for t in ${SCEN_CHECK_DIR}/[0-9][0-9][0-9][0-9]_test.yml; do test_filepath "$t" echo "$(date) - check test $t on $msg" dest=${RESULT_DIR}/$(basename "$t" .yml) @@ -776,6 +809,16 @@ if ! "${SKIP_TESTS}" ; then echo "$(date) - Done" fi done + + if "${CDR}" ; then + echo "$(date) - Validating CDRs" + t_cdr="${SCEN_CHECK_DIR}/cdr_test.yml" + msg="${LOG_DIR}/cdr.txt" + dest="${RESULT_DIR}/cdr_test.tap" + echo "$(date) - check test $t_cdr on $msg" + cdr_check "$t_cdr" "$msg" "${dest}" + echo "$(date) - Done" + fi fi exit ${ERR_FLAG} #EOF diff --git a/bin/config_debug.pl b/bin/config_debug.pl index 51a321b7..1de4aa63 100755 --- a/bin/config_debug.pl +++ b/bin/config_debug.pl @@ -109,6 +109,7 @@ else $yaml->{sems}{debug} = 'yes'; $yaml->{checktools}{sip_check_enable} = 0; $yaml->{security}->{ngcp_panel}->{scripts}->{restapi}->{sslverify} = 'no'; + $yaml->{mediator}{interval} = '1'; my $group_yml_file = $base_dir."/".$group."/config.yml"; if ( -e $group_yml_file ) diff --git a/get_results.sh b/get_results.sh index 3c58f074..c07d8ec3 100755 --- a/get_results.sh +++ b/get_results.sh @@ -6,6 +6,7 @@ PROFILE="CE" DOMAIN="spce.test" GROUP="${GROUP:-scenarios}" RETRANS="" +CDR="" usage() { echo "Usage: get_results.sh [-p PROFILE] [-h] [-g]" @@ -16,6 +17,7 @@ usage() { echo "-P parse only will disable test" echo "-T test only will disable parse" echo "-r fix retransmission issues" + echo "-c enable cdr validation" echo "-x set GROUP scenario. Default: scenarios" echo "BASE_DIR:${BASE_DIR}" echo "BIN_DIR:${BIN_DIR}" @@ -41,7 +43,7 @@ get_scenarios() { fi } -while getopts 'hgGp:TPrx:' opt; do +while getopts 'hgGp:TPrcx:' opt; do case $opt in h) usage; exit 0;; G) GRAPH="-G";; @@ -49,6 +51,7 @@ while getopts 'hgGp:TPrx:' opt; do P) OPTS="-T";; T) OPTS="-P";; r) RETRANS="-r";; + c) CDR="-c";; p) PROFILE=$OPTARG;; x) GROUP=$OPTARG;; esac @@ -70,7 +73,8 @@ fi get_scenarios echo "${SCENARIOS}" | tr ' ' '\n' \ - | parallel "${BIN_DIR}/check.sh ${GRAPH} -J -C -R ${OPTS} ${RETRANS} -d ${DOMAIN} -p ${PROFILE} -s ${GROUP}" + | parallel "${BIN_DIR}/check.sh ${GRAPH} -J -C -R ${OPTS} ${RETRANS} ${CDR} -d ${DOMAIN} -p ${PROFILE} -s ${GROUP}" status=$? echo "$(date) - All done[$status]" exit $status + diff --git a/run_tests.sh b/run_tests.sh index a0b8399a..8a1894b7 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -17,17 +17,19 @@ SKIP=false SKIP_CAPTURE=false SKIP_RETRANS=false MEMDBG=false +CDR=false error_flag=0 usage() { - echo "Usage: run_test.sh [-p PROFILE] [-c] [-t]" + echo "Usage: run_test.sh [-p PROFILE] [-C] [-t]" echo "-p CE|PRO default is CE" echo "-l print available SCENARIOS in GROUP" - echo "-c skips configuration of the environment" + echo "-C skips configuration of the environment" echo "-K capture messages with tcpdump" echo "-x set GROUP scenario. Default: scenarios" echo "-t set timeout in secs for pid_watcher.py [PRO]. Default: 300" echo "-r fix retransmission issues" + echo "-c export CDRs at the end of the test" echo "-h this help" echo "BASE_DIR:${BASE_DIR}" @@ -72,12 +74,13 @@ while getopts 'hlcp:Kx:t:rm' opt; do case $opt in h) usage; exit 0;; l) SHOW_SCENARIOS=true;; - c) SKIP=true;; + C) SKIP=true;; p) PROFILE=$OPTARG;; K) SKIP_CAPTURE=true;; x) GROUP=$OPTARG;; t) TIMEOUT=$OPTARG;; r) SKIP_RETRANS=true;; + c) CDR=true;; m) MEMDBG=true;; esac done @@ -173,6 +176,11 @@ if "${SKIP_RETRANS}" ; then OPTS+=(-r) fi +if "${CDR}" ; then + echo "$(date) - enable cdr export" + OPTS+=(-c) +fi + for t in ${SCENARIOS}; do echo "$(date) - Run[${GROUP}/${PROFILE}]: $t =================================================" log_temp="${LOG_DIR}/${t}" diff --git a/scenarios/incoming_foreign_dom/cdr_test.yml.tt2 b/scenarios/incoming_foreign_dom/cdr_test.yml.tt2 new file mode 100644 index 00000000..657baf63 --- /dev/null +++ b/scenarios/incoming_foreign_dom/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'external' + source_domain: 'external.test' + source_cli: 'external' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: '4311003' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/incoming_hih/cdr_test.yml.tt2 b/scenarios/incoming_hih/cdr_test.yml.tt2 new file mode 100644 index 00000000..48b2f7f2 --- /dev/null +++ b/scenarios/incoming_hih/cdr_test.yml.tt2 @@ -0,0 +1,19 @@ +cdr: + - source_user: '004321001' + source_domain: '127.0.2.1' + source_cli: '004321001' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: '4311003' + call_type: 'call' + call_status: 'ok' + call_code: '200' + - source_user: 'testuser1003' + source_domain: 'spce.test' + source_cli: '4311003' + destination_user: 'testuser1002' + destination_domain: 'spce.test' + destination_user_dialed: '4311002' + call_type: 'cfu' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/incoming_peer/cdr_test.yml.tt2 b/scenarios/incoming_peer/cdr_test.yml.tt2 new file mode 100644 index 00000000..4220883f --- /dev/null +++ b/scenarios/incoming_peer/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: '004321001' + source_domain: '127.0.2.1' + source_cli: '004321001' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: '4311003' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite/cdr_test.yml.tt2 b/scenarios/invite/cdr_test.yml.tt2 new file mode 100644 index 00000000..7e903ea7 --- /dev/null +++ b/scenarios/invite/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1003' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite_allowedcli_match/cdr_test.yml.tt2 b/scenarios/invite_allowedcli_match/cdr_test.yml.tt2 new file mode 100644 index 00000000..639957c9 --- /dev/null +++ b/scenarios/invite_allowedcli_match/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '431100299' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1003' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite_allowedcli_match_alias/cdr_test.yml.tt2 b/scenarios/invite_allowedcli_match_alias/cdr_test.yml.tt2 new file mode 100644 index 00000000..24024007 --- /dev/null +++ b/scenarios/invite_allowedcli_match_alias/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311009' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1003' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite_allowedcli_nonmatch/cdr_test.yml.tt2 b/scenarios/invite_allowedcli_nonmatch/cdr_test.yml.tt2 new file mode 100644 index 00000000..9f21b819 --- /dev/null +++ b/scenarios/invite_allowedcli_nonmatch/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '43122122' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1003' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite_allowedcli_nonmatch_reject/cdr_test.yml.tt2 b/scenarios/invite_allowedcli_nonmatch_reject/cdr_test.yml.tt2 new file mode 100644 index 00000000..4697e591 --- /dev/null +++ b/scenarios/invite_allowedcli_nonmatch_reject/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '431100222' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1003' + call_type: 'call' + call_status: 'other' + call_code: '403' \ No newline at end of file diff --git a/scenarios/invite_allowip/cdr_test.yml.tt2 b/scenarios/invite_allowip/cdr_test.yml.tt2 new file mode 100644 index 00000000..ffce6dc6 --- /dev/null +++ b/scenarios/invite_allowip/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '0' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1003' + call_type: 'call' + call_status: 'other' + call_code: '403' \ No newline at end of file diff --git a/scenarios/invite_allowip_soundset/cdr_test.yml.tt2 b/scenarios/invite_allowip_soundset/cdr_test.yml.tt2 new file mode 100644 index 00000000..ffce6dc6 --- /dev/null +++ b/scenarios/invite_allowip_soundset/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '0' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1003' + call_type: 'call' + call_status: 'other' + call_code: '403' \ No newline at end of file diff --git a/scenarios/invite_anonymous/cdr_test.yml.tt2 b/scenarios/invite_anonymous/cdr_test.yml.tt2 new file mode 100644 index 00000000..52288aab --- /dev/null +++ b/scenarios/invite_anonymous/cdr_test.yml.tt2 @@ -0,0 +1,12 @@ +cdr: + - source_user: 'anonymous' + source_domain: 'spce.test' + source_cli: '4311002' + source_clir: '1' + source_ip: '127.126.0.1' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1003' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite_blockin_blst/cdr_test.yml.tt2 b/scenarios/invite_blockin_blst/cdr_test.yml.tt2 new file mode 100644 index 00000000..f85a1bba --- /dev/null +++ b/scenarios/invite_blockin_blst/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: '4311003' + call_type: 'call' + call_status: 'other' + call_code: '403' \ No newline at end of file diff --git a/scenarios/invite_blockin_clir/cdr_test.yml.tt2 b/scenarios/invite_blockin_clir/cdr_test.yml.tt2 new file mode 100644 index 00000000..cd238152 --- /dev/null +++ b/scenarios/invite_blockin_clir/cdr_test.yml.tt2 @@ -0,0 +1,11 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + source_clir: '1' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: '4311003' + call_type: 'call' + call_status: 'other' + call_code: '403' \ No newline at end of file diff --git a/scenarios/invite_blockin_wlst/cdr_test.yml.tt2 b/scenarios/invite_blockin_wlst/cdr_test.yml.tt2 new file mode 100644 index 00000000..f85a1bba --- /dev/null +++ b/scenarios/invite_blockin_wlst/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: '4311003' + call_type: 'call' + call_status: 'other' + call_code: '403' \ No newline at end of file diff --git a/scenarios/invite_blockout_blst/cdr_test.yml.tt2 b/scenarios/invite_blockout_blst/cdr_test.yml.tt2 new file mode 100644 index 00000000..a21cec87 --- /dev/null +++ b/scenarios/invite_blockout_blst/cdr_test.yml.tt2 @@ -0,0 +1,11 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: '4311003' + call_type: 'call' + call_status: 'other' + call_code: '403' + duration: '0' \ No newline at end of file diff --git a/scenarios/invite_blockout_ncos/cdr_test.yml.tt2 b/scenarios/invite_blockout_ncos/cdr_test.yml.tt2 new file mode 100644 index 00000000..a21cec87 --- /dev/null +++ b/scenarios/invite_blockout_ncos/cdr_test.yml.tt2 @@ -0,0 +1,11 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: '4311003' + call_type: 'call' + call_status: 'other' + call_code: '403' + duration: '0' \ No newline at end of file diff --git a/scenarios/invite_blockout_pinoverride/cdr_test.yml.tt2 b/scenarios/invite_blockout_pinoverride/cdr_test.yml.tt2 new file mode 100644 index 00000000..adc371ba --- /dev/null +++ b/scenarios/invite_blockout_pinoverride/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: '\*80\*4444311003' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite_blockout_wlst/cdr_test.yml.tt2 b/scenarios/invite_blockout_wlst/cdr_test.yml.tt2 new file mode 100644 index 00000000..f85a1bba --- /dev/null +++ b/scenarios/invite_blockout_wlst/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: '4311003' + call_type: 'call' + call_status: 'other' + call_code: '403' \ No newline at end of file diff --git a/scenarios/invite_callforward/cdr_test.yml.tt2 b/scenarios/invite_callforward/cdr_test.yml.tt2 new file mode 100644 index 00000000..a71a8bfe --- /dev/null +++ b/scenarios/invite_callforward/cdr_test.yml.tt2 @@ -0,0 +1,28 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1004' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1004' + call_type: 'call' + call_status: 'ok' + call_code: '200' + - source_user: 'testuser1004' + source_domain: 'spce.test' + source_cli: '4311004' + destination_user: 'testuser1005' + destination_domain: 'spce.test' + destination_user_dialed: '4311005' + call_type: 'cfb' + call_status: 'ok' + call_code: '200' + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1001' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1001' + call_type: 'call' + call_status: 'ok' + call_code: '200' diff --git a/scenarios/invite_concurrent_max/cdr_test.yml.tt2 b/scenarios/invite_concurrent_max/cdr_test.yml.tt2 new file mode 100644 index 00000000..4b209ec3 --- /dev/null +++ b/scenarios/invite_concurrent_max/cdr_test.yml.tt2 @@ -0,0 +1,20 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1003' + call_type: 'call' + call_status: 'ok' + call_code: '200' + - source_user: 'testuser1004' + source_domain: 'spce.test' + source_cli: '4311004' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1003' + call_type: 'call' + call_status: 'busy' + call_code: '486' + duration: '0' \ No newline at end of file diff --git a/scenarios/invite_concurrent_max_out/cdr_test.yml.tt2 b/scenarios/invite_concurrent_max_out/cdr_test.yml.tt2 new file mode 100644 index 00000000..d4ad38ce --- /dev/null +++ b/scenarios/invite_concurrent_max_out/cdr_test.yml.tt2 @@ -0,0 +1,19 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: '004321001' + destination_domain: '127.0.2.1' + destination_user_dialed: '004321001' + call_type: 'call' + call_status: 'ok' + call_code: '200' + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: '004421003' + destination_domain: '127.0.2.1' + destination_user_dialed: '004421003' + call_type: 'call' + call_status: 'other' + call_code: '403' \ No newline at end of file diff --git a/scenarios/invite_concurrent_max_out_per_account/cdr_test.yml.tt2 b/scenarios/invite_concurrent_max_out_per_account/cdr_test.yml.tt2 new file mode 100644 index 00000000..dd6c3459 --- /dev/null +++ b/scenarios/invite_concurrent_max_out_per_account/cdr_test.yml.tt2 @@ -0,0 +1,20 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: '004321001' + destination_domain: '127.0.2.1' + destination_user_dialed: '004321001' + call_type: 'call' + call_status: 'ok' + call_code: '200' + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: '004421003' + destination_domain: '127.0.2.1' + destination_user_dialed: '004421003' + call_type: 'call' + call_status: 'other' + call_code: '403' + duration: '0' \ No newline at end of file diff --git a/scenarios/invite_concurrent_max_per_account/cdr_test.yml.tt2 b/scenarios/invite_concurrent_max_per_account/cdr_test.yml.tt2 new file mode 100644 index 00000000..cfb25d62 --- /dev/null +++ b/scenarios/invite_concurrent_max_per_account/cdr_test.yml.tt2 @@ -0,0 +1,20 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1003' + call_type: 'call' + call_status: 'ok' + call_code: '200' + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1004' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1004' + call_type: 'call' + call_status: 'busy' + call_code: '486' + duration: '0' \ No newline at end of file diff --git a/scenarios/invite_conference_update/cdr_test.yml.tt2 b/scenarios/invite_conference_update/cdr_test.yml.tt2 new file mode 100644 index 00000000..03f205f1 --- /dev/null +++ b/scenarios/invite_conference_update/cdr_test.yml.tt2 @@ -0,0 +1,21 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1001' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1001' + call_type: 'call' + call_status: 'ok' + call_code: '200' + - source_user: 'testuser1001' + source_domain: 'spce.test' + source_cli: '4311001' + destination_user: 'conf=4311001' + destination_domain: 'conference.local' + destination_user_dialed: 'conf=4311001' + destination_user_in: 'conf=4311001' + destination_domain_in: 'conference.local' + call_type: 'cfu' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite_foreign_dom/cdr_test.yml.tt2 b/scenarios/invite_foreign_dom/cdr_test.yml.tt2 new file mode 100644 index 00000000..b0badf54 --- /dev/null +++ b/scenarios/invite_foreign_dom/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: '004321001' + destination_domain: 'external.test' + destination_user_dialed: '004321001' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite_ignore_allowip/cdr_test.yml.tt2 b/scenarios/invite_ignore_allowip/cdr_test.yml.tt2 new file mode 100644 index 00000000..7e903ea7 --- /dev/null +++ b/scenarios/invite_ignore_allowip/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1003' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite_lateoam/cdr_test.yml.tt2 b/scenarios/invite_lateoam/cdr_test.yml.tt2 new file mode 100644 index 00000000..7e903ea7 --- /dev/null +++ b/scenarios/invite_lateoam/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1003' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite_no_refer/cdr_test.yml.tt2 b/scenarios/invite_no_refer/cdr_test.yml.tt2 new file mode 100644 index 00000000..7e903ea7 --- /dev/null +++ b/scenarios/invite_no_refer/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1003' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite_offline/cdr_test.yml.tt2 b/scenarios/invite_offline/cdr_test.yml.tt2 new file mode 100644 index 00000000..f003a991 --- /dev/null +++ b/scenarios/invite_offline/cdr_test.yml.tt2 @@ -0,0 +1,21 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: '4311003' + call_type: 'call' + call_status: 'noanswer' + call_code: '480' + duration: '0' + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1003' + call_type: 'call' + call_status: 'noanswer' + call_code: '480' + duration: '0' \ No newline at end of file diff --git a/scenarios/invite_peerout/cdr_test.yml.tt2 b/scenarios/invite_peerout/cdr_test.yml.tt2 new file mode 100644 index 00000000..6667f5a0 --- /dev/null +++ b/scenarios/invite_peerout/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: '004321001' + destination_domain: '127.0.2.1' + destination_user_dialed: '004321001' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite_peerout_failover/cdr_test.yml.tt2 b/scenarios/invite_peerout_failover/cdr_test.yml.tt2 new file mode 100644 index 00000000..6667f5a0 --- /dev/null +++ b/scenarios/invite_peerout_failover/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: '004321001' + destination_domain: '127.0.2.1' + destination_user_dialed: '004321001' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite_peerout_max_out/cdr_test.yml.tt2 b/scenarios/invite_peerout_max_out/cdr_test.yml.tt2 new file mode 100644 index 00000000..6667f5a0 --- /dev/null +++ b/scenarios/invite_peerout_max_out/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: '004321001' + destination_domain: '127.0.2.1' + destination_user_dialed: '004321001' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite_peerout_rewrite/cdr_test.yml.tt2 b/scenarios/invite_peerout_rewrite/cdr_test.yml.tt2 new file mode 100644 index 00000000..c8fddf65 --- /dev/null +++ b/scenarios/invite_peerout_rewrite/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: '4321001' + destination_domain: '127.0.2.1' + destination_user_dialed: '4321001' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite_peerout_rewrite_pv_regex/cdr_test.yml.tt2 b/scenarios/invite_peerout_rewrite_pv_regex/cdr_test.yml.tt2 new file mode 100644 index 00000000..0596a391 --- /dev/null +++ b/scenarios/invite_peerout_rewrite_pv_regex/cdr_test.yml.tt2 @@ -0,0 +1,11 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + source_user_out: '1002' + destination_user: '4321001' + destination_domain: '127.0.2.1' + destination_user_dialed: '4321001' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite_redirect/cdr_test.yml.tt2 b/scenarios/invite_redirect/cdr_test.yml.tt2 new file mode 100644 index 00000000..7e903ea7 --- /dev/null +++ b/scenarios/invite_redirect/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1003' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite_redirect_blocked/cdr_test.yml.tt2 b/scenarios/invite_redirect_blocked/cdr_test.yml.tt2 new file mode 100644 index 00000000..b6df7f45 --- /dev/null +++ b/scenarios/invite_redirect_blocked/cdr_test.yml.tt2 @@ -0,0 +1,11 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1003' + call_type: 'call' + call_status: 'other' + call_code: '302' + duration: '0' \ No newline at end of file diff --git a/scenarios/invite_retrans/cdr_test.yml.tt2 b/scenarios/invite_retrans/cdr_test.yml.tt2 new file mode 100644 index 00000000..7e903ea7 --- /dev/null +++ b/scenarios/invite_retrans/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1003' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite_tcp_udp/cdr_test.yml.tt2 b/scenarios/invite_tcp_udp/cdr_test.yml.tt2 new file mode 100644 index 00000000..7e903ea7 --- /dev/null +++ b/scenarios/invite_tcp_udp/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1003' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite_tcp_udp_reinvite/cdr_test.yml.tt2 b/scenarios/invite_tcp_udp_reinvite/cdr_test.yml.tt2 new file mode 100644 index 00000000..7e903ea7 --- /dev/null +++ b/scenarios/invite_tcp_udp_reinvite/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1003' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite_trusted_anonymous/cdr_test.yml.tt2 b/scenarios/invite_trusted_anonymous/cdr_test.yml.tt2 new file mode 100644 index 00000000..bb5dd846 --- /dev/null +++ b/scenarios/invite_trusted_anonymous/cdr_test.yml.tt2 @@ -0,0 +1,11 @@ +cdr: + - source_user: 'anonymous' + source_domain: 'spce.test' + source_cli: '4311002' + source_clir: '1' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1003' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/invite_voicebox/cdr_test.yml.tt2 b/scenarios/invite_voicebox/cdr_test.yml.tt2 new file mode 100644 index 00000000..b5e538da --- /dev/null +++ b/scenarios/invite_voicebox/cdr_test.yml.tt2 @@ -0,0 +1,21 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1001' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1001' + call_type: 'call' + call_status: 'ok' + call_code: '200' + - source_user: 'testuser1001' + source_domain: 'spce.test' + source_cli: '4311001' + destination_user: 'vmu4311001' + destination_domain: 'voicebox.local' + destination_user_dialed: 'vmu4311001' + destination_user_in: 'vmu4311001' + destination_domain_in: 'voicebox.local' + call_type: 'cfu' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios/lock_ported/cdr_test.yml.tt2 b/scenarios/lock_ported/cdr_test.yml.tt2 new file mode 100644 index 00000000..e6390827 --- /dev/null +++ b/scenarios/lock_ported/cdr_test.yml.tt2 @@ -0,0 +1,29 @@ +cdr: + - source_user: 'testuser1001' + source_domain: 'spce.test' + source_cli: '4311001' + destination_user: 'testuser1004' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1004' + call_type: 'call' + call_status: 'other' + call_code: '403' + duration: '0' + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1001' + destination_domain: 'spce.test' + destination_user_dialed: 'testuser1001' + call_type: 'call' + call_status: 'ok' + call_code: '200' + - source_user: 'testuser1001' + source_domain: 'spce.test' + source_cli: '4311001' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: '4311003' + call_type: 'cfu' + call_status: 'ok' + call_code: '200' diff --git a/scenarios/reminder/cdr_test.yml.tt2 b/scenarios/reminder/cdr_test.yml.tt2 new file mode 100644 index 00000000..221ba53a --- /dev/null +++ b/scenarios/reminder/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1001' + source_domain: 'spce.test' + source_cli: '4311001' + destination_user: '\*55\*1420' + destination_domain: 'vsc.local' + destination_user_dialed: '\*55\*1420' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios_lnp/incoming_peer/cdr_test.yml.tt2 b/scenarios_lnp/incoming_peer/cdr_test.yml.tt2 new file mode 100644 index 00000000..7479b83d --- /dev/null +++ b/scenarios_lnp/incoming_peer/cdr_test.yml.tt2 @@ -0,0 +1,19 @@ +cdr: + - source_user: '004321001' + source_domain: '127.0.2.1' + source_cli: '004321001' + destination_user: 'testuser1001' + destination_domain: 'spce.test' + destination_user_dialed: '4311001' + call_type: 'call' + call_status: 'ok' + call_code: '200' + - source_user: 'testuser1001' + source_domain: 'spce.test' + source_cli: '4311001' + destination_user: '4318881003' + destination_domain: '127.1.0.1' + destination_user_dialed: '4311003' + call_type: 'cfu' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios_lnp/incoming_peer_unallocated_authoritative/cdr_test.yml.tt2 b/scenarios_lnp/incoming_peer_unallocated_authoritative/cdr_test.yml.tt2 new file mode 100644 index 00000000..aea6f68f --- /dev/null +++ b/scenarios_lnp/incoming_peer_unallocated_authoritative/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: '004411001' + source_domain: '127.0.2.1' + source_cli: '004411001' + destination_user: '4321001' + destination_domain: 'spce.test' + destination_user_dialed: '4321001' + call_type: 'call' + call_status: 'offline' + call_code: '404' \ No newline at end of file diff --git a/scenarios_lnp/invite/cdr_test.yml.tt2 b/scenarios_lnp/invite/cdr_test.yml.tt2 new file mode 100644 index 00000000..c864c241 --- /dev/null +++ b/scenarios_lnp/invite/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: '4318881001' + destination_domain: '127.0.2.1' + destination_user_dialed: '4311001' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios_lnp/invite_ncos_black/cdr_test.yml.tt2 b/scenarios_lnp/invite_ncos_black/cdr_test.yml.tt2 new file mode 100644 index 00000000..360dfb95 --- /dev/null +++ b/scenarios_lnp/invite_ncos_black/cdr_test.yml.tt2 @@ -0,0 +1,30 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: '43999300' + destination_domain: '127.0.2.1' + destination_user_dialed: '43999300' + call_type: 'call' + call_status: 'ok' + call_code: '200' + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: '43999100' + destination_domain: 'spce.test' + destination_user_dialed: '43999100' + call_type: 'call' + call_status: 'other' + call_code: '403' + duration: '0' + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: '4318881001' + destination_domain: 'spce.test' + destination_user_dialed: '43999200' + call_type: 'call' + call_status: 'other' + call_code: '403' + duration: '0' \ No newline at end of file diff --git a/scenarios_lnp/invite_ncos_white/cdr_test.yml.tt2 b/scenarios_lnp/invite_ncos_white/cdr_test.yml.tt2 new file mode 100644 index 00000000..596e20d3 --- /dev/null +++ b/scenarios_lnp/invite_ncos_white/cdr_test.yml.tt2 @@ -0,0 +1,26 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: '43999300' + destination_user_dialed: '43999300' + call_type: 'call' + call_status: 'other' + call_code: '403' + duration: '0' + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: '4318881001' + destination_user_dialed: '43999200' + call_type: 'call' + call_status: 'ok' + call_code: '200' + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: '43999100' + destination_user_dialed: '43999100' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios_lnp/invite_peerout/cdr_test.yml.tt2 b/scenarios_lnp/invite_peerout/cdr_test.yml.tt2 new file mode 100644 index 00000000..f8fd3f22 --- /dev/null +++ b/scenarios_lnp/invite_peerout/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: '0043test28881001' + destination_domain: '127.0.2.1' + destination_user_dialed: '004321001' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios_lnp/invite_peerout_rn/cdr_test.yml.tt2 b/scenarios_lnp/invite_peerout_rn/cdr_test.yml.tt2 new file mode 100644 index 00000000..ae2ca0db --- /dev/null +++ b/scenarios_lnp/invite_peerout_rn/cdr_test.yml.tt2 @@ -0,0 +1,10 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: '004328881001' + destination_domain: '127.0.2.1' + destination_user_dialed: '004321001' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios_pbx/incoming_shared_line/cdr_test.yml.tt2 b/scenarios_pbx/incoming_shared_line/cdr_test.yml.tt2 new file mode 100644 index 00000000..c942c807 --- /dev/null +++ b/scenarios_pbx/incoming_shared_line/cdr_test.yml.tt2 @@ -0,0 +1,12 @@ +cdr: + - source_user: 'testuser1003' + source_domain: 'spce.test' + source_cli: '43110021003' + source_user_out: '43110021003' + destination_user: 'testuser1002' + destination_domain: 'spce.test' + destination_user_dialed: '1002' + destination_user_in: '4311002' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios_pbx/invite/cdr_test.yml.tt2 b/scenarios_pbx/invite/cdr_test.yml.tt2 new file mode 100644 index 00000000..724ce02d --- /dev/null +++ b/scenarios_pbx/invite/cdr_test.yml.tt2 @@ -0,0 +1,11 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: '1003' + destination_user_in: '43110021003' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/scenarios_pbx/invite_shared_line/cdr_test.yml.tt2 b/scenarios_pbx/invite_shared_line/cdr_test.yml.tt2 new file mode 100644 index 00000000..724ce02d --- /dev/null +++ b/scenarios_pbx/invite_shared_line/cdr_test.yml.tt2 @@ -0,0 +1,11 @@ +cdr: + - source_user: 'testuser1002' + source_domain: 'spce.test' + source_cli: '4311002' + destination_user: 'testuser1003' + destination_domain: 'spce.test' + destination_user_dialed: '1003' + destination_user_in: '43110021003' + call_type: 'call' + call_status: 'ok' + call_code: '200' \ No newline at end of file diff --git a/tests/do_test_yaml_format.sh b/tests/do_test_yaml_format.sh index c18b3ed2..dcb49e93 100755 --- a/tests/do_test_yaml_format.sh +++ b/tests/do_test_yaml_format.sh @@ -2,7 +2,7 @@ export BASE_DIR=$(pwd) DEST_DIR=${RESULTS} ./bin/generate_tests.sh -d "$1" tests/fixtures/scenario_ids.yml PRO -find "${RESULTS}/$1" -type f -name '*_test.yml' | while read -r i; do +find "${RESULTS}/$1" -type f -name '[0-9][0-9][0-9][0-9]_test.yml' | while read -r i; do ./tests/test_yaml_format.py "$i" | sed -e 's/skip>/skipped>/g' > "$i.xml" done