diff --git a/Netdisco/bin/app.pl b/Netdisco/bin/app.pl index 4dbe0d2c..114ae861 100755 --- a/Netdisco/bin/app.pl +++ b/Netdisco/bin/app.pl @@ -1,4 +1,4 @@ #!/usr/bin/env perl use Dancer; -use Netdisco; +use Netdisco::Web; dance; diff --git a/Netdisco/lib/Netdisco/DB.pm b/Netdisco/lib/Netdisco/DB.pm new file mode 100644 index 00000000..e1aa6072 --- /dev/null +++ b/Netdisco/lib/Netdisco/DB.pm @@ -0,0 +1,20 @@ +use utf8; +package Netdisco::DB; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Schema'; + +__PACKAGE__->load_namespaces; + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:tQTf/oInVydRDsuIFLSU4A + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/Admin.pm b/Netdisco/lib/Netdisco/DB/Result/Admin.pm new file mode 100644 index 00000000..cdb06868 --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/Admin.pm @@ -0,0 +1,57 @@ +use utf8; +package Netdisco::DB::Result::Admin; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("admin"); +__PACKAGE__->add_columns( + "job", + { + data_type => "integer", + is_auto_increment => 1, + is_nullable => 0, + sequence => "admin_job_seq", + }, + "entered", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, + "started", + { data_type => "timestamp", is_nullable => 1 }, + "finished", + { data_type => "timestamp", is_nullable => 1 }, + "device", + { data_type => "inet", is_nullable => 1 }, + "port", + { data_type => "text", is_nullable => 1 }, + "action", + { data_type => "text", is_nullable => 1 }, + "subaction", + { data_type => "text", is_nullable => 1 }, + "status", + { data_type => "text", is_nullable => 1 }, + "username", + { data_type => "text", is_nullable => 1 }, + "userip", + { data_type => "inet", is_nullable => 1 }, + "log", + { data_type => "text", is_nullable => 1 }, + "debug", + { data_type => "boolean", is_nullable => 1 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:gW4JW4pMgrufFIxFeYPYpw + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/Device.pm b/Netdisco/lib/Netdisco/DB/Result/Device.pm new file mode 100644 index 00000000..11577d48 --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/Device.pm @@ -0,0 +1,87 @@ +use utf8; +package Netdisco::DB::Result::Device; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("device"); +__PACKAGE__->add_columns( + "ip", + { data_type => "inet", is_nullable => 0 }, + "creation", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, + "dns", + { data_type => "text", is_nullable => 1 }, + "description", + { data_type => "text", is_nullable => 1 }, + "uptime", + { data_type => "bigint", is_nullable => 1 }, + "contact", + { data_type => "text", is_nullable => 1 }, + "name", + { data_type => "text", is_nullable => 1 }, + "location", + { data_type => "text", is_nullable => 1 }, + "layers", + { data_type => "varchar", is_nullable => 1, size => 8 }, + "ports", + { data_type => "integer", is_nullable => 1 }, + "mac", + { data_type => "macaddr", is_nullable => 1 }, + "serial", + { data_type => "text", is_nullable => 1 }, + "model", + { data_type => "text", is_nullable => 1 }, + "ps1_type", + { data_type => "text", is_nullable => 1 }, + "ps2_type", + { data_type => "text", is_nullable => 1 }, + "ps1_status", + { data_type => "text", is_nullable => 1 }, + "ps2_status", + { data_type => "text", is_nullable => 1 }, + "fan", + { data_type => "text", is_nullable => 1 }, + "slots", + { data_type => "integer", is_nullable => 1 }, + "vendor", + { data_type => "text", is_nullable => 1 }, + "os", + { data_type => "text", is_nullable => 1 }, + "os_ver", + { data_type => "text", is_nullable => 1 }, + "log", + { data_type => "text", is_nullable => 1 }, + "snmp_ver", + { data_type => "integer", is_nullable => 1 }, + "snmp_comm", + { data_type => "text", is_nullable => 1 }, + "snmp_class", + { data_type => "text", is_nullable => 1 }, + "vtp_domain", + { data_type => "text", is_nullable => 1 }, + "last_discover", + { data_type => "timestamp", is_nullable => 1 }, + "last_macsuck", + { data_type => "timestamp", is_nullable => 1 }, + "last_arpnip", + { data_type => "timestamp", is_nullable => 1 }, +); +__PACKAGE__->set_primary_key("ip"); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:671/XuuvsO2aMB1+IRWFjg + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/DeviceIp.pm b/Netdisco/lib/Netdisco/DB/Result/DeviceIp.pm new file mode 100644 index 00000000..c49f7d6b --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/DeviceIp.pm @@ -0,0 +1,39 @@ +use utf8; +package Netdisco::DB::Result::DeviceIp; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("device_ip"); +__PACKAGE__->add_columns( + "ip", + { data_type => "inet", is_nullable => 0 }, + "alias", + { data_type => "inet", is_nullable => 0 }, + "subnet", + { data_type => "cidr", is_nullable => 1 }, + "port", + { data_type => "text", is_nullable => 1 }, + "dns", + { data_type => "text", is_nullable => 1 }, + "creation", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, +); +__PACKAGE__->set_primary_key("ip", "alias"); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/ugGtBSGyrJ7s6yqJ9bclQ + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/DeviceModule.pm b/Netdisco/lib/Netdisco/DB/Result/DeviceModule.pm new file mode 100644 index 00000000..6fdbdea2 --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/DeviceModule.pm @@ -0,0 +1,59 @@ +use utf8; +package Netdisco::DB::Result::DeviceModule; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("device_module"); +__PACKAGE__->add_columns( + "ip", + { data_type => "inet", is_nullable => 0 }, + "index", + { data_type => "integer", is_nullable => 0 }, + "description", + { data_type => "text", is_nullable => 1 }, + "type", + { data_type => "text", is_nullable => 1 }, + "parent", + { data_type => "integer", is_nullable => 1 }, + "name", + { data_type => "text", is_nullable => 1 }, + "class", + { data_type => "text", is_nullable => 1 }, + "pos", + { data_type => "integer", is_nullable => 1 }, + "hw_ver", + { data_type => "text", is_nullable => 1 }, + "fw_ver", + { data_type => "text", is_nullable => 1 }, + "sw_ver", + { data_type => "text", is_nullable => 1 }, + "serial", + { data_type => "text", is_nullable => 1 }, + "model", + { data_type => "text", is_nullable => 1 }, + "fru", + { data_type => "boolean", is_nullable => 1 }, + "creation", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, + "last_discover", + { data_type => "timestamp", is_nullable => 1 }, +); +__PACKAGE__->set_primary_key("ip", "index"); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:nuwxZBoiip9trdJFmgk3Fw + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/DevicePort.pm b/Netdisco/lib/Netdisco/DB/Result/DevicePort.pm new file mode 100644 index 00000000..fc72a63e --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/DevicePort.pm @@ -0,0 +1,69 @@ +use utf8; +package Netdisco::DB::Result::DevicePort; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("device_port"); +__PACKAGE__->add_columns( + "ip", + { data_type => "inet", is_nullable => 0 }, + "port", + { data_type => "text", is_nullable => 0 }, + "creation", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, + "descr", + { data_type => "text", is_nullable => 1 }, + "up", + { data_type => "text", is_nullable => 1 }, + "up_admin", + { data_type => "text", is_nullable => 1 }, + "type", + { data_type => "text", is_nullable => 1 }, + "duplex", + { data_type => "text", is_nullable => 1 }, + "duplex_admin", + { data_type => "text", is_nullable => 1 }, + "speed", + { data_type => "text", is_nullable => 1 }, + "name", + { data_type => "text", is_nullable => 1 }, + "mac", + { data_type => "macaddr", is_nullable => 1 }, + "mtu", + { data_type => "integer", is_nullable => 1 }, + "stp", + { data_type => "text", is_nullable => 1 }, + "remote_ip", + { data_type => "inet", is_nullable => 1 }, + "remote_port", + { data_type => "text", is_nullable => 1 }, + "remote_type", + { data_type => "text", is_nullable => 1 }, + "remote_id", + { data_type => "text", is_nullable => 1 }, + "vlan", + { data_type => "text", is_nullable => 1 }, + "pvid", + { data_type => "integer", is_nullable => 1 }, + "lastchange", + { data_type => "bigint", is_nullable => 1 }, +); +__PACKAGE__->set_primary_key("port", "ip"); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:lcbweb0loNwHoWUuxTN/hA + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/DevicePortLog.pm b/Netdisco/lib/Netdisco/DB/Result/DevicePortLog.pm new file mode 100644 index 00000000..6439f34d --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/DevicePortLog.pm @@ -0,0 +1,49 @@ +use utf8; +package Netdisco::DB::Result::DevicePortLog; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("device_port_log"); +__PACKAGE__->add_columns( + "id", + { + data_type => "integer", + is_auto_increment => 1, + is_nullable => 0, + sequence => "device_port_log_id_seq", + }, + "ip", + { data_type => "inet", is_nullable => 1 }, + "port", + { data_type => "text", is_nullable => 1 }, + "reason", + { data_type => "text", is_nullable => 1 }, + "log", + { data_type => "text", is_nullable => 1 }, + "username", + { data_type => "text", is_nullable => 1 }, + "userip", + { data_type => "inet", is_nullable => 1 }, + "action", + { data_type => "text", is_nullable => 1 }, + "creation", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:5moCbYoDG2BqT7VrP/MRkA + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/DevicePortPower.pm b/Netdisco/lib/Netdisco/DB/Result/DevicePortPower.pm new file mode 100644 index 00000000..68a81758 --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/DevicePortPower.pm @@ -0,0 +1,36 @@ +use utf8; +package Netdisco::DB::Result::DevicePortPower; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("device_port_power"); +__PACKAGE__->add_columns( + "ip", + { data_type => "inet", is_nullable => 0 }, + "port", + { data_type => "text", is_nullable => 0 }, + "module", + { data_type => "integer", is_nullable => 1 }, + "admin", + { data_type => "text", is_nullable => 1 }, + "status", + { data_type => "text", is_nullable => 1 }, + "class", + { data_type => "text", is_nullable => 1 }, + "power", + { data_type => "integer", is_nullable => 1 }, +); +__PACKAGE__->set_primary_key("port", "ip"); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:sHcdItRUFUOAtIZQjdWbcg + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/DevicePortSsid.pm b/Netdisco/lib/Netdisco/DB/Result/DevicePortSsid.pm new file mode 100644 index 00000000..fa83396d --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/DevicePortSsid.pm @@ -0,0 +1,29 @@ +use utf8; +package Netdisco::DB::Result::DevicePortSsid; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("device_port_ssid"); +__PACKAGE__->add_columns( + "ip", + { data_type => "inet", is_nullable => 1 }, + "port", + { data_type => "text", is_nullable => 1 }, + "ssid", + { data_type => "text", is_nullable => 1 }, + "broadcast", + { data_type => "boolean", is_nullable => 1 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:zvgylKzUQtizJZCe1rEdUg + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/DevicePortVlan.pm b/Netdisco/lib/Netdisco/DB/Result/DevicePortVlan.pm new file mode 100644 index 00000000..725cb803 --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/DevicePortVlan.pm @@ -0,0 +1,44 @@ +use utf8; +package Netdisco::DB::Result::DevicePortVlan; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("device_port_vlan"); +__PACKAGE__->add_columns( + "ip", + { data_type => "inet", is_nullable => 0 }, + "port", + { data_type => "text", is_nullable => 0 }, + "vlan", + { data_type => "integer", is_nullable => 0 }, + "native", + { data_type => "boolean", default_value => \"false", is_nullable => 0 }, + "creation", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, + "last_discover", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, +); +__PACKAGE__->set_primary_key("ip", "port", "vlan"); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:/3KLjJ3D18pGaPEaw9EU5w + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/DevicePortWireless.pm b/Netdisco/lib/Netdisco/DB/Result/DevicePortWireless.pm new file mode 100644 index 00000000..f653c08e --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/DevicePortWireless.pm @@ -0,0 +1,29 @@ +use utf8; +package Netdisco::DB::Result::DevicePortWireless; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("device_port_wireless"); +__PACKAGE__->add_columns( + "ip", + { data_type => "inet", is_nullable => 1 }, + "port", + { data_type => "text", is_nullable => 1 }, + "channel", + { data_type => "integer", is_nullable => 1 }, + "power", + { data_type => "integer", is_nullable => 1 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:T5GmnCj/9BB7meiGZ3xN7g + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/DevicePower.pm b/Netdisco/lib/Netdisco/DB/Result/DevicePower.pm new file mode 100644 index 00000000..02164695 --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/DevicePower.pm @@ -0,0 +1,30 @@ +use utf8; +package Netdisco::DB::Result::DevicePower; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("device_power"); +__PACKAGE__->add_columns( + "ip", + { data_type => "inet", is_nullable => 0 }, + "module", + { data_type => "integer", is_nullable => 0 }, + "power", + { data_type => "integer", is_nullable => 1 }, + "status", + { data_type => "text", is_nullable => 1 }, +); +__PACKAGE__->set_primary_key("ip", "module"); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:awZRI/IH2VewzGlxISsr7w + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/DeviceRoute.pm b/Netdisco/lib/Netdisco/DB/Result/DeviceRoute.pm new file mode 100644 index 00000000..d129a751 --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/DeviceRoute.pm @@ -0,0 +1,42 @@ +use utf8; +package Netdisco::DB::Result::DeviceRoute; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("device_route"); +__PACKAGE__->add_columns( + "ip", + { data_type => "inet", is_nullable => 0 }, + "network", + { data_type => "cidr", is_nullable => 0 }, + "creation", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, + "dest", + { data_type => "inet", is_nullable => 0 }, + "last_discover", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, +); +__PACKAGE__->set_primary_key("ip", "network", "dest"); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:3jcvPP60E5BvwnUbXql7mQ + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/DeviceVlan.pm b/Netdisco/lib/Netdisco/DB/Result/DeviceVlan.pm new file mode 100644 index 00000000..efac70e4 --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/DeviceVlan.pm @@ -0,0 +1,42 @@ +use utf8; +package Netdisco::DB::Result::DeviceVlan; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("device_vlan"); +__PACKAGE__->add_columns( + "ip", + { data_type => "inet", is_nullable => 0 }, + "vlan", + { data_type => "integer", is_nullable => 0 }, + "description", + { data_type => "text", is_nullable => 1 }, + "creation", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, + "last_discover", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, +); +__PACKAGE__->set_primary_key("ip", "vlan"); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:hBJRcdzOic4d3u4pD1m8iA + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/Log.pm b/Netdisco/lib/Netdisco/DB/Result/Log.pm new file mode 100644 index 00000000..acd56c99 --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/Log.pm @@ -0,0 +1,41 @@ +use utf8; +package Netdisco::DB::Result::Log; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("log"); +__PACKAGE__->add_columns( + "id", + { + data_type => "integer", + is_auto_increment => 1, + is_nullable => 0, + sequence => "log_id_seq", + }, + "creation", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, + "class", + { data_type => "text", is_nullable => 1 }, + "entry", + { data_type => "text", is_nullable => 1 }, + "logfile", + { data_type => "text", is_nullable => 1 }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:eonwOHvvzWm88Ug+IGKuzg + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/Node.pm b/Netdisco/lib/Netdisco/DB/Result/Node.pm new file mode 100644 index 00000000..b680ab99 --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/Node.pm @@ -0,0 +1,53 @@ +use utf8; +package Netdisco::DB::Result::Node; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("node"); +__PACKAGE__->add_columns( + "mac", + { data_type => "macaddr", is_nullable => 0 }, + "switch", + { data_type => "inet", is_nullable => 0 }, + "port", + { data_type => "text", is_nullable => 0 }, + "active", + { data_type => "boolean", is_nullable => 1 }, + "oui", + { data_type => "varchar", is_nullable => 1, size => 8 }, + "time_first", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, + "time_recent", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, + "time_last", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, +); +__PACKAGE__->set_primary_key("mac", "switch", "port"); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:sGGyKEfUkoIFVtmj1wnH7A + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/NodeIp.pm b/Netdisco/lib/Netdisco/DB/Result/NodeIp.pm new file mode 100644 index 00000000..4b680e32 --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/NodeIp.pm @@ -0,0 +1,44 @@ +use utf8; +package Netdisco::DB::Result::NodeIp; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("node_ip"); +__PACKAGE__->add_columns( + "mac", + { data_type => "macaddr", is_nullable => 0 }, + "ip", + { data_type => "inet", is_nullable => 0 }, + "active", + { data_type => "boolean", is_nullable => 1 }, + "time_first", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, + "time_last", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, + "dns", + { data_type => "text", is_nullable => 1 }, +); +__PACKAGE__->set_primary_key("mac", "ip"); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:9+CuvuVWH88WxAf6IBij8g + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/NodeMonitor.pm b/Netdisco/lib/Netdisco/DB/Result/NodeMonitor.pm new file mode 100644 index 00000000..ea758667 --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/NodeMonitor.pm @@ -0,0 +1,37 @@ +use utf8; +package Netdisco::DB::Result::NodeMonitor; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("node_monitor"); +__PACKAGE__->add_columns( + "mac", + { data_type => "macaddr", is_nullable => 0 }, + "active", + { data_type => "boolean", is_nullable => 1 }, + "why", + { data_type => "text", is_nullable => 1 }, + "cc", + { data_type => "text", is_nullable => 1 }, + "date", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, +); +__PACKAGE__->set_primary_key("mac"); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:0prRdz2XYlFuE+nahsI2Yg + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/NodeNbt.pm b/Netdisco/lib/Netdisco/DB/Result/NodeNbt.pm new file mode 100644 index 00000000..a1fd8e46 --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/NodeNbt.pm @@ -0,0 +1,50 @@ +use utf8; +package Netdisco::DB::Result::NodeNbt; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("node_nbt"); +__PACKAGE__->add_columns( + "mac", + { data_type => "macaddr", is_nullable => 0 }, + "ip", + { data_type => "inet", is_nullable => 1 }, + "nbname", + { data_type => "text", is_nullable => 1 }, + "domain", + { data_type => "text", is_nullable => 1 }, + "server", + { data_type => "boolean", is_nullable => 1 }, + "nbuser", + { data_type => "text", is_nullable => 1 }, + "active", + { data_type => "boolean", is_nullable => 1 }, + "time_first", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, + "time_last", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, +); +__PACKAGE__->set_primary_key("mac"); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:XFpxaGAWE13iizQIuVOP3g + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/NodeWireless.pm b/Netdisco/lib/Netdisco/DB/Result/NodeWireless.pm new file mode 100644 index 00000000..3deb714b --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/NodeWireless.pm @@ -0,0 +1,49 @@ +use utf8; +package Netdisco::DB::Result::NodeWireless; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("node_wireless"); +__PACKAGE__->add_columns( + "mac", + { data_type => "macaddr", is_nullable => 0 }, + "uptime", + { data_type => "integer", is_nullable => 1 }, + "maxrate", + { data_type => "integer", is_nullable => 1 }, + "txrate", + { data_type => "integer", is_nullable => 1 }, + "sigstrength", + { data_type => "integer", is_nullable => 1 }, + "sigqual", + { data_type => "integer", is_nullable => 1 }, + "rxpkt", + { data_type => "integer", is_nullable => 1 }, + "txpkt", + { data_type => "integer", is_nullable => 1 }, + "rxbyte", + { data_type => "bigint", is_nullable => 1 }, + "txbyte", + { data_type => "bigint", is_nullable => 1 }, + "time_last", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, +); +__PACKAGE__->set_primary_key("mac"); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# 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 +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/Oui.pm b/Netdisco/lib/Netdisco/DB/Result/Oui.pm new file mode 100644 index 00000000..b973f412 --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/Oui.pm @@ -0,0 +1,26 @@ +use utf8; +package Netdisco::DB::Result::Oui; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("oui"); +__PACKAGE__->add_columns( + "oui", + { data_type => "varchar", is_nullable => 0, size => 8 }, + "company", + { data_type => "text", is_nullable => 1 }, +); +__PACKAGE__->set_primary_key("oui"); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:s51mj6SvstPd4GdNEy9SoA + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/Process.pm b/Netdisco/lib/Netdisco/DB/Result/Process.pm new file mode 100644 index 00000000..40af173c --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/Process.pm @@ -0,0 +1,38 @@ +use utf8; +package Netdisco::DB::Result::Process; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("process"); +__PACKAGE__->add_columns( + "controller", + { data_type => "integer", is_nullable => 0 }, + "device", + { data_type => "inet", is_nullable => 0 }, + "action", + { data_type => "text", is_nullable => 0 }, + "status", + { data_type => "text", is_nullable => 1 }, + "count", + { data_type => "integer", is_nullable => 1 }, + "creation", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:28hTnOo4oNwJabiWWHBgCw + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/Session.pm b/Netdisco/lib/Netdisco/DB/Result/Session.pm new file mode 100644 index 00000000..0356cf44 --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/Session.pm @@ -0,0 +1,33 @@ +use utf8; +package Netdisco::DB::Result::Session; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("sessions"); +__PACKAGE__->add_columns( + "id", + { data_type => "char", is_nullable => 0, size => 32 }, + "creation", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, + "a_session", + { data_type => "text", is_nullable => 1 }, +); +__PACKAGE__->set_primary_key("id"); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:khNPh72VjQh8QHayuW/p1w + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/Subnet.pm b/Netdisco/lib/Netdisco/DB/Result/Subnet.pm new file mode 100644 index 00000000..494bb3ed --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/Subnet.pm @@ -0,0 +1,38 @@ +use utf8; +package Netdisco::DB::Result::Subnet; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("subnets"); +__PACKAGE__->add_columns( + "net", + { data_type => "cidr", is_nullable => 0 }, + "creation", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, + "last_discover", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, +); +__PACKAGE__->set_primary_key("net"); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:1EHOfYx8PYOHoTkViZR6OA + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/User.pm b/Netdisco/lib/Netdisco/DB/Result/User.pm new file mode 100644 index 00000000..213fd8ba --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/User.pm @@ -0,0 +1,45 @@ +use utf8; +package Netdisco::DB::Result::User; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("users"); +__PACKAGE__->add_columns( + "username", + { data_type => "varchar", is_nullable => 0, size => 50 }, + "password", + { data_type => "text", is_nullable => 1 }, + "creation", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, + "last_on", + { data_type => "timestamp", is_nullable => 1 }, + "port_control", + { data_type => "boolean", default_value => \"false", is_nullable => 1 }, + "ldap", + { data_type => "boolean", default_value => \"false", is_nullable => 1 }, + "admin", + { data_type => "boolean", default_value => \"false", is_nullable => 1 }, + "fullname", + { data_type => "text", is_nullable => 1 }, + "note", + { data_type => "text", is_nullable => 1 }, +); +__PACKAGE__->set_primary_key("username"); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:2awpSJkzXP7+8eyT4vGjfw + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco/DB/Result/UserLog.pm b/Netdisco/lib/Netdisco/DB/Result/UserLog.pm new file mode 100644 index 00000000..9f13a4ad --- /dev/null +++ b/Netdisco/lib/Netdisco/DB/Result/UserLog.pm @@ -0,0 +1,43 @@ +use utf8; +package Netdisco::DB::Result::UserLog; + +# Created by DBIx::Class::Schema::Loader +# DO NOT MODIFY THE FIRST PART OF THIS FILE + +use strict; +use warnings; + +use base 'DBIx::Class::Core'; +__PACKAGE__->table("user_log"); +__PACKAGE__->add_columns( + "entry", + { + data_type => "integer", + is_auto_increment => 1, + is_nullable => 0, + sequence => "user_log_entry_seq", + }, + "username", + { data_type => "varchar", is_nullable => 1, size => 50 }, + "userip", + { data_type => "inet", is_nullable => 1 }, + "event", + { data_type => "text", is_nullable => 1 }, + "details", + { data_type => "text", is_nullable => 1 }, + "creation", + { + data_type => "timestamp", + default_value => \"current_timestamp", + is_nullable => 1, + original => { default_value => \"now()" }, + }, +); + + +# Created by DBIx::Class::Schema::Loader v0.07015 @ 2012-01-07 14:20:02 +# DO NOT MODIFY THIS OR ANYTHING ABOVE! md5sum:BFrhjYJOhcLIHeWviu9rjw + + +# You can replace this text with custom code or comments, and it will be preserved on regeneration +1; diff --git a/Netdisco/lib/Netdisco.pm b/Netdisco/lib/Netdisco/Web.pm similarity index 86% rename from Netdisco/lib/Netdisco.pm rename to Netdisco/lib/Netdisco/Web.pm index a45a9c35..5069ff94 100644 --- a/Netdisco/lib/Netdisco.pm +++ b/Netdisco/lib/Netdisco/Web.pm @@ -1,8 +1,8 @@ -package Netdisco; +package Netdisco::Web; use Dancer ':syntax'; use Dancer::Plugin::Ajax; -use Dancer::Plugin::Database; +use Dancer::Plugin::DBIC; use Digest::MD5 (); hook 'before' => sub { @@ -57,13 +57,11 @@ get '/search' => sub { post '/login' => sub { if (param('username') and param('password')) { - my $user = database->quick_select('users', - { username => param('username') } - ); + my $user = schema('netdisco')->resultset('User')->find(param('username')); if ($user) { my $sum = Digest::MD5::md5_hex(param('password')); - if ($sum and $sum eq $user->{password}) { - session(user => $user->{username}); + if ($sum and $sum eq $user->password) { + session(user => $user->username); redirect param('path') || '/'; return; } diff --git a/Netdisco/views/index.tt b/Netdisco/views/index.tt index 818a8026..09c04c0f 100644 --- a/Netdisco/views/index.tt +++ b/Netdisco/views/index.tt @@ -2,19 +2,19 @@