From patchwork Fri Dec 11 01:05:05 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Heider X-Patchwork-Id: 1414876 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.openwrt.org (client-ip=2001:8b0:10b:1231::1; helo=merlin.infradead.org; envelope-from=openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=merlin.20170209 header.b=ZfvXEKgD; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20161025 header.b=VvXYpmsg; dkim-atps=neutral Received: from merlin.infradead.org (merlin.infradead.org [IPv6:2001:8b0:10b:1231::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CsqKK6Pk4z9sTX for ; Fri, 11 Dec 2020 23:07:17 +1100 (AEDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe :List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:To:From: Reply-To:Cc:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=p2W1Sk9Upy6d8PssJMPCsLHLSjGbi5B1XmALP4kY81E=; b=ZfvXEKgDPrDZnEIzTK7vIvyZSI xYaZy37GZznwyl+fzGuo6tFfBWYqB4SoQIHcESmyI8RBYFJ13YrOq5mtbCMClvaNbS+o5Bo85bPly lppjSfVT7WVcTAqOlLVLEY8cku4PAj+rQus6YCYpwUrGEFrKACUnaU+nuOHSn8uRT3yLtVYcBRtAM BjVNXNFicXGkxgWGHsbysnbX99qo3mQQpk61Rq5sR0lDvnb+wHe0jbDCdlsAmWqA5QMW2U965MbtZ amWhBJLIHvrGISvrVKwdfboihTGpyWHPglacf8h4pBZl6IBsobOOY2LgDHSLpHmw55AI3MpLFjuaj tFfHi24w==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1knhB0-0005Lc-9F; Fri, 11 Dec 2020 12:05:34 +0000 Received: from mail-wm1-x32b.google.com ([2a00:1450:4864:20::32b]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1knhAn-0005H4-67 for openwrt-devel@lists.openwrt.org; Fri, 11 Dec 2020 12:05:25 +0000 Received: by mail-wm1-x32b.google.com with SMTP id g25so4556019wmh.1 for ; Fri, 11 Dec 2020 04:05:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references:mime-version :content-transfer-encoding; bh=qP+sxK7nU7XKyuuJdpOmX7B8CB01KfHXYLqORX4l8YI=; b=VvXYpmsgEUsAcHA54LJKJdEKbHRgFkmBst453ObVMRx+K7t5r+FSzf1qN/m/nTjbBv +L6d9dRDdWtSNMpRFnegUTmDB9YXeHTjB5CNAwF+2bVlvHe9YwqlBNnYurqPSXQc1DYv F2P1d6W0x5WuX/39tlKekKohVLkKiNgBMHX2JlaQs7y+HqubMI80qHposV/eALeNKf83 IjNUKXe4R4HQUvfbLXHCgvOaeXtR5juRQIUQXWTHwU2lP3776FCw9PpPTDYc0CEBYEz6 lCeGAcjxFZlq2ZKZyfBM67m0bODf+NZQjnJyOeMbO7mHDr2WUMab0/XoZgKMUoMdXJR0 yWDA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=qP+sxK7nU7XKyuuJdpOmX7B8CB01KfHXYLqORX4l8YI=; b=q/j7LBP8EGXJVjRJGXJM/JbQqXXCbuPw2INIHtyKQ0W7o951FQf2IAbBEJ4iM/8Bb/ WbzN1m1njwM57YUF8WlbvibPrX/YoRiqq9YKYBimrttK422k9WV3f/uPNqQS6JGYxF5W XSJrPApEEc+GH6g/TFlChYQSnQ8n+I8quja6z4ykFhP5pj56I8zOub5B3/VzoQpneWtf mUQz6c7mzN7Fc2uis6v+KuzMMCbis49V4ZLymwWsRPAzC3acUkdM4bzIYMEUs1EH+3ND bnccEg9rFZZYiJZmOkTT0UpFsEdwjD7idi3xeeEGuFpv33LHdM7a3jwSxhqc78r6HWXc Lq2g== X-Gm-Message-State: AOAM533qP+oJjFIp7BHmWxX8rV2nZ+MNcJUt226oq6fpxkVveMFxJu7N QCBvuKE7De4/6IF7VMXBPbI55D5rOZLVUQ== X-Google-Smtp-Source: ABdhPJydpgsTGZstTx6RWXbttx0tANoeATzNSuoBi5cEPhYBhX5H/7szmAJgeD8WPlwsObXgKPbJCw== X-Received: by 2002:a05:600c:224b:: with SMTP id a11mr13174580wmm.97.1607688319435; Fri, 11 Dec 2020 04:05:19 -0800 (PST) Received: from mamamia.internal (a89-182-180-166.net-htp.de. [89.182.180.166]) by smtp.gmail.com with ESMTPSA id l1sm14552616wmi.15.2020.12.11.04.05.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Dec 2020 04:05:19 -0800 (PST) From: Andre Heider To: openwrt-devel@lists.openwrt.org Subject: [luci PATCH 05/13] luci-mod-status: use the new ubus dsl metrics Date: Fri, 11 Dec 2020 13:05:05 +0100 Message-Id: <20201211120513.1130247-6-a.heider@gmail.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201211120513.1130247-1-a.heider@gmail.com> References: <20201211120513.1130247-1-a.heider@gmail.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201211_070521_323626_0A28DF39 X-CRM114-Status: GOOD ( 12.29 ) X-Spam-Score: -0.2 (/) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-0.2 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:32b listed in] [list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider [a.heider[at]gmail.com] -0.0 SPF_PASS SPF: sender matches SPF record 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain X-BeenThere: openwrt-devel@lists.openwrt.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: OpenWrt Development List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "openwrt-devel" Errors-To: openwrt-devel-bounces+incoming=patchwork.ozlabs.org@lists.openwrt.org This is significantly faster. Signed-off-by: Andre Heider --- .../resources/view/status/include/50_dsl.js | 55 +++++++++---------- .../usr/share/rpcd/acl.d/luci-mod-status.json | 2 +- 2 files changed, 28 insertions(+), 29 deletions(-) diff --git a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/50_dsl.js b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/50_dsl.js index 4150b5513..946890f07 100644 --- a/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/50_dsl.js +++ b/modules/luci-mod-status/htdocs/luci-static/resources/view/status/include/50_dsl.js @@ -2,40 +2,39 @@ 'require baseclass'; 'require rpc'; -var callLuciDSLStatus = rpc.declare({ - object: 'luci-rpc', - method: 'getDSLStatus', +var call_dsl_metrics = rpc.declare({ + object: 'dsl', + method: 'metrics', expect: { '': {} } }); function renderbox(dsl) { return E('div', { class: 'ifacebox' }, [ - E('div', { class: 'ifacebox-head center ' + ((dsl.line_state === 'UP') ? 'active' : '') }, + E('div', { class: 'ifacebox-head center ' + (dsl.up ? 'active' : '') }, E('strong', _('DSL Status'))), E('div', { class: 'ifacebox-body left' }, [ L.itemlist(E('span'), [ - _('Line State'), '%s [0x%x]'.format(dsl.line_state, dsl.line_state_detail), - _('Line Mode'), dsl.line_mode_s || '-', - _('Line Uptime'), '%t'.format(dsl.line_uptime), - _('Annex'), dsl.annex_s || '-', - _('Profile'), dsl.profile_s || '-', - _('Data Rate'), '%1000.3mb/s / %1000.3mb/s'.format(dsl.data_rate_down, dsl.data_rate_up), - _('Max. Attainable Data Rate (ATTNDR)'), '%1000.3mb/s / %1000.3mb/s'.format(dsl.max_data_rate_down, dsl.max_data_rate_up), - _('Latency'), '%.2f ms / %.2f ms'.format(dsl.latency_down / 1000, dsl.latency_up / 1000), - _('Line Attenuation (LATN)'), '%.1f dB / %.1f dB'.format(dsl.line_attenuation_down, dsl.line_attenuation_up), - _('Signal Attenuation (SATN)'), '%.1f dB / %.1f dB'.format(dsl.signal_attenuation_down, dsl.signal_attenuation_up), - _('Noise Margin (SNR)'), '%.1f dB / %.1f dB'.format(dsl.noise_margin_down, dsl.noise_margin_up), - _('Aggregate Transmit Power (ACTATP)'), '%.1f dB / %.1f dB'.format(dsl.actatp_down, dsl.actatp_up), - _('Forward Error Correction Seconds (FECS)'), '%d / %d'.format(dsl.errors_fecs_near, dsl.errors_fecs_far), - _('Errored seconds (ES)'), '%d / %d'.format(dsl.errors_es_near, dsl.errors_es_far), - _('Severely Errored Seconds (SES)'), '%d / %d'.format(dsl.errors_ses_near, dsl.errors_ses_far), - _('Loss of Signal Seconds (LOSS)'), '%d / %d'.format(dsl.errors_loss_near, dsl.errors_loss_far), - _('Unavailable Seconds (UAS)'), '%d / %d'.format(dsl.errors_uas_near, dsl.errors_uas_far), - _('Header Error Code Errors (HEC)'), '%d / %d'.format(dsl.errors_hec_near, dsl.errors_hec_far), - _('Non Pre-emptive CRC errors (CRC_P)'), '%d / %d'.format(dsl.errors_crc_p_near, dsl.errors_crc_p_far), - _('Pre-emptive CRC errors (CRCP_P)'), '%d / %d'.format(dsl.errors_crcp_p_near, dsl.errors_crcp_p_far), - _('ATU-C System Vendor ID'), dsl.atuc_vendor_id, - _('Power Management Mode'), dsl.power_mode_s + _('Line State'), dsl.state || '-', + _('Line Mode'), dsl.mode || '-', + _('Line Uptime'), '%t'.format(dsl.uptime), + _('Annex'), dsl.annex || '-', + _('Data Rate'), '%1000.3mb/s / %1000.3mb/s'.format(dsl.downstream.data_rate, dsl.upstream.data_rate), + _('Max. Attainable Data Rate (ATTNDR)'), '%1000.3mb/s / %1000.3mb/s'.format(dsl.downstream.attndr, dsl.upstream.attndr), + _('Latency'), '%.2f ms / %.2f ms'.format(dsl.downstream.interleave_delay / 1000, dsl.upstream.interleave_delay / 1000), + _('Line Attenuation (LATN)'), '%.1f dB / %.1f dB'.format(dsl.downstream.latn, dsl.upstream.latn), + _('Signal Attenuation (SATN)'), '%.1f dB / %.1f dB'.format(dsl.downstream.satn, dsl.upstream.satn), + _('Noise Margin (SNR)'), '%.1f dB / %.1f dB'.format(dsl.downstream.snr, dsl.upstream.snr), + _('Aggregate Transmit Power (ACTATP)'), '%.1f dB / %.1f dB'.format(dsl.downstream.actatp, dsl.upstream.actatp), + _('Forward Error Correction Seconds (FECS)'), '%d / %d'.format(dsl.errors.near.fecs, dsl.errors.far.fecs), + _('Errored seconds (ES)'), '%d / %d'.format(dsl.errors.near.es, dsl.errors.far.es), + _('Severely Errored Seconds (SES)'), '%d / %d'.format(dsl.errors.near.ses, dsl.errors.far.ses), + _('Loss of Signal Seconds (LOSS)'), '%d / %d'.format(dsl.errors.near.loss, dsl.errors.far.loss), + _('Unavailable Seconds (UAS)'), '%d / %d'.format(dsl.errors.near.uas, dsl.errors.far.uas), + _('Header Error Code Errors (HEC)'), '%d / %d'.format(dsl.errors.near.hec, dsl.errors.far.hec), + _('Non Pre-emptive CRC errors (CRC_P)'), '%d / %d'.format(dsl.errors.near.crc_p, dsl.errors.far.crc_p), + _('Pre-emptive CRC errors (CRCP_P)'), '%d / %d'.format(dsl.errors.near.crcp_p, dsl.errors.far.crcp_p), + _('ATU-C System Vendor ID'), dsl.atu_c.vendor || dsl.atu_c.vendor_id, + _('Power Management Mode'), dsl.power_state ]) ]) ]); @@ -45,11 +44,11 @@ return baseclass.extend({ title: _('DSL'), load: function() { - return L.resolveDefault(callLuciDSLStatus(), {}); + return L.resolveDefault(call_dsl_metrics(), {}); }, render: function(dsl) { - if (!dsl.line_state) + if (!dsl.state) return null; return E('div', { 'id': 'dsl_status_table', 'class': 'network-status-table' }, renderbox(dsl)); diff --git a/modules/luci-mod-status/root/usr/share/rpcd/acl.d/luci-mod-status.json b/modules/luci-mod-status/root/usr/share/rpcd/acl.d/luci-mod-status.json index db52c7313..5768f0a97 100644 --- a/modules/luci-mod-status/root/usr/share/rpcd/acl.d/luci-mod-status.json +++ b/modules/luci-mod-status/root/usr/share/rpcd/acl.d/luci-mod-status.json @@ -111,7 +111,7 @@ "description": "Grant access to DSL status display", "read": { "ubus": { - "luci-rpc": [ "getDSLStatus" ] + "dsl": [ "metrics" ] } } },