SetParameterValues - Using Multiple Requests

Hello,
I have created a bunch of provisioning scripts which are working well, and I am now just going through the final process of optimizing them.

In the access log I see this:

2022-03-16T02:54:11.613Z [INFO] ::ffff:46.102.196.2 9c65ee-H660GM-DSNW2692fc78: ACS request; acsRequestId="17f90a49db1010a" acsRequestName="SetParameterValues"
2022-03-16T02:54:11.992Z [INFO] ::ffff:46.102.196.2 9c65ee-H660GM-DSNW2692fc78: ACS request; acsRequestId="17f90a49db1010b" acsRequestName="SetParameterValues"
2022-03-16T02:54:12.704Z [INFO] ::ffff:46.102.196.2 9c65ee-H660GM-DSNW2692fc78: ACS request; acsRequestId="17f90a49db1010c" acsRequestName="SetParameterValues"
2022-03-16T02:54:13.082Z [INFO] ::ffff:46.102.196.2 9c65ee-H660GM-DSNW2692fc78: ACS request; acsRequestId="17f90a49db1010d" acsRequestName="SetParameterValues"
2022-03-16T02:54:13.483Z [INFO] ::ffff:46.102.196.2 9c65ee-H660GM-DSNW2692fc78: ACS request; acsRequestId="17f90a49db1010e" acsRequestName="SetParameterValues"

…which is caused by this part of the script:

// Configure the WAN1 IP connection
  const values = {
    Add: true,
    Enable: true,
    NATEnabled: true,
    Name: "INTERNET_VOIP",
    AddressingType: "DHCP",
    ConnectionType: "IP_Dynamic"
  };
  
  for (let key of Object.keys(values))
  {
    let valuePath = "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1." + key;
    declare(valuePath, null, {value: values[key]});
  }

Why is this using multiple requests to set the values one at a time rather than batching them up into a single request?

I have also tried setting the 2nd param of the declare call to both of these:

{value: Date.now()}
{value: 1}

I have also tried prereading the parameters on the object before setting them:

declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1.*", {path: Date.now(), value: Date.now()});

Thanks!

as is, I do not think the number of requests is important as long as all the parameters reach the device and are properly set. This issue might only be important when a high number of cpe connect to the ACS after a blackout (happened to me during the past year, had to hack a lot to get around it).

and I’m not sure if this can help and might have no effect on what you want, but: have you read this?

https://docs.genieacs.com/en/latest/provisions.html#creating-deleting-object-instances

please do read the code example, specifically the declare with parameters between square brackets. You will have to tweak your code to generate a string and then use it on the declare() function.

if you try it let us know if there was a difference.

rm

@rudymartin Thank you. It is all working, it was more of a want to understand that scripts are being written correctly and efficiently.

I do use the square bracket method when creating new instances, but this is updating several values of an existing instance.

the mention I did about the square brackets was about using them inside the parameter key.

like this:

declare("InternetGatewayDevice.X_BROADCOM_COM_IPAddrAccCtrl.X_BROADCOM_COM_IPAddrAccCtrlListCfg.[SourceIPAddress:192.168.1.0,SourceNetMask:255.255.255.0]",  {path: now}, {path: 1});

I know, but that will always create a new instance (unless an instance with those two params set to those two values already exists).

That syntax doesn’t work for changing a bunch of values on an instance that already exists.