Create/Delete objects

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.

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:

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:

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.

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:

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

As good as always man.
Thank you very much.

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:

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

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

directly. That does not work.

I have tried to first

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

And then do the other declarations.

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

That does not work

I have tried all kinds of combinations of

declare("Device.Bridging.Filter.[Alias:Inetfilter,Enable:false,Bridge:Bridging.Bridge.2]", { path: 1 }, { path: 1 });
declare("Device.Bridging.Filter.[Alias:Inetfilter,Enable:false,Bridge:Bridging.Bridge.2]", { path: now }, { path: 1 });
declare("Device.Bridging.Filter.[Alias:Inetfilter,Enable:false,Bridge:Bridging.Bridge.2]", { path: 1 }, { path: 6 });
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:

    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?

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

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.

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.

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.

1 Like