<div dir="ltr">We are adding the ability for customers to manage port forwarding (PortMapping). I'm trying to figure out how to ensure that only specific instances exist in the PortMapping node. For instance customer adds a port forward for <font face="monospace, monospace">ExternalPort:3000,InternalPort:3001,PortMappingProtocol:TCP,InternalClient:192.168.1.50</font>. Creating that instance will be easy enough.<div><br></div><div>Now, the customer remove that instance, and adds a mapping for <font face="monospace, monospace">ExternalPort:8080,InternalPort:80,PortMappingProtocol:TCP,InternalClient:192.168.1.51</font>, <font face="monospace, monospace">ExternalPort:8081,InternalPort:80,PortMappingProtocol:TCP,InternalClient:192.168.1.50</font>. How can I using provisioning scripts ensure that the first instance is deleted, and the second instance is created, if the only data I have available is what the desired state should be?</div><div><br></div><div>My first thought was to delete all existing PortMapping entries and then add back the desired entries. But that seems really inefficient. I could do something like this to ensure I have the desired number of entries:</div><div><br></div><div><div><font face="monospace, monospace">declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.1.WANPPPConnection.*.PortMapping.*", null, {path: 2});</font></div></div><div><br></div><div>But then how would I go about updating the two entries with the desired values? Something like this?</div><div><br></div><div><font face="monospace, monospace">declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.1.WANPPPConnection.*.PortMapping.[ExternalPort:8080,InternalPort:80,PortMappingProtocol:TCP,InternalClient:192.168.1.51]", {path: 1}, {path: 1});</font></div><div><font face="monospace, monospace">declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.1.WANPPPConnection.*.PortMapping.[ExternalPort:8081,InternalPort:80,PortMappingProtocol:TCP,InternalClient:192.168.1.50]", {path: 1}, {path: 1});</font><br></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace"><br></font></div><div><font face="monospace, monospace">--dan</font></div></div>