[#81] Identify wireless nodes and provide information when available

This commit is contained in:
Eric A. Miller
2014-01-11 03:45:27 -05:00
parent 0e6d8c71e3
commit 1e0c6b9598
6 changed files with 44 additions and 1 deletions

View File

@@ -1,5 +1,9 @@
2.021001
[NEW FEATURES]
* [#81] Identify wireless nodes and provide information when available
[ENHANCEMENTS]
* [#32] Show device layers in Details tab

View File

@@ -112,6 +112,17 @@ the current Node's.
__PACKAGE__->has_many( ips => 'App::Netdisco::DB::Result::NodeIp',
{ 'foreign.mac' => 'self.mac', 'foreign.active' => 'self.active' } );
=head2 wireless
Returns the set of C<node_wireless> entries associated with this Node. That
is, the SSIDs and wireless statistics associated with this MAC address
at the time of discovery.
=cut
__PACKAGE__->has_many( wireless => 'App::Netdisco::DB::Result::NodeWireless',
{ 'foreign.mac' => 'self.mac' } );
=head2 oui
Returns the C<oui> table entry matching this Node. You can then join on this

View File

@@ -47,5 +47,17 @@ __PACKAGE__->set_primary_key("mac", "ssid");
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3xsSiWzL85ih3vhdews8Hg
# You can replace this text with custom code or comments, and it will be preserved on regeneration
=head2 node
Returns the C<node> table entry matching this wireless entry.
The JOIN is of type LEFT, in case the C<node> is no longer present in the
database but the relation is being used in C<search()>.
=cut
__PACKAGE__->belongs_to( node => 'App::Netdisco::DB::Result::Node',
{ 'foreign.mac' => 'self.mac' },
{ join_type => 'LEFT' } );
1;

View File

@@ -48,6 +48,7 @@ hook 'before' => sub {
var('connected_properties' => [
{ name => 'n_age', label => 'Age Stamp', default => '' },
{ name => 'n_ip', label => 'IP Address', default => 'on' },
{ name => 'n_ssid', label => 'SSID', default => 'on' },
{ name => 'n_archived', label => 'Archived Data', default => '' },
]);

View File

@@ -129,6 +129,10 @@ get '/ajax/content/device/ports' => require_login sub {
$set = $set->search_rs({}, { prefetch => [{$nodes_name => 'ips'}] })
if param('c_nodes');
# retrieve wireless SSIDs, if asked for
$set = $set->search_rs({}, { prefetch => [{$nodes_name => 'wireless'}] })
if param('c_nodes');
# retrieve neighbor devices, if asked for
$set = $set->search_rs({}, { prefetch => [{neighbor_alias => 'device'}] })
if param('c_neighbors');

View File

@@ -243,8 +243,19 @@
[% FOREACH node IN row.$nodes %]
[% '<br/>' IF (row.remote_ip OR row.is_uplink) OR NOT loop.first %]
[% '<i class="icon-book"></i>&nbsp; ' IF NOT node.active %]
[% '<i class="icon-signal"></i>&nbsp; ' IF node.wireless.defined %]
<a href="[% search_node %]&q=[% node.net_mac.$mac_format_call | uri %]">
[% node.net_mac.$mac_format_call | html_entity %]</a>
[% IF (node.vlan > 0) && (node.vlan != row.vlan) %]
(on vlan [% node.vlan | html_entity %])
[% END %]
[% IF params.n_ssid AND node.wireless.defined %]
(SSID:
[% FOREACH wlan IN node.wireless %]
[%+ wlan.ssid | html_entity %]
[% END %]
)
[% END %]
[% ' (' _ node.time_last_age _ ')' IF params.n_age %]
[% IF params.n_ip %]
[% FOREACH ip IN node.ips %]