I got it to pass an object by:
let resp = ext("EID", "set", JSON.stringify(updAttributes));

and then using JSON.parse in the ext script.

Just it case it helps some-one

Marc


From: Users [mailto:[email protected]] On Behalf Of Dan Morphis
Sent: Wednesday, 15 March 2017 6:23 a.m.
To: Community support for GenieACS users <[email protected]>
Subject: Re: Problem with arguments to extension script

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 
<[email protected]<mailto:[email protected]>> 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
[email protected]<mailto:[email protected]>
http://lists.genieacs.com/mailman/listinfo/users

_______________________________________________
Users mailing list
[email protected]
http://lists.genieacs.com/mailman/listinfo/users

Reply via email to