jnx_management_service.proto

Service

Management

Junos configuration and operational management service.

Method Name Request Type Response Type Description
OpCommandGet OpCommandGetRequest OpCommandGetResponse Run an operational command
ConfigSet ConfigSetRequest ConfigSetResponse Perform configuration operation on static database
EphemeralConfigGet EphemeralConfigGetRequest EphemeralConfigGetResponse Retrieve epehemral configuration from the device
EphemeralConfigSet EphemeralConfigSetRequest EphemeralConfigSetResponse Perform configuration operation on the ephemeral database

RPC(s)

The following APIs are provided by this service:

OpCommandGet

This RPC returns the operational command output as a streamed response

Input: OpCommandGetRequest

Output: OpCommandGetResponse

Example(s):

stub = jnx_management_service_pb2_grpc.ManagementStub(channel)

request = jnx_management_service_pb2.OpCommandGetRequest(
   xml_command = "<get-software-information></get-software-information>"
   out_format = 1)

response = stub.OpCommandGet(request, _TIMEOUT_SECONDS)

if response.status.code == jnx_common_base_types_pb2.FAILURE:
   print "Error Message" + response.status.message
else:
   print "Command successful."

ConfigSet

Load and commit configuration onto a Junos device

Input: ConfigSetRequest

Output: ConfigSetResponse

Example(s):

stub = jnx_management_service_pb2_grpc.ManagementStub(channel)

configuration = """
    <configuration>
        <interfaces>
            <interface>
                <name>ge-1/0/0</name>
                <unit>
                    <name>0</name>
                    <description>foo</description>
                </unit>
            </interface>
        </interfaces>
    </configuration>
"""

commitMessage = jnx_management_service_pb2.ConfigCommit(
   type= jnx_management_service_pb2.CONFIG_COMMIT, comment="Lego commit")
request = jnx_management_service_pb2.ConfigSetRequest(
   xml_config = configuration, load_type = jnx_management_service_pb2.CONFIG_LOAD_MERGE,
   commit = commitMessage)
response = stub.ConfigSet(cfgRequest, _TIMEOUT_SECONDS)

if response.status.code == jnx_common_base_types_pb2.FAILURE:
   print "Error Message" + response.status.message
else:
   print "Config Set successful."

EphemeralConfigGet

Retrieve epehemral configuration from the device

Input: EphemeralConfigGetRequest

Output: EphemeralConfigGetResponse

Example(s):

stub = jnx_management_service_pb2_grpc.ManagementStub(channel)

get_request = jnx_management_service_pb2.ConfigPathRequest (id = "1",
   path = "/configuration/interfaces/interface/")
request = jnx_management_service_pb2.EphemeralConfigGetRequest(
   encoding=0, config_requests=[get_request], instance_name = "instance")
response = stub.EphemeralConfigGet (request, _TIMEOUT_SECONDS)
if response.status.code == jnx_common_base_types_pb2.FAILURE:
   print "Error Message" + response.status.message
else:
   print "Ephemeral Config Get successful."

EphemeralConfigSet

Load and commit configuration onto Junos device's epehemral database

Input: EphemeralConfigSetRequest

Output: EphemeralConfigSetResponse

Example(s):

INTF_ADD_XML = """
<configuration>
    <interfaces>
        <interface>
            <name>ge-1/0/0</name>
            <unit>
                <name>0</name>
                <description>foo</description>
            </unit>
        </interface>
    </interfaces>
</configuration>
"""

stub = jnx_management_service_pb2_grpc.ManagementStub(channel)

cfg_request = jnx_management_service_pb2.EphemeralConfigSetRequest.ConfigOperation(
   id = "1", operation=jnx_management_service_pb2.CONFIG_OPERATION_UPDATE,
   xml_config=INTF_ADD_XML)

request = jnx_management_service_pb2.EphemeralConfigSetRequest(
   config_operations = [cfg_request], instance_name = "instance1")
response = stub.EphemeralConfigSet(request, _TIMEOUT_SECONDS)
if response.status.code == jnx_common_base_types_pb2.FAILURE:
   print "Error Message" + response.status.message
else:
   print "Ephemeral Config Set successful."

Message(s)

This IDL defines the following message type(s)

OpCommandGetRequest

