<div dir="ltr">Perfect, that is exactly what I needed!</div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Jun 16, 2017 at 3:18 PM, Zaid Abdulla <span dir="ltr"><<a href="mailto:zaid@genieacs.com" target="_blank">zaid@genieacs.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On Thu, 2017-06-15 at 09:41 -0800, Dan Morphis wrote:<br>
> We are adding the ability for customers to manage port forwarding<br>
> (PortMapping). I'm trying to figure out how to ensure that only<br>
> specific instances exist in the PortMapping node. For instance<br>
> customer adds a port forward for<br>
> ExternalPort:3000,<wbr>InternalPort:3001,<wbr>PortMappingProtocol:TCP,<wbr>InternalC<br>
> lient:192.168.1.50. Creating that instance will be easy enough.<br>
><br>
> Now, the customer remove that instance, and adds a mapping for<br>
> ExternalPort:8080,<wbr>InternalPort:80,<wbr>PortMappingProtocol:TCP,<wbr>InternalCli<br>
> ent:192.168.1.51,<br>
> ExternalPort:8081,<wbr>InternalPort:80,<wbr>PortMappingProtocol:TCP,<wbr>InternalCli<br>
> ent:192.168.1.50. How can I using provisioning scripts ensure that<br>
> the first instance is deleted, and the second instance is created, if<br>
> the only data I have available is what the desired state should be?<br>
<br>
</span>If I understand you correctly, you can do something like this:<br>
<br>
declare("<wbr>InternetGatewayDevice.<wbr>WANDevice.*.<wbr>WANConnectionDevice.1.WANPPP<br>
Connection.*.PortMapping.[]", null, {path: 0});<br>
<br>
declare("<wbr>InternetGatewayDevice.<wbr>WANDevice.*.<wbr>WANConnectionDevice.1.WANPPP<br>
Connection.*.PortMapping.[<wbr>ExternalPort:8080,<wbr>InternalPort:80,PortMapping<br>
<span class="">Protocol:TCP,InternalClient:<wbr>192.168.1.51]", {path: 1}, {path: 1});<br>
<br>
declare("<wbr>InternetGatewayDevice.<wbr>WANDevice.*.<wbr>WANConnectionDevice.1.WANPPP<br>
Connection.*.PortMapping.[<wbr>ExternalPort:8081,<wbr>InternalPort:80,PortMapping<br>
Protocol:TCP,InternalClient:<wbr>192.168.1.50]", {path: 1}, {path: 1});<br>
<br>
</span>This will cause all instances other than those two to be deleted. And<br>
since there's no commit() between the declarations, it knows not to<br>
delete and recreate said instances.<br>
<span class="HOEnZb"><font color="#888888"><br>
--<br>
Zaid Abdulla <<a href="mailto:zaid@genieacs.com">zaid@genieacs.com</a>><br>
______________________________<wbr>_________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.genieacs.com">Users@lists.genieacs.com</a><br>
<a href="http://lists.genieacs.com/mailman/listinfo/users" rel="noreferrer" target="_blank">http://lists.genieacs.com/<wbr>mailman/listinfo/users</a><br>
</font></span></blockquote></div><br></div>