How to transfer files between the NCM server and managed devices using client-based custom commands?
Network Configuration Manager (NCM) supports file transfer between the NCM server and managed end devices using custom commands. These file transfers are performed through protocol-specific clients such as TFTP, SCP, and SFTP, depending on the configuration and services available on the managed device.
File transfer using TFTP client
Prerequisites
- Ensure that the remote server (managed device) has a TFTP server enabled and running.
- The TFTP server must have read and write permissions for the folder and file being accessed.
Commands
1. tftp_download "<source_path>" "<destination_path>"
Use this command to transfer files from a remote TFTP server to the NCM server.
- <source_path> - Represents the relative file path on the remote server from which the file needs to be transferred. For TFTP, the path must be relative to the directory that the TFTP server has access to.
- <destination_path> - Represents the destination path on the NCM server. This must be specified as: "../tftp_files/<fileName>"
Example: tftp_download "test.txt" "../tftp_files/test.txt"
2. tftp_upload "<source_path>" "<destination_path>"
Use this command to transfer files from the NCM server to a remote TFTP server.
- <source_path> - Must be specified as: "../tftp_files/<fileNameToBeTransferred>". This refers to the file location on the NCM server.
- <destination_path> - Represents the relative destination path on the remote server. The file will be transferred to the directory that the TFTP server has access to.
Example: tftp_upload "../tftp_files/test.txt" "test.txt"
File transfer using SCP and SFTP clients
Prerequisites
- Ensure that the remote server (managed device) has an SCP or SFTP service running.
Commands
1. scp_download "<source_path>" "<destination_path>"
Use this command to transfer files from a remote SCP server to the NCM server.
- <source_path> - Represents the full or relative file path on the remote server from which the file needs to be transferred.
- <destination_path> - Represents the destination path on the NCM server and must be specified as: "../tftp_files/<fileName>"
Example: scp_download "test.txt" "../tftp_files/test.txt"
2. scp_upload "<source_path>" "<destination_path>"
Use this command to transfer files from the NCM server to a remote SCP server.
- <source_path> - Must be specified as: "../tftp_files/<fileNameToBeTransferred>". This refers to the file location on the NCM server.
- <destination_path> - Represents the destination file path on the remote server.
Example: scp_upload "../tftp_files/test.txt" "test.txt"
3. sftp_download "<source_path>" "<destination_path>"
Use this command to transfer files from a remote SFTP server to the NCM server.
- <source_path> - Represents the file path on the remote SFTP server from which the file needs to be transferred.
- <destination_path> - Represents the destination path on the NCM server and must be specified as: "../tftp_files/<fileName>"
Example: sftp_download "test.txt" "../tftp_files/test.txt"
4. sftp_upload "<source_path>" "<destination_path>"
Use this command to transfer files from the NCM server to a remote SFTP server.
- <source_path> - Must be specified as: "../tftp_files/<fileNameToBeTransferred>". This refers to the file location on the NCM server.
- <destination_path> - Represents the destination file path on the remote SFTP server.
Example: sftp_upload "../tftp_files/test.txt" "test.txt"