Overview

This documentation describes the order stack management API.

This REST API is also used internally by the MSactivator™ portal.

Each API is described below with the REST call, a textual description, the parameters and a section 'detail'. The 'detail' section provides some insight into the inner workings of the API. For instance, what is the database table impacted or what CoreEngine API command is being used.

The detail on the CoreEngine API command is very important because it is directly related to the adaptor implementation for a specific vendor.

API description

Add an order to the Stack

curl --location -s -k -H "Authorization: Bearer TOKEN“ -XPUT http://MSA_IP/ubi-api-rest/orderstack/command/{deviceId}/{commandName} -d {objectParameters}
Description

Adds a command in the stack and returns the ID of the order in the stack.

Parameters
  • deviceId: the database identifier of the managed device, for example: 123.

  • commandName: possible values are CREATE UPDATE IMPORT DELETE

  • objectParameters: in JSON format, for example:

'{
"interface" : {
   "port2" : {
       "ip" : "1.2.4.5",
       "object_id" : "port2",
       "mask" : "255.255.255.0"
         }
     }
}'
Detail

Write into database (redsms.sd_crud_object).

Generate the configuration from the stack

curl --location -s -k -H "Authorization: Bearer TOKEN“ -XGET http://MSA_IP/ubi-api-rest/orderstack/configuration/{deviceId}
Description

Generates the configuration based on the stacked orders for a device.

Parameters
  • deviceId: the database identifier of the managed device, for example: 123.

Detail

loop on commands in the stack call SMS verb end loop

The SMS verb is equivalent to the following CLI command command:

sms -e JSCALLCOMMAND -i 'deviceId commandName 0' -c 'objectParameters'
with the CLI command above the parameter 0 is used along with commands such as CREATE, UPDATE or DELETE and generate configuration without access to the database or the device

Generates the configuration and store the configuration from the stack

curl --location -s -k -H "Authorization: Bearer TOKEN“ -XPUT http://MSA_IP/ubi-api-rest/orderstack/configuration/{deviceId}
Description

Generates the configuration based on the stacked orders for a device and stores the configuration items in the database.

Parameters
  • deviceId: the database identifier of the managed device, for example: 123.

Detail
loop on commands in the stack
  call SMS verb
  write in database (redsms.sd_crud_object)
end loop

The SMS verb is equivalent to the following command: sms -e JSCALLCOMMAND -i 'deviceId commandName 1' -c 'objectParameters'

In the CLI command above the parameter 1 is used along with commands such as CREATE, UPDATE or DELETE and generate the configuration and stores the configuration items in the database.

The device configuration is not impacted.

Generate the configuration from the stack and apply to the device

curl --location -s -k -H "Authorization: Bearer TOKEN“ -XPOST http://MSA_IP/ubi-api-rest/orderstack/execute/{deviceId}
Description

Generates the configuration based on the stacked orders for a device and stores the configuration items in the database and executes all the commands on the device.

Parameters
  • deviceId: the database identifier of the managed device, for example: 123.

Detail
loop on commands in the stack
  call SMS verb
  write in database (table redsms.sd_crud_object)
  execute command on the device
end loop

The SMS verb is equivalent to the following command: sms -e JSCALLCOMMAND -i 'deviceId commandName 2' -c 'objectParameters'

with the CLI command above, the parameter 2 is used along with commands such as CREATE, UPDATE or DELETE which will generate the configuration, store the configuration items in the database and apply the configuration to the device.

List the orders in the stack

curl --location -s -k -H "Authorization: Bearer TOKEN“ -XGET http://MSA_IP/ubi-api-rest/orderstack/{deviceId}
Description

Lists the stacked orders for a device.

Parameters
  • deviceId: the database identifier of the managed device, for example: 123.

Detail

Read from the database (table redsms.sd_crud_object).

Get the detail of a stack command

curl --location -s -k -H "Authorization: Bearer TOKEN“ -XGET http://MSA_IP/ubi-api-rest/orderstack/command/{deviceId}/{commandId}
Description

Gets the detail of a stack command based on its identifier in the stack.

Parameters
  • deviceId: the database identifier of the managed device, for example: 123.

  • commandId: the identifier of the command in the stack.

Detail

Read in database (redsms.sd_crud_object).

Clear the stack

curl --location -s -k -H "Authorization: Bearer TOKEN“ -XDELETE http://MSA_IP/ubi-api-rest/orderstack/{deviceId}
Description

Clears the stack for a device.

Parameters
  • deviceId: the database identifier of the managed device, for example: 123.

Detail

Remove in database (redsms.sd_crud_object)

Delete a command from the stack

curl --location -s -k -H "Authorization: Bearer TOKEN“ -XDELETE http://MSA_IP/ubi-api-rest/orderstack/command/{deviceId}/{commandId}
Description

Deletes a command from the stack based on the command ID.

Parameters
  • deviceId: the database identifier of the managed device, for example: 123.

  • commandId: the identifier of the command in the stack.

Detail

Remove in database (redsms.sd_crud_object).

Apply the configuration for a device

curl --location -s -k -H "Authorization: Bearer TOKEN“ -XPUT http://MSA_IP/ubi-api-rest/device/push_configuration/{deviceId} -d {configuration}
Description

Perform a push configuration for a device.

Parameters
  • deviceId: the database identifier of the managed device, for example: 123.

  • configuration: the configuration in JSON format.

Example
{
    "configuration": "config system interface\nedit port1\nset ip 192.168.1.10 255.255.255.0\nend"
}
Detail

Applies the configuration to the device.

Get the status of the API push_configuration

curl --location -s -k -H "Authorization: Bearer TOKEN“  -X GET http://MSA_IP/ubi-api-rest/device/push_configuration/status/{deviceId}
Description

Gets the status of the push configuration from the device.

Parameters

deviceId: the database identifier of the managed device, for example: 123.

Detail

Read the status from the database.