From 6b9e569c917181f941e19d0257db3c635d1af9e9 Mon Sep 17 00:00:00 2001 From: Guillem Jover Date: Tue, 18 Feb 2020 22:03:51 +0100 Subject: [PATCH] TT#71952 Integrate ngcpcfg functional tests into t testsuite There were functional tests for the get and values actions, but had never been hooked into any testing framework. And some obsolete build action tests already covered by the python tests. Rewrite the get tests in python so that they get executed within docker with the expected permissions, and remove the old unhooked tests that are just confusing when adding new functionality. Change-Id: I7570e35428c1fa0a0f26de75721f84365d4daf9a --- t/fixtures/repos/config.yml | 15 + t/fixtures/repos/constants.yml | 9 + t/test_ngcpcfg_get.py | 66 +++++ testsuite/build-check | 87 ------ testsuite/cpanfile | 13 - testsuite/ngcp-config/config.yml | 279 ------------------ testsuite/ngcp-config/constants.yml | 129 -------- .../templates/testsuite/crontab.tt2 | 18 -- .../templates/testsuite/mysql/my.cnf.tt2.sp1 | 170 ----------- .../templates/testsuite/mysql/my.cnf.tt2.sp2 | 170 ----------- .../testsuite/mysql/ngcpcfg.services | 5 - .../ngcp-ossbss/logging.conf.postbuild | 1 - .../testsuite/ngcp-ossbss/logging.conf.tt2 | 16 - .../ngcp-ossbss/mysql_values.cfg.services | 21 -- .../ngcp-ossbss/mysql_values.cfg.tt2 | 4 - .../ngcp-ossbss/provisioning.conf.tt2 | 65 ---- .../ngcp-ossbss/provisioning.htpasswd.tt2 | 4 - .../ngcp-www-admin/admin.conf.services | 2 - .../testsuite/ngcp-www-admin/admin.conf.tt2 | 40 --- .../precedence/all/test.customtt.tt2 | 1 - .../precedence/all/test.customtt.tt2.sp1 | 1 - .../testsuite/precedence/all/test.tt2 | 1 - .../testsuite/precedence/all/test.tt2.sp1 | 1 - .../templates/testsuite/testtemplate.tt2 | 1 - testsuite/ngcpcfg-testsuite.cfg | 31 -- testsuite/values-check | 83 ------ 26 files changed, 90 insertions(+), 1143 deletions(-) create mode 100644 t/test_ngcpcfg_get.py delete mode 100644 testsuite/build-check delete mode 100644 testsuite/cpanfile delete mode 100644 testsuite/ngcp-config/config.yml delete mode 100644 testsuite/ngcp-config/constants.yml delete mode 100644 testsuite/ngcp-config/templates/testsuite/crontab.tt2 delete mode 100644 testsuite/ngcp-config/templates/testsuite/mysql/my.cnf.tt2.sp1 delete mode 100644 testsuite/ngcp-config/templates/testsuite/mysql/my.cnf.tt2.sp2 delete mode 100644 testsuite/ngcp-config/templates/testsuite/mysql/ngcpcfg.services delete mode 100644 testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/logging.conf.postbuild delete mode 100644 testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/logging.conf.tt2 delete mode 100644 testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/mysql_values.cfg.services delete mode 100644 testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/mysql_values.cfg.tt2 delete mode 100644 testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/provisioning.conf.tt2 delete mode 100644 testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/provisioning.htpasswd.tt2 delete mode 100644 testsuite/ngcp-config/templates/testsuite/ngcp-www-admin/admin.conf.services delete mode 100644 testsuite/ngcp-config/templates/testsuite/ngcp-www-admin/admin.conf.tt2 delete mode 100644 testsuite/ngcp-config/templates/testsuite/precedence/all/test.customtt.tt2 delete mode 100644 testsuite/ngcp-config/templates/testsuite/precedence/all/test.customtt.tt2.sp1 delete mode 100644 testsuite/ngcp-config/templates/testsuite/precedence/all/test.tt2 delete mode 100644 testsuite/ngcp-config/templates/testsuite/precedence/all/test.tt2.sp1 delete mode 100644 testsuite/ngcp-config/templates/testsuite/testtemplate.tt2 delete mode 100644 testsuite/ngcpcfg-testsuite.cfg delete mode 100644 testsuite/values-check diff --git a/t/fixtures/repos/config.yml b/t/fixtures/repos/config.yml index e6860740..def39abf 100644 --- a/t/fixtures/repos/config.yml +++ b/t/fixtures/repos/config.yml @@ -6,3 +6,18 @@ cluster_sets: dispatcher_id: '50' default_set: default type: central +www_admin: + fees_csv: + element_order: + - destination + - zone + - zone_detail + - onpeak_init_rate + - onpeak_init_interval + - onpeak_follow_rate + - onpeak_follow_interval + - offpeak_init_rate + - offpeak_init_interval + - offpeak_follow_rate + - offpeak_follow_interval + - use_free_time diff --git a/t/fixtures/repos/constants.yml b/t/fixtures/repos/constants.yml index b77b96bb..d97221a7 100644 --- a/t/fixtures/repos/constants.yml +++ b/t/fixtures/repos/constants.yml @@ -1,2 +1,11 @@ --- tests: +database: + dbhost: localhost + dbport: 3306 +ossbss: + provisioning: + database: + name: provisioning + user: soap + pass: hEuxXrzLF43X93ULhoNu diff --git a/t/test_ngcpcfg_get.py b/t/test_ngcpcfg_get.py new file mode 100644 index 00000000..5d49d000 --- /dev/null +++ b/t/test_ngcpcfg_get.py @@ -0,0 +1,66 @@ +#!/usr/bin/env py.test-3 + +import pytest +import re +import tempfile + +############################################################### +# ngcpcfg get +############################################################### + + +@pytest.mark.get +def test_get_action_missing_key_parameter(ngcpcfgcli, tmpdir): + out = ngcpcfgcli("get") + assert "" in out.stdout + assert "Usage: ngcpcfg get " in out.stderr + assert out.returncode == 1 + + +@pytest.mark.get +def test_get_action_missing_file(ngcpcfgcli, tmpdir): + out = ngcpcfgcli("get", "test", + env={ + 'NGCPCTL_CONFIG': '/run/nonexistent-file' + }) + assert "" in out.stdout + assert "Error: Configuration file /run/nonexistent-file does not " + \ + "exist (unconfigured?) - exiting." in out.stderr + assert out.returncode == 1 + + +@pytest.mark.get +def test_get_wrong_get_option(ngcpcfgcli, tmpdir): + out = ngcpcfgcli("get", "--something", "key.missing") + assert "" in out.stdout + assert "Usage: ngcpcfg get " in out.stderr + assert out.returncode == 1 + + +@pytest.mark.get +def test_get_action_constants_child_item(ngcpcfgcli, tmpdir): + out = ngcpcfgcli("get", "database.dbhost") + assert "localhost" in out.stdout + assert "" in out.stderr + assert out.returncode == 0 + + +@pytest.mark.get +def test_get_action_config_child_item(ngcpcfgcli, tmpdir): + out = ngcpcfgcli("get", "www_admin.fees_csv.element_order") + assert "destination zone zone_detail " + \ + "onpeak_init_rate onpeak_init_interval " + \ + "onpeak_follow_rate onpeak_follow_interval " + \ + "offpeak_init_rate offpeak_init_interval " + \ + "offpeak_follow_rate offpeak_follow_interval " + \ + "use_free_time" in out.stdout + assert "" in out.stderr + assert out.returncode == 0 + + +@pytest.mark.get +def test_get_action_missing_item(ngcpcfgcli, tmpdir): + out = ngcpcfgcli("get", "key.missing") + assert "\\n" in out.stdout + assert "" in out.stderr + assert out.returncode == 0 diff --git a/testsuite/build-check b/testsuite/build-check deleted file mode 100644 index b814724a..00000000 --- a/testsuite/build-check +++ /dev/null @@ -1,87 +0,0 @@ -#!/bin/bash - -set -e -set -u - -# when invoked under DEBUG_SHELL=1 then provide -# interactive shell before exiting -if [ -n "${DEBUG_SHELL:-}" ] ; then - bailout() { bash; exit 1; } -else - bailout() { exit 1; } -fi - -testsuite="$(dirname "${PWD}/$0")" -export testsuite - -TMPDIR="$(mktemp -d)" -echo "Switching to temporary directory $TMPDIR" -cd "$TMPDIR" -cp -a "${testsuite}"/* . - -export FUNCTIONS="$testsuite/../functions/" -export HELPER="$testsuite/../helper/" -export HOOKS="$testsuite/../hooks/" -export SCRIPTS="$testsuite/../scripts/" - -echo -n "Testing ngcpcfg without any arguments: " -if "$testsuite"/../sbin/ngcpcfg 2>&1 | grep -q "^Usage:$" ; then - echo OK -else - echo "Error with executing ngcpcfg without any arguments" >&2 - bailout -fi - -echo -n "Testing ngcpcfg --help: " -if "$testsuite"/../sbin/ngcpcfg --help 2>&1 | grep -q "^Usage:$" ; then - echo OK -else - echo "Error with executing ngcpcfg --help" >&2 - bailout -fi - -echo -n "Testing ngcpcfg --version: " -if "$testsuite"/../sbin/ngcpcfg --version 2>&1 | grep -q "version" ; then - echo OK -else - echo "Error with executing ngcpcfg --version" >&2 - bailout -fi - -echo "Testing ngcpcfg build:" -"$testsuite"/../sbin/ngcpcfg build > build.log - -while IFS= read -r line ; do - case "$line" in - Generating\ testsuite/*OK) echo generation OK ;; - Executing\ postbuild\ for\ testsuite/*) echo postbuild OK;; - chgrp\ www-data\ testsuite/ngcp-ossbss/logging.conf) echo postbuild OK;; - DEBUG:*) ;; # support running under "--debug" - *) - echo "Error caught: $line" >&2 - bailout - ;; - esac -done < build.log - -# test main tt2 processing -if [[ $(cat testsuite/testtemplate) == "foo" ]] ; then - echo "template test is OK" -else - echo "Error with [ngcp-config/templates/]testsuite/testtemplate.tt2" >&2 - bailout -fi - -# test precedence of files -if [[ $(cat testsuite/precedence/all/test) == "test.custom.tt2" ]] ; then - echo "precedence test is OK" -else - echo "Error with [ngcp-config/templates/]testsuite/precedence/all/*" >&2 - bailout -fi - -rm -rf "$TMPDIR" - -echo "Everything seems to be ok." - -# EOF diff --git a/testsuite/cpanfile b/testsuite/cpanfile deleted file mode 100644 index 0d7f9798..00000000 --- a/testsuite/cpanfile +++ /dev/null @@ -1,13 +0,0 @@ -requires 'Carp'; -requires 'Data::Clone'; -requires 'Data::Validate::IP'; -requires 'Getopt::Long'; -requires 'IO::Interface'; -requires 'IO::Socket'; -requires 'IPC::Open3'; -requires 'Net::Netmask'; -requires 'Pod::Usage'; -requires 'Regexp::IPv6'; -requires 'Socket'; -requires 'Sys::Hostname'; -requires 'YAML::XS'; diff --git a/testsuite/ngcp-config/config.yml b/testsuite/ngcp-config/config.yml deleted file mode 100644 index db9c2f31..00000000 --- a/testsuite/ngcp-config/config.yml +++ /dev/null @@ -1,279 +0,0 @@ - - -#These values might be changed to constants.yml -networking: - eaddress: 192.168.51.117 -ha: - eiface: eth0 - bindnetaddr: 192.168.51.0 - mcastaddr: 226.94.1.1 - mcastport: 5405 - -database: - bufferpoolsize: 254M -kamailio: - port: 5060 - disable_tcp: yes - authenticate_bye: no - - multi_homed: no - allow_peer_relay: no - - use_enum: no - enum_suffix: e164.arpa. - patterns: - emergency: 112|911|999 -asterisk: - sip: - bindport: 5070 - dtmfmode: rfc2833 - rtp: - minport: 10000 - maxport: 20000 - voicemail: - serveremail: voicebox@sip.sipwise.com - maxmsg: 30 - max_msg_length: 180 - min_msg_length: 3 - maxgreet: 60 - fromstring: Voicemail server - mailsubject: '[Voicebox] New message ${VM_MSGNUM} in voicebox ${VM_MAILBOX}' - mailbody: 'You have received a new message from ${VM_CALLERID} in voicebox ${VM_MAILBOX} on ${VM_DATE}.' - log: - facility: local6 -mediator: - interval: 10 -rateomat: - splitpeakparts: 0 - loopinterval: 10 -ossbss: - htpasswd: - - user: ngcpsoap - pass: '{SHA}w4zj3mxbmynIQ1jsUEjSkN2z2pk=' - apache: - port: 2443 - serveradmin: support@sipwise.com - servername: '"myserver"' - sslcertfile: /etc/apache2/ssl/myserver.crt - sslcertkeyfile: /etc/apache2/ssl/myserver.pem - provisioning: - log_passwords: 0 - no_logline_truncate: 0 - allow_ip_as_domain: 1 - allow_numeric_usernames: 0 - tmpdir: /tmp - - faxpw_min_char: 0 - - routing: - cc_regex: '[1-9]\d{0,3}' - ac_regex: '[1-9]\d{0,4}' - sn_regex: '[1-9]\d+' - logging: - ossbss: - facility: local0 - level: DEBUG - identity: provisioning - web: - facility: local0 - level: DEBUG - apache: - err: - facility: local7 - level: info - acc: - facility: daemon - level: info - identity: oss -www_admin: - apache: - port: 1443 - serveradmin: support@sipwise.com - servername: '"myserver"' - sslcertfile: /etc/apache2/ssl/myserver.crt - sslcertkeyfile: /etc/apache2/ssl/myserver.pem - billing_features: 1 - peering_features: 1 - voicemail_features: 1 - fax_features: 1 - conference_features: 1 - cc_dial_prefix: 00 - ac_dial_prefix: 0 - dashboard: - enable: 1 - subscriber: - extension_features: 0 - audiofile_features: 0 - domain: - rewrite_features: 1 - audiofile_features: 0 - vsc_features: 0 - default_admin_settings: - is_master: 0 - is_active: 1 - read_only: 0 - show_passwords: 1 - call_data: 0 - fees_csv: - element_order: - - destination - - zone - - zone_detail - - onpeak_init_rate - - onpeak_init_interval - - onpeak_follow_rate - - onpeak_follow_interval - - offpeak_init_rate - - offpeak_init_interval - - offpeak_follow_rate - - offpeak_follow_interval - - use_free_time - speed_dial_vsc_presets: - vsc: - - '*0' - - '*1' - - '*2' - - '*3' - - '*4' - - '*5' - - '*6' - - '*7' - - '*8' - - '*9' - logging: - apache: - err: - facility: local7 - level: info - acc: - facility: daemon - level: info - identity: oss -www_csc: - apache: - port: 443 - serveradmin: support@sipwise.com - servername: myserver - sslcertfile: /etc/apache2/ssl/myserver.crt - sslcertkeyfile: /etc/apache2/ssl/myserver.pem - site_domain: sip.yourdomain.tld - display_account_info: 0 - sip_server: sip.yourdomain.tld - tftp_server: tftp.yourdomain.tld - payment_features: 0 - cc_dial_prefix: 00 - ac_dial_prefix: 0 - site_config: - title: Sipwise NGCP CSC - default_language: en - default_uri: '/desktop' - languages: - - en - - es - company: - name: Your Company - logo: 'https://some.server/path/to/logo.gif' - hotline: '' - city: '' - street: '' - phone: '' - fax: '' - email: '' - webserver: '' - main_menu: - desktop: 1 - calllist: 1 - voicebox: 1 - addressbook: 1 - callforward: 1 - callblock: 1 - reminder: 1 - device: 0 - account: 1 - logging: - apache: - err: - facility: local7 - level: info - acc: - facility: daemon - level: info - identity: csc -rtpproxy: - minport: 30000 - maxport: 40000 -sems: - bindport: 5080 - lowport: 40001 - highport: 50000 - xmlrpcport: 8090 - vsc: - voicemail_number: 2000 - cfu_code: 72 - cfb_code: 90 - cft_code: 92 - cfna_code: 93 - speedial_code: 50 - reminder_code: 55 -rsyslog: - external_log: 0 - external_address: 192.168.32.1 - external_proto: udp - external_port: 514 - external_loglevel: warning -reminder: - retries: 2 - retry_time: 60 - wait_time: 30 - sip_fromuser: reminder - sip_fromdomain: voicebox.sipwise.local -checktools: - sip_check_enable: 1 - mysql_check_enable: 1 - mpt_check_enable: 0 - exim_check_enable: 0 - kamailio_check_dialog_active_enable: 1 - kamailio_check_dialog_early_enable: 0 - kamailio_check_usrloc_regusers_enable: 1 - kamailio_check_usrloc_regdevices_enable: 0 - oss_check_provisioned_subscribers_enable: 1 - - force: 0 - mysql_check_replication: 1 - kamailio_check_dialog_local_enable: 0 - kamailio_check_dialog_relay_enable: 0 - kamailio_check_dialog_incoming_enable: 0 - kamailio_check_dialog_outgoing_enable: 0 - - - collcheck: - maxage: 600 - cpuidle: 0.1 - swapfree: 0.5 - dfused: 0.9 - memused: 0.7 - loadshort: 3 - loadmedium: 2 - loadlong: 2 - siptimeout: 15 - eximmaxqueue: 15 - -cdrexport: - exportpath: '/home/jail/home/cdrexport' - filepreffix: sipwise - fileversion: 001 - monthly_folder: yes - daily_folder: yes -cleanuptools: - batch: 10000 - archive_targetdir: '/tmp' - compress: gzip - acc_days: 90 - trash_days: 30 - acc2_days: 180 -general: - companyname: sipwise - lang: en - adminmail: nomail@nodomain.org - -# vim: ft=yaml diff --git a/testsuite/ngcp-config/constants.yml b/testsuite/ngcp-config/constants.yml deleted file mode 100644 index 46ce2df5..00000000 --- a/testsuite/ngcp-config/constants.yml +++ /dev/null @@ -1,129 +0,0 @@ - - -############################# -# -# DO NOT EDIT THIS FILE!! -# -# This file contains some values not being handled by the ngcp configuration framework. -# Editing this file may cause your system to stop working. -# Do not manually edit this file unless you know what you're doing. -# -# -############################ - -database: - dbhost: localhost - dbport: 3306 -kamailio: - dbengine: MYSQL - dbname: kamailio - dbrootuser: root - dbropw: jJXgh7AAmkJ4KCMWYHCX - dbrouser: kamailioro - dbrwpw: g7PYspcXhLRNjgwPghkx - dbrwuser: kamailio - uaccryptpw: UwrpwmpCUMhfv4zscuha -asterisk: - odbc: - dbuser: asterisk - dbpassword: cx9W7PWMmkjRVpzzYkts - dbname: kamailio -mediator: - dbuser: mediator - dbpassword: AcMcrhbzXhUmTvTf9gsm - srcdbname: kamailio - destdbname: accounting - provdbname: provisioning -rateomat: - billingdb: - name: billing - user: rateomat - pass: dn7iM9YgPcJhmHXo9eWr - accountingdb: - name: accounting - user: rateomat - pass: dn7iM9YgPcJhmHXo9eWr - provisioningdb: - name: provisioning - user: rateomat - pass: dn7iM9YgPcJhmHXo9eWr -mysql: - - repuser: replicator - reppassword: KtXpr3jT7jtcd7PmnTbd - -ossbss: - provisioning: - database: - name: provisioning - user: soap - pass: hEuxXrzLF43X93ULhoNu - billingdb: - name: billing - user: soap - pass: hEuxXrzLF43X93ULhoNu - openserdb: - name: kamailio - user: soap - pass: hEuxXrzLF43X93ULhoNu - acl: - - user: csc - pass: RMYisfV4rvpWYVKosYnU - allow: - - Voip - - Billing - fax: - sendfax: /usr/bin/sendfax - faxserver: 127.0.0.1 - default_sender: webfax - routing: - internal_domain: voip.sipwise.local - no_such_number: no_such_number - voicebox_domain: voicebox.local - fax2mail_domain: fax2mail.local - conference_domain: conference.local - backends: - available: - - Billing - - Voip - enabled: - - Billing - - Voip -www_csc: - prov_user: csc - prov_pass: RMYisfV4rvpWYVKosYnU -sems: - dbuser: soap - dbpassword: hEuxXrzLF43X93ULhoNu -rsyslog: - dbname: syslog - dbuser: rsyslog - dbpassword: bAmjr7gTaevK4tFofkaP - rotate_days: 28 -reminder: - context: reminder - sip_peer: sip_proxy - dbname: provisioning - dbuser: soap - dbpassword: hEuxXrzLF43X93ULhoNu -checktools: - dbuser: nagios - dbpassword: XM4s47qEyJrckCoqPVYe - sipuser: nagios - sipdomain: voip.sipwise.local - sip_check_ip: 127.0.0.1 -cdrexport: - dbuser: exporter - dbpassword: zghivhVEv7fPMRiLAPRR - dbname: accounting -cleanuptools: - dbuser: dbcleaner - dbpassword: q43aaqRucmTmYz9gvJhe - acc_db: kamailio - trash_db: kamailio -#### Do not touch this! #### -configuration_framework: - constants_version: 4083 - config_version: 4083 - -# vim: ft=yaml diff --git a/testsuite/ngcp-config/templates/testsuite/crontab.tt2 b/testsuite/ngcp-config/templates/testsuite/crontab.tt2 deleted file mode 100644 index 6a3d0182..00000000 --- a/testsuite/ngcp-config/templates/testsuite/crontab.tt2 +++ /dev/null @@ -1,18 +0,0 @@ - -# /etc/crontab: system-wide crontab -# Unlike any other crontab you don't have to run the `crontab' -# command to install the new version when you edit this file -# and files in /etc/cron.d. These files also have username fields, -# that none of the other crontabs do. - -SHELL=/bin/sh -PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin - -# m h dom mon dow user command -17 * * * * root cd / && run-parts --report /etc/cron.hourly -59 23 * * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.daily ) -47 6 * * 7 root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.weekly ) -52 6 1 * * root test -x /usr/sbin/anacron || ( cd / && run-parts --report /etc/cron.monthly ) -# - - diff --git a/testsuite/ngcp-config/templates/testsuite/mysql/my.cnf.tt2.sp1 b/testsuite/ngcp-config/templates/testsuite/mysql/my.cnf.tt2.sp1 deleted file mode 100644 index d3664743..00000000 --- a/testsuite/ngcp-config/templates/testsuite/mysql/my.cnf.tt2.sp1 +++ /dev/null @@ -1,170 +0,0 @@ -[client] - -port = [% database.dbport %] -socket = /run/mysqld/mysqld.sock -default_character_set = utf8 - -#---------------------------------------------------------------- - -[safe_mysqld] - -syslog - -#---------------------------------------------------------------- - -[mysqld] - - - - - - -user = mysql -port = [% database.dbport %] -socket = /run/mysqld/mysqld.sock - -max_connections = 2048 -back_log = 128 -max_connect_errors = 1000 -connect_timeout = 2 -wait_timeout = 60 - -max_allowed_packet = 16M -net_buffer_length = 8K - -default_character_set = utf8 -character_set_server = utf8 - -default_collation = utf8_general_ci -init_connect = 'SET NAMES utf8; SET sql_mode = STRICT_TRANS_TABLES' - -basedir = /usr -datadir = /var/lib/mysql -tmpdir = /tmp -language = /usr/share/mysql/english -log-error = /var/log/mysql/mysqld.err -pid-file = /run/mysqld/mysqld.pid -log_slow_queries = /var/log/mysql/slow-queries.log -log_output = FILE -long_query_time = 5 -log_long_format -#log = /var/log/mysql/queries.log - - -#Binlog options -log_bin = /var/lib/mysql/log-bin -max_binlog_size = 512M -expire_logs_days = 90 #Values 0-99 -binlog_format = row -binlog_cache_size = 1M -sync_binlog = 1 - -relay_log = /var/lib/mysql/log-relay-bin -max_relay_log_size = 512M - - - - -#Replication options - -server_id = 1 -auto_increment_offset = 1 -auto_increment_increment = 2 -master-host = sp2 - - - - -master-port=[% database.dbport %] -master-user=[% mysql.repuser %] -master-password=[% mysql.reppassword %] -master-connect-retry=10 - -replicate-wild-do-table=kamailio.% -replicate-wild-do-table=provisioning.% -replicate-wild-do-table=operating.% -replicate-wild-do-table=billing.% -replicate-wild-do-table=accounting.% -replicate-wild-do-table=syslog.% -replicate-ignore-table=accounting.acc_backup -replicate-ignore-table=accounting.acc_trash -replicate-ignore-table=kamailio.acc_backup -replicate-ignore-table=kamailio.acc_trash - - - - -table_cache = 4096 -join_buffer_size = 8M -tmp_table_size = 64M -sort_buffer_size = 8M -thread_cache_size = 64 -thread_concurrency = 8 -thread_stack = 192K - - - -# Query cache, disabled -query_cache_size = 0 -query_cache_type = 1 -query_cache_limit = 2M - -transaction_isolation = REPEATABLE-READ - -# MyISAM options -key_buffer_size = 256M -read_buffer_size = 2M -read_rnd_buffer_size = 8M -myisam_sort_buffer_size = 128M -bulk_insert_buffer_size = 64M -myisam_max_sort_file_size = 10G -myisam_repair_threads = 2 -#myisam_recover_options = DEFAULT - - - -# InnoDB options -innodb_data_home_dir = /var/lib/mysql -innodb_data_file_path = ibdata1:10M:autoextend -innodb_file_per_table -innodb_buffer_pool_size = [% database.bufferpoolsize %] -innodb_additional_mem_pool_size = 32M -innodb_log_group_home_dir = /var/lib/mysql -innodb_log_files_in_group = 4 -innodb_log_file_size = 128M -innodb_log_buffer_size = 8M -innodb_max_dirty_pages_pct = 80 -innodb_flush_log_at_trx_commit = 1 -innodb_lock_wait_timeout = 50 -innodb_flush_method = O_DIRECT -innodb_thread_concurrency = 32 -innodb_autoinc_lock_mode = 1 -innodb_locks_unsafe_for_binlog -innodb_fast_shutdown = 1 -innodb_max_purge_lag = 0 - -#---------------------------------------------------------------- - -[mysqldump] - -quick -max_allowed_packet = 16M -single_transaction - - -#---------------------------------------------------------------- - -[mysql] - -#no_auto_rehash - - -#---------------------------------------------------------------- - -[myisamchk] - -# databases -key_buffer = 256M -sort_buffer = 256M -read_buffer = 64M -write_buffer = 64M diff --git a/testsuite/ngcp-config/templates/testsuite/mysql/my.cnf.tt2.sp2 b/testsuite/ngcp-config/templates/testsuite/mysql/my.cnf.tt2.sp2 deleted file mode 100644 index 5268d07f..00000000 --- a/testsuite/ngcp-config/templates/testsuite/mysql/my.cnf.tt2.sp2 +++ /dev/null @@ -1,170 +0,0 @@ -[client] - -port = [% database.dbport %] -socket = /run/mysqld/mysqld.sock -default_character_set = utf8 - -#---------------------------------------------------------------- - -[safe_mysqld] - -syslog - -#---------------------------------------------------------------- - -[mysqld] - - - - - - -user = mysql -port = [% database.dbport %] -socket = /run/mysqld/mysqld.sock - -max_connections = 2048 -back_log = 128 -max_connect_errors = 1000 -connect_timeout = 2 -wait_timeout = 60 - -max_allowed_packet = 16M -net_buffer_length = 8K - -default_character_set = utf8 -character_set_server = utf8 - -default_collation = utf8_general_ci -init_connect = 'SET NAMES utf8; SET sql_mode = STRICT_TRANS_TABLES' - -basedir = /usr -datadir = /var/lib/mysql -tmpdir = /tmp -language = /usr/share/mysql/english -log-error = /var/log/mysql/mysqld.err -pid-file = /run/mysqld/mysqld.pid -log_slow_queries = /var/log/mysql/slow-queries.log -log_output = FILE -long_query_time = 5 -log_long_format -#log = /var/log/mysql/queries.log - - -#Binlog options -log_bin = /var/lib/mysql/log-bin -max_binlog_size = 512M -expire_logs_days = 90 #Values 0-99 -binlog_format = row -binlog_cache_size = 1M -sync_binlog = 1 - -relay_log = /var/lib/mysql/log-relay-bin -max_relay_log_size = 512M - - - - -#Replication options - -server_id = 2 -auto_increment_offset = 2 -auto_increment_increment = 2 -master-host = sp1 - - - - -master-port=[% database.dbport %] -master-user=[% mysql.repuser %] -master-password=[% mysql.reppassword %] -master-connect-retry=10 - -replicate-wild-do-table=kamailio.% -replicate-wild-do-table=provisioning.% -replicate-wild-do-table=operating.% -replicate-wild-do-table=billing.% -replicate-wild-do-table=accounting.% -replicate-wild-do-table=syslog.% -replicate-ignore-table=accounting.acc_backup -replicate-ignore-table=accounting.acc_trash -replicate-ignore-table=kamailio.acc_backup -replicate-ignore-table=kamailio.acc_trash - - - - -table_cache = 4096 -join_buffer_size = 8M -tmp_table_size = 64M -sort_buffer_size = 8M -thread_cache_size = 64 -thread_concurrency = 8 -thread_stack = 192K - - - -# Query cache, disabled -query_cache_size = 0 -query_cache_type = 1 -query_cache_limit = 2M - -transaction_isolation = REPEATABLE-READ - -# MyISAM options -key_buffer_size = 256M -read_buffer_size = 2M -read_rnd_buffer_size = 8M -myisam_sort_buffer_size = 128M -bulk_insert_buffer_size = 64M -myisam_max_sort_file_size = 10G -myisam_repair_threads = 2 -#myisam_recover_options = DEFAULT - - - -# InnoDB options -innodb_data_home_dir = /var/lib/mysql -innodb_data_file_path = ibdata1:10M:autoextend -innodb_file_per_table -innodb_buffer_pool_size = [% database.bufferpoolsize %] -innodb_additional_mem_pool_size = 32M -innodb_log_group_home_dir = /var/lib/mysql -innodb_log_files_in_group = 4 -innodb_log_file_size = 128M -innodb_log_buffer_size = 8M -innodb_max_dirty_pages_pct = 80 -innodb_flush_log_at_trx_commit = 1 -innodb_lock_wait_timeout = 50 -innodb_flush_method = O_DIRECT -innodb_thread_concurrency = 32 -innodb_autoinc_lock_mode = 1 -innodb_locks_unsafe_for_binlog -innodb_fast_shutdown = 1 -innodb_max_purge_lag = 0 - -#---------------------------------------------------------------- - -[mysqldump] - -quick -max_allowed_packet = 16M -single_transaction - - -#---------------------------------------------------------------- - -[mysql] - -#no_auto_rehash - - -#---------------------------------------------------------------- - -[myisamchk] - -# databases -key_buffer = 256M -sort_buffer = 256M -read_buffer = 64M -write_buffer = 64M diff --git a/testsuite/ngcp-config/templates/testsuite/mysql/ngcpcfg.services b/testsuite/ngcp-config/templates/testsuite/mysql/ngcpcfg.services deleted file mode 100644 index ef459907..00000000 --- a/testsuite/ngcp-config/templates/testsuite/mysql/ngcpcfg.services +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash - -ngcp-service mysql restart - -# vim: ft=sh diff --git a/testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/logging.conf.postbuild b/testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/logging.conf.postbuild deleted file mode 100644 index 112a1e79..00000000 --- a/testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/logging.conf.postbuild +++ /dev/null @@ -1 +0,0 @@ -echo chgrp www-data ${output_file} diff --git a/testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/logging.conf.tt2 b/testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/logging.conf.tt2 deleted file mode 100644 index 1fcedb46..00000000 --- a/testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/logging.conf.tt2 +++ /dev/null @@ -1,16 +0,0 @@ - -log4perl.logger.Sipwise.Provisioning = [% ossbss.logging.ossbss.level %], ProvSyslogApp - -log4perl.appender.ProvSyslogApp = Log::Dispatch::Syslog -log4perl.appender.ProvSyslogApp.facility = [% ossbss.logging.ossbss.facility %] -log4perl.appender.ProvSyslogApp.ident = [% ossbss.logging.ossbss.identity %] -log4perl.appender.ProvSyslogApp.layout = PatternLayout -log4perl.appender.ProvSyslogApp.layout.ConversionPattern = %M: %m%n - -log4perl.logger.Catalyst = WARN, CatalystSyslogApp -log4perl.logger.csc = [% ossbss.logging.web.level %], CatalystSyslogApp -log4perl.logger.admin = [% ossbss.logging.web.level %], CatalystSyslogApp - -log4perl.appender.CatalystSyslogApp = Log::Dispatch::Syslog -log4perl.appender.CatalystSyslogApp.facility = [% ossbss.logging.web.facility %] -log4perl.appender.CatalystSyslogApp.layout = PatternLayout diff --git a/testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/mysql_values.cfg.services b/testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/mysql_values.cfg.services deleted file mode 100644 index fe0a65b8..00000000 --- a/testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/mysql_values.cfg.services +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/bash - -MYSQL_USER='sipwise' - -. /etc/mysql/sipwise.cnf -. /etc/ngcp-ossbss/mysql_values.cfg - -#dispatcher values reloaded -MYCOM="mysql -u$MYSQL_USER -p$SIPWISE_DB_PASSWORD kamailio -e" -$MYCOM "update dispatcher set destination='sip:$EADDRESS:$ASTERISK_PORT' where setid='2' " -$MYCOM "update dispatcher set destination='sip:$EADDRESS:$SEMS_PORT' where setid='3' " - -#xmlrcp values reloaded - #sems ip does not need to change - #kamailio rpc port not configurable at the moment -MYCOM="mysql -u$MYSQL_USER -p$SIPWISE_DB_PASSWORD provisioning -e" -$MYCOM "update xmlhosts set ip='$EADDRESS' where id='1' " -$MYCOM "update xmlhosts set port='$SEMS_XMLRPCPORT' where id='2' " - -ngcp-service kamailio restart -sleep 2 diff --git a/testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/mysql_values.cfg.tt2 b/testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/mysql_values.cfg.tt2 deleted file mode 100644 index 1a64c2cb..00000000 --- a/testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/mysql_values.cfg.tt2 +++ /dev/null @@ -1,4 +0,0 @@ -EADDRESS='[% networking.eaddress %]' -ASTERISK_PORT='[% asterisk.sip.bindport %]' -SEMS_PORT='[% sems.bindport %]' -SEMS_XMLRPCPORT='[% sems.xmlrpcport %]' diff --git a/testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/provisioning.conf.tt2 b/testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/provisioning.conf.tt2 deleted file mode 100644 index ccc16aa8..00000000 --- a/testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/provisioning.conf.tt2 +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - [% FOREACH aclentry = ossbss.provisioning.acl %] - <[% aclentry.user %] password="[% aclentry.pass %]" [% FOREACH aclallow = aclentry.allow %][% aclallow %]="" [% END %] /> - [% END %] - - - - - error - unknown - cfu_on - cfu_off - cfb_on - cfb_off - cft_on - cft_off - cfna_on - cfna_off - reminder_on - reminder_off - - - voicebox - - [% FOREACH backend = ossbss.provisioning.backends.enabled %] - [% backend %] - [% END %] - diff --git a/testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/provisioning.htpasswd.tt2 b/testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/provisioning.htpasswd.tt2 deleted file mode 100644 index 35d91576..00000000 --- a/testsuite/ngcp-config/templates/testsuite/ngcp-ossbss/provisioning.htpasswd.tt2 +++ /dev/null @@ -1,4 +0,0 @@ - -[% FOREACH htentry = ossbss.htpasswd %] -[% htentry.user %]:[% htentry.pass %] -[% END %] diff --git a/testsuite/ngcp-config/templates/testsuite/ngcp-www-admin/admin.conf.services b/testsuite/ngcp-config/templates/testsuite/ngcp-www-admin/admin.conf.services deleted file mode 100644 index 53f9a137..00000000 --- a/testsuite/ngcp-config/templates/testsuite/ngcp-www-admin/admin.conf.services +++ /dev/null @@ -1,2 +0,0 @@ - -ngcp-service apache2 reload diff --git a/testsuite/ngcp-config/templates/testsuite/ngcp-www-admin/admin.conf.tt2 b/testsuite/ngcp-config/templates/testsuite/ngcp-www-admin/admin.conf.tt2 deleted file mode 100644 index f6e4cfcb..00000000 --- a/testsuite/ngcp-config/templates/testsuite/ngcp-www-admin/admin.conf.tt2 +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - [% FOREACH feecsvelement = www_admin.fees_csv.element_order %] - [% feecsvelement %] - [% END %] - - - [% FOREACH speeddialvsc = www_admin.speed_dial_vsc_presets.vsc %] - [% speeddialvsc %] - [% END %] - - diff --git a/testsuite/ngcp-config/templates/testsuite/precedence/all/test.customtt.tt2 b/testsuite/ngcp-config/templates/testsuite/precedence/all/test.customtt.tt2 deleted file mode 100644 index cf566826..00000000 --- a/testsuite/ngcp-config/templates/testsuite/precedence/all/test.customtt.tt2 +++ /dev/null @@ -1 +0,0 @@ -test.custom.tt2 diff --git a/testsuite/ngcp-config/templates/testsuite/precedence/all/test.customtt.tt2.sp1 b/testsuite/ngcp-config/templates/testsuite/precedence/all/test.customtt.tt2.sp1 deleted file mode 100644 index 66a8840b..00000000 --- a/testsuite/ngcp-config/templates/testsuite/precedence/all/test.customtt.tt2.sp1 +++ /dev/null @@ -1 +0,0 @@ -test.custom.tt2.sp1 diff --git a/testsuite/ngcp-config/templates/testsuite/precedence/all/test.tt2 b/testsuite/ngcp-config/templates/testsuite/precedence/all/test.tt2 deleted file mode 100644 index 326dad1a..00000000 --- a/testsuite/ngcp-config/templates/testsuite/precedence/all/test.tt2 +++ /dev/null @@ -1 +0,0 @@ -test.tt2 diff --git a/testsuite/ngcp-config/templates/testsuite/precedence/all/test.tt2.sp1 b/testsuite/ngcp-config/templates/testsuite/precedence/all/test.tt2.sp1 deleted file mode 100644 index a5ca125e..00000000 --- a/testsuite/ngcp-config/templates/testsuite/precedence/all/test.tt2.sp1 +++ /dev/null @@ -1 +0,0 @@ -test.tt2.sp1 diff --git a/testsuite/ngcp-config/templates/testsuite/testtemplate.tt2 b/testsuite/ngcp-config/templates/testsuite/testtemplate.tt2 deleted file mode 100644 index 9b6389c0..00000000 --- a/testsuite/ngcp-config/templates/testsuite/testtemplate.tt2 +++ /dev/null @@ -1 +0,0 @@ -[% TAGS [- -] %]foo diff --git a/testsuite/ngcpcfg-testsuite.cfg b/testsuite/ngcpcfg-testsuite.cfg deleted file mode 100644 index b938c00f..00000000 --- a/testsuite/ngcpcfg-testsuite.cfg +++ /dev/null @@ -1,31 +0,0 @@ -# Filename: /etc/ngcp-config/ngcpcfg.cfg -# Purpose: main configuration file for ngcpcfg tools -# Note: do not modify unless you have a really good reason to do so - -# directory name where ngcpcfg is managed through git -NGCPCTL_MAIN='./ngcp-config' -NGCPCTL_CONFIG="${NGCPCTL_MAIN}/config.yml" -HOST_CONFIG="${NGCPCTL_MAIN}/config.$(hostname).yml" -LOCAL_CONFIG="${NGCPCTL_MAIN}/config.local.yml" -CONSTANTS_CONFIG="${NGCPCTL_MAIN}/constants.yml" - -# configuration files that should be managed -CONFIG_POOL='/tmp/output' - -# location of templates -TEMPLATE_POOL_BASE="${NGCPCTL_MAIN}/templates/testsuite" - -# location of service definitions -SERVICES_POOL_BASE="${NGCPCTL_MAIN}/templates/testsuite" - -## NOTE: only supported with ngcp-ngcpcfg-ha -# supported values: {true,false} -SHARED_STORAGE='true' - -# name of shared storage -GLUSTERFS='./glusterfs' - -# name of shared storage repository -NGCPCTL_SHARE="${GLUSTERFS}/ngcpcfg-share" - -## END OF FILE ################################################################# diff --git a/testsuite/values-check b/testsuite/values-check deleted file mode 100644 index 143e482d..00000000 --- a/testsuite/values-check +++ /dev/null @@ -1,83 +0,0 @@ -#!/bin/bash - -set -e -set -u - -# when invoked under DEBUG_SHELL=1 then provide -# interactive shell before exiting -if [ -n "${DEBUG_SHELL:-}" ] ; then - bailout() { bash; exit 1; } -else - bailout() { exit 1; } -fi - -testsuite="$(dirname "${PWD}/$0")" -export testsuite - -TMPDIR="$(mktemp -d)" -echo "Switching to temporary directory $TMPDIR" -cd "$TMPDIR" -cp -a "${testsuite}"/* . - -export FUNCTIONS="$testsuite/../functions/" -export HELPER="$testsuite/../helper/" -export HOOKS="$testsuite/../hooks/" -export SCRIPTS="$testsuite/../scripts/" - -echo -n "Testing ngcpcfg without any arguments: " -if "$testsuite"/../sbin/ngcpcfg 2>&1 | grep -q "^Usage:$" ; then - echo OK -else - echo "Error with executing ngcpcfg without any arguments" >&2 - bailout -fi - -echo -n "Testing ngcpcfg --help: " -if "$testsuite"/../sbin/ngcpcfg --help 2>&1 | grep -q "^Usage:$" ; then - echo OK -else - echo "Error with executing ngcpcfg --help" >&2 - bailout -fi - -echo -n "Testing ngcpcfg --version: " -if "$testsuite"/../sbin/ngcpcfg --version 2>&1 | grep -q "version" ; then - echo OK -else - echo "Error with executing ngcpcfg --version" >&2 - bailout -fi - -for action in values get ; do - echo "Testing ngcpcfg ${action} database.dbhost" - value=$("$testsuite"/../sbin/ngcpcfg "${action}" database.dbhost) - if [ "${value}" != "localhost" ] ; then - echo "Error caught: database.dbhost != 'localhost' (action '${action}')" - bailout - fi - - echo "Testing ngcpcfg ${action} ossbss.provisioning.database.user" - value=$("$testsuite"/../sbin/ngcpcfg "${action}" ossbss.provisioning.database.user) - if [ "${value}" != "soap" ] ; then - echo "Error caught: ossbss.provisioning.database.user != 'soap' (action '${action}')" - bailout - fi - - - echo "Testing ngcpcfg ${action} www_admin.fees_csv.element_order" - value=$("$testsuite"/../sbin/ngcpcfg "${action}" www_admin.fees_csv.element_order) - if [ "${value}" != "destination zone zone_detail onpeak_init_rate \ - onpeak_init_interval onpeak_follow_rate onpeak_follow_interval \ - offpeak_init_rate offpeak_init_interval offpeak_follow_rate \ - offpeak_follow_interval use_free_time" ] ; - then - echo "Error caught: www_admin.fees_csv.element_order != expected value (action '${action}')" - bailout - fi -done - -rm -rf "$TMPDIR" - -echo "Everything seems to be ok." - -# EOF