Enhance SwaggerUI to support NAPALM methods #1633

Closed
opened 2025-12-29 16:33:41 +01:00 by adam · 0 comments
Owner

Originally created by @bdlamprecht on GitHub (Mar 21, 2018).

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.

Originally created by @bdlamprecht on GitHub (Mar 21, 2018). ### 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 `method`s (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.
adam added the status: acceptedtype: documentation labels 2025-12-29 16:33:41 +01:00
adam closed this issue 2025-12-29 16:33:41 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/netbox#1633