<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"></head><body dir="auto">Answers below. <br><br><div id="AppleMailSignature">-dan</div><div><br>On Apr 14, 2018, at 12:21 AM, George Chelidze <<a href="mailto:george.chelidze@magticom.ge">george.chelidze@magticom.ge</a>> wrote:<br><br></div><blockquote type="cite"><div>
  
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  
  
    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></div></blockquote>Yes<br><blockquote type="cite"><div>
    <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></div></blockquote>The 10 entries aren’t actually deleted. Genie tracks the desired state, sees that there is no change to the 10 entries, doesn’t mess with them. It will only create the new entry. <br><blockquote type="cite"><div>
    <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></div></blockquote>Genie doesn’t have that capability yet. So I fake it :). I create a tag on the device called NeedsPortMappings. Then I have a preset with the trigger being said tag name which initiates the provision script. Then to get the preset to fire I initiate a connection request to the CPE. Not ideal, but it works. <br><blockquote type="cite"><div>
    <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></div></blockquote><div><br></div>Look in the parameters.yml file in the GUI. It does the same type of thing for device hosts. Remember to restart the GUI after making changes to the file.<div><br></div><div>-dan<br><blockquote type="cite"><div>
    <br>
    At the end, thank you very much for your input, it really helps.<br>
    <br>
    Best regards,<br>
    <br>
    George Chelidze<br>
  

</div></blockquote><blockquote type="cite"><div><span>_______________________________________________</span><br><span>Users mailing list</span><br><span><a href="mailto:Users@lists.genieacs.com">Users@lists.genieacs.com</a></span><br><span><a href="http://lists.genieacs.com/mailman/listinfo/users">http://lists.genieacs.com/mailman/listinfo/users</a></span><br></div></blockquote></div></body></html>