NEO Get Data
File Name |
neo_get_data.py |
|
Description |
This SDK retrieves NEO resources using NEO's REST API. The script can retrieve the following resources:
|
|
Usage |
neo_get_data.py [-h] -s SERVER -u USERNAME -p PASSWORD [-r {http,https}] --port {80,443,3080,3443} |
|
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:
If NEO run on a docker container:
|
|
-r {http,https} |
Connection protocol to NEO |
|
-o {groups, users, systems, jobs, ports, tasks, events, logs} |
Script operations |
'systems'
Output example:
[root@ufm_sdk]# /opt/neo/venv/bin/python neo_get_data.py -s 10.209.37.77 -u admin -r https --port 443 -p 123456 -o systems
----------------------------------------------------------------------
[*] Running settings:
-> NEO server: 10.209.37.77
-> Protocol: http
-> NEO user name: admin
-> Selected REST API: systems
----------------------------------------------------------------------
[*] Execution Stages:
-1- Starting NEO Session...
-2- Reading Data From REST API: /neo/resources/systems
----------------------------------------------------------------------
[*] Output:
[{'caption': '',
'healthState': 'Unknown',
'id': '10.209.24.137.system',
'ipAddress': '10.209.24.137',
'isManagement': True, 'model': '',
'name': 'r-smg34',
'profile': 'Not Applicable',
'status': 'Unknown',
'swVersion': 'Ubuntu 14.04 LTS Linux 3.13.0-83-generic #127-Ubuntu SMP Fri Mar 11 00:25:37 UTC 2016 x86_64',
'sysType': 'Linux Host',
'vendor': ''},
{'caption': '',
'healthState': 'Major',
'id': '10.209.37.9.system',
'ipAddress': '10.209.37.9',
'isManagement': True, 'model': 'SX6036',
'ports'
Output example:
[root@ufm_sdk]# /opt/neo/venv/bin/python neo_get_data.py -s 10.209.37.77 -u admin -r https --port 443 -p 123456 -o ports
----------------------------------------------------------------------
[*] Running settings:
-> NEO server: 10.209.37.77
-> Protocol: http
-> NEO user name: admin
-> Selected REST API: ports
----------------------------------------------------------------------
[*] Execution Stages:
-1- Starting NEO Session...
-2- Reading Data From REST API: /neo/resources/ports
----------------------------------------------------------------------
[*] Output:
[{'activeSpeed': 'N/A',
'adminState': 'Enabled',
'health': 'OK',
'id': '10.209.24.137.network_port.p2p1',
'lagMembership': None,
'lagMode': None, 'mtu': 'N/A',
'name': 'p2p1',
'operationalState': 'UP',
'portNumber': -1,
'protocol': 'Ethernet',
'systemID': '10.209.24.137.system',
'systemIP': '10.209.24.137',
'systemName': 'r-smg34',
'vlanMode': None, 'vlans': []},
.
.
.
]
----------------------------------------------------------------------
For all other script options, the usage is the same (except for the -o), and no additional arguments need to be added.