diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index a31658f4..bb87f60f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -83,10 +83,14 @@ run_memory_test: when: always paths: - timestamp.log - - memory-report-get.xml - - memory-report-operate.xml - - memory-report-schema.xml - - memory-report-instances.xml + - memory-report-usp-get.xml + - memory-report-usp-operate.xml + - memory-report-usp-schema.xml + - memory-report-usp-instances.xml + - memory-report-cwmp-get.xml + - memory-report-cwmp-operate.xml + - memory-report-cwmp-schema.xml + - memory-report-cwmp-instances.xml - memory-test-coverage.xml run_uspd: diff --git a/gitlab-ci/memory-test.sh b/gitlab-ci/memory-test.sh index 4013690c..d5b23be7 100755 --- a/gitlab-ci/memory-test.sh +++ b/gitlab-ci/memory-test.sh @@ -17,21 +17,33 @@ supervisorctl status all echo "Running memory check on datamodel" ret=0 -valgrind --xml=yes --xml-file=/builds/iopsys/bbf/memory-report-get.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes /builds/iopsys/bbf/test/bbf_test/bbf_dm -u get Device. +valgrind --xml=yes --xml-file=/builds/iopsys/bbf/memory-report-usp-get.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes /builds/iopsys/bbf/test/bbf_test/bbf_dm -u get Device. ret=$? -valgrind --xml=yes --xml-file=/builds/iopsys/bbf/memory-report-operate.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes /builds/iopsys/bbf/test/bbf_test/bbf_dm -u list_operate +valgrind --xml=yes --xml-file=/builds/iopsys/bbf/memory-report-usp-operate.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes /builds/iopsys/bbf/test/bbf_test/bbf_dm -u list_operate ret=$(( ret + $? )) -valgrind --xml=yes --xml-file=/builds/iopsys/bbf/memory-report-schema.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes /builds/iopsys/bbf/test/bbf_test/bbf_dm -u get_schema +valgrind --xml=yes --xml-file=/builds/iopsys/bbf/memory-report-usp-schema.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes /builds/iopsys/bbf/test/bbf_test/bbf_dm -u get_schema ret=$(( ret + $? )) -valgrind --xml=yes --xml-file=/builds/iopsys/bbf/memory-report-instances.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes /builds/iopsys/bbf/test/bbf_test/bbf_dm -u instances Device. +valgrind --xml=yes --xml-file=/builds/iopsys/bbf/memory-report-usp-instances.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes /builds/iopsys/bbf/test/bbf_test/bbf_dm -u instances Device. +ret=$(( ret + $? )) + +valgrind --xml=yes --xml-file=/builds/iopsys/bbf/memory-report-cwmp-get.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes /builds/iopsys/bbf/test/bbf_test/bbf_dm -c get Device. +ret=$? + +valgrind --xml=yes --xml-file=/builds/iopsys/bbf/memory-report-cwmp-operate.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes /builds/iopsys/bbf/test/bbf_test/bbf_dm -c list_operate +ret=$(( ret + $? )) + +valgrind --xml=yes --xml-file=/builds/iopsys/bbf/memory-report-cwmp-schema.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes /builds/iopsys/bbf/test/bbf_test/bbf_dm -c get_schema +ret=$(( ret + $? )) + +valgrind --xml=yes --xml-file=/builds/iopsys/bbf/memory-report-cwmp-instances.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes /builds/iopsys/bbf/test/bbf_test/bbf_dm -c instances Device. ret=$(( ret + $? )) if [ "$ret" -ne 0 ]; then echo "Memory check failed" - return $ret + check_ret $ret fi supervisorctl stop all diff --git a/gitlab-ci/setup.sh b/gitlab-ci/setup.sh index 9f1f0090..d23e87e8 100755 --- a/gitlab-ci/setup.sh +++ b/gitlab-ci/setup.sh @@ -8,6 +8,7 @@ cp -r ./test/files/etc/* /etc/ cp -r ./test/files/usr/* /usr/ cp -r ./test/files/var/* /var/ cp -r ./test/files/tmp/* /tmp/ +cp -r ./test/files/lib/* /lib/ cp ./gitlab-ci/iopsys-supervisord.conf /etc/supervisor/conf.d/ diff --git a/test/files/etc/config/asterisk b/test/files/etc/config/asterisk index 3eaf44b5..da260be8 100644 --- a/test/files/etc/config/asterisk +++ b/test/files/etc/config/asterisk @@ -1,3 +1,4 @@ + config asterisk 'general' option enabled '1' option log_stderr '1' @@ -57,6 +58,34 @@ config tel_line 'telline3' option clir '0' option callwaiting_enabled '0' option do_not_disturb '0' + option name 'DECT 4' + +config tel_line 'telline4' + option enabled '1' + option extension '4444' + option sip_account 'sip0' + option noise '0' + option vad '0' + option txgain '4' + option rxgain '4' + option echo_cancel '1' + option clir '0' + option callwaiting_enabled '0' + option do_not_disturb '0' + option name 'Tel 2' + +config tel_line 'telline5' + option enabled '1' + option extension '5555' + option sip_account 'sip0' + option noise '0' + option vad '0' + option txgain '4' + option rxgain '4' + option echo_cancel '1' + option clir '0' + option callwaiting_enabled '0' + option do_not_disturb '0' option name 'Tel 1' config dialplan 'custom_dialplan' @@ -144,3 +173,4 @@ config sip_service_provider 'sip0' option encryption 'no' option mediasec '0' option dtmf_mode 'rfc4733' + diff --git a/test/files/etc/config/bulkdata b/test/files/etc/config/bulkdata new file mode 100644 index 00000000..7ef0df97 --- /dev/null +++ b/test/files/etc/config/bulkdata @@ -0,0 +1,43 @@ + +config bulkdata 'bulkdata' + option enable '0' + #Log levels: Critical=0, Warning=1, Notice=2, Info=3, Debug=4 + option log_level '3' + +config profile + option profile_id '1' + option enable '0' + option name '' + option nbre_of_retained_failed_reports '0' + option protocol 'http' + option encoding_type '' + option reporting_interval '86400' + option time_reference '0' + option csv_encoding_field_separator ',' + option csv_encoding_row_separator ' ' + option csv_encoding_escape_character '"' + option csv_encoding_report_format 'column' + option csv_encoding_row_time_stamp 'unix' + option json_encoding_report_format 'objecthierarchy' + option json_encoding_report_time_stamp 'unix' + option http_url '' + option http_username '' + option http_password '' + option http_compression 'none' + option http_method 'post' + option http_use_date_header '1' + option http_retry_enable '0' + option http_retry_minimum_wait_interval '5' + option http_retry_interval_multiplier '2000' + option http_persist_across_reboot '0' + +config profile_parameter + option profile_id '1' + option name '' + option reference '' + +config profile_http_request_uri_parameter + option profile_id '1' + option name '' + option reference '' + diff --git a/test/files/etc/config/cwmp b/test/files/etc/config/cwmp index 5c1a74b1..590ccb52 100644 --- a/test/files/etc/config/cwmp +++ b/test/files/etc/config/cwmp @@ -36,7 +36,6 @@ config cpe 'cpe' option instance_mode 'InstanceNumber' option session_timeout '60' option notification '1' - option datamodel 'tr181' option exec_download '0' option periodic_notify_enable '1' option periodic_notify_interval '10' diff --git a/test/files/etc/config/ddns b/test/files/etc/config/ddns new file mode 100644 index 00000000..6242ee45 --- /dev/null +++ b/test/files/etc/config/ddns @@ -0,0 +1,33 @@ +# +# Please read https://openwrt.org/docs/guide-user/base-system/ddns +# +config ddns "global" + option ddns_dateformat "%F %R" +# option ddns_rundir "/var/run/ddns" +# option ddns_logdir "/var/log/ddns" + option ddns_loglines "250" + option upd_privateip "0" + option use_curl "1" + + +config service "myddns_ipv4" + option service_name "dyndns.org" + option lookup_host "yourhost.example.com" + option domain "yourhost.example.com" + option username "your_username" + option password "your_password" + option interface "wan" + option ip_source "network" + option ip_network "wan" + +config service "myddns_ipv6" + option update_url "http://[USERNAME]:[PASSWORD]@your.provider.net/nic/update?hostname=[DOMAIN]&myip=[IP]" + option lookup_host "yourhost.example.com" + option domain "yourhost.example.com" + option username "your_username" + option password "your_password" + option use_ipv6 "1" + option interface "wan6" + option ip_source "network" + option ip_network "wan6" + diff --git a/test/files/etc/config/dhcp b/test/files/etc/config/dhcp new file mode 100644 index 00000000..9a70765b --- /dev/null +++ b/test/files/etc/config/dhcp @@ -0,0 +1,53 @@ + +config dnsmasq + option domainneeded '1' + option boguspriv '1' + option filterwin2k '0' + option localise_queries '1' + option rebind_protection '0' + option rebind_localhost '1' + option local '/lan/' + option domain 'lan' + option expandhosts '1' + option nonegcache '0' + option authoritative '1' + option readethers '1' + option leasefile '/tmp/dhcp.leases' + option resolvfile '/tmp/resolv.conf.d/resolv.conf.auto' + option nonwildcard '1' + option localservice '1' + option dhcpscript '/usr/lib/dnsmasq/user-dhcp-script.sh' + option ednspacket_max '1232' + +config domain + list name 'www.routerlogin.net' + list name 'routerlogin.net' + list name 'www.routerlogin.com' + list name 'routerlogin.com' + list name 'www.login.lan' + list name 'login.lan' + list name 'login' + list name 'iopsys.lan' + +config dhcp 'lan' + option interface 'lan' + option start '100' + option limit '150' + option leasetime '1h' + option dhcpv4 'server' + option dhcpv6 'server' + option ra 'server' + option ra_slaac '1' + list ra_flags 'managed-config' + list ra_flags 'other-config' + +config dhcp 'wan' + option interface 'wan' + option ignore '1' + +config odhcpd 'odhcpd' + option maindhcp '0' + option leasefile '/tmp/hosts/odhcpd' + option leasetrigger '/usr/sbin/odhcpd-update' + option loglevel '4' + diff --git a/test/files/etc/config/firewall b/test/files/etc/config/firewall index fe44ace6..44001047 100644 --- a/test/files/etc/config/firewall +++ b/test/files/etc/config/firewall @@ -1,164 +1,173 @@ + config globals 'globals' - option enabled '1' + option enabled '1' config defaults - option syn_flood '1' - option input 'ACCEPT' - option output 'ACCEPT' - option forward 'REJECT' + option syn_flood '1' + option input 'ACCEPT' + option output 'ACCEPT' + option forward 'REJECT' config zone - option name 'lan' - list network 'lan' - option input 'ACCEPT' - option output 'ACCEPT' - option forward 'ACCEPT' + option name 'lan' + list network 'lan' + option input 'ACCEPT' + option output 'ACCEPT' + option forward 'ACCEPT' config zone - option name 'wan' - list network 'wan' - list network 'wan6' - option input 'REJECT' - option output 'ACCEPT' - option forward 'REJECT' - option masq '1' - option mtu_fix '1' + option name 'wan' + list network 'wan' + list network 'wan6' + option input 'REJECT' + option output 'ACCEPT' + option forward 'REJECT' + option masq '1' + option mtu_fix '1' config forwarding - option src 'lan' - option dest 'wan' + option src 'lan' + option dest 'wan' config rule - option name 'Allow-DHCP-Renew' - option src 'wan' - option proto 'udp' - option dest_port '68' - option target 'ACCEPT' - option family 'ipv4' - option dest 'lan' + option name 'Allow-DHCP-Renew' + option src 'wan' + option proto 'udp' + option dest_port '68' + option target 'ACCEPT' + option family 'ipv4' config rule - option name 'Allow-Ping' - option src 'wan' - option proto 'icmp' - option icmp_type 'echo-request' - option family 'ipv4' - option target 'ACCEPT' + option name 'Allow-Ping' + option src 'wan' + option proto 'icmp' + option icmp_type 'echo-request' + option family 'ipv4' + option target 'ACCEPT' config rule - option name 'Allow-IGMP' - option src 'wan' - option proto 'igmp' - option family 'ipv4' - option target 'ACCEPT' + option name 'Allow-IGMP' + option src 'wan' + option proto 'igmp' + option family 'ipv4' + option target 'ACCEPT' config rule - option name 'Allow-DHCPv6' - option src 'wan' - option proto 'udp' - option src_ip 'fc00::/6' - option dest_ip 'fc00::/6' - option dest_port '546' - option family 'ipv6' - option target 'ACCEPT' + option name 'Allow-DHCPv6' + option src 'wan' + option proto 'udp' + option src_ip 'fc00::/6' + option dest_ip 'fc00::/6' + option dest_port '546' + option family 'ipv6' + option target 'ACCEPT' config rule - option name 'Allow-MLD' - option src 'wan' - option proto 'icmp' - option src_ip 'fe80::/10' - list icmp_type '130/0' - list icmp_type '131/0' - list icmp_type '132/0' - list icmp_type '143/0' - option family 'ipv6' - option target 'ACCEPT' + option name 'Allow-MLD' + option src 'wan' + option proto 'icmp' + option src_ip 'fe80::/10' + list icmp_type '130/0' + list icmp_type '131/0' + list icmp_type '132/0' + list icmp_type '143/0' + option family 'ipv6' + option target 'ACCEPT' config rule - option name 'Allow-ICMPv6-Input' - option src 'wan' - option proto 'icmp' - list icmp_type 'echo-request' - list icmp_type 'echo-reply' - list icmp_type 'destination-unreachable' - list icmp_type 'packet-too-big' - list icmp_type 'time-exceeded' - list icmp_type 'bad-header' - list icmp_type 'unknown-header-type' - list icmp_type 'router-solicitation' - list icmp_type 'neighbour-solicitation' - list icmp_type 'router-advertisement' - list icmp_type 'neighbour-advertisement' - option limit '1000/sec' - option family 'ipv6' - option target 'ACCEPT' + option name 'Allow-ICMPv6-Input' + option src 'wan' + option proto 'icmp' + list icmp_type 'echo-request' + list icmp_type 'echo-reply' + list icmp_type 'destination-unreachable' + list icmp_type 'packet-too-big' + list icmp_type 'time-exceeded' + list icmp_type 'bad-header' + list icmp_type 'unknown-header-type' + list icmp_type 'router-solicitation' + list icmp_type 'neighbour-solicitation' + list icmp_type 'router-advertisement' + list icmp_type 'neighbour-advertisement' + option limit '1000/sec' + option family 'ipv6' + option target 'ACCEPT' config rule - option name 'Allow-ICMPv6-Forward' - option src 'wan' - option dest '*' - option proto 'icmp' - list icmp_type 'echo-request' - list icmp_type 'echo-reply' - list icmp_type 'destination-unreachable' - list icmp_type 'packet-too-big' - list icmp_type 'time-exceeded' - list icmp_type 'bad-header' - list icmp_type 'unknown-header-type' - option limit '1000/sec' - option family 'ipv6' - option target 'ACCEPT' + option name 'Allow-ICMPv6-Forward' + option src 'wan' + option dest '*' + option proto 'icmp' + list icmp_type 'echo-request' + list icmp_type 'echo-reply' + list icmp_type 'destination-unreachable' + list icmp_type 'packet-too-big' + list icmp_type 'time-exceeded' + list icmp_type 'bad-header' + list icmp_type 'unknown-header-type' + option limit '1000/sec' + option family 'ipv6' + option target 'ACCEPT' config rule - option name 'Allow-IPSec-ESP' - option src 'wan' - option dest 'lan' - option proto 'esp' - option target 'ACCEPT' + option name 'Allow-IPSec-ESP' + option src 'wan' + option dest 'lan' + option proto 'esp' + option target 'ACCEPT' config rule - option name 'Allow-ISAKMP' - option src 'wan' - option dest 'lan' - option dest_port '500' - option proto 'udp' - option target 'ACCEPT' + option name 'Allow-ISAKMP' + option src 'wan' + option dest 'lan' + option dest_port '500' + option proto 'udp' + option target 'ACCEPT' + +config rule + option name 'Support-UDP-Traceroute' + option src 'wan' + option dest_port '33434:33689' + option proto 'udp' + option family 'ipv4' + option target 'REJECT' + option enabled 'false' config dmz 'dmz' - option enabled '0' - option exclude_ports '5060 7547' + option enabled '0' + option exclude_ports '5060 7547' config include - option path '/etc/firewall.user' - option reload '1' + option path '/etc/firewall.user' + option reload '1' config include 'ddos' - option path '/etc/firewall.ddos' - option reload '1' + option path '/etc/firewall.ddos' + option reload '1' config include 'parental' - option path '/etc/firewall.parental' - option reload '1' + option path '/etc/firewall.parental' + option reload '1' config include 'qos' - option path '/etc/firewall.qos' - option reload '1' + option path '/etc/firewall.qos' + option reload '1' config include 'cwmp' - option path '/etc/firewall.cwmp' - option reload '1' + option path '/etc/firewall.cwmp' + option reload '1' config include 'miniupnpd' - option type 'script' - option path '/usr/share/miniupnpd/firewall.include' - option family 'any' - option reload '1' + option type 'script' + option path '/usr/share/miniupnpd/firewall.include' + option family 'any' + option reload '1' config include 'sip' - option path '/etc/firewall.sip' - option reload '1' + option path '/etc/firewall.sip' + option reload '1' config include 'dmzhost' - option path '/etc/firewall.dmz' - option reload '1' + option path '/etc/firewall.dmz' + option reload '1' diff --git a/test/files/etc/config/hosts b/test/files/etc/config/hosts new file mode 100644 index 00000000..55f2ada8 --- /dev/null +++ b/test/files/etc/config/hosts @@ -0,0 +1,4 @@ + +config global 'global' + option ageing_timer '1440' + option reboot_persistent '0' diff --git a/test/files/etc/config/ieee1905 b/test/files/etc/config/ieee1905 new file mode 100755 index 00000000..03dbad69 --- /dev/null +++ b/test/files/etc/config/ieee1905 @@ -0,0 +1,25 @@ + +config ieee1905 'ieee1905' + option enabled '1' + option extension '1' + list extmodule 'map' + option registrar '2 5' + option macaddress '02:22:07:AB:9F:80' + +config ap + option band '2' + option ssid 'TestSSID.2' + option encryption 'psk2' + option key '5555500000' + +config ap + option band '5' + option ssid 'TestSSID.5' + option encryption 'psk2' + option key '2222200000' + +config al-iface + option enabled '1' + option ifname 'br-lan' + option type 'bridge' + diff --git a/test/files/etc/config/mcast b/test/files/etc/config/mcast new file mode 100644 index 00000000..b97d0068 --- /dev/null +++ b/test/files/etc/config/mcast @@ -0,0 +1,29 @@ + +config igmp 'igmp' + option max_membership '20' + option max_msf '10' + option qrv '2' + option force_version '0' + +config mld 'mld' + option mldv1_unsolicited_report_interval '10' + option mldv2_unsolicited_report_interval '1' + option qrv '2' + option force_version '0' + +config proxy 'igmp_proxy_1' + option enable '1' + option proto 'igmp' + option version '2' + option robustness '2' + option query_interval '125' + option query_response_interval '100' + option last_member_query_interval '10' + option fast_leave '1' + option snooping_mode '2' + list downstream_interface 'br-lan' + list upstream_interface 'atm0.1' + list upstream_interface 'ptm0.1' + list upstream_interface 'eth0.1' + list filter '239.0.0.0/8' + diff --git a/test/files/etc/config/network b/test/files/etc/config/network index 686d1649..b0bbaffc 100644 --- a/test/files/etc/config/network +++ b/test/files/etc/config/network @@ -4,14 +4,88 @@ config interface 'loopback' option ipaddr '127.0.0.1' option netmask '255.0.0.0' +config globals 'globals' + option ula_prefix 'fddb:7949:7caa::/48' + +config device + option name 'br-lan' + option type 'bridge' + list ports 'eth1' + list ports 'eth2' + list ports 'eth3' + list ports 'eth4' + option macaddr '44:D4:37:71:B8:11' + +config interface 'lan' + option device 'br-lan' + option proto 'static' + option ipaddr '192.168.1.1' + option netmask '255.255.255.0' + option ip6assign '60' + option is_lan '1' + option macaddr '44:D4:37:71:B8:11' + config interface 'wan' option proto 'dhcp' - option hostname 'iopsysWrt-00220775DC6C' + option hostname 'iopsysWrt-44D43771B810' option vendorid 'eg400' - option device 'eth0' - option reqopts '43' + option device 'eth0.1' + option reqopts '12 43' + option sendopts '60:iopsystest 61:iopsys' + option macaddr '44:D4:37:71:B8:12' config interface 'wan6' option proto 'dhcpv6' option device '@wan' +config device 'ethwan' + option type 'untagged' + option ifname 'eth0' + option name 'eth0.1' + option macaddr '44:D4:37:71:B8:12' + +config device 'br_test_1' + option name 'br-test' + option type 'bridge' + list ports 'eth1.100' + list ports 'eth2.100' + list ports 'eth3.100' + list ports 'eth4.100' + option macaddr '44:D4:37:71:B8:13' + +config interface 'lan100' + option device 'br-test' + option proto 'static' + option ipaddr '172.32.1.1' + option macaddr '44:D4:37:71:B8:13' + +config device 'eth1_100' + option type 'untagged' + option ifname 'eth1' + option name 'eth1.100' + option vid '100' + +config device 'eth2_100' + option type 'untagged' + option ifname 'eth2' + option name 'eth2.100' + option vid '100' + +config device 'eth3_100' + option type '8021q' + option ifname 'eth3' + option name 'eth3.100' + option vid '100' + +config device 'eth4_100' + option type '8021q' + option ifname 'eth4' + option name 'eth4.100' + option vid '100' + +config interface 'ppp_wan' + option proto 'pppoe' + option username 'iopsys' + option password 'iopsys' + option device 'eth0.1' + option macaddr '44:D4:37:71:B8:14' diff --git a/test/files/etc/config/openvpn b/test/files/etc/config/openvpn new file mode 100644 index 00000000..ea442c76 --- /dev/null +++ b/test/files/etc/config/openvpn @@ -0,0 +1,506 @@ +package openvpn + +################################################# +# Sample to include a custom config file. # +################################################# + +config openvpn custom_config + + # Set to 1 to enable this instance: + option enabled 0 + + # Credentials to login + #option username 'login' + #option password 'password' + + # Password for client certificate + #option cert_password 'cert_password' + + # Include OpenVPN configuration + option config /etc/openvpn/my-vpn.conf + + +################################################# +# Sample OpenVPN 2.0 uci config for # +# multi-client server. # +################################################# + +config openvpn sample_server + + # Set to 1 to enable this instance: + option enabled 0 + + # Which local IP address should OpenVPN + # listen on? (optional) +# option local 0.0.0.0 + + # Which TCP/UDP port should OpenVPN listen on? + # If you want to run multiple OpenVPN instances + # on the same machine, use a different port + # number for each one. You will need to + # open up this port on your firewall. + option port 1194 + + # TCP or UDP server? +# option proto tcp + option proto udp + + # "dev tun" will create a routed IP tunnel, + # "dev tap" will create an ethernet tunnel. + # Use "dev tap0" if you are ethernet bridging + # and have precreated a tap0 virtual interface + # and bridged it with your ethernet interface. + # If you want to control access policies + # over the VPN, you must create firewall + # rules for the the TUN/TAP interface. + # On non-Windows systems, you can give + # an explicit unit number, such as tun0. + # On Windows, use "dev-node" for this. + # On most systems, the VPN will not function + # unless you partially or fully disable + # the firewall for the TUN/TAP interface. +# option dev tap + option dev tun + + # SSL/TLS root certificate (ca), certificate + # (cert), and private key (key). Each client + # and the server must have their own cert and + # key file. The server and all clients will + # use the same ca file. + # + # See the "easy-rsa" directory for a series + # of scripts for generating RSA certificates + # and private keys. Remember to use + # a unique Common Name for the server + # and each of the client certificates. + # + # Any X509 key management system can be used. + # OpenVPN can also use a PKCS #12 formatted key file + # (see "pkcs12" directive in man page). + option ca /etc/openvpn/ca.crt + option cert /etc/openvpn/server.crt + # This file should be kept secret: + option key /etc/openvpn/server.key + + # Diffie hellman parameters. + # Generate your own with: + # openssl dhparam -out dh2048.pem 2048 + # Substitute 2048 for 1024 if you are using + # 1024 bit keys. + option dh /etc/openvpn/dh2048.pem + + # Configure server mode and supply a VPN subnet + # for OpenVPN to draw client addresses from. + # The server will take 10.8.0.1 for itself, + # the rest will be made available to clients. + # Each client will be able to reach the server + # on 10.8.0.1. Comment this line out if you are + # ethernet bridging. See the man page for more info. + option server "10.8.0.0 255.255.255.0" + + # Maintain a record of client <-> virtual IP address + # associations in this file. If OpenVPN goes down or + # is restarted, reconnecting clients can be assigned + # the same virtual IP address from the pool that was + # previously assigned. + option ifconfig_pool_persist /tmp/ipp.txt + + # Configure server mode for ethernet bridging. + # You must first use your OS's bridging capability + # to bridge the TAP interface with the ethernet + # NIC interface. Then you must manually set the + # IP/netmask on the bridge interface, here we + # assume 10.8.0.4/255.255.255.0. Finally we + # must set aside an IP range in this subnet + # (start=10.8.0.50 end=10.8.0.100) to allocate + # to connecting clients. Leave this line commented + # out unless you are ethernet bridging. +# option server_bridge "10.8.0.4 255.255.255.0 10.8.0.50 10.8.0.100" + + # Push routes to the client to allow it + # to reach other private subnets behind + # the server. Remember that these + # private subnets will also need + # to know to route the OpenVPN client + # address pool (10.8.0.0/255.255.255.0) + # back to the OpenVPN server. +# list push "route 192.168.10.0 255.255.255.0" +# list push "route 192.168.20.0 255.255.255.0" + + # To assign specific IP addresses to specific + # clients or if a connecting client has a private + # subnet behind it that should also have VPN access, + # use the subdirectory "ccd" for client-specific + # configuration files (see man page for more info). + + # EXAMPLE: Suppose the client + # having the certificate common name "Thelonious" + # also has a small subnet behind his connecting + # machine, such as 192.168.40.128/255.255.255.248. + # First, uncomment out these lines: +# option client_config_dir /etc/openvpn/ccd +# list route "192.168.40.128 255.255.255.248" + # Then create a file ccd/Thelonious with this line: + # iroute 192.168.40.128 255.255.255.248 + # This will allow Thelonious' private subnet to + # access the VPN. This example will only work + # if you are routing, not bridging, i.e. you are + # using "dev tun" and "server" directives. + + # EXAMPLE: Suppose you want to give + # Thelonious a fixed VPN IP address of 10.9.0.1. + # First uncomment out these lines: +# option client_config_dir /etc/openvpn/ccd +# list route "10.9.0.0 255.255.255.252" +# list route "192.168.100.0 255.255.255.0" + # Then add this line to ccd/Thelonious: + # ifconfig-push "10.9.0.1 10.9.0.2" + + # Suppose that you want to enable different + # firewall access policies for different groups + # of clients. There are two methods: + # (1) Run multiple OpenVPN daemons, one for each + # group, and firewall the TUN/TAP interface + # for each group/daemon appropriately. + # (2) (Advanced) Create a script to dynamically + # modify the firewall in response to access + # from different clients. See man + # page for more info on learn-address script. +# option learn_address /etc/openvpn/script + + # If enabled, this directive will configure + # all clients to redirect their default + # network gateway through the VPN, causing + # all IP traffic such as web browsing and + # and DNS lookups to go through the VPN + # (The OpenVPN server machine may need to NAT + # the TUN/TAP interface to the internet in + # order for this to work properly). + # CAVEAT: May break client's network config if + # client's local DHCP server packets get routed + # through the tunnel. Solution: make sure + # client's local DHCP server is reachable via + # a more specific route than the default route + # of 0.0.0.0/0.0.0.0. +# list push "redirect-gateway" + + # Certain Windows-specific network settings + # can be pushed to clients, such as DNS + # or WINS server addresses. CAVEAT: + # http://openvpn.net/faq.html#dhcpcaveats +# list push "dhcp-option DNS 10.8.0.1" +# list push "dhcp-option WINS 10.8.0.1" + + # Uncomment this directive to allow different + # clients to be able to "see" each other. + # By default, clients will only see the server. + # To force clients to only see the server, you + # will also need to appropriately firewall the + # server's TUN/TAP interface. +# option client_to_client 1 + + # Uncomment this directive if multiple clients + # might connect with the same certificate/key + # files or common names. This is recommended + # only for testing purposes. For production use, + # each client should have its own certificate/key + # pair. + # + # IF YOU HAVE NOT GENERATED INDIVIDUAL + # CERTIFICATE/KEY PAIRS FOR EACH CLIENT, + # EACH HAVING ITS OWN UNIQUE "COMMON NAME", + # UNCOMMENT THIS LINE OUT. +# option duplicate_cn 1 + + # The keepalive directive causes ping-like + # messages to be sent back and forth over + # the link so that each side knows when + # the other side has gone down. + # Ping every 10 seconds, assume that remote + # peer is down if no ping received during + # a 120 second time period. + option keepalive "10 120" + + # For extra security beyond that provided + # by SSL/TLS, create an "HMAC firewall" + # to help block DoS attacks and UDP port flooding. + # + # Generate with: + # openvpn --genkey --secret ta.key + # + # The server and each client must have + # a copy of this key. + # The second parameter should be '0' + # on the server and '1' on the clients. + # This file is secret: +# option tls_auth "/etc/openvpn/ta.key 0" + + # For additional privacy, a shared secret key + # can be used for both authentication (as in tls_auth) + # and encryption of the TLS control channel. + # + # Generate a shared secret with: + # openvpn --genkey --secret ta.key + # + # The server and each client must have + # a copy of this key. + # + # tls_auth and tls_crypt should NOT + # be combined, as tls_crypt implies tls_auth. + # Use EITHER tls_crypt, tls_auth, or neither option. +# option tls_crypt "/etc/openvpn/ta.key" + + # Set the minimum required TLS protocol version + # for all connections. + # + # Require at least TLS 1.1 +# option tls_version_min "1.1" + # Require at least TLS 1.2 +# option tls_version_min "1.2" + # Require TLS 1.2, or the highest version supported + # on the system +# option tls_version_min "1.2 'or-highest'" + + # List the preferred ciphers to use for the data channel. + # Run openvpn --show-ciphers to see all supported ciphers. +# list data_ciphers 'AES-256-GCM' +# list data_ciphers 'AES-128-GCM' +# list data_ciphers 'CHACHA20-POLY1305' + + # Set a fallback cipher in order to be compatible with + # peers that do not support cipher negotiation. + # + # Use AES-256-CBC as fallback +# option data_ciphers_fallback 'AES-128-CBC' + # Use AES-128-CBC as fallback +# option data_ciphers_fallback 'AES-256-CBC' + # Use Triple-DES as fallback +# option data_ciphers_fallback 'DES-EDE3-CBC' + # Use BF-CBC as fallback +# option data_ciphers_fallback 'BF-CBC' + + # OpenVPN versions 2.4 and later will attempt to + # automatically negotiate the most secure cipher + # between the client and server, regardless of a + # configured "option cipher" (see below). + # Automatic negotiation is recommended. + # + # Uncomment this option to disable this behavior, + # and force all OpenVPN peers to use the configured + # cipher option instead (not recommended). +# option ncp_disable + + # Enable compression on the VPN link. + # If you enable it here, you must also + # enable it in the client config file. + # + # Compression is not recommended, as compression and + # encryption in combination can weaken the security + # of the connection. + # + # LZ4 requires OpenVPN 2.4+ client and server +# option compress lz4 + # LZO is available by default only in openvpn-openssl variant + # LZO is compatible with most OpenVPN versions +# option compress lzo + + # Control how OpenVPN handles peers using compression + # + # Do not allow any connections using compression +# option allow_compression 'no' + # Allow incoming compressed packets, but do not send compressed packets to other peers + # This can be useful when migrating old configurations with compression activated +# option allow_compression 'asym' + # Both incoming and outgoing packets may be compressed +# option allow_compression 'yes' + + # The maximum number of concurrently connected + # clients we want to allow. +# option max_clients 100 + + # The persist options will try to avoid + # accessing certain resources on restart + # that may no longer be accessible because + # of the privilege downgrade. + option persist_key 1 + option persist_tun 1 + option user nobody + + # Output a short status file showing + # current connections, truncated + # and rewritten every minute. + option status /tmp/openvpn-status.log + + # By default, log messages will go to the syslog (or + # on Windows, if running as a service, they will go to + # the "\Program Files\OpenVPN\log" directory). + # Use log or log-append to override this default. + # "log" will truncate the log file on OpenVPN startup, + # while "log-append" will append to it. Use one + # or the other (but not both). +# option log /tmp/openvpn.log +# option log_append /tmp/openvpn.log + + # Set the appropriate level of log + # file verbosity. + # + # 0 is silent, except for fatal errors + # 4 is reasonable for general usage + # 5 and 6 can help to debug connection problems + # 9 is extremely verbose + option verb 3 + + # Silence repeating messages. At most 20 + # sequential messages of the same message + # category will be output to the log. +# option mute 20 + + +############################################## +# Sample client-side OpenVPN 2.0 uci config # +# for connecting to multi-client server. # +############################################## + +config openvpn sample_client + + # Set to 1 to enable this instance: + option enabled 0 + + # Specify that we are a client and that we + # will be pulling certain config file directives + # from the server. + option client 1 + + # Use the same setting as you are using on + # the server. + # On most systems, the VPN will not function + # unless you partially or fully disable + # the firewall for the TUN/TAP interface. +# option dev tap + option dev tun + + # Are we connecting to a TCP or + # UDP server? Use the same setting as + # on the server. +# option proto tcp + option proto udp + + # The hostname/IP and port of the server. + # You can have multiple remote entries + # to load balance between the servers. + list remote "my_server_1 1194" +# list remote "my_server_2 1194" + + # Choose a random host from the remote + # list for load_balancing. Otherwise + # try hosts in the order specified. +# option remote_random 1 + + # Keep trying indefinitely to resolve the + # host name of the OpenVPN server. Very useful + # on machines which are not permanently connected + # to the internet such as laptops. + option resolv_retry infinite + + # Most clients don't need to bind to + # a specific local port number. + option nobind 1 + + # Try to preserve some state across restarts. + option persist_key 1 + option persist_tun 1 + option user nobody + + # If you are connecting through an + # HTTP proxy to reach the actual OpenVPN + # server, put the proxy server/IP and + # port number here. See the man page + # if your proxy server requires + # authentication. + # retry on connection failures: +# option http_proxy_retry 1 + # specify http proxy address and port: +# option http_proxy "192.168.1.100 8080" + + # Wireless networks often produce a lot + # of duplicate packets. Set this flag + # to silence duplicate packet warnings. +# option mute_replay_warnings 1 + + # SSL/TLS parms. + # See the server config file for more + # description. It's best to use + # a separate .crt/.key file pair + # for each client. A single ca + # file can be used for all clients. + option ca /etc/openvpn/ca.crt + option cert /etc/openvpn/client.crt + option key /etc/openvpn/client.key + + # Verify server certificate by checking + # that the certicate has the key usage + # field set to "server". This is an + # important precaution to protect against + # a potential attack discussed here: + # http://openvpn.net/howto.html#mitm + # + # To use this feature, you will need to generate + # your server certificates with the nsCertType + # field set to "server". The build_key_server + # script in the easy_rsa folder will do this. +# option remote_cert_tls server + + # If a tls_auth key is used on the server + # then every client must also have the key. +# option tls_auth "/etc/openvpn/ta.key 1" + + # If a tls_crypt key is used on the server + # every client must also have the key. +# option tls_crypt "/etc/openvpn/ta.key" + + # Set the minimum required TLS protocol version + # for all connections. + # + # Require at least TLS 1.1 +# option tls_version_min "1.1" + # Require at least TLS 1.2 +# option tls_version_min "1.2" + # Require TLS 1.2, or the highest version supported + # on the system +# option tls_version_min "1.2 'or-highest'" + + # List the preferred ciphers for the data channel. +# list data_ciphers 'AES-256-GCM' +# list data_ciphers 'AES-128-GCM' +# list data_ciphers 'CHACHA20-POLY1305' + + # Set a fallback cipher if you connect to a peer that does + # not support cipher negotiation. + # Use AES-256-CBC as fallback +# option data_ciphers_fallback 'AES-128-CBC' + # Use AES-128-CBC as fallback +# option data_ciphers_fallback 'AES-256-CBC' + # Use Triple-DES as fallback +# option data_ciphers_fallback 'DES-EDE3-CBC' + # Use BF-CBC as fallback +# option data_ciphers_fallback 'BF-CBC' + + # Enable compression on the VPN link. + # Don't enable this unless it is also + # enabled in the server config file. + # + # Compression is not recommended, as compression and + # encryption in combination can weaken the security + # of the connection. + # + # LZ4 requires OpenVPN 2.4+ on server and client +# option compress lz4 + # LZO is available by default only in openvpn-openssl variant + # LZO is compatible with most OpenVPN versions +# option compress lzo + + # Set log file verbosity. + option verb 3 + + # Silence repeating messages +# option mute 20 diff --git a/test/files/etc/config/owsd b/test/files/etc/config/owsd new file mode 100644 index 00000000..8b4f840a --- /dev/null +++ b/test/files/etc/config/owsd @@ -0,0 +1,29 @@ + +config owsd 'global' + option enable '0' + option www '/www' + +config ubusproxy 'ubusproxy' + option enable '0' + list object 'netmode' + +config owsd-listen 'loopback' + option port '80' + option interface 'loopback' + option ipv6 'on' + option whitelist_interface_as_origin '1' + +config owsd-listen 'lan' + option port '80' + option interface 'lan' + option ipv6 'on' + option ipv6only 'off' + option whitelist_interface_as_origin '1' + option whitelist_dhcp_domains '1' + +config owsd-listen 'wan' + option port '80' + option interface 'wan' + option ipv6 'on' + option whitelist_interface_as_origin '1' + diff --git a/test/files/etc/config/periodicstats b/test/files/etc/config/periodicstats new file mode 100644 index 00000000..9cbd3580 --- /dev/null +++ b/test/files/etc/config/periodicstats @@ -0,0 +1,70 @@ +config globals 'globals' + option enable '1' + option base_interval '5' + +config sampleset 'set_1' + option fetch_samples '0' + option enable '1' + option sample_interval '20' + option report_sample '7' + +config parameter 'param_1_set_1' + option sample_set 'set_1' + option sample_mode '0' + option calculation_mode '0' + option low_threshold '0' + option high_threshold '0' + option enable '1' + option reference 'Device.Ethernet.Link.1.Stats.BytesReceived' + +config parameter 'param_2_set_1' + option sample_set 'set_1' + option sample_mode '0' + option calculation_mode '0' + option low_threshold '0' + option high_threshold '0' + option enable '1' + option reference 'Device.Ethernet.Link.1.Stats.BytesSent' + +config parameter 'param_3_set_1' + option sample_set 'set_1' + option sample_mode '0' + option calculation_mode '0' + option low_threshold '0' + option high_threshold '0' + option enable '1' + option reference 'Device.Ethernet.Link.1.Stats.ErrorsReceived' + +config parameter 'param_4_set_1' + option sample_set 'set_1' + option sample_mode '0' + option calculation_mode '0' + option low_threshold '0' + option high_threshold '0' + option enable '1' + option reference 'Device.Ethernet.Link.1.Stats.ErrorsSent' + +config sampleset 'set_2' + option fetch_samples '0' + option enable '1' + option sample_interval '10' + option report_sample '4' + +config parameter 'param_1_set_2' + option sample_set 'set_2' + option sample_mode '0' + option calculation_mode '0' + option low_threshold '0' + option high_threshold '0' + option enable '1' + option reference 'Device.Ethernet.Link.2.Stats.BytesReceived' + +config parameter 'param_2_set_2' + option sample_set 'set_2' + option sample_mode '0' + option calculation_mode '0' + option low_threshold '0' + option high_threshold '0' + option enable '1' + option reference 'Device.Ethernet.Link.2.Stats.BytesSent' + diff --git a/test/files/etc/config/ports b/test/files/etc/config/ports new file mode 100644 index 00000000..bc52778c --- /dev/null +++ b/test/files/etc/config/ports @@ -0,0 +1,52 @@ + +config ethport 'LAN1' + option enabled '1' + option name 'LAN1' + option ifname 'eth1' + option speed '1000' + option duplex 'full' + option autoneg '1' + option eee '0' + option pause '0' + +config ethport 'LAN2' + option enabled '1' + option name 'LAN2' + option ifname 'eth2' + option speed '1000' + option duplex 'full' + option autoneg '1' + option eee '0' + option pause '0' + +config ethport 'LAN3' + option enabled '1' + option name 'LAN3' + option ifname 'eth3' + option speed '1000' + option duplex 'full' + option autoneg '1' + option eee '0' + option pause '0' + +config ethport 'LAN4' + option enabled '1' + option name 'LAN4' + option ifname 'eth4' + option speed '1000' + option duplex 'full' + option autoneg '1' + option eee '0' + option pause '0' + +config ethport 'WAN' + option enabled '1' + option name 'WAN' + option ifname 'eth0' + option speed '1000' + option duplex 'full' + option autoneg '1' + option eee '0' + option pause '1' + option uplink '1' + diff --git a/test/files/etc/config/qos b/test/files/etc/config/qos new file mode 100644 index 00000000..97688746 --- /dev/null +++ b/test/files/etc/config/qos @@ -0,0 +1,361 @@ + +config queue 'q_0_eth1' + option enable '1' + option ifname 'eth1' + option precedence '8' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_1_eth1' + option enable '1' + option ifname 'eth1' + option precedence '7' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_2_eth1' + option enable '1' + option ifname 'eth1' + option precedence '6' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_3_eth1' + option enable '1' + option ifname 'eth1' + option precedence '5' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_4_eth1' + option enable '1' + option ifname 'eth1' + option precedence '4' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_5_eth1' + option enable '1' + option ifname 'eth1' + option precedence '3' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_6_eth1' + option enable '1' + option ifname 'eth1' + option precedence '2' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_7_eth1' + option enable '1' + option ifname 'eth1' + option precedence '1' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_0_eth2' + option enable '1' + option ifname 'eth2' + option precedence '8' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_1_eth2' + option enable '1' + option ifname 'eth2' + option precedence '7' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_2_eth2' + option enable '1' + option ifname 'eth2' + option precedence '6' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_3_eth2' + option enable '1' + option ifname 'eth2' + option precedence '5' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_4_eth2' + option enable '1' + option ifname 'eth2' + option precedence '4' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_5_eth2' + option enable '1' + option ifname 'eth2' + option precedence '3' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_6_eth2' + option enable '1' + option ifname 'eth2' + option precedence '2' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_7_eth2' + option enable '1' + option ifname 'eth2' + option precedence '1' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_0_eth3' + option enable '1' + option ifname 'eth3' + option precedence '8' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_1_eth3' + option enable '1' + option ifname 'eth3' + option precedence '7' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_2_eth3' + option enable '1' + option ifname 'eth3' + option precedence '6' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_3_eth3' + option enable '1' + option ifname 'eth3' + option precedence '5' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_4_eth3' + option enable '1' + option ifname 'eth3' + option precedence '4' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_5_eth3' + option enable '1' + option ifname 'eth3' + option precedence '3' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_6_eth3' + option enable '1' + option ifname 'eth3' + option precedence '2' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_7_eth3' + option enable '1' + option ifname 'eth3' + option precedence '1' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_0_eth4' + option enable '1' + option ifname 'eth4' + option precedence '8' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_1_eth4' + option enable '1' + option ifname 'eth4' + option precedence '7' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_2_eth4' + option enable '1' + option ifname 'eth4' + option precedence '6' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_3_eth4' + option enable '1' + option ifname 'eth4' + option precedence '5' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_4_eth4' + option enable '1' + option ifname 'eth4' + option precedence '4' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_5_eth4' + option enable '1' + option ifname 'eth4' + option precedence '3' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_6_eth4' + option enable '1' + option ifname 'eth4' + option precedence '2' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_7_eth4' + option enable '1' + option ifname 'eth4' + option precedence '1' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_0_eth0' + option enable '1' + option ifname 'eth0' + option precedence '8' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_1_eth0' + option enable '1' + option ifname 'eth0' + option precedence '7' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_2_eth0' + option enable '1' + option ifname 'eth0' + option precedence '6' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_3_eth0' + option enable '1' + option ifname 'eth0' + option precedence '5' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_4_eth0' + option enable '1' + option ifname 'eth0' + option precedence '4' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_5_eth0' + option enable '1' + option ifname 'eth0' + option precedence '3' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_6_eth0' + option enable '1' + option ifname 'eth0' + option precedence '2' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + +config queue 'q_7_eth0' + option enable '1' + option ifname 'eth0' + option precedence '1' + option scheduling 'SP' + option rate '0' + option burst_size '0' + option weight '1' + diff --git a/test/files/etc/config/system b/test/files/etc/config/system index 4deaa5f1..bafa926e 100644 --- a/test/files/etc/config/system +++ b/test/files/etc/config/system @@ -12,3 +12,4 @@ config timeserver 'ntp' option enable_server '1' list server 'ntp1.sth.netnod.se' list server 'ntp1.gbg.netnod.se' + diff --git a/test/files/etc/config/upnpd b/test/files/etc/config/upnpd new file mode 100644 index 00000000..bd7c3ec4 --- /dev/null +++ b/test/files/etc/config/upnpd @@ -0,0 +1,28 @@ +config upnpd config + option enabled 0 + option enable_natpmp 1 + option enable_upnp 1 + option secure_mode 1 + option log_output 0 + option download 1024 + option upload 512 +#by default, looked up dynamically from ubus +# option external_iface wan + option internal_iface lan + option port 5000 + option upnp_lease_file /var/run/miniupnpd.leases + option igdv1 1 + +config perm_rule + option action allow + option ext_ports 1024-65535 + option int_addr 0.0.0.0/0 # Does not override secure_mode + option int_ports 1024-65535 + option comment "Allow high ports" + +config perm_rule + option action deny + option ext_ports 0-65535 + option int_addr 0.0.0.0/0 + option int_ports 0-65535 + option comment "Default deny" diff --git a/test/files/etc/config/wireless b/test/files/etc/config/wireless index a9cde45e..8d4ee8d3 100644 --- a/test/files/etc/config/wireless +++ b/test/files/etc/config/wireless @@ -8,6 +8,7 @@ config wifi-device 'test1' config wifi-iface 'test1_1' option device 'test1' option ifname 'test1' + option network 'lan' option mode 'ap' option encryption 'psk2' @@ -21,5 +22,6 @@ config wifi-device 'test2' config wifi-iface 'test2_1' option device 'test2' option ifname 'test2' + option network 'lan' option mode 'ap' option encryption 'psk2' diff --git a/test/files/lib/netifd/proto/dhcp.sh b/test/files/lib/netifd/proto/dhcp.sh new file mode 100644 index 00000000..e69de29b diff --git a/test/files/lib/netifd/proto/dhcpv6.sh b/test/files/lib/netifd/proto/dhcpv6.sh new file mode 100644 index 00000000..e69de29b diff --git a/test/files/lib/netifd/proto/gre.sh b/test/files/lib/netifd/proto/gre.sh new file mode 100644 index 00000000..e69de29b diff --git a/test/files/lib/netifd/proto/ppp.sh b/test/files/lib/netifd/proto/ppp.sh new file mode 100644 index 00000000..e69de29b diff --git a/test/files/tmp/fast_stats.data b/test/files/tmp/fast_stats.data new file mode 100644 index 00000000..36bf781b --- /dev/null +++ b/test/files/tmp/fast_stats.data @@ -0,0 +1,91 @@ +{ + "line": [ + { + "id": 1, + "bytes_sent": 0, + "bytes_received": 0, + "packets_sent": 0, + "packets_received": 0, + "errors_sent": 0, + "errors_received": 0, + "discard_packets_sent": 0, + "discard_packets_received": 0, + "total_start": 0, + "showtime_start": 0, + "last_showtime_start": 8438, + "current_day_start": 0, + "quarter_hour_start": 0, + "total": { + "errored_secs": 0, + "severely_errored_secs": 0, + "loss": 0, + "lors": 0, + "uas": 0, + "rtx_uc": 0, + "rtx_tx": 0, + "success_bsw": 0, + "success_sra": 0, + "success_fra": 0, + "success_rpa": 4, + "success_tiga": 0 + }, + "showtime": { + "errored_secs": 0, + "severely_errored_secs": 0, + "loss": 0, + "lors": 0, + "uas": 0, + "rtx_uc": 0, + "rtx_tx": 0, + "success_bsw": 0, + "success_sra": 0, + "success_fra": 0, + "success_rpa": 338, + "success_tiga": 0 + }, + "lastshowtime": { + "errored_secs": 4294967295, + "severely_errored_secs": 4294967295, + "loss": 4294967295, + "lors": 4294967295, + "uas": 4294967295, + "rtx_uc": 4294967295, + "rtx_tx": 4294967295, + "success_bsw": 4294967295, + "success_sra": 4294967295, + "success_fra": 4294967295, + "success_rpa": 4294967295, + "success_tiga": 4294967295 + }, + "currentday": { + "errored_secs": 0, + "severely_errored_secs": 0, + "loss": 0, + "lors": 0, + "uas": 0, + "rtx_uc": 0, + "rtx_tx": 0, + "success_bsw": 0, + "success_sra": 0, + "success_fra": 0, + "success_rpa": 0, + "success_tiga": 0 + }, + "quarterhour": { + "errored_secs": 0, + "severely_errored_secs": 0, + "loss": 0, + "lors": 0, + "uas": 0, + "rtx_uc": 0, + "rtx_tx": 0, + "success_bsw": 0, + "success_sra": 0, + "success_fra": 0, + "success_rpa": 0, + "success_tiga": 0 + } + } + ] +} + diff --git a/test/files/tmp/fast_status.data b/test/files/tmp/fast_status.data new file mode 100644 index 00000000..4820326e --- /dev/null +++ b/test/files/tmp/fast_status.data @@ -0,0 +1,67 @@ +{ + "line": [ + { + "id": 1, + "status": "down", + "upstream": true, + "firmware_version": "A2pvfbH046w.d27l2", + "link_status": "no_signal", + "current_profile": "unknown", + "power_management_state": "l3", + "max_bit_rate": { + "us": 0, + "ds": 0 + }, + "allowed_profiles": [ + + ], + "success_failure_cause": 0, + "upbokler": 0, + "last_transmitted_signal": { + "us": 0, + "ds": 0 + }, + "upbokle": 0, + "line_number": 1, + "noise_margin": { + "us": 0, + "ds": 0 + }, + "attenuation": { + "us": 0, + "ds": 0 + }, + "power": { + "us": -512, + "ds": 0 + }, + "snrm_rmc": { + "us": 0, + "ds": 0 + }, + "bits_rmc_ps_ds": [ + + ], + "bits_rmc_ps_us": [ + + ], + "fext_to_cancel_enable": { + "us": false, + "ds": false + }, + "etr": { + "us": 0, + "ds": 0 + }, + "att_etr": { + "us": 0, + "ds": 0 + }, + "min_eftr": { + "us": 0, + "ds": 0 + } + } + ] +} + diff --git a/test/files/tmp/fwbank.data b/test/files/tmp/fwbank.data new file mode 100644 index 00000000..e35a1aa3 --- /dev/null +++ b/test/files/tmp/fwbank.data @@ -0,0 +1,24 @@ +{ + "bank": [ + { + "name": "A", + "id": 1, + "active": true, + "boot": true, + "upgrade": false, + "fwver": "DG400PRIME-A-IOPSYS-6.3.0BETA1-210908_1319", + "swver": "6.3.0BETA1", + "status": "Active" + }, + { + "name": "B", + "id": 2, + "active": false, + "boot": false, + "upgrade": true, + "fwver": "DG400PRIME-A-IOPSYS-6.2.0RC1-210624_0041", + "swver": "6.2.0RC1", + "status": "Available" + } + ] +} diff --git a/test/files/tmp/processes.data b/test/files/tmp/processes.data new file mode 100644 index 00000000..aed00d67 --- /dev/null +++ b/test/files/tmp/processes.data @@ -0,0 +1,1281 @@ +{ + "processes": [ + { + "pid": 1, + "ppid": 0, + "command": "/sbin/procd", + "vsz": 1480, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 4000, + "state": "Sleeping" + }, + { + "pid": 2, + "ppid": 0, + "command": "[kthreadd]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 3, + "ppid": 2, + "command": "[rcu_gp]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 4, + "ppid": 2, + "command": "[rcu_par_gp]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 6, + "ppid": 2, + "command": "[kworker/0:0H-kb]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 8, + "ppid": 2, + "command": "[mm_percpu_wq]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 9, + "ppid": 2, + "command": "[ksoftirqd/0]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 10, + "ppid": 2, + "command": "[rcu_preempt]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Running" + }, + { + "pid": 11, + "ppid": 2, + "command": "[rcu_sched]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 12, + "ppid": 2, + "command": "[rcu_bh]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 13, + "ppid": 2, + "command": "[migration/0]", + "vsz": 0, + "%vsz": 0, + "priority": -100, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 14, + "ppid": 2, + "command": "[cpuhp/0]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 15, + "ppid": 2, + "command": "[cpuhp/1]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 16, + "ppid": 2, + "command": "[migration/1]", + "vsz": 0, + "%vsz": 0, + "priority": -100, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 17, + "ppid": 2, + "command": "[ksoftirqd/1]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 19, + "ppid": 2, + "command": "[kworker/1:0H-kb]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 20, + "ppid": 2, + "command": "[kdevtmpfs]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 21, + "ppid": 2, + "command": "[netns]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 22, + "ppid": 2, + "command": "[kworker/u4:1-fl]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 24, + "ppid": 2, + "command": "[rcu_tasks_kthre]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 29, + "ppid": 2, + "command": "[kworker/u4:2-ev]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 39, + "ppid": 2, + "command": "[kworker/1:1-eve]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 249, + "ppid": 2, + "command": "[oom_reaper]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 250, + "ppid": 2, + "command": "[writeback]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 252, + "ppid": 2, + "command": "[crypto]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 254, + "ppid": 2, + "command": "[kblockd]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 275, + "ppid": 2, + "command": "[skb_free_task]", + "vsz": 0, + "%vsz": 0, + "priority": -11, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 276, + "ppid": 2, + "command": "[watchdogd]", + "vsz": 0, + "%vsz": 0, + "priority": -100, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 292, + "ppid": 2, + "command": "[mptcp_wq]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 293, + "ppid": 2, + "command": "[rpciod]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 294, + "ppid": 2, + "command": "[kworker/u5:0]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 295, + "ppid": 2, + "command": "[xprtiod]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 311, + "ppid": 2, + "command": "[kswapd0]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 415, + "ppid": 2, + "command": "[nfsiod]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 476, + "ppid": 2, + "command": "[hwrng]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 518, + "ppid": 2, + "command": "[spi1]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 592, + "ppid": 2, + "command": "[ipv6_addrconf]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 665, + "ppid": 2, + "command": "[ubi_bgt0d]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 717, + "ppid": 2, + "command": "[kworker/0:1H-kb]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 718, + "ppid": 2, + "command": "[kworker/1:1H-kb]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 856, + "ppid": 2, + "command": "[ubifs_bgt0_9]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 1125, + "ppid": 1, + "command": "/sbin/ubusd", + "vsz": 1148, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 1579, + "ppid": 2, + "command": "[bpm_monitor]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 1598, + "ppid": 2, + "command": "[fc_evt]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 1599, + "ppid": 2, + "command": "[fc_timer]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 1600, + "ppid": 2, + "command": "[bcmFlwStatsTask]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 1605, + "ppid": 2, + "command": "[bcmxtm_rx]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 1613, + "ppid": 2, + "command": "[sw0HouseKeeping]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 1644, + "ppid": 2, + "command": "[bcmsw_rx]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 1648, + "ppid": 2, + "command": "[enet-kthrd]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 1673, + "ppid": 2, + "command": "[scsi_eh_0]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 1674, + "ppid": 2, + "command": "[scsi_tmf_0]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 1974, + "ppid": 2, + "command": "[uas]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 2055, + "ppid": 2, + "command": "[krfcommd]", + "vsz": 0, + "%vsz": 0, + "priority": 10, + "niceness": -10, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 2272, + "ppid": 2, + "command": "[cifsiod]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 2274, + "ppid": 2, + "command": "[cifsoplockd]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 3843, + "ppid": 1, + "command": "/usr/sbin/uwsgi --ini /etc/uwsgi/emperor.ini", + "vsz": 2328, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 4143, + "ppid": 2, + "command": "[kbdmf_shell]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 4246, + "ppid": 1, + "command": "/sbin/logd -S 200", + "vsz": 1232, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 4296, + "ppid": 1, + "command": "/sbin/peripheral_manager -f", + "vsz": 1216, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 17000, + "state": "Sleeping" + }, + { + "pid": 4363, + "ppid": 1, + "command": "/sbin/rpcd -s /var/run/ubus/ubus.sock -t 30", + "vsz": 5264, + "%vsz": 1, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 4430, + "ppid": 1, + "command": "/usr/bin/inbd", + "vsz": 1424, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 4553, + "ppid": 1, + "command": "/sbin/questd", + "vsz": 1428, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Running" + }, + { + "pid": 4872, + "ppid": 1, + "command": "rulengd -r ruleng", + "vsz": 1388, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 4939, + "ppid": 2, + "command": "[cfg80211]", + "vsz": 0, + "%vsz": 0, + "priority": 0, + "niceness": -20, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 5308, + "ppid": 2, + "command": "[wl0-kthrd]", + "vsz": 0, + "%vsz": 0, + "priority": -6, + "niceness": 0, + "cputime": 4000, + "state": "Sleeping" + }, + { + "pid": 5310, + "ppid": 2, + "command": "[wfd0-thrd]", + "vsz": 0, + "%vsz": 0, + "priority": -6, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 5887, + "ppid": 1, + "command": "/usr/sbin/dropbear -F -P /var/run/dropbear.1.pid -p 22 -K 300 -T 3", + "vsz": 924, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 6376, + "ppid": 1, + "command": "/bin/sh /usr/sbin/mwan3rtmon ipv4", + "vsz": 1408, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 6377, + "ppid": 1, + "command": "/bin/sh /usr/sbin/mwan3rtmon ipv6", + "vsz": 1408, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 6434, + "ppid": 6376, + "command": "ip -4 monitor route", + "vsz": 2108, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 6435, + "ppid": 6376, + "command": "/bin/sh /usr/sbin/mwan3rtmon ipv4", + "vsz": 1420, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 6454, + "ppid": 6377, + "command": "ip -6 monitor route", + "vsz": 2108, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 6455, + "ppid": 6377, + "command": "/bin/sh /usr/sbin/mwan3rtmon ipv6", + "vsz": 1428, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 6536, + "ppid": 2, + "command": "[dsl0]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 6550, + "ppid": 1, + "command": "/sbin/dslmngr", + "vsz": 4644, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 6904, + "ppid": 1, + "command": "/sbin/netifd", + "vsz": 1576, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 7908, + "ppid": 1, + "command": "/usr/sbin/qosmngr", + "vsz": 4428, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 8131, + "ppid": 1, + "command": "/usr/sbin/odhcpd", + "vsz": 1328, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 8234, + "ppid": 1, + "command": "/usr/sbin/atd -f", + "vsz": 840, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 8452, + "ppid": 1, + "command": "xl2tpd -D -l -p /var/run/xl2tpd.pid", + "vsz": 856, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 8732, + "ppid": 1, + "command": "endptmngr", + "vsz": 6928, + "%vsz": 1, + "priority": 8, + "niceness": -12, + "cputime": 6000, + "state": "Sleeping" + }, + { + "pid": 8923, + "ppid": 1, + "command": "mosquitto -c /etc/mosquitto/mosquitto.conf", + "vsz": 4516, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 1000, + "state": "Sleeping" + }, + { + "pid": 9220, + "ppid": 1, + "command": "/bin/sh /sbin/testnet", + "vsz": 1224, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 9816, + "ppid": 1, + "command": "/sbin/ntpd -g -u ntp:ntp -p /var/run/ntpd.pid -n -c /var/etc/ntpd.conf", + "vsz": 3480, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 9817, + "ppid": 1, + "command": "/bin/sh /usr/sbin/ntpd.hotplug-helper", + "vsz": 1164, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 9979, + "ppid": 1, + "command": "/usr/sbin/hostapd.brcm -s -P /var/run/wifi-phy21.pid -B /var/run/hostapd-phy21.conf", + "vsz": 6180, + "%vsz": 1, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 10016, + "ppid": 1, + "command": "/usr/sbin/dnsmasq -C /var/etc/dnsmasq.conf.cfg01411c -k -x /var/run/dnsmasq/dnsmasq.cfg01411c.pid", + "vsz": 1248, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 10020, + "ppid": 10016, + "command": "/usr/sbin/dnsmasq -C /var/etc/dnsmasq.conf.cfg01411c -k -x /var/run/dnsmasq/dnsmasq.cfg01411c.pid", + "vsz": 1244, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 10053, + "ppid": 1, + "command": "nginx: master process /usr/sbin/nginx -c /etc/nginx/uci.conf -g daemon off;", + "vsz": 5332, + "%vsz": 1, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 10113, + "ppid": 10053, + "command": "nginx: worker process", + "vsz": 5452, + "%vsz": 1, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 10120, + "ppid": 1, + "command": "/usr/sbin/crond -f -c /etc/crontabs -l 9", + "vsz": 1168, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 10247, + "ppid": 2, + "command": "[kworker/1:3-mm_]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 10425, + "ppid": 1, + "command": "/usr/sbin/ethmngr", + "vsz": 4460, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 10487, + "ppid": 1, + "command": "/sbin/uledd", + "vsz": 1216, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 2000, + "state": "Sleeping" + }, + { + "pid": 10596, + "ppid": 1, + "command": "/usr/sbin/wifimngr", + "vsz": 4636, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 10692, + "ppid": 1, + "command": "/usr/sbin/ieee1905d", + "vsz": 5012, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 3000, + "state": "Sleeping" + }, + { + "pid": 10847, + "ppid": 1, + "command": "/usr/sbin/topologyd", + "vsz": 5492, + "%vsz": 1, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 11000, + "ppid": 1, + "command": "/usr/sbin/mcpd", + "vsz": 1968, + "%vsz": 0, + "priority": -6, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 11057, + "ppid": 1, + "command": "/usr/sbin/uspd", + "vsz": 10148, + "%vsz": 2, + "priority": 20, + "niceness": 0, + "cputime": 29000, + "state": "Sleeping" + }, + { + "pid": 11093, + "ppid": 1, + "command": "/usr/sbin/wfadatad -d -t 15", + "vsz": 4928, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 11700, + "ppid": 1, + "command": "/usr/sbin/asterisk -C /var/etc/asterisk/asterisk.conf", + "vsz": 31600, + "%vsz": 6, + "priority": 20, + "niceness": 0, + "cputime": 20000, + "state": "Sleeping" + }, + { + "pid": 11701, + "ppid": 11700, + "command": "astcanary /var/run/asterisk/alt.asterisk.canary.tweet.tweet.tweet 11700", + "vsz": 1656, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 11981, + "ppid": 1, + "command": "/usr/sbin/icwmpd -b", + "vsz": 6212, + "%vsz": 1, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 12066, + "ppid": 1, + "command": "/usr/sbin/obuspa -v 1 -r /tmp/obuspa_param_reset.txt", + "vsz": 7380, + "%vsz": 1, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 12214, + "ppid": 1, + "command": "/sbin/askfirst /usr/libexec/login.sh", + "vsz": 756, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 13220, + "ppid": 2, + "command": "[kworker/0:1-eve]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 1000, + "state": "Idle" + }, + { + "pid": 14274, + "ppid": 2, + "command": "[kworker/0:2-eve]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 14712, + "ppid": 2, + "command": "[kworker/0:0-eve]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 14975, + "ppid": 5887, + "command": "/usr/sbin/dropbear -F -P /var/run/dropbear.1.pid -p 22 -K 300 -T 3", + "vsz": 948, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 14980, + "ppid": 14975, + "command": "-ash", + "vsz": 1172, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 15029, + "ppid": 9220, + "command": "sleep 30", + "vsz": 1164, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 15038, + "ppid": 2, + "command": "[kworker/u4:0-ev]", + "vsz": 0, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Idle" + }, + { + "pid": 15042, + "ppid": 9817, + "command": "sleep 10", + "vsz": 1164, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 15045, + "ppid": 1, + "command": "timeout 5 hostapd_cli -i wl0 list_sta", + "vsz": 1164, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + }, + { + "pid": 15050, + "ppid": 14980, + "command": "ubus call router.system processes", + "vsz": 1216, + "%vsz": 0, + "priority": 20, + "niceness": 0, + "cputime": 0, + "state": "Sleeping" + } + ] +} + diff --git a/test/files/tmp/rmonstats_eth0.data b/test/files/tmp/rmonstats_eth0.data new file mode 100644 index 00000000..e0222fe9 --- /dev/null +++ b/test/files/tmp/rmonstats_eth0.data @@ -0,0 +1,31 @@ +{ + "ifname": "eth0", + "tx_priority_q": -1, + "tx_bytes": 0, + "tx_packets": 0, + "tx_broadcast_packets": 0, + "tx_multicast_packets": 0, + "tx_crc_error_packets": 0, + "tx_undersize_packets": 0, + "tx_oversize_packets": 0, + "tx_packets_64bytes": 0, + "tx_packets_65to127bytes": 0, + "tx_packets_128to255bytes": 0, + "tx_packets_256to511bytes": 0, + "tx_packets_512to1023bytes": 0, + "tx_packets_1024to1518bytes": 0, + "rx_bytes": 0, + "rx_packets": 0, + "rx_broadcast_packets": 0, + "rx_multicast_packets": 0, + "rx_crc_error_packets": 0, + "rx_undersize_packets": 0, + "rx_oversize_packets": 0, + "rx_packets_64bytes": 0, + "rx_packets_65to127bytes": 0, + "rx_packets_128to255bytes": 0, + "rx_packets_256to511bytes": 0, + "rx_packets_512to1023bytes": 0, + "rx_packets_1024to1518bytes": 0 +} + diff --git a/test/files/tmp/rmonstats_eth1.data b/test/files/tmp/rmonstats_eth1.data new file mode 100644 index 00000000..7f62405a --- /dev/null +++ b/test/files/tmp/rmonstats_eth1.data @@ -0,0 +1,31 @@ +{ + "ifname": "eth1", + "tx_priority_q": -1, + "tx_bytes": 0, + "tx_packets": 0, + "tx_broadcast_packets": 0, + "tx_multicast_packets": 0, + "tx_crc_error_packets": 0, + "tx_undersize_packets": 0, + "tx_oversize_packets": 0, + "tx_packets_64bytes": 0, + "tx_packets_65to127bytes": 0, + "tx_packets_128to255bytes": 0, + "tx_packets_256to511bytes": 0, + "tx_packets_512to1023bytes": 0, + "tx_packets_1024to1518bytes": 0, + "rx_bytes": 0, + "rx_packets": 0, + "rx_broadcast_packets": 0, + "rx_multicast_packets": 0, + "rx_crc_error_packets": 0, + "rx_undersize_packets": 0, + "rx_oversize_packets": 0, + "rx_packets_64bytes": 0, + "rx_packets_65to127bytes": 0, + "rx_packets_128to255bytes": 0, + "rx_packets_256to511bytes": 0, + "rx_packets_512to1023bytes": 0, + "rx_packets_1024to1518bytes": 0 +} + diff --git a/test/files/tmp/rmonstats_eth2.data b/test/files/tmp/rmonstats_eth2.data new file mode 100644 index 00000000..d69be128 --- /dev/null +++ b/test/files/tmp/rmonstats_eth2.data @@ -0,0 +1,31 @@ +{ + "ifname": "eth2", + "tx_priority_q": -1, + "tx_bytes": 338808, + "tx_packets": 2268, + "tx_broadcast_packets": 377, + "tx_multicast_packets": 1104, + "tx_crc_error_packets": 0, + "tx_undersize_packets": 0, + "tx_oversize_packets": 0, + "tx_packets_64bytes": 666, + "tx_packets_65to127bytes": 1291, + "tx_packets_128to255bytes": 196, + "tx_packets_256to511bytes": 16, + "tx_packets_512to1023bytes": 16, + "tx_packets_1024to1518bytes": 83, + "rx_bytes": 245770, + "rx_packets": 2410, + "rx_broadcast_packets": 0, + "rx_multicast_packets": 797, + "rx_crc_error_packets": 0, + "rx_undersize_packets": 0, + "rx_oversize_packets": 0, + "rx_packets_64bytes": 392, + "rx_packets_65to127bytes": 1724, + "rx_packets_128to255bytes": 289, + "rx_packets_256to511bytes": 1, + "rx_packets_512to1023bytes": 1, + "rx_packets_1024to1518bytes": 3 +} + diff --git a/test/files/tmp/rmonstats_eth3.data b/test/files/tmp/rmonstats_eth3.data new file mode 100644 index 00000000..d60d0cb1 --- /dev/null +++ b/test/files/tmp/rmonstats_eth3.data @@ -0,0 +1,31 @@ +{ + "ifname": "eth3", + "tx_priority_q": -1, + "tx_bytes": 0, + "tx_packets": 0, + "tx_broadcast_packets": 0, + "tx_multicast_packets": 0, + "tx_crc_error_packets": 0, + "tx_undersize_packets": 0, + "tx_oversize_packets": 0, + "tx_packets_64bytes": 0, + "tx_packets_65to127bytes": 0, + "tx_packets_128to255bytes": 0, + "tx_packets_256to511bytes": 0, + "tx_packets_512to1023bytes": 0, + "tx_packets_1024to1518bytes": 0, + "rx_bytes": 0, + "rx_packets": 0, + "rx_broadcast_packets": 0, + "rx_multicast_packets": 0, + "rx_crc_error_packets": 0, + "rx_undersize_packets": 0, + "rx_oversize_packets": 0, + "rx_packets_64bytes": 0, + "rx_packets_65to127bytes": 0, + "rx_packets_128to255bytes": 0, + "rx_packets_256to511bytes": 0, + "rx_packets_512to1023bytes": 0, + "rx_packets_1024to1518bytes": 0 +} + diff --git a/test/files/tmp/rmonstats_eth4.data b/test/files/tmp/rmonstats_eth4.data new file mode 100644 index 00000000..90b97b64 --- /dev/null +++ b/test/files/tmp/rmonstats_eth4.data @@ -0,0 +1,31 @@ +{ + "ifname": "eth4", + "tx_priority_q": -1, + "tx_bytes": 0, + "tx_packets": 0, + "tx_broadcast_packets": 0, + "tx_multicast_packets": 0, + "tx_crc_error_packets": 0, + "tx_undersize_packets": 0, + "tx_oversize_packets": 0, + "tx_packets_64bytes": 0, + "tx_packets_65to127bytes": 0, + "tx_packets_128to255bytes": 0, + "tx_packets_256to511bytes": 0, + "tx_packets_512to1023bytes": 0, + "tx_packets_1024to1518bytes": 0, + "rx_bytes": 0, + "rx_packets": 0, + "rx_broadcast_packets": 0, + "rx_multicast_packets": 0, + "rx_crc_error_packets": 0, + "rx_undersize_packets": 0, + "rx_oversize_packets": 0, + "rx_packets_64bytes": 0, + "rx_packets_65to127bytes": 0, + "rx_packets_128to255bytes": 0, + "rx_packets_256to511bytes": 0, + "rx_packets_512to1023bytes": 0, + "rx_packets_1024to1518bytes": 0 +} + diff --git a/test/files/tmp/topology_hosts.data b/test/files/tmp/topology_hosts.data new file mode 100644 index 00000000..a6bcc6bf --- /dev/null +++ b/test/files/tmp/topology_hosts.data @@ -0,0 +1,56 @@ +{ + "hosts": [ + { + "macaddr": "00:90:9e:9f:f6:d5", + "ipaddr": "192.168.1.40", + "address_source": "Static", + "lease_time_remaining": 0, + "device": "eth1", + "network": "lan", + "interface_type": "Ethernet", + "hostname": "", + "active": true, + "active_last_change": "2021-09-22T23:07:10Z", + "active_connections": 1, + "ipv4addr": [ + "192.168.1.40" + ], + "ipv6addr": [ + "fe80::290:9eff:fe9f:f6d5", + "2001:db8:100:15a::1" + ], + "stats": { + "tx_packets": 659, + "tx_bytes": 74322, + "rx_packets": 524, + "rx_bytes": 60000 + } + }, + { + "macaddr": "24:18:1d:e2:f7:dd", + "ipaddr": "192.168.1.187", + "address_source": "DHCP", + "lease_time_remaining": 3599, + "device": "wl0", + "network": "lan", + "interface_type": "Wi-Fi", + "hostname": "Galaxy-S8", + "active": true, + "active_last_change": "2021-09-22T23:27:09Z", + "active_connections": 2, + "ipv4addr": [ + "192.168.1.187" + ], + "ipv6addr": [ + "fe80::655b:b9e9:4eae:148" + ], + "stats": { + "tx_packets": 432, + "tx_bytes": 51391, + "rx_packets": 41, + "rx_bytes": 5694 + } + } + ] +} + diff --git a/test/files/usr/libexec/rpcd/ethernet b/test/files/usr/libexec/rpcd/ethernet new file mode 100755 index 00000000..7707201a --- /dev/null +++ b/test/files/usr/libexec/rpcd/ethernet @@ -0,0 +1,30 @@ +#!/bin/sh + +. /usr/share/libubox/jshn.sh + +case "$1" in + list) + echo '{ "rmonstats" : {"ifname":"String"} }' + ;; + call) + case "$2" in + rmonstats) + read input; + json_load "$input" + json_get_var ifname ifname + if [ "$ifname" == "eth1" ]; then + cat /tmp/rmonstats_eth1.data 2>/dev/null + elif [ "$ifname" == "eth2" ]; then + cat /tmp/rmonstats_eth2.data 2>/dev/null + elif [ "$ifname" == "eth3" ]; then + cat /tmp/rmonstats_eth3.data 2>/dev/null + elif [ "$ifname" == "eth4" ]; then + cat /tmp/rmonstats_eth4.data 2>/dev/null + else + cat /tmp/rmonstats_eth0.data 2>/dev/null + fi + ;; + esac + ;; +esac + diff --git a/test/files/usr/libexec/rpcd/fast b/test/files/usr/libexec/rpcd/fast new file mode 100755 index 00000000..79d81ba8 --- /dev/null +++ b/test/files/usr/libexec/rpcd/fast @@ -0,0 +1,20 @@ +#!/bin/sh + +. /usr/share/libubox/jshn.sh + +case "$1" in + list) + echo '{ "status" : {}, "stats" : {} }' + ;; + call) + case "$2" in + status) + cat /tmp/fast_status.data 2>/dev/null + ;; + stats) + cat /tmp/fast_stats.data 2>/dev/null + ;; + esac + ;; +esac + diff --git a/test/files/usr/libexec/rpcd/fwbank b/test/files/usr/libexec/rpcd/fwbank new file mode 100755 index 00000000..599776f8 --- /dev/null +++ b/test/files/usr/libexec/rpcd/fwbank @@ -0,0 +1,17 @@ +#!/bin/sh + +. /usr/share/libubox/jshn.sh + +case "$1" in + list) + echo '{ "dump" : {} }' + ;; + call) + case "$2" in + dump) + cat /tmp/fwbank.data 2>/dev/null + ;; + esac + ;; +esac + diff --git a/test/files/usr/libexec/rpcd/router.system b/test/files/usr/libexec/rpcd/router.system new file mode 100755 index 00000000..6ce96b66 --- /dev/null +++ b/test/files/usr/libexec/rpcd/router.system @@ -0,0 +1,17 @@ +#!/bin/sh + +. /usr/share/libubox/jshn.sh + +case "$1" in + list) + echo '{ "processes" : {} }' + ;; + call) + case "$2" in + processes) + cat /tmp/processes.data 2>/dev/null + ;; + esac + ;; +esac + diff --git a/test/files/usr/libexec/rpcd/topology b/test/files/usr/libexec/rpcd/topology new file mode 100755 index 00000000..8a244d98 --- /dev/null +++ b/test/files/usr/libexec/rpcd/topology @@ -0,0 +1,17 @@ +#!/bin/sh + +. /usr/share/libubox/jshn.sh + +case "$1" in + list) + echo '{ "hosts" : {} }' + ;; + call) + case "$2" in + hosts) + cat /tmp/topology_hosts.data 2>/dev/null + ;; + esac + ;; +esac +