CLI for netbox using pynetbox module
Project description
nbcli NetBox Command-line Client
Extensible command-line interface for Netbox using the pynetbox module.
nbcli is still in development! Syntax of commands are subject to change!
Quickstart
The full nbcli documentation on Read the Docs
$ pip install nbcli
$ nbcli init
Edit pynetbox 'url' and 'token' entries in user_config.yml:
~/.nbcli/user_config.yml
At the very minimum, you need to specify a url and token in the user_config.yml file
pynetbox:
url: http://localhost:8080
token: 0123456789abcdef0123456789abcdef01234567
If you need to disable SSL verification, add (or uncomment) the following to your user_config.yml file.
requests:
verify: false
Core Commands
Extend and Customize
Testing
Instructions for setting up a test environment are here.
Basic Usage
Run a search of Netbox objects and show a table view of results.
$ nbcli search server
dcim.devices
============
ID Name Status Tenant Site Rack Role Type IP Address
1 server01 Active - AMS 1 rack-01 server Other -
2 server02 Active - AMS 2 rack-02 server Other -
3 server03 Active - SING 1 rack-03 server Other -
Show device with id 2.
$ nbcli show dcim.devices 2
server02
========
Device
------
Site: AMS 2
Rack: rack-02
Position: 2
Tenant: None
Device Type: Other
Serial Number:
Asset Tag: None
Management
----------
Role: None
Platform: None
Status: Active
Primary IPv4: None
Primary IPv6: None
Custom Fields
-------------
select_field: None
select_field_auto_weight: None
boolean_field: None
date_field: None
text_field: Description
Tags
----
Comments
--------
Interfaces
----------
Name LAG Description MTU Mode Cable Connection
to-server01 - - - - - - -
Show Prefix 10.1.1.0/24
$ nbcli show ipam.prefixes prefix=10.1.1.0/24
id: 1
family: IPv4
prefix: 10.1.1.0/24
site: AMS 1
vrf: None
tenant: tenant1
vlan: vlan1
status: Active
role: None
is_pool: False
description: prefix1
tags: []
custom_fields: {'text_field': None}
created: 2020-07-31
last_updated: 2020-07-31T21:09:11.947263Z
List all IP Addresses with pynb (pynetbox wrapper)
$ nbcli pynb ipam.ip_addresses all
ID IP Address Vrf Status Role Tenant Parent Interface DNS Name Description
1 10.1.1.1/24 vrf1 Active - - server01 to-server02 - -
3 10.1.1.2/24 - Active - - server02 to-server01 - -
5 10.1.1.10/24 - Reserved - tenant1 - - - reserved IP
2 2001:db8:a000:1::1/64 vrf1 Active - - server01 to-server02 - -
4 2001:db8:a000:1::2/64 - Active - - server02 to-server01 - -
6 2001:db8:a000:1::10/64 - Reserved - tenant1 - - - reserved IP
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
nbcli-0.7.1.dev1.tar.gz
(21.7 kB
view hashes)
Built Distribution
nbcli-0.7.1.dev1-py3-none-any.whl
(40.3 kB
view hashes)
Close
Hashes for nbcli-0.7.1.dev1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3258a425eabc17f1e654f7243cead70e24a7edb7d8fbb3913296ba60ca9fdaa1 |
|
MD5 | e35f56436bb4f58c9259a45cbe7f1901 |
|
BLAKE2b-256 | 0d4f49c637ad5170260903149d375a61a2a1a592106de99f0af62203a8ebe2ae |