Closed FlorianP2023 closed 10 months ago
Hello again, I managed to put the firmware update command in a macro. But this is static, but I have to use different filenames for different firmware image (and also in future).
So is there a way to interact with the switch cli using the script (in the window)?
For example, I send function run(cli, device) { cli.macro("enable"); cli.command("copy tftp://10.9.112.75/N1100v6.7.1.21.stk backup"); cli.command("boot system backup"); } The switch CLI response is "Are you sure you want to start? (y/n) ". The script stops here and runns into a timeout. How to send the neccessary "y"? Any idea? I have similiar problems with other commands that have to be confirmed. I'm sure there is way but I don't see it. Again, any help is very much appreciated. See also attached log.
Regards fwupdate-log.txt
Macros with params could be useful indeed. For the time being you should be able to do something like:
cli.command("copy tftp://10.9.112.75/N1100v6.7.1.21.stk backup", {
mode: {
prompt: /Are you sure you want to start? \(y\/n\)/,
},
timeout: 300000,
});
cli.command("y");
Thank you very much.
I will try when I'm back in the office.
Regards
Thank you very much, it works now and I could update my switches on the fly (over 200).
Is there a documentation which commands I can use in the scripts? I added one item to the device called "Last Snapshot" and wanted to fill it with the date of the snapshot (during the snapshot).
I used for this device.set("lastSnapshot", getDate()); but it fails. How can I populate this field with the actual date and time?
Regards, Florian
Hello!
I'm still waitung for an answer. Again, does anybody know how to get the actual time inside the scripting? Is there a documentation for the script language? (is java script fully supported?)
Thanks for your help Florian
this is just javascript.
this should be work
var date = new Date();
date.getTime()
Hello, I would like to implement a simple task for firmwareupdate.
The following command does the copy task: "copy tftp://1.1.1.1/firmware.dat backup" But you have to confirm by pressing "y" afterwards (on the CLI). I dont know how to implement this. Is there an example for this? My implementation doesn't work since it is not sending "y" to confirm.
function run(cli, device) { cli.macro("configure"); cli.command("copy tftp://10.10.10.10/N1100v6.7.1.21.stk backup"); cli.macro("end"); }
In addition the copy task will take up to 5 min. Will I run into a timeout? (and how to avoid this?) Any help is appreciated. Regards