Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

gNOI File Service

Use the gNOI File service to manage files on a network device.

Use the File service RPCs to transfer and delete files or retrieve information about files. The proto definition file is located at https://github.com/openconfig/gnoi/blob/master/file/file.proto.

Supported RPCs

Table 1: Supported file.proto RPCs
RPC Description Introduced in Release
Get()

Read and stream the contents of a file from the target.

The file is streamed by sequential messages, each message containing up to 64KB of data. A final message is sent prior to closing the stream that contains the hash of the data sent. The operation returns an error if the file does not exist or there is an error reading the file.

Junos OS Evolved 22.2R1

Put()

Stream data to a file on the target.

The file is sent in sequential messages, each message containing up to 64KB of data. A final message must be sent that includes the hash of the data.

The operation returns an error if the location does not exist or there is an error writing the data. If no checksum is received, the target removes the partially transmitted file. A failure will not alter any existing file of the same name.

Junos OS Evolved 22.2R1

Remove()

Remove the specified file from the target. The operation returns an error if the file does not exist, if the file path resolves to a directory, or if the remove operation encounters an error.

Junos OS Evolved 22.2R1

Stat()

Return metadata about a file on the target device. The operation returns an error if the file does not exist or there is an error accessing the metadata.

Junos OS Evolved 22.2R1

Network Device Configuration

Before you begin:

To perform file operations on the target device, the client must have the appropriate permissions to interact with the file system.

Example: Get File

This example provides a simple Python application, gnoi_file_get.py, to download a file from the target device to the local network management system.

The application imports the grpc_channel module to establish the channel. The grpc_channel module is described in Configure gNOI Services. The application's arguments are stored in the args_file_get.txt file. The application and argument files are presented here.

gnoi_file_get.py

args_file_get.txt

Execute the Application

When the client executes the application, it transfers the specified file from the target device to the local device.

Example: Put File

This example provides a simple Python application, gnoi_file_put.py, to upload a file from the local network management system to the target device.

The application imports the grpc_channel module to establish the channel. The grpc_channel module is described in Configure gNOI Services. The application's arguments are stored in the args_file_put.txt file. The application and argument files are presented here.

gnoi_file_put.py

args_file_put.txt

Execute the Application

When the client executes the application, it transfers the specified file from the local device to the target device and sets the file permissions according to the dest_file_mode value.