NEO Notifications
File Name |
neo_notifications.py |
|
Description |
This SDK manipulates NEO notifications data using NEO's REST API. The script includes the following main operations:
|
|
Usage |
neo_notifications.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 {get,getall,update,delete} |
Script operations |
|
-d PAYLOAD |
Payload attributes. Valid format: attrib1=value1&attrib2=value2 |
|
-t PARAMETERS |
URL parameters. Valid formats:
|
'get'
Required Arguments |
|
Parameters |
|
Output example:
[root@ufm_sdk]# /opt/neo/venv/bin/python neo_notifications.py -s 10.209.37.152 -u admin -r https --port 443 -p 123456 -o get -t "notification_id=1"
======================================================================
<<< NEO - Getting notification data SDK >>>
----------------------------------------------------------------------
[*] Running Settings:
-> NEO server IP address: 10.209.37.152
-> NEO user name: admin
======================================================================
[*] Getting notification data stages:
-1- Setting Up data...
-2- Sending Getting notification data request...
======================================================================
[*] Getting notification data results:
>> Getting notification data request HTTP response status code: 200
>> Getting notification data request HTTP response text:
{
"originator": "Device Management",
"body": [
{
"Name": "switch-62fea2",
"Reference": "3.5.1006",
"Ip": "10.209.37.9",
"Current": "3.3.5006",
"Diff": "3.3.5006",
"Technology": "ETH",
"Id": "10.209.37.9.system"
},
{
"Name": "r-smg-sw19",
"Reference": "3.5.1006",
"Ip": "10.209.24.40",
"Current": "3.4.3004",
"Diff": "3.4.3004",
"Technology": "ETH",
"Id": "10.209.24.40.system"
},
.
.
.
],
"severity": "Info",
"instanceID": 1,
"timestamp": "2016-04-01 09:06:51",
"read": true,
"subject": "OS Mismatches"
}
======================================================================
'getall'
Output example:
[root@ufm_sdk]# /opt/neo/venv/bin/python neo_notifications.py -s 10.209.37.152 -u admin -r https --port 443 -p 123456 -o getall
======================================================================
<<< NEO - Getting all notifications data SDK >>>
----------------------------------------------------------------------
[*] Running Settings:
-> NEO server IP address: 10.209.37.152
-> NEO user name: admin
======================================================================
[*] Getting all notifications data stages:
-1- Setting Up data...
-2- Sending Getting all notifications data request...
======================================================================
[*] Getting all notifications data results:
>> Getting all notifications data request HTTP response status code: 200
>> Getting all notifications data request HTTP response text:
[
{
"originator": "Device Management",
"severity": "Info",
"instanceID": 1,
"timestamp": "2016-04-01 09:06:51",
"read": true,
"subject": "OS Mismatches"
},
{
"originator": "Device Management",
"severity": "Error",
"instanceID": 2,
"timestamp": "2016-04-01 09:06:51",
"read": true,
"subject": "MTU Mismatches"
},
.
.
.
]
======================================================================
'update'
Required Arguments |
|
Parameters |
|
Payload |
|
Output example:
[root@ufm_sdk]# /opt/neo/venv/bin/python neo_notifications.py -s 10.209.37.152 -u admin -r https --port 443 -p 123456 -o update -t "notification_id=1" -d "read=True"
======================================================================
<<< NEO - Updating notification SDK >>>
----------------------------------------------------------------------
[*] Running Settings:
-> NEO server IP address: 10.209.37.152
-> NEO user name: admin
======================================================================
[*] Updating notification stages:
-1- Setting Up data...
-2- Sending Updating notification request...
======================================================================
[*] Updating notification results:
>> Updating notification request HTTP response status code: 200
======================================================================
'delete'
Required Arguments |
|
Parameters |
|
Output example:
[root@ufm_sdk]# /opt/neo/venv/bin/python neo_notifications.py -s 10.209.37.152 -u admin -r https --port 443 -p 123456 -o delete -t "notification_id=1"
======================================================================
<<< NEO - Deleting notification SDK >>>
----------------------------------------------------------------------
[*] Running Settings:
-> NEO server IP address: 10.209.37.152
-> NEO user name: admin
======================================================================
[*] Deleting notification stages:
-1- Setting Up data...
-2- Sending Deleting notification request...
======================================================================
[*] Deleting notification results:
>> Deleting notification request HTTP response status code: 204
======================================================================