Appendix: ZTP API
The ZTP makes use of the API (application programming interface) defined in the ztp-functions.sh file located in the /usr/bin directory.
The API description is shown as below, and you can refer to it when configuring the ZTP function, such as running the generate_script to generate the provision script.
NOTE:
For APIs with name changed, please use the correct name in the corresponding version, or the error prompt will appear.
API | Description | Parameter | Return Value | Supported Version |
ztp_disable | Disable ZTP auto-run when switch boots up | None | 0 = success, 1 = failed | All |
ztp_enable | Enable ZTP auto-run when switch boots up | None | 0 = success, 1 = failed | All |
add_remote_syslog_server <ip-addrees> | Add the remote Syslog server | Parameter #1: the IP address of remote Syslog server (eg: 192.168.1.200) | 0 = success, 1 = failed | All |
remove_remote_syslog_server <ip-address> | Remove the remote Syslog server | Parameter #1: the IP address of remote Syslog server (eg: 192.168.1.200) | 0 = success, 1 = failed | All |
tftp_get_file <file-name1> <file-name2> <ip-address> | Get file from TFTP server | Parameter #1: file name in TFTP server Parameter #2: file name with path in local Parameter #3: IP address of TFTP server | 0 = success, 1 = failed | All |
http_get_file <file-name> <file-url> | Get file from HTTP server | Parameter #1: file name with path in local Parameter #2: file name with HTTP server URL | 0 = success, 1 = failed | V4.5.0E or later versions |
get_l2l3_config_file <file-name> <ip-address> | Get PicOS configuration file "pica_startup.boot" from file server | Parameter #1: For TFTP download: it is the configuration file name with path on TFTP sever For HTTP download: it is the configuration file name with HTTP server URL. Parameter #2 does not need to be set Parameter #2: TFTP server IP address, if not set, the TFTP server IP address from DHCP server will be used | 0 = success, 1 = failed | V4.5.0E or later versions Note: in the previous versions, the name is tftp_get_l2l3_config_file. |
get_ovs_config_file <file-name> <ip-address> Â | Get PicOS OVS configuration file "ovs-vswitchd.conf.db" from file server | Parameter #1: For TFTP download: it is the configuration file name with path on TFTP sever For HTTP download: it is the configuration file name with HTTP server URL. Parameter #2 does not need to be set Parameter #2: TFTP server IP address, if not set, the TFTP server IP address from DHCP server will be used | 0 = success, 1 = failed | V4.5.0E or later versions Note: in the previous versions, the name is tftp_ get_ovs_config_file. Â |
get_picos_startup_file <file-name> <ip-address>   | Get PicOS startup file "picos_start.conf" from file server  | Parameter #1: For TFTP download: it is the startup file name with path on TFTP sever For HTTP download: it is the startup file name with HTTP server URL. Parameter #2 does not need to be set Parameter #2: TFTP server IP address, if not set, the TFTP server IP address from DHCP server will be used | 0 = success, 1 = failed | V4.5.0E or later versions Note: in the previous versions, the name is tftp_ get_picos_startup_file.  |
get_picos_image <file-name> <ip-address>  | Get PicOS image from file server and upgrade   | Parameter #1: For TFTP download: it is the image file name with path on TFTP sever For HTTP download: it is the image file name with HTTP server URL. Parameter #2 does not need to be set Parameter #2: TFTP server IP address, if not set, the TFTP server IP address from DHCP server will be used | 0 = success, 1 = failed | V4.5.0E or later versions Note: in the previous versions, the name is tftp_ get_picos_image.  |
l2l3_load_config <file-name> <ip-address> Â | Get a file with PicOS L2/L3 commands list, and execute these commands. | Parameter #1: For TFTP download: it is the commands file name with path on TFTP sever For HTTP download: it is the commands file name with HTTP server URL. Parameter #2 does not need to be set Parameter #2: TFTP server IP address, if not set, the TFTP server IP address from DHCP server will be used | 0 = success, 1 = failed | All |
Copyright © 2024 Pica8 Inc. All Rights Reserved.