Skip to content

Commit f26227e

Browse files
Merge pull request #6180 from netbox-community/develop
Release v2.11.0
2 parents 6c1c695 + c002501 commit f26227e

File tree

353 files changed

+14600
-6991
lines changed

Some content is hidden

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

353 files changed

+14600
-6991
lines changed

base_requirements.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,3 +93,7 @@ redis
9393
# SVG image rendering (used for rack elevations)
9494
# https://github.com/mozman/svgwrite
9595
svgwrite
96+
97+
# Tabular dataset library (for table-based exports)
98+
# https://github.com/jazzband/tablib
99+
tablib

docs/additional-features/change-logging.md

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

3-
Every time an object in NetBox is created, updated, or deleted, a serialized copy of that object 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.
3+
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.
44

55
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.
66

docs/additional-features/custom-fields.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ Custom fields must be created through the admin UI under Extras > Custom Fields.
1616
* Date: A date in ISO 8601 format (YYYY-MM-DD)
1717
* URL: This will be presented as a link in the web UI
1818
* Selection: A selection of one of several pre-defined custom choices
19+
* Multiple selection: A selection field which supports the assignment of multiple values
1920

2021
Each custom field must have a name; this should be a simple database-friendly string, e.g. `tps_report`. You may also assign a corresponding human-friendly label (e.g. "TPS report"); the label will be displayed on web forms. A weight is also required: Higher-weight fields will be ordered lower within a form. (The default weight is 100.) If a description is provided, it will appear beneath the field in a form.
2122

@@ -37,7 +38,7 @@ NetBox supports limited custom validation for custom field values. Following are
3738

3839
Each custom selection field must have at least two choices. These are specified as a comma-separated list. Choices appear in forms in the order they are listed. Note that choice values are saved exactly as they appear, so it's best to avoid superfluous punctuation or symbols where possible.
3940

40-
If a default value is specified for a selection field, it must exactly match one of the provided choices.
41+
If a default value is specified for a selection field, it must exactly match one of the provided choices. The value of a multiple selection field will always return a list, even if only one value is selected.
4142

4243
## Custom Fields in Templates
4344

docs/additional-features/custom-scripts.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,13 @@ Similar to `ChoiceVar`, but allows for the selection of multiple choices.
170170
A particular object within NetBox. Each ObjectVar must specify a particular model, and allows the user to select one of the available instances. ObjectVar accepts several arguments, listed below.
171171

172172
* `model` - The model class
173-
* `display_field` - The name of the REST API object field to display in the selection list (default: `'name'`)
173+
* `display_field` - The name of the REST API object field to display in the selection list (default: `'display'`)
174174
* `query_params` - A dictionary of query parameters to use when retrieving available options (optional)
175175
* `null_option` - A label representing a "null" or empty choice (optional)
176176

177-
The `display_field` argument is useful when referencing a model which does not have a `name` field. For example, when displaying a list of device types, you would likely use the `model` field:
178-
179-
```python
180-
device_type = ObjectVar(
181-
model=DeviceType,
182-
display_field='model'
183-
)
184-
```
177+
!!! warning
178+
The `display_field` parameter is now deprecated, and will be removed in NetBox v2.12. All ObjectVar instances will
179+
instead use the new standard `display` field for all serializers (introduced in NetBox v2.11).
185180

186181
To limit the selections available within the list, additional query parameters can be passed as the `query_params` dictionary. For example, to show only devices with an "active" status:
187182

docs/additional-features/export-templates.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22

33
NetBox allows users to define custom templates that can be used when exporting objects. To create an export template, navigate to Extras > Export Templates under the admin interface.
44

5-
Each export template is associated with a certain type of object. For instance, if you create an export template for VLANs, your custom template will appear under the "Export" button on the VLANs list.
5+
Each export template is associated with a certain type of object. For instance, if you create an export template for VLANs, your custom template will appear under the "Export" button on the VLANs list. Each export template must have a name, and may optionally designate a specific export [MIME type](https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types) and/or file extension.
6+
7+
!!! note
8+
The name `table` is reserved for internal use.
69

