Get event type inside a provision script

Takim takimp at yahoo.com
Tue Sep 11 23:19:41 EDT 2018


Hi,
In my observation, if the Event had been occurred before, it will be always be in the parameter. So if you want to check whether the event is included in the recent inform you have to compare the value of the stored value of that event with current timestamp (or current timestamp – several  seconds, just to make it save).
Note setting value to current timestamp in the declare will always return the last stored value.

I might be wrong but that’s my conclusion based on my observation.

Regards,

From: Michael Neumann
Sent: Tuesday, September 11, 2018 9:42 PM
To: Community support for GenieACS users
Subject: Get event type inside a provision script

Hello,

i try now for a while to get the inform Event inside a provision script.

In the web I have found this info: https://github.com/genieacs/genieacs/issues/270

I am running version 1.1.2

What I have seen in the code it should be possible in that version.

https://github.com/genieacs/genieacs/blob/v1.1.2/lib/session.coffee#L145



My provision looks like that:

log("MN-DEBUG STARTED");

let myboot = declare("Events.1_BOOT", {value: 1});
if (myboot.value !== undefined) {
    log("1 BOOT");
    return;
}

let myperiodic = declare("Events.2_PERIODIC", {value: 1});
if (myperiodic.value !== undefined) {
    log("2 PERIODIC");
    return;
}

..

First logs looks fine ..
Sep 11 15:17:18 acs-01 genieacs-cwmp[1177]: 2018-09-11T13:17:18.440Z [INFO] 10.31.0.7 0cb912-968380FEGU-0cb912007af0: Inform; cpeRequestId="978990364" informEvent="2 PERIODIC" informRetryCount=0
Sep 11 15:17:18 acs-01 genieacs-cwmp[1177]: 2018-09-11T13:17:18.504Z [INFO] 10.31.0.7 0cb912-968380FEGU-0cb912007af0: Script: MN-DEBUG STARTED
Sep 11 15:17:18 acs-01 genieacs-cwmp[1177]: 2018-09-11T13:17:18.508Z [INFO] 10.31.0.7 0cb912-968380FEGU-0cb912007af0: Script: 2 PERIODIC

Then I have restarted the device . then the first log is also as expected ...
Sep 11 15:21:25 acs-01 genieacs-cwmp[1177]: 2018-09-11T13:21:25.791Z [INFO] 10.31.0.7 0cb912-968380FEGU-0cb912007af0: Inform; cpeRequestId="1804289383" informEvent="M Reboot,1 BOOT,4 VALUE CHANGE"informRetryCount=0
Sep 11 15:21:25 acs-01 genieacs-cwmp[1177]: 2018-09-11T13:21:25.938Z [INFO] 10.31.0.7 0cb912-968380FEGU-0cb912007af0: Script: MN-DEBUG STARTED
Sep 11 15:21:25 acs-01 genieacs-cwmp[1177]: 2018-09-11T13:21:25.939Z [INFO] 10.31.0.7 0cb912-968380FEGU-0cb912007af0: Script: 1 BOOT

But from now I get on each priodic inform the debug message 1 BOOT 
Sep 11 15:41:40 acs-01 genieacs-cwmp[1177]: 2018-09-11T13:41:40.529Z [INFO] 10.31.0.7 0cb912-968380FEGU-0cb912007af0: Inform; cpeRequestId="945367102" informEvent="2 PERIODIC" informRetryCount=0
Sep 11 15:41:40 acs-01 genieacs-cwmp[1177]: 2018-09-11T13:41:40.614Z [INFO] 10.31.0.7 0cb912-968380FEGU-0cb912007af0: Script: MN-DEBUG STARTED
Sep 11 15:41:40 acs-01 genieacs-cwmp[1177]: 2018-09-11T13:41:40.616Z [INFO] 10.31.0.7 0cb912-968380FEGU-0cb912007af0: Script: 1 BOOT


Can someone help me to get the type of the event in a provision script. 


Best Regards

Michael Neumann

_______________________________________________
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/20180912/fd35c592/attachment.html>


More information about the Users mailing list