NetBox Labs, Device Discovery backend for Orb Agent, part of NetBox Discovery
Project description
device-discovery
Orb device discovery backend
Usage
usage: device-discovery [-h] [-V] [-s HOST] [-p PORT] -t DIODE_TARGET -c DIODE_CLIENT_ID -k DIODE_CLIENT_SECRET [-a DIODE_APP_NAME_PREFIX] [-d] [-o DRY_RUN_OUTPUT_DIR]
[--otel-endpoint OTEL_ENDPOINT] [--otel-export-period OTEL_EXPORT_PERIOD]
Orb Device Discovery Backend
options:
-h, --help show this help message and exit
-V, --version Display Device Discovery, NAPALM and Diode SDK versions
-s HOST, --host HOST Server host
-p PORT, --port PORT Server port
-t DIODE_TARGET, --diode-target DIODE_TARGET
Diode target. Environment variable can be used by wrapping it in ${} (e.g. ${TARGET})
-c DIODE_CLIENT_ID, --diode-client-id DIODE_CLIENT_ID
Diode Client ID. Environment variable can be used by wrapping it in ${} (e.g. ${MY_CLIENT_ID})
-k DIODE_CLIENT_SECRET, --diode-client-secret DIODE_CLIENT_SECRET
Diode Client Secret. Environment variable can be used by wrapping it in ${} (e.g. ${MY_CLIENT_SECRET})
-a DIODE_APP_NAME_PREFIX, --diode-app-name-prefix DIODE_APP_NAME_PREFIX
Diode producer_app_name prefix
-d, --dry-run Run in dry-run mode, do not ingest data
-o DRY_RUN_OUTPUT_DIR, --dry-run-output-dir DRY_RUN_OUTPUT_DIR
Output dir for dry-run mode. Environment variable can be used by wrapping it in ${} (e.g. ${OUTPUT_DIR})
--otel-endpoint OTEL_ENDPOINT
OpenTelemetry exporter endpoint
--otel-export-period OTEL_EXPORT_PERIOD
Period in seconds between OpenTelemetry exports (default: 60)
Policy RFC
policies:
discovery_1:
config:
schedule: "* * * * *" #Cron expression
defaults:
site: New York NY
role: Router
scope:
- hostname: 192.168.0.32
username: ${USER}
password: admin
- driver: eos
hostname: 127.0.0.1
username: admin
password: ${ARISTA_PASSWORD}
optional_args:
enable_password: ${ARISTA_PASSWORD}
discover_once: # will run only once
scope:
- hostname: 192.168.0.34
username: ${USER}
password: ${PASSWORD}
Run device-discovery
device-discovery can be run by installing it with pip
git clone https://github.com/netboxlabs/orb-discovery.git
cd orb-discovery/
pip install --no-cache-dir ./device-discovery/
device-discovery -t 'grpc://192.168.0.10:8080/diode' -c '${DIODE_CLIENT_ID}' -k '${DIODE_CLIENT_SECRET}'
Docker Image
device-discovery can be build and run using docker:
cd device-discovery
docker build --no-cache -t device-discovery:develop -f docker/Dockerfile .
docker run -e DIODE_CLIENT_ID=${YOUR_CLIENT} -e DIODE_CLIENT_SECRET=${YOUR_SECRET} -p 8072:8072 device-discovery:develop \
device-discovery -t 'grpc://192.168.0.10:8080/diode' -c '${DIODE_CLIENT_ID}' -k '${DIODE_CLIENT_SECRET}'
Routes (v1)
Get runtime and capabilities information
GET /api/v1/status (gets discovery runtime data)
Parameters
None
Responses
http code content-type response 200application/json; charset=utf-8{"version": "0.1.0","up_time_seconds": 3678 }
Example cURL
curl -X GET -H "Content-Type: application/json" http://localhost:8072/api/v1/status
GET /api/v1/capabilities (gets device-discovery capabilities)
Parameters
None
Responses
http code content-type response 200application/json; charset=utf-8{"supported_drivers":["ios","eos","junos","nxos","cumulus"]}
Example cURL
curl -X GET -H "Content-Type: application/json" http://localhost:8072/api/v1/capabilities
Policies Management
POST /api/v1/policies (Creates a new policy)
Parameters
name type data type description None required YAML object yaml format specified in Policy RFC
Responses
http code content-type response 201application/json; charset=UTF-8{"detail":"policy 'policy_name' was started"}400application/json; charset=UTF-8{ "detail": "invalid Content-Type. Only 'application/x-yaml' is supported" }400application/json; charset=UTF-8Any other policy error 403application/json; charset=UTF-8{ "detail": "config field is required" }409application/json; charset=UTF-8{ "detail": "policy 'policy_name' already exists" }
Example cURL
curl -X POST -H "Content-Type: application/x-yaml" --data-binary @policy.yaml http://localhost:8072/api/v1/policies
DELETE /api/v1/policies/{policy_name} (delete a existing policy)
Parameters
name type data type description policy_namerequired string The unique policy name
Responses
http code content-type response 200application/json; charset=UTF-8{ "detail": "policy 'policy_name' was deleted" }400application/json; charset=UTF-8Any other policy deletion error 404application/json; charset=UTF-8{ "detail": "policy 'policy_name' not found" }
Example cURL
curl -X DELETE http://localhost:8072/api/v1/policies/policy_name
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file netboxlabs_device_discovery-1.9.0.tar.gz.
File metadata
- Download URL: netboxlabs_device_discovery-1.9.0.tar.gz
- Upload date:
- Size: 28.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.0.1 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f2a5797a8e95bcfb750e39d34310dd07bf9cdd15f70779c62602c40eca6ff572
|
|
| MD5 |
833973162c77ef36b184286bc5c1f1ed
|
|
| BLAKE2b-256 |
52e1acaadfea937a1050d1d07eec6584af029646cac94650afd1bc86d687475f
|
Provenance
The following attestation bundles were made for netboxlabs_device_discovery-1.9.0.tar.gz:
Publisher:
device-discovery-release.yaml on netboxlabs/orb-discovery
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
netboxlabs_device_discovery-1.9.0.tar.gz -
Subject digest:
f2a5797a8e95bcfb750e39d34310dd07bf9cdd15f70779c62602c40eca6ff572 - Sigstore transparency entry: 658941652
- Sigstore integration time:
-
Permalink:
netboxlabs/orb-discovery@bf59391a45e8183ba52e3fa9de710be5d4e5add3 -
Branch / Tag:
refs/heads/release - Owner: https://github.com/netboxlabs
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
device-discovery-release.yaml@bf59391a45e8183ba52e3fa9de710be5d4e5add3 -
Trigger Event:
push
-
Statement type: