Skip to content

Release v3.1.2 #8123

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 69 commits into from
Dec 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
0edf9b1
Closes #7665 add new boolen for filtering assigned prefixes, adjust c…
Nov 13, 2021
641a9bc
pep8 compliance
Nov 13, 2021
80048bf
Make the same changes for aggregate views as these use the same adjus…
Nov 13, 2021
dcfd332
Moved filtering logic to utils, adjusted show buttons
Dec 1, 2021
ca07a88
fix spelling...
Dec 1, 2021
aebfccf
Merge branch 'develop' into develop
WillIrvine Dec 6, 2021
13414dc
pep8 compliance...
WillIrvine Dec 6, 2021
cc50e22
feat: add 6GHz & 60Ghz channels
joni1993 Dec 7, 2021
e9549ab
PRVB
jeremystretch Dec 13, 2021
5d6158d
Merge pull request #7826 from WillIrvine/develop
jeremystretch Dec 13, 2021
b6d93b7
Changelog for #7665
jeremystretch Dec 13, 2021
afc866e
#7665: Refactored add_requested_prefixes(); removed button icons
jeremystretch Dec 13, 2021
dc1331e
Fixes #7674: Fix inadvertent application of device type context to vi…
jeremystretch Dec 13, 2021
c50dc1e
Standardize usage of table template
jeremystretch Dec 13, 2021
91f33d3
#8057: Enable dynamic tables for object list views
jeremystretch Dec 13, 2021
5c34a75
Enable HTMX for quick table search
jeremystretch Dec 14, 2021
6dd6094
Push HTMX URL to browser location
jeremystretch Dec 14, 2021
414d33e
Refactor HTMX table template
jeremystretch Dec 14, 2021
491eac1
Enable HTMX for connections lists
jeremystretch Dec 14, 2021
af6f0db
Introduce ObjectChildrenView
jeremystretch Dec 14, 2021
cfdb985
Update prefix children views to use ObjectChildrenView
jeremystretch Dec 14, 2021
8d3b296
Update device/VM component views to use ObjectChildrenView
jeremystretch Dec 14, 2021
5ce0807
Update IPRange IP addresses view to use ObjectChildrenView
jeremystretch Dec 14, 2021
c795068
Update VLAN member interface views to use ObjectChildrenView
jeremystretch Dec 14, 2021
59ee30f
Update cluster VM/device views to use ObjectChildrenView
jeremystretch Dec 14, 2021
402136d
Merge branch '8069-generic-children-view' into 8057-htmx-tables
jeremystretch Dec 14, 2021
001c7e4
Merge pull request #8070 from netbox-community/8069-generic-children-…
jeremystretch Dec 14, 2021
4ffa823
Enable HTMX for all ObjectChildrenViews
jeremystretch Dec 14, 2021
c981b5c
Add prep_table_data() method to ObjectChildrenView
jeremystretch Dec 14, 2021
9a53c22
Serve HTMX JS locally
jeremystretch Dec 14, 2021
85b10b5
Introduce child prefixes view for aggregates
jeremystretch Dec 14, 2021
8ed79d5
Remove obsolete templates
jeremystretch Dec 14, 2021
d1e8c06
Fixes #8074: Ordering VMs by name should reference naturalized value
jeremystretch Dec 14, 2021
298fb00
Remove obsolete "quick find" TS
jeremystretch Dec 15, 2021
863fb9a
Sync HTMX and non-HTMX paginator styles
jeremystretch Dec 15, 2021
0e50c96
Remove obsolete pagination TS/CSS
jeremystretch Dec 15, 2021
cdc73d4
Closes #8080: Link to NAT IPs for device/VM primary IPs
jeremystretch Dec 15, 2021
305d88e
Fixes #8079: Fix validation of LLDP neighbors when connected device h…
jeremystretch Dec 15, 2021
b6ff553
Fixes #8078: Add missing wireless models to lsmodels() in nbshell
jeremystretch Dec 15, 2021
b92e345
Fixes #8077: Fix exception when attaching image to location, circuit,…
jeremystretch Dec 15, 2021
57d3bfc
Merge pull request #8073 from netbox-community/8057-htmx-tables
jeremystretch Dec 15, 2021
fee2ac2
Changelog for #8057
jeremystretch Dec 15, 2021
3699f16
Show per-page selector only when results are present
jeremystretch Dec 15, 2021
ff9dde5
Ensure consistent placement of table paginator
jeremystretch Dec 15, 2021
f43ec7c
Add "add IP range" button to prefix IP ranges view
jeremystretch Dec 15, 2021
8dbd3f3
Closes #8081: Allow creating services directly from navigation menu
jeremystretch Dec 15, 2021
fcc7207
Restore actions column under VM interfaces table
jeremystretch Dec 15, 2021
044e203
Standardize button colors
jeremystretch Dec 15, 2021
806706c
Refresh development documentation
jeremystretch Dec 15, 2021
8d06908
Bulk component add view should use tabs
jeremystretch Dec 15, 2021
fd785fc
Move speed select dropdown menu to widget template
jeremystretch Dec 16, 2021
68eb6fc
fix: use center freq instead of beginning of freq range for 6Ghz
joni1993 Dec 16, 2021
7735a53
Fixes #8088: Improve legibility of text in labels with light-colored …
jeremystretch Dec 16, 2021
cab07c7
fix: non 20Mhz-wide channel centers
joni1993 Dec 16, 2021
cf4a55b
Closes #8107: Correct template name
jeremystretch Dec 18, 2021
628e186
Closes #8108: Improve breadcrumb links for device/VM components
jeremystretch Dec 18, 2021
b00eeb8
Fixes #8096: Fix DataError during change logging of objects with very…
jeremystretch Dec 18, 2021
2db82a7
#8096: Include only first assigned IP in FHRPGroup string representation
jeremystretch Dec 18, 2021
4723500
Fixes #8092: Rack elevations should not include device asset tags
jeremystretch Dec 18, 2021
85f9690
Closes #8083: Removed "related devices" panel from device view
jeremystretch Dec 18, 2021
7b23856
templates: add an opaque icon for mobile home screens
bonktree Dec 17, 2021
14fc37a
Closes #7661: Remove forced styling of custom banners
jeremystretch Dec 19, 2021
82932ae
Fixes #8102 - Add validation around assigned objects
DanSheps Dec 20, 2021
f95e510
Fixes #8102: Raise validation error when attempting to assign an IP a…
jeremystretch Dec 20, 2021
e12da72
Fixes #8101: Preserve return URL when using "create and add another" …
jeremystretch Dec 20, 2021
4a3bc8d
Merge pull request #8111 from bonktree/opaque-icon
jeremystretch Dec 20, 2021
892d6b5
Merge pull request #8000 from joni1993/more-channels
jeremystretch Dec 20, 2021
b8b485a
Changelog & PEP8 cleanup for #7999
jeremystretch Dec 20, 2021
df4f80e
Release v3.1.2
jeremystretch Dec 20, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ body:
attributes:
label: NetBox version
description: What version of NetBox are you currently running?
placeholder: v3.1.1
placeholder: v3.1.2
validations:
required: true
- type: dropdown
Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/feature_request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ body:
attributes:
label: NetBox version
description: What version of NetBox are you currently running?
placeholder: v3.1.1
placeholder: v3.1.2
validations:
required: true
- type: dropdown
Expand Down
14 changes: 6 additions & 8 deletions docs/development/adding-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ Models within each app are stored in either `models.py` or within a submodule un