710
Export templates must be written in [Jinja2](https://jinja.palletsprojects.com/).
811

@@ -26,6 +29,8 @@ If you need to use the config context data in an export template, you'll should
2629
{% endfor %}
2730
```
2831

32+
The `as_attachment` attribute of an export template controls its behavior when rendered. If true, the rendered content will be returned to the user as a downloadable file. If false, it will be displayed within the browser. (This may be handy e.g. for generating HTML content.)
33+
2934
A MIME type and file extension can optionally be defined for each export template. The default MIME type is `text/plain`.
3035

3136
## Example
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Journaling
2+
3+
All primary objects in NetBox support journaling. A journal is a collection of human-generated notes and comments about an object maintained for historical context. It supplements NetBox's change log to provide additional information about why changes have been made or to convey events which occur outside NetBox. Unlike the change log, in which records typically expire after a configurable period of time, journal entries persist for the life of their associated object.
4+
5+
Each journal entry has a selectable kind (info, success, warning, or danger) and a user-populated `comments` field. Each entry automatically records the date, time, and associated user upon being created.

docs/additional-features/webhooks.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ The following data is available as context for Jinja2 templates:
3838
* `timestamp` - The time at which the event occurred (in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format).
3939
* `username` - The name of the user account associated with the change.
4040
* `request_id` - The unique request ID. This may be used to correlate multiple changes associated with a single request.
41-
* `data` - A serialized representation of the object _after_ the change was made. This is typically equivalent to the model's representation in NetBox's REST API.
41+
* `data` - A detailed representation of the object in its current state. This is typically equivalent to the model's representation in NetBox's REST API.
42+
* `snapshots` - Minimal "snapshots" of the object state both before and after the change was made; provided ass a dictionary with keys named `prechange` and `postchange`. These are not as extensive as the fully serialized representation, but contain enough information to convey what has changed.
4243

4344
### Default Request Body
4445

@@ -47,7 +48,7 @@ If no body template is specified, the request body will be populated with a JSON
4748
```no-highlight
4849
{
4950
"event": "created",
50-
"timestamp": "2020-02-25 15:10:26.010582+00:00",
51+
"timestamp": "2021-03-09 17:55:33.968016+00:00",
5152
"model": "site",
5253
"username": "jstretch",
5354
"request_id": "fdbca812-3142-4783-b364-2e2bd5c16c6a",
@@ -62,6 +63,17 @@ If no body template is specified, the request body will be populated with a JSON
6263
},
6364
"region": null,
6465
...
66+
},
67+
"snapshots": {
68+
"prechange": null,
69+
"postchange": {
70+
"created": "2021-03-09",
71+
"last_updated": "2021-03-09T17:55:33.851Z",
72+
"name": "Site 1",
73+
"slug": "site-1",
74+
"status": "active",
75+
...
76+
}
6577
}
6678
}
6779
```

docs/core-functionality/circuits.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Circuits
22

33
{!docs/models/circuits/provider.md!}
4+
{!docs/models/circuits/providernetwork.md!}
45

56
---
67

docs/core-functionality/devices.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
## Device Components
1010

11+
Device components represent discrete objects within a device which are used to terminate cables, house child devices, or track resources.
12+
1113
{!docs/models/dcim/consoleport.md!}
1214
{!docs/models/dcim/consoleserverport.md!}
1315
{!docs/models/dcim/powerport.md!}
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# Sites and Racks
22

3-
{!docs/models/dcim/site.md!}
43
{!docs/models/dcim/region.md!}
4+
{!docs/models/dcim/sitegroup.md!}
5+
{!docs/models/dcim/site.md!}
6+
{!docs/models/dcim/location.md!}
57

68
---
79

810
{!docs/models/dcim/rack.md!}
9-
{!docs/models/dcim/rackgroup.md!}
1011
{!docs/models/dcim/rackrole.md!}
1112
{!docs/models/dcim/rackreservation.md!}

docs/development/models.md

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
# NetBox Models
2+
3+
## Model Types
4+
5+
A NetBox model represents a discrete object type such as a device or IP address. Each model is defined as a Python class and has its own SQL table. All NetBox data models can be categorized by type.
6+
7+
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`).
8+
9+
### Features Matrix
10+
11+
* [Change logging](../additional-features/change-logging.md) - Changes to these objects are automatically recorded in the change log
12+
* [Webhooks](../additional-features/webhooks.md) - NetBox is capable of generating outgoing webhooks for these objects
13+
* [Custom fields](../additional-features/custom-fields.md) - These models support the addition of user-defined fields
14+
* [Export templates](../additional-features/export-templates.md) - Users can create custom export templates for these models
15+
* [Tagging](../models/extras/tag.md) - The models can be tagged with user-defined tags
16+
* [Journaling](../additional-features/journaling.md) - These models support persistent historical commentary
17+
* Nesting - These models can be nested recursively to create a hierarchy
18+
19+
| Type | Change Logging | Webhooks | Custom Fields | Export Templates | Tags | Journaling | Nesting |
20+
| ------------------ | ---------------- | ---------------- | ---------------- | ---------------- | ---------------- | ---------------- | ---------------- |
21+
| Primary | :material-check: | :material-check: | :material-check: | :material-check: | :material-check: | :material-check: | |
22+
| Organizational | :material-check: | :material-check: | :material-check: | :material-check: | | | |
23+
| Nested Group | :material-check: | :material-check: | :material-check: | :material-check: | | | :material-check: |
24+
| Component | :material-check: | :material-check: | :material-check: | :material-check: | :material-check: | | |
25+
| Component Template | :material-check: | :material-check: | :material-check: | | | | |
26+
27+
## Models Index
28+
29+
### Primary Models
30+
31+
* [circuits.Circuit](../models/circuits/circuit.md)
32+
* [circuits.Provider](../models/circuits/provider.md)
33+
* [circuits.ProviderNetwork](../models/circuits/providernetwork.md)
34+
* [dcim.Cable](../models/dcim/cable.md)
35+
* [dcim.Device](../models/dcim/device.md)
36+
* [dcim.DeviceType](../models/dcim/devicetype.md)
37+
* [dcim.PowerFeed](../models/dcim/powerfeed.md)
38+
* [dcim.PowerPanel](../models/dcim/powerpanel.md)
39+
* [dcim.Rack](../models/dcim/rack.md)
40+
* [dcim.RackReservation](../models/dcim/rackreservation.md)
41+
* [dcim.Site](../models/dcim/site.md)
42+
* [dcim.VirtualChassis](../models/dcim/virtualchassis.md)
43+
* [ipam.Aggregate](../models/ipam/aggregate.md)
44+
* [ipam.IPAddress](../models/ipam/ipaddress.md)
45+
* [ipam.Prefix](../models/ipam/prefix.md)
46+
* [ipam.RouteTarget](../models/ipam/routetarget.md)
47+
* [ipam.Service](../models/ipam/service.md)
48+
* [ipam.VLAN](../models/ipam/vlan.md)
49+
* [ipam.VRF](../models/ipam/vrf.md)
50+
* [secrets.Secret](../models/secrets/secret.md)
51+
* [tenancy.Tenant](../models/tenancy/tenant.md)
52+
* [virtualization.Cluster](../models/virtualization/cluster.md)
53+
* [virtualization.VirtualMachine](../models/virtualization/virtualmachine.md)
54+
55+
### Organizational Models
56+
57+
* [circuits.CircuitType](../models/circuits/circuittype.md)
58+
* [dcim.DeviceRole](../models/dcim/devicerole.md)
59+
* [dcim.Manufacturer](../models/dcim/manufacturer.md)
60+
* [dcim.Platform](../models/dcim/platform.md)
61+
* [dcim.RackRole](../models/dcim/rackrole.md)
62+
* [ipam.RIR](../models/ipam/rir.md)
63+
* [ipam.Role](../models/ipam/role.md)
64+
* [ipam.VLANGroup](../models/ipam/vlangroup.md)
65+
* [secrets.SecretRole](../models/secrets/secretrole.md)
66+
* [virtualization.ClusterGroup](../models/virtualization/clustergroup.md)
67+
* [virtualization.ClusterType](../models/virtualization/clustertype.md)
68+
69+
### Nested Group Models
70+
71+
* [dcim.Location](../models/dcim/location.md) (formerly RackGroup)
72+
* [dcim.Region](../models/dcim/region.md)
73+
* [dcim.SiteGroup](../models/dcim/sitegroup.md)
74+
* [tenancy.TenantGroup](../models/tenancy/tenantgroup.md)
75+
76+
### Component Models
77+
78+
* [dcim.ConsolePort](../models/dcim/consoleport.md)
79+
* [dcim.ConsoleServerPort](../models/dcim/consoleserverport.md)
80+
* [dcim.DeviceBay](../models/dcim/devicebay.md)
81+
* [dcim.FrontPort](../models/dcim/frontport.md)
82+
* [dcim.Interface](../models/dcim/interface.md)
83+
* [dcim.InventoryItem](../models/dcim/inventoryitem.md)
84+
* [dcim.PowerOutlet](../models/dcim/poweroutlet.md)
85+
* [dcim.PowerPort](../models/dcim/powerport.md)
86+
* [dcim.RearPort](../models/dcim/rearport.md)
87+
* [virtualization.VMInterface](../models/virtualization/vminterface.md)
88+
89+
### Component Template Models
90+
91+
* [dcim.ConsolePortTemplate](../models/dcim/consoleporttemplate.md)
92+
* [dcim.ConsoleServerPortTemplate](../models/dcim/consoleserverporttemplate.md)
93+
* [dcim.DeviceBayTemplate](../models/dcim/devicebaytemplate.md)
94+
* [dcim.FrontPortTemplate](../models/dcim/frontporttemplate.md)
95+
* [dcim.InterfaceTemplate](../models/dcim/interfacetemplate.md)
96+
* [dcim.PowerOutletTemplate](../models/dcim/poweroutlettemplate.md)
97+
* [dcim.PowerPortTemplate](../models/dcim/powerporttemplate.md)
98+
* [dcim.RearPortTemplate](../models/dcim/rearporttemplate.md)

docs/installation/1-postgresql.md

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -7,32 +7,31 @@ This section entails the installation and configuration of a local PostgreSQL da
77

88
## Installation
99

10-
#### Ubuntu
10+
=== "Ubuntu"
1111

12-
Install the PostgreSQL server and client development libraries using `apt`.
12+
```no-highlight
13+
sudo apt update
14+
sudo apt install -y postgresql libpq-dev
15+
```
1316

14-
```no-highlight
15-
sudo apt update
16-
sudo apt install -y postgresql libpq-dev
17-
```
17+
=== "CentOS"
1818

19-
#### CentOS
19+
```no-highlight
20+
sudo yum install -y postgresql-server libpq-devel
21+
sudo postgresql-setup --initdb
22+
```
2023

21-
PostgreSQL 9.6 and later are available natively on CentOS 8.2. If using an earlier CentOS release, you may need to [install it from an RPM](https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/).
24+
!!! info
25+
PostgreSQL 9.6 and later are available natively on CentOS 8.2. If using an earlier CentOS release, you may need to [install it from an RPM](https://download.postgresql.org/pub/repos/yum/reporpms/EL-7-x86_64/).
2226

23-
```no-highlight
24-
sudo yum install -y postgresql-server libpq-devel
25-
sudo postgresql-setup --initdb
26-
```
27+
CentOS configures ident host-based authentication for PostgreSQL by default. Because NetBox will need to authenticate using a username and password, modify `/var/lib/pgsql/data/pg_hba.conf` to support MD5 authentication by changing `ident` to `md5` for the lines below:
2728

28-
CentOS configures ident host-based authentication for PostgreSQL by default. Because NetBox will need to authenticate using a username and password, modify `/var/lib/pgsql/data/pg_hba.conf` to support MD5 authentication by changing `ident` to `md5` for the lines below:
29-
30-
```no-highlight
31-
host all all 127.0.0.1/32 md5
32-
host all all ::1/128 md5
33-
```
29+
```no-highlight
30+
host all all 127.0.0.1/32 md5
31+
host all all ::1/128 md5
32+
```
3433

35-
Then, start the service and enable it to run at boot:
34+
Once PostgreSQL has been installed, start the service and enable it to run at boot:
3635

3736
```no-highlight
3837
sudo systemctl start postgresql

docs/installation/2-redis.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,19 @@
77
!!! note
88
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.
99

10-
### Ubuntu
10+
=== "Ubuntu"
1111

12-
```no-highlight
13-
sudo apt install -y redis-server
14-
```
12+
```no-highlight
13+
sudo apt install -y redis-server
14+
```
1515

16-
### CentOS
16+
=== "CentOS"
1717

18-
```no-highlight
19-
sudo yum install -y redis
20-
sudo systemctl start redis
21-
sudo systemctl enable redis
22-
```
18+
```no-highlight
19+
sudo yum install -y redis
20+
sudo systemctl start redis
21+
sudo systemctl enable redis
22+
```
2323

2424
You may wish to modify the Redis configuration at `/etc/redis.conf` or `/etc/redis/redis.conf`, however in most cases the default configuration is sufficient.
2525

0 commit comments

Comments
 (0)