NEO Provisioning

File Name

neo_provisioning.py

Description

This SDK execute NEO provisioning operations using NEO's REST API. The script includes the following main operations:

  • 'list' – List of all existing templates

  • 'details' – Get data on a specific template

  • 'execute' – Execute a provisioning task

Usage

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

-o {execute,list,details}[-t PARAMETERS] [-f FILE]

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 {list,details,execute}

Script operations

-t PARAMETERS

URL parameters. Valid formats:

  • attrib1=value1&attrib2=value2

  • attrib=[value1,value2]

-b

Blocks any action while running a provisioning task

Can only be used for the 'execute' operation.

-f FILE

A file in json format containing the payload of the request.

'list'

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_provisioning.py -s localhost -u admin -r https --port 443 -p 123456 -o list ======================.================================================ <<< NEO - Getting template list SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: localhost -> NEO user name: admin ====================================================================== [*] Getting template list stages: -1- Setting Up data... -2- Sending Getting template list request... ====================================================================== [*] Template list: Enable-Protocol-PIM Create-LAG Add-Port-To-LAG Enable-PFC . . . ====================================================================== [*] Getting template list results: >> Getting template list request HTTP response status code: 200 ======================================================================


'details'

Required Arguments

Parameters

  • 'template_name' - The name of an existing template

Output example:

Copy
Copied!
            

[root@r-ufm209 sdk]# /opt/neo/venv/bin/python neo_provisioning.py -s localhost -r https --port 443 -u admin -p 123456 -o details -t "template_name=Create-MLAG" ====================================================================== <<< NEO - Getting template details SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: localhost -> NEO user name: admin ====================================================================== [*] Getting template details stages: -1- Setting Up data... -2- Sending Getting template details request... ====================================================================== [*] Template details: { "global_args": { "IPL_IP_mask": "Subnet mask for IPL interfaces (0-32)", "MLAG_VIP": "Virtual IP address for MLAG", "MLAG_VIP_mask": "Subnet mask for MLAG Virtual IP (0-32)", "MLAG_system_MAC": "Virtual System MAC.", "VLAN_ID": "VLAN Interface ID for IPL (1-4094)" }, "local_args": { "IPL_IP_address": "IP Address of IPL Interface", "IPL_LAG_ID": "LAG ID to use with IPL ports", "IPL_peer_IP_address": "IP Address of peer IPL Interface", "IPL_port_range": "Port range to use for IPL" } } ====================================================================== [*] Getting template details results: >> Getting template details request HTTP response status code: 200 ======================================================================


'execute'

Required Arguments

File Name

  • For the 'execute' operation, you need to supply a file containing the payload of the provisioning task request. For example:

{

"params": {

"arguments": {

"globals": {

"VLAN_ID": "472",

"VLAN_name": "VLAN Example"

},

"devices": {

"10.209.24.39": {

                }

}

}

},

"description": "Adding VLAN to switch",

    "object_ids": ["10.209.24.39"],
    "object_type": "System"

}

Parameters

  • template_name' - The name of an existing template

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_provisioning.py -s 10.209.37.77 -u admin -r https --port 443 -p 123456 -o execute -t "template_name=Add-VLAN" -f provisioning_example ====================================================================== <<< NEO - Executing provisioning task SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ====================================================================== [*] Executing provisioning task stages: -1- Setting Up data... -2- Sending Executing provisioning task request... ====================================================================== [*] Executing provisioning task results: >> Executing provisioning task request HTTP response status code: 202 >> Executing provisioning task request HTTP response text: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <title>Redirecting...</title> <h1>Redirecting...</h1> <p>You should be redirected automatically to target URL: <a href="/neo/app/jobs/7">/neo/ app/jobs/7</a>. If not click the link. ======================================================================

Warning

For executing the task and waiting until it's done, use the -b argument.


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