Each model should define, at a minimum:

* A `Meta` class specifying a deterministic ordering (if ordered by fields other than the primary ID)
* A `__str__()` method returning a user-friendly string representation of the instance
* A `get_absolute_url()` method returning an instance's direct URL (using `reverse()`)
* A `Meta` class specifying a deterministic ordering (if ordered by fields other than the primary ID)

## 2. Define field choices

If the model has one or more fields with static choices, define those choices in `choices.py` by subclassing `utilities.choices.ChoiceSet`.

## 3. Generate database migrations

Once your model definition is complete, generate database migrations by running `manage.py -n $NAME --no-header`. Always specify a short unique name when generating migrations.
Once your model definition is complete, generate database migrations by running `manage.py makemigrations -n $NAME --no-header`. Always specify a short unique name when generating migrations.

!!! info
!!! info "Configuration Required"
Set `DEVELOPER = True` in your NetBox configuration to enable the creation of new migrations.

## 4. Add all standard views
Expand All @@ -41,9 +41,7 @@ Add the relevant URL path for each view created in the previous step to `urls.py

Each model should have a corresponding FilterSet class defined. This is used to filter UI and API queries. Subclass the appropriate class from `netbox.filtersets` that matches the model's parent class.

Every model FilterSet should define a `q` filter to support general search queries.

## 7. Create the table
## 7. Create the table class

Create a table class for the model in `tables.py` by subclassing `utilities.tables.BaseTable`. Under the table's `Meta` class, be sure to list both the fields and default columns.

Expand All @@ -53,7 +51,7 @@ Create the HTML template for the object view. (The other views each typically em

## 9. Add the model to the navigation menu

For NetBox releases prior to v3.0, add the relevant link(s) to the navigation menu template. For later releases, add the relevant items in `netbox/netbox/navigation_menu.py`.
Add the relevant navigation menu items in `netbox/netbox/navigation_menu.py`.

## 10. REST API components

Expand All @@ -64,7 +62,7 @@ Create the following for each model:
* API view in `api/views.py`
* Endpoint route in `api/urls.py`

## 11. GraphQL API components (v3.0+)
## 11. GraphQL API components

Create a Graphene object type for the model in `graphql/types.py` by subclassing the appropriate class from `netbox.graphql.types`.

Expand Down
15 changes: 7 additions & 8 deletions docs/development/extending-models.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ Below is a list of tasks to consider when adding a new field to a core model.

## 1. Generate and run database migrations

Django migrations are used to express changes to the database schema. In most cases, Django can generate these automatically, however very complex changes may require manual intervention. Always remember to specify a short but descriptive name when generating a new migration.
[Django migrations](https://docs.djangoproject.com/en/stable/topics/migrations/) are used to express changes to the database schema. In most cases, Django can generate these automatically, however very complex changes may require manual intervention. Always remember to specify a short but descriptive name when generating a new migration.

```
./manage.py makemigrations <app> -n <name>
./manage.py migrate
```

Where possible, try to merge related changes into a single migration. For example, if three new fields are being added to different models within an app, these can be expressed in the same migration. You can merge a new migration with an existing one by combining their `operations` lists.
Where possible, try to merge related changes into a single migration. For example, if three new fields are being added to different models within an app, these can be expressed in a single migration. You can merge a newly generated migration with an existing one by combining their `operations` lists.

!!! note
!!! warning "Do not alter existing migrations"
Migrations can only be merged within a release. Once a new release has been published, its migrations cannot be altered (other than for the purpose of correcting a bug).

## 2. Add validation logic to `clean()`
Expand All @@ -24,7 +24,6 @@ If the new field introduces additional validation requirements (beyond what's in
class Foo(models.Model):

def clean(self):

super().clean()

# Custom validation goes here
Expand All @@ -40,9 +39,9 @@ If you're adding a relational field (e.g. `ForeignKey`) and intend to include th

Extend the model's API serializer in `<app>.api.serializers` to include the new field. In most cases, it will not be necessary to also extend the nested serializer, which produces a minimal representation of the model.

## 5. Add field to forms
## 5. Add fields to forms

Extend any forms to include the new field as appropriate. Common forms include:
Extend any forms to include the new field(s) as appropriate. These are found under the `forms/` directory within each app. Common forms include:

* **Credit/edit** - Manipulating a single object
* **Bulk edit** - Performing a change on many objects at once
Expand All @@ -51,11 +50,11 @@ Extend any forms to include the new field as appropriate. Common forms include:

## 6. Extend object filter set

If the new field should be filterable, add it to the `FilterSet` for the model. If the field should be searchable, remember to reference it in the FilterSet's `search()` method.
If the new field should be filterable, add it to the `FilterSet` for the model. If the field should be searchable, remember to query it in the FilterSet's `search()` method.

## 7. Add column to object table

If the new field will be included in the object list view, add a column to the model's table. For simple fields, adding the field name to `Meta.fields` will be sufficient. More complex fields may require declaring a custom column.
If the new field will be included in the object list view, add a column to the model's table. For simple fields, adding the field name to `Meta.fields` will be sufficient. More complex fields may require declaring a custom column. Also add the field name to `default_columns` if the column should be present in the table by default.

## 8. Update the UI templates

Expand Down
27 changes: 19 additions & 8 deletions docs/development/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ The NetBox project utilizes three persistent git branches to track work:

Typically, you'll base pull requests off of the `develop` branch, or off of `feature` if you're working on a new major release. **Never** merge pull requests into the `master` branch, which receives merged only from the `develop` branch.

For example, assume that the current NetBox release is v3.1.1. Work applied to the `develop` branch will appear in v3.1.2, and work done under the `feature` branch will be included in the next minor release (v3.2.0).

### Enable Pre-Commit Hooks

NetBox ships with a [git pre-commit hook](https://githooks.com/) script that automatically checks for style compliance and missing database migrations prior to committing changes. This helps avoid erroneous commits that result in CI test failures. You are encouraged to enable it by creating a link to `scripts/git-hooks/pre-commit`:
Expand All @@ -46,7 +48,7 @@ $ ln -s ../../scripts/git-hooks/pre-commit

### Create a Python Virtual Environment

A [virtual environment](https://docs.python.org/3/tutorial/venv.html) is like a container for a set of Python packages. They allow you to build environments suited to specific projects without interfering with system packages or other projects. When installed per the documentation, NetBox uses a virtual environment in production.
A [virtual environment](https://docs.python.org/3/tutorial/venv.html) (or "venv" for short) is like a container for a set of Python packages. These allow you to build environments suited to specific projects without interfering with system packages or other projects. When installed per the documentation, NetBox uses a virtual environment in production.

Create a virtual environment using the `venv` Python module:

Expand All @@ -57,8 +59,8 @@ $ python3 -m venv ~/.venv/netbox

This will create a directory named `.venv/netbox/` in your home directory, which houses a virtual copy of the Python executable and its related libraries and tooling. When running NetBox for development, it will be run using the Python binary at `~/.venv/netbox/bin/python`.

!!! info
Keeping virtual environments in `~/.venv/` is a common convention but entirely optional: Virtual environments can be created wherever you please.
!!! info "Where to Create Your Virtual Environments"
Keeping virtual environments in `~/.venv/` is a common convention but entirely optional: Virtual environments can be created almost wherever you please.

Once created, activate the virtual environment:

Expand Down Expand Up @@ -94,7 +96,7 @@ Within the `netbox/netbox/` directory, copy `configuration.example.py` to `confi

