Writable table as VirtualParameter

Dan Morphis dan at milkcarton.com
Sat Apr 14 15:50:52 EDT 2018


Answers below. 

-dan

> On Apr 14, 2018, at 12:21 AM, George Chelidze <george.chelidze at magticom.ge> wrote:
> 
> Hi Dan,
> 
> I have several questions, please find them under the quoted text:
> 
>> //Staticly define the data for demonstration purposes. In production, I fetch the data from another server.
> Do you fetch the data using ext. script?
Yes
> 
>> 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 "192.168.1.113:9308 to 9308 (UDP)", protocol of UDP, etc. And so no change will be made.
>> 
>> 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.
> 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.
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. 
> 
> Two questions to give it a try:
> 
> 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)?
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. 
> 
> 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?

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.

-dan
> 
> At the end, thank you very much for your input, it really helps.
> 
> Best regards,
> 
> George Chelidze
> _______________________________________________
> Users mailing list
> Users at lists.genieacs.com
> http://lists.genieacs.com/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genieacs.com/pipermail/users/attachments/20180414/6c1be0a7/attachment.html>


More information about the Users mailing list