Skip to content

Commit e05fa5c

Browse files
Merge pull request #7061 from netbox-community/feature
v3.0 release prep
2 parents 13e6337 + f5f7494 commit e05fa5c

File tree

1,668 files changed

+32855
-198060
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,668 files changed

+32855
-198060
lines changed

.github/ISSUE_TEMPLATE/bug_report.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ body:
2525
label: Python version
2626
description: What version of Python are you currently running?
2727
options:
28-
- 3.6
2928
- 3.7
3029
- 3.8
3130
- 3.9

.github/workflows/ci.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ jobs:
55
runs-on: ubuntu-latest
66
strategy:
77
matrix:
8-
python-version: [3.6, 3.7, 3.8]
8+
python-version: [3.7, 3.8, 3.9]
9+
node-version: [14.x]
910
services:
1011
redis:
1112
image: redis
@@ -33,15 +34,30 @@ jobs:
3334
with:
3435
python-version: ${{ matrix.python-version }}
3536

37+
- name: Use Node.js ${{ matrix.node-version }}
38+
uses: actions/setup-node@v2
39+
with:
40+
node-version: ${{ matrix.node-version }}
41+
3642
- name: Install dependencies & set up configuration
3743
run: |
3844
python -m pip install --upgrade pip
3945
pip install -r requirements.txt
4046
pip install pycodestyle coverage
4147
ln -s configuration.testing.py netbox/netbox/configuration.py
48+
yarn --cwd netbox/project-static
49+
50+
- name: Build documentation
51+
run: mkdocs build
52+
53+
- name: Collect static files
54+
run: python netbox/manage.py collectstatic --no-input
4255

4356
- name: Check PEP8 compliance
44-
run: pycodestyle --ignore=W504,E501 netbox/
57+
run: pycodestyle --ignore=W504,E501 --exclude=node_modules netbox/
58+
59+
- name: Check UI ESLint, TypeScript, and Prettier Compliance
60+
run: yarn --cwd netbox/project-static validate
4561

4662
- name: Run tests
4763
run: coverage run --source="netbox/" netbox/manage.py test netbox/

