Problem with arguments to extension script

Dan Morphis dan at milkcarton.com
Tue Mar 14 13:22:43 EDT 2017


I tried to pass in an object for ext args and wasn't able to get that to
work. I also didn't spend a whole lot of time on it. Here is how I'm
passing args, and it works fine.

//prov script
let serialNumber = declare("DeviceID.SerialNumber", {value: 1});
let productClass = declare("DeviceID.ProductClass", {value: 1});
let oui = declare("DeviceID.OUI", {value: 1});
let userConfig = ext('cpe-config', 'getPppoe', serialNumber.value[0],
oui.value[0], productClass.value[0]);

//ext script
  const serial = args[0];
  const oui = args[1];
  const productClass = args[2];

On Mon, Mar 13, 2017 at 6:38 PM, Marc Priebee <Marc.Priebee at spark.co.nz>
wrote:

> Hi,
>
>
>
> I’m having a problem with passing arguments into an extension script from
> a provision.
>
>
>
> In the provision, I have…
>
> let serial = declare("InternetGatewayDevice.DeviceInfo.SerialNumber",
> {value: 1});
>
> let remoteID = serial.value[0];
>
> let updAttributes = {
>
>   remoteID: remoteID,
>
>   DeviceRadio: null,
>
>   VoiceProfile: null
>
> };
>
> ….
>
> updAttributes.deviceRadio = radioRSRP.value[0]+"#"+radioRSRQ.value[0]+"#"+
> radioRSSI.value[0];
>
> let resp = ext("EID", "set", updAttributes)
>
>
>
> And in the extension (EID, set function)
>
> function set(updAttributes, callback) {
>
>
>
>         console.log("** DEBUG ** in EID set for updAttributes="+JSON.
> stringify(updAttributes));
>
>         callback(null, updateAttributes.remoteID);
>
>
>
> }
>
>
>
> What gets logged is
>
> ** DEBUG ** in EID set for updAttributes=["[object Object]"]
>
>
>
> I’ve tried change the JSON.stringify in the script to
> String(updAttributes) and also combining the JSON.stringify and String, but
> I cannot seem to get access to the updAttributes object.
>
>
>
> I also noted that if I passed 2 arguments such as let resp = ext("EID",
> "set", remoteID, updAttributes), they appear in the script as a single
> argument..something like this;
>
> BoLTE2799000000,[object Object]
>
> In the first parameter of the function
>
>
>
> Marc
>
>
>
>
>
>
>
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.genieacs.com/pipermail/users/attachments/20170314/531a3772/attachment.html>


More information about the Users mailing list