<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Hi Dan,<br>
<br>
I have several questions, please find them under the quoted text:<br>
<br>
<blockquote type="cite"
cite="mid:CAHwrMLe_ou5L-cKnDDFiB+W9CHJxk0ktUpTMQrtJxvtpZXnkuA@mail.gmail.com">
<div dir="ltr">
<div><font face="monospace, monospace">//Staticly define the
data for demonstration purposes. In production, I fetch the
data from another server.</font></div>
</div>
</blockquote>
Do you fetch the data using ext. script?<br>
<br>
<blockquote type="cite"
cite="mid:CAHwrMLe_ou5L-cKnDDFiB+W9CHJxk0ktUpTMQrtJxvtpZXnkuA@mail.gmail.com">
<div dir="ltr">
<div>What will happen here is on the first run of this script,
the port mapping will be created. On subsequent runs, in
Genie's internal state it will first delete all object
instances, but then see that the desired state at the end is
to have a single port mapping, with a name of "<a
href="http://192.168.1.113:9308/"
style="color:rgb(17,85,204);font-family:monospace,monospace;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255)"
target="_blank" moz-do-not-send="true">192.168.1.113:9308</a><span
style="color:rgb(34,34,34);font-family:monospace,monospace;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><span> </span>to
9308 (UDP)", protocol of UDP, etc. And so no change will be
made.</span></div>
<div><span
style="color:rgb(34,34,34);font-family:monospace,monospace;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline"><br>
</span></div>
<div><span
style="color:rgb(34,34,34);font-family:monospace,monospace;font-size:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:400;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;background-color:rgb(255,255,255);text-decoration-style:initial;text-decoration-color:initial;float:none;display:inline">If
on subsequent runs, you change any of the parameters, the
previous instance will be deleted, and a new instance will
be created with the given values.</span></div>
</div>
</blockquote>
You approach is clear, but what I don't like is that you clear the
whole table at the beginning and then create instances according to
your current state. So, if you have for instance 10 port mappings
active and you want to add one more, you first delete these 10 and
then create these 10 again plus one new instance, which is much more
work than required.<br>
<br>
Two questions to give it a try:<br>
<br>
1. When and how do you execute this preset? In my case the trigger
for action should be an API call with whatever parameters will be
required, how can I run a preset triggered by an API call, not an
event from network (BOOT, INFORM, etc)?<br>
<br>
2. Even if I use your solution I still don't understand how can I
output PortMapping table on device summary page. That was my second
point when I explained why I bet for virtual parameter approach. Any
ideas?<br>
<br>
At the end, thank you very much for your input, it really helps.<br>
<br>
Best regards,<br>
<br>
George Chelidze<br>
</body>
</html>