Too many commits

Hi,
I have two virtual parameters, one for the username of PPPoE and one for the password.
When I edit these two parameters from the device and then I commit the two pending tasks I have a fault of “Too many commits”, if I click “retry” all works. Why?

Thank you for the support!

Please post your vparam scripts for the pppoe username and password and the relevant parts of your provision script? An explicit commit() is not needed either, except in very rare situation.

Also, any reason you are using a vparam for the pppoe username/password? You can set the pppoe creds more simply like this and let the ACS figure things out for you:

let now = Date.now()
declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANPPPConnection.*.Username", {value: now}, {value: config.username});
declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANPPPConnection.*.Password", {value: now}, {value: config.password});
declare("Device.PPP.Interface.*.Username", {value: now}, {value: config.username});
declare("Device.PPP.Interface.*.Password", {value: now}, {value: config.password});

This is my vparam for un

let username = “”;
if (typeof(args[1])==‘object’ && ‘value’ in args[1]) {
// Set declared value
username = args[1].value;
declare(“InternetGatewayDevice.WANDevice..WANConnectionDevice..WANPPPConnection..Username", null, {value: username});
} else {
let igd = declare("InternetGatewayDevice.WANDevice.
.WANConnectionDevice..WANPPPConnection..Username”, {value: 1});

if (igd.size) {
    for (let p of igd) {
        if (p.value[0]) {
            username = p.value[0];
            break;
        }
    }
}

}

return {writable: true, value: [username, “xsd:string”]};

this is my vparam for pw

let password = “”;
if (typeof(args[1])==‘object’ && ‘value’ in args[1]) {
// Set declared value
password = args[1].value;
declare(“InternetGatewayDevice.WANDevice..WANConnectionDevice..WANPPPConnection..Password", null, {value: password});
} else {
let igd = declare("InternetGatewayDevice.WANDevice.
.WANConnectionDevice..WANPPPConnection..Password”, {value: 1});

if (igd.size) {
    for (let p of igd) {
        if (p.value[0]) {
            password = p.value[0];
            break;
        }
    }
}

}

return {writable: true, value: [password, “xsd:string”]};

And this is my piece of code where I call my vparam

declare("VirtualParameters.pppoeUsername", {value: now});
declare("VirtualParameters.pppoePassword",{value:now});

I’m using vparams for setting the username and the password pppoe from the device parameters…
My colleagues prefer that way.

With your piece of code how does it?

It works by setting the username/password on any WANPPPConnection instance or and Device.PPP instance. I use this in production and it works without any issues.

Your vparam scripts aren’t working because the path in the declares is invalid. I suggest you review the documentation.

This code will never set the username/password. There is no value provided. I highly suggest you engage the professional services @zaidka has to offer.

But…you didn’t understand me…If I edit the VirtualParameters.pppoePassword and VirtualParameters.pppoeUsername from the device parameters (as my colleagues want). On my CPE they change and it works!

But the problem is that:

To do what I’ve described, don’t I even need the provision script?

Okay, now I understand the requirements. To set the un/pw from the device params page, yes this approach works.

But I would ask why you are manually setting the un/pw? This should be something that is entirely automatic. In our environment, the CPE comes online, we check the state the CPE should be in, configure it as such and the account is online. If the customer factory defaults the CPE, recovery happens automatically.

As to why you get too many commit iterations error, specify the time param:

declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANPPPConnection.*.Password", {value: Date.now()}, {value: password});

I’m manually setting un/pw because my colleagues want this, I don’t know why, because I’m new in this place and they didn’t explain much to me, they just gave me this task to do.

Anyway I tried to do this, but I have the same fault: “Too many commit iterations” when I change un/pw and then I commit

I just ask you one more time if my provision script is useless for doing what I’ve described

You are using wildecard (*) to provision values. I am not sure if that is possible because I never thought of doing that. I suspect that you get too many commit irritations because your declare statements walk entire trees of parameters.

The number of parameters is limited to 32 by default. You can set an environment variable to increase this limit, but I would not recommend to solve your problem by doing so.

It works the second time because your newly set parameters are probably skipped. The declare statement is pretty smart about that. Hence the limits are not reached then.

You probably want to change the wild cards for numbers. Most probably just number just 1. Or perhaps use a for-loop limited to the numbers you need for what you want.

Its entirely possible. Its how I provision our CPEs, and I have absolutely no issues:

declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANPPPConnection.*.Username", {value: now}, {value: config.username});
declare("InternetGatewayDevice.WANDevice.*.WANConnectionDevice.*.WANPPPConnection.*.Password", {value: now}, {value: config.password});

Cool, I am learning every day :slight_smile:

And my provision script is useless for doing this?

I solved the problem by removing “xsd:string”
before:

return {writable: true, value: [username, "xsd:string"]};

now:
return {writable: true, value: username};

Now it works without faults

I explained to my colleagues that there is the possibility of auto provision and now they want to do it this way.
But how do I get the pppoe to be pushed back?
I don’t understand…I need to write for example a CSV with customerCode; name; serialNumber; PPoE?
With this the PPPoE where is it get from?

NAME:
SyntaxError

MESSAGE:
Unexpected token < in JSON at position 0

STACK:
SyntaxError: Unexpected token < in JSON at position 0
at JSON.parse ()
at IncomingMessage. (/usr/lib/node_modules/genieacs/config/ext/cpe-config.js:35:31)
at emitNone (events.js:111:20)
at IncomingMessage.emit (events.js:208:7)
at endReadableNT (_stream_readable.js:1064:12)
at _combinedTickCallback (internal/process/next_tick.js:139:11)
at process._tickCallback (internal/process/next_tick.js:181:9)