netbox-pyswagger icon indicating copy to clipboard operation
netbox-pyswagger copied to clipboard

How to get NAPALM information?

Open bdlamprecht opened this issue 7 years ago • 1 comments
trafficstars

Hi Jeremy, I didn't want to bother you in your evening hours using Slack, so I thought I give this a shot instead so I didn't loose my train of thought...

I'm trying to get device-specific NAPALM information via the netbox-pyswagger (along with jupyter notebook) that I can get using following API call:

curl -X GET -H "Accept: application/json; indent=2" -H "Authorization: Token [REMOVED]" "http://netbox.local/devices/20/napalm/?method=get_facts"

Using your tutorial as a reference, I found the following operationId in Swagger's OpenAPI reference file (/api/docs/?format=openapi), but did not see an obvious way to pass a specific device_id nor a method=get_facts to it:

"/api/dcim/devices/{id}/napalm/": {
    "get": {
        "description": "Execute a NAPALM method on a Device",
        "operationId": "dcim_devices_napalm",
        "parameters": [
            {
                "description": "A unique integer value identifying this device.",
                "in": "path",
                "name": "id",
                "required": true,
                "type": "integer"
            }
        ],
        "responses": {
            "200": {
                "description": ""
            }
        },
        "summary": "Execute a NAPALM method on a Device",
        "tags": [
            "dcim"
        ]
    }
},

Is that type of request possible at all or am I missing something obvious in how I'm going about it? Thanks and let me know when you can.

bdlamprecht avatar Mar 20 '18 23:03 bdlamprecht

Hi @bdlamprecht - this may be a bug in the API swagger spec. If you have not already; I'd suggest checking with netbox team on this API. I will also try this as well to explore "workarounds"

jeremyschulman avatar Mar 21 '18 13:03 jeremyschulman