7 var callDSLMetrics
= rpc
.declare({
13 function format_on_off(val
) {
14 return val
? _('on') : _('off');
17 function format_latency(val
) {
18 return '%.2f ms'.format(val
/ 1000);
23 return L
.resolveDefault(callDSLMetrics(), {});
26 pollData: function(container
) {
27 poll
.add(L
.bind(function() {
28 return L
.resolveDefault(callDSLMetrics(), {}).then(L
.bind(function(data
) {
29 dom
.content(container
, this.renderContent(data
));
34 formatHelper: function(format
, val
) {
36 if (format
instanceof Function
) {
38 } else if (typeof format
=== 'string') {
39 return format
.format(val
);
47 renderSimpleTable: function(data
) {
48 var table
= E('table', { 'class': 'table' });
50 for (var [i
, item
] of data
.entries()) {
54 var rowstyle
= (i
% 2 == 0) ? 'cbi-rowstyle-1' : 'cbi-rowstyle-2';
56 table
.appendChild(E('tr', { 'class': 'tr ' + rowstyle
}, [
57 E('td', { 'class': 'td left', 'width': '33%' }, [ label
]),
58 E('td', { 'class': 'td left' }, [ this.formatHelper(null, val
) ])
62 return E('div', { 'class': 'cbi-section' }, table
);
65 renderTable: function(data
) {
66 var table
= E('table', { 'class': 'table' });
68 for (var [i
, item
] of data
.entries()) {
74 var rowstyle
= (i
% 2 == 0) ? 'cbi-rowstyle-1' : 'cbi-rowstyle-2';
76 table
.appendChild(E('tr', { 'class': 'tr ' + rowstyle
}, [
77 E('td', { 'class': 'td left', 'width': '33%' }, [ label
]),
78 E('td', { 'class': 'td right', 'width': '33%' }, [ this.formatHelper(format
, val1
) ]),
79 E('td', { 'class': 'td right', 'width': '33%' }, [ this.formatHelper(format
, val2
) ])
83 return E('div', { 'class': 'cbi-section' }, table
);
86 renderContent: function(data
) {
89 E('h3', {}, [ _('Connection State') ]),
91 this.renderSimpleTable([
92 [ _('Line State'), data
.state
],
93 [ _('Line Mode'), data
.mode
],
94 [ _('Line Uptime'), '%t'.format(data
.uptime
) ],
95 [ _('Annex'), data
.annex
],
96 [ _('Power Management Mode'), data
.power_state
]
99 E('h3', {}, [ _('Inventory') ]),
101 this.renderSimpleTable([
102 [ _('Modem Chipset'), data
.chipset
],
103 [ _('Modem Firmware'), data
.firmware_version
],
104 [ _('xTU-C Vendor ID'), data
.atu_c
.vendor
|| data
.atu_c
.vendor_id
]
107 E('h3', {}, [ _('Line Details') ]),
109 E('h4', {}, [ _('Data Rates') ]),
111 [ _('Actual Data Rate'), '%1000.3mb/s', data
.downstream
.data_rate
, data
.upstream
.data_rate
],
112 [ _('Attainable Data Rate (ATTNDR)'), '%1000.3mb/s', data
.downstream
.attndr
, data
.upstream
.attndr
],
113 [ _('Minimum Error-Free Throughput (MINEFTR)'), '%1000.3mb/s', data
.downstream
.mineftr
, data
.upstream
.mineftr
]
116 E('h4', {}, [ _('On-line Reconfiguration') ]),
118 [ _('Bitswap'), format_on_off
, data
.downstream
.bitswap
, data
.upstream
.bitswap
],
119 [ _('Rate Adaptation Mode'), '%s', data
.downstream
.ra_mode
, data
.upstream
.ra_mode
]
122 E('h4', {}, [ _('Noise Protection') ]),
124 [ _('Latency'), format_latency
, data
.downstream
.interleave_delay
, data
.upstream
.interleave_delay
],
125 [ _('Impulse Noise Protection (INP)'), '%.1f symbols', data
.downstream
.inp
, data
.upstream
.inp
],
126 [ _('Retransmission (G.INP)'), format_on_off
, data
.downstream
.retx
, data
.upstream
.retx
]
129 E('h4', {}, [ _('Line Parameters') ]),
131 [ _('Line Attenuation (LATN)'), '%.1f dB', data
.downstream
.latn
, data
.upstream
.latn
],
132 [ _('Signal Attenuation (SATN)'), '%.1f dB', data
.downstream
.satn
, data
.upstream
.satn
],
133 [ _('Noise Margin (SNRM)'), '%.1f dB', data
.downstream
.snr
, data
.upstream
.snr
],
134 [ _('Aggregate Transmit Power (ACTATP)'), '%.1f dB', data
.downstream
.actatp
, data
.upstream
.actatp
]
137 E('h3', {}, [ _('Error Counters') ]),
139 E('h4', {}, [ _('Error Seconds') ]),
141 [ _('Forward Error Correction Seconds (FECS)'), '%d', data
.errors
.near
.fecs
, data
.errors
.far
.fecs
],
142 [ _('Errored Seconds (ES)'), '%d', data
.errors
.near
.es
, data
.errors
.far
.es
],
143 [ _('Severely Errored Seconds (SES)'), '%d', data
.errors
.near
.ses
, data
.errors
.far
.ses
],
144 [ _('Loss of Signal Seconds (LOSS)'), '%d', data
.errors
.near
.loss
, data
.errors
.far
.loss
],
145 [ _('Unavailable Seconds (UAS)'), '%d', data
.errors
.near
.uas
, data
.errors
.far
.uas
],
146 [ _('Seconds with Low Error-Free Throughput (LEFTRS)'), '%d', data
.errors
.near
.leftrs
, data
.errors
.far
.leftrs
]
149 E('h4', {}, [ _('Channel Counters') ]),
151 [ _('CRC Errors (CV-C)'), '%d', data
.errors
.near
.cv_c
, data
.errors
.far
.cv_c
],
152 [ _('Corrected by FEC (FEC-C)'), '%d', data
.errors
.near
.fec_c
, data
.errors
.far
.fec_c
]
155 E('h4', {}, [ _('Data Path Counters') ]),
157 [ _('ATM Header Error Control Errors (HEC-P)'), '%d', data
.errors
.near
.hec
, data
.errors
.far
.hec
],
158 [ _('PTM Non Pre-emptive CRC Errors (CRC-P)'), '%d', data
.errors
.near
.crc_p
, data
.errors
.far
.crc_p
],
159 [ _('PTM Pre-emptive CRC Errors (CRCP-P)'), '%d', data
.errors
.near
.crcp_p
, data
.errors
.far
.crcp_p
]
162 E('h4', {}, [ _('Retransmission Counters') ]),
164 [ _('Retransmitted DTUs (rtx-tx)'), '%d', data
.errors
.far
.tx_retransmitted
, data
.errors
.near
.tx_retransmitted
],
165 [ _('Corrected DTUs (rtx-c)'), '%d', data
.errors
.near
.rx_corrected
, data
.errors
.far
.rx_corrected
],
166 [ _('Uncorrected DTUs (rtx-uc)'), '%d', data
.errors
.near
.rx_uncorrected_protected
, data
.errors
.far
.rx_uncorrected_protected
]
172 render: function(data
) {
174 E('h2', {}, [ _('DSL stats') ]),
178 var container
= v
.lastElementChild
;
179 dom
.content(container
, this.renderContent(data
));
180 this.pollData(container
);
185 handleSaveApply
: null,