jeremyschulman / netbox-pyswagger

Python Swagger client for Netbox
MIT License
18 stars 4 forks source link

How to get NAPALM information? #6

Open bdlamprecht opened 6 years ago

bdlamprecht commented 6 years ago

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.

jeremyschulman commented 6 years ago

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"