diff --git a/bench.sh b/bench.sh index 8bfab83f..bb63424b 100755 --- a/bench.sh +++ b/bench.sh @@ -1,21 +1,24 @@ #!/bin/bash SKIP_CONFIG=false PROFILE=CE +GROUP="${GROUP:-scenarios}" usage() { echo "Usage: bench.sh [-p PROFILE] [-C] [num_runs]" echo "Options:" echo -e "\t-p CE|PRO default is CE" echo -e "\t-C skips configuration of the environment" + echo -e "\t-x set GROUP scenario. Default: scenarios" echo -e "\t-h this help" echo -e "num_runs default is 20" } -while getopts 'hCp:' opt; do +while getopts 'hCp:x:' opt; do case $opt in h) usage; exit 0;; C) SKIP_CONFIG=true;; p) PROFILE=${OPTARG};; + x) GROUP=${OPTARG};; *) echo "Unknown option $opt"; usage; exit 1;; esac done @@ -28,7 +31,7 @@ if [ "${PROFILE}" != "CE" ] && [ "${PROFILE}" != "PRO" ]; then fi NUM=${1:-20} -RUN_OPS=(-C -c -r -p"${PROFILE}") +RUN_OPS=(-C -c -r -p"${PROFILE}" -x"${GROUP}") # clean previous rm -rf log_* result_* @@ -39,8 +42,11 @@ export BASE_DIR if ! "${SKIP_CONFIG}" ; then export PERL5LIB="${BASE_DIR}/lib" echo "add configuration for tests" - ./bin/config_debug.pl on - ngcpcfg apply 'k-c-t on' + ./bin/config_debug.pl -g"${GROUP}" on + ( + cd /etc/ngcp-config || true + ngcpcfg apply "k-c-t ${GROUP} on" + ) fi echo "$(date) - Starting $NUM tests" @@ -67,6 +73,9 @@ set +o pipefail if ! "${SKIP_CONFIG}" ; then echo "remove configuration for tests" - ./bin/config_debug.pl off - ngcpcfg apply 'k-c-t off' + ./bin/config_debug.pl -g"${GROUP}" off + ( + cd /etc/ngcp-config || true + ngcpcfg apply "k-c-t ${GROUP} off" + ) fi \ No newline at end of file diff --git a/bin/generate_test_tt2.pl b/bin/generate_test_tt2.pl index 58286e00..4486c0f2 100755 --- a/bin/generate_test_tt2.pl +++ b/bin/generate_test_tt2.pl @@ -93,6 +93,8 @@ sub subst_common $line =~ s/^: Sipwise .+/: Sipwise NGCP Proxy/; } elsif($line =~ /^Content-Length: [1-9]/i) { $line =~ s/: \d+/: \\d+/; + } elsif($line =~ /^P-LB-Uptime: /i) { + $line =~ s/: \d+/: \\d+/; } return $line; } diff --git a/bin/show_flow_diff.pl b/bin/show_flow_diff.pl index 76ecffd6..0037ac1e 100755 --- a/bin/show_flow_diff.pl +++ b/bin/show_flow_diff.pl @@ -29,6 +29,7 @@ use YAML::XS; use utf8; use JSON; use Text::Diff; +use Scalar::Util qw(reftype); sub usage { @@ -59,21 +60,49 @@ my $log; $log = decode_json($json); } +sub str_values +{ + my $data = shift; + my $res = shift; + + foreach my $key (keys %{$data}) + { + my $_type = defined(reftype($data->{$key})) ? reftype($data->{$key}) : "HASH"; + if( $_type eq 'ARRAY') { + $res .= " ".$key.": [\n"; + foreach my $val (@{$data->{$key}}){ + $res .= " ".$val.",\n"; + } + $res .= " ]\n"; + } elsif( $_type eq 'HASH') { + $res .= " ".$key.": ".$data->{$key}."\n"; + } + } + return $res; +} + my $text_yml = ""; foreach my $i (@{$test->{'flow'}}) { foreach my $key (keys %{$i}) { $text_yml .= " - ".$key.":\n"; + if($i->{$key}) { + $text_yml = str_values($i->{$key}, $text_yml); + } } } my $text_json = ""; -foreach my $i (@{$log->{'flow'}}) +while (my ($index, $element) = each(@{$log->{'flow'}})) { - foreach my $key (keys %{$i}) + my $element_yml = @{$test->{'flow'}}[$index]; + foreach my $key (keys %{$element}) { $text_json .= " - ".$key.":\n"; + if(defined($element_yml->{$key})) { + $text_json = str_values($element_yml->{$key}, $text_json); + } } } diff --git a/scenarios/invite_conference_update/media181sec.pcap b/scenarios/invite_conference_update/media181sec.pcap deleted file mode 100644 index a8bed169..00000000 Binary files a/scenarios/invite_conference_update/media181sec.pcap and /dev/null differ diff --git a/scenarios/invite_conference_update/media181sec.pcap b/scenarios/invite_conference_update/media181sec.pcap new file mode 120000 index 00000000..d95ed875 --- /dev/null +++ b/scenarios/invite_conference_update/media181sec.pcap @@ -0,0 +1 @@ +../media181sec.pcap \ No newline at end of file diff --git a/set_config.sh b/set_config.sh index 9e9e3748..117433d5 100755 --- a/set_config.sh +++ b/set_config.sh @@ -32,6 +32,7 @@ echo "$(date) - Removed apicert.pem" rm -f "${BASE_DIR}/apicert.pem" echo "$(date) - Setting config debug on" "${BIN_DIR}/config_debug.pl" -g "${GROUP}" on ${DOMAIN} +cd /etc/ngcp-config || exit 3 if ! ngcpcfg apply "config debug on via kamailio-config-tests" ; then echo "$(date) - ngcpcfg apply returned $?" error_flag=4