Create new instance WAN (NBI)

Good morning friends, I would like some help if possible, I need to create a new wan instance (voip) through the api (nbi) but through AddObject it does not work like in ACS Ex:


Do you know if there would be any other alternative?

Using AddObject you are not guaranteed an instance ID. So I avoid this approach.

This is some pseudocode you can string together to accomplish your goal via a provision script. The paths in here are not valid. Thats for you to fill in:

  declare('InternetGatewayDevice.Voip.*', {value: now, path: now}); // Refresh everything
  declare('InternetGatewayDevice.Voip.[]', null, {path: 0}); // Remove all instance (no changes are actually made until the end of the provision script)

const sn = declare('Device.SerialNumber', {value: 1})[0];
const voipData = ext('myScript', 'voipSettingsFoSerialNumber', {serialNumber: sn});

declare(`InternetGatewayDevice.Voip.[PhoneNumber:${},AnotherParam:${voipData.anotherParam}]`, {path: 1}, {path: 1});

This will cause GenieACS to remove any existing voip information if it does not match the incoming voip data.

1 Like

That’s right, but is there no way for NBI to pass all the fields I need for creation?

Because I have a system with a screen that I wanted to create there without using provisioning.

There is always ways to do this with the NBI. But right now its not a simple step. You have to first addObject, then refresh all the params in that tree. Then figure out whats new, then update the new instance.

The way I handle stuff like this is by adding a tag to the router I want to do something with. Example, if I want to update the port forwards on a router I add the tag UpdatePortForwards then I initiate a connection request to the CPE and let my provision script take over.