diff --git a/docs/api/atm.link.md b/docs/api/atm.link.md index 1266d323ba7892ebadc6a3f935e80c05c5bbc28c..84a49f6b84be3506df58733e879d18a1b36b55f1 100644 --- a/docs/api/atm.link.md +++ b/docs/api/atm.link.md @@ -15,7 +15,7 @@ Type: `Method` ### Ubus CLI Example ```bash -ubus call atm.link.0 status +ubus call atm.link.1 status ``` ### JSONRPC Example @@ -25,7 +25,7 @@ ubus call atm.link.0 status "jsonrpc": "2.0", "id": 0, "method": "call", - "params": ["<SID>", "atm.link.0", "status"] + "params": ["<SID>", "atm.link.1", "status"] } ``` @@ -77,7 +77,7 @@ Type: `Method` ### Ubus CLI Example ```bash -ubus call atm.link.0 stats +ubus call atm.link.1 stats ``` ### JSONRPC Example @@ -87,7 +87,7 @@ ubus call atm.link.0 stats "jsonrpc": "2.0", "id": 0, "method": "call", - "params": ["<SID>", "atm.link.0", "stats"] + "params": ["<SID>", "atm.link.1", "stats"] } ``` @@ -116,7 +116,7 @@ Type: `Method` ### Ubus CLI Example ```bash -ubus call atm.link.0 configure "{'link_type':'eoa','vpi':8,'vci':35,'encapsulation':'llc',\ +ubus call atm.link.1 configure "{'link_type':'eoa','vpi':8,'vci':35,'encapsulation':'llc',\ 'qos_class':'ubr','peak_cell_rate':10240,'max_burst_size':8124,'sustainable_cell_rate':9600}" ``` @@ -127,7 +127,7 @@ ubus call atm.link.0 configure "{'link_type':'eoa','vpi':8,'vci':35,'encapsulati "jsonrpc": "2.0", "id": 0, "method": "call", - "params": ["<SID>", "atm.link.0", "configure", "{'link_type':'eoa','vpi':8,'vci':35,'encapsulation':'llc'}"] + "params": ["<SID>", "atm.link.1", "configure", "{'link_type':'eoa','vpi':8,'vci':35,'encapsulation':'llc'}"] } ``` diff --git a/docs/api/dsl.channel.md b/docs/api/dsl.channel.md index 699620d4b80240d812f8b5d002b413dabc8b1e81..a439077ec103bae5e999e4cebd5b6d86a3633e5d 100644 --- a/docs/api/dsl.channel.md +++ b/docs/api/dsl.channel.md @@ -15,7 +15,7 @@ Type: `Method` ### Ubus CLI Example ```bash -ubus call dsl.channel.0 status +ubus call dsl.channel.1 status ``` ### JSONRPC Example @@ -25,7 +25,7 @@ ubus call dsl.channel.0 status "jsonrpc": "2.0", "id": 0, "method": "call", - "params": ["<SID>", "dsl.channel.0", "status"] + "params": ["<SID>", "dsl.channel.1", "status"] } ``` @@ -39,37 +39,36 @@ None - Example as below ```json { - "status": "up", - "link_encapsulation_used": "vdsl2_ptm", - "curr_rate": { - "us": 60085, - "ds": 100120 - }, - "actndr": { - "us": 59999, - "ds": 99976 - }, - "link_encapsulation_supported": [ - "adsl2_atm", - "adsl2_ptm", - "vdsl2_atm", - "vdsl2_ptm", - "auto" - ], - "lpath": 0, - "intlvdepth": 1, - "intlvblock": 120, - "actual_interleaving_delay": 0, - "actinp": 0, - "inpreport": false, - "nfec": 240, - "rfec": -1, - "lsymb": 15080, - "actinprein": { - "us": 0, - "ds": 0 - } - } + "status": "up", + "link_encapsulation_used": "vdsl2_ptm", + "curr_rate": { + "us": 60085, + "ds": 100120 + }, + "actndr": { + "us": 59999, + "ds": 99976 + }, + "link_encapsulation_supported": [ + "adsl2_atm", + "adsl2_ptm", + "vdsl2_atm", + "vdsl2_ptm", + "auto" + ], + "lpath": 0, + "intlvdepth": 1, + "intlvblock": 120, + "actual_interleaving_delay": 0, + "actinp": 0, + "inpreport": false, + "nfec": 240, + "rfec": -1, + "lsymb": 15080, + "actinprein": { + "us": 0, + "ds": 0 + } } ``` @@ -82,7 +81,7 @@ Type: `Method` ### Ubus CLI Example ```bash -ubus call dsl.channel.0 stats +ubus call dsl.channel.1 stats ``` ### JSONRPC Example @@ -92,7 +91,7 @@ ubus call dsl.channel.0 stats "jsonrpc": "2.0", "id": 0, "method": "call", - "params": ["<SID>", "dsl.channel.0", "stats"] + "params": ["<SID>", "dsl.channel.1", "stats"] } ``` @@ -106,51 +105,59 @@ None - Example as below ```json { - "total_start": 0, - "showtime_start": 0, - "last_showtime_start": 0, - "current_day_start": 420, - "quarter_hour_start": 420, - "total": { - "xtur_fec_errors": 0, - "xtuc_fec_errors": 0, - "xtur_hec_errors": 4294967295, - "xtuc_hec_errors": 4294967295, - "xtur_crc_errors": 0, - "xtuc_crc_errors": 0 - }, - "showtime": { - "xtur_fec_errors": 0, - "xtuc_fec_errors": 0, - "xtur_hec_errors": 0, - "xtuc_hec_errors": 0, - "xtur_crc_errors": 0, - "xtuc_crc_errors": 0 - }, - "lastshowtime": { - "xtur_fec_errors": 4294967295, - "xtuc_fec_errors": 4294967295, - "xtur_hec_errors": 4294967295, - "xtuc_hec_errors": 4294967295, - "xtur_crc_errors": 4294967295, - "xtuc_crc_errors": 4294967295 - }, - "currentday": { - "xtur_fec_errors": 0, - "xtuc_fec_errors": 0, - "xtur_hec_errors": 4294967295, - "xtuc_hec_errors": 4294967295, - "xtur_crc_errors": 0, - "xtuc_crc_errors": 0 - }, - "quarterhour": { - "xtur_fec_errors": 0, - "xtuc_fec_errors": 0, - "xtur_hec_errors": 4294967295, - "xtuc_hec_errors": 4294967295, - "xtur_crc_errors": 0, - "xtuc_crc_errors": 0 - } + "bytes_sent": 373384, + "bytes_received": 285514, + "packets_sent": 5443, + "packets_received": 4499, + "errors_sent": 0, + "errors_received": 0, + "discard_packets_sent": 0, + "discard_packets_received": 0, + "total_start": 0, + "showtime_start": 0, + "last_showtime_start": 0, + "current_day_start": 206, + "quarter_hour_start": 206, + "total": { + "xtur_fec_errors": 0, + "xtuc_fec_errors": 0, + "xtur_hec_errors": 4294967295, + "xtuc_hec_errors": 4294967295, + "xtur_crc_errors": 215, + "xtuc_crc_errors": 83 + }, + "showtime": { + "xtur_fec_errors": 0, + "xtuc_fec_errors": 0, + "xtur_hec_errors": 0, + "xtuc_hec_errors": 0, + "xtur_crc_errors": 6, + "xtuc_crc_errors": 1 + }, + "lastshowtime": { + "xtur_fec_errors": 4294967295, + "xtuc_fec_errors": 4294967295, + "xtur_hec_errors": 4294967295, + "xtuc_hec_errors": 4294967295, + "xtur_crc_errors": 4294967295, + "xtuc_crc_errors": 4294967295 + }, + "currentday": { + "xtur_fec_errors": 0, + "xtuc_fec_errors": 0, + "xtur_hec_errors": 4294967295, + "xtuc_hec_errors": 4294967295, + "xtur_crc_errors": 0, + "xtuc_crc_errors": 0 + }, + "quarterhour": { + "xtur_fec_errors": 0, + "xtuc_fec_errors": 0, + "xtur_hec_errors": 4294967295, + "xtuc_hec_errors": 4294967295, + "xtur_crc_errors": 0, + "xtuc_crc_errors": 0 + } } ``` @@ -163,7 +170,7 @@ Type: `Method` ### Ubus CLI Example ```bash -ubus call dsl.channel.0 stats "{ 'interval': 'total'}" +ubus call dsl.channel.1 stats "{ 'interval': 'total'}" ``` ### JSONRPC Example @@ -173,7 +180,7 @@ ubus call dsl.channel.0 stats "{ 'interval': 'total'}" "jsonrpc": "2.0", "id": 0, "method": "call", - "params": ["<SID>", "dsl.channel.0", "stats", "{ 'interval': 'total'}"] + "params": ["<SID>", "dsl.channel.1", "stats", "{ 'interval': 'total'}"] } ``` @@ -189,11 +196,11 @@ ubus call dsl.channel.0 stats "{ 'interval': 'total'}" - Example as below ```json { - "xtur_fec_errors": 0, - "xtuc_fec_errors": 0, - "xtur_hec_errors": 4294967295, - "xtuc_hec_errors": 4294967295, - "xtur_crc_errors": 0, - "xtuc_crc_errors": 0 + "xtur_fec_errors": 0, + "xtuc_fec_errors": 0, + "xtur_hec_errors": 4294967295, + "xtuc_hec_errors": 4294967295, + "xtur_crc_errors": 215, + "xtuc_crc_errors": 83 } ``` diff --git a/docs/api/dsl.line.md b/docs/api/dsl.line.md index 8620141a3eb5d20e9bafe79881645efe49a927cd..c37c4861b0c0ef3fa275988c115c9579639fa7f7 100644 --- a/docs/api/dsl.line.md +++ b/docs/api/dsl.line.md @@ -16,7 +16,7 @@ Type: `Method` ### Ubus CLI Example ```bash -ubus call dsl.line.0 status +ubus call dsl.line.1 status ``` ### JSONRPC Example @@ -26,7 +26,7 @@ ubus call dsl.line.0 status "jsonrpc": "2.0", "id": 0, "method": "call", - "params": ["<SID>", "dsl.line.0", "status"] + "params": ["<SID>", "dsl.line.1", "status"] } ``` @@ -40,111 +40,118 @@ None - Example as below ```json { - "status": "up", - "upstream": true, - "firmware_version": "A2pvfbH045k.d27f", - "link_status": "up", - "standard_used": "vdsl2_annexa", - "current_profile": "17a", - "power_management_state": "l0", - "max_bit_rate": { - "us": 65322, - "ds": 148448 - }, - "line_encoding": "dmt", - "standards_supported": [ - "gdmt_annexa", - "gdmt_annexb", - "gdmt_annexc", - "t1413", - "t1413_i2", - "glite", - "adsl2_annexa", - "adsl2_annexb", - "adsl2_annexc", - "adsl2_annexi", - "adsl2_annexj", - "adsl2_annexl", - "adsl2_annexm", - "adsl2p_annexa", - "adsl2p_annexb", - "adsl2p_annexc", - "adsl2p_annexi", - "adsl2p_annexj", - "adsl2p_annexm", - "vdsl2_annexa", - "vdsl2_annexb", - "vdsl2_annexc" - ], - "allowed_profiles": [ - "8a", - "8b", - "8c", - "8b", - "12a", - "12b", - "17a", - "30a", - "35b" - ], - "success_failure_cause": 0, - "upbokler_pb": [ - 180 - ], - "rxthrsh_ds": [ - 0 - ], - "act_ra_mode": { - "us": 0, - "ds": 0 - }, - "snr_mroc_us": 0, - "last_state_transmitted": { - "us": 0, - "ds": 0 - }, - "us0_mask": 8323072, - "trellis": { - "us": 1, - "ds": 1 - }, - "act_snr_mode": { - "us": 1, - "ds": 1 - }, - "line_number": 0, - "noise_margin": { - "us": 145, - "ds": 177 - }, - "snr_mpb_us": [ - 130, - 183, - 131, - 0 - ], - "snr_mpb_ds": [ - 176, - 177, - 177, - 0 - ], - "attenuation": { - "us": 0, - "ds": 48 - }, - "power": { - "us": 123, - "ds": 106 - }, - "xtur_vendor": "B5004244434D0000", - "xtur_country": "0000", - "xtur_ansi_std": 0, - "xtur_ansi_rev": 0, - "xtuc_vendor": "B5004244434DA491", - "xtuc_country": "0000", - "xtuc_ansi_std": 0, - "xtuc_ansi_rev": 42129, + "status": "up", + "upstream": true, + "firmware_version": "A2pvfbK047c1.d27l2", + "link_status": "up", + "xtse_used": [ + "00", + "00", + "00", + "00", + "00", + "00", + "00", + "01" + ], + "standard_used": "vdsl2_annexa", + "current_profile": "17a", + "power_management_state": "l0", + "max_bit_rate": { + "us": 65421, + "ds": 151416 + }, + "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": [ + 162, + 207, + 224 + ], + "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": 1, + "ds": 1 + }, + "act_snr_mode": { + "us": 1, + "ds": 1 + }, + "line_number": 1, + "noise_margin": { + "us": 147, + "ds": 175 + }, + "snr_mpb_us": [ + 137, + 175, + 136, + 0 + ], + "snr_mpb_ds": [ + 174, + 173, + 176, + 0 + ], + "attenuation": { + "us": 0, + "ds": 51 + }, + "power": { + "us": 121, + "ds": 86 + }, + "xtur_vendor": "4244434D", + "xtur_country": "0000", + "xtur_ansi_std": 0, + "xtur_ansi_rev": 0, + "xtuc_vendor": "4244434D", + "xtuc_country": "0000", + "xtuc_ansi_std": 0, + "xtuc_ansi_rev": 42129 } ``` @@ -157,7 +164,7 @@ Type: `Method` ### Ubus CLI Example ```bash -ubus call dsl.line.0 stats +ubus call dsl.line.1 stats ``` ### JSONRPC Example @@ -167,7 +174,7 @@ ubus call dsl.line.0 stats "jsonrpc": "2.0", "id": 0, "method": "call", - "params": ["<SID>", "dsl.line.0", "stats"] + "params": ["<SID>", "dsl.line.1", "stats"] } ``` @@ -181,31 +188,39 @@ None - Example as below ```json { - "total_start": 420, - "showtime_start": 371, - "last_showtime_start": 371, - "current_day_start": 420, - "quarter_hour_start": 420, - "total": { - "errored_secs": 0, - "severely_errored_secs": 0 - }, - "showtime": { - "errored_secs": 0, - "severely_errored_secs": 0 - }, - "lastshowtime": { - "errored_secs": 4294967295, - "severely_errored_secs": 4294967295 - }, - "currentday": { - "errored_secs": 0, - "severely_errored_secs": 0 - }, - "quarterhour": { - "errored_secs": 0, - "severely_errored_secs": 0 - } + "bytes_sent": 360788, + "bytes_received": 276184, + "packets_sent": 5259, + "packets_received": 4350, + "errors_sent": 0, + "errors_received": 0, + "discard_packets_sent": 0, + "discard_packets_received": 0, + "total_start": 1382424, + "showtime_start": 5247, + "last_showtime_start": 159416, + "current_day_start": 24, + "quarter_hour_start": 24, + "total": { + "errored_secs": 69, + "severely_errored_secs": 0 + }, + "showtime": { + "errored_secs": 1, + "severely_errored_secs": 0 + }, + "lastshowtime": { + "errored_secs": 4294967295, + "severely_errored_secs": 4294967295 + }, + "currentday": { + "errored_secs": 0, + "severely_errored_secs": 0 + }, + "quarterhour": { + "errored_secs": 0, + "severely_errored_secs": 0 + } } ``` @@ -218,7 +233,7 @@ Type: `Method` ### Ubus CLI Example ```bash -ubus call dsl.line.0 stats "{ 'interval': 'total'}" +ubus call dsl.line.1 stats "{ 'interval': 'total'}" ``` ### JSONRPC Example @@ -228,7 +243,7 @@ ubus call dsl.line.0 stats "{ 'interval': 'total'}" "jsonrpc": "2.0", "id": 0, "method": "call", - "params": ["<SID>", "dsl.line.0", "stats", "{ 'interval': 'total'}"] + "params": ["<SID>", "dsl.line.1", "stats", "{ 'interval': 'total'}"] } ``` @@ -244,8 +259,8 @@ ubus call dsl.line.0 stats "{ 'interval': 'total'}" - Example as below ```json { - "errored_secs": 0, - "severely_errored_secs": 0 + "errored_secs": 69, + "severely_errored_secs": 0 } ``` @@ -258,7 +273,7 @@ Type: `Method` ### Ubus CLI Example ```bash -ubus call dsl.line.0 configure "{'xtse':'01,02,ab,cd,41,52,f8,6e',\ +ubus call dsl.line.1 configure "{'xtse':'01,02,ab,cd,41,52,f8,6e',\ 'vdsl2_profiles':'8a,8b,8c,8d,17a,30a,35b',\ 'fast_profiles':'106a,212a','data_gathering':true,'limit_mask':255,'us0_mask':511}" ``` @@ -270,7 +285,7 @@ ubus call dsl.line.0 configure "{'xtse':'01,02,ab,cd,41,52,f8,6e',\ "jsonrpc": "2.0", "id": 0, "method": "call", - "params": ["<SID>", "dsl.line.0", "configure", "{'xtse':'01,02,ab,cd,41,52,f8,6e','vdsl2_profiles':'8a,8b,8c,8d,17a,30a,35b'}"] + "params": ["<SID>", "dsl.line.1", "configure", "{'xtse':'01,02,ab,cd,41,52,f8,6e','vdsl2_profiles':'8a,8b,8c,8d,17a,30a,35b'}"] } ``` diff --git a/docs/api/dsl.md b/docs/api/dsl.md index 8f6b0c5bd901d60b0439ee080ededaa90e2f1108..8aab5b2533568638464fd87959f4671bafd2979a 100644 --- a/docs/api/dsl.md +++ b/docs/api/dsl.md @@ -40,147 +40,154 @@ None { "line": [ { - "id": 0, - "status": "up", - "upstream": true, - "firmware_version": "A2pvfbH045k.d27f", - "link_status": "up", - "standard_used": "vdsl2_annexa", - "current_profile": "17a", - "power_management_state": "l0", - "max_bit_rate": { - "us": 65322, - "ds": 148448 - }, - "line_encoding": "dmt", - "standards_supported": [ - "gdmt_annexa", - "gdmt_annexb", - "gdmt_annexc", - "t1413", - "t1413_i2", - "glite", - "adsl2_annexa", - "adsl2_annexb", - "adsl2_annexc", - "adsl2_annexi", - "adsl2_annexj", - "adsl2_annexl", - "adsl2_annexm", - "adsl2p_annexa", - "adsl2p_annexb", - "adsl2p_annexc", - "adsl2p_annexi", - "adsl2p_annexj", - "adsl2p_annexm", - "vdsl2_annexa", - "vdsl2_annexb", - "vdsl2_annexc" - ], - "allowed_profiles": [ - "8a", - "8b", - "8c", - "8b", - "12a", - "12b", - "17a", - "30a", - "35b" - ], - "success_failure_cause": 0, - "upbokler_pb": [ - 180 - ], - "rxthrsh_ds": [ - 0 - ], - "act_ra_mode": { - "us": 0, - "ds": 0 - }, - "snr_mroc_us": 0, - "last_state_transmitted": { - "us": 0, - "ds": 0 - }, - "us0_mask": 8323072, - "trellis": { - "us": 1, - "ds": 1 - }, - "act_snr_mode": { - "us": 1, - "ds": 1 - }, - "line_number": 0, - "noise_margin": { - "us": 145, - "ds": 177 - }, - "snr_mpb_us": [ - 130, - 183, - 131, - 0 - ], - "snr_mpb_ds": [ - 176, - 177, - 177, - 0 - ], - "attenuation": { - "us": 0, - "ds": 48 - }, - "power": { - "us": 123, - "ds": 106 - }, - "xtur_vendor": "B5004244434D0000", - "xtur_country": "0000", - "xtur_ansi_std": 0, - "xtur_ansi_rev": 0, - "xtuc_vendor": "B5004244434DA491", - "xtuc_country": "0000", - "xtuc_ansi_std": 0, - "xtuc_ansi_rev": 42129, - "channel": [ - { - "id": 0, - "status": "up", - "link_encapsulation_used": "vdsl2_ptm", - "curr_rate": { - "us": 60085, - "ds": 100120 - }, - "actndr": { - "us": 59999, - "ds": 99976 - }, - "link_encapsulation_supported": [ - "adsl2_atm", - "adsl2_ptm", - "vdsl2_atm", - "vdsl2_ptm", - "auto" - ], - "lpath": 0, - "intlvdepth": 1, - "intlvblock": 120, - "actual_interleaving_delay": 0, - "actinp": 0, - "inpreport": false, - "nfec": 240, - "rfec": -1, - "lsymb": 15080, - "actinprein": { - "us": 0, - "ds": 0 - } - } - ] + "id": 1, + "status": "up", + "upstream": true, + "firmware_version": "A2pvfbK047c1.d27l2", + "link_status": "up", + "xtse_used": [ + "00", + "00", + "00", + "00", + "00", + "00", + "00", + "01" + ], + "standard_used": "vdsl2_annexa", + "current_profile": "17a", + "power_management_state": "l0", + "max_bit_rate": { + "us": 65421, + "ds": 151436 + }, + "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": [ + 162, + 207, + 224 + ], + "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": 1, + "ds": 1 + }, + "act_snr_mode": { + "us": 1, + "ds": 1 + }, + "line_number": 1, + "noise_margin": { + "us": 147, + "ds": 175 + }, + "snr_mpb_us": [ + 141, + 175, + 136, + 0 + ], + "snr_mpb_ds": [ + 174, + 173, + 176, + 0 + ], + "attenuation": { + "us": 0, + "ds": 51 + }, + "power": { + "us": 121, + "ds": 86 + }, + "xtur_vendor": "4244434D", + "xtur_country": "0000", + "xtur_ansi_std": 0, + "xtur_ansi_rev": 0, + "xtuc_vendor": "4244434D", + "xtuc_country": "0000", + "xtuc_ansi_std": 0, + "xtuc_ansi_rev": 42129, + "channel": [ + { + "id": 1, + "status": "up", + "link_encapsulation_used": "vdsl2_ptm", + "curr_rate": { + "us": 60085, + "ds": 100120 + }, + "actndr": { + "us": 59999, + "ds": 99976 + }, + "link_encapsulation_supported": [ + "adsl2_atm", + "adsl2_ptm", + "vdsl2_atm", + "vdsl2_ptm", + "auto" + ], + "lpath": 0, + "intlvdepth": 1, + "intlvblock": 120, + "actual_interleaving_delay": 0, + "actinp": 0, + "inpreport": false, + "nfec": 240, + "rfec": -1, + "lsymb": 15080, + "actinprein": { + "us": 0, + "ds": 0 + } + } + ] } ] } @@ -221,82 +228,98 @@ None { "line": [ { - "id": 0, - "total_start": 420, - "showtime_start": 371, - "last_showtime_start": 371, - "current_day_start": 420, - "quarter_hour_start": 420, - "total": { - "errored_secs": 0, - "severely_errored_secs": 0 - }, - "showtime": { - "errored_secs": 0, - "severely_errored_secs": 0 - }, - "lastshowtime": { - "errored_secs": 4294967295, - "severely_errored_secs": 4294967295 - }, - "currentday": { - "errored_secs": 0, - "severely_errored_secs": 0 - }, - "quarterhour": { - "errored_secs": 0, - "severely_errored_secs": 0 - }, - "channel": [ - { - "id": 0, - "total_start": 0, - "showtime_start": 0, - "last_showtime_start": 0, - "current_day_start": 420, - "quarter_hour_start": 420, - "total": { - "xtur_fec_errors": 0, - "xtuc_fec_errors": 0, - "xtur_hec_errors": 4294967295, - "xtuc_hec_errors": 4294967295, - "xtur_crc_errors": 0, - "xtuc_crc_errors": 0 - }, - "showtime": { - "xtur_fec_errors": 0, - "xtuc_fec_errors": 0, - "xtur_hec_errors": 0, - "xtuc_hec_errors": 0, - "xtur_crc_errors": 0, - "xtuc_crc_errors": 0 - }, - "lastshowtime": { - "xtur_fec_errors": 4294967295, - "xtuc_fec_errors": 4294967295, - "xtur_hec_errors": 4294967295, - "xtuc_hec_errors": 4294967295, - "xtur_crc_errors": 4294967295, - "xtuc_crc_errors": 4294967295 - }, - "currentday": { - "xtur_fec_errors": 0, - "xtuc_fec_errors": 0, - "xtur_hec_errors": 4294967295, - "xtuc_hec_errors": 4294967295, - "xtur_crc_errors": 0, - "xtuc_crc_errors": 0 - }, - "quarterhour": { - "xtur_fec_errors": 0, - "xtuc_fec_errors": 0, - "xtur_hec_errors": 4294967295, - "xtuc_hec_errors": 4294967295, - "xtur_crc_errors": 0, - "xtuc_crc_errors": 0 - } - } - ] + "id": 1, + "bytes_sent": 319970, + "bytes_received": 244818, + "packets_sent": 4661, + "packets_received": 3854, + "errors_sent": 0, + "errors_received": 0, + "discard_packets_sent": 0, + "discard_packets_received": 0, + "total_start": 1381821, + "showtime_start": 4643, + "last_showtime_start": 158812, + "current_day_start": 85821, + "quarter_hour_start": 321, + "total": { + "errored_secs": 69, + "severely_errored_secs": 0 + }, + "showtime": { + "errored_secs": 1, + "severely_errored_secs": 0 + }, + "lastshowtime": { + "errored_secs": 4294967295, + "severely_errored_secs": 4294967295 + }, + "currentday": { + "errored_secs": 6, + "severely_errored_secs": 0 + }, + "quarterhour": { + "errored_secs": 0, + "severely_errored_secs": 0 + }, + "channel": [ + { + "id": 1, + "bytes_sent": 319970, + "bytes_received": 244818, + "packets_sent": 4661, + "packets_received": 3854, + "errors_sent": 0, + "errors_received": 0, + "discard_packets_sent": 0, + "discard_packets_received": 0, + "total_start": 0, + "showtime_start": 0, + "last_showtime_start": 0, + "current_day_start": 85821, + "quarter_hour_start": 321, + "total": { + "xtur_fec_errors": 0, + "xtuc_fec_errors": 0, + "xtur_hec_errors": 4294967295, + "xtuc_hec_errors": 4294967295, + "xtur_crc_errors": 215, + "xtuc_crc_errors": 83 + }, + "showtime": { + "xtur_fec_errors": 0, + "xtuc_fec_errors": 0, + "xtur_hec_errors": 0, + "xtuc_hec_errors": 0, + "xtur_crc_errors": 6, + "xtuc_crc_errors": 1 + }, + "lastshowtime": { + "xtur_fec_errors": 4294967295, + "xtuc_fec_errors": 4294967295, + "xtur_hec_errors": 4294967295, + "xtuc_hec_errors": 4294967295, + "xtur_crc_errors": 4294967295, + "xtuc_crc_errors": 4294967295 + }, + "currentday": { + "xtur_fec_errors": 0, + "xtuc_fec_errors": 0, + "xtur_hec_errors": 4294967295, + "xtuc_hec_errors": 4294967295, + "xtur_crc_errors": 18, + "xtuc_crc_errors": 7 + }, + "quarterhour": { + "xtur_fec_errors": 0, + "xtuc_fec_errors": 0, + "xtur_hec_errors": 4294967295, + "xtuc_hec_errors": 4294967295, + "xtur_crc_errors": 0, + "xtuc_crc_errors": 0 + } + } + ] } ] } diff --git a/docs/api/fast.line.md b/docs/api/fast.line.md index 9a90ad9444b2ab67c0f40e1bbee350ec7aded48e..aa2e6ba18b773abec0e4e1aa2ebbf4e12ab0d8b1 100644 --- a/docs/api/fast.line.md +++ b/docs/api/fast.line.md @@ -15,7 +15,7 @@ Type: `Method` ### Ubus CLI Example ```bash -ubus call fast.line.0 status +ubus call fast.line.1 status ``` ### JSONRPC Example @@ -25,7 +25,7 @@ ubus call fast.line.0 status "jsonrpc": "2.0", "id": 0, "method": "call", - "params": ["<SID>", "fast.line.0", "status"] + "params": ["<SID>", "fast.line.1", "status"] } ``` @@ -41,63 +41,66 @@ None { "status": "up", "upstream": true, - "firmware_version": "A2pvfbH045k.d28a", + "firmware_version": "A2pvfbK047c1.d27l2", "link_status": "up", "current_profile": "106a", "power_management_state": "l0", "max_bit_rate": { - "us": 201000, - "ds": 402000 + "us": 166033, + "ds": 712517 }, "allowed_profiles": [ "106a", - "212a" + "106b", + "106c", + "212a", + "212c" ], "success_failure_cause": 0, - "upbokler": 180, + "upbokler": 210, "last_transmitted_signal": { - "us": 100, - "ds": 200 + "us": 0, + "ds": 0 }, - "upbokle": 160, + "upbokle": 0, "line_number": 1, "noise_margin": { - "us": 146, - "ds": 177 + "us": 80, + "ds": 81 }, "attenuation": { "us": 0, - "ds": 48 + "ds": 123 }, "power": { - "us": 123, - "ds": 106 + "us": 37, + "ds": 0 }, "snrm_rmc": { - "us": 12, - "ds": 14 + "us": 326, + "ds": 364 }, - "bits_rmc_ps": [ - 1, - 3, - 5, - 7 + "bits_rmc_ps_ds": [ + + ], + "bits_rmc_ps_us": [ + ], "fext_to_cancel_enable": { - "us": true, - "ds": true + "us": false, + "ds": false }, "etr": { - "us": 250000, - "ds": 350000 + "us": 0, + "ds": 0 }, "att_etr": { - "us": 225000, - "ds": 325000 + "us": 0, + "ds": 0 }, "min_eftr": { - "us": 200000, - "ds": 300000 + "us": 0, + "ds": 0 } } ``` @@ -111,7 +114,7 @@ Type: `Method` ### Ubus CLI Example ```bash -ubus call fast.line.0 stats +ubus call fast.line.1 stats ``` ### JSONRPC Example @@ -121,7 +124,7 @@ ubus call fast.line.0 stats "jsonrpc": "2.0", "id": 0, "method": "call", - "params": ["<SID>", "fast.line.0", "stats"] + "params": ["<SID>", "fast.line.1", "stats"] } ``` @@ -135,80 +138,88 @@ None - Example as below ```json { - "total_start": 397, - "showtime_start": 349, - "last_showtime_start": 349, - "current_day_start": 397, - "quarter_hour_start": 397, + "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": 3705, + "showtime_start": 1337, + "last_showtime_start": 3680, + "current_day_start": 3705, + "quarter_hour_start": 105, "total": { - "errored_secs": 20, - "severely_errored_secs": 5, - "loss": 1, - "lors": 4294967295, - "uas": 1, - "rtx_uc": 4294967295, - "rtx_tx": 0, - "success_bsw": 1024, - "success_sra": 2048, - "success_fra": 1024, - "success_rpa": 2048, - "success_tiga": 1024 + "errored_secs": 33, + "severely_errored_secs": 0, + "loss": 0, + "lors": 0, + "uas": 23, + "rtx_uc": 9203, + "rtx_tx": 18241, + "success_bsw": 207, + "success_sra": 34, + "success_fra": 32, + "success_rpa": 0, + "success_tiga": 0 }, "showtime": { - "errored_secs": 20, - "severely_errored_secs": 5, - "loss": 1, - "lors": 4294967295, - "uas": 1, - "rtx_uc": 4294967295, - "rtx_tx": 0, - "success_bsw": 1024, - "success_sra": 2048, - "success_fra": 1024, - "success_rpa": 2048, - "success_tiga": 1024 + "errored_secs": 0, + "severely_errored_secs": 0, + "loss": 0, + "lors": 0, + "uas": 0, + "rtx_uc": 0, + "rtx_tx": 711, + "success_bsw": 76, + "success_sra": 1, + "success_fra": 0, + "success_rpa": 0, + "success_tiga": 0 }, "lastshowtime": { - "errored_secs": 20, - "severely_errored_secs": 5, - "loss": 1, + "errored_secs": 4294967295, + "severely_errored_secs": 4294967295, + "loss": 4294967295, "lors": 4294967295, - "uas": 1, + "uas": 4294967295, "rtx_uc": 4294967295, - "rtx_tx": 0, - "success_bsw": 1024, - "success_sra": 2048, - "success_fra": 1024, - "success_rpa": 2048, - "success_tiga": 1024 + "rtx_tx": 4294967295, + "success_bsw": 4294967295, + "success_sra": 4294967295, + "success_fra": 4294967295, + "success_rpa": 4294967295, + "success_tiga": 4294967295 }, "currentday": { - "errored_secs": 20, - "severely_errored_secs": 5, - "loss": 1, - "lors": 4294967295, - "uas": 1, - "rtx_uc": 4294967295, - "rtx_tx": 0, - "success_bsw": 1024, - "success_sra": 2048, - "success_fra": 1024, - "success_rpa": 2048, - "success_tiga": 1024 + "errored_secs": 33, + "severely_errored_secs": 0, + "loss": 0, + "lors": 0, + "uas": 23, + "rtx_uc": 9203, + "rtx_tx": 18241, + "success_bsw": 207, + "success_sra": 34, + "success_fra": 32, + "success_rpa": 0, + "success_tiga": 0 }, "quarterhour": { - "errored_secs": 20, - "severely_errored_secs": 5, - "loss": 1, - "lors": 4294967295, - "uas": 1, - "rtx_uc": 4294967295, - "rtx_tx": 0, - "success_bsw": 1024, - "success_sra": 2048, - "success_fra": 1024, - "success_rpa": 2048, - "success_tiga": 1024 + "errored_secs": 0, + "severely_errored_secs": 0, + "loss": 0, + "lors": 0, + "uas": 0, + "rtx_uc": 0, + "rtx_tx": 85, + "success_bsw": 7, + "success_sra": 0, + "success_fra": 0, + "success_rpa": 0, + "success_tiga": 0 } } ``` @@ -222,7 +233,7 @@ Type: `Method` ### Ubus CLI Example ```bash -ubus call fast.line.0 stats "{ 'interval': 'total'}" +ubus call fast.line.1 stats "{ 'interval': 'total'}" ``` ### JSONRPC Example @@ -232,7 +243,7 @@ ubus call fast.line.0 stats "{ 'interval': 'total'}" "jsonrpc": "2.0", "id": 0, "method": "call", - "params": ["<SID>", "fast.line.0", "stats", "{ 'interval': 'total'}"] + "params": ["<SID>", "fast.line.1", "stats", "{ 'interval': 'total'}"] } ``` diff --git a/docs/api/ptm.link.md b/docs/api/ptm.link.md index 5e8ecbff8937f58da8070fb223039e829a9b21c5..02813d0cacf812e4d7148f374434f9f87ad5edff 100644 --- a/docs/api/ptm.link.md +++ b/docs/api/ptm.link.md @@ -13,7 +13,7 @@ Type: `Method` ### Ubus CLI Example ```bash -ubus call ptm.link.0 status +ubus call ptm.link.1 status ``` ### JSONRPC Example @@ -23,7 +23,7 @@ ubus call ptm.link.0 status "jsonrpc": "2.0", "id": 0, "method": "call", - "params": ["<SID>", "ptm.link.0", "status"] + "params": ["<SID>", "ptm.link.1", "status"] } ``` diff --git a/dslmngr.c b/dslmngr.c index f5db623fb0b78eef8c32bf3b610da700371e47b4..0052d27b1748c803558cdca5d86a493e788c9902 100644 --- a/dslmngr.c +++ b/dslmngr.c @@ -748,29 +748,18 @@ __ret: return retval; } -int dsl_line_stats(struct ubus_context *ctx, struct ubus_object *obj, - struct ubus_request_data *req, const char *method, struct blob_attr *msg) +static int validate_interval_type(struct blob_attr *msg, enum dsl_stats_type *type) { - static struct blob_buf bb; struct blob_attr *tb[__DSL_STATS_MAX]; - enum dsl_stats_type type = DSL_STATS_QUARTERHOUR + 1; - char ifname[IFNAMSIZ]; - struct if_stats if_stats = {0}; - struct dsl_line_channel_stats stats; - struct dsl_line_stats_interval line_stats_interval; - int retval = UBUS_STATUS_OK; - int num = -1; - int i, j; - void *table; + int i; - // Parse and validation check the interval type if any blobmsg_parse(dsl_stats_policy, __DSL_STATS_MAX, tb, blob_data(msg), blob_len(msg)); if (tb[DSL_STATS_INTERVAL]) { const char *st = blobmsg_data(tb[DSL_STATS_INTERVAL]); for (i = 0; i < ARRAY_SIZE(dsl_stats_types); i++) { if (strcasecmp(st, dsl_stats_types[i].text) == 0) { - type = dsl_stats_types[i].value; + *type = dsl_stats_types[i].value; break; } } @@ -780,6 +769,27 @@ int dsl_line_stats(struct ubus_context *ctx, struct ubus_object *obj, return UBUS_STATUS_INVALID_ARGUMENT; } } + return UBUS_STATUS_OK; +} + +int dsl_line_stats(struct ubus_context *ctx, struct ubus_object *obj, + struct ubus_request_data *req, const char *method, struct blob_attr *msg) +{ + static struct blob_buf bb; + enum dsl_stats_type type = DSL_STATS_QUARTERHOUR + 1; + char ifname[IFNAMSIZ]; + struct if_stats if_stats = {0}; + struct dsl_line_channel_stats stats; + struct dsl_line_stats_interval line_stats_interval; + int retval = UBUS_STATUS_OK; + int num = -1; + int i; + void *table; + + // Parse and validation check the interval type if any + if ((retval = validate_interval_type(msg, &type)) != UBUS_STATUS_OK) { + return retval; + } // Initialize the buffer memset(&bb, 0, sizeof(bb)); @@ -810,11 +820,11 @@ int dsl_line_stats(struct ubus_context *ctx, struct ubus_object *obj, dsl_stats_to_blob(&stats, &bb); // Get all interval statistics - for (j = 0; j < ARRAY_SIZE(dsl_stats_types); j++) { - table = blobmsg_open_table(&bb, dsl_stats_types[j].text); + for (i = 0; i < ARRAY_SIZE(dsl_stats_types); i++) { + table = blobmsg_open_table(&bb, dsl_stats_types[i].text); if (xdsl_ops.get_line_stats_interval == NULL || (*xdsl_ops.get_line_stats_interval) - (num, dsl_stats_types[j].value, &line_stats_interval) != 0) { + (num, dsl_stats_types[i].value, &line_stats_interval) != 0) { retval = UBUS_STATUS_UNKNOWN_ERROR; goto __ret; } @@ -874,7 +884,6 @@ int dsl_channel_stats(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg) { static struct blob_buf bb; - struct blob_attr *tb[__DSL_STATS_MAX]; enum dsl_stats_type type = DSL_STATS_QUARTERHOUR + 1; char ifname[IFNAMSIZ]; struct if_stats if_stats = {0}; @@ -882,25 +891,12 @@ int dsl_channel_stats(struct ubus_context *ctx, struct ubus_object *obj, struct dsl_channel_stats_interval channel_stats_interval; int retval = UBUS_STATUS_OK; int num = -1; - int i, j; + int i; void *table; // Parse and validation check the interval type if any - blobmsg_parse(dsl_stats_policy, __DSL_STATS_MAX, tb, blob_data(msg), blob_len(msg)); - if (tb[DSL_STATS_INTERVAL]) { - const char *st = blobmsg_data(tb[DSL_STATS_INTERVAL]); - - for (i = 0; i < ARRAY_SIZE(dsl_stats_types); i++) { - if (strcasecmp(st, dsl_stats_types[i].text) == 0) { - type = dsl_stats_types[i].value; - break; - } - } - - if (i >= ARRAY_SIZE(dsl_stats_types)) { - DSLMNGR_LOG(LOG_ERR, "Wrong argument for interval statistics type\n"); - return UBUS_STATUS_INVALID_ARGUMENT; - } + if ((retval = validate_interval_type(msg, &type)) != UBUS_STATUS_OK) { + return retval; } // Initialize the buffer @@ -932,11 +928,11 @@ int dsl_channel_stats(struct ubus_context *ctx, struct ubus_object *obj, dsl_stats_to_blob(&stats, &bb); // Get all interval statistics - for (j = 0; j < ARRAY_SIZE(dsl_stats_types); j++) { - table = blobmsg_open_table(&bb, dsl_stats_types[j].text); + for (i = 0; i < ARRAY_SIZE(dsl_stats_types); i++) { + table = blobmsg_open_table(&bb, dsl_stats_types[i].text); if (xdsl_ops.get_channel_stats_interval == NULL || (*xdsl_ops.get_channel_stats_interval) - (num, dsl_stats_types[j].value, &channel_stats_interval) != 0) { + (num, dsl_stats_types[i].value, &channel_stats_interval) != 0) { retval = UBUS_STATUS_UNKNOWN_ERROR; goto __ret; } @@ -1212,33 +1208,19 @@ int fast_line_stats_handler(struct ubus_context *ctx, struct ubus_object *obj, struct ubus_request_data *req, const char *method, struct blob_attr *msg) { static struct blob_buf bb; - struct blob_attr *tb[__DSL_STATS_MAX]; enum dsl_stats_type type = DSL_STATS_QUARTERHOUR + 1; struct if_stats if_stats = {0}; struct fast_line_stats stats; struct fast_line_stats_interval stats_interval; int retval = UBUS_STATUS_OK; int num = -1; - int i, j; + int i; void *table; char ifname[IFNAMSIZ]; // Parse and validation check the interval type if any - blobmsg_parse(dsl_stats_policy, __DSL_STATS_MAX, tb, blob_data(msg), blob_len(msg)); - if (tb[DSL_STATS_INTERVAL]) { - const char *st = blobmsg_data(tb[DSL_STATS_INTERVAL]); - - for (i = 0; i < ARRAY_SIZE(dsl_stats_types); i++) { - if (strcasecmp(st, dsl_stats_types[i].text) == 0) { - type = dsl_stats_types[i].value; - break; - } - } - - if (i >= ARRAY_SIZE(dsl_stats_types)) { - DSLMNGR_LOG(LOG_ERR, "Wrong argument for interval statistics type\n"); - return UBUS_STATUS_INVALID_ARGUMENT; - } + if ((retval = validate_interval_type(msg, &type)) != UBUS_STATUS_OK) { + return retval; } // Initialize the buffer @@ -1270,11 +1252,11 @@ int fast_line_stats_handler(struct ubus_context *ctx, struct ubus_object *obj, dsl_stats_to_blob(&stats, &bb); // Get all interval statistics - for (j = 0; j < ARRAY_SIZE(dsl_stats_types); j++) { - table = blobmsg_open_table(&bb, dsl_stats_types[j].text); + for (i = 0; i < ARRAY_SIZE(dsl_stats_types); i++) { + table = blobmsg_open_table(&bb, dsl_stats_types[i].text); if (xdsl_ops.get_fast_line_stats_interval == NULL || (*xdsl_ops.get_fast_line_stats_interval) - (num, dsl_stats_types[j].value, &stats_interval) != 0) { + (num, dsl_stats_types[i].value, &stats_interval) != 0) { retval = UBUS_STATUS_UNKNOWN_ERROR; goto __ret; } @@ -1689,7 +1671,7 @@ int dsl_line_configure(struct ubus_context *ctx, struct ubus_object *obj, } dup = alloca(strlen(profiles_str) + 1); - strcpy(dup, profiles_str); + strncpy(dup, profiles_str, strlen(profiles_str) + 1); for (token = strtok_r(dup, ",", &saveptr); token != NULL; token = strtok_r(NULL, ",", &saveptr)) { int profile = dsl_get_enum_value(vdsl2_profiles, token); if (profile != -1) @@ -1716,7 +1698,7 @@ int dsl_line_configure(struct ubus_context *ctx, struct ubus_object *obj, } dup = alloca(strlen(profiles_str) + 1); - strcpy(dup, profiles_str); + strncpy(dup, profiles_str, strlen(profiles_str) + 1); for (token = strtok_r(dup, ",", &saveptr); token != NULL; token = strtok_r(NULL, ",", &saveptr)) { int profile = dsl_get_enum_value(fast_profiles, token); if (profile != -1) diff --git a/dslmngr.h b/dslmngr.h index bd08ec70e316fb8c8abebecc6e0d4ce122e62e67..a1248d649fd7ed3b85f93045e52496efb4f418a3 100644 --- a/dslmngr.h +++ b/dslmngr.h @@ -35,7 +35,7 @@ extern int current_log_level; #define DSLMNGR_LOG(log_level, format...) do { \ if (log_level <= current_log_level) \ - fprintf(stderr, ##format); \ + fprintf(stderr, ##format); /* Flawfinder: ignore */ \ } while(0) #define CHECK_POINT() printf("Check point at %s@%s:%d\n", __func__, __FILE__, __LINE__) diff --git a/dslmngr_nl.c b/dslmngr_nl.c index 2b5bf6ded9872dc62808e0e461f10863877b7392..090c882527284c65773946dd4e18d1de80c104fd 100644 --- a/dslmngr_nl.c +++ b/dslmngr_nl.c @@ -56,7 +56,7 @@ static int dslmngr_ubus_event(struct ubus_context *ctx, char *message) char event[32] = {0}; struct blob_buf b; - sscanf(message, "%s '%[^\n]s'", event, data); + sscanf(message, "%32s '%512[^\n]s'", event, data); /* ignore non-dsl events */ if (!strstr(event, "dsl.")) diff --git a/gitlab-ci/functional-api-test.sh b/gitlab-ci/functional-api-test.sh index 49dea201134881697cb26afc46833306eca95509..223d5a8dcc1f5c8105f8a9eb9cb12d550dc43d08 100755 --- a/gitlab-ci/functional-api-test.sh +++ b/gitlab-ci/functional-api-test.sh @@ -14,9 +14,12 @@ supervisorctl status all ubus-api-validator -d ./test/api/json/ > ./api-result.log supervisorctl stop all supervisorctl status +# cleanup +supervisorctl remove dslmngr +supervisorctl remove ubusd # report part gcovr -r . --html --html-details -o ./api-test-coverage.html gcovr -r . -cp /opt/work/memory-report.xml /builds/iopsys/dslmngr/api-test-memory-report.xml +cp ./test/memory-report.xml /builds/iopsys/dslmngr/api-test-memory-report.xml tap-junit --input ./api-result.log --output report diff --git a/gitlab-ci/functional-test.sh b/gitlab-ci/functional-test.sh index 4f1946550aec3cd579532e3a1263ee0eafcff33d..fa84d54a03c9f349c5b376db56a935bc212bafbb 100755 --- a/gitlab-ci/functional-test.sh +++ b/gitlab-ci/functional-test.sh @@ -15,6 +15,9 @@ make functional-test -C ./ # run API validation supervisorctl stop all supervisorctl status +# cleanup +supervisorctl remove dslmngr +supervisorctl remove ubusd # report part # GitLab-CI output diff --git a/gitlab-ci/install-dependencies.sh b/gitlab-ci/install-dependencies.sh index 3a9449fab64f9b2644457afd48d0a40de0a9d3af..310f558f960ee588af62c8ee986de8470af4e58f 100755 --- a/gitlab-ci/install-dependencies.sh +++ b/gitlab-ci/install-dependencies.sh @@ -13,7 +13,7 @@ git checkout devel cd libeasy make CFLAGS+="-I/usr/include/libnl3" mkdir -p /usr/include/easy -cp easy.h event.h utils.h /usr/include/easy +cp easy.h event.h utils.h if_utils.h debug.h /usr/include/easy cp -a libeasy*.so* /usr/lib cd ../libdsl make PLATFORM=TEST diff --git a/gitlab-ci/iopsys-supervisord.conf b/gitlab-ci/iopsys-supervisord.conf index 4c539a05e1e4a4559184a8c58bf11756f369da33..468bb5483fa8dacf2aca414c48f48a7d6534d905 100644 --- a/gitlab-ci/iopsys-supervisord.conf +++ b/gitlab-ci/iopsys-supervisord.conf @@ -2,4 +2,4 @@ command=/bin/bash -c "/usr/sbin/ubusd" [program:dslmngr] -command=/bin/bash -c "/usr/bin/valgrind --xml=yes --xml-file=memory-report.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes /builds/iopsys/dslmngr/dslmngr" +command=/bin/bash -c "/usr/bin/valgrind --xml=yes --xml-file=/builds/iopsys/dslmngr/test/memory-report.xml --leak-check=full --show-reachable=yes --show-leak-kinds=all --errors-for-leak-kinds=all --error-exitcode=1 --track-origins=yes /builds/iopsys/dslmngr/dslmngr" diff --git a/schemas/ubus/dsl.line_stats.json b/schemas/ubus/dsl.line_stats.json index fde4198c5268f8d34cb1582c236fa9bbd30b957a..bb7ef8a97481ea1bf119f488762837e67d18e8f9 100644 --- a/schemas/ubus/dsl.line_stats.json +++ b/schemas/ubus/dsl.line_stats.json @@ -31,7 +31,15 @@ "properties" : { "id": { "type": "integer" }, - "total_start": { "$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger" }, + "bytes_sent": { "$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger" }, + "bytes_received": { "$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger" }, + "packets_sent": { "$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger" }, + "packets_received": { "$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger" }, + "errors_sent": { "$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger" }, + "errors_received": { "$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger" }, + "discard_packets_sent": { "$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger" }, + "discard_packets_received": { "$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger" }, + "total_start": { "$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger" }, "showtime_start": { "$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger" }, "last_showtime_start": { "$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger" }, "current_day_start": { "$ref": "http://json-schema.org/draft-07/schema#/definitions/nonNegativeInteger" }, @@ -45,6 +53,14 @@ }, "required": [ + "bytes_sent", + "bytes_received", + "packets_sent", + "packets_received", + "errors_sent", + "errors_received", + "discard_packets_sent", + "discard_packets_received", "total_start", "showtime_start", "last_showtime_start", diff --git a/test/api/json/atm.link.validation.json b/test/api/json/atm.link.validation.json index 9a4fc83b761f22c18f4938aca92dde10e97c8be2..7e5fc1a5445e2e681f22b9327f278b7c0fd94c50 100644 --- a/test/api/json/atm.link.validation.json +++ b/test/api/json/atm.link.validation.json @@ -1,5 +1,5 @@ { - "object": "atm.link.0", + "object": "atm.link.1", "methods": [ { diff --git a/test/api/json/dsl.channel.validation.json b/test/api/json/dsl.channel.validation.json index 110575d78bdb3b20b220da62e596c2d5f61b61b1..e637313e0ba53b534fe87e42bf0e84f1b8d699ab 100644 --- a/test/api/json/dsl.channel.validation.json +++ b/test/api/json/dsl.channel.validation.json @@ -1,5 +1,5 @@ { - "object": "dsl.channel.0", + "object": "dsl.channel.1", "methods": [ { diff --git a/test/api/json/dsl.line.validation.json b/test/api/json/dsl.line.validation.json index cfc96874b5f5466a6c132ae4be0446414f4864f4..9f9966ca510cf5448cabb055d55c847406bb799d 100644 --- a/test/api/json/dsl.line.validation.json +++ b/test/api/json/dsl.line.validation.json @@ -1,5 +1,5 @@ { - "object": "dsl.line.0", + "object": "dsl.line.1", "methods": [ { diff --git a/test/api/json/fast.line.validation.json b/test/api/json/fast.line.validation.json index df93e2879280466555956ed1c8a5cdb6893d63dc..831f382815185399f91181c275892a718ff5b43b 100644 --- a/test/api/json/fast.line.validation.json +++ b/test/api/json/fast.line.validation.json @@ -1,5 +1,5 @@ { - "object": "fast.line.0", + "object": "fast.line.1", "methods": [ { diff --git a/test/api/json/ptm.link.validation.json b/test/api/json/ptm.link.validation.json index e5e973ee811d5543db23887e4f3ac50d5e793998..8805d578f671c6eb3ae1d25f35ec345cc747d456 100644 --- a/test/api/json/ptm.link.validation.json +++ b/test/api/json/ptm.link.validation.json @@ -1,5 +1,5 @@ { - "object": "ptm.link.0", + "object": "ptm.link.1", "methods": [ { diff --git a/test/cmocka/Makefile b/test/cmocka/Makefile index bc3aa8c308ba238a09f85747d6593d6d16c2cf01..cd4a0b19abe561f2badb5b3726b82a9969e58832 100644 --- a/test/cmocka/Makefile +++ b/test/cmocka/Makefile @@ -3,7 +3,7 @@ DSLMNGR_LIB_DIR ?= $(PWD) DSLMNGR_LIB = -ldslmngr -L$(DSLMNGR_LIB_DIR) CMOCKA_LIB = -l cmocka LIBS = $(DSLMNGR_LIB) $(CMOCKA_LIB) -ldsl -pthread -luci -lubus -lubox -ljson-c -lblobmsg_json \ - -lnl-genl-3 -lnl-3 -ljson-validator -ljson-schema-validator -ljson-editor + -lnl-genl-3 -lnl-3 -ljson-validator -ljson-schema-validator -ljson-editor -leasy CFLAGS = -g -Wall -I../.. LDFLAGS = $(LIBS) -Wl,-rpath=$(DSLMNGR_LIB_DIR) UNIT_TESTS = unit_test_dslmngr diff --git a/test/cmocka/functional_test_dslmngr.c b/test/cmocka/functional_test_dslmngr.c index 8b8814c94e56ab3b102de423032d5754d4de0ddf..fbf1f76336fa49206233c0d1c5825fa2b095f4f2 100644 --- a/test/cmocka/functional_test_dslmngr.c +++ b/test/cmocka/functional_test_dslmngr.c @@ -47,10 +47,10 @@ static int group_setup(void **state) { // Start ubusd if it is not running - system("pidof ubusd || ubusd &"); + system("pidof ubusd || ubusd &"); /* Flawfinder: ignore */ // Restart dslmngr - system("kill $(pidof dslmngr) 2>/dev/null; ../../dslmngr &"); + system("kill $(pidof dslmngr) 2>/dev/null; ../../dslmngr &"); /* Flawfinder: ignore */ return 0; } @@ -58,7 +58,7 @@ static int group_setup(void **state) static int group_teardown(void **state) { // Stop dslmngr - system("kill $(pidof dslmngr)"); + system("kill $(pidof dslmngr)"); /* Flawfinder: ignore */ // Delete test logs unlink(UBUS_OUTPUT_FILE); @@ -84,7 +84,7 @@ static void get_ubus_call_output(const char *ubus_cmd) // Put the output of ubus call into a string snprintf(cmd, sizeof(cmd), "%s > %s", ubus_cmd, UBUS_OUTPUT_FILE); - int rc = system(cmd); + int rc = system(cmd); /* Flawfinder: ignore */ assert_return_code(rc, errno); fd = open(UBUS_OUTPUT_FILE, O_RDONLY); @@ -112,13 +112,13 @@ static void get_ubus_call_output(const char *ubus_cmd) static void test_ubus_dsl_line_status(void **state) { - get_ubus_call_output("ubus call dsl.line.0 status"); + get_ubus_call_output("ubus call dsl.line.1 status"); validate_dsl_line_status(json_output); } static void test_ubus_dsl_channel_status(void **state) { - get_ubus_call_output("ubus call dsl.channel.0 status"); + get_ubus_call_output("ubus call dsl.channel.1 status"); validate_dsl_channel_status(json_output); } @@ -130,7 +130,7 @@ static void test_ubus_dsl_status(void **state) static void test_ubus_dsl_line_stats(void **state) { - get_ubus_call_output("ubus call dsl.line.0 stats"); + get_ubus_call_output("ubus call dsl.line.1 stats"); validate_dsl_line_stats(json_output); } @@ -140,7 +140,7 @@ static void test_ubus_dsl_line_stats_interval(void **state) char ubus_cmd[256]; for (interval = interval_types; *interval != NULL; interval++) { - snprintf(ubus_cmd, sizeof(ubus_cmd), "ubus call dsl.line.0 stats \"{'interval':'%s'}\"", *interval); + snprintf(ubus_cmd, sizeof(ubus_cmd), "ubus call dsl.line.1 stats \"{'interval':'%s'}\"", *interval); get_ubus_call_output(ubus_cmd); validate_dsl_line_stats_interval(json_output, *interval); @@ -151,7 +151,7 @@ static void test_ubus_dsl_line_stats_interval(void **state) static void test_ubus_dsl_channel_stats(void **state) { - get_ubus_call_output("ubus call dsl.channel.0 stats"); + get_ubus_call_output("ubus call dsl.channel.1 stats"); validate_dsl_channel_stats(json_output); } @@ -161,7 +161,7 @@ static void test_ubus_dsl_channel_stats_interval(void **state) char ubus_cmd[256]; for (interval = interval_types; *interval != NULL; interval++) { - snprintf(ubus_cmd, sizeof(ubus_cmd), "ubus call dsl.channel.0 stats \"{'interval':'%s'}\"", *interval); + snprintf(ubus_cmd, sizeof(ubus_cmd), "ubus call dsl.channel.1 stats \"{'interval':'%s'}\"", *interval); get_ubus_call_output(ubus_cmd); validate_dsl_channel_stats_interval(json_output, *interval); diff --git a/test/cmocka/unit_test_dslmngr.c b/test/cmocka/unit_test_dslmngr.c index 4099e4ce0b8b061ebcdc40e52e09b1a2d99c9ce5..724769d51173b361cab243ac6518f939c87151f5 100644 --- a/test/cmocka/unit_test_dslmngr.c +++ b/test/cmocka/unit_test_dslmngr.c @@ -99,9 +99,9 @@ static int group_setup(void **state) return -1; ctx->dsl.name = "dsl"; - ctx->dsl_line.name = "dsl.line.0"; - ctx->dsl_channel.name = "dsl.channel.0"; - ctx->atm_link.name = "atm.link.0"; + ctx->dsl_line.name = "dsl.line.1"; + ctx->dsl_channel.name = "dsl.channel.1"; + ctx->atm_link.name = "atm.link.1"; memset(&ctx->bb, 0, sizeof(struct blob_buf)); *state = ctx; diff --git a/test/cmocka/utils.c b/test/cmocka/utils.c index a5d6cc352f53df5789dff38d769b845ba5a03b28..0c76634a0d12af9946d867e7c3386e7a4a864fe5 100644 --- a/test/cmocka/utils.c +++ b/test/cmocka/utils.c @@ -44,8 +44,9 @@ struct json_object *json_output = NULL; const char *interval_types[] = { "total", "showtime", "lastshowtime", "currentday", "quarterhour", NULL }; -static const char *stats_counters[] = { "total_start", "showtime_start", "last_showtime_start", - "current_day_start", "quarter_hour_start", NULL }; +static const char *stats_counters[] = { "bytes_sent", "bytes_received", "packets_sent", "packets_received", + "errors_sent", "errors_received", "discard_packets_sent", "discard_packets_received", "total_start", + "showtime_start", "last_showtime_start", "current_day_start", "quarter_hour_start", NULL }; void validate_dsl_line_status(struct json_object *json_obj) { @@ -185,7 +186,7 @@ void validate_dsl_line_stats(struct json_object *json_obj) for (counter = stats_counters; *counter != NULL; counter++) { JSON_GET_OBJ(json_obj, tmp, (char *)*counter); - assert_true(json_object_get_int(tmp) > 0); + assert_true(json_object_get_int(tmp) >= 0); } // Validate all interval statistics @@ -293,6 +294,8 @@ void validate_dsl_stats(struct json_object *json_obj) array = json_object_get_array(tmp); assert_true(array != NULL && array_list_length(array) == 1); line = (struct json_object *)array_list_get_idx(array, 0); + JSON_GET_OBJ(line, tmp, "id"); + assert_true(json_object_get_int(tmp) >= 1); validate_dsl_line_stats(line); // Validate channel status @@ -300,5 +303,7 @@ void validate_dsl_stats(struct json_object *json_obj) array = json_object_get_array(tmp); assert_true(array != NULL && array_list_length(array) == 1); channel = (struct json_object *)array_list_get_idx(array, 0); + JSON_GET_OBJ(channel, tmp, "id"); + assert_true(json_object_get_int(tmp) >= 1); validate_dsl_channel_stats(channel); } diff --git a/test/files/etc/config/dsl b/test/files/etc/config/dsl new file mode 100644 index 0000000000000000000000000000000000000000..754c5492a06a464671590ca65db533a2f902b7ce --- /dev/null +++ b/test/files/etc/config/dsl @@ -0,0 +1,7 @@ +config atm-device 'atm0' + option name 'ATM' + option device 'atm0' + +config ptm-device 'ptm0' + option name 'PTM' + option device 'ptm0'