mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-17 04:58:16 -06:00
5509 merge develop
This commit is contained in:
commit
1229dacf75
2
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
2
.github/ISSUE_TEMPLATE/bug_report.yaml
vendored
@ -14,7 +14,7 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: NetBox version
|
label: NetBox version
|
||||||
description: What version of NetBox are you currently running?
|
description: What version of NetBox are you currently running?
|
||||||
placeholder: v3.4.8
|
placeholder: v3.5.8
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
|
11
.github/ISSUE_TEMPLATE/config.yml
vendored
11
.github/ISSUE_TEMPLATE/config.yml
vendored
@ -3,10 +3,13 @@ blank_issues_enabled: false
|
|||||||
contact_links:
|
contact_links:
|
||||||
- name: 📖 Contributing Policy
|
- name: 📖 Contributing Policy
|
||||||
url: https://github.com/netbox-community/netbox/blob/develop/CONTRIBUTING.md
|
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"
|
about: "Please read through our contributing policy before opening an issue or pull request."
|
||||||
- name: ❓ Discussion
|
- name: ❓ Discussion
|
||||||
url: https://github.com/netbox-community/netbox/discussions
|
url: https://github.com/netbox-community/netbox/discussions
|
||||||
about: "If you're just looking for help, try starting a discussion instead"
|
about: "If you're just looking for help, try starting a discussion instead."
|
||||||
|
- name: 💡 Plugin Idea
|
||||||
|
url: https://plugin-ideas.netbox.dev
|
||||||
|
about: "Have an idea for a plugin? Head over to the ideas board!"
|
||||||
- name: 💬 Community Slack
|
- name: 💬 Community Slack
|
||||||
url: https://netdev.chat/
|
url: https://netdev.chat
|
||||||
about: "Join #netbox on the NetDev Community Slack for assistance with installation issues and other problems"
|
about: "Join #netbox on the NetDev Community Slack for assistance with installation issues and other problems."
|
||||||
|
24
.github/ISSUE_TEMPLATE/deprecation.yaml
vendored
Normal file
24
.github/ISSUE_TEMPLATE/deprecation.yaml
vendored
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
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
|
2
.github/ISSUE_TEMPLATE/feature_request.yaml
vendored
2
.github/ISSUE_TEMPLATE/feature_request.yaml
vendored
@ -14,7 +14,7 @@ body:
|
|||||||
attributes:
|
attributes:
|
||||||
label: NetBox version
|
label: NetBox version
|
||||||
description: What version of NetBox are you currently running?
|
description: What version of NetBox are you currently running?
|
||||||
placeholder: v3.4.8
|
placeholder: v3.5.8
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: dropdown
|
- type: dropdown
|
||||||
|
@ -14,12 +14,25 @@
|
|||||||
</div>
|
</div>
|
||||||
<h3></h3>
|
<h3></h3>
|
||||||
|
|
||||||
Some general tips for engaging here on GitHub:
|
## :information_source: Welcome to the Stadium!
|
||||||
|
|
||||||
|
In her book [Working in Public](https://www.amazon.com/Working-Public-Making-Maintenance-Software/dp/0578675862), Nadia Eghbal defines four production models for open source projects, categorized by contributor and user growth: federations, clubs, toys, and stadiums. The NetBox project fits her definition of a stadium very well:
|
||||||
|
|
||||||
|
> Stadiums are projects with low contributor growth and high user growth. While they may receive casual contributions, their regular contributor base does not grow proportionately to their users. As a result, they tend to be powered by one or a few developers.
|
||||||
|
|
||||||
|
The bulk of NetBox's development is carried out by a handful of core maintainers, with occasional contributions from collaborators in the community. We find the stadium analogy very useful in conveying the roles and obligations of both contributors and users.
|
||||||
|
|
||||||
|
If you're a contributor, actively working on the center stage, you have an obligation to produce quality content that will benefit the project as a whole. Conversely, if you're in the audience consuming the work being produced, you have the option of making requests and suggestions, but must also recognize that contributors are under no obligation to act on them.
|
||||||
|
|
||||||
|
NetBox users are welcome to participate in either role, on stage or in the crowd. We ask only that you acknowledge the role you've chosen and respect the roles of others.
|
||||||
|
|
||||||
|
### General Tips for Working on GitHub
|
||||||
|
|
||||||
* Register for a free [GitHub account](https://github.com/signup) if you haven't already.
|
* Register for a free [GitHub account](https://github.com/signup) if you haven't already.
|
||||||
* You can use [GitHub Markdown](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) for formatting text and adding images.
|
* You can use [GitHub Markdown](https://docs.github.com/en/get-started/writing-on-github/getting-started-with-writing-and-formatting-on-github/basic-writing-and-formatting-syntax) for formatting text and adding images.
|
||||||
* To help mitigate notification spam, please avoid "bumping" issues with no activity. (To vote an issue up or down, use a :thumbsup: or :thumbsdown: reaction.)
|
* To help mitigate notification spam, please avoid "bumping" issues with no activity. (To vote an issue up or down, use a :thumbsup: or :thumbsdown: reaction.)
|
||||||
* Please avoid pinging members with `@` unless they've previously expressed interest or involvement with that particular issue.
|
* Please avoid pinging members with `@` unless they've previously expressed interest or involvement with that particular issue.
|
||||||
|
* Familiarize yourself with [this list of discussion anti-patterns](https://github.com/bradfitz/issue-tracker-behaviors) and make every effort to avoid them.
|
||||||
|
|
||||||
## :bug: Reporting Bugs
|
## :bug: Reporting Bugs
|
||||||
|
|
||||||
|
32
README.md
32
README.md
@ -1,11 +1,10 @@
|
|||||||
<div align="center">
|
<div align="center">
|
||||||
<img src="https://raw.githubusercontent.com/netbox-community/netbox/develop/docs/netbox_logo.svg" width="400" alt="NetBox logo" />
|
<img src="https://raw.githubusercontent.com/netbox-community/netbox/develop/docs/netbox_logo.svg" width="400" alt="NetBox logo" />
|
||||||
|
<p>The premiere source of truth powering network automation</p>
|
||||||
The premiere source of truth powering network automation
|
<img src="https://github.com/netbox-community/netbox/workflows/CI/badge.svg?branch=master" alt="CI status" />
|
||||||
|
<p></p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
NetBox is the leading solution for modeling and documenting modern networks. By
|
NetBox is the leading solution for modeling and documenting modern networks. By
|
||||||
combining the traditional disciplines of IP address management (IPAM) and
|
combining the traditional disciplines of IP address management (IPAM) and
|
||||||
datacenter infrastructure management (DCIM) with powerful APIs and extensions,
|
datacenter infrastructure management (DCIM) with powerful APIs and extensions,
|
||||||
@ -29,9 +28,18 @@ as the cornerstone for network automation in thousands of organizations.
|
|||||||
|
|
||||||
## Getting Started
|
## Getting Started
|
||||||
|
|
||||||
|
<div align="center">
|
||||||
|
|
||||||
|
[](https://github.com/netbox-community/netbox)
|
||||||
|
|
||||||
|
[](https://github.com/netbox-community/netbox-docker)
|
||||||
|
|
||||||
|
[](https://netboxlabs.com/netbox-cloud/)
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
* Just want to explore? Check out [our public demo](https://demo.netbox.dev/) right now!
|
* Just want to explore? Check out [our public demo](https://demo.netbox.dev/) right now!
|
||||||
* The [official documentation](https://docs.netbox.dev) offers a comprehensive introduction.
|
* The [official documentation](https://docs.netbox.dev) offers a comprehensive introduction.
|
||||||
* Choose your deployment: [self-hosted](https://github.com/netbox-community/netbox), [Docker](https://github.com/netbox-community/netbox-docker), or [NetBox Cloud](https://netboxlabs.com/netbox-cloud/).
|
|
||||||
* Check out [our wiki](https://github.com/netbox-community/netbox/wiki/Community-Contributions) for even more projects to get the most out of NetBox!
|
* Check out [our wiki](https://github.com/netbox-community/netbox/wiki/Community-Contributions) for even more projects to get the most out of NetBox!
|
||||||
|
|
||||||
## Get Involved
|
## Get Involved
|
||||||
@ -44,10 +52,10 @@ as the cornerstone for network automation in thousands of organizations.
|
|||||||
## Project Stats
|
## Project Stats
|
||||||
|
|
||||||
<div align="center">
|
<div align="center">
|
||||||
<a href="https://github.com/netbox-community/netbox/commits"><img src="https://images.repography.com/29023055/netbox-community/netbox/recent-activity/31db894eee74b8a5475e3af307a81b6c_timeline.svg" alt="Timeline graph"></a>
|
<a href="https://github.com/netbox-community/netbox/commits"><img src="https://images.repography.com/29023055/netbox-community/netbox/recent-activity/whQtEr_TGD9PhW1BPlhlEQ5jnrgQ0KJpm-LlGtpoGO0/3Kx_iWUSBRJ5-AI4QwJEJWrUDEz3KrX2lvh8aYE0WXY_timeline.svg" alt="Timeline graph"></a>
|
||||||
<a href="https://github.com/netbox-community/netbox/issues"><img src="https://images.repography.com/29023055/netbox-community/netbox/recent-activity/31db894eee74b8a5475e3af307a81b6c_issues.svg" alt="Issues graph"></a>
|
<a href="https://github.com/netbox-community/netbox/issues"><img src="https://images.repography.com/29023055/netbox-community/netbox/recent-activity/whQtEr_TGD9PhW1BPlhlEQ5jnrgQ0KJpm-LlGtpoGO0/3Kx_iWUSBRJ5-AI4QwJEJWrUDEz3KrX2lvh8aYE0WXY_issues.svg" alt="Issues graph"></a>
|
||||||
<a href="https://github.com/netbox-community/netbox/pulls"><img src="https://images.repography.com/29023055/netbox-community/netbox/recent-activity/31db894eee74b8a5475e3af307a81b6c_prs.svg" alt="Pull requests graph"></a>
|
<a href="https://github.com/netbox-community/netbox/pulls"><img src="https://images.repography.com/29023055/netbox-community/netbox/recent-activity/whQtEr_TGD9PhW1BPlhlEQ5jnrgQ0KJpm-LlGtpoGO0/3Kx_iWUSBRJ5-AI4QwJEJWrUDEz3KrX2lvh8aYE0WXY_prs.svg" alt="Pull requests graph"></a>
|
||||||
<a href="https://github.com/netbox-community/netbox/graphs/contributors"><img src="https://images.repography.com/29023055/netbox-community/netbox/recent-activity/31db894eee74b8a5475e3af307a81b6c_users.svg" alt="Top contributors"></a>
|
<a href="https://github.com/netbox-community/netbox/graphs/contributors"><img src="https://images.repography.com/29023055/netbox-community/netbox/recent-activity/whQtEr_TGD9PhW1BPlhlEQ5jnrgQ0KJpm-LlGtpoGO0/3Kx_iWUSBRJ5-AI4QwJEJWrUDEz3KrX2lvh8aYE0WXY_users.svg" alt="Top contributors"></a>
|
||||||
<br />Stats via <a href="https://repography.com">Repography</a>
|
<br />Stats via <a href="https://repography.com">Repography</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@ -58,10 +66,12 @@ as the cornerstone for network automation in thousands of organizations.
|
|||||||
[](https://netboxlabs.com)
|
[](https://netboxlabs.com)
|
||||||
|
|
||||||
[](https://try.digitalocean.com/developer-cloud)
|
[](https://try.digitalocean.com/developer-cloud)
|
||||||
<br />
|
|
||||||
[](https://sentry.io)
|
|
||||||
|
|
||||||
|
[](https://sentry.io)
|
||||||
|
<br />
|
||||||
[](https://metal.equinix.com)
|
[](https://metal.equinix.com)
|
||||||
|
|
||||||
|
[](https://onemindservices.com)
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
# HTML sanitizer
|
# HTML sanitizer
|
||||||
# https://github.com/mozilla/bleach/blob/main/CHANGES
|
# https://github.com/mozilla/bleach/blob/main/CHANGES
|
||||||
bleach<6.0
|
bleach
|
||||||
|
|
||||||
|
# Python client for Amazon AWS API
|
||||||
|
# https://github.com/boto/boto3/blob/develop/CHANGELOG.rst
|
||||||
|
boto3
|
||||||
|
|
||||||
# The Python web framework on which NetBox is built
|
# The Python web framework on which NetBox is built
|
||||||
# https://docs.djangoproject.com/en/stable/releases/
|
# https://docs.djangoproject.com/en/stable/releases/
|
||||||
@ -62,13 +66,26 @@ django-timezone-field
|
|||||||
# https://www.django-rest-framework.org/community/release-notes/
|
# https://www.django-rest-framework.org/community/release-notes/
|
||||||
djangorestframework
|
djangorestframework
|
||||||
|
|
||||||
# Swagger/OpenAPI schema generation for REST APIs
|
# Sane and flexible OpenAPI 3 schema generation for Django REST framework.
|
||||||
# https://drf-yasg.readthedocs.io/en/stable/changelog.html
|
# https://github.com/tfranzel/drf-spectacular/blob/master/CHANGELOG.rst
|
||||||
drf-yasg[validation]
|
drf-spectacular
|
||||||
|
|
||||||
|
# Serve self-contained distribution builds of Swagger UI and Redoc with Django.
|
||||||
|
# https://github.com/tfranzel/drf-spectacular-sidecar
|
||||||
|
drf-spectacular-sidecar
|
||||||
|
|
||||||
|
# Git client for file sync
|
||||||
|
# https://github.com/jelmer/dulwich/releases
|
||||||
|
dulwich
|
||||||
|
|
||||||
|
# RSS feed parser
|
||||||
|
# https://github.com/kurtmckee/feedparser/blob/develop/CHANGELOG.rst
|
||||||
|
feedparser
|
||||||
|
|
||||||
# Django wrapper for Graphene (GraphQL support)
|
# Django wrapper for Graphene (GraphQL support)
|
||||||
# https://github.com/graphql-python/graphene-django/releases
|
# https://github.com/graphql-python/graphene-django/releases
|
||||||
graphene_django
|
# Pinned to v3.0.0 for GraphiQL UI issue (see #12762)
|
||||||
|
graphene_django==3.0.0
|
||||||
|
|
||||||
# WSGI HTTP server
|
# WSGI HTTP server
|
||||||
# https://docs.gunicorn.org/en/latest/news.html
|
# https://docs.gunicorn.org/en/latest/news.html
|
||||||
@ -121,8 +138,7 @@ social-auth-core
|
|||||||
|
|
||||||
# Django app for social-auth-core
|
# Django app for social-auth-core
|
||||||
# https://github.com/python-social-auth/social-app-django/blob/master/CHANGELOG.md
|
# https://github.com/python-social-auth/social-app-django/blob/master/CHANGELOG.md
|
||||||
# See https://github.com/python-social-auth/social-app-django/issues/429
|
social-auth-app-django
|
||||||
social-auth-app-django==5.0.0
|
|
||||||
|
|
||||||
# SVG image rendering (used for rack elevations)
|
# SVG image rendering (used for rack elevations)
|
||||||
# hhttps://github.com/mozman/svgwrite/blob/master/NEWS.rst
|
# hhttps://github.com/mozman/svgwrite/blob/master/NEWS.rst
|
||||||
|
561
contrib/generated_schema.json
Normal file
561
contrib/generated_schema.json
Normal file
@ -0,0 +1,561 @@
|
|||||||
|
{
|
||||||
|
"type": "object",
|
||||||
|
"additionalProperties": false,
|
||||||
|
"definitions": {
|
||||||
|
"airflow": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"front-to-rear",
|
||||||
|
"rear-to-front",
|
||||||
|
"left-to-right",
|
||||||
|
"right-to-left",
|
||||||
|
"side-to-rear",
|
||||||
|
"passive",
|
||||||
|
"mixed"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"weight-unit": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"kg",
|
||||||
|
"g",
|
||||||
|
"lb",
|
||||||
|
"oz"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"subdevice-role": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"parent",
|
||||||
|
"child"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"console-port": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"de-9",
|
||||||
|
"db-25",
|
||||||
|
"rj-11",
|
||||||
|
"rj-12",
|
||||||
|
"rj-45",
|
||||||
|
"mini-din-8",
|
||||||
|
"usb-a",
|
||||||
|
"usb-b",
|
||||||
|
"usb-c",
|
||||||
|
"usb-mini-a",
|
||||||
|
"usb-mini-b",
|
||||||
|
"usb-micro-a",
|
||||||
|
"usb-micro-b",
|
||||||
|
"usb-micro-ab",
|
||||||
|
"other"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"console-server-port": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"de-9",
|
||||||
|
"db-25",
|
||||||
|
"rj-11",
|
||||||
|
"rj-12",
|
||||||
|
"rj-45",
|
||||||
|
"mini-din-8",
|
||||||
|
"usb-a",
|
||||||
|
"usb-b",
|
||||||
|
"usb-c",
|
||||||
|
"usb-mini-a",
|
||||||
|
"usb-mini-b",
|
||||||
|
"usb-micro-a",
|
||||||
|
"usb-micro-b",
|
||||||
|
"usb-micro-ab",
|
||||||
|
"other"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"power-port": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"iec-60320-c6",
|
||||||
|
"iec-60320-c8",
|
||||||
|
"iec-60320-c14",
|
||||||
|
"iec-60320-c16",
|
||||||
|
"iec-60320-c20",
|
||||||
|
"iec-60320-c22",
|
||||||
|
"iec-60309-p-n-e-4h",
|
||||||
|
"iec-60309-p-n-e-6h",
|
||||||
|
"iec-60309-p-n-e-9h",
|
||||||
|
"iec-60309-2p-e-4h",
|
||||||
|
"iec-60309-2p-e-6h",
|
||||||
|
"iec-60309-2p-e-9h",
|
||||||
|
"iec-60309-3p-e-4h",
|
||||||
|
"iec-60309-3p-e-6h",
|
||||||
|
"iec-60309-3p-e-9h",
|
||||||
|
"iec-60309-3p-n-e-4h",
|
||||||
|
"iec-60309-3p-n-e-6h",
|
||||||
|
"iec-60309-3p-n-e-9h",
|
||||||
|
"iec-60906-1",
|
||||||
|
"nbr-14136-10a",
|
||||||
|
"nbr-14136-20a",
|
||||||
|
"nema-1-15p",
|
||||||
|
"nema-5-15p",
|
||||||
|
"nema-5-20p",
|
||||||
|
"nema-5-30p",
|
||||||
|
"nema-5-50p",
|
||||||
|
"nema-6-15p",
|
||||||
|
"nema-6-20p",
|
||||||
|
"nema-6-30p",
|
||||||
|
"nema-6-50p",
|
||||||
|
"nema-10-30p",
|
||||||
|
"nema-10-50p",
|
||||||
|
"nema-14-20p",
|
||||||
|
"nema-14-30p",
|
||||||
|
"nema-14-50p",
|
||||||
|
"nema-14-60p",
|
||||||
|
"nema-15-15p",
|
||||||
|
"nema-15-20p",
|
||||||
|
"nema-15-30p",
|
||||||
|
"nema-15-50p",
|
||||||
|
"nema-15-60p",
|
||||||
|
"nema-l1-15p",
|
||||||
|
"nema-l5-15p",
|
||||||
|
"nema-l5-20p",
|
||||||
|
"nema-l5-30p",
|
||||||
|
"nema-l5-50p",
|
||||||
|
"nema-l6-15p",
|
||||||
|
"nema-l6-20p",
|
||||||
|
"nema-l6-30p",
|
||||||
|
"nema-l6-50p",
|
||||||
|
"nema-l10-30p",
|
||||||
|
"nema-l14-20p",
|
||||||
|
"nema-l14-30p",
|
||||||
|
"nema-l14-50p",
|
||||||
|
"nema-l14-60p",
|
||||||
|
"nema-l15-20p",
|
||||||
|
"nema-l15-30p",
|
||||||
|
"nema-l15-50p",
|
||||||
|
"nema-l15-60p",
|
||||||
|
"nema-l21-20p",
|
||||||
|
"nema-l21-30p",
|
||||||
|
"nema-l22-30p",
|
||||||
|
"cs6361c",
|
||||||
|
"cs6365c",
|
||||||
|
"cs8165c",
|
||||||
|
"cs8265c",
|
||||||
|
"cs8365c",
|
||||||
|
"cs8465c",
|
||||||
|
"ita-c",
|
||||||
|
"ita-e",
|
||||||
|
"ita-f",
|
||||||
|
"ita-ef",
|
||||||
|
"ita-g",
|
||||||
|
"ita-h",
|
||||||
|
"ita-i",
|
||||||
|
"ita-j",
|
||||||
|
"ita-k",
|
||||||
|
"ita-l",
|
||||||
|
"ita-m",
|
||||||
|
"ita-n",
|
||||||
|
"ita-o",
|
||||||
|
"usb-a",
|
||||||
|
"usb-b",
|
||||||
|
"usb-c",
|
||||||
|
"usb-mini-a",
|
||||||
|
"usb-mini-b",
|
||||||
|
"usb-micro-a",
|
||||||
|
"usb-micro-b",
|
||||||
|
"usb-micro-ab",
|
||||||
|
"usb-3-b",
|
||||||
|
"usb-3-micro-b",
|
||||||
|
"dc-terminal",
|
||||||
|
"saf-d-grid",
|
||||||
|
"neutrik-powercon-20",
|
||||||
|
"neutrik-powercon-32",
|
||||||
|
"neutrik-powercon-true1",
|
||||||
|
"neutrik-powercon-true1-top",
|
||||||
|
"ubiquiti-smartpower",
|
||||||
|
"hardwired",
|
||||||
|
"other"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"power-outlet": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"iec-60320-c5",
|
||||||
|
"iec-60320-c7",
|
||||||
|
"iec-60320-c13",
|
||||||
|
"iec-60320-c15",
|
||||||
|
"iec-60320-c19",
|
||||||
|
"iec-60320-c21",
|
||||||
|
"iec-60309-p-n-e-4h",
|
||||||
|
"iec-60309-p-n-e-6h",
|
||||||
|
"iec-60309-p-n-e-9h",
|
||||||
|
"iec-60309-2p-e-4h",
|
||||||
|
"iec-60309-2p-e-6h",
|
||||||
|
"iec-60309-2p-e-9h",
|
||||||
|
"iec-60309-3p-e-4h",
|
||||||
|
"iec-60309-3p-e-6h",
|
||||||
|
"iec-60309-3p-e-9h",
|
||||||
|
"iec-60309-3p-n-e-4h",
|
||||||
|
"iec-60309-3p-n-e-6h",
|
||||||
|
"iec-60309-3p-n-e-9h",
|
||||||
|
"iec-60906-1",
|
||||||
|
"nbr-14136-10a",
|
||||||
|
"nbr-14136-20a",
|
||||||
|
"nema-1-15r",
|
||||||
|
"nema-5-15r",
|
||||||
|
"nema-5-20r",
|
||||||
|
"nema-5-30r",
|
||||||
|
"nema-5-50r",
|
||||||
|
"nema-6-15r",
|
||||||
|
"nema-6-20r",
|
||||||
|
"nema-6-30r",
|
||||||
|
"nema-6-50r",
|
||||||
|
"nema-10-30r",
|
||||||
|
"nema-10-50r",
|
||||||
|
"nema-14-20r",
|
||||||
|
"nema-14-30r",
|
||||||
|
"nema-14-50r",
|
||||||
|
"nema-14-60r",
|
||||||
|
"nema-15-15r",
|
||||||
|
"nema-15-20r",
|
||||||
|
"nema-15-30r",
|
||||||
|
"nema-15-50r",
|
||||||
|
"nema-15-60r",
|
||||||
|
"nema-l1-15r",
|
||||||
|
"nema-l5-15r",
|
||||||
|
"nema-l5-20r",
|
||||||
|
"nema-l5-30r",
|
||||||
|
"nema-l5-50r",
|
||||||
|
"nema-l6-15r",
|
||||||
|
"nema-l6-20r",
|
||||||
|
"nema-l6-30r",
|
||||||
|
"nema-l6-50r",
|
||||||
|
"nema-l10-30r",
|
||||||
|
"nema-l14-20r",
|
||||||
|
"nema-l14-30r",
|
||||||
|
"nema-l14-50r",
|
||||||
|
"nema-l14-60r",
|
||||||
|
"nema-l15-20r",
|
||||||
|
"nema-l15-30r",
|
||||||
|
"nema-l15-50r",
|
||||||
|
"nema-l15-60r",
|
||||||
|
"nema-l21-20r",
|
||||||
|
"nema-l21-30r",
|
||||||
|
"nema-l22-30r",
|
||||||
|
"CS6360C",
|
||||||
|
"CS6364C",
|
||||||
|
"CS8164C",
|
||||||
|
"CS8264C",
|
||||||
|
"CS8364C",
|
||||||
|
"CS8464C",
|
||||||
|
"ita-e",
|
||||||
|
"ita-f",
|
||||||
|
"ita-g",
|
||||||
|
"ita-h",
|
||||||
|
"ita-i",
|
||||||
|
"ita-j",
|
||||||
|
"ita-k",
|
||||||
|
"ita-l",
|
||||||
|
"ita-m",
|
||||||
|
"ita-n",
|
||||||
|
"ita-o",
|
||||||
|
"ita-multistandard",
|
||||||
|
"usb-a",
|
||||||
|
"usb-micro-b",
|
||||||
|
"usb-c",
|
||||||
|
"dc-terminal",
|
||||||
|
"hdot-cx",
|
||||||
|
"saf-d-grid",
|
||||||
|
"neutrik-powercon-20a",
|
||||||
|
"neutrik-powercon-32a",
|
||||||
|
"neutrik-powercon-true1",
|
||||||
|
"neutrik-powercon-true1-top",
|
||||||
|
"ubiquiti-smartpower",
|
||||||
|
"hardwired",
|
||||||
|
"other"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"feed-leg": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"A",
|
||||||
|
"B",
|
||||||
|
"C"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"interface": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"virtual",
|
||||||
|
"bridge",
|
||||||
|
"lag",
|
||||||
|
"100base-fx",
|
||||||
|
"100base-lfx",
|
||||||
|
"100base-tx",
|
||||||
|
"100base-t1",
|
||||||
|
"1000base-t",
|
||||||
|
"2.5gbase-t",
|
||||||
|
"5gbase-t",
|
||||||
|
"10gbase-t",
|
||||||
|
"10gbase-cx4",
|
||||||
|
"1000base-x-gbic",
|
||||||
|
"1000base-x-sfp",
|
||||||
|
"10gbase-x-sfpp",
|
||||||
|
"10gbase-x-xfp",
|
||||||
|
"10gbase-x-xenpak",
|
||||||
|
"10gbase-x-x2",
|
||||||
|
"25gbase-x-sfp28",
|
||||||
|
"50gbase-x-sfp56",
|
||||||
|
"40gbase-x-qsfpp",
|
||||||
|
"50gbase-x-sfp28",
|
||||||
|
"100gbase-x-cfp",
|
||||||
|
"100gbase-x-cfp2",
|
||||||
|
"200gbase-x-cfp2",
|
||||||
|
"100gbase-x-cfp4",
|
||||||
|
"100gbase-x-cxp",
|
||||||
|
"100gbase-x-cpak",
|
||||||
|
"100gbase-x-dsfp",
|
||||||
|
"100gbase-x-sfpdd",
|
||||||
|
"100gbase-x-qsfp28",
|
||||||
|
"100gbase-x-qsfpdd",
|
||||||
|
"200gbase-x-qsfp56",
|
||||||
|
"200gbase-x-qsfpdd",
|
||||||
|
"400gbase-x-qsfpdd",
|
||||||
|
"400gbase-x-osfp",
|
||||||
|
"400gbase-x-cdfp",
|
||||||
|
"400gbase-x-cfp8",
|
||||||
|
"800gbase-x-qsfpdd",
|
||||||
|
"800gbase-x-osfp",
|
||||||
|
"1000base-kx",
|
||||||
|
"10gbase-kr",
|
||||||
|
"10gbase-kx4",
|
||||||
|
"25gbase-kr",
|
||||||
|
"40gbase-kr4",
|
||||||
|
"50gbase-kr",
|
||||||
|
"100gbase-kp4",
|
||||||
|
"100gbase-kr2",
|
||||||
|
"100gbase-kr4",
|
||||||
|
"ieee802.11a",
|
||||||
|
"ieee802.11g",
|
||||||
|
"ieee802.11n",
|
||||||
|
"ieee802.11ac",
|
||||||
|
"ieee802.11ad",
|
||||||
|
"ieee802.11ax",
|
||||||
|
"ieee802.11ay",
|
||||||
|
"ieee802.15.1",
|
||||||
|
"other-wireless",
|
||||||
|
"gsm",
|
||||||
|
"cdma",
|
||||||
|
"lte",
|
||||||
|
"sonet-oc3",
|
||||||
|
"sonet-oc12",
|
||||||
|
"sonet-oc48",
|
||||||
|
"sonet-oc192",
|
||||||
|
"sonet-oc768",
|
||||||
|
"sonet-oc1920",
|
||||||
|
"sonet-oc3840",
|
||||||
|
"1gfc-sfp",
|
||||||
|
"2gfc-sfp",
|
||||||
|
"4gfc-sfp",
|
||||||
|
"8gfc-sfpp",
|
||||||
|
"16gfc-sfpp",
|
||||||
|
"32gfc-sfp28",
|
||||||
|
"64gfc-qsfpp",
|
||||||
|
"128gfc-qsfp28",
|
||||||
|
"infiniband-sdr",
|
||||||
|
"infiniband-ddr",
|
||||||
|
"infiniband-qdr",
|
||||||
|
"infiniband-fdr10",
|
||||||
|
"infiniband-fdr",
|
||||||
|
"infiniband-edr",
|
||||||
|
"infiniband-hdr",
|
||||||
|
"infiniband-ndr",
|
||||||
|
"infiniband-xdr",
|
||||||
|
"t1",
|
||||||
|
"e1",
|
||||||
|
"t3",
|
||||||
|
"e3",
|
||||||
|
"xdsl",
|
||||||
|
"docsis",
|
||||||
|
"gpon",
|
||||||
|
"xg-pon",
|
||||||
|
"xgs-pon",
|
||||||
|
"ng-pon2",
|
||||||
|
"epon",
|
||||||
|
"10g-epon",
|
||||||
|
"cisco-stackwise",
|
||||||
|
"cisco-stackwise-plus",
|
||||||
|
"cisco-flexstack",
|
||||||
|
"cisco-flexstack-plus",
|
||||||
|
"cisco-stackwise-80",
|
||||||
|
"cisco-stackwise-160",
|
||||||
|
"cisco-stackwise-320",
|
||||||
|
"cisco-stackwise-480",
|
||||||
|
"cisco-stackwise-1t",
|
||||||
|
"juniper-vcp",
|
||||||
|
"extreme-summitstack",
|
||||||
|
"extreme-summitstack-128",
|
||||||
|
"extreme-summitstack-256",
|
||||||
|
"extreme-summitstack-512",
|
||||||
|
"other"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"poe_mode": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"pd",
|
||||||
|
"pse"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"poe_type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"type1-ieee802.3af",
|
||||||
|
"type2-ieee802.3at",
|
||||||
|
"type3-ieee802.3bt",
|
||||||
|
"type4-ieee802.3bt",
|
||||||
|
"passive-24v-2pair",
|
||||||
|
"passive-24v-4pair",
|
||||||
|
"passive-48v-2pair",
|
||||||
|
"passive-48v-4pair"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"front-port": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"8p8c",
|
||||||
|
"8p6c",
|
||||||
|
"8p4c",
|
||||||
|
"8p2c",
|
||||||
|
"6p6c",
|
||||||
|
"6p4c",
|
||||||
|
"6p2c",
|
||||||
|
"4p4c",
|
||||||
|
"4p2c",
|
||||||
|
"gg45",
|
||||||
|
"tera-4p",
|
||||||
|
"tera-2p",
|
||||||
|
"tera-1p",
|
||||||
|
"110-punch",
|
||||||
|
"bnc",
|
||||||
|
"f",
|
||||||
|
"n",
|
||||||
|
"mrj21",
|
||||||
|
"fc",
|
||||||
|
"lc",
|
||||||
|
"lc-pc",
|
||||||
|
"lc-upc",
|
||||||
|
"lc-apc",
|
||||||
|
"lsh",
|
||||||
|
"lsh-pc",
|
||||||
|
"lsh-upc",
|
||||||
|
"lsh-apc",
|
||||||
|
"lx5",
|
||||||
|
"lx5-pc",
|
||||||
|
"lx5-upc",
|
||||||
|
"lx5-apc",
|
||||||
|
"mpo",
|
||||||
|
"mtrj",
|
||||||
|
"sc",
|
||||||
|
"sc-pc",
|
||||||
|
"sc-upc",
|
||||||
|
"sc-apc",
|
||||||
|
"st",
|
||||||
|
"cs",
|
||||||
|
"sn",
|
||||||
|
"sma-905",
|
||||||
|
"sma-906",
|
||||||
|
"urm-p2",
|
||||||
|
"urm-p4",
|
||||||
|
"urm-p8",
|
||||||
|
"splice",
|
||||||
|
"other"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"rear-port": {
|
||||||
|
"type": "object",
|
||||||
|
"properties": {
|
||||||
|
"type": {
|
||||||
|
"type": "string",
|
||||||
|
"enum": [
|
||||||
|
"8p8c",
|
||||||
|
"8p6c",
|
||||||
|
"8p4c",
|
||||||
|
"8p2c",
|
||||||
|
"6p6c",
|
||||||
|
"6p4c",
|
||||||
|
"6p2c",
|
||||||
|
"4p4c",
|
||||||
|
"4p2c",
|
||||||
|
"gg45",
|
||||||
|
"tera-4p",
|
||||||
|
"tera-2p",
|
||||||
|
"tera-1p",
|
||||||
|
"110-punch",
|
||||||
|
"bnc",
|
||||||
|
"f",
|
||||||
|
"n",
|
||||||
|
"mrj21",
|
||||||
|
"fc",
|
||||||
|
"lc",
|
||||||
|
"lc-pc",
|
||||||
|
"lc-upc",
|
||||||
|
"lc-apc",
|
||||||
|
"lsh",
|
||||||
|
"lsh-pc",
|
||||||
|
"lsh-upc",
|
||||||
|
"lsh-apc",
|
||||||
|
"lx5",
|
||||||
|
"lx5-pc",
|
||||||
|
"lx5-upc",
|
||||||
|
"lx5-apc",
|
||||||
|
"mpo",
|
||||||
|
"mtrj",
|
||||||
|
"sc",
|
||||||
|
"sc-pc",
|
||||||
|
"sc-upc",
|
||||||
|
"sc-apc",
|
||||||
|
"st",
|
||||||
|
"cs",
|
||||||
|
"sn",
|
||||||
|
"sma-905",
|
||||||
|
"sma-906",
|
||||||
|
"urm-p2",
|
||||||
|
"urm-p4",
|
||||||
|
"urm-p8",
|
||||||
|
"splice",
|
||||||
|
"other"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
17
contrib/netbox-housekeeping.service
Normal file
17
contrib/netbox-housekeeping.service
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=NetBox Housekeeping Service
|
||||||
|
Documentation=https://docs.netbox.dev/
|
||||||
|
After=network-online.target
|
||||||
|
Wants=network-online.target
|
||||||
|
|
||||||
|
[Service]
|
||||||
|
Type=simple
|
||||||
|
|
||||||
|
User=netbox
|
||||||
|
Group=netbox
|
||||||
|
WorkingDirectory=/opt/netbox
|
||||||
|
|
||||||
|
ExecStart=/opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py housekeeping
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
13
contrib/netbox-housekeeping.timer
Normal file
13
contrib/netbox-housekeeping.timer
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
[Unit]
|
||||||
|
Description=NetBox Housekeeping Timer
|
||||||
|
Documentation=https://docs.netbox.dev/
|
||||||
|
After=network-online.target
|
||||||
|
Wants=network-online.target
|
||||||
|
|
||||||
|
[Timer]
|
||||||
|
OnCalendar=daily
|
||||||
|
AccuracySec=1h
|
||||||
|
Persistent=true
|
||||||
|
|
||||||
|
[Install]
|
||||||
|
WantedBy=multi-user.target
|
95605
contrib/openapi2.json
Normal file
95605
contrib/openapi2.json
Normal file
File diff suppressed because it is too large
Load Diff
69695
contrib/openapi2.yaml
Normal file
69695
contrib/openapi2.yaml
Normal file
File diff suppressed because it is too large
Load Diff
@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
### Enabling Error Reporting
|
### Enabling Error Reporting
|
||||||
|
|
||||||
NetBox v3.2.3 and later support native integration with [Sentry](https://sentry.io/) for automatic error reporting. To enable this functionality, simply set `SENTRY_ENABLED` to True in `configuration.py`. Errors will be sent to a Sentry ingestor maintained by the NetBox team for analysis.
|
NetBox supports native integration with [Sentry](https://sentry.io/) for automatic error reporting. To enable this functionality, simply set `SENTRY_ENABLED` to True in `configuration.py`. Errors will be sent to a Sentry ingestor maintained by the NetBox team for analysis.
|
||||||
|
|
||||||
```python
|
```python
|
||||||
SENTRY_ENABLED = True
|
SENTRY_ENABLED = True
|
||||||
|
@ -4,10 +4,16 @@ NetBox includes a `housekeeping` management command that should be run nightly.
|
|||||||
|
|
||||||
* Clearing expired authentication sessions from the database
|
* Clearing expired authentication sessions from the database
|
||||||
* Deleting changelog records older than the configured [retention time](../configuration/miscellaneous.md#changelog_retention)
|
* Deleting changelog records older than the configured [retention time](../configuration/miscellaneous.md#changelog_retention)
|
||||||
* Deleting job result records older than the configured [retention time](../configuration/miscellaneous.md#jobresult_retention)
|
* Deleting job result records older than the configured [retention time](../configuration/miscellaneous.md#job_retention)
|
||||||
* Check for new NetBox releases (if [`RELEASE_CHECK_URL`](../configuration/miscellaneous.md#release_check_url) is set)
|
* Check for new NetBox releases (if [`RELEASE_CHECK_URL`](../configuration/miscellaneous.md#release_check_url) is set)
|
||||||
|
|
||||||
This command can be invoked directly, or by using the shell script provided at `/opt/netbox/contrib/netbox-housekeeping.sh`. This script can be linked from your cron scheduler's daily jobs directory (e.g. `/etc/cron.daily`) or referenced directly within the cron configuration file.
|
This command can be invoked directly, or by using the shell script provided at `/opt/netbox/contrib/netbox-housekeeping.sh`.
|
||||||
|
|
||||||
|
## Scheduling
|
||||||
|
|
||||||
|
### Using Cron
|
||||||
|
|
||||||
|
This script can be linked from your cron scheduler's daily jobs directory (e.g. `/etc/cron.daily`) or referenced directly within the cron configuration file.
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
sudo ln -s /opt/netbox/contrib/netbox-housekeeping.sh /etc/cron.daily/netbox-housekeeping
|
sudo ln -s /opt/netbox/contrib/netbox-housekeeping.sh /etc/cron.daily/netbox-housekeeping
|
||||||
@ -16,4 +22,28 @@ sudo ln -s /opt/netbox/contrib/netbox-housekeeping.sh /etc/cron.daily/netbox-hou
|
|||||||
!!! note
|
!!! note
|
||||||
On Debian-based systems, be sure to omit the `.sh` file extension when linking to the script from within a cron directory. Otherwise, the task may not run.
|
On Debian-based systems, be sure to omit the `.sh` file extension when linking to the script from within a cron directory. Otherwise, the task may not run.
|
||||||
|
|
||||||
The `housekeeping` command can also be run manually at any time: Running the command outside scheduled execution times will not interfere with its operation.
|
### Using Systemd
|
||||||
|
|
||||||
|
First, create symbolic links for the systemd service and timer files. Link the existing service and timer files from the `/opt/netbox/contrib/` directory to the `/etc/systemd/system/` directory:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo ln -s /opt/netbox/contrib/netbox-housekeeping.service /etc/systemd/system/netbox-housekeeping.service
|
||||||
|
sudo ln -s /opt/netbox/contrib/netbox-housekeeping.timer /etc/systemd/system/netbox-housekeeping.timer
|
||||||
|
```
|
||||||
|
|
||||||
|
Then, reload the systemd configuration and enable the timer to start automatically at boot:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo systemctl daemon-reload
|
||||||
|
sudo systemctl enable --now netbox-housekeeping.timer
|
||||||
|
```
|
||||||
|
|
||||||
|
Check the status of your timer by running:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
sudo systemctl list-timers --all
|
||||||
|
```
|
||||||
|
|
||||||
|
This command will show a list of all timers, including your `netbox-housekeeping.timer`. Make sure the timer is active and properly scheduled.
|
||||||
|
|
||||||
|
That's it! Your NetBox housekeeping service is now configured to run daily using systemd.
|
||||||
|
@ -153,15 +153,10 @@ New objects can be created by instantiating the desired model, defining values f
|
|||||||
```
|
```
|
||||||
>>> lab1 = Site.objects.get(pk=7)
|
>>> lab1 = Site.objects.get(pk=7)
|
||||||
>>> myvlan = VLAN(vid=123, name='MyNewVLAN', site=lab1)
|
>>> myvlan = VLAN(vid=123, name='MyNewVLAN', site=lab1)
|
||||||
|
>>> myvlan.full_clean()
|
||||||
>>> myvlan.save()
|
>>> myvlan.save()
|
||||||
```
|
```
|
||||||
|
|
||||||
Alternatively, the above can be performed as a single operation. (Note, however, that `save()` does _not_ return the new instance for reuse.)
|
|
||||||
|
|
||||||
```
|
|
||||||
>>> VLAN(vid=123, name='MyNewVLAN', site=Site.objects.get(pk=7)).save()
|
|
||||||
```
|
|
||||||
|
|
||||||
To modify an existing object, we retrieve it, update the desired field(s), and call `save()` again.
|
To modify an existing object, we retrieve it, update the desired field(s), and call `save()` again.
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -169,6 +164,7 @@ To modify an existing object, we retrieve it, update the desired field(s), and c
|
|||||||
>>> vlan.name
|
>>> vlan.name
|
||||||
'MyNewVLAN'
|
'MyNewVLAN'
|
||||||
>>> vlan.name = 'BetterName'
|
>>> vlan.name = 'BetterName'
|
||||||
|
>>> vlan.full_clean()
|
||||||
>>> vlan.save()
|
>>> vlan.save()
|
||||||
>>> VLAN.objects.get(pk=1280).name
|
>>> VLAN.objects.get(pk=1280).name
|
||||||
'BetterName'
|
'BetterName'
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Object-Based Permissions
|
# Object-Based Permissions
|
||||||
|
|
||||||
NetBox v2.9 introduced a new object-based permissions framework, which replaces Django's built-in permissions model. Object-based permissions enable an administrator to grant users or groups the ability to perform an action on arbitrary subsets of objects in NetBox, rather than all objects of a certain type. For example, it is possible to grant a user permission to view only sites within a particular region, or to modify only VLANs with a numeric ID within a certain range.
|
NetBox employs a new object-based permissions framework, which replaces Django's built-in permissions model. Object-based permissions enable an administrator to grant users or groups the ability to perform an action on arbitrary subsets of objects in NetBox, rather than all objects of a certain type. For example, it is possible to grant a user permission to view only sites within a particular region, or to modify only VLANs with a numeric ID within a certain range.
|
||||||
|
|
||||||
A permission in NetBox represents a relationship shared by several components:
|
A permission in NetBox represents a relationship shared by several components:
|
||||||
|
|
||||||
@ -20,7 +20,7 @@ There are four core actions that can be permitted for each type of object within
|
|||||||
* **Change** - Modify an existing object
|
* **Change** - Modify an existing object
|
||||||
* **Delete** - Delete an existing object
|
* **Delete** - Delete an existing object
|
||||||
|
|
||||||
In addition to these, permissions can also grant custom actions that may be required by a specific model or plugin. For example, the `napalm_read` permission on the device model allows a user to execute NAPALM queries on a device via NetBox's REST API. These can be specified when granting a permission in the "additional actions" field.
|
In addition to these, permissions can also grant custom actions that may be required by a specific model or plugin. For example, the `run` permission for scripts allows a user to execute custom scripts. These can be specified when granting a permission in the "additional actions" field.
|
||||||
|
|
||||||
!!! note
|
!!! note
|
||||||
Internally, all actions granted by a permission (both built-in and custom) are stored as strings in an array field named `actions`.
|
Internally, all actions granted by a permission (both built-in and custom) are stored as strings in an array field named `actions`.
|
||||||
@ -58,8 +58,6 @@ Additionally, where multiple permissions have been assigned for an object type,
|
|||||||
|
|
||||||
### User Token
|
### User Token
|
||||||
|
|
||||||
!!! info "This feature was introduced in NetBox v3.3"
|
|
||||||
|
|
||||||
When defining a permission constraint, administrators may use the special token `$user` to reference the current user at the time of evaluation. This can be helpful to restrict users to editing only their own journal entries, for example. Such a constraint might be defined as:
|
When defining a permission constraint, administrators may use the special token `$user` to reference the current user at the time of evaluation. This can be helpful to restrict users to editing only their own journal entries, for example. Such a constraint might be defined as:
|
||||||
|
|
||||||
```json
|
```json
|
||||||
|
@ -1,5 +1,50 @@
|
|||||||
# Default Value Parameters
|
# Default Value Parameters
|
||||||
|
|
||||||
|
## DEFAULT_DASHBOARD
|
||||||
|
|
||||||
|
This parameter controls the content and layout of user's default dashboard. Once the dashboard has been created, the user is free to customize it as they please by adding, removing, and reconfiguring widgets.
|
||||||
|
|
||||||
|
This parameter must specify an iterable of dictionaries, each representing a discrete dashboard widget and its configuration. The follow widget attributes are supported:
|
||||||
|
|
||||||
|
* `widget`: Dotted path to the Python class (required)
|
||||||
|
* `width`: Default widget width (between 1 and 12, inclusive)
|
||||||
|
* `height`: Default widget height, in rows
|
||||||
|
* `title`: Widget title
|
||||||
|
* `color`: Color of the widget's title bar, specified by name
|
||||||
|
* `config`: Dictionary mapping of any widget configuration parameters
|
||||||
|
|
||||||
|
A brief example configuration is provided below.
|
||||||
|
|
||||||
|
```python
|
||||||
|
DEFAULT_DASHBOARD = [
|
||||||
|
{
|
||||||
|
'widget': 'extras.ObjectCountsWidget',
|
||||||
|
'width': 4,
|
||||||
|
'height': 2,
|
||||||
|
'title': 'Organization',
|
||||||
|
'config': {
|
||||||
|
'models': [
|
||||||
|
'dcim.site',
|
||||||
|
'tenancy.tenant',
|
||||||
|
'tenancy.contact',
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'widget': 'extras.ObjectCountsWidget',
|
||||||
|
'title': 'IPAM',
|
||||||
|
'color': 'blue',
|
||||||
|
'config': {
|
||||||
|
'models': [
|
||||||
|
'ipam.prefix',
|
||||||
|
'ipam.iprange',
|
||||||
|
'ipam.ipaddress',
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
]
|
||||||
|
```
|
||||||
|
|
||||||
## DEFAULT_USER_PREFERENCES
|
## DEFAULT_USER_PREFERENCES
|
||||||
|
|
||||||
!!! tip "Dynamic Configuration Parameter"
|
!!! tip "Dynamic Configuration Parameter"
|
||||||
|
@ -26,14 +26,10 @@ Some configuration parameters are primarily controlled via NetBox's admin interf
|
|||||||
* [`DEFAULT_USER_PREFERENCES`](./default-values.md#default_user_preferences)
|
* [`DEFAULT_USER_PREFERENCES`](./default-values.md#default_user_preferences)
|
||||||
* [`ENFORCE_GLOBAL_UNIQUE`](./miscellaneous.md#enforce_global_unique)
|
* [`ENFORCE_GLOBAL_UNIQUE`](./miscellaneous.md#enforce_global_unique)
|
||||||
* [`GRAPHQL_ENABLED`](./miscellaneous.md#graphql_enabled)
|
* [`GRAPHQL_ENABLED`](./miscellaneous.md#graphql_enabled)
|
||||||
* [`JOBRESULT_RETENTION`](./miscellaneous.md#jobresult_retention)
|
* [`JOB_RETENTION`](./miscellaneous.md#job_retention)
|
||||||
* [`MAINTENANCE_MODE`](./miscellaneous.md#maintenance_mode)
|
* [`MAINTENANCE_MODE`](./miscellaneous.md#maintenance_mode)
|
||||||
* [`MAPS_URL`](./miscellaneous.md#maps_url)
|
* [`MAPS_URL`](./miscellaneous.md#maps_url)
|
||||||
* [`MAX_PAGE_SIZE`](./miscellaneous.md#max_page_size)
|
* [`MAX_PAGE_SIZE`](./miscellaneous.md#max_page_size)
|
||||||
* [`NAPALM_ARGS`](./napalm.md#napalm_args)
|
|
||||||
* [`NAPALM_PASSWORD`](./napalm.md#napalm_password)
|
|
||||||
* [`NAPALM_TIMEOUT`](./napalm.md#napalm_timeout)
|
|
||||||
* [`NAPALM_USERNAME`](./napalm.md#napalm_username)
|
|
||||||
* [`PAGINATE_COUNT`](./default-values.md#paginate_count)
|
* [`PAGINATE_COUNT`](./default-values.md#paginate_count)
|
||||||
* [`POWERFEED_DEFAULT_AMPERAGE`](./default-values.md#powerfeed_default_amperage)
|
* [`POWERFEED_DEFAULT_AMPERAGE`](./default-values.md#powerfeed_default_amperage)
|
||||||
* [`POWERFEED_DEFAULT_MAX_UTILIZATION`](./default-values.md#powerfeed_default_max_utilization)
|
* [`POWERFEED_DEFAULT_MAX_UTILIZATION`](./default-values.md#powerfeed_default_max_utilization)
|
||||||
|
@ -29,6 +29,17 @@ This defines custom content to be displayed on the login page above the login fo
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## BANNER_MAINTENANCE
|
||||||
|
|
||||||
|
!!! tip "Dynamic Configuration Parameter"
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
This parameter was added in NetBox v3.5.
|
||||||
|
|
||||||
|
This adds a banner to the top of every page when maintenance mode is enabled. HTML is allowed.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## BANNER_TOP
|
## BANNER_TOP
|
||||||
|
|
||||||
!!! tip "Dynamic Configuration Parameter"
|
!!! tip "Dynamic Configuration Parameter"
|
||||||
@ -45,6 +56,16 @@ Sets content for the top banner in the user interface.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## CENSUS_REPORTING_ENABLED
|
||||||
|
|
||||||
|
Default: True
|
||||||
|
|
||||||
|
Enables anonymous census reporting. To opt out of census reporting, set this to False.
|
||||||
|
|
||||||
|
This data enables the project maintainers to estimate how many NetBox deployments exist and track the adoption of new versions over time. Census reporting effects a single HTTP request each time a worker starts. The only data reported by this function are the NetBox version, Python version, and a pseudorandom unique identifier.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## CHANGELOG_RETENTION
|
## CHANGELOG_RETENTION
|
||||||
|
|
||||||
!!! tip "Dynamic Configuration Parameter"
|
!!! tip "Dynamic Configuration Parameter"
|
||||||
@ -87,14 +108,16 @@ Setting this to False will disable the GraphQL API.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## JOBRESULT_RETENTION
|
## JOB_RETENTION
|
||||||
|
|
||||||
!!! tip "Dynamic Configuration Parameter"
|
!!! tip "Dynamic Configuration Parameter"
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
This parameter was renamed from `JOBRESULT_RETENTION` in NetBox v3.5.
|
||||||
|
|
||||||
Default: 90
|
Default: 90
|
||||||
|
|
||||||
The number of days to retain job results (scripts and reports). Set this to `0` to retain
|
The number of days to retain job results (scripts and reports). Set this to `0` to retain job results in the database indefinitely.
|
||||||
job results in the database indefinitely.
|
|
||||||
|
|
||||||
!!! warning
|
!!! warning
|
||||||
If enabling indefinite job results retention, it is recommended to periodically delete old entries. Otherwise, the database may eventually exceed capacity.
|
If enabling indefinite job results retention, it is recommended to periodically delete old entries. Otherwise, the database may eventually exceed capacity.
|
||||||
@ -117,7 +140,7 @@ Setting this to True will display a "maintenance mode" banner at the top of ever
|
|||||||
|
|
||||||
Default: `https://maps.google.com/?q=` (Google Maps)
|
Default: `https://maps.google.com/?q=` (Google Maps)
|
||||||
|
|
||||||
This specifies the URL to use when presenting a map of a physical location by street address or GPS coordinates. The URL must accept either a free-form street address or a comma-separated pair of numeric coordinates appended to it.
|
This specifies the URL to use when presenting a map of a physical location by street address or GPS coordinates. The URL must accept either a free-form street address or a comma-separated pair of numeric coordinates appended to it. Set this to `None` to disable the "map it" button within the UI.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
@ -181,3 +204,25 @@ This parameter defines the URL of the repository that will be checked for new Ne
|
|||||||
Default: `300`
|
Default: `300`
|
||||||
|
|
||||||
The maximum execution time of a background task (such as running a custom script), in seconds.
|
The maximum execution time of a background task (such as running a custom script), in seconds.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## RQ_RETRY_INTERVAL
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
This parameter was added in NetBox v3.5.
|
||||||
|
|
||||||
|
Default: `60`
|
||||||
|
|
||||||
|
This parameter controls how frequently a failed job is retried, up to the maximum number of times specified by `RQ_RETRY_MAX`. This must be either an integer specifying the number of seconds to wait between successive attempts, or a list of such values. For example, `[60, 300, 3600]` will retry the task after 1 minute, 5 minutes, and 1 hour.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## RQ_RETRY_MAX
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
This parameter was added in NetBox v3.5.
|
||||||
|
|
||||||
|
Default: `0` (retries disabled)
|
||||||
|
|
||||||
|
The maximum number of times a background task will be retried before being marked as failed.
|
||||||
|
@ -1,51 +0,0 @@
|
|||||||
# NAPALM Parameters
|
|
||||||
|
|
||||||
## NAPALM_USERNAME
|
|
||||||
|
|
||||||
## NAPALM_PASSWORD
|
|
||||||
|
|
||||||
!!! tip "Dynamic Configuration Parameter"
|
|
||||||
|
|
||||||
NetBox will use these credentials when authenticating to remote devices via the supported [NAPALM integration](../integrations/napalm.md), if installed. Both parameters are optional.
|
|
||||||
|
|
||||||
!!! note
|
|
||||||
If SSH public key authentication has been set up on the remote device(s) for the system account under which NetBox runs, these parameters are not needed.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## NAPALM_ARGS
|
|
||||||
|
|
||||||
!!! tip "Dynamic Configuration Parameter"
|
|
||||||
|
|
||||||
A dictionary of optional arguments to pass to NAPALM when instantiating a network driver. See the NAPALM documentation for a [complete list of optional arguments](https://napalm.readthedocs.io/en/latest/support/#optional-arguments). An example:
|
|
||||||
|
|
||||||
```python
|
|
||||||
NAPALM_ARGS = {
|
|
||||||
'api_key': '472071a93b60a1bd1fafb401d9f8ef41',
|
|
||||||
'port': 2222,
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Some platforms (e.g. Cisco IOS) require an argument named `secret` to be passed in addition to the normal password. If desired, you can use the configured `NAPALM_PASSWORD` as the value for this argument:
|
|
||||||
|
|
||||||
```python
|
|
||||||
NAPALM_USERNAME = 'username'
|
|
||||||
NAPALM_PASSWORD = 'MySecretPassword'
|
|
||||||
NAPALM_ARGS = {
|
|
||||||
'secret': NAPALM_PASSWORD,
|
|
||||||
# Include any additional args here
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
||||||
## NAPALM_TIMEOUT
|
|
||||||
|
|
||||||
!!! tip "Dynamic Configuration Parameter"
|
|
||||||
|
|
||||||
Default: 30 seconds
|
|
||||||
|
|
||||||
The amount of time (in seconds) to wait for NAPALM to connect to a device.
|
|
||||||
|
|
||||||
---
|
|
||||||
|
|
@ -4,6 +4,14 @@ The configuration parameters listed here control remote authentication for NetBo
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## REMOTE_AUTH_AUTO_CREATE_GROUPS
|
||||||
|
|
||||||
|
Default: `False`
|
||||||
|
|
||||||
|
If true, NetBox will automatically create groups specified in the `REMOTE_AUTH_GROUP_HEADER` header if they don't already exist. (Requires `REMOTE_AUTH_ENABLED`.)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## REMOTE_AUTH_AUTO_CREATE_USER
|
## REMOTE_AUTH_AUTO_CREATE_USER
|
||||||
|
|
||||||
Default: `False`
|
Default: `False`
|
||||||
|
@ -33,11 +33,13 @@ NetBox requires access to a PostgreSQL 11 or later database service to store dat
|
|||||||
* `HOST` - Name or IP address of the database server (use `localhost` if running locally)
|
* `HOST` - Name or IP address of the database server (use `localhost` if running locally)
|
||||||
* `PORT` - TCP port of the PostgreSQL service; leave blank for default port (TCP/5432)
|
* `PORT` - TCP port of the PostgreSQL service; leave blank for default port (TCP/5432)
|
||||||
* `CONN_MAX_AGE` - Lifetime of a [persistent database connection](https://docs.djangoproject.com/en/stable/ref/databases/#persistent-connections), in seconds (300 is the default)
|
* `CONN_MAX_AGE` - Lifetime of a [persistent database connection](https://docs.djangoproject.com/en/stable/ref/databases/#persistent-connections), in seconds (300 is the default)
|
||||||
|
* `ENGINE` - The database backend to use; must be a PostgreSQL-compatible backend (e.g. `django.db.backends.postgresql`)
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
DATABASE = {
|
DATABASE = {
|
||||||
|
'ENGINE': 'django.db.backends.postgresql',
|
||||||
'NAME': 'netbox', # Database name
|
'NAME': 'netbox', # Database name
|
||||||
'USER': 'netbox', # PostgreSQL username
|
'USER': 'netbox', # PostgreSQL username
|
||||||
'PASSWORD': 'J5brHrAXFLQSif0K', # PostgreSQL password
|
'PASSWORD': 'J5brHrAXFLQSif0K', # PostgreSQL password
|
||||||
@ -50,6 +52,9 @@ DATABASE = {
|
|||||||
!!! note
|
!!! note
|
||||||
NetBox supports all PostgreSQL database options supported by the underlying Django framework. For a complete list of available parameters, please see [the Django documentation](https://docs.djangoproject.com/en/stable/ref/settings/#databases).
|
NetBox supports all PostgreSQL database options supported by the underlying Django framework. For a complete list of available parameters, please see [the Django documentation](https://docs.djangoproject.com/en/stable/ref/settings/#databases).
|
||||||
|
|
||||||
|
!!! warning
|
||||||
|
Make sure to use a PostgreSQL-compatible backend for the ENGINE setting. If you don't specify an ENGINE, the default will be django.db.backends.postgresql.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## REDIS
|
## REDIS
|
||||||
@ -144,8 +149,6 @@ REDIS = {
|
|||||||
|
|
||||||
## SECRET_KEY
|
## SECRET_KEY
|
||||||
|
|
||||||
This is a secret, random string used to assist in the creation new cryptographic hashes for passwords and HTTP cookies. The key defined here should not be shared outside of the configuration file. `SECRET_KEY` can be changed at any time, however be aware that doing so will invalidate all existing sessions.
|
This is a secret, pseudorandom string used to assist in the creation new cryptographic hashes for passwords and HTTP cookies. The key defined here should not be shared outside the configuration file. `SECRET_KEY` can be changed at any time without impacting stored data, however be aware that doing so will invalidate all existing user sessions. NetBox deployments comprising multiple nodes must have the same secret key configured on all nodes.
|
||||||
|
|
||||||
Please note that this key is **not** used directly for hashing user passwords or for the encrypted storage of secret data in NetBox.
|
`SECRET_KEY` **must** be at least 50 characters in length, and should contain a mix of letters, digits, and symbols. The script located at `$INSTALL_ROOT/netbox/generate_secret_key.py` may be used to generate a suitable key. Please note that this key is **not** used directly for hashing user passwords or for the encrypted storage of secret data in NetBox.
|
||||||
|
|
||||||
`SECRET_KEY` should be at least 50 characters in length and contain a random mix of letters, digits, and symbols. The script located at `$INSTALL_ROOT/netbox/generate_secret_key.py` may be used to generate a suitable key.
|
|
||||||
|
@ -67,6 +67,12 @@ The name of the cookie to use for the cross-site request forgery (CSRF) authenti
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## CSRF_COOKIE_SECURE
|
||||||
|
|
||||||
|
Default: False
|
||||||
|
|
||||||
|
If true, the cookie employed for cross-site request forgery (CSRF) protection will be marked as secure, meaning that it can only be sent across an HTTPS connection.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## CSRF_TRUSTED_ORIGINS
|
## CSRF_TRUSTED_ORIGINS
|
||||||
@ -145,6 +151,17 @@ The view name or URL to which a user is redirected after logging out.
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## SECURE_SSL_REDIRECT
|
||||||
|
|
||||||
|
Default: False
|
||||||
|
|
||||||
|
If true, all non-HTTPS requests will be automatically redirected to use HTTPS.
|
||||||
|
|
||||||
|
!!! warning
|
||||||
|
Ensure that your frontend HTTP daemon has been configured to forward the HTTP scheme correctly before enabling this option. An incorrectly configured frontend may result in a looping redirect.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## SESSION_COOKIE_NAME
|
## SESSION_COOKIE_NAME
|
||||||
|
|
||||||
Default: `sessionid`
|
Default: `sessionid`
|
||||||
@ -153,6 +170,14 @@ The name used for the session cookie. See the [Django documentation](https://doc
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## SESSION_COOKIE_SECURE
|
||||||
|
|
||||||
|
Default: False
|
||||||
|
|
||||||
|
If true, the cookie employed for session authentication will be marked as secure, meaning that it can only be sent across an HTTPS connection.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## SESSION_FILE_PATH
|
## SESSION_FILE_PATH
|
||||||
|
|
||||||
Default: None
|
Default: None
|
||||||
|
@ -73,6 +73,14 @@ Determines if localization features are enabled or not. This should only be enab
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## GIT_PATH
|
||||||
|
|
||||||
|
Default: `git`
|
||||||
|
|
||||||
|
The system path to the `git` executable, used by the synchronization backend for remote git repositories.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## HTTP_PROXIES
|
## HTTP_PROXIES
|
||||||
|
|
||||||
Default: None
|
Default: None
|
||||||
|
@ -16,6 +16,7 @@ Custom fields may be created by navigating to Customization > Custom Fields. Net
|
|||||||
* Decimal: A fixed-precision decimal number (4 decimal places)
|
* Decimal: A fixed-precision decimal number (4 decimal places)
|
||||||
* Boolean: True or false
|
* Boolean: True or false
|
||||||
* Date: A date in ISO 8601 format (YYYY-MM-DD)
|
* Date: A date in ISO 8601 format (YYYY-MM-DD)
|
||||||
|
* Date & time: A date and time in ISO 8601 format (YYYY-MM-DD HH:MM:SS)
|
||||||
* URL: This will be presented as a link in the web UI
|
* URL: This will be presented as a link in the web UI
|
||||||
* JSON: Arbitrary data stored in JSON format
|
* JSON: Arbitrary data stored in JSON format
|
||||||
* Selection: A selection of one of several pre-defined custom choices
|
* Selection: A selection of one of several pre-defined custom choices
|
||||||
@ -35,18 +36,12 @@ The filter logic controls how values are matched when filtering objects by the c
|
|||||||
|
|
||||||
### Grouping
|
### Grouping
|
||||||
|
|
||||||
!!! note
|
|
||||||
This feature was introduced in NetBox v3.3.
|
|
||||||
|
|
||||||
Related custom fields can be grouped together within the UI by assigning each the same group name. When at least one custom field for an object type has a group defined, it will appear under the group heading within the custom fields panel under the object view. All custom fields with the same group name will appear under that heading. (Note that the group names must match exactly, or each will appear as a separate heading.)
|
Related custom fields can be grouped together within the UI by assigning each the same group name. When at least one custom field for an object type has a group defined, it will appear under the group heading within the custom fields panel under the object view. All custom fields with the same group name will appear under that heading. (Note that the group names must match exactly, or each will appear as a separate heading.)
|
||||||
|
|
||||||
This parameter has no effect on the API representation of custom field data.
|
This parameter has no effect on the API representation of custom field data.
|
||||||
|
|
||||||
### Visibility
|
### Visibility
|
||||||
|
|
||||||
!!! note
|
|
||||||
This feature was introduced in NetBox v3.3.
|
|
||||||
|
|
||||||
When creating a custom field, there are three options for UI visibility. These control how and whether the custom field is displayed within the NetBox UI.
|
When creating a custom field, there are three options for UI visibility. These control how and whether the custom field is displayed within the NetBox UI.
|
||||||
|
|
||||||
* **Read/write** (default): The custom field is included when viewing and editing objects.
|
* **Read/write** (default): The custom field is included when viewing and editing objects.
|
||||||
|
@ -2,12 +2,12 @@
|
|||||||
|
|
||||||
Custom links allow users to display arbitrary hyperlinks to external content within NetBox object views. These are helpful for cross-referencing related records in systems outside NetBox. For example, you might create a custom link on the device view which links to the current device in a Network Monitoring System (NMS).
|
Custom links allow users to display arbitrary hyperlinks to external content within NetBox object views. These are helpful for cross-referencing related records in systems outside NetBox. For example, you might create a custom link on the device view which links to the current device in a Network Monitoring System (NMS).
|
||||||
|
|
||||||
Custom links are created by navigating to Customization > Custom Links. Each link is associated with a particular NetBox object type (site, device, prefix, etc.) and will be displayed on relevant views. Each link has display text and a URL, and data from the NetBox item being viewed can be included in the link using [Jinja2 template code](https://jinja2docs.readthedocs.io/en/stable/) through the variable `obj`, and custom fields through `obj.cf`.
|
Custom links are created by navigating to Customization > Custom Links. Each link is associated with a particular NetBox object type (site, device, prefix, etc.) and will be displayed on relevant views. Each link has display text and a URL, and data from the NetBox item being viewed can be included in the link using [Jinja2 template code](https://jinja2docs.readthedocs.io/en/stable/) through the variable `object`, and custom fields through `object.cf`.
|
||||||
|
|
||||||
For example, you might define a link like this:
|
For example, you might define a link like this:
|
||||||
|
|
||||||
* Text: `View NMS`
|
* Text: `View NMS`
|
||||||
* URL: `https://nms.example.com/nodes/?name={{ obj.name }}`
|
* URL: `https://nms.example.com/nodes/?name={{ object.name }}`
|
||||||
|
|
||||||
When viewing a device named Router4, this link would render as:
|
When viewing a device named Router4, this link would render as:
|
||||||
|
|
||||||
@ -27,7 +27,6 @@ The following context data is available within the template when rendering a cus
|
|||||||
| Variable | Description |
|
| Variable | Description |
|
||||||
|-----------|-------------------------------------------------------------------------------------------------------------------|
|
|-----------|-------------------------------------------------------------------------------------------------------------------|
|
||||||
| `object` | The NetBox object being displayed |
|
| `object` | The NetBox object being displayed |
|
||||||
| `obj` | Same as `object`; maintained for backward compatability until NetBox v3.5 |
|
|
||||||
| `debug` | A boolean indicating whether debugging is enabled |
|
| `debug` | A boolean indicating whether debugging is enabled |
|
||||||
| `request` | The current WSGI request |
|
| `request` | The current WSGI request |
|
||||||
| `user` | The current user (if authenticated) |
|
| `user` | The current user (if authenticated) |
|
||||||
@ -44,7 +43,7 @@ Only links which render with non-empty text are included on the page. You can em
|
|||||||
For example, if you only want to display a link for active devices, you could set the link text to
|
For example, if you only want to display a link for active devices, you could set the link text to
|
||||||
|
|
||||||
```jinja2
|
```jinja2
|
||||||
{% if obj.status == 'active' %}View NMS{% endif %}
|
{% if object.status == 'active' %}View NMS{% endif %}
|
||||||
```
|
```
|
||||||
|
|
||||||
The link will not appear when viewing a device with any status other than "active."
|
The link will not appear when viewing a device with any status other than "active."
|
||||||
@ -52,7 +51,7 @@ The link will not appear when viewing a device with any status other than "activ
|
|||||||
As another example, if you wanted to show only devices belonging to a certain manufacturer, you could do something like this:
|
As another example, if you wanted to show only devices belonging to a certain manufacturer, you could do something like this:
|
||||||
|
|
||||||
```jinja2
|
```jinja2
|
||||||
{% if obj.device_type.manufacturer.name == 'Cisco' %}View NMS{% endif %}
|
{% if object.device_type.manufacturer.name == 'Cisco' %}View NMS{% endif %}
|
||||||
```
|
```
|
||||||
|
|
||||||
The link will only appear when viewing a device with a manufacturer name of "Cisco."
|
The link will only appear when viewing a device with a manufacturer name of "Cisco."
|
||||||
|
@ -35,12 +35,9 @@ class MyScript(Script):
|
|||||||
|
|
||||||
The `run()` method should accept two arguments:
|
The `run()` method should accept two arguments:
|
||||||
|
|
||||||
* `data` - A dictionary containing all of the variable data passed via the web form.
|
* `data` - A dictionary containing all the variable data passed via the web form.
|
||||||
* `commit` - A boolean indicating whether database changes will be committed.
|
* `commit` - A boolean indicating whether database changes will be committed.
|
||||||
|
|
||||||
!!! note
|
|
||||||
The `commit` argument was introduced in NetBox v2.7.8. Backward compatibility is maintained for scripts which accept only the `data` argument, however beginning with v2.10 NetBox will require the `run()` method of every script to accept both arguments. (Either argument may still be ignored within the method.)
|
|
||||||
|
|
||||||
Defining script variables is optional: You may create a script with only a `run()` method if no user input is needed.
|
Defining script variables is optional: You may create a script with only a `run()` method if no user input is needed.
|
||||||
|
|
||||||
Any output generated by the script during its execution will be displayed under the "output" tab in the UI.
|
Any output generated by the script during its execution will be displayed under the "output" tab in the UI.
|
||||||
@ -104,12 +101,14 @@ The checkbox to commit database changes when executing a script is checked by de
|
|||||||
commit_default = False
|
commit_default = False
|
||||||
```
|
```
|
||||||
|
|
||||||
|
### `scheduling_enabled`
|
||||||
|
|
||||||
|
By default, a script can be scheduled for execution at a later time. Setting `scheduling_enabled` to False disables this ability: Only immediate execution will be possible. (This also disables the ability to set a recurring execution interval.)
|
||||||
|
|
||||||
### `job_timeout`
|
### `job_timeout`
|
||||||
|
|
||||||
Set the maximum allowed runtime for the script. If not set, `RQ_DEFAULT_TIMEOUT` will be used.
|
Set the maximum allowed runtime for the script. If not set, `RQ_DEFAULT_TIMEOUT` will be used.
|
||||||
|
|
||||||
!!! info "This feature was introduced in v3.2.1"
|
|
||||||
|
|
||||||
## Accessing Request Data
|
## Accessing Request Data
|
||||||
|
|
||||||
Details of the current HTTP request (the one being made to execute the script) are available as the instance attribute `self.request`. This can be used to infer, for example, the user executing the script and the client IP address:
|
Details of the current HTTP request (the one being made to execute the script) are available as the instance attribute `self.request`. This can be used to infer, for example, the user executing the script and the client IP address:
|
||||||
@ -379,6 +378,7 @@ class NewBranchScript(Script):
|
|||||||
slug=slugify(data['site_name']),
|
slug=slugify(data['site_name']),
|
||||||
status=SiteStatusChoices.STATUS_PLANNED
|
status=SiteStatusChoices.STATUS_PLANNED
|
||||||
)
|
)
|
||||||
|
site.full_clean()
|
||||||
site.save()
|
site.save()
|
||||||
self.log_success(f"Created new site: {site}")
|
self.log_success(f"Created new site: {site}")
|
||||||
|
|
||||||
@ -392,6 +392,7 @@ class NewBranchScript(Script):
|
|||||||
status=DeviceStatusChoices.STATUS_PLANNED,
|
status=DeviceStatusChoices.STATUS_PLANNED,
|
||||||
device_role=switch_role
|
device_role=switch_role
|
||||||
)
|
)
|
||||||
|
switch.full_clean()
|
||||||
switch.save()
|
switch.save()
|
||||||
self.log_success(f"Created new switch: {switch}")
|
self.log_success(f"Created new switch: {switch}")
|
||||||
|
|
||||||
|
@ -91,12 +91,14 @@ As you can see, reports are completely customizable. Validation logic can be as
|
|||||||
|
|
||||||
A human-friendly description of what your report does.
|
A human-friendly description of what your report does.
|
||||||
|
|
||||||
|
### `scheduling_enabled`
|
||||||
|
|
||||||
|
By default, a report can be scheduled for execution at a later time. Setting `scheduling_enabled` to False disables this ability: Only immediate execution will be possible. (This also disables the ability to set a recurring execution interval.)
|
||||||
|
|
||||||
### `job_timeout`
|
### `job_timeout`
|
||||||
|
|
||||||
Set the maximum allowed runtime for the report. If not set, `RQ_DEFAULT_TIMEOUT` will be used.
|
Set the maximum allowed runtime for the report. If not set, `RQ_DEFAULT_TIMEOUT` will be used.
|
||||||
|
|
||||||
!!! info "This feature was introduced in v3.2.1"
|
|
||||||
|
|
||||||
## Logging
|
## Logging
|
||||||
|
|
||||||
The following methods are available to log results within a report:
|
The following methods are available to log results within a report:
|
||||||
|
@ -8,6 +8,14 @@ The registry can be inspected by importing `registry` from `extras.registry`.
|
|||||||
|
|
||||||
## Stores
|
## Stores
|
||||||
|
|
||||||
|
### `data_backends`
|
||||||
|
|
||||||
|
A dictionary mapping data backend types to their respective classes. These are used to interact with [remote data sources](../models/core/datasource.md).
|
||||||
|
|
||||||
|
### `denormalized_fields`
|
||||||
|
|
||||||
|
Stores registration made using `netbox.denormalized.register()`. For each model, a list of related models and their field mappings is maintained to facilitate automatic updates.
|
||||||
|
|
||||||
### `model_features`
|
### `model_features`
|
||||||
|
|
||||||
A dictionary of particular features (e.g. custom fields) mapped to the NetBox models which support them, arranged by app. For example:
|
A dictionary of particular features (e.g. custom fields) mapped to the NetBox models which support them, arranged by app. For example:
|
||||||
@ -20,38 +28,23 @@ A dictionary of particular features (e.g. custom fields) mapped to the NetBox mo
|
|||||||
...
|
...
|
||||||
},
|
},
|
||||||
'webhooks': {
|
'webhooks': {
|
||||||
...
|
'extras': ['configcontext', 'tag', ...],
|
||||||
|
'dcim': ['site', 'rack', 'devicetype', ...],
|
||||||
},
|
},
|
||||||
...
|
...
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
### `plugin_menu_items`
|
Supported model features are listed in the [features matrix](./models.md#features-matrix).
|
||||||
|
|
||||||
Navigation menu items provided by NetBox plugins. Each plugin is registered as a key with the list of menu items it provides. An example:
|
### `plugins`
|
||||||
|
|
||||||
```python
|
This store maintains all registered items for plugins, such as navigation menus, template extensions, etc.
|
||||||
{
|
|
||||||
'Plugin A': (
|
|
||||||
<MenuItem>, <MenuItem>, <MenuItem>,
|
|
||||||
),
|
|
||||||
'Plugin B': (
|
|
||||||
<MenuItem>, <MenuItem>, <MenuItem>,
|
|
||||||
),
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
### `plugin_template_extensions`
|
### `search`
|
||||||
|
|
||||||
Plugin content that gets embedded into core NetBox templates. The store comprises NetBox models registered as dictionary keys, each pointing to a list of applicable template extension classes that exist. An example:
|
A dictionary mapping each model (identified by its app and label) to its search index class, if one has been registered for it.
|
||||||
|
|
||||||
```python
|
### `views`
|
||||||
{
|
|
||||||
'dcim.site': [
|
A hierarchical mapping of registered views for each model. Mappings are added using the `register_model_view()` decorator, and URLs paths can be generated from these using `get_model_urls()`.
|
||||||
<TemplateExtension>, <TemplateExtension>, <TemplateExtension>,
|
|
||||||
],
|
|
||||||
'dcim.rack': [
|
|
||||||
<TemplateExtension>, <TemplateExtension>,
|
|
||||||
],
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
@ -2,38 +2,44 @@
|
|||||||
|
|
||||||
## Model Types
|
## Model Types
|
||||||
|
|
||||||
A NetBox model represents a discrete object type such as a device or IP address. Per [Django convention](https://docs.djangoproject.com/en/stable/topics/db/models/), each model is defined as a Python class and has its own SQL table. All NetBox data models can be categorized by type.
|
A NetBox model represents a discrete object type such as a device or IP address. Per [Django convention](https://docs.djangoproject.com/en/stable/topics/db/models/), each model is defined as a Python class and has its own table in the PostgreSQL database. All NetBox data models can be categorized by type.
|
||||||
|
|
||||||
The Django [content types](https://docs.djangoproject.com/en/stable/ref/contrib/contenttypes/) framework can be used to reference models within the database. A ContentType instance references a model by its `app_label` and `name`: For example, the Site model is referred to as `dcim.site`. The content type combined with an object's primary key form a globally unique identifier for the object (e.g. `dcim.site:123`).
|
The Django [content types](https://docs.djangoproject.com/en/stable/ref/contrib/contenttypes/) framework is used to map Django models to database tables. A ContentType instance references a model by its `app_label` and `name`: For example, the Site model within the DCIM app is referred to as `dcim.site`. The content type combined with an object's primary key form a globally unique identifier for the object (e.g. `dcim.site:123`).
|
||||||
|
|
||||||
### Features Matrix
|
### Features Matrix
|
||||||
|
|
||||||
* [Change logging](../features/change-logging.md) - Changes to these objects are automatically recorded in the change log
|
Depending on its classification, each NetBox model may support various features which enhance its operation. Each feature is enabled by inheriting from its designated mixin class, and some features also make use of the [application registry](./application-registry.md#model_features).
|
||||||
* [Webhooks](../integrations/webhooks.md) - NetBox is capable of generating outgoing webhooks for these objects
|
|
||||||
* [Custom fields](../customization/custom-fields.md) - These models support the addition of user-defined fields
|
|
||||||
* [Export templates](../customization/export-templates.md) - Users can create custom export templates for these models
|
|
||||||
* [Tagging](../models/extras/tag.md) - The models can be tagged with user-defined tags
|
|
||||||
* [Journaling](../features/journaling.md) - These models support persistent historical commentary
|
|
||||||
* Nesting - These models can be nested recursively to create a hierarchy
|
|
||||||
|
|
||||||
| Type | Change Logging | Webhooks | Custom Fields | Export Templates | Tags | Journaling | Nesting |
|
| Feature | Feature Mixin | Registry Key | Description |
|
||||||
| ------------------ | ---------------- | ---------------- |------------------| ---------------- | ---------------- | ---------------- | ---------------- |
|
|------------------------------------------------------------|-------------------------|--------------------|--------------------------------------------------------------------------------|
|
||||||
| Primary | :material-check: | :material-check: | :material-check: | :material-check: | :material-check: | :material-check: | |
|
| [Change logging](../features/change-logging.md) | `ChangeLoggingMixin` | - | Changes to these objects are automatically recorded in the change log |
|
||||||
| Organizational | :material-check: | :material-check: | :material-check: | :material-check: | :material-check: | | |
|
| Cloning | `CloningMixin` | - | Provides the `clone()` method to prepare a copy |
|
||||||
| Nested Group | :material-check: | :material-check: | :material-check: | :material-check: | :material-check: | | :material-check: |
|
| [Custom fields](../customization/custom-fields.md) | `CustomFieldsMixin` | `custom_fields` | These models support the addition of user-defined fields |
|
||||||
| Component | :material-check: | :material-check: | :material-check: | :material-check: | :material-check: | | |
|
| [Custom links](../customization/custom-links.md) | `CustomLinksMixin` | `custom_links` | These models support the assignment of custom links |
|
||||||
| Component Template | :material-check: | :material-check: | | | | | |
|
| [Custom validation](../customization/custom-validation.md) | `CustomValidationMixin` | - | Supports the enforcement of custom validation rules |
|
||||||
|
| [Export templates](../customization/export-templates.md) | `ExportTemplatesMixin` | `export_templates` | Users can create custom export templates for these models |
|
||||||
|
| [Job results](../features/background-jobs.md) | `JobsMixin` | `jobs` | Users can create custom export templates for these models |
|
||||||
|
| [Journaling](../features/journaling.md) | `JournalingMixin` | `journaling` | These models support persistent historical commentary |
|
||||||
|
| [Synchronized data](../integrations/synchronized-data.md) | `SyncedDataMixin` | `synced_data` | Certain model data can be automatically synchronized from a remote data source |
|
||||||
|
| [Tagging](../models/extras/tag.md) | `TagsMixin` | `tags` | The models can be tagged with user-defined tags |
|
||||||
|
| [Webhooks](../integrations/webhooks.md) | `WebhooksMixin` | `webhooks` | NetBox is capable of generating outgoing webhooks for these objects |
|
||||||
|
|
||||||
## Models Index
|
## Models Index
|
||||||
|
|
||||||
### Primary Models
|
### Primary Models
|
||||||
|
|
||||||
|
These are considered the "core" application models which are used to model network infrastructure.
|
||||||
|
|
||||||
* [circuits.Circuit](../models/circuits/circuit.md)
|
* [circuits.Circuit](../models/circuits/circuit.md)
|
||||||
* [circuits.Provider](../models/circuits/provider.md)
|
* [circuits.Provider](../models/circuits/provider.md)
|
||||||
|
* [circuits.ProviderAccount](../models/circuits/provideraccount.md)
|
||||||
* [circuits.ProviderNetwork](../models/circuits/providernetwork.md)
|
* [circuits.ProviderNetwork](../models/circuits/providernetwork.md)
|
||||||
|
* [core.DataSource](../models/core/datasource.md)
|
||||||
* [dcim.Cable](../models/dcim/cable.md)
|
* [dcim.Cable](../models/dcim/cable.md)
|
||||||
* [dcim.Device](../models/dcim/device.md)
|
* [dcim.Device](../models/dcim/device.md)
|
||||||
* [dcim.DeviceType](../models/dcim/devicetype.md)
|
* [dcim.DeviceType](../models/dcim/devicetype.md)
|
||||||
|
* [dcim.Module](../models/dcim/module.md)
|
||||||
|
* [dcim.ModuleType](../models/dcim/moduletype.md)
|
||||||
* [dcim.PowerFeed](../models/dcim/powerfeed.md)
|
* [dcim.PowerFeed](../models/dcim/powerfeed.md)
|
||||||
* [dcim.PowerPanel](../models/dcim/powerpanel.md)
|
* [dcim.PowerPanel](../models/dcim/powerpanel.md)
|
||||||
* [dcim.Rack](../models/dcim/rack.md)
|
* [dcim.Rack](../models/dcim/rack.md)
|
||||||
@ -47,10 +53,10 @@ The Django [content types](https://docs.djangoproject.com/en/stable/ref/contrib/
|
|||||||
* [ipam.IPAddress](../models/ipam/ipaddress.md)
|
* [ipam.IPAddress](../models/ipam/ipaddress.md)
|
||||||
* [ipam.IPRange](../models/ipam/iprange.md)
|
* [ipam.IPRange](../models/ipam/iprange.md)
|
||||||
* [ipam.L2VPN](../models/ipam/l2vpn.md)
|
* [ipam.L2VPN](../models/ipam/l2vpn.md)
|
||||||
* [ipam.L2VPNTermination](../models/ipam/l2vpntermination.md)
|
|
||||||
* [ipam.Prefix](../models/ipam/prefix.md)
|
* [ipam.Prefix](../models/ipam/prefix.md)
|
||||||
* [ipam.RouteTarget](../models/ipam/routetarget.md)
|
* [ipam.RouteTarget](../models/ipam/routetarget.md)
|
||||||
* [ipam.Service](../models/ipam/service.md)
|
* [ipam.Service](../models/ipam/service.md)
|
||||||
|
* [ipam.ServiceTemplate](../models/ipam/servicetemplate.md)
|
||||||
* [ipam.VLAN](../models/ipam/vlan.md)
|
* [ipam.VLAN](../models/ipam/vlan.md)
|
||||||
* [ipam.VRF](../models/ipam/vrf.md)
|
* [ipam.VRF](../models/ipam/vrf.md)
|
||||||
* [tenancy.Contact](../models/tenancy/contact.md)
|
* [tenancy.Contact](../models/tenancy/contact.md)
|
||||||
@ -62,6 +68,8 @@ The Django [content types](https://docs.djangoproject.com/en/stable/ref/contrib/
|
|||||||
|
|
||||||
### Organizational Models
|
### Organizational Models
|
||||||
|
|
||||||
|
Organization models are used to organize and classify primary models.
|
||||||
|
|
||||||
* [circuits.CircuitType](../models/circuits/circuittype.md)
|
* [circuits.CircuitType](../models/circuits/circuittype.md)
|
||||||
* [dcim.DeviceRole](../models/dcim/devicerole.md)
|
* [dcim.DeviceRole](../models/dcim/devicerole.md)
|
||||||
* [dcim.Manufacturer](../models/dcim/manufacturer.md)
|
* [dcim.Manufacturer](../models/dcim/manufacturer.md)
|
||||||
@ -76,6 +84,8 @@ The Django [content types](https://docs.djangoproject.com/en/stable/ref/contrib/
|
|||||||
|
|
||||||
### Nested Group Models
|
### Nested Group Models
|
||||||
|
|
||||||
|
Nested group models behave like organizational model, but self-nest within a recursive hierarchy. For example, the Region model can be used to represent a hierarchy of countries, states, and cities.
|
||||||
|
|
||||||
* [dcim.Location](../models/dcim/location.md) (formerly RackGroup)
|
* [dcim.Location](../models/dcim/location.md) (formerly RackGroup)
|
||||||
* [dcim.Region](../models/dcim/region.md)
|
* [dcim.Region](../models/dcim/region.md)
|
||||||
* [dcim.SiteGroup](../models/dcim/sitegroup.md)
|
* [dcim.SiteGroup](../models/dcim/sitegroup.md)
|
||||||
@ -85,12 +95,15 @@ The Django [content types](https://docs.djangoproject.com/en/stable/ref/contrib/
|
|||||||
|
|
||||||
### Component Models
|
### Component Models
|
||||||
|
|
||||||
|
Component models represent individual physical or virtual components belonging to a device or virtual machine.
|
||||||
|
|
||||||
* [dcim.ConsolePort](../models/dcim/consoleport.md)
|
* [dcim.ConsolePort](../models/dcim/consoleport.md)
|
||||||
* [dcim.ConsoleServerPort](../models/dcim/consoleserverport.md)
|
* [dcim.ConsoleServerPort](../models/dcim/consoleserverport.md)
|
||||||
* [dcim.DeviceBay](../models/dcim/devicebay.md)
|
* [dcim.DeviceBay](../models/dcim/devicebay.md)
|
||||||
* [dcim.FrontPort](../models/dcim/frontport.md)
|
* [dcim.FrontPort](../models/dcim/frontport.md)
|
||||||
* [dcim.Interface](../models/dcim/interface.md)
|
* [dcim.Interface](../models/dcim/interface.md)
|
||||||
* [dcim.InventoryItem](../models/dcim/inventoryitem.md)
|
* [dcim.InventoryItem](../models/dcim/inventoryitem.md)
|
||||||
|
* [dcim.ModuleBay](../models/dcim/modulebay.md)
|
||||||
* [dcim.PowerOutlet](../models/dcim/poweroutlet.md)
|
* [dcim.PowerOutlet](../models/dcim/poweroutlet.md)
|
||||||
* [dcim.PowerPort](../models/dcim/powerport.md)
|
* [dcim.PowerPort](../models/dcim/powerport.md)
|
||||||
* [dcim.RearPort](../models/dcim/rearport.md)
|
* [dcim.RearPort](../models/dcim/rearport.md)
|
||||||
@ -98,11 +111,15 @@ The Django [content types](https://docs.djangoproject.com/en/stable/ref/contrib/
|
|||||||
|
|
||||||
### Component Template Models
|
### Component Template Models
|
||||||
|
|
||||||
|
These function as templates to effect the replication of device and virtual machine components. Component template models support a limited feature set, including change logging, custom validation, and webhooks.
|
||||||
|
|
||||||
* [dcim.ConsolePortTemplate](../models/dcim/consoleporttemplate.md)
|
* [dcim.ConsolePortTemplate](../models/dcim/consoleporttemplate.md)
|
||||||
* [dcim.ConsoleServerPortTemplate](../models/dcim/consoleserverporttemplate.md)
|
* [dcim.ConsoleServerPortTemplate](../models/dcim/consoleserverporttemplate.md)
|
||||||
* [dcim.DeviceBayTemplate](../models/dcim/devicebaytemplate.md)
|
* [dcim.DeviceBayTemplate](../models/dcim/devicebaytemplate.md)
|
||||||
* [dcim.FrontPortTemplate](../models/dcim/frontporttemplate.md)
|
* [dcim.FrontPortTemplate](../models/dcim/frontporttemplate.md)
|
||||||
* [dcim.InterfaceTemplate](../models/dcim/interfacetemplate.md)
|
* [dcim.InterfaceTemplate](../models/dcim/interfacetemplate.md)
|
||||||
|
* [dcim.InventoryItemTemplate](../models/dcim/inventoryitemtemplate.md)
|
||||||
|
* [dcim.ModuleBayTemplate](../models/dcim/modulebaytemplate.md)
|
||||||
* [dcim.PowerOutletTemplate](../models/dcim/poweroutlettemplate.md)
|
* [dcim.PowerOutletTemplate](../models/dcim/poweroutlettemplate.md)
|
||||||
* [dcim.PowerPortTemplate](../models/dcim/powerporttemplate.md)
|
* [dcim.PowerPortTemplate](../models/dcim/powerporttemplate.md)
|
||||||
* [dcim.RearPortTemplate](../models/dcim/rearporttemplate.md)
|
* [dcim.RearPortTemplate](../models/dcim/rearporttemplate.md)
|
||||||
|
@ -43,10 +43,22 @@ Follow these instructions to perform a new installation of NetBox in a temporary
|
|||||||
|
|
||||||
Submit a pull request to merge the `feature` branch into the `develop` branch in preparation for its release. Once it has been merged, continue with the section for patch releases below.
|
Submit a pull request to merge the `feature` branch into the `develop` branch in preparation for its release. Once it has been merged, continue with the section for patch releases below.
|
||||||
|
|
||||||
|
### Rebuild Demo Data (After Release)
|
||||||
|
|
||||||
|
After the release of a new minor version, generate a new demo data snapshot compatible with the new release. See the [`netbox-demo-data`](https://github.com/netbox-community/netbox-demo-data) repository for instructions.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## Patch Releases
|
## Patch Releases
|
||||||
|
|
||||||
|
### Notify netbox-docker Project of Any Relevant Changes
|
||||||
|
|
||||||
|
Notify the [`netbox-docker`](https://github.com/netbox-community/netbox-docker) maintainers (in **#netbox-docker**) of any changes that may be relevant to their build process, including:
|
||||||
|
|
||||||
|
* Significant changes to `upgrade.sh`
|
||||||
|
* Increases in minimum versions for service dependencies (PostgreSQL, Redis, etc.)
|
||||||
|
* Any changes to the reference installation
|
||||||
|
|
||||||
### Update Requirements
|
### Update Requirements
|
||||||
|
|
||||||
Before each release, update each of NetBox's Python dependencies to its most recent stable version. These are defined in `requirements.txt`, which is updated from `base_requirements.txt` using `pip`. To do this:
|
Before each release, update each of NetBox's Python dependencies to its most recent stable version. These are defined in `requirements.txt`, which is updated from `base_requirements.txt` using `pip`. To do this:
|
||||||
@ -58,6 +70,16 @@ Before each release, update each of NetBox's Python dependencies to its most rec
|
|||||||
|
|
||||||
In cases where upgrading a dependency to its most recent release is breaking, it should be constrained to its current minor version in `base_requirements.txt` with an explanatory comment and revisited for the next major NetBox release (see the [Address Constrained Dependencies](#address-constrained-dependencies) section above).
|
In cases where upgrading a dependency to its most recent release is breaking, it should be constrained to its current minor version in `base_requirements.txt` with an explanatory comment and revisited for the next major NetBox release (see the [Address Constrained Dependencies](#address-constrained-dependencies) section above).
|
||||||
|
|
||||||
|
### Rebuild the Device Type Definition Schema
|
||||||
|
|
||||||
|
Run the following command to update the device type definition validation schema:
|
||||||
|
|
||||||
|
```nohighlight
|
||||||
|
./manage.py buildschema --write
|
||||||
|
```
|
||||||
|
|
||||||
|
This will automatically update the schema file at `contrib/generated_schema.json`.
|
||||||
|
|
||||||
### Update Version and Changelog
|
### Update Version and Changelog
|
||||||
|
|
||||||
* Update the `VERSION` constant in `settings.py` to the new release version.
|
* Update the `VERSION` constant in `settings.py` to the new release version.
|
||||||
|
@ -29,7 +29,7 @@ A SearchIndex subclass defines both its model and a list of two-tuples specifyin
|
|||||||
| 60 | Unique serialized attribute (per related object) | Device.serial |
|
| 60 | Unique serialized attribute (per related object) | Device.serial |
|
||||||
| 100 | Primary human identifier | Device.name, Circuit.cid, Cable.label |
|
| 100 | Primary human identifier | Device.name, Circuit.cid, Cable.label |
|
||||||
| 110 | Slug | Site.slug |
|
| 110 | Slug | Site.slug |
|
||||||
| 200 | Secondary identifier | Provider.account, DeviceType.part_number |
|
| 200 | Secondary identifier | ProviderAccount.account, DeviceType.part_number |
|
||||||
| 300 | Highly unique descriptive attribute | CircuitTermination.xconnect_id, IPAddress.dns_name |
|
| 300 | Highly unique descriptive attribute | CircuitTermination.xconnect_id, IPAddress.dns_name |
|
||||||
| 500 | Description | Site.description |
|
| 500 | Description | Site.description |
|
||||||
| 1000 | Custom field default | - |
|
| 1000 | Custom field default | - |
|
||||||
|
@ -30,12 +30,6 @@ A webhook is a mechanism for conveying to some external system a change that too
|
|||||||
|
|
||||||
To learn more about this feature, check out the [webhooks documentation](../integrations/webhooks.md).
|
To learn more about this feature, check out the [webhooks documentation](../integrations/webhooks.md).
|
||||||
|
|
||||||
## NAPALM
|
|
||||||
|
|
||||||
[NAPALM](https://github.com/napalm-automation/napalm) is a Python library which enables direct interaction with network devices of various platforms. When configured, NetBox supports fetching live operational and status data directly from network devices to be compared to what has been defined in NetBox. This allows for easily validating the device's operational state against its desired state. Additionally, NetBox's REST API can act as a sort of proxy for NAPALM commands, allowing external clients to interact with network devices by sending HTTP requests to the appropriate API endpoint.
|
|
||||||
|
|
||||||
To learn more about this feature, check out the [NAPALM documentation](../integrations/napalm.md).
|
|
||||||
|
|
||||||
## Prometheus Metrics
|
## Prometheus Metrics
|
||||||
|
|
||||||
NetBox includes a special `/metrics` view which exposes metrics for a [Prometheus](https://prometheus.io/) scraper, powered by the open source [django-prometheus](https://github.com/korfuri/django-prometheus) library. To learn more about this feature, check out the [Prometheus metrics documentation](../integrations/prometheus-metrics.md).
|
NetBox includes a special `/metrics` view which exposes metrics for a [Prometheus](https://prometheus.io/) scraper, powered by the open source [django-prometheus](https://github.com/korfuri/django-prometheus) library. To learn more about this feature, check out the [Prometheus metrics documentation](../integrations/prometheus-metrics.md).
|
||||||
|
13
docs/features/background-jobs.md
Normal file
13
docs/features/background-jobs.md
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
# Background Jobs
|
||||||
|
|
||||||
|
NetBox includes the ability to execute certain functions as background tasks. These include:
|
||||||
|
|
||||||
|
* [Report](../customization/reports.md) execution
|
||||||
|
* [Custom script](../customization/custom-scripts.md) execution
|
||||||
|
* Synchronization of [remote data sources](../integrations/synchronized-data.md)
|
||||||
|
|
||||||
|
Additionally, NetBox plugins can enqueue their own background tasks. This is accomplished using the [Job model](../models/core/job.md). Background tasks are executed by the `rqworker` process(es).
|
||||||
|
|
||||||
|
## Scheduled Jobs
|
||||||
|
|
||||||
|
Background jobs can be configured to run immediately, or at a set time in the future. Scheduled jobs can also be configured to repeat at a set interval.
|
@ -1,9 +1,13 @@
|
|||||||
# Change Logging
|
# Change Logging
|
||||||
|
|
||||||
Every time an object in NetBox is created, updated, or deleted, a serialized copy of that object taken both before and after the change is saved to the database, along with meta data including the current time and the user associated with the change. These records form a persistent record of changes both for each individual object as well as NetBox as a whole. The global change log can be viewed by navigating to Other > Change Log.
|
Every time an object in NetBox is created, updated, or deleted, a serialized copy of that object taken both before and after the change is saved to the database, along with metadata including the current time and the user associated with the change. These records form a persistent record of changes both for each individual object as well as NetBox as a whole. The global change log can be viewed by navigating to Other > Change Log.
|
||||||
|
|
||||||
A serialized representation of the instance being modified is included in JSON format. This is similar to how objects are conveyed within the REST API, but does not include any nested representations. For instance, the `tenant` field of a site will record only the tenant's ID, not a representation of the tenant.
|
A serialized representation of the instance being modified is included in JSON format. This is similar to how objects are conveyed within the REST API, but does not include any nested representations. For instance, the `tenant` field of a site will record only the tenant's ID, not a representation of the tenant.
|
||||||
|
|
||||||
When a request is made, a UUID is generated and attached to any change records resulting from that request. For example, editing three objects in bulk will create a separate change record for each (three in total), and each of those objects will be associated with the same UUID. This makes it easy to identify all the change records resulting from a particular request.
|
When a request is made, a UUID is generated and attached to any change records resulting from that request. For example, editing three objects in bulk will create a separate change record for each (three in total), and each of those objects will be associated with the same UUID. This makes it easy to identify all the change records resulting from a particular request.
|
||||||
|
|
||||||
Change records are exposed in the API via the read-only endpoint `/api/extras/object-changes/`. They may also be exported via the web UI in CSV format.
|
Change records are exposed in the API via the read-only endpoint `/api/extras/object-changes/`. They may also be exported via the web UI in CSV format.
|
||||||
|
|
||||||
|
## Correlating Changes by Request
|
||||||
|
|
||||||
|
Every request made to NetBox is assigned a random unique ID that can be used to correlate change records. For example, if you change the status of three sites using the UI's bulk edit feature, you will see three new change records (one for each site) all referencing the same request ID. This shows that all three changes were made as part of the same request.
|
||||||
|
@ -5,13 +5,15 @@ NetBox is ideal for managing your network's transit and peering providers and ci
|
|||||||
```mermaid
|
```mermaid
|
||||||
flowchart TD
|
flowchart TD
|
||||||
ASN --> Provider
|
ASN --> Provider
|
||||||
Provider --> ProviderNetwork & Circuit
|
Provider --> ProviderNetwork & ProviderAccount & Circuit
|
||||||
|
ProviderAccount --> Circuit
|
||||||
CircuitType --> Circuit
|
CircuitType --> Circuit
|
||||||
|
|
||||||
click ASN "../../models/circuits/asn/"
|
click ASN "../../models/circuits/asn/"
|
||||||
click Circuit "../../models/circuits/circuit/"
|
click Circuit "../../models/circuits/circuit/"
|
||||||
click CircuitType "../../models/circuits/circuittype/"
|
click CircuitType "../../models/circuits/circuittype/"
|
||||||
click Provider "../../models/circuits/provider/"
|
click Provider "../../models/circuits/provider/"
|
||||||
|
click ProviderAccount "../../models/circuits/provideraccount/"
|
||||||
click ProviderNetwork "../../models/circuits/providernetwork/"
|
click ProviderNetwork "../../models/circuits/providernetwork/"
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -25,7 +27,7 @@ Sometimes you'll need to model provider networks into which you don't have full
|
|||||||
|
|
||||||
A circuit is a physical connection between two points, which is installed and maintained by an external provider. For example, an Internet connection delivered as a fiber optic cable would be modeled as a circuit in NetBox.
|
A circuit is a physical connection between two points, which is installed and maintained by an external provider. For example, an Internet connection delivered as a fiber optic cable would be modeled as a circuit in NetBox.
|
||||||
|
|
||||||
Each circuit is associated with a provider and assigned a circuit ID, which must be unique to that provider. A circuit is also assigned a user-defined type, operational status, and various other operating characteristics.
|
Each circuit is associated with a provider and assigned a circuit ID, which must be unique to that provider. A circuit is also assigned a user-defined type, operational status, and various other operating characteristics. Provider accounts can also be employed to further categorize circuits belonging to a common provider: These may represent different business units or technologies.
|
||||||
|
|
||||||
Each circuit may have up to two terminations (A and Z) defined. Each termination can be associated with a particular site or provider network. In the case of the former, a cable can be connected between the circuit termination and a device component to map its physical connectivity.
|
Each circuit may have up to two terminations (A and Z) defined. Each termination can be associated with a particular site or provider network. In the case of the former, a cable can be connected between the circuit termination and a device component to map its physical connectivity.
|
||||||
|
|
||||||
|
81
docs/features/configuration-rendering.md
Normal file
81
docs/features/configuration-rendering.md
Normal file
@ -0,0 +1,81 @@
|
|||||||
|
# Configuration Rendering
|
||||||
|
|
||||||
|
!!! info "This feature was introduced in NetBox v3.5."
|
||||||
|
|
||||||
|
One of the critical aspects of operating a network is ensuring that every network node is configured correctly. By leveraging configuration templates and [context data](./context-data.md), NetBox can render complete configuration files for each device on your network.
|
||||||
|
|
||||||
|
```mermaid
|
||||||
|
flowchart TD
|
||||||
|
ConfigContext & ConfigTemplate --> Config{{Rendered configuration}}
|
||||||
|
|
||||||
|
click ConfigContext "../../models/extras/configcontext/"
|
||||||
|
click ConfigTemplate "../../models/extras/configtemplate/"
|
||||||
|
```
|
||||||
|
|
||||||
|
## Configuration Templates
|
||||||
|
|
||||||
|
Configuration templates are written in the [Jinja2 templating language](https://jinja.palletsprojects.com/), and may be automatically populated from remote data sources. Context data is applied to a template during rendering to output a complete configuration file. Below is an example Jinja2 template which renders a simple network switch configuration file.
|
||||||
|
|
||||||
|
```jinja2
|
||||||
|
{% extends 'base.j2' %}
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
system {
|
||||||
|
host-name {{ device.name }};
|
||||||
|
domain-name example.com;
|
||||||
|
time-zone UTC;
|
||||||
|
authentication-order [ password radius ];
|
||||||
|
ntp {
|
||||||
|
{% for server in ntp_servers %}
|
||||||
|
server {{ server }};
|
||||||
|
{% endfor %}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
{% for interface in device.interfaces.all() %}
|
||||||
|
{% include 'common/interface.j2' %}
|
||||||
|
{% endfor %}
|
||||||
|
{% endblock %}
|
||||||
|
```
|
||||||
|
|
||||||
|
When rendered for a specific NetBox device, the template's `device` variable will be populated with the device instance, and `ntp_servers` will be pulled from the device's available context data. The resulting output will be a valid configuration segment that can be applied directly to a compatible network device.
|
||||||
|
|
||||||
|
## Rendering Templates
|
||||||
|
|
||||||
|
### Device Configurations
|
||||||
|
|
||||||
|
NetBox provides a REST API endpoint specifically for rendering the default configuration template for a specific device. This is accomplished by sending a POST request to the device's unique URL, optionally including additional context data.
|
||||||
|
|
||||||
|
```no-highlight
|
||||||
|
curl -X POST \
|
||||||
|
-H "Authorization: Token $TOKEN" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-H "Accept: application/json; indent=4" \
|
||||||
|
http://netbox:8000/api/dcim/devices/123/render-config/ \
|
||||||
|
--data '{
|
||||||
|
"extra_data": "abc123"
|
||||||
|
}'
|
||||||
|
```
|
||||||
|
|
||||||
|
This request will trigger resolution of the device's preferred config template in the following order:
|
||||||
|
|
||||||
|
* The config template assigned to the individual device
|
||||||
|
* The config template assigned to the device's role
|
||||||
|
* The config template assigned to the device's platform
|
||||||
|
|
||||||
|
If no config template has been assigned to any of these three objects, the request will fail.
|
||||||
|
|
||||||
|
### General Purpose Use
|
||||||
|
|
||||||
|
NetBox config templates can also be rendered without being tied to any specific device, using a separate general purpose REST API endpoint. Any data included with a POST request to this endpoint will be passed as context data for the template.
|
||||||
|
|
||||||
|
```no-highlight
|
||||||
|
curl -X POST \
|
||||||
|
-H "Authorization: Token $TOKEN" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-H "Accept: application/json; indent=4" \
|
||||||
|
http://netbox:8000/api/extras/config-templates/123/render/ \
|
||||||
|
--data '{
|
||||||
|
"foo": "abc",
|
||||||
|
"bar": 123
|
||||||
|
}'
|
||||||
|
```
|
@ -31,6 +31,7 @@ The following models support the assignment of contacts:
|
|||||||
|
|
||||||
* circuits.Circuit
|
* circuits.Circuit
|
||||||
* circuits.Provider
|
* circuits.Provider
|
||||||
|
* circuits.ProviderAccount
|
||||||
* dcim.Device
|
* dcim.Device
|
||||||
* dcim.Location
|
* dcim.Location
|
||||||
* dcim.Manufacturer
|
* dcim.Manufacturer
|
||||||
|
@ -11,6 +11,8 @@ Configuration context data (or "config contexts" for short) is a powerful featur
|
|||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Context data can be consumed by remote API clients, or it can be employed natively to render [configuration templates](./configuration-rendering.md).
|
||||||
|
|
||||||
Config contexts can be computed for objects based on the following criteria:
|
Config contexts can be computed for objects based on the following criteria:
|
||||||
|
|
||||||
| Type | Devices | Virtual Machines |
|
| Type | Devices | Virtual Machines |
|
||||||
|
@ -38,7 +38,7 @@ An example hierarchy might look like this:
|
|||||||
* 100.64.16.1/24 (address)
|
* 100.64.16.1/24 (address)
|
||||||
* 100.64.16.2/24 (address)
|
* 100.64.16.2/24 (address)
|
||||||
* 100.64.16.3/24 (address)
|
* 100.64.16.3/24 (address)
|
||||||
* 100.64.16.9/24 (prefix)
|
* 100.64.19.0/24 (prefix)
|
||||||
* 100.64.32.0/20 (prefix)
|
* 100.64.32.0/20 (prefix)
|
||||||
* 100.64.32.1/24 (address)
|
* 100.64.32.1/24 (address)
|
||||||
* 100.64.32.10-99/24 (range)
|
* 100.64.32.10-99/24 (range)
|
||||||
|
23
docs/features/synchronized-data.md
Normal file
23
docs/features/synchronized-data.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# Synchronized Data
|
||||||
|
|
||||||
|
!!! info "This feature was introduced in NetBox v3.5."
|
||||||
|
|
||||||
|
Several models in NetBox support the automatic synchronization of local data from a designated remote source. For example, [configuration templates](./configuration-rendering.md) defined in NetBox can source their content from text files stored in a remote git repository. This accomplished using the core [data source](../models/core/datasource.md) and [data file](../models/core/datafile.md) models.
|
||||||
|
|
||||||
|
To enable remote data synchronization, the NetBox administrator first designates one or more remote data sources. NetBox currently supports the following source types:
|
||||||
|
|
||||||
|
* Git repository
|
||||||
|
* Amazon S3 bucket (or compatible product)
|
||||||
|
* Local disk path
|
||||||
|
|
||||||
|
(Local disk paths are considered "remote" in this context as they exist outside NetBox's database. These paths could also be mapped to external network shares.)
|
||||||
|
|
||||||
|
Each type of remote source has its own configuration parameters. For instance, a git source will ask the user to specify a branch and authentication credentials. Once the source has been created, a synchronization job is run to automatically replicate remote files in the local database.
|
||||||
|
|
||||||
|
The following NetBox models can be associated with replicated data files:
|
||||||
|
|
||||||
|
* Config contexts
|
||||||
|
* Config templates
|
||||||
|
* Export templates
|
||||||
|
|
||||||
|
Once a data has been designated for a local instance, its data will be replaced with the content of the replicated file. When the replicated file is updated in the future (via synchronization jobs), the local instance will be flagged as having out-of-date data. A user can then synchronize these objects individually or in bulk to effect the update. This two-stage process ensures that automated synchronization tasks do not immediately affect production data.
|
@ -56,7 +56,7 @@ Below is the (rough) recommended order in which NetBox objects should be created
|
|||||||
4. Manufacturers, device types, and module types
|
4. Manufacturers, device types, and module types
|
||||||
5. Platforms and device roles
|
5. Platforms and device roles
|
||||||
6. Devices and modules
|
6. Devices and modules
|
||||||
7. Providers and provider networks
|
7. Providers, provider accounts, and provider networks
|
||||||
8. Circuit types and circuits
|
8. Circuit types and circuits
|
||||||
9. Wireless LAN groups and wireless LANs
|
9. Wireless LAN groups and wireless LANs
|
||||||
10. Route targets and VRFs
|
10. Route targets and VRFs
|
||||||
|
@ -28,12 +28,12 @@ This section entails the installation and configuration of a local PostgreSQL da
|
|||||||
host all all ::1/128 md5
|
host all all ::1/128 md5
|
||||||
```
|
```
|
||||||
|
|
||||||
Once PostgreSQL has been installed, start the service and enable it to run at boot:
|
Once PostgreSQL has been installed, start the service and enable it to run at boot:
|
||||||
|
|
||||||
```no-highlight
|
```no-highlight
|
||||||
sudo systemctl start postgresql
|
sudo systemctl start postgresql
|
||||||
sudo systemctl enable postgresql
|
sudo systemctl enable postgresql
|
||||||
```
|
```
|
||||||
|
|
||||||
Before continuing, verify that you have installed PostgreSQL 11 or later:
|
Before continuing, verify that you have installed PostgreSQL 11 or later:
|
||||||
|
|
||||||
@ -55,6 +55,9 @@ Within the shell, enter the following commands to create the database and user (
|
|||||||
CREATE DATABASE netbox;
|
CREATE DATABASE netbox;
|
||||||
CREATE USER netbox WITH PASSWORD 'J5brHrAXFLQSif0K';
|
CREATE USER netbox WITH PASSWORD 'J5brHrAXFLQSif0K';
|
||||||
ALTER DATABASE netbox OWNER TO netbox;
|
ALTER DATABASE netbox OWNER TO netbox;
|
||||||
|
-- the next two commands are needed on PostgreSQL 15 and later
|
||||||
|
\connect netbox;
|
||||||
|
GRANT CREATE ON SCHEMA public TO netbox;
|
||||||
```
|
```
|
||||||
|
|
||||||
!!! danger "Use a strong password"
|
!!! danger "Use a strong password"
|
||||||
|
@ -4,9 +4,6 @@
|
|||||||
|
|
||||||
[Redis](https://redis.io/) is an in-memory key-value store which NetBox employs for caching and queuing. This section entails the installation and configuration of a local Redis instance. If you already have a Redis service in place, skip to [the next section](3-netbox.md).
|
[Redis](https://redis.io/) is an in-memory key-value store which NetBox employs for caching and queuing. This section entails the installation and configuration of a local Redis instance. If you already have a Redis service in place, skip to [the next section](3-netbox.md).
|
||||||
|
|
||||||
!!! warning "Redis v4.0 or later required"
|
|
||||||
NetBox v2.9.0 and later require Redis v4.0 or higher. If your distribution does not offer a recent enough release, you will need to build Redis from source. Please see [the Redis installation documentation](https://github.com/redis/redis) for further details.
|
|
||||||
|
|
||||||
=== "Ubuntu"
|
=== "Ubuntu"
|
||||||
|
|
||||||
```no-highlight
|
```no-highlight
|
||||||
|
@ -100,6 +100,8 @@ Create a system user account named `netbox`. We'll configure the WSGI and HTTP s
|
|||||||
```
|
```
|
||||||
sudo adduser --system --group netbox
|
sudo adduser --system --group netbox
|
||||||
sudo chown --recursive netbox /opt/netbox/netbox/media/
|
sudo chown --recursive netbox /opt/netbox/netbox/media/
|
||||||
|
sudo chown --recursive netbox /opt/netbox/netbox/reports/
|
||||||
|
sudo chown --recursive netbox /opt/netbox/netbox/scripts/
|
||||||
```
|
```
|
||||||
|
|
||||||
=== "CentOS"
|
=== "CentOS"
|
||||||
@ -108,6 +110,8 @@ Create a system user account named `netbox`. We'll configure the WSGI and HTTP s
|
|||||||
sudo groupadd --system netbox
|
sudo groupadd --system netbox
|
||||||
sudo adduser --system -g netbox netbox
|
sudo adduser --system -g netbox netbox
|
||||||
sudo chown --recursive netbox /opt/netbox/netbox/media/
|
sudo chown --recursive netbox /opt/netbox/netbox/media/
|
||||||
|
sudo chown --recursive netbox /opt/netbox/netbox/reports/
|
||||||
|
sudo chown --recursive netbox /opt/netbox/netbox/scripts/
|
||||||
```
|
```
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
@ -199,14 +203,6 @@ When you have finished modifying the configuration, remember to save the file.
|
|||||||
|
|
||||||
All Python packages required by NetBox are listed in `requirements.txt` and will be installed automatically. NetBox also supports some optional packages. If desired, these packages must be listed in `local_requirements.txt` within the NetBox root directory.
|
All Python packages required by NetBox are listed in `requirements.txt` and will be installed automatically. NetBox also supports some optional packages. If desired, these packages must be listed in `local_requirements.txt` within the NetBox root directory.
|
||||||
|
|
||||||
### NAPALM
|
|
||||||
|
|
||||||
Integration with the [NAPALM automation](../integrations/napalm.md) library allows NetBox to fetch live data from devices and return it to a requester via its REST API. The `NAPALM_USERNAME` and `NAPALM_PASSWORD` configuration parameters define the credentials to be used when connecting to a device.
|
|
||||||
|
|
||||||
```no-highlight
|
|
||||||
sudo sh -c "echo 'napalm' >> /opt/netbox/local_requirements.txt"
|
|
||||||
```
|
|
||||||
|
|
||||||
### Remote File Storage
|
### Remote File Storage
|
||||||
|
|
||||||
By default, NetBox will use the local filesystem to store uploaded files. To use a remote filesystem, install the [`django-storages`](https://django-storages.readthedocs.io/en/stable/) library and configure your [desired storage backend](../configuration/system.md#storage_backend) in `configuration.py`.
|
By default, NetBox will use the local filesystem to store uploaded files. To use a remote filesystem, install the [`django-storages`](https://django-storages.readthedocs.io/en/stable/) library and configure your [desired storage backend](../configuration/system.md#storage_backend) in `configuration.py`.
|
||||||
|
@ -15,7 +15,7 @@ sudo apt install -y libldap2-dev libsasl2-dev libssl-dev
|
|||||||
On CentOS:
|
On CentOS:
|
||||||
|
|
||||||
```no-highlight
|
```no-highlight
|
||||||
sudo yum install -y openldap-devel
|
sudo yum install -y openldap-devel python3-devel
|
||||||
```
|
```
|
||||||
|
|
||||||
### Install django-auth-ldap
|
### Install django-auth-ldap
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
# Installation
|
# Installation
|
||||||
|
|
||||||
The installation instructions provided here have been tested to work on Ubuntu 20.04 and CentOS 8.3. The particular commands needed to install dependencies on other distributions may vary significantly. Unfortunately, this is outside the control of the NetBox maintainers. Please consult your distribution's documentation for assistance with any errors.
|
The installation instructions provided here have been tested to work on Ubuntu 22.04 and CentOS 8.3. The particular commands needed to install dependencies on other distributions may vary significantly. Unfortunately, this is outside the control of the NetBox maintainers. Please consult your distribution's documentation for assistance with any errors.
|
||||||
|
|
||||||
<iframe width="560" height="315" src="https://www.youtube.com/embed/_y5JRiW_PLM" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
<iframe width="560" height="315" src="https://www.youtube.com/embed/_y5JRiW_PLM" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
|
||||||
|
|
||||||
|
@ -48,36 +48,40 @@ Download the [latest stable release](https://github.com/netbox-community/netbox/
|
|||||||
Download and extract the latest version:
|
Download and extract the latest version:
|
||||||
|
|
||||||
```no-highlight
|
```no-highlight
|
||||||
wget https://github.com/netbox-community/netbox/archive/vX.Y.Z.tar.gz
|
# Set $NEWVER to the NetBox version being installed
|
||||||
sudo tar -xzf vX.Y.Z.tar.gz -C /opt
|
NEWVER=3.5.0
|
||||||
sudo ln -sfn /opt/netbox-X.Y.Z/ /opt/netbox
|
wget https://github.com/netbox-community/netbox/archive/v$NEWVER.tar.gz
|
||||||
|
sudo tar -xzf v$NEWVER.tar.gz -C /opt
|
||||||
|
sudo ln -sfn /opt/netbox-$NEWVER/ /opt/netbox
|
||||||
```
|
```
|
||||||
|
|
||||||
Copy `local_requirements.txt`, `configuration.py`, and `ldap_config.py` (if present) from the current installation to the new version:
|
Copy `local_requirements.txt`, `configuration.py`, and `ldap_config.py` (if present) from the current installation to the new version:
|
||||||
|
|
||||||
```no-highlight
|
```no-highlight
|
||||||
sudo cp /opt/netbox-X.Y.Z/local_requirements.txt /opt/netbox/
|
# Set $OLDVER to the NetBox version currently installed
|
||||||
sudo cp /opt/netbox-X.Y.Z/netbox/netbox/configuration.py /opt/netbox/netbox/netbox/
|
OLDVER=3.4.9
|
||||||
sudo cp /opt/netbox-X.Y.Z/netbox/netbox/ldap_config.py /opt/netbox/netbox/netbox/
|
sudo cp /opt/netbox-$OLDVER/local_requirements.txt /opt/netbox/
|
||||||
|
sudo cp /opt/netbox-$OLDVER/netbox/netbox/configuration.py /opt/netbox/netbox/netbox/
|
||||||
|
sudo cp /opt/netbox-$OLDVER/netbox/netbox/ldap_config.py /opt/netbox/netbox/netbox/
|
||||||
```
|
```
|
||||||
|
|
||||||
Be sure to replicate your uploaded media as well. (The exact action necessary will depend on where you choose to store your media, but in general moving or copying the media directory will suffice.)
|
Be sure to replicate your uploaded media as well. (The exact action necessary will depend on where you choose to store your media, but in general moving or copying the media directory will suffice.)
|
||||||
|
|
||||||
```no-highlight
|
```no-highlight
|
||||||
sudo cp -pr /opt/netbox-X.Y.Z/netbox/media/ /opt/netbox/netbox/
|
sudo cp -pr /opt/netbox-$OLDVER/netbox/media/ /opt/netbox/netbox/
|
||||||
```
|
```
|
||||||
|
|
||||||
Also make sure to copy or link any custom scripts and reports that you've made. Note that if these are stored outside the project root, you will not need to copy them. (Check the `SCRIPTS_ROOT` and `REPORTS_ROOT` parameters in the configuration file above if you're unsure.)
|
Also make sure to copy or link any custom scripts and reports that you've made. Note that if these are stored outside the project root, you will not need to copy them. (Check the `SCRIPTS_ROOT` and `REPORTS_ROOT` parameters in the configuration file above if you're unsure.)
|
||||||
|
|
||||||
```no-highlight
|
```no-highlight
|
||||||
sudo cp -r /opt/netbox-X.Y.Z/netbox/scripts /opt/netbox/netbox/
|
sudo cp -r /opt/netbox-$OLDVER/netbox/scripts /opt/netbox/netbox/
|
||||||
sudo cp -r /opt/netbox-X.Y.Z/netbox/reports /opt/netbox/netbox/
|
sudo cp -r /opt/netbox-$OLDVER/netbox/reports /opt/netbox/netbox/
|
||||||
```
|
```
|
||||||
|
|
||||||
If you followed the original installation guide to set up gunicorn, be sure to copy its configuration as well:
|
If you followed the original installation guide to set up gunicorn, be sure to copy its configuration as well:
|
||||||
|
|
||||||
```no-highlight
|
```no-highlight
|
||||||
sudo cp /opt/netbox-X.Y.Z/gunicorn.py /opt/netbox/
|
sudo cp /opt/netbox-$OLDVER/gunicorn.py /opt/netbox/
|
||||||
```
|
```
|
||||||
|
|
||||||
### Option B: Clone the Git Repository
|
### Option B: Clone the Git Repository
|
||||||
@ -97,7 +101,7 @@ sudo git pull origin master
|
|||||||
|
|
||||||
## 4. Run the Upgrade Script
|
## 4. Run the Upgrade Script
|
||||||
|
|
||||||
Once the new code is in place, verify that any optional Python packages required by your deployment (e.g. `napalm` or `django-auth-ldap`) are listed in `local_requirements.txt`. Then, run the upgrade script:
|
Once the new code is in place, verify that any optional Python packages required by your deployment (e.g. `django-auth-ldap`) are listed in `local_requirements.txt`. Then, run the upgrade script:
|
||||||
|
|
||||||
```no-highlight
|
```no-highlight
|
||||||
sudo ./upgrade.sh
|
sudo ./upgrade.sh
|
||||||
|
@ -1,74 +0,0 @@
|
|||||||
# NAPALM
|
|
||||||
|
|
||||||
NetBox supports integration with the [NAPALM automation](https://github.com/napalm-automation/napalm) library. NAPALM allows NetBox to serve a proxy for operational data, fetching live data from network devices and returning it to a requester via its REST API. Note that NetBox does not store any NAPALM data locally.
|
|
||||||
|
|
||||||
The NetBox UI will display tabs for status, LLDP neighbors, and configuration under the device view if the following conditions are met:
|
|
||||||
|
|
||||||
* Device status is "Active"
|
|
||||||
* A primary IP has been assigned to the device
|
|
||||||
* A platform with a NAPALM driver has been assigned
|
|
||||||
* The authenticated user has the `dcim.napalm_read_device` permission
|
|
||||||
|
|
||||||
!!! note
|
|
||||||
To enable this integration, the NAPALM library must be installed. See [installation steps](../../installation/3-netbox/#napalm) for more information.
|
|
||||||
|
|
||||||
Below is an example REST API request and response:
|
|
||||||
|
|
||||||
```no-highlight
|
|
||||||
GET /api/dcim/devices/1/napalm/?method=get_environment
|
|
||||||
|
|
||||||
{
|
|
||||||
"get_environment": {
|
|
||||||
...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
!!! note
|
|
||||||
To make NAPALM requests via the NetBox REST API, a NetBox user must have assigned a permission granting the `napalm_read` action for the device object type.
|
|
||||||
|
|
||||||
## Authentication
|
|
||||||
|
|
||||||
By default, the [`NAPALM_USERNAME`](../configuration/napalm.md#napalm_username) and [`NAPALM_PASSWORD`](../configuration/napalm.md#napalm_password) configuration parameters are used for NAPALM authentication. They can be overridden for an individual API call by specifying the `X-NAPALM-Username` and `X-NAPALM-Password` headers.
|
|
||||||
|
|
||||||
```
|
|
||||||
$ curl "http://localhost/api/dcim/devices/1/napalm/?method=get_environment" \
|
|
||||||
-H "Authorization: Token $TOKEN" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-H "Accept: application/json; indent=4" \
|
|
||||||
-H "X-NAPALM-Username: foo" \
|
|
||||||
-H "X-NAPALM-Password: bar"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Method Support
|
|
||||||
|
|
||||||
The list of supported NAPALM methods depends on the [NAPALM driver](https://napalm.readthedocs.io/en/latest/support/index.html#general-support-matrix) configured for the platform of a device. Because there is no granular mechanism in place for limiting potentially disruptive requests, NetBox supports only read-only [get](https://napalm.readthedocs.io/en/latest/support/index.html#getters-support-matrix) methods.
|
|
||||||
|
|
||||||
## Multiple Methods
|
|
||||||
|
|
||||||
It is possible to request the output of multiple NAPALM methods in a single API request by passing multiple `method` parameters. For example:
|
|
||||||
|
|
||||||
```no-highlight
|
|
||||||
GET /api/dcim/devices/1/napalm/?method=get_ntp_servers&method=get_ntp_peers
|
|
||||||
|
|
||||||
{
|
|
||||||
"get_ntp_servers": {
|
|
||||||
...
|
|
||||||
},
|
|
||||||
"get_ntp_peers": {
|
|
||||||
...
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Optional Arguments
|
|
||||||
|
|
||||||
The behavior of NAPALM drivers can be adjusted according to the [optional arguments](https://napalm.readthedocs.io/en/latest/support/index.html#optional-arguments). NetBox exposes those arguments using headers prefixed with `X-NAPALM-`. For example, the SSH port is changed to 2222 in this API call:
|
|
||||||
|
|
||||||
```
|
|
||||||
$ curl "http://localhost/api/dcim/devices/1/napalm/?method=get_environment" \
|
|
||||||
-H "Authorization: Token $TOKEN" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-H "Accept: application/json; indent=4" \
|
|
||||||
-H "X-NAPALM-port: 2222"
|
|
||||||
```
|
|
@ -63,7 +63,7 @@ Each attribute of the IP address is expressed as an attribute of the JSON object
|
|||||||
|
|
||||||
## Interactive Documentation
|
## Interactive Documentation
|
||||||
|
|
||||||
Comprehensive, interactive documentation of all REST API endpoints is available on a running NetBox instance at `/api/docs/`. This interface provides a convenient sandbox for researching and experimenting with specific endpoints and request types. The API itself can also be explored using a web browser by navigating to its root at `/api/`.
|
Comprehensive, interactive documentation of all REST API endpoints is available on a running NetBox instance at `/api/schema/swagger-ui/`. This interface provides a convenient sandbox for researching and experimenting with specific endpoints and request types. The API itself can also be explored using a web browser by navigating to its root at `/api/`.
|
||||||
|
|
||||||
## Endpoint Hierarchy
|
## Endpoint Hierarchy
|
||||||
|
|
||||||
@ -638,7 +638,7 @@ $ curl -X POST \
|
|||||||
https://netbox/api/users/tokens/provision/ \
|
https://netbox/api/users/tokens/provision/ \
|
||||||
--data '{
|
--data '{
|
||||||
"username": "hankhill",
|
"username": "hankhill",
|
||||||
"password": "I<3C3H8",
|
"password": "I<3C3H8"
|
||||||
}'
|
}'
|
||||||
```
|
```
|
||||||
|
|
||||||
@ -662,3 +662,28 @@ Note that we are _not_ passing an existing REST API token with this request. If
|
|||||||
"description": ""
|
"description": ""
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
## HTTP Headers
|
||||||
|
|
||||||
|
### `API-Version`
|
||||||
|
|
||||||
|
This header specifies the API version in use. This will always match the version of NetBox installed. For example, NetBox v3.4.2 will report an API version of `3.4`.
|
||||||
|
|
||||||
|
### `X-Request-ID`
|
||||||
|
|
||||||
|
!!! info "This feature was introduced in NetBox v3.5."
|
||||||
|
|
||||||
|
This header specifies the unique ID assigned to the received API request. It can be very handy for correlating a request with change records. For example, after creating several new objects, you can filter against the object changes API endpoint to retrieve the resulting change records:
|
||||||
|
|
||||||
|
```
|
||||||
|
GET /api/extras/object-changes/?request_id=e39c84bc-f169-4d5f-bc1c-94487a1b18b5
|
||||||
|
```
|
||||||
|
|
||||||
|
The request ID can also be used to filter many objects directly, to return those created or updated by a certain request:
|
||||||
|
|
||||||
|
```
|
||||||
|
GET /api/dcim/sites/?created_by_request=e39c84bc-f169-4d5f-bc1c-94487a1b18b5
|
||||||
|
```
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
This header is included with _all_ NetBox responses, although it is most practical when working with an API.
|
||||||
|
9
docs/integrations/synchronized-data.md
Normal file
9
docs/integrations/synchronized-data.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Synchronized Data
|
||||||
|
|
||||||
|
Some NetBox models support automatic synchronization of certain attributes from remote [data sources](../models/core/datasource.md), such as a git repository hosted on GitHub or GitLab. Data from the authoritative remote source is synchronized locally in NetBox as [data files](../models/core/datafile.md).
|
||||||
|
|
||||||
|
The following features support the use of synchronized data:
|
||||||
|
|
||||||
|
* [Configuration templates](../features/configuration-rendering.md)
|
||||||
|
* [Configuration context data](../features/context-data.md)
|
||||||
|
* [Export templates](../customization/export-templates.md)
|
@ -37,7 +37,6 @@ NetBox was built specifically to serve the needs of network engineers and operat
|
|||||||
* Robust object-based permissions
|
* Robust object-based permissions
|
||||||
* Detailed, automatic change logging
|
* Detailed, automatic change logging
|
||||||
* Global search engine
|
* Global search engine
|
||||||
* NAPALM integration
|
|
||||||
|
|
||||||
## What NetBox Is Not
|
## What NetBox Is Not
|
||||||
|
|
||||||
@ -78,4 +77,3 @@ NetBox is built on the [Django](https://djangoproject.com/) Python framework and
|
|||||||
| Application | Django/Python |
|
| Application | Django/Python |
|
||||||
| Database | PostgreSQL 11+ |
|
| Database | PostgreSQL 11+ |
|
||||||
| Task queuing | Redis/django-rq |
|
| Task queuing | Redis/django-rq |
|
||||||
| Live device access | NAPALM (optional) |
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 174 KiB After Width: | Height: | Size: 173 KiB |
Binary file not shown.
Before Width: | Height: | Size: 173 KiB After Width: | Height: | Size: 171 KiB |
@ -8,6 +8,10 @@ A circuit represents a physical point-to-point data connection, typically used t
|
|||||||
|
|
||||||
The [provider](./provider.md) to which this circuit belongs.
|
The [provider](./provider.md) to which this circuit belongs.
|
||||||
|
|
||||||
|
### Provider Account
|
||||||
|
|
||||||
|
Circuits may optionally be assigned to a specific [provider account](./provideraccount.md).
|
||||||
|
|
||||||
### Circuit ID
|
### Circuit ID
|
||||||
|
|
||||||
An identifier for this circuit. This must be unique to the assigned provider. (Circuits assigned to different providers may have the same circuit ID.)
|
An identifier for this circuit. This must be unique to the assigned provider. (Circuits assigned to different providers may have the same circuit ID.)
|
||||||
|
@ -12,21 +12,10 @@ A unique human-friendly name.
|
|||||||
|
|
||||||
A unique URL-friendly identifier. (This value can be used for filtering.)
|
A unique URL-friendly identifier. (This value can be used for filtering.)
|
||||||
|
|
||||||
### ASN
|
|
||||||
|
|
||||||
The AS number assigned to this provider.
|
|
||||||
|
|
||||||
!!! warning "Legacy field"
|
|
||||||
This field is being removed in NetBox v3.4. Users are highly encouraged to use the [ASN model](../ipam/asn.md) to track AS number assignment for providers.
|
|
||||||
|
|
||||||
### ASNs
|
### ASNs
|
||||||
|
|
||||||
The [AS numbers](../ipam/asn.md) assigned to this provider (optional).
|
The [AS numbers](../ipam/asn.md) assigned to this provider (optional).
|
||||||
|
|
||||||
### Account Number
|
|
||||||
|
|
||||||
The administrative account identifier tied to this provider for your organization.
|
|
||||||
|
|
||||||
### Portal URL
|
### Portal URL
|
||||||
|
|
||||||
The URL for the provider's customer service portal.
|
The URL for the provider's customer service portal.
|
||||||
|
19
docs/models/circuits/provideraccount.md
Normal file
19
docs/models/circuits/provideraccount.md
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
# Provider Accounts
|
||||||
|
|
||||||
|
!!! info "This model was introduced in NetBox v3.5."
|
||||||
|
|
||||||
|
This model can be used to represent individual accounts associated with a provider.
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
### Provider
|
||||||
|
|
||||||
|
The [provider](./provider.md) the account belongs to.
|
||||||
|
|
||||||
|
### Name
|
||||||
|
|
||||||
|
A human-friendly name, unique to the provider.
|
||||||
|
|
||||||
|
### Account Number
|
||||||
|
|
||||||
|
The administrative account identifier tied to this provider for your organization.
|
25
docs/models/core/datafile.md
Normal file
25
docs/models/core/datafile.md
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
# Data Files
|
||||||
|
|
||||||
|
A data file object is the representation in NetBox's database of some file belonging to a remote [data source](./datasource.md). Data files are synchronized automatically, and cannot be modified locally (although they can be deleted).
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
### Source
|
||||||
|
|
||||||
|
The [data source](./datasource.md) to which this file belongs.
|
||||||
|
|
||||||
|
### Path
|
||||||
|
|
||||||
|
The path to the file, relative to its source's URL. For example, a file at `/opt/config-data/routing/bgp/peer.yaml` with a source URL of `file:///opt/config-data/` would have its path set to `routing/bgp/peer.yaml`.
|
||||||
|
|
||||||
|
### Last Updated
|
||||||
|
|
||||||
|
The date and time at which the file most recently updated from its source. Note that this attribute is updated only when the file's contents have been modified. Re-synchronizing the data source will not update this timestamp if the upstream file's data has not changed.
|
||||||
|
|
||||||
|
### Size
|
||||||
|
|
||||||
|
The file's size, in bytes.
|
||||||
|
|
||||||
|
### Hash
|
||||||
|
|
||||||
|
A [SHA256 hash](https://en.wikipedia.org/wiki/SHA-2) of the file's data. This can be compared to a hash taken from the original file to determine whether any changes have been made.
|
49
docs/models/core/datasource.md
Normal file
49
docs/models/core/datasource.md
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
# Data Sources
|
||||||
|
|
||||||
|
A data source represents some external repository of data which NetBox can consume, such as a git repository. Files within the data source are synchronized to NetBox by saving them in the database as [data file](./datafile.md) objects.
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
### Name
|
||||||
|
|
||||||
|
The data source's human-friendly name.
|
||||||
|
|
||||||
|
### Type
|
||||||
|
|
||||||
|
The type of data source. Supported options include:
|
||||||
|
|
||||||
|
* Local directory
|
||||||
|
* git repository
|
||||||
|
* Amazon S3 bucket
|
||||||
|
|
||||||
|
### URL
|
||||||
|
|
||||||
|
The URL identifying the remote source. Some examples are included below.
|
||||||
|
|
||||||
|
| Type | Example URL |
|
||||||
|
|-----------|----------------------------------------------------|
|
||||||
|
| Local | file:///path/to/my/data/ |
|
||||||
|
| git | https://github.com/my-organization/my-repo |
|
||||||
|
| Amazon S3 | https://s3.us-east-2.amazonaws.com/my-bucket-name/ |
|
||||||
|
|
||||||
|
### Status
|
||||||
|
|
||||||
|
The source's current synchronization status. Note that this cannot be set manually: It is updated automatically when the source is synchronized.
|
||||||
|
|
||||||
|
### Enabled
|
||||||
|
|
||||||
|
If false, synchronization will be disabled.
|
||||||
|
|
||||||
|
### Ignore Rules
|
||||||
|
|
||||||
|
A set of rules (one per line) identifying filenames to ignore during synchronization. Some examples are provided below. See Python's [`fnmatch()` documentation](https://docs.python.org/3/library/fnmatch.html) for a complete reference.
|
||||||
|
|
||||||
|
| Rule | Description |
|
||||||
|
|----------------|------------------------------------------|
|
||||||
|
| `README` | Ignore any files named `README` |
|
||||||
|
| `*.txt` | Ignore any files with a `.txt` extension |
|
||||||
|
| `data???.json` | Ignore e.g. `data123.json` |
|
||||||
|
|
||||||
|
### Last Synced
|
||||||
|
|
||||||
|
The date and time at which the source was most recently synchronized successfully.
|
54
docs/models/core/job.md
Normal file
54
docs/models/core/job.md
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
# Jobs
|
||||||
|
|
||||||
|
The Job model is used to schedule and record the execution of [background tasks](../../features/background-jobs.md).
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
### Name
|
||||||
|
|
||||||
|
The name or other identifier of the NetBox object with which the job is associated.
|
||||||
|
|
||||||
|
## Object Type
|
||||||
|
|
||||||
|
The type of object (model) associated with this job.
|
||||||
|
|
||||||
|
### Created
|
||||||
|
|
||||||
|
The date and time at which the job itself was created.
|
||||||
|
|
||||||
|
### Scheduled
|
||||||
|
|
||||||
|
The date and time at which the job is/was scheduled to execute (if not submitted for immediate execution at the time of creation).
|
||||||
|
|
||||||
|
### Interval
|
||||||
|
|
||||||
|
The interval (in minutes) at which a scheduled job should re-execute.
|
||||||
|
|
||||||
|
### Completed
|
||||||
|
|
||||||
|
The date and time at which the job completed (if complete).
|
||||||
|
|
||||||
|
### User
|
||||||
|
|
||||||
|
The user who created the job.
|
||||||
|
|
||||||
|
### Status
|
||||||
|
|
||||||
|
The job's current status. Potential values include:
|
||||||
|
|
||||||
|
| Value | Description |
|
||||||
|
|-------|-------------|
|
||||||
|
| Pending | Awaiting execution by an RQ worker process |
|
||||||
|
| Scheduled | Scheduled for a future date/time |
|
||||||
|
| Running | Currently executing |
|
||||||
|
| Completed | Successfully completed |
|
||||||
|
| Failed | The job did not complete successfully |
|
||||||
|
| Errored | An unexpected error was encountered during execution |
|
||||||
|
|
||||||
|
### Data
|
||||||
|
|
||||||
|
Any data associated with the execution of the job, such as log output.
|
||||||
|
|
||||||
|
### Job ID
|
||||||
|
|
||||||
|
The job's UUID, used for unique identification within a queue.
|
@ -72,6 +72,10 @@ The device's operational status.
|
|||||||
|
|
||||||
A device may be associated with a particular [platform](./platform.md) to indicate its operating system. Note that only platforms assigned to the associated manufacturer (or to no manufacturer) will be available for selection.
|
A device may be associated with a particular [platform](./platform.md) to indicate its operating system. Note that only platforms assigned to the associated manufacturer (or to no manufacturer) will be available for selection.
|
||||||
|
|
||||||
|
### Configuration Template
|
||||||
|
|
||||||
|
The [configuration template](../extras/configtemplate.md) from which the configuration for this device can be rendered. If set, this will override any config template referenced by the device's role or platform.
|
||||||
|
|
||||||
### Primary IPv4 & IPv6 Addresses
|
### Primary IPv4 & IPv6 Addresses
|
||||||
|
|
||||||
Each device may designate one primary IPv4 address and/or one primary IPv6 address for management purposes.
|
Each device may designate one primary IPv4 address and/or one primary IPv6 address for management purposes.
|
||||||
|
@ -19,3 +19,7 @@ The color used when displaying the role in the NetBox UI.
|
|||||||
### VM Role
|
### VM Role
|
||||||
|
|
||||||
If selected, this role may be assigned to [virtual machines](../virtualization/virtualmachine.md)
|
If selected, this role may be assigned to [virtual machines](../virtualization/virtualmachine.md)
|
||||||
|
|
||||||
|
### Configuration Template
|
||||||
|
|
||||||
|
The default [configuration template](../extras/configtemplate.md) for devices assigned to this role.
|
||||||
|
@ -21,6 +21,10 @@ The model number assigned to this device type by its manufacturer. Must be uniqu
|
|||||||
|
|
||||||
A unique URL-friendly representation of the model identifier. (This value can be used for filtering.)
|
A unique URL-friendly representation of the model identifier. (This value can be used for filtering.)
|
||||||
|
|
||||||
|
### Default Platform
|
||||||
|
|
||||||
|
If defined, devices instantiated from this type will automatically inherit the selected platform. (This assignment can be changed after the device has been created.)
|
||||||
|
|
||||||
### Part Number
|
### Part Number
|
||||||
|
|
||||||
An alternative part number to uniquely identify the device type.
|
An alternative part number to uniquely identify the device type.
|
||||||
|
@ -4,8 +4,6 @@ A platform defines the type of software running on a [device](./device.md) or [v
|
|||||||
|
|
||||||
Platforms may optionally be limited by [manufacturer](./manufacturer.md): If a platform is assigned to a particular manufacturer, it can only be assigned to devices with a type belonging to that manufacturer.
|
Platforms may optionally be limited by [manufacturer](./manufacturer.md): If a platform is assigned to a particular manufacturer, it can only be assigned to devices with a type belonging to that manufacturer.
|
||||||
|
|
||||||
The platform model is also used to indicate which [NAPALM driver](../../integrations/napalm.md) (if any) and any associated arguments NetBox should use when connecting to a remote device. The name of the driver along with optional parameters are stored with the platform.
|
|
||||||
|
|
||||||
The assignment of platforms to devices is an optional feature, and may be disregarded if not desired.
|
The assignment of platforms to devices is an optional feature, and may be disregarded if not desired.
|
||||||
|
|
||||||
## Fields
|
## Fields
|
||||||
@ -22,10 +20,20 @@ A unique URL-friendly identifier. (This value can be used for filtering.)
|
|||||||
|
|
||||||
If designated, this platform will be available for use only to devices assigned to this [manufacturer](./manufacturer.md). This can be handy e.g. for limiting network operating systems to use on hardware produced by the relevant vendor. However, it should not be used when defining general-purpose software platforms.
|
If designated, this platform will be available for use only to devices assigned to this [manufacturer](./manufacturer.md). This can be handy e.g. for limiting network operating systems to use on hardware produced by the relevant vendor. However, it should not be used when defining general-purpose software platforms.
|
||||||
|
|
||||||
|
### Configuration Template
|
||||||
|
|
||||||
|
The default [configuration template](../extras/configtemplate.md) for devices assigned to this platform.
|
||||||
|
|
||||||
### NAPALM Driver
|
### NAPALM Driver
|
||||||
|
|
||||||
|
!!! warning "Deprecated Field"
|
||||||
|
NAPALM integration was removed from NetBox core in v3.5 and is now available as a [plugin](https://github.com/netbox-community/netbox-napalm). This field will be removed in NetBox v3.6.
|
||||||
|
|
||||||
The [NAPALM driver](https://napalm.readthedocs.io/en/latest/support/index.html) associated with this platform.
|
The [NAPALM driver](https://napalm.readthedocs.io/en/latest/support/index.html) associated with this platform.
|
||||||
|
|
||||||
### NAPALM Arguments
|
### NAPALM Arguments
|
||||||
|
|
||||||
|
!!! warning "Deprecated Field"
|
||||||
|
NAPALM integration was removed from NetBox core in v3.5 and is now available as a [plugin](https://github.com/netbox-community/netbox-napalm). This field will be removed in NetBox v3.6.
|
||||||
|
|
||||||
Any additional arguments to send when invoking the NAPALM driver assigned to this platform.
|
Any additional arguments to send when invoking the NAPALM driver assigned to this platform.
|
||||||
|
@ -18,6 +18,10 @@ A numeric value which influences the order in which context data is merged. Cont
|
|||||||
|
|
||||||
The context data expressed in JSON format.
|
The context data expressed in JSON format.
|
||||||
|
|
||||||
|
### Data File
|
||||||
|
|
||||||
|
Config context data may optionally be sourced from a remote [data file](../core/datafile.md), which is synchronized from a remote data source. When designating a data file, there is no need to specify local data for the config context: It will be populated automatically from the data file.
|
||||||
|
|
||||||
### Is Active
|
### Is Active
|
||||||
|
|
||||||
If not selected, this config context will be excluded from rendering. This can be convenient to temporarily disable a config context.
|
If not selected, this config context will be excluded from rendering. This can be convenient to temporarily disable a config context.
|
||||||
|
29
docs/models/extras/configtemplate.md
Normal file
29
docs/models/extras/configtemplate.md
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
# Configuration Templates
|
||||||
|
|
||||||
|
Configuration templates can be used to render [device](../dcim/device.md) configurations from [context data](../../features/context-data.md). Templates are written in the [Jinja2 language](https://jinja.palletsprojects.com/) and can be associated with devices roles, platforms, and/or individual devices.
|
||||||
|
|
||||||
|
Context data is made available to [devices](../dcim/device.md) and/or [virtual machines](../virtualization/virtualmachine.md) based on their relationships to other objects in NetBox. For example, context data can be associated only with devices assigned to a particular site, or only to virtual machines in a certain cluster.
|
||||||
|
|
||||||
|
See the [configuration rendering documentation](../../features/configuration-rendering.md) for more information.
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
### Name
|
||||||
|
|
||||||
|
A unique human-friendly name.
|
||||||
|
|
||||||
|
### Weight
|
||||||
|
|
||||||
|
A numeric value which influences the order in which context data is merged. Contexts with a lower weight are merged before those with a higher weight.
|
||||||
|
|
||||||
|
### Data File
|
||||||
|
|
||||||
|
Template code may optionally be sourced from a remote [data file](../core/datafile.md), which is synchronized from a remote data source. When designating a data file, there is no need to specify template code: It will be populated automatically from the data file.
|
||||||
|
|
||||||
|
### Template Code
|
||||||
|
|
||||||
|
Jinja2 template code, if being defined locally rather than replicated from a data file.
|
||||||
|
|
||||||
|
### Environment Parameters
|
||||||
|
|
||||||
|
A dictionary of any additional parameters to pass when instantiating the [Jinja2 environment](https://jinja.palletsprojects.com/en/3.1.x/api/#jinja2.Environment). Jinja2 supports various optional parameters which can be used to modify its default behavior.
|
@ -68,11 +68,12 @@ Defines how filters are evaluated against custom field values.
|
|||||||
|
|
||||||
Controls how and whether the custom field is displayed within the NetBox user interface.
|
Controls how and whether the custom field is displayed within the NetBox user interface.
|
||||||
|
|
||||||
| Option | Description |
|
| Option | Description |
|
||||||
|------------|--------------------------------------|
|
|-------------------|--------------------------------------------------|
|
||||||
| Read/write | Display and permit editing (default) |
|
| Read/write | Display and permit editing (default) |
|
||||||
| Read-only | Display field but disallow editing |
|
| Read-only | Display field but disallow editing |
|
||||||
| Hidden | Do not display field in the UI |
|
| Hidden | Do not display field in the UI |
|
||||||
|
| Hidden (if unset) | Display in the UI only when a value has been set |
|
||||||
|
|
||||||
### Default
|
### Default
|
||||||
|
|
||||||
@ -82,6 +83,10 @@ The default value to populate for the custom field when creating new objects (op
|
|||||||
|
|
||||||
For choice and multi-choice custom fields only. A comma-delimited list of the available choices.
|
For choice and multi-choice custom fields only. A comma-delimited list of the available choices.
|
||||||
|
|
||||||
|
### Cloneable
|
||||||
|
|
||||||
|
If enabled, values from this field will be automatically pre-populated when cloning existing objects.
|
||||||
|
|
||||||
### Minimum Value
|
### Minimum Value
|
||||||
|
|
||||||
For numeric custom fields only. The minimum valid value (optional).
|
For numeric custom fields only. The minimum valid value (optional).
|
||||||
|
@ -12,6 +12,10 @@ The name of the export template. This will appear in the "export" dropdown list
|
|||||||
|
|
||||||
The type of NetBox object to which the export template applies.
|
The type of NetBox object to which the export template applies.
|
||||||
|
|
||||||
|
### Data File
|
||||||
|
|
||||||
|
Template code may optionally be sourced from a remote [data file](../core/datafile.md), which is synchronized from a remote data source. When designating a data file, there is no need to specify local content for the template: It will be populated automatically from the data file.
|
||||||
|
|
||||||
### Template Code
|
### Template Code
|
||||||
|
|
||||||
Jinja2 template code for rendering the exported data.
|
Jinja2 template code for rendering the exported data.
|
||||||
|
@ -22,11 +22,13 @@ If not selected, the webhook will be inactive.
|
|||||||
|
|
||||||
The events which will trigger the webhook. At least one event type must be selected.
|
The events which will trigger the webhook. At least one event type must be selected.
|
||||||
|
|
||||||
| Name | Description |
|
| Name | Description |
|
||||||
|-----------|--------------------------------------|
|
|------------|--------------------------------------|
|
||||||
| Creations | A new object has been created |
|
| Creations | A new object has been created |
|
||||||
| Updates | An existing object has been modified |
|
| Updates | An existing object has been modified |
|
||||||
| Deletions | An object has been deleted |
|
| Deletions | An object has been deleted |
|
||||||
|
| Job starts | A job for an object starts |
|
||||||
|
| Job ends | A job for an object terminates |
|
||||||
|
|
||||||
### URL
|
### URL
|
||||||
|
|
||||||
@ -58,6 +60,10 @@ Jinja2 template for a custom request body, if desired. If not defined, NetBox wi
|
|||||||
|
|
||||||
A secret string used to prove authenticity of the request (optional). This will append a `X-Hook-Signature` header to the request, consisting of a HMAC (SHA-512) hex digest of the request body using the secret as the key.
|
A secret string used to prove authenticity of the request (optional). This will append a `X-Hook-Signature` header to the request, consisting of a HMAC (SHA-512) hex digest of the request body using the secret as the key.
|
||||||
|
|
||||||
|
### Conditions
|
||||||
|
|
||||||
|
A set of [prescribed conditions](../../reference/conditions.md) against which the triggering object will be evaluated. If the conditions are defined but not met by the object, the webhook will not be sent. A webhook that does not define any conditions will _always_ trigger.
|
||||||
|
|
||||||
### SSL Verification
|
### SSL Verification
|
||||||
|
|
||||||
Controls whether validation of the receiver's SSL certificate is enforced when HTTPS is used.
|
Controls whether validation of the receiver's SSL certificate is enforced when HTTPS is used.
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
# ASN
|
# ASNs
|
||||||
|
|
||||||
An Autonomous System Number (ASN) is a numeric identifier used in the BGP protocol to identify which [autonomous system](https://en.wikipedia.org/wiki/Autonomous_system_%28Internet%29) a particular prefix is originating and transiting through. NetBox support both 32- and 64- ASNs.
|
An Autonomous System Number (ASN) is a numeric identifier used in the BGP protocol to identify which [autonomous system](https://en.wikipedia.org/wiki/Autonomous_system_%28Internet%29) a particular prefix is originating and transiting through. NetBox support both 32- and 64- ASNs.
|
||||||
|
|
||||||
ASNs must be globally unique within NetBox, must each may be assigned to multiple [sites](../dcim/site.md).
|
ASNs must be globally unique within NetBox, and may be allocated from within a [defined range](./asnrange.md). Each ASN may be assigned to multiple [sites](../dcim/site.md).
|
||||||
|
|
||||||
## Fields
|
## Fields
|
||||||
|
|
||||||
|
23
docs/models/ipam/asnrange.md
Normal file
23
docs/models/ipam/asnrange.md
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
# ASN Ranges
|
||||||
|
|
||||||
|
!!! info "This model was introduced in NetBox v3.5."
|
||||||
|
|
||||||
|
Ranges can be defined to group [AS numbers](./asn.md) numerically and to facilitate their automatic provisioning. Each range must be assigned to a [RIR](./rir.md).
|
||||||
|
|
||||||
|
## Fields
|
||||||
|
|
||||||
|
### Name
|
||||||
|
|
||||||
|
A unique human-friendly name for the range.
|
||||||
|
|
||||||
|
### Slug
|
||||||
|
|
||||||
|
A unique URL-friendly identifier. (This value can be used for filtering.)
|
||||||
|
|
||||||
|
### RIR
|
||||||
|
|
||||||
|
The [Regional Internet Registry](./rir.md) or similar authority responsible for the allocation of AS numbers within this range.
|
||||||
|
|
||||||
|
### Start & End
|
||||||
|
|
||||||
|
The starting and ending numeric boundaries of the range (inclusive).
|
@ -28,3 +28,7 @@ The IP range's operational status. Note that the status of a range does _not_ ha
|
|||||||
|
|
||||||
!!! tip
|
!!! tip
|
||||||
Additional statuses may be defined by setting `IPRange.status` under the [`FIELD_CHOICES`](../../configuration/data-validation.md#field_choices) configuration parameter.
|
Additional statuses may be defined by setting `IPRange.status` under the [`FIELD_CHOICES`](../../configuration/data-validation.md#field_choices) configuration parameter.
|
||||||
|
|
||||||
|
### Mark Utilized
|
||||||
|
|
||||||
|
If enabled, the IP range will be considered 100% utilized regardless of how many IP addresses are defined within it. This is useful for documenting DHCP ranges, for example.
|
||||||
|
@ -6,11 +6,11 @@ A tenant represents a discrete grouping of resources used for administrative pur
|
|||||||
|
|
||||||
### Name
|
### Name
|
||||||
|
|
||||||
A unique human-friendly name.
|
A human-friendly name, unique to the assigned group.
|
||||||
|
|
||||||
### Slug
|
### Slug
|
||||||
|
|
||||||
A unique URL-friendly identifier. (This value can be used for filtering.)
|
A URL-friendly identifier, unique to the assigned group. (This value can be used for filtering.)
|
||||||
|
|
||||||
### Group
|
### Group
|
||||||
|
|
||||||
|
51
docs/plugins/development/dashboard-widgets.md
Normal file
51
docs/plugins/development/dashboard-widgets.md
Normal file
@ -0,0 +1,51 @@
|
|||||||
|
# Dashboard Widgets
|
||||||
|
|
||||||
|
!!! info "This feature was introduced in NetBox v3.5."
|
||||||
|
|
||||||
|
Each NetBox user can customize his or her personal dashboard by adding and removing widgets and by manipulating the size and position of each. Plugins can register their own dashboard widgets to complement those already available natively.
|
||||||
|
|
||||||
|
## The DashboardWidget Class
|
||||||
|
|
||||||
|
All dashboard widgets must inherit from NetBox's `DashboardWidget` base class. Subclasses must provide a `render()` method, and may override the base class' default characteristics.
|
||||||
|
|
||||||
|
Widgets which require configuration by a user must also include a `ConfigForm` child class which inherits from `WidgetConfigForm`. This form is used to render the user configuration options for the widget.
|
||||||
|
|
||||||
|
::: extras.dashboard.widgets.DashboardWidget
|
||||||
|
|
||||||
|
## Widget Registration
|
||||||
|
|
||||||
|
To register a dashboard widget for use in NetBox, import the `register_widget()` decorator and use it to wrap each `DashboardWidget` subclass:
|
||||||
|
|
||||||
|
```python
|
||||||
|
from extras.dashboard.widgets import DashboardWidget, register_widget
|
||||||
|
|
||||||
|
@register_widget
|
||||||
|
class MyWidget1(DashboardWidget):
|
||||||
|
...
|
||||||
|
|
||||||
|
@register_widget
|
||||||
|
class MyWidget2(DashboardWidget):
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
## Example
|
||||||
|
|
||||||
|
```python
|
||||||
|
from django import forms
|
||||||
|
from extras.dashboard.utils import register_widget
|
||||||
|
from extras.dashboard.widgets import DashboardWidget, WidgetConfigForm
|
||||||
|
|
||||||
|
|
||||||
|
@register_widget
|
||||||
|
class ReminderWidget(DashboardWidget):
|
||||||
|
default_title = 'Reminder'
|
||||||
|
description = 'Add a virtual sticky note'
|
||||||
|
|
||||||
|
class ConfigForm(WidgetConfigForm):
|
||||||
|
content = forms.CharField(
|
||||||
|
widget=forms.Textarea()
|
||||||
|
)
|
||||||
|
|
||||||
|
def render(self, request):
|
||||||
|
return self.config.get('content')
|
||||||
|
```
|
@ -70,9 +70,6 @@ class MyModelImportForm(NetBoxModelImportForm):
|
|||||||
fields = ('name', 'status', 'site', 'comments')
|
fields = ('name', 'status', 'site', 'comments')
|
||||||
```
|
```
|
||||||
|
|
||||||
!!! note "Previously NetBoxModelCSVForm"
|
|
||||||
This form class was previously named `NetBoxModelCSVForm`. It was renamed in NetBox v3.4 to convey support for JSON and YAML formats in addition to CSV. The `NetBoxModelCSVForm` class has been retained for backward compatibility and functions exactly the same as `NetBoxModelImportForm`. However, plugin authors should be aware that this backward compatability will be removed in NetBox v3.5.
|
|
||||||
|
|
||||||
### `NetBoxModelBulkEditForm`
|
### `NetBoxModelBulkEditForm`
|
||||||
|
|
||||||
This form facilitates editing multiple objects in bulk. Unlike a model form, this form does not have a child `Meta` class, and must explicitly define each field. All fields in a bulk edit form are generally declared with `required=False`.
|
This form facilitates editing multiple objects in bulk. Unlike a model form, this form does not have a child `Meta` class, and must explicitly define each field. All fields in a bulk edit form are generally declared with `required=False`.
|
||||||
@ -148,74 +145,77 @@ class MyModelFilterForm(NetBoxModelFilterSetForm):
|
|||||||
|
|
||||||
In addition to the [form fields provided by Django](https://docs.djangoproject.com/en/stable/ref/forms/fields/), NetBox provides several field classes for use within forms to handle specific types of data. These can be imported from `utilities.forms.fields` and are documented below.
|
In addition to the [form fields provided by Django](https://docs.djangoproject.com/en/stable/ref/forms/fields/), NetBox provides several field classes for use within forms to handle specific types of data. These can be imported from `utilities.forms.fields` and are documented below.
|
||||||
|
|
||||||
::: utilities.forms.ColorField
|
::: utilities.forms.fields.ColorField
|
||||||
options:
|
options:
|
||||||
members: false
|
members: false
|
||||||
|
|
||||||
::: utilities.forms.CommentField
|
::: utilities.forms.fields.CommentField
|
||||||
options:
|
options:
|
||||||
members: false
|
members: false
|
||||||
|
|
||||||
::: utilities.forms.JSONField
|
::: utilities.forms.fields.JSONField
|
||||||
options:
|
options:
|
||||||
members: false
|
members: false
|
||||||
|
|
||||||
::: utilities.forms.MACAddressField
|
::: utilities.forms.fields.MACAddressField
|
||||||
options:
|
options:
|
||||||
members: false
|
members: false
|
||||||
|
|
||||||
::: utilities.forms.SlugField
|
::: utilities.forms.fields.SlugField
|
||||||
options:
|
options:
|
||||||
members: false
|
members: false
|
||||||
|
|
||||||
## Choice Fields
|
## Choice Fields
|
||||||
|
|
||||||
::: utilities.forms.ChoiceField
|
!!! warning "Obsolete Fields"
|
||||||
|
NetBox's custom `ChoiceField` and `MultipleChoiceField` classes are no longer necessary thanks to improvements made to the user interface. Django's native form fields can be used instead. These custom field classes will be removed in NetBox v3.6.
|
||||||
|
|
||||||
|
::: utilities.forms.fields.ChoiceField
|
||||||
options:
|
options:
|
||||||
members: false
|
members: false
|
||||||
|
|
||||||
::: utilities.forms.MultipleChoiceField
|
::: utilities.forms.fields.MultipleChoiceField
|
||||||
options:
|
options:
|
||||||
members: false
|
members: false
|
||||||
|
|
||||||
## Dynamic Object Fields
|
## Dynamic Object Fields
|
||||||
|
|
||||||
::: utilities.forms.DynamicModelChoiceField
|
::: utilities.forms.fields.DynamicModelChoiceField
|
||||||
options:
|
options:
|
||||||
members: false
|
members: false
|
||||||
|
|
||||||
::: utilities.forms.DynamicModelMultipleChoiceField
|
::: utilities.forms.fields.DynamicModelMultipleChoiceField
|
||||||
options:
|
options:
|
||||||
members: false
|
members: false
|
||||||
|
|
||||||
## Content Type Fields
|
## Content Type Fields
|
||||||
|
|
||||||
::: utilities.forms.ContentTypeChoiceField
|
::: utilities.forms.fields.ContentTypeChoiceField
|
||||||
options:
|
options:
|
||||||
members: false
|
members: false
|
||||||
|
|
||||||
::: utilities.forms.ContentTypeMultipleChoiceField
|
::: utilities.forms.fields.ContentTypeMultipleChoiceField
|
||||||
options:
|
options:
|
||||||
members: false
|
members: false
|
||||||
|
|
||||||
## CSV Import Fields
|
## CSV Import Fields
|
||||||
|
|
||||||
::: utilities.forms.CSVChoiceField
|
::: utilities.forms.fields.CSVChoiceField
|
||||||
options:
|
options:
|
||||||
members: false
|
members: false
|
||||||
|
|
||||||
::: utilities.forms.CSVMultipleChoiceField
|
::: utilities.forms.fields.CSVMultipleChoiceField
|
||||||
options:
|
options:
|
||||||
members: false
|
members: false
|
||||||
|
|
||||||
::: utilities.forms.CSVModelChoiceField
|
::: utilities.forms.fields.CSVModelChoiceField
|
||||||
options:
|
options:
|
||||||
members: false
|
members: false
|
||||||
|
|
||||||
::: utilities.forms.CSVContentTypeField
|
::: utilities.forms.fields.CSVContentTypeField
|
||||||
options:
|
options:
|
||||||
members: false
|
members: false
|
||||||
|
|
||||||
::: utilities.forms.CSVMultipleContentTypeField
|
::: utilities.forms.fields.CSVMultipleContentTypeField
|
||||||
options:
|
options:
|
||||||
members: false
|
members: false
|
||||||
|
@ -19,6 +19,9 @@ class MyModel(models.Model):
|
|||||||
|
|
||||||
Every model includes by default a numeric primary key. This value is generated automatically by the database, and can be referenced as `pk` or `id`.
|
Every model includes by default a numeric primary key. This value is generated automatically by the database, and can be referenced as `pk` or `id`.
|
||||||
|
|
||||||
|
!!! note
|
||||||
|
Model names should adhere to [PEP8](https://www.python.org/dev/peps/pep-0008/#class-names) standards and be CapWords (no underscores). Using underscores in model names will result in problems with permissions.
|
||||||
|
|
||||||
## Enabling NetBox Features
|
## Enabling NetBox Features
|
||||||
|
|
||||||
Plugin models can leverage certain NetBox features by inheriting from NetBox's `NetBoxModel` class. This class extends the plugin model to enable features unique to NetBox, including:
|
Plugin models can leverage certain NetBox features by inheriting from NetBox's `NetBoxModel` class. This class extends the plugin model to enable features unique to NetBox, including:
|
||||||
|
@ -2,9 +2,6 @@
|
|||||||
|
|
||||||
## Menus
|
## Menus
|
||||||
|
|
||||||
!!! note
|
|
||||||
This feature was introduced in NetBox v3.4.
|
|
||||||
|
|
||||||
A plugin can register its own submenu as part of NetBox's navigation menu. This is done by defining a variable named `menu` in `navigation.py`, pointing to an instance of the `PluginMenu` class. Each menu must define a label and grouped menu items (discussed below), and may optionally specify an icon. An example is shown below.
|
A plugin can register its own submenu as part of NetBox's navigation menu. This is done by defining a variable named `menu` in `navigation.py`, pointing to an instance of the `PluginMenu` class. Each menu must define a label and grouped menu items (discussed below), and may optionally specify an icon. An example is shown below.
|
||||||
|
|
||||||
```python title="navigation.py"
|
```python title="navigation.py"
|
||||||
|
@ -1,8 +1,5 @@
|
|||||||
# Search
|
# Search
|
||||||
|
|
||||||
!!! note
|
|
||||||
This feature was introduced in NetBox v3.4.
|
|
||||||
|
|
||||||
Plugins can define and register their own models to extend NetBox's core search functionality. Typically, a plugin will include a file named `search.py`, which holds all search indexes for its models (see the example below).
|
Plugins can define and register their own models to extend NetBox's core search functionality. Typically, a plugin will include a file named `search.py`, which holds all search indexes for its models (see the example below).
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
@ -3,9 +3,6 @@
|
|||||||
!!! danger "Experimental Feature"
|
!!! danger "Experimental Feature"
|
||||||
This feature is still under active development and considered experimental in nature. Its use in production is strongly discouraged at this time.
|
This feature is still under active development and considered experimental in nature. Its use in production is strongly discouraged at this time.
|
||||||
|
|
||||||
!!! note
|
|
||||||
This feature was introduced in NetBox v3.4.
|
|
||||||
|
|
||||||
NetBox provides a programmatic API to stage the creation, modification, and deletion of objects without actually committing those changes to the active database. This can be useful for performing a "dry run" of bulk operations, or preparing a set of changes for administrative approval, for example.
|
NetBox provides a programmatic API to stage the creation, modification, and deletion of objects without actually committing those changes to the active database. This can be useful for performing a "dry run" of bulk operations, or preparing a set of changes for administrative approval, for example.
|
||||||
|
|
||||||
To begin staging changes, first create a [branch](../../models/extras/branch.md):
|
To begin staging changes, first create a [branch](../../models/extras/branch.md):
|
||||||
|
@ -74,7 +74,6 @@ This template is used by the `ObjectView` generic view to display a single objec
|
|||||||
| `breadcrumbs` | - | Breadcrumb list items (HTML `<li>` elements) |
|
| `breadcrumbs` | - | Breadcrumb list items (HTML `<li>` elements) |
|
||||||
| `object_identifier` | - | A unique identifier (string) for the object |
|
| `object_identifier` | - | A unique identifier (string) for the object |
|
||||||
| `extra_controls` | - | Additional action buttons to display |
|
| `extra_controls` | - | Additional action buttons to display |
|
||||||
| `extra_tabs` | - | Additional tabs to include |
|
|
||||||
|
|
||||||
#### Context
|
#### Context
|
||||||
|
|
||||||
|
@ -157,9 +157,6 @@ These views are provided to enable or enhance certain NetBox model features, suc
|
|||||||
|
|
||||||
### Additional Tabs
|
### Additional Tabs
|
||||||
|
|
||||||
!!! note
|
|
||||||
This feature was introduced in NetBox v3.4.
|
|
||||||
|
|
||||||
Plugins can "attach" a custom view to a core NetBox model by registering it with `register_model_view()`. To include a tab for this view within the NetBox UI, declare a TabView instance named `tab`:
|
Plugins can "attach" a custom view to a core NetBox model by registering it with `register_model_view()`. To include a tab for this view within the NetBox UI, declare a TabView instance named `tab`:
|
||||||
|
|
||||||
```python
|
```python
|
||||||
|
@ -2,8 +2,6 @@
|
|||||||
|
|
||||||
Plugins are packaged [Django](https://docs.djangoproject.com/) apps that can be installed alongside NetBox to provide custom functionality not present in the core application. Plugins can introduce their own models and views, but cannot interfere with existing components. A NetBox user may opt to install plugins provided by the community or build his or her own.
|
Plugins are packaged [Django](https://docs.djangoproject.com/) apps that can be installed alongside NetBox to provide custom functionality not present in the core application. Plugins can introduce their own models and views, but cannot interfere with existing components. A NetBox user may opt to install plugins provided by the community or build his or her own.
|
||||||
|
|
||||||
Plugins are supported on NetBox v2.8 and later.
|
|
||||||
|
|
||||||
## Capabilities
|
## Capabilities
|
||||||
|
|
||||||
The NetBox plugin architecture allows for the following:
|
The NetBox plugin architecture allows for the following:
|
||||||
|
@ -10,6 +10,16 @@ Minor releases are published in April, August, and December of each calendar yea
|
|||||||
|
|
||||||
This page contains a history of all major and minor releases since NetBox v2.0. For more detail on a specific patch release, please see the release notes page for that specific minor release.
|
This page contains a history of all major and minor releases since NetBox v2.0. For more detail on a specific patch release, please see the release notes page for that specific minor release.
|
||||||
|
|
||||||
|
#### [Version 3.5](./version-3.5.md) (April 2023)
|
||||||
|
|
||||||
|
* Customizable Dashboard ([#9416](https://github.com/netbox-community/netbox/issues/9416))
|
||||||
|
* Remote Data Sources ([#11558](https://github.com/netbox-community/netbox/issues/11558))
|
||||||
|
* Configuration Template Rendering ([#11559](https://github.com/netbox-community/netbox/issues/11559))
|
||||||
|
* NAPALM Integration Plugin ([#10520](https://github.com/netbox-community/netbox/issues/10520))
|
||||||
|
* ASN Ranges ([#8550](https://github.com/netbox-community/netbox/issues/8550))
|
||||||
|
* Provider Accounts ([#9047](https://github.com/netbox-community/netbox/issues/9047))
|
||||||
|
* Job-Triggered Webhooks ([#8958](https://github.com/netbox-community/netbox/issues/8958))
|
||||||
|
|
||||||
#### [Version 3.4](./version-3.4.md) (December 2022)
|
#### [Version 3.4](./version-3.4.md) (December 2022)
|
||||||
|
|
||||||
* New Global Search ([#10560](https://github.com/netbox-community/netbox/issues/10560))
|
* New Global Search ([#10560](https://github.com/netbox-community/netbox/issues/10560))
|
||||||
|
@ -1,9 +1,32 @@
|
|||||||
# NetBox v3.4
|
# NetBox v3.4
|
||||||
|
|
||||||
## v3.4.9 (FUTURE)
|
## v3.4.10 (2023-04-27)
|
||||||
|
|
||||||
### Bug Fixes
|
### Bug Fixes
|
||||||
|
|
||||||
|
* [#11607](https://github.com/netbox-community/netbox/issues/11607) - Fix custom object field assignments made via REST API for for cables
|
||||||
|
* [#12252](https://github.com/netbox-community/netbox/issues/12252) - Fix ordering of search results when sorting by object name
|
||||||
|
* [#12355](https://github.com/netbox-community/netbox/issues/12355) - Fix escaping of certain characters in URL when rendering custom links
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## v3.4.9 (2023-04-26)
|
||||||
|
|
||||||
|
### Enhancements
|
||||||
|
|
||||||
|
* [#10987](https://github.com/netbox-community/netbox/issues/10987) - Show peer racks as a dropdown list under rack view
|
||||||
|
* [#11386](https://github.com/netbox-community/netbox/issues/11386) - Introduce `CSRF_COOKIE_SECURE`, `SECURE_SSL_REDIRECT`, and `SESSION_COOKIE_SECURE` configuration parameters
|
||||||
|
* [#11623](https://github.com/netbox-community/netbox/issues/11623) - Hide PSK strings under wireless LAN & link views
|
||||||
|
* [#12205](https://github.com/netbox-community/netbox/issues/12205) - Sanitize rendered custom links to mitigate malicious links
|
||||||
|
* [#12226](https://github.com/netbox-community/netbox/issues/12226) - Enable setting user name & email values via remote authenticate headers
|
||||||
|
* [#12337](https://github.com/netbox-community/netbox/issues/12337) - Enable anonymized reporting of census data
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* [#11383](https://github.com/netbox-community/netbox/issues/11383) - Fix ordering of global search results by object type
|
||||||
|
* [#11902](https://github.com/netbox-community/netbox/issues/11902) - Fix import of inventory items for devices with duplicated names
|
||||||
|
* [#12238](https://github.com/netbox-community/netbox/issues/12238) - Improve error message for API token IP prefix validation failures
|
||||||
|
* [#12255](https://github.com/netbox-community/netbox/issues/12255) - Restore the ability to move inventory items among devices
|
||||||
* [#12270](https://github.com/netbox-community/netbox/issues/12270) - Fix pre-population of list values when creating a saved filter
|
* [#12270](https://github.com/netbox-community/netbox/issues/12270) - Fix pre-population of list values when creating a saved filter
|
||||||
* [#12296](https://github.com/netbox-community/netbox/issues/12296) - Fix "mark connected" form field for bulk editing front & rear ports
|
* [#12296](https://github.com/netbox-community/netbox/issues/12296) - Fix "mark connected" form field for bulk editing front & rear ports
|
||||||
|
|
||||||
|
362
docs/release-notes/version-3.5.md
Normal file
362
docs/release-notes/version-3.5.md
Normal file
@ -0,0 +1,362 @@
|
|||||||
|
# NetBox v3.5
|
||||||
|
|
||||||
|
## v3.5.9 (FUTURE)
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## v3.5.8 (2023-08-15)
|
||||||
|
|
||||||
|
### Enhancements
|
||||||
|
|
||||||
|
* [#10030](https://github.com/netbox-community/netbox/issues/10030) - Ship a validation schema for the device type library with each release
|
||||||
|
* [#11675](https://github.com/netbox-community/netbox/issues/11675) - Add support for specifying import/export route targets during VRF bulk import
|
||||||
|
* [#11922](https://github.com/netbox-community/netbox/issues/11922) - Automatically populate any VDC assignments from the parent when adding a child interface via the UI
|
||||||
|
* [#12889](https://github.com/netbox-community/netbox/issues/12889) - Add 400GE CFP2 interface type
|
||||||
|
* [#13033](https://github.com/netbox-community/netbox/issues/13033) - Add human-friendly speed column to interfaces table
|
||||||
|
* [#13151](https://github.com/netbox-community/netbox/issues/13151) - Add "assigned" filter for IP addresses
|
||||||
|
* [#13368](https://github.com/netbox-community/netbox/issues/13368) - List installed plugins on the server error report page
|
||||||
|
* [#13442](https://github.com/netbox-community/netbox/issues/13442) - Add 200 and 400 Gbps speeds to dropdown choices on interface form
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* [#11578](https://github.com/netbox-community/netbox/issues/11578) - Fix schema definition for available IP & VLAN REST API endpoints
|
||||||
|
* [#12639](https://github.com/netbox-community/netbox/issues/12639) - Raise validation error for invalid alphanumeric ranges when creating objects
|
||||||
|
* [#12665](https://github.com/netbox-community/netbox/issues/12665) - Avoid escaping semicolons when rendering custom links
|
||||||
|
* [#12750](https://github.com/netbox-community/netbox/issues/12750) - Automatically delete an AutoSyncRecord when its object is deleted
|
||||||
|
* [#13343](https://github.com/netbox-community/netbox/issues/13343) - Fix filtering of circuits under provider network view
|
||||||
|
* [#13369](https://github.com/netbox-community/netbox/issues/13369) - Fix job termination status for failed reports
|
||||||
|
* [#13414](https://github.com/netbox-community/netbox/issues/13414) - Fix support for "hide-if-unset" custom fields on bulk import forms
|
||||||
|
* [#13446](https://github.com/netbox-community/netbox/issues/13446) - Don't disable bulk edit/delete buttons after deselecting "select all" checkbox
|
||||||
|
* [#13451](https://github.com/netbox-community/netbox/issues/13451) - Disable table ordering for custom link columns
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## v3.5.7 (2023-07-28)
|
||||||
|
|
||||||
|
### Enhancements
|
||||||
|
|
||||||
|
* [#11803](https://github.com/netbox-community/netbox/issues/11803) - Move non-rack devices list to a separate tab under the rack view
|
||||||
|
* [#12625](https://github.com/netbox-community/netbox/issues/12625) - Mask sensitive parameters when viewing a configured data source
|
||||||
|
* [#13009](https://github.com/netbox-community/netbox/issues/13009) - Add IEC 10609-1 and NBR 14136 power port & outlet types
|
||||||
|
* [#13097](https://github.com/netbox-community/netbox/issues/13097) - Implement a faster initial poll for report & script results
|
||||||
|
* [#13234](https://github.com/netbox-community/netbox/issues/13234) - Add 100GBASE-X-DSFP and 100GBASE-X-SFPDD interface types
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* [#13051](https://github.com/netbox-community/netbox/issues/13051) - Fix Markdown support for table cell alignment
|
||||||
|
* [#13167](https://github.com/netbox-community/netbox/issues/13167) - Fix missing script results when fetched via REST API
|
||||||
|
* [#13233](https://github.com/netbox-community/netbox/issues/13233) - Remove extraneous VLAN group field from bulk edit form for interfaces
|
||||||
|
* [#13237](https://github.com/netbox-community/netbox/issues/13237) - Permit unauthenticated access to content types REST API endpoint when `LOGIN_REQUIRED` is false
|
||||||
|
* [#13285](https://github.com/netbox-community/netbox/issues/13285) - Fix exception when importing device type missing rack unit height value
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## v3.5.6 (2023-07-10)
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* [#13061](https://github.com/netbox-community/netbox/issues/13061) - Fix display of last result for scripts & reports with a custom name defined
|
||||||
|
* [#13096](https://github.com/netbox-community/netbox/issues/13096) - Hide scheduling fields for all scripts with scheduling disabled
|
||||||
|
* [#13105](https://github.com/netbox-community/netbox/issues/13105) - Fix exception when attempting to allocate next available IP address from prefix marked as utilized
|
||||||
|
* [#13116](https://github.com/netbox-community/netbox/issues/13116) - Catch ProgrammingError exception when starting NetBox without pre-populated content types
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## v3.5.5 (2023-07-06)
|
||||||
|
|
||||||
|
### Enhancements
|
||||||
|
|
||||||
|
* [#11738](https://github.com/netbox-community/netbox/issues/11738) - Annotate VLAN group utilization
|
||||||
|
* [#12499](https://github.com/netbox-community/netbox/issues/12499) - Add "copy to clipboard" buttons in UI for IP addresses
|
||||||
|
* [#12945](https://github.com/netbox-community/netbox/issues/12945) - Add 100GE QSFP-DD interface type
|
||||||
|
* [#12955](https://github.com/netbox-community/netbox/issues/12955) - Include additional contact details on contact assignments table
|
||||||
|
* [#13065](https://github.com/netbox-community/netbox/issues/13065) - Associate contact assignments with their objects in the change log
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* [#11335](https://github.com/netbox-community/netbox/issues/11335) - Exclude stale content types when retrieving changelog records
|
||||||
|
* [#12533](https://github.com/netbox-community/netbox/issues/12533) - Fix REST API validation of null values for several interface attributes
|
||||||
|
* [#12579](https://github.com/netbox-community/netbox/issues/12579) - Fix exception when clicking "create and add another" to add a cable
|
||||||
|
* [#12617](https://github.com/netbox-community/netbox/issues/12617) - Populate prechange snapshot on parent object when assigning/removing primary IP address
|
||||||
|
* [#12760](https://github.com/netbox-community/netbox/issues/12760) - Avoid rendering partial HTMX responses when restoring browser tabs
|
||||||
|
* [#12842](https://github.com/netbox-community/netbox/issues/12842) - Improve handling of exceptions when loading reports
|
||||||
|
* [#12849](https://github.com/netbox-community/netbox/issues/12849) - Fix LDAP group permissions assignment for API clients
|
||||||
|
* [#12951](https://github.com/netbox-community/netbox/issues/12951) - Display consistent parent information for each termination under cable view
|
||||||
|
* [#12953](https://github.com/netbox-community/netbox/issues/12953) - Fix designation of primary IP addresses during interface assignment
|
||||||
|
* [#12960](https://github.com/netbox-community/netbox/issues/12960) - Fix OpenAPI schema for various choice fields
|
||||||
|
* [#12961](https://github.com/netbox-community/netbox/issues/12961) - Set correct return URL for object contacts tabs
|
||||||
|
* [#12966](https://github.com/netbox-community/netbox/issues/12966) - Avoid catching database exceptions when maintenance mode is disabled
|
||||||
|
* [#12975](https://github.com/netbox-community/netbox/issues/12975) - Correct URL for VirtualDeviceContext API serializer
|
||||||
|
* [#12977](https://github.com/netbox-community/netbox/issues/12977) - Fix URL parameters for object count dashboard widgets
|
||||||
|
* [#12983](https://github.com/netbox-community/netbox/issues/12983) - Avoid erroneously clearing many-to-many assignments during bulk edit
|
||||||
|
* [#12989](https://github.com/netbox-community/netbox/issues/12989) - Fix bulk import of tags for device & module types
|
||||||
|
* [#13011](https://github.com/netbox-community/netbox/issues/13011) - Do not escape commas when rendering custom links
|
||||||
|
* [#13047](https://github.com/netbox-community/netbox/issues/13047) - Correct ASN count under ASN ranges list
|
||||||
|
* [#13056](https://github.com/netbox-community/netbox/issues/13056) - Add `config_template` field to device API serializer
|
||||||
|
* [#13092](https://github.com/netbox-community/netbox/issues/13092) - Allow nullifying power port max & allocated draw values during bulk edit
|
||||||
|
* [#13100](https://github.com/netbox-community/netbox/issues/13100) - Fix ValueError exception when searching for virtual device context for non-numeric values
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## v3.5.4 (2023-06-20)
|
||||||
|
|
||||||
|
### Enhancements
|
||||||
|
|
||||||
|
* [#12828](https://github.com/netbox-community/netbox/issues/12828) - Define colors for staged change action choices
|
||||||
|
* [#12847](https://github.com/netbox-community/netbox/issues/12847) - Include "add" button on all device & virtual machine component list views
|
||||||
|
* [#12862](https://github.com/netbox-community/netbox/issues/12862) - Add menu navigation button to add wireless links directly
|
||||||
|
* [#12865](https://github.com/netbox-community/netbox/issues/12865) - Add "add" buttons for reports & scripts to navigation menu
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* [#12474](https://github.com/netbox-community/netbox/issues/12474) - Update cable terminations when assigning a location to a new site
|
||||||
|
* [#12622](https://github.com/netbox-community/netbox/issues/12622) - Permit the assignment of non-site VLANs to prefixes assigned to a site
|
||||||
|
* [#12682](https://github.com/netbox-community/netbox/issues/12682) - Correct OpenAPI schema for connected device API endpoint
|
||||||
|
* [#12687](https://github.com/netbox-community/netbox/issues/12687) - Allow the assignment of all /31 IP addresses to interfaces
|
||||||
|
* [#12818](https://github.com/netbox-community/netbox/issues/12818) - Fix permissions evaluation when queuing a data sync job
|
||||||
|
* [#12822](https://github.com/netbox-community/netbox/issues/12822) - Fix encoding of whitespace in custom link URLs
|
||||||
|
* [#12838](https://github.com/netbox-community/netbox/issues/12838) - Correct rounding of rack power utilization values
|
||||||
|
* [#12845](https://github.com/netbox-community/netbox/issues/12845) - Fix pagination of objects for related IP addresses table
|
||||||
|
* [#12850](https://github.com/netbox-community/netbox/issues/12850) - Fix table configuration modal for the contact assignments list
|
||||||
|
* [#12885](https://github.com/netbox-community/netbox/issues/12885) - Permit mounting of devices in rack unit 100
|
||||||
|
* [#12914](https://github.com/netbox-community/netbox/issues/12914) - Clear stored ordering from user config when cleared by request
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## v3.5.3 (2023-06-02)
|
||||||
|
|
||||||
|
### Enhancements
|
||||||
|
|
||||||
|
* [#9876](https://github.com/netbox-community/netbox/issues/9876) - Improve support for matching tags in conditional rules
|
||||||
|
* [#12015](https://github.com/netbox-community/netbox/issues/12015) - Add device type & role filters for device components
|
||||||
|
* [#12470](https://github.com/netbox-community/netbox/issues/12470) - Collapse context data by default when viewing a rendered device configuration
|
||||||
|
* [#12562](https://github.com/netbox-community/netbox/issues/12562) - Record client IP address when logging authentication failures
|
||||||
|
* [#12597](https://github.com/netbox-community/netbox/issues/12597) - Add an option to hide custom fields only if unset
|
||||||
|
* [#12599](https://github.com/netbox-community/netbox/issues/12599) - Apply filter parameters to links in object count dashboard widgets
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* [#7503](https://github.com/netbox-community/netbox/issues/7503) - Improve rack space validation when creating multiple devices via REST API
|
||||||
|
* [#11539](https://github.com/netbox-community/netbox/issues/11539) - Fix exception when applying "empty" filter lookup with invalid value
|
||||||
|
* [#11934](https://github.com/netbox-community/netbox/issues/11934) - Prevent reassignment of an IP address designated as primary for its parent object
|
||||||
|
* [#12538](https://github.com/netbox-community/netbox/issues/12538) - Redirect user to originating view after editing/deleting an image attachment
|
||||||
|
* [#12627](https://github.com/netbox-community/netbox/issues/12627) - Restore hover preview for embedded image attachment tables
|
||||||
|
* [#12694](https://github.com/netbox-community/netbox/issues/12694) - Strip leading & trailing whitespace from custom link URL & text
|
||||||
|
* [#12702](https://github.com/netbox-community/netbox/issues/12702) - Fix sizing of rear port selection widget on front port template creation form
|
||||||
|
* [#12715](https://github.com/netbox-community/netbox/issues/12715) - Use contact assignments table to display the contacts assigned to an object
|
||||||
|
* [#12730](https://github.com/netbox-community/netbox/issues/12730) - Fix extraneous contacts listed in object contact assignments view
|
||||||
|
* [#12742](https://github.com/netbox-community/netbox/issues/12742) - Object counts dashboard widget should support URL-compatible query filters
|
||||||
|
* [#12762](https://github.com/netbox-community/netbox/issues/12762) - Fix GraphiQL UI by reverting graphene-django to earlier version
|
||||||
|
* [#12745](https://github.com/netbox-community/netbox/issues/12745) - Escape display text in API-backed selection widgets
|
||||||
|
* [#12779](https://github.com/netbox-community/netbox/issues/12779) - Correct arithmetic for converting inches to meters
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## v3.5.2 (2023-05-22)
|
||||||
|
|
||||||
|
### Enhancements
|
||||||
|
|
||||||
|
* [#7671](https://github.com/netbox-community/netbox/issues/7671) - Introduce `REMOTE_AUTH_AUTO_CREATE_GROUPS` config parameter to enable the automatic creation of new groups when remote authentication is in use
|
||||||
|
* [#9068](https://github.com/netbox-community/netbox/issues/9068) - Disallow the assignment of network/broadcast IP addresses to interfaces
|
||||||
|
* [#11017](https://github.com/netbox-community/netbox/issues/11017) - Increase the maximum values for allocated and maximum power draws
|
||||||
|
* [#11233](https://github.com/netbox-community/netbox/issues/11233) - Intercept and cleanly report errors upon attempted database writes when maintenance mode is enabled
|
||||||
|
* [#11599](https://github.com/netbox-community/netbox/issues/11599) - Move contacts panels to separate tabs under object views
|
||||||
|
* [#11670](https://github.com/netbox-community/netbox/issues/11670) - Enable setting device type & module type weight via bulk import
|
||||||
|
* [#11900](https://github.com/netbox-community/netbox/issues/11900) - Add an outline to the reservation markers on rack elevations
|
||||||
|
* [#12131](https://github.com/netbox-community/netbox/issues/12131) - Show custom field description as an icon tooltip under object views
|
||||||
|
* [#12223](https://github.com/netbox-community/netbox/issues/12223) - Add columns for parent device bay and position to devices list
|
||||||
|
* [#12233](https://github.com/netbox-community/netbox/issues/12233) - Move related IP addresses table to a separate tab
|
||||||
|
* [#12286](https://github.com/netbox-community/netbox/issues/12286) - Show height and total weight under device view
|
||||||
|
* [#12323](https://github.com/netbox-community/netbox/issues/12323) - Add 100GE CXP interface type
|
||||||
|
* [#12327](https://github.com/netbox-community/netbox/issues/12327) - Introduce the ability to automatically retry failed background jobs
|
||||||
|
* [#12498](https://github.com/netbox-community/netbox/issues/12498) - Hide map button if `MAPS_URL` is empty
|
||||||
|
* [#12548](https://github.com/netbox-community/netbox/issues/12548) - Optimize REST API performance when retrieving interfaces with L2VPN assignments
|
||||||
|
* [#12554](https://github.com/netbox-community/netbox/issues/12554) - Allow customization or disabling of the maintenance mode banner
|
||||||
|
* [#12605](https://github.com/netbox-community/netbox/issues/12605) - Add LX.5 port types
|
||||||
|
* [#12629](https://github.com/netbox-community/netbox/issues/12629) - Add 400GE CDFP and CFP8 interface types
|
||||||
|
* [#12678](https://github.com/netbox-community/netbox/issues/12678) - Add 200GE QSFP-DD interface type
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* [#10686](https://github.com/netbox-community/netbox/issues/10686) - Enable specifying termination object by virtual chassis master when importing cables
|
||||||
|
* [#11619](https://github.com/netbox-community/netbox/issues/11619) - Enable assigning VLANs without a site to interfaces during bulk edit
|
||||||
|
* [#12468](https://github.com/netbox-community/netbox/issues/12468) - Custom field names should not permit double underscores
|
||||||
|
* [#12550](https://github.com/netbox-community/netbox/issues/12550) - Fix rear port selection widget under front port creation form
|
||||||
|
* [#12570](https://github.com/netbox-community/netbox/issues/12570) - Disable ordering of synchronized object tables by the "synced" attribute
|
||||||
|
* [#12594](https://github.com/netbox-community/netbox/issues/12594) - Enable selecting config context as object type in object counts dashboard widget
|
||||||
|
* [#12642](https://github.com/netbox-community/netbox/issues/12642) - Fix bulk tenant assignment via cluster import form
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## v3.5.1 (2023-05-05)
|
||||||
|
|
||||||
|
### Enhancements
|
||||||
|
|
||||||
|
* [#10759](https://github.com/netbox-community/netbox/issues/10759) - Support Markdown rendering for custom field descriptions
|
||||||
|
* [#11190](https://github.com/netbox-community/netbox/issues/11190) - Including systemd service & timer configurations for housekeeping tasks
|
||||||
|
* [#11422](https://github.com/netbox-community/netbox/issues/11422) - Match on power panel name when searching for power feeds
|
||||||
|
* [#11504](https://github.com/netbox-community/netbox/issues/11504) - Add filter to select individual racks under rack elevations view
|
||||||
|
* [#11652](https://github.com/netbox-community/netbox/issues/11652) - Add a module status column to module bay tables
|
||||||
|
* [#11791](https://github.com/netbox-community/netbox/issues/11791) - Enable configuration of custom database backend via `ENGINE` parameter
|
||||||
|
* [#11801](https://github.com/netbox-community/netbox/issues/11801) - Include device description within rack elevation tooltip
|
||||||
|
* [#11932](https://github.com/netbox-community/netbox/issues/11932) - Introduce a list view for image attachments, orderable by date and other attributes
|
||||||
|
* [#12122](https://github.com/netbox-community/netbox/issues/12122) - Enable bulk import oj journal entries
|
||||||
|
* [#12245](https://github.com/netbox-community/netbox/issues/12245) - Enable the assignment of wireless LANs to interfaces under bulk edit
|
||||||
|
|
||||||
|
### Bug Fixes
|
||||||
|
|
||||||
|
* [#10757](https://github.com/netbox-community/netbox/issues/10757) - Simplify IP address interface and NAT IP assignment form fields to avoid confusion
|
||||||
|
* [#11715](https://github.com/netbox-community/netbox/issues/11715) - Prefix within a VRF should list global prefixes as parents only if they are containers
|
||||||
|
* [#12363](https://github.com/netbox-community/netbox/issues/12363) - Fix whitespace for paragraph elements in Markdown-rendered table columns
|
||||||
|
* [#12367](https://github.com/netbox-community/netbox/issues/12367) - Fix `RelatedObjectDoesNotExist` exception under certain conditions (regression from #11550)
|
||||||
|
* [#12380](https://github.com/netbox-community/netbox/issues/12380) - Allow selecting object change as model under object list widget configuration
|
||||||
|
* [#12384](https://github.com/netbox-community/netbox/issues/12384) - Add a three-second timeout for RSS reader widget
|
||||||
|
* [#12395](https://github.com/netbox-community/netbox/issues/12395) - Fix "create & add another" action for objects with custom fields
|
||||||
|
* [#12396](https://github.com/netbox-community/netbox/issues/12396) - Provider account should not be a required field in REST API serializer
|
||||||
|
* [#12400](https://github.com/netbox-community/netbox/issues/12400) - Validate default values for object and multi-object custom fields
|
||||||
|
* [#12401](https://github.com/netbox-community/netbox/issues/12401) - Support the creation of front ports without a pre-populated device ID
|
||||||
|
* [#12405](https://github.com/netbox-community/netbox/issues/12405) - Fix filtering for VLAN groups displayed under site view
|
||||||
|
* [#12410](https://github.com/netbox-community/netbox/issues/12410) - Fix base path for OpenAPI schema (fixes Swagger UI requests)
|
||||||
|
* [#12416](https://github.com/netbox-community/netbox/issues/12416) - Fix `FileNotFoundError` exception when a managed script file is missing from disk
|
||||||
|
* [#12412](https://github.com/netbox-community/netbox/issues/12412) - Device/VM interface MAC addresses can be nullified via REST API
|
||||||
|
* [#12415](https://github.com/netbox-community/netbox/issues/12415) - Fix `ImportError` exception when running RQ worker
|
||||||
|
* [#12433](https://github.com/netbox-community/netbox/issues/12433) - Correct the application of URL query parameters for object list dashboard widgets
|
||||||
|
* [#12436](https://github.com/netbox-community/netbox/issues/12436) - Remove extraneous "add" button from contact assignments list
|
||||||
|
* [#12463](https://github.com/netbox-community/netbox/issues/12463) - Fix the association of completed jobs with reports & scripts in the REST API
|
||||||
|
* [#12464](https://github.com/netbox-community/netbox/issues/12464) - Apply credentials for git data source only when connecting via HTTP/S
|
||||||
|
* [#12476](https://github.com/netbox-community/netbox/issues/12476) - Fix `TypeError` exception when running the `runscript` management command
|
||||||
|
* [#12483](https://github.com/netbox-community/netbox/issues/12483) - Fix git remote data syncing when with HTTP proxies defined
|
||||||
|
* [#12496](https://github.com/netbox-community/netbox/issues/12496) - Remove obsolete account field from provider UI view
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## v3.5.0 (2023-04-27)
|
||||||
|
|
||||||
|
### Breaking Changes
|
||||||
|
|
||||||
|
* The `account` field has been removed from the provider model. This information is now tracked using the new provider account model. Multiple accounts can be assigned per provider.
|
||||||
|
* A minimum length of 50 characters is now enforced for the `SECRET_KEY` configuration parameter.
|
||||||
|
* The JobResult model has been moved from the `extras` app to `core` and renamed to Job. Accordingly, its REST API endpoint has been moved from `/api/extras/job-results/` to `/api/core/jobs/`.
|
||||||
|
* The `obj_type` field on the Job model (previously JobResult) has been renamed to `object_type` for consistency with other models.
|
||||||
|
* The `JOBRESULT_RETENTION` configuration parameter has been renamed to `JOB_RETENTION`.
|
||||||
|
* The `obj` context variable is no longer passed when rendering custom links: Use `object` instead.
|
||||||
|
* The REST API schema is now generated using the OpenAPI 3.0 spec
|
||||||
|
* The URLs for the REST API schema documentation have changed:
|
||||||
|
* `/api/docs/` is now `/api/schema/swagger-ui/`
|
||||||
|
* `/api/redoc/` is now `/api/schema/redoc/`
|
||||||
|
|
||||||
|
### New Features
|
||||||
|
|
||||||
|
#### Customizable Dashboard ([#9416](https://github.com/netbox-community/netbox/issues/9416))
|
||||||
|
|
||||||
|
The static home view has been replaced with a fully customizable dashboard. Users can construct and rearrange their own personal dashboard to convey the information most pertinent to them. Supported widgets include object statistics, configurable object lists, RSS feeds, and notes, and we expect to continue adding new widgets over time.
|
||||||
|
|
||||||
|
#### Remote Data Sources ([#11558](https://github.com/netbox-community/netbox/issues/11558))
|
||||||
|
|
||||||
|
NetBox now has the ability to synchronize arbitrary data from external sources through the new [DataSource](../models/core/datasource.md) and [DataFile](../models/core/datafile.md) models. Synchronized files are stored in the PostgreSQL database, and may be referenced and consumed by other NetBox models, such as export templates and config contexts. Currently, replication from local filesystem paths, git repositories, and Amazon S3 buckets is supported, and we expect to introduce additional backends in the near future.
|
||||||
|
|
||||||
|
#### Configuration Template Rendering ([#11559](https://github.com/netbox-community/netbox/issues/11559))
|
||||||
|
|
||||||
|
This release introduces the ability to render device configurations from Jinja2 templates natively within NetBox, via both the UI and REST API. The new [ConfigTemplate](../models/extras/configtemplate.md) model stores template code (which may be defined locally or sourced from remote data files). The rendering engine passes data gleaned from both config contexts and request parameters to generate complete configurations suitable for direct application to network devices.
|
||||||
|
|
||||||
|
#### NAPALM Integration Plugin ([#10520](https://github.com/netbox-community/netbox/issues/10520))
|
||||||
|
|
||||||
|
The NAPALM integration feature found in previous NetBox releases has been moved from the core application to a [dedicated plugin](https://github.com/netbox-community/netbox-napalm). This allows greater control over the feature's configuration and will unlock additional potential as a separate project.
|
||||||
|
|
||||||
|
#### ASN Ranges ([#8550](https://github.com/netbox-community/netbox/issues/8550))
|
||||||
|
|
||||||
|
A new ASN range model has been introduced to facilitate the provisioning of new autonomous system numbers from within a prescribed range. For example, an administrator might define an ASN range of 65000-65099 to be used for internal site identification. This includes a REST API endpoint suitable for automatic provisioning, very similar to the allocation of available prefixes and IP addresses.
|
||||||
|
|
||||||
|
#### Provider Accounts ([#9047](https://github.com/netbox-community/netbox/issues/9047))
|
||||||
|
|
||||||
|
A new model has been introduced to represent individual accounts within a common circuit provider. This replaces the `account` field on the provider model, enabling users to track multiple accounts per provider. New provider account instances will be created automatically during upgrade for all providers which currently have an account assigned. The assignment of individual circuits to a provider account remains optional.
|
||||||
|
|
||||||
|
#### Job-Triggered Webhooks ([#8958](https://github.com/netbox-community/netbox/issues/8958))
|
||||||
|
|
||||||
|
Two new webhook trigger events have been introduced: `job_start` and `job_end`. These enable users to configure webhook to trigger when a background job starts or ends, respectively. This new functionality can be used, for example, to inform a remote system when a custom script has been executed.
|
||||||
|
|
||||||
|
### Enhancements
|
||||||
|
|
||||||
|
* [#7947](https://github.com/netbox-community/netbox/issues/7947) - Enable marking IP ranges as fully utilized
|
||||||
|
* [#8184](https://github.com/netbox-community/netbox/issues/8184) - Employ HTMX to dynamically render tables listing related objects
|
||||||
|
* [#8272](https://github.com/netbox-community/netbox/issues/8272) - Support bridge relationships among device type interfaces
|
||||||
|
* [#8749](https://github.com/netbox-community/netbox/issues/8749) - Support replicating custom field values when cloning an object
|
||||||
|
* [#9073](https://github.com/netbox-community/netbox/issues/9073) - Enable syncing config context data from remote sources
|
||||||
|
* [#9653](https://github.com/netbox-community/netbox/issues/9653) - Enable setting a default platform for device types
|
||||||
|
* [#10054](https://github.com/netbox-community/netbox/issues/10054) - Introduce advanced object selector for UI forms
|
||||||
|
* [#10242](https://github.com/netbox-community/netbox/issues/10242) - Redirect to filtered objects list after bulk import
|
||||||
|
* [#10374](https://github.com/netbox-community/netbox/issues/10374) - Require unique tenant names & slugs per group
|
||||||
|
* [#10729](https://github.com/netbox-community/netbox/issues/10729) - Add date & time custom field type
|
||||||
|
* [#11029](https://github.com/netbox-community/netbox/issues/11029) - Enable change logging for cable terminations
|
||||||
|
* [#11254](https://github.com/netbox-community/netbox/issues/11254) - Introduce the `X-Request-ID` HTTP header to annotate the unique ID of each request for change logging
|
||||||
|
* [#11255](https://github.com/netbox-community/netbox/issues/11255) - Introduce the `scheduling_enabled` settings for reports & scripts
|
||||||
|
* [#11291](https://github.com/netbox-community/netbox/issues/11291) - Optimized GraphQL API request handling
|
||||||
|
* [#11440](https://github.com/netbox-community/netbox/issues/11440) - Add an `enabled` field for device type interfaces
|
||||||
|
* [#11494](https://github.com/netbox-community/netbox/issues/11494) - Enable filtering objects by create/update request IDs
|
||||||
|
* [#11517](https://github.com/netbox-community/netbox/issues/11517) - Standardize the inclusion of related objects across the entire UI
|
||||||
|
* [#11584](https://github.com/netbox-community/netbox/issues/11584) - Add a list view for contact assignments
|
||||||
|
* [#11625](https://github.com/netbox-community/netbox/issues/11625) - Add HTMX support to ObjectEditView
|
||||||
|
* [#11693](https://github.com/netbox-community/netbox/issues/11693) - Enable syncing export template content from remote sources
|
||||||
|
* [#11780](https://github.com/netbox-community/netbox/issues/11780) - Enable loading import data from remote sources
|
||||||
|
* [#11790](https://github.com/netbox-community/netbox/issues/11790) - Create database indexes for all generic foreign keys
|
||||||
|
* [#11968](https://github.com/netbox-community/netbox/issues/11968) - Add navigation menu buttons to create device & VM components
|
||||||
|
* [#12068](https://github.com/netbox-community/netbox/issues/12068) - Enable generic foreign key relationships from jobs to NetBox objects
|
||||||
|
* [#12085](https://github.com/netbox-community/netbox/issues/12085) - Add a file source view for reports
|
||||||
|
* [#12218](https://github.com/netbox-community/netbox/issues/12218) - Provide more relevant API endpoint descriptions in schema
|
||||||
|
* [#12343](https://github.com/netbox-community/netbox/issues/12343) - Enforce a minimum length for `SECRET_KEY` configuration parameter
|
||||||
|
|
||||||
|
### Bug Fixes (From Beta2)
|
||||||
|
|
||||||
|
* [#12149](https://github.com/netbox-community/netbox/issues/12149) - Fix OpenAPI schema warnings relating to enum collisions
|
||||||
|
* [#12195](https://github.com/netbox-community/netbox/issues/12195) - Fix exception when setting IP address role to null via REST API
|
||||||
|
* [#12256](https://github.com/netbox-community/netbox/issues/12256) - Fix OpenAPI schema warnings relating to nested serializers
|
||||||
|
* [#12278](https://github.com/netbox-community/netbox/issues/12278) - Fix schema warnings related to IPAddressField
|
||||||
|
* [#12288](https://github.com/netbox-community/netbox/issues/12288) - Include `servers` definition in OpenAPI spec
|
||||||
|
* [#12299](https://github.com/netbox-community/netbox/issues/12299) - Fix object list widget support for filtering by multiple values
|
||||||
|
|
||||||
|
### Other Changes
|
||||||
|
|
||||||
|
* [#9608](https://github.com/netbox-community/netbox/issues/9608) - Upgrade REST API schema to OpenAPI 3.0
|
||||||
|
* [#10604](https://github.com/netbox-community/netbox/issues/10604) - Remove unused `extra_tabs` block from `object.html` generic template
|
||||||
|
* [#10923](https://github.com/netbox-community/netbox/issues/10923) - Remove unused `NetBoxModelCSVForm` class (replaced by `NetBoxModelImportForm`)
|
||||||
|
* [#11489](https://github.com/netbox-community/netbox/issues/11489) - Consolidated several middleware classes
|
||||||
|
* [#11611](https://github.com/netbox-community/netbox/issues/11611) - Refactor API viewset classes and introduce NetBoxReadOnlyModelViewSet
|
||||||
|
* [#11694](https://github.com/netbox-community/netbox/issues/11694) - Remove obsolete `SmallTextarea` form widget
|
||||||
|
* [#11737](https://github.com/netbox-community/netbox/issues/11737) - `ChangeLoggedModel` now inherits `WebhooksMixin`
|
||||||
|
* [#11765](https://github.com/netbox-community/netbox/issues/11765) - Retire the `StaticSelect` and `StaticSelectMultiple` form widgets
|
||||||
|
* [#11955](https://github.com/netbox-community/netbox/issues/11955) - Remove the unused `CSVDataField` and `CSVFileField` classes
|
||||||
|
* [#12067](https://github.com/netbox-community/netbox/issues/12067) - Move & rename `extras.JobResult` to `core.Job`
|
||||||
|
|
||||||
|
### REST API Changes
|
||||||
|
|
||||||
|
* All API responses now include a `X-Request-ID` HTTP header indicating the request's unique ID
|
||||||
|
* Introduced new endpoints:
|
||||||
|
* `/api/circuits/provider-accounts/`
|
||||||
|
* `/api/core/data-files/`
|
||||||
|
* `/api/core/data-sources/`
|
||||||
|
* `/api/dcim/device/<id>/render-config/`
|
||||||
|
* `/api/extras/config-templates/`
|
||||||
|
* `/api/ipam/asn-ranges/`
|
||||||
|
* Removed existing endpoints:
|
||||||
|
* `/api/dcim/device/<id>/napalm/`
|
||||||
|
* circuits.Circuit
|
||||||
|
* Added the optional `account` foreign key to ProviderAccount
|
||||||
|
* circuits.Provider
|
||||||
|
* Removed the `account` field
|
||||||
|
* dcim.CableTermination
|
||||||
|
* Added `default_platform` foreign key (optional)
|
||||||
|
* dcim.DeviceType
|
||||||
|
* Added `default_platform` foreign key (optional)
|
||||||
|
* dcim.InterfaceTemplate
|
||||||
|
* Added `enabled` boolean field
|
||||||
|
* Added optional `bridge` foreign key (optional)
|
||||||
|
* extras.ConfigContext
|
||||||
|
* Added `data_source`, `data_file`, `data_path`, and `data_synced` fields to enable syncing data from remote sources
|
||||||
|
* extras.ExportTemplate
|
||||||
|
* Added `data_source`, `data_file`, `data_path`, and `data_synced` fields to enable syncing content from remote sources
|
||||||
|
* extras.Webhook
|
||||||
|
* Added `type_job_start` and `type_job_end` boolean fields
|
||||||
|
* ipam.ASN
|
||||||
|
* The `rir` field now fully represents the assigned RIR (if any)
|
||||||
|
* ipam.IPRange
|
||||||
|
* Added the `mark_utilized` boolean field (default: false)
|
15
mkdocs.yml
15
mkdocs.yml
@ -78,8 +78,11 @@ nav:
|
|||||||
- Contacts: 'features/contacts.md'
|
- Contacts: 'features/contacts.md'
|
||||||
- Search: 'features/search.md'
|
- Search: 'features/search.md'
|
||||||
- Context Data: 'features/context-data.md'
|
- Context Data: 'features/context-data.md'
|
||||||
|
- Configuration Rendering: 'features/configuration-rendering.md'
|
||||||
|
- Synchronized Data: 'features/synchronized-data.md'
|
||||||
- Change Logging: 'features/change-logging.md'
|
- Change Logging: 'features/change-logging.md'
|
||||||
- Journaling: 'features/journaling.md'
|
- Journaling: 'features/journaling.md'
|
||||||
|
- Background Jobs: 'features/background-jobs.md'
|
||||||
- Auth & Permissions: 'features/authentication-permissions.md'
|
- Auth & Permissions: 'features/authentication-permissions.md'
|
||||||
- API & Integration: 'features/api-integration.md'
|
- API & Integration: 'features/api-integration.md'
|
||||||
- Customization: 'features/customization.md'
|
- Customization: 'features/customization.md'
|
||||||
@ -105,7 +108,6 @@ nav:
|
|||||||
- Default Values: 'configuration/default-values.md'
|
- Default Values: 'configuration/default-values.md'
|
||||||
- Error Reporting: 'configuration/error-reporting.md'
|
- Error Reporting: 'configuration/error-reporting.md'
|
||||||
- Plugins: 'configuration/plugins.md'
|
- Plugins: 'configuration/plugins.md'
|
||||||
- NAPALM: 'configuration/napalm.md'
|
|
||||||
- Date & Time: 'configuration/date-time.md'
|
- Date & Time: 'configuration/date-time.md'
|
||||||
- Miscellaneous: 'configuration/miscellaneous.md'
|
- Miscellaneous: 'configuration/miscellaneous.md'
|
||||||
- Development: 'configuration/development.md'
|
- Development: 'configuration/development.md'
|
||||||
@ -120,7 +122,7 @@ nav:
|
|||||||
- REST API: 'integrations/rest-api.md'
|
- REST API: 'integrations/rest-api.md'
|
||||||
- GraphQL API: 'integrations/graphql-api.md'
|
- GraphQL API: 'integrations/graphql-api.md'
|
||||||
- Webhooks: 'integrations/webhooks.md'
|
- Webhooks: 'integrations/webhooks.md'
|
||||||
- NAPALM: 'integrations/napalm.md'
|
- Synchronized Data: 'integrations/synchronized-data.md'
|
||||||
- Prometheus Metrics: 'integrations/prometheus-metrics.md'
|
- Prometheus Metrics: 'integrations/prometheus-metrics.md'
|
||||||
- Plugins:
|
- Plugins:
|
||||||
- Using Plugins: 'plugins/index.md'
|
- Using Plugins: 'plugins/index.md'
|
||||||
@ -137,6 +139,7 @@ nav:
|
|||||||
- REST API: 'plugins/development/rest-api.md'
|
- REST API: 'plugins/development/rest-api.md'
|
||||||
- GraphQL API: 'plugins/development/graphql-api.md'
|
- GraphQL API: 'plugins/development/graphql-api.md'
|
||||||
- Background Tasks: 'plugins/development/background-tasks.md'
|
- Background Tasks: 'plugins/development/background-tasks.md'
|
||||||
|
- Dashboard Widgets: 'plugins/development/dashboard-widgets.md'
|
||||||
- Staged Changes: 'plugins/development/staged-changes.md'
|
- Staged Changes: 'plugins/development/staged-changes.md'
|
||||||
- Exceptions: 'plugins/development/exceptions.md'
|
- Exceptions: 'plugins/development/exceptions.md'
|
||||||
- Administration:
|
- Administration:
|
||||||
@ -155,7 +158,12 @@ nav:
|
|||||||
- Circuit Termination: 'models/circuits/circuittermination.md'
|
- Circuit Termination: 'models/circuits/circuittermination.md'
|
||||||
- Circuit Type: 'models/circuits/circuittype.md'
|
- Circuit Type: 'models/circuits/circuittype.md'
|
||||||
- Provider: 'models/circuits/provider.md'
|
- Provider: 'models/circuits/provider.md'
|
||||||
|
- Provider Account: 'models/circuits/provideraccount.md'
|
||||||
- Provider Network: 'models/circuits/providernetwork.md'
|
- Provider Network: 'models/circuits/providernetwork.md'
|
||||||
|
- Core:
|
||||||
|
- DataFile: 'models/core/datafile.md'
|
||||||
|
- DataSource: 'models/core/datasource.md'
|
||||||
|
- Job: 'models/core/job.md'
|
||||||
- DCIM:
|
- DCIM:
|
||||||
- Cable: 'models/dcim/cable.md'
|
- Cable: 'models/dcim/cable.md'
|
||||||
- ConsolePort: 'models/dcim/consoleport.md'
|
- ConsolePort: 'models/dcim/consoleport.md'
|
||||||
@ -200,6 +208,7 @@ nav:
|
|||||||
- Extras:
|
- Extras:
|
||||||
- Branch: 'models/extras/branch.md'
|
- Branch: 'models/extras/branch.md'
|
||||||
- ConfigContext: 'models/extras/configcontext.md'
|
- ConfigContext: 'models/extras/configcontext.md'
|
||||||
|
- ConfigTemplate: 'models/extras/configtemplate.md'
|
||||||
- CustomField: 'models/extras/customfield.md'
|
- CustomField: 'models/extras/customfield.md'
|
||||||
- CustomLink: 'models/extras/customlink.md'
|
- CustomLink: 'models/extras/customlink.md'
|
||||||
- ExportTemplate: 'models/extras/exporttemplate.md'
|
- ExportTemplate: 'models/extras/exporttemplate.md'
|
||||||
@ -211,6 +220,7 @@ nav:
|
|||||||
- Webhook: 'models/extras/webhook.md'
|
- Webhook: 'models/extras/webhook.md'
|
||||||
- IPAM:
|
- IPAM:
|
||||||
- ASN: 'models/ipam/asn.md'
|
- ASN: 'models/ipam/asn.md'
|
||||||
|
- ASNRange: 'models/ipam/asnrange.md'
|
||||||
- Aggregate: 'models/ipam/aggregate.md'
|
- Aggregate: 'models/ipam/aggregate.md'
|
||||||
- FHRPGroup: 'models/ipam/fhrpgroup.md'
|
- FHRPGroup: 'models/ipam/fhrpgroup.md'
|
||||||
- FHRPGroupAssignment: 'models/ipam/fhrpgroupassignment.md'
|
- FHRPGroupAssignment: 'models/ipam/fhrpgroupassignment.md'
|
||||||
@ -263,6 +273,7 @@ nav:
|
|||||||
- git Cheat Sheet: 'development/git-cheat-sheet.md'
|
- git Cheat Sheet: 'development/git-cheat-sheet.md'
|
||||||
- Release Notes:
|
- Release Notes:
|
||||||
- Summary: 'release-notes/index.md'
|
- Summary: 'release-notes/index.md'
|
||||||
|
- Version 3.5: 'release-notes/version-3.5.md'
|
||||||
- Version 3.4: 'release-notes/version-3.4.md'
|
- Version 3.4: 'release-notes/version-3.4.md'
|
||||||
- Version 3.3: 'release-notes/version-3.3.md'
|
- Version 3.3: 'release-notes/version-3.3.md'
|
||||||
- Version 3.2: 'release-notes/version-3.2.md'
|
- Version 3.2: 'release-notes/version-3.2.md'
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
from drf_spectacular.utils import extend_schema_field, extend_schema_serializer
|
||||||
|
from drf_spectacular.types import OpenApiTypes
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
|
|
||||||
from circuits.models import *
|
from circuits.models import *
|
||||||
@ -9,6 +11,7 @@ __all__ = [
|
|||||||
'NestedCircuitTypeSerializer',
|
'NestedCircuitTypeSerializer',
|
||||||
'NestedProviderNetworkSerializer',
|
'NestedProviderNetworkSerializer',
|
||||||
'NestedProviderSerializer',
|
'NestedProviderSerializer',
|
||||||
|
'NestedProviderAccountSerializer',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@ -28,6 +31,9 @@ class NestedProviderNetworkSerializer(WritableNestedSerializer):
|
|||||||
# Providers
|
# Providers
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@extend_schema_serializer(
|
||||||
|
exclude_fields=('circuit_count',),
|
||||||
|
)
|
||||||
class NestedProviderSerializer(WritableNestedSerializer):
|
class NestedProviderSerializer(WritableNestedSerializer):
|
||||||
url = serializers.HyperlinkedIdentityField(view_name='circuits-api:provider-detail')
|
url = serializers.HyperlinkedIdentityField(view_name='circuits-api:provider-detail')
|
||||||
circuit_count = serializers.IntegerField(read_only=True)
|
circuit_count = serializers.IntegerField(read_only=True)
|
||||||
@ -37,10 +43,25 @@ class NestedProviderSerializer(WritableNestedSerializer):
|
|||||||
fields = ['id', 'url', 'display', 'name', 'slug', 'circuit_count']
|
fields = ['id', 'url', 'display', 'name', 'slug', 'circuit_count']
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Provider Accounts
|
||||||
|
#
|
||||||
|
|
||||||
|
class NestedProviderAccountSerializer(WritableNestedSerializer):
|
||||||
|
url = serializers.HyperlinkedIdentityField(view_name='circuits-api:provideraccount-detail')
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = ProviderAccount
|
||||||
|
fields = ['id', 'url', 'display', 'name', 'account']
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Circuits
|
# Circuits
|
||||||
#
|
#
|
||||||
|
|
||||||
|
@extend_schema_serializer(
|
||||||
|
exclude_fields=('circuit_count',),
|
||||||
|
)
|
||||||
class NestedCircuitTypeSerializer(WritableNestedSerializer):
|
class NestedCircuitTypeSerializer(WritableNestedSerializer):
|
||||||
url = serializers.HyperlinkedIdentityField(view_name='circuits-api:circuittype-detail')
|
url = serializers.HyperlinkedIdentityField(view_name='circuits-api:circuittype-detail')
|
||||||
circuit_count = serializers.IntegerField(read_only=True)
|
circuit_count = serializers.IntegerField(read_only=True)
|
||||||
|
@ -18,6 +18,12 @@ from .nested_serializers import *
|
|||||||
|
|
||||||
class ProviderSerializer(NetBoxModelSerializer):
|
class ProviderSerializer(NetBoxModelSerializer):
|
||||||
url = serializers.HyperlinkedIdentityField(view_name='circuits-api:provider-detail')
|
url = serializers.HyperlinkedIdentityField(view_name='circuits-api:provider-detail')
|
||||||
|
accounts = SerializedPKRelatedField(
|
||||||
|
queryset=ProviderAccount.objects.all(),
|
||||||
|
serializer=NestedProviderAccountSerializer,
|
||||||
|
required=False,
|
||||||
|
many=True
|
||||||
|
)
|
||||||
asns = SerializedPKRelatedField(
|
asns = SerializedPKRelatedField(
|
||||||
queryset=ASN.objects.all(),
|
queryset=ASN.objects.all(),
|
||||||
serializer=NestedASNSerializer,
|
serializer=NestedASNSerializer,
|
||||||
@ -31,11 +37,27 @@ class ProviderSerializer(NetBoxModelSerializer):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Provider
|
model = Provider
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'url', 'display', 'name', 'slug', 'account', 'description', 'comments', 'asns', 'tags',
|
'id', 'url', 'display', 'name', 'slug', 'accounts', 'description', 'comments', 'asns', 'tags',
|
||||||
'custom_fields', 'created', 'last_updated', 'circuit_count',
|
'custom_fields', 'created', 'last_updated', 'circuit_count',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Provider Accounts
|
||||||
|
#
|
||||||
|
|
||||||
|
class ProviderAccountSerializer(NetBoxModelSerializer):
|
||||||
|
url = serializers.HyperlinkedIdentityField(view_name='circuits-api:provideraccount-detail')
|
||||||
|
provider = NestedProviderSerializer()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = ProviderAccount
|
||||||
|
fields = [
|
||||||
|
'id', 'url', 'display', 'provider', 'name', 'account', 'description', 'comments', 'tags', 'custom_fields',
|
||||||
|
'created', 'last_updated',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Provider networks
|
# Provider networks
|
||||||
#
|
#
|
||||||
@ -70,8 +92,8 @@ class CircuitTypeSerializer(NetBoxModelSerializer):
|
|||||||
|
|
||||||
class CircuitCircuitTerminationSerializer(WritableNestedSerializer):
|
class CircuitCircuitTerminationSerializer(WritableNestedSerializer):
|
||||||
url = serializers.HyperlinkedIdentityField(view_name='circuits-api:circuittermination-detail')
|
url = serializers.HyperlinkedIdentityField(view_name='circuits-api:circuittermination-detail')
|
||||||
site = NestedSiteSerializer()
|
site = NestedSiteSerializer(allow_null=True)
|
||||||
provider_network = NestedProviderNetworkSerializer()
|
provider_network = NestedProviderNetworkSerializer(allow_null=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = CircuitTermination
|
model = CircuitTermination
|
||||||
@ -84,18 +106,19 @@ class CircuitCircuitTerminationSerializer(WritableNestedSerializer):
|
|||||||
class CircuitSerializer(NetBoxModelSerializer):
|
class CircuitSerializer(NetBoxModelSerializer):
|
||||||
url = serializers.HyperlinkedIdentityField(view_name='circuits-api:circuit-detail')
|
url = serializers.HyperlinkedIdentityField(view_name='circuits-api:circuit-detail')
|
||||||
provider = NestedProviderSerializer()
|
provider = NestedProviderSerializer()
|
||||||
|
provider_account = NestedProviderAccountSerializer(required=False, allow_null=True)
|
||||||
status = ChoiceField(choices=CircuitStatusChoices, required=False)
|
status = ChoiceField(choices=CircuitStatusChoices, required=False)
|
||||||
type = NestedCircuitTypeSerializer()
|
type = NestedCircuitTypeSerializer()
|
||||||
tenant = NestedTenantSerializer(required=False, allow_null=True)
|
tenant = NestedTenantSerializer(required=False, allow_null=True)
|
||||||
termination_a = CircuitCircuitTerminationSerializer(read_only=True)
|
termination_a = CircuitCircuitTerminationSerializer(read_only=True, allow_null=True)
|
||||||
termination_z = CircuitCircuitTerminationSerializer(read_only=True)
|
termination_z = CircuitCircuitTerminationSerializer(read_only=True, allow_null=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Circuit
|
model = Circuit
|
||||||
fields = [
|
fields = [
|
||||||
'id', 'url', 'display', 'cid', 'provider', 'type', 'status', 'tenant', 'install_date', 'termination_date',
|
'id', 'url', 'display', 'cid', 'provider', 'provider_account', 'type', 'status', 'tenant', 'install_date',
|
||||||
'commit_rate', 'description', 'termination_a', 'termination_z', 'comments', 'tags', 'custom_fields',
|
'termination_date', 'commit_rate', 'description', 'termination_a', 'termination_z', 'comments', 'tags',
|
||||||
'created', 'last_updated',
|
'custom_fields', 'created', 'last_updated',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,14 +7,13 @@ router.APIRootView = views.CircuitsRootView
|
|||||||
|
|
||||||
# Providers
|
# Providers
|
||||||
router.register('providers', views.ProviderViewSet)
|
router.register('providers', views.ProviderViewSet)
|
||||||
|
router.register('provider-accounts', views.ProviderAccountViewSet)
|
||||||
|
router.register('provider-networks', views.ProviderNetworkViewSet)
|
||||||
|
|
||||||
# Circuits
|
# Circuits
|
||||||
router.register('circuit-types', views.CircuitTypeViewSet)
|
router.register('circuit-types', views.CircuitTypeViewSet)
|
||||||
router.register('circuits', views.CircuitViewSet)
|
router.register('circuits', views.CircuitViewSet)
|
||||||
router.register('circuit-terminations', views.CircuitTerminationViewSet)
|
router.register('circuit-terminations', views.CircuitTerminationViewSet)
|
||||||
|
|
||||||
# Provider networks
|
|
||||||
router.register('provider-networks', views.ProviderNetworkViewSet)
|
|
||||||
|
|
||||||
app_name = 'circuits-api'
|
app_name = 'circuits-api'
|
||||||
urlpatterns = router.urls
|
urlpatterns = router.urls
|
||||||
|
@ -46,7 +46,7 @@ class CircuitTypeViewSet(NetBoxModelViewSet):
|
|||||||
|
|
||||||
class CircuitViewSet(NetBoxModelViewSet):
|
class CircuitViewSet(NetBoxModelViewSet):
|
||||||
queryset = Circuit.objects.prefetch_related(
|
queryset = Circuit.objects.prefetch_related(
|
||||||
'type', 'tenant', 'provider', 'termination_a', 'termination_z'
|
'type', 'tenant', 'provider', 'provider_account', 'termination_a', 'termination_z'
|
||||||
).prefetch_related('tags')
|
).prefetch_related('tags')
|
||||||
serializer_class = serializers.CircuitSerializer
|
serializer_class = serializers.CircuitSerializer
|
||||||
filterset_class = filtersets.CircuitFilterSet
|
filterset_class = filtersets.CircuitFilterSet
|
||||||
@ -65,6 +65,16 @@ class CircuitTerminationViewSet(PassThroughPortMixin, NetBoxModelViewSet):
|
|||||||
brief_prefetch_fields = ['circuit']
|
brief_prefetch_fields = ['circuit']
|
||||||
|
|
||||||
|
|
||||||
|
#
|
||||||
|
# Provider accounts
|
||||||
|
#
|
||||||
|
|
||||||
|
class ProviderAccountViewSet(NetBoxModelViewSet):
|
||||||
|
queryset = ProviderAccount.objects.prefetch_related('provider', 'tags')
|
||||||
|
serializer_class = serializers.ProviderAccountSerializer
|
||||||
|
filterset_class = filtersets.ProviderAccountFilterSet
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Provider networks
|
# Provider networks
|
||||||
#
|
#
|
||||||
|
@ -25,6 +25,22 @@ class CircuitStatusChoices(ChoiceSet):
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class CircuitCommitRateChoices(ChoiceSet):
|
||||||
|
key = 'Circuit.commit_rate'
|
||||||
|
|
||||||
|
CHOICES = [
|
||||||
|
(10000, '10 Mbps'),
|
||||||
|
(100000, '100 Mbps'),
|
||||||
|
(1000000, '1 Gbps'),
|
||||||
|
(10000000, '10 Gbps'),
|
||||||
|
(25000000, '25 Gbps'),
|
||||||
|
(40000000, '40 Gbps'),
|
||||||
|
(100000000, '100 Gbps'),
|
||||||
|
(1544, 'T1 (1.544 Mbps)'),
|
||||||
|
(2048, 'E1 (2.048 Mbps)'),
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# CircuitTerminations
|
# CircuitTerminations
|
||||||
#
|
#
|
||||||
@ -38,3 +54,19 @@ class CircuitTerminationSideChoices(ChoiceSet):
|
|||||||
(SIDE_A, 'A'),
|
(SIDE_A, 'A'),
|
||||||
(SIDE_Z, 'Z')
|
(SIDE_Z, 'Z')
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class CircuitTerminationPortSpeedChoices(ChoiceSet):
|
||||||
|
key = 'CircuitTermination.port_speed'
|
||||||
|
|
||||||
|
CHOICES = [
|
||||||
|
(10000, '10 Mbps'),
|
||||||
|
(100000, '100 Mbps'),
|
||||||
|
(1000000, '1 Gbps'),
|
||||||
|
(10000000, '10 Gbps'),
|
||||||
|
(25000000, '25 Gbps'),
|
||||||
|
(40000000, '40 Gbps'),
|
||||||
|
(100000000, '100 Gbps'),
|
||||||
|
(1544, 'T1 (1.544 Mbps)'),
|
||||||
|
(2048, 'E1 (2.048 Mbps)'),
|
||||||
|
]
|
||||||
|
@ -16,6 +16,7 @@ __all__ = (
|
|||||||
'CircuitTerminationFilterSet',
|
'CircuitTerminationFilterSet',
|
||||||
'CircuitTypeFilterSet',
|
'CircuitTypeFilterSet',
|
||||||
'ProviderNetworkFilterSet',
|
'ProviderNetworkFilterSet',
|
||||||
|
'ProviderAccountFilterSet',
|
||||||
'ProviderFilterSet',
|
'ProviderFilterSet',
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -66,7 +67,34 @@ class ProviderFilterSet(NetBoxModelFilterSet, ContactModelFilterSet):
|
|||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Provider
|
model = Provider
|
||||||
fields = ['id', 'name', 'slug', 'account']
|
fields = ['id', 'name', 'slug']
|
||||||
|
|
||||||
|
def search(self, queryset, name, value):
|
||||||
|
if not value.strip():
|
||||||
|
return queryset
|
||||||
|
return queryset.filter(
|
||||||
|
Q(name__icontains=value) |
|
||||||
|
Q(accounts__account__icontains=value) |
|
||||||
|
Q(accounts__name__icontains=value) |
|
||||||
|
Q(comments__icontains=value)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ProviderAccountFilterSet(NetBoxModelFilterSet):
|
||||||
|
provider_id = django_filters.ModelMultipleChoiceFilter(
|
||||||
|
queryset=Provider.objects.all(),
|
||||||
|
label=_('Provider (ID)'),
|
||||||
|
)
|
||||||
|
provider = django_filters.ModelMultipleChoiceFilter(
|
||||||
|
field_name='provider__slug',
|
||||||
|
queryset=Provider.objects.all(),
|
||||||
|
to_field_name='slug',
|
||||||
|
label=_('Provider (slug)'),
|
||||||
|
)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = ProviderAccount
|
||||||
|
fields = ['id', 'name', 'account', 'description']
|
||||||
|
|
||||||
def search(self, queryset, name, value):
|
def search(self, queryset, name, value):
|
||||||
if not value.strip():
|
if not value.strip():
|
||||||
@ -75,7 +103,7 @@ class ProviderFilterSet(NetBoxModelFilterSet, ContactModelFilterSet):
|
|||||||
Q(name__icontains=value) |
|
Q(name__icontains=value) |
|
||||||
Q(account__icontains=value) |
|
Q(account__icontains=value) |
|
||||||
Q(comments__icontains=value)
|
Q(comments__icontains=value)
|
||||||
)
|
).distinct()
|
||||||
|
|
||||||
|
|
||||||
class ProviderNetworkFilterSet(NetBoxModelFilterSet):
|
class ProviderNetworkFilterSet(NetBoxModelFilterSet):
|
||||||
@ -123,6 +151,11 @@ class CircuitFilterSet(NetBoxModelFilterSet, TenancyFilterSet, ContactModelFilte
|
|||||||
to_field_name='slug',
|
to_field_name='slug',
|
||||||
label=_('Provider (slug)'),
|
label=_('Provider (slug)'),
|
||||||
)
|
)
|
||||||
|
provider_account_id = django_filters.ModelMultipleChoiceFilter(
|
||||||
|
field_name='provider_account',
|
||||||
|
queryset=ProviderAccount.objects.all(),
|
||||||
|
label=_('ProviderAccount (ID)'),
|
||||||
|
)
|
||||||
provider_network_id = django_filters.ModelMultipleChoiceFilter(
|
provider_network_id = django_filters.ModelMultipleChoiceFilter(
|
||||||
field_name='terminations__provider_network',
|
field_name='terminations__provider_network',
|
||||||
queryset=ProviderNetwork.objects.all(),
|
queryset=ProviderNetwork.objects.all(),
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from circuits.choices import CircuitStatusChoices
|
from circuits.choices import CircuitCommitRateChoices, CircuitStatusChoices
|
||||||
from circuits.models import *
|
from circuits.models import *
|
||||||
from ipam.models import ASN
|
from ipam.models import ASN
|
||||||
from netbox.forms import NetBoxModelBulkEditForm
|
from netbox.forms import NetBoxModelBulkEditForm
|
||||||
from tenancy.models import Tenant
|
from tenancy.models import Tenant
|
||||||
from utilities.forms import (
|
from utilities.forms import add_blank_choice
|
||||||
add_blank_choice, CommentField, DatePicker, DynamicModelChoiceField, DynamicModelMultipleChoiceField,
|
from utilities.forms.fields import CommentField, DynamicModelChoiceField, DynamicModelMultipleChoiceField
|
||||||
StaticSelect,
|
from utilities.forms.widgets import DatePicker, NumberWithOptions
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'CircuitBulkEditForm',
|
'CircuitBulkEditForm',
|
||||||
'CircuitTypeBulkEditForm',
|
'CircuitTypeBulkEditForm',
|
||||||
'ProviderBulkEditForm',
|
'ProviderBulkEditForm',
|
||||||
|
'ProviderAccountBulkEditForm',
|
||||||
'ProviderNetworkBulkEditForm',
|
'ProviderNetworkBulkEditForm',
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -25,11 +25,6 @@ class ProviderBulkEditForm(NetBoxModelBulkEditForm):
|
|||||||
label=_('ASNs'),
|
label=_('ASNs'),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
account = forms.CharField(
|
|
||||||
max_length=30,
|
|
||||||
required=False,
|
|
||||||
label=_('Account number')
|
|
||||||
)
|
|
||||||
description = forms.CharField(
|
description = forms.CharField(
|
||||||
max_length=200,
|
max_length=200,
|
||||||
required=False
|
required=False
|
||||||
@ -40,10 +35,32 @@ class ProviderBulkEditForm(NetBoxModelBulkEditForm):
|
|||||||
|
|
||||||
model = Provider
|
model = Provider
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(None, ('asns', 'account', )),
|
(None, ('asns', 'description')),
|
||||||
)
|
)
|
||||||
nullable_fields = (
|
nullable_fields = (
|
||||||
'asns', 'account', 'description', 'comments',
|
'asns', 'description', 'comments',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ProviderAccountBulkEditForm(NetBoxModelBulkEditForm):
|
||||||
|
provider = DynamicModelChoiceField(
|
||||||
|
queryset=Provider.objects.all(),
|
||||||
|
required=False
|
||||||
|
)
|
||||||
|
description = forms.CharField(
|
||||||
|
max_length=200,
|
||||||
|
required=False
|
||||||
|
)
|
||||||
|
comments = CommentField(
|
||||||
|
label=_('Comments')
|
||||||
|
)
|
||||||
|
|
||||||
|
model = ProviderAccount
|
||||||
|
fieldsets = (
|
||||||
|
(None, ('provider', 'description')),
|
||||||
|
)
|
||||||
|
nullable_fields = (
|
||||||
|
'description', 'comments',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -96,11 +113,17 @@ class CircuitBulkEditForm(NetBoxModelBulkEditForm):
|
|||||||
queryset=Provider.objects.all(),
|
queryset=Provider.objects.all(),
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
|
provider_account = DynamicModelChoiceField(
|
||||||
|
queryset=ProviderAccount.objects.all(),
|
||||||
|
required=False,
|
||||||
|
query_params={
|
||||||
|
'provider': '$provider'
|
||||||
|
}
|
||||||
|
)
|
||||||
status = forms.ChoiceField(
|
status = forms.ChoiceField(
|
||||||
choices=add_blank_choice(CircuitStatusChoices),
|
choices=add_blank_choice(CircuitStatusChoices),
|
||||||
required=False,
|
required=False,
|
||||||
initial='',
|
initial=''
|
||||||
widget=StaticSelect()
|
|
||||||
)
|
)
|
||||||
tenant = DynamicModelChoiceField(
|
tenant = DynamicModelChoiceField(
|
||||||
queryset=Tenant.objects.all(),
|
queryset=Tenant.objects.all(),
|
||||||
@ -116,7 +139,10 @@ class CircuitBulkEditForm(NetBoxModelBulkEditForm):
|
|||||||
)
|
)
|
||||||
commit_rate = forms.IntegerField(
|
commit_rate = forms.IntegerField(
|
||||||
required=False,
|
required=False,
|
||||||
label=_('Commit rate (Kbps)')
|
label=_('Commit rate (Kbps)'),
|
||||||
|
widget=NumberWithOptions(
|
||||||
|
options=CircuitCommitRateChoices
|
||||||
|
)
|
||||||
)
|
)
|
||||||
description = forms.CharField(
|
description = forms.CharField(
|
||||||
max_length=100,
|
max_length=100,
|
||||||
@ -129,7 +155,7 @@ class CircuitBulkEditForm(NetBoxModelBulkEditForm):
|
|||||||
model = Circuit
|
model = Circuit
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
('Circuit', ('provider', 'type', 'status', 'description')),
|
('Circuit', ('provider', 'type', 'status', 'description')),
|
||||||
('Service Parameters', ('install_date', 'termination_date', 'commit_rate')),
|
('Service Parameters', ('provider_account', 'install_date', 'termination_date', 'commit_rate')),
|
||||||
('Tenancy', ('tenant',)),
|
('Tenancy', ('tenant',)),
|
||||||
)
|
)
|
||||||
nullable_fields = (
|
nullable_fields = (
|
||||||
|
@ -6,13 +6,15 @@ from dcim.models import Site
|
|||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
from netbox.forms import NetBoxModelImportForm
|
from netbox.forms import NetBoxModelImportForm
|
||||||
from tenancy.models import Tenant
|
from tenancy.models import Tenant
|
||||||
from utilities.forms import BootstrapMixin, CSVChoiceField, CSVModelChoiceField, SlugField
|
from utilities.forms import BootstrapMixin
|
||||||
|
from utilities.forms.fields import CSVChoiceField, CSVModelChoiceField, SlugField
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'CircuitImportForm',
|
'CircuitImportForm',
|
||||||
'CircuitTerminationImportForm',
|
'CircuitTerminationImportForm',
|
||||||
'CircuitTypeImportForm',
|
'CircuitTypeImportForm',
|
||||||
'ProviderImportForm',
|
'ProviderImportForm',
|
||||||
|
'ProviderAccountImportForm',
|
||||||
'ProviderNetworkImportForm',
|
'ProviderNetworkImportForm',
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -23,7 +25,21 @@ class ProviderImportForm(NetBoxModelImportForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Provider
|
model = Provider
|
||||||
fields = (
|
fields = (
|
||||||
'name', 'slug', 'account', 'description', 'comments', 'tags',
|
'name', 'slug', 'description', 'comments', 'tags',
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
class ProviderAccountImportForm(NetBoxModelImportForm):
|
||||||
|
provider = CSVModelChoiceField(
|
||||||
|
queryset=Provider.objects.all(),
|
||||||
|
to_field_name='name',
|
||||||
|
help_text=_('Assigned provider')
|
||||||
|
)
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = ProviderAccount
|
||||||
|
fields = (
|
||||||
|
'provider', 'name', 'account', 'description', 'comments', 'tags',
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
@ -47,9 +63,6 @@ class CircuitTypeImportForm(NetBoxModelImportForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = CircuitType
|
model = CircuitType
|
||||||
fields = ('name', 'slug', 'description', 'tags')
|
fields = ('name', 'slug', 'description', 'tags')
|
||||||
help_texts = {
|
|
||||||
'name': _('Name of circuit type'),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class CircuitImportForm(NetBoxModelImportForm):
|
class CircuitImportForm(NetBoxModelImportForm):
|
||||||
@ -58,6 +71,12 @@ class CircuitImportForm(NetBoxModelImportForm):
|
|||||||
to_field_name='name',
|
to_field_name='name',
|
||||||
help_text=_('Assigned provider')
|
help_text=_('Assigned provider')
|
||||||
)
|
)
|
||||||
|
provider_account = CSVModelChoiceField(
|
||||||
|
queryset=ProviderAccount.objects.all(),
|
||||||
|
to_field_name='name',
|
||||||
|
help_text=_('Assigned provider account'),
|
||||||
|
required=False
|
||||||
|
)
|
||||||
type = CSVModelChoiceField(
|
type = CSVModelChoiceField(
|
||||||
queryset=CircuitType.objects.all(),
|
queryset=CircuitType.objects.all(),
|
||||||
to_field_name='name',
|
to_field_name='name',
|
||||||
@ -77,8 +96,8 @@ class CircuitImportForm(NetBoxModelImportForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Circuit
|
model = Circuit
|
||||||
fields = [
|
fields = [
|
||||||
'cid', 'provider', 'type', 'status', 'tenant', 'install_date', 'termination_date', 'commit_rate',
|
'cid', 'provider', 'provider_account', 'type', 'status', 'tenant', 'install_date', 'termination_date',
|
||||||
'description', 'comments', 'tags'
|
'commit_rate', 'description', 'comments', 'tags'
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,18 +1,20 @@
|
|||||||
from django import forms
|
from django import forms
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
from circuits.choices import CircuitStatusChoices
|
from circuits.choices import CircuitCommitRateChoices, CircuitStatusChoices
|
||||||
from circuits.models import *
|
from circuits.models import *
|
||||||
from dcim.models import Region, Site, SiteGroup
|
from dcim.models import Region, Site, SiteGroup
|
||||||
from ipam.models import ASN
|
from ipam.models import ASN
|
||||||
from netbox.forms import NetBoxModelFilterSetForm
|
from netbox.forms import NetBoxModelFilterSetForm
|
||||||
from tenancy.forms import TenancyFilterForm, ContactModelFilterForm
|
from tenancy.forms import TenancyFilterForm, ContactModelFilterForm
|
||||||
from utilities.forms import DatePicker, DynamicModelMultipleChoiceField, MultipleChoiceField, TagFilterField
|
from utilities.forms.fields import DynamicModelMultipleChoiceField, TagFilterField
|
||||||
|
from utilities.forms.widgets import DatePicker, NumberWithOptions
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'CircuitFilterForm',
|
'CircuitFilterForm',
|
||||||
'CircuitTypeFilterForm',
|
'CircuitTypeFilterForm',
|
||||||
'ProviderFilterForm',
|
'ProviderFilterForm',
|
||||||
|
'ProviderAccountFilterForm',
|
||||||
'ProviderNetworkFilterForm',
|
'ProviderNetworkFilterForm',
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -56,6 +58,23 @@ class ProviderFilterForm(ContactModelFilterForm, NetBoxModelFilterSetForm):
|
|||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
|
class ProviderAccountFilterForm(NetBoxModelFilterSetForm):
|
||||||
|
model = ProviderAccount
|
||||||
|
fieldsets = (
|
||||||
|
(None, ('q', 'filter_id', 'tag')),
|
||||||
|
('Attributes', ('provider_id', 'account')),
|
||||||
|
)
|
||||||
|
provider_id = DynamicModelMultipleChoiceField(
|
||||||
|
queryset=Provider.objects.all(),
|
||||||
|
required=False,
|
||||||
|
label=_('Provider')
|
||||||
|
)
|
||||||
|
account = forms.CharField(
|
||||||
|
required=False
|
||||||
|
)
|
||||||
|
tag = TagFilterField(model)
|
||||||
|
|
||||||
|
|
||||||
class ProviderNetworkFilterForm(NetBoxModelFilterSetForm):
|
class ProviderNetworkFilterForm(NetBoxModelFilterSetForm):
|
||||||
model = ProviderNetwork
|
model = ProviderNetwork
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
@ -83,7 +102,7 @@ class CircuitFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFi
|
|||||||
model = Circuit
|
model = Circuit
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
(None, ('q', 'filter_id', 'tag')),
|
(None, ('q', 'filter_id', 'tag')),
|
||||||
('Provider', ('provider_id', 'provider_network_id')),
|
('Provider', ('provider_id', 'provider_account_id', 'provider_network_id')),
|
||||||
('Attributes', ('type_id', 'status', 'install_date', 'termination_date', 'commit_rate')),
|
('Attributes', ('type_id', 'status', 'install_date', 'termination_date', 'commit_rate')),
|
||||||
('Location', ('region_id', 'site_group_id', 'site_id')),
|
('Location', ('region_id', 'site_group_id', 'site_id')),
|
||||||
('Tenant', ('tenant_group_id', 'tenant_id')),
|
('Tenant', ('tenant_group_id', 'tenant_id')),
|
||||||
@ -99,6 +118,14 @@ class CircuitFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFi
|
|||||||
required=False,
|
required=False,
|
||||||
label=_('Provider')
|
label=_('Provider')
|
||||||
)
|
)
|
||||||
|
provider_account_id = DynamicModelMultipleChoiceField(
|
||||||
|
queryset=ProviderAccount.objects.all(),
|
||||||
|
required=False,
|
||||||
|
query_params={
|
||||||
|
'provider_id': '$provider_id'
|
||||||
|
},
|
||||||
|
label=_('Provider account')
|
||||||
|
)
|
||||||
provider_network_id = DynamicModelMultipleChoiceField(
|
provider_network_id = DynamicModelMultipleChoiceField(
|
||||||
queryset=ProviderNetwork.objects.all(),
|
queryset=ProviderNetwork.objects.all(),
|
||||||
required=False,
|
required=False,
|
||||||
@ -107,7 +134,7 @@ class CircuitFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFi
|
|||||||
},
|
},
|
||||||
label=_('Provider network')
|
label=_('Provider network')
|
||||||
)
|
)
|
||||||
status = MultipleChoiceField(
|
status = forms.MultipleChoiceField(
|
||||||
choices=CircuitStatusChoices,
|
choices=CircuitStatusChoices,
|
||||||
required=False
|
required=False
|
||||||
)
|
)
|
||||||
@ -141,6 +168,9 @@ class CircuitFilterForm(TenancyFilterForm, ContactModelFilterForm, NetBoxModelFi
|
|||||||
commit_rate = forms.IntegerField(
|
commit_rate = forms.IntegerField(
|
||||||
required=False,
|
required=False,
|
||||||
min_value=0,
|
min_value=0,
|
||||||
label=_('Commit rate (Kbps)')
|
label=_('Commit rate (Kbps)'),
|
||||||
|
widget=NumberWithOptions(
|
||||||
|
options=CircuitCommitRateChoices
|
||||||
|
)
|
||||||
)
|
)
|
||||||
tag = TagFilterField(model)
|
tag = TagFilterField(model)
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
|
||||||
|
from circuits.choices import CircuitCommitRateChoices, CircuitTerminationPortSpeedChoices
|
||||||
from circuits.models import *
|
from circuits.models import *
|
||||||
from dcim.models import Region, Site, SiteGroup
|
from dcim.models import Site
|
||||||
from ipam.models import ASN
|
from ipam.models import ASN
|
||||||
from netbox.forms import NetBoxModelForm
|
from netbox.forms import NetBoxModelForm
|
||||||
from tenancy.forms import TenancyForm
|
from tenancy.forms import TenancyForm
|
||||||
from utilities.forms import (
|
from utilities.forms.fields import CommentField, DynamicModelChoiceField, DynamicModelMultipleChoiceField, SlugField
|
||||||
CommentField, DatePicker, DynamicModelChoiceField, DynamicModelMultipleChoiceField, SelectSpeedWidget, SlugField,
|
from utilities.forms.widgets import DatePicker, NumberWithOptions
|
||||||
StaticSelect,
|
|
||||||
)
|
|
||||||
|
|
||||||
__all__ = (
|
__all__ = (
|
||||||
'CircuitForm',
|
'CircuitForm',
|
||||||
'CircuitTerminationForm',
|
'CircuitTerminationForm',
|
||||||
'CircuitTypeForm',
|
'CircuitTypeForm',
|
||||||
'ProviderForm',
|
'ProviderForm',
|
||||||
|
'ProviderAccountForm',
|
||||||
'ProviderNetworkForm',
|
'ProviderNetworkForm',
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -30,17 +30,26 @@ class ProviderForm(NetBoxModelForm):
|
|||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
('Provider', ('name', 'slug', 'asns', 'description', 'tags')),
|
('Provider', ('name', 'slug', 'asns', 'description', 'tags')),
|
||||||
('Support Info', ('account',)),
|
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Provider
|
model = Provider
|
||||||
fields = [
|
fields = [
|
||||||
'name', 'slug', 'account', 'asns', 'description', 'comments', 'tags',
|
'name', 'slug', 'asns', 'description', 'comments', 'tags',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class ProviderAccountForm(NetBoxModelForm):
|
||||||
|
provider = DynamicModelChoiceField(
|
||||||
|
queryset=Provider.objects.all()
|
||||||
|
)
|
||||||
|
comments = CommentField()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = ProviderAccount
|
||||||
|
fields = [
|
||||||
|
'provider', 'name', 'account', 'description', 'comments', 'tags',
|
||||||
]
|
]
|
||||||
help_texts = {
|
|
||||||
'name': _("Full name of the provider"),
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
class ProviderNetworkForm(NetBoxModelForm):
|
class ProviderNetworkForm(NetBoxModelForm):
|
||||||
@ -78,7 +87,15 @@ class CircuitTypeForm(NetBoxModelForm):
|
|||||||
|
|
||||||
class CircuitForm(TenancyForm, NetBoxModelForm):
|
class CircuitForm(TenancyForm, NetBoxModelForm):
|
||||||
provider = DynamicModelChoiceField(
|
provider = DynamicModelChoiceField(
|
||||||
queryset=Provider.objects.all()
|
queryset=Provider.objects.all(),
|
||||||
|
selector=True
|
||||||
|
)
|
||||||
|
provider_account = DynamicModelChoiceField(
|
||||||
|
queryset=ProviderAccount.objects.all(),
|
||||||
|
required=False,
|
||||||
|
query_params={
|
||||||
|
'provider_id': '$provider',
|
||||||
|
}
|
||||||
)
|
)
|
||||||
type = DynamicModelChoiceField(
|
type = DynamicModelChoiceField(
|
||||||
queryset=CircuitType.objects.all()
|
queryset=CircuitType.objects.all()
|
||||||
@ -86,7 +103,7 @@ class CircuitForm(TenancyForm, NetBoxModelForm):
|
|||||||
comments = CommentField()
|
comments = CommentField()
|
||||||
|
|
||||||
fieldsets = (
|
fieldsets = (
|
||||||
('Circuit', ('provider', 'cid', 'type', 'status', 'description', 'tags')),
|
('Circuit', ('provider', 'provider_account', 'cid', 'type', 'status', 'description', 'tags')),
|
||||||
('Service Parameters', ('install_date', 'termination_date', 'commit_rate')),
|
('Service Parameters', ('install_date', 'termination_date', 'commit_rate')),
|
||||||
('Tenancy', ('tenant_group', 'tenant')),
|
('Tenancy', ('tenant_group', 'tenant')),
|
||||||
)
|
)
|
||||||
@ -94,87 +111,45 @@ class CircuitForm(TenancyForm, NetBoxModelForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Circuit
|
model = Circuit
|
||||||
fields = [
|
fields = [
|
||||||
'cid', 'type', 'provider', 'status', 'install_date', 'termination_date', 'commit_rate', 'description',
|
'cid', 'type', 'provider', 'provider_account', 'status', 'install_date', 'termination_date', 'commit_rate',
|
||||||
'tenant_group', 'tenant', 'comments', 'tags',
|
'description', 'tenant_group', 'tenant', 'comments', 'tags',
|
||||||
]
|
]
|
||||||
help_texts = {
|
|
||||||
'cid': _("Unique circuit ID"),
|
|
||||||
'commit_rate': _("Committed rate"),
|
|
||||||
}
|
|
||||||
widgets = {
|
widgets = {
|
||||||
'status': StaticSelect(),
|
|
||||||
'install_date': DatePicker(),
|
'install_date': DatePicker(),
|
||||||
'termination_date': DatePicker(),
|
'termination_date': DatePicker(),
|
||||||
'commit_rate': SelectSpeedWidget(),
|
'commit_rate': NumberWithOptions(
|
||||||
|
options=CircuitCommitRateChoices
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class CircuitTerminationForm(NetBoxModelForm):
|
class CircuitTerminationForm(NetBoxModelForm):
|
||||||
provider = DynamicModelChoiceField(
|
|
||||||
queryset=Provider.objects.all(),
|
|
||||||
required=False,
|
|
||||||
initial_params={
|
|
||||||
'circuits': '$circuit'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
circuit = DynamicModelChoiceField(
|
circuit = DynamicModelChoiceField(
|
||||||
queryset=Circuit.objects.all(),
|
queryset=Circuit.objects.all(),
|
||||||
query_params={
|
selector=True
|
||||||
'provider_id': '$provider',
|
|
||||||
},
|
|
||||||
)
|
|
||||||
region = DynamicModelChoiceField(
|
|
||||||
queryset=Region.objects.all(),
|
|
||||||
required=False,
|
|
||||||
initial_params={
|
|
||||||
'sites': '$site'
|
|
||||||
}
|
|
||||||
)
|
|
||||||
site_group = DynamicModelChoiceField(
|
|
||||||
queryset=SiteGroup.objects.all(),
|
|
||||||
required=False,
|
|
||||||
initial_params={
|
|
||||||
'sites': '$site'
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
site = DynamicModelChoiceField(
|
site = DynamicModelChoiceField(
|
||||||
queryset=Site.objects.all(),
|
queryset=Site.objects.all(),
|
||||||
query_params={
|
|
||||||
'region_id': '$region',
|
|
||||||
'group_id': '$site_group',
|
|
||||||
},
|
|
||||||
required=False
|
|
||||||
)
|
|
||||||
provider_network_provider = DynamicModelChoiceField(
|
|
||||||
queryset=Provider.objects.all(),
|
|
||||||
required=False,
|
required=False,
|
||||||
label='Provider',
|
selector=True
|
||||||
initial_params={
|
|
||||||
'networks': 'provider_network'
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
provider_network = DynamicModelChoiceField(
|
provider_network = DynamicModelChoiceField(
|
||||||
queryset=ProviderNetwork.objects.all(),
|
queryset=ProviderNetwork.objects.all(),
|
||||||
query_params={
|
required=False,
|
||||||
'provider_id': '$provider_network_provider',
|
selector=True
|
||||||
},
|
|
||||||
required=False
|
|
||||||
)
|
)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = CircuitTermination
|
model = CircuitTermination
|
||||||
fields = [
|
fields = [
|
||||||
'provider', 'circuit', 'term_side', 'region', 'site_group', 'site', 'provider_network_provider',
|
'circuit', 'term_side', 'site', 'provider_network', 'mark_connected', 'port_speed', 'upstream_speed',
|
||||||
'provider_network', 'mark_connected', 'port_speed', 'upstream_speed', 'xconnect_id', 'pp_info',
|
'xconnect_id', 'pp_info', 'description', 'tags',
|
||||||
'description', 'tags',
|
|
||||||
]
|
]
|
||||||
help_texts = {
|
|
||||||
'port_speed': _("Physical circuit speed"),
|
|
||||||
'xconnect_id': _("ID of the local cross-connect"),
|
|
||||||
'pp_info': _("Patch panel ID and port number(s)")
|
|
||||||
}
|
|
||||||
widgets = {
|
widgets = {
|
||||||
'term_side': StaticSelect(),
|
'port_speed': NumberWithOptions(
|
||||||
'port_speed': SelectSpeedWidget(),
|
options=CircuitTerminationPortSpeedChoices
|
||||||
'upstream_speed': SelectSpeedWidget(),
|
),
|
||||||
|
'upstream_speed': NumberWithOptions(
|
||||||
|
options=CircuitTerminationPortSpeedChoices
|
||||||
|
),
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,41 @@
|
|||||||
import graphene
|
import graphene
|
||||||
|
|
||||||
|
from circuits import models
|
||||||
from netbox.graphql.fields import ObjectField, ObjectListField
|
from netbox.graphql.fields import ObjectField, ObjectListField
|
||||||
from .types import *
|
from .types import *
|
||||||
|
from utilities.graphql_optimizer import gql_query_optimizer
|
||||||
|
|
||||||
|
|
||||||
class CircuitsQuery(graphene.ObjectType):
|
class CircuitsQuery(graphene.ObjectType):
|
||||||
circuit = ObjectField(CircuitType)
|
circuit = ObjectField(CircuitType)
|
||||||
circuit_list = ObjectListField(CircuitType)
|
circuit_list = ObjectListField(CircuitType)
|
||||||
|
|
||||||
|
def resolve_circuit_list(root, info, **kwargs):
|
||||||
|
return gql_query_optimizer(models.Circuit.objects.all(), info)
|
||||||
|
|
||||||
circuit_termination = ObjectField(CircuitTerminationType)
|
circuit_termination = ObjectField(CircuitTerminationType)
|
||||||
circuit_termination_list = ObjectListField(CircuitTerminationType)
|
circuit_termination_list = ObjectListField(CircuitTerminationType)
|
||||||
|
|
||||||
|
def resolve_circuit_termination_list(root, info, **kwargs):
|
||||||
|
return gql_query_optimizer(models.CircuitTermination.objects.all(), info)
|
||||||
|
|
||||||
circuit_type = ObjectField(CircuitTypeType)
|
circuit_type = ObjectField(CircuitTypeType)
|
||||||
circuit_type_list = ObjectListField(CircuitTypeType)
|
circuit_type_list = ObjectListField(CircuitTypeType)
|
||||||
|
|
||||||
|
def resolve_circuit_type_list(root, info, **kwargs):
|
||||||
|
return gql_query_optimizer(models.CircuitType.objects.all(), info)
|
||||||
|
|
||||||
provider = ObjectField(ProviderType)
|
provider = ObjectField(ProviderType)
|
||||||
provider_list = ObjectListField(ProviderType)
|
provider_list = ObjectListField(ProviderType)
|
||||||
|
|
||||||
|
def resolve_provider_list(root, info, **kwargs):
|
||||||
|
return gql_query_optimizer(models.Provider.objects.all(), info)
|
||||||
|
|
||||||
|
provider_account = ObjectField(ProviderAccountType)
|
||||||
|
provider_account_list = ObjectListField(ProviderAccountType)
|
||||||
|
|
||||||
provider_network = ObjectField(ProviderNetworkType)
|
provider_network = ObjectField(ProviderNetworkType)
|
||||||
provider_network_list = ObjectListField(ProviderNetworkType)
|
provider_network_list = ObjectListField(ProviderNetworkType)
|
||||||
|
|
||||||
|
def resolve_provider_network_list(root, info, **kwargs):
|
||||||
|
return gql_query_optimizer(models.ProviderNetwork.objects.all(), info)
|
||||||
|
@ -10,6 +10,7 @@ __all__ = (
|
|||||||
'CircuitType',
|
'CircuitType',
|
||||||
'CircuitTypeType',
|
'CircuitTypeType',
|
||||||
'ProviderType',
|
'ProviderType',
|
||||||
|
'ProviderAccountType',
|
||||||
'ProviderNetworkType',
|
'ProviderNetworkType',
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -45,6 +46,14 @@ class ProviderType(NetBoxObjectType, ContactsMixin):
|
|||||||
filterset_class = filtersets.ProviderFilterSet
|
filterset_class = filtersets.ProviderFilterSet
|
||||||
|
|
||||||
|
|
||||||
|
class ProviderAccountType(NetBoxObjectType):
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = models.ProviderAccount
|
||||||
|
fields = '__all__'
|
||||||
|
filterset_class = filtersets.ProviderAccountFilterSet
|
||||||
|
|
||||||
|
|
||||||
class ProviderNetworkType(NetBoxObjectType):
|
class ProviderNetworkType(NetBoxObjectType):
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
import dcim.fields
|
import ipam.fields
|
||||||
from utilities.json import CustomFieldJSONEncoder
|
from utilities.json import CustomFieldJSONEncoder
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
@ -77,7 +77,7 @@ class Migration(migrations.Migration):
|
|||||||
('id', models.BigAutoField(primary_key=True, serialize=False)),
|
('id', models.BigAutoField(primary_key=True, serialize=False)),
|
||||||
('name', models.CharField(max_length=100, unique=True)),
|
('name', models.CharField(max_length=100, unique=True)),
|
||||||
('slug', models.SlugField(max_length=100, unique=True)),
|
('slug', models.SlugField(max_length=100, unique=True)),
|
||||||
('asn', dcim.fields.ASNField(blank=True, null=True)),
|
('asn', ipam.fields.ASNField(blank=True, null=True)),
|
||||||
('account', models.CharField(blank=True, max_length=30)),
|
('account', models.CharField(blank=True, max_length=30)),
|
||||||
('portal_url', models.URLField(blank=True)),
|
('portal_url', models.URLField(blank=True)),
|
||||||
('noc_contact', models.TextField(blank=True)),
|
('noc_contact', models.TextField(blank=True)),
|
||||||
|
91
netbox/circuits/migrations/0042_provideraccount.py
Normal file
91
netbox/circuits/migrations/0042_provideraccount.py
Normal file
@ -0,0 +1,91 @@
|
|||||||
|
from django.db import migrations, models
|
||||||
|
import django.db.models.deletion
|
||||||
|
import taggit.managers
|
||||||
|
import utilities.json
|
||||||
|
|
||||||
|
|
||||||
|
def create_provideraccounts_from_providers(apps, schema_editor):
|
||||||
|
"""
|
||||||
|
Migrate Account in Provider model to separate account model
|
||||||
|
"""
|
||||||
|
Provider = apps.get_model('circuits', 'Provider')
|
||||||
|
ProviderAccount = apps.get_model('circuits', 'ProviderAccount')
|
||||||
|
|
||||||
|
provider_accounts = []
|
||||||
|
for provider in Provider.objects.all():
|
||||||
|
if provider.account:
|
||||||
|
provider_accounts.append(ProviderAccount(
|
||||||
|
provider=provider,
|
||||||
|
account=provider.account
|
||||||
|
))
|
||||||
|
ProviderAccount.objects.bulk_create(provider_accounts, batch_size=100)
|
||||||
|
|
||||||
|
|
||||||
|
def restore_providers_from_provideraccounts(apps, schema_editor):
|
||||||
|
"""
|
||||||
|
Restore Provider account values from auto-generated ProviderAccounts
|
||||||
|
"""
|
||||||
|
ProviderAccount = apps.get_model('circuits', 'ProviderAccount')
|
||||||
|
provider_accounts = ProviderAccount.objects.order_by('pk')
|
||||||
|
for provideraccount in provider_accounts:
|
||||||
|
if provider_accounts.filter(provider=provideraccount.provider)[0] == provideraccount:
|
||||||
|
provideraccount.provider.account = provideraccount.account
|
||||||
|
provideraccount.provider.save()
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('extras', '0084_staging'),
|
||||||
|
('circuits', '0041_standardize_description_comments'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='ProviderAccount',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False)),
|
||||||
|
('created', models.DateTimeField(auto_now_add=True, null=True)),
|
||||||
|
('last_updated', models.DateTimeField(auto_now=True, null=True)),
|
||||||
|
('custom_field_data', models.JSONField(blank=True, default=dict, encoder=utilities.json.CustomFieldJSONEncoder)),
|
||||||
|
('description', models.CharField(blank=True, max_length=200)),
|
||||||
|
('comments', models.TextField(blank=True)),
|
||||||
|
('account', models.CharField(max_length=100)),
|
||||||
|
('name', models.CharField(blank=True, max_length=100)),
|
||||||
|
('provider', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='accounts', to='circuits.provider')),
|
||||||
|
('tags', taggit.managers.TaggableManager(through='extras.TaggedItem', to='extras.Tag')),
|
||||||
|
],
|
||||||
|
options={
|
||||||
|
'ordering': ('provider', 'account'),
|
||||||
|
},
|
||||||
|
),
|
||||||
|
migrations.AddConstraint(
|
||||||
|
model_name='provideraccount',
|
||||||
|
constraint=models.UniqueConstraint(condition=models.Q(('name', ''), _negated=True), fields=('provider', 'name'), name='circuits_provideraccount_unique_provider_name'),
|
||||||
|
),
|
||||||
|
migrations.AddConstraint(
|
||||||
|
model_name='provideraccount',
|
||||||
|
constraint=models.UniqueConstraint(fields=('provider', 'account'), name='circuits_provideraccount_unique_provider_account'),
|
||||||
|
),
|
||||||
|
migrations.RunPython(
|
||||||
|
create_provideraccounts_from_providers, restore_providers_from_provideraccounts
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='provider',
|
||||||
|
name='account',
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='circuit',
|
||||||
|
name='provider_account',
|
||||||
|
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='circuits', to='circuits.provideraccount', null=True, blank=True),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
migrations.AlterModelOptions(
|
||||||
|
name='circuit',
|
||||||
|
options={'ordering': ['provider', 'provider_account', 'cid']},
|
||||||
|
),
|
||||||
|
migrations.AddConstraint(
|
||||||
|
model_name='circuit',
|
||||||
|
constraint=models.UniqueConstraint(fields=('provider_account', 'cid'), name='circuits_circuit_unique_provideraccount_cid'),
|
||||||
|
),
|
||||||
|
]
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user