VirtualParameter Refresh ERROR

Good Afternoon everyone,

We have a VirtualParameter configured as so (based on the MAC Address Example on the Wiki):

let ip = "0.0.0.0";
declare("Device.WANDevice.*", {value: Date.now()});
declare("InternetGatewayDevice.WANDevice.*", {value: Date.now()});
//commit();
let d = declare("Device.WANDevice.*.WANConnectionDevice.*.WANIPConnection.*.ExternalIPAddress", {value: Date.now()});
let igd = declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANIPConnection.*.ExternalIPAddress", {value: Date.now()});

if (d.size) {
  for (let p of d) {
    if (p.value[0]) {
      ip = p.value[0];
      break;
    }
  }
}
else if (igd.size) {
  for (let p of igd) {
    if (p.value[0]) {
      ip = p.value[0];
      break;
    }
  }
}
return {writable: false, value: [ip, "xsd:string"]};

With this VirtualParameter we check to see the Value of the External IP address of a WANDevice, independently of what Instance it is.

The problem we are having is that our device changes from Instance WANConnectionDevice.1… to WANConnectionDevice.2… whenever it wants to (hence the VirtualParameter).
When our Provisioning Script calls the VirtualParameter it checks all of the ExternalIPAddress which is fine, the problem is that GenieACS thinks that WANConnectionDevice.1… still exists when it is now WANConnectionDevice.2… so the Provisioning Script gives us a fault.

We tried to fix this by adding the first 2 declares to “refresh” the current WAN Values, but it doesn’t seem to do the trick. If we access the Device Page and refresh “InternetGatewayDevice.WANDevice” manually it works just fine, but we want to automate this process.

Before:
imagen

After:
imagen

We have also tried adding the “refresh” in our Provisioning script (not the VirtualParameter) and the same thing happens.

Does anybody have an idea?
(Running GenieACS 1.1.3 instead of 1.2.0_beta)

Thanks,
James

Change your the top of your script to this:

let ip = "0.0.0.0";
const now = Date.now();

let d = declare("Device.WANDevice.*.WANConnectionDevice.*.WANIPConnection.*.ExternalIPAddress", {path: now, value: now});
let igd = declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANIPConnection.*.ExternalIPAddress", {path: now, value: now});

The path: now part of the second argument tells Genie to verify that the paths still exist on the CPE.

-dan

1 Like

Hi Dan,

Thank you for the incredibly quick response.
With the path argument it works like a charm.

Thanks!
James