NVIDIA NEO SDK v2.7.20
NVIDIA NEO SDK v2.7.20

NEO Groups

File Name

neo_groups.py

Description

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

  • 'get' – get an existing group

  • 'getall' – get all existing groups

  • 'add' – add a new group

  • 'update' – update an existing group

  • 'delete' – delete an existing group

  • 'addsys' – add an existing system to a group

  • 'getsys' – get all the systems of an existing group

  • 'getsyswprop' – get all the systems of an existing group, and retrieve additional system properties

  • 'delsys' – delete a system from a group

  • 'delallsys' – delete all the systems from a group

  • 'getbysys' – get all the groups that contains an existing system

Usage

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

-o {delsys, get,update,delallsys,getsyswprop,getall,getbysys,add,getsys,addsys,delete} [-d PAYLOAD] [-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,add,update,delete,addsys, getsys,getsyswprop,delsys,delall-sys,getbysus}

Script operations

-d PAYLOAD

Payload attributes. Valid format:

attrib1=value1&attrib2=value2

-t PARAMETERS

URL parameters. Valid formats:

  • attrib1=value1&attrib2=value2

  • attrib=[value1,value2]

'get'

Required Arguments

Parameters

  • 'elementName' - An element (group) name of an existing group

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_groups.py -s 10.209.37.77 -u admin -r https --port 443 -p 123456 -o get -t "elementName=global.open_switch" ====================================================================== <<< NEO - Getting groups data SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ====================================================================== [*] Getting groups data stages: -1- Setting Up data... -2- Sending Getting groups data request... ====================================================================== [*] Getting groups data results: >> Getting groups data request HTTP response status code: 200 >> Getting groups data request HTTP response text: { "instanceID": "group.global.open_switch", "elementName": "global.open_switch", "hasSettings": true, "description": "" } ======================================================================


'getall'

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_groups.py -s 10.209.37.77 -u admin -r https --port 443 -p 123456 -o getall ====================================================================== <<< NEO - Getting all groups data SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ====================================================================== [*] Getting all groups data stages: -1- Setting Up data... -2- Sending Getting all groups data request... ====================================================================== [*] Getting all groups data results: >> Getting all groups data request HTTP response status code: 200 >> Getting all groups data request HTTP response text: [ { "instanceID": "group.global.cumulus", "elementName": "global.cumulus", "hasSettings": true, "description": "" }, { "instanceID": "group.global.arista", "elementName": "global.arista", "hasSettings": true, "description": "" }, . . . ] ======================================================================


'add'

Required Arguments

Payload

  • 'elementName' - The element (group) name of the new group

  • 'description' - The description of the new group

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_groups.py -s 10.209.37.77 -u admin -r https --port 443 -p 123456 -o add -d "elementName=shachar&description=This is a test" ====================================================================== <<< NEO - Adding group SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ======================================================================   [*] Adding group stages: -1- Setting Up data... -2- Sending Adding group request... ====================================================================== [*] Adding group results: >> Adding group request HTTP response status code: 201 >> Adding group 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/resources/groups/ shachar">/neo/resources/groups/shachar</a>. If not click the link. ======================================================================


'update'

Required Arguments

Parameters

  • 'elementName' - The element (group) name of an existing group

Payload

  • 'description' - The description of an existing group

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_groups.py -s 10.209.37.77 -u admin -r https --port 443 -p 123456 -o update - t "elementName=shachar" -d "description=This is an update test" ====================================================================== <<< NEO - Updating group SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ====================================================================== [*] Updating group stages: -1- Setting Up data... -2- Sending Updating group request... ====================================================================== [*] Updating group results: >> Updating group request HTTP response status code: 200 ======================================================================


'delete'

Required Arguments

Parameters

  • 'elementName' - The element (group) name of the new group

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_groups.py -s 10.209.37.77 -u admin -r https --port 443 -p 123456 -o delete - t "elementName=shachar" ====================================================================== <<< NEO - Deleting group SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ====================================================================== [*] Deleting group stages: -1- Setting Up data... -2- Sending Deleting group request... ====================================================================== [*] Deleting group results: >> Deleting group request HTTP response status code: 202 >> Deleting group 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/19">/ neo/app/jobs/19</a>. If not click the link. ======================================================================


