How to create a second instance

Hello, I’m new to GenieACS and to ACS in general.
I’m trying to setup a Huawei 8141A5 with the following WAN:
1- DHCP for TR069
2- PPPoE for internet
3- DHCP for VOIP
So far I got the first 2 WAN, the TR069 is configured via OMCI and the I have this config on GenieACS for de PPPoE

declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*", null, {path: 1});
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.*", {path: now}); //Refrescar nodo
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.Name", {value: now}, {value: "Internet"});
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.ConnectionType", {value: now}, {value: "IP_Routed"});
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.X_BROADCOM_COM_IfName", {value: now}, {value: "ppp0.1"});
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.NATEnabled", {value: now}, {value: true});
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.X_BROADCOM_COM_FirewallEnabled", {value: now}, {value: true});
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.Enable", {value: now}, {value: true});
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.*.X_HW_VLAN", {value: now}, {value: 51});

But I’m unable to create a second WANIPConnection no matter what I’ve tryed.
Any help will by appreciated.

The forum doesn’t work with firefox.

Thank you.

Please share your lines for creating the WANIPConnection

Hello, that was really my question, how to create it.
If you mean how I create the first one, it’s created via OMCI command from the OLT.
Anyway I have figured out how to create the second instance like this:

declare(“InternetGatewayDevice.WANDevice.1.WANConnectionDevice.", null, {path: 2}); declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANIPConnection.”, null, {path: 1});

I don’t know if it’s the right way but It’s the only way I’ve found.

With assumption that All WANIPConnection is declared under InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2, if you want to have/create 2 WANIPConnections under this tree, you have to put {path: 2} instead of {path: 1}. Then number after path: is number of instances that must be existed.
The instances will be created/deleted/nothing to do based on this number.

The simpler way to create the instance is by setting one or more unique parameters value during creation.
For example if you will only have 1 interface with Name value “VOIP”, than you can create using this line :
*declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANIPConnection.[Name:VOIP] ”, null, {path: 1});

And then if you want to set another parameters under created instance, you can use line like this
*declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANIPConnection.[Name:VOIP].Enable”, {value:}, {value: true});

Hope this will help.

Hi Encarta, thank you for your answer and sorry for reply that late, I’ve been off the project for a long time.
The problem I have is in how to create that number 2 WANConnectionDevice InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2
My scenario is like this:
OMCI command creates InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1 and the InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1
the via ACS I append a InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.1 to it.
Well I need to create de second WANConnectionDevice to append to it a voip wan but there is where I have the problems I’m unable to create it with the script.
Really I was able to create it with the command on my previous post but just in one of the ONU’s I’ve tested
I hope you can guide me and you can understand what I want to say (becuase my mother tongue is Spanish). Thank you.

You cannot create specific instance numbers. But you can ensure that an instance with the proper parameter values exists:

