From 2cdb11ce2515c5db0410faf137019c971e4e9619 Mon Sep 17 00:00:00 2001 From: ATX Bot Date: Mon, 8 Jun 2026 17:19:31 +0200 Subject: [PATCH] IdleState now extracts parent paths from Inform parameters for GPN test. This classifies Inform params (writable vs read-only) and tests GPN support in one step. Falls back to data model root path if no Inform params available. All 791 tests pass. Build status: Success --- app/services/cwmp/main_state_machine.ts | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/app/services/cwmp/main_state_machine.ts b/app/services/cwmp/main_state_machine.ts index 5c7219c..4bd732f 100644 --- a/app/services/cwmp/main_state_machine.ts +++ b/app/services/cwmp/main_state_machine.ts @@ -59,7 +59,26 @@ class IdleState extends DeviceState { '[IdleState] GPN allowed — proceeding to discovery' ) - // Test GPN support using a single known path from the device's data model + // Extract unique parent paths from the Inform parameters to test GPN support + // and classify them (writable vs read-only). If GPN fails, the catalog will classify instead. + const allKnown = [...device.getParameters(), ...device.getProperties()] + const parentPaths = new Set() + for (const p of allKnown) { + if (!p?.name || typeof p.name !== 'string') continue + const lastDot = p.name.lastIndexOf('.') + if (lastDot > 0) { + parentPaths.add(p.name.substring(0, lastDot + 1)) + } + } + + // If we have paths from the Inform, use them for GPN test + classification + if (parentPaths.size > 0) { + const paths = Array.from(parentPaths).sort() + logger.info({ paths, deviceId: device.identifier }, '[IdleState] GPN test on Inform parameter paths') + return { nextState: new DiscoveringParametersState(paths), response: '' } + } + + // Fallback: use known data model root path const dataModel = device.dataModel if (dataModel === 'tr-181') { return { nextState: new DiscoveringParametersState(['Device.ManagementServer.']), response: '' }