Skip to content

Enhance SwaggerUI to support NAPALM methods #1982

@bdlamprecht

Description

@bdlamprecht

Issue type

[X] Feature request

Environment

  • Python version: 3.6
  • NetBox version: 2.3.1

Description

I know how to use the NetBox API directly from the CLI to get info from devices using NAPALM (and the works great!). However, I can't do the same thing in the SwaggerUI and I'm hoping a small change could enable me to do that.

What I'm trying to accomplish is to programatically query the devices I have in NetBox (via NAPALM) to see if their model matches the device_type (or specifically part_number) that I have defined in NetBox.

From what I can tell, pynetbox doesn't have this functionalty so I'm trying to use netbox-pyswagger (from @jeremyschulman) to accomplish this. However, that "client" is solely based on the output gathered from /api/docs/?format=openapi.

To clarify, under the dcim section of Swagger, there is this option:

GET /api/dcim/devices/{id}/napalm/

And when you expand it, you can only pass the id field.

After entering an id there and clicking the "Try It Out!" button, I can confirm (with command logging on the device in question) that NAPALM does connect just fine, but doesn't run anything else (due to not be told otherwise) and then disconnects.

The, the response seen in Swagger is the following:

Response Body
{}

Response Code
200

I suppose what I'm looking for is the option to pass other methods (via Swagger) to get the same information as I can using the CLI. I hope that makes sense. If not, let me know and I can try to explain further.

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: acceptedThis issue has been accepted for implementationtype: documentationA change or addition to the documentation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions