installed initial DBIC class, switched to DBIC

This commit is contained in:
Oliver Gorwits
2012-01-07 14:45:14 +00:00
parent 5f295a8d53
commit 9213c013f8
29 changed files with 1138 additions and 11 deletions

View File

@@ -1,4 +1,4 @@
#!/usr/bin/env perl #!/usr/bin/env perl
use Dancer; use Dancer;
use Netdisco; use Netdisco::Web;
dance; dance;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,8 +1,8 @@
package Netdisco; package Netdisco::Web;
use Dancer ':syntax'; use Dancer ':syntax';
use Dancer::Plugin::Ajax; use Dancer::Plugin::Ajax;
use Dancer::Plugin::Database; use Dancer::Plugin::DBIC;
use Digest::MD5 (); use Digest::MD5 ();
hook 'before' => sub { hook 'before' => sub {
@@ -57,13 +57,11 @@ get '/search' => sub {
post '/login' => sub { post '/login' => sub {
if (param('username') and param('password')) { if (param('username') and param('password')) {
my $user = database->quick_select('users', my $user = schema('netdisco')->resultset('User')->find(param('username'));
{ username => param('username') }
);
if ($user) { if ($user) {
my $sum = Digest::MD5::md5_hex(param('password')); my $sum = Digest::MD5::md5_hex(param('password'));
if ($sum and $sum eq $user->{password}) { if ($sum and $sum eq $user->password) {
session(user => $user->{username}); session(user => $user->username);
redirect param('path') || '/'; redirect param('path') || '/';
return; return;
} }

View File

@@ -2,19 +2,19 @@
<div class="row nd_herorow"> <div class="row nd_herorow">
<div class="span10 offset3"> <div class="span10 offset3">
[% IF params.failed %] [% IF params.failed %]
<div class="nd_loginalert alert-message error" data-alert="on"> <div class="nd_loginalert alert-message error fade in" data-alert="on">
<a class="close" href="#">×</a> <a class="close" href="#">×</a>
<p>Incorrect username or password, please try again.</p> <p>Incorrect username or password, please try again.</p>
</div> </div>
[% END %] [% END %]
[% IF params.logout %] [% IF params.logout %]
<div class="nd_loginalert alert-message notice" data-alert="on"> <div class="nd_loginalert alert-message notice fade in" data-alert="on">
<a class="close" href="#">×</a> <a class="close" href="#">×</a>
<p>You are now logged out.</p> <p>You are now logged out.</p>
</div> </div>
[% END %] [% END %]
[% IF vars.notfound %] [% IF vars.notfound %]
<div class="nd_loginalert alert-message notice" data-alert="on"> <div class="nd_loginalert alert-message notice fade in" data-alert="on">
<a class="close" href="#">×</a> <a class="close" href="#">×</a>
<p>Sorry, page not found. <p>Sorry, page not found.
<a href="http://sourceforge.net/tracker/?group_id=80033&atid=558508" target="_blank">Report a Bug?</a></p> <a href="http://sourceforge.net/tracker/?group_id=80033&atid=558508" target="_blank">Report a Bug?</a></p>