Script to provissioning

Hello,

I have a Ont Huawei HS8145V on Genieacs and currently can configure parameters as ssid for example whit a preset. Someone can help me whit a script to provission pppoe.
I just need configure a pppoe when the Ont was a factory reseted.

Many thanks.
Rgds.

Gastón.-

This question has been answered numerous times. Please review the documentation and the wiki.

Hello @akcoder , thanks I found this link


But I dont understand how work it.
Can you help me please, or give a introduction to how use these script?
Many thanks.
Rgds.

Gastón.-

Scripts are executed by presets.

This preset runs when a CPE is bootstraped (turned on for the very first time, or factory defaulted).

.

This preset here runs when a CPE informs without the 0 BOOTSTRAP event, and is not Disabled, Provisioned and the desired state is Managed. Those tags are added to the CPE by a different preset :smiley:.

This provision script queries our subscriber management server to get the desired configuration of a CPE. The ext() func calls an external script (that reside in the genieacs/config/ext dir). External scripts are how you can get data from external services.

log("Set_Config_Mode");

let serialNumber = declare("DeviceID.SerialNumber", {value: 1}).value[0];
let productClass = declare("DeviceID.ProductClass", {value: 1}).value[0];
let oui = declare("DeviceID.OUI", {value: 1}).value[0];
let deviceId = declare("DeviceID.ID", {value: 1}).value[0];

let params = {serial: serialNumber, productClass: productClass, oui: oui, deviceId: deviceId};

//Get the cpe config mode
let cpeConfig = ext('cpe-config', 'getConfig', JSON.stringify(params));

if (cpeConfig && cpeConfig.config) {
    log('Set_Config_Mode - Config? ' + cpeConfig.config);

    declare("Tags." + cpeConfig.config, null, {value: true});

    if (cpeConfig.tags && cpeConfig.tags.toLength > 0) {
        for (let [tag] of cpeConfig.tags) {
            declare("Tags." + tag.replace(' ', '_'), null, {value: true});
        }
    }
}
1 Like

Hello @akcoder

I dont have a path as genieacs/config/ext.
Have GenieACS-Version: 1.2.1+20200909044125.

Many thanks.
Best regards.

Gastón.-

I haven’t upgraded to v1.2 yet, but as I understand its still supported. As always, the best place to look is the documentation.

@akcoder, I dont have ext file on a server.
Id create the file my self with this link?

Many thanks.
Best regards.

Gastón Urbina.-

ext is a directory that your extension scripts go in.

I’m not sure yet how 1.2 works, but I will presume it works the same as v1.1, so yes create that directory and put your extension scripts in there.

I am using ext scripts with 1.2 without Problems.
I followed this guide:

You have to create the directory your self.

1 Like

Ok, many thanks @JonasGhost and @akcoder.
I`ll try making directory and put these scritp.
Happy new year

Hi,

Now, I have the external script in home/urbina/genieacs-gui/config/ext# and also added the provision script. Whats the next step? Because in the provision script or external I dont see where modify the tags.

I only need to provide one wan interface pppoe, ssid and presharedkey.
Do you think that exists another easy way to provide this parameters?

Many thanks.

Gastón Urbina.-

That is an incorrect location for your ext scripts. They should be under genieacs/config/ext not the gui.

Hi, @akcoder:

So I should create genieacs/config/ext in " / " ?

Thanks.

Gastón.-

The location of the ext dir is entirely dependent on where you put genieacs. If you put genieacs in the /opt dir, then the correct location would be /opt/genieacs/config/ext.

-dan


Dan,
The installation put the directories on /home/urbina.
So I should create /genieacs/config/ext on /home/urbina? Ok?

Thanks

Gastòn

It looks like you are using the old version of the genieacs Ui.

The path to the ext folder is stored by an env variable. That is described in the installation manual for genieacs in the link above.