Modified: trunk/opsview-core/lib/Opsview/Schema/Hosts.pm
===================================================================
--- trunk/opsview-core/lib/Opsview/Schema/Hosts.pm 2010-11-04 15:24:23 UTC (rev 5306)
+++ trunk/opsview-core/lib/Opsview/Schema/Hosts.pm 2010-11-04 15:24:28 UTC (rev 5307)
@@ -198,7 +198,7 @@
check_interval check_attempts retry_check_interval hosttemplates
notification_interval notification_options notification_period
flap_detection_enabled
- enable_snmp snmp_version snmp_community snmpv3_username snmpv3_authprotocol snmpv3_authpassword snmpv3_privpassword snmpv3_privprotocol snmpv3_privpassword
+ enable_snmp snmp_version snmp_port snmp_community snmpv3_username snmpv3_authprotocol snmpv3_authpassword snmpv3_privpassword snmpv3_privprotocol snmpv3_privpassword
use_rancid rancid_vendor rancid_username rancid_password rancid_connection_type
use_nmis nmis_node_type use_mrtg
servicechecks
Modified: trunk/opsview-core/t/945hosts.t
===================================================================
--- trunk/opsview-core/t/945hosts.t 2010-11-04 15:24:23 UTC (rev 5306)
+++ trunk/opsview-core/t/945hosts.t 2010-11-04 15:24:28 UTC (rev 5307)
@@ -215,6 +215,7 @@
rancid_vendor => undef,
retry_check_interval => 2,
snmp_version => "1",
+ snmp_port => 161,
snmpv3_authpassword => "",
snmpv3_authprotocol => undef,
snmpv3_privpassword => "",
Modified: trunk/opsview-web/t/650-api2-host.t
===================================================================
--- trunk/opsview-web/t/650-api2-host.t 2010-11-04 15:24:23 UTC (rev 5306)
+++ trunk/opsview-web/t/650-api2-host.t 2010-11-04 15:24:28 UTC (rev 5307)
@@ -30,9 +30,7 @@
my $res_data = eval $ua->content;
my $expected = {
'list' => [
- { 'icon' => {
- 'name' => 'SYMBOL - Environment Monitor'
- },
+ { 'icon' => { 'name' => 'SYMBOL - Environment Monitor' },
'hosttemplates' => [
{ 'ref' => '/rest/config/hosttemplate/3',
'name' => 'Cisco Mgt'
@@ -47,9 +45,7 @@
'name' => 'Leaf'
}
},
- { 'icon' => {
- 'name' => 'SYMBOL - *DSL'
- },
+ { 'icon' => { 'name' => 'SYMBOL - *DSL' },
'hosttemplates' => [],
'ref' => '/rest/config/host/8',
'ip' => '192.168.10.23',
@@ -60,9 +56,7 @@
'name' => 'Leaf'
}
},
- { 'icon' => {
- 'name' => 'SYMBOL - Firewall'
- },
+ { 'icon' => { 'name' => 'SYMBOL - Firewall' },
'hosttemplates' => [],
'ref' => '/rest/config/host/9',
'ip' => '192.168.10.22',
@@ -73,9 +67,7 @@
'name' => 'Leaf'
}
},
- { 'icon' => {
- 'name' => 'LOGO - NetBSD'
- },
+ { 'icon' => { 'name' => 'LOGO - NetBSD' },
'hosttemplates' => [
{ 'ref' => '/rest/config/hosttemplate/4',
'name' => 'Blank'
@@ -90,9 +82,7 @@
'name' => 'Leaf'
}
},
- { 'icon' => {
- 'name' => 'SYMBOL - Network'
- },
+ { 'icon' => { 'name' => 'SYMBOL - Network' },
'hosttemplates' => [],
'ref' => '/rest/config/host/11',
'ip' => 'not_a_real_host',
@@ -105,156 +95,152 @@
},
],
summary => {
- allrows => 22,
- page => 1,
- rows => 5,
+ allrows => 22,
+ page => 1,
+ rows => 5,
totalpages => 5,
- totalrows => 22,
+ totalrows => 22,
}
};
-is_deeply( $res_data, $expected, "Got expected data for host list" ) || diag(Data::Dump::dump($res_data));
+is_deeply( $res_data, $expected, "Got expected data for host list" ) || diag( Data::Dump::dump($res_data) );
$ua->get_ok( "http://localhost:3000/rest/config/host?rows=all&s.name=opsview&cols=name", "Check search by name works" );
$res_data = eval $ua->content;
$expected = {
'list' => [
- {
- 'name' => 'opsview',
- 'ref' => '/rest/config/host/1',
+ { 'name' => 'opsview',
+ 'ref' => '/rest/config/host/1',
},
],
summary => {
allrows => 22,
- rows => 1,
+ rows => 1,
}
};
-is_deeply( $res_data, $expected, "Got expected data for host when searching by name" ) || diag(Data::Dump::dump($res_data));
+is_deeply( $res_data, $expected, "Got expected data for host when searching by name" ) || diag( Data::Dump::dump($res_data) );
-
$ua->get_ok( "http://localhost/rest/config/host/7", "Get cisco host info" );
$expected = {
- 'object' => {
- 'alias' => '',
- 'check_attempts' => '2',
- 'check_command' => {
- 'ref' => '/rest/config/hostcheckcommand/1',
- 'name' => 'slow ping'
- },
- 'check_interval' => '0',
- 'check_period' => {
- 'ref' => '/rest/config/timeperiod/1',
- 'name' => '24x7'
- },
- enable_snmp => 0,
- flap_detection_enabled => 1,
- hostattributes => [],
- 'hostgroup' => {
- 'ref' => '/rest/config/hostgroup/4',
- 'name' => 'Leaf'
- },
- 'hosttemplates' => [
- {
- 'ref' => '/rest/config/hosttemplate/3',
- 'name' => 'Cisco Mgt'
- }
- ],
- 'icon' => {
- 'name' => 'SYMBOL - Environment Monitor'
- },
- 'id' => '7',
- 'ip' => '192.168.10.20',
- 'keywords' => [
- {
- 'ref' => '/rest/config/keyword/6',
- 'name' => 'alphaearly'
- },
- {
- 'ref' => '/rest/config/keyword/2',
- 'name' => 'cisco'
- },
- {
- 'ref' => '/rest/config/keyword/3',
- 'name' => 'cisco_gp1'
- }
- ],
- 'monitored_by' => {
- 'ref' => '/rest/config/monitoringserver/1',
- 'name' => 'Master Monitoring Server'
- },
- 'name' => 'cisco',
- nmis_node_type => "router",
- notification_interval => 0,
- notification_options => "u,d,r",
- notification_period => {
- name => "24x7",
- ref => "/rest/config/timeperiod/1",
- },
- 'other_addresses' => '',
- 'parents' => [
- {
- 'ref' => '/rest/config/host/7',
- 'name' => 'cisco'
- }
- ],
- rancid_connection_type => "ssh",
- rancid_password => undef,
- rancid_username => undef,
- rancid_vendor => undef,
- 'retry_check_interval' => '1',
- servicechecks => [
- { name => "Another exception",
- event_handler => undef,
- exception => undef,
- remove_servicecheck => 0,
- timed_exception => undef,
- ref => "/rest/config/servicecheck/82", },
- { name => "Coldstart",
- event_handler => undef,
- exception => undef,
- remove_servicecheck => 0,
- timed_exception => undef,
- ref => "/rest/config/servicecheck/79" },
- { name => "Interface",
- event_handler => undef,
- exception => undef,
- remove_servicecheck => 0,
- timed_exception => undef,
- ref => "/rest/config/servicecheck/95" },
- { name => "snmp poll",
- event_handler => undef,
- exception => undef,
- remove_servicecheck => 0,
- timed_exception => undef,
- ref => "/rest/config/servicecheck/83" },
- { name => "Test exceptions",
- event_handler => undef,
- exception => undef,
- remove_servicecheck => 0,
- timed_exception => undef,
- ref => "/rest/config/servicecheck/81" },
- ],
- snmp_community => "shouldnotcreate",
- snmp_version => "2c",
- snmpv3_authpassword => "",
- snmpv3_authprotocol => undef,
- snmpv3_privpassword => "",
- snmpv3_privprotocol => undef,
- snmpv3_username => "",
- uncommitted => 1,
- use_mrtg => 0,
- use_nmis => 0,
- use_rancid => 0,
- }
- };
+ 'object' => {
+ 'alias' => '',
+ 'check_attempts' => '2',
+ 'check_command' => {
+ 'ref' => '/rest/config/hostcheckcommand/1',
+ 'name' => 'slow ping'
+ },
+ 'check_interval' => '0',
+ 'check_period' => {
+ 'ref' => '/rest/config/timeperiod/1',
+ 'name' => '24x7'
+ },
+ enable_snmp => 0,
+ flap_detection_enabled => 1,
+ hostattributes => [],
+ 'hostgroup' => {
+ 'ref' => '/rest/config/hostgroup/4',
+ 'name' => 'Leaf'
+ },
+ 'hosttemplates' => [
+ { 'ref' => '/rest/config/hosttemplate/3',
+ 'name' => 'Cisco Mgt'
+ }
+ ],
+ 'icon' => { 'name' => 'SYMBOL - Environment Monitor' },
+ 'id' => '7',
+ 'ip' => '192.168.10.20',
+ 'keywords' => [
+ { 'ref' => '/rest/config/keyword/6',
+ 'name' => 'alphaearly'
+ },
+ { 'ref' => '/rest/config/keyword/2',
+ 'name' => 'cisco'
+ },
+ { 'ref' => '/rest/config/keyword/3',
+ 'name' => 'cisco_gp1'
+ }
+ ],
+ 'monitored_by' => {
+ 'ref' => '/rest/config/monitoringserver/1',
+ 'name' => 'Master Monitoring Server'
+ },
+ 'name' => 'cisco',
+ nmis_node_type => "router",
+ notification_interval => 0,
+ notification_options => "u,d,r",
+ notification_period => {
+ name => "24x7",
+ ref => "/rest/config/timeperiod/1",
+ },
+ 'other_addresses' => '',
+ 'parents' => [
+ { 'ref' => '/rest/config/host/7',
+ 'name' => 'cisco'
+ }
+ ],
+ rancid_connection_type => "ssh",
+ rancid_password => undef,
+ rancid_username => undef,
+ rancid_vendor => undef,
+ 'retry_check_interval' => '1',
+ servicechecks => [
+ { name => "Another exception",
+ event_handler => undef,
+ exception => undef,
+ remove_servicecheck => 0,
+ timed_exception => undef,
+ ref => "/rest/config/servicecheck/82",
+ },
+ { name => "Coldstart",
+ event_handler => undef,
+ exception => undef,
+ remove_servicecheck => 0,
+ timed_exception => undef,
+ ref => "/rest/config/servicecheck/79"
+ },
+ { name => "Interface",
+ event_handler => undef,
+ exception => undef,
+ remove_servicecheck => 0,
+ timed_exception => undef,
+ ref => "/rest/config/servicecheck/95"
+ },
+ { name => "snmp poll",
+ event_handler => undef,
+ exception => undef,
+ remove_servicecheck => 0,
+ timed_exception => undef,
+ ref => "/rest/config/servicecheck/83"
+ },
+ { name => "Test exceptions",
+ event_handler => undef,
+ exception => undef,
+ remove_servicecheck => 0,
+ timed_exception => undef,
+ ref => "/rest/config/servicecheck/81"
+ },
+ ],
+ snmp_community => "shouldnotcreate",
+ snmp_version => "2c",
+ snmp_port => 161,
+ snmpv3_authpassword => "",
+ snmpv3_authprotocol => undef,
+ snmpv3_privpassword => "",
+ snmpv3_privprotocol => undef,
+ snmpv3_username => "",
+ uncommitted => 1,
+ use_mrtg => 0,
+ use_nmis => 0,
+ use_rancid => 0,
+ }
+};
$res_data = eval $ua->content;
-is_deeply( $res_data, $expected, "Got hash data for host as expected" ) || diag("Full dump: ".Data::Dump::dump($res_data->{object}));
+is_deeply( $res_data, $expected, "Got hash data for host as expected" ) || diag( "Full dump: " . Data::Dump::dump( $res_data->{object} ) );
-
$ua->put( "http://localhost/rest/config/host/7", content => '{ other_addresses => "bahamas", parents => [ { id => 3 } ] }' );
is( $ua->status, 200, "PUT OK" );
-$res_data = eval $ua->content;
+$res_data = eval $ua->content;
$expected->{object}->{other_addresses} = "bahamas";
-$expected->{object}->{parents} = [ { ref => "/rest/config/host/3", name => "host_locally_monitored" } ];
+$expected->{object}->{parents} = [ { ref => "/rest/config/host/3", name => "host_locally_monitored" } ];
is_deeply( $res_data, $expected, "Got hash data for contact after a PUT to update" );
$expected->{object}->{check_attempts} = 1;
@@ -268,7 +254,7 @@
$res_data = eval $ua->content;
$expected = { message => "Error trying to synchronise object", };
is( $res_data->{message}, $expected->{message}, "Got right error message" );
-is( $res_data->{detail}, "name: Invalid\n", "Got invalid error message" );
+is( $res_data->{detail}, "name: Invalid\n", "Got invalid error message" );
$ua->get_ok( "http://localhost/rest/config/host/17", "Try to get host 17 before delete" );
is( $ua->status, 200, "Host 17 found" );
@@ -284,65 +270,62 @@
# Need to set Content-Type otherwise WWW::Mechanize will assume post sends form data
$ua->add_header( 'Content-type' => "text/x-data-dumper" );
my $creation = {
- name => "NewHost",
- ip => "11.12.13.14",
+ name => "NewHost",
+ ip => "11.12.13.14",
hosttemplates => [ { name => "blank" }, { name => "Base Unix" } ],
- };
+};
$expected = {
- alias => "",
- check_attempts => 2,
- check_command => undef,
- check_interval => 0,
- check_period => undef,
- enable_snmp => 0,
+ alias => "",
+ check_attempts => 2,
+ check_command => undef,
+ check_interval => 0,
+ check_period => undef,
+ enable_snmp => 0,
flap_detection_enabled => 1,
- hostattributes => [],
- hostgroup => { name => "alphaearly", ref => "/rest/config/hostgroup/9" },
- hosttemplates => [
- { name => "Blank", ref => "/rest/config/hosttemplate/4" },
- { name => "Base Unix", ref => "/rest/config/hosttemplate/1" }
- ],
- icon => {
- name => "LOGO - Opsview",
- },
- id => 23,
- ip => "11.12.13.14",,
- keywords => [],
+ hostattributes => [],
+ hostgroup => { name => "alphaearly", ref => "/rest/config/hostgroup/9" },
+ hosttemplates => [ { name => "Blank", ref => "/rest/config/hosttemplate/4" }, { name => "Base Unix", ref => "/rest/config/hosttemplate/1" } ],
+ icon => { name => "LOGO - Opsview", },
+ id => 23,
+ ip => "11.12.13.14",
+ ,
+ keywords => [],
monitored_by => {
name => "Master Monitoring Server",
- ref => "/rest/config/monitoringserver/1",
- },
- name => "NewHost",
- nmis_node_type => "router",
+ ref => "/rest/config/monitoringserver/1",
+ },
+ name => "NewHost",
+ nmis_node_type => "router",
notification_interval => 60,
- notification_options => undef,
- notification_period => {
- name => "24x7",
- ref => "/rest/config/timeperiod/1",
+ notification_options => undef,
+ notification_period => {
+ name => "24x7",
+ ref => "/rest/config/timeperiod/1",
},
- other_addresses => "",
- parents => [],
+ other_addresses => "",
+ parents => [],
rancid_connection_type => "ssh",
- rancid_password => undef,
- rancid_username => undef,
- rancid_vendor => undef,
- retry_check_interval => 1,
- servicechecks => [],
- snmp_community => "",
- snmp_version => "2c",
- snmpv3_authpassword => "",
- snmpv3_authprotocol => undef,
- snmpv3_privpassword => "",
- snmpv3_privprotocol => undef,
- snmpv3_username => "",
- uncommitted => 1,
- use_mrtg => 0,
- use_nmis => 0,
- use_rancid => 0,
+ rancid_password => undef,
+ rancid_username => undef,
+ rancid_vendor => undef,
+ retry_check_interval => 1,
+ servicechecks => [],
+ snmp_community => "",
+ snmp_version => "2c",
+ snmp_port => 161,
+ snmpv3_authpassword => "",
+ snmpv3_authprotocol => undef,
+ snmpv3_privpassword => "",
+ snmpv3_privprotocol => undef,
+ snmpv3_username => "",
+ uncommitted => 1,
+ use_mrtg => 0,
+ use_nmis => 0,
+ use_rancid => 0,
};
$ua->post( "http://localhost/rest/config/host", Content => Data::Dump::dump($creation) );
is( $ua->status, 200, "Create succeeded" );
$res_data = eval $ua->content;
-is_deeply( $res_data->{object}, $expected, "Expected return of data too" ) || diag("Full dump: ".Data::Dump::dump($res_data->{object}));
+is_deeply( $res_data->{object}, $expected, "Expected return of data too" ) || diag( "Full dump: " . Data::Dump::dump( $res_data->{object} ) );
1;
Modified: trunk/opsview-web/t/653-api2-xml.t
===================================================================
--- trunk/opsview-web/t/653-api2-xml.t 2010-11-04 15:24:23 UTC (rev 5306)
+++ trunk/opsview-web/t/653-api2-xml.t 2010-11-04 15:24:28 UTC (rev 5307)
@@ -71,6 +71,7 @@
rancid_connection_type="ssh"
retry_check_interval="1"
snmp_community="shouldnotcreate"
+ snmp_port="161"
snmp_version="2c"
snmpv3_authpassword=""
snmpv3_privpassword=""
@@ -172,6 +173,7 @@
rancid_connection_type="ssh"
retry_check_interval="1"
snmp_community="shouldnotcreate"
+ snmp_port="161"
snmp_version="2c"
snmpv3_authpassword=""
snmpv3_privpassword=""
Modified: trunk/opsview-web/t/var/api/host22_put.testcase
===================================================================
--- trunk/opsview-web/t/var/api/host22_put.testcase 2010-11-04 15:24:23 UTC (rev 5306)
+++ trunk/opsview-web/t/var/api/host22_put.testcase 2010-11-04 15:24:28 UTC (rev 5307)
@@ -75,6 +75,7 @@
"nmis_node_type" : "server",
"snmpv3_authpassword" : "",
"snmp_version" : "2c",
+ "snmp_port" : 161,
"use_nmis" : "1",
"rancid_connection_type" : "ssh",
"snmpv3_authprotocol" : null,
@@ -192,6 +193,7 @@
"nmis_node_type" : "server",
"snmpv3_authpassword" : "",
"snmp_version" : "2c",
+ "snmp_port" : 161,
"use_nmis" : "1",
"rancid_connection_type" : "ssh",
"snmpv3_authprotocol" : null,
Modified: trunk/opsview-web/t/var/api/x_host_post.testcase
===================================================================
--- trunk/opsview-web/t/var/api/x_host_post.testcase 2010-11-04 15:24:23 UTC (rev 5306)
+++ trunk/opsview-web/t/var/api/x_host_post.testcase 2010-11-04 15:24:28 UTC (rev 5307)
@@ -109,6 +109,7 @@
],
"use_rancid" : "0",
"snmp_version" : "2c",
+ "snmp_port" : 161,
"snmpv3_authpassword" : "",
"nmis_node_type" : "router",
"use_nmis" : "0",
Modified: trunk/opsview-web/t/var/api/x_host_post_hostattributes.testcase
===================================================================
--- trunk/opsview-web/t/var/api/x_host_post_hostattributes.testcase 2010-11-04 15:24:23 UTC (rev 5306)
+++ trunk/opsview-web/t/var/api/x_host_post_hostattributes.testcase 2010-11-04 15:24:28 UTC (rev 5307)
@@ -123,6 +123,7 @@
],
"use_rancid" : "0",
"snmp_version" : "2c",
+ "snmp_port" : 161,
"snmpv3_authpassword" : "",
"nmis_node_type" : "router",
"use_nmis" : "0",