[#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

@@ -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');