diff --git a/Netdisco/Changes b/Netdisco/Changes index d24551b0..4534f702 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -1,5 +1,9 @@ 2.031006 - 2015-02-12 + [ENHANCEMENTS] + + * Avoid displaying all VLANs on device ports when there are 1000's + [BUG FIXES] * Fix headings on IP Inventory CSV report (J. Binks) diff --git a/Netdisco/lib/App/Netdisco/Manual/ReleaseNotes.pod b/Netdisco/lib/App/Netdisco/Manual/ReleaseNotes.pod index 4c5a2bc7..c0af216a 100644 --- a/Netdisco/lib/App/Netdisco/Manual/ReleaseNotes.pod +++ b/Netdisco/lib/App/Netdisco/Manual/ReleaseNotes.pod @@ -36,6 +36,15 @@ but they are backwards compatible. =back +=head1 2.031006 + +=head2 General Notices + +When displaying device ports, Netdisco will now avoid showing VLAN Membership +if it looks like there are a large number of VLANs on many ports. This is an +average of the VLANs per port, configurable in +. The default is 150. + =head1 2.031005 =head2 General Notices diff --git a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm index cd6636d4..112e6c7d 100644 --- a/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm +++ b/Netdisco/lib/App/Netdisco/Web/Plugin/Device/Ports.pm @@ -123,9 +123,16 @@ get '/ajax/content/device/ports' => require_login sub { # make sure query asks for formatted timestamps when needed $set = $set->with_times if param('c_lastchange'); - # get vlans on the port - $set = $set->search_rs({}, { prefetch => 'all_port_vlans' })->with_vlan_count - if param('c_vmember'); + # get vlans on the port, if there aren't too many + my $port_cnt = $device->ports->count() || 1; + my $vlan_cnt = $device->port_vlans->count() || 1; + my $vmember_ok = + (($vlan_cnt / $port_cnt) <= setting('deviceport_vlan_membership_threshold')); + + if ($vmember_ok) { + $set = $set->search_rs({}, { prefetch => 'all_port_vlans' })->with_vlan_count + if param('c_vmember'); + } # what kind of nodes are we interested in? my $nodes_name = (param('n_archived') ? 'nodes' : 'active_nodes'); @@ -165,6 +172,7 @@ get '/ajax/content/device/ports' => require_login sub { results => $results, nodes => $nodes_name, device => $device, + vmember_ok => $vmember_ok, }, { layout => undef }; } else { diff --git a/Netdisco/share/config.yml b/Netdisco/share/config.yml index 91b2ac9b..cbd061f9 100644 --- a/Netdisco/share/config.yml +++ b/Netdisco/share/config.yml @@ -86,6 +86,24 @@ table_pagesize: 10 table_showrecordsmenu: - [10, 25, 50, 100, '-1'] - [10, 25, 50, 100, 'All'] +vlanctl: true +portctl_nameonly: false +portctl_nophones: false +portctl_vlans: false +portctl_uplinks: false +port_control_reasons: + address: 'Address Allocation Abuse' + copyright: 'Copyright Violation' + dos: 'Denial of Service' + bandwidth: 'Excessive Bandwidth' + polling: 'Excessive Polling of DNS/DHCP/SNMP' + noserv: 'Not In Service' + exploit: 'Remote Exploit Possible' + compromised: 'System Compromised' + other: 'Other' + resolved: 'Issue Resolved' +check_userlog: true +deviceport_vlan_membership_threshold: 150 # ------------- # NETDISCO CORE @@ -157,23 +175,6 @@ ignore_interfaces: - '(E|T)\d \d\/\d\/\d' ignore_private_nets: false reverse_sysname: false -vlanctl: true -portctl_nameonly: false -portctl_nophones: false -portctl_vlans: false -portctl_uplinks: false -check_userlog: true -port_control_reasons: - address: 'Address Allocation Abuse' - copyright: 'Copyright Violation' - dos: 'Denial of Service' - bandwidth: 'Excessive Bandwidth' - polling: 'Excessive Polling of DNS/DHCP/SNMP' - noserv: 'Not In Service' - exploit: 'Remote Exploit Possible' - compromised: 'System Compromised' - other: 'Other' - resolved: 'Issue Resolved' # -------------- # BACKEND DAEMON diff --git a/Netdisco/share/views/ajax/device/ports.tt b/Netdisco/share/views/ajax/device/ports.tt index 97037bcd..217f1e4a 100644 --- a/Netdisco/share/views/ajax/device/ports.tt +++ b/Netdisco/share/views/ajax/device/ports.tt @@ -188,23 +188,27 @@ [% IF params.c_vmember %] - [% IF row.vlan_count %] - [% SET output = '' %] - [% SET vlanlist = [] %] - [% FOREACH vlan IN row.all_port_vlans %][% vlanlist.push(vlan.get_column('vlan')) %][% END %] - [% FOREACH vlan IN vlanlist.nsort %] - [% SET output = output _ - '' _ vlan _ '' %] - [% SET output = output _ ', ' IF NOT loop.last %] - [% END %] - [% IF row.vlan_count > 10 %] [%# TODO make this a settable variable %] - [% SET output = '
(' _ row.vlan_count - _ ')
-
Show VLANs
-
' _ output %] - [% SET output = output _ '
' %] - [% END %] - [% output %] + [% IF vmember_ok %] + [% IF row.vlan_count %] + [% SET output = '' %] + [% SET vlanlist = [] %] + [% FOREACH vlan IN row.all_port_vlans %][% vlanlist.push(vlan.get_column('vlan')) %][% END %] + [% FOREACH vlan IN vlanlist.nsort %] + [% SET output = output _ + '' _ vlan _ '' %] + [% SET output = output _ ', ' IF NOT loop.last %] + [% END %] + [% IF row.vlan_count > 10 %] [%# TODO make this a settable variable %] + [% SET output = '
(' _ row.vlan_count + _ ')
+
Show VLANs
+
' _ output %] + [% SET output = output _ '
' %] + [% END %] + [% output %] + [% END %] + [% ELSE %] + (too many to list) [% END %] [% END %]