### Start the Development Server

Django provides a lightweight, auto-updating HTTP/WSGI server for development use. NetBox extends this slightly to automatically import models and other utilities. Run the NetBox development server with the `nbshell` management command:
Django provides a lightweight, auto-updating HTTP/WSGI server for development use. It is started with the `runserver` management command:

```no-highlight
$ python netbox/manage.py runserver
Expand All @@ -109,9 +111,12 @@ Quit the server with CONTROL-C.

This ensures that your development environment is now complete and operational. Any changes you make to the code base will be automatically adapted by the development server.

!!! info "IDE Integration"
Some IDEs, such as PyCharm, will integrate with Django's development server and allow you to run it directly within the IDE. This is strongly encouraged as it makes for a much more convenient development environment.

## Running Tests

Throughout the course of development, it's a good idea to occasionally run NetBox's test suite to catch any potential errors. Tests are run using the `test` management command:
Prior to committing any substantial changes to the code base, be sure to run NetBox's test suite to catch any potential errors. Tests are run using the `test` management command. Remember to ensure the Python virtual environment is active before running this command.

```no-highlight
$ python netbox/manage.py test
Expand All @@ -123,9 +128,15 @@ In cases where you haven't made any changes to the database (which is most of th
$ python netbox/manage.py test --keepdb
```

You can also limit the command to running only a specific subset of tests. For example, to run only IPAM and DCIM view tests:

```no-highlight
$ python netbox/manage.py test dcim.tests.test_views ipam.tests.test_views
```

## Submitting Pull Requests

Once you're happy with your work and have verified that all tests pass, commit your changes and push it upstream to your fork. Always provide descriptive (but not excessively verbose) commit messages. When working on a specific issue, be sure to reference it.
Once you're happy with your work and have verified that all tests pass, commit your changes and push it upstream to your fork. Always provide descriptive (but not excessively verbose) commit messages. When working on a specific issue, be sure to prefix your commit message with the word "Fixes" or "Closes" and the issue number (with a hash mark). This tells GitHub to automatically close the referenced issue once the commit has been merged.

```no-highlight
$ git commit -m "Closes #1234: Add IPv5 support"
Expand All @@ -136,5 +147,5 @@ Once your fork has the new commit, submit a [pull request](https://github.com/ne

Once submitted, a maintainer will review your pull request and either merge it or request changes. If changes are needed, you can make them via new commits to your fork: The pull request will update automatically.

!!! note
Remember, pull requests are entertained only for **accepted** issues. If an issue you want to work on hasn't been approved by a maintainer yet, it's best to avoid risking your time and effort on a change that might not be accepted.
!!! note "Remember to Open an Issue First"
Remember, pull requests are permitted only for **accepted** issues. If an issue you want to work on hasn't been approved by a maintainer yet, it's best to avoid risking your time and effort on a change that might not be accepted. (The one exception to this is trivial changes to the documentation or other non-critical resources.)
13 changes: 8 additions & 5 deletions docs/development/index.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
# NetBox Development

NetBox is maintained as a [GitHub project](https://github.com/netbox-community/netbox) under the Apache 2 license. Users are encouraged to submit GitHub issues for feature requests and bug reports, however we are very selective about pull requests. Please see the `CONTRIBUTING` guide for more direction on contributing to NetBox.
NetBox is maintained as a [GitHub project](https://github.com/netbox-community/netbox) under the Apache 2 license. Users are encouraged to submit GitHub issues for feature requests and bug reports, however we are very selective about pull requests. Each pull request must be preceded by an **approved** issue. Please see the `CONTRIBUTING` guide for more direction on contributing to NetBox.

## Communication

There are several official forums for communication among the developers and community members:

* [GitHub issues](https://github.com/netbox-community/netbox/issues) - All feature requests, bug reports, and other substantial changes to the code base **must** be documented in an issue.
* [GitHub issues](https://github.com/netbox-community/netbox/issues) - All feature requests, bug reports, and other substantial changes to the code base **must** be documented in a GitHub issue.
* [GitHub Discussions](https://github.com/netbox-community/netbox/discussions) - The preferred forum for general discussion and support issues. Ideal for shaping a feature request prior to submitting an issue.
* [#netbox on NetDev Community Slack](https://netdev.chat/) - Good for quick chats. Avoid any discussion that might need to be referenced later on, as the chat history is not retained long.
* [Google Group](https://groups.google.com/g/netbox-discuss) - Legacy mailing list; slowly being phased out in favor of GitHub discussions.

## Governance

NetBox follows the [benevolent dictator](http://oss-watch.ac.uk/resources/benevolentdictatorgovernancemodel) model of governance, with [Jeremy Stretch](https://github.com/jeremystretch) ultimately responsible for all changes to the code base. While community contributions are welcomed and encouraged, the lead maintainer's primary role is to ensure the project's long-term maintainability and continued focus on its primary functions (in other words, avoid scope creep).
NetBox follows the [benevolent dictator](http://oss-watch.ac.uk/resources/benevolentdictatorgovernancemodel) model of governance, with [Jeremy Stretch](https://github.com/jeremystretch) ultimately responsible for all changes to the code base. While community contributions are welcomed and encouraged, the lead maintainer's primary role is to ensure the project's long-term maintainability and continued focus on its primary functions.

## Project Structure

All development of the current NetBox release occurs in the `develop` branch; releases are packaged from the `master` branch. The `master` branch should _always_ represent the current stable release in its entirety, such that installing NetBox by either downloading a packaged release or cloning the `master` branch provides the same code base.
All development of the current NetBox release occurs in the `develop` branch; releases are packaged from the `master` branch. The `master` branch should _always_ represent the current stable release in its entirety, such that installing NetBox by either downloading a packaged release or cloning the `master` branch provides the same code base. Only pull requests representing new releases should be merged into `master`.

NetBox components are arranged into functional subsections called _apps_ (a carryover from Django vernacular). Each app holds the models, views, and templates relevant to a particular function:
NetBox components are arranged into Django apps. Each app holds the models, views, and other resources relevant to a particular function:

* `circuits`: Communications circuits and providers (not to be confused with power circuits)
* `dcim`: Datacenter infrastructure management (sites, racks, and devices)
Expand All @@ -29,3 +29,6 @@ NetBox components are arranged into functional subsections called _apps_ (a carr
* `users`: Authentication and user preferences
* `utilities`: Resources which are not user-facing (extendable classes, etc.)
* `virtualization`: Virtual machines and clusters
* `wireless`: Wireless links and LANs

All core functionality is stored within the `netbox/` subdirectory. HTML templates are stored in a common `templates/` directory, with model- and view-specific templates arranged by app. Documentation is kept in the `docs/` root directory.
5 changes: 3 additions & 2 deletions docs/development/models.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ The Django [content types](https://docs.djangoproject.com/en/stable/ref/contrib/
* Nesting - These models can be nested recursively to create a hierarchy

| Type | Change Logging | Webhooks | Custom Fields | Export Templates | Tags | Journaling | Nesting |
| ------------------ | ---------------- | ---------------- | ---------------- | ---------------- | ---------------- | ---------------- | ---------------- |
| ------------------ | ---------------- | ---------------- |------------------| ---------------- | ---------------- | ---------------- | ---------------- |
| Primary | :material-check: | :material-check: | :material-check: | :material-check: | :material-check: | :material-check: | |
| Organizational | :material-check: | :material-check: | :material-check: | :material-check: | :material-check: | | |
| Nested Group | :material-check: | :material-check: | :material-check: | :material-check: | :material-check: | | :material-check: |
| Component | :material-check: | :material-check: | :material-check: | :material-check: | :material-check: | | |
| Component Template | :material-check: | :material-check: | :material-check: | | | | |
| Component Template | :material-check: | :material-check: | | | | | |

## Models Index

Expand All @@ -44,6 +44,7 @@ The Django [content types](https://docs.djangoproject.com/en/stable/ref/contrib/
* [ipam.ASN](../models/ipam/asn.md)
* [ipam.FHRPGroup](../models/ipam/fhrpgroup.md)
* [ipam.IPAddress](../models/ipam/ipaddress.md)
* [ipam.IPRange](../models/ipam/iprange.md)
* [ipam.Prefix](../models/ipam/prefix.md)
* [ipam.RouteTarget](../models/ipam/routetarget.md)
* [ipam.Service](../models/ipam/service.md)
Expand Down
Loading