# Script to provissioning

**URL:** <https://forum.genieacs.com/t/script-to-provissioning/1257>\
**Category:** Uncategorized\
**Created:** [November 30, 2020, 10:18pm UTC](https://forum.genieacs.com/t/script-to-provissioning/1257 "2020-11-30T22:18:30Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![urbina](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/urbina/32/301_2.png) [@urbina](https://forum.genieacs.com/u/urbina)\
**Post date:** [November 30, 2020, 10:18pm UTC](https://forum.genieacs.com/t/script-to-provissioning/1257/1 "2020-11-30T22:18:30Z")

</div>

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.-

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [December 1, 2020, 8:47pm UTC](https://forum.genieacs.com/t/script-to-provissioning/1257/2 "2020-12-01T20:47:39Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![urbina](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/urbina/32/301_2.png) [@urbina](https://forum.genieacs.com/u/urbina)\
**Post date:** [December 3, 2020, 10:57pm UTC](https://forum.genieacs.com/t/script-to-provissioning/1257/3 "2020-12-03T22:57:03Z")

</div>

Hello @akcoder , thanks I found this link

> **[genieacs/genieacs](https://github.com/genieacs/genieacs/wiki/Example-of-a-Provisioning-Flow)**
>
> A fast and lightweight TR-069 Auto Configuration Server (ACS) - genieacs/genieacs

  
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.-

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [December 3, 2020, 11:22pm UTC](https://forum.genieacs.com/t/script-to-provissioning/1257/4 "2020-12-03T23:22:06Z")

</div>

Scripts are executed by presets.

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

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/genieacs/original/1X/d096a03fd1a4c7ecc87cb82f9ebdcc70d6b2acea.png).

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 😃.

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/genieacs/original/1X/167988cc139ec92d65c454c13ed49e5b625fb062.png)

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.

```auto
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});
        }
    }
}

```

---

<div class="post-metadata">

**Author:** ![urbina](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/urbina/32/301_2.png) [@urbina](https://forum.genieacs.com/u/urbina)\
**Post date:** [December 15, 2020, 5:55pm UTC](https://forum.genieacs.com/t/script-to-provissioning/1257/5 "2020-12-15T17:55:35Z")

</div>

Hello @akcoder

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

Many thanks.  
Best regards.

Gastón.-

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [December 15, 2020, 6:15pm UTC](https://forum.genieacs.com/t/script-to-provissioning/1257/6 "2020-12-15T18:15:08Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![urbina](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/urbina/32/301_2.png) [@urbina](https://forum.genieacs.com/u/urbina)\
**Post date:** [December 15, 2020, 7:19pm UTC](https://forum.genieacs.com/t/script-to-provissioning/1257/7 "2020-12-15T19:19:36Z")

</div>

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

> **[genieacs/genieacs](https://github.com/genieacs/genieacs/wiki/Example-of-a-Provisioning-Flow)**
>
> Example-of-a-Provisioning-Flow

Many thanks.  
Best regards.

Gastón Urbina.-

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [December 16, 2020, 4:12pm UTC](https://forum.genieacs.com/t/script-to-provissioning/1257/8 "2020-12-16T16:12:29Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![JonasGhost](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/jonasghost/32/286_2.png) [@JonasGhost](https://forum.genieacs.com/u/JonasGhost)\
**Post date:** [December 18, 2020, 10:37pm UTC](https://forum.genieacs.com/t/script-to-provissioning/1257/9 "2020-12-18T22:37:01Z")

</div>

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

> **[Installation Guide — GenieACS Documentation 1.2.3 documentation](http://docs.genieacs.com/en/latest/installation-guide.html)**

You have to create the directory your self.

---

<div class="post-metadata">

**Author:** ![urbina](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/urbina/32/301_2.png) [@urbina](https://forum.genieacs.com/u/urbina)\
**Post date:** [January 6, 2021, 1:35pm UTC](https://forum.genieacs.com/t/script-to-provissioning/1257/10 "2021-01-06T13:35:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![urbina](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/urbina/32/301_2.png) [@urbina](https://forum.genieacs.com/u/urbina)\
**Post date:** [January 7, 2021, 6:52pm UTC](https://forum.genieacs.com/t/script-to-provissioning/1257/11 "2021-01-07T18:52:47Z")

</div>

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.-

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/genieacs/original/1X/a40c64d2799dd2b86b6611df0ff0de1094a8450f.png)

 ![image](https://canada1.discourse-cdn.com/flex035/uploads/genieacs/original/1X/279ba1e39e0c85f0a3be115aa514e1c8566bb622.png)

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [January 8, 2021, 6:12pm UTC](https://forum.genieacs.com/t/script-to-provissioning/1257/12 "2021-01-08T18:12:58Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![urbina](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/urbina/32/301_2.png) [@urbina](https://forum.genieacs.com/u/urbina)\
**Post date:** [January 13, 2021, 7:21pm UTC](https://forum.genieacs.com/t/script-to-provissioning/1257/13 "2021-01-13T19:21:00Z")

</div>

Hi, @akcoder:

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

Thanks.

Gastón.-

---

<div class="post-metadata">

**Author:** ![akcoder](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/akcoder/32/11_2.png) [@akcoder](https://forum.genieacs.com/u/akcoder)\
**Post date:** [January 13, 2021, 7:38pm UTC](https://forum.genieacs.com/t/script-to-provissioning/1257/14 "2021-01-13T19:38:30Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![urbina](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/urbina/32/301_2.png) [@urbina](https://forum.genieacs.com/u/urbina)\
**Post date:** [January 13, 2021, 7:42pm UTC](https://forum.genieacs.com/t/script-to-provissioning/1257/15 "2021-01-13T19:42:31Z")

</div>

![imagen](https://canada1.discourse-cdn.com/flex035/uploads/genieacs/original/1X/e96a0055b3781d5f1244dd23538484256d557df0.png)  
Dan,  
The installation put the directories on /home/urbina.  
So I should create /genieacs/config/ext on /home/urbina? Ok?

Thanks

Gastòn

---

<div class="post-metadata">

**Author:** ![JonasGhost](https://yyz1.discourse-cdn.com/flex035/user_avatar/forum.genieacs.com/jonasghost/32/286_2.png) [@JonasGhost](https://forum.genieacs.com/u/JonasGhost)\
**Post date:** [February 7, 2022, 11:24am UTC](https://forum.genieacs.com/t/script-to-provissioning/1257/16 "2022-02-07T11:24:09Z")

</div>

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.
