././@PaxHeader 0000000 0000000 0000000 00000000034 00000000000 010212 x ustar 00 28 mtime=1729871946.3977442
pynetbox-7.4.1/ 0000755 0001751 0000177 00000000000 14706740112 013002 5 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000033 00000000000 010211 x ustar 00 27 mtime=1729871946.369744
pynetbox-7.4.1/.github/ 0000755 0001751 0000177 00000000000 14706740112 014342 5 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000033 00000000000 010211 x ustar 00 27 mtime=1729871946.369744
pynetbox-7.4.1/.github/ISSUE_TEMPLATE/ 0000755 0001751 0000177 00000000000 14706740112 016525 5 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/.github/ISSUE_TEMPLATE/bug_report.yaml 0000644 0001751 0000177 00000004226 14706740105 021567 0 ustar 00runner docker ---
name: 🐛 Bug Report
description: Report a reproducible bug in the current release of pynetbox
labels: ["type: bug"]
body:
- type: markdown
attributes:
value: >
**NOTE:** This form is only for reporting _reproducible bugs_ in a current pynetbox release.
- type: input
attributes:
label: pynetbox version
description: What version of pynetbox are you currently running?
placeholder: v7.4.1
validations:
required: true
- type: input
attributes:
label: NetBox version
description: What version of NetBox are you currently running?
placeholder: v4.0.8
validations:
required: true
- type: dropdown
attributes:
label: Python version
description: What version of Python are you currently running?
options:
- "3.10"
- "3.11"
- "3.12"
validations:
required: true
- type: textarea
attributes:
label: Steps to Reproduce
description: >
Please provide a minimal working example to demonstrate the bug. Begin with the
initialization of any necessary database objects and clearly enumerate each
operation carried out. Ensure that your example is as concise as possible
while adequately illustrating the issue. For example:
```python
>>> import pynetbox
>>> nb = pynebox.api('https://netbox.example.com', token='my-token')
```
Note: **do not utilize the demo instance** for replicating suspected bugs,
as its data is subject to change or removal at any time.
_Please refrain from including any confidential or sensitive
information in your example._
validations:
required: true
- type: textarea
attributes:
label: Expected Behavior
description: What did you expect to happen?
placeholder: The script should execute without raising any errors or exceptions
validations:
required: true
- type: textarea
attributes:
label: Observed Behavior
description: What happened instead?
placeholder: A TypeError exception was raised
validations:
required: true
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/.github/ISSUE_TEMPLATE/config.yml 0000644 0001751 0000177 00000001371 14706740105 020521 0 ustar 00runner docker # Reference: https://help.github.com/en/github/building-a-strong-community/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
blank_issues_enabled: false
contact_links:
- name: 📖 Contributing Policy
url: https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md
about: "Please read through our contributing policy before opening an issue or pull request."
- name: ❓ Discussion
url: https://github.com/netbox-community/pynetbox/discussions
about: "If you're just looking for help, try starting a discussion instead."
- name: 💬 Community Slack
url: https://netdev.chat
about: "Join #netbox on the NetDev Community Slack for assistance with installation issues and other problems."
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/.github/ISSUE_TEMPLATE/deprecation.yaml 0000644 0001751 0000177 00000001252 14706740105 021710 0 ustar 00runner docker ---
name: 🗑️ Deprecation
description: The removal of an existing feature or resource
labels: ["type: deprecation"]
body:
- type: textarea
attributes:
label: Proposed Changes
description: >
Describe in detail the proposed changes. What is being removed?
validations:
required: true
- type: textarea
attributes:
label: Justification
description: Please provide justification for the proposed change(s).
validations:
required: true
- type: textarea
attributes:
label: Impact
description: List all areas of the application that will be affected by this change.
validations:
required: true
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/.github/ISSUE_TEMPLATE/documentation_change.yaml 0000644 0001751 0000177 00000001573 14706740105 023577 0 ustar 00runner docker ---
name: 📖 Documentation Change
description: Suggest an addition or modification to the pynetbox documentation
labels: ["type: documentation"]
body:
- type: dropdown
attributes:
label: Change Type
description: What type of change are you proposing?
options:
- Addition
- Correction
- Removal
- Cleanup (formatting, typos, etc.)
validations:
required: true
- type: dropdown
attributes:
label: Area
description: To what section of the documentation does this change primarily pertain?
options:
- Endpoint
- Response
- Request
- IPAM
- Other
validations:
required: true
- type: textarea
attributes:
label: Proposed Changes
description: Describe the proposed changes and why they are necessary.
validations:
required: true
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/.github/ISSUE_TEMPLATE/feature_request.yaml 0000644 0001751 0000177 00000004236 14706740105 022623 0 ustar 00runner docker ---
name: ✨ Feature Request
description: Propose a new pynetbox feature or enhancement
labels: ["type: feature"]
body:
- type: markdown
attributes:
value: >
**NOTE:** This form is only for submitting well-formed proposals to extend or modify
pynetbox in some way. If you're trying to solve a problem but can't figure out how, or if
you still need time to work on the details of a proposed new feature, please start a
[discussion](https://github.com/netbox-community/pynetbox/discussions) instead.
- type: input
attributes:
label: pynetbox version
description: What version of pynetbox are you currently running?
placeholder: v7.1.0
validations:
required: true
- type: input
attributes:
label: NetBox version
description: What version of NetBox are you currently running?
placeholder: v3.6.0
validations:
required: true
- type: dropdown
attributes:
label: Feature type
options:
- Data model extension
- New functionality
- Change to existing functionality
validations:
required: true
- type: textarea
attributes:
label: Proposed functionality
description: >
Describe in detail the new feature or behavior you are proposing. Include any specific changes
to work flows, data models, and/or the user interface. The more detail you provide here, the
greater chance your proposal has of being discussed. Feature requests which don't include an
actionable implementation plan will be rejected.
validations:
required: true
- type: textarea
attributes:
label: Use case
description: >
Explain how adding this functionality would benefit pynetbox users. What need does it address?
validations:
required: true
- type: textarea
attributes:
label: External dependencies
description: >
List any new dependencies on external libraries or services that this new feature would
introduce. For example, does the proposal require the installation of a new Python package?
(Not all new features introduce new dependencies.)
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/.github/ISSUE_TEMPLATE/housekeeping.yaml 0000644 0001751 0000177 00000001473 14706740105 022106 0 ustar 00runner docker ---
name: 🏡 Housekeeping
description: A change pertaining to the codebase itself (developers only)
labels: ["type: housekeeping"]
body:
- type: markdown
attributes:
value: >
**NOTE:** This template is for use by maintainers only. Please do not submit
an issue using this template unless you have been specifically asked to do so.
- type: textarea
attributes:
label: Proposed Changes
description: >
Describe in detail the new feature or behavior you'd like to propose.
Include any specific changes to work flows, data models, or the user interface.
validations:
required: true
- type: textarea
attributes:
label: Justification
description: Please provide justification for the proposed change(s).
validations:
required: true
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/.github/PULL_REQUEST_TEMPLATE.md 0000644 0001751 0000177 00000001134 14706740105 020144 0 ustar 00runner docker
### Fixes: #1234
././@PaxHeader 0000000 0000000 0000000 00000000033 00000000000 010211 x ustar 00 27 mtime=1729871946.369744
pynetbox-7.4.1/.github/workflows/ 0000755 0001751 0000177 00000000000 14706740112 016377 5 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/.github/workflows/publish.yml 0000644 0001751 0000177 00000002074 14706740105 020575 0 ustar 00runner docker # This workflow will upload a Python Package using Twine when a release is created
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-package-registries
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.
name: Upload Python Package
on:
release:
types: [published]
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v3
with:
python-version: '3.x'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: python -m build
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/.github/workflows/py3.yml 0000644 0001751 0000177 00000001224 14706740105 017636 0 ustar 00runner docker name: Py3 Test
on:
pull_request: {}
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python: ["3.10", "3.11", "3.12"]
netbox: ["3.6", "3.7", "4.0"]
steps:
- uses: actions/checkout@v4
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install dev requirements
run: pip install -r requirements-dev.txt .
- name: Run Linter
run: black --diff --check pynetbox tests
- name: Run Tests
run: pytest --netbox-versions=${{ matrix.netbox }}
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/.gitignore 0000644 0001751 0000177 00000002363 14706740105 015000 0 ustar 00runner docker # Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class
# C extensions
*.so
# Distribution / packaging
.Python
build/
develop-eggs/
dist/
downloads/
eggs/
.eggs/
lib64/
lib/
parts/
sdist/
var/
wheels/
*.egg-info/
.installed.cfg
*.egg
# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec
# Installer logs
pip-log.txt
pip-delete-this-directory.txt
# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.coverage.*
.cache
nosetests.xml
coverage.xml
*.cover
.hypothesis/
# Translations
*.mo
*.pot
# Django stuff:
*.log
local_settings.py
# Flask stuff:
instance/
.webassets-cache
# Scrapy stuff:
.scrapy
# Sphinx documentation
docs/_build/
# PyBuilder
target/
# Jupyter Notebook
.ipynb_checkpoints
# pyenv
.python-version
# celery beat schedule file
celerybeat-schedule
# SageMath parsed files
*.sage.py
# Environments
.env
.venv
env/
venv/
ENV/
# Spyder project settings
.spyderproject
.spyproject
# Rope project settings
.ropeproject
# mkdocs documentation
/site
# mypy
.mypy_cache/
# Other git repos checked out locally
.netbox-docker-*/
.devicetype-library/
# Visual Studio Code settings
.vscode/
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/.readthedocs.yaml 0000644 0001751 0000177 00000000420 14706740105 016227 0 ustar 00runner docker version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"
# Build from the docs/ directory with Sphinx
sphinx:
configuration: docs/conf.py
# Explicitly set the version of Python and its requirements
python:
install:
- requirements: docs/requirements.txt
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/CHANGELOG.md 0000644 0001751 0000177 00000000127 14706740105 014615 0 ustar 00runner docker
For the list of changelog, please see the repository releases information in GitHub.
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/LICENSE 0000644 0001751 0000177 00000022614 14706740105 014016 0 ustar 00runner docker
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
Copyright 2017 DigitalOcean ././@PaxHeader 0000000 0000000 0000000 00000000034 00000000000 010212 x ustar 00 28 mtime=1729871946.3977442
pynetbox-7.4.1/PKG-INFO 0000644 0001751 0000177 00000007537 14706740112 014113 0 ustar 00runner docker Metadata-Version: 2.1
Name: pynetbox
Version: 7.4.1
Summary: NetBox API client library
Home-page: https://github.com/netbox-community/pynetbox
Author: Zach Moody, Arthur Hanson
Author-email: ahanson@netboxlabs.com
License: Apache2
Keywords: netbox
Classifier: Intended Audience :: Developers
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests<3.0,>=2.20.0
Requires-Dist: packaging
# Pynetbox
Python API client library for [NetBox](https://github.com/netbox-community/netbox).
> **Note:** Version 6.7 and later of the library only supports NetBox 3.3 and above.
## Compatibility
Each pyNetBox Version listed below has been tested with its corresponding NetBox Version.
| NetBox Version | Plugin Version |
|:--------------:|:--------------:|
| 4.0.6 | 7.4.1 |
| 4.0.0 | 7.3.4 |
| 3.7 | 7.3.0 |
| 3.6 | 7.2.0 |
| 3.5 | 7.1.0 |
| 3.3 | 7.0.0 |
## Installation
To install run `pip install pynetbox`.
Alternatively, you can clone the repo and run `python setup.py install`.
## Quick Start
The full pynetbox API is documented on [Read the Docs](http://pynetbox.readthedocs.io/en/latest/), but the following should be enough to get started using it.
To begin, import pynetbox and instantiate the API.
```
import pynetbox
nb = pynetbox.api(
'http://localhost:8000',
token='d6f4e314a5b5fefd164995169f28ae32d987704f'
)
```
The first argument the .api() method takes is the NetBox URL. There are a handful of named arguments you can provide, but in most cases none are required to simply pull data. In order to write, the `token` argument should to be provided.
## Queries
The pynetbox API is setup so that NetBox's apps are attributes of the `.api()` object, and in turn those apps have attribute representing each endpoint. Each endpoint has a handful of methods available to carry out actions on the endpoint. For example, in order to query all the objects in the `devices` endpoint you would do the following:
```
>>> devices = nb.dcim.devices.all()
>>> for device in devices:
... print(device.name)
...
test1-leaf1
test1-leaf2
test1-leaf3
>>>
```
Note that the all() and filter() methods are generators and return an object that can be iterated over only once. If you are going to be iterating over it repeatedly you need to either call the all() method again, or encapsulate the results in a `list` object like this:
```
>>> devices = list(nb.dcim.devices.all())
```
### Threading
pynetbox supports multithreaded calls for `.filter()` and `.all()` queries. It is **highly recommended** you have `MAX_PAGE_SIZE` in your Netbox install set to anything *except* `0` or `None`. The default value of `1000` is usually a good value to use. To enable threading, add `threading=True` parameter to the `.api`:
```python
nb = pynetbox.api(
'http://localhost:8000',
threading=True,
)
```
## Alternative Library
> **Note:** For those interested in a different approach, there is an alternative Python API client library available for NetBox called [netbox-python](https://github.com/netbox-community/netbox-python). This library provides a thin Python wrapper over the NetBox API.
[netbox-python](https://github.com/netbox-community/netbox-python) offers a minimalistic interface to interact with NetBox's API. While it may not provide all the features available in pynetbox, it offers a lightweight and straightforward option for interfacing with NetBox.
To explore further details and access the documentation, please visit the [netbox-python](https://github.com/netbox-community/netbox-python).
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/README.md 0000644 0001751 0000177 00000006275 14706740105 014275 0 ustar 00runner docker # Pynetbox
Python API client library for [NetBox](https://github.com/netbox-community/netbox).
> **Note:** Version 6.7 and later of the library only supports NetBox 3.3 and above.
## Compatibility
Each pyNetBox Version listed below has been tested with its corresponding NetBox Version.
| NetBox Version | Plugin Version |
|:--------------:|:--------------:|
| 4.0.6 | 7.4.1 |
| 4.0.0 | 7.3.4 |
| 3.7 | 7.3.0 |
| 3.6 | 7.2.0 |
| 3.5 | 7.1.0 |
| 3.3 | 7.0.0 |
## Installation
To install run `pip install pynetbox`.
Alternatively, you can clone the repo and run `python setup.py install`.
## Quick Start
The full pynetbox API is documented on [Read the Docs](http://pynetbox.readthedocs.io/en/latest/), but the following should be enough to get started using it.
To begin, import pynetbox and instantiate the API.
```
import pynetbox
nb = pynetbox.api(
'http://localhost:8000',
token='d6f4e314a5b5fefd164995169f28ae32d987704f'
)
```
The first argument the .api() method takes is the NetBox URL. There are a handful of named arguments you can provide, but in most cases none are required to simply pull data. In order to write, the `token` argument should to be provided.
## Queries
The pynetbox API is setup so that NetBox's apps are attributes of the `.api()` object, and in turn those apps have attribute representing each endpoint. Each endpoint has a handful of methods available to carry out actions on the endpoint. For example, in order to query all the objects in the `devices` endpoint you would do the following:
```
>>> devices = nb.dcim.devices.all()
>>> for device in devices:
... print(device.name)
...
test1-leaf1
test1-leaf2
test1-leaf3
>>>
```
Note that the all() and filter() methods are generators and return an object that can be iterated over only once. If you are going to be iterating over it repeatedly you need to either call the all() method again, or encapsulate the results in a `list` object like this:
```
>>> devices = list(nb.dcim.devices.all())
```
### Threading
pynetbox supports multithreaded calls for `.filter()` and `.all()` queries. It is **highly recommended** you have `MAX_PAGE_SIZE` in your Netbox install set to anything *except* `0` or `None`. The default value of `1000` is usually a good value to use. To enable threading, add `threading=True` parameter to the `.api`:
```python
nb = pynetbox.api(
'http://localhost:8000',
threading=True,
)
```
## Alternative Library
> **Note:** For those interested in a different approach, there is an alternative Python API client library available for NetBox called [netbox-python](https://github.com/netbox-community/netbox-python). This library provides a thin Python wrapper over the NetBox API.
[netbox-python](https://github.com/netbox-community/netbox-python) offers a minimalistic interface to interact with NetBox's API. While it may not provide all the features available in pynetbox, it offers a lightweight and straightforward option for interfacing with NetBox.
To explore further details and access the documentation, please visit the [netbox-python](https://github.com/netbox-community/netbox-python).
././@PaxHeader 0000000 0000000 0000000 00000000033 00000000000 010211 x ustar 00 27 mtime=1729871946.369744
pynetbox-7.4.1/docs/ 0000755 0001751 0000177 00000000000 14706740112 013732 5 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/docs/IPAM.rst 0000644 0001751 0000177 00000000204 14706740105 015210 0 ustar 00runner docker IPAM
========
.. autoclass:: pynetbox.models.ipam.Prefixes
:members:
.. autoclass:: pynetbox.models.ipam.VlanGroups
:members:
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/docs/Makefile 0000644 0001751 0000177 00000001172 14706740105 015375 0 ustar 00runner docker # Minimal makefile for Sphinx documentation
#
# You can set these variables from the command line, and also
# from the environment for the first two.
SPHINXOPTS ?=
SPHINXBUILD ?= sphinx-build
SOURCEDIR = .
BUILDDIR = _build
# Put it first so that "make" without argument is like "make help".
help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
.PHONY: help Makefile
# Catch-all target: route all unknown targets to Sphinx using the new
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
%: Makefile
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/docs/advanced.rst 0000644 0001751 0000177 00000003465 14706740105 016243 0 ustar 00runner docker Custom Sessions
===============
Custom sessions can be used to modify the default HTTP behavior. Below are a few examples, most of them from `here `_.
Headers
*******
To set a custom header on all requests. These headers are automatically merged with headers pynetbox sets itself.
:Example:
>>> import pynetbox
>>> import requests
>>> session = requests.Session()
>>> session.headers = {"mycustomheader": "test"}
>>> nb = pynetbox.api(
... 'http://localhost:8000',
... token='d6f4e314a5b5fefd164995169f28ae32d987704f'
... )
>>> nb.http_session = session
SSL Verification
****************
To disable SSL verification. See `the docs `_.
:Example:
>>> import pynetbox
>>> import requests
>>> session = requests.Session()
>>> session.verify = False
>>> nb = pynetbox.api(
... 'http://localhost:8000',
... token='d6f4e314a5b5fefd164995169f28ae32d987704f'
... )
>>> nb.http_session = session
Timeouts
********
Setting timeouts requires the use of Adapters.
:Example:
.. code-block:: python
from requests.adapters import HTTPAdapter
class TimeoutHTTPAdapter(HTTPAdapter):
def __init__(self, *args, **kwargs):
self.timeout = kwargs.get("timeout", 5)
super().__init__(*args, **kwargs)
def send(self, request, **kwargs):
kwargs['timeout'] = self.timeout
return super().send(request, **kwargs)
adapter = TimeoutHTTPAdapter()
session = requests.Session()
session.mount("http://", adapter)
session.mount("https://", adapter)
nb = pynetbox.api(
'http://localhost:8000',
token='d6f4e314a5b5fefd164995169f28ae32d987704f'
)
nb.http_session = session
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/docs/conf.py 0000644 0001751 0000177 00000002624 14706740105 015237 0 ustar 00runner docker # Configuration file for the Sphinx documentation builder.
#
# For the full list of built-in configuration values, see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
from importlib.metadata import version
# -- Project information -----------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
project = "pynetbox"
copyright = "2023, NetBox"
author = "Abhimanyu Saharan"
release = "Apache2"
# -- General configuration ---------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
extensions = ["sphinx.ext.autodoc"]
templates_path = ["_templates"]
exclude_patterns = ["_build"]
# The master toctree document.
master_doc = "index"
# -- Options for HTML output -------------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
html_theme = "sphinx_rtd_theme"
htmlhelp_basename = "pynetboxdoc"
pygments_style = "sphinx"
# The version info for the project you're documenting, acts as replacement for
# |version| and |release|, also used in various other places throughout the
# built documents.
# The full version, including alpha/beta/rc tags.
release_version = version("pynetbox")
#
# The short X.Y version.
version = ".".join(release_version.split(".")[:2])
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/docs/endpoint.rst 0000644 0001751 0000177 00000000217 14706740105 016306 0 ustar 00runner docker Endpoint
========
.. autoclass:: pynetbox.core.endpoint.Endpoint
:members:
.. autoclass:: pynetbox.core.endpoint.DetailEndpoint
:members: ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/docs/index.rst 0000644 0001751 0000177 00000000645 14706740105 015602 0 ustar 00runner docker .. toctree::
:maxdepth: 2
:caption: Contents:
endpoint
response
request
IPAM
advanced
TL;DR
=====
Instantiate the :py:class:`.Api`. Use the methods available on :py:class:`.Endpoint` to return :py:class:`.Record` objects.
API
===
.. autoclass:: pynetbox.core.api.Api
:members:
App
===
.. autoclass:: pynetbox.core.app.App
:members:
Indices and tables
==================
* :ref:`genindex`
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/docs/request.rst 0000644 0001751 0000177 00000000313 14706740105 016153 0 ustar 00runner docker Request
========
.. autoclass:: pynetbox.core.query.RequestError
:members:
.. autoclass:: pynetbox.core.query.ContentError
:members:
.. autoclass:: pynetbox.core.query.AllocationError
:members:
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/docs/requirements.txt 0000644 0001751 0000177 00000000115 14706740105 017215 0 ustar 00runner docker sphinx<8.0.0
sphinx_rtd_theme<2.0.0
readthedocs-sphinx-search<0.4.0
pynetbox
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/docs/response.rst 0000644 0001751 0000177 00000000211 14706740105 016316 0 ustar 00runner docker Response
========
.. autoclass:: pynetbox.core.response.Record
:members:
.. autoclass:: pynetbox.core.response.RecordSet
:members:
././@PaxHeader 0000000 0000000 0000000 00000000033 00000000000 010211 x ustar 00 27 mtime=1729871946.369744
pynetbox-7.4.1/pynetbox/ 0000755 0001751 0000177 00000000000 14706740112 014652 5 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/pynetbox/__init__.py 0000644 0001751 0000177 00000000214 14706740105 016762 0 ustar 00runner docker from pynetbox.core.api import Api as api
from pynetbox.core.query import AllocationError, ContentError, RequestError
__version__ = "7.4.1"
././@PaxHeader 0000000 0000000 0000000 00000000033 00000000000 010211 x ustar 00 27 mtime=1729871946.373744
pynetbox-7.4.1/pynetbox/core/ 0000755 0001751 0000177 00000000000 14706740112 015602 5 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/pynetbox/core/__init__.py 0000644 0001751 0000177 00000000000 14706740105 017703 0 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/pynetbox/core/api.py 0000644 0001751 0000177 00000015375 14706740105 016742 0 ustar 00runner docker """
(c) 2017 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import requests
from pynetbox.core.app import App, PluginsApp
from pynetbox.core.query import Request
from pynetbox.core.response import Record
class Api:
"""The API object is the point of entry to pynetbox.
After instantiating the Api() with the appropriate named arguments
you can specify which app and endpoint you wish to interact with.
Valid attributes currently are:
* circuits
* core (NetBox 3.5+)
* dcim
* extras
* ipam
* tenancy
* users
* virtualization
* vpn (NetBox 3.7+)
* wireless
Calling any of these attributes will return
:py:class:`.App` which exposes endpoints as attributes.
**Additional Attributes**:
* **http_session(requests.Session)**:
Override the default session with your own. This is used to control
a number of HTTP behaviors such as SSL verification, custom headers,
retires, and timeouts.
See `custom sessions `__ for more info.
:param str url: The base URL to the instance of NetBox you
wish to connect to.
:param str token: Your NetBox token.
:param bool,optional threading: Set to True to use threading in ``.all()``
and ``.filter()`` requests.
:raises AttributeError: If app doesn't exist.
:Examples:
>>> import pynetbox
>>> nb = pynetbox.api(
... 'http://localhost:8000',
... token='d6f4e314a5b5fefd164995169f28ae32d987704f'
... )
>>> list(nb.dcim.devices.all())
[test1-leaf1, test1-leaf2, test1-leaf3]
"""
def __init__(
self,
url,
token=None,
threading=False,
):
base_url = "{}/api".format(url if url[-1] != "/" else url[:-1])
self.token = token
self.base_url = base_url
self.http_session = requests.Session()
self.threading = threading
self.circuits = App(self, "circuits")
self.core = App(self, "core")
self.dcim = App(self, "dcim")
self.extras = App(self, "extras")
self.ipam = App(self, "ipam")
self.tenancy = App(self, "tenancy")
self.users = App(self, "users")
self.virtualization = App(self, "virtualization")
self.vpn = App(self, "vpn")
self.wireless = App(self, "wireless")
self.plugins = PluginsApp(self)
@property
def version(self):
"""Gets the API version of NetBox.
Can be used to check the NetBox API version if there are
version-dependent features or syntaxes in the API.
:Returns: Version number as a string.
:Example:
>>> import pynetbox
>>> nb = pynetbox.api(
... 'http://localhost:8000',
... token='d6f4e314a5b5fefd164995169f28ae32d987704f'
... )
>>> nb.version
'3.1'
>>>
"""
version = Request(
base=self.base_url,
http_session=self.http_session,
).get_version()
return version
def openapi(self):
"""Returns the OpenAPI spec.
Quick helper function to pull down the entire OpenAPI spec.
:Returns: dict
:Example:
>>> import pynetbox
>>> nb = pynetbox.api(
... 'http://localhost:8000',
... token='d6f4e314a5b5fefd164995169f28ae32d987704f'
... )
>>> nb.openapi()
{...}
>>>
"""
return Request(
base=self.base_url,
http_session=self.http_session,
).get_openapi()
def status(self):
"""Gets the status information from NetBox.
:Returns: Dictionary as returned by NetBox.
:Raises: :py:class:`.RequestError` if the request is not successful.
:Example:
>>> pprint.pprint(nb.status())
{'django-version': '3.1.3',
'installed-apps': {'cacheops': '5.0.1',
'debug_toolbar': '3.1.1',
'django_filters': '2.4.0',
'django_prometheus': '2.1.0',
'django_rq': '2.4.0',
'django_tables2': '2.3.3',
'drf_yasg': '1.20.0',
'mptt': '0.11.0',
'rest_framework': '3.12.2',
'taggit': '1.3.0',
'timezone_field': '4.0'},
'netbox-version': '2.10.2',
'plugins': {},
'python-version': '3.7.3',
'rq-workers-running': 1}
>>>
"""
status = Request(
base=self.base_url,
token=self.token,
http_session=self.http_session,
).get_status()
return status
def create_token(self, username, password):
"""Creates an API token using a valid NetBox username and password.
Saves the created token automatically in the API object.
:Returns: The token as a ``Record`` object.
:Raises: :py:class:`.RequestError` if the request is not successful.
:Example:
>>> import pynetbox
>>> nb = pynetbox.api("https://netbox-server")
>>> token = nb.create_token("admin", "netboxpassword")
>>> nb.token
'96d02e13e3f1fdcd8b4c089094c0191dcb045bef'
>>> from pprint import pprint
>>> pprint(dict(token))
{'created': '2021-11-27T11:26:49.360185+02:00',
'description': '',
'display': '045bef (admin)',
'expires': None,
'id': 2,
'key': '96d02e13e3f1fdcd8b4c089094c0191dcb045bef',
'url': 'https://netbox-server/api/users/tokens/2/',
'user': {'display': 'admin',
'id': 1,
'url': 'https://netbox-server/api/users/users/1/',
'username': 'admin'},
'write_enabled': True}
>>>
"""
resp = Request(
base="{}/users/tokens/provision/".format(self.base_url),
http_session=self.http_session,
).post(data={"username": username, "password": password})
# Save the newly created API token, otherwise populating the Record
# object details will fail
self.token = resp["key"]
return Record(resp, self, None)
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/pynetbox/core/app.py 0000644 0001751 0000177 00000007456 14706740105 016752 0 ustar 00runner docker """
(c) 2017 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from pynetbox.core.endpoint import Endpoint
from pynetbox.core.query import Request
from pynetbox.models import (
circuits,
dcim,
extras,
ipam,
users,
virtualization,
wireless,
)
class App:
"""Represents apps in NetBox.
Calls to attributes are returned as Endpoint objects.
:returns: :py:class:`.Endpoint` matching requested attribute.
:raises: :py:class:`.RequestError`
if requested endpoint doesn't exist.
"""
def __init__(self, api, name):
self.api = api
self.name = name
self._setmodel()
models = {
"dcim": dcim,
"ipam": ipam,
"circuits": circuits,
"virtualization": virtualization,
"extras": extras,
"users": users,
"wireless": wireless,
}
def _setmodel(self):
self.model = App.models[self.name] if self.name in App.models else None
def __getstate__(self):
return {"api": self.api, "name": self.name}
def __setstate__(self, d):
self.__dict__.update(d)
self._setmodel()
def __getattr__(self, name):
return Endpoint(self.api, self, name, model=self.model)
def config(self):
"""Returns config response from app
:Returns: Raw response from NetBox's config endpoint.
:Raises: :py:class:`.RequestError` if called for an invalid endpoint.
:Example:
>>> pprint.pprint(nb.users.config())
{'tables': {'DeviceTable': {'columns': ['name',
'status',
'tenant',
'role',
'site',
'primary_ip',
'tags']}}}
"""
config = Request(
base="{}/{}/config/".format(
self.api.base_url,
self.name,
),
token=self.api.token,
http_session=self.api.http_session,
).get()
return config
class PluginsApp:
"""
Basically valid plugins api could be handled by same App class,
but you need to add plugins to request url path.
:returns: :py:class:`.App` with added plugins into path.
"""
def __init__(self, api):
self.api = api
def __getstate__(self):
return self.__dict__
def __setstate__(self, d):
self.__dict__.update(d)
def __getattr__(self, name):
return App(self.api, "plugins/{}".format(name.replace("_", "-")))
def installed_plugins(self):
"""Returns raw response with installed plugins
:returns: Raw response NetBox's installed plugins.
:Example:
>>> nb.plugins.installed_plugins()
[{
'name': 'test_plugin',
'package': 'test_plugin',
'author': 'Dmitry',
'description': 'Netbox test plugin',
'verison': '0.10'
}]
"""
installed_plugins = Request(
base="{}/plugins/installed-plugins".format(
self.api.base_url,
),
token=self.api.token,
http_session=self.api.http_session,
).get()
return installed_plugins
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/pynetbox/core/endpoint.py 0000644 0001751 0000177 00000061232 14706740105 020002 0 ustar 00runner docker """
(c) 2017 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from pynetbox.core.query import Request, RequestError
from pynetbox.core.response import Record, RecordSet
RESERVED_KWARGS = ()
class Endpoint:
"""Represent actions available on endpoints in the Netbox API.
Takes ``name`` and ``app`` passed from App() and builds the correct
url to make queries to and the proper Response object to return
results in.
:arg obj api: Takes :py:class:`.Api` created at instantiation.
:arg obj app: Takes :py:class:`.App`.
:arg str name: Name of endpoint passed to App().
:arg obj,optional model: Custom model for given app.
.. note::
In order to call NetBox endpoints with dashes in their
names you should convert the dash to an underscore.
(E.g. querying the ip-addresses endpoint is done with
``nb.ipam.ip_addresses.all()``.)
"""
def __init__(self, api, app, name, model=None):
self.return_obj = self._lookup_ret_obj(name, model)
self.name = name.replace("_", "-")
self.api = api
self.base_url = api.base_url
self.token = api.token
self.url = "{base_url}/{app}/{endpoint}".format(
base_url=self.base_url,
app=app.name,
endpoint=self.name,
)
self._choices = None
def _lookup_ret_obj(self, name, model):
"""Loads unique Response objects.
This method loads a unique response object for an endpoint if
it exists. Otherwise return a generic `Record` object.
:arg str name: Endpoint name.
:arg obj model: The application model that
contains unique Record objects.
:Returns: Record (obj)
"""
if model:
name = name.title().replace("_", "")
ret = getattr(model, name, Record)
else:
ret = Record
return ret
def all(self, limit=0, offset=None):
"""Queries the 'ListView' of a given endpoint.
Returns all objects from an endpoint.
:arg int,optional limit: Overrides the max page size on
paginated returns. This defines the number of records that will
be returned with each query to the Netbox server. The queries
will be made as you iterate through the result set.
:arg int,optional offset: Overrides the offset on paginated returns.
:Returns: A :py:class:`.RecordSet` object.
:Examples:
>>> devices = list(nb.dcim.devices.all())
>>> for device in devices:
... print(device.name)
...
test1-leaf1
test1-leaf2
test1-leaf3
>>>
If you want to iterate over the results multiple times then
encapsulate them in a list like this:
>>> devices = list(nb.dcim.devices.all())
This will cause the entire result set
to be fetched from the server.
"""
if limit == 0 and offset is not None:
raise ValueError("offset requires a positive limit value")
req = Request(
base="{}/".format(self.url),
token=self.token,
http_session=self.api.http_session,
threading=self.api.threading,
limit=limit,
offset=offset,
)
return RecordSet(self, req)
def get(self, *args, **kwargs):
r"""Queries the DetailsView of a given endpoint.
:arg int,optional key: id for the item to be
retrieved.
:arg str,optional \**kwargs: Accepts the same keyword args as
filter(). Any search argument the endpoint accepts can
be added as a keyword arg.
:returns: A single :py:class:`.Record` object or None
:raises ValueError: if kwarg search return more than one value.
:Examples:
Referencing with a kwarg that only returns one value.
>>> nb.dcim.devices.get(name='test1-a3-tor1b')
test1-a3-tor1b
>>>
Referencing with an id.
>>> nb.dcim.devices.get(1)
test1-edge1
>>>
Using multiple named arguments. For example, retriving the location when the location name is not unique and used in multiple sites.
>>> nb.locations.get(site='site-1', name='Row 1')
Row 1
"""
try:
key = args[0]
except IndexError:
key = None
if not key:
resp = self.filter(**kwargs)
ret = next(resp, None)
if not ret:
return ret
try:
next(resp)
raise ValueError(
"get() returned more than one result. "
"Check that the kwarg(s) passed are valid for this "
"endpoint or use filter() or all() instead."
)
except StopIteration:
return ret
req = Request(
key=key,
base=self.url,
token=self.token,
http_session=self.api.http_session,
)
try:
return next(RecordSet(self, req), None)
except RequestError as e:
if e.req.status_code == 404:
return None
else:
raise e
def filter(self, *args, **kwargs):
r"""Queries the 'ListView' of a given endpoint.
Takes named arguments that match the usable filters on a
given endpoint. If an argument is passed then it's used as a
freeform search argument if the endpoint supports it.
:arg str,optional \*args: Freeform search string that's
accepted on given endpoint.
:arg str,optional \**kwargs: Any search argument the
endpoint accepts can be added as a keyword arg.
:arg int,optional limit: Overrides the max page size on
paginated returns. This defines the number of records that will
be returned with each query to the Netbox server. The queries
will be made as you iterate through the result set.
:arg int,optional offset: Overrides the offset on paginated returns.
:Returns: A :py:class:`.RecordSet` object.
:Examples:
To return a list of objects matching a named argument filter.
>>> devices = nb.dcim.devices.filter(role='leaf-switch')
>>> for device in devices:
... print(device.name)
...
test1-leaf1
test1-leaf2
test1-leaf3
>>>
>>> devices = nb.dcim.devices.filter(site='site-1')
>>> for device in devices:
... print(device.name)
...
test1-a2-leaf1
test2-a2-leaf2
>>>
If we want to filter by site, location, tenant, or fields which have a display name and a slug, the slug has to be used for filtering.
.. note::
If a keyword argument is incorrect a `TypeError` will not be returned by pynetbox.
Instead, all records filtered up to the last correct keyword argument. For example, if we used `site="Site 1"` instead of `site=site-1` when using filter on
the devices endpoint, then pynetbox will return **all** devices across all sites instead of devices at Site 1.
Using a freeform query along with a named argument.
>>> devices = nb.dcim.devices.filter('a3', role='leaf-switch')
>>> for device in devices:
... print(device.name)
...
test1-a3-leaf1
test1-a3-leaf2
>>>
Chaining multiple named arguments.
>>> devices = nb.dcim.devices.filter(role='leaf-switch', status=True)
>>> for device in devices:
... print(device.name)
...
test1-leaf2
>>>
Passing a list as a named argument adds multiple filters of the
same value.
>>> devices = nb.dcim.devices.filter(role=['leaf-switch', 'spine-switch'])
>>> for device in devices:
... print(device.name)
...
test1-a3-spine1
test1-a3-spine2
test1-a3-leaf1
>>>
To have the ability to iterate over the results multiple times then
encapsulate them in a list. This will cause the entire result set
to be fetched from the server.
>>> devices = list(nb.dcim.devices.filter(role='leaf-switch'))
"""
if args:
kwargs.update({"q": args[0]})
if any(i in RESERVED_KWARGS for i in kwargs):
raise ValueError(
"A reserved kwarg was passed ({}). Please remove it "
"and try again.".format(RESERVED_KWARGS)
)
limit = kwargs.pop("limit") if "limit" in kwargs else 0
offset = kwargs.pop("offset") if "offset" in kwargs else None
if limit == 0 and offset is not None:
raise ValueError("offset requires a positive limit value")
filters = {x: y if y is not None else "null" for x, y in kwargs.items()}
req = Request(
filters=filters,
base=self.url,
token=self.token,
http_session=self.api.http_session,
threading=self.api.threading,
limit=limit,
offset=offset,
)
return RecordSet(self, req)
def create(self, *args, **kwargs):
r"""Creates an object on an endpoint.
Allows for the creation of new objects on an endpoint. Named
arguments are converted to json properties, and a single object
is created. NetBox's bulk creation capabilities can be used by
passing a list of dictionaries as the first argument.
.. note:
Any positional arguments will supercede named ones.
:arg list \*args: A list of dictionaries containing the
properties of the objects to be created.
:arg str \**kwargs: key/value strings representing
properties on a json object.
:returns: A list or single :py:class:`.Record` object depending
on whether a bulk creation was requested.
:Examples:
Creating an object on the `devices` endpoint:
>>> device = netbox.dcim.devices.create(
... name='test',
... role=1,
... )
>>>
Creating an object on the 'devices' endpoint using `.get()` to get ids.
>>> device = netbox.dcim.devices.create(
... name = 'test1',
... site = netbox.dcim.devices.get(name='site1').id,
... location = netbox.dcim.locations.get(name='Row 1').id,
... rack = netbox.dcim.racks.get(facility_id=1).id,
... device_type = netbox.dcim.device_types.get(slug='server-type-1').id,
... status='active',
... )
>>>
Use bulk creation by passing a list of dictionaries:
>>> nb.dcim.devices.create([
... {
... "name": "test1-core3",
... "role": 3,
... "site": 1,
... "device_type": 1,
... "status": 1
... },
... {
... "name": "test1-core4",
... "role": 3,
... "site": 1,
... "device_type": 1,
... "status": 1
... }
... ])
Create a new device type.
>>> device_type = netbox.dcim.devices.create(
... manufacturer = netbox.dcim.manufacturers.get(name='manufacturer-name').id,
... model = 'device-type-name',
... slug = 'device-type-slug',
... subdevice_role = 'child or parent', #optional field - requred if creating a device type to be used by child devices
... u_height = unit_height, #can only equal 0 if the device type is for a child device - requires subdevice_role='child' if that is the case
... custom_fields = {'cf_1' : 'custom data 1'}
... )
Create a device bay and child device.
>>> device_bay = netbox.dcim.device_bays.create(
... device = netbox.dcim.devices.get(name='parent device').id, # device the device bay is located
... name = 'Bay 1'
... )
>>> child_device = netbox.dcim.devices.create(
... name = 'child device',
... site = netbox.dcim.devices.get(name='test-site').id,
... location = netbox.dcim.locations.get(name='row-1').id,
... tenant = netbox.tenancy.tenants.get(name='tenant-1').id,
... manufactuer = netbox.dcim.manufacturers.get(name='test-m').id,
... rack = netbox.dcim.racks.get(name='Test Rack').id,
... device_type = netbox.dcim.device.types.get(slug='test-server').id, #easier to get device_type id by search by its slug rather than by its name
... )
>>> get_device_bay = netbox.dcim.device_bays.get(name='Bay 1')
>>> get_child_device = netbox.dcim.devices.get(name='child device')
>>> get_device_bay.installed_device = get_child_device
>>> get_device_bay.save()
Create a network interface
>>> interface = netbox.dcim.interfaces.get(name="interface-test", device="test-device")
>>> netbox_ip = netbox.ipam.ip_addresses.create(
... address = "ip-address",
... tenant = netbox.tenancy.tenants.get(name='tenant-1').id,
... tags = [{'name':'Tag 1'}],
... )
>>> #assign IP Address to device's network interface
>>> netbox_ip.assigned_object = interface
>>> netbox_ip.assigned_object_id = interface.id
>>> netbox_ip.assigned_object_type = 'dcim.interface'
>>> # add dns name to IP Address (optional)
>>> netbox_ip.dns_name = "test.dns.local"
>>> # save changes to IP Address
>>> netbox_ip.save()
"""
req = Request(
base=self.url,
token=self.token,
http_session=self.api.http_session,
).post(args[0] if args else kwargs)
if isinstance(req, list):
return [self.return_obj(i, self.api, self) for i in req]
return self.return_obj(req, self.api, self)
def update(self, objects):
r"""Bulk updates existing objects on an endpoint.
Allows for bulk updating of existing objects on an endpoint.
Objects is a list whic contain either json/dicts or Record
derived objects, which contain the updates to apply.
If json/dicts are used, then the id of the object *must* be
included
:arg list objects: A list of dicts or Record.
:returns: True if the update succeeded
:Examples:
Updating objects on the `devices` endpoint:
>>> devices = nb.dcim.devices.update([
... {'id': 1, 'name': 'test'},
... {'id': 2, 'name': 'test2'},
... ])
>>> devices
[test2, test]
>>>
Use bulk update by passing a list of Records:
>>> devices = list(nb.dcim.devices.filter())
>>> devices
[Device1, Device2, Device3]
>>> for d in devices:
... d.name = d.name+'-test'
...
>>> nb.dcim.devices.update(devices)
[Device1-test, Device2-test, Device3-test]
>>>
"""
series = []
if not isinstance(objects, list):
raise ValueError(
"Objects passed must be list[dict|Record] - was {}".format(
type(objects)
)
)
for o in objects:
if isinstance(o, Record):
data = o.updates()
if data:
data["id"] = o.id
series.append(data)
elif isinstance(o, dict):
if "id" not in o:
raise ValueError("id is missing from object: " + str(o))
series.append(o)
else:
raise ValueError(
"Object passed must be dict|Record - was {}".format(type(objects))
)
req = Request(
base=self.url,
token=self.token,
http_session=self.api.http_session,
).patch(series)
if isinstance(req, list):
return [self.return_obj(i, self.api, self) for i in req]
return self.return_obj(req, self.api, self)
def delete(self, objects):
r"""Bulk deletes objects on an endpoint.
Allows for batch deletion of multiple objects from
a single endpoint
:arg list objects: A list of either ids or Records or
a single RecordSet to delete.
:returns: True if bulk DELETE operation was successful.
:Examples:
Deleting all `devices`:
>>> netbox.dcim.devices.delete(netbox.dcim.devices.all(0))
>>>
Use bulk deletion by passing a list of ids:
>>> netbox.dcim.devices.delete([2, 243, 431, 700])
>>>
Use bulk deletion to delete objects eg. when filtering
on a `custom_field`:
>>> netbox.dcim.devices.delete([
>>> d for d in netbox.dcim.devices.all(0) \
>>> if d.custom_fields.get('field', False)
>>> ])
>>>
"""
cleaned_ids = []
if not isinstance(objects, list) and not isinstance(objects, RecordSet):
raise ValueError(
"objects must be list[str|int|Record]"
"|RecordSet - was " + str(type(objects))
)
for o in objects:
if isinstance(o, int):
cleaned_ids.append(o)
elif isinstance(o, str) and o.isnumeric():
cleaned_ids.append(int(o))
elif isinstance(o, Record):
if not hasattr(o, "id"):
raise ValueError(
"Record from '"
+ o.url
+ "' does not have an id and cannot be bulk deleted"
)
cleaned_ids.append(o.id)
else:
raise ValueError(
"Invalid object in list of objects to delete: " + str(type(o))
)
req = Request(
base=self.url,
token=self.token,
http_session=self.api.http_session,
)
return True if req.delete(data=[{"id": i} for i in cleaned_ids]) else False
def choices(self):
"""Returns all choices from the endpoint.
The returned dict is also saved in the endpoint object (in
``_choices`` attribute) so that later calls will return the same data
without recurring requests to NetBox. When using ``.choices()`` in
long-running applications, consider restarting them whenever NetBox is
upgraded, to prevent using stale choices data.
:Returns: Dict containing the available choices.
:Example:
>>> from pprint import pprint
>>> pprint(nb.ipam.ip_addresses.choices())
{'role': [{'display_name': 'Loopback', 'value': 'loopback'},
{'display_name': 'Secondary', 'value': 'secondary'},
{'display_name': 'Anycast', 'value': 'anycast'},
{'display_name': 'VIP', 'value': 'vip'},
{'display_name': 'VRRP', 'value': 'vrrp'},
{'display_name': 'HSRP', 'value': 'hsrp'},
{'display_name': 'GLBP', 'value': 'glbp'},
{'display_name': 'CARP', 'value': 'carp'}],
'status': [{'display_name': 'Active', 'value': 'active'},
{'display_name': 'Reserved', 'value': 'reserved'},
{'display_name': 'Deprecated', 'value': 'deprecated'},
{'display_name': 'DHCP', 'value': 'dhcp'},
{'display_name': 'SLAAC', 'value': 'slaac'}]}
>>>
"""
if self._choices:
return self._choices
req = Request(
base=self.url,
token=self.api.token,
http_session=self.api.http_session,
).options()
try:
post_data = req["actions"]["POST"]
except KeyError:
raise ValueError(
"Unexpected format in the OPTIONS response at {}".format(self.url)
)
self._choices = {}
for prop in post_data:
if "choices" in post_data[prop]:
self._choices[prop] = post_data[prop]["choices"]
return self._choices
def count(self, *args, **kwargs):
r"""Returns the count of objects in a query.
Takes named arguments that match the usable filters on a
given endpoint. If an argument is passed then it's used as a
freeform search argument if the endpoint supports it. If no
arguments are passed the count for all objects on an endpoint
are returned.
:arg str,optional \*args: Freeform search string that's
accepted on given endpoint.
:arg str,optional \**kwargs: Any search argument the
endpoint accepts can be added as a keyword arg.
:Returns: Integer with count of objects returns by query.
:Examples:
To return a count of objects matching a named argument filter.
>>> nb.dcim.devices.count(site='tst1')
5827
>>>
To return a count of objects on an entire endpoint.
>>> nb.dcim.devices.count()
87382
>>>
"""
if args:
kwargs.update({"q": args[0]})
if any(i in RESERVED_KWARGS for i in kwargs):
raise ValueError(
"A reserved {} kwarg was passed. Please remove it "
"try again.".format(RESERVED_KWARGS)
)
ret = Request(
filters=kwargs,
base=self.url,
token=self.token,
http_session=self.api.http_session,
)
return ret.get_count()
class DetailEndpoint:
"""Enables read/write operations on detail endpoints.
Endpoints like ``available-ips`` that are detail routes off
traditional endpoints are handled with this class.
"""
def __init__(self, parent_obj, name, custom_return=None):
self.parent_obj = parent_obj
self.custom_return = custom_return
self.url = "{}/{}/{}/".format(parent_obj.endpoint.url, parent_obj.id, name)
self.request_kwargs = dict(
base=self.url,
token=parent_obj.api.token,
http_session=parent_obj.api.http_session,
)
def list(self, **kwargs):
r"""The view operation for a detail endpoint
Returns the response from NetBox for a detail endpoint.
:args \**kwargs: key/value pairs that get converted into url
parameters when passed to the endpoint.
E.g. ``.list(method='get_facts')`` would be converted to
``.../?method=get_facts``.
:returns: A :py:class:`.Record` object or list of :py:class:`.Record` objects created
from data retrieved from NetBox.
"""
req = Request(**self.request_kwargs).get(add_params=kwargs)
if self.custom_return:
return [
self.custom_return(
i, self.parent_obj.endpoint.api, self.parent_obj.endpoint
)
for i in req
]
return req
def create(self, data=None):
"""The write operation for a detail endpoint.
Creates objects on a detail endpoint in NetBox.
:arg dict/list,optional data: A dictionary containing the
key/value pair of the items you're creating on the parent
object. Defaults to empty dict which will create a single
item with default values.
:returns: A :py:class:`.Record` object or list of :py:class:`.Record` objects created
from data created in NetBox.
"""
data = data or {}
req = Request(**self.request_kwargs).post(data)
if self.custom_return:
if isinstance(req, list):
return [
self.custom_return(
req_item, self.parent_obj.endpoint.api, self.parent_obj.endpoint
)
for req_item in req
]
else:
return self.custom_return(
req, self.parent_obj.endpoint.api, self.parent_obj.endpoint
)
return req
class RODetailEndpoint(DetailEndpoint):
def create(self, data):
raise NotImplementedError("Writes are not supported for this endpoint.")
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/pynetbox/core/query.py 0000644 0001751 0000177 00000033604 14706740105 017331 0 ustar 00runner docker """
(c) 2017 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import concurrent.futures as cf
import json
from packaging import version
def calc_pages(limit, count):
"""Calculate number of pages required for full results set."""
return int(count / limit) + (limit % count > 0)
class RequestError(Exception):
"""Basic Request Exception
More detailed exception that returns the original requests object
for inspection. Along with some attributes with specific details
from the requests object. If return is json we decode and add it
to the message.
:Example:
>>> try:
... nb.dcim.devices.create(name="destined-for-failure")
... except pynetbox.RequestError as e:
... print(e.error)
"""
def __init__(self, req):
if req.status_code == 404:
self.message = "The requested url: {} could not be found.".format(req.url)
else:
try:
self.message = "The request failed with code {} {}: {}".format(
req.status_code, req.reason, req.json()
)
except ValueError:
self.message = (
"The request failed with code {} {} but more specific "
"details were not returned in json. Check the NetBox Logs "
"or investigate this exception's error attribute.".format(
req.status_code, req.reason
)
)
super().__init__(self.message)
self.req = req
self.request_body = req.request.body
self.base = req.url
self.error = req.text
def __str__(self):
return self.message
class AllocationError(Exception):
"""Allocation Exception
Used with available-ips/available-prefixes when there is no
room for allocation and NetBox returns 409 Conflict.
"""
def __init__(self, req):
super().__init__(req)
self.req = req
self.request_body = req.request.body
self.base = req.url
self.error = "The requested allocation could not be fulfilled."
def __str__(self):
return self.error
class ContentError(Exception):
"""Content Exception
If the API URL does not point to a valid NetBox API, the server may
return a valid response code, but the content is not json. This
exception is raised in those cases.
"""
def __init__(self, req):
super().__init__(req)
self.req = req
self.request_body = req.request.body
self.base = req.url
self.error = (
"The server returned invalid (non-json) data. Maybe not a NetBox server?"
)
def __str__(self):
return self.error
class Request:
"""Creates requests to the Netbox API
Responsible for building the url and making the HTTP(S) requests to
Netbox's API
:param base: (str) Base URL passed in api() instantiation.
:param filters: (dict, optional) contains key/value pairs that
correlate to the filters a given endpoint accepts.
In (e.g. /api/dcim/devices/?name='test') 'name': 'test'
would be in the filters dict.
"""
def __init__(
self,
base,
http_session,
filters=None,
limit=None,
offset=None,
key=None,
token=None,
threading=False,
):
"""
Instantiates a new Request object
Args:
base (string): Base URL passed in api() instantiation.
filters (dict, optional): contains key/value pairs that
correlate to the filters a given endpoint accepts.
In (e.g. /api/dcim/devices/?name='test') 'name': 'test'
would be in the filters dict.
key (int, optional): database id of the item being queried.
"""
self.base = self.normalize_url(base)
self.filters = filters or None
self.key = key
self.token = token
self.http_session = http_session
self.url = self.base if not key else "{}{}/".format(self.base, key)
self.threading = threading
self.limit = limit
self.offset = offset
def get_openapi(self):
"""Gets the OpenAPI Spec"""
headers = {
"Accept": "application/json",
"Content-Type": "application/json",
}
current_version = version.parse(self.get_version())
if current_version >= version.parse("3.5"):
req = self.http_session.get(
"{}schema/".format(self.normalize_url(self.base)),
headers=headers,
)
else:
req = self.http_session.get(
"{}docs/?format=openapi".format(self.normalize_url(self.base)),
headers=headers,
)
if req.ok:
return req.json()
else:
raise RequestError(req)
def get_version(self):
"""Gets the API version of NetBox.
Issues a GET request to the base URL to read the API version from the
response headers.
:Raises: RequestError if req.ok returns false.
:Returns: Version number as a string. Empty string if version is not
present in the headers.
"""
headers = {
"Content-Type": "application/json",
}
req = self.http_session.get(
self.normalize_url(self.base),
headers=headers,
)
if req.ok or req.status_code == 403:
return req.headers.get("API-Version", "")
else:
raise RequestError(req)
def get_status(self):
"""Gets the status from /api/status/ endpoint in NetBox.
:Returns: Dictionary as returned by NetBox.
:Raises: RequestError if request is not successful.
"""
headers = {"Content-Type": "application/json"}
if self.token:
headers["authorization"] = "Token {}".format(self.token)
req = self.http_session.get(
"{}status/".format(self.normalize_url(self.base)),
headers=headers,
)
if req.ok:
return req.json()
else:
raise RequestError(req)
def normalize_url(self, url):
"""Builds a url for POST actions."""
if url[-1] != "/":
return "{}/".format(url)
return url
def _make_call(self, verb="get", url_override=None, add_params=None, data=None):
if verb in ("post", "put") or verb == "delete" and data:
headers = {"Content-Type": "application/json"}
else:
headers = {"accept": "application/json"}
if self.token:
headers["authorization"] = "Token {}".format(self.token)
params = {}
if not url_override:
if self.filters:
params.update(self.filters)
if add_params:
params.update(add_params)
req = getattr(self.http_session, verb)(
url_override or self.url, headers=headers, params=params, json=data
)
if req.status_code == 409 and verb == "post":
raise AllocationError(req)
if verb == "delete":
if req.ok:
return True
else:
raise RequestError(req)
elif req.ok:
try:
return req.json()
except json.JSONDecodeError:
raise ContentError(req)
else:
raise RequestError(req)
def concurrent_get(self, ret, page_size, page_offsets):
futures_to_results = []
with cf.ThreadPoolExecutor(max_workers=4) as pool:
for offset in page_offsets:
new_params = {"offset": offset, "limit": page_size}
futures_to_results.append(
pool.submit(self._make_call, add_params=new_params)
)
for future in cf.as_completed(futures_to_results):
result = future.result()
ret.extend(result["results"])
def get(self, add_params=None):
"""Makes a GET request.
Makes a GET request to NetBox's API, and automatically recurses
any paginated results.
:raises: RequestError if req.ok returns false.
:raises: ContentError if response is not json.
:Returns: List of `Response` objects returned from the
endpoint.
"""
if not add_params and self.limit is not None:
add_params = {"limit": self.limit}
if self.limit and self.offset is not None:
# if non-zero limit and some offset -> add offset
add_params["offset"] = self.offset
req = self._make_call(add_params=add_params)
if isinstance(req, dict) and req.get("results") is not None:
self.count = req["count"]
if self.offset is not None:
# only yield requested page results if paginating
for i in req["results"]:
yield i
elif self.threading:
ret = req["results"]
if req.get("next"):
page_size = len(req["results"])
pages = calc_pages(page_size, req["count"])
page_offsets = [
increment * page_size for increment in range(1, pages)
]
if pages == 1:
req = self._make_call(url_override=req.get("next"))
ret.extend(req["results"])
else:
self.concurrent_get(ret, page_size, page_offsets)
for i in ret:
yield i
else:
first_run = True
for i in req["results"]:
yield i
while req["next"]:
# Not worrying about making sure add_params kwargs is
# passed in here because results from detail routes aren't
# paginated, thus far.
if first_run:
req = self._make_call(
add_params={
"limit": self.limit or req["count"],
"offset": len(req["results"]),
}
)
else:
req = self._make_call(url_override=req["next"])
first_run = False
for i in req["results"]:
yield i
elif isinstance(req, list):
self.count = len(req)
for i in req:
yield i
else:
self.count = len(req)
yield req
def put(self, data):
"""Makes PUT request.
Makes a PUT request to NetBox's API.
:param data: (dict) Contains a dict that will be turned into a
json object and sent to the API.
:raises: RequestError if req.ok returns false.
:raises: ContentError if response is not json.
:returns: Dict containing the response from NetBox's API.
"""
return self._make_call(verb="put", data=data)
def post(self, data):
"""Makes POST request.
Makes a POST request to NetBox's API.
:param data: (dict) Contains a dict that will be turned into a
json object and sent to the API.
:raises: RequestError if req.ok returns false.
:raises: AllocationError if req.status_code is 409 (Conflict)
as with available-ips and available-prefixes when there is
no room for the requested allocation.
:raises: ContentError if response is not json.
:Returns: Dict containing the response from NetBox's API.
"""
return self._make_call(verb="post", data=data)
def delete(self, data=None):
"""Makes DELETE request.
Makes a DELETE request to NetBox's API.
:param data: (list) Contains a dict that will be turned into a
json object and sent to the API.
Returns:
True if successful.
Raises:
RequestError if req.ok doesn't return True.
"""
return self._make_call(verb="delete", data=data)
def patch(self, data):
"""Makes PATCH request.
Makes a PATCH request to NetBox's API.
:param data: (dict) Contains a dict that will be turned into a
json object and sent to the API.
:raises: RequestError if req.ok returns false.
:raises: ContentError if response is not json.
:returns: Dict containing the response from NetBox's API.
"""
return self._make_call(verb="patch", data=data)
def options(self):
"""Makes an OPTIONS request.
Makes an OPTIONS request to NetBox's API.
:raises: RequestError if req.ok returns false.
:raises: ContentError if response is not json.
:returns: Dict containing the response from NetBox's API.
"""
return self._make_call(verb="options")
def get_count(self, *args, **kwargs):
"""Returns object count for query
Makes a query to the endpoint with ``limit=1`` set and only
returns the value of the "count" field.
:raises: RequestError if req.ok returns false.
:raises: ContentError if response is not json.
:returns: Int of number of objects query returned.
"""
if not hasattr(self, "count"):
self.count = self._make_call(add_params={"limit": 1, "brief": 1})["count"]
return self.count
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/pynetbox/core/response.py 0000644 0001751 0000177 00000045267 14706740105 020032 0 ustar 00runner docker """
(c) 2017 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
import copy
from collections import OrderedDict
from urllib.parse import urlsplit
import pynetbox.core.app
from pynetbox.core.query import Request
from pynetbox.core.util import Hashabledict
# List of fields that are lists but should be treated as sets.
LIST_AS_SET = ("tags", "tagged_vlans")
def get_return(lookup, return_fields=None):
"""Returns simple representations for items passed to lookup.
Used to return a "simple" representation of objects and collections
sent to it via lookup. Otherwise, we look to see if
lookup is a "choices" field (dict with only 'id' and 'value')
or a nested_return. Finally, we check if it's a Record, if
so simply return a string. Order is important due to nested_return
being self-referential.
:arg list,optional return_fields: A list of fields to reference when
calling values on lookup.
"""
for i in return_fields or ["id", "value", "nested_return"]:
if isinstance(lookup, dict) and lookup.get(i):
return lookup[i]
else:
if hasattr(lookup, i):
# check if this is a "choices" field record
# from a NetBox 2.7 server.
if sorted(dict(lookup)) == sorted(["id", "value", "label"]):
return getattr(lookup, "value")
return getattr(lookup, i)
if isinstance(lookup, Record):
return str(lookup)
else:
return lookup
def flatten_custom(custom_dict):
ret = {}
for k, val in custom_dict.items():
current_val = val
if isinstance(val, dict):
current_val = val.get("id", val)
if isinstance(val, list):
current_val = [v.get("id", v) if isinstance(v, dict) else v for v in val]
ret[k] = current_val
return ret
class JsonField:
"""Explicit field type for values that are not to be converted
to a Record object"""
_json_field = True
class RecordSet:
"""Iterator containing Record objects.
Returned by :py:meth:`.Endpoint.all()` and :py:meth:`.Endpoint.filter()` methods.
Allows iteration of and actions to be taken on the results from the aforementioned
methods. Contains :py:class:`.Record` objects.
:Examples:
To see how many results are in a query by calling ``len()``:
>>> x = nb.dcim.devices.all()
>>> len(x)
123
>>>
Simple iteration of the results:
>>> devices = nb.dcim.devices.all()
>>> for device in devices:
... print(device.name)
...
test1-leaf1
test1-leaf2
test1-leaf3
>>>
"""
def __init__(self, endpoint, request, **kwargs):
self.endpoint = endpoint
self.request = request
self.response = self.request.get()
self._response_cache = []
def __iter__(self):
return self
def __next__(self):
if self._response_cache:
return self.endpoint.return_obj(
self._response_cache.pop(), self.endpoint.api, self.endpoint
)
return self.endpoint.return_obj(
next(self.response), self.endpoint.api, self.endpoint
)
def __len__(self):
try:
return self.request.count
except AttributeError:
try:
self._response_cache.append(next(self.response))
except StopIteration:
return 0
return self.request.count
def update(self, **kwargs):
"""Updates kwargs onto all Records in the RecordSet and saves these.
Updates are only sent to the API if a value were changed, and only for
the Records which were changed
:returns: True if the update succeeded, None if no update were required
:example:
>>> result = nb.dcim.devices.filter(site_id=1).update(status='active')
True
>>>
"""
updates = []
for record in self:
# Update each record and determine if anything was updated
for k, v in kwargs.items():
setattr(record, k, v)
record_updates = record.updates()
if record_updates:
# if updated, add the id to the dict and append to list of updates
record_updates["id"] = record.id
updates.append(record_updates)
if updates:
return self.endpoint.update(updates)
else:
return None
def delete(self):
r"""Bulk deletes objects in a RecordSet.
Allows for batch deletion of multiple objects in a RecordSet
:returns: True if bulk DELETE operation was successful.
:Examples:
Deleting offline `devices` on site 1:
>>> netbox.dcim.devices.filter(site_id=1, status="offline").delete()
>>>
"""
return self.endpoint.delete(self)
class Record:
"""Create Python objects from NetBox API responses.
Creates an object from a NetBox response passed as ``values``.
Nested dicts that represent other endpoints are also turned
into ``Record`` objects. All fields are then assigned to the
object's attributes. If a missing attr is requested
(e.g. requesting a field that's only present on a full response on
a ``Record`` made from a nested response) then pynetbox will make a
request for the full object and return the requested value.
:examples:
Default representation of the object is usually its name:
>>> x = nb.dcim.devices.get(1)
>>> x
test1-switch1
>>>
Querying a string field:
>>> x = nb.dcim.devices.get(1)
>>> x.serial
'ABC123'
>>>
Querying a field on a nested object:
>>> x = nb.dcim.devices.get(1)
>>> x.device_type.model
'QFX5100-24Q'
>>>
Casting the object as a dictionary:
>>> from pprint import pprint
>>> pprint(dict(x))
{'asset_tag': None,
'cluster': None,
'comments': '',
'config_context': {},
'created': '2018-04-01',
'custom_fields': {},
'role': {'id': 1,
'name': 'Test Switch',
'slug': 'test-switch',
'url': 'http://localhost:8000/api/dcim/device-roles/1/'},
'device_type': {...},
'display_name': 'test1-switch1',
'face': {'label': 'Rear', 'value': 1},
'id': 1,
'name': 'test1-switch1',
'parent_device': None,
'platform': {...},
'position': 1,
'primary_ip': {'address': '192.0.2.1/24',
'family': 4,
'id': 1,
'url': 'http://localhost:8000/api/ipam/ip-addresses/1/'},
'primary_ip4': {...},
'primary_ip6': None,
'rack': {'display_name': 'Test Rack',
'id': 1,
'name': 'Test Rack',
'url': 'http://localhost:8000/api/dcim/racks/1/'},
'serial': 'ABC123',
'site': {'id': 1,
'name': 'TEST',
'slug': 'TEST',
'url': 'http://localhost:8000/api/dcim/sites/1/'},
'status': {'label': 'Active', 'value': 1},
'tags': [],
'tenant': None,
'vc_position': None,
'vc_priority': None,
'virtual_chassis': None}
>>>
Iterating over a ``Record`` object:
>>> for i in x:
... print(i)
...
('id', 1)
('name', 'test1-switch1')
('display_name', 'test1-switch1')
>>>
"""
url = None
def __init__(self, values, api, endpoint):
self.has_details = False
self._full_cache = []
self._init_cache = []
self.api = api
self.default_ret = Record
self.endpoint = (
self._endpoint_from_url(values["url"])
if values and "url" in values and values["url"]
else endpoint
)
if values:
self._parse_values(values)
def __getattr__(self, k):
"""Default behavior for missing attrs.
We'll call `full_details()` if we're asked for an attribute
we don't have.
In order to prevent non-explicit behavior,`k='keys'` is
excluded because casting to dict() calls this attr.
"""
if self.url:
if self.has_details is False and k != "keys":
if self.full_details():
ret = getattr(self, k, None)
if ret or hasattr(self, k):
return ret
raise AttributeError('object has no attribute "{}"'.format(k))
def __iter__(self):
for i in dict(self._init_cache):
cur_attr = getattr(self, i)
if isinstance(cur_attr, Record):
yield i, dict(cur_attr)
elif isinstance(cur_attr, list) and all(
isinstance(i, Record) for i in cur_attr
):
yield i, [dict(x) for x in cur_attr]
else:
yield i, cur_attr
def __getitem__(self, k):
return dict(self)[k]
def __str__(self):
return (
getattr(self, "name", None)
or getattr(self, "label", None)
or getattr(self, "display", None)
or ""
)
def __repr__(self):
return str(self)
def __getstate__(self):
return self.__dict__
def __setstate__(self, d):
self.__dict__.update(d)
def __key__(self):
if hasattr(self, "id"):
return (self.endpoint.name, self.id)
else:
return self.endpoint.name
def __hash__(self):
return hash(self.__key__())
def __eq__(self, other):
if isinstance(other, Record):
return self.__key__() == other.__key__()
return NotImplemented
def _add_cache(self, item):
key, value = item
self._init_cache.append((key, get_return(value)))
def _parse_values(self, values):
"""Parses values init arg.
Parses values dict at init and sets object attributes with the
values within.
"""
def generic_list_parser(key_name, list_item):
from pynetbox.models.mapper import CONTENT_TYPE_MAPPER
if (
isinstance(list_item, dict)
and "object_type" in list_item
and "object" in list_item
):
lookup = list_item["object_type"]
model = None
model = CONTENT_TYPE_MAPPER.get(lookup)
if model:
return model(list_item["object"], self.api, self.endpoint)
return list_item
def list_parser(key_name, list_item):
if isinstance(list_item, dict):
lookup = getattr(self.__class__, key_name, None)
if not isinstance(lookup, list):
# This is *list_parser*, so if the custom model field is not
# a list (or is not defined), just return the default model
return self.default_ret(list_item, self.api, self.endpoint)
else:
model = lookup[0]
return model(list_item, self.api, self.endpoint)
return list_item
for k, v in values.items():
if isinstance(v, dict):
lookup = getattr(self.__class__, k, None)
if k in ["custom_fields", "local_context_data"] or hasattr(
lookup, "_json_field"
):
self._add_cache((k, copy.deepcopy(v)))
setattr(self, k, v)
continue
if lookup:
v = lookup(v, self.api, self.endpoint)
else:
v = self.default_ret(v, self.api, self.endpoint)
self._add_cache((k, v))
elif isinstance(v, list):
# check if GFK
if len(v) and isinstance(v[0], dict) and "object_type" in v[0]:
v = [generic_list_parser(k, i) for i in v]
to_cache = list(v)
elif k == "constraints":
# Permissions constraints can be either dict or list
to_cache = copy.deepcopy(v)
else:
v = [list_parser(k, i) for i in v]
to_cache = list(v)
self._add_cache((k, to_cache))
else:
self._add_cache((k, v))
setattr(self, k, v)
def _endpoint_from_url(self, url):
url_path = urlsplit(url).path
base_url_path_parts = urlsplit(self.api.base_url).path.split("/")
if len(base_url_path_parts) > 2:
# There are some extra directories in the path, remove them from url
extra_path = "/".join(base_url_path_parts[:-1])
url_path = url_path[len(extra_path) :]
split_url_path = url_path.split("/")
if split_url_path[2] == "plugins":
app = "plugins/{}".format(split_url_path[3])
name = split_url_path[4]
else:
app, name = split_url_path[2:4]
return getattr(pynetbox.core.app.App(self.api, app), name)
def full_details(self):
"""Queries the hyperlinked endpoint if 'url' is defined.
This method will populate the attributes from the detail
endpoint when it's called. Sets the class-level `has_details`
attribute when it's called to prevent being called more
than once.
:returns: True
"""
if self.url:
req = Request(
base=self.url,
token=self.api.token,
http_session=self.api.http_session,
)
self._parse_values(next(req.get()))
self.has_details = True
return True
return False
def serialize(self, nested=False, init=False):
"""Serializes an object
Pulls all the attributes in an object and creates a dict that
can be turned into the json that netbox is expecting.
If an attribute's value is a ``Record`` type it's replaced with
the ``id`` field of that object.
.. note::
Using this to get a dictionary representation of the record
is discouraged. It's probably better to cast to dict()
instead. See Record docstring for example.
:returns: dict.
"""
if nested:
return get_return(self)
if init:
init_vals = dict(self._init_cache)
ret = {}
for i in dict(self):
current_val = getattr(self, i) if not init else init_vals.get(i)
if i == "custom_fields":
ret[i] = flatten_custom(current_val)
else:
if isinstance(current_val, Record):
current_val = getattr(current_val, "serialize")(nested=True)
if isinstance(current_val, list):
current_val = [
v.id if isinstance(v, Record) else v for v in current_val
]
if i in LIST_AS_SET and (
all([isinstance(v, str) for v in current_val])
or all([isinstance(v, int) for v in current_val])
):
current_val = list(OrderedDict.fromkeys(current_val))
ret[i] = current_val
return ret
def _diff(self):
def fmt_dict(k, v):
if isinstance(v, dict):
return k, Hashabledict(v)
if isinstance(v, list):
return k, ",".join(map(str, v))
return k, v
current = Hashabledict({fmt_dict(k, v) for k, v in self.serialize().items()})
init = Hashabledict(
{fmt_dict(k, v) for k, v in self.serialize(init=True).items()}
)
return set([i[0] for i in set(current.items()) ^ set(init.items())])
def updates(self):
"""Compiles changes for an existing object into a dict.
Takes a diff between the objects current state and its state at init
and returns them as a dictionary, which will be empty if no changes.
:returns: dict.
:example:
>>> x = nb.dcim.devices.get(name='test1-a3-tor1b')
>>> x.serial
''
>>> x.serial = '1234'
>>> x.updates()
{'serial': '1234'}
>>>
"""
if self.id:
diff = self._diff()
if diff:
serialized = self.serialize()
return {i: serialized[i] for i in diff}
return {}
def save(self):
"""Saves changes to an existing object.
Takes a diff between the objects current state and its state at init
and sends them as a dictionary to Request.patch().
:returns: True if PATCH request was successful.
:example:
>>> x = nb.dcim.devices.get(name='test1-a3-tor1b')
>>> x.serial
''
>>> x.serial = '1234'
>>> x.save()
True
>>>
"""
updates = self.updates()
if updates:
req = Request(
key=self.id,
base=self.endpoint.url,
token=self.api.token,
http_session=self.api.http_session,
)
if req.patch(updates):
return True
return False
def update(self, data):
"""Update an object with a dictionary.
Accepts a dict and uses it to update the record and call save().
For nested and choice fields you'd pass an int the same as
if you were modifying the attribute and calling save().
:arg dict data: Dictionary containing the k/v to update the
record object with.
:returns: True if PATCH request was successful.
:example:
>>> x = nb.dcim.devices.get(1)
>>> x.update({
... "name": "test-switch2",
... "serial": "ABC321",
... })
True
"""
for k, v in data.items():
setattr(self, k, v)
return self.save()
def delete(self):
"""Deletes an existing object.
:returns: True if DELETE operation was successful.
:example:
>>> x = nb.dcim.devices.get(name='test1-a3-tor1b')
>>> x.delete()
True
>>>
"""
req = Request(
key=self.id,
base=self.endpoint.url,
token=self.api.token,
http_session=self.api.http_session,
)
return True if req.delete() else False
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/pynetbox/core/util.py 0000644 0001751 0000177 00000000127 14706740105 017133 0 ustar 00runner docker class Hashabledict(dict):
def __hash__(self):
return hash(frozenset(self))
././@PaxHeader 0000000 0000000 0000000 00000000033 00000000000 010211 x ustar 00 27 mtime=1729871946.373744
pynetbox-7.4.1/pynetbox/models/ 0000755 0001751 0000177 00000000000 14706740112 016135 5 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/pynetbox/models/__init__.py 0000644 0001751 0000177 00000000000 14706740105 020236 0 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/pynetbox/models/circuits.py 0000644 0001751 0000177 00000001371 14706740105 020340 0 ustar 00runner docker """
(c) 2017 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from pynetbox.core.response import Record
class Circuits(Record):
def __str__(self):
return self.cid
class CircuitTerminations(Record):
def __str__(self):
return self.circuit.cid
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/pynetbox/models/dcim.py 0000644 0001751 0000177 00000015337 14706740105 017436 0 ustar 00runner docker """
(c) 2017 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from urllib.parse import urlsplit
from pynetbox.core.endpoint import DetailEndpoint, RODetailEndpoint
from pynetbox.core.query import Request
from pynetbox.core.response import JsonField, Record
from pynetbox.models.circuits import Circuits
from pynetbox.models.ipam import IpAddresses
class TraceableRecord(Record):
def _get_obj_class(self, url):
uri_to_obj_class_map = {
"dcim/cables": Cables,
"dcim/front-ports": FrontPorts,
"dcim/interfaces": Interfaces,
"dcim/rear-ports": RearPorts,
}
# the url for this item will be something like:
# https://netbox/api/dcim/rear-ports/12761/
# TODO: Move this to a more general function.
app_endpoint = "/".join(
urlsplit(url).path[len(urlsplit(self.api.base_url).path) :].split("/")[1:3]
)
return uri_to_obj_class_map.get(
app_endpoint,
Record,
)
def _build_termination_data(self, termination_list):
terminations_data = []
for hop_item_data in termination_list:
return_obj_class = self._get_obj_class(hop_item_data["url"])
terminations_data.append(
return_obj_class(hop_item_data, self.endpoint.api, self.endpoint)
)
return terminations_data
def trace(self):
req = Request(
key=str(self.id) + "/trace",
base=self.endpoint.url,
token=self.api.token,
http_session=self.api.http_session,
).get()
ret = []
for a_terminations_data, cable_data, b_terminations_data in req:
ret.append(self._build_termination_data(a_terminations_data))
if not cable_data:
ret.append(cable_data)
else:
return_obj_class = self._get_obj_class(cable_data["url"])
ret.append(
return_obj_class(cable_data, self.endpoint.api, self.endpoint)
)
ret.append(self._build_termination_data(b_terminations_data))
return ret
class DeviceTypes(Record):
def __str__(self):
return self.model
class Devices(Record):
"""Devices Object
Represents a device response from netbox.
Attributes:
primary_ip, ip4, ip6 (list): Tells __init__ in Record() to
take the `primary_ip` field's value from the API
response and return an initialized list of IpAddress
objects
device_type (obj): Tells __init__ in Record() to take the
`device_type` field's value from the API response and
return an initialized DeviceType object
"""
has_details = True
device_type = DeviceTypes
primary_ip = IpAddresses
primary_ip4 = IpAddresses
primary_ip6 = IpAddresses
local_context_data = JsonField
config_context = JsonField
@property
def napalm(self):
"""Represents the ``napalm`` detail endpoint.
Returns a DetailEndpoint object that is the interface for
viewing response from the napalm endpoint.
:returns: :py:class:`.DetailEndpoint`
:Examples:
>>> device = nb.ipam.devices.get(123)
>>> device.napalm.list(method='get_facts')
{"get_facts": {"interface_list": ["ge-0/0/0"]}}
"""
return RODetailEndpoint(self, "napalm")
@property
def render_config(self):
"""
Represents the ``render-config`` detail endpoint.
Returns a DetailEndpoint object that is the interface for
viewing response from the render-config endpoint.
:returns: :py:class:`.DetailEndpoint`
:Examples:
>>> device = nb.ipam.devices.get(123)
>>> device.render_config.create()
"""
return DetailEndpoint(self, "render-config")
class InterfaceConnections(Record):
def __str__(self):
return self.interface_a.name
class InterfaceConnection(Record):
def __str__(self):
return self.interface.name
class Interfaces(TraceableRecord):
interface_connection = InterfaceConnection
class PowerOutlets(TraceableRecord):
device = Devices
class PowerPorts(TraceableRecord):
device = Devices
class ConsolePorts(TraceableRecord):
device = Devices
class ConsoleServerPorts(TraceableRecord):
device = Devices
class RackReservations(Record):
def __str__(self):
return self.description
class VirtualChassis(Record):
master = Devices
class RUs(Record):
device = Devices
class FrontPorts(TraceableRecord):
device = Devices
class RearPorts(TraceableRecord):
device = Devices
class Racks(Record):
@property
def units(self):
"""Represents the ``units`` detail endpoint.
Returns a DetailEndpoint object that is the interface for
viewing response from the units endpoint.
:returns: :py:class:`.DetailEndpoint`
:Examples:
>>> rack = nb.dcim.racks.get(123)
>>> rack.units.list()
{"get_facts": {"interface_list": ["ge-0/0/0"]}}
"""
return RODetailEndpoint(self, "units", custom_return=RUs)
@property
def elevation(self):
"""Represents the ``elevation`` detail endpoint.
Returns a DetailEndpoint object that is the interface for
viewing response from the elevation endpoint updated in
Netbox version 2.8.
:returns: :py:class:`.DetailEndpoint`
:Examples:
>>> rack = nb.dcim.racks.get(123)
>>> rack.elevation.list()
{"get_facts": {"interface_list": ["ge-0/0/0"]}}
"""
return RODetailEndpoint(self, "elevation", custom_return=RUs)
class Termination(Record):
def __str__(self):
# hacky check to see if we're a circuit termination to
# avoid another call to NetBox because of a non-existent attr
# in self.name
if "circuit" in str(self.url):
return self.circuit.cid
return self.name
device = Devices
circuit = Circuits
class Cables(Record):
def __str__(self):
if len(self.a_terminations) == 1 and len(self.b_terminations) == 1:
return "{} <> {}".format(self.a_terminations[0], self.b_terminations[0])
return "Cable #{}".format(self.id)
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/pynetbox/models/extras.py 0000644 0001751 0000177 00000001505 14706740105 020020 0 ustar 00runner docker """
(c) 2017 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from pynetbox.core.response import JsonField, Record
class ConfigContexts(Record):
data = JsonField
class ObjectChanges(Record):
object_data = JsonField
postchange_data = JsonField
prechange_data = JsonField
def __str__(self):
return self.request_id
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/pynetbox/models/ipam.py 0000644 0001751 0000177 00000012475 14706740105 017450 0 ustar 00runner docker """
(c) 2017 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from pynetbox.core.endpoint import DetailEndpoint
from pynetbox.core.response import Record
class IpAddresses(Record):
def __str__(self):
return str(self.address)
class IpRanges(Record):
def __str__(self):
return str(self.display)
@property
def available_ips(self):
"""Represents the ``available-ips`` detail endpoint.
Returns a DetailEndpoint object that is the interface for
viewing and creating IP addresses inside an ip range .
:returns: :py:class:`.DetailEndpoint`
:Examples:
>>> ip_range = nb.ipam.ip_ranges.get(24)
>>> ip_range.available_ips.list()
[10.0.0.1/24, 10.0.0.2/24, 10.0.0.3/24, 10.0.0.4/24, 10.0.0.5/24, ...]
To create a single IP:
>>> ip_range = nb.ipam.ip_ranges.get(24)
>>> ip_range.available_ips.create()
10.0.0.1/24
To create multiple IPs:
>>> ip_range = nb.ipam.ip_ranges.get(24)
>>> create = ip_range.available_ips.create([{} for i in range(2)])
>>> create
[10.0.0.2/24, 10.0.0.3/24]
"""
return DetailEndpoint(self, "available-ips", custom_return=IpAddresses)
class Prefixes(Record):
def __str__(self):
return str(self.prefix)
@property
def available_ips(self):
"""Represents the ``available-ips`` detail endpoint.
Returns a DetailEndpoint object that is the interface for
viewing and creating IP addresses inside a prefix.
:returns: :py:class:`.DetailEndpoint`
:Examples:
>>> prefix = nb.ipam.prefixes.get(24)
>>> prefix.available_ips.list()
[10.0.0.1/24, 10.0.0.2/24, 10.0.0.3/24, 10.0.0.4/24, 10.0.0.5/24, ...]
To create a single IP:
>>> prefix = nb.ipam.prefixes.get(24)
>>> prefix.available_ips.create()
10.0.0.1/24
To create multiple IPs:
>>> prefix = nb.ipam.prefixes.get(24)
>>> create = prefix.available_ips.create([{} for i in range(2)])
>>> create
[10.0.0.2/24, 10.0.0.3/24]
"""
return DetailEndpoint(self, "available-ips", custom_return=IpAddresses)
@property
def available_prefixes(self):
"""Represents the ``available-prefixes`` detail endpoint.
Returns a DetailEndpoint object that is the interface for
viewing and creating prefixes inside a parent prefix.
Very similar to :py:meth:`~pynetbox.ipam.Prefixes.available_ips`
, except that dict (or list of dicts) passed to ``.create()``
needs to have a ``prefix_length`` key/value specifed.
:returns: :py:class:`.DetailEndpoint`
:Examples:
>>> prefix = nb.ipam.prefixes.get(3)
>>> prefix
10.0.0.0/16
>>> prefix.available_prefixes.list()
[10.0.1.0/24, 10.0.2.0/23, 10.0.4.0/22, 10.0.8.0/21, 10.0.16.0/20, 10.0.32.0/19, 10.0.64.0/18, 10.0.128.0/17]
Creating a single child prefix:
>>> prefix = nb.ipam.prefixes.get(1)
>>> prefix
10.0.0.0/24
>>> new_prefix = prefix.available_prefixes.create(
... {"prefix_length": 29}
... )
>>> new_prefix
10.0.0.16/29
"""
return DetailEndpoint(self, "available-prefixes", custom_return=Prefixes)
class Aggregates(Record):
def __str__(self):
return str(self.prefix)
class Vlans(Record):
def __str__(self):
return super().__str__() or str(self.vid)
class VlanGroups(Record):
@property
def available_vlans(self):
"""Represents the ``available-vlans`` detail endpoint.
Returns a DetailEndpoint object that is the interface for
viewing and creating VLANs inside a VLAN group.
:returns: :py:class:`.DetailEndpoint`
:Examples:
>>> vlan_group = nb.ipam.vlan_groups.get(1)
>>> vlan_group.available_vlans.list()
[10, 11, 12]
To create a new VLAN:
>>> vlan_group.available_vlans.create({"name": "NewVLAN"})
NewVLAN (10)
"""
return DetailEndpoint(self, "available-vlans", custom_return=Vlans)
class AsnRanges(Record):
@property
def available_asns(self):
"""
Represents the ``available-asns`` detail endpoint.
Returns a DetailEndpoint object that is the interface for
viewing and creating ASNs inside an ASN range.
:returns: :py:class:`.DetailEndpoint`
:Examples:
>>> asn_range = nb.ipam.asn_ranges.get(1)
>>> asn_range.available_asns.list()
[64512, 64513, 64514]
To create a new ASN:
>>> asn_range.available_asns.create()
64512
To create multiple ASNs:
>>> asn_range.available_asns.create([{} for i in range(2)])
[64513, 64514]
"""
return DetailEndpoint(self, "available-asns")
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/pynetbox/models/mapper.py 0000644 0001751 0000177 00000006463 14706740105 020006 0 ustar 00runner docker from .circuits import Circuits, CircuitTerminations
from .dcim import (
Cables,
ConsolePorts,
ConsoleServerPorts,
Devices,
DeviceTypes,
FrontPorts,
Interfaces,
PowerOutlets,
PowerPorts,
RackReservations,
Racks,
RearPorts,
Termination,
VirtualChassis,
)
from .ipam import Aggregates, IpAddresses, Prefixes, VlanGroups, Vlans
from .virtualization import VirtualMachines
from .wireless import WirelessLans
CONTENT_TYPE_MAPPER = {
"circuits.circuit": Circuits,
"circuits.circuittermination": CircuitTerminations,
"dcim.cable": Cables,
"dcim.cablepath": None,
"dcim.cabletermination": Termination,
"dcim.consoleport": ConsolePorts,
"dcim.consoleporttemplate": None,
"dcim.consoleserverport": ConsoleServerPorts,
"dcim.consoleserverporttemplate": None,
"dcim.device": Devices,
"dcim.devicebay": None,
"dcim.devicebaytemplate": None,
"dcim.devicerole": None,
"dcim.devicetype": DeviceTypes,
"dcim.frontport": FrontPorts,
"dcim.frontporttemplate": None,
"dcim.interface": Interfaces,
"dcim.interfacetemplate": None,
"dcim.inventoryitem": None,
"dcim.inventoryitemrole": None,
"dcim.inventoryitemtemplate": None,
"dcim.location": None,
"dcim.manufacturer": None,
"dcim.module": None,
"dcim.modulebay": None,
"dcim.modulebaytemplate": None,
"dcim.moduletype": None,
"dcim.platform": None,
"dcim.powerfeed": None,
"dcim.poweroutlet": PowerOutlets,
"dcim.poweroutlettemplate": None,
"dcim.powerpanel": None,
"dcim.powerport": PowerPorts,
"dcim.powerporttemplate": None,
"dcim.rack": Racks,
"dcim.rackreservation": RackReservations,
"dcim.rackrole": None,
"dcim.rearport": RearPorts,
"dcim.rearporttemplate": None,
"dcim.region": None,
"dcim.site": None,
"dcim.sitegroup": None,
"dcim.virtualchassis": VirtualChassis,
"extras.configcontext": None,
"extras.configrevision": None,
"extras.customfield": None,
"extras.customlink": None,
"extras.exporttemplate": None,
"extras.imageattachment": None,
"extras.jobresult": None,
"extras.journalentry": None,
"extras.objectchange": None,
"extras.report": None,
"extras.script": None,
"extras.tag": None,
"extras.taggeditem": None,
"extras.webhook": None,
"ipam.aggregate": Aggregates,
"ipam.ASN": None,
"ipam.FHRPgroup": None,
"ipam.FHRPgroupassignment": None,
"ipam.IPaddress": IpAddresses,
"ipam.IPrange": None,
"ipam.L2VPN": None,
"ipam.L2VPNtermination": None,
"ipam.prefix": Prefixes,
"ipam.RIR": None,
"ipam.role": None,
"ipam.routetarget": None,
"ipam.service": None,
"ipam.servicetemplate": None,
"ipam.VLAN": Vlans,
"ipam.VLANgroup": VlanGroups,
"ipam.VRF": None,
"tenancy.contact": None,
"tenancy.contactassignment": None,
"tenancy.contactgroup": None,
"tenancy.contactrole": None,
"tenancy.tenant": None,
"tenancy.tenantgroup": None,
"virtualization.cluster": None,
"virtualization.clustergroup": None,
"virtualization.clustertype": None,
"virtualization.interface": None,
"virtualization.virtualmachine": VirtualMachines,
"wireless.WirelessLAN": WirelessLans,
"wireless.WirelessLANGroup": None,
"wireless.wirelesslink": None,
}
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/pynetbox/models/users.py 0000644 0001751 0000177 00000001367 14706740105 017661 0 ustar 00runner docker """
(c) 2017 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from pynetbox.core.response import JsonField, Record
class Users(Record):
def __str__(self):
return self.username
class Permissions(Record):
users = [Users]
constraints = JsonField
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/pynetbox/models/virtualization.py 0000644 0001751 0000177 00000001445 14706740105 021601 0 ustar 00runner docker """
(c) 2017 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from pynetbox.core.response import JsonField, Record
from pynetbox.models.ipam import IpAddresses
class VirtualMachines(Record):
primary_ip = IpAddresses
primary_ip4 = IpAddresses
primary_ip6 = IpAddresses
config_context = JsonField
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/pynetbox/models/wireless.py 0000644 0001751 0000177 00000001242 14706740105 020345 0 ustar 00runner docker """
(c) 2017 DigitalOcean
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
from pynetbox.core.response import Record
class WirelessLans(Record):
def __str__(self):
return self.ssid
././@PaxHeader 0000000 0000000 0000000 00000000034 00000000000 010212 x ustar 00 28 mtime=1729871946.3977442
pynetbox-7.4.1/pynetbox.egg-info/ 0000755 0001751 0000177 00000000000 14706740112 016344 5 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871946.0
pynetbox-7.4.1/pynetbox.egg-info/PKG-INFO 0000644 0001751 0000177 00000007537 14706740112 017455 0 ustar 00runner docker Metadata-Version: 2.1
Name: pynetbox
Version: 7.4.1
Summary: NetBox API client library
Home-page: https://github.com/netbox-community/pynetbox
Author: Zach Moody, Arthur Hanson
Author-email: ahanson@netboxlabs.com
License: Apache2
Keywords: netbox
Classifier: Intended Audience :: Developers
Classifier: Development Status :: 5 - Production/Stable
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: requests<3.0,>=2.20.0
Requires-Dist: packaging
# Pynetbox
Python API client library for [NetBox](https://github.com/netbox-community/netbox).
> **Note:** Version 6.7 and later of the library only supports NetBox 3.3 and above.
## Compatibility
Each pyNetBox Version listed below has been tested with its corresponding NetBox Version.
| NetBox Version | Plugin Version |
|:--------------:|:--------------:|
| 4.0.6 | 7.4.1 |
| 4.0.0 | 7.3.4 |
| 3.7 | 7.3.0 |
| 3.6 | 7.2.0 |
| 3.5 | 7.1.0 |
| 3.3 | 7.0.0 |
## Installation
To install run `pip install pynetbox`.
Alternatively, you can clone the repo and run `python setup.py install`.
## Quick Start
The full pynetbox API is documented on [Read the Docs](http://pynetbox.readthedocs.io/en/latest/), but the following should be enough to get started using it.
To begin, import pynetbox and instantiate the API.
```
import pynetbox
nb = pynetbox.api(
'http://localhost:8000',
token='d6f4e314a5b5fefd164995169f28ae32d987704f'
)
```
The first argument the .api() method takes is the NetBox URL. There are a handful of named arguments you can provide, but in most cases none are required to simply pull data. In order to write, the `token` argument should to be provided.
## Queries
The pynetbox API is setup so that NetBox's apps are attributes of the `.api()` object, and in turn those apps have attribute representing each endpoint. Each endpoint has a handful of methods available to carry out actions on the endpoint. For example, in order to query all the objects in the `devices` endpoint you would do the following:
```
>>> devices = nb.dcim.devices.all()
>>> for device in devices:
... print(device.name)
...
test1-leaf1
test1-leaf2
test1-leaf3
>>>
```
Note that the all() and filter() methods are generators and return an object that can be iterated over only once. If you are going to be iterating over it repeatedly you need to either call the all() method again, or encapsulate the results in a `list` object like this:
```
>>> devices = list(nb.dcim.devices.all())
```
### Threading
pynetbox supports multithreaded calls for `.filter()` and `.all()` queries. It is **highly recommended** you have `MAX_PAGE_SIZE` in your Netbox install set to anything *except* `0` or `None`. The default value of `1000` is usually a good value to use. To enable threading, add `threading=True` parameter to the `.api`:
```python
nb = pynetbox.api(
'http://localhost:8000',
threading=True,
)
```
## Alternative Library
> **Note:** For those interested in a different approach, there is an alternative Python API client library available for NetBox called [netbox-python](https://github.com/netbox-community/netbox-python). This library provides a thin Python wrapper over the NetBox API.
[netbox-python](https://github.com/netbox-community/netbox-python) offers a minimalistic interface to interact with NetBox's API. While it may not provide all the features available in pynetbox, it offers a lightweight and straightforward option for interfacing with NetBox.
To explore further details and access the documentation, please visit the [netbox-python](https://github.com/netbox-community/netbox-python).
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871946.0
pynetbox-7.4.1/pynetbox.egg-info/SOURCES.txt 0000644 0001751 0000177 00000013764 14706740112 020243 0 ustar 00runner docker .gitignore
.readthedocs.yaml
CHANGELOG.md
LICENSE
README.md
requirements-dev.txt
requirements.txt
setup.py
.github/PULL_REQUEST_TEMPLATE.md
.github/ISSUE_TEMPLATE/bug_report.yaml
.github/ISSUE_TEMPLATE/config.yml
.github/ISSUE_TEMPLATE/deprecation.yaml
.github/ISSUE_TEMPLATE/documentation_change.yaml
.github/ISSUE_TEMPLATE/feature_request.yaml
.github/ISSUE_TEMPLATE/housekeeping.yaml
.github/workflows/publish.yml
.github/workflows/py3.yml
docs/IPAM.rst
docs/Makefile
docs/advanced.rst
docs/conf.py
docs/endpoint.rst
docs/index.rst
docs/request.rst
docs/requirements.txt
docs/response.rst
pynetbox/__init__.py
pynetbox.egg-info/PKG-INFO
pynetbox.egg-info/SOURCES.txt
pynetbox.egg-info/dependency_links.txt
pynetbox.egg-info/not-zip-safe
pynetbox.egg-info/requires.txt
pynetbox.egg-info/top_level.txt
pynetbox/core/__init__.py
pynetbox/core/api.py
pynetbox/core/app.py
pynetbox/core/endpoint.py
pynetbox/core/query.py
pynetbox/core/response.py
pynetbox/core/util.py
pynetbox/models/__init__.py
pynetbox/models/circuits.py
pynetbox/models/dcim.py
pynetbox/models/extras.py
pynetbox/models/ipam.py
pynetbox/models/mapper.py
pynetbox/models/users.py
pynetbox/models/virtualization.py
pynetbox/models/wireless.py
tests/__init__.py
tests/conftest.py
tests/test_api.py
tests/test_app.py
tests/test_circuits.py
tests/test_tenancy.py
tests/test_users.py
tests/test_virtualization.py
tests/test_wireless.py
tests/util.py
tests/fixtures/api/token_provision.json
tests/fixtures/circuits/circuit.json
tests/fixtures/circuits/circuit_termination.json
tests/fixtures/circuits/circuit_terminations.json
tests/fixtures/circuits/circuit_type.json
tests/fixtures/circuits/circuit_types.json
tests/fixtures/circuits/circuits.json
tests/fixtures/circuits/provider.json
tests/fixtures/circuits/providers.json
tests/fixtures/dcim/cable.json
tests/fixtures/dcim/cables.json
tests/fixtures/dcim/choices.json
tests/fixtures/dcim/console_port.json
tests/fixtures/dcim/console_port_template.json
tests/fixtures/dcim/console_port_templates.json
tests/fixtures/dcim/console_ports.json
tests/fixtures/dcim/console_server_port.json
tests/fixtures/dcim/console_server_port_template.json
tests/fixtures/dcim/console_server_port_templates.json
tests/fixtures/dcim/console_server_ports.json
tests/fixtures/dcim/device.json
tests/fixtures/dcim/device_bay.json
tests/fixtures/dcim/device_bay_template.json
tests/fixtures/dcim/device_bay_templates.json
tests/fixtures/dcim/device_bays.json
tests/fixtures/dcim/device_bulk_create.json
tests/fixtures/dcim/device_role.json
tests/fixtures/dcim/device_roles.json
tests/fixtures/dcim/device_type.json
tests/fixtures/dcim/device_types.json
tests/fixtures/dcim/devices.json
tests/fixtures/dcim/interface.json
tests/fixtures/dcim/interface_connection.json
tests/fixtures/dcim/interface_connections.json
tests/fixtures/dcim/interface_template.json
tests/fixtures/dcim/interface_templates.json
tests/fixtures/dcim/interface_trace.json
tests/fixtures/dcim/interfaces.json
tests/fixtures/dcim/interfaces_1.json
tests/fixtures/dcim/interfaces_2.json
tests/fixtures/dcim/inventory_item.json
tests/fixtures/dcim/inventory_items.json
tests/fixtures/dcim/manufacturer.json
tests/fixtures/dcim/manufacturers.json
tests/fixtures/dcim/napalm.json
tests/fixtures/dcim/platform.json
tests/fixtures/dcim/platforms.json
tests/fixtures/dcim/power_outlet.json
tests/fixtures/dcim/power_outlet_template.json
tests/fixtures/dcim/power_outlet_templates.json
tests/fixtures/dcim/power_outlets.json
tests/fixtures/dcim/power_port.json
tests/fixtures/dcim/power_port_template.json
tests/fixtures/dcim/power_port_templates.json
tests/fixtures/dcim/power_ports.json
tests/fixtures/dcim/rack.json
tests/fixtures/dcim/rack_group.json
tests/fixtures/dcim/rack_groups.json
tests/fixtures/dcim/rack_reservation.json
tests/fixtures/dcim/rack_reservations.json
tests/fixtures/dcim/rack_role.json
tests/fixtures/dcim/rack_roles.json
tests/fixtures/dcim/rack_u.json
tests/fixtures/dcim/racks.json
tests/fixtures/dcim/region.json
tests/fixtures/dcim/regions.json
tests/fixtures/dcim/site.json
tests/fixtures/dcim/sites.json
tests/fixtures/dcim/virtual_chassis_device.json
tests/fixtures/dcim/virtual_chassis_devices.json
tests/fixtures/ipam/aggregate.json
tests/fixtures/ipam/aggregates.json
tests/fixtures/ipam/available-ips-post.json
tests/fixtures/ipam/available-ips.json
tests/fixtures/ipam/available-prefixes-post.json
tests/fixtures/ipam/available-prefixes.json
tests/fixtures/ipam/ip_address.json
tests/fixtures/ipam/ip_addresses.json
tests/fixtures/ipam/prefix.json
tests/fixtures/ipam/prefixes.json
tests/fixtures/ipam/rir.json
tests/fixtures/ipam/rirs.json
tests/fixtures/ipam/role.json
tests/fixtures/ipam/roles.json
tests/fixtures/ipam/vlan.json
tests/fixtures/ipam/vlan_group.json
tests/fixtures/ipam/vlan_groups.json
tests/fixtures/ipam/vlans.json
tests/fixtures/ipam/vrf.json
tests/fixtures/ipam/vrfs.json
tests/fixtures/tenancy/tenant.json
tests/fixtures/tenancy/tenant_group.json
tests/fixtures/tenancy/tenant_groups.json
tests/fixtures/tenancy/tenants.json
tests/fixtures/users/group.json
tests/fixtures/users/groups.json
tests/fixtures/users/permission.json
tests/fixtures/users/permissions.json
tests/fixtures/users/unknown_model.json
tests/fixtures/users/user.json
tests/fixtures/users/users.json
tests/fixtures/virtualization/cluster.json
tests/fixtures/virtualization/cluster_group.json
tests/fixtures/virtualization/cluster_groups.json
tests/fixtures/virtualization/cluster_type.json
tests/fixtures/virtualization/cluster_types.json
tests/fixtures/virtualization/clusters.json
tests/fixtures/virtualization/interface.json
tests/fixtures/virtualization/interfaces.json
tests/fixtures/virtualization/virtual_machine.json
tests/fixtures/virtualization/virtual_machines.json
tests/fixtures/wireless/wireless_lan.json
tests/fixtures/wireless/wireless_lans.json
tests/integration/conftest.py
tests/integration/test_dcim.py
tests/integration/test_ipam.py
tests/unit/__init__.py
tests/unit/test_detailendpoint.py
tests/unit/test_endpoint.py
tests/unit/test_extras.py
tests/unit/test_query.py
tests/unit/test_request.py
tests/unit/test_response.py ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871946.0
pynetbox-7.4.1/pynetbox.egg-info/dependency_links.txt 0000644 0001751 0000177 00000000001 14706740112 022412 0 ustar 00runner docker
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871946.0
pynetbox-7.4.1/pynetbox.egg-info/not-zip-safe 0000644 0001751 0000177 00000000001 14706740112 020572 0 ustar 00runner docker
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871946.0
pynetbox-7.4.1/pynetbox.egg-info/requires.txt 0000644 0001751 0000177 00000000040 14706740112 020736 0 ustar 00runner docker requests<3.0,>=2.20.0
packaging
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871946.0
pynetbox-7.4.1/pynetbox.egg-info/top_level.txt 0000644 0001751 0000177 00000000011 14706740112 021066 0 ustar 00runner docker pynetbox
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/requirements-dev.txt 0000644 0001751 0000177 00000000041 14706740105 017037 0 ustar 00runner docker black
pytest
pytest-docker
PyYAML ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/requirements.txt 0000644 0001751 0000177 00000000062 14706740105 016266 0 ustar 00runner docker requests>=2.32.3,<3.0
urllib3>=2.2.3,<3
packaging
././@PaxHeader 0000000 0000000 0000000 00000000034 00000000000 010212 x ustar 00 28 mtime=1729871946.3977442
pynetbox-7.4.1/setup.cfg 0000644 0001751 0000177 00000000046 14706740112 014623 0 ustar 00runner docker [egg_info]
tag_build =
tag_date = 0
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/setup.py 0000644 0001751 0000177 00000001700 14706740105 014514 0 ustar 00runner docker from setuptools import find_packages, setup
setup(
name="pynetbox",
description="NetBox API client library",
url="https://github.com/netbox-community/pynetbox",
author="Zach Moody, Arthur Hanson",
author_email="ahanson@netboxlabs.com",
license="Apache2",
include_package_data=True,
use_scm_version=True,
setup_requires=["setuptools_scm"],
packages=find_packages(exclude=["tests", "tests.*"]),
long_description=open("README.md").read(),
long_description_content_type="text/markdown",
install_requires=["requests>=2.20.0,<3.0", "packaging"],
zip_safe=False,
keywords=["netbox"],
classifiers=[
"Intended Audience :: Developers",
"Development Status :: 5 - Production/Stable",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
],
)
././@PaxHeader 0000000 0000000 0000000 00000000034 00000000000 010212 x ustar 00 28 mtime=1729871946.3777442
pynetbox-7.4.1/tests/ 0000755 0001751 0000177 00000000000 14706740112 014144 5 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/__init__.py 0000644 0001751 0000177 00000000000 14706740105 016245 0 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/conftest.py 0000644 0001751 0000177 00000004341 14706740105 016347 0 ustar 00runner docker from urllib import parse
import pytest
from packaging import version
DEFAULT_NETBOX_VERSIONS = "4.0"
def pytest_addoption(parser):
"""Hook on the pytest option parser setup.
Add some extra options to the parser.
"""
parser.addoption(
"--netbox-versions",
action="store",
default=DEFAULT_NETBOX_VERSIONS,
help=(
"The versions of netbox to run integration tests against, as a"
" comma-separated list. Default: %s" % DEFAULT_NETBOX_VERSIONS
),
)
parser.addoption(
"--no-cleanup",
dest="cleanup",
action="store_false",
help=(
"Skip any cleanup steps after the pytest session finishes. Any containers"
" created will be left running and the docker-compose files used to"
" create them will be left on disk."
),
)
parser.addoption(
"--url-override",
dest="url_override",
action="store",
help=(
"Overrides the URL to run tests to. This allows for testing to the same"
" containers for separate runs."
),
)
def pytest_configure(config):
"""Hook that runs after test collection is completed.
Here we can modify items in the collected tests or parser args.
"""
# verify the netbox versions parse correctly and split them
config.option.netbox_versions = [
version.Version(version_string)
for version_string in config.option.netbox_versions.split(",")
]
if "no:docker" in config.option.plugins and config.option.url_override:
url_parse = parse.urlparse(config.option.url_override)
class DockerServicesMock:
def __init__(self, ports):
self.ports = ports
def wait_until_responsive(self, *args, **kwargs):
return None
def port_for(self, *args):
return self.ports
class Plugin:
@pytest.fixture(scope="session")
def docker_ip(self):
return "127.0.0.1"
@pytest.fixture(scope="session")
def docker_services(self):
return DockerServicesMock(url_parse.port)
config.pluginmanager.register(Plugin())
././@PaxHeader 0000000 0000000 0000000 00000000033 00000000000 010211 x ustar 00 27 mtime=1729871946.365744
pynetbox-7.4.1/tests/fixtures/ 0000755 0001751 0000177 00000000000 14706740112 016015 5 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000034 00000000000 010212 x ustar 00 28 mtime=1729871946.3777442
pynetbox-7.4.1/tests/fixtures/api/ 0000755 0001751 0000177 00000000000 14706740112 016566 5 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/api/token_provision.json 0000644 0001751 0000177 00000000072 14706740105 022712 0 ustar 00runner docker {
"key": "1234567890123456789012345678901234567890"
}
././@PaxHeader 0000000 0000000 0000000 00000000034 00000000000 010212 x ustar 00 28 mtime=1729871946.3777442
pynetbox-7.4.1/tests/fixtures/circuits/ 0000755 0001751 0000177 00000000000 14706740112 017642 5 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/circuits/circuit.json 0000644 0001751 0000177 00000000753 14706740105 022206 0 ustar 00runner docker {
"id": 1,
"cid": "123456",
"provider": {
"id": 1,
"url": "http://localhost:8000/api/circuits/providers/1/",
"name": "TEST",
"slug": "test"
},
"type": {
"id": 1,
"url": "http://localhost:8000/api/circuits/circuit-types/1/",
"name": "Transit",
"slug": "transit"
},
"tenant": null,
"install_date": null,
"commit_rate": null,
"description": "",
"comments": "",
"custom_fields": {}
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/circuits/circuit_termination.json 0000644 0001751 0000177 00000001660 14706740105 024615 0 ustar 00runner docker {
"id": 1,
"circuit": {
"id": 1,
"url": "http://localhost:8000/api/circuits/circuits/1/",
"cid": "123456"
},
"term_side": "A",
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"interface": {
"id": 4,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "xe-0/0/0",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "TEST",
"connection": null,
"connected_interface": null
},
"port_speed": 1000000,
"upstream_speed": null,
"xconnect_id": "",
"pp_info": ""
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/circuits/circuit_terminations.json 0000644 0001751 0000177 00000002473 14706740105 025003 0 ustar 00runner docker {
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"circuit": {
"id": 1,
"url": "http://localhost:8000/api/circuits/circuits/1/",
"cid": "123456"
},
"term_side": "A",
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"interface": {
"id": 4,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "xe-0/0/0",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "TEST",
"connection": null,
"connected_interface": null
},
"port_speed": 1000000,
"upstream_speed": null,
"xconnect_id": "",
"pp_info": ""
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/circuits/circuit_type.json 0000644 0001751 0000177 00000000075 14706740105 023244 0 ustar 00runner docker {
"id": 1,
"name": "Transit",
"slug": "transit"
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/circuits/circuit_types.json 0000644 0001751 0000177 00000000270 14706740105 023424 0 ustar 00runner docker {
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "Transit",
"slug": "transit"
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/circuits/circuits.json 0000644 0001751 0000177 00000001356 14706740105 022371 0 ustar 00runner docker {
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"cid": "123456",
"provider": {
"id": 1,
"url": "http://localhost:8000/api/circuits/providers/1/",
"name": "TEST",
"slug": "test"
},
"type": {
"id": 1,
"url": "http://localhost:8000/api/circuits/circuit-types/1/",
"name": "Transit",
"slug": "transit"
},
"tenant": null,
"install_date": null,
"commit_rate": null,
"description": "",
"comments": "",
"custom_fields": {}
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/circuits/provider.json 0000644 0001751 0000177 00000000316 14706740105 022371 0 ustar 00runner docker {
"id": 1,
"name": "TEST",
"slug": "test",
"asn": null,
"account": "",
"portal_url": "",
"noc_contact": "",
"admin_contact": "",
"comments": "",
"custom_fields": {}
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/circuits/providers.json 0000644 0001751 0000177 00000000601 14706740105 022551 0 ustar 00runner docker {
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "TEST",
"slug": "test",
"asn": null,
"account": "",
"portal_url": "",
"noc_contact": "",
"admin_contact": "",
"comments": "",
"custom_fields": {}
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000033 00000000000 010211 x ustar 00 27 mtime=1729871946.389744
pynetbox-7.4.1/tests/fixtures/dcim/ 0000755 0001751 0000177 00000000000 14706740112 016731 5 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/cable.json 0000644 0001751 0000177 00000002026 14706740105 020674 0 ustar 00runner docker {
"id": 1,
"termination_a_type": "dcim.consoleport",
"termination_a_id": 1,
"termination_a": {
"id": 1,
"url": "http://localhost:8000/api/dcim/console-ports/1/",
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "tst1-test1",
"display_name": "tst1-test1"
},
"name": "Console",
"cable": 1
},
"termination_b_type": "dcim.consoleserverport",
"termination_b_id": 2,
"termination_b": {
"id": 2,
"url": "http://localhost:8000/api/dcim/console-server-ports/2/",
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "tst1-test2",
"display_name": "tst1-test2"
},
"name": "Port 10",
"cable": 1
},
"type": null,
"status": {
"value": true,
"label": "Connected"
},
"label": "",
"color": "",
"length": null,
"length_unit": null
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/cables.json 0000644 0001751 0000177 00000010130 14706740105 021052 0 ustar 00runner docker {
"count": 3,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"termination_a_type": "dcim.consoleport",
"termination_a_id": 1,
"termination_a": {
"id": 1,
"url": "http://localhost:8000/api/dcim/console-ports/1/",
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "tst1-test1",
"display_name": "tst1-test1"
},
"name": "Console",
"cable": 1
},
"termination_b_type": "dcim.consoleserverport",
"termination_b_id": 2,
"termination_b": {
"id": 2,
"url": "http://localhost:8000/api/dcim/console-server-ports/2/",
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "tst1-test2",
"display_name": "tst1-test2"
},
"name": "Port 10",
"cable": 1
},
"type": null,
"status": {
"value": true,
"label": "Connected"
},
"label": "",
"color": "",
"length": null,
"length_unit": null
},
{
"id": 2,
"termination_a_type": "dcim.consoleport",
"termination_a_id": 3,
"termination_a": {
"id": 3,
"url": "http://localhost:8000/api/dcim/console-ports/3/",
"device": {
"id": 3,
"url": "http://localhost:8000/api/dcim/devices/3/",
"name": "tst1-test3",
"display_name": "tst1-test3"
},
"name": "Console",
"cable": 2
},
"termination_b_type": "dcim.consoleserverport",
"termination_b_id": 4,
"termination_b": {
"id": 4,
"url": "http://localhost:8000/api/dcim/console-server-ports/4/",
"device": {
"id": 4,
"url": "http://localhost:8000/api/dcim/devices/4/",
"name": "tst1-test4",
"display_name": "tst1-test4"
},
"name": "Port 11",
"cable": 2
},
"type": null,
"status": {
"value": true,
"label": "Connected"
},
"label": "",
"color": "",
"length": null,
"length_unit": null
},
{
"id": 3,
"termination_a_type": "dcim.consoleport",
"termination_a_id": 5,
"termination_a": {
"id": 5,
"url": "http://localhost:8000/api/dcim/console-ports/5/",
"device": {
"id": 5,
"url": "http://localhost:8000/api/dcim/devices/5/",
"name": "tst1-test5",
"display_name": "tst1-test5"
},
"name": "Console",
"cable": 3
},
"termination_b_type": "dcim.consoleserverport",
"termination_b_id": 6,
"termination_b": {
"id": 6,
"url": "http://localhost:8000/api/dcim/console-server-ports/6/",
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "tst1-test6",
"display_name": "tst1-test6"
},
"name": "Port 1",
"cable": 3
},
"type": null,
"status": {
"value": true,
"label": "Connected"
},
"label": "",
"color": "",
"length": null,
"length_unit": null
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/choices.json 0000644 0001751 0000177 00000023303 14706740105 021244 0 ustar 00runner docker {
"device:face": [
{
"label": "Front",
"value": 0
},
{
"label": "Rear",
"value": 1
}
],
"device:status": [
{
"label": "Active",
"value": 1
},
{
"label": "Offline",
"value": 0
},
{
"label": "Planned",
"value": 2
},
{
"label": "Staged",
"value": 3
},
{
"label": "Failed",
"value": 4
},
{
"label": "Inventory",
"value": 5
}
],
"console-port:connection_status": [
{
"label": "Planned",
"value": false
},
{
"label": "Connected",
"value": true
}
],
"interface:form_factor": [
{
"label": "Virtual",
"value": 0
},
{
"label": "Link Aggregation Group (LAG)",
"value": 200
},
{
"label": "100BASE-TX (10/100ME)",
"value": 800
},
{
"label": "1000BASE-T (1GE)",
"value": 1000
},
{
"label": "10GBASE-T (10GE)",
"value": 1150
},
{
"label": "10GBASE-CX4 (10GE)",
"value": 1170
},
{
"label": "GBIC (1GE)",
"value": 1050
},
{
"label": "SFP (1GE)",
"value": 1100
},
{
"label": "SFP+ (10GE)",
"value": 1200
},
{
"label": "XFP (10GE)",
"value": 1300
},
{
"label": "XENPAK (10GE)",
"value": 1310
},
{
"label": "X2 (10GE)",
"value": 1320
},
{
"label": "SFP28 (25GE)",
"value": 1350
},
{
"label": "QSFP+ (40GE)",
"value": 1400
},
{
"label": "CFP (100GE)",
"value": 1500
},
{
"label": "CFP2 (100GE)",
"value": 1510
},
{
"label": "CFP4 (100GE)",
"value": 1520
},
{
"label": "Cisco CPAK (100GE)",
"value": 1550
},
{
"label": "QSFP28 (100GE)",
"value": 1600
},
{
"label": "IEEE 802.11a",
"value": 2600
},
{
"label": "IEEE 802.11b/g",
"value": 2610
},
{
"label": "IEEE 802.11n",
"value": 2620
},
{
"label": "IEEE 802.11ac",
"value": 2630
},
{
"label": "IEEE 802.11ad",
"value": 2640
},
{
"label": "SFP (1GFC)",
"value": 3010
},
{
"label": "SFP (2GFC)",
"value": 3020
},
{
"label": "SFP (4GFC)",
"value": 3040
},
{
"label": "SFP+ (8GFC)",
"value": 3080
},
{
"label": "SFP+ (16GFC)",
"value": 3160
},
{
"label": "T1 (1.544 Mbps)",
"value": 4000
},
{
"label": "E1 (2.048 Mbps)",
"value": 4010
},
{
"label": "T3 (45 Mbps)",
"value": 4040
},
{
"label": "E3 (34 Mbps)",
"value": 4050
},
{
"label": "Cisco StackWise",
"value": 5000
},
{
"label": "Cisco StackWise Plus",
"value": 5050
},
{
"label": "Cisco FlexStack",
"value": 5100
},
{
"label": "Cisco FlexStack Plus",
"value": 5150
},
{
"label": "Juniper VCP",
"value": 5200
},
{
"label": "Extreme SummitStack",
"value": 5300
},
{
"label": "Extreme SummitStack-128",
"value": 5310
},
{
"label": "Extreme SummitStack-256",
"value": 5320
},
{
"label": "Extreme SummitStack-512",
"value": 5330
},
{
"label": "Other",
"value": 32767
}
],
"interface:mode": [
{
"label": "Access",
"value": 100
},
{
"label": "Tagged",
"value": 200
},
{
"label": "Tagged All",
"value": 300
}
],
"interface-connection:connection_status": [
{
"label": "Planned",
"value": false
},
{
"label": "Connected",
"value": true
}
],
"interface-template:form_factor": [
{
"label": "Virtual",
"value": 0
},
{
"label": "Link Aggregation Group (LAG)",
"value": 200
},
{
"label": "100BASE-TX (10/100ME)",
"value": 800
},
{
"label": "1000BASE-T (1GE)",
"value": 1000
},
{
"label": "10GBASE-T (10GE)",
"value": 1150
},
{
"label": "10GBASE-CX4 (10GE)",
"value": 1170
},
{
"label": "GBIC (1GE)",
"value": 1050
},
{
"label": "SFP (1GE)",
"value": 1100
},
{
"label": "SFP+ (10GE)",
"value": 1200
},
{
"label": "XFP (10GE)",
"value": 1300
},
{
"label": "XENPAK (10GE)",
"value": 1310
},
{
"label": "X2 (10GE)",
"value": 1320
},
{
"label": "SFP28 (25GE)",
"value": 1350
},
{
"label": "QSFP+ (40GE)",
"value": 1400
},
{
"label": "CFP (100GE)",
"value": 1500
},
{
"label": "CFP2 (100GE)",
"value": 1510
},
{
"label": "CFP4 (100GE)",
"value": 1520
},
{
"label": "Cisco CPAK (100GE)",
"value": 1550
},
{
"label": "QSFP28 (100GE)",
"value": 1600
},
{
"label": "IEEE 802.11a",
"value": 2600
},
{
"label": "IEEE 802.11b/g",
"value": 2610
},
{
"label": "IEEE 802.11n",
"value": 2620
},
{
"label": "IEEE 802.11ac",
"value": 2630
},
{
"label": "IEEE 802.11ad",
"value": 2640
},
{
"label": "SFP (1GFC)",
"value": 3010
},
{
"label": "SFP (2GFC)",
"value": 3020
},
{
"label": "SFP (4GFC)",
"value": 3040
},
{
"label": "SFP+ (8GFC)",
"value": 3080
},
{
"label": "SFP+ (16GFC)",
"value": 3160
},
{
"label": "T1 (1.544 Mbps)",
"value": 4000
},
{
"label": "E1 (2.048 Mbps)",
"value": 4010
},
{
"label": "T3 (45 Mbps)",
"value": 4040
},
{
"label": "E3 (34 Mbps)",
"value": 4050
},
{
"label": "Cisco StackWise",
"value": 5000
},
{
"label": "Cisco StackWise Plus",
"value": 5050
},
{
"label": "Cisco FlexStack",
"value": 5100
},
{
"label": "Cisco FlexStack Plus",
"value": 5150
},
{
"label": "Juniper VCP",
"value": 5200
},
{
"label": "Extreme SummitStack",
"value": 5300
},
{
"label": "Extreme SummitStack-128",
"value": 5310
},
{
"label": "Extreme SummitStack-256",
"value": 5320
},
{
"label": "Extreme SummitStack-512",
"value": 5330
},
{
"label": "Other",
"value": 32767
}
],
"power-port:connection_status": [
{
"label": "Planned",
"value": false
},
{
"label": "Connected",
"value": true
}
],
"rack:type": [
{
"label": "2-post frame",
"value": 100
},
{
"label": "4-post frame",
"value": 200
},
{
"label": "4-post cabinet",
"value": 300
},
{
"label": "Wall-mounted frame",
"value": 1000
},
{
"label": "Wall-mounted cabinet",
"value": 1100
}
],
"rack:width": [
{
"label": "19 inches",
"value": 19
},
{
"label": "23 inches",
"value": 23
}
],
"site:status": [
{
"label": "Active",
"value": 1
},
{
"label": "Planned",
"value": 2
},
{
"label": "Retired",
"value": 4
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/console_port.json 0000644 0001751 0000177 00000001026 14706740105 022333 0 ustar 00runner docker {
"id": 1,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "Console (RE0)",
"cs_port": {
"id": 27,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 3",
"connected_console": 1
},
"connection_status": true
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/console_port_template.json 0000644 0001751 0000177 00000000611 14706740105 024225 0 ustar 00runner docker {
"id": 1,
"device_type": {
"id": 1,
"url": "http://localhost:8000/api/dcim/device-types/1/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "MX960",
"slug": "mx960"
},
"name": "Console (RE0)"
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/console_port_templates.json 0000644 0001751 0000177 00000007267 14706740105 024426 0 ustar 00runner docker {
"count": 7,
"next": null,
"previous": null,
"results": [
{
"id": 3,
"device_type": {
"id": 2,
"url": "http://localhost:8000/api/dcim/device-types/2/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "EX9214",
"slug": "ex9214"
},
"name": "Console (RE0)"
},
{
"id": 4,
"device_type": {
"id": 2,
"url": "http://localhost:8000/api/dcim/device-types/2/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "EX9214",
"slug": "ex9214"
},
"name": "Console (RE1)"
},
{
"id": 1,
"device_type": {
"id": 1,
"url": "http://localhost:8000/api/dcim/device-types/1/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "MX960",
"slug": "mx960"
},
"name": "Console (RE0)"
},
{
"id": 2,
"device_type": {
"id": 1,
"url": "http://localhost:8000/api/dcim/device-types/1/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "MX960",
"slug": "mx960"
},
"name": "Console (RE1)"
},
{
"id": 5,
"device_type": {
"id": 3,
"url": "http://localhost:8000/api/dcim/device-types/3/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "QFX5100-24Q",
"slug": "qfx5100-24q"
},
"name": "Console"
},
{
"id": 6,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Console"
},
{
"id": 7,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "Serial"
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/console_ports.json 0000644 0001751 0000177 00000016640 14706740105 022526 0 ustar 00runner docker {
"count": 15,
"next": null,
"previous": null,
"results": [
{
"id": 3,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "Console (RE0)",
"cs_port": {
"id": 5,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 1",
"connected_console": 3
},
"connection_status": true
},
{
"id": 4,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "Console (RE1)",
"cs_port": {
"id": 16,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 2",
"connected_console": 4
},
"connection_status": true
},
{
"id": 11,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "Console (RE0)",
"cs_port": null,
"connection_status": true
},
{
"id": 12,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "Console (RE1)",
"cs_port": null,
"connection_status": true
},
{
"id": 1,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "Console (RE0)",
"cs_port": {
"id": 27,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 3",
"connected_console": 1
},
"connection_status": true
},
{
"id": 2,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "Console (RE1)",
"cs_port": {
"id": 38,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 4",
"connected_console": 2
},
"connection_status": true
},
{
"id": 9,
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "Console (RE0)",
"cs_port": null,
"connection_status": true
},
{
"id": 10,
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "Console (RE1)",
"cs_port": null,
"connection_status": true
},
{
"id": 6,
"device": {
"id": 4,
"url": "http://localhost:8000/api/dcim/devices/4/",
"name": "test1-leaf1",
"display_name": "test1-leaf1"
},
"name": "Console",
"cs_port": {
"id": 48,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 5",
"connected_console": 6
},
"connection_status": true
},
{
"id": 7,
"device": {
"id": 5,
"url": "http://localhost:8000/api/dcim/devices/5/",
"name": "test1-leaf2",
"display_name": "test1-leaf2"
},
"name": "Console",
"cs_port": null,
"connection_status": true
},
{
"id": 13,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Console",
"cs_port": null,
"connection_status": true
},
{
"id": 15,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "Serial",
"cs_port": null,
"connection_status": true
},
{
"id": 16,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "Serial",
"cs_port": null,
"connection_status": true
},
{
"id": 5,
"device": {
"id": 3,
"url": "http://localhost:8000/api/dcim/devices/3/",
"name": "test1-spine1",
"display_name": "test1-spine1"
},
"name": "Console",
"cs_port": {
"id": 49,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 6",
"connected_console": 5
},
"connection_status": true
},
{
"id": 8,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "Console",
"cs_port": null,
"connection_status": true
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/console_server_port.json 0000644 0001751 0000177 00000000350 14706740105 023720 0 ustar 00runner docker {
"id": 1,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 1",
"connected_console": 3
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/console_server_port_template.json 0000644 0001751 0000177 00000000617 14706740105 025621 0 ustar 00runner docker {
"id": 1,
"device_type": {
"id": 3,
"url": "http://localhost:8000/api/dcim/device-types/3/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "QFX5100-24Q",
"slug": "qfx5100-24q"
},
"name": "Console"
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/console_server_port_templates.json 0000644 0001751 0000177 00000063105 14706740105 026005 0 ustar 00runner docker {
"count": 50,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"device_type": {
"id": 3,
"url": "http://localhost:8000/api/dcim/device-types/3/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "QFX5100-24Q",
"slug": "qfx5100-24q"
},
"name": "Console"
},
{
"id": 3,
"device_type": {
"id": 4,
"url": "http://localhost:8000/api/dcim/device-types/4/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "QFX5100-48S",
"slug": "qfx5100-48s"
},
"name": "Console"
},
{
"id": 4,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 1"
},
{
"id": 13,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 10"
},
{
"id": 14,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 11"
},
{
"id": 15,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 12"
},
{
"id": 16,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 13"
},
{
"id": 17,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 14"
},
{
"id": 18,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 15"
},
{
"id": 19,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 16"
},
{
"id": 20,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 17"
},
{
"id": 21,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 18"
},
{
"id": 22,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 19"
},
{
"id": 5,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 2"
},
{
"id": 23,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 20"
},
{
"id": 24,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 21"
},
{
"id": 25,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 22"
},
{
"id": 26,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 23"
},
{
"id": 27,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 24"
},
{
"id": 28,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 25"
},
{
"id": 29,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 26"
},
{
"id": 30,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 27"
},
{
"id": 31,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 28"
},
{
"id": 32,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 29"
},
{
"id": 6,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 3"
},
{
"id": 33,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 30"
},
{
"id": 34,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 31"
},
{
"id": 35,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 32"
},
{
"id": 36,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 33"
},
{
"id": 37,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 34"
},
{
"id": 38,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 35"
},
{
"id": 39,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 36"
},
{
"id": 40,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 37"
},
{
"id": 41,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 38"
},
{
"id": 42,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 39"
},
{
"id": 7,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 4"
},
{
"id": 43,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 40"
},
{
"id": 44,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 41"
},
{
"id": 45,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 42"
},
{
"id": 46,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 43"
},
{
"id": 47,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 44"
},
{
"id": 48,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 45"
},
{
"id": 49,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 46"
},
{
"id": 50,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 47"
},
{
"id": 51,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 48"
},
{
"id": 8,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 5"
},
{
"id": 9,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 6"
},
{
"id": 10,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 7"
},
{
"id": 11,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 8"
},
{
"id": 12,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "Port 9"
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/console_server_ports.json 0000644 0001751 0000177 00000036602 14706740105 024114 0 ustar 00runner docker {
"count": 48,
"next": null,
"previous": null,
"results": [
{
"id": 5,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 1",
"connected_console": 3
},
{
"id": 16,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 2",
"connected_console": 4
},
{
"id": 27,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 3",
"connected_console": 1
},
{
"id": 38,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 4",
"connected_console": 2
},
{
"id": 48,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 5",
"connected_console": 6
},
{
"id": 49,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 6",
"connected_console": 5
},
{
"id": 50,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 7",
"connected_console": null
},
{
"id": 51,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 8",
"connected_console": null
},
{
"id": 52,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 9",
"connected_console": null
},
{
"id": 6,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 10",
"connected_console": null
},
{
"id": 7,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 11",
"connected_console": null
},
{
"id": 8,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 12",
"connected_console": null
},
{
"id": 9,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 13",
"connected_console": null
},
{
"id": 10,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 14",
"connected_console": null
},
{
"id": 11,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 15",
"connected_console": null
},
{
"id": 12,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 16",
"connected_console": null
},
{
"id": 13,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 17",
"connected_console": null
},
{
"id": 14,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 18",
"connected_console": null
},
{
"id": 15,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 19",
"connected_console": null
},
{
"id": 17,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 20",
"connected_console": null
},
{
"id": 18,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 21",
"connected_console": null
},
{
"id": 19,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 22",
"connected_console": null
},
{
"id": 20,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 23",
"connected_console": null
},
{
"id": 21,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 24",
"connected_console": null
},
{
"id": 22,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 25",
"connected_console": null
},
{
"id": 23,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 26",
"connected_console": null
},
{
"id": 24,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 27",
"connected_console": null
},
{
"id": 25,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 28",
"connected_console": null
},
{
"id": 26,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 29",
"connected_console": null
},
{
"id": 28,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 30",
"connected_console": null
},
{
"id": 29,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 31",
"connected_console": null
},
{
"id": 30,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 32",
"connected_console": null
},
{
"id": 31,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 33",
"connected_console": null
},
{
"id": 32,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 34",
"connected_console": null
},
{
"id": 33,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 35",
"connected_console": null
},
{
"id": 34,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 36",
"connected_console": null
},
{
"id": 35,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 37",
"connected_console": null
},
{
"id": 36,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 38",
"connected_console": null
},
{
"id": 37,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 39",
"connected_console": null
},
{
"id": 39,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 40",
"connected_console": null
},
{
"id": 40,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 41",
"connected_console": null
},
{
"id": 41,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 42",
"connected_console": null
},
{
"id": 42,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 43",
"connected_console": null
},
{
"id": 43,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 44",
"connected_console": null
},
{
"id": 44,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 45",
"connected_console": null
},
{
"id": 45,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 46",
"connected_console": null
},
{
"id": 46,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 47",
"connected_console": null
},
{
"id": 47,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "Port 48",
"connected_console": null
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/device.json 0000644 0001751 0000177 00000003452 14706740105 021071 0 ustar 00runner docker {
"id": 1,
"name": "test1-edge1",
"display_name": "test1-edge1",
"device_type": {
"id": 1,
"url": "http://localhost:8000/api/dcim/device-types/1/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "MX960",
"slug": "mx960"
},
"role": {
"id": 1,
"url": "http://localhost:8000/api/dcim/device-roles/1/",
"name": "Router",
"slug": "router"
},
"tenant": null,
"platform": {
"id": 1,
"url": "http://localhost:8000/api/dcim/platforms/1/",
"name": "Juniper Junos",
"slug": "juniper-junos"
},
"serial": "5555555555",
"asset_tag": null,
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"rack": {
"id": 1,
"url": "http://localhost:8000/api/dcim/racks/1/",
"name": "A1R1",
"display_name": "A1R1 (T23A01)"
},
"position": 1,
"face": {
"value": 0,
"label": "Front"
},
"parent_device": null,
"status": {
"value": true,
"label": "Active"
},
"primary_ip": {
"id": 1,
"url": "http://localhost:8000/api/ipam/ip-addresses/1/",
"family": 4,
"address": "10.0.255.1/32"
},
"primary_ip4": {
"id": 1,
"url": "http://localhost:8000/api/ipam/ip-addresses/1/",
"family": 4,
"address": "10.0.255.1/32"
},
"primary_ip6": null,
"comments": "",
"local_context_data": {
"testing": "test"
},
"custom_fields": {},
"config_context": {
"test_key": "test_val"
}
}
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/device_bay.json 0000644 0001751 0000177 00000000371 14706740105 021721 0 ustar 00runner docker {
"id": 1,
"device": {
"id": 13,
"url": "http://localhost:8000/api/dcim/devices/13/",
"name": "test1-mothership",
"display_name": "test1-mothership"
},
"name": "thing-1",
"installed_device": null
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/device_bay_template.json 0000644 0001751 0000177 00000000623 14706740105 023614 0 ustar 00runner docker {
"id": 1,
"device_type": {
"id": 7,
"url": "http://localhost:8000/api/dcim/device-types/7/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "Mothership",
"slug": "mothership"
},
"name": "thing-1"
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/device_bay_templates.json 0000644 0001751 0000177 00000003220 14706740105 023773 0 ustar 00runner docker {
"count": 3,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"device_type": {
"id": 7,
"url": "http://localhost:8000/api/dcim/device-types/7/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "Mothership",
"slug": "mothership"
},
"name": "thing-1"
},
{
"id": 2,
"device_type": {
"id": 7,
"url": "http://localhost:8000/api/dcim/device-types/7/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "Mothership",
"slug": "mothership"
},
"name": "thing-2"
},
{
"id": 3,
"device_type": {
"id": 7,
"url": "http://localhost:8000/api/dcim/device-types/7/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "Mothership",
"slug": "mothership"
},
"name": "thing-3"
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/device_bays.json 0000644 0001751 0000177 00000002112 14706740105 022077 0 ustar 00runner docker {
"count": 3,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"device": {
"id": 13,
"url": "http://localhost:8000/api/dcim/devices/13/",
"name": "test1-mothership",
"display_name": "test1-mothership"
},
"name": "thing-1",
"installed_device": null
},
{
"id": 2,
"device": {
"id": 13,
"url": "http://localhost:8000/api/dcim/devices/13/",
"name": "test1-mothership",
"display_name": "test1-mothership"
},
"name": "thing-2",
"installed_device": null
},
{
"id": 3,
"device": {
"id": 13,
"url": "http://localhost:8000/api/dcim/devices/13/",
"name": "test1-mothership",
"display_name": "test1-mothership"
},
"name": "thing-3",
"installed_device": null
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/device_bulk_create.json 0000644 0001751 0000177 00000001514 14706740105 023426 0 ustar 00runner docker [
{
"id": 1,
"name": "test1-core3",
"device_type": 1,
"role": 3,
"tenant": null,
"platform": null,
"serial": "",
"asset_tag": null,
"site": 1,
"rack": null,
"position": null,
"face": null,
"status": 1,
"primary_ip4": null,
"primary_ip6": null,
"cluster": null,
"comments": ""
},
{
"id": 2,
"name": "test1-core4",
"device_type": 1,
"role": 3,
"tenant": null,
"platform": null,
"serial": "",
"asset_tag": null,
"site": 1,
"rack": null,
"position": null,
"face": null,
"status": 1,
"primary_ip4": null,
"primary_ip6": null,
"cluster": null,
"comments": ""
}
] ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/device_role.json 0000644 0001751 0000177 00000000122 14706740105 022101 0 ustar 00runner docker {
"id": 1,
"name": "Router",
"slug": "router",
"color": "purple"
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/device_roles.json 0000644 0001751 0000177 00000001605 14706740105 022273 0 ustar 00runner docker {
"count": 6,
"next": null,
"previous": null,
"results": [
{
"id": 3,
"name": "Core Switch",
"slug": "core-switch",
"color": "red"
},
{
"id": 4,
"name": "Leaf Switch",
"slug": "leaf-switch",
"color": "teal"
},
{
"id": 5,
"name": "OOB Switch",
"slug": "oob-switch",
"color": "purple"
},
{
"id": 6,
"name": "PDU",
"slug": "pdu",
"color": "yellow"
},
{
"id": 1,
"name": "Router",
"slug": "router",
"color": "purple"
},
{
"id": 2,
"name": "Spine Switch",
"slug": "spine-switch",
"color": "green"
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/device_type.json 0000644 0001751 0000177 00000001063 14706740105 022126 0 ustar 00runner docker {
"id": 1,
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "MX960",
"slug": "mx960",
"part_number": "",
"u_height": 16,
"is_full_depth": true,
"interface_ordering": {
"value": 1,
"label": "Slot/position"
},
"is_console_server": false,
"is_pdu": false,
"is_network_device": true,
"subdevice_role": null,
"comments": "",
"custom_fields": {},
"instance_count": 2
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/device_types.json 0000644 0001751 0000177 00000011162 14706740105 022312 0 ustar 00runner docker {
"count": 6,
"next": null,
"previous": null,
"results": [
{
"id": 2,
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "EX9214",
"slug": "ex9214",
"part_number": "",
"u_height": 16,
"is_full_depth": true,
"interface_ordering": {
"value": 1,
"label": "Slot/position"
},
"is_console_server": false,
"is_pdu": false,
"is_network_device": true,
"subdevice_role": null,
"comments": "",
"custom_fields": {},
"instance_count": 2
},
{
"id": 1,
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "MX960",
"slug": "mx960",
"part_number": "",
"u_height": 16,
"is_full_depth": true,
"interface_ordering": {
"value": 1,
"label": "Slot/position"
},
"is_console_server": false,
"is_pdu": false,
"is_network_device": true,
"subdevice_role": null,
"comments": "",
"custom_fields": {},
"instance_count": 2
},
{
"id": 3,
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "QFX5100-24Q",
"slug": "qfx5100-24q",
"part_number": "",
"u_height": 1,
"is_full_depth": true,
"interface_ordering": {
"value": 1,
"label": "Slot/position"
},
"is_console_server": false,
"is_pdu": false,
"is_network_device": true,
"subdevice_role": null,
"comments": "",
"custom_fields": {},
"instance_count": 2
},
{
"id": 4,
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "QFX5100-48S",
"slug": "qfx5100-48s",
"part_number": "",
"u_height": 1,
"is_full_depth": true,
"interface_ordering": {
"value": 1,
"label": "Slot/position"
},
"is_console_server": false,
"is_pdu": false,
"is_network_device": true,
"subdevice_role": null,
"comments": "",
"custom_fields": {},
"instance_count": 2
},
{
"id": 5,
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148",
"part_number": "",
"u_height": 1,
"is_full_depth": true,
"interface_ordering": {
"value": 1,
"label": "Slot/position"
},
"is_console_server": true,
"is_pdu": false,
"is_network_device": false,
"subdevice_role": null,
"comments": "",
"custom_fields": {},
"instance_count": 1
},
{
"id": 6,
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9",
"part_number": "",
"u_height": 0,
"is_full_depth": false,
"interface_ordering": {
"value": 1,
"label": "Slot/position"
},
"is_console_server": false,
"is_pdu": true,
"is_network_device": false,
"subdevice_role": null,
"comments": "",
"custom_fields": {},
"instance_count": 2
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/devices.json 0000644 0001751 0000177 00000053055 14706740105 021260 0 ustar 00runner docker {
"count": 11,
"next": null,
"previous": null,
"results": [
{
"id": 2,
"name": "test1-core1",
"display_name": "test1-core1",
"device_type": {
"id": 2,
"url": "http://localhost:8000/api/dcim/device-types/2/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "EX9214",
"slug": "ex9214"
},
"role": {
"id": 3,
"url": "http://localhost:8000/api/dcim/device-roles/3/",
"name": "Core Switch",
"slug": "core-switch"
},
"tenant": null,
"platform": {
"id": 1,
"url": "http://localhost:8000/api/dcim/platforms/1/",
"name": "Juniper Junos",
"slug": "juniper-junos"
},
"serial": "",
"asset_tag": null,
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"rack": {
"id": 1,
"url": "http://localhost:8000/api/dcim/racks/1/",
"name": "A1R1",
"display_name": "A1R1 (T23A01)"
},
"position": 17,
"face": {
"value": 0,
"label": "Front"
},
"parent_device": null,
"status": {
"value": true,
"label": "Active"
},
"primary_ip": {
"id": 5,
"url": "http://localhost:8000/api/ipam/ip-addresses/5/",
"family": 4,
"address": "10.0.254.1/24"
},
"primary_ip4": {
"id": 5,
"url": "http://localhost:8000/api/ipam/ip-addresses/5/",
"family": 4,
"address": "10.0.254.1/24"
},
"primary_ip6": null,
"comments": "",
"custom_fields": {}
},
{
"id": 8,
"name": "test1-core2",
"display_name": "test1-core2",
"device_type": {
"id": 2,
"url": "http://localhost:8000/api/dcim/device-types/2/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "EX9214",
"slug": "ex9214"
},
"role": {
"id": 3,
"url": "http://localhost:8000/api/dcim/device-roles/3/",
"name": "Core Switch",
"slug": "core-switch"
},
"tenant": null,
"platform": {
"id": 1,
"url": "http://localhost:8000/api/dcim/platforms/1/",
"name": "Juniper Junos",
"slug": "juniper-junos"
},
"serial": "67856734534",
"asset_tag": null,
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"rack": {
"id": 2,
"url": "http://localhost:8000/api/dcim/racks/2/",
"name": "A1R2",
"display_name": "A1R2 (T24A01)"
},
"position": 17,
"face": {
"value": 0,
"label": "Front"
},
"parent_device": null,
"status": {
"value": true,
"label": "Active"
},
"primary_ip": {
"id": 19,
"url": "http://localhost:8000/api/ipam/ip-addresses/19/",
"family": 4,
"address": "10.0.254.2/32"
},
"primary_ip4": {
"id": 19,
"url": "http://localhost:8000/api/ipam/ip-addresses/19/",
"family": 4,
"address": "10.0.254.2/32"
},
"primary_ip6": null,
"comments": "",
"custom_fields": {}
},
{
"id": 1,
"name": "test1-edge1",
"display_name": "test1-edge1",
"device_type": {
"id": 1,
"url": "http://localhost:8000/api/dcim/device-types/1/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "MX960",
"slug": "mx960"
},
"role": {
"id": 1,
"url": "http://localhost:8000/api/dcim/device-roles/1/",
"name": "Router",
"slug": "router"
},
"tenant": null,
"platform": {
"id": 1,
"url": "http://localhost:8000/api/dcim/platforms/1/",
"name": "Juniper Junos",
"slug": "juniper-junos"
},
"serial": "5555555555",
"asset_tag": null,
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"rack": {
"id": 1,
"url": "http://localhost:8000/api/dcim/racks/1/",
"name": "A1R1",
"display_name": "A1R1 (T23A01)"
},
"position": 1,
"face": {
"value": 0,
"label": "Front"
},
"parent_device": null,
"status": {
"value": true,
"label": "Active"
},
"primary_ip": {
"id": 1,
"url": "http://localhost:8000/api/ipam/ip-addresses/1/",
"family": 4,
"address": "10.0.255.1/32"
},
"primary_ip4": {
"id": 1,
"url": "http://localhost:8000/api/ipam/ip-addresses/1/",
"family": 4,
"address": "10.0.255.1/32"
},
"primary_ip6": null,
"comments": "",
"custom_fields": {}
},
{
"id": 7,
"name": "test1-edge2",
"display_name": "test1-edge2",
"device_type": {
"id": 1,
"url": "http://localhost:8000/api/dcim/device-types/1/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "MX960",
"slug": "mx960"
},
"role": {
"id": 1,
"url": "http://localhost:8000/api/dcim/device-roles/1/",
"name": "Router",
"slug": "router"
},
"tenant": null,
"platform": {
"id": 1,
"url": "http://localhost:8000/api/dcim/platforms/1/",
"name": "Juniper Junos",
"slug": "juniper-junos"
},
"serial": "7567356345",
"asset_tag": null,
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"rack": {
"id": 2,
"url": "http://localhost:8000/api/dcim/racks/2/",
"name": "A1R2",
"display_name": "A1R2 (T24A01)"
},
"position": 1,
"face": {
"value": 0,
"label": "Front"
},
"parent_device": null,
"status": {
"value": true,
"label": "Active"
},
"primary_ip": {
"id": 3,
"url": "http://localhost:8000/api/ipam/ip-addresses/3/",
"family": 4,
"address": "10.0.255.2/32"
},
"primary_ip4": {
"id": 3,
"url": "http://localhost:8000/api/ipam/ip-addresses/3/",
"family": 4,
"address": "10.0.255.2/32"
},
"primary_ip6": null,
"comments": "",
"custom_fields": {}
},
{
"id": 4,
"name": "test1-leaf1",
"display_name": "test1-leaf1",
"device_type": {
"id": 4,
"url": "http://localhost:8000/api/dcim/device-types/4/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "QFX5100-48S",
"slug": "qfx5100-48s"
},
"role": {
"id": 4,
"url": "http://localhost:8000/api/dcim/device-roles/4/",
"name": "Leaf Switch",
"slug": "leaf-switch"
},
"tenant": null,
"platform": {
"id": 1,
"url": "http://localhost:8000/api/dcim/platforms/1/",
"name": "Juniper Junos",
"slug": "juniper-junos"
},
"serial": "",
"asset_tag": null,
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"rack": {
"id": 1,
"url": "http://localhost:8000/api/dcim/racks/1/",
"name": "A1R1",
"display_name": "A1R1 (T23A01)"
},
"position": 34,
"face": {
"value": 0,
"label": "Front"
},
"parent_device": null,
"status": {
"value": true,
"label": "Active"
},
"primary_ip": null,
"primary_ip4": null,
"primary_ip6": null,
"comments": "",
"custom_fields": {}
},
{
"id": 5,
"name": "test1-leaf2",
"display_name": "test1-leaf2",
"device_type": {
"id": 4,
"url": "http://localhost:8000/api/dcim/device-types/4/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "QFX5100-48S",
"slug": "qfx5100-48s"
},
"role": {
"id": 4,
"url": "http://localhost:8000/api/dcim/device-roles/4/",
"name": "Leaf Switch",
"slug": "leaf-switch"
},
"tenant": null,
"platform": {
"id": 1,
"url": "http://localhost:8000/api/dcim/platforms/1/",
"name": "Juniper Junos",
"slug": "juniper-junos"
},
"serial": "9823478293748",
"asset_tag": null,
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"rack": {
"id": 2,
"url": "http://localhost:8000/api/dcim/racks/2/",
"name": "A1R2",
"display_name": "A1R2 (T24A01)"
},
"position": 34,
"face": {
"value": 0,
"label": "Front"
},
"parent_device": null,
"status": {
"value": true,
"label": "Active"
},
"primary_ip": null,
"primary_ip4": null,
"primary_ip6": null,
"comments": "",
"custom_fields": {}
},
{
"id": 9,
"name": "test1-oob1",
"display_name": "test1-oob1",
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"role": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-roles/5/",
"name": "OOB Switch",
"slug": "oob-switch"
},
"tenant": null,
"platform": {
"id": 2,
"url": "http://localhost:8000/api/dcim/platforms/2/",
"name": "Opengear",
"slug": "opengear"
},
"serial": "98273942938",
"asset_tag": null,
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"rack": {
"id": 1,
"url": "http://localhost:8000/api/dcim/racks/1/",
"name": "A1R1",
"display_name": "A1R1 (T23A01)"
},
"position": 42,
"face": {
"value": 0,
"label": "Front"
},
"parent_device": null,
"status": {
"value": true,
"label": "Active"
},
"primary_ip": null,
"primary_ip4": null,
"primary_ip6": null,
"comments": "",
"custom_fields": {}
},
{
"id": 11,
"name": "test1-pdu1",
"display_name": "test1-pdu1",
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"role": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-roles/6/",
"name": "PDU",
"slug": "pdu"
},
"tenant": null,
"platform": null,
"serial": "",
"asset_tag": null,
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"rack": {
"id": 1,
"url": "http://localhost:8000/api/dcim/racks/1/",
"name": "A1R1",
"display_name": "A1R1 (T23A01)"
},
"position": null,
"face": null,
"parent_device": null,
"status": {
"value": true,
"label": "Active"
},
"primary_ip": null,
"primary_ip4": null,
"primary_ip6": null,
"comments": "",
"custom_fields": {}
},
{
"id": 12,
"name": "test1-pdu2",
"display_name": "test1-pdu2",
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"role": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-roles/6/",
"name": "PDU",
"slug": "pdu"
},
"tenant": null,
"platform": null,
"serial": "",
"asset_tag": null,
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"rack": {
"id": 2,
"url": "http://localhost:8000/api/dcim/racks/2/",
"name": "A1R2",
"display_name": "A1R2 (T24A01)"
},
"position": null,
"face": null,
"parent_device": null,
"status": {
"value": true,
"label": "Active"
},
"primary_ip": null,
"primary_ip4": null,
"primary_ip6": null,
"comments": "",
"custom_fields": {}
},
{
"id": 3,
"name": "test1-spine1",
"display_name": "test1-spine1",
"device_type": {
"id": 3,
"url": "http://localhost:8000/api/dcim/device-types/3/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "QFX5100-24Q",
"slug": "qfx5100-24q"
},
"role": {
"id": 2,
"url": "http://localhost:8000/api/dcim/device-roles/2/",
"name": "Spine Switch",
"slug": "spine-switch"
},
"tenant": null,
"platform": {
"id": 1,
"url": "http://localhost:8000/api/dcim/platforms/1/",
"name": "Juniper Junos",
"slug": "juniper-junos"
},
"serial": "",
"asset_tag": null,
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"rack": {
"id": 1,
"url": "http://localhost:8000/api/dcim/racks/1/",
"name": "A1R1",
"display_name": "A1R1 (T23A01)"
},
"position": 33,
"face": {
"value": 0,
"label": "Front"
},
"parent_device": null,
"status": {
"value": true,
"label": "Active"
},
"primary_ip": null,
"primary_ip4": null,
"primary_ip6": null,
"comments": "",
"custom_fields": {}
},
{
"id": 6,
"name": "test1-spine2",
"display_name": "test1-spine2",
"device_type": {
"id": 3,
"url": "http://localhost:8000/api/dcim/device-types/3/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "QFX5100-24Q",
"slug": "qfx5100-24q"
},
"role": {
"id": 2,
"url": "http://localhost:8000/api/dcim/device-roles/2/",
"name": "Spine Switch",
"slug": "spine-switch"
},
"tenant": null,
"platform": {
"id": 1,
"url": "http://localhost:8000/api/dcim/platforms/1/",
"name": "Juniper Junos",
"slug": "juniper-junos"
},
"serial": "45649818158",
"asset_tag": null,
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"rack": {
"id": 2,
"url": "http://localhost:8000/api/dcim/racks/2/",
"name": "A1R2",
"display_name": "A1R2 (T24A01)"
},
"position": 33,
"face": {
"value": 0,
"label": "Front"
},
"parent_device": null,
"status": {
"value": true,
"label": "Active"
},
"primary_ip": null,
"primary_ip4": null,
"primary_ip6": null,
"comments": "",
"custom_fields": {}
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/interface.json 0000644 0001751 0000177 00000002724 14706740105 021573 0 ustar 00runner docker {
"id": 1,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "et-0/0/0",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"enabled": true,
"lag": {
"id": 223,
"url": "http://localhost:8000/api/dcim/interfaces/223/",
"name": "ae0"
},
"mtu": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"is_connected": true,
"connected_endpoints": [
{
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"display": "tst-endpoint",
"name": "tst-endpoint"
}
],
"connected_endpoints_type": "dcim.device",
"connected_endpoints_reachable": true,
"cable": {
"id": 1,
"url": "http://localhost:8000/api/dcim/cables/1/",
"label": ""
},
"mode": {
"value": "tagged",
"label": "Tagged",
"id": 200
},
"untagged_vlan": {
"id": 2,
"url": "http://localhost:8000/api/ipam/vlans/792/",
"vid": 2069,
"name": "v2069",
"display_name": "2069 (v2069)"
},
"tagged_vlans": [
{
"id": 3,
"url": "http://localhost:8000/api/ipam/vlans/248/",
"vid": 1210,
"name": "v1210",
"display_name": "1210 (v1210)"
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/interface_connection.json 0000644 0001751 0000177 00000001737 14706740105 024015 0 ustar 00runner docker {
"id": 1,
"interface_a": {
"id": 99,
"url": "http://localhost:8000/api/dcim/interfaces/99/",
"device": {
"id": 5,
"url": "http://localhost:8000/api/dcim/devices/5/",
"name": "test1-leaf2",
"display_name": "test1-leaf2"
},
"name": "et-0/0/48",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"interface_b": {
"id": 15,
"url": "http://localhost:8000/api/dcim/interfaces/15/",
"device": {
"id": 3,
"url": "http://localhost:8000/api/dcim/devices/3/",
"name": "test1-spine1",
"display_name": "test1-spine1"
},
"name": "et-0/0/1",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"connection_status": {
"value": true,
"label": "Connected"
}
}
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/interface_connections.json 0000644 0001751 0000177 00000052760 14706740105 024202 0 ustar 00runner docker {
"count": 17,
"next": null,
"previous": null,
"results": [
{
"id": 22,
"interface_a": {
"id": 9,
"url": "http://localhost:8000/api/dcim/interfaces/9/",
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "xe-0/0/5",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"interface_b": {
"id": 218,
"url": "http://localhost:8000/api/dcim/interfaces/218/",
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "xe-0/0/5",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"connection_status": {
"value": true,
"label": "Connected"
}
},
{
"id": 23,
"interface_a": {
"id": 8,
"url": "http://localhost:8000/api/dcim/interfaces/8/",
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "xe-0/0/4",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"interface_b": {
"id": 206,
"url": "http://localhost:8000/api/dcim/interfaces/206/",
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "xe-0/0/5",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"connection_status": {
"value": true,
"label": "Connected"
}
},
{
"id": 24,
"interface_a": {
"id": 7,
"url": "http://localhost:8000/api/dcim/interfaces/7/",
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "xe-0/0/3",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"interface_b": {
"id": 212,
"url": "http://localhost:8000/api/dcim/interfaces/212/",
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "xe-0/0/5",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"connection_status": {
"value": true,
"label": "Connected"
}
},
{
"id": 21,
"interface_a": {
"id": 194,
"url": "http://localhost:8000/api/dcim/interfaces/194/",
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "et-0/1/2",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"interface_b": {
"id": 200,
"url": "http://localhost:8000/api/dcim/interfaces/200/",
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "et-0/1/2",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"connection_status": {
"value": true,
"label": "Connected"
}
},
{
"id": 17,
"interface_a": {
"id": 192,
"url": "http://localhost:8000/api/dcim/interfaces/192/",
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "et-0/1/0",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"interface_b": {
"id": 175,
"url": "http://localhost:8000/api/dcim/interfaces/175/",
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/1/0",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"connection_status": {
"value": true,
"label": "Connected"
}
},
{
"id": 20,
"interface_a": {
"id": 191,
"url": "http://localhost:8000/api/dcim/interfaces/191/",
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "et-0/0/2",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"interface_b": {
"id": 197,
"url": "http://localhost:8000/api/dcim/interfaces/197/",
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "et-0/0/2",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"connection_status": {
"value": true,
"label": "Connected"
}
},
{
"id": 16,
"interface_a": {
"id": 189,
"url": "http://localhost:8000/api/dcim/interfaces/189/",
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "et-0/0/0",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"interface_b": {
"id": 37,
"url": "http://localhost:8000/api/dcim/interfaces/37/",
"device": {
"id": 3,
"url": "http://localhost:8000/api/dcim/devices/3/",
"name": "test1-spine1",
"display_name": "test1-spine1"
},
"name": "et-0/1/0",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"connection_status": {
"value": true,
"label": "Connected"
}
},
{
"id": 8,
"interface_a": {
"id": 92,
"url": "http://localhost:8000/api/dcim/interfaces/92/",
"device": {
"id": 4,
"url": "http://localhost:8000/api/dcim/devices/4/",
"name": "test1-leaf1",
"display_name": "test1-leaf1"
},
"name": "xe-0/0/47",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"interface_b": {
"id": 145,
"url": "http://localhost:8000/api/dcim/interfaces/145/",
"device": {
"id": 5,
"url": "http://localhost:8000/api/dcim/devices/5/",
"name": "test1-leaf2",
"display_name": "test1-leaf2"
},
"name": "xe-0/0/47",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"connection_status": {
"value": true,
"label": "Connected"
}
},
{
"id": 7,
"interface_a": {
"id": 91,
"url": "http://localhost:8000/api/dcim/interfaces/91/",
"device": {
"id": 4,
"url": "http://localhost:8000/api/dcim/devices/4/",
"name": "test1-leaf1",
"display_name": "test1-leaf1"
},
"name": "xe-0/0/46",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"interface_b": {
"id": 144,
"url": "http://localhost:8000/api/dcim/interfaces/144/",
"device": {
"id": 5,
"url": "http://localhost:8000/api/dcim/devices/5/",
"name": "test1-leaf2",
"display_name": "test1-leaf2"
},
"name": "xe-0/0/46",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"connection_status": {
"value": true,
"label": "Connected"
}
},
{
"id": 6,
"interface_a": {
"id": 47,
"url": "http://localhost:8000/api/dcim/interfaces/47/",
"device": {
"id": 4,
"url": "http://localhost:8000/api/dcim/devices/4/",
"name": "test1-leaf1",
"display_name": "test1-leaf1"
},
"name": "et-0/0/49",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"interface_b": {
"id": 152,
"url": "http://localhost:8000/api/dcim/interfaces/152/",
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/0",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"connection_status": {
"value": true,
"label": "Connected"
}
},
{
"id": 5,
"interface_a": {
"id": 46,
"url": "http://localhost:8000/api/dcim/interfaces/46/",
"device": {
"id": 4,
"url": "http://localhost:8000/api/dcim/devices/4/",
"name": "test1-leaf1",
"display_name": "test1-leaf1"
},
"name": "et-0/0/48",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"interface_b": {
"id": 14,
"url": "http://localhost:8000/api/dcim/interfaces/14/",
"device": {
"id": 3,
"url": "http://localhost:8000/api/dcim/devices/3/",
"name": "test1-spine1",
"display_name": "test1-spine1"
},
"name": "et-0/0/0",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"connection_status": {
"value": true,
"label": "Connected"
}
},
{
"id": 4,
"interface_a": {
"id": 100,
"url": "http://localhost:8000/api/dcim/interfaces/100/",
"device": {
"id": 5,
"url": "http://localhost:8000/api/dcim/devices/5/",
"name": "test1-leaf2",
"display_name": "test1-leaf2"
},
"name": "et-0/0/49",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"interface_b": {
"id": 153,
"url": "http://localhost:8000/api/dcim/interfaces/153/",
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/1",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"connection_status": {
"value": true,
"label": "Connected"
}
},
{
"id": 3,
"interface_a": {
"id": 99,
"url": "http://localhost:8000/api/dcim/interfaces/99/",
"device": {
"id": 5,
"url": "http://localhost:8000/api/dcim/devices/5/",
"name": "test1-leaf2",
"display_name": "test1-leaf2"
},
"name": "et-0/0/48",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"interface_b": {
"id": 15,
"url": "http://localhost:8000/api/dcim/interfaces/15/",
"device": {
"id": 3,
"url": "http://localhost:8000/api/dcim/devices/3/",
"name": "test1-spine1",
"display_name": "test1-spine1"
},
"name": "et-0/0/1",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"connection_status": {
"value": true,
"label": "Connected"
}
},
{
"id": 25,
"interface_a": {
"id": 217,
"url": "http://localhost:8000/api/dcim/interfaces/217/",
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "xe-0/0/4",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"interface_b": {
"id": 205,
"url": "http://localhost:8000/api/dcim/interfaces/205/",
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "xe-0/0/4",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"connection_status": {
"value": true,
"label": "Connected"
}
},
{
"id": 26,
"interface_a": {
"id": 216,
"url": "http://localhost:8000/api/dcim/interfaces/216/",
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "xe-0/0/3",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"interface_b": {
"id": 211,
"url": "http://localhost:8000/api/dcim/interfaces/211/",
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "xe-0/0/4",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"connection_status": {
"value": true,
"label": "Connected"
}
},
{
"id": 19,
"interface_a": {
"id": 198,
"url": "http://localhost:8000/api/dcim/interfaces/198/",
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "et-0/1/0",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"interface_b": {
"id": 179,
"url": "http://localhost:8000/api/dcim/interfaces/179/",
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/2/0",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"connection_status": {
"value": true,
"label": "Connected"
}
},
{
"id": 18,
"interface_a": {
"id": 195,
"url": "http://localhost:8000/api/dcim/interfaces/195/",
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "et-0/0/0",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"interface_b": {
"id": 41,
"url": "http://localhost:8000/api/dcim/interfaces/41/",
"device": {
"id": 3,
"url": "http://localhost:8000/api/dcim/devices/3/",
"name": "test1-spine1",
"display_name": "test1-spine1"
},
"name": "et-0/2/0",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
},
"connection_status": {
"value": true,
"label": "Connected"
}
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/interface_template.json 0000644 0001751 0000177 00000000764 14706740105 023470 0 ustar 00runner docker {
"id": 1,
"device_type": {
"id": 1,
"url": "http://localhost:8000/api/dcim/device-types/1/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "MX960",
"slug": "mx960"
},
"name": "fxp0 (RE0)",
"form_factor": {
"value": 1000,
"label": "1000BASE-T (1GE)"
},
"mgmt_only": true
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/interface_templates.json 0000644 0001751 0000177 00000002621 14706740105 023645 0 ustar 00runner docker {
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 4,
"device_type": {
"id": 2,
"url": "http://localhost:8000/api/dcim/device-types/2/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "EX9214",
"slug": "ex9214"
},
"name": "fxp0 (RE0)",
"form_factor": {
"value": 1000,
"label": "1000BASE-T (1GE)"
},
"mgmt_only": true
},
{
"id": 5,
"device_type": {
"id": 2,
"url": "http://localhost:8000/api/dcim/device-types/2/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "EX9214",
"slug": "ex9214"
},
"name": "fxp0 (RE1)",
"form_factor": {
"value": 1000,
"label": "1000BASE-T (1GE)"
},
"mgmt_only": true
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/interface_trace.json 0000644 0001751 0000177 00000006770 14706740105 022756 0 ustar 00runner docker [
[
{
"id": 39126,
"url": "http://localhost:8000/api/dcim/interfaces/39126/",
"device": {
"id": 4747,
"url": "http://localhost:8000/api/dcim/devices/4747/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "em1",
"cable": 9911,
"connection_status": {
"value": false,
"label": "Not Connected"
}
},
{
"id": 9911,
"url": "http://localhost:8000/api/dcim/cables/9911/",
"type": "",
"status": "planned",
"label": "",
"color": "",
"length": null,
"length_unit": ""
},
{
"id": 5583,
"url": "http://localhost:8000/api/dcim/front-ports/5583/",
"device": {
"id": 4430,
"url": "http://localhost:8000/api/dcim/devices/4430/",
"name": "test1-patchpanel1",
"display_name": "test1-patchpanel1"
},
"name": "pair-11 (ports 21-22)",
"cable": 9911
}
],
[
{
"id": 3736,
"url": "http://localhost:8000/api/dcim/rear-ports/3736/",
"device": {
"id": 4430,
"url": "http://localhost:8000/api/dcim/devices/4430/",
"name": "test1-patchpanel1",
"display_name": "test1-patchpanel1"
},
"name": "port-2",
"cable": 9229
},
{
"id": 9229,
"url": "http://localhost:8000/api/dcim/cables/9229/",
"type": "mmf-om4",
"status": "planned",
"label": "",
"color": "",
"length": null,
"length_unit": ""
},
{
"id": 3768,
"url": "http://localhost:8000/api/dcim/rear-ports/3768/",
"device": {
"id": 4436,
"url": "http://localhost:8000/api/dcim/devices/4436/",
"name": "test1-patchpanel2",
"display_name": "test1-patchpanel2"
},
"name": "port-2",
"cable": 9229
}
],
[
{
"id": 5655,
"url": "http://localhost:8000/api/dcim/front-ports/5655/",
"device": {
"id": 4436,
"url": "http://localhost:8000/api/dcim/devices/4436/",
"name": "test1-patchpanel2",
"display_name": "test1-patchpanel2"
},
"name": "pair-11 (ports 21-22)",
"cable": 9240
},
{
"id": 9240,
"url": "http://localhost:8000/api/dcim/cables/9240/",
"type": "mmf-om4",
"status": "planned",
"label": "",
"color": "",
"length": null,
"length_unit": ""
},
{
"id": 35473,
"url": "http://localhost:8000/api/dcim/interfaces/35473/",
"device": {
"id": 3930,
"url": "http://localhost:8000/api/dcim/devices/3930/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "Ethernet11",
"cable": 9240,
"connection_status": {
"value": false,
"label": "Not Connected"
}
}
]
]
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/interfaces.json 0000644 0001751 0000177 00000033567 14706740105 021767 0 ustar 00runner docker {
"count": 221,
"next": null,
"previous": "http://localhost:8000/api/dcim/interfaces/?limit=50&offset=150",
"results": [
{
"id": 162,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/18",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 163,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/19",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 164,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/2",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 165,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/20",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 166,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/21",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 167,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/22",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 168,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/3",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 169,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/4",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 170,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/5",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 171,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/6",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 172,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/7",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 173,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/8",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 174,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/9",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 175,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/1/0",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 17,
"url": "http://localhost:8000/api/dcim/interface-connections/17/",
"connection_status": true
},
"connected_interface": {
"id": 192,
"url": "http://localhost:8000/api/dcim/interfaces/192/",
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "et-0/1/0",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 176,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/1/1",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 177,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/1/2",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 178,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/1/3",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 179,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/2/0",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 19,
"url": "http://localhost:8000/api/dcim/interface-connections/19/",
"connection_status": true
},
"connected_interface": {
"id": 198,
"url": "http://localhost:8000/api/dcim/interfaces/198/",
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "et-0/1/0",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 180,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/2/1",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 181,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/2/2",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 182,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/2/3",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/interfaces_1.json 0000644 0001751 0000177 00000124507 14706740105 022202 0 ustar 00runner docker {
"count": 221,
"next": "http://localhost:8000/api/dcim/interfaces/?limit=50&offset=50",
"previous": null,
"results": [
{
"id": 189,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "et-0/0/0",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 16,
"url": "http://localhost:8000/api/dcim/interface-connections/16/",
"connection_status": true
},
"connected_interface": {
"id": 37,
"url": "http://localhost:8000/api/dcim/interfaces/37/",
"device": {
"id": 3,
"url": "http://localhost:8000/api/dcim/devices/3/",
"name": "test1-spine1",
"display_name": "test1-spine1"
},
"name": "et-0/1/0",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 190,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "et-0/0/1",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 191,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "et-0/0/2",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 20,
"url": "http://localhost:8000/api/dcim/interface-connections/20/",
"connection_status": true
},
"connected_interface": {
"id": 197,
"url": "http://localhost:8000/api/dcim/interfaces/197/",
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "et-0/0/2",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 192,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "et-0/1/0",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 17,
"url": "http://localhost:8000/api/dcim/interface-connections/17/",
"connection_status": true
},
"connected_interface": {
"id": 175,
"url": "http://localhost:8000/api/dcim/interfaces/175/",
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/1/0",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 193,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "et-0/1/1",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 194,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "et-0/1/2",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 21,
"url": "http://localhost:8000/api/dcim/interface-connections/21/",
"connection_status": true
},
"connected_interface": {
"id": 200,
"url": "http://localhost:8000/api/dcim/interfaces/200/",
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "et-0/1/2",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 10,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "fxp0 (RE0)",
"form_factor": {
"value": 1000,
"label": "1000BASE-T (1GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": true,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 11,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "fxp0 (RE1)",
"form_factor": {
"value": 1000,
"label": "1000BASE-T (1GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": true,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 12,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "lo0",
"form_factor": {
"value": 0,
"label": "Virtual"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 201,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "xe-0/0/0",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 202,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "xe-0/0/1",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 203,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "xe-0/0/2",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 204,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "xe-0/0/3",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 205,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "xe-0/0/4",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 25,
"url": "http://localhost:8000/api/dcim/interface-connections/25/",
"connection_status": true
},
"connected_interface": {
"id": 217,
"url": "http://localhost:8000/api/dcim/interfaces/217/",
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "xe-0/0/4",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 206,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "xe-0/0/5",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 23,
"url": "http://localhost:8000/api/dcim/interface-connections/23/",
"connection_status": true
},
"connected_interface": {
"id": 8,
"url": "http://localhost:8000/api/dcim/interfaces/8/",
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "xe-0/0/4",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 195,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "et-0/0/0",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 18,
"url": "http://localhost:8000/api/dcim/interface-connections/18/",
"connection_status": true
},
"connected_interface": {
"id": 41,
"url": "http://localhost:8000/api/dcim/interfaces/41/",
"device": {
"id": 3,
"url": "http://localhost:8000/api/dcim/devices/3/",
"name": "test1-spine1",
"display_name": "test1-spine1"
},
"name": "et-0/2/0",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 196,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "et-0/0/1",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 197,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "et-0/0/2",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 20,
"url": "http://localhost:8000/api/dcim/interface-connections/20/",
"connection_status": true
},
"connected_interface": {
"id": 191,
"url": "http://localhost:8000/api/dcim/interfaces/191/",
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "et-0/0/2",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 198,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "et-0/1/0",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 19,
"url": "http://localhost:8000/api/dcim/interface-connections/19/",
"connection_status": true
},
"connected_interface": {
"id": 179,
"url": "http://localhost:8000/api/dcim/interfaces/179/",
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/2/0",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 199,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "et-0/1/1",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 200,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "et-0/1/2",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 21,
"url": "http://localhost:8000/api/dcim/interface-connections/21/",
"connection_status": true
},
"connected_interface": {
"id": 194,
"url": "http://localhost:8000/api/dcim/interfaces/194/",
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "et-0/1/2",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 186,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "fxp0 (RE0)",
"form_factor": {
"value": 1000,
"label": "1000BASE-T (1GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": true,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 187,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "fxp0 (RE1)",
"form_factor": {
"value": 1000,
"label": "1000BASE-T (1GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": true,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 188,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "lo0",
"form_factor": {
"value": 0,
"label": "Virtual"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 207,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "xe-0/0/0",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 208,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "xe-0/0/1",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 209,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "xe-0/0/2",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 210,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "xe-0/0/3",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 211,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "xe-0/0/4",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 26,
"url": "http://localhost:8000/api/dcim/interface-connections/26/",
"connection_status": true
},
"connected_interface": {
"id": 216,
"url": "http://localhost:8000/api/dcim/interfaces/216/",
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "xe-0/0/3",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 212,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "xe-0/0/5",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 24,
"url": "http://localhost:8000/api/dcim/interface-connections/24/",
"connection_status": true
},
"connected_interface": {
"id": 7,
"url": "http://localhost:8000/api/dcim/interfaces/7/",
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "xe-0/0/3",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 1,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "fxp0 (RE0)",
"form_factor": {
"value": 1000,
"label": "1000BASE-T (1GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": true,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 2,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "fxp0 (RE1)",
"form_factor": {
"value": 800,
"label": "100BASE-TX (10/100ME)"
},
"lag": null,
"mac_address": null,
"mgmt_only": true,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 3,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "lo0",
"form_factor": {
"value": 0,
"label": "Virtual"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 4,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "xe-0/0/0",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "TEST",
"connection": null,
"connected_interface": null
},
{
"id": 5,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "xe-0/0/1",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 6,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "xe-0/0/2",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 7,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "xe-0/0/3",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 24,
"url": "http://localhost:8000/api/dcim/interface-connections/24/",
"connection_status": true
},
"connected_interface": {
"id": 212,
"url": "http://localhost:8000/api/dcim/interfaces/212/",
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "xe-0/0/5",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 8,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "xe-0/0/4",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 23,
"url": "http://localhost:8000/api/dcim/interface-connections/23/",
"connection_status": true
},
"connected_interface": {
"id": 206,
"url": "http://localhost:8000/api/dcim/interfaces/206/",
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "xe-0/0/5",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 9,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "xe-0/0/5",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 22,
"url": "http://localhost:8000/api/dcim/interface-connections/22/",
"connection_status": true
},
"connected_interface": {
"id": 218,
"url": "http://localhost:8000/api/dcim/interfaces/218/",
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "xe-0/0/5",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 183,
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "fxp0 (RE0)",
"form_factor": {
"value": 1000,
"label": "1000BASE-T (1GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": true,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 184,
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "fxp0 (RE1)",
"form_factor": {
"value": 800,
"label": "100BASE-TX (10/100ME)"
},
"lag": null,
"mac_address": null,
"mgmt_only": true,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 185,
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "lo0",
"form_factor": {
"value": 0,
"label": "Virtual"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 213,
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "xe-0/0/0",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 214,
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "xe-0/0/1",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 215,
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "xe-0/0/2",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 216,
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "xe-0/0/3",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 26,
"url": "http://localhost:8000/api/dcim/interface-connections/26/",
"connection_status": true
},
"connected_interface": {
"id": 211,
"url": "http://localhost:8000/api/dcim/interfaces/211/",
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "xe-0/0/4",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 217,
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "xe-0/0/4",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 25,
"url": "http://localhost:8000/api/dcim/interface-connections/25/",
"connection_status": true
},
"connected_interface": {
"id": 205,
"url": "http://localhost:8000/api/dcim/interfaces/205/",
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "xe-0/0/4",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 218,
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "xe-0/0/5",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 22,
"url": "http://localhost:8000/api/dcim/interface-connections/22/",
"connection_status": true
},
"connected_interface": {
"id": 9,
"url": "http://localhost:8000/api/dcim/interfaces/9/",
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "xe-0/0/5",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 45,
"device": {
"id": 4,
"url": "http://localhost:8000/api/dcim/devices/4/",
"name": "test1-leaf1",
"display_name": "test1-leaf1"
},
"name": "em0",
"form_factor": {
"value": 1000,
"label": "1000BASE-T (1GE)"
},
"lag": null,
"mac_address": "FF:EE:DD:33:22:11",
"mgmt_only": true,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 46,
"device": {
"id": 4,
"url": "http://localhost:8000/api/dcim/devices/4/",
"name": "test1-leaf1",
"display_name": "test1-leaf1"
},
"name": "et-0/0/48",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 5,
"url": "http://localhost:8000/api/dcim/interface-connections/5/",
"connection_status": true
},
"connected_interface": {
"id": 14,
"url": "http://localhost:8000/api/dcim/interfaces/14/",
"device": {
"id": 3,
"url": "http://localhost:8000/api/dcim/devices/3/",
"name": "test1-spine1",
"display_name": "test1-spine1"
},
"name": "et-0/0/0",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/interfaces_2.json 0000644 0001751 0000177 00000033567 14706740105 022210 0 ustar 00runner docker {
"count": 221,
"next": null,
"previous": "http://localhost:8000/api/dcim/interfaces/?limit=50&offset=150",
"results": [
{
"id": 162,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/18",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 163,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/19",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 164,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/2",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 165,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/20",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 166,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/21",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 167,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/22",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 168,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/3",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 169,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/4",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 170,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/5",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 171,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/6",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 172,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/7",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 173,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/8",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 174,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/0/9",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 175,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/1/0",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 17,
"url": "http://localhost:8000/api/dcim/interface-connections/17/",
"connection_status": true
},
"connected_interface": {
"id": 192,
"url": "http://localhost:8000/api/dcim/interfaces/192/",
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "et-0/1/0",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 176,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/1/1",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 177,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/1/2",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 178,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/1/3",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 179,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/2/0",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 19,
"url": "http://localhost:8000/api/dcim/interface-connections/19/",
"connection_status": true
},
"connected_interface": {
"id": 198,
"url": "http://localhost:8000/api/dcim/interfaces/198/",
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "et-0/1/0",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
{
"id": 180,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/2/1",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 181,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/2/2",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
{
"id": 182,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "et-0/2/3",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/inventory_item.json 0000644 0001751 0000177 00000000036 14706740105 022700 0 ustar 00runner docker {
"detail": "Not found."
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/inventory_items.json 0000644 0001751 0000177 00000000115 14706740105 023061 0 ustar 00runner docker {
"count": 0,
"next": null,
"previous": null,
"results": []
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/manufacturer.json 0000644 0001751 0000177 00000000075 14706740105 022324 0 ustar 00runner docker {
"id": 1,
"name": "Juniper",
"slug": "juniper"
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/manufacturers.json 0000644 0001751 0000177 00000000616 14706740105 022510 0 ustar 00runner docker {
"count": 3,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "Juniper",
"slug": "juniper"
},
{
"id": 2,
"name": "Opengear",
"slug": "opengear"
},
{
"id": 3,
"name": "ServerTech",
"slug": "servertech"
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/napalm.json 0000644 0001751 0000177 00000000446 14706740105 021102 0 ustar 00runner docker {
"get_facts": {
"interface_list": [
"xe-0/0/0"
],
"serial_number": "ABC!@#",
"vendor": "PacketPusher",
"os_version": "1.1",
"hostname": "test-1",
"model": "UnobtaniumX",
"fqdn": "None",
"uptime": 2
}
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/platform.json 0000644 0001751 0000177 00000000154 14706740105 021452 0 ustar 00runner docker {
"id": 1,
"name": "Juniper Junos",
"slug": "juniper-junos",
"rpc_client": "juniper-junos"
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/platforms.json 0000644 0001751 0000177 00000000576 14706740105 021645 0 ustar 00runner docker {
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "Juniper Junos",
"slug": "juniper-junos",
"rpc_client": "juniper-junos"
},
{
"id": 2,
"name": "Opengear",
"slug": "opengear",
"rpc_client": "opengear"
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/power_outlet.json 0000644 0001751 0000177 00000000344 14706740105 022357 0 ustar 00runner docker {
"id": 1,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AA1",
"connected_port": 1
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/power_outlet_template.json 0000644 0001751 0000177 00000000627 14706740105 024256 0 ustar 00runner docker {
"id": 1,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AA1"
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/power_outlet_templates.json 0000644 0001751 0000177 00000031274 14706740105 024443 0 ustar 00runner docker {
"count": 24,
"next": null,
"previous": null,
"results": [
{
"id": 4,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AA1"
},
{
"id": 5,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AA2"
},
{
"id": 6,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AA3"
},
{
"id": 7,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AA4"
},
{
"id": 8,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AA5"
},
{
"id": 9,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AA6"
},
{
"id": 10,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AA7"
},
{
"id": 11,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AA8"
},
{
"id": 12,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AB1"
},
{
"id": 13,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AB2"
},
{
"id": 14,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AB3"
},
{
"id": 15,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AB4"
},
{
"id": 16,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AB5"
},
{
"id": 17,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AB6"
},
{
"id": 18,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AB7"
},
{
"id": 19,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AB8"
},
{
"id": 20,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AC1"
},
{
"id": 21,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AC2"
},
{
"id": 22,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AC3"
},
{
"id": 23,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AC4"
},
{
"id": 24,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AC5"
},
{
"id": 25,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AC6"
},
{
"id": 26,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AC7"
},
{
"id": 27,
"device_type": {
"id": 6,
"url": "http://localhost:8000/api/dcim/device-types/6/",
"manufacturer": {
"id": 3,
"url": "http://localhost:8000/api/dcim/manufacturers/3/",
"name": "ServerTech",
"slug": "servertech"
},
"model": "CWG-24VYM415C9",
"slug": "cwg-24vym415c9"
},
"name": "AC8"
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/power_outlets.json 0000644 0001751 0000177 00000036215 14706740105 022550 0 ustar 00runner docker {
"count": 48,
"next": null,
"previous": null,
"results": [
{
"id": 25,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AA1",
"connected_port": 1
},
{
"id": 26,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AA2",
"connected_port": 5
},
{
"id": 27,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AA3",
"connected_port": 13
},
{
"id": 28,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AA4",
"connected_port": 9
},
{
"id": 29,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AA5",
"connected_port": 16
},
{
"id": 30,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AA6",
"connected_port": 20
},
{
"id": 31,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AA7",
"connected_port": 24
},
{
"id": 32,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AA8",
"connected_port": 12
},
{
"id": 33,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AB1",
"connected_port": null
},
{
"id": 34,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AB2",
"connected_port": null
},
{
"id": 35,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AB3",
"connected_port": null
},
{
"id": 36,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AB4",
"connected_port": null
},
{
"id": 37,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AB5",
"connected_port": null
},
{
"id": 38,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AB6",
"connected_port": null
},
{
"id": 39,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AB7",
"connected_port": null
},
{
"id": 40,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AB8",
"connected_port": null
},
{
"id": 41,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AC1",
"connected_port": null
},
{
"id": 42,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AC2",
"connected_port": null
},
{
"id": 43,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AC3",
"connected_port": null
},
{
"id": 44,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AC4",
"connected_port": null
},
{
"id": 45,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AC5",
"connected_port": null
},
{
"id": 46,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AC6",
"connected_port": null
},
{
"id": 47,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AC7",
"connected_port": null
},
{
"id": 48,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AC8",
"connected_port": null
},
{
"id": 49,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AA1",
"connected_port": 2
},
{
"id": 50,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AA2",
"connected_port": 6
},
{
"id": 51,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AA3",
"connected_port": 14
},
{
"id": 52,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AA4",
"connected_port": 10
},
{
"id": 53,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AA5",
"connected_port": 15
},
{
"id": 54,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AA6",
"connected_port": 19
},
{
"id": 55,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AA7",
"connected_port": 23
},
{
"id": 56,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AA8",
"connected_port": 11
},
{
"id": 57,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AB1",
"connected_port": null
},
{
"id": 58,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AB2",
"connected_port": null
},
{
"id": 59,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AB3",
"connected_port": null
},
{
"id": 60,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AB4",
"connected_port": null
},
{
"id": 61,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AB5",
"connected_port": null
},
{
"id": 62,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AB6",
"connected_port": null
},
{
"id": 63,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AB7",
"connected_port": null
},
{
"id": 64,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AB8",
"connected_port": null
},
{
"id": 65,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AC1",
"connected_port": null
},
{
"id": 66,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AC2",
"connected_port": null
},
{
"id": 67,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AC3",
"connected_port": null
},
{
"id": 68,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AC4",
"connected_port": null
},
{
"id": 69,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AC5",
"connected_port": null
},
{
"id": 70,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AC6",
"connected_port": null
},
{
"id": 71,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AC7",
"connected_port": null
},
{
"id": 72,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AC8",
"connected_port": null
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/power_port.json 0000644 0001751 0000177 00000001016 14706740105 022024 0 ustar 00runner docker {
"id": 1,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "PEM0",
"power_outlet": {
"id": 25,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AA1",
"connected_port": 1
},
"connection_status": true
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/power_port_template.json 0000644 0001751 0000177 00000000600 14706740105 023715 0 ustar 00runner docker {
"id": 1,
"device_type": {
"id": 1,
"url": "http://localhost:8000/api/dcim/device-types/1/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "MX960",
"slug": "mx960"
},
"name": "PEM0"
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/power_port_templates.json 0000644 0001751 0000177 00000015253 14706740105 024112 0 ustar 00runner docker {
"count": 13,
"next": null,
"previous": null,
"results": [
{
"id": 5,
"device_type": {
"id": 2,
"url": "http://localhost:8000/api/dcim/device-types/2/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "EX9214",
"slug": "ex9214"
},
"name": "PEM0"
},
{
"id": 6,
"device_type": {
"id": 2,
"url": "http://localhost:8000/api/dcim/device-types/2/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "EX9214",
"slug": "ex9214"
},
"name": "PEM1"
},
{
"id": 7,
"device_type": {
"id": 2,
"url": "http://localhost:8000/api/dcim/device-types/2/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "EX9214",
"slug": "ex9214"
},
"name": "PEM2"
},
{
"id": 8,
"device_type": {
"id": 2,
"url": "http://localhost:8000/api/dcim/device-types/2/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "EX9214",
"slug": "ex9214"
},
"name": "PEM3"
},
{
"id": 1,
"device_type": {
"id": 1,
"url": "http://localhost:8000/api/dcim/device-types/1/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "MX960",
"slug": "mx960"
},
"name": "PEM0"
},
{
"id": 2,
"device_type": {
"id": 1,
"url": "http://localhost:8000/api/dcim/device-types/1/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "MX960",
"slug": "mx960"
},
"name": "PEM1"
},
{
"id": 3,
"device_type": {
"id": 1,
"url": "http://localhost:8000/api/dcim/device-types/1/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "MX960",
"slug": "mx960"
},
"name": "PEM2"
},
{
"id": 4,
"device_type": {
"id": 1,
"url": "http://localhost:8000/api/dcim/device-types/1/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "MX960",
"slug": "mx960"
},
"name": "PEM3"
},
{
"id": 11,
"device_type": {
"id": 3,
"url": "http://localhost:8000/api/dcim/device-types/3/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "QFX5100-24Q",
"slug": "qfx5100-24q"
},
"name": "PSU0"
},
{
"id": 12,
"device_type": {
"id": 3,
"url": "http://localhost:8000/api/dcim/device-types/3/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "QFX5100-24Q",
"slug": "qfx5100-24q"
},
"name": "PSU1"
},
{
"id": 9,
"device_type": {
"id": 4,
"url": "http://localhost:8000/api/dcim/device-types/4/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "QFX5100-48S",
"slug": "qfx5100-48s"
},
"name": "PSU0"
},
{
"id": 13,
"device_type": {
"id": 4,
"url": "http://localhost:8000/api/dcim/device-types/4/",
"manufacturer": {
"id": 1,
"url": "http://localhost:8000/api/dcim/manufacturers/1/",
"name": "Juniper",
"slug": "juniper"
},
"model": "QFX5100-48S",
"slug": "qfx5100-48s"
},
"name": "PSU1"
},
{
"id": 14,
"device_type": {
"id": 5,
"url": "http://localhost:8000/api/dcim/device-types/5/",
"manufacturer": {
"id": 2,
"url": "http://localhost:8000/api/dcim/manufacturers/2/",
"name": "Opengear",
"slug": "opengear"
},
"model": "CM4148",
"slug": "cm4148"
},
"name": "PSU"
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/power_ports.json 0000644 0001751 0000177 00000034421 14706740105 022215 0 ustar 00runner docker {
"count": 25,
"next": null,
"previous": null,
"results": [
{
"id": 5,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "PEM0",
"power_outlet": {
"id": 26,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AA2",
"connected_port": 5
},
"connection_status": true
},
{
"id": 6,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "PEM1",
"power_outlet": {
"id": 50,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AA2",
"connected_port": 6
},
"connection_status": true
},
{
"id": 7,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "PEM2",
"power_outlet": null,
"connection_status": true
},
{
"id": 8,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "PEM3",
"power_outlet": null,
"connection_status": true
},
{
"id": 19,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "PEM0",
"power_outlet": {
"id": 54,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AA6",
"connected_port": 19
},
"connection_status": true
},
{
"id": 20,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "PEM1",
"power_outlet": {
"id": 30,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AA6",
"connected_port": 20
},
"connection_status": true
},
{
"id": 21,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "PEM2",
"power_outlet": null,
"connection_status": true
},
{
"id": 22,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "PEM3",
"power_outlet": null,
"connection_status": true
},
{
"id": 1,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "PEM0",
"power_outlet": {
"id": 25,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AA1",
"connected_port": 1
},
"connection_status": true
},
{
"id": 2,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "PEM1",
"power_outlet": {
"id": 49,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AA1",
"connected_port": 2
},
"connection_status": true
},
{
"id": 3,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "PEM2",
"power_outlet": null,
"connection_status": true
},
{
"id": 4,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "PEM3",
"power_outlet": null,
"connection_status": true
},
{
"id": 15,
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "PEM0",
"power_outlet": {
"id": 53,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AA5",
"connected_port": 15
},
"connection_status": true
},
{
"id": 16,
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "PEM1",
"power_outlet": {
"id": 29,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AA5",
"connected_port": 16
},
"connection_status": true
},
{
"id": 17,
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "PEM2",
"power_outlet": null,
"connection_status": true
},
{
"id": 18,
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "PEM3",
"power_outlet": null,
"connection_status": true
},
{
"id": 9,
"device": {
"id": 4,
"url": "http://localhost:8000/api/dcim/devices/4/",
"name": "test1-leaf1",
"display_name": "test1-leaf1"
},
"name": "PSU0",
"power_outlet": {
"id": 28,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AA4",
"connected_port": 9
},
"connection_status": true
},
{
"id": 10,
"device": {
"id": 4,
"url": "http://localhost:8000/api/dcim/devices/4/",
"name": "test1-leaf1",
"display_name": "test1-leaf1"
},
"name": "PSU1",
"power_outlet": {
"id": 52,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AA4",
"connected_port": 10
},
"connection_status": true
},
{
"id": 11,
"device": {
"id": 5,
"url": "http://localhost:8000/api/dcim/devices/5/",
"name": "test1-leaf2",
"display_name": "test1-leaf2"
},
"name": "PSU0",
"power_outlet": {
"id": 56,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AA8",
"connected_port": 11
},
"connection_status": true
},
{
"id": 12,
"device": {
"id": 5,
"url": "http://localhost:8000/api/dcim/devices/5/",
"name": "test1-leaf2",
"display_name": "test1-leaf2"
},
"name": "PSU1",
"power_outlet": {
"id": 32,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AA8",
"connected_port": 12
},
"connection_status": true
},
{
"id": 25,
"device": {
"id": 9,
"url": "http://localhost:8000/api/dcim/devices/9/",
"name": "test1-oob1",
"display_name": "test1-oob1"
},
"name": "PSU",
"power_outlet": null,
"connection_status": true
},
{
"id": 13,
"device": {
"id": 3,
"url": "http://localhost:8000/api/dcim/devices/3/",
"name": "test1-spine1",
"display_name": "test1-spine1"
},
"name": "PSU0",
"power_outlet": {
"id": 27,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AA3",
"connected_port": 13
},
"connection_status": true
},
{
"id": 14,
"device": {
"id": 3,
"url": "http://localhost:8000/api/dcim/devices/3/",
"name": "test1-spine1",
"display_name": "test1-spine1"
},
"name": "PSU1",
"power_outlet": {
"id": 51,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AA3",
"connected_port": 14
},
"connection_status": true
},
{
"id": 23,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "PSU0",
"power_outlet": {
"id": 55,
"device": {
"id": 12,
"url": "http://localhost:8000/api/dcim/devices/12/",
"name": "test1-pdu2",
"display_name": "test1-pdu2"
},
"name": "AA7",
"connected_port": 23
},
"connection_status": true
},
{
"id": 24,
"device": {
"id": 6,
"url": "http://localhost:8000/api/dcim/devices/6/",
"name": "test1-spine2",
"display_name": "test1-spine2"
},
"name": "PSU1",
"power_outlet": {
"id": 31,
"device": {
"id": 11,
"url": "http://localhost:8000/api/dcim/devices/11/",
"name": "test1-pdu1",
"display_name": "test1-pdu1"
},
"name": "AA7",
"connected_port": 24
},
"connection_status": true
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/rack.json 0000644 0001751 0000177 00000001153 14706740105 020546 0 ustar 00runner docker {
"id": 1,
"name": "A1R1",
"facility_id": "T23A01",
"display_name": "A1R1 (T23A01)",
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"group": null,
"tenant": null,
"role": {
"id": 1,
"url": "http://localhost:8000/api/dcim/rack-roles/1/",
"name": "Compute",
"slug": "compute"
},
"type": null,
"width": {
"value": 19,
"label": "19 inches"
},
"u_height": 42,
"desc_units": false,
"comments": "",
"custom_fields": {}
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/rack_group.json 0000644 0001751 0000177 00000000310 14706740105 021754 0 ustar 00runner docker {
"id": 1,
"name": "TEST",
"slug": "test",
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
}
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/rack_groups.json 0000644 0001751 0000177 00000000563 14706740105 022151 0 ustar 00runner docker {
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "TEST",
"slug": "test",
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
}
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/rack_reservation.json 0000644 0001751 0000177 00000000464 14706740105 023173 0 ustar 00runner docker {
"id": 1,
"rack": {
"id": 2,
"url": "http://localhost:8000/api/dcim/racks/2/",
"name": "A1R2",
"display_name": "A1R2 (T24A01)"
},
"units": [
42
],
"created": "2017-03-22T04:10:47.307156Z",
"user": 1,
"description": "Test Reservation"
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/rack_reservations.json 0000644 0001751 0000177 00000000777 14706740105 023365 0 ustar 00runner docker {
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"rack": {
"id": 2,
"url": "http://localhost:8000/api/dcim/racks/2/",
"name": "A1R2",
"display_name": "A1R2 (T24A01)"
},
"units": [
42
],
"created": "2017-03-22T04:10:47.307156Z",
"user": 1,
"description": "Test Reservation"
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/rack_role.json 0000644 0001751 0000177 00000000116 14706740105 021565 0 ustar 00runner docker {
"id": 1,
"name": "Test",
"slug": "test",
"color": "aa1409"
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/rack_roles.json 0000644 0001751 0000177 00000000321 14706740105 021746 0 ustar 00runner docker {
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "Test",
"slug": "test",
"color": "aa1409"
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/rack_u.json 0000644 0001751 0000177 00000001465 14706740105 021100 0 ustar 00runner docker {
"count": 3,
"next": null,
"previous": null,
"results": [
{
"id": 48,
"name": "U1",
"face": 0,
"device": {
"id": 130,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "tst-device1",
"display_name": "tst-device1"
}
},
{
"id": 47,
"name": "U2",
"face": 0,
"device": null
},
{
"id": 46,
"name": "U3",
"face": 0,
"device": {
"id": 1859,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "tst-device2",
"display_name": "tst-device2"
}
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/racks.json 0000644 0001751 0000177 00000002633 14706740105 020735 0 ustar 00runner docker {
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "A1R1",
"facility_id": "T23A01",
"display_name": "A1R1 (T23A01)",
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"group": null,
"tenant": null,
"role": null,
"type": null,
"width": {
"value": 19,
"label": "19 inches"
},
"u_height": 42,
"desc_units": false,
"comments": "",
"custom_fields": {}
},
{
"id": 2,
"name": "A1R2",
"facility_id": "T24A01",
"display_name": "A1R2 (T24A01)",
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"group": null,
"tenant": null,
"role": null,
"type": null,
"width": {
"value": 19,
"label": "19 inches"
},
"u_height": 42,
"desc_units": false,
"comments": "",
"custom_fields": {}
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/region.json 0000644 0001751 0000177 00000000113 14706740105 021104 0 ustar 00runner docker {
"id": 1,
"name": "TEST",
"slug": "test",
"parent": null
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/regions.json 0000644 0001751 0000177 00000000316 14706740105 021274 0 ustar 00runner docker {
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "TEST",
"slug": "test",
"parent": null
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/site.json 0000644 0001751 0000177 00000001132 14706740105 020567 0 ustar 00runner docker {
"id": 1,
"name": "TEST1",
"slug": "test1",
"region": null,
"tenant": null,
"facility": "Test Facility",
"asn": 65535,
"physical_address": "555 Test Ave.\r\nTest, NY 55555",
"shipping_address": "",
"contact_name": "",
"contact_phone": "",
"contact_email": "",
"comments": "",
"custom_fields": {
"test_custom": "Hello",
"test_selection": {
"value": 2,
"label": "second"
}
},
"count_prefixes": 2,
"count_vlans": 1,
"count_racks": 2,
"count_devices": 11,
"count_circuits": 0
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/sites.json 0000644 0001751 0000177 00000001410 14706740105 020751 0 ustar 00runner docker {
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "TEST1",
"slug": "test1",
"region": null,
"tenant": null,
"facility": "Test Facility",
"asn": 65535,
"physical_address": "555 Test Ave.\r\nTest, NY 55555",
"shipping_address": "",
"contact_name": "",
"contact_phone": "",
"contact_email": "",
"comments": "",
"custom_fields": {
"test_custom": "Hello"
},
"count_prefixes": 2,
"count_vlans": 1,
"count_racks": 2,
"count_devices": 11,
"count_circuits": 0
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/virtual_chassis_device.json 0000644 0001751 0000177 00000000366 14706740105 024355 0 ustar 00runner docker {
"id": 1,
"master": {
"id": 5654,
"url": "http://localhost:8000/api/dcim/devices/5654/",
"name": "01-0001-e214-as01 (SW1)",
"display_name": "01-0001-e214-as01 (SW1)"
},
"domain": "test-domain-1"
}
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/dcim/virtual_chassis_devices.json 0000644 0001751 0000177 00000001363 14706740105 024536 0 ustar 00runner docker {
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"master": {
"id": 5654,
"url": "http://localhost:8000/api/dcim/devices/5654/",
"name": "01-0001-e214-as01 (SW1)",
"display_name": "01-0001-e214-as01 (SW1)"
},
"domain": "test-domain-1"
},
{
"id": 2,
"master": {
"id": 5635,
"url": "http://localhost:8000/netbox/api/dcim/devices/5635/",
"name": "hercules.router.com (VSS-SW1)",
"display_name": "hercules.router.com (VSS-SW1)"
},
"domain": "test-domain-2"
}
]
}
././@PaxHeader 0000000 0000000 0000000 00000000033 00000000000 010211 x ustar 00 27 mtime=1729871946.393744
pynetbox-7.4.1/tests/fixtures/ipam/ 0000755 0001751 0000177 00000000000 14706740112 016743 5 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/ipam/aggregate.json 0000644 0001751 0000177 00000000427 14706740105 021571 0 ustar 00runner docker {
"id": 1,
"family": 4,
"prefix": "10.0.0.0/8",
"rir": {
"id": 1,
"url": "http://localhost:8000/api/ipam/rirs/1/",
"name": "RFC1918",
"slug": "rfc1918"
},
"date_added": null,
"description": "",
"custom_fields": {}
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/ipam/aggregates.json 0000644 0001751 0000177 00000000732 14706740105 021753 0 ustar 00runner docker {
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"family": 4,
"prefix": "10.0.0.0/8",
"rir": {
"id": 1,
"url": "http://localhost:8000/api/ipam/rirs/1/",
"name": "RFC1918",
"slug": "rfc1918"
},
"date_added": null,
"description": "",
"custom_fields": {}
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/ipam/available-ips-post.json 0000644 0001751 0000177 00000000273 14706740105 023336 0 ustar 00runner docker {
"id": 1,
"address": "10.1.1.1/32",
"vrf": null,
"tenant": null,
"status": 1,
"role": null,
"interface": null,
"description": "",
"nat_inside": null
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/ipam/available-ips.json 0000644 0001751 0000177 00000000412 14706740105 022346 0 ustar 00runner docker [
{
"family": 4,
"address": "10.1.1.2/27",
"vrf": null
},
{
"family": 4,
"address": "10.1.1.3/27",
"vrf": null
},
{
"family": 4,
"address": "10.1.1.7/27",
"vrf": null
}
] ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/ipam/available-prefixes-post.json 0000644 0001751 0000177 00000000371 14706740105 024367 0 ustar 00runner docker [
{
"id": 4,
"prefix": "10.1.1.0/30",
"site": null,
"vrf": null,
"tenant": null,
"vlan": null,
"status": 1,
"role": null,
"is_pool": false,
"description": ""
}
] ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/ipam/available-prefixes.json 0000644 0001751 0000177 00000000131 14706740105 023376 0 ustar 00runner docker [
{
"family": 4,
"prefix": "10.1.1.0/24",
"vrf": null
}
] ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/ipam/ip_address.json 0000644 0001751 0000177 00000001422 14706740105 021754 0 ustar 00runner docker {
"id": 1,
"family": 4,
"address": "10.0.255.1/32",
"vrf": null,
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"interface": {
"id": 3,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "lo0",
"form_factor": {
"value": 0,
"label": "Virtual"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
"description": "",
"nat_inside": null,
"nat_outside": null,
"custom_fields": {}
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/ipam/ip_addresses.json 0000644 0001751 0000177 00000070036 14706740105 022313 0 ustar 00runner docker {
"count": 18,
"next": null,
"previous": null,
"results": [
{
"id": 5,
"family": 4,
"address": "10.0.254.1/24",
"vrf": null,
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"interface": {
"id": 12,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "lo0",
"form_factor": {
"value": 0,
"label": "Virtual"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
"description": "",
"nat_inside": null,
"nat_outside": null,
"custom_fields": {}
},
{
"id": 19,
"family": 4,
"address": "10.0.254.2/32",
"vrf": null,
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"interface": {
"id": 188,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "lo0",
"form_factor": {
"value": 0,
"label": "Virtual"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
"description": "",
"nat_inside": null,
"nat_outside": null,
"custom_fields": {}
},
{
"id": 1,
"family": 4,
"address": "10.0.255.1/32",
"vrf": null,
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"interface": {
"id": 3,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "lo0",
"form_factor": {
"value": 0,
"label": "Virtual"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
"description": "",
"nat_inside": null,
"nat_outside": null,
"custom_fields": {}
},
{
"id": 3,
"family": 4,
"address": "10.0.255.2/32",
"vrf": null,
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"interface": {
"id": 185,
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "lo0",
"form_factor": {
"value": 0,
"label": "Virtual"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
"description": "",
"nat_inside": null,
"nat_outside": null,
"custom_fields": {}
},
{
"id": 11,
"family": 4,
"address": "10.15.20.1/31",
"vrf": null,
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"interface": {
"id": 7,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "xe-0/0/3",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 24,
"url": "http://localhost:8000/api/dcim/interface-connections/24/",
"connection_status": true
},
"connected_interface": {
"id": 212,
"url": "http://localhost:8000/api/dcim/interfaces/212/",
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "xe-0/0/5",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
"description": "",
"nat_inside": null,
"nat_outside": null,
"custom_fields": {}
},
{
"id": 8,
"family": 4,
"address": "10.15.21.1/31",
"vrf": null,
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"interface": {
"id": 218,
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "xe-0/0/5",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 22,
"url": "http://localhost:8000/api/dcim/interface-connections/22/",
"connection_status": true
},
"connected_interface": {
"id": 9,
"url": "http://localhost:8000/api/dcim/interfaces/9/",
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "xe-0/0/5",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
"description": "",
"nat_inside": null,
"nat_outside": null,
"custom_fields": {}
},
{
"id": 9,
"family": 4,
"address": "10.15.21.2/31",
"vrf": null,
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"interface": {
"id": 9,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "xe-0/0/5",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 22,
"url": "http://localhost:8000/api/dcim/interface-connections/22/",
"connection_status": true
},
"connected_interface": {
"id": 218,
"url": "http://localhost:8000/api/dcim/interfaces/218/",
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "xe-0/0/5",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
"description": "",
"nat_inside": null,
"nat_outside": null,
"custom_fields": {}
},
{
"id": 10,
"family": 4,
"address": "10.15.22.1/31",
"vrf": null,
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"interface": {
"id": 8,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "xe-0/0/4",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 23,
"url": "http://localhost:8000/api/dcim/interface-connections/23/",
"connection_status": true
},
"connected_interface": {
"id": 206,
"url": "http://localhost:8000/api/dcim/interfaces/206/",
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "xe-0/0/5",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
"description": "",
"nat_inside": null,
"nat_outside": null,
"custom_fields": {}
},
{
"id": 13,
"family": 4,
"address": "10.15.22.2/31",
"vrf": null,
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"interface": {
"id": 206,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "xe-0/0/5",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 23,
"url": "http://localhost:8000/api/dcim/interface-connections/23/",
"connection_status": true
},
"connected_interface": {
"id": 8,
"url": "http://localhost:8000/api/dcim/interfaces/8/",
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "xe-0/0/4",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
"description": "",
"nat_inside": null,
"nat_outside": null,
"custom_fields": {}
},
{
"id": 17,
"family": 4,
"address": "10.15.22.2/31",
"vrf": null,
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"interface": {
"id": 212,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "xe-0/0/5",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 24,
"url": "http://localhost:8000/api/dcim/interface-connections/24/",
"connection_status": true
},
"connected_interface": {
"id": 7,
"url": "http://localhost:8000/api/dcim/interfaces/7/",
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "xe-0/0/3",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
"description": "",
"nat_inside": null,
"nat_outside": null,
"custom_fields": {}
},
{
"id": 12,
"family": 4,
"address": "10.16.20.1/31",
"vrf": null,
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"interface": {
"id": 216,
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "xe-0/0/3",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 26,
"url": "http://localhost:8000/api/dcim/interface-connections/26/",
"connection_status": true
},
"connected_interface": {
"id": 211,
"url": "http://localhost:8000/api/dcim/interfaces/211/",
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "xe-0/0/4",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
"description": "",
"nat_inside": null,
"nat_outside": null,
"custom_fields": {}
},
{
"id": 16,
"family": 4,
"address": "10.16.20.2/31",
"vrf": null,
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"interface": {
"id": 211,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "xe-0/0/4",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 26,
"url": "http://localhost:8000/api/dcim/interface-connections/26/",
"connection_status": true
},
"connected_interface": {
"id": 216,
"url": "http://localhost:8000/api/dcim/interfaces/216/",
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "xe-0/0/3",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
"description": "",
"nat_inside": null,
"nat_outside": null,
"custom_fields": {}
},
{
"id": 14,
"family": 4,
"address": "10.16.22.1/31",
"vrf": null,
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"interface": {
"id": 217,
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "xe-0/0/4",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 25,
"url": "http://localhost:8000/api/dcim/interface-connections/25/",
"connection_status": true
},
"connected_interface": {
"id": 205,
"url": "http://localhost:8000/api/dcim/interfaces/205/",
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "xe-0/0/4",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
"description": "",
"nat_inside": null,
"nat_outside": null,
"custom_fields": {}
},
{
"id": 15,
"family": 4,
"address": "10.16.22.2/31",
"vrf": null,
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"interface": {
"id": 205,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "xe-0/0/4",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 25,
"url": "http://localhost:8000/api/dcim/interface-connections/25/",
"connection_status": true
},
"connected_interface": {
"id": 217,
"url": "http://localhost:8000/api/dcim/interfaces/217/",
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "xe-0/0/4",
"form_factor": 1200,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
"description": "",
"nat_inside": null,
"nat_outside": null,
"custom_fields": {}
},
{
"id": 4,
"family": 4,
"address": "169.254.1.1/31",
"vrf": null,
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"interface": {
"id": 213,
"device": {
"id": 7,
"url": "http://localhost:8000/api/dcim/devices/7/",
"name": "test1-edge2",
"display_name": "test1-edge2"
},
"name": "xe-0/0/0",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": null,
"connected_interface": null
},
"description": "",
"nat_inside": null,
"nat_outside": null,
"custom_fields": {}
},
{
"id": 20,
"family": 4,
"address": "169.254.1.1/31",
"vrf": null,
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"interface": {
"id": 200,
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "et-0/1/2",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 21,
"url": "http://localhost:8000/api/dcim/interface-connections/21/",
"connection_status": true
},
"connected_interface": {
"id": 194,
"url": "http://localhost:8000/api/dcim/interfaces/194/",
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "et-0/1/2",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
"description": "",
"nat_inside": null,
"nat_outside": null,
"custom_fields": {}
},
{
"id": 21,
"family": 4,
"address": "169.254.1.2/31",
"vrf": null,
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"interface": {
"id": 194,
"device": {
"id": 2,
"url": "http://localhost:8000/api/dcim/devices/2/",
"name": "test1-core1",
"display_name": "test1-core1"
},
"name": "et-0/1/2",
"form_factor": {
"value": 1400,
"label": "QSFP+ (40GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "",
"connection": {
"id": 21,
"url": "http://localhost:8000/api/dcim/interface-connections/21/",
"connection_status": true
},
"connected_interface": {
"id": 200,
"url": "http://localhost:8000/api/dcim/interfaces/200/",
"device": {
"id": 8,
"url": "http://localhost:8000/api/dcim/devices/8/",
"name": "test1-core2",
"display_name": "test1-core2"
},
"name": "et-0/1/2",
"form_factor": 1400,
"mac_address": null,
"mgmt_only": false,
"description": ""
}
},
"description": "",
"nat_inside": null,
"nat_outside": null,
"custom_fields": {}
},
{
"id": 2,
"family": 4,
"address": "169.254.254.1/31",
"vrf": null,
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"interface": {
"id": 4,
"device": {
"id": 1,
"url": "http://localhost:8000/api/dcim/devices/1/",
"name": "test1-edge1",
"display_name": "test1-edge1"
},
"name": "xe-0/0/0",
"form_factor": {
"value": 1200,
"label": "SFP+ (10GE)"
},
"lag": null,
"mac_address": null,
"mgmt_only": false,
"description": "TEST",
"connection": null,
"connected_interface": null
},
"description": "",
"nat_inside": null,
"nat_outside": null,
"custom_fields": {}
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/ipam/prefix.json 0000644 0001751 0000177 00000001055 14706740105 021136 0 ustar 00runner docker {
"id": 1,
"family": 4,
"prefix": "10.1.1.0/24",
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"vrf": null,
"tenant": null,
"vlan": null,
"status": {
"value": 1,
"label": "Active"
},
"role": {
"id": 1,
"url": "http://localhost:8000/api/ipam/roles/1/",
"name": "Lab Network",
"slug": "lab-network"
},
"is_pool": false,
"description": "",
"custom_fields": {}
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/ipam/prefixes.json 0000644 0001751 0000177 00000003141 14706740105 021464 0 ustar 00runner docker {
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 2,
"family": 4,
"prefix": "10.0.255.0/24",
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"vrf": null,
"tenant": null,
"vlan": null,
"status": {
"value": 1,
"label": "Active"
},
"role": {
"id": 1,
"url": "http://localhost:8000/api/ipam/roles/1/",
"name": "Lab Network",
"slug": "lab-network"
},
"is_pool": false,
"description": "",
"custom_fields": {}
},
{
"id": 1,
"family": 4,
"prefix": "10.1.1.0/24",
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"vrf": null,
"tenant": null,
"vlan": null,
"status": {
"value": 1,
"label": "Active"
},
"role": {
"id": 1,
"url": "http://localhost:8000/api/ipam/roles/1/",
"name": "Lab Network",
"slug": "lab-network"
},
"is_pool": false,
"description": "",
"custom_fields": {}
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/ipam/rir.json 0000644 0001751 0000177 00000000126 14706740105 020433 0 ustar 00runner docker {
"id": 1,
"name": "RFC1918",
"slug": "rfc1918",
"is_private": false
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/ipam/rirs.json 0000644 0001751 0000177 00000000331 14706740105 020614 0 ustar 00runner docker {
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "RFC1918",
"slug": "rfc1918",
"is_private": false
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/ipam/role.json 0000644 0001751 0000177 00000000131 14706740105 020574 0 ustar 00runner docker {
"id": 1,
"name": "Lab Network",
"slug": "lab-network",
"weight": 1000
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/ipam/roles.json 0000644 0001751 0000177 00000000334 14706740105 020764 0 ustar 00runner docker {
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "Lab Network",
"slug": "lab-network",
"weight": 1000
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/ipam/vlan.json 0000644 0001751 0000177 00000001043 14706740105 020576 0 ustar 00runner docker {
"id": 3,
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"group": null,
"vid": 1210,
"name": "v1210",
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"role": {
"id": 1,
"url": "http://localhost:8000/api/ipam/roles/1/",
"name": "Lab Network",
"slug": "lab-network"
},
"description": "",
"display_name": "1210 (v1210)",
"custom_fields": {}
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/ipam/vlan_group.json 0000644 0001751 0000177 00000000310 14706740105 022006 0 ustar 00runner docker {
"id": 1,
"name": "TEST",
"slug": "test",
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
}
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/ipam/vlan_groups.json 0000644 0001751 0000177 00000000563 14706740105 022203 0 ustar 00runner docker {
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "TEST",
"slug": "test",
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
}
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/ipam/vlans.json 0000644 0001751 0000177 00000004454 14706740105 020772 0 ustar 00runner docker {
"count": 3,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"group": null,
"vid": 999,
"name": "TEST",
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"role": {
"id": 1,
"url": "http://localhost:8000/api/ipam/roles/1/",
"name": "Lab Network",
"slug": "lab-network"
},
"description": "",
"display_name": "999 (TEST)",
"custom_fields": {}
},
{
"id": 2,
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"group": null,
"vid": 2069,
"name": "v2069",
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"role": {
"id": 1,
"url": "http://localhost:8000/api/ipam/roles/1/",
"name": "Lab Network",
"slug": "lab-network"
},
"description": "",
"display_name": "2069 (v2069)",
"custom_fields": {}
},
{
"id": 3,
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"group": null,
"vid": 1210,
"name": "v1210",
"tenant": null,
"status": {
"value": 1,
"label": "Active"
},
"role": {
"id": 1,
"url": "http://localhost:8000/api/ipam/roles/1/",
"name": "Lab Network",
"slug": "lab-network"
},
"description": "",
"display_name": "1210 (v1210)",
"custom_fields": {}
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/ipam/vrf.json 0000644 0001751 0000177 00000000230 14706740105 020430 0 ustar 00runner docker {
"id": 1,
"name": "TEST",
"rd": "65535:1",
"tenant": null,
"enforce_unique": true,
"description": "",
"custom_fields": {}
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/ipam/vrfs.json 0000644 0001751 0000177 00000000463 14706740105 020623 0 ustar 00runner docker {
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "TEST",
"rd": "65535:1",
"tenant": null,
"enforce_unique": true,
"description": "",
"custom_fields": {}
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000033 00000000000 010211 x ustar 00 27 mtime=1729871946.393744
pynetbox-7.4.1/tests/fixtures/tenancy/ 0000755 0001751 0000177 00000000000 14706740112 017456 5 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/tenancy/tenant.json 0000644 0001751 0000177 00000000464 14706740105 021650 0 ustar 00runner docker {
"id": 1,
"name": "TEST Tenant 1",
"slug": "test-tenant-1",
"group": {
"id": 1,
"url": "http://localhost:8000/api/tenancy/tenant-groups/1/",
"name": "TEST Group",
"slug": "test-group"
},
"description": "",
"comments": "",
"custom_fields": {}
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/tenancy/tenant_group.json 0000644 0001751 0000177 00000000103 14706740105 023052 0 ustar 00runner docker {
"id": 1,
"name": "TEST Group",
"slug": "test-group"
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/tenancy/tenant_groups.json 0000644 0001751 0000177 00000000276 14706740105 023250 0 ustar 00runner docker {
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "TEST Group",
"slug": "test-group"
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/tenancy/tenants.json 0000644 0001751 0000177 00000001635 14706740105 022034 0 ustar 00runner docker {
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "TEST Tenant 1",
"slug": "test-tenant-1",
"group": {
"id": 1,
"url": "http://localhost:8000/api/tenancy/tenant-groups/1/",
"name": "TEST Group",
"slug": "test-group"
},
"description": "",
"comments": "",
"custom_fields": {}
},
{
"id": 2,
"name": "TEST Tenant 2",
"slug": "test-tenant-2",
"group": {
"id": 1,
"url": "http://localhost:8000/api/tenancy/tenant-groups/1/",
"name": "TEST Group",
"slug": "test-group"
},
"description": "",
"comments": "",
"custom_fields": {}
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000033 00000000000 010211 x ustar 00 27 mtime=1729871946.393744
pynetbox-7.4.1/tests/fixtures/users/ 0000755 0001751 0000177 00000000000 14706740112 017156 5 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/users/group.json 0000644 0001751 0000177 00000000052 14706740105 021204 0 ustar 00runner docker {
"id": 1,
"name": "usergroup1"
}
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/users/groups.json 0000644 0001751 0000177 00000000350 14706740105 021370 0 ustar 00runner docker {
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "usergroup1"
},
{
"id": 2,
"name": "usergroup2"
}
]
}
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/users/permission.json 0000644 0001751 0000177 00000000376 14706740105 022251 0 ustar 00runner docker {
"id": 1,
"name": "permission1",
"users": [
{
"username": "user1"
}
],
"constraints": [
{
"status": "active"
},
{
"region__name": "Europe"
}
]
}
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/users/permissions.json 0000644 0001751 0000177 00000000352 14706740105 022426 0 ustar 00runner docker {
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "permission1"
},
{
"id": 2,
"name": "permission2"
}
]
}
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/users/unknown_model.json 0000644 0001751 0000177 00000000061 14706740105 022727 0 ustar 00runner docker {
"id": 1,
"display": "Unknown object"
}
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/users/user.json 0000644 0001751 0000177 00000000051 14706740105 021025 0 ustar 00runner docker {
"id": 1,
"username": "user1"
}
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/users/users.json 0000644 0001751 0000177 00000000346 14706740105 021217 0 ustar 00runner docker {
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"username": "user1"
},
{
"id": 2,
"username": "user2"
}
]
}
././@PaxHeader 0000000 0000000 0000000 00000000033 00000000000 010211 x ustar 00 27 mtime=1729871946.393744
pynetbox-7.4.1/tests/fixtures/virtualization/ 0000755 0001751 0000177 00000000000 14706740112 021101 5 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/virtualization/cluster.json 0000644 0001751 0000177 00000001122 14706740105 023453 0 ustar 00runner docker {
"id": 1,
"name": "vm-test-cluster",
"type": {
"id": 1,
"url": "http://localhost:8000/api/virtualization/cluster-types/1/",
"name": "vm-test-type",
"slug": "vm-test-type"
},
"group": {
"id": 1,
"url": "http://localhost:8000/api/virtualization/cluster-groups/1/",
"name": "vm-test-group",
"slug": "vm-test-group"
},
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"comments": "",
"custom_fields": {}
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/virtualization/cluster_group.json 0000644 0001751 0000177 00000000111 14706740105 024664 0 ustar 00runner docker {
"id": 1,
"name": "vm-test-group",
"slug": "vm-test-group"
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/virtualization/cluster_groups.json 0000644 0001751 0000177 00000000304 14706740105 025053 0 ustar 00runner docker {
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "vm-test-group",
"slug": "vm-test-group"
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/virtualization/cluster_type.json 0000644 0001751 0000177 00000000107 14706740105 024516 0 ustar 00runner docker {
"id": 1,
"name": "vm-test-type",
"slug": "vm-test-type"
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/virtualization/cluster_types.json 0000644 0001751 0000177 00000000302 14706740105 024676 0 ustar 00runner docker {
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "vm-test-type",
"slug": "vm-test-type"
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/virtualization/clusters.json 0000644 0001751 0000177 00000001545 14706740105 023647 0 ustar 00runner docker {
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "vm-test-cluster",
"type": {
"id": 1,
"url": "http://localhost:8000/api/virtualization/cluster-types/1/",
"name": "vm-test-type",
"slug": "vm-test-type"
},
"group": {
"id": 1,
"url": "http://localhost:8000/api/virtualization/cluster-groups/1/",
"name": "vm-test-group",
"slug": "vm-test-group"
},
"site": {
"id": 1,
"url": "http://localhost:8000/api/dcim/sites/1/",
"name": "TEST1",
"slug": "test1"
},
"comments": "",
"custom_fields": {}
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/virtualization/interface.json 0000644 0001751 0000177 00000000427 14706740105 023741 0 ustar 00runner docker {
"id": 223,
"name": "eth0",
"virtual_machine": {
"id": 1,
"url": "http://localhost:8000/api/virtualization/virtual-machines/1/",
"name": "vm-test01"
},
"enabled": true,
"mac_address": null,
"mtu": null,
"description": ""
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/virtualization/interfaces.json 0000644 0001751 0000177 00000001523 14706740105 024122 0 ustar 00runner docker {
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 223,
"name": "eth0",
"virtual_machine": {
"id": 1,
"url": "http://localhost:8000/api/virtualization/virtual-machines/1/",
"name": "vm-test01"
},
"enabled": true,
"mac_address": null,
"mtu": null,
"description": ""
},
{
"id": 224,
"name": "eth1",
"virtual_machine": {
"id": 1,
"url": "http://localhost:8000/api/virtualization/virtual-machines/1/",
"name": "vm-test01"
},
"enabled": true,
"mac_address": null,
"mtu": null,
"description": ""
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/virtualization/virtual_machine.json 0000644 0001751 0000177 00000000720 14706740105 025147 0 ustar 00runner docker {
"id": 1,
"name": "vm-test01",
"status": {
"value": 1,
"label": "Active"
},
"cluster": {
"id": 1,
"url": "http://localhost:8000/api/virtualization/clusters/1/",
"name": "vm-test-cluster"
},
"role": null,
"tenant": null,
"platform": null,
"primary_ip4": null,
"primary_ip6": null,
"vcpus": 2,
"memory": 1024,
"disk": 500,
"comments": "",
"custom_fields": {}
}
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/virtualization/virtual_machines.json 0000644 0001751 0000177 00000001332 14706740105 025332 0 ustar 00runner docker {
"count": 1,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"name": "vm-test01",
"status": {
"value": 1,
"label": "Active"
},
"cluster": {
"id": 1,
"url": "http://localhost:8000/api/virtualization/clusters/1/",
"name": "vm-test-cluster"
},
"role": null,
"tenant": null,
"platform": null,
"primary_ip4": null,
"primary_ip6": null,
"vcpus": 2,
"memory": 1024,
"disk": 500,
"comments": "",
"custom_fields": {}
}
]
} ././@PaxHeader 0000000 0000000 0000000 00000000033 00000000000 010211 x ustar 00 27 mtime=1729871946.393744
pynetbox-7.4.1/tests/fixtures/wireless/ 0000755 0001751 0000177 00000000000 14706740112 017652 5 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/wireless/wireless_lan.json 0000644 0001751 0000177 00000000046 14706740105 023236 0 ustar 00runner docker {
"id": 1,
"ssid": "SSID 1"
}
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/fixtures/wireless/wireless_lans.json 0000644 0001751 0000177 00000000340 14706740105 023416 0 ustar 00runner docker {
"count": 2,
"next": null,
"previous": null,
"results": [
{
"id": 1,
"ssid": "SSID 1"
},
{
"id": 2,
"ssid": "SSID 2"
}
]
}
././@PaxHeader 0000000 0000000 0000000 00000000034 00000000000 010212 x ustar 00 28 mtime=1729871946.3977442
pynetbox-7.4.1/tests/integration/ 0000755 0001751 0000177 00000000000 14706740112 016467 5 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/integration/conftest.py 0000644 0001751 0000177 00000043144 14706740105 020676 0 ustar 00runner docker import atexit
import os
import subprocess as subp
import time
from http.client import RemoteDisconnected
import pytest
import requests
import yaml
import pynetbox
DOCKER_PROJECT_PREFIX = "pytest_pynetbox"
def get_netbox_docker_version_tag(netbox_version):
"""Get the repo tag to build netbox-docker in from the requested netbox version.
Args:
netbox_version (version.Version): The version of netbox we want to build
Returns:
str: The release tag for the netbox-docker repo that should be able to build
the requested version of netbox.
"""
major, minor = netbox_version.major, netbox_version.minor
if (major, minor) == (3, 6):
tag = "2.7.0"
elif (major, minor) == (3, 7):
tag = "2.8.0"
elif (major, minor) == (4, 0):
tag = "2.9.1"
else:
raise NotImplementedError(
"Version %s is not currently supported" % netbox_version
)
return tag
@pytest.fixture(scope="session")
def git_toplevel():
"""Get the top level of the current git repo.
Returns:
str: The path of the top level directory of the current git repo.
"""
try:
subp.check_call(["which", "git"])
except subp.CalledProcessError:
pytest.skip(reason="git executable was not found on the host")
return (
subp.check_output(["git", "rev-parse", "--show-toplevel"])
.decode("utf-8")
.splitlines()[0]
)
@pytest.fixture(scope="session")
def netbox_docker_repo_dirpaths(pytestconfig, git_toplevel):
"""Get the path to the netbox-docker repos we will use.
Returns:
dict: A map of the repo dir paths to the versions of netbox that should be run
from that repo as:
{
: [
,
...,
]
}
"""
try:
subp.check_call(["which", "docker"])
except subp.CalledProcessError:
pytest.skip(reason="docker executable was not found on the host")
netbox_versions_by_repo_dirpaths = {}
for netbox_version in pytestconfig.option.netbox_versions:
repo_version_tag = get_netbox_docker_version_tag(netbox_version=netbox_version)
print("top: ", git_toplevel)
repo_fpath = os.path.join(
git_toplevel, ".netbox-docker-%s" % str(repo_version_tag)
)
if os.path.isdir(repo_fpath):
subp.check_call(
["git", "fetch"], cwd=repo_fpath, stdout=subp.PIPE, stderr=subp.PIPE
)
subp.check_call(
["git", "reset", "--hard"],
cwd=repo_fpath,
stdout=subp.PIPE,
stderr=subp.PIPE,
)
subp.check_call(
["git", "pull", "origin", "release"],
cwd=repo_fpath,
stdout=subp.PIPE,
stderr=subp.PIPE,
)
else:
subp.check_call(
[
"git",
"clone",
"https://github.com/netbox-community/netbox-docker",
repo_fpath,
],
cwd=git_toplevel,
stdout=subp.PIPE,
stderr=subp.PIPE,
)
subp.check_call(
["git", "checkout", repo_version_tag],
cwd=repo_fpath,
stdout=subp.PIPE,
stderr=subp.PIPE,
)
try:
netbox_versions_by_repo_dirpaths[repo_fpath].append(netbox_version)
except KeyError:
netbox_versions_by_repo_dirpaths[repo_fpath] = [netbox_version]
return netbox_versions_by_repo_dirpaths
@pytest.fixture(scope="session")
def docker_compose_project_name(pytestconfig):
"""Get the project name to use for docker containers.
This will return a consistently generated project name so we can kill stale
containers after the test run is finished.
"""
return "%s_%s" % (DOCKER_PROJECT_PREFIX, int(time.time()))
def clean_netbox_docker_tmpfiles():
"""Clean up any temporary files created in the netbox-docker repo."""
dirpath, dirnames, filenames = next(os.walk("./"))
for filename in filenames:
if filename.startswith("docker-compose-v"):
os.remove(filename)
def clean_docker_objects():
"""Clean up any docker objects created via these tests."""
# clean up any containers
for line in subp.check_output(["docker", "ps", "-a"]).decode("utf-8").splitlines():
words = line.split()
if not words:
continue
if words[-1].startswith(DOCKER_PROJECT_PREFIX):
subp.check_call(
["docker", "rm", "-f", words[0]], stdout=subp.PIPE, stderr=subp.PIPE
)
# clean up any volumes
for line in (
subp.check_output(["docker", "volume", "list"]).decode("utf-8").splitlines()
):
words = line.split()
if not words:
continue
if words[-1].startswith(DOCKER_PROJECT_PREFIX):
subp.check_call(
["docker", "volume", "rm", "-f", words[-1]],
stdout=subp.PIPE,
stderr=subp.PIPE,
)
# clean up any networks
for line in (
subp.check_output(["docker", "network", "list"]).decode("utf-8").splitlines()
):
words = line.split()
if not words:
continue
if words[1].startswith(DOCKER_PROJECT_PREFIX):
subp.check_call(
["docker", "network", "rm", words[1]],
stdout=subp.PIPE,
stderr=subp.PIPE,
)
# TODO: this function could be split up
@pytest.fixture(scope="session")
def docker_compose_file(pytestconfig, netbox_docker_repo_dirpaths):
"""Return paths to the compose files needed to create test containers.
We can create container sets for multiple versions of netbox here by returning a
list of paths to multiple compose files.
"""
clean_netbox_docker_tmpfiles()
clean_docker_objects()
compose_files = []
for (
netbox_docker_repo_dirpath,
netbox_versions,
) in netbox_docker_repo_dirpaths.items():
compose_source_fpath = os.path.join(
netbox_docker_repo_dirpath, "docker-compose.yml"
)
for netbox_version in netbox_versions:
# check for updates to the local netbox images
subp.check_call(
["docker", "pull", "netboxcommunity/netbox:v%s" % (netbox_version)],
stdout=subp.PIPE,
stderr=subp.PIPE,
)
docker_netbox_version = str(netbox_version).replace(".", "_")
# load the compose file yaml
compose_data = yaml.safe_load(open(compose_source_fpath, "r").read())
# add the custom network for this version
docker_network_name = "%s_v%s" % (
DOCKER_PROJECT_PREFIX,
docker_netbox_version,
)
compose_data["networks"] = {docker_network_name: {}}
# https://docs.docker.com/compose/compose-file/compose-file-v3/#network-configuration-reference
if "version" not in compose_data or compose_data["version"] >= "3.5":
compose_data["networks"][docker_network_name][
"name"
] = docker_network_name
# prepend the netbox version to each of the service names and anything else
# needed to make the continers unique to the netbox version
new_services = {}
for service_name in compose_data["services"].keys():
new_service_name = "netbox_v%s_%s" % (
docker_netbox_version,
service_name,
)
new_services[new_service_name] = compose_data["services"][service_name]
if service_name in ["netbox", "netbox-worker"]:
# set the netbox image version
new_services[new_service_name]["image"] = (
"netboxcommunity/netbox:v%s" % netbox_version
)
new_services[new_service_name]["environment"] = {
"SKIP_SUPERUSER": "false",
"SUPERUSER_API_TOKEN": "0123456789abcdef0123456789abcdef01234567",
"SUPERUSER_EMAIL": "admin@example.com",
"SUPERUSER_NAME": "admin",
"SUPERUSER_PASSWORD": "admin",
}
if service_name == "netbox":
# ensure the netbox container listens on a random port
new_services[new_service_name]["ports"] = ["8080"]
# set the network and an alias to the proper short name of the container
# within that network
new_services[new_service_name]["networks"] = {
docker_network_name: {"aliases": [service_name]}
}
# fix the naming of any dependencies
if "depends_on" in new_services[new_service_name]:
new_service_dependencies = []
for dependent_service_name in new_services[new_service_name][
"depends_on"
]:
new_service_dependencies.append(
"netbox_v%s_%s"
% (
docker_netbox_version,
dependent_service_name,
)
)
new_services[new_service_name][
"depends_on"
] = new_service_dependencies
# make any internal named volumes unique to the netbox version
if "volumes" in new_services[new_service_name]:
new_volumes = []
for volume_config in new_services[new_service_name]["volumes"]:
source = volume_config.split(":")[0]
if "/" in source:
if volume_config.startswith("./"):
# Set the full path to the volume source. Without this
# some of the containers would be spun up from the
# wrong source directories.
volume_source, volume_dest = volume_config.split(
":", maxsplit=1
)
volume_source = os.path.join(
netbox_docker_repo_dirpath, volume_source[2::]
)
new_volumes.append(
":".join([volume_source, volume_dest])
)
else:
new_volumes.append(volume_config)
else:
new_volumes.append(
"%s_v%s_%s"
% (
DOCKER_PROJECT_PREFIX,
docker_netbox_version,
volume_config,
)
)
new_services[new_service_name]["volumes"] = new_volumes
# replace the services config with the renamed versions
compose_data["services"] = new_services
# prepend local volume names
new_volumes = {}
for volume_name, volume_config in compose_data["volumes"].items():
new_volumes[
"%s_v%s_%s"
% (
DOCKER_PROJECT_PREFIX,
docker_netbox_version,
volume_name,
)
] = volume_config
compose_data["volumes"] = new_volumes
compose_output_fpath = os.path.join(
netbox_docker_repo_dirpath,
"docker-compose-v%s.yml" % netbox_version,
)
with open(compose_output_fpath, "w") as fdesc:
fdesc.write(yaml.dump(compose_data))
compose_files.append(compose_output_fpath)
# set post=run cleanup hooks if requested
if pytestconfig.option.cleanup:
atexit.register(clean_docker_objects)
atexit.register(clean_netbox_docker_tmpfiles)
return compose_files
def netbox_is_responsive(url):
"""Check if the HTTP service is up and responsive."""
try:
response = requests.get(url)
if response.status_code == 200:
return True
except (
ConnectionError,
ConnectionResetError,
requests.exceptions.ConnectionError,
RemoteDisconnected,
):
return False
def id_netbox_service(fixture_value):
"""Create and ID representation for a netbox service fixture param.
Returns:
str: Identifiable representation of the service, as best we can
"""
return "netbox v%s" % fixture_value
@pytest.fixture(scope="session")
def docker_netbox_service(
pytestconfig,
docker_ip,
docker_services,
request,
):
"""Get the netbox service to test against.
This function waits until the netbox container is fully up and running then does an
initial data population with a few object types to be used in testing. Then the
service is returned as a fixture to be called from tests.
"""
netbox_integration_version = request.param
netbox_service_name = "netbox_v%s_netbox" % str(netbox_integration_version).replace(
".", "_"
)
netbox_service_port = 8080
try:
# `port_for` takes a container port and returns the corresponding host port
port = docker_services.port_for(netbox_service_name, netbox_service_port)
except Exception as err:
docker_ps_stdout = subp.check_output(["docker", "ps", "-a"]).decode("utf-8")
exited_container_logs = []
for line in docker_ps_stdout.splitlines():
if "Exited" in line:
container_id = line.split()[0]
exited_container_logs.append(
"\nContainer %s logs:\n%s"
% (
container_id,
subp.check_output(["docker", "logs", container_id]).decode(
"utf-8"
),
)
)
raise KeyError(
"Unable to find a docker service matching the name %s on port %s. Running"
" containers: %s. Original error: %s. Logs:\n%s"
% (
netbox_service_name,
netbox_service_port,
docker_ps_stdout,
err,
exited_container_logs,
)
)
url = "http://{}:{}".format(docker_ip, port)
docker_services.wait_until_responsive(
timeout=300.0, pause=1, check=lambda: netbox_is_responsive(url)
)
return {
"url": url,
"netbox_version": netbox_integration_version,
}
@pytest.fixture(scope="session")
def api(docker_netbox_service):
return pynetbox.api(
docker_netbox_service["url"], token="0123456789abcdef0123456789abcdef01234567"
)
@pytest.fixture(scope="session")
def nb_version(docker_netbox_service):
return docker_netbox_service["netbox_version"]
@pytest.fixture(scope="session")
def site(api):
site = api.dcim.sites.create(name="test", slug="test")
yield site
site.delete()
@pytest.fixture(scope="session")
def manufacturer(api):
manufacturer = api.dcim.manufacturers.create(
name="test-manufacturer", slug="test-manufacturer"
)
yield manufacturer
manufacturer.delete()
@pytest.fixture(scope="session")
def device_type(api, manufacturer):
device_type = api.dcim.device_types.create(
manufacturer=manufacturer.id,
model="test-device-type",
slug="test-device-type",
height=1,
)
yield device_type
device_type.delete()
@pytest.fixture(scope="session")
def role(api):
role = api.dcim.device_roles.create(
name="test-device-role",
slug="test-device-role",
color="000000",
)
yield role
role.delete()
def pytest_generate_tests(metafunc):
"""Dynamically parametrize some functions based on args from the cli parser."""
if "docker_netbox_service" in metafunc.fixturenames:
# parametrize the requested versions of netbox to the docker_netbox_services fixture
# so that it will return a fixture for each of the versions requested
# individually rather than one fixture with multiple versions within it
metafunc.parametrize(
"docker_netbox_service",
metafunc.config.getoption("netbox_versions"),
ids=id_netbox_service,
indirect=True,
)
@pytest.fixture(scope="session")
def docker_cleanup(pytestconfig):
"""Override the docker cleanup command for the containsers used in testing."""
# pytest-docker does not always clean up after itself properly, and sometimes it
# will fail during cleanup because there is still a connection to one of the
# running containers. Here we will disable the builtin cleanup of containers via the
# pytest-docker module and implement our own instead.
# This is only relevant until https://github.com/avast/pytest-docker/pull/33 gets
# resolved.
# There is not a great way to skip the shutdown step, so in this case to skip
# it we will just pass the "version" arg so the containers are left alone
command_args = "version"
return command_args
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/integration/test_dcim.py 0000644 0001751 0000177 00000024715 14706740105 021027 0 ustar 00runner docker import pytest
from packaging import version
import pynetbox
@pytest.fixture(scope="module")
def rack(api, site):
rack = api.dcim.racks.create(site=site.id, name="test-rack")
yield rack
rack.delete()
@pytest.fixture(scope="module")
def device(api, site, device_type, role):
if version.parse(api.version) >= version.parse("3.6"):
device = api.dcim.devices.create(
name="test-device",
role=role.id,
device_type=device_type.id,
site=site.id,
color="000000",
)
else:
device = api.dcim.devices.create(
name="test-device",
device_role=role.id,
device_type=device_type.id,
site=site.id,
color="000000",
)
yield device
device.delete()
@pytest.mark.usefixtures("init")
class BaseTest:
app = "dcim"
def _init_helper(
self,
request,
fixture,
update_field=None,
filter_kwargs=None,
endpoint=None,
str_repr=None,
):
request.cls.endpoint = endpoint
request.cls.fixture = fixture
request.cls.update_field = update_field
request.cls.filter_kwargs = filter_kwargs
request.cls.str_repr = str_repr
def test_create(self):
assert self.fixture
def test_str(self):
if self.str_repr:
test = str(self.fixture)
assert test == self.str_repr
def test_update_fixture(self):
if self.update_field:
setattr(self.fixture, self.update_field, "Test Value")
assert self.fixture.save()
def test_get_fixture_by_id(self, api):
test = getattr(getattr(api, self.app), self.endpoint).get(self.fixture.id)
assert test
if self.update_field:
assert getattr(test, self.update_field) == "Test Value"
def test_get_fixture_by_kwarg(self, api):
test = getattr(getattr(api, self.app), self.endpoint).get(**self.filter_kwargs)
assert test
if self.update_field:
assert getattr(test, self.update_field) == "Test Value"
def test_filter_fixture(self, api):
test = list(
getattr(getattr(api, self.app), self.endpoint).filter(**self.filter_kwargs)
)[0]
assert test
if self.update_field:
assert getattr(test, self.update_field) == "Test Value"
class TestSite(BaseTest):
@pytest.fixture(scope="class")
def init(self, request, site):
self._init_helper(
request,
site,
filter_kwargs={"name": "test"},
update_field="description",
endpoint="sites",
)
@pytest.fixture(scope="class")
def add_sites(self, api):
sites = api.dcim.sites.create(
[
{"name": "test{}".format(i), "slug": "test{}".format(i)}
for i in range(2, 20)
]
)
yield
for i in sites:
i.delete()
def test_threading_duplicates(self, docker_netbox_service, add_sites):
api = pynetbox.api(
docker_netbox_service["url"],
token="0123456789abcdef0123456789abcdef01234567",
threading=True,
)
test = api.dcim.sites.all(limit=5)
test_list = list(test)
test_set = set(test_list)
assert len(test_list) == len(test_set)
class TestRack(BaseTest):
@pytest.fixture(scope="class")
def init(self, request, rack):
self._init_helper(
request,
rack,
filter_kwargs={"name": rack.name},
update_field="comments",
endpoint="racks",
)
def test_get_elevation(self):
test = self.fixture.elevation.list()
assert test
assert isinstance(test, list)
class TestManufacturer(BaseTest):
@pytest.fixture(scope="class")
def init(self, request, manufacturer, nb_version):
self._init_helper(
request,
manufacturer,
filter_kwargs={"name": manufacturer.name},
update_field="description" if version.parse("2.10") < nb_version else None,
endpoint="manufacturers",
)
class TestDeviceType(BaseTest):
@pytest.fixture(scope="class")
def init(self, request, device_type):
self._init_helper(
request,
device_type,
filter_kwargs={"model": device_type.model},
update_field="comments",
endpoint="device_types",
str_repr=device_type.model,
)
class TestDevice(BaseTest):
@pytest.fixture(scope="class")
def init(self, request, device):
self._init_helper(
request,
device,
filter_kwargs={"name": device.name},
update_field="comments",
endpoint="devices",
)
class TestInterface(BaseTest):
@pytest.fixture(scope="class")
def interface(self, api, device):
ret = api.dcim.interfaces.create(
name="test-interface", type="1000base-t", device=device.id
)
yield ret
ret.delete()
@pytest.fixture(scope="class")
def init(self, request, interface):
self._init_helper(
request,
interface,
filter_kwargs={"name": interface.name},
update_field="description",
endpoint="interfaces",
)
class TestPowerCable(BaseTest):
@pytest.fixture(scope="class")
def power_outlet(self, api, device_type, role, site):
if version.parse(api.version) >= version.parse("3.6"):
pdu = api.dcim.devices.create(
name="test-pdu",
role=role.id,
device_type=device_type.id,
site=site.id,
)
else:
pdu = api.dcim.devices.create(
name="test-pdu",
device_role=role.id,
device_type=device_type.id,
site=site.id,
)
outlet = api.dcim.power_outlets.create(name="outlet", device=pdu.id)
yield outlet
pdu.delete()
@pytest.fixture(scope="class")
def power_port(self, api, device):
ret = api.dcim.power_ports.create(name="PSU1", device=device.id)
yield ret
@pytest.fixture(scope="class")
def power_cable(self, api, power_outlet, power_port):
cable = api.dcim.cables.create(
a_terminations=[
{"object_type": "dcim.powerport", "object_id": power_port.id},
],
b_terminations=[
{"object_type": "dcim.poweroutlet", "object_id": power_outlet.id},
],
)
yield cable
cable.delete()
@pytest.fixture(scope="class")
def init(self, request, power_cable):
self._init_helper(
request,
power_cable,
filter_kwargs={"id": power_cable.id},
endpoint="cables",
str_repr="PSU1 <> outlet",
)
class TestConsoleCable(BaseTest):
@pytest.fixture(scope="class")
def console_server_port(self, api, device_type, role, site):
if version.parse(api.version) >= version.parse("3.6"):
device = api.dcim.devices.create(
name="test-console-server",
role=role.id,
device_type=device_type.id,
site=site.id,
)
else:
device = api.dcim.devices.create(
name="test-console-server",
device_role=role.id,
device_type=device_type.id,
site=site.id,
)
ret = api.dcim.console_server_ports.create(name="Port 1", device=device.id)
yield ret
device.delete()
@pytest.fixture(scope="class")
def console_port(self, api, device):
ret = api.dcim.console_ports.create(name="Console", device=device.id)
yield ret
@pytest.fixture(scope="class")
def console_cable(self, api, console_port, console_server_port):
ret = api.dcim.cables.create(
a_terminations=[
{"object_type": "dcim.consoleport", "object_id": console_port.id},
],
b_terminations=[
{
"object_type": "dcim.consoleserverport",
"object_id": console_server_port.id,
},
],
)
yield ret
ret.delete()
@pytest.fixture(scope="class")
def init(self, request, console_cable):
self._init_helper(
request,
console_cable,
filter_kwargs={"id": console_cable.id},
endpoint="cables",
str_repr="Console <> Port 1",
)
class TestInterfaceCable(BaseTest):
@pytest.fixture(scope="class")
def interface_b(self, api, device_type, role, site):
if version.parse(api.version) >= version.parse("3.6"):
device = api.dcim.devices.create(
name="test-device-2",
role=role.id,
device_type=device_type.id,
site=site.id,
)
else:
device = api.dcim.devices.create(
name="test-device-2",
device_role=role.id,
device_type=device_type.id,
site=site.id,
)
ret = api.dcim.interfaces.create(
name="Ethernet1", type="1000base-t", device=device.id
)
yield ret
device.delete()
@pytest.fixture(scope="class")
def interface_a(self, api, device):
ret = api.dcim.interfaces.create(
name="Ethernet1", type="1000base-t", device=device.id
)
yield ret
@pytest.fixture(scope="class")
def interface_cable(self, api, interface_a, interface_b):
ret = api.dcim.cables.create(
a_terminations=[
{"object_type": "dcim.interface", "object_id": interface_a.id},
],
b_terminations=[
{"object_type": "dcim.interface", "object_id": interface_b.id},
],
)
yield ret
ret.delete()
@pytest.fixture(scope="class")
def init(self, request, interface_cable):
self._init_helper(
request,
interface_cable,
filter_kwargs={"id": interface_cable.id},
endpoint="cables",
str_repr="Ethernet1 <> Ethernet1",
)
def test_trace(self, interface_a):
test = interface_a.trace()
assert test
assert test[0][0].name == "Ethernet1"
assert test[2][0].name == "Ethernet1"
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/integration/test_ipam.py 0000644 0001751 0000177 00000011636 14706740105 021037 0 ustar 00runner docker import pytest
from packaging import version
@pytest.mark.usefixtures("init")
class BaseTest:
app = "ipam"
def _init_helper(
self,
request,
fixture,
update_field=None,
filter_kwargs=None,
endpoint=None,
str_repr=None,
):
request.cls.endpoint = endpoint
request.cls.fixture = fixture
request.cls.update_field = update_field
request.cls.filter_kwargs = filter_kwargs
request.cls.str_repr = str_repr
def test_create(self):
assert self.fixture
def test_str(self):
if self.str_repr:
test = str(self.fixture)
assert test == self.str_repr
def test_update_fixture(self):
if self.update_field:
setattr(self.fixture, self.update_field, "Test Value")
assert self.fixture.save()
def test_get_fixture_by_id(self, api):
test = getattr(getattr(api, self.app), self.endpoint).get(self.fixture.id)
assert test
if self.update_field:
assert getattr(test, self.update_field) == "Test Value"
def test_get_fixture_by_kwarg(self, api):
test = getattr(getattr(api, self.app), self.endpoint).get(**self.filter_kwargs)
assert test
if self.update_field:
assert getattr(test, self.update_field) == "Test Value"
def test_filter_fixture(self, api):
test = list(
getattr(getattr(api, self.app), self.endpoint).filter(**self.filter_kwargs)
)[0]
assert test
if self.update_field:
assert getattr(test, self.update_field) == "Test Value"
@pytest.fixture(scope="module")
def rir(api, site):
ret = api.ipam.rirs.create(
name="ministry-of-silly-walks", slug="ministry-of-silly-walks"
)
yield ret
ret.delete()
class TestRIR(BaseTest):
@pytest.fixture(scope="class")
def init(self, request, rir, nb_version):
self._init_helper(
request,
rir,
filter_kwargs={"name": "ministry-of-silly-walks"},
update_field="description" if nb_version >= version.parse("2.8") else None,
endpoint="rirs",
)
class TestAggregate(BaseTest):
@pytest.fixture(scope="class")
def aggregate(self, api, rir):
ret = api.ipam.aggregates.create(prefix="192.0.2.0/24", rir=rir.id)
yield ret
ret.delete()
@pytest.fixture(scope="class")
def init(self, request, aggregate):
self._init_helper(
request,
aggregate,
filter_kwargs={"prefix": "192.0.2.0/24"},
update_field="description",
endpoint="aggregates",
)
class TestPrefix(BaseTest):
@pytest.fixture(scope="class")
def prefix(self, api):
ret = api.ipam.prefixes.create(prefix="192.0.2.0/24")
yield ret
ret.delete()
@pytest.fixture(scope="class")
def init(self, request, prefix):
self._init_helper(
request,
prefix,
filter_kwargs={"prefix": "192.0.2.0/24"},
update_field="description",
endpoint="prefixes",
)
class TestIpAddress(BaseTest):
@pytest.fixture(scope="class")
def ip(self, api):
ret = api.ipam.ip_addresses.create(address="192.0.2.1/24")
yield ret
ret.delete()
@pytest.fixture(scope="class")
def init(self, request, ip):
self._init_helper(
request,
ip,
filter_kwargs={"q": "192.0.2.1/24"},
update_field="description",
endpoint="ip_addresses",
)
class TestRole(BaseTest):
@pytest.fixture(scope="class")
def role(self, api):
ret = api.ipam.roles.create(name="test-role", slug="test-role")
yield ret
ret.delete()
@pytest.fixture(scope="class")
def init(self, request, role):
self._init_helper(
request,
role,
filter_kwargs={"name": "test-role"},
update_field="description",
endpoint="roles",
)
class TestVlan(BaseTest):
@pytest.fixture(scope="class")
def vlan(self, api):
ret = api.ipam.vlans.create(vid=123, name="test-vlan")
yield ret
ret.delete()
@pytest.fixture(scope="class")
def init(self, request, vlan):
self._init_helper(
request,
vlan,
filter_kwargs={"name": "test-vlan"},
update_field="description",
endpoint="vlans",
)
class TestVRF(BaseTest):
@pytest.fixture(scope="class")
def vrf(self, api):
ret = api.ipam.vrfs.create(name="test-vrf", rd="192.0.2.1:1234")
yield ret
ret.delete()
@pytest.fixture(scope="class")
def init(self, request, vrf):
self._init_helper(
request,
vrf,
filter_kwargs={"name": "test-vrf"},
update_field="description",
endpoint="vrfs",
)
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/test_api.py 0000644 0001751 0000177 00000005321 14706740105 016331 0 ustar 00runner docker import unittest
from unittest.mock import patch
import pynetbox
from .util import Response
host = "http://localhost:8000"
def_kwargs = {
"token": "abc123",
}
# Keys are app names, values are arbitrarily selected endpoints
# We use dcim and ipam since they have unique app classes
# and circuits because it does not. We don't add other apps/endpoints
# beyond 'circuits' as they all use the same code as each other
endpoints = {
"dcim": "devices",
"ipam": "prefixes",
"circuits": "circuits",
}
class ApiTestCase(unittest.TestCase):
@patch(
"requests.sessions.Session.post",
return_value=Response(),
)
def test_get(self, *_):
api = pynetbox.api(host, **def_kwargs)
self.assertTrue(api)
@patch(
"requests.sessions.Session.post",
return_value=Response(),
)
def test_sanitize_url(self, *_):
api = pynetbox.api("http://localhost:8000/", **def_kwargs)
self.assertTrue(api)
self.assertEqual(api.base_url, "http://localhost:8000/api")
class ApiVersionTestCase(unittest.TestCase):
class ResponseHeadersWithVersion:
headers = {"API-Version": "1.999"}
ok = True
@patch(
"requests.sessions.Session.get",
return_value=ResponseHeadersWithVersion(),
)
def test_api_version(self, *_):
api = pynetbox.api(
host,
)
self.assertEqual(api.version, "1.999")
class ResponseHeadersWithoutVersion:
headers = {}
ok = True
@patch(
"requests.sessions.Session.get",
return_value=ResponseHeadersWithoutVersion(),
)
def test_api_version_not_found(self, *_):
api = pynetbox.api(
host,
)
self.assertEqual(api.version, "")
class ApiStatusTestCase(unittest.TestCase):
class ResponseWithStatus:
ok = True
def json(self):
return {
"netbox-version": "0.9.9",
}
@patch(
"requests.sessions.Session.get",
return_value=ResponseWithStatus(),
)
def test_api_status(self, *_):
api = pynetbox.api(
host,
)
self.assertEqual(api.status()["netbox-version"], "0.9.9")
class ApiCreateTokenTestCase(unittest.TestCase):
@patch(
"requests.sessions.Session.post",
return_value=Response(fixture="api/token_provision.json"),
)
def test_create_token(self, *_):
api = pynetbox.api(host)
token = api.create_token("user", "pass")
self.assertTrue(isinstance(token, pynetbox.core.response.Record))
self.assertEqual(token.key, "1234567890123456789012345678901234567890")
self.assertEqual(api.token, "1234567890123456789012345678901234567890")
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/test_app.py 0000644 0001751 0000177 00000003054 14706740105 016341 0 ustar 00runner docker import unittest
from unittest.mock import patch
import pynetbox
host = "http://localhost:8000"
def_kwargs = {
"token": "abc123",
}
class AppConfigTestCase(unittest.TestCase):
@patch(
"pynetbox.core.query.Request.get",
return_value={
"tables": {
"DeviceTable": {
"columns": [
"name",
"status",
"tenant",
"tags",
],
},
},
},
)
def test_config(self, *_):
api = pynetbox.api(host, **def_kwargs)
config = api.users.config()
self.assertEqual(sorted(config.keys()), ["tables"])
self.assertEqual(
sorted(config["tables"]["DeviceTable"]["columns"]),
["name", "status", "tags", "tenant"],
)
class PluginAppTestCase(unittest.TestCase):
@patch(
"pynetbox.core.query.Request.get",
return_value=[
{
"name": "test_plugin",
"package": "netbox_test_plugin",
}
],
)
def test_installed_plugins(self, *_):
api = pynetbox.api(host, **def_kwargs)
plugins = api.plugins.installed_plugins()
self.assertEqual(len(plugins), 1)
self.assertEqual(plugins[0]["name"], "test_plugin")
def test_plugin_app_name(self, *_):
api = pynetbox.api(host, **def_kwargs)
test_plugin = api.plugins.test_plugin
self.assertEqual(test_plugin.name, "plugins/test-plugin")
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/test_circuits.py 0000644 0001751 0000177 00000006250 14706740105 017407 0 ustar 00runner docker import unittest
from unittest.mock import patch
import pynetbox
from .util import Response
api = pynetbox.api(
"http://localhost:8000",
)
nb = api.circuits
HEADERS = {"accept": "application/json"}
class Generic:
class Tests(unittest.TestCase):
name = ""
ret = pynetbox.core.response.Record
app = "circuits"
def test_get_all(self):
with patch(
"requests.sessions.Session.get",
return_value=Response(fixture="{}/{}.json".format(self.app, self.name)),
) as mock:
ret = list(getattr(nb, self.name).all())
self.assertTrue(ret)
self.assertTrue(isinstance(ret[0], self.ret))
mock.assert_called_with(
"http://localhost:8000/api/{}/{}/".format(
self.app, self.name.replace("_", "-")
),
params={"limit": 0},
json=None,
headers=HEADERS,
)
def test_filter(self):
with patch(
"requests.sessions.Session.get",
return_value=Response(fixture="{}/{}.json".format(self.app, self.name)),
) as mock:
ret = list(getattr(nb, self.name).filter(name="test"))
self.assertTrue(ret)
self.assertTrue(isinstance(ret[0], self.ret))
mock.assert_called_with(
"http://localhost:8000/api/{}/{}/".format(
self.app, self.name.replace("_", "-")
),
params={"name": "test", "limit": 0},
json=None,
headers=HEADERS,
)
def test_get(self):
with patch(
"requests.sessions.Session.get",
return_value=Response(
fixture="{}/{}.json".format(self.app, self.name[:-1])
),
) as mock:
ret = getattr(nb, self.name).get(1)
self.assertTrue(ret)
self.assertTrue(isinstance(ret, self.ret))
mock.assert_called_with(
"http://localhost:8000/api/{}/{}/1/".format(
self.app, self.name.replace("_", "-")
),
params={},
json=None,
headers=HEADERS,
)
class CircuitsTestCase(Generic.Tests):
name = "circuits"
@patch(
"requests.sessions.Session.get",
return_value=Response(fixture="circuits/circuit.json"),
)
def test_repr(self, _):
test = nb.circuits.get(1)
self.assertEqual(str(test), "123456")
class ProviderTestCase(Generic.Tests):
name = "providers"
class CircuitTypeTestCase(Generic.Tests):
name = "circuit_types"
class CircuitTerminationsTestCase(Generic.Tests):
name = "circuit_terminations"
@patch(
"requests.sessions.Session.get",
return_value=Response(fixture="circuits/circuit_termination.json"),
)
def test_repr(self, _):
test = nb.circuit_terminations.get(1)
self.assertEqual(str(test), "123456")
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/test_tenancy.py 0000644 0001751 0000177 00000005047 14706740105 017226 0 ustar 00runner docker import unittest
from unittest.mock import patch
import pynetbox
from .util import Response
api = pynetbox.api(
"http://localhost:8000",
)
nb = api.tenancy
HEADERS = {"accept": "application/json"}
class Generic:
class Tests(unittest.TestCase):
name = ""
ret = pynetbox.core.response.Record
app = "tenancy"
def test_get_all(self):
with patch(
"requests.sessions.Session.get",
return_value=Response(fixture="{}/{}.json".format(self.app, self.name)),
) as mock:
ret = list(getattr(nb, self.name).all())
self.assertTrue(ret)
self.assertTrue(isinstance(ret[0], self.ret))
mock.assert_called_with(
"http://localhost:8000/api/{}/{}/".format(
self.app, self.name.replace("_", "-")
),
params={"limit": 0},
json=None,
headers=HEADERS,
)
def test_filter(self):
with patch(
"requests.sessions.Session.get",
return_value=Response(fixture="{}/{}.json".format(self.app, self.name)),
) as mock:
ret = list(getattr(nb, self.name).filter(name="test"))
self.assertTrue(ret)
self.assertTrue(isinstance(ret[0], self.ret))
mock.assert_called_with(
"http://localhost:8000/api/{}/{}/".format(
self.app, self.name.replace("_", "-")
),
params={"name": "test", "limit": 0},
json=None,
headers=HEADERS,
)
def test_get(self):
with patch(
"requests.sessions.Session.get",
return_value=Response(
fixture="{}/{}.json".format(self.app, self.name[:-1])
),
) as mock:
ret = getattr(nb, self.name).get(1)
self.assertTrue(ret)
self.assertTrue(isinstance(ret, self.ret))
mock.assert_called_with(
"http://localhost:8000/api/{}/{}/1/".format(
self.app, self.name.replace("_", "-")
),
params={},
json=None,
headers=HEADERS,
)
class TenantsTestCase(Generic.Tests):
name = "tenants"
class TenantGroupsTestCase(Generic.Tests):
name = "tenant_groups"
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/test_users.py 0000644 0001751 0000177 00000010161 14706740105 016717 0 ustar 00runner docker import unittest
from unittest.mock import patch
import pynetbox
from .util import Response
api = pynetbox.api(
"http://localhost:8000",
)
nb = api.users
HEADERS = {"accept": "application/json"}
class Generic:
class Tests(unittest.TestCase):
name = ""
ret = pynetbox.core.response.Record
app = "users"
def test_get_all(self):
with patch(
"requests.sessions.Session.get",
return_value=Response(fixture="{}/{}.json".format(self.app, self.name)),
) as mock:
ret = list(getattr(nb, self.name).all())
self.assertTrue(ret)
self.assertTrue(isinstance(ret[0], self.ret))
mock.assert_called_with(
"http://localhost:8000/api/{}/{}/".format(
self.app, self.name.replace("_", "-")
),
params={"limit": 0},
json=None,
headers=HEADERS,
)
def test_filter(self):
with patch(
"requests.sessions.Session.get",
return_value=Response(fixture="{}/{}.json".format(self.app, self.name)),
) as mock:
ret = list(getattr(nb, self.name).filter(name="test"))
self.assertTrue(ret)
self.assertTrue(isinstance(ret[0], self.ret))
mock.assert_called_with(
"http://localhost:8000/api/{}/{}/".format(
self.app, self.name.replace("_", "-")
),
params={"name": "test", "limit": 0},
json=None,
headers=HEADERS,
)
def test_get(self):
with patch(
"requests.sessions.Session.get",
return_value=Response(
fixture="{}/{}.json".format(self.app, self.name[:-1])
),
) as mock:
ret = getattr(nb, self.name).get(1)
self.assertTrue(ret)
self.assertTrue(isinstance(ret, self.ret))
mock.assert_called_with(
"http://localhost:8000/api/{}/{}/1/".format(
self.app, self.name.replace("_", "-")
),
params={},
json=None,
headers=HEADERS,
)
class UsersTestCase(Generic.Tests):
name = "users"
@patch(
"requests.sessions.Session.get",
return_value=Response(fixture="users/user.json"),
)
def test_repr(self, _):
test = nb.users.get(1)
self.assertEqual(type(test), pynetbox.models.users.Users)
self.assertEqual(str(test), "user1")
class GroupsTestCase(Generic.Tests):
name = "groups"
class PermissionsTestCase(Generic.Tests):
name = "permissions"
@patch(
"requests.sessions.Session.get",
return_value=Response(fixture="users/permission.json"),
)
def test_username(self, _):
permission = nb.permissions.get(1)
self.assertEqual(len(permission.users), 1)
user = permission.users[0]
self.assertEqual(str(user), "user1")
@patch(
"requests.sessions.Session.get",
return_value=Response(fixture="users/permission.json"),
)
def test_constraints(self, _):
permission = nb.permissions.get(1)
self.assertIsInstance(permission.constraints, list)
self.assertIsInstance(permission.constraints[0], dict)
class UnknownModelTestCase(unittest.TestCase):
"""This test validates that an unknown model is returned as Record object
and that the __str__() method correctly uses the 'display' field of the
object (introduced as a standard field in NetBox 2.11.0).
"""
@patch(
"requests.sessions.Session.get",
return_value=Response(fixture="users/unknown_model.json"),
)
def test_unknown_model(self, _):
unknown_obj = nb.unknown_model.get(1)
self.assertEqual(type(unknown_obj), pynetbox.core.response.Record)
self.assertEqual(str(unknown_obj), "Unknown object")
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/test_virtualization.py 0000644 0001751 0000177 00000005422 14706740105 020646 0 ustar 00runner docker import unittest
from unittest.mock import patch
import pynetbox
from .util import Response
api = pynetbox.api(
"http://localhost:8000",
)
nb = api.virtualization
HEADERS = {"accept": "application/json"}
class Generic:
class Tests(unittest.TestCase):
name = ""
ret = pynetbox.core.response.Record
app = "virtualization"
def test_get_all(self):
with patch(
"requests.sessions.Session.get",
return_value=Response(fixture="{}/{}.json".format(self.app, self.name)),
) as mock:
ret = list(getattr(nb, self.name).all())
self.assertTrue(ret)
self.assertTrue(isinstance(ret[0], self.ret))
mock.assert_called_with(
"http://localhost:8000/api/{}/{}/".format(
self.app, self.name.replace("_", "-")
),
params={"limit": 0},
json=None,
headers=HEADERS,
)
def test_filter(self):
with patch(
"requests.sessions.Session.get",
return_value=Response(fixture="{}/{}.json".format(self.app, self.name)),
) as mock:
ret = list(getattr(nb, self.name).filter(name="test"))
self.assertTrue(ret)
self.assertTrue(isinstance(ret[0], self.ret))
mock.assert_called_with(
"http://localhost:8000/api/{}/{}/".format(
self.app, self.name.replace("_", "-")
),
params={"name": "test", "limit": 0},
json=None,
headers=HEADERS,
)
def test_get(self):
with patch(
"requests.sessions.Session.get",
return_value=Response(
fixture="{}/{}.json".format(self.app, self.name[:-1])
),
) as mock:
ret = getattr(nb, self.name).get(1)
self.assertTrue(ret)
self.assertTrue(isinstance(ret, self.ret))
mock.assert_called_with(
"http://localhost:8000/api/{}/{}/1/".format(
self.app, self.name.replace("_", "-")
),
params={},
json=None,
headers=HEADERS,
)
class ClusterTypesTestCase(Generic.Tests):
name = "cluster_types"
class ClusterGroupsTestCase(Generic.Tests):
name = "cluster_groups"
class ClustersTestCase(Generic.Tests):
name = "clusters"
class VirtualMachinesTestCase(Generic.Tests):
name = "virtual_machines"
class InterfacesTestCase(Generic.Tests):
name = "interfaces"
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/test_wireless.py 0000644 0001751 0000177 00000005533 14706740105 017422 0 ustar 00runner docker import unittest
from unittest.mock import patch
import pynetbox
from .util import Response
api = pynetbox.api("http://localhost:8000")
nb_app = api.wireless
HEADERS = {"accept": "application/json"}
class Generic:
class Tests(unittest.TestCase):
name = ""
ret = pynetbox.core.response.Record
app = "wireless"
def test_get_all(self):
with patch(
"requests.sessions.Session.get",
return_value=Response(fixture="{}/{}.json".format(self.app, self.name)),
) as mock:
ret = list(getattr(nb_app, self.name).all())
self.assertTrue(ret)
self.assertTrue(isinstance(ret[0], self.ret))
mock.assert_called_with(
"http://localhost:8000/api/{}/{}/".format(
self.app, self.name.replace("_", "-")
),
params={"limit": 0},
json=None,
headers=HEADERS,
)
def test_filter(self):
with patch(
"requests.sessions.Session.get",
return_value=Response(fixture="{}/{}.json".format(self.app, self.name)),
) as mock:
ret = list(getattr(nb_app, self.name).filter(name="test"))
self.assertTrue(ret)
self.assertTrue(isinstance(ret[0], self.ret))
mock.assert_called_with(
"http://localhost:8000/api/{}/{}/".format(
self.app, self.name.replace("_", "-")
),
params={"name": "test", "limit": 0},
json=None,
headers=HEADERS,
)
def test_get(self):
with patch(
"requests.sessions.Session.get",
return_value=Response(
fixture="{}/{}.json".format(self.app, self.name[:-1])
),
) as mock:
ret = getattr(nb_app, self.name).get(1)
self.assertTrue(ret)
self.assertTrue(isinstance(ret, self.ret))
mock.assert_called_with(
"http://localhost:8000/api/{}/{}/1/".format(
self.app, self.name.replace("_", "-")
),
params={},
json=None,
headers=HEADERS,
)
class WirelessLansTestCase(Generic.Tests):
name = "wireless_lans"
@patch(
"requests.sessions.Session.get",
return_value=Response(fixture="wireless/wireless_lan.json"),
)
def test_repr(self, _):
wireless_lan_obj = nb_app.wireless_lans.get(1)
self.assertEqual(type(wireless_lan_obj), pynetbox.models.wireless.WirelessLans)
self.assertEqual(str(wireless_lan_obj), "SSID 1")
././@PaxHeader 0000000 0000000 0000000 00000000034 00000000000 010212 x ustar 00 28 mtime=1729871946.3977442
pynetbox-7.4.1/tests/unit/ 0000755 0001751 0000177 00000000000 14706740112 015123 5 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/unit/__init__.py 0000644 0001751 0000177 00000000000 14706740105 017224 0 ustar 00runner docker ././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/unit/test_detailendpoint.py 0000644 0001751 0000177 00000005053 14706740105 021544 0 ustar 00runner docker import unittest
from unittest.mock import patch
import pynetbox
nb = pynetbox.api("http://localhost:8000")
class DetailEndpointTestCase(unittest.TestCase):
def test_detail_endpoint_create_single(self):
# Prefixes
with patch(
"pynetbox.core.query.Request._make_call",
return_value={"id": 123, "prefix": "1.2.3.0/24"},
):
prefix_obj = nb.ipam.prefixes.get(123)
self.assertEqual(prefix_obj.prefix, "1.2.3.0/24")
with patch(
"pynetbox.core.query.Request._make_call",
return_value={"address": "1.2.3.1/24"},
):
ip_obj = prefix_obj.available_ips.create()
self.assertEqual(ip_obj.address, "1.2.3.1/24")
# IP Ranges
with patch(
"pynetbox.core.query.Request._make_call",
return_value={"id": 321, "display": "1.2.4.1-254/24"},
):
ip_range_obj = nb.ipam.ip_ranges.get(321)
self.assertEqual(ip_range_obj.display, "1.2.4.1-254/24")
with patch(
"pynetbox.core.query.Request._make_call",
return_value={"address": "1.2.4.2/24"},
):
ip_obj = ip_range_obj.available_ips.create()
self.assertEqual(ip_obj.address, "1.2.4.2/24")
def test_detail_endpoint_create_list(self):
# Prefixes
with patch(
"pynetbox.core.query.Request._make_call",
return_value={"id": 123, "prefix": "1.2.3.0/24"},
):
prefix_obj = nb.ipam.prefixes.get(123)
self.assertEqual(prefix_obj.prefix, "1.2.3.0/24")
with patch(
"pynetbox.core.query.Request._make_call",
return_value=[{"address": "1.2.3.1/24"}, {"address": "1.2.3.2/24"}],
):
ip_list = prefix_obj.available_ips.create([{} for _ in range(2)])
self.assertTrue(isinstance(ip_list, list))
self.assertEqual(len(ip_list), 2)
# IP Ranges
with patch(
"pynetbox.core.query.Request._make_call",
return_value={"id": 321, "display": "1.2.4.1-254/24"},
):
ip_range_obj = nb.ipam.ip_ranges.get(321)
self.assertEqual(ip_range_obj.display, "1.2.4.1-254/24")
with patch(
"pynetbox.core.query.Request._make_call",
return_value=[{"address": "1.2.4.2/24"}, {"address": "1.2.4.3/24"}],
):
ip_list = ip_range_obj.available_ips.create([{} for _ in range(2)])
self.assertTrue(isinstance(ip_list, list))
self.assertEqual(len(ip_list), 2)
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/unit/test_endpoint.py 0000644 0001751 0000177 00000016215 14706740105 020363 0 ustar 00runner docker import unittest
from unittest.mock import Mock, patch
from pynetbox.core.endpoint import Endpoint
class EndPointTestCase(unittest.TestCase):
def test_filter(self):
with patch(
"pynetbox.core.query.Request._make_call", return_value=Mock()
) as mock:
api = Mock(base_url="http://localhost:8000/api")
app = Mock(name="test")
mock.return_value = [{"id": 123}, {"id": 321}]
test_obj = Endpoint(api, app, "test")
test = test_obj.filter(test="test")
self.assertEqual(len(test), 2)
def test_filter_invalid_pagination_args(self):
api = Mock(base_url="http://localhost:8000/api")
app = Mock(name="test")
test_obj = Endpoint(api, app, "test")
with self.assertRaises(ValueError) as _:
test_obj.filter(offset=1)
def test_filter_replace_none_with_null(self):
api = Mock(base_url="http://localhost:8000/api")
app = Mock(name="test")
test_obj = Endpoint(api, app, "test")
test = test_obj.filter(name=None, id=0)
self.assertEqual(test.request.filters, {"name": "null", "id": 0})
def test_all_invalid_pagination_args(self):
api = Mock(base_url="http://localhost:8000/api")
app = Mock(name="test")
test_obj = Endpoint(api, app, "test")
with self.assertRaises(ValueError) as _:
test_obj.all(offset=1)
def test_choices(self):
with patch("pynetbox.core.query.Request.options", return_value=Mock()) as mock:
api = Mock(base_url="http://localhost:8000/api")
app = Mock(name="test")
mock.return_value = {
"actions": {
"POST": {
"letter": {
"choices": [
{"display_name": "A", "value": 1},
{"display_name": "B", "value": 2},
{"display_name": "C", "value": 3},
]
}
}
}
}
test_obj = Endpoint(api, app, "test")
choices = test_obj.choices()
self.assertEqual(choices["letter"][1]["display_name"], "B")
self.assertEqual(choices["letter"][1]["value"], 2)
def test_get_with_filter(self):
with patch(
"pynetbox.core.query.Request._make_call", return_value=Mock()
) as mock:
mock.return_value = [{"id": 123}]
api = Mock(base_url="http://localhost:8000/api")
app = Mock(name="test")
test_obj = Endpoint(api, app, "test")
test = test_obj.get(name="test")
self.assertEqual(test.id, 123)
def test_delete_with_ids(self):
with patch(
"pynetbox.core.query.Request._make_call", return_value=Mock()
) as mock:
ids = [1, 3, 5]
mock.return_value = True
api = Mock(base_url="http://localhost:8000/api")
app = Mock(name="test")
test_obj = Endpoint(api, app, "test")
test = test_obj.delete(ids)
mock.assert_called_with(verb="delete", data=[{"id": i} for i in ids])
self.assertTrue(test)
def test_delete_with_objects(self):
with patch(
"pynetbox.core.query.Request._make_call", return_value=Mock()
) as mock:
from pynetbox.core.response import Record
ids = [1, 3, 5]
mock.return_value = True
api = Mock(base_url="http://localhost:8000/api")
app = Mock(name="test")
test_obj = Endpoint(api, app, "test")
objects = [
Record({"id": i, "name": "dummy" + str(i)}, api, test_obj) for i in ids
]
test = test_obj.delete(objects)
mock.assert_called_with(verb="delete", data=[{"id": i} for i in ids])
self.assertTrue(test)
def test_delete_with_recordset(self):
with patch(
"pynetbox.core.query.Request._make_call", return_value=Mock()
) as mock:
from pynetbox.core.response import RecordSet
ids = [1, 3, 5]
class FakeRequest:
def get(self):
return iter([{"id": i, "name": "dummy" + str(i)} for i in ids])
mock.return_value = True
api = Mock(base_url="http://localhost:8000/api")
app = Mock(name="test")
test_obj = Endpoint(api, app, "test")
recordset = RecordSet(test_obj, FakeRequest())
test = test_obj.delete(recordset)
mock.assert_called_with(verb="delete", data=[{"id": i} for i in ids])
self.assertTrue(test)
def test_get_greater_than_one(self):
with patch(
"pynetbox.core.query.Request._make_call", return_value=Mock()
) as mock:
mock.return_value = [{"id": 123}, {"id": 321}]
api = Mock(base_url="http://localhost:8000/api")
app = Mock(name="test")
test_obj = Endpoint(api, app, "test")
with self.assertRaises(ValueError) as _:
test_obj.get(name="test")
def test_get_no_results(self):
with patch(
"pynetbox.core.query.Request._make_call", return_value=Mock()
) as mock:
mock.return_value = []
api = Mock(base_url="http://localhost:8000/api")
app = Mock(name="test")
test_obj = Endpoint(api, app, "test")
test = test_obj.get(name="test")
self.assertIsNone(test)
def test_bulk_update_records(self):
with patch(
"pynetbox.core.query.Request._make_call", return_value=Mock()
) as mock:
from pynetbox.core.response import Record
ids = [1, 3, 5]
mock.return_value = True
api = Mock(base_url="http://localhost:8000/api")
app = Mock(name="test")
test_obj = Endpoint(api, app, "test")
objects = [
Record(
{"id": i, "name": "dummy" + str(i), "unchanged": "yes"},
api,
test_obj,
)
for i in ids
]
for o in objects:
o.name = "fluffy" + str(o.id)
mock.return_value = [o.serialize() for o in objects]
test = test_obj.update(objects)
mock.assert_called_with(
verb="patch", data=[{"id": i, "name": "fluffy" + str(i)} for i in ids]
)
self.assertTrue(test)
def test_bulk_update_json(self):
with patch(
"pynetbox.core.query.Request._make_call", return_value=Mock()
) as mock:
ids = [1, 3, 5]
changes = [{"id": i, "name": "puffy" + str(i)} for i in ids]
mock.return_value = True
api = Mock(base_url="http://localhost:8000/api")
app = Mock(name="test")
mock.return_value = changes
test_obj = Endpoint(api, app, "test")
test = test_obj.update(changes)
mock.assert_called_with(verb="patch", data=changes)
self.assertTrue(test)
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/unit/test_extras.py 0000644 0001751 0000177 00000002354 14706740105 020050 0 ustar 00runner docker import unittest
from pynetbox.models.extras import ConfigContexts
class ExtrasTestCase(unittest.TestCase):
def test_config_contexts(self):
test_values = {
"data": {
"test_int": 123,
"test_str": "testing",
"test_list": [1, 2, 3],
}
}
test = ConfigContexts(test_values, None, None)
self.assertTrue(test)
def test_config_contexts_diff_str(self):
test_values = {
"data": {
"test_int": 123,
"test_str": "testing",
"test_list": [1, 2, 3],
"test_dict": {"foo": "bar"},
}
}
test = ConfigContexts(test_values, None, None)
test.data["test_str"] = "bar"
self.assertEqual(test._diff(), {"data"})
def test_config_contexts_diff_dict(self):
test_values = {
"data": {
"test_int": 123,
"test_str": "testing",
"test_list": [1, 2, 3],
"test_dict": {"foo": "bar"},
}
}
test = ConfigContexts(test_values, None, None)
test.data["test_dict"].update({"bar": "foo"})
self.assertEqual(test._diff(), {"data"})
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/unit/test_query.py 0000644 0001751 0000177 00000005272 14706740105 017711 0 ustar 00runner docker import unittest
from unittest.mock import Mock, call
from pynetbox.core.query import Request
class RequestTestCase(unittest.TestCase):
def test_get_count(self):
test_obj = Request(
http_session=Mock(),
base="http://localhost:8001/api/dcim/devices",
filters={"q": "abcd"},
)
test_obj.http_session.get.return_value.json.return_value = {
"count": 42,
"next": "http://localhost:8001/api/dcim/devices?limit=1&offset=1&q=abcd",
"previous": False,
"results": [],
}
test_obj.http_session.get.ok = True
test = test_obj.get_count()
self.assertEqual(test, 42)
test_obj.http_session.get.assert_called_with(
"http://localhost:8001/api/dcim/devices/",
params={"q": "abcd", "limit": 1, "brief": 1},
headers={"accept": "application/json"},
json=None,
)
def test_get_count_no_filters(self):
test_obj = Request(
http_session=Mock(),
base="http://localhost:8001/api/dcim/devices",
)
test_obj.http_session.get.return_value.json.return_value = {
"count": 42,
"next": "http://localhost:8001/api/dcim/devices?limit=1&offset=1",
"previous": False,
"results": [],
}
test_obj.http_session.get.ok = True
test = test_obj.get_count()
self.assertEqual(test, 42)
test_obj.http_session.get.assert_called_with(
"http://localhost:8001/api/dcim/devices/",
params={"limit": 1, "brief": 1},
headers={"accept": "application/json"},
json=None,
)
def test_get_manual_pagination(self):
test_obj = Request(
http_session=Mock(),
base="http://localhost:8001/api/dcim/devices",
limit=10,
offset=20,
)
test_obj.http_session.get.return_value.json.return_value = {
"count": 4,
"next": "http://localhost:8001/api/dcim/devices?limit=10&offset=30",
"previous": False,
"results": [1, 2, 3, 4],
}
expected = call(
"http://localhost:8001/api/dcim/devices/",
params={"offset": 20, "limit": 10},
headers={"accept": "application/json"},
)
test_obj.http_session.get.ok = True
generator = test_obj.get()
self.assertEqual(len(list(generator)), 4)
test_obj.http_session.get.assert_called_with(
"http://localhost:8001/api/dcim/devices/",
params={"offset": 20, "limit": 10},
headers={"accept": "application/json"},
json=None,
)
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/unit/test_request.py 0000644 0001751 0000177 00000002331 14706740105 020225 0 ustar 00runner docker import unittest
from unittest.mock import Mock
from pynetbox.core.query import Request
class RequestTestCase(unittest.TestCase):
def test_get_openapi_version_less_than_3_5(self):
test = Request("http://localhost:8080/api", Mock())
test.get_version = Mock(return_value="3.4")
# Mock the HTTP response
response_mock = Mock()
response_mock.ok = True
test.http_session.get.return_value = response_mock
test.get_openapi()
test.http_session.get.assert_called_with(
"http://localhost:8080/api/docs/?format=openapi",
headers={"Accept": "application/json", "Content-Type": "application/json"},
)
def test_get_openapi_version_3_5_or_greater(self):
test = Request("http://localhost:8080/api", Mock())
test.get_version = Mock(return_value="3.5")
# Mock the HTTP response
response_mock = Mock()
response_mock.ok = True
test.http_session.get.return_value = response_mock
test.get_openapi()
test.http_session.get.assert_called_with(
"http://localhost:8080/api/schema/",
headers={"Accept": "application/json", "Content-Type": "application/json"},
)
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/unit/test_response.py 0000644 0001751 0000177 00000030777 14706740105 020412 0 ustar 00runner docker import unittest
from unittest.mock import Mock, patch
from pynetbox.core.endpoint import Endpoint
from pynetbox.core.response import Record, RecordSet, flatten_custom
class FlattenCustomTest(unittest.TestCase):
def test_flatten_custom(self):
test_dicts = [
{"foo0": []},
{"foo1": [{"a": "b"}]},
{"foo2": [{"a": "b", "c": "d"}]},
{"foo3": 123},
{"foo4": "a"},
{"foo5": {"a": "b"}},
{"foo6": [{"a": "b", "c": "d"}]},
]
for test_dict in test_dicts:
ret = flatten_custom(test_dict)
assert ret == test_dict
class RecordTestCase(unittest.TestCase):
def test_attribute_access(self):
test_values = {
"id": 123,
"units": 12,
"nested_dict": {"id": 222, "name": "bar"},
"int_list": [123, 321, 231],
}
test_obj = Record(test_values, None, None)
self.assertEqual(test_obj.id, 123)
self.assertEqual(test_obj.units, 12)
self.assertEqual(test_obj.nested_dict.name, "bar")
self.assertEqual(test_obj.int_list[1], 321)
with self.assertRaises(AttributeError) as _:
test_obj.nothing
def test_dict_access(self):
test_values = {
"id": 123,
"units": 12,
"nested_dict": {"id": 222, "name": "bar"},
"int_list": [123, 321, 231],
}
test_obj = Record(test_values, None, None)
self.assertEqual(test_obj["id"], 123)
self.assertEqual(test_obj["units"], 12)
self.assertEqual(test_obj["nested_dict"]["name"], "bar")
self.assertEqual(test_obj["int_list"][1], 321)
with self.assertRaises(KeyError) as _:
test_obj["nothing"]
def test_serialize_list_of_records(self):
test_values = {
"id": 123,
"tagged_vlans": [
{
"id": 1,
"url": "http://localhost:8000/api/ipam/vlans/1/",
"vid": 1,
"name": "test1",
"display_name": "test1",
},
{
"id": 2,
"url": "http://localhost:8000/api/ipam/vlans/2/",
"vid": 2,
"name": "test 2",
"display_name": "test2",
},
],
}
test_obj = Record(test_values, Mock(base_url="test"), None)
test = test_obj.serialize()
self.assertEqual(test["tagged_vlans"], [1, 2])
def test_serialize_list_of_ints(self):
test_values = {"id": 123, "units": [12]}
test_obj = Record(test_values, None, None)
test = test_obj.serialize()
self.assertEqual(test["units"], [12])
def test_serialize_string_tag_set(self):
test_values = {"id": 123, "tags": ["foo", "bar", "foo"]}
test = Record(test_values, None, None).serialize()
self.assertEqual(len(test["tags"]), 2)
def test_serialize_dict_tag_set(self):
test_values = {
"id": 123,
"tags": [
{
"id": 1,
"name": "foo",
},
{
"id": 2,
"name": "bar",
},
{
"id": 3,
"name": "baz",
},
],
}
test = Record(test_values, None, None).serialize()
self.assertEqual(len(test["tags"]), 3)
def test_diff(self):
test_values = {
"id": 123,
"custom_fields": {"foo": "bar"},
"string_field": "foobar",
"int_field": 1,
"nested_dict": {"id": 222, "name": "bar"},
"tags": ["foo", "bar"],
"int_list": [123, 321, 231],
"local_context_data": {"data": ["one"]},
}
test = Record(test_values, None, None)
test.tags.append("baz")
test.nested_dict = 1
test.string_field = "foobaz"
test.local_context_data["data"].append("two")
self.assertEqual(
test._diff(), {"tags", "nested_dict", "string_field", "local_context_data"}
)
def test_diff_append_records_list(self):
test_values = {
"id": 123,
"tagged_vlans": [
{
"id": 1,
"url": "http://localhost:8000/api/ipam/vlans/1/",
"vid": 1,
"name": "test1",
"display_name": "test1",
}
],
}
test_obj = Record(test_values, Mock(base_url="test"), None)
test_obj.tagged_vlans.append(1)
test = test_obj._diff()
self.assertFalse(test)
def test_dict(self):
test_values = {
"id": 123,
"custom_fields": {"foo": "bar"},
"string_field": "foobar",
"int_field": 1,
"nested_dict": {"id": 222, "name": "bar"},
"tags": ["foo", "bar"],
"int_list": [123, 321, 231],
"empty_list": [],
"record_list": [
{
"id": 123,
"name": "Test",
"str_attr": "foo",
"int_attr": 123,
"custom_fields": {"foo": "bar"},
"tags": ["foo", "bar"],
},
{
"id": 321,
"name": "Test 1",
"str_attr": "bar",
"int_attr": 321,
"custom_fields": {"foo": "bar"},
"tags": ["foo", "bar"],
},
],
}
test = Record(test_values, None, None)
self.assertEqual(dict(test), test_values)
def test_choices_idempotence(self):
test_values = {
"id": 123,
"choices_test": {
"value": "test",
"label": "test",
},
}
test = Record(test_values, None, None)
test.choices_test = "test"
self.assertFalse(test._diff())
def test_hash(self):
endpoint = Mock()
endpoint.name = "test-endpoint"
test = Record({}, None, endpoint)
self.assertIsInstance(hash(test), int)
def test_hash_diff(self):
endpoint1 = Mock()
endpoint1.name = "test-endpoint"
endpoint2 = Mock()
endpoint2.name = "test-endpoint"
test1 = Record({}, None, endpoint1)
test1.id = 1
test2 = Record({}, None, endpoint2)
test2.id = 2
self.assertNotEqual(hash(test1), hash(test2))
def test_compare(self):
endpoint1 = Mock()
endpoint1.name = "test-endpoint"
endpoint2 = Mock()
endpoint2.name = "test-endpoint"
test1 = Record({}, None, endpoint1)
test1.id = 1
test2 = Record({}, None, endpoint2)
test2.id = 1
self.assertEqual(test1, test2)
def test_nested_write(self):
app = Mock()
app.token = "abc123"
app.base_url = "http://localhost:8080/api"
endpoint = Mock()
endpoint.name = "test-endpoint"
test = Record(
{
"id": 123,
"name": "test",
"child": {
"id": 321,
"name": "test123",
"url": "http://localhost:8080/api/test-app/test-endpoint/321/",
},
},
app,
endpoint,
)
test.child.name = "test321"
test.child.save()
self.assertEqual(
app.http_session.patch.call_args[0][0],
"http://localhost:8080/api/test-app/test-endpoint/321/",
)
def test_nested_write_with_directory_in_base_url(self):
app = Mock()
app.token = "abc123"
app.base_url = "http://localhost:8080/testing/api"
endpoint = Mock()
endpoint.name = "test-endpoint"
test = Record(
{
"id": 123,
"name": "test",
"child": {
"id": 321,
"name": "test123",
"url": "http://localhost:8080/testing/api/test-app/test-endpoint/321/",
},
},
app,
endpoint,
)
test.child.name = "test321"
test.child.save()
self.assertEqual(
app.http_session.patch.call_args[0][0],
"http://localhost:8080/testing/api/test-app/test-endpoint/321/",
)
def test_endpoint_from_url(self):
api = Mock()
api.base_url = "http://localhost:8080/api"
test = Record(
{
"id": 123,
"name": "test",
"url": "http://localhost:8080/api/test-app/test-endpoint/1/",
},
api,
None,
)
ret = test._endpoint_from_url(test.url)
self.assertEqual(ret.name, "test-endpoint")
def test_endpoint_from_url_with_directory_in_base_url(self):
api = Mock()
api.base_url = "http://localhost:8080/testing/api"
test = Record(
{
"id": 123,
"name": "test",
"url": "http://localhost:8080/testing/api/test-app/test-endpoint/1/",
},
api,
None,
)
ret = test._endpoint_from_url(test.url)
self.assertEqual(ret.name, "test-endpoint")
def test_endpoint_from_url_with_plugins(self):
api = Mock()
api.base_url = "http://localhost:8080/api"
test = Record(
{
"id": 123,
"name": "test",
"url": "http://localhost:8080/api/plugins/test-app/test-endpoint/1/",
},
api,
None,
)
ret = test._endpoint_from_url(test.url)
self.assertEqual(ret.name, "test-endpoint")
def test_endpoint_from_url_with_plugins_and_directory_in_base_url(self):
api = Mock()
api.base_url = "http://localhost:8080/testing/api"
test = Record(
{
"id": 123,
"name": "test",
"url": "http://localhost:8080/testing/api/plugins/test-app/test-endpoint/1/",
},
api,
None,
)
ret = test._endpoint_from_url(test.url)
self.assertEqual(ret.name, "test-endpoint")
def test_serialize_tag_list_order(self):
"""Add tests to ensure we're preserving tag order
This test could still give false-negatives, but making the tag list
longer helps mitigate that.
"""
test_tags = [
"one",
"two",
"three",
"four",
"five",
"six",
"seven",
"eight",
"nine",
"ten",
]
test = Record({"id": 123, "tags": test_tags}, None, None).serialize()
self.assertEqual(test["tags"], test_tags)
class RecordSetTestCase(unittest.TestCase):
ids = [1, 3, 5]
@classmethod
def init_recordset(cls):
data = [
{"id": i, "name": "dummy" + str(i), "status": "active"} for i in cls.ids
]
api = Mock(base_url="http://localhost:8000/api")
app = Mock(name="test")
class FakeRequest:
def get(self):
return iter(data)
def patch(self):
return iter(data)
return RecordSet(Endpoint(api, app, "test"), FakeRequest())
def test_delete(self):
with patch(
"pynetbox.core.query.Request._make_call", return_value=Mock()
) as mock:
mock.return_value = True
test_obj = RecordSetTestCase.init_recordset()
test = test_obj.delete()
mock.assert_called_with(
verb="delete", data=[{"id": i} for i in RecordSetTestCase.ids]
)
self.assertTrue(test)
def test_update(self):
with patch(
"pynetbox.core.query.Request._make_call", return_value=Mock()
) as mock:
mock.return_value = [
{"id": i, "name": "dummy" + str(i), "status": "offline"}
for i in RecordSetTestCase.ids
]
test_obj = RecordSetTestCase.init_recordset()
test = test_obj.update(status="offline")
mock.assert_called_with(
verb="patch",
data=[{"id": i, "status": "offline"} for i in RecordSetTestCase.ids],
)
self.assertTrue(test)
././@PaxHeader 0000000 0000000 0000000 00000000026 00000000000 010213 x ustar 00 22 mtime=1729871941.0
pynetbox-7.4.1/tests/util.py 0000644 0001751 0000177 00000000746 14706740105 015504 0 ustar 00runner docker import json
class Response:
def __init__(self, fixture=None, status_code=200, ok=True, content=None):
self.status_code = status_code
self.content = json.dumps(content) if content else self.load_fixture(fixture)
self.ok = ok
def load_fixture(self, path):
if not path:
return "{}"
with open("tests/fixtures/{}".format(path), "r") as f:
return f.read()
def json(self):
return json.loads(self.content)