fix(wan): read the uplink from the gateway's status page (#29)

get_wan_status built its answer from WanIp, WanAccessType,
SystemUpTime, MaxUpstream and MaxDownstream in getBasicInformation.
A VMG4005-B50A sends none of them there, so every gateway's uplink
read as down, with no address and no sync rate; get_nat_translations
built inside_global from the same WanIp and reported ":<port>".

Both now read the DAL's cardpage_status. A bridge has no WAN address
of its own, so it is connected when its DSL line is in sync (a
DslChannelInfo entry with Status "Up"); a router is connected when a
WAN interface that is not IP_Bridged is up with an address. The sync
rates are those of the channels in sync, added up for bonded lines;
a channel out of sync keeps its last rates, which are not reported.
A translation without a WAN address goes to 0.0.0.0, and without
enabled port forwards the status page is not read at all.

The tests read the recorded, anonymised status page of a
VMG4005-B50A bridge whose line was not in sync; the in-sync and
router states are derived from it.

Closes #29
This commit is contained in:
Christian Manivong committed 2026-11-12 19:05:48 +01:00
1 parent a47f9c3970
commit 3213dfaaaa
7 files changed
+672 -28

No files matched your search

@@ -0,0 +1,357 @@
{
"result": "ZCFG_SUCCESS",
"ReplyMsg": "DeviceSource",
"ReplyMsgMultiLang": "",
"Object": [
{
"WanLanInfo": [
{
"Enable": true,
"IpIfacePath": "IP.Interface.1",
"wanIdx": 1,
"BindToIntfGrp": false,
"X_ZYXEL_Type": "LAN",
"Encapsulation": "",
"MACAddress": "6c:4f:89:00:00:50",
"LowerlayerUp": "",
"pppConnectionStatus": "",
"wanpppIdx": 0,
"DHCPtr181Path": "Device.DHCPv4.Server.Pool.1",
"Status": "Up",
"X_ZYXEL_ConnectionType": "IP_Routed",
"X_ZYXEL_SrvName": "Default",
"Name": "LAN",
"Type": "Normal",
"IPv4Enable": true,
"IPv6Enable": false,
"X_ZYXEL_IfName": "br0",
"X_ZYXEL_UpTime": 13554113,
"IPv6Origin": "DelegateFromWan",
"IPv6PrefixDelegateWAN": "Default",
"X_ZYXEL_DefaultGatewayIface": false,
"X_ZYXEL_IPv6LocalAddress": "fe80::6e4f:89ff:fe00:50",
"IPv4Address": [
{
"Enable": true,
"Alias": "",
"IPAddress": "192.0.2.1",
"SubnetMask": "255.255.255.248",
"Status": "Enabled",
"AddressingType": "Static",
"X_ZYXEL_IfName": "",
"X_ZYXEL_Alias": false,
"X_ZYXEL_Dhcp4Subnet_Ref": "",
"ipIfaceIdx": 1
}
],
"IPv6Address": [],
"IPv6Prefix": [],
"v4Gateway": "192.0.2.2",
"dnsv4Server": [],
"dnsv6Server": [],
"rtinfoIntf": [],
"ipoeConnectionUpTime": 13554213,
"BridgingBrPath": "Bridging.Bridge.1",
"Group_WAN_IpIface": "",
"DHCPStatus": "Disable",
"Gateway": "",
"LeaseTime": 0,
"LeaseTimeRemaining": 0,
"DHCPoption42Enable": false,
"DHCPoption43Enable": false,
"DHCPoption60Enable": false,
"DHCPoption42Value": "",
"DHCPoption43Value": "",
"DHCPoption60Value": ""
},
{
"Enable": true,
"IpIfacePath": "IP.Interface.2",
"wanIdx": 2,
"BindToIntfGrp": false,
"X_ZYXEL_Type": "WAN",
"Encapsulation": "IPoE",
"MACAddress": "",
"LowerlayerUp": "",
"pppConnectionStatus": "",
"wanpppIdx": 0,
"DHCPtr181Path": "",
"X_ZYXEL_ConnectionType": "IP_Bridged",
"X_ZYXEL_SrvName": "Bridge_ATM",
"Name": "WAN",
"Type": "Normal",
"IPv4Enable": false,
"IPv6Enable": false,
"X_ZYXEL_IfName": "atm0.1",
"IPv6Origin": "",
"IPv6PrefixDelegateWAN": "Default",
"X_ZYXEL_DefaultGatewayIface": false,
"X_ZYXEL_IPv6LocalAddress": "",
"IPv4Address": [],
"IPv6Address": [],
"IPv6Prefix": [],
"dnsv4Server": [],
"dnsv6Server": [],
"rtinfoIntf": [],
"ipoeConnectionUpTime": 0,
"LinkType": "ATM",
"DHCPStatus": "Disable",
"Gateway": "",
"LeaseTime": 0,
"LeaseTimeRemaining": 0,
"DHCPoption42Enable": false,
"DHCPoption43Enable": false,
"DHCPoption60Enable": false,
"DHCPoption42Value": "",
"DHCPoption43Value": "",
"DHCPoption60Value": ""
},
{
"Enable": true,
"IpIfacePath": "IP.Interface.3",
"wanIdx": 3,
"BindToIntfGrp": false,
"X_ZYXEL_Type": "WAN",
"Encapsulation": "IPoE",
"MACAddress": "",
"LowerlayerUp": "",
"pppConnectionStatus": "",
"wanpppIdx": 0,
"DHCPtr181Path": "",
"Status": "LowerLayerDown",
"X_ZYXEL_ConnectionType": "IP_Bridged",
"X_ZYXEL_SrvName": "Bridge_PTM",
"Name": "WAN",
"Type": "Normal",
"IPv4Enable": false,
"IPv6Enable": false,
"X_ZYXEL_IfName": "ptm0.2",
"X_ZYXEL_UpTime": 0,
"IPv6Origin": "",
"IPv6PrefixDelegateWAN": "Default",
"X_ZYXEL_DefaultGatewayIface": false,
"X_ZYXEL_IPv6LocalAddress": "",
"IPv4Address": [],
"IPv6Address": [],
"IPv6Prefix": [],
"dnsv4Server": [],
"dnsv6Server": [],
"rtinfoIntf": [],
"ipoeConnectionUpTime": 0,
"LinkType": "PTM",
"DHCPStatus": "Disable",
"Gateway": "",
"LeaseTime": 0,
"LeaseTimeRemaining": 0,
"DHCPoption42Enable": false,
"DHCPoption43Enable": false,
"DHCPoption60Enable": false,
"DHCPoption42Value": "",
"DHCPoption43Value": "",
"DHCPoption60Value": ""
}
],
"DeviceInfo": {
"Manufacturer": "ZYXEL",
"ManufacturerOUI": "6C4F89",
"FixManufacturerOUI": "",
"ModelName": "VMG4005-B50A",
"Description": "VDSL2 17a Bonding and 35b Single Line Bridge",
"ProductClass": "VMG4005-B50A",
"SerialNumber": "S000Y00000001",
"HardwareVersion": "VMG4005-B50A",
"SoftwareVersion": "V5.17(ABQA.3.1)C0",
"AdditionalHardwareVersion": "",
"AdditionalSoftwareVersion": "",
"ProvisioningCode": "",
"X_ZYXEL_ProvisioningCodeIntf": "",
"X_ZYXEL_ProvisioningKey": "",
"X_ZYXEL_GponSerialNumber": "",
"X_ZYXEL_Ploam_Password": "",
"UpTime": 13554213,
"FirstUseDate": "0001-01-01T00:00:00Z",
"VendorConfigFileNumberOfEntries": 0,
"SupportedDataModelNumberOfEntries": 0,
"ProcessorNumberOfEntries": 0,
"VendorLogFileNumberOfEntries": 0,
"LocationNumberOfEntries": 0,
"BootVersion": "",
"WiFiDriverVersion": "",
"DSLVersion": ""
},
"LanPortInfo": {
"LanMac": "6c:4f:89:00:00:53",
"ethPortExist": false
},
"Dhcp4SerPoolInfo": {
"Enable": false,
"X_ZYXEL_SetEnable": false,
"X_ZYXEL_AutoReserveLanIp": false,
"Status": "Enabled",
"Alias": "",
"Order": 1,
"Interface": "IP.Interface.1",
"VendorClassID": "",
"VendorClassIDExclude": false,
"VendorClassIDMode": "",
"ClientID": "",
"ClientIDExclude": false,
"UserClassID": "",
"ChaddrExclude": false,
"Chaddr": "",
"ChaddrMask": "",
"MinAddress": "192.0.2.2",
"MaxAddress": "192.0.2.254",
"ReservedAddresses": "",
"SubnetMask": "255.255.255.0",
"DNSServers": "192.0.2.1",
"X_ZYXEL_ServerConfigurable": true,
"X_ZYXEL_DNS_Type": "DNS Proxy",
"DomainName": "",
"IPRouters": "",
"LeaseTime": 86400,
"X_ZYXEL_STB_VENDORID": "",
"X_ZYXEL_STB_URL": "",
"X_ZYXEL_STB_PrCode": "",
"X_ZYXEL_STB_URL_subcode": 1,
"X_ZYXEL_STB_PrCode_subcode": 2,
"StaticAddressNumberOfEntries": 0,
"OptionNumberOfEntries": 0,
"ClientNumberOfEntries": 0
},
"LanInfo": [
{
"Enable": true,
"Status": "Up",
"Alias": "",
"Name": "eth1",
"LastChange": 13554195,
"LowerLayers": "",
"Upstream": false,
"MACAddress": "6c:4f:89:00:00:53",
"IntfEnable": true,
"IntfStatus": "Up",
"MaxBitRate": 1000,
"DuplexMode": "Full",
"EEECapability": false,
"EEEEnable": true,
"X_ZYXEL_DuplexMode": "Auto",
"X_ZYXEL_MaxBitRate": -1,
"X_ZYXEL_LanPort": "LAN1",
"X_ZYXEL_SFP": false,
"X_ZYXEL_SwitchToWAN": false,
"X_ZYXEL_Upstream": false,
"X_ZYXEL_UpTime": 13554195,
"X_ZYXEL_LastChangeTime": 18
}
],
"DslChannelInfo": [
{
"Enable": true,
"Status": "Down",
"Alias": "",
"Name": "",
"LastChange": 0,
"LowerLayers": "DSL.Line.1",
"LinkEncapsulationSupported": "G.992.3_Annex_K_ATM",
"LinkEncapsulationUsed": "G.992.3_Annex_K_ATM",
"LPATH": 0,
"INTLVDEPTH": 0,
"INTLVBLOCK": 0,
"ActualInterleavingDelay": 0,
"ACTINP": 0,
"INPREPORT": false,
"NFEC": 0,
"RFEC": 0,
"LSYMB": 0,
"UpstreamCurrRate": 0,
"DownstreamCurrRate": 0,
"DSLUpTime": "",
"X_ZYXEL_BondingLineNumber": 0
},
{
"Enable": true,
"Status": "LowerLayerDown",
"Alias": "",
"Name": "",
"LastChange": 0,
"LowerLayers": "DSL.Line.1",
"LinkEncapsulationSupported": "G.992.3_Annex_K_PTM",
"LinkEncapsulationUsed": "G.992.3_Annex_K_PTM",
"LPATH": 0,
"INTLVDEPTH": 0,
"INTLVBLOCK": 0,
"ActualInterleavingDelay": 0,
"ACTINP": 0,
"INPREPORT": false,
"NFEC": 0,
"RFEC": 0,
"LSYMB": 0,
"UpstreamCurrRate": 0,
"DownstreamCurrRate": 0,
"DSLUpTime": "",
"X_ZYXEL_BondingLineNumber": 0
},
{
"Enable": true,
"Status": "Down",
"Alias": "",
"Name": "",
"LastChange": 0,
"LowerLayers": "DSL.Line.2",
"LinkEncapsulationSupported": "G.992.3_Annex_K_ATM",
"LinkEncapsulationUsed": "G.992.3_Annex_K_ATM",
"LPATH": 0,
"INTLVDEPTH": 0,
"INTLVBLOCK": 0,
"ActualInterleavingDelay": 0,
"ACTINP": 0,
"INPREPORT": false,
"NFEC": 0,
"RFEC": 0,
"LSYMB": 0,
"UpstreamCurrRate": 0,
"DownstreamCurrRate": 0,
"DSLUpTime": "",
"X_ZYXEL_BondingLineNumber": 1
},
{
"Enable": true,
"Status": "LowerLayerDown",
"Alias": "",
"Name": "",
"LastChange": 0,
"LowerLayers": "DSL.Line.2",
"LinkEncapsulationSupported": "G.992.3_Annex_K_PTM",
"LinkEncapsulationUsed": "G.992.3_Annex_K_PTM",
"LPATH": 0,
"INTLVDEPTH": 0,
"INTLVBLOCK": 0,
"ActualInterleavingDelay": 0,
"ACTINP": 0,
"INPREPORT": false,
"NFEC": 0,
"RFEC": 0,
"LSYMB": 0,
"UpstreamCurrRate": 45875,
"DownstreamCurrRate": 274098,
"DSLUpTime": "",
"X_ZYXEL_BondingLineNumber": 1
}
],
"OptIntfInfo": [],
"GponStatsInfo": {
"RxPowerSignal": "0",
"TxPowerSignal": "0",
"Temperature": "0",
"SFP_Vendor": "",
"SFP_Model": "",
"SFP_Serial": "",
"SFP_Presence": false
},
"WanType": "",
"WanRate_RX": "",
"WanRate_TX": ""
}
]
}