.gitignore

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
*.pyc
22
*.swp
3+
node_modules
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
/netbox/project-static/.cache
8+
/netbox/project-static/docs/*
9+
!/netbox/project-static/docs/.info
310
/netbox/netbox/configuration.py
411
/netbox/netbox/ldap_config.py
512
/netbox/project-static/.cache

README.md

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,13 @@ our [contributing guide](CONTRIBUTING.md) prior to beginning any work.
5454

5555
### Screenshots
5656

57-
![Screenshot of main page](docs/media/screenshot1.png "Main page")
57+
![Screenshot of Main Page](docs/media/home-light.png "Main Page")
5858

59-
![Screenshot of rack elevation](docs/media/screenshot2.png "Rack elevation")
59+
![Screenshot of Rack Elevation](docs/media/rack-dark.png "Rack Elevation")
6060

61-
![Screenshot of prefix hierarchy](docs/media/screenshot3.png "Prefix hierarchy")
61+
![Screenshot of Prefix Hierarchy](docs/media/prefixes-light.png "Prefix Hierarchy")
62+
63+
![Screenshot of Cable Tracing](docs/media/cable-dark.png "Cable Tracing")
6264

6365
### Related projects
6466

base_requirements.txt

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,6 @@
22
# https://github.com/django/django
33
Django
44

5-
# Django caching using Redis
6-
# https://github.com/Suor/django-cacheops
7-
django-cacheops
8-
95
# Django middleware which permits cross-domain API requests
106
# https://github.com/OttoYiu/django-cors-headers
117
django-cors-headers
@@ -18,6 +14,10 @@ django-debug-toolbar
1814
# https://github.com/carltongibson/django-filter
1915
django-filter
2016

17+
# Django debug toolbar extension with support for GraphiQL
18+
# https://github.com/flavors/django-graphiql-debug-toolbar/
19+
django-graphiql-debug-toolbar
20+
2121
# Modified Preorder Tree Traversal (recursive nesting of objects)
2222
# https://github.com/django-mptt/django-mptt
2323
django-mptt
@@ -30,6 +30,10 @@ django-pglocks
3030
# https://github.com/korfuri/django-prometheus
3131
django-prometheus
3232

33+
# Django chaching backend using Redis
34+
# https://github.com/jazzband/django-redis
35+
django-redis
36+
3337
# Django integration for RQ (Reqis queuing)
3438
# https://github.com/rq/django-rq
3539
django-rq
@@ -54,6 +58,10 @@ djangorestframework
5458
# https://github.com/axnsan12/drf-yasg
5559
drf-yasg[validation]
5660

61+
# Django wrapper for Graphene (GraphQL support)
62+
# https://github.com/graphql-python/graphene-django
63+
graphene_django
64+
5765
# WSGI HTTP server
5866
# https://gunicorn.org/
5967
gunicorn
@@ -66,6 +74,14 @@ Jinja2
6674
# https://github.com/Python-Markdown/markdown
6775
Markdown
6876

77+
# File inclusion plugin for Python-Markdown
78+
# https://github.com/cmacmackin/markdown-include
79+
markdown-include
80+
81+
# MkDocs Material theme (for documentation build)
82+
# https://github.com/squidfunk/mkdocs-material
83+
mkdocs-material
84+
6985
# Library for manipulating IP prefixes and addresses
7086
# https://github.com/drkjam/netaddr
7187
netaddr

contrib/netbox-housekeeping.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
# This shell script invokes NetBox's housekeeping management command, which
3+
# intended to be run nightly. This script can be copied into your system's
4+
# daily cron directory (e.g. /etc/cron.daily), or referenced directly from
5+
# within the cron configuration file.
6+
#
7+
# If NetBox has been installed into a nonstandard location, update the paths
8+
# below.
9+
/opt/netbox/venv/bin/python /opt/netbox/netbox/manage.py housekeeping

contrib/netbox-rq.service

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ User=netbox
1111
Group=netbox
1212
WorkingDirectory=/opt/netbox
1313

14-
ExecStart=/opt/netbox/venv/bin/python3 /opt/netbox/netbox/manage.py rqworker
14+
ExecStart=/opt/netbox/venv/bin/python3 /opt/netbox/netbox/manage.py rqworker high default low
1515

1616
Restart=on-failure
1717
RestartSec=30

docs/additional-features/caching.md

Lines changed: 0 additions & 28 deletions
This file was deleted.

docs/additional-features/webhooks.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Webhooks
22

3-
A webhook is a mechanism for conveying to some external system a change that took place in NetBox. For example, you may want to notify a monitoring system whenever the status of a device is updated in NetBox. This can be done by creating a webhook for the device model in NetBox and identifying the webhook receiver. When NetBox detects a change to a device, an HTTP request containing the details of the change and who made it be sent to the specified receiver. Webhooks are configured in the admin UI under Extras > Webhooks.
3+
A webhook is a mechanism for conveying to some external system a change that took place in NetBox. For example, you may want to notify a monitoring system whenever the status of a device is updated in NetBox. This can be done by creating a webhook for the device model in NetBox and identifying the webhook receiver. When NetBox detects a change to a device, an HTTP request containing the details of the change and who made it be sent to the specified receiver. Webhooks are managed under Logging > Webhooks.
44

55
!!! warning
66
Webhooks support the inclusion of user-submitted code to generate custom headers and payloads, which may pose security risks under certain conditions. Only grant permission to create or modify webhooks to trusted users.

docs/administration/housekeeping.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Housekeeping
2+
3+
NetBox includes a `housekeeping` management command that should be run nightly. This command handles:
4+
5+
* Clearing expired authentication sessions from the database
6+
* Deleting changelog records older than the configured [retention time](../configuration/optional-settings.md#changelog_retention)
7+
8+
This command can be invoked directly, or by using the shell script provided at `/opt/netbox/contrib/netbox-housekeeping.sh`. This script can be copied into your cron scheduler's daily jobs directory (e.g. `/etc/cron.daily`) or referenced directly within the cron configuration file.
9+
10+
The `housekeeping` command can also be run manually at any time: Running the command outside of scheduled execution times will not interfere with its operation.

docs/administration/netbox-shell.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This will launch a lightly customized version of [the built-in Django shell](htt
1111
```
1212
$ ./manage.py nbshell
1313
### NetBox interactive shell (localhost)
14-
### Python 3.6.9 | Django 2.2.11 | NetBox 2.7.10
14+
### Python 3.7.10 | Django 3.2.5 | NetBox 3.0
1515
### lsmodels() will show available models. Use help(<model>) for more info.
1616
```
1717

@@ -194,7 +194,7 @@ To delete multiple objects at once, call `delete()` on a filtered queryset. It's
194194
>>> Device.objects.filter(name__icontains='test').count()
195195
27
196196
>>> Device.objects.filter(name__icontains='test').delete()
197-
(35, {'dcim.DeviceBay': 0, 'secrets.Secret': 0, 'dcim.InterfaceConnection': 4,
197+
(35, {'dcim.DeviceBay': 0, 'dcim.InterfaceConnection': 4,
198198
'extras.ImageAttachment': 0, 'dcim.Device': 27, 'dcim.Interface': 4,
199199
'dcim.ConsolePort': 0, 'dcim.PowerPort': 0})
200200
```

docs/configuration/optional-settings.md

Lines changed: 29 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -52,14 +52,6 @@ BASE_PATH = 'netbox/'
5252

5353
---
5454

55-
## CACHE_TIMEOUT
56-
57-
Default: 0 (disabled)
58-
59-
The number of seconds that cached database queries will be retained before expiring.
60-
61-
---
62-
6355
## CHANGELOG_RETENTION
6456

6557
Default: 90
@@ -96,6 +88,22 @@ CORS_ORIGIN_WHITELIST = [
9688

9789
---
9890

91+
## CUSTOM_VALIDATORS
92+
93+
This is a mapping of models to [custom validators](../customization/custom-validation.md) that have been defined locally to enforce custom validation logic. An example is provided below:
94+
95+
```python
96+
CUSTOM_VALIDATORS = {
97+
'dcim.site': (
98+
Validator1,
99+
Validator2,
100+
Validator3
101+
)
102+
}
103+
```
104+
105+
---
106+
99107
## DEBUG
100108

101109
Default: False
@@ -144,7 +152,7 @@ In order to send email, NetBox needs an email server configured. The following i
144152
!!! note
145153
The `USE_SSL` and `USE_TLS` parameters are mutually exclusive.
146154

147-
Email is sent from NetBox only for critical events or if configured for [logging](#logging). If you would like to test the email server configuration, Django provides a convenient [send_mail()](https://docs.djangoproject.com/en/stable/topics/email/#send-mail) fuction accessible within the NetBox shell:
155+
Email is sent from NetBox only for critical events or if configured for [logging](#logging). If you would like to test the email server configuration, Django provides a convenient [send_mail()](https://docs.djangoproject.com/en/stable/topics/email/#send-mail) function accessible within the NetBox shell:
148156

149157
```no-highlight
150158
# python ./manage.py nbshell
@@ -195,6 +203,14 @@ EXEMPT_VIEW_PERMISSIONS = ['*']
195203

196204
---
197205

206+
## GRAPHQL_ENABLED
207+
208+
Default: True
209+
210+
Setting this to False will disable the GraphQL API.
211+
212+
---
213+
198214
## HTTP_PROXIES
199215

200216
Default: None
@@ -271,7 +287,7 @@ Note that enabling this setting causes NetBox to update a user's session in the
271287

272288
Default: False
273289

274-
Setting this to True will permit only authenticated users to access any part of NetBox. By default, anonymous users are permitted to access most data in NetBox (excluding secrets) but not make any changes.
290+
Setting this to True will permit only authenticated users to access any part of NetBox. By default, anonymous users are permitted to access most data in NetBox but not make any changes.
275291

276292
---
277293

@@ -482,19 +498,11 @@ When remote user authentication is in use, this is the name of the HTTP header w
482498

483499
---
484500

485-
## RELEASE_CHECK_TIMEOUT
486-
487-
Default: 86,400 (24 hours)
488-
489-
The number of seconds to retain the latest version that is fetched from the GitHub API before automatically invalidating it and fetching it from the API again. This must be set to at least one hour (3600 seconds).
490-
491-
---
492-
493501
## RELEASE_CHECK_URL
494502

495503
Default: None (disabled)
496504

497-
This parameter defines the URL of the repository that will be checked periodically for new NetBox releases. When a new release is detected, a message will be displayed to administrative users on the home page. This can be set to the official repository (`'https://api.github.com/repos/netbox-community/netbox/releases'`) or a custom fork. Set this to `None` to disable automatic update checks.
505+
This parameter defines the URL of the repository that will be checked for new NetBox releases. When a new release is detected, a message will be displayed to administrative users on the home page. This can be set to the official repository (`'https://api.github.com/repos/netbox-community/netbox/releases'`) or a custom fork. Set this to `None` to disable automatic update checks.
498506

499507
!!! note
500508
The URL provided **must** be compatible with the [GitHub REST API](https://docs.github.com/en/rest).
@@ -505,7 +513,7 @@ This parameter defines the URL of the repository that will be checked periodical
505513

506514
Default: `$INSTALL_ROOT/netbox/reports/`
507515

508-
The file path to the location where custom reports will be kept. By default, this is the `netbox/reports/` directory within the base NetBox installation path.
516+
The file path to the location where [custom reports](../customization/reports.md) will be kept. By default, this is the `netbox/reports/` directory within the base NetBox installation path.
509517

510518
---
511519

@@ -521,7 +529,7 @@ The maximum execution time of a background task (such as running a custom script
521529

522530
Default: `$INSTALL_ROOT/netbox/scripts/`
523531

524-
The file path to the location where custom scripts will be kept. By default, this is the `netbox/scripts/` directory within the base NetBox installation path.
532+
The file path to the location where [custom scripts](../customization/custom-scripts.md) will be kept. By default, this is the `netbox/scripts/` directory within the base NetBox installation path.
525533

526534
---
527535

docs/core-functionality/ipam.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
---
1212

13+
{!docs/models/ipam/iprange.md!}
1314
{!docs/models/ipam/ipaddress.md!}
1415

1516
---

docs/core-functionality/secrets.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

docs/additional-features/custom-fields.md renamed to docs/customization/custom-fields.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ Within the database, custom fields are stored as JSON data directly alongside ea
88

99
## Creating Custom Fields
1010

11-
Custom fields must be created through the admin UI under Extras > Custom Fields. NetBox supports six types of custom field:
11+
Custom fields may be created by navigating to Customization > Custom Fields. NetBox supports six types of custom field:
1212

1313
* Text: Free-form text (up to 255 characters)
1414
* Integer: A whole number (positive or negative)

docs/additional-features/custom-links.md renamed to docs/customization/custom-links.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
# Custom Links
22

3-
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 of NetBox. For example, you might create a custom link on the device view which links to the current device in a network monitoring system.
3+
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.
44

5-
Custom links are created under the admin UI. Each link is associated with a particular NetBox object type (site, device, prefix, etc.) and will be displayed on relevant views. Each link is assigned text and a URL, both of which support Jinja2 templating. The text and URL are rendered with the context variable `obj` representing the current object.
5+
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 is assigned text and a URL, both of which support Jinja2 templating. The text and URL are rendered with the context variable `obj` representing the current object.
66

77
For example, you might define a link like this:
88

@@ -15,7 +15,7 @@ When viewing a device named Router4, this link would render as:
1515
<a href="https://nms.example.com/nodes/?name=Router4">View NMS</a>
1616
```
1717

18-
Custom links appear as buttons at the top right corner of the page. Numeric weighting can be used to influence the ordering of links.
18+
Custom links appear as buttons in the top right corner of the page. Numeric weighting can be used to influence the ordering of links.
1919

2020
!!! warning
2121
Custom links rely on user-created code to generate arbitrary HTML output, which may be dangerous. Only grant permission to create or modify custom links to trusted users.

0 commit comments

Comments
 (0)