# Create/Delete objects

**URL:** <https://forum.genieacs.com/t/create-delete-objects/1714>\
**Category:** Uncategorized\
**Created:** [May 14, 2021, 7:54am UTC](https://forum.genieacs.com/t/create-delete-objects/1714 "2021-05-14T07:54:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jorge](https://avatars.discourse-cdn.com/v4/letter/j/9fc29f/32.png) [@Jorge](https://forum.genieacs.com/u/Jorge)\
**Post date:** [May 14, 2021, 7:54am UTC](https://forum.genieacs.com/t/create-delete-objects/1714/1 "2021-05-14T07:54:10Z")

</div>

Hello I want to open a new thread just to clarify for me and probably for more people how to deal with create/delete object in genieacs.  
I know that because of the nature of provision we can’t relay on the instance number, so to create a new one I use this on a particular CPE model and work just fine.

```auto
let d = declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.[]", null, {path: 3});
for (let instance of d){
	let vlan = declare(instance.path + ".X_TP_WANPonLinkConfig.VLANIDMark", {value: 1}).value[0];
	if (vlan == '-1'){
		let id = instance.path.slice(instance.path.lastIndexOf('.') + 1);
		declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice." + id + ".WANIPConnection.*", null, {path: 1});
		declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice." + id + ".WANIPConnection.1.Enable", {value: now}, {value: "true"});
		...

```

But how to proceed when I want to delete that instance? I know that if I do this:

```auto
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.[]", null, {path: 2});

```

the last instance on that branch is going to be remove, but there is nothing that really make that the removed one is the one that I want.  
(Of course if nobody has been messing with the cpe it’s going to be the last provisioned but…)  
I hope somebody can enlighten me about this situation.

And if there is a fastest trick to select by a parameter value something like:

```auto
let e = declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.*.X_TP_WANPonLinkConfig.[VLANIDMark:52]", {value: Date.now()})

```

or if it’s always needed to iterate on the whole branch?

Thank you.  
Regards. Jorge.

---

<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:** [May 14, 2021, 4:57pm UTC](https://forum.genieacs.com/t/create-delete-objects/1714/2 "2021-05-14T16:57:19Z")

</div>

The way to accomplish this is via what ever combination of param values make that instance unique.

Example if you wanted to delete the wan ip connection you’ve named “CustInternet” you would do this:

```auto
declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.WANConnectionDevice.*.WANIPConnection.[Name:CustInternet]", {path: 0});

```

---

<div class="post-metadata">

**Author:** ![Jorge](https://avatars.discourse-cdn.com/v4/letter/j/9fc29f/32.png) [@Jorge](https://forum.genieacs.com/u/Jorge)\
**Post date:** [May 14, 2021, 5:38pm UTC](https://forum.genieacs.com/t/create-delete-objects/1714/3 "2021-05-14T17:38:51Z")

</div>

As good as always man.  
Thank you very much.

---

<div class="post-metadata">

**Author:** ![Olen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/olen/32/969_2.png) [@Olen](https://forum.genieacs.com/u/Olen)\
**Post date:** [September 7, 2022, 1:40pm UTC](https://forum.genieacs.com/t/create-delete-objects/1714/4 "2022-09-07T13:40:02Z")

</div>

I know this is an old thread, but it’s the best I found.  
But I still can’t wrap my head around how this is supposed to work.  
If it is me who is missing something trivial, or if it is a bug in the version we are running here (v1.2.5+20210622064800)

I have a list of objects:

```auto
Device.Bridging.Filter	
Device.Bridging.Filter.1	
Device.Bridging.Filter.1.Alias	
Device.Bridging.Filter.1.Bridge
(...)
Device.Bridging.Filter	
Device.Bridging.Filter.2	
Device.Bridging.Filter.2.Alias	
Device.Bridging.Filter.2.Bridge
(...)
Device.Bridging.Filter	
Device.Bridging.Filter.3	
Device.Bridging.Filter.3.Alias	
Device.Bridging.Filter.3.Bridge
(...)
etc

```

.

On the test-device there are Filter 1-5, but there can obviously be any number of filters here.  
I think I have tried every possible option to add a new filter (6 in this case).

I have tried to just set values for

```auto
Device.Bridging.Filter.6.Alias	
Device.Bridging.Filter.6.Bridge
etc

```

directly. That does not work.

I have tried to first

```auto
    declare("Device.Bridging.Filter.[]", null, {path: 6});

```

And then do the other declarations.

```auto
    declare("Device.Bridging.Filter.6.Alias", { value: now }, { value: "Inetfilter" });

```

That does not work

I have tried all kinds of combinations of

```auto
declare("Device.Bridging.Filter.[Alias:Inetfilter,Enable:false,Bridge:Bridging.Bridge.2]", { path: 1 }, { path: 1 });

```

```auto
declare("Device.Bridging.Filter.[Alias:Inetfilter,Enable:false,Bridge:Bridging.Bridge.2]", { path: now }, { path: 1 });

```

```auto
declare("Device.Bridging.Filter.[Alias:Inetfilter,Enable:false,Bridge:Bridging.Bridge.2]", { path: 1 }, { path: 6 });

```

```auto
declare("Device.Bridging.Filter.[Alias:Inetfilter,Enable:false,Bridge:Bridging.Bridge.2]", { path: now }, { path: 6 });

```

None of these work.

I have tried to duplicate the code from this and several other thread, for instance like this:

```auto
    let basePath = "Device.Bridging.Filter";
    let values = {
    	Enable: false,
    	Alias: "Inetfilter",
    	Bridge: "Bridging.Bridge.2",
      	DHCPType: "DHCPv4",
      	DestMACFromVendorClassIDFilter: "vendor-inet",
      	Status: "Enabled"
    };
    const path = basePath + '.[' + Object.keys(values).map(key => key + ':' + values[key]).join(',') + ']';
    log(`CPE-script ${path}`);
    declare(path, {path: 1, writable: 1}, {path: 1});

```

I can see the log entry, and the path looks right there, but no matter what I try, I can not see that Genieacs are actually sending anything to the CPE to create these entries when I run a packet dump.  
I can see it sending SOAP back and forth for other declares up until it comes to these ones, then it does not send anything.

I see no errors in any logs.

What am I doing wrong here?

---

<div class="post-metadata">

**Author:** ![rudymartin](https://avatars.discourse-cdn.com/v4/letter/r/919ad9/32.png) [@rudymartin](https://forum.genieacs.com/u/rudymartin)\
**Post date:** [September 7, 2022, 2:21pm UTC](https://forum.genieacs.com/t/create-delete-objects/1714/5 "2022-09-07T14:21:11Z")

</div>

Seems to me like you did your homework. When confronted with problems like this one, sometimes my approach is to start over and re-read the docs until I get sick from it:

[https://docs.genieacs.com/en/latest/provisions.html#creating-deleting-object-instances](https://docs.genieacs.com/en/latest/provisions.html#creating-deleting-object-instances)

comparing what you did with the docs the only thing that comes to mind is to try to start from scratch. I assume you are working on a test environment, so you could try first to delete all instances and make sure not a single one survives. Then adding instances one by one and see if it done properly.

If you haven´t done it already, disable other provisions which might get in the way.

I know is it not a big help and I hope I am pointing you to the right direction. Perhaps others will point out something I missed.

And while it has nothing to do with this particular problem, I recommend doing the upgrade to the latest stable, specially if your production ACS is not under a VLAN. Read the changelog before you do.

---

<div class="post-metadata">

**Author:** ![Jorge](https://avatars.discourse-cdn.com/v4/letter/j/9fc29f/32.png) [@Jorge](https://forum.genieacs.com/u/Jorge)\
**Post date:** [September 7, 2022, 2:31pm UTC](https://forum.genieacs.com/t/create-delete-objects/1714/6 "2022-09-07T14:31:34Z")

</div>

Hi the way you try to create a new instance looks good to me, but I’m still a newbie on ACS.

Anyway, have you tried to create the new instance manually from the parameters inspector? Just to check that everything works as it should.

 ![imagen](https://canada1.discourse-cdn.com/flex035/uploads/genieacs/original/1X/46889194d2eb72f679506f544415ce9fae090845.png)

---

<div class="post-metadata">

**Author:** ![Olen](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/olen/32/969_2.png) [@Olen](https://forum.genieacs.com/u/Olen)\
**Post date:** [September 13, 2022, 7:03am UTC](https://forum.genieacs.com/t/create-delete-objects/1714/7 "2022-09-13T07:03:39Z")

</div>

Turns out it was a problem with the CPE. We are arguing with the vendor if it is a bug or if the TR69 spec is unclear.  
Anyway. Adding some info here that can be relevant for others in the same situation.

The parent `Device.Bridging.Filter` is tagged as `writable: 0`, whereas each filter `Device.Bridging.Filter.1`, `Device.Bridging.Filter.2` etc. are tagged as `writable: 1`  
So GenieACS does not even try to create new objects under `...Filter.`, as it respects the `writable: 0`.

But we got a tip about a config statement `cwmp.skipWritableCheck` which makes GenieACS ignore this flag, and try to write the object even if the CPE has stated that it is readonly, and that works.
