Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ollyg/b466e5e286e48c0b96fc68a4537c1723 to your computer and use it in GitHub Desktop.
Save ollyg/b466e5e286e48c0b96fc68a4537c1723 to your computer and use it in GitHub Desktop.
API implementation notes
Device
GET /device??q={search}&{params} # Lists ALL devices OR filters by search and/or params, if present
# params: vendor, dns, name, location, ip, description
# these can hopefully be autogenerated/parsed
POST /device # Creates a device.
GET /device/{ip} # Gets Device Generic Info
GET /device/{ip}/{query}
# query is one of:
# Details
# Ports
# Modules
# Neighbors
# Addresses
# VLANs
PATCH /device/{ip} # Can update location and contact info I guess?
DELETE /device/{ip} # Deletes device
# Should just be data access, so no POST/PATCH/PUT/DELETE/etc needed
Node:
GET /node?q={search}?{params}
# params: ip, mac, vendor, date range, etc.
GET /node/{mac} # technically ':' is reserved in urls, needs encoding
GET /node/{mac}/{queries} # not sure if any are needed
VLANs: (root or under reports?)
GET /vlan?q={search}&{params}
# params: id, name
GET /vlan/{vl_name} # name is primary key?
# Should just be data access, so no POST/PATCH/PUT/DELETE/etc needed
Report:
# implement in App::Netdisco::Web::Plugin ?
PortControl
GET /ports?q={search}&{params} # port search should probably be here
# params: name, vlan, speed, status, etc
# If my understanding of the db is correct, ports should unique per a {device} and {port} identifier
# Maybe a path of /device/{ip}/port/{port} (use snmp id or ifDescr/etc?) ?
# Could also add uuid or some kind of token to decode into {device} and {port}?
# implement in the PortControl.pm module
location
contact
portcontrol
portname
vlan
power
AdminTask
# implement in the AdminTask.pm module
# anything which is a Worker Action
# use standard params (device, extra)
GET /admin/jobs?q={search}&{params}
# whatever params are needed (if any)
POST /admin/jobs # start new job, pass job type in json. Returns job id (does this exist?)
# data to launch discover of device "10.20.30.40".
#{
# "job_type": "discover",
# "job_details": { # To allow more flexibility than simply devices maybe?
# "device": "10.20.30.40"
# }
#}
GET /admin/jobs/{job_id} #Get job status and info
#Below just copied from main netdisco
GET /admin/slowdevices # slow devices
GET /admin/performance # performance
GET /admin/timedoutdevices # snmp failured
GET /admin/duplicatedevices # duplicates
GET /admin/orphaned # orphaned
GET /admin/userlog # get user activity log
GET /admin/topology # list manual topo
POST /admin/topology # add topo entry, returns id (if exists?)
GET /admin/topology/{id}
PATCH /admin/topology/{id}
DELETE /admin/topology/{id}
GET /admin/pseudodevice # list pseudodev
POST /admin/pseudodevice # add pseudodev, returns id (if exists?)
GET /admin/pseudodevice/{id}
PATCH /admin/pseudodevice/{id}
DELETE /admin/pseudodevice/{id}
GET /admin/user # Gets list of all users
POST /admin/user # Create new user
GET /admin/user/{user} # user info
PATCH /admin/user/{user} # update user
DELETE /admin/user/{user} # delete user
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment