# How to set Virtual Parameters

**URL:** <https://forum.genieacs.com/t/how-to-set-virtual-parameters/6680>\
**Category:** Uncategorized\
**Created:** [March 21, 2025, 2:14pm UTC](https://forum.genieacs.com/t/how-to-set-virtual-parameters/6680 "2025-03-21T14:14:31Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![not.genieacs\_scholar](https://avatars.discourse-cdn.com/v4/letter/n/a5b964/32.png) [@not.genieacs\_scholar](https://forum.genieacs.com/u/not.genieacs_scholar)\
**Post date:** [March 21, 2025, 2:14pm UTC](https://forum.genieacs.com/t/how-to-set-virtual-parameters/6680/1 "2025-03-21T14:14:31Z")

</div>

Hi everyone,

I have difficulty creating virtual parameters. I want to unify my device connection usernames in GenieACS under one virtual parameter. The script works without issues for most of devices, but not for all devices.

I created a virtual parameter as follows:

- Name: “User”
- Script:

```js
let username;

let d = declare("Device.ManagementServer.Username", { value: Date.now() });
let igd = declare("InternetGatewayDevice.ManagementServer.Username", { value: Date.now() });

if (d.size && d.value[0]) {
  username = d.value[0];
} else if (igd.size && igd.value[0]) {
  username = igd.value[0];
}

if (typeof username === "string") {
  return { writable: true, value: [username, "xsd:string"] };
} else {
  return { writable: true, value: ["errusername", "xsd:string"] };
}

```

The error I get on some devices:

```sh
faultCode: "9003"
faultString: Invalid arguments
setParameterValuesFault: null

```

I also tried to return just a hard coded virtual parameter:

```js
return {writable: false, value: ["testuser", "xsd:string"]};

```

I placed the parameter declaration in `inform` for testing, and tried setting it as:

```js
declare("VirtualParameters.User", {path: Date.now(), value: Date.now()});

```

and as:

```auto
declare('VirtualParameters.User', {value: 1});

```

I would like to solve this for all devices (cpes). To have this in the device parameters  
I tried deleting devices and retrying as well.  
Thank you in all advance.

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [March 21, 2025, 6:16pm UTC](https://forum.genieacs.com/t/how-to-set-virtual-parameters/6680/2 "2025-03-21T18:16:38Z")

</div>

I’m not seeing from your vparam script any SPV’s. I don’t think the issue is with your vparam.  
Enable debug for the CPE in question to figure out what the CPE doesn’t like. There are instructions on the forum on how to enable debug.

---

<div class="post-metadata">

**Author:** ![not.genieacs\_scholar](https://avatars.discourse-cdn.com/v4/letter/n/a5b964/32.png) [@not.genieacs\_scholar](https://forum.genieacs.com/u/not.genieacs_scholar)\
**Post date:** [March 24, 2025, 10:15am UTC](https://forum.genieacs.com/t/how-to-set-virtual-parameters/6680/3 "2025-03-24T10:15:47Z")

</div>

Hi akcoder,

Thank you for the reply, this is the debug log I get:

```txt
  GNU nano 6.2 genieacs-cwmp-access.log                                                                                         
2025-03-24T10:31:07.272Z [INFO] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: Inform; cpeRequestId="4" informEvent="2 PERIODIC" informRetryCount=0
2025-03-24T10:31:07.466Z [INFO] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: ACS request; acsRequestId="195c7b4c1f80000" acsRequestName="GetParameterNames"
2025-03-24T10:31:07.671Z [INFO] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: ACS request; acsRequestId="195c7b4c1f80001" acsRequestName="GetParameterNames"
2025-03-24T10:31:07.865Z [INFO] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: ACS request; acsRequestId="195c7b4c1f80002" acsRequestName="GetParameterNames"
2025-03-24T10:31:08.059Z [INFO] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: ACS request; acsRequestId="195c7b4c1f80003" acsRequestName="GetParameterNames"
2025-03-24T10:31:08.254Z [INFO] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: ACS request; acsRequestId="195c7b4c1f80004" acsRequestName="GetParameterNames"
2025-03-24T10:31:08.448Z [INFO] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: ACS request; acsRequestId="195c7b4c1f80005" acsRequestName="GetParameterNames"
2025-03-24T10:31:08.641Z [INFO] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: ACS request; acsRequestId="195c7b4c1f80006" acsRequestName="GetParameterNames"
2025-03-24T10:31:08.840Z [INFO] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: ACS request; acsRequestId="195c7b4c1f80007" acsRequestName="GetParameterNames"
2025-03-24T10:31:09.035Z [INFO] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: ACS request; acsRequestId="195c7b4c1f80008" acsRequestName="GetParameterNames"
2025-03-24T10:31:09.230Z [INFO] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: ACS request; acsRequestId="195c7b4c1f80009" acsRequestName="GetParameterNames"
2025-03-24T10:31:09.644Z [INFO] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: ACS request; acsRequestId="195c7b4c1f8000a" acsRequestName="GetParameterNames"
2025-03-24T10:31:09.872Z [INFO] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: ACS request; acsRequestId="195c7b4c1f8000b" acsRequestName="GetParameterNames"
2025-03-24T10:31:10.102Z [INFO] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: ACS request; acsRequestId="195c7b4c1f8000c" acsRequestName="GetParameterNames"
2025-03-24T10:31:10.332Z [INFO] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: ACS request; acsRequestId="195c7b4c1f8000d" acsRequestName="GetParameterNames"
2025-03-24T10:31:10.525Z [INFO] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: ACS request; acsRequestId="195c7b4c1f8000e" acsRequestName="GetParameterValues"
2025-03-24T10:31:10.722Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: Missing parameter in response; parameter="InternetGatewayDevice.LANDevice.1.WLANConfiguration>
2025-03-24T10:31:10.722Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: Missing parameter in response; parameter="InternetGatewayDevice.LANDevice.1.WLANConfiguration>
2025-03-24T10:31:10.722Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: Missing parameter in response; parameter="InternetGatewayDevice.LANDevice.1.WLANConfiguration>
2025-03-24T10:31:10.722Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: Missing parameter in response; parameter="InternetGatewayDevice.LANDevice.1.WLANConfiguration>
2025-03-24T10:31:10.722Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: Missing parameter in response; parameter="InternetGatewayDevice.LANDevice.1.WLANConfiguration>
2025-03-24T10:31:10.722Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: Missing parameter in response; parameter="InternetGatewayDevice.LANDevice.1.WLANConfiguration>
2025-03-24T10:31:10.726Z [INFO] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: ACS request; acsRequestId="195c7b4c1f8000f" acsRequestName="GetParameterNames"
2025-03-24T10:31:11.329Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: CPE fault; acsRequestId="195c7b4c1f8000f" cpeFaultCode="9003" cpeFaultString="Invalid argumen>
2025-03-24T10:31:11.329Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: Channel has faulted; channel="default" retries=0 faultCode="cwmp.9003" faultMessage="Invalid >
2025-03-24T10:31:11.329Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: Channel has faulted; channel="inform" retries=0 faultCode="cwmp.9003" faultMessage="Invalid a>
2025-03-24T10:31:11.342Z [INFO] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: ACS request; acsRequestId="195c7b4c1f80200" acsRequestName="GetParameterNames"
2025-03-24T10:31:11.535Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: CPE fault; acsRequestId="195c7b4c1f80200" cpeFaultCode="9003" cpeFaultString="Invalid argumen>
2025-03-24T10:31:11.535Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: Channel has faulted; channel="inform" retries=1 faultCode="cwmp.9003" faultMessage="Invalid a>
2025-03-24T10:31:11.561Z [INFO] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: New device registered

```

All of my provision scripts are reverted to default with addition of this virtual parameter declaration.

Inform:

```js
// Device ID as user name
const username = declare("DeviceID.ID", {value: 1}).value[0]

//// Password will be fixed for a given device because Math.random() is seeded with device ID by default.
const password = Math.trunc(Math.random() * Number.MAX_SAFE_INTEGER).toString(36);

const informInterval = 300;

// Refresh values daily
const daily = Date.now(86400000);

// Unique inform offset per device for better load distribution
const informTime = daily % 86400000;

declare("InternetGatewayDevice.ManagementServer.ConnectionRequestUsername", {value: daily}, {value: username});
declare("InternetGatewayDevice.ManagementServer.ConnectionRequestPassword", {value: daily}, {value: password});
declare("InternetGatewayDevice.ManagementServer.PeriodicInformEnable", {value: daily}, {value: true});
declare("InternetGatewayDevice.ManagementServer.PeriodicInformInterval", {value: daily}, {value: informInterval});
declare("InternetGatewayDevice.ManagementServer.PeriodicInformTime", {value: daily}, {value: informTime});

declare("Device.ManagementServer.ConnectionRequestUsername", {value: daily}, {value: username});
declare("Device.ManagementServer.ConnectionRequestPassword", {value: daily}, {value: password});
declare("Device.ManagementServer.PeriodicInformEnable", {value: daily}, {value: true});
declare("Device.ManagementServer.PeriodicInformInterval", {value: daily}, {value: informInterval});
declare("Device.ManagementServer.PeriodicInformTime", {value: daily}, {value: informTime});

declare("VirtualParameters.User", {path: Date.now(), value: Date.now()});

```

default

```js
const hourly = Date.now(3600000);

// Refresh basic parameters hourly
declare("InternetGatewayDevice.DeviceInfo.HardwareVersion", {path: hourly, value: hourly});
declare("InternetGatewayDevice.DeviceInfo.SoftwareVersion", {path: hourly, value: hourly});
declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANIPConnection.*.MACAddress", {path: hourly, value: hourly});
declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANIPConnection.*.ExternalIPAddress", {path: hourly, value: hourly});
declare("InternetGatewayDevice.LANDevice.*.WLANConfiguration.*.SSID", {path: hourly, value: hourly});
// Don't refresh password field periodically because CPEs always report blank passowrds for security reasons
declare("InternetGatewayDevice.LANDevice.*.WLANConfiguration.*.KeyPassphrase", {path: hourly, value: 1});
declare("InternetGatewayDevice.LANDevice.*.Hosts.Host.*.HostName", {path: hourly, value: hourly});
declare("InternetGatewayDevice.LANDevice.*.Hosts.Host.*.IPAddress", {path: hourly, value: hourly});
declare("InternetGatewayDevice.LANDevice.*.Hosts.Host.*.MACAddress", {path: hourly, value: hourly});

```

bootstrap

```auto
const now = Date.now();

// Clear cached data model to force a refresh
clear("Device", now);
clear("InternetGatewayDevice", now);

```

Any advice is much appreciated.

Thanks again.

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [March 24, 2025, 5:01pm UTC](https://forum.genieacs.com/t/how-to-set-virtual-parameters/6680/4 "2025-03-24T17:01:18Z")

</div>

You are missing the forest for the trees. The issue is not with your vparam or inform script.

```auto
2025-03-24T10:31:10.722Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: Missing parameter in response; parameter="InternetGatewayDevice.LANDevice.1.WLANConfiguration>
2025-03-24T10:31:10.722Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: Missing parameter in response; parameter="InternetGatewayDevice.LANDevice.1.WLANConfiguration>
2025-03-24T10:31:10.722Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: Missing parameter in response; parameter="InternetGatewayDevice.LANDevice.1.WLANConfiguration>
2025-03-24T10:31:10.722Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: Missing parameter in response; parameter="InternetGatewayDevice.LANDevice.1.WLANConfiguration>
2025-03-24T10:31:10.722Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: Missing parameter in response; parameter="InternetGatewayDevice.LANDevice.1.WLANConfiguration>
2025-03-24T10:31:10.722Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: Missing parameter in response; parameter="InternetGatewayDevice.LANDevice.1.WLANConfiguration>
2025-03-24T10:31:10.726Z [INFO] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: ACS request; acsRequestId="195c7b4c1f8000f" acsRequestName="GetParameterNames"
2025-03-24T10:31:11.329Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: CPE fault; acsRequestId="195c7b4c1f8000f" cpeFaultCode="9003" cpeFaultString="Invalid argumen>
2025-03-24T10:31:11.329Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: Channel has faulted; channel="default" retries=0 faultCode="cwmp.9003" faultMessage="Invalid >
2025-03-24T10:31:11.329Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: Channel has faulted; channel="inform" retries=0 faultCode="cwmp.9003" faultMessage="Invalid a>
2025-03-24T10:31:11.342Z [INFO] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: ACS request; acsRequestId="195c7b4c1f80200" acsRequestName="GetParameterNames"
2025-03-24T10:31:11.535Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: CPE fault; acsRequestId="195c7b4c1f80200" cpeFaultCode="9003" cpeFaultString="Invalid argumen>
2025-03-24T10:31:11.535Z [WARN] ::ffff:103.173.170.61 8CC7C3-XPON%2B1GE%2B1FE%2B1POTS%2BWIFI-F32428CC7C3017243: Channel has faulted; channel="inform" retries=1 faultCode="cwmp.9003" faultMessage="Invalid a>

```

---

<div class="post-metadata">

**Author:** ![not.genieacs\_scholar](https://avatars.discourse-cdn.com/v4/letter/n/a5b964/32.png) [@not.genieacs\_scholar](https://forum.genieacs.com/u/not.genieacs_scholar)\
**Post date:** [March 26, 2025, 9:27am UTC](https://forum.genieacs.com/t/how-to-set-virtual-parameters/6680/5 "2025-03-26T09:27:30Z")

</div>

Looks like when I delete everything but the Virtual Parameters from the inform provision the errors go away, and the VirtualParameter appears on the device.

So I suppose that I need to adjust the inform with if blocks to avoid this issue.  
Something like the following pseudo code:

```js
if (device_software_versions != "device_with_errors"){
declare....
}
// other shared code

```

Thanks.
