Script to find WANIPConnection number

Hello community,
Could someone please help me to create correct script.

I need to know ‘X’ for InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.{X}
by checking its InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.{X}.Name

Thanks in advance

UPD: I just need to know how to properly write iteration through available ip connections.

You mean a variable call X, where do you get the X value from ? If you want any value, you can use * instead of X as a wild card.

Thanks for reply @mike99
Yes I know that but somehow when I use “*” I got index of the first wan ip connection only.
So if I have

let index = declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.*", {path: now}).path;

and my CPE has


GenieACS returns me

Script: InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.3
Script: InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.3

though in the wireshark I see that CPE provides correct path.

Use the genieacs debug feature to see what going one. I could be something as subtle as comma instead of a dot, etc.

But it’s strange it start at 3. If it never change for every device of those model, you can hardcode it in your script.

This is specifics of my CPE - after each reboot it increases its WANIPConnection index by 1.
So after factory reset I have WANIPConnection.1 after reboot this index will change to .2 and so on.
However connection parameters remains unchanged. Which is why I am searching for some correct provisioning flow.

What I’am trying to do now it to track this changes write it to some variable. Actually I have already found how to get it

let index = declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.*", {path: now}).path.split(".").pop();

In this case index = ‘3’ in case of first normal reboot after initial factory reset…