Operational command request type to pass to the OpCommandGet RPC

Field Type Description
cli_command string standard cli command input
xml_command string xml command input
out_format OpCommandOutputFormat Output format, default is JSON

OpCommandGetResponse

Request message for executing an operational command

Field Type Description
status RpcStatus RPC execution status information
data string Operation command output

ConfigSetRequest

Request type to represent the configuration operation to be performed on the static Junos config database.

Field Type Description
xml_config string config in xml format
json_config string config in json format
text_config string config in text format
load_type ConfigLoadType Type of config load operation
commit ConfigCommit Commit info associated with this configuration operation

ConfigSetResponse

Request type to represent the configuration operation response from a ConfigSet RPC.

Field Type Description
status RpcStatus RPC execution status information

EphemeralConfigGetRequest

Request for retrieving configuration data from an ephemeral database

Field Type Description
encoding ConfigGetOutputFormat Encoding format for the returned config
config_requests ConfigPathRequest List of configuration paths to retrieve configuration for
instance_name string Name of ephemeral configuration database instance

EphemeralConfigGetResponse

Request type to represent the configuration responses from a EphemeralConfigGet RPC.

Field Type Description
status RpcStatus RPC execution status information
config_responses ConfigPathResponse List of responses for each configuration path request

EphemeralConfigSetRequest

Request type to represent a group of configuration operations to be applied to the Ephemeral configuration database.

Field Type Description
config_operations ConfigOperation List of configuration operations to apply together as part of this request
instance_name string Name of the Ephemeral configuration database instance
validate_config bool Enable validation of config
load_only bool Do a load only operation

EphemeralConfigSetResponse

Request type to represent the configuration operation responses from a EphemeralConfigSet RPC.

Field Type Description
status RpcStatus RPC execution status information
operation_responses ConfigOperationResponse List of responses for each configuration operation

ConfigPathResponse

Response corresponding to a ConfigPathRequest message sent over the EphemeralConfigGet RPC

Field Type Description
status RpcStatus Status code and message for the corresponding ConfigPathRequest
id string Response id corresponding to the ConfigPathRequest id
path string Requested config path
value string Configuration data for the requested configuration path

ConfigCommit

Configuration commit options

Field Type Description
type ConfigCommitType Specify the type of commit operation
comment string Specify the comment for the commit log

ConfigOperationResponse

A message representing response to a single configuration operation request

Field Type Description
status RpcStatus Status code and message for configuration operation request
id string Response id corresponding to the ConfigRequest id

ConfigOperation

A message to represent a single configuration operation.

Field Type Description
id string Identifier for this configuration operation
operation ConfigOperationType Type of configuration modification
path string Configuration path to apply the operation
xml_config string configuration in xml format
json_config string configuration in json format

ConfigPathRequest

configuration path from which to retrieve the configuration data. The 'id' needs to be set for each path request to help associate the responses to the corresponding path.

Field Type Description
id string Identifier for the request
path string Data model path to retrieve

Enum(s)

ConfigCommitType

Type of commit to run after loading the configuration

Value Description
CONFIG_COMMIT Regular commit on current routing engine
CONFIG_COMMIT_SYNCHRONIZE Sync and commit configuration to both routing engines

ConfigGetOutputFormat

Encoding format types for the returned configuration data

Value Description
CONFIG_GET_OUTPUT_JSON JSON format
CONFIG_GET_OUTPUT_XML XML format

ConfigOperationType

Type of operation associcated with a configuration set request

Value Description
CONFIG_OPERATION_UPDATE Update the config

ConfigLoadType

The load operation type to apply for the configuration set request.

Value Description
CONFIG_LOAD_MERGE Combines existing configuration with payload
CONFIG_LOAD_REPLACE Replace parts of existing configuration
CONFIG_LOAD_OVERRIDE Replace existing configuration with payload configuration
CONFIG_LOAD_UPDATE Update existing configuration hierarchies with payload configuration
CONFIG_LOAD_SET Load input configuration consisting of set commands

OpCommandOutputFormat

Output format types for an operational command response

Value Description
OP_COMMAND_OUTPUT_JSON JSON format
OP_COMMAND_OUTPUT_XML XML format
OP_COMMAND_OUTPUT_CLI CLI Text format