let values = {
    Name: "Internet",
    ConnectionType: "IP_Routed",
    X_BROADCOM_COM_IfName: "ppp0.1",
    NATEnabled: true,
    X_BROADCOM_COM_FirewallEnabled: true,
    Enable: true,
    X_HW_VLAN: 51,

let basePath = "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.";
const path = basePath + '.[' + Object.keys(values).map(key => key + ':' + values[key]).join(',') + ']';

declare(path, {path: 1}, {path: 1});

Yes I figured that out, I don’t I want a WAN interface numbered 2, the thing is that I can’t create a second WANConnectionDevice.
The CPE I’m working with only let me create 1 pppoe instance and 1 ip instance under a WANConnectionDevice, so I need to create a new WANConnectionDevice to add a second WANIPConnection
I can’t find the magic combination to create the new WAN
I thought the command was like this
declare(“InternetGatewayDevice.WANDevice.1.WANConnectionDevice.*”, null, {path: 2});
but it does not work or at least not always.
Thank you

Try this (notice the [] instead of *):

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

That’s it, perfect. I don’t really know how many different configurations I tryed.
I think also this one but with some other command failing after it.
One last thing for now, I got it now working but how can I make it work without doing reference to the numbering? This is what I have:
declare(“InternetGatewayDevice.WANDevice.1.WANConnectionDevice.[]”, null, {path: 2}); declare(“InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANIPConnection.[Name:3_VOIP_R_VID_52]”, null, {path: 1});
declare(“InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANIPConnection.[Name:3_VOIP_R_VID_52].X_HW_SERVICELIST”, {value: now}, {value: “VOIP”}); declare(“InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANIPConnection.[Name:3_VOIP_R_VID_52].X_HW_VLAN”, {value: now}, {value: 52}); declare(“InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANIPConnection.[Name:3_VOIP_R_VID_52].X_HW_PRI”, {value: now}, {value: 5});

Thank very much for your help.

What you have will (mostly) work, but its kind of inefficient. It would be much better to put all your params in one statement. This will prevent GenieACS from first figuring out if it needs to create the instance, then finding the path each time only to set a different value.

So this line will accomplish what you are trying to do:

declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANIPConnection.[Name:3_VOIP_R_VID_52,X_HW_SERVICELIST:VOIP,X_HW_VLAN:52,X_HW_PRI:5]", {path: 1}, {path: 1});

I like to write very readable code, so I would accomplish the goal like this, which also makes it very extensible. Remember, its much slower for humans to re-read/parse code than it is for computers :slight_smile: .

let values = {
    Name: "3_VOIP_R_VID_52",
    X_HW_VLAN: 52,
    X_HW_PRI: 51

let basePath = "InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANIPConnection.";
const path = basePath + '.[' + Object.keys(values).map(key => key + ':' + values[key]).join(',') + ']';

declare(path, {path: 1}, {path: 1});

The computer will build the same path as the first example, but one is more readable/maintainable.

If you need to find a particular instance after the fact to reference it from another provision, then you have to find it by some particular unique identifier.

Example, from a different provision script, if you want to disable the connection, you would do this:

//Customer hasn't paid their bill! No telephone for them!
declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.*.WANIPConnection.[Name:3_VOIP_R_VID_52].Enable", {value: now}, {value: false});

To summarize, if you replace the instance number on a path with a qualifier in [] then that becomes a search parameter that can be used to get or set values.

BTW, if you use triple backticks ``` then discord will put whats after that (on a new line) into a code block and it won’t turn your quotes into curly quotes. Finish it off with another set of triple backticks on a new line.

Yes you are right
I was trying to change to this way, since I saw your first post.
The only thing is that for me to work this example you gave me I need to remove one of “.”, the one last one on the basePath or the first one on the path

BTW, I’m on the 1.2.3 version.

Thank you again for your support.
Regards from Spain.

1 Like

Hi Dan I’m still struggling a bit with that second instance.
All works fine after a add it manually for the first time throught the GenieACS + button,

and then it works flawlessly from the script add/remove without any problem.
Could it be that I need to query to refresh some parameter prior to try to add it for the first time, like I do when it is manually?

Really the + button is missing un unless I refresh that parameter a couple of times through the genie GUI.

Try changing the bottom line of the script from

declare(path, {path: 1}, {path: 1});


declare(path, {path: 1, value: now}, {path: 1});

Hi with that line is supossed to fix the problem with the 2 dots on your example or to solve the problem with the fact that the + button is missing on this? InternetGatewayDevice.WANDevice.1.WANConnectionDevice
Because this is the main problem I have and is this why I had problems with creating the second instance, it worked one time with * and other with [], but I think both work but it needed that parameter to allow to add.
Sorry if it is confuse but it’s difficult to express that in English for me.
Thank you.

So the GUI is separate from the CWMP process. Just because the add instance button doesn’t work in the gui, doesn’t mean you can’t add an instance via the cwmp scripting engine. Many, many CPEs falsely report that items are writable when they aren’t, or non-writable when they in fact are. See the first entry of the change log for v1.2.3. I worked with @zaidka on this issue after discovering that provision scripts didn’t respect the writable flag, which was actually beneficial in my case.

1 Like

Hello you are right it seems that my CPE is reporting no state for the writable flag at all:

Parameter Object Object timestamp Writable Writable timestamp
InternetGatewayDevice.WANDevice.1.WANConnectionDevice true 1,61226E+12

I’ve been looking where to change the config option you refered but I’m unsure where is the place to actually change it. Is it adding a new entry in the config list?

Thank you very much you’re helping me a lot.

P.D. Yes it looks like it is, but please confirm if you can it’s not the first time I think is working and actually is because of something else.

Hmm this should behave identically to using an asterisk. But judging from @Jorge’s reply it seems to have made a difference which it shouldn’t! This may be a bug.

Looks like the value itself is missing, not that it’s reported incorrectly by the CPE. Try adding ‘writable’ to the timestamps argument:

declare(path, {path: 1, writable: 1}, ...);

Hi, yes I think both works the same, my previous result I guess was mistaken due to the fact that I had the problem with parameter flag (I was playing with the CPE) and when I tested [] instead of * it was just a coincidence that in that moment the parameter was in writeable state.

1 Like

I think is working fine so far with the config option pointed by @akcoder (in 3 different CPE), but I will try your approach because if it works I believe is better than messing with global parameters.

Thank you both of you.

PD. I can’t make it work with your suggestion or I’m maybe putting it in the wrong place. I’ve set that like this:

let values = {
X_HW_VLAN: 52,

let basePath = “InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANIPConnection”;
const path = basePath + ‘.[’ + Object.keys(values).map(key => key + ‘:’ + values[key]).join(’,’) + ‘]’;
declare(path, {path: 1, writable: 1}, {path: 1});