Beide Seiten der vorigen RevisionVorhergehende ÜberarbeitungNächste Überarbeitung | Vorhergehende Überarbeitung |
omnivista-restful-api [2016/09/10 14:52] – benny | omnivista-restful-api [2024/06/09 10:29] (aktuell) – Externe Bearbeitung 127.0.0.1 |
---|
* -d = Daten die man übertragen möchte | * -d = Daten die man übertragen möchte |
* -F = Überträgt die Daten als wenn sie aus einem Formular kommen (<form>) im multipart/form-data Format | * -F = Überträgt die Daten als wenn sie aus einem Formular kommen (<form>) im multipart/form-data Format |
* -i = HTTP Response Ausgaben anzeigen | |
* -H = Header festlegen (kann mehrfach für mehrere Header verwendet werden) | * -H = Header festlegen (kann mehrfach für mehrere Header verwendet werden) |
| * -i = HTTP Response Ausgaben anzeigen |
* -k = Unsichere Verbindung ignorieren (https mit self-signed im Labor) | * -k = Unsichere Verbindung ignorieren (https mit self-signed im Labor) |
* -s = Keine Ausgaben außer dem Ergebnis auf der Console ausgeben (übersichtlicher) | * -s = Keine Ausgaben außer dem Ergebnis auf der Console ausgeben (übersichtlicher) |
"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> |
| |
</code> | </code> |
| |
| ==== Ein Element suchen ==== |
| |
| Wir suchen nach "OS6860" auf allen Maps (searchOnCurrentMap = false) und geben auch keine mapID an. |
| |
| <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 '{ "TopologySearchRequest": {"searchString": "OS6860", "searchOnCurrentMap": false, "mapId": ""} }' https://192.168.40.12/api/topology/maps/search | jq . |
| { |
| "status": "SUCCESS", |
| "statusCode": 200, |
| "type": "TopologySearchResponse", |
| "response": { |
| "searchString": "OS6860", |
| "searchOnCurrentMap": false, |
| "mapId": "", |
| "searchResultList": [ |
| { |
| "NodeSearchResult": { |
| "mapId": { |
| "TopologyMapIdVO": { |
| "instanceid": "57a9a194e4b0bf325ef8540d", |
| "mapName": "Physical Network", |
| "dynamicMap": false, |
| "physicalNetworkMap": true, |
| "autoCreatedDynamicMap": true, |
| "translated": {} |
| } |
| }, |
| "node": { |
| "id": "57b4de1de4b0ec43d27f6a6d", |
| "x": 0, |
| "y": 0, |
| "deviceAddress": true, |
| "mapId": "57a9bdc6e4b0fa2ef20478ed", |
| "deviceName": "OS6860E-P24", |
| "deviceIpAddress": "192.168.20.254", |
| "deviceMacAddress": "e8:e7:32:ea:45:ed", |
| "deviceType": "OS6860E-P24", |
| "deviceVersion": "8.2.1.304.R01", |
| "deviceStatus": "Down", |
| "deviceDNS": "os6860.alu4u.local", |
| "deviceLocation": "Showroom Kornwestheim", |
| "deviceLastUpgradeStatus": "", |
| "deviceBackupDate": null, |
| "deviceBackupVersion": null, |
| "deviceLastKnownUpAt": 1472124658902, |
| "deviceDescription": "Alcatel-Lucent OS6860E-P24 8.2.1.304.R01 Service Release, May 17, 2016.", |
| "deviceTraps": "Unknown", |
| "deviceRunningFrom": "821-304-R01", |
| "deviceChanges": "Unsaved", |
| "deviceDiscoveredDate": 1471471133187, |
| "webUrl": "https://192.168.20.254/", |
| "deviceIconUrl": "topology/deviceicons/6860.png", |
| "deviceIconName": "6860", |
| "licenseType": "Alcatel-Lucent Enterprise", |
| "friendlyName": "192.168.20.254", |
| "supportsSsh": true, |
| "arubaWireLessOrThirdPartyDevice": false, |
| "oaw": false, |
| "others": { |
| "SwitchState": 5, |
| "SwitchSysObjId": ".1.3.6.1.4.1.6486.801.1.1.2.1.11.1.6", |
| "coreLicenseUsed": 1, |
| "SwitchFtpLoginPasswd": "Isklaaaa :)", |
| "SwitchContact": "Michael Neesen", |
| "ChassisName": "OS6860E-P24", |
| "SwitchFtpLoginName": "admin", |
| "SwitchSynchronized": "Synchronize" |
| }, |
| "switchState": "SWITCH_STATE_MAJOR", |
| "overlayType": "none", |
| "stackOverlay": null, |
| "virtualChassisOverlay": null, |
| "wirelessOverlay": null, |
| "translated": { |
| "switchStateTranslated": "SWITCH_STATE_MAJOR", |
| "deviceStatusTranslated": "Down", |
| "yTranslated": "0", |
| "deviceLastKnownUpAtTranslated": "Aug 25, 2016 1:30:58 PM", |
| "deviceDiscoveredDateTranslated": "Aug 17, 2016 11:58:53 PM", |
| "xTranslated": "0" |
| } |
| }, |
| "translated": {} |
| } |
| }, |
| { |
| "NodeSearchResult": { |
| "mapId": { |
| "TopologyMapIdVO": { |
| "instanceid": "57a9bdc6e4b0fa2ef20478ed", |
| "mapName": "192.168.20.1-192.168.20.254", |
| "dynamicMap": true, |
| "physicalNetworkMap": false, |
| "autoCreatedDynamicMap": false, |
| "translated": {} |
| } |
| }, |
| "node": { |
| "id": "57b4de1de4b0ec43d27f6a6d", |
| "x": 0, |
| "y": 0, |
| "deviceAddress": true, |
| "mapId": "57a9bdc6e4b0fa2ef20478ed", |
| "deviceName": "OS6860E-P24", |
| "deviceIpAddress": "192.168.20.254", |
| "deviceMacAddress": "e8:e7:32:ea:45:ed", |
| "deviceType": "OS6860E-P24", |
| "deviceVersion": "8.2.1.304.R01", |
| "deviceStatus": "Down", |
| "deviceDNS": "os6860.alu4u.local", |
| "deviceLocation": "Showroom Kornwestheim", |
| "deviceLastUpgradeStatus": "", |
| "deviceBackupDate": null, |
| "deviceBackupVersion": null, |
| "deviceLastKnownUpAt": 1472124658902, |
| "deviceDescription": "Alcatel-Lucent OS6860E-P24 8.2.1.304.R01 Service Release, May 17, 2016.", |
| "deviceTraps": "Unknown", |
| "deviceRunningFrom": "821-304-R01", |
| "deviceChanges": "Unsaved", |
| "deviceDiscoveredDate": 1471471133187, |
| "webUrl": "https://192.168.20.254/", |
| "deviceIconUrl": "topology/deviceicons/6860.png", |
| "deviceIconName": "6860", |
| "licenseType": "Alcatel-Lucent Enterprise", |
| "friendlyName": "192.168.20.254", |
| "supportsSsh": true, |
| "arubaWireLessOrThirdPartyDevice": false, |
| "oaw": false, |
| "others": { |
| "SwitchState": 5, |
| "SwitchSysObjId": ".1.3.6.1.4.1.6486.801.1.1.2.1.11.1.6", |
| "coreLicenseUsed": 1, |
| "SwitchFtpLoginPasswd": "Isklaaaa :)", |
| "SwitchContact": "Michael Neesen", |
| "ChassisName": "OS6860E-P24", |
| "SwitchFtpLoginName": "admin", |
| "SwitchSynchronized": "Synchronize" |
| }, |
| "switchState": "SWITCH_STATE_MAJOR", |
| "overlayType": "none", |
| "stackOverlay": null, |
| "virtualChassisOverlay": null, |
| "wirelessOverlay": null, |
| "translated": { |
| "switchStateTranslated": "SWITCH_STATE_MAJOR", |
| "deviceStatusTranslated": "Down", |
| "yTranslated": "0", |
| "deviceLastKnownUpAtTranslated": "Aug 25, 2016 1:30:58 PM", |
| "deviceDiscoveredDateTranslated": "Aug 17, 2016 11:58:53 PM", |
| "xTranslated": "0" |
| } |
| }, |
| "translated": {} |
| } |
| } |
| ], |
| "translated": { |
| "mapIdTranslated": "", |
| "searchOnCurrentMapTranslated": "false", |
| "searchStringTranslated": "OS6860", |
| "searchResultList": [] |
| } |
| }, |
| "serverVersion": "4.2.1.R01" |
| } |
| </code> |
| |
| ==== Alle Hintergrundbilder der Maps auflisten ==== |
| |
| Bei mir relativ langweilig, hab leider keine Hintergrundbilder mehr derzeit. |
| |
| <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/topology/maps/bg | jq . |
| { |
| "status": "SUCCESS", |
| "statusCode": 200, |
| "type": "ArrayList", |
| "response": [], |
| "serverVersion": "4.2.1.R01" |
| } |
| </code> |
| |
| ==== Alle Elemente einer Map auflisten ==== |
| |
| <WRAP center round tip 60%> |
| Wer hier den Inhalt mehrerer Maps sehen möchte, übermittelt einfach [ "57a9bdc6e4b0fa2ef20478ed", "instanceid-der-zweiten-Map", "instanceid-der-dritten-Map" ]. |
| </WRAP> |
| |
| <code bash> |
| BennyE$ curl -s -k -H "Authorization: Bearer 5827823e-9979-4d93-851b-4aa71e9e44eb" -H "Ov-App-Version:4.2.1.R01" -H "Content-Type: application/json" -X POST -d '[ "57a9bdc6e4b0fa2ef20478ed" ]' https://192.168.40.12/api/topology/maps/nodes |
| { |
| "status": "SUCCESS", |
| "statusCode": 200, |
| "type": "MapNodeCollectionVO", |
| "response": { |
| "nodeList": [ |
| { |
| "id": "57a9bdcbe4b0bf325ef855ed", |
| "x": 0, |
| "y": 0, |
| "deviceAddress": true, |
| "mapId": "57a9bdc6e4b0fa2ef20478ed", |
| "deviceName": "OS6450-24", |
| "deviceIpAddress": "192.168.20.35", |
| "deviceMacAddress": "e8:e7:32:40:28:e0", |
| "deviceType": "OS6450-C24", |
| "deviceVersion": "6.7.1.86.R03", |
| "deviceStatus": "Up", |
| "deviceDNS": "os6450-24.alu4u.local", |
| "deviceLocation": "Lab ProfServ Kornwestheim", |
| "deviceLastUpgradeStatus": "Failed (Image)", |
| "deviceBackupDate": null, |
| "deviceBackupVersion": null, |
| "deviceLastKnownUpAt": 1473523589767, |
| "deviceDescription": "Alcatel-Lucent OS6450-24 6.7.1.86.R03 GA, August 10, 2016.", |
| "deviceTraps": "Unknown", |
| "deviceRunningFrom": "working", |
| "deviceChanges": "Unsaved", |
| "deviceDiscoveredDate": 1470741963808, |
| "webUrl": "https://192.168.20.35/", |
| "deviceIconUrl": "topology/deviceicons/6450.png", |
| "deviceIconName": "6450", |
| "licenseType": "Alcatel-Lucent Enterprise", |
| "friendlyName": "192.168.20.35", |
| "supportsSsh": true, |
| "arubaWireLessOrThirdPartyDevice": false, |
| "oaw": false, |
| "others": { |
| "SwitchState": 1, |
| "SwitchSysObjId": ".1.3.6.1.4.1.6486.800.1.1.2.1.12.1.5", |
| "coreLicenseUsed": 1, |
| "SwitchFtpLoginPasswd": "blubblubblub", |
| "SwitchContact": "Michael Neesen", |
| "ChassisName": "OS6450-C24", |
| "SwitchFtpLoginName": "admin", |
| "SwitchSynchronized": "Not Applicable" |
| }, |
| "switchState": "SWITCH_STATE_OK", |
| "overlayType": "none", |
| "stackOverlay": null, |
| "virtualChassisOverlay": null, |
| "wirelessOverlay": null, |
| "translated": { |
| "switchStateTranslated": "SWITCH_STATE_OK", |
| "deviceStatusTranslated": "Up", |
| "yTranslated": "0", |
| "deviceLastKnownUpAtTranslated": "Sep 10, 2016 6:06:29 PM", |
| "deviceDiscoveredDateTranslated": "Aug 9, 2016 1:26:03 PM", |
| "xTranslated": "0" |
| } |
| }, |
| ... |
| } |
| </code> |
| |
| ==== Statistik einer Map anzeigen ==== |
| |
| <WRAP center round important 60%> |
| Das funktioniert anscheinend nur wenn man hier Geräte und Links mit angibt. |
| </WRAP> |
| |
| <WRAP center round important 60%> |
| TODO: Benny |
| </WRAP> |
| |
| <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 '{ "TopologyStatisticRequest": { "mapId": "56c2cee507e12d333c0f442f", "devicesIp": [], "linksId": [] } }' https://192.168.40.12/api/topology/maps/57a9bdc6e4b0fa2ef20478ed/statisticv2 | jq . |
| { |
| "status": "SUCCESS", |
| "statusCode": 200, |
| "type": "TopologyStatisticResponse", |
| "response": { |
| "mapId": "56c2cee507e12d333c0f442f", |
| "switchStatusStatistic": [ |
| { |
| "type": "Up", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "Up" |
| } |
| }, |
| { |
| "type": "Down", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "Down" |
| } |
| }, |
| { |
| "type": "Warning", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "Warning" |
| } |
| } |
| ], |
| "linkStatusStatistic": [ |
| { |
| "type": "LINK_UP", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "up" |
| } |
| }, |
| { |
| "type": "LINK_DOWN", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "down" |
| } |
| }, |
| { |
| "type": "LINK_BLOCKED", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "blocked" |
| } |
| }, |
| { |
| "type": "LINK_UNKNOWN", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "unknown" |
| } |
| } |
| ], |
| "deviceTypesStatistic": [ |
| { |
| "type": "virtualchassis", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "virtualchassis" |
| } |
| }, |
| { |
| "type": "stack", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "stack" |
| } |
| }, |
| { |
| "type": "oaw", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "oaw" |
| } |
| } |
| ], |
| "linkTypesStatistic": [ |
| { |
| "type": "linkagg", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "linkagg" |
| } |
| } |
| ], |
| "linkOriginStatistic": [ |
| { |
| "type": "ORIGIN_LLDP", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "LLDP" |
| } |
| }, |
| { |
| "type": "ORIGIN_MANUAL", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "MANUAL" |
| } |
| }, |
| { |
| "type": "ORIGIN_XMAP", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "XMAP" |
| } |
| }, |
| { |
| "type": "ORIGIN_AMAP", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "AMAP" |
| } |
| }, |
| { |
| "type": "ORIGIN_PNNI", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "PNNI" |
| } |
| }, |
| { |
| "type": "ORIGIN_OEM", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "OEM" |
| } |
| }, |
| { |
| "type": "ORIGIN_SPB", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "SPB" |
| } |
| } |
| ], |
| "switchStateStatistic": [ |
| { |
| "type": "SWITCH_STATE_OK", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "SWITCH_STATE_OK" |
| } |
| }, |
| { |
| "type": "SWITCH_STATE_WARNING", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "SWITCH_STATE_WARNING" |
| } |
| }, |
| { |
| "type": "SWITCH_STATE_MINOR", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "SWITCH_STATE_MINOR" |
| } |
| }, |
| { |
| "type": "SWITCH_STATE_MAJOR", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "SWITCH_STATE_MAJOR" |
| } |
| }, |
| { |
| "type": "SWITCH_STATE_CRITICAL", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "SWITCH_STATE_CRITICAL" |
| } |
| } |
| ], |
| "switchChangesStatistic": [ |
| { |
| "type": "Unknown", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "Unknown" |
| } |
| }, |
| { |
| "type": "none", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "none" |
| } |
| }, |
| { |
| "type": "Unsaved", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "Unsaved" |
| } |
| }, |
| { |
| "type": "Saved", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "Saved" |
| } |
| }, |
| { |
| "type": "Certified", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "Certified" |
| } |
| }, |
| { |
| "type": "Uncertified", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "Uncertified" |
| } |
| } |
| ], |
| "switchSynchronizedStatistic": [ |
| { |
| "type": "Unknown", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "Unknown" |
| } |
| }, |
| { |
| "type": "NotApplicable", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "NotApplicable" |
| } |
| }, |
| { |
| "type": "NotSynchronize", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "NotSynchronize" |
| } |
| }, |
| { |
| "type": "Synchronize", |
| "count": 0, |
| "translated": { |
| "countTranslated": "0", |
| "typeTranslated": "Synchronize" |
| } |
| } |
| ], |
| "translated": { |
| "deviceTypesStatistic": [], |
| "switchSynchronizedStatistic": [], |
| "linkTypesStatistic": [], |
| "switchStateStatistic": [], |
| "switchStatusStatistic": [], |
| "mapIdTranslated": "56c2cee507e12d333c0f442f", |
| "switchChangesStatistic": [], |
| "linkOriginStatistic": [], |
| "linkStatusStatistic": [] |
| } |
| }, |
| "serverVersion": "4.2.1.R01" |
| } |
| </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%> |