Repository navigation
ONT Stats: Peter-Pon GPON firmware (Lantiq PEB98035 sticks) - #1368
Merged
Merged
Conversation
Adds an ONT provider for GPON SFP sticks running Peter-Pon, the OpenWrt-based firmware for the Huawei MA5671A. The stick's uhttpd serves ubus JSON-RPC at /ubus/. A poll signs in with session.login (username root by default), then reads luci.gpon status and info in one batch: - status: Rx/Tx power (the dBm half of "12.14uW -19.16dBm"), PLOAM state, and the laser temperature (kelvin to C). The laser temperature is the optic reading SFP DDM and the other sticks report; the SoC die temperature has no OntStats field. - info: GPON SN, firmware build, OLT vendor ID (stored raw, "HWTC", and decoded for display), OLT version and equipment ID. luci.gpon live_get adds laser bias, supply voltage (optic.vcc_mv), and the stick's uptime for reboot detection. It is best effort: a firmware without it still polls. live_get returns every 1 s sample after its since sequence number, so each poll passes the previous reply's seq to read only the samples taken since the last poll, not the whole ring. A failed read, or a reply with no seq, starts over from 0. The firmware serves no cumulative error counters, only per-second GTC rates in that ring. The provider sums gtc.bip_ps, gtc.fec_uncorr_ps, gtc.fec_corr_ps, gtc.hec_corr_ps, and gtc.hec_uncorr_ps into running BIP, FEC, and HEC counters per configuration. Samples are counted by their time (ms since the stick booted), so a reply that repeats the ring never counts a sample twice, and a sample time that goes back means the stick rebooted and the totals start over. The totals also restart with Network Optimizer; the charts, alerts, and ISP Health already read a counter that goes down as a reset. Samples the ring drops between two polls are not counted. The ubus session is reused across polls and replaced when the stick answers Access denied (-32002, or ubus status 6), as rpcd expires it after 300 s idle. A denial that survives a fresh sign-in reports that the user has no access to luci.gpon. A stick without luci.gpon reports that it does not look like Peter-Pon firmware. Requests carry a Content-Length instead of a chunked body. Implements ISfpSupplementalOntProvider, so the stick can attach to the gateway's monitored SFP module: its PLOAM state, counters, firmware, and OLT identity merge into the module's sfp series, and its optics fill gaps the gateway's DDM read leaves. Registered in DI and in the Settings - Monitoring ONT provider list, with 192.168.1.10 as the default host and root as the username placeholder. FEATURES.md lists the stick under Fiber ONTs.
Fixtures are the luci.gpon status, info, and live_get replies from a web UI capture of an MA5671A on Peter-Pon, with the GPON serial and service VLANs replaced by generic values. Covers the dBm and kelvin conversions, batch replies matched by id, Access denied and missing-object replies, the newest live sample (bias 8.53 mA, 3.35 V, uptime), and the status and info mapping. The error counter tests cover sums across polls, repeated samples counted once, a stick reboot starting the totals over, a reply with no new samples still reporting the totals, metric arrays aligned from the newest sample, and a firmware without the rates leaving the counters null. A loopback ubus stub serves the captured replies to cover sign-in, session reuse, re-login after expiry, rejected and changed credentials, a user without access to luci.gpon, a firmware without luci.gpon, and since tracking across polls and after a failed live_get.
The Test button probes the edited form, which can point at a different stick, but it polled with the saved configuration's Id. That advanced the saved configuration's live_get since and replaced its ubus session, and the other stick's samples were added to its error totals. Test now polls with Id 0, like an unsaved configuration. Also marks the provider [VendorSpecific]: it parses raw ubus JSON.
The fixtures come from an FS.com GPON-SFP-ONT-MAC-I, not an MA5671A. Both sticks use the Lantiq PEB98035 and run Peter-Pon. The provider summary, the test fixture note, and FEATURES.md now name both.
The stick's uptime came from live_get's uptime_s, while the error totals reset on the sample times t, read as ms since boot. In the capture uptime_s is 134143 but updated_s and the newest t are 134171: uptime_s trails the boot clock, so it is likely omci_ngd's age (pid 1420), and a daemon restart would read as a stick reboot. Uptime now comes from updated_s, or from the newest t when updated_s is absent, so reboot detection and the totals use one clock.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Monitoring - ONT Stats
192.168.1.10and the default username isroot. The provider reads Rx/Tx power, PLOAM state, laser temperature, laser bias, supply voltage, the stick's uptime, the GPON SN, the firmware build, and the OLT vendor and version. Thanks to micallan_17 for the provider spec and the web UI capture, taken from an FS.com GPON-SFP-ONT-MAC-I in a UniFi gateway, and to turboleak1482 for the firmware.How it works
/ubus/. A poll signs in withsession.login, then readsluci.gpon statusandluci.gpon infoin one batch.-32002, or ubus status 6), the provider signs in again once and retries.luci.gpon live_getis best effort: a firmware without it still polls. It returns every 1 s sample aftersince. Each poll passes the previous reply'sseqassince, so a reply holds only the samples taken since the last poll, not the whole ring.live_get'supdated_s(else the newest sample time), the same clock the error totals reset on.uptime_strails it by 28 s in the capture, so it is likely the daemon's age: a daemon restart would read as a reboot.since, or error totals.Not yet verified on a device
session.logincall follows the spec and OpenWrt's standard, but no capture shows it.live_get: on the first poll,since: 0may return the whole ring once. The capture has no reply to show its size._psvalue has not been seen.Tests
PeterPonOntProviderTests: 45 tests. The fixtures are the capturedstatus,info, andlive_getreplies, with the GPON serial and service VLANs replaced by generic values. A loopback ubus stub covers:luci.gponluci.gponsincetracking across pollssince, and totals alone