Benutzer-Werkzeuge

Webseiten-Werkzeuge


omnivista-restful-api

Unterschiede

Hier werden die Unterschiede zwischen zwei Versionen angezeigt.

Link zu dieser Vergleichsansicht

Beide Seiten der vorigen RevisionVorhergehende Überarbeitung
Nächste Überarbeitung
Vorhergehende Überarbeitung
omnivista-restful-api [2016/09/10 16:45] bennyomnivista-restful-api [2024/06/09 10:29] (aktuell) – Externe Bearbeitung 127.0.0.1
Zeile 29: Zeile 29:
   "accessToken": "Authorization: 450d7a34-5dc7-4f1e-a01f-29556864eb59"   "accessToken": "Authorization: 450d7a34-5dc7-4f1e-a01f-29556864eb59"
 } }
 +</code>
 +
 +==== Alle OmniVista bekannten Geräte anzeigen ====
 +<WRAP center round important 60%>
 +Die Ausgabe beinhaltet SNMPv3 und ähnliche Zugangsdaten, man sollte also entsprechend vorsichtig mit dieser Liste umgehen!
 +</WRAP>
 +
 +<code bash>
 +BennyE$ curl -s -k -H "Authorization: Bearer 450d7a34-5dc7-4f1e-a01f-29556864eb59" -H "Ov-App-Version:4.2.1.R01" https://192.168.40.12/api/devices | jq .
 +{
 +  "status": "SUCCESS",
 +  "statusCode": 200,
 +  "type": "ArrayList",
 +  "response": [
 +    {
 +      "deviceType": "ArubaController",
 +      "name": "OAW4550",
 +      "ipAddress": "192.168.20.51",
 +      "model": null,
 +      "version": "6.4.4.9_55980",
 +      "location": "Showroom Kornwestheim",
 +      "deviceDNS": "oaw4550.alu4u.local",
 +      "deviceLastUpgradeStatus": "",
 +      "backupDate": null,
 +      "backupVersion": null,
 +      "lastKnownUpAt": 1473536311964,
 +      "description": "AOS-W (MODEL: OAW-4550), Version 6.4.4.9 (55980)",
 +      "status": "Up",
 +      "traps": "Not Configurable",
 +      "seenBy": "Default,Writers,Administrators,Network Administrators",
 +      "runningFrom": null,
 +      "changes": " ",
 +      "discoveredDateTime": 1470741969751,
 +      "macAddress": "00:1a:1e:01:05:58",
 +...
 </code> </code>
  
Zeile 839: Zeile 874:
 </code> </code>
  
 +==== Manuell ein Gerät aufnehmen (und einer Map zuordnen => geht aktuell nicht, siehe nächster Punkt) ====
 +
 +<WRAP center round important 60%>
 +Work in progress! Funktioniert noch nicht so wie ich mir das vorstelle.
 +</WRAP>
 +
 +  * Das Gerät dass man aufnehmen möchte muss erreichbar sein, sonst dauert der Request sehr lange bis zur JSON-Response (knapp eine Minute)
 +  * MD5+DES ist das Protokoll 5, nicht 7 wie es die Ausgabe unter /api/devices einem glauben machen will (7 ist SHA+AES192) :: Anfrage bei R&D offen.
 +  * Egal was man als "currentMap" übergibt, das Gerät landet immer in "Physical Devices" :: Anfrage bei R&D offen.
 +
 +<code bash>
 +#BennyE$ curl -s -k -H "Authorization: Bearer 450d7a34-5dc7-4f1e-a01f-29556864eb59" -H "Ov-App-Version:4.2.1.R01" -H "Content-Type: application/json" -X POST -d '' https://192.168.40.12/api/discoverylite/devices | jq .
 +
 +BennyE$ curl -s -k -H "Authorization: Bearer 450d7a34-5dc7-4f1e-a01f-29556864eb59" -H "Ov-App-Version:4.2.1.R01" -H "Content-Type: application/json" -X POST -d '{ "ipAddress": "1.1.1.1", "discoveryProfile": { "name": "Benny_API_Test", "seenBy": [ "Port Administrators", "Default", "Administrators", "Writers", "Network Administrators" ], "telnetOrFTPUser": "admin", "telnetOrFTPPassword": "switch", "secondaryPassword": "", "snmpProfile": { "type": "SnmpProfile", "snmpVersion": "SNMPv2", "readSnmpCommunity": "public", "writeSnmpCommunity": "private", "snmpv3Information": { "contextId": "", "contextName": "", "securityName": "", "authProtocol": null, "authPassword": "", "privPassword": "" }, "maxRetries": 3, "timeout": 5000 }, "trapStationUserName": "", "discoverLinks": "Normally", "shellPreference": "Telnet", "useGetbulk": true, "maxRepetitions": 10, "allowPortDisabling": false }, "currentMap": "57d404d3e4b0d545f07f47db" }' https://192.168.40.12/api/discoverylite/devices | jq .
 +{
 +  "status": "SUCCESS",
 +  "statusCode": 201,
 +  "type": "DiscoverySuccessResponse",
 +  "response": {
 +    "sessionId": null,
 +    "user": null,
 +    "currentTypeDiscovery": null,
 +    "message": {
 +      "params": [],
 +      "code": "disc.create.success"
 +    },
 +    "translated": {
 +      "messageTranslated": "Created successfully"
 +    }
 +  },
 +  "serverVersion": "4.2.1.R01"
 +}
 +
 +### Kopie des JSON-Request-Body als Oneliner
 +
 +{ "ipAddress": "1.1.1.1", "discoveryProfile": { "name": "Benny_API_Test", "seenBy": [ "Port Administrators", "Default", "Administrators", "Writers", "Network Administrators" ], "telnetOrFTPUser": "admin", "telnetOrFTPPassword": "switch", "secondaryPassword": "", "snmpProfile": { "type": "SnmpProfile", "snmpVersion": "SNMPv2", "readSnmpCommunity": "public", "writeSnmpCommunity": "private", "snmpv3Information": { "contextId": "", 
 +"contextName": "", "securityName": "", "authProtocol": null, "authPassword": "", "privPassword": "" }, "maxRetries": 3, "timeout": 5000 }, "trapStationUserName": "", "discoverLinks": "Normally", "shellPreference": "Telnet", "useGetbulk": true, "maxRepetitions": 10, "allowPortDisabling": false }, "currentMap": "57d404d3e4b0d545f07f47db" }
 +
 +### prettyprint JSON-Request-Body 
 +
 +{
 +    "ipAddress": "1.1.1.1",
 +    "discoveryProfile": {
 +        "name": "Benny_API_Test",
 +        "seenBy": [
 +            "Port Administrators",
 +            "Default",
 +            "Administrators",
 +            "Writers",
 +            "Network Administrators"
 +        ],
 +        "telnetOrFTPUser": "admin",
 +        "telnetOrFTPPassword": "switch",
 +        "secondaryPassword": "",
 +        "snmpProfile": {
 +            "type": "SnmpProfile",
 +            "snmpVersion": "SNMPv2",
 +            "readSnmpCommunity": "public",
 +            "writeSnmpCommunity": "private",
 +            "snmpv3Information": {
 +                "contextId": "",
 +                "contextName": "",
 +                "securityName": "",
 +                "authProtocol": null,
 +                "authPassword": "",
 +                "privPassword": ""
 +            },
 +            "maxRetries": 3,
 +            "timeout": 5000
 +        },
 +        "trapStationUserName": "",
 +        "discoverLinks": "Normally",
 +        "shellPreference": "Telnet",
 +        "useGetbulk": true,
 +        "maxRepetitions": 10,
 +        "allowPortDisabling": false
 +    },
 +    "currentMap": "57d404d3e4b0d545f07f47db"
 +}
 +
 +#### Funktioniert für MD5+DES (5), warum das aber in dem anderen Output (7) ist muss ich noch rausfinden
 +
 +curl -s -k -H "Authorization: Bearer 606caa63-5238-451b-b2b4-6fa6efc402fe" -H "Ov-App-Version:4.2.1.R01" -H "Content-Type: application/json" -X POST -d '{ "ipAddress": "192.168.20.26", "discoveryProfile": { "name": "Benny_API_Test", "seenBy": [ "Port Administrators", "Default", "Administrators", "Writers", "Network Administrators" ], "telnetOrFTPUser": "admin", "telnetOrFTPPassword": "switch", "secondaryPassword": "", "snmpProfile": { "type": "SnmpProfile", "snmpVersion": "SNMPv3", "readSnmpCommunity": "", "writeSnmpCommunity": "", "snmpv3Information": { "contextId": "", "contextName": "", "securityName": "USERNAME (z.B. omnivista) ", "authProtocol": 5, "authPassword": "PASSWORD", "privPassword": "PASSWORD" }, "maxRetries": 3, "timeout": 5000 }, "trapStationUserName": "", "discoverLinks": "Normally", "shellPreference": "Telnet", "useGetbulk": true, "maxRepetitions": 10, "allowPortDisabling": false }, "currentMap": "57d404d3e4b0d545f07f47db" }' https://192.168.40.12/api/discoverylite/devices
 +
 +</code>
 +
 +==== Gerät einer Map zuordnen ====
 +
 +  * mapId ist die ID der Zielmap (im JSON-Request-Body und der URL!)
 +  * id ist die instanceid des Objekts das man auf Map hinzufügen möchte
 +  * deviceIPAddress ist die IP des Gerätes das der Map hinzugefügt werden soll (kann ja mehrere haben, das wird dann wohl die primäre für diese Map)
 +
 +<code bash>
 +BennyE$ curl -s -k -H "Authorization: Bearer 450d7a34-5dc7-4f1e-a01f-29556864eb59" -H "Ov-App-Version:4.2.1.R01" -H "Content-Type: application/json" -X POST -d '[ { "id": "57d48039e4b0ec43d29869ac", "deviceIpAddress": "192.168.20.26", "x": 0, "y": 120, "deviceAddress": true, "mapId": "57d404d3e4b0d545f07f47db" } ]' https://192.168.40.12/api/topology/maps/57d404d3e4b0d545f07f47db/addNodes/ | jq .
 +{
 +  "status": "SUCCESS",
 +  "statusCode": 200,
 +  "type": "TopologyBaseResponse",
 +  "response": {
 +    "multipleResult": false,
 +    "resultList": [],
 +    "operation": "ADDNODESTOMAP",
 +    "uniqueName": "57d404d3e4b0d545f07f47db",
 +    "displayName": "Unprovisioned Devices",
 +    "mapVersion": 1,
 +    "success": true,
 +    "message": {
 +      "params": [],
 +      "code": "topology.addnodestomap.success"
 +    },
 +    "additionParams": {},
 +    "translated": {
 +      "additionParams": {},
 +      "operationTranslated": "ADDNODESTOMAP",
 +      "successTranslated": "Success",
 +      "resultList": [],
 +      "messageTranslated": "Added devices to map successfully"
 +    }
 +  },
 +  "serverVersion": "4.2.1.R01"
 +}
 +
 +### json oneliner
 +
 +[ { "id": "57d48039e4b0ec43d29869ac", "deviceIpAddress": "192.168.20.26", "x": 0, "y": 120, "deviceAddress": true, "mapId": "57d404d3e4b0d545f07f47db" } ]
 +
 +### prettyprint
 +
 +[
 +    {
 +        "id": "57d48039e4b0ec43d29869ac", 
 +        "deviceIpAddress": "192.168.20.26", 
 +        "x": 0, 
 +        "y": 120, 
 +        "deviceAddress": true, 
 +        "mapId": "57d404d3e4b0d545f07f47db"
 +    }
 +]
 +</code>
 +
 +Feierabend nun: RESTful API, you gonna be restLESS! :)
 ===== OmniVista RESTful API mit Python ansprechen ===== ===== OmniVista RESTful API mit Python ansprechen =====
 <WRAP center round important 60%> <WRAP center round important 60%>
omnivista-restful-api.1473525942.txt.gz · Zuletzt geändert: 2024/06/09 10:29 (Externe Bearbeitung)

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki