# Trouble adding a new instance - bridge

**URL:** <https://forum.genieacs.com/t/trouble-adding-a-new-instance-bridge/688>\
**Category:** Uncategorized\
**Created:** [April 4, 2020, 11:11pm UTC](https://forum.genieacs.com/t/trouble-adding-a-new-instance-bridge/688 "2020-04-04T23:11:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![git-neo-si](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/git-neo-si/32/607_2.png) [@git-neo-si](https://forum.genieacs.com/u/git-neo-si)\
**Post date:** [April 4, 2020, 11:11pm UTC](https://forum.genieacs.com/t/trouble-adding-a-new-instance-bridge/688/1 "2020-04-04T23:11:25Z")

</div>

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! 🙁

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.

---

<div class="post-metadata">

**Author:** ![git-neo-si](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/git-neo-si/32/607_2.png) [@git-neo-si](https://forum.genieacs.com/u/git-neo-si)\
**Post date:** [April 8, 2020, 10:35am UTC](https://forum.genieacs.com/t/trouble-adding-a-new-instance-bridge/688/2 "2020-04-08T10:35:28Z")

</div>

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… 😕

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.

---

<div class="post-metadata">

**Author:** ![lavira](https://avatars.discourse-cdn.com/v4/letter/l/87869e/32.png) [@lavira](https://forum.genieacs.com/u/lavira)\
**Post date:** [April 27, 2020, 9:23am UTC](https://forum.genieacs.com/t/trouble-adding-a-new-instance-bridge/688/3 "2020-04-27T09:23:18Z")

</div>

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
