Trouble adding a new instance - bridge

Running GenieACS 1.1.3, using provisions to populate and configure devices.

Trying to add an new instance to a device (add new bridge on managed device), but cannot figure out what I am doing wrong.

This should work, right?
declare(“Device.Bridging.Bridge”, { path: 1}, { path: 1});

But, provisions script behaves as this line is missing.

Deleting bridges, no issue, changing values in existing, no issue, adding a new one - nope! :slightly_frowning_face:

Can read and set any existing variable, but to create (add) a bridge, not possible.

Doing it (adding a bridge) via GUI, no issue, works as expected.

HELP?

Regards.

What I determined so far:

  1. above declare was missing “.*”
  2. value part (3rd parameter) looks like it represents the number of instances you require, so specifiying “{ path: 3}” will make sure I get 3 (three) Bridge instances - if current config contains less than 3, missing will be created, if more than 3 exist, those with highest numbers will be removed.

Still having trouble how to list all present instances, as I cannot be 100% sure, that instance numbers are sequential. For example, first deleting instance #3 and than adding a new one, the sequential number of newly added instance is NOT 3, but 4. And if I keep repeating delete + add (for whatever reason), resulting instance numbers can look like 1,2,15, not 1,2.3.
Yes, factory reset “solves” this “issue”, but… Not a preferred method of “doing business”.

New issue: how do I examine what declare returned? Normal iteration just does nothing. Logging the returned value returns “[object Object]”, but have not find a way to retrieve Object keys/parameters/properties. Should behave as an JS object, but it does not… :confused:

I did check debug logs and device does return a range of values, I just don’t seem to find how to read those values in Provisions script.

Am I really the only one with these issues? What am I doing wrong?

Regards.

When you add instances with the declare, the return object is an iterator. You can iterate over it with “for” (in the example I declare I want 3 bridges … if there is only one on the device it will add 2; if there are 4, it will delete 1 … etc):

let bridges = declare(“Device.Bridging.Bridge.*”, null, { path: 3});
for (let i of bridges) {
console.log(i.path);
}

this will log all 3 existing paths, like so:
Device.Bridging.Bridge.1
Device.Bridging.Bridge.5
Device.Bridging.Bridge.15

1 Like