I recently discovered that the Comware auto-configuration feature also supports Python scripts. In the traditional auto configuration setup, a TFTP server and TFTP boot filename are used to deploy a (basic initial) configuration to the network devices.
This configuration boot file had to be a classic configuration file, as it would exist on the normal CLI.
With Comware 7 devices, an administrator can also make a Python script and save this script on a Web server. Using the DHCP boot file option (same as for the TFTP boot file), the administrator can point to the URL of the script file.
On a Linux dhcp server, this example configures a DHCP host static reservation and sets the boot file name (typically used for a TFTP boot file) to the Python file as HTTP download.
host vsr-sc-r1 { hardware ethernet 00:50:56:a1:59:66; fixed-address 10.254.1.115; filename "http://10.254.1.1/autodeploy.py"; }
When the factory default device boots, it will get the IP address, then it will download and execute the Python script. The setup was tested using a VSR router, which will use the G1/0 (first interface of the VM) as the management interface.
Thanks for the tip Peter,
It really works great!
I use it to deploy HP5130 Switches in combination with HP iMC.
https://github.com/networkingdvi/HPN-Scripting/blob/master/5130_irf-config.py
Remi