'addsys'

Required Arguments

Parameters

  • elementName' - The element (group) name of the new group

Payload

  • 'system_id' - The system IDs of existing systems

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_groups.py -u admin -r https --port 443 -p 123456 -s 10.209.37.77 -o addsys - t "elementName=shachar" -d "system_id=[10.209.37.9.system,10.209.36.36.system]" ====================================================================== <<< NEO - Adding systems to group SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ====================================================================== [*] Adding systems to group stages: -1- Setting Up data... -2- Sending Adding systems to group request... ====================================================================== [*] Adding systems to group results: >> Adding systems to group request HTTP response status code: 201 >> Adding systems to group 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/resources/groups/ shachar/members/10.209.37.9.system%2C10.209.36.36.system">/neo/resources/groups/ shachar/members/10.209.37.9.system%2C10.209.36.36.system</a>. If not click the link. ======================================================================


'getsys'

Required Arguments

Parameters

  • elementName' - The element (group) name of the new group

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_groups.py -u admin -r https --port 443 -p 123456 -s 10.209.37.77 -o getsys - t "elementName=shachar" ====================================================================== <<< NEO - Getting systems in group SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ====================================================================== [*] Getting systems in group stages: -1- Setting Up data... -2- Sending Getting systems in group request... ====================================================================== [*] Getting systems in group results: >> Getting systems in group request HTTP response status code: 200 >> Getting systems in group request HTTP response text: [ { "instanceID": "10.209.37.9.system" }, { "instanceID": "10.209.36.36.system" } ] ======================================================================


'getsyswprop'

Required Arguments

Parameters

  • elementName' - The element (group) name of the new group

  • properties' - The properties to retrieve from the group's systems

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_groups.py -s 10.209.37.77 -u admin -r https --port 443 -p 123456 -o getsys- wprop -t "elementName=shachar&properties=status,roles" ====================================================================== <<< NEO - Getting systems with properties in group SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ====================================================================== [*] Getting systems with properties in group stages: -1- Setting Up data... -2- Sending Getting systems with properties in group request... ====================================================================== [*] Getting systems with properties in group results: >> Getting systems with properties in group request HTTP response status code: 200 >> Getting systems with properties in group request HTTP response text: [ { "instanceID": "10.209.37.9.system", "status": "", "roles": [ "Eth Single Switch" ] }, { "instanceID": "10.209.36.36.system", "status": "", "roles": [ "Vpi Single Switch" ] } ] ======================================================================

'delsys'

Required Arguments

Parameters

  • elementName' - The element (group) name of the new group

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_groups.py -u admin -r https --port 443 -p 123456 -s 10.209.37.77 -o delall- sys -t "elementName=shachar" ====================================================================== <<< NEO - Deleting all systems in group SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ====================================================================== [*] Deleting all systems in group stages: -1- Setting Up data... -2- Sending Deleting all systems in group request... ====================================================================== [*] Deleting all systems in group results: >> Deleting all systems in group request HTTP response status code: 204 ======================================================================


'getbysys'

Required Arguments

Parameters

  • system_id' - The system IDs of existing systems

Output example:

Copy
Copied!
            

[root@ufm_sdk]# /opt/neo/venv/bin/python neo_groups.py -s 10.209.37.77 -u admin -r https --port 443 -p 123456 -o getbysys -t "system_id=10.209.37.9.system" ====================================================================== <<< NEO - Getting groups by systems SDK >>> ---------------------------------------------------------------------- [*] Running Settings: -> NEO server IP address: 10.209.37.77 -> NEO user name: admin ====================================================================== [*] Getting groups by systems stages: -1- Setting Up data... -2- Sending Getting groups by systems request... ====================================================================== [*] Getting groups by systems results: >> Getting groups by systems request HTTP response status code: 200 >> Getting groups by systems request HTTP response text: [ { "instanceID": "group.shachar", "elementName": "shachar", "hasSettings": false, "description": "This is a test" } ] ======================================================================


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