store wireless ssid and port info to DB
This commit is contained in:
@@ -144,6 +144,29 @@ __PACKAGE__->has_many(
|
|||||||
# helper which assumes we've just RIGHT JOINed to Vlans table
|
# helper which assumes we've just RIGHT JOINed to Vlans table
|
||||||
sub vlan { return (shift)->vlans->first }
|
sub vlan { return (shift)->vlans->first }
|
||||||
|
|
||||||
|
=head2 wireless_ports
|
||||||
|
|
||||||
|
Returns the set of wireless IDs known to be configured on Ports on this
|
||||||
|
Device.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
__PACKAGE__->has_many(
|
||||||
|
wireless_ports => 'App::Netdisco::DB::Result::DevicePortWireless',
|
||||||
|
'ip', { join_type => 'RIGHT' }
|
||||||
|
);
|
||||||
|
|
||||||
|
=head2 ssids
|
||||||
|
|
||||||
|
Returns the set of SSIDs known to be configured on Ports on this Device.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
__PACKAGE__->has_many(
|
||||||
|
ssids => 'App::Netdisco::DB::Result::DevicePortSsid',
|
||||||
|
'ip', { join_type => 'RIGHT' }
|
||||||
|
);
|
||||||
|
|
||||||
=head1 ADDITIONAL COLUMNS
|
=head1 ADDITIONAL COLUMNS
|
||||||
|
|
||||||
=head2 uptime_age
|
=head2 uptime_age
|
||||||
|
|||||||
@@ -26,6 +26,25 @@ __PACKAGE__->add_columns(
|
|||||||
# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02
|
# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02
|
||||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zvgylKzUQtizJZCe1rEdUg
|
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zvgylKzUQtizJZCe1rEdUg
|
||||||
|
|
||||||
|
=head1 RELATIONSHIPS
|
||||||
|
|
||||||
|
=head2 device
|
||||||
|
|
||||||
|
Returns the entry from the C<device> table which hosts this SSID.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
__PACKAGE__->belongs_to( device => 'App::Netdisco::DB::Result::Device', 'ip' );
|
||||||
|
|
||||||
|
=head2 port
|
||||||
|
|
||||||
|
Returns the entry from the C<port> table which corresponds to this SSID.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
__PACKAGE__->belongs_to( port => 'App::Netdisco::DB::Result::DevicePort', {
|
||||||
|
'foreign.ip' => 'self.ip', 'foreign.port' => 'self.port',
|
||||||
|
});
|
||||||
|
|
||||||
# You can replace this text with custom code or comments, and it will be preserved on regeneration
|
# You can replace this text with custom code or comments, and it will be preserved on regeneration
|
||||||
1;
|
1;
|
||||||
|
|||||||
@@ -24,6 +24,26 @@ __PACKAGE__->add_columns(
|
|||||||
# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02
|
# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02
|
||||||
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:T5GmnCj/9BB7meiGZ3xN7g
|
# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:T5GmnCj/9BB7meiGZ3xN7g
|
||||||
|
|
||||||
|
=head1 RELATIONSHIPS
|
||||||
|
|
||||||
|
=head2 device
|
||||||
|
|
||||||
|
Returns the entry from the C<device> table which hosts this wireless port.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
__PACKAGE__->belongs_to( device => 'App::Netdisco::DB::Result::Device', 'ip' );
|
||||||
|
|
||||||
|
=head2 port
|
||||||
|
|
||||||
|
Returns the entry from the C<port> table which corresponds to this wireless
|
||||||
|
interface.
|
||||||
|
|
||||||
|
=cut
|
||||||
|
|
||||||
|
__PACKAGE__->belongs_to( port => 'App::Netdisco::DB::Result::DevicePort', {
|
||||||
|
'foreign.ip' => 'self.ip', 'foreign.port' => 'self.port',
|
||||||
|
});
|
||||||
|
|
||||||
# You can replace this text with custom code or comments, and it will be preserved on regeneration
|
# You can replace this text with custom code or comments, and it will be preserved on regeneration
|
||||||
1;
|
1;
|
||||||
|
|||||||
@@ -240,6 +240,11 @@ sub store_wireless {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
schema('netdisco')->txn_do(sub {
|
||||||
|
$device->ssids->delete;
|
||||||
|
$device->ssids->populate(\@ssids);
|
||||||
|
});
|
||||||
|
|
||||||
# build device channel list suitable for DBIC
|
# build device channel list suitable for DBIC
|
||||||
my @channels;
|
my @channels;
|
||||||
foreach my $entry (keys %$channel) {
|
foreach my $entry (keys %$channel) {
|
||||||
@@ -258,13 +263,10 @@ sub store_wireless {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
# FIXME not sure what relations need adding for wireless ports
|
schema('netdisco')->txn_do(sub {
|
||||||
#
|
$device->wireless_ports->delete;
|
||||||
#schema('netdisco')->txn_do(sub {
|
$device->wireless_ports->populate(\@channels);
|
||||||
# $device->ports->delete;
|
});
|
||||||
# $device->update_or_insert;
|
|
||||||
# $device->ports->populate(\@interfaces);
|
|
||||||
#});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
=head2 store_vlans( $device, $snmp )
|
=head2 store_vlans( $device, $snmp )
|
||||||
|
|||||||
Reference in New Issue
Block a user