Tasks

Description

Allows users to manipulate tasks in NEO

Request URL

/neo/app/tasks

Main Operations

  • Create New Task

  • Get Tasks

  • All Tasks

  • Specific Tasks

  • Run Task

  • Remove Task

  • Update Task

Warning

Users can create, delete, fetch and run tasks using REST API.

Create Provisioning Task Using Explicit CLI Commands

Description

Creates a new task in NEO using explicit CLI commands

Request URL

POST /neo/app/tasks

Response

HTTP Response location header will contain URI with Task ID that was created

Response:

Copy
Copied!
            

{ "action":"run_cli", "params":{ "commandline":[ "<cli_command>" ], "arguments":{ "globals":{}, "devices":{ "<system_IP>":{} } } }, "description":"", "object_ids":[ "<system_IP>" ] target_type":<type_of_target>, } { "application": { "version": "1.9.0-15062017", "name": "Mellanox NEO" }, "next": "/neo", "server": { "ip": "10.212.220.1", "name": "dev-r-vrt-220.mtr.labs.mlnx" } }


Create a New Provisioning Task Using Template Name

Description

Creates a new task in NEO using template name

Request URL

POST /neo/app/tasks

Response

HTTP Response location header will contain URI with Task ID that was created

Request Data:

Copy
Copied!
            

{"action":"run_cli","description":"Shows list of trap- receivers","object_type":"System",target_type":"system","object_ids":["10.224.26.118"], "params":{"commandline":["#!desc: Shows list of trap- receivers","#!system_profile:","#!system_type: mlnxos_switch","#!owner: *system*","show snmp host"],"arguments":{"globals":{}}}}


Create a New Software Upgrade Task

Description

Creates a new software upgrade task in NEO

Request URL

POST /neo/app/tasks

Response

HTTP Response location header will contain URI with Task ID that was created

Request Data:

Copy
Copied!
            

{ "action": "sw_upgrade", "params": { "description": "", "protocol": "scp", "server": "<host_name>", "path": "<image_path>", "image": "<selected_image>", "username": "<username>", "password": "<password>"  }, "object_ids": ["<system_IP>"], "description": ""  }


Create a New Reboot Task

Description

Creates a new reboot task in NEO

Request URL

POST /neo/app/tasks

Response

HTTP Response location header will contain URI with Task ID that was created

Request Data:

Copy
Copied!
            

{ "action": "reboot", "params": { }, "description": "Switch reboot", "object_ids": ["<system_IP>"] }


Create a New Apply Configuration Task

Description

Creates a new Apply Configuration task

Request URL

POST /neo/app/tasks

Response

HTTP Response location header will contain URI with Task ID that was created

Request Data:

Copy
Copied!
            

{ "action":"apply_conf", "description":"Apply Config", "object_ids":["10.209.37.30", "10.209.37.13"],   "object_type":"System", "params":{ "file_id": "conf_file_global.global_test_avi2", "arguments": { "globals": {}, "devices": { "10.209.37.30": { "switch_hostname": "r-ufm-sw56" }, "10.209.37.13": { "switch_hostname": "r-ufm-sw55" } } } }, "target_type":"System", "task_type":"" }


Create a New Generate Dump Task

Description

Creates a new Generate Dump task

Request URL

POST /neo/app/tasks

Response

HTTP Response location header will contain URI with Task ID that was created

Request Data:

Copy
Copied!
            

{  "action":"generate_dump",  "params":{  "description":"decription",  "protocol":"scp",  "server":"10.224.14.231",  "path":"/path/to/send/dump",  "username": "username",  "password": "password"  },  "description": "description",  "target_type": "System",  "object_type":"System",  "object_ids":["10.209.36.161"] }


Description

Retrieves information for all tasks in NEO

Request URL

GET /neo/app/tasks

Request Data

N/A

Response:

Copy
Copied!
            

{ "lastJobId": "", "description": "Shows list of trap-receivers", "schedule": {}, "instanceID": "922cbf60-f4a8-4646-82bc-c6ce405dc4ff", "createdOn": "2016-01-04 13:40:44", "object_type": "System", "object_ids": [ "10.224.26.118" ], "parent_task_id": null, "target_type": "System", "action": "Provisioning", "readOnly": false, "params": { "commandline": [ "show snmp host" ], "arguments": { "globals": {} } }, "lastRunTime": null, "owner": "admin"  }

Description

Retrieves information for specific tasks in NEO

Request URL

GET /neo/app/tasks/<list_of_Task_IDs>

Request Data

N/A

Response:

Copy
Copied!
            

{ "lastJobId": "", "description": "Setting MTU on interfaces", "schedule": {}, "instanceID": "581513fa-63ac-442f-a89b-03552fd316e2", "createdOn": "2016-12-11 14:20:03", "object_type": "EthernetPort", "object_ids": [ { "10.209.24.148": [ "1/2", "1/5"  ] } ], "parent_task_id": null, "target_type": "EthernetPort", "action": "Provisioning", "readOnly": false, "task_type": "", "params": { "commandline": [ "interface ethernet <interface_range> mtu <MTU_size> force" ], "arguments": { "globals": { "MTU_size": "1500"  } } }, "lastRunTime": "2016-12-13 13:16:09", "owner": "admin", "hidden": false  },

Warning

The user can use Tasks IDs in Request URL to filter tasks returned.

Description

Runs an existing task in NEO

Request URL

POST /neo/app/tasks/<Task_ID>/run

Request Data

N/A

Response

HTTP response location header will contain URI with Job ID created for the running task.

Status Codes

Note: Status code 202 ACCEPTED means that task is running and a job has been created for this task

Description

Removes an existing task from NEO

Request URL

DELETE /neo/app/tasks/<Task_ID>

Request Data

N/A

Response

N/A

Status Codes

Note: Status code 204 NO CONTENT mean that task was removed successfully

Description

Updates an existing task data

Request URL

PUT /neo/app/tasks/<Task_ID>

Response

HTTP response location header will contain URI with task id of the updated task.

Status Codes

Note: Status code 403 FORBIDDEN occurs when trying to set a schedule when not applicable

Request Data:

Copy
Copied!
            

{ "description": "new description", "object_ids": ["10.224.15.89"], "params": { "commandline": [ "show voltage" ], "arguments": { "globals": {} }}, "timeout": 1, "schedule": { "instanceID": "14b2ff5a-0ad6-45ec-9e0f-11879a348386", "active": true, "trigger": "date", "date": "2019-1-24 19:59:06", "timezone": "Asia/Jerusalem" } }

Description

Get the output of the last job of the given task

Request URL

GET /neo/app/tasks/<task_id>/lastSnapshot

Response

HTTP response location header will contain URI with task id of the updated task.

Request Data:

Copy
Copied!
            

[ { "device": "10.209.36.162", "output": "X86_64 3.6.8100 2018-08-01 21:29:20 x86_64" } ]

© Copyright 2023, NVIDIA. Last updated on Nov 16, 2023.