Zero Touch Provisioning API

Pica8 PicOS ZTP (Zero Touch Provisioning) makes use of the API (application programming interface) defined in the ztp-functions.sh file located in the /usr/local/bin directory.

The /usr/local/bin/ztp-functions.sh file is dscribed as API interface for auto-provisioning scripts. The following functions are defined in the ztp-functions.sh file, which can be used in ZTP scripts:

APIDescriptionParameterReturn ValueSupported Version
ztp_disableDisable ZTP auto-run when switch boot upNone

0 = success,

1 =  failed

All
ztp_enableEnable ZTP auto-run when switch boot upNone

0 = success,

1 =  failed

All
add_remote_syslog_server <ip-addreAs> Add 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 remote syslog server

Parameter #1: the IP address of remote syslog server

(eg: 192.168.1.200)

0 = success,

1 =  failed

All
picos_config <number> <ip-address> <gateway-ip> Set the configuration for PicOS service

Parameter #1: the server selected,

         1 for PicOS L2/L3,

         2 for OVS,

         3 for none service                                     

Parameter #2: a static IP and netmask for the switch

(e.g. 128.0.0.10/24) when parameter #1 is set to 2                           

Parameter #3: the gateway IP (e.g. 172.168.1.2) when

parameter #1 is set to 2

0 = success,

1 =  failed

2.11 and  versions before 2.11
picos_start_stop <action> The action of PicOS service

Parameter #1:                                                                    

start: start the PicOS service                                             

stop: stop the PicOS service                                              

restart: restart the PicOS service                                      

status: get the status of PicOS service

0 = success,

1 =  failed

2.11 and  versions before 2.11
picos_l2l3_start Start PicOS L2/L3None

0 = success,

1 =  failed

2.11 and  versions before 2.11
picos_l2l3_restart Restart PicOS L2/L3None

0 = success,

1 =  failed

2.11 and  versions before 2.11
picos_l2l3_stop Stop PicOS L2/L3None

0 = success,

1 =  failed

2.11 and  versions before 2.11
picos_ovs_start <ip-address> <gateway-ip>Start PicOS OVS, parameters are needed if PicOS is not set in OVS mode.

Parameter #1: eth0 IP address and netmask

(eg: 192.168.0.2/24)

Parameter #2:gataway IP (eg: 192.168.1.1)

0 = success,

1 =  failed

2.11 and  versions before 2.11
picos_ovs_restart <ip-address> <gateway-ip>Restart PicOS OVS, parameters are needed if PicOS is not set in OVS mode.

Parameter #1: eth0 IP address and netmask

(eg: 192.168.0.2/24)

0 = success,

1 =  failed

2.11 and  versions before 2.11
picos_ovs_stopStop PicOS L2/L3None

0 = success,

1 =  failed

2.11 and  versions before 2.11
tftp_get_file <file-name> <file-name> <ip-address>Get file from TFTP server

Parameter #1: file name in TFTP server

Parameter #2: file name with path in local

Parameter #3: TFTP server IP address

0 = success,

1 =  failed

All
tftp_get_l2l3_config_file <file-name> <ip-address>Get PicOS L2/L3 configuration from TFTP server

Parameter #1: configuration file name with path on TFTP sever

Parameter #2: server IP address, if not set, the TFTP server IP address from DHCP server will be used

0 = success,

1 =  failed

All
tftp_get_ovs_config_file <file-name> <ip-address>Get PicOS OVS configuration file

Parameter #1: configuration file name with path on TFTP sever

Parameter #2: server IP address, if not set, the TFTP server IP address from DHCP server will be used

0 = success,

1 =  failed

All
tftp_get_picos_config_file <file-name> <ip-address>Get PicOS configuration file from TFTP server

Parameter #1: configuration file name with path on TFTP sever

Parameter #2: server IP address, if not set, the TFTP server IP address from DHCP server will be used

0 = success,

1 =  failed

All
tftp_get_picos_image <file-name> <ip-address>Get PicOS image from TFTP server

Parameter #1: configuration file name with path on TFTP sever

Parameter #2: server IP address, if not set, the TFTP server IP address got from DHCP server will be used

0 = success,

1 =  failed

All
tftp_get_pica_image <file-name> <ip-address>Get Pica Image from TFTP server

Parameter #1: configuration file name with path on TFTP sever

Parameter #2: server IP address, if not set, the TFTP server IP address from DHCP server will be used

0 = success,

1 =  failed

All
l2l3_cmd_shell <commands>Run an CLI command of PicOS L2/L3Parameter #1: linux shell command(s)

0 = success,

1 =  failed

All
l2l3_load_config <file-name> <ip-address>Get a file with PicOS L2/L3 CLI commands list, and execute these commands.

Parameter #1: configuration file name with path on TFTP sever

Parameter #2: server IP address, if not set, the TFTP server IP address got from DHCP server will be used

0 = success,

1 =  failed

All
ovs_cmd_shell <commands>Run an OVS commandParameter #1: linux shell command(s)

0 = success,

1 =  failed

All
ovs_load_config <ip-address> <gateway-ip> <file-name> <ip-address>Get a file with PicOS OVS commands list, and execute these commands.

Parameter #1: if PicOS is not set to OVS, then it should be eth0 IP address and netmask, 192.168.0.2/24, otherwise “ ”

Parameter #2: if PicOS is not set to OVS, then gateway IP, otherwise “ ”

Parameter #3: file name with path on TFTP server

Parameter #4: server IP address, if not set, the TFTP server IP address from DHCP server will be used

N/AAll



Copyright © 2024 Pica8 Inc. All Rights Reserved.