diff --git a/ce/01_hostname-and-interfaces.yaml.tt2 b/ce/01_hostname-and-interfaces.yaml.tt2 deleted file mode 100644 index 6be3d7e..0000000 --- a/ce/01_hostname-and-interfaces.yaml.tt2 +++ /dev/null @@ -1,35 +0,0 @@ -command: - hostname: - exit-status: 0 - -[% IF sipwise.system_tester.skip_strict_hostname_test != "true" %] - hostname: - exit-status: 0 - stdout: - - "spce" - stderr: [] - - hostname --fqdn: - exit-status: 0 - stdout: - - "spce." - stderr: [] - - hostname --short: - exit-status: 0 - stdout: - - "spce" - stderr: [] - -[% END -%] - "[ $(hostname --short). = $(hostname --fqdn) ]": - title: "short hostname should be the same as fqdn (ignoring trailing dot)" - exit-status: 0 - stdout: [] - stderr: [] - - "[ $(resolveip -s $(hostname --fqdn)) = $(resolveip -s $(hostname --short)) ]": - title: "ip-s of short hostname and fqdn should be the same" - exit-status: 0 - stdout: [] - stderr: [] diff --git a/ce/01_running-processes.yaml.tt2 b/ce/01_running-processes.yaml.tt2 deleted file mode 100644 index 7ef2c50..0000000 --- a/ce/01_running-processes.yaml.tt2 +++ /dev/null @@ -1,75 +0,0 @@ -command: - "pgrep -c -f '[l]ua5.1 /usr/bin/prosody'": - exit-status: 0 - stdout: - - "1" - stderr: [] - - "pgrep -c -f '[p]erl-fcgi-pm \\[NGCP::Panel\\]'": - exit-status: 0 - stdout: - - "1" - stderr: [] - - "pgrep -n -f '[k]amailio.*kamailio.proxy.pid'": - exit-status: 0 - stdout: - - "/[0-9]+/" - stderr: [] - - "pgrep -n -f '[k]amailio.*kamailio.lb.pid'": - exit-status: 0 - stdout: - - "/[0-9]+/" - stderr: [] - -process: - acpid: - running: true - asterisk: - running: true - cron: - running: true - exim4: - running: true - getty: - running: true - influxd: - running: true - kamailio: - running: true - mediator: - running: true - mysqld: - running: true - mysqld_safe: - running: true - ngcp-sems: - running: true - ngcp-witnessd: - running: true - nginx: - running: true - ntpd: - running: true - perl-fcgi: - running: true - rate-o-mat: - running: true - redis-server: - running: true - rsyslogd: - running: true - rtpengine: - running: true - sshd: - running: true - telegraf: - running: true -{{if eq .Env.DEBIAN_RELEASE "8"}} - udevd: - running: true -{{else}} - systemd-udevd: - running: true -{{end}} diff --git a/ce/03_files_availability.yaml.tt2 b/ce/03_files_availability.yaml.tt2 deleted file mode 100644 index cd008d4..0000000 --- a/ce/03_files_availability.yaml.tt2 +++ /dev/null @@ -1,137 +0,0 @@ -file: - - /etc/apt/sources.list.d/sipwise.list: - exists: true - mode: "0644" - owner: root - group: root - filetype: file - contains: [] - - /etc/ngcp-config/config.yml: - exists: true - mode: "0644" - owner: root - group: root - filetype: file - contains: [] - - /etc/ngcp-config/constants.yml: - exists: true - mode: "0600" - owner: root - group: root - filetype: file - contains: [] - - /etc/ngcp-config/network.yml: - exists: true - mode: "0644" - owner: root - group: root - filetype: file - contains: [] - - /etc/ngcp-config/.git: - exists: true - mode: "0700" - owner: root - group: root - filetype: directory - contains: [] - - /etc/ngcp-config/cfg_schema.db: - exists: true - mode: "0644" - owner: root - group: root - filetype: file - contains: [] - - /etc/ngcp-config/.ngcpcfg_perms: - exists: true - mode: "0700" - owner: root - group: root - filetype: file - contains: [] - - /etc/ngcp-config/ngcpcfg.cfg: - exists: true - mode: "0644" - owner: root - group: root - filetype: file - contains: [] - -# /etc/ngcp-config/systems.cfg: -# exists: true -# mode: "0644" -# owner: root -# group: root -# filetype: file -# contains: [] - - /etc/ngcp-config/ssl: - exists: true - mode: "0750" - owner: root - group: ssl-cert - filetype: directory - contains: [] - - /etc/ngcp-config/shared-files: - exists: true - mode: "0755" - owner: root - group: root - filetype: directory - contains: [] - - /etc/ngcp-config/shared-files/mysql: - exists: true - mode: "0755" - owner: root - group: root - filetype: directory - contains: [] - - /etc/ngcp-config/shared-files/mysql/sipwise.cnf: - exists: true - mode: "0600" - owner: root - group: root - filetype: file - contains: [] - -# /etc/ngcp-config/shared-files/ssh: -# exists: true -# mode: "0755" -# owner: root -# group: root -# filetype: directory -# contains: [] - -# /etc/ngcp-config/shared-files/sshd: -# exists: true -# mode: "0755" -# owner: root -# group: root -# filetype: directory -# contains: [] - - /etc/ngcp_version: - exists: true - mode: "0644" - owner: root - group: root - filetype: file - contains: [] - - /etc/sipwise_ngcp_version: - exists: true - mode: "0644" - owner: root - group: root - filetype: file - contains: [] diff --git a/ce/03_open_ports.yaml.tt2 b/ce/03_open_ports.yaml.tt2 deleted file mode 100644 index 4b9da84..0000000 --- a/ce/03_open_ports.yaml.tt2 +++ /dev/null @@ -1,27 +0,0 @@ -[% PROCESS '/usr/lib/ngcp-ngcpcfg/get_hostname'; - hostname = out --%] -[% argv.host=hostname; argv.type='web_ext'; - PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host'; - web_ext_ips = out; --%] -[% argv.host=hostname; argv.type='web_int'; - PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host'; - web_int_ips = out; --%] -port: - tcp:443: - listening: true - ip: ["[% web_ext_ips.0 -%]"] - - tcp:1443: - listening: true - ip: ["[% web_int_ips.0 -%]"] - - tcp6:8083: - listening: true - ip: ["::"] - - tcp6:8086: - listening: true - ip: ["::"] diff --git a/ce/06_system_packages.yaml.tt2 b/ce/06_system_packages.yaml.tt2 deleted file mode 100644 index 56ff0bb..0000000 --- a/ce/06_system_packages.yaml.tt2 +++ /dev/null @@ -1,9 +0,0 @@ -package: - ngcp-ngcp-ce: - installed: true - - ngcp-ngcp-pro: - installed: false - - ngcp-ngcp-carrier: - installed: false diff --git a/ce/07_system_service.yaml.tt2 b/ce/07_system_service.yaml.tt2 deleted file mode 100644 index 9241cc3..0000000 --- a/ce/07_system_service.yaml.tt2 +++ /dev/null @@ -1,88 +0,0 @@ -service: - acpid: - enabled: true - running: true - - asterisk: - enabled: true - running: true - - cron: - enabled: true - running: true - - exim4: - enabled: true - running: true - - influxdb: - enabled: true - running: true - - io-scheduler: - enabled: true - running: true - - kamailio-lb: - enabled: true - running: true - - kamailio-proxy: - enabled: true - running: true - - mediator: - enabled: true - running: true - - motd: - enabled: true - running: true - - mysql: - enabled: true - running: true - - ngcp-rate-o-mat: - enabled: true - running: true - - ngcp-rtpengine-daemon: - enabled: true - running: true - - ngcp-sems: - enabled: true - running: true - - ngcp-witnessd: - enabled: true - running: true - - nginx: - enabled: true - running: true - - ntp: - enabled: true - running: true - - prosody: - enabled: true - running: true - - redis-server: - enabled: true - running: true - - rsyslog: - enabled: true - running: true - - ssh: - enabled: true - running: true - - telegraf: - enabled: true - running: true diff --git a/ce/08_system_ports.yaml.tt2 b/ce/08_system_ports.yaml.tt2 deleted file mode 100644 index 86ece3c..0000000 --- a/ce/08_system_ports.yaml.tt2 +++ /dev/null @@ -1,13 +0,0 @@ -port: - tcp:1443: - listening: true - - tcp:22: - listening: true - - tcp:443: - listening: true - - tcp6:80: - # why Ipv4 is not here? - listening: true diff --git a/ce/09_system_dns.yaml.tt2 b/ce/09_system_dns.yaml.tt2 deleted file mode 100644 index f0f4bae..0000000 --- a/ce/09_system_dns.yaml.tt2 +++ /dev/null @@ -1,14 +0,0 @@ -dns: -[% IF sipwise.system_tester.skip_dns_check_test != "true" -%] - spce: - resolveable: true - addrs: - - 127.0.0.2 - timeout: 500 - -[% END -%] - localhost: - resolveable: true - addrs: - - 127.0.0.1 - timeout: 500 diff --git a/ce/goss.yaml.tt2 b/ce/goss.yaml.tt2 deleted file mode 100644 index 36e75eb..0000000 --- a/ce/goss.yaml.tt2 +++ /dev/null @@ -1,16 +0,0 @@ -gossfile: - 01_running-processes.yaml: {} - 01_hostname-and-interfaces.yaml: {} - 02_disk-free.yaml: {} - 03_files_availability.yaml: {} - 03_no-cores.yaml: {} - 03_open_ports.yaml: {} - 04_template_files.yaml: {} - 05_system_users.yaml: {} - 06_system_packages.yaml: {} - 07_system_service.yaml: {} - 08_system_ports.yaml: {} - 09_system_dns.yaml: {} - 10_sites_ok.yaml: {} - 11_influxdb_content.yaml: {} - 99_dummy.yaml: {} diff --git a/debian/ngcp-system-tests.install b/debian/ngcp-system-tests.install index d6b5bcf..2ba9e28 100644 --- a/debian/ngcp-system-tests.install +++ b/debian/ngcp-system-tests.install @@ -1,3 +1,2 @@ -ce/* /etc/ngcp-config/templates/etc/ngcp-tests/ce/ -pro/* /etc/ngcp-config/templates/etc/ngcp-tests/pro/ -testrunner /usr/share/ngcp-tests/ +templates/* /etc/ngcp-config/templates/etc/ngcp-tests/ +testrunner /usr/share/ngcp-tests/ diff --git a/debian/ngcp-system-tests.maintscript b/debian/ngcp-system-tests.maintscript new file mode 100644 index 0000000..8ac1df1 --- /dev/null +++ b/debian/ngcp-system-tests.maintscript @@ -0,0 +1,32 @@ +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/ce/01_hostname-and-interfaces.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/ce/01_running-processes.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/ce/02_disk-free.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/ce/03_files_availability.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/ce/03_no-cores.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/ce/03_open_ports.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/ce/04_template_files.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/ce/05_system_users.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/ce/06_system_packages.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/ce/07_system_service.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/ce/08_system_ports.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/ce/09_system_dns.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/ce/10_sites_ok.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/ce/11_influxdb_content.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/ce/99_dummy.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/ce/goss.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/pro/01_hostname-and-interfaces.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/pro/01_running-processes.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/pro/02_disk-free.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/pro/03_files_availability.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/pro/03_no-cores.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/pro/03_open_ports.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/pro/04_template_files.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/pro/05_system_users.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/pro/06_system_packages.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/pro/07_system_service.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/pro/08_system_ports.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/pro/09_system_dns.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/pro/10_sites_ok.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/pro/11_influxdb_content.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/pro/99_dummy.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests +rm_conffile /etc/ngcp-config/templates/etc/ngcp-tests/pro/goss.yaml.tt2 5.4.0.0+0~mr5.4.0.0~ ngcp-system-tests diff --git a/debian/ngcp-system-tests.postinst b/debian/ngcp-system-tests.postinst new file mode 100644 index 0000000..7d67e76 --- /dev/null +++ b/debian/ngcp-system-tests.postinst @@ -0,0 +1,7 @@ +#!/bin/bash + +# Remove obsolete files generated from templates. +rm -rf /etc/ngcp-tests/ce +rm -rf /etc/ngcp-tests/pro + +#DEBHELPER# diff --git a/pro/01_running-processes.yaml.tt2 b/pro/01_running-processes.yaml.tt2 deleted file mode 100644 index 03ad811..0000000 --- a/pro/01_running-processes.yaml.tt2 +++ /dev/null @@ -1,121 +0,0 @@ -command: - - "pgrep -c -f '[l]ua5.1 /usr/bin/prosody'": - exit-status: 0 - stdout: - - "1" - stderr: [] - - "pgrep -c -f '[p]erl-fcgi-pm \\[NGCP::Panel\\]'": - exit-status: 0 - stdout: - - "1" - stderr: [] - - "pgrep -n -f '[k]amailio.*kamailio.proxy.pid'": - exit-status: 0 - stdout: - - "/[0-9]+/" - stderr: [] - - "pgrep -n -f '[k]amailio.*kamailio.lb.pid'": - exit-status: 0 - stdout: - - "/[0-9]+/" - stderr: [] - -process: - acpid: - running: true - - asterisk: - running: true - - cron: - running: true - - exim4: - running: true - - glusterfs: - running: true - - hb_watchdog: - running: true - - heartbeat: - running: true - - influxd: - running: true - - influxdb-relay: - running: true - - kamailio: - running: true - - mediator: - running: true - - mysqld: - running: true - - mysqld_safe: - running: true - - monit: - running: true - - ngcp-faxserver: - running: true - - ngcp-sems: - running: true - - ngcp-snmp-agent: - running: true - - ngcp-witnessd: - running: true - - nginx: - running: true - - ntpd: - running: true - - perl-fcgi: - running: true - - rate-o-mat: - running: true - - redis-server: - running: true - - rsyslogd: - running: true - - rtpengine: - running: true - - sshd: - running: true - - snmpd: - running: true - - telegraf: - running: true - -{{if eq .Env.DEBIAN_RELEASE "8"}} - udevd: - running: true -{{else}} - systemd-udevd: - running: true -{{end}} - - voisniff-ng: - running: true diff --git a/pro/02_disk-free.yaml.tt2 b/pro/02_disk-free.yaml.tt2 deleted file mode 120000 index 8093325..0000000 --- a/pro/02_disk-free.yaml.tt2 +++ /dev/null @@ -1 +0,0 @@ -../ce/02_disk-free.yaml.tt2 \ No newline at end of file diff --git a/pro/03_no-cores.yaml.tt2 b/pro/03_no-cores.yaml.tt2 deleted file mode 120000 index 4fdd438..0000000 --- a/pro/03_no-cores.yaml.tt2 +++ /dev/null @@ -1 +0,0 @@ -../ce/03_no-cores.yaml.tt2 \ No newline at end of file diff --git a/pro/03_open_ports.yaml.tt2 b/pro/03_open_ports.yaml.tt2 deleted file mode 100644 index f1843a5..0000000 --- a/pro/03_open_ports.yaml.tt2 +++ /dev/null @@ -1,203 +0,0 @@ -[% PROCESS '/usr/lib/ngcp-ngcpcfg/get_hostname'; hostname = out -%] -[% argv.host=hostname; argv.role='proxy'; - PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; - is_proxy = out --%] -[% argv.host=hostname; argv.role='lb'; - PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; - is_lb = out --%] -[% argv.host=hostname; argv.role='mgmt'; - PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; - is_mgmt = out --%] -[% argv.host=hostname; argv.role='db'; - PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; - is_db = out --%] -[% argv.host=hostname; argv.role='rtp'; - PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; - is_rtp = out --%] -[% argv.host=hostname; argv.type='ha_int'; - PROCESS '/usr/lib/ngcp-ngcpcfg/get_iface'; - host_ha_iface = out --%] -[% argv.host=hostname; argv.type='sip_ext'; - PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_shared_ips_for_host'; - sip_ext_ips = out --%] -[% IF !sip_ext_ips.size -%] -[% argv.host=hostname; argv.type='sip_ext'; - PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host'; - sip_ext_ips = out; --%] -[% END -%] -[% argv.host=hostname; argv.type='web_ext'; - PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_shared_ips_for_host'; - web_ext_ips = out --%] -[% IF !web_ext_ips.size -%] -[% argv.host=hostname; argv.type='web_ext'; - PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host'; - web_ext_ips = out; --%] -[% END -%] -[% argv.host=hostname; argv.type='web_int'; - PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_shared_ips_for_host'; - web_int_ips = out --%] -[% IF !web_int_ips.size -%] -[% argv.host=hostname; argv.type='web_int'; - PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host'; - web_int_ips = out; --%] -[% END -%] -[% argv.host=hostname; argv.type='ha_int'; - PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host'; - ha_int_ips = out; --%] - -port: - -[% IF is_mgmt -%] - tcp:443: - listening: true - ip: ["127.0.0.1"] - - tcp:1443: - listening: true - ip: ["127.0.0.1"] - -[% END -%] -[% IF is_mgmt && pbx.enable == 'yes' -%] - tcp:1444: - listening: true - ip: ["[% web_ext_ips.0 -%]"] - - tcp:1445: - listening: true - ip: ["[% web_ext_ips.0 -%]"] - -[% END -%] - tcp:22: - listening: true - ip: ["0.0.0.0"] - - tcp:22: - listening: true - ip: ["[% hosts.$hostname.$host_ha_iface.ip %]"] - - tcp:24009: - listening: true - ip: ["0.0.0.0"] - - tcp:25: - listening: true - ip: ["127.0.0.1"] - - tcp:2812: - listening: true - ip: ["127.0.0.1"] - - tcp:3306: - listening: true - ip: ["0.0.0.0"] - -[% IF is_lb -%] - tcp:5060: - listening: true - ip: ["[% sip_ext_ips.0 -%]"] - -[% END -%] -[% IF is_proxy -%] - tcp:5062: - listening: true - ip: ["127.0.0.1"] - - tcp:5222: - listening: true - ip: ["[% sip_ext_ips.0 -%]"] - - tcp:5269: - listening: true - ip: ["[% sip_ext_ips.0 -%]"] - - tcp:5280: - listening: true - ip: ["127.0.0.1"] - - tcp:5281: - listening: true - ip: ["127.0.0.1"] - - tcp:5582: - listening: true - ip: ["127.0.0.1"] - - tcp:8090: - listening: true - ip: ["127.0.0.1"] - - tcp:5038: - listening: true - ip: ["127.0.0.1"] - - udp:5040: - listening: true - ip: ["127.0.0.1"] - - udp:5070: - listening: true - ip: ["127.0.0.1"] - - udp:5080: - listening: true - ip: ["127.0.0.1"] - -[% END -%] -[% IF is_rtp || is_proxy || is_db -%] - tcp:6379: - listening: true - ip: ["[% ha_int_ips.0 %]"] - -[% END -%] - tcp:7777: - listening: false - - udp:7777: - listening: false - - udp:123: - listening: true - ip: ["0.0.0.0"] - - udp:161: - listening: true - ip: ["127.0.0.1"] - -[% IF is_rtp -%] - udp:2223: - listening: true - ip: ["127.0.0.1"] - -[% END -%] - tcp6:8083: - listening: true - ip: ["::"] - - tcp6:8086: - listening: true - ip: ["::"] - - tcp:9096: - listening: true - ip: ["127.0.0.1"] - - udp:[% heartbeat.port ? heartbeat.port : '694' %]: - listening: true - ip: ["0.0.0.0"] - - tcp:22: - # last record to keep JSON valid - listening: true diff --git a/pro/04_template_files.yaml.tt2 b/pro/04_template_files.yaml.tt2 deleted file mode 120000 index be17fb9..0000000 --- a/pro/04_template_files.yaml.tt2 +++ /dev/null @@ -1 +0,0 @@ -../ce/04_template_files.yaml.tt2 \ No newline at end of file diff --git a/pro/05_system_users.yaml.tt2 b/pro/05_system_users.yaml.tt2 deleted file mode 120000 index ccc24da..0000000 --- a/pro/05_system_users.yaml.tt2 +++ /dev/null @@ -1 +0,0 @@ -../ce/05_system_users.yaml.tt2 \ No newline at end of file diff --git a/pro/06_system_packages.yaml.tt2 b/pro/06_system_packages.yaml.tt2 deleted file mode 100644 index 4cbadcd..0000000 --- a/pro/06_system_packages.yaml.tt2 +++ /dev/null @@ -1,9 +0,0 @@ -package: - ngcp-ngcp-ce: - installed: false - - ngcp-ngcp-pro: - installed: true - - ngcp-ngcp-carrier: - installed: false diff --git a/pro/07_system_service.yaml.tt2 b/pro/07_system_service.yaml.tt2 deleted file mode 100644 index 68aebb3..0000000 --- a/pro/07_system_service.yaml.tt2 +++ /dev/null @@ -1,239 +0,0 @@ -[% PROCESS '/usr/lib/ngcp-ngcpcfg/get_hostname'; hostname = out -%] -[% argv.host=hostname; argv.role='proxy'; - PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; - is_proxy = out --%] -[% argv.host=hostname; argv.role='lb'; - PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; - is_lb = out --%] -[% argv.host=hostname; argv.role='mgmt'; - PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; - is_mgmt = out --%] -[% argv.host=hostname; argv.role='db'; - PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; - is_db = out --%] -[% argv.host=hostname; argv.role='rtp'; - PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; - is_rtp = out --%] -[% PROCESS '/usr/lib/ngcp-ngcpcfg/get_ngcp_type'; ngcp_type = out -%] - -service: - - acpid: - enabled: true - running: true - -[% IF is_proxy && asterisk.enabled == "yes" -%] - asterisk: - enabled: false - running: true - -[% END -%] -[% IF (is_proxy || is_rtp) && intercept.enabled == "yes" -%] - captagent: - enabled: false - running: true - -[% END -%] -[% IF turnserver.enabled == 'yes' -%] - coturn: - enabled: false - running: true - -[% END -%] - cron: - enabled: true - running: true - -[% IF bootenv.dhcp.enable == 'yes' -%] - dnsmasq: - enabled: false - running: true - -[% END -%] - exim4: - enabled: true - running: true - -[% IF haproxy.enable == "yes" -%] - haproxy: - enabled: false - running: true - -[% END -%] -[% IF heartbeat.hb_watchdog.enable == 'yes' -%] - hb_watchdog: - enabled: true - running: true - -[% END -%] - io-scheduler: - enabled: true - running: true - - influxdb: - enabled: true - running: true - - influxdb-relay: - enabled: true - running: true - -[% IF is_lb && kamailio.lb.start == "yes" -%] - kamailio-lb: - enabled: false - running: true - -[% ELSE -%] - kamailio-lb: - enabled: false - running: false - -[% END -%] -[% IF is_proxy && kamailio.proxy.start == "yes" -%] - kamailio-proxy: - enabled: false - running: true - -[% ELSE -%] - kamailio-proxy: - enabled: false - running: false - -[% END -%] -[% IF mediator.enabled == 'yes' -%] - mediator: - enabled: false - running: true - -[% END -%] - motd: - enabled: true - running: true - - mysql: - enabled: true - running: true - -[% IF www_admin.enabled == 'yes' -%] - ngcp-panel: - enabled: true - running: true - -[% END -%] -[% IF rateomat.enable == "yes" -%] - ngcp-rate-o-mat: - enabled: false - running: true - -[% END -%] -[% IF rtpproxy.enabled == "yes" -%] - ngcp-rtpengine-daemon: - enabled: false - running: true - -[% END -%] -[% IF sems.enabled == "yes" -%] - ngcp-sems: - enabled: false - running: true - -[% END -%] -[% IF is_mgmt -%] - ngcp-snmp-agent: - enabled: true - running: true - -[% ELSE -%] - ngcp-snmp-agent: - enabled: false - running: false - -[% END -%] - ngcp-witnessd: - enabled: true - running: true - -[% IF nginx.enabled == 'yes' -%] - nginx: - enabled: true - running: true - -[% END -%] - ntp: - enabled: true - running: true - -[% IF prosody.enabled == 'yes' -%] - prosody: - enabled: false - running: true - -[% END -%] -[% IF pushd.enable == "yes" -%] - ngcp-pushd: - enabled: true - running: true - -[% END -%] -[% IF faxserver.enable == "yes" -%] - ngcp-faxserver: - enabled: false - running: true - -[% END -%] -[% IF redis.enabled == "yes" -%] - redis-server: - enabled: true - running: true - -[% END -%] - rsyslog: - enabled: true - running: true - -[% IF ldap.enabled == "yes" -%] - slapd: - enabled: false - running: true - -[% END -%] -[% IF pbx.enable == "yes" -%] - sems-pbx: - enabled: false - running: true - -[% END -%] - snmpd: - enabled: true - running: true - -[% IF (is_proxy || is_lb || is_rtp) && voisniff.daemon.start == 'yes' -%] - voisniff-ng: - enabled: false - running: true - -[% END -%] -[% IF ngcp_type == 'carrier' -%] - ngcpcfg-api: - enabled: false - running: true - -[% END -%] -[% IF (is_db || is_mgmt) && ngcp_type == 'carrier' -%] - elasticsearch: - enabled: true - running: true - -[% END -%] - ssh: - enabled: true - running: true - - telegraf: - enabled: true - running: true diff --git a/pro/08_system_ports.yaml.tt2 b/pro/08_system_ports.yaml.tt2 deleted file mode 120000 index 45e4d1f..0000000 --- a/pro/08_system_ports.yaml.tt2 +++ /dev/null @@ -1 +0,0 @@ -../ce/08_system_ports.yaml.tt2 \ No newline at end of file diff --git a/pro/10_sites_ok.yaml.tt2 b/pro/10_sites_ok.yaml.tt2 deleted file mode 120000 index f3280da..0000000 --- a/pro/10_sites_ok.yaml.tt2 +++ /dev/null @@ -1 +0,0 @@ -../ce/10_sites_ok.yaml.tt2 \ No newline at end of file diff --git a/pro/11_influxdb_content.yaml.tt2 b/pro/11_influxdb_content.yaml.tt2 deleted file mode 120000 index 85e0fdc..0000000 --- a/pro/11_influxdb_content.yaml.tt2 +++ /dev/null @@ -1 +0,0 @@ -../ce/11_influxdb_content.yaml.tt2 \ No newline at end of file diff --git a/pro/99_dummy.yaml.tt2 b/pro/99_dummy.yaml.tt2 deleted file mode 120000 index 93817df..0000000 --- a/pro/99_dummy.yaml.tt2 +++ /dev/null @@ -1 +0,0 @@ -../ce/99_dummy.yaml.tt2 \ No newline at end of file diff --git a/pro/goss.yaml.tt2 b/pro/goss.yaml.tt2 deleted file mode 120000 index 4995a35..0000000 --- a/pro/goss.yaml.tt2 +++ /dev/null @@ -1 +0,0 @@ -../ce/goss.yaml.tt2 \ No newline at end of file diff --git a/ce/99_dummy.yaml.tt2 b/templates/000_self-test-command.yaml.tt2 similarity index 100% rename from ce/99_dummy.yaml.tt2 rename to templates/000_self-test-command.yaml.tt2 diff --git a/ce/03_no-cores.yaml.tt2 b/templates/110_filesys-no-cores.yaml.tt2 similarity index 100% rename from ce/03_no-cores.yaml.tt2 rename to templates/110_filesys-no-cores.yaml.tt2 diff --git a/ce/02_disk-free.yaml.tt2 b/templates/120_filesys-free-space.yaml.tt2 similarity index 100% rename from ce/02_disk-free.yaml.tt2 rename to templates/120_filesys-free-space.yaml.tt2 diff --git a/pro/03_files_availability.yaml.tt2 b/templates/130_filesys-ngcp.yaml.tt2 similarity index 81% rename from pro/03_files_availability.yaml.tt2 rename to templates/130_filesys-ngcp.yaml.tt2 index 6020e83..bade7fa 100644 --- a/pro/03_files_availability.yaml.tt2 +++ b/templates/130_filesys-ngcp.yaml.tt2 @@ -2,7 +2,7 @@ file: /etc/apt/sources.list.d/sipwise.list: exists: true - mode: "0444" + mode: [% general.ngcp_type == 'spce' ? '"0644"' : '"0444"' %] owner: root group: root filetype: file @@ -64,14 +64,6 @@ file: filetype: file contains: [] - /etc/ngcp-config/systems.cfg: - exists: true - mode: "0644" - owner: root - group: root - filetype: file - contains: [] - /etc/ngcp-config/ssl: exists: true mode: "0750" @@ -104,22 +96,6 @@ file: filetype: file contains: [] - /etc/ngcp-config/shared-files/ssh: - exists: true - mode: "0755" - owner: root - group: root - filetype: directory - contains: [] - - /etc/ngcp-config/shared-files/sshd: - exists: true - mode: "0755" - owner: root - group: root - filetype: directory - contains: [] - /etc/ngcp_version: exists: true mode: "0644" diff --git a/templates/131_filesys-ngcp-pro.yaml.tt2 b/templates/131_filesys-ngcp-pro.yaml.tt2 new file mode 100644 index 0000000..b5379e5 --- /dev/null +++ b/templates/131_filesys-ngcp-pro.yaml.tt2 @@ -0,0 +1,25 @@ +file: + + /etc/ngcp-config/shared-files/ssh: + exists: true + mode: "0755" + owner: root + group: root + filetype: directory + contains: [] + + /etc/ngcp-config/shared-files/sshd: + exists: true + mode: "0755" + owner: root + group: root + filetype: directory + contains: [] + + /etc/ngcp-config/systems.cfg: + exists: true + mode: "0644" + owner: root + group: root + filetype: file + contains: [] diff --git a/ce/04_template_files.yaml.tt2 b/templates/132_filesys-ngcp-templates.yaml.tt2 similarity index 100% rename from ce/04_template_files.yaml.tt2 rename to templates/132_filesys-ngcp-templates.yaml.tt2 diff --git a/ce/05_system_users.yaml.tt2 b/templates/200_user-debian.yaml.tt2 similarity index 62% rename from ce/05_system_users.yaml.tt2 rename to templates/200_user-debian.yaml.tt2 index 67b42d9..3bc308c 100644 --- a/ce/05_system_users.yaml.tt2 +++ b/templates/200_user-debian.yaml.tt2 @@ -1,10 +1,4 @@ group: - cdrexport: - exists: true - gid: - or: - - 1001 - - 10001 daemon: exists: true gid: 1 @@ -28,16 +22,6 @@ group: exists: true gid: 0 - sems: - exists: true - - sipwise: - exists: true - gid: - or: - - 1000 - - 10000 - ssh: exists: true @@ -54,20 +38,6 @@ user: "": exists: false - cdrexport: - exists: true - uid: - or: - - 1001 - - 10001 - gid: - or: - - 1001 - - 10001 - groups: - - cdrexport - home: "/home/jail/home/cdrexport" - kamailio: exists: true groups: @@ -109,29 +79,6 @@ user: - redis home: "/var/lib/redis" - sems: - exists: true - groups: - - sems - home: - or: - - "/var/run/ngcp-sems" - - "/var/run/sems" - - sipwise: - exists: true - uid: - or: - - 1000 - - 10000 - gid: - or: - - 1000 - - 10000 - groups: - - sipwise - home: "/var/sipwise" - sshd: exists: true groups: diff --git a/templates/210_user-ngcp.yaml.tt2 b/templates/210_user-ngcp.yaml.tt2 new file mode 100644 index 0000000..27a3c32 --- /dev/null +++ b/templates/210_user-ngcp.yaml.tt2 @@ -0,0 +1,54 @@ +group: + cdrexport: + exists: true + gid: + or: + - 1001 + - 10001 + sems: + exists: true + + sipwise: + exists: true + gid: + or: + - 1000 + - 10000 + +user: + cdrexport: + exists: true + uid: + or: + - 1001 + - 10001 + gid: + or: + - 1001 + - 10001 + groups: + - cdrexport + home: "/home/jail/home/cdrexport" + + sems: + exists: true + groups: + - sems + home: + or: + - "/var/run/ngcp-sems" + - "/var/run/sems" + + sipwise: + exists: true + uid: + or: + - 1000 + - 10000 + gid: + or: + - 1000 + - 10000 + groups: + - sipwise + home: "/var/sipwise" diff --git a/templates/310_package-ngcp.yaml.tt2 b/templates/310_package-ngcp.yaml.tt2 new file mode 100644 index 0000000..66f4d34 --- /dev/null +++ b/templates/310_package-ngcp.yaml.tt2 @@ -0,0 +1,9 @@ +package: + ngcp-ngcp-ce: + installed: [% general.ngcp_type == 'spce' ? 'true' : 'false' %] + + ngcp-ngcp-pro: + installed: [% general.ngcp_type == 'sppro' ? 'true' : 'false' %] + + ngcp-ngcp-carrier: + installed: [% general.ngcp_type == 'carrier' ? 'true' : 'false' %] diff --git a/templates/400_process-debian.yaml.tt2 b/templates/400_process-debian.yaml.tt2 new file mode 100644 index 0000000..7d34d78 --- /dev/null +++ b/templates/400_process-debian.yaml.tt2 @@ -0,0 +1,44 @@ +process: + acpid: + running: true + + cron: + running: true + + exim4: + running: true + + getty: + running: true + + mysqld: + running: true + + mysqld_safe: + running: true + + nginx: + running: true + + ntpd: + running: true + + perl-fcgi: + running: true + + redis-server: + running: true + + rsyslogd: + running: true + + sshd: + running: true + +{{if eq .Env.DEBIAN_RELEASE "8"}} + udevd: + running: true +{{else}} + systemd-udevd: + running: true +{{end}} diff --git a/templates/410_process-ngcp.yaml.tt2 b/templates/410_process-ngcp.yaml.tt2 new file mode 100644 index 0000000..5a36547 --- /dev/null +++ b/templates/410_process-ngcp.yaml.tt2 @@ -0,0 +1,109 @@ +[% + PROCESS '/usr/lib/ngcp-ngcpcfg/get_hostname'; + hostname = out; + + argv.host = hostname; + argv.role = 'proxy'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_proxy = out; + + argv.host = hostname; + argv.role = 'lb'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_lb = out; + + argv.host = hostname; + argv.role = 'mgmt'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_mgmt = out; + + argv.host = hostname; + argv.role = 'db'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_db = out; + + argv.host = hostname; + argv.role = 'rtp'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_rtp = out; +-%] +[% PERL -%] + my $node_state = qx(ngcp-check_active -v); + chomp $node_state; + + $stash->set(node_state => $node_state); +[% END -%] + +command: + + "pgrep -c -f '[l]ua5.1 /usr/bin/prosody'": +[% IF is_proxy && prosody.enabled == 'yes' && node_state == 'active' -%] + exit-status: 0 + stdout: + - "1" +[% ELSE -%] + exit-status: 1 + stdout: [] +[% END -%] + stderr: [] + + "pgrep -c -f '[p]erl-fcgi-pm \\[NGCP::Panel\\]'": +[% IF is_mgmt && www_admin.enabled == 'yes' -%] + exit-status: 0 + stdout: + - "1" +[% ELSE -%] + exit-status: 1 + stdout: [] +[% END -%] + stderr: [] + + "pgrep -n -f '[k]amailio.*kamailio.proxy.pid'": +[% IF is_proxy && kamailio.proxy.start == "yes" && node_state == 'active' -%] + exit-status: 0 + stdout: + - "/[0-9]+/" +[% ELSE -%] + exit-status: 1 + stdout: [] +[% END -%] + stderr: [] + + "pgrep -n -f '[k]amailio.*kamailio.lb.pid'": +[% IF is_lb && kamailio.lb.start == "yes" && node_state == 'active' -%] + exit-status: 0 + stdout: + - "/[0-9]+/" +[% ELSE -%] + exit-status: 1 + stdout: [] +[% END -%] + stderr: [] + +process: + asterisk: + running: [% is_proxy && node_state == 'active' ? 'true' : 'false' %] + + influxd: + running: true + + kamailio: + running: [% (is_lb || is_proxy) && node_state == 'active' ? 'true' : 'false' %] + + mediator: + running: [% is_proxy && node_state == 'active' ? 'true' : 'false' %] + + ngcp-sems: + running: [% is_proxy && node_state == 'active' ? 'true' : 'false' %] + + ngcp-witnessd: + running: true + + rate-o-mat: + running: [% is_proxy && node_state == 'active' ? 'true' : 'false' %] + + rtpengine: + running: [% is_rtp && node_state == 'active' ? 'true' : 'false' %] + + telegraf: + running: true diff --git a/templates/411_process-ngcp-pro.yaml.tt2 b/templates/411_process-ngcp-pro.yaml.tt2 new file mode 100644 index 0000000..2d3da8b --- /dev/null +++ b/templates/411_process-ngcp-pro.yaml.tt2 @@ -0,0 +1,53 @@ +[% + PROCESS '/usr/lib/ngcp-ngcpcfg/get_hostname'; + hostname = out; + + argv.host = hostname; + argv.role = 'proxy'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_proxy = out; + + argv.host = hostname; + argv.role = 'lb'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_lb = out; + + argv.host = hostname; + argv.role = 'rtp'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_rtp = out; +-%] +[% PERL -%] + my $node_state = qx(ngcp-check_active -v); + chomp $node_state; + + $stash->set(node_state => $node_state); +[% END -%] + +process: + glusterfs: + running: true + + hb_watchdog: + running: true + + heartbeat: + running: true + + influxdb-relay: + running: true + + monit: + running: true + + ngcp-faxserver: + running: [% is_proxy && node_state == 'active' ? 'true' : 'false' %] + + ngcp-snmp-agent: + running: true + + snmpd: + running: true + + voisniff-ng: + running: [% (is_proxy || is_lb || is_rtp) && node_state == 'active' ? 'true' : 'false' %] diff --git a/templates/500_init-daemons-dabian.yaml.tt2 b/templates/500_init-daemons-dabian.yaml.tt2 new file mode 100644 index 0000000..873ad4d --- /dev/null +++ b/templates/500_init-daemons-dabian.yaml.tt2 @@ -0,0 +1,45 @@ +service: + + acpid: + enabled: true + running: true + + cron: + enabled: true + running: true + + exim4: + enabled: true + running: true + + io-scheduler: + enabled: true + running: true + + influxdb: + enabled: true + running: true + + motd: + enabled: true + running: true + + mysql: + enabled: true + running: true + + ntp: + enabled: true + running: true + + rsyslog: + enabled: true + running: true + + ssh: + enabled: true + running: true + + telegraf: + enabled: true + running: true diff --git a/templates/510_init-daemons-ngcp.yaml.tt2 b/templates/510_init-daemons-ngcp.yaml.tt2 new file mode 100644 index 0000000..78783e1 --- /dev/null +++ b/templates/510_init-daemons-ngcp.yaml.tt2 @@ -0,0 +1,178 @@ +[% + PROCESS '/usr/lib/ngcp-ngcpcfg/get_hostname'; + hostname = out; + + argv.host = hostname; + argv.role = 'proxy'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_proxy = out; + + argv.host = hostname; + argv.role = 'lb'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_lb = out; + + argv.host = hostname; + argv.role = 'mgmt'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_mgmt = out; + + argv.host = hostname; + argv.role = 'db'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_db = out; + + argv.host = hostname; + argv.role = 'rtp'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_rtp = out; + + argv.role = 'li'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_li = out; + is_li_enabled = is_li && cluster_sets.type == 'distributed' && intercept.enabled == 'yes'; +-%] +[% PERL -%] + my $node_state = qx(ngcp-check_active -v); + chomp $node_state; + + $stash->set(node_state => $node_state); +[% END -%] + +service: +[% IF asterisk.enabled == "yes" -%] + + asterisk: + enabled: [% general.process_handler == 'none' ? 'true' : 'false' %] + running: [% is_proxy && node_state == 'active' ? 'true' : 'false' %] +[% END -%] +[% IF intercept.enabled == "yes" -%] + + captagent: + enabled: false + running: [% is_proxy || is_rtp ? 'true' : 'false' %] +[% END -%] +[% IF turnserver.enabled == 'yes' -%] + + coturn: + enabled: false + running: [% is_rtp ? 'true' : 'false' %] +[% END -%] +[% IF bootenv.dhcp.enable == 'yes' -%] + + dnsmasq: + enabled: false + running: [% is_mgmt ? 'true' : 'false' %] +[% END -%] +[% IF haproxy.enable == "yes" -%] + + haproxy: + enabled: false + running: [% is_lb ? 'true' : 'false' %] +[% END -%] +[% IF heartbeat.hb_watchdog.enable == 'yes' -%] + + hb_watchdog: + enabled: true + running: true +[% END -%] +[% IF kamailio.lb.start == "yes" -%] + + kamailio-lb: + enabled: [% general.process_handler == 'none' ? 'true' : 'false' %] + running: [% is_lb && node_state == 'active' ? 'true' : 'false' %] +[% END -%] +[% IF kamailio.proxy.start == "yes" -%] + + kamailio-proxy: + enabled: [% general.process_handler == 'none' ? 'true' : 'false' %] + running: [% is_proxy && node_state == 'active' ? 'true' : 'false' %] +[% END -%] +[% IF mediator.enabled == 'yes' -%] + + mediator: + enabled: [% general.process_handler == 'none' ? 'true' : 'false' %] + running: [% is_proxy && node_state == 'active' ? 'true' : 'false' %] +[% END -%] +[% IF www_admin.enabled == 'yes' -%] + + ngcp-panel: + enabled: [% is_mgmt ? 'true' : 'false' %] + running: [% is_mgmt ? 'true' : 'false' %] +[% END -%] +[% IF rateomat.enable == "yes" -%] + + ngcp-rate-o-mat: + enabled: [% general.process_handler == 'none' ? 'true' : 'false' %] + running: [% is_proxy && node_state == 'active' ? 'true' : 'false' %] +[% END -%] +[% IF rtpproxy.enabled == "yes" -%] + + ngcp-rtpengine-daemon: + enabled: [% general.process_handler == 'none' ? 'true' : 'false' %] + running: [% is_rtp && node_state == 'active' ? 'true' : 'false' %] +[% END -%] +[% IF sems.enabled == "yes" -%] + + ngcp-sems: + enabled: [% general.process_handler == 'none' ? 'true' : 'false' %] + running: [% is_proxy && node_state == 'active' ? 'true' : 'false' %] +[% END -%] + + ngcp-witnessd: + enabled: true + running: true +[% IF nginx.enabled == 'yes' -%] + + nginx: + enabled: true + running: [% (is_mgmt || is_li_enabled) ? 'true' : 'false' %] +[% END -%] +[% IF prosody.enabled == 'yes' -%] + + prosody: + enabled: [% general.process_handler == 'none' ? 'true' : 'false' %] + running: [% is_proxy && node_state == 'active' ? 'true' : 'false' %] +[% END -%] +[% IF pushd.enable == "yes" -%] + + ngcp-pushd: + enabled: true + running: [% is_lb ? 'true' : 'false' %] +[% END -%] +[% IF redis.enabled == "yes" -%] + + redis-server: + enabled: true + running: [% (is_rtp || is_proxy || is_db) ? 'true' : 'false' %] +[% END -%] +[% IF ldap.enabled == "yes" -%] + + slapd: + enabled: false + running: [% is_mgmt ? 'true' : 'false' %] +[% END -%] +[% IF pbx.enable == "yes" -%] + + sems-pbx: + enabled: false + running: [% is_proxy && node_state == 'active' ? 'true' : 'false' %] +[% END -%] +[% IF voisniff.daemon.start == 'yes' -%] + + voisniff-ng: + enabled: false + running: [% (is_proxy || is_lb || is_rtp) && node_state == 'active' ? 'true' : 'false' %] +[% END -%] +[% IF is_mgmt && general.ngcp_type == 'carrier' -%] + + ngcpcfg-api: + enabled: false + running: true +[% END -%] +[% IF elasticsearch.enable == 'yes' -%] + + elasticsearch: + enabled: true + running: [% (is_db || is_mgmt) ? 'true' : 'false' %] +[% END -%] diff --git a/templates/511_init-daemons-ngcp-pro.yaml.tt2 b/templates/511_init-daemons-ngcp-pro.yaml.tt2 new file mode 100644 index 0000000..17c1fd0 --- /dev/null +++ b/templates/511_init-daemons-ngcp-pro.yaml.tt2 @@ -0,0 +1,41 @@ +[% + PROCESS '/usr/lib/ngcp-ngcpcfg/get_hostname'; + hostname = out; + + argv.host = hostname; + argv.role = 'mgmt'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_mgmt = out; + + argv.host = hostname; + argv.role = 'proxy'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_proxy = out; +-%] +[% PERL -%] + my $node_state = qx(ngcp-check_active -v); + chomp $node_state; + + $stash->set(node_state => $node_state); +[% END -%] + +service: + influxdb-relay: + enabled: true + running: true + + snmpd: + enabled: true + running: true + + ngcp-snmp-agent: + enabled: true + running: true +[% IF faxserver.enable == "yes" -%] + + # XXX: This should be moved to the non-pro file, but the faxserver.enable + # is incorrectly enabled on spce. + ngcp-faxserver: + enabled: false + running: [% is_proxy && node_state == 'active' ? 'true' : 'false' %] +[% END -%] diff --git a/pro/01_hostname-and-interfaces.yaml.tt2 b/templates/800_network-hostname.yaml.tt2 similarity index 51% rename from pro/01_hostname-and-interfaces.yaml.tt2 rename to templates/800_network-hostname.yaml.tt2 index dda74c4..7b53ada 100644 --- a/pro/01_hostname-and-interfaces.yaml.tt2 +++ b/templates/800_network-hostname.yaml.tt2 @@ -6,28 +6,42 @@ command: hostname: exit-status: 0 stdout: - - "/sp[1,2]/" + - [% general.ngcp_type == 'spce' ? "spce" : "/sp[1,2]/" %] stderr: [] "hostname --fqdn": exit-status: 0 stdout: - - "/sp[1,2]/" + - [% general.ngcp_type == 'spce' ? "spce." : "/sp[1,2]/" %] stderr: [] "hostname --short": exit-status: 0 stdout: - - "/sp[1,2]/" + - [% general.ngcp_type == 'spce' ? "spce" : "/sp[1,2]/" %] stderr: [] [% END -%] - "[ $(hostname --short) = $(hostname --fqdn) ]": +[% IF general.ngcp_type == 'spce' -%] + "[ $(hostname --short). = $(hostname --fqdn) ]": title: "short hostname should be the same as fqdn (ignoring trailing dot)" exit-status: 0 stdout: [] stderr: [] +[% ELSIF general.ngcp_type == 'sppro' -%] + "[ $(hostname --short) = $(hostname --fqdn) ]": + title: "short hostname should be the same as fqdn" + exit-status: 0 + stdout: [] + stderr: [] +[% ELSIF general.ngcp_type == 'carrier' -%] + "[ $(hostname --short) = $(cat /etc/hostname) ]": + title: "short hostname should be the same as /etc/hostname" + exit-status: 0 + stdout: [] + stderr: [] +[% END -%] "[ $(resolveip -s $(hostname --fqdn)) = $(resolveip -s $(hostname --short)) ]": title: "ip-s of short hostname and fqdn should be the same" exit-status: 0 diff --git a/templates/810_network-dns-debian.yaml.tt2 b/templates/810_network-dns-debian.yaml.tt2 new file mode 100644 index 0000000..ce136df --- /dev/null +++ b/templates/810_network-dns-debian.yaml.tt2 @@ -0,0 +1,6 @@ +dns: + localhost: + resolveable: true + addrs: + - 127.0.0.1 + timeout: 500 diff --git a/templates/811_network-dns-ngcp-ce.yaml.tt2 b/templates/811_network-dns-ngcp-ce.yaml.tt2 new file mode 100644 index 0000000..483b02f --- /dev/null +++ b/templates/811_network-dns-ngcp-ce.yaml.tt2 @@ -0,0 +1,6 @@ +dns: + spce: + resolveable: true + addrs: + - 127.0.0.2 + timeout: 500 diff --git a/pro/09_system_dns.yaml.tt2 b/templates/812_network-dns-ngcp-pro.yaml.tt2 similarity index 51% rename from pro/09_system_dns.yaml.tt2 rename to templates/812_network-dns-ngcp-pro.yaml.tt2 index 52cd6d4..f5c43b9 100644 --- a/pro/09_system_dns.yaml.tt2 +++ b/templates/812_network-dns-ngcp-pro.yaml.tt2 @@ -1,6 +1,4 @@ dns: - -[% IF sipwise.system_tester.skip_dns_check_test != "true" -%] sp1: resolveable: true addrs: @@ -12,10 +10,3 @@ dns: addrs: - 192.168.255.252 timeout: 500 - -[% END -%] - localhost: - resolveable: true - addrs: - - 127.0.0.1 - timeout: 500 diff --git a/templates/820_network-ports-debian.yaml.tt2 b/templates/820_network-ports-debian.yaml.tt2 new file mode 100644 index 0000000..f263c42 --- /dev/null +++ b/templates/820_network-ports-debian.yaml.tt2 @@ -0,0 +1,23 @@ +port: + # OpenSSH + tcp:22: + listening: true + ip: ["0.0.0.0"] + + # Exim MTA + tcp:25: + listening: true + ip: ["127.0.0.1"] + + # ntpd + udp:123: + listening: true + ip: ["0.0.0.0"] + + # Check for a closed port, nothing there. + tcp:7777: + listening: false + + # Check for a closed port, nothing there. + udp:7777: + listening: false diff --git a/templates/821_network-ports-ngcp.yaml.tt2 b/templates/821_network-ports-ngcp.yaml.tt2 new file mode 100644 index 0000000..d650b6b --- /dev/null +++ b/templates/821_network-ports-ngcp.yaml.tt2 @@ -0,0 +1,199 @@ +[% + PROCESS '/usr/lib/ngcp-ngcpcfg/get_hostname'; + hostname = out; + + argv.host = hostname; + argv.role = 'proxy'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_proxy = out; + + argv.host = hostname; + argv.role = 'lb'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_lb = out; + + argv.host = hostname; + argv.role = 'mgmt'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_mgmt = out; + + argv.host = hostname; + argv.role = 'db'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_db = out; + + argv.host = hostname; + argv.role = 'rtp'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_rtp = out; + + argv.host = hostname; + argv.type = 'sip_ext'; + PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_shared_ips_for_host'; + sip_ext_ips = out; + + IF !sip_ext_ips.size; + argv.host = hostname; + argv.type = 'sip_ext'; + PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host'; + sip_ext_ips = out; + END; + + argv.host = hostname; + argv.type = 'web_ext'; + PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_shared_ips_for_host'; + web_ext_ips = out; + + IF !web_ext_ips.size; + argv.host = hostname; + argv.type = 'web_ext'; + PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host'; + web_ext_ips = out; + END; + + argv.host = hostname; + argv.type = 'web_int'; + PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_shared_ips_for_host'; + web_int_ips = out; + + IF !web_int_ips.size; + argv.host = hostname; + argv.type = 'web_int'; + PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host'; + web_int_ips = out; + END; + + argv.host = hostname; + argv.type = 'ha_int'; + PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host'; + ha_int_ips = out; +-%] +[% PERL -%] + my $node_state = qx(ngcp-check_active -v); + chomp $node_state; + + $stash->set(node_state => $node_state); +[% END -%] + +port: + +[% IF is_mgmt -%] + # Nginx (IPv6 due to listening on all address families) + tcp6:80: + listening: true + + # Nginx HTTPS (NGCP Panel) + tcp:443: + listening: true + ip: ["[% web_ext_ips.0 -%]"] + + # Nginx HTTPS (NGCP Panel Admin) + tcp:1443: + listening: true + ip: ["[% web_int_ips.0 -%]"] + +[% END -%] +[% IF is_mgmt && pbx.enable == 'yes' -%] + # HTTPS PBX autoprovisioning + tcp:1444: + listening: true + ip: ["[% web_ext_ips.0 -%]"] + + # HTTP PBX autoprovisioning + tcp:1445: + listening: true + ip: ["[% web_ext_ips.0 -%]"] + +[% END -%] + # MySQL + tcp:3306: + listening: true + ip: ["[% general.ngcp_type == 'spce' ? '127.0.0.1' : '0.0.0.0' %]"] + +[% IF is_lb -%] + # Kamailio load-balancer + tcp:5060: + listening: [% node_state == 'active' ? 'true' : 'false' %] + ip: ["[% sip_ext_ips.0 -%]"] + +[% END -%] +[% IF is_proxy -%] + # Kamailio proxy + tcp:5062: + listening: [% node_state == 'active' ? 'true' : 'false' %] + ip: ["127.0.0.1"] + + # Prosody + tcp:5222: + listening: [% node_state == 'active' ? 'true' : 'false' %] + ip: ["[% sip_ext_ips.0 -%]"] + + # Prosody + tcp:5269: + listening: [% node_state == 'active' ? 'true' : 'false' %] + ip: ["[% sip_ext_ips.0 -%]"] + + # Prosody + tcp:5280: + listening: [% node_state == 'active' ? 'true' : 'false' %] + ip: ["127.0.0.1"] + + # Prosody + tcp:5281: + listening: [% node_state == 'active' ? 'true' : 'false' %] + ip: ["127.0.0.1"] + + # Prosody + tcp:5582: + listening: [% node_state == 'active' ? 'true' : 'false' %] + ip: ["127.0.0.1"] + + # SEMS + tcp:8090: + listening: [% node_state == 'active' ? 'true' : 'false' %] + ip: ["127.0.0.1"] + + # Asterisk + tcp:5038: + listening: [% node_state == 'active' ? 'true' : 'false' %] + ip: ["127.0.0.1"] + + # SEMS + udp:5040: + listening: [% node_state == 'active' ? 'true' : 'false' %] + ip: ["127.0.0.1"] + + # Asterisk + udp:5070: + listening: [% node_state == 'active' ? 'true' : 'false' %] + ip: ["127.0.0.1"] + + # SEMS + udp:5080: + listening: [% node_state == 'active' ? 'true' : 'false' %] + ip: ["127.0.0.1"] + +[% END -%] +[% IF is_rtp || is_proxy || is_db -%] + # Redis + tcp:6379: + listening: true + ip: ["[% ha_int_ips.0 %]"] + +[% END -%] +[% IF is_rtp -%] + # rtpengine + udp:2223: + listening: [% node_state == 'active' ? 'true' : 'false' %] + ip: ["127.0.0.1"] + +[% END -%] + # InfluxDB Admin + tcp6:8083: + listening: true + ip: ["::"] + + # InfluxDb Query + tcp6:8086: + listening: true + ip: ["::"] diff --git a/templates/822_network-ports-ngcp-pro.yaml.tt2 b/templates/822_network-ports-ngcp-pro.yaml.tt2 new file mode 100644 index 0000000..299fc40 --- /dev/null +++ b/templates/822_network-ports-ngcp-pro.yaml.tt2 @@ -0,0 +1,25 @@ +port: + # glusterfs + tcp:24009: + listening: true + ip: ["0.0.0.0"] + + # Monit + tcp:2812: + listening: true + ip: ["127.0.0.1"] + + # snmpd + udp:161: + listening: true + ip: ["127.0.0.1"] + + # InfluxDB Relay + tcp:9096: + listening: true + ip: ["127.0.0.1"] + + # Heartbeat + udp:[% heartbeat.port ? heartbeat.port : '694' %]: + listening: true + ip: ["0.0.0.0"] diff --git a/ce/10_sites_ok.yaml.tt2 b/templates/900_service-ngcp-api.yaml.tt2 similarity index 77% rename from ce/10_sites_ok.yaml.tt2 rename to templates/900_service-ngcp-api.yaml.tt2 index 3adec4f..3487abf 100644 --- a/ce/10_sites_ok.yaml.tt2 +++ b/templates/900_service-ngcp-api.yaml.tt2 @@ -1,41 +1,54 @@ -[% PROCESS '/usr/lib/ngcp-ngcpcfg/get_hostname'; hostname = out -%] -[% argv.host=hostname; argv.type='web_ext'; - PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_shared_ips_for_host'; - web_ext_ips = out --%] -[% IF !web_ext_ips.size -%] -[% argv.host=hostname; argv.type='web_ext'; - PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host'; - web_ext_ips = out; --%] -[% END -%] -[% argv.host=hostname; argv.type='web_int'; - PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_shared_ips_for_host'; - web_int_ips = out --%] -[% IF !web_int_ips.size -%] -[% argv.host=hostname; argv.type='web_int'; - PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host'; - web_int_ips = out; --%] -[% END -%] [% - argv.host=hostname; argv.type='api_int'; - PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_shared_ips_for_host'; - api_int_ips = out; - - PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host'; - api_int_ips = out.merge(api_int_ips); - - argv.role='mgmt'; - PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; - is_mgmt = out; - - argv.role='li'; - PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; - is_li = out; - is_li_enabled = is_li && cluster_sets.type == 'distributed' && intercept.enabled == 'yes'; + PROCESS '/usr/lib/ngcp-ngcpcfg/get_hostname'; + hostname = out; + + argv.host = hostname; + argv.type = 'web_ext'; + PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_shared_ips_for_host'; + web_ext_ips = out; + + IF !web_ext_ips.size; + argv.host = hostname; + argv.type = 'web_ext'; + PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host'; + web_ext_ips = out; + END; + + argv.host = hostname; + argv.type = 'web_int'; + PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_shared_ips_for_host'; + web_int_ips = out; + + IF !web_int_ips.size; + argv.host = hostname; + argv.type = 'web_int'; + PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host'; + web_int_ips = out; + END; + + argv.host = hostname; + argv.type = 'api_int'; + PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_shared_ips_for_host'; + api_int_ips = out; + + PROCESS '/usr/lib/ngcp-ngcpcfg/get_all_ips_for_host'; + api_int_ips = out.merge(api_int_ips); + + argv.role = 'mgmt'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_mgmt = out; + + argv.role = 'li'; + PROCESS '/usr/lib/ngcp-ngcpcfg/has_role'; + is_li = out; + is_li_enabled = is_li && cluster_sets.type == 'distributed' && intercept.enabled == 'yes'; -%] +[% PERL -%] + my $node_state = qx(ngcp-check_active -v); + chomp $node_state; + + $stash->set(node_state => $node_state); +[% END -%] command: @@ -158,7 +171,7 @@ command: timeout: 30000 -[% IF www_admin.enabled == 'yes' && (is_mgmt || is_li_enabled) -%] +[% IF www_admin.enabled == 'yes' && (is_mgmt || is_li_enabled) && node_state == 'active' -%] "curl -H 'NGCP-UserAgent: NGCP::API::Client' --insecure -L https://[% credentials.rest_api.auth_system.u %]:[% credentials.rest_api.auth_system.p %]@[% api_int_ips.0 -%]:[% www_admin.http_system.port %]/api/": exit-status: 0 stdout: diff --git a/ce/11_influxdb_content.yaml.tt2 b/templates/910_service-influxdb.yaml.tt2 similarity index 100% rename from ce/11_influxdb_content.yaml.tt2 rename to templates/910_service-influxdb.yaml.tt2 diff --git a/templates/goss.yaml.tt2 b/templates/goss.yaml.tt2 new file mode 100644 index 0000000..a653f20 --- /dev/null +++ b/templates/goss.yaml.tt2 @@ -0,0 +1,38 @@ +gossfile: + 000_self-test-command.yaml: {} + 110_filesys-no-cores.yaml: {} + 120_filesys-free-space.yaml: {} + 130_filesys-ngcp.yaml: {} +[% IF general.ngcp_type != 'spce' -%] + 131_filesys-ngcp-pro.yaml: {} +[% END -%] + 132_filesys-ngcp-templates.yaml: {} + 200_user-debian.yaml: {} + 210_user-ngcp.yaml: {} + 310_package-ngcp.yaml: {} + 400_process-debian.yaml: {} + 410_process-ngcp.yaml: {} +[% IF general.ngcp_type != 'spce' -%] + 411_process-ngcp-pro.yaml: {} +[% END -%] + 500_init-daemons-dabian.yaml: {} + 510_init-daemons-ngcp.yaml: {} +[% IF general.ngcp_type != 'spce' -%] + 511_init-daemons-ngcp-pro.yaml: {} +[% END -%] + 800_network-hostname.yaml: {} +[% IF sipwise.system_tester.skip_dns_check_test != "true" -%] + 810_network-dns-debian.yaml: {} +[% IF general.ngcp_type == 'spce' -%] + 811_network-dns-ngcp-ce.yaml: {} +[% ELSE -%] + 812_network-dns-ngcp-pro.yaml: {} +[% END -%] +[% END -%] + 820_network-ports-debian.yaml: {} + 821_network-ports-ngcp.yaml: {} +[% IF general.ngcp_type != 'spce' -%] + 822_network-ports-ngcp-pro.yaml: {} +[% END -%] + 900_service-ngcp-api.yaml: {} + 910_service-influxdb.yaml: {} diff --git a/testrunner b/testrunner index 8de2dce..9255fa8 100755 --- a/testrunner +++ b/testrunner @@ -4,26 +4,10 @@ set -e REPORT_DIRECTORY='reports/' -usage() { - printf "Usage: %s \n\n" "$0" - printf "Usage example: %s CE\n" "$0" -} - diag() { echo "$@" 2>&1 } -if [ $# -lt 1 ] ; then - usage >&2 - exit 1 -fi - -TYPE=$(echo "$1"| tr '[:upper:]' '[:lower:]') -case "${TYPE}" in - ce|pro) diag "Requested system tests for supported type '${TYPE}', continue..." ;; - *) echo "ERRRO: Unknown type '$1'" >&2 ; usage >&2 ; exit 1 ;; -esac - if ls /var/cores/core.perl-fcgi.sig11* >/dev/null 2>&1 ; then diag "================== NOTE: CORE DUMP DETECTED ==================" diag "= Removing known cores to prevent failing for the known issues:" @@ -69,9 +53,9 @@ rm -f "${host_yml_file}" rm -rf "${REPORT_DIRECTORY}" mkdir -p "${REPORT_DIRECTORY}" -TAP_RESULTS="${REPORT_DIRECTORY}/goss_${TYPE}_results.tap" +TAP_RESULTS="${REPORT_DIRECTORY}/goss_results.tap" DEBIAN_RELEASE=$(sed -e 's/\([0-9]*\)\..*/\1/' /etc/debian_version) -DEBIAN_RELEASE=$DEBIAN_RELEASE goss -g "/etc/ngcp-tests/${TYPE}/goss.yaml" validate --format tap | tee "${TAP_RESULTS}" +DEBIAN_RELEASE=$DEBIAN_RELEASE goss -g "/etc/ngcp-tests/goss.yaml" validate --format tap | tee "${TAP_RESULTS}" exit "${PIPESTATUS[0]}"