Skip to content

Commit

Permalink
Merge pull request #2244 from digitalocean/develop
Browse files Browse the repository at this point in the history
Release v2.3.6
  • Loading branch information
jeremystretch authored Jul 16, 2018
2 parents 6159994 + 456b058 commit 09a0356
Show file tree
Hide file tree
Showing 13 changed files with 54 additions and 13 deletions.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
[ ] Feature request <!-- An enhancement of existing functionality -->
[ ] Bug report <!-- Unexpected or erroneous behavior -->
[ ] Documentation <!-- A modification to the documentation -->
[ ] Housekeeping <!-- Changes pertaining to the codebase itself -->

<!--
Please describe the environment in which you are running NetBox. (Be sure
Expand All @@ -31,7 +32,7 @@
-->
### Environment
* Python version: <!-- Example: 3.5.4 -->
* NetBox version: <!-- Example: 2.1.3 -->
* NetBox version: <!-- Example: 2.3.5 -->

<!--
BUG REPORTS must include:
Expand Down
25 changes: 25 additions & 0 deletions docs/api/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,28 @@ The maximum number of objects that can be returned is limited by the [`MAX_PAGE_

!!! warning
Disabling the page size limit introduces a potential for very resource-intensive requests, since one API request can effectively retrieve an entire table from the database.

# Filtering

A list of objects retrieved via the API can be filtered by passing one or more query parameters. The same parameters used by the web UI work for the API as well. For example, to return only prefixes with a status of "Active" (`1`):

```
GET /api/ipam/prefixes/?status=1
```

The same filter can be incldued multiple times. These will effect a logical OR and return objects matching any of the given values. For example, the following will return all active and reserved prefixes:

```
GET /api/ipam/prefixes/?status=1&status=2
```

## Custom Fields

To filter on a custom field, prepend `cf_` to the field name. For example, the following query will return only sites where a custom field named `foo` is equal to 123:

```
GET /api/dcim/sites/?cf_foo=123
```

!!! note
Full versus partial matching when filtering is configurable per custom field. Filtering can be toggled (or disabled) for a custom field in the admin UI.
2 changes: 2 additions & 0 deletions docs/data-model/dcim.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ A device type represents a particular hardware model that exists in the real wor

Device types are instantiated as devices installed within racks. For example, you might define a device type to represent a Juniper EX4300-48T network switch with 48 Ethernet interfaces. You can then create multiple devices of this type named "switch1," "switch2," and so on. Each device will inherit the components (such as interfaces) of its device type.

A device type can be a parent, child, or neither. Parent devices house child devices in device bays. This relationship is used to model things like blade servers, where child devices function independently but share physical resources like rack space and power. Note that this is **not** intended to model chassis-based devices, wherein child members share a common control plane.

### Manufacturers

Each device type belongs to one manufacturer; e.g. Cisco, Opengear, or APC. The model number of a device type must be unique to its manufacturer.
Expand Down
2 changes: 1 addition & 1 deletion docs/installation/ldap.md
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ AUTH_LDAP_USER_ATTR_MAP = {

# User Groups for Permissions
!!! info
When using Microsoft Active Directory, support for nested groups can be activated by using `NestedGroupOfNamesType()` instead of `GroupOfNamesType()` for `AUTH_LDAP_GROUP_TYPE`.
When using Microsoft Active Directory, support for nested groups can be activated by using `NestedGroupOfNamesType()` instead of `GroupOfNamesType()` for `AUTH_LDAP_GROUP_TYPE`. You will also need to modify the import line to use `NestedGroupOfNamesType` instead of `GroupOfNamesType` .

```python
from django_auth_ldap.config import LDAPSearch, GroupOfNamesType
Expand Down
6 changes: 3 additions & 3 deletions docs/miscellaneous/reports.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class DeviceIPsReport(Report):
Within each report class, we'll create a number of test methods to execute our report's logic. In DeviceConnectionsReport, for instance, we want to ensure that every live device has a console connection, an out-of-band management connection, and two power connections.

```
from dcim.constants import CONNECTION_STATUS_PLANNED, STATUS_ACTIVE
from dcim.constants import CONNECTION_STATUS_PLANNED, DEVICE_STATUS_ACTIVE
from dcim.models import ConsolePort, Device, PowerPort
from extras.reports import Report
Expand All @@ -43,7 +43,7 @@ class DeviceConnectionsReport(Report):
def test_console_connection(self):
# Check that every console port for every active device has a connection defined.
for console_port in ConsolePort.objects.select_related('device').filter(device__status=STATUS_ACTIVE):
for console_port in ConsolePort.objects.select_related('device').filter(device__status=DEVICE_STATUS_ACTIVE):
if console_port.cs_port is None:
self.log_failure(
console_port.device,
Expand All @@ -60,7 +60,7 @@ class DeviceConnectionsReport(Report):
def test_power_connections(self):
# Check that every active device has at least two connected power supplies.
for device in Device.objects.filter(status=STATUS_ACTIVE):
for device in Device.objects.filter(status=DEVICE_STATUS_ACTIVE):
connected_ports = 0
for power_port in PowerPort.objects.filter(device=device):
if power_port.power_outlet is not None:
Expand Down
5 changes: 3 additions & 2 deletions netbox/dcim/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -1780,8 +1780,9 @@ def __init__(self, *args, **kwargs):
if parent is not None:

# Add site VLANs
site_vlans = VLAN.objects.filter(site=parent.site, group=None).exclude(pk__in=assigned_vlans)
vlan_choices.append((parent.site.name, [(vlan.pk, vlan) for vlan in site_vlans]))
if parent.site:
site_vlans = VLAN.objects.filter(site=parent.site, group=None).exclude(pk__in=assigned_vlans)
vlan_choices.append((parent.site.name, [(vlan.pk, vlan) for vlan in site_vlans]))

# Add grouped site VLANs
for group in VLANGroup.objects.filter(site=parent.site):
Expand Down
2 changes: 1 addition & 1 deletion netbox/dcim/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2075,7 +2075,7 @@ class InventoryItemBulkDeleteView(PermissionRequiredMixin, BulkDeleteView):
#

class VirtualChassisListView(ObjectListView):
queryset = VirtualChassis.objects.annotate(member_count=Count('members'))
queryset = VirtualChassis.objects.select_related('master').annotate(member_count=Count('members'))
table = tables.VirtualChassisTable
filter = filters.VirtualChassisFilter
filter_form = forms.VirtualChassisFilterForm
Expand Down
1 change: 1 addition & 0 deletions netbox/netbox/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
('rack', 'Racks'),
('devicetype', 'Device types'),
('device', 'Devices'),
('virtualchassis', 'Virtual Chassis'),
)),
('IPAM', (
('vrf', 'VRFs'),
Expand Down
2 changes: 1 addition & 1 deletion netbox/netbox/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
DeprecationWarning
)

VERSION = '2.3.5'
VERSION = '2.3.6'

BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))

Expand Down
12 changes: 9 additions & 3 deletions netbox/netbox/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
from circuits.filters import CircuitFilter, ProviderFilter
from circuits.models import Circuit, Provider
from circuits.tables import CircuitTable, ProviderTable
from dcim.filters import DeviceFilter, DeviceTypeFilter, RackFilter, SiteFilter
from dcim.models import ConsolePort, Device, DeviceType, InterfaceConnection, PowerPort, Rack, Site
from dcim.tables import DeviceDetailTable, DeviceTypeTable, RackTable, SiteTable
from dcim.filters import DeviceFilter, DeviceTypeFilter, RackFilter, SiteFilter, VirtualChassisFilter
from dcim.models import ConsolePort, Device, DeviceType, InterfaceConnection, PowerPort, Rack, Site, VirtualChassis
from dcim.tables import DeviceDetailTable, DeviceTypeTable, RackTable, SiteTable, VirtualChassisTable
from extras.models import ReportResult, TopologyMap, UserAction
from ipam.filters import AggregateFilter, IPAddressFilter, PrefixFilter, VLANFilter, VRFFilter
from ipam.models import Aggregate, IPAddress, Prefix, VLAN, VRF
Expand Down Expand Up @@ -72,6 +72,12 @@
'table': DeviceDetailTable,
'url': 'dcim:device_list',
}),
('virtualchassis', {
'queryset': VirtualChassis.objects.select_related('master').annotate(member_count=Count('members')),
'filter': VirtualChassisFilter,
'table': VirtualChassisTable,
'url': 'dcim:virtualchassis_list',
}),
# IPAM
('vrf', {
'queryset': VRF.objects.select_related('tenant'),
Expand Down
1 change: 1 addition & 0 deletions netbox/templates/dcim/device.html
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@
<th class="pk"><input type="checkbox" class="toggle" title="Toggle all" /></th>
{% endif %}
<th>Name</th>
<th>Status</th>
<th colspan="2">Installed Device</th>
<th></th>
</tr>
Expand Down
4 changes: 4 additions & 0 deletions netbox/templates/dcim/inc/devicebay.html
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@
<i class="fa fa-fw fa-{% if devicebay.installed_device %}dot-circle-o{% else %}circle-o{% endif %}"></i> {{ devicebay.name }}
</td>
{% if devicebay.installed_device %}
<td>
<span class="label label-{{ devicebay.installed_device.get_status_class }}">{{ devicebay.installed_device.get_status_display }}</span>
</td>
<td>
<a href="{% url 'dcim:device' pk=devicebay.installed_device.pk %}">{{ devicebay.installed_device }}</a>
</td>
<td>
<span>{{ devicebay.installed_device.device_type.full_name }}</span>
</td>
{% else %}
<td></td>
<td colspan="2">
<span class="text-muted">Vacant</span>
</td>
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Django>=1.11,<2.0
django-cors-headers>=2.1.0
django-debug-toolbar>=1.9.0
django-filter>=1.1.0
django-filter==1.1.0
django-mptt>=0.9.0
django-tables2>=1.19.0
django-timezone-field>=2.0
Expand Down

0 comments on commit 09a0356

Please sign in to comment.