Virtual parameters

Dan Morphis dan at milkcarton.com
Mon Mar 6 12:00:07 EST 2017


Marc,
 Would you be so kind as to update the wiki with this information? Where
you place extension scripts on disk, how to call and get the value back,
etc. I'm sure many people would find this information very useful!

-dan

On Sun, Mar 5, 2017 at 12:32 PM, Marc Priebee <Marc.Priebee at spark.co.nz>
wrote:

> FYI, in case this helps some-one...
>
> I resolved this after reviewing what the extension-wrapper script does.
> The extension scripts require a callback;
>
> exports.getSIP = function(d, callback) {
>         console.log("in getSIP with "+d);
>         var ldap = require('ldapjs');
>         let SIPParms = {
>                 "username": '5645195',
>                 "password": 'bleah'
>         }
>         callback(null, SIPParms);
> }
>
> (The 1st parameter in the callback is an error value)
>
> Marc
>
>
> -----Original Message-----
> From: Users [mailto:users-bounces at lists.genieacs.com]
> Sent: Monday, 6 March 2017 7:59 a.m.
> To: Community support for GenieACS users <users at lists.genieacs.com>
> Subject: RE: Virtual parameters
>
>
> Hi,
>
> I'm also struggling with this, except I'm trying to use an extension
> script rather than virtual parameters. The documentation refers to them as
> similar, but the extension section of the docs is TODO, and I can't find
> any examples anywhere.
>
> The provision script looks this this..
> let serial = declare("InternetGatewayDevice.DeviceInfo.SerialNumber",
> {value: 1}); log("provision with "+serial.value[0]); let resp =
> ext("testext", "start", serial.value[0]); log("provision back from
> extension"); declare("InternetGatewayDevice.ManagementServer.Username",
> {value: 1},
>   {value: resp.username});
> declare("InternetGatewayDevice.ManagementServer.Password", {value: 1},
>   {value: resp.password});
>
> If I remove the extension, (and set static values) the provision works as
> expected. But when I call the extension, I get the following error; Channel
> has faulted; channel="default" retries=0 faultCode="timeout"
> faultMessage="Extension timed out"
>
> The extension looks like this;
> exports.start = function(d) {
>  console.log("in ext script start with "+d);  let sipuser = "5645194";
> let sippw = "bleah";  return {
>   "username": sipuser,
>   "password": sippw
>  };
> }
>
> I get the log message, so it's being called, but the script really isn't
> doing enough to be actually timing out.
> (Ultimately, my intention is to use the extension to retrieve SIP
> parameters from an LDAP directory, and provisioning them into the CPE)
>
> Regards
> Marc
>
>
> -----Original Message-----
> From: Users [mailto:users-bounces at lists.genieacs.com] On Behalf Of Zaid
> Abdulla
> Sent: Sunday, 5 March 2017 12:41 a.m.
> To: Community support for GenieACS users <users at lists.genieacs.com>
> Subject: Re: Virtual parameters
>
> On Wed, 2017-03-01 at 06:56 -0900, Dan Morphis wrote:
> > Can you post your script and some screenshots?
>
> Here's a sample script:
>
>     declare("InternetGatewayDevice.ManagementServer.PeriodicInformInter
> val", null, {value: 300});
>     declare("InternetGatewayDevice.ManagementServer.PeriodicInformEnabl
> e", null, {value: true});
>     declare("InternetGatewayDevice.ManagementServer.ConnectionRequestUs
> ername", null, {value: "genieacs"});
>     declare("InternetGatewayDevice.ManagementServer.ConnectionRequestPa
> ssword", null, {value: "genieacs"});
>     declare("InternetGatewayDevice.DeviceInfo.SerialNumber", {value:
> 1});
>     declare("InternetGatewayDevice.DeviceInfo.ProductClass", {value:
> 1});
>     declare("InternetGatewayDevice.DeviceInfo.ManufacturerOUI", {value:
> 1});
>     declare("InternetGatewayDevice.DeviceInfo.Manufacturer", {value:
> 1});
>     declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.1.WA
> NPPConnection.*.MACAddress", {value: 1});
>     declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.1.WA
> NPPConnection.*.ExternalIPAddress", {value: Date.now()});
>     declare("InternetGatewayDevice.LANDevice.*.WLANConfiguration.*.SSID
> ", {value: Date.now()});
>     declare("InternetGatewayDevice.LANDevice.*.Hosts.Host.*.HostName",
> {value: 1});
>     declare("InternetGatewayDevice.LANDevice.*.Hosts.Host.*.IPAddress",
> {value: 1});
>     declare("InternetGatewayDevice.LANDevice.*.Hosts.Host.*.MACAddress"
> , {value: 1});
>
> > Heres what I have, and I'm getting an error: Channel has faulted;
> > channel="default" retries=0 faultCode="script.ReferenceError"
> > faultMessage="maxRevision is not defined"
>
> That's a bug that was recently fixed. Pull the latest changes.
>
> --
> Zaid Abdulla <zaid at genieacs.com>
> _______________________________________________
> Users mailing list
> Users at lists.genieacs.com
> http://lists.genieacs.com/mailman/listinfo/users
>
> This communication, including any attachments, is confidential. If you are
> not the intended recipient, you should not read it - please contact me
> immediately, destroy it, and do not copy or use any part of this
> communication or disclose anything about it. Thank you. Please note that
> this communication does not designate an information system for the
> purposes of the Electronic Transactions Act 2002.
>
> _______________________________________________
> Users mailing list
> Users at lists.genieacs.com
> http://lists.genieacs.com/mailman/listinfo/users
> _______________________________________________
> 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/20170306/80f15596/attachment.html>


More information about the Users mailing list