From 333c4b4fd7994661c79be51bfe97d666a25fb4eb Mon Sep 17 00:00:00 2001 From: Vivek Kumar Dutta Date: Wed, 22 Sep 2021 10:26:49 +0000 Subject: [PATCH] Test to check memory leak in datamodel --- .gitignore | 3 +- .gitlab-ci.yml | 19 +++ gitlab-ci/memory-test.sh | 46 ++++++ test/bbf_test/.gitignore | 3 + test/bbf_test/Makefile | 14 +- test/bbf_test/bbf_dm.c | 98 +++++++++++++ test/cmocka/.gitignore | 3 + test/files/etc/config/asterisk | 146 +++++++++++++++++++ test/files/etc/config/cwmp | 4 +- test/files/etc/config/dsl | 45 ++++++ test/files/etc/config/firewall | 164 ++++++++++++++++++++++ test/files/tmp/dect.data | 44 ++++++ test/files/tmp/dsl.channel.data | 32 +++++ test/files/tmp/dsl.data | 151 ++++++++++++++++++++ test/files/tmp/dsl.line.data | 111 +++++++++++++++ test/files/usr/libexec/rpcd/dect | 17 +++ test/files/usr/libexec/rpcd/dsl | 17 +++ test/files/usr/libexec/rpcd/dsl.channel.1 | 17 +++ test/files/usr/libexec/rpcd/dsl.line.1 | 17 +++ 19 files changed, 943 insertions(+), 8 deletions(-) create mode 100755 gitlab-ci/memory-test.sh create mode 100644 test/bbf_test/.gitignore create mode 100644 test/bbf_test/bbf_dm.c create mode 100644 test/cmocka/.gitignore create mode 100644 test/files/etc/config/asterisk create mode 100644 test/files/etc/config/dsl create mode 100644 test/files/etc/config/firewall create mode 100644 test/files/tmp/dect.data create mode 100644 test/files/tmp/dsl.channel.data create mode 100644 test/files/tmp/dsl.data create mode 100644 test/files/tmp/dsl.line.data create mode 100755 test/files/usr/libexec/rpcd/dect create mode 100755 test/files/usr/libexec/rpcd/dsl create mode 100755 test/files/usr/libexec/rpcd/dsl.channel.1 create mode 100755 test/files/usr/libexec/rpcd/dsl.line.1 diff --git a/.gitignore b/.gitignore index a24c70dd..cc79c769 100644 --- a/.gitignore +++ b/.gitignore @@ -38,4 +38,5 @@ tools/*.pyc tools/__pycache__ *.gcov *.gcno -*.log +*\.log +.libs diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 43615429..a31658f4 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -8,6 +8,7 @@ stages: - functional_test - functional_api_test - tools_test + - memory_test - uspd variables: @@ -70,6 +71,24 @@ run_tools_test: - tools/out/datamodel_hdm.xml - tools/out/datamodel.xls +run_memory_test: + stage: memory_test + image: iopsys/code-analysis:latest + allow_failure: false + script: + - "./gitlab-ci/setup.sh" + - "./gitlab-ci/memory-test.sh" + + artifacts: + when: always + paths: + - timestamp.log + - memory-report-get.xml + - memory-report-operate.xml + - memory-report-schema.xml + - memory-report-instances.xml + - memory-test-coverage.xml + run_uspd: stage: uspd variables: diff --git a/gitlab-ci/memory-test.sh b/gitlab-ci/memory-test.sh new file mode 100755 index 00000000..4013690c --- /dev/null +++ b/gitlab-ci/memory-test.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +echo "Functional API Tests" +pwd +source ./gitlab-ci/shared.sh + +date +%s > timestamp.log +# compile and install libbbf +install_libbbf + +install_libbbf_test + +supervisorctl status all +supervisorctl update +sleep 5 +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. +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 +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 +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. +ret=$(( ret + $? )) + +if [ "$ret" -ne 0 ]; then + echo "Memory check failed" + return $ret +fi + +supervisorctl stop all +supervisorctl status + +#report part +#GitLab-CI output +gcovr -r . 2> /dev/null #throw away stderr +# Artefact +gcovr -r . 2> /dev/null --xml -o ./memory-test-coverage.xml + +echo "Memory Test :: PASS" diff --git a/test/bbf_test/.gitignore b/test/bbf_test/.gitignore new file mode 100644 index 00000000..f53c1f80 --- /dev/null +++ b/test/bbf_test/.gitignore @@ -0,0 +1,3 @@ +bbf_dm +*.so +*.o diff --git a/test/bbf_test/Makefile b/test/bbf_test/Makefile index 092dbd4c..c657bffd 100644 --- a/test/bbf_test/Makefile +++ b/test/bbf_test/Makefile @@ -1,16 +1,22 @@ LIB = libbbf_test.so +BIN = bbf_dm +BIN_OBJ = bbf_dm.o LIB_OBJS = libbbf_test.o -LIB_CFLAGS = $(CFLAGS) -Wall -Werror -fPIC +LIB_CFLAGS = $(CFLAGS) -fPIC -I /usr/local/include/ LIB_LDFLAGS = $(LDFLAGS) -lbbf_api +BIN_LDFLAGS = $(LDFLAGS) -lbbfdm %.o: %.c - $(CC) $(PROG_CFLAGS) $(FPIC) -c -o $@ $< + $(CC) $(LIB_CFLAGS) $(FPIC) -c -o $@ $< -all: $(LIB) +all: $(LIB) $(BIN) $(LIB): $(LIB_OBJS) $(CC) $(LIB_CFLAGS) $(LIB_LDFLAGS) -shared -o $@ $^ +$(BIN): $(BIN_OBJ) + $(CC) -o $@ $^ $(BIN_LDFLAGS) + clean: - rm -fv *.o $(LIB) + rm -fv *.o $(LIB) $(BIN) diff --git a/test/bbf_test/bbf_dm.c b/test/bbf_test/bbf_dm.c new file mode 100644 index 00000000..eec020e5 --- /dev/null +++ b/test/bbf_test/bbf_dm.c @@ -0,0 +1,98 @@ +#include + +#include +#include + +static int g_proto = BBFDM_USP; + +typedef struct { + int id; + char *str; +} cmd_t; + + +cmd_t CMD[] = { + { CMD_GET_VALUE, "get"}, + { CMD_GET_NAME, "get_name"}, + //{ CMD_SET_VALUE, "set"}, + //{ CMD_ADD_OBJECT, "add"}, + //{ CMD_DEL_OBJECT, "del"}, + //{ CMD_USP_OPERATE, "operate"}, + { CMD_USP_LIST_OPERATE, "list_operate"}, + //{ CMD_USP_LIST_EVENT, "list_event"}, + { CMD_GET_SCHEMA, "get_schema"}, + { CMD_GET_INSTANCES, "instances"} +}; + +int get_cmd_from_str(char *str) +{ + int i, cmd = CMD_GET_VALUE; + + for (i = 0; i < ARRAY_SIZE(CMD); i++) { + if (strcmp(CMD[i].str, str) == 0) { + cmd = CMD[i].id; + break; + } + } + + return cmd; +} + +void print_help(char *prog) +{ + printf("Valid commands:\n"); + printf("%s -c => Run with cwmp proto\n", prog); + printf("%s -u => Run with usp proto\n", prog); + exit(0); +} + +int usp_dm_exec(int cmd, char *path, char *arg1, char *arg2) +{ + int fault = 0; + struct dmctx bbf_ctx; + struct dm_parameter *n; + + memset(&bbf_ctx, 0, sizeof(struct dmctx)); + + printf("cmd[%d], path[%s]", cmd, path); + set_bbfdatamodel_type(g_proto); + + dm_ctx_init(&bbf_ctx, 0); + fault = dm_entry_param_method(&bbf_ctx, cmd, path, arg1, arg2); + + if (!fault) { + list_for_each_entry(n, &bbf_ctx.list_parameter, list) { + printf(" %s::%s::%s\n", n->name, n->data, n->type); + } + } else { + printf("Fault %d", fault); + } + + dm_ctx_clean(&bbf_ctx); + return fault; +} + +int main(int argc, char *argv[]) +{ + char *param = NULL, *value = NULL; + int cmd; + + if (argc < 3) { + print_help(argv[0]); + } + + if (strcmp(argv[1], "-c") == 0) + g_proto = BBFDM_CWMP; + + cmd = get_cmd_from_str(argv[2]); + + if (argc > 3 && strlen(argv[3])) + param = argv[3]; + + if (argc > 4 && strlen(argv[4])) + value = argv[3]; + + usp_dm_exec(cmd, param, NULL, NULL); + + free_dynamic_arrays(); +} diff --git a/test/cmocka/.gitignore b/test/cmocka/.gitignore new file mode 100644 index 00000000..b6dc4956 --- /dev/null +++ b/test/cmocka/.gitignore @@ -0,0 +1,3 @@ +functional_test_bbfd +functional_api_test_bbfd +unit_test_bbfd diff --git a/test/files/etc/config/asterisk b/test/files/etc/config/asterisk new file mode 100644 index 00000000..3eaf44b5 --- /dev/null +++ b/test/files/etc/config/asterisk @@ -0,0 +1,146 @@ +config asterisk 'general' + option enabled '1' + option log_stderr '1' + option log_stdout '1' + +config tel_line 'telline0' + option enabled '1' + option extension '0000' + option noise '0' + option vad '0' + option txgain '4' + option rxgain '4' + option echo_cancel '1' + option clir '0' + option sip_account 'sip0' + option callwaiting_enabled '0' + option do_not_disturb '0' + option name 'DECT 1' + +config tel_line 'telline1' + option enabled '1' + option extension '1111' + option noise '0' + option vad '0' + option txgain '4' + option rxgain '4' + option echo_cancel '1' + option clir '0' + option sip_account 'sip0' + option callwaiting_enabled '0' + option do_not_disturb '0' + option name 'DECT 2' + +config tel_line 'telline2' + option enabled '1' + option extension '2222' + 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 'DECT 3' + +config tel_line 'telline3' + option enabled '1' + option extension '3333' + 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' + option custom_outgoing_enabled '0' + option custom_incoming_enabled '0' + option custom_hangup_enabled '0' + option all_ports_extension '#123456' + option test_audio_extension '#123457' + option test_echo_extension '#123458' + option record_message_extension '#999999' + +config sip_advanced 'sip_options' + option rtpstart '10000' + option rtpend '20000' + option dtmfmode 'rfc4733' + option remotehold 'yes' + option tls_version 'sslv23' + option dnsmgr 'no' + option dnsmgr_refresh_interval '300' + option srvlookup 'yes' + +config tel_advanced 'tel_options' + option country 'se' + option jbenable 'yes' + option jbforce 'no' + option jbmaxsize '500' + option jbimpl 'adaptive' + option dialoutmsec '4000' + option echo_cancel '1' + +config advanced_features 'call_features' + option cbbs_type 'internal' + option callforward_enabled '1' + option redial_enabled '1' + option callreturn_enabled '1' + option moh_passthrough '1' + option mwi_enabled '0' + option internal_service '0' + +config log 'log_options' + option console 'notice,warning,error' + option messages 'error' + option syslog_facility 'local0' + +config cdr 'cdr_options' + option csv_max_row '100' + +config call_filter 'call_filter0' + option block_outgoing '0' + option block_incoming '0' + +config codec_profile 'alaw' + option name 'G.711ALaw' + option ptime '20' + +config codec_profile 'ulaw' + option name 'G.711MuLaw' + option ptime '20' + +config sip_service_provider 'sip0' + option name 'account 1' + option enabled '0' + list codecs 'alaw' + list codecs 'ulaw' + option cbbs_key '5' + option cbbs_maxretry '5' + option cbbs_retrytime '300' + option cbbs_waittime '30' + option cfim_on '*21*' + option cfim_off '#21#' + option cfbs_on '*61*' + option cfbs_off '#61#' + option cfb_on '*67*' + option cfb_off '#67#' + option cw_on '*43#' + option cw_off '#43#' + option cw_status '*#43#' + option dnd_on '*261#' + option dnd_off '#261#' + option dnd_status '*#261#' + option call_return '*69' + option redial '*66' + option is_fax '0' + option transport 'udp' + option encryption 'no' + option mediasec '0' + option dtmf_mode 'rfc4733' diff --git a/test/files/etc/config/cwmp b/test/files/etc/config/cwmp index 684e6a7f..5c1a74b1 100644 --- a/test/files/etc/config/cwmp +++ b/test/files/etc/config/cwmp @@ -1,5 +1,5 @@ config acs 'acs' - option enabled '0' + option enable '0' option url '' option userid '' #$OUI-$SER option passwd 'iopsys' @@ -30,7 +30,6 @@ config cpe 'cpe' option userid '' #$OUI-$SER option passwd 'iopsys' option port '7547' - option ubus_socket '/var/run/ubus.sock' option provisioning_code '' option amd_version '5' # compression possible configs: InstanceNumber, InstanceAlias @@ -56,4 +55,3 @@ config inform_extra option enabled '0' option parameter 'Device.DeviceInfo.SerialNumber' option events '0 BOOTSTRAP' - diff --git a/test/files/etc/config/dsl b/test/files/etc/config/dsl new file mode 100644 index 00000000..f9c67332 --- /dev/null +++ b/test/files/etc/config/dsl @@ -0,0 +1,45 @@ +config dsl-line 'line' + list mode 'gdmt' + list mode 'glite' + list mode 't1413' + list mode 'adsl2' + list mode 'adsl2p' + list mode 'annexl' + list mode 'annexm' + list mode 'vdsl2' + list profile '8a' + list profile '8b' + list profile '8c' + list profile '8d' + list profile '12a' + list profile '12b' + list profile '17a' + list profile '30a' + list profile '35b' + list profile '35b' + list profile '35b' + list profile '35b' + list profile '35b' + list profile '35b' + option bitswap '1' + option sra '1' + option us0 '1' + option sesdrop '0' + option sos '0' + option phyReXmtUs '0' + option phyReXmtDs '1' + +config atm-device 'atm0' + option name 'ATM' + option vpi '8' + option vci '35' + option device 'atm0' + option link_type 'eoa' + option encapsulation 'llc' + option qos_class 'ubr' + +config ptm-device 'ptm0' + option name 'PTM' + option device 'ptm0' + option priority '1' + option portid '1' diff --git a/test/files/etc/config/firewall b/test/files/etc/config/firewall new file mode 100644 index 00000000..fe44ace6 --- /dev/null +++ b/test/files/etc/config/firewall @@ -0,0 +1,164 @@ +config globals 'globals' + option enabled '1' + +config defaults + 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' + +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' + +config forwarding + 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' + +config rule + 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' + +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' + +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' + +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' + +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' + +config rule + 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' + +config dmz 'dmz' + option enabled '0' + option exclude_ports '5060 7547' + +config include + option path '/etc/firewall.user' + option reload '1' + +config include 'ddos' + option path '/etc/firewall.ddos' + option reload '1' + +config include 'parental' + option path '/etc/firewall.parental' + option reload '1' + +config include 'qos' + option path '/etc/firewall.qos' + option reload '1' + +config include 'cwmp' + 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' + +config include 'sip' + option path '/etc/firewall.sip' + option reload '1' + +config include 'dmzhost' + option path '/etc/firewall.dmz' + option reload '1' + diff --git a/test/files/tmp/dect.data b/test/files/tmp/dect.data new file mode 100644 index 00000000..24040e7a --- /dev/null +++ b/test/files/tmp/dect.data @@ -0,0 +1,44 @@ +{ + "base": [ + { + "id": 1, + "status": "up", + "standard": "CAT-iq 3.0", + "rfpi": "036CD3AAC8", + "subscription_enabled": true, + "firmware_version": "410", + "eeprom_version": "6DEE", + "hardware_version": "DCX81 Version C" + } + ], + "handsets": [ + { + "id": 1, + "status": "up", + "registration_status": "In reach", + "ipui": "02FED686D3", + "ipui_length": 40, + "base_id": 1, + "portable_type": "CAT-iq 2", + "subscription_time": "2021-09-02T08:57:57Z", + "hardware_version": "X65_BT_HW0.3", + "software_version": "X65_BT_H31029", + "software_upgrade": "true", + "last_update_datetime": "0001-01-01T00:00:00Z" + }, + { + "id": 2, + "status": "up", + "registration_status": "in reach", + "ipui": "02FED6860E", + "ipui_length": 40, + "base_id": 1, + "portable_type": "CAT-iq 2", + "subscription_time": "2021-09-02T09:50:11Z", + "hardware_version": "X65_BT_HW0.3", + "software_version": "X65_BT_H31029", + "software_upgrade": "true", + "last_update_datetime": "0001-01-01T00:00:00Z" + } + ] +} diff --git a/test/files/tmp/dsl.channel.data b/test/files/tmp/dsl.channel.data new file mode 100644 index 00000000..6a48119e --- /dev/null +++ b/test/files/tmp/dsl.channel.data @@ -0,0 +1,32 @@ +{ + "status": "lower_layer_down", + "link_encapsulation_used": "auto", + "curr_rate": { + "us": 4294967295, + "ds": 4294967295 + }, + "actndr": { + "us": 0, + "ds": 0 + }, + "link_encapsulation_supported": [ + "adsl2_atm", + "adsl2_ptm", + "vdsl2_atm", + "vdsl2_ptm", + "auto" + ], + "lpath": 0, + "intlvdepth": 0, + "intlvblock": 0, + "actual_interleaving_delay": 0, + "actinp": 0, + "inpreport": false, + "nfec": 0, + "rfec": -1, + "lsymb": 0, + "actinprein": { + "us": 0, + "ds": 0 + } +} diff --git a/test/files/tmp/dsl.data b/test/files/tmp/dsl.data new file mode 100644 index 00000000..14cb5339 --- /dev/null +++ b/test/files/tmp/dsl.data @@ -0,0 +1,151 @@ +{ + "line": [ + { + "id": 1, + "status": "down", + "upstream": true, + "firmware_version": "A2pvfbH045q.d27l_rc4", + "link_status": "no_signal", + "xtse_used": [ + "00", + "00", + "00", + "00", + "00", + "00", + "00", + "00" + ], + "current_profile": "unknown", + "power_management_state": "l3", + "max_bit_rate": { + "us": 0, + "ds": 0 + }, + "line_encoding": "dmt", + "xtse": [ + "0d", + "03", + "0c", + "00", + "c0", + "03", + "0c", + "01" + ], + "standards_supported": [ + "t1413", + "gdmt_annexa", + "glite", + "adsl2_annexa", + "adsl2_annexm", + "adsl2p_annexa", + "adsl2p_annexm", + "vdsl2_annexa" + ], + "allowed_profiles": [ + "8a", + "8b", + "8c", + "8d", + "12a", + "12b", + "17a", + "30a" + ], + "success_failure_cause": 0, + "upbokler_pb": [ + + ], + "rxthrsh_ds": [ + 0 + ], + "act_ra_mode": { + "us": 1, + "ds": 1 + }, + "snr_mroc_us": 0, + "last_state_transmitted": { + "us": 0, + "ds": 0 + }, + "us0_mask": 8323072, + "trellis": { + "us": 0, + "ds": 0 + }, + "act_snr_mode": { + "us": 0, + "ds": 0 + }, + "line_number": 1, + "noise_margin": { + "us": 0, + "ds": 0 + }, + "snr_mpb_us": [ + 0, + 0, + 0, + 0 + ], + "snr_mpb_ds": [ + 0, + 0, + 0, + 0 + ], + "attenuation": { + "us": 0, + "ds": 0 + }, + "power": { + "us": -512, + "ds": 0 + }, + "xtur_vendor": "00000000", + "xtur_country": "0000", + "xtur_ansi_std": 0, + "xtur_ansi_rev": 0, + "xtuc_vendor": "00000000", + "xtuc_country": "0000", + "xtuc_ansi_std": 0, + "xtuc_ansi_rev": 0, + "channel": [ + { + "id": 1, + "status": "lower_layer_down", + "link_encapsulation_used": "auto", + "curr_rate": { + "us": 4294967295, + "ds": 4294967295 + }, + "actndr": { + "us": 0, + "ds": 0 + }, + "link_encapsulation_supported": [ + "adsl2_atm", + "adsl2_ptm", + "vdsl2_atm", + "vdsl2_ptm", + "auto" + ], + "lpath": 0, + "intlvdepth": 0, + "intlvblock": 0, + "actual_interleaving_delay": 0, + "actinp": 0, + "inpreport": false, + "nfec": 0, + "rfec": -1, + "lsymb": 0, + "actinprein": { + "us": 0, + "ds": 0 + } + } + ] + } + ] +} diff --git a/test/files/tmp/dsl.line.data b/test/files/tmp/dsl.line.data new file mode 100644 index 00000000..a7b72917 --- /dev/null +++ b/test/files/tmp/dsl.line.data @@ -0,0 +1,111 @@ +{ + "status": "down", + "upstream": true, + "firmware_version": "A2pvfbH045q.d27l_rc4", + "link_status": "no_signal", + "xtse_used": [ + "00", + "00", + "00", + "00", + "00", + "00", + "00", + "00" + ], + "current_profile": "unknown", + "power_management_state": "l3", + "max_bit_rate": { + "us": 0, + "ds": 0 + }, + "line_encoding": "dmt", + "xtse": [ + "0d", + "03", + "0c", + "00", + "c0", + "03", + "0c", + "01" + ], + "standards_supported": [ + "t1413", + "gdmt_annexa", + "glite", + "adsl2_annexa", + "adsl2_annexm", + "adsl2p_annexa", + "adsl2p_annexm", + "vdsl2_annexa" + ], + "allowed_profiles": [ + "8a", + "8b", + "8c", + "8d", + "12a", + "12b", + "17a", + "30a" + ], + "success_failure_cause": 0, + "upbokler_pb": [ + + ], + "rxthrsh_ds": [ + 0 + ], + "act_ra_mode": { + "us": 1, + "ds": 1 + }, + "snr_mroc_us": 0, + "last_state_transmitted": { + "us": 0, + "ds": 0 + }, + "us0_mask": 8323072, + "trellis": { + "us": 0, + "ds": 0 + }, + "act_snr_mode": { + "us": 0, + "ds": 0 + }, + "line_number": 1, + "noise_margin": { + "us": 0, + "ds": 0 + }, + "snr_mpb_us": [ + 0, + 0, + 0, + 0 + ], + "snr_mpb_ds": [ + 0, + 0, + 0, + 0 + ], + "attenuation": { + "us": 0, + "ds": 0 + }, + "power": { + "us": -512, + "ds": 0 + }, + "xtur_vendor": "00000000", + "xtur_country": "0000", + "xtur_ansi_std": 0, + "xtur_ansi_rev": 0, + "xtuc_vendor": "00000000", + "xtuc_country": "0000", + "xtuc_ansi_std": 0, + "xtuc_ansi_rev": 0 +} diff --git a/test/files/usr/libexec/rpcd/dect b/test/files/usr/libexec/rpcd/dect new file mode 100755 index 00000000..8bb5069d --- /dev/null +++ b/test/files/usr/libexec/rpcd/dect @@ -0,0 +1,17 @@ +#!/bin/sh + +. /usr/share/libubox/jshn.sh + +case "$1" in + list) + echo '{ "status" : {} }' + ;; + call) + case "$2" in + status) + cat /tmp/dect.data + ;; + esac + ;; +esac + diff --git a/test/files/usr/libexec/rpcd/dsl b/test/files/usr/libexec/rpcd/dsl new file mode 100755 index 00000000..bdc7c415 --- /dev/null +++ b/test/files/usr/libexec/rpcd/dsl @@ -0,0 +1,17 @@ +#!/bin/sh + +. /usr/share/libubox/jshn.sh + +case "$1" in + list) + echo '{ "status" : {} }' + ;; + call) + case "$2" in + status) + cat /tmp/dsl.data 2>/dev/null + ;; + esac + ;; +esac + diff --git a/test/files/usr/libexec/rpcd/dsl.channel.1 b/test/files/usr/libexec/rpcd/dsl.channel.1 new file mode 100755 index 00000000..04d190df --- /dev/null +++ b/test/files/usr/libexec/rpcd/dsl.channel.1 @@ -0,0 +1,17 @@ +#!/bin/sh + +. /usr/share/libubox/jshn.sh + +case "$1" in + list) + echo '{ "status" : {} }' + ;; + call) + case "$2" in + status) + cat /tmp/dsl.channel.data 2>/dev/null + ;; + esac + ;; +esac + diff --git a/test/files/usr/libexec/rpcd/dsl.line.1 b/test/files/usr/libexec/rpcd/dsl.line.1 new file mode 100755 index 00000000..c592834e --- /dev/null +++ b/test/files/usr/libexec/rpcd/dsl.line.1 @@ -0,0 +1,17 @@ +#!/bin/sh + +. /usr/share/libubox/jshn.sh + +case "$1" in + list) + echo '{ "status" : {} }' + ;; + call) + case "$2" in + status) + cat /tmp/dsl.line.data 2>/dev/null + ;; + esac + ;; +esac +