refreshObject inconsistency

from a provisioning script, the following does the minimum number of getParameterNames calls:

declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANIPConnection.*", {path:})

How I can achieve the same thing via the API methods? In the v1.2.0 I managed to do this using:

{"name": "refreshObject", 
 "objectName": "InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANIPConnection."}

but on the latest version, it gives me a error:
faultCode=“script.Error” faultMessage=“Invalid parameter path”

and any other combination, just refreshes all child nodes exhaustive which is not optimal and without purpose.

There is no inconsistency. This is by design. Because provision scripts and the API are designed for two different scenarios. One for setting up a CPE (provision scripts), and one for getting/setting/refreshing specific values.

To accomplish the same things, you will need to do this, repeated for every instance of WANDevice:

{"name": "refreshObject", 
 "objectName": "InternetGatewayDevice.WANDevice.1.WANConnectionDevice"}

Are you in a situation where the WANIPConnection instances are changing or your code not knowing about them?

I’ve tried that also but on the latest version is making a lot more unnecessary requests:

Inform; cpeRequestId="107" informEvent="6 CONNECTION REQUEST" informRetryCount=0
ACS request; acsRequestId="177654754560000" acsRequestName="GetParameterNames"
ACS request; acsRequestId="177654754560001" acsRequestName="GetParameterValues"
ACS request; acsRequestId="177654754560002" acsRequestName="GetParameterValues"
ACS request; acsRequestId="177654754560003" acsRequestName="GetParameterValues"
ACS request; acsRequestId="177654754560004" acsRequestName="GetParameterValues"
ACS request; acsRequestId="177654754560005" acsRequestName="GetParameterValues"
ACS request; acsRequestId="177654754560006" acsRequestName="GetParameterValues"
ACS request; acsRequestId="177654754560007" acsRequestName="GetParameterValues"
ACS request; acsRequestId="177654754560008" acsRequestName="GetParameterValues"
ACS request; acsRequestId="177654754560009" acsRequestName="GetParameterValues"
ACS request; acsRequestId="17765475456000a" acsRequestName="GetParameterValues"
ACS request; acsRequestId="17765475456000b" acsRequestName="GetParameterValues"

From a packet capture, after I make the API call just as you said, this is the stripped “conversation”:


  <ParameterList SOAP-ENC:arrayType="cwmp:ParameterInfoStruct[418]">
... 1000+ more lines

  <ParameterNames soap-enc:arrayType="xsd:string[32]">

  <ParameterList SOAP-ENC:arrayType="cwmp:ParameterValueStruct[32]">
      <Value xsi:type="xsd:string">DHCP</Value>

I think the GetParameterNames should have NextLevel =1 and after it it should skip all the GetParameterValues RPC’s.

The problem is with all objects, the WANIPConnection was just an example … but yes, these instances could change directly on the device and I need to refresh them on demand, and I do this via API but this no longer works the way it did in the previous version I tested (v1.2.0-beta).

This task should do the trick:

    "name": "provisions",
    "provisions": [["refresh", "InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANIPConnection.*", 1, false, "path"]]

Here ‘refresh’ is a default built-in provision that accepts arguments the following arguments:

<path: string>, <seconds: number>, <refreshChildren: boolean>, <attr: string>, [<attr: string>, ...]

1 Like

Hi @zaidka ,

sorry for replying to this old thread, I did try this back then but received an error (“Task name not recognized”) since I was using a older version of genieacs. But I’ve test this now on the latest branch and it throws this error in the cwmp logs:

genieacs-cwmp[23686]: 2021-05-21T11:35:57.737Z [ERROR] Uncaught exception; pid=31671 exceptionName=“TypeError”
exceptionMessage=“Cannot read property ‘add’ of undefined”
exceptionStack=“TypeError: Cannot read property ‘add’ of undefined
at c (/opt/genieacs/dist/bin/genieacs-cwmp:2:87065)
at c (/opt/genieacs/dist/bin/genieacs-cwmp:2:87513)
at c (/opt/genieacs/dist/bin/genieacs-cwmp:2:87513)
at c (/opt/genieacs/dist/bin/genieacs-cwmp:2:87513)
at c (/opt/genieacs/dist/bin/genieacs-cwmp:2:87513)
at c (/opt/genieacs/dist/bin/genieacs-cwmp:2:87513)
at c (/opt/genieacs/dist/bin/genieacs-cwmp:2:87513)
at c (/opt/genieacs/dist/bin/genieacs-cwmp:2:87513)
at /opt/genieacs/dist/bin/genieacs-cwmp:2:87551
at Qs (/opt/genieacs/dist/bin/genieacs-cwmp:2:87571)”

genieacs-cwmp[23686]: 2021-05-21T11:35:57.804Z [ERROR] Worker died; pid=31671 exitCode=0

From a packet capture on the NBI port this is the request:

POST /devices/DEVICESN/tasks/?timeout=3&connection_request HTTP/1.1
Accept: */*
content-type: application/json
Content-Length: 139


and this is the response I get, right before the error:

HTTP/1.1 202 Task queued but not processed
GenieACS-Version: 1.2.5+20210521105922
Content-Type: application/json
Date: Fri, 21 May 2021 11:40:42 GMT
Connection: keep-alive
Transfer-Encoding: chunked


I’m doing it wrong? can you give me a hint where is the problem?
thank you!

The stack trace seems to indicate that this is a bug that has nothing to do with the structure of the task object. Can you confirm whether you installed it from npm or from source and whether you have made any potentially changes to the code?

FYI, you can pass the following environment variable to enable source map support for better stack traces:


Hi Zaidka,
I’ve installed it from source and I didn’t change anything notable (I’ve run npm audit fix which just changed the version of some dependencies in the package.json and npm-shrinkwrap.json: postcss , hosted-git-info , nanoid, source-map-js).

Thank you very much for the source map hint, I din’t knew about it and enabling it helped me to spot the issue. The stack traces now pointed to the exact location from the source code:


The line that triggered the error was this one:


and since the definition of refreshAttributes object didn’t contained a “path” attribute, I’ve changed the call to the NBI to use “value” instead:


and now it works as expected.

Thank you!

Good catch! Will fix it such that something like can never cause an exception and crash the process.