Provisionings executing twice

Hi, i have two presets that match the “1 BOOT” event, but when a 1 BOOT arrives they both execute twice (I also cant controll the order of their execution even though i set their wheights).
In this way:

Then i can see in the cwmp logs:

For reference, the boot_script provisions ends with the line:
Script: Configuracion de hora inicial de inform sobre nodo device

And the notify_event ends with the line:
Script: ext executed, result: ; 0=“s” 1=“u” 2=“c” 3=“c” 4=“e” 5=“s” 6=“s”

Is there a reason why this happens? Also it doesnt happend all the time or with every preset i would love to understand why. (I have read the documentation several times)

Weight is used to control precedence when resolving conflicting provisions. It does not control execution order.

Oh okay,

Although my primary concern is the multiple execution of the same preset.
Some more info i get from testin, is that this double execution only occurs when there is more than one preset triggered from an event.

Can you give some clarity over the matter if you know something?
Thanks for the answers.

See the note section in the docs for provisions.

1 Like

Yes i have read it, but i dont get what the acs considers as a stable state is reached.
For example, one of my provisions is just:

//Obtener datos del device para enviar
const serialNumber = declare("DeviceID.SerialNumber", { value: 1 }).value[0];
const deviceId = declare("DeviceID.ID", {value: 1}).value[0]
const eventType = args[0]; // En el argumento viene el tipo de evento
log('Event type is ',eventType)
log('Executing ext')
const result = ext("ext-event-notifier","fetchInstallerData", deviceId, serialNumber, eventType)
log('ext executed, result: ',result.response)

I mean the only thing it does is call an Ext, so i dont know if it surpaces a certain time limit of execution the provision runs again or what

Stable state is no changes to the data model. What is the contents of your other provision?

Is pretty complex, the ext sends a post to an API with the deviceID and the event like so:

function fetchInstallerData(args,callback) {

            const device_id = args[0];
            const serial_number = args[1]; 
            const event_type = args[2];          
            const myUUID = uuidv4();

            const options = {
                hostname: 'connection-api',
                port: 8081,
                path: `/v1/connection/acs/event?requestID=${myUUID}`,
                method: 'POST',
                headers: {
                    'Content-Type': 'application/json'
                }
            };
            try{
                const req = http.request(options, (res) => {
                    let data = '';

                    // A chunk of data has been received.
                    res.on('data', (chunk) => {
                        data += chunk;
                    });

                    // The whole response has been received.
                    res.on('end', () => {
                        try {
                            jsonData = JSON.parse(data);
                        } catch (error) {
                            console.error('Error parsing JSON:', error);
                            callback('Error parsing JSON response', 'Error in request execution');
                            return;
                        }
                        console.log('Extension completed!');
                        callback(null, jsonData);
                    });
                });

                req.on('error', (error) => {
                    console.log('Error:', error);
                    callback(error);
                });

                // Write data to request body
                req.write(JSON.stringify({ event: event_type, ont_id: device_id, ont_serial: serial_number}));
                req.end();
            } catch (error) {
                callback(null, "Error on fetchInstallerData");
            }
            
        }

Then in my API the Post is recieved and a series of API calls are made to change values in the acs with several POST (around 5) and some of the modify up to 10 parameter values.

Basically the company wants all the logic and work to be done in our API and not genieacs scripts thats the reason of the cycle.

This is a bad idea. You are forcing the ACS to track multiple sessions for the CPE. One way to
accomplish your goals, and still stay within byzantine rules of your org is have the call from your extension script return a set of key/value pairs of parameters to set. Then you spin through those in the provision script and do your declares there.

Okay thats not a bad idea at all.
I would try to convince my supervisor of it so i can face more standard behaviour from the acs.
Thanks a ton for your help and experience.

Remind management that you should be using the best system for the job. Doing ACS logic outside of the ACS adds additional costs (in the form of developer time).

The scripting language for GenieACS is ECMA Script (aka Javascript). A pretty standard and very, very widely known language.