1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Closes #539: Implemented L4 services for devices

This commit is contained in:
Jeremy Stretch
2016-12-15 15:32:58 -05:00
parent 66fa877198
commit f02c222d4f
15 changed files with 268 additions and 12 deletions

View File

@@ -1,5 +1,6 @@
from django.conf.urls import url
from ipam.views import ServiceEditView
from secrets.views import secret_add
from . import views
@@ -104,6 +105,7 @@ urlpatterns = [
url(r'^devices/(?P<pk>\d+)/lldp-neighbors/$', views.device_lldp_neighbors, name='device_lldp_neighbors'),
url(r'^devices/(?P<pk>\d+)/ip-addresses/assign/$', views.ipaddress_assign, name='ipaddress_assign'),
url(r'^devices/(?P<pk>\d+)/add-secret/$', secret_add, name='device_addsecret'),
url(r'^devices/(?P<device>\d+)/services/assign/$', ServiceEditView.as_view(), name='service_assign'),
# Console ports
url(r'^devices/(?P<pk>\d+)/console-ports/add/$', views.consoleport_add, name='consoleport_add'),

View File

@@ -14,7 +14,7 @@ from django.shortcuts import get_object_or_404, redirect, render
from django.utils.http import urlencode
from django.views.generic import View
from ipam.models import Prefix, IPAddress, VLAN
from ipam.models import Prefix, IPAddress, Service, VLAN
from circuits.models import Circuit
from extras.models import Graph, TopologyMap, GRAPH_TYPE_INTERFACE, GRAPH_TYPE_SITE
from utilities.forms import ConfirmationForm
@@ -569,12 +569,11 @@ def device(request, pk):
key=attrgetter('name')
)
# Gather any secrets which belong to this device
secrets = device.secrets.all()
# Find all IP addresses assigned to this device
# Gather relevant device objects
ip_addresses = IPAddress.objects.filter(interface__device=device).select_related('interface', 'vrf')\
.order_by('address')
services = Service.objects.filter(device=device)
secrets = device.secrets.all()
# Find any related devices for convenient linking in the UI
related_devices = []
@@ -604,6 +603,7 @@ def device(request, pk):
'mgmt_interfaces': mgmt_interfaces,
'device_bays': device_bays,
'ip_addresses': ip_addresses,
'services': services,
'secrets': secrets,
'related_devices': related_devices,
'show_graphs': show_graphs,