Netbox Get Devices Task¤
task api name:
get_devices
Get Devices Sample Usage¤
NORFAB Netbox Get Devices Command Shell Reference¤
NorFab shell supports these command options for Netbox get_devices task:
nf#man tree netbox.get.devices
root
└── netbox: Netbox service
└── get: Query data from Netbox
└── devices: Query Netbox devices data
├── instance: Netbox instance name to target
├── workers: Filter worker to target, default 'any'
├── timeout: Job timeout
├── filters: List of device filters dictionaries as a JSON string, examples: [{"q": "ceos1"}]
├── devices: Device names to query data for
├── dry-run: Only return query content, do not run it
└── cache: How to use cache, default 'True'
nf#
Python API Reference¤
Retrieve device data from Netbox REST API using Pynetbox.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
job
|
Job
|
NorFab Job object |
required |
filters
|
Union[None, list]
|
list of filter dicts applied to |
None
|
instance
|
Union[None, str]
|
Netbox instance name, uses default if omitted |
None
|
dry_run
|
bool
|
if True returns filter params without making REST calls |
False
|
devices
|
Union[None, list]
|
list of device names to fetch, merged into filters as |
None
|
cache
|
Union[None, bool, str]
|
|
None
|
Returns:
| Type | Description |
|---|---|
Result
|
dict keyed by device name with fields: last_updated, custom_field_data, tags, device_type, |
Result
|
role, config_context, tenant, platform, serial, asset_tag, site, location, rack, status, |
Result
|
primary_ip4, primary_ip6, airflow, position, id |
Source code in norfab\workers\netbox_worker\devices_tasks.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | |