NEO Jobs

File Name

neo_jobs.py

Description

This SDK manipulates NEO jobs data using NEO's REST API. The script includes the following main operations:

  • 'get' – get an existing job

  • 'getall' – get all existing jobs

  • 'getparentjobs' – get all parent jobs

  • 'getchildjobs' – get all sub-jobs of a specific job

  • 'getsystemjobs' – get all jobs for a specific system

Usage

neo_jobs.py [-h] -s SERVER -u USERNAME -p PASSWORD [-r {http,https}] --port {80,443,3080,3443}

-o {getparent- jobs,getchildjobs,getall,getsystemjobs,get} [-t PARAMETERS]

Arguments

-h

Displays the help menu

-s SERVER

NEO server IP

-u USERNAME

NEO username

-p PASSWORD

NEO password

--port

The port used to communicate with NEO.

If NEO is run on a physical machine:

  • Port 80 is used for HTTP

  • Port 443 is used for HTTPS

If NEO run on a docker container:

  • Port 3080 is used for HTTP

  • Port 3443 is used for HTTPS

-r {http,https}

Connection protocol to NEO

-o {get,getall,getparentjobs,getchildjobs,getsystemjobs}

Script operations

-t PARAMETERS

URL parameters. Valid formats:

  • attrib1=value1&attrib2=value2

  • attrib=[value1,value2]

'get'

Required Arguments

Parameters

  • 'job_id' - The job ID of an existing job

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_jobs.py -s 10.209.37.77 -u admin -r https --port 443 -p 123456 -o get -t "job_id=8" ====================================================================== <<< NEO - Getting job data SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ====================================================================== [*] Getting job data stages: -1- Setting Up data... -2- Sending Getting job data request... ====================================================================== [*] Getting job data results: >> Getting job data request HTTP response status code: 200 >> Getting job data request HTTP response text: { "Status": "Completed", "Foreground": true, "Description": "Adding VLAN to switch", "RelatedObjects": [ "10.209.24.39" ], "Created": "2016-04-11 14:05:06", "LastUpdated": "2016-04-11 14:05:11", "Summary": "", "CreatedBy": "admin", "Progress": 100, "Operation": "Provisioning", "ID": "8" } ======================================================================


'getall'

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_jobs.py -s 10.209.37.77 -u admin -r https --port 443 -p 123456 -o getall ====================================================================== <<< NEO - Getting all jobs data SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ====================================================================== [*] Getting all jobs data stages: -1- Setting Up data... -2- Sending Getting all jobs data request... ====================================================================== [*] Getting all jobs data results: >> Getting all jobs data request HTTP response status code: 200 >> Getting all jobs data request HTTP response text: [ { "Status": "Completed", "Foreground": true, "Description": "Adding VLAN to switch", "RelatedObjects": [ "10.209.24.39" ], "Created": "2016-04-11 14:05:06", "LastUpdated": "2016-04-11 14:05:11", "Summary": "vlan 472\n\nexit\n\nvlan 472 name \"VLAN Example\"\n\n", "CreatedBy": "admin", "Progress": 100, "Operation": "Provisioning", "ID": "8.1" }, . . . ] ======================================================================


'getparentjobs'

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_jobs.py -s 10.209.37.77 -u admin -r https --port 443 -p 123456 -o getparent- jobs ====================================================================== <<< NEO - Getting all parent jobs SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ====================================================================== [*] Getting all parent jobs stages: -1- Setting Up data... -2- Sending Getting all parent jobs request... ====================================================================== [*] Getting all parent jobs results: >> Getting all parent jobs request HTTP response status code: 200 >> Getting all parent jobs request HTTP response text: [ { "Status": "Completed", "Foreground": true, "Description": " Adding VLAN to switch", "RelatedObjects": [ "10.209.24.39" ], "Created": "2016-04-11 11:50:20", "LastUpdated": "2016-04-11 11:50:25", "Summary": "", "CreatedBy": "admin", "Progress": 100, "Operation": "Provisioning", "ID": "6" }, { "Status": "Completed", "Foreground": true, "Description": "Adding VLAN to switch", "RelatedObjects": [ "10.209.24.39" ], "Created": "2016-04-11 13:50:20", "LastUpdated": "2016-04-11 13:50:24", "Summary": "", "CreatedBy": "admin", "Progress": 100, "Operation": "Provisioning", "ID": "7" }, . . . ] ======================================================================


'getchildjobs'

Required Arguments

Parameters

  • 'job_id' - The job ID of an existing job

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_jobs.py -s 10.209.37.77 -u admin -r https --port 443 -p 123456 -o getchild- jobs -t "job_id=8" ====================================================================== <<< NEO - Getting all sub jobs of a specific job SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ====================================================================== [*] Getting all sub jobs of a specific job stages: -1- Setting Up data... -2- Sending Getting all sub jobs of a specific job request... ====================================================================== [*] Getting all sub jobs of a specific job results: >> Getting all sub jobs of a specific job request HTTP response status code: 200 >> Getting all sub jobs of a specific job request HTTP response text: [ { "Status": "Completed", "Foreground": true, "Description": "Adding VLAN to switch", "RelatedObjects": [ "10.209.24.39" ], "Created": "2016-04-11 14:05:06", "LastUpdated": "2016-04-11 14:05:11", "Summary": "vlan 472\n\nexit\n\nvlan 472 name \"VLAN Example\"\n\n", "CreatedBy": "admin", "Progress": 100, "Operation": "Provisioning", "ID": "8.1" } ] ======================================================================


'getsystemjobs'

Required Arguments

Parameters

  • 'system_id' - The system IP of an existing system

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_jobs.py -s 10.209.37.77 -u admin -r https --port 443 -p 123456 -o getsystem- jobs -t "system_id=10.209.24.39" ====================================================================== <<< NEO - Getting jobs for system SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ====================================================================== [*] Getting jobs for system stages: -1- Setting Up data... -2- Sending Getting jobs for system request... ====================================================================== [*] Getting jobs for system results: >> Getting jobs for system request HTTP response status code: 200 >> Getting jobs for system request HTTP response text: [ { "Status": "Completed", "Foreground": true, "Description": "Adding VLAN to switch", "RelatedObjects": [ "10.209.24.39" ], "Created": "2016-04-11 14:05:06", "LastUpdated": "2016-04-11 14:05:11", "Summary": "vlan 472\n\nexit\n\nvlan 472 name \"VLAN Example\"\n\n", "CreatedBy": "admin", "Progress": 100, "Operation": "Provisioning", "ID": "8.1" }, { "Status": "Completed", "Foreground": true, "Description": " Adding VLAN to switch", "RelatedObjects": [ "10.209.24.39" ], "Created": "2016-04-11 11:50:20", "LastUpdated": "2016-04-11 11:50:25", "Summary": "", "CreatedBy": "admin", "Progress": 100, "Operation": "Provisioning", "ID": "6" }, . . . ] ======================================================================


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