<div dir="ltr"><div>The last configuration sample in the previous email contains errors, should read like so instead:</div><div><br></div><div>
var wanIpCount = declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.*", {value: Date.now()}).size; //get the current count of existing wanipconnections<br>declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.*.WANIPConnection.[]", null, { path: wanIpCount + 1}); //specify we want one additional instance to be present<br>declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.*.WANIPConnection.[WANNAME:test,WANENABLED:true]", {path:1}, {path:1});



</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">czw., 9 maj 2019 o 12:06 SC SCx <<a href="mailto:kredaxx@gmail.com">kredaxx@gmail.com</a>> napisał(a):<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div dir="ltr">Hi,<br><br>I am a bit confused how to "declare" objects to be added or removed in GenieACS provisioning scripts.<br><br>Suppose I have a sample settings tree like this that contains 1 WANPPPConnection and 3 WANIPConnections, and I would like to add another WANIPConnection with WANNAME="test",WANENABLED=true<br><br>InternetGatewayDevice.WANDevice.1.WANConnectionDevice<br>InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.1.WANNAME=wanppp1<br>InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANPPPConnection.2.WANENABLED=true<br>InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANIPConnection.1.WANNAME=wanip1<br>InternetGatewayDevice.WANDevice.1.WANConnectionDevice.2.WANPPPConnection.2.WANENABLED=true<br>InternetGatewayDevice.WANDevice.1.WANConnectionDevice.3.WANIPConnection.1.WANNAME=wanip2<br>InternetGatewayDevice.WANDevice.1.WANConnectionDevice.3.WANPPPConnection.2.WANENABLED=true<br>InternetGatewayDevice.WANDevice.1.WANConnectionDevice.4.WANIPConnection.1.WANNAME=wanip3<br>InternetGatewayDevice.WANDevice.1.WANConnectionDevice.4.WANPPPConnection.2.WANENABLED=true<br><br><br>I can successfully "manually" add a new WANIPConnection like so with an explicit number (e.g. 5), but since the indexing can be arbitrary in the settings tree (and can clash) this is not a good idea.<br><br>declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.5.WANIPConnection.[WANNAME:test,WANENABLED:true]", {path:1}, {path:1});<br><br>So my other attempt was with a wildcard instead to not to rely on an index, like so:<br><br>declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.*.WANIPConnection.[WANNAME:test,WANENABLED:true]", {path:1}, {path:1});<br><br>However this calls 4 times "AddObject" RPCs, creates 4 WANIPConnections, but only the last one contains the specified WANNNAMAE="test",WANENABLED=true.<br><br>So after reading around the mailing list and the Wiki I found samples where one specifies the desired instance count, so I tried something along the lines of this:<br><br>var wanIpCount = declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.*", {value: Date.now()}).size; //get the current count of existing wanipconnections<br>declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.1.WANIPConnection.[]", null, { path: wanIpCount + 1}); //specify we want one additional instance to be present<br>declare("InternetGatewayDevice.WANDevice.1.WANConnectionDevice.5.WANIPConnection.[WANNAME:test,WANENABLED:true]", {path:1}, {path:1});<br><br>Unfortunately this is no good as well, it managed to call 2 times AddObject and then throws an error of faultCode="cwmp.9002" faultMessage="Internal error".<br><br>What would be the proper way to add a new WANIPconnection instance in this case?<br><br>PS:<br>Since this is not mentioned anywhere, is a wildcard: "*" equivalent to empty brackets: "[]" in a path string?<br><br>Thank you<br></div></div>
</blockquote></div>