![]() |
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
Patch patch-ext-snmp-tests for SNMP related Bug #53594Patch version 2010-12-22 18:53 UTC Return to Bug #53594 | Download this patchThis patch is obsolete Obsoleted by patches:
Developer: lytboris@gmail.comLine 1 (now 1), was 7 lines, now 6 lines diff -ruN trunk/ext/snmp/tests/README snmp-new/ext/snmp/tests/README --- trunk/ext/snmp/tests/README 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/README 2010-12-21 19:41:14.000000000 +0300 --- ext/snmp/tests/README 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/README 2010-12-21 19:41:14.000000000 +0300 @@ -0,0 +1,63 @@ +SNMP Tests +---------- + Line 64 (now 63), was 19 lines, now 17 lines +On Windows +---------- + +[to be completed] diff -ruN trunk/ext/snmp/tests/clean.inc snmp-new/ext/snmp/tests/clean.inc --- trunk/ext/snmp/tests/clean.inc 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/clean.inc 2009-10-17 21:14:00.000000000 +0400 --- ext/snmp/tests/clean.inc 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/clean.inc 2009-10-17 21:14:00.000000000 +0400 @@ -0,0 +1,4 @@ +<?php +include_once(dirname(__FILE__) . '/snmp_include.inc'); + +// To be completed if necessary diff -ruN trunk/ext/snmp/tests/generic_timeout_error.phpt snmp-new/ext/snmp/tests/generic_timeout_error.phpt --- trunk/ext/snmp/tests/generic_timeout_error.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/generic_timeout_error.phpt 2011-01-05 12:15:40.000000000 +0300 --- ext/snmp/tests/generic_timeout_error.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/generic_timeout_error.phpt 2010-12-21 23:33:35.000000000 +0300 @@ -0,0 +1,22 @@ +--TEST-- +Generic timeout (wrong community) +--CREDITS-- Line 99 (now 96), was 11 lines, now 10 lines +--EXPECTF-- +Warning: snmpget(): No response from %s in %s on line %d +bool(false) \ No newline at end of file diff -ruN trunk/ext/snmp/tests/skipif.inc snmp-new/ext/snmp/tests/skipif.inc --- trunk/ext/snmp/tests/skipif.inc 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/skipif.inc 2010-12-18 14:33:17.000000000 +0300 --- ext/snmp/tests/skipif.inc 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/skipif.inc 2010-12-18 14:33:17.000000000 +0300 @@ -0,0 +1,13 @@ +<?php +extension_loaded('snmp') or die('skip snmp extension not available in this build'); + Line 116 (now 112), was 16 lines, now 15 lines + +if (snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout) === false) + die('NO SNMPD on this host or community invalid'); + diff -ruN trunk/ext/snmp/tests/snmp-object-error.phpt snmp-new/ext/snmp/tests/snmp-object-error.phpt --- trunk/ext/snmp/tests/snmp-object-error.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmp-object-error.phpt 2011-01-05 15:31:21.000000000 +0300 @@ -0,0 +1,84 @@ --- ext/snmp/tests/snmp2_get.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmp2_get.phpt 2010-12-21 17:08:24.000000000 +0300 @@ -0,0 +1,107 @@ +--TEST-- +Errors in SNMP session-wise functions +Function snmp2_get +--CREDITS-- +Boris Lytochkin +Olivier Doucet & Boris Lytochkin +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> Line 136 (now 131), was 278 lines, now 106 lines +//EXPECTF format is quickprint OFF +snmp_set_quick_print(false); +snmp_set_valueretrieval(SNMP_VALUE_PLAIN); + +try { +var_dump(new SNMP(SNMP_VERSION_1, $hostname)); +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} +try { +var_dump(new SNMP(SNMP_VERSION_1, $hostname, $community, '')); +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} +try { +var_dump(new SNMP(SNMP_VERSION_1, $hostname, $community, $timeout, '')); +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} +try { +var_dump(new SNMP(7, $hostname, $community)); +} catch (Exception $e) { + print $e->getMessage() . "\n"; +} +echo "Checking error handling\n"; +var_dump(snmp2_get($hostname, $community, '.1.3.6.1.2.1.1.1.0', '')); +var_dump(snmp2_get($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, '')); +echo "Empty OID array\n"; +var_dump(snmp2_get($hostname, $community, array(), $timeout, $retries)); + +echo "Open normal session\n"; +$session = new SNMP(SNMP_VERSION_3, $hostname, $user_noauth, $timeout, $retries); +$session->valueretrieval = 67; +var_dump($session->valueretrieval); +echo "Closing session\n"; +var_dump($session->close('')); +var_dump($session->close()); +var_dump($session->get('.1.3.6.1.2.1.1.1.0')); +var_dump($session->close()); +echo "Checking working\n"; +echo "Single OID\n"; +var_dump(snmp2_get($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, $retries)); +echo "Single OID in array\n"; +var_dump(snmp2_get($hostname, $community, array('.1.3.6.1.2.1.1.1.0'), $timeout, $retries)); +echo "Multiple OID\n"; +var_dump(snmp2_get($hostname, $community, array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.1.1.3.0'), $timeout, $retries)); + +echo "More error handling\n"; +echo "Single OID\n"; +var_dump(snmp2_get($hostname, $community, '.1.3.6.1.2..1.1.1.0', $timeout, $retries)); +echo "Single OID in array\n"; +var_dump(snmp2_get($hostname, $community, array('.1.3.6.1.2.1...1.1.0'), $timeout, $retries)); +echo "Multiple OID\n"; +var_dump(snmp2_get($hostname, $community, array('.1.3.6.1.2.1...1.1.0', '.1.3.6.1.2.1.1.3.0'), $timeout, $retries)); + +echo "noSuchName checks\n"; +echo "Single OID\n"; +var_dump(snmp2_get($hostname, $community, '.1.3.6.1.2.1.1.1.110', $timeout, $retries)); +echo "Single OID in array\n"; +var_dump(snmp2_get($hostname, $community, array('.1.3.6.1.2.1.1.1.110'), $timeout, $retries)); +echo "Multiple OID\n"; +var_dump(snmp2_get($hostname, $community, array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.1.1.3.220'), $timeout, $retries)); + +$session = new SNMP(SNMP_VERSION_2c, $hostname, $community, $timeout, $retries); +var_dump($session->walk('.1.3.6.1.2.1.1', '')); +var_dump($session->walk('.1.3.6.1.2.1.1', 0, '')); +var_dump($session->get()); +var_dump($session->set()); + +?> +--EXPECTF-- +SNMP::__construct() expects at least 3 parameters, 2 given +SNMP::__construct() expects parameter 4 to be long, string given +SNMP::__construct() expects parameter 5 to be long, string given +Unknown SNMP protocol version +Open normal session +Checking error handling + +Warning: main(): Unknown SNMP value retrieval method '67' in %s on line %d +int(%d) +Closing session + +Warning: SNMP::close() expects exactly 0 parameters, 1 given in %s on line %d +Warning: snmp2_get() expects parameter 4 to be long,%s given in %s on line %d +bool(false) +bool(true) + +Warning: SNMP::get(): Invalid or unitialized SNMP object in %s on line %d +Warning: snmp2_get() expects parameter 5 to be long,%s given in %s on line %d +bool(false) +bool(true) +Empty OID array + +Warning: SNMP::walk() expects parameter 2 to be long, string given in %s on line %d +Warning: snmp2_get(): Got empty OID array in %s on line %d +bool(false) + +Warning: SNMP::walk() expects parameter 3 to be long, string given in %s on line %d +bool(false) + +Warning: SNMP::get() expects exactly 1 parameter, 0 given in %s on line %d +bool(false) + +Warning: SNMP::set() expects exactly 3 parameters, 0 given in %s on line %d +bool(false) diff -ruN trunk/ext/snmp/tests/snmp-object-properties.phpt snmp-new/ext/snmp/tests/snmp-object-properties.phpt --- trunk/ext/snmp/tests/snmp-object-properties.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmp-object-properties.phpt 2011-01-05 17:57:02.000000000 +0300 @@ -0,0 +1,118 @@ +--TEST-- +OO API: SNMP object properties +--CREDITS-- +Boris Lytochkin +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +require_once(dirname(__FILE__).'/snmp_include.inc'); + +//EXPECTF format is quickprint OFF +snmp_set_enum_print(false); +snmp_set_quick_print(false); +snmp_set_valueretrieval(SNMP_VALUE_PLAIN); +snmp_set_oid_output_format(SNMP_OID_OUTPUT_FULL); + +echo "Check working\n"; + +$session = new SNMP(SNMP_VERSION_1, $hostname, $community, $timeout, $retries); +var_dump($session); + +$session->enum_print = TRUE; +$session->quick_print = TRUE; +$session->valueretrieval = SNMP_VALUE_LIBRARY; +$session->oid_output_format = SNMP_OID_OUTPUT_NUMERIC; + +var_dump($session); + +$session->enum_print = "1"; +$session->quick_print = "1"; +$session->valueretrieval = "1"; +$session->oid_output_format = "3"; + +var_dump($session); + +var_dump(property_exists($session, "enum_print")); +var_dump(isset($session->enum_print)); +var_dump(empty($session->enum_print)); + +$param=123; +$session->$param = "param_value"; +var_dump($session); +var_dump($session->$param); +var_dump(property_exists($session, $param)); + +echo "Error handling\n"; +$param = 'there is no such parameter'; +var_dump($session->$param); +var_dump(property_exists($session, $param)); + +$session->valueretrieval = 67; +var_dump($session->valueretrieval); +$session->oid_output_format = 78; +var_dump($session->oid_output_format); + +?> +--EXPECTF-- +Check working +object(SNMP)#%d (%d) { + ["valueretrieval"]=> + int(1) + ["quick_print"]=> + bool(false) + ["enum_print"]=> + bool(false) + ["oid_output_format"]=> + int(3) +Checking working +Single OID +%unicode|string%(%d) "%s" +Single OID in array +array(1) { + [0]=> + %unicode|string%(%d) "%s" +} +object(SNMP)#%d (%d) { + ["valueretrieval"]=> + int(0) + ["quick_print"]=> + bool(true) + ["enum_print"]=> + bool(true) + ["oid_output_format"]=> + int(4) +Multiple OID +array(2) { + [0]=> + %unicode|string%(%d) "%s" + [1]=> + %unicode|string%(%d) "%d" +} +object(SNMP)#%d (%d) { + ["valueretrieval"]=> + int(1) + ["quick_print"]=> + bool(true) + ["enum_print"]=> + bool(true) + ["oid_output_format"]=> + int(3) +} +bool(true) +bool(true) +bool(false) +object(SNMP)#%d (%d) { + ["valueretrieval"]=> + int(1) + ["quick_print"]=> + bool(true) + ["enum_print"]=> + bool(true) + ["oid_output_format"]=> + int(3) + ["123"]=> + string(11) "param_value" +} +string(11) "param_value" +bool(true) +Error handling +More error handling +Single OID + +Notice: Undefined property: SNMP::$there is no such parameter in %s on line %d +NULL +Warning: snmp2_get(): Invalid object identifier: .1.3.6.1.2..1.1.1.0 in %s on line %d +bool(false) +Single OID in array + +Warning: main(): Unknown SNMP value retrieval method '67' in %s on line %d +int(1) + +Warning: main(): Unknown SNMP output print format '78' in %s on line %d +int(3) \ No newline at end of file diff -ruN trunk/ext/snmp/tests/snmp-object-set_security_error.phpt snmp-new/ext/snmp/tests/snmp-object-set_security_error.phpt --- trunk/ext/snmp/tests/snmp-object-set_security_error.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmp-object-set_security_error.phpt 2011-01-05 15:34:13.000000000 +0300 @@ -0,0 +1,66 @@ +--TEST-- +OO API SNMP::set_security (errors) +--CREDITS-- +Boris Lytochkin +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +require_once(dirname(__FILE__).'/snmp_include.inc'); + +//EXPECTF format is quickprint OFF +snmp_set_quick_print(false); +snmp_set_valueretrieval(SNMP_VALUE_PLAIN); + +$session = new SNMP(SNMP_VERSION_3, $hostname, $user_noauth, $timeout, $retries); +$session->set_security('noAuthNoPriv'); + +#echo "Checking error handling\n"; +var_dump($session->set_security()); +var_dump($session->set_security('')); +var_dump($session->set_security('bugusPriv')); +var_dump($session->set_security('authNoPriv', 'TTT')); +var_dump($session->set_security('authNoPriv', 'MD5', '')); +var_dump($session->set_security('authNoPriv', 'MD5', 'te')); +var_dump($session->set_security('authPriv', 'MD5', $auth_pass, 'BBB')); +var_dump($session->set_security('authPriv', 'MD5', $auth_pass, 'AES', '')); +var_dump($session->set_security('authPriv', 'MD5', $auth_pass, 'AES', 'ty')); +var_dump($session->set_security('authPriv', 'MD5', $auth_pass, 'AES', 'test12345', 'context', 'dsa')); + +var_dump($session->close()); + +?> +--EXPECTF-- + +Warning: SNMP::set_security() expects at least 1 parameter, 0 given in %s on line %d +Warning: snmp2_get(): Invalid object identifier: .1.3.6.1.2.1...1.1.0 in %s on line %d +bool(false) +Multiple OID + +Warning: SNMP::set_security(): Invalid security level '' in %s on line %d +bool(false) +Warning: snmp2_get(): Invalid object identifier: .1.3.6.1.2.1...1.1.0 in %s on line %d +array(1) { + [0]=> + %unicode|string%(%d) "%d" +} +noSuchName checks +Single OID + +Warning: SNMP::set_security(): Invalid security level 'bugusPriv' in %s on line %d +Warning: snmp2_get(): Error in packet at 'SNMPv2-MIB::sysDescr.110': No Such Instance currently exists at this OID in %s on line %d +bool(false) +Single OID in array + +Warning: SNMP::set_security(): Unknown authentication protocol 'TTT' in %s on line %d +Warning: snmp2_get(): Error in packet at 'SNMPv2-MIB::sysDescr.110': No Such Instance currently exists at this OID in %s on line %d +bool(false) +Multiple OID + +Warning: SNMP::set_security(): Error generating a key for authentication pass phrase '': Generic error (The supplied password length is too short.) in %s on line %d +bool(false) + +Warning: SNMP::set_security(): Error generating a key for authentication pass phrase 'te': Generic error (The supplied password length is too short.) in %s on line %d +bool(false) + +Warning: SNMP::set_security(): Unknown security protocol 'BBB' in %s on line %d +bool(false) + +Warning: SNMP::set_security(): Error generating a key for privacy pass phrase '': Generic error (The supplied password length is too short.) in %s on line %d +bool(false) + +Warning: SNMP::set_security(): Error generating a key for privacy pass phrase 'ty': Generic error (The supplied password length is too short.) in %s on line %d +bool(false) + +Warning: SNMP::set_security(): Bad engine ID value 'dsa' in %s on line %d +bool(false) +bool(true) \ No newline at end of file diff -ruN trunk/ext/snmp/tests/snmp-object.phpt snmp-new/ext/snmp/tests/snmp-object.phpt --- trunk/ext/snmp/tests/snmp-object.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmp-object.phpt 2011-01-05 16:16:12.000000000 +0300 @@ -0,0 +1,161 @@ +Warning: snmp2_get(): Error in packet at 'SNMPv2-MIB::sysUpTime.220': No Such Instance currently exists at this OID in %s on line %d +array(1) { + [0]=> + %unicode|string%(%d) "%s" +} --- ext/snmp/tests/snmp2_getnext.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmp2_getnext.phpt 2010-12-19 22:44:42.000000000 +0300 @@ -0,0 +1,39 @@ +--TEST-- +OO API +Function snmp2_getnext +--CREDITS-- +Boris Lytochkin +Olivier Doucet & Boris Lytochkin +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> Line 415 (now 238), was 163 lines, now 39 lines +<?php +require_once(dirname(__FILE__).'/snmp_include.inc'); + +//EXPECTF format is quickprint OFF +snmp_set_enum_print(false); +snmp_set_quick_print(false); +snmp_set_valueretrieval(SNMP_VALUE_PLAIN); +snmp_set_oid_output_format(SNMP_OID_OUTPUT_FULL); + +echo "SNMPv1\n"; +$session = new SNMP(SNMP_VERSION_1, $hostname, $community, $timeout, $retries); +$session->valueretrieval = SNMP_VALUE_LIBRARY; +var_dump($session->get('.1.3.6.1.2.1.1.1.0')); +var_dump($session->get(array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.1.1.3.0'))); +var_dump($session->getnext('.1.3.6.1.2.1.1.1.0')); +var_dump($session->close()); + +echo "SNMPv2\n"; +$session = new SNMP(SNMP_VERSION_2c, $hostname, $community, $timeout, $retries); +var_dump($session->get('.1.3.6.1.2.1.1.1.0')); +var_dump($session->getnext('.1.3.6.1.2.1.1.1.0')); +var_dump($session->close()); + +echo "WALK multiple on single OID\n"; +$session = new SNMP(SNMP_VERSION_2c, $hostname, $community, $timeout, $retries); +$z = $session->walk('.1.3.6.1.2.1.1'); +var_dump(gettype($z)); +var_dump(count($z)); +var_dump(key($z)); +var_dump(array_shift($z)); +var_dump($session->close()); + +echo "WALK multiple on single OID, non_repeaters set to 0\n"; +$session = new SNMP(SNMP_VERSION_2c, $hostname, $community, $timeout, $retries); +$z = $session->walk('.1.3.6.1.2.1.1', 0); +var_dump(gettype($z)); +var_dump(count($z)); +var_dump(key($z)); +var_dump(array_shift($z)); +var_dump($session->close()); + +echo "WALK multiple on single OID, non_repeaters set to 0, max_repetitions set to 30\n"; +$session = new SNMP(SNMP_VERSION_2c, $hostname, $community, $timeout, $retries); +$z = $session->walk('.1.3.6.1.2.1.1', 0, 30); +var_dump(gettype($z)); +var_dump(count($z)); +var_dump(key($z)); +var_dump(array_shift($z)); +var_dump($session->close()); + +echo "SNMPv3 (default security settings)\n"; +$session = new SNMP(SNMP_VERSION_3, $hostname, $user_noauth, $timeout, $retries); +#$session->set_security($user_noauth, 'noAuthNoPriv', '', '', '', '', '', ''); +var_dump($session->get('.1.3.6.1.2.1.1.1.0')); +var_dump($session->getnext('.1.3.6.1.2.1.1.1.0')); +var_dump($session->close()); + +echo "SNMPv3 (noAuthNoPriv)\n"; +$session = new SNMP(SNMP_VERSION_3, $hostname, $user_noauth, $timeout, $retries); +$session->set_security('noAuthNoPriv'); +var_dump($session->get('.1.3.6.1.2.1.1.1.0')); +var_dump($session->getnext('.1.3.6.1.2.1.1.1.0')); +var_dump($session->close()); + +echo "SNMPv3 (authPriv)\n"; +$session = new SNMP(SNMP_VERSION_3, $hostname, $rwuser, $timeout, $retries); +$session->set_security('authPriv', 'MD5', $auth_pass, 'AES', $priv_pass); +var_dump($session->get('.1.3.6.1.2.1.1.1.0')); +var_dump($session->getnext('.1.3.6.1.2.1.1.1.0')); +var_dump($session->walk('.1.3.6.1.2.1.1.1.0')); +var_dump($session->close()); + +echo "SET single OID\n"; +$session = new SNMP(SNMP_VERSION_3, $hostname, $rwuser, $timeout, $retries); +$session->set_security('authPriv', 'MD5', $auth_pass, 'AES', $priv_pass); +$oid1 = 'SNMPv2-MIB::sysContact.0'; +$oldvalue1 = $session->get($oid1); +$newvalue1 = $oldvalue1 . '0'; + +$z = $session->set($oid1, 's', $newvalue1); +var_dump($z); +var_dump(($session->get($oid1) === $newvalue1)); +$z = $session->set($oid1, 's', $oldvalue1); +var_dump($z); +var_dump(($session->get($oid1) === $oldvalue1)); +var_dump($session->close()); + +echo "SNMPv3, setting contextEngineID (authPriv)\n"; +$session = new SNMP(SNMP_VERSION_3, $hostname, $rwuser, $timeout, $retries); +$session->set_security('authPriv', 'MD5', $auth_pass, 'AES', $priv_pass, '', 'aeeeff'); +var_dump($session->get('.1.3.6.1.2.1.1.1.0')); +var_dump($session->close()); +echo "Single OID\n"; +var_dump(snmp2_getnext($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, $retries)); +echo "Single OID in array\n"; +var_dump(snmp2_getnext($hostname, $community, array('.1.3.6.1.2.1.1.1.0'), $timeout, $retries)); +echo "Multiple OID\n"; +var_dump(snmp2_getnext($hostname, $community, array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.1.1.6.0'), $timeout, $retries)); + +?> +--EXPECTF-- +SNMPv1 +string(%d) "%S" +Single OID +%unicode|string%(%d) "%s" +Single OID in array +array(1) { + [0]=> + %unicode|string%(%d) "%s" +} +Multiple OID +array(2) { + ["%s"]=> + string(%d) "%S" + ["%s"]=> + string(%d) "%S" + [0]=> + %unicode|string%(%d) "%s" + [1]=> + %unicode|string%(%d) "%d" +} +string(%d) "%S" +bool(true) +SNMPv2 +string(%d) "%S" +string(%d) "%S" +bool(true) +WALK multiple on single OID +string(5) "array" +int(%d) +string(%d) "%S" +string(%d) "%S" +bool(true) +WALK multiple on single OID, non_repeaters set to 0 +string(5) "array" +int(%d) +string(%d) "%S" +string(%d) "%S" +bool(true) +WALK multiple on single OID, non_repeaters set to 0, max_repetitions set to 30 +string(5) "array" +int(%d) +string(%d) "%S" +string(%d) "%S" +bool(true) +SNMPv3 (default security settings) +string(%d) "%S" +string(%d) "%S" +bool(true) +SNMPv3 (noAuthNoPriv) +string(%d) "%S" +string(%d) "%S" +bool(true) +SNMPv3 (authPriv) +string(%d) "%S" +string(%d) "%S" +array(1) { + [%s]=> + string(%d) "%S" +} +bool(true) +SET single OID +bool(true) +bool(true) +bool(true) +bool(true) +bool(true) +SNMPv3, setting contextEngineID (authPriv) +string(%d) "%S" +bool(true) \ No newline at end of file diff -ruN trunk/ext/snmp/tests/snmp2_get.phpt snmp-new/ext/snmp/tests/snmp2_get.phpt --- trunk/ext/snmp/tests/snmp2_get.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmp2_get.phpt 2010-12-31 00:06:53.000000000 +0300 @@ -0,0 +1,107 @@ --- ext/snmp/tests/snmp2_real_get.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmp2_real_get.phpt 2010-12-19 18:46:41.000000000 +0300 @@ -0,0 +1,104 @@ +--TEST-- +Function snmp2_get +Function snmp2_real_get +--CREDITS-- +Olivier Doucet & Boris Lytochkin +--SKIPIF-- +<?php Line 585 (now 284), was 54 lines, now 51 lines +snmp_set_quick_print(false); +snmp_set_valueretrieval(SNMP_VALUE_PLAIN); + +echo "Checking error handling\n"; +var_dump(snmp2_get($hostname, $community, '.1.3.6.1.2.1.1.1.0', '')); +var_dump(snmp2_get($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, '')); +echo "Empty OID array\n"; +var_dump(snmp2_get($hostname, $community, array(), $timeout, $retries)); +var_dump(snmp2_real_get($hostname, $community, '.1.3.6.1.2.1.1.1.0', '')); +var_dump(snmp2_real_get($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, '')); + +echo "Checking working\n"; +echo "Single OID\n"; +var_dump(snmp2_get($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, $retries)); +var_dump(snmp2_real_get($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, $retries)); +echo "Single OID in array\n"; +var_dump(snmp2_get($hostname, $community, array('.1.3.6.1.2.1.1.1.0'), $timeout, $retries)); +var_dump(snmp2_real_get($hostname, $community, array('.1.3.6.1.2.1.1.1.0'), $timeout, $retries)); +echo "Multiple OID\n"; +var_dump(snmp2_get($hostname, $community, array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.1.1.3.0'), $timeout, $retries)); +var_dump(snmp2_real_get($hostname, $community, array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.1.1.3.0'), $timeout, $retries)); + +echo "More error handling\n"; +echo "Single OID\n"; +var_dump(snmp2_get($hostname, $community, '.1.3.6.1.2..1.1.1.0', $timeout, $retries)); +var_dump(snmp2_real_get($hostname, $community, '.1.3.6.1.2.1..1.1.0', $timeout, $retries)); +echo "Single OID in array\n"; +var_dump(snmp2_get($hostname, $community, array('.1.3.6.1.2.1...1.1.0'), $timeout, $retries)); +var_dump(snmp2_real_get($hostname, $community, array('.1.3.6.1.2.1...1.1.0'), $timeout, $retries)); +echo "Multiple OID\n"; +var_dump(snmp2_get($hostname, $community, array('.1.3.6.1.2.1...1.1.0', '.1.3.6.1.2.1.1.3.0'), $timeout, $retries)); +var_dump(snmp2_real_get($hostname, $community, array('.1.3.6.1.2.1...1.1.0', '.1.3.6.1.2.1.1.3.0'), $timeout, $retries)); + +echo "noSuchName checks\n"; +echo "Single OID\n"; +var_dump(snmp2_get($hostname, $community, '.1.3.6.1.2.1.1.1.110', $timeout, $retries)); +var_dump(snmp2_real_get($hostname, $community, '.1.3.6.1.2.1.1.1.110', $timeout, $retries)); +echo "Single OID in array\n"; +var_dump(snmp2_get($hostname, $community, array('.1.3.6.1.2.1.1.1.110'), $timeout, $retries)); +var_dump(snmp2_real_get($hostname, $community, array('.1.3.6.1.2.1.1.1.110'), $timeout, $retries)); +echo "Multiple OID\n"; +var_dump(snmp2_get($hostname, $community, array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.1.1.3.220'), $timeout, $retries)); +var_dump(snmp2_real_get($hostname, $community, array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.1.1.3.220'), $timeout, $retries)); + + +?> +--EXPECTF-- +Checking error handling + +Warning: snmp2_get() expects parameter 4 to be long,%s given in %s on line %d +Warning: snmp2_real_get() expects parameter 4 to be long,%s given in %s on line %d +bool(false) + +Warning: snmp2_get() expects parameter 5 to be long,%s given in %s on line %d +bool(false) +Empty OID array + +Warning: snmp2_get(): Got empty OID array in %s on line %d +Warning: snmp2_real_get() expects parameter 5 to be long,%s given in %s on line %d +bool(false) +Checking working +Single OID +%unicode|string%(%d) "%s" +array(1) { + ["%s"]=> + %unicode|string%(%d) "%s" +} +Single OID in array +array(1) { + ["%s"]=> + %unicode|string%(%d) "%s" Line 646 (now 342), was 45 lines, now 44 lines +} +More error handling +Single OID + +Warning: snmp2_get(): Invalid object identifier: .1.3.6.1.2..1.1.1.0 in %s on line %d +Warning: snmp2_real_get(): Invalid object identifier: .1.3.6.1.2.1..1.1.0 in %s on line %d +bool(false) +Single OID in array + +Warning: snmp2_get(): Invalid object identifier: .1.3.6.1.2.1...1.1.0 in %s on line %d +Warning: snmp2_real_get(): Invalid object identifier: .1.3.6.1.2.1...1.1.0 in %s on line %d +bool(false) +Multiple OID + +Warning: snmp2_get(): Invalid object identifier: .1.3.6.1.2.1...1.1.0 in %s on line %d +Warning: snmp2_real_get(): Invalid object identifier: .1.3.6.1.2.1...1.1.0 in %s on line %d +array(1) { + ["%s"]=> + [%s]=> + %unicode|string%(%d) "%d" +} +noSuchName checks +Single OID + +Warning: snmp2_get(): Error in packet at 'SNMPv2-MIB::sysDescr.110': No Such Instance currently exists at this OID in %s on line %d +Warning: snmp2_real_get(): Error in packet at 'SNMPv2-MIB::sysDescr.110': No Such Instance currently exists at this OID in %s on line %d +bool(false) +Single OID in array + +Warning: snmp2_get(): Error in packet at 'SNMPv2-MIB::sysDescr.110': No Such Instance currently exists at this OID in %s on line %d +Warning: snmp2_real_get(): Error in packet at 'SNMPv2-MIB::sysDescr.110': No Such Instance currently exists at this OID in %s on line %d +bool(false) +Multiple OID + +Warning: snmp2_get(): Error in packet at 'SNMPv2-MIB::sysUpTime.220': No Such Instance currently exists at this OID in %s on line %d +Warning: snmp2_real_get(): Error in packet at 'SNMPv2-MIB::sysUpTime.220': No Such Instance currently exists at this OID in %s on line %d +array(1) { + ["%s"]=> + [%s]=> + %unicode|string%(%d) "%s" +} diff -ruN trunk/ext/snmp/tests/snmp2_getnext.phpt snmp-new/ext/snmp/tests/snmp2_getnext.phpt --- trunk/ext/snmp/tests/snmp2_getnext.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmp2_getnext.phpt 2010-12-31 00:07:55.000000000 +0300 @@ -0,0 +1,39 @@ --- ext/snmp/tests/snmp2_real_getnext.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmp2_real_getnext.phpt 2010-12-20 11:22:38.000000000 +0300 @@ -0,0 +1,42 @@ +--TEST-- +Function snmp2_getnext +Function snmp2_real_getnext +--CREDITS-- +Olivier Doucet & Boris Lytochkin +Boris Lytochkin +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +snmp_set_quick_print(false); +snmp_set_valueretrieval(SNMP_VALUE_PLAIN); + +echo "Single OID\n"; +var_dump(snmp2_getnext($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, $retries)); +var_dump(snmp2_real_getnext($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, $retries)); +echo "Single OID in array\n"; +var_dump(snmp2_getnext($hostname, $community, array('.1.3.6.1.2.1.1.1.0'), $timeout, $retries)); +var_dump(snmp2_real_getnext($hostname, $community, array('.1.3.6.1.2.1.1.1.0'), $timeout, $retries)); +echo "Multiple OID\n"; +var_dump(snmp2_getnext($hostname, $community, array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.1.1.6.0'), $timeout, $retries)); +var_dump(snmp2_real_getnext($hostname, $community, array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.1.1.6.0'), $timeout, $retries)); + +?> +--EXPECTF-- +Single OID +%unicode|string%(%d) "%s" +array(1) { + [%s]=> + %unicode|string%(%d) "%s" +} +Single OID in array +array(1) { + ["%s"]=> + [%s]=> + %unicode|string%(%d) "%s" +} +Multiple OID +array(2) { + ["%s"]=> + [%s]=> + %unicode|string%(%d) "%s" + ["%s"]=> + [%s]=> + %unicode|string%(%d) "%d" +} diff -ruN trunk/ext/snmp/tests/snmp2_real_walk.phpt snmp-new/ext/snmp/tests/snmp2_real_walk.phpt --- trunk/ext/snmp/tests/snmp2_real_walk.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmp2_real_walk.phpt 2010-12-21 23:31:59.000000000 +0300 --- ext/snmp/tests/snmp2_real_walk.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmp2_real_walk.phpt 2010-12-21 23:31:59.000000000 +0300 @@ -0,0 +1,86 @@ +--TEST-- +Function snmp2_real_walk +--CREDITS-- Line 808 (now 505), was 14 lines, now 13 lines +Single nonexisting OID + +Warning: snmp2_real_walk(): Error in packet at '%s': No more variables left in this MIB View (It is past the end of the MIB tree) in %s on line %d +bool(false) diff -ruN trunk/ext/snmp/tests/snmp2_set-nomib.phpt snmp-new/ext/snmp/tests/snmp2_set-nomib.phpt --- trunk/ext/snmp/tests/snmp2_set-nomib.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmp2_set-nomib.phpt 2010-12-27 23:49:25.000000000 +0300 --- ext/snmp/tests/snmp2_set-nomib.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmp2_set-nomib.phpt 2010-12-20 11:05:38.000000000 +0300 @@ -0,0 +1,59 @@ +--TEST-- +Function snmp2_set (without MIBs loading) +Function snmp2_set +--CREDITS-- +Boris Lytockin +--SKIPIF-- +<?php Line 872 (now 568), was 11 lines, now 10 lines +bool(true) +bool(true) +bool(true) \ No newline at end of file diff -ruN trunk/ext/snmp/tests/snmp2_set.phpt snmp-new/ext/snmp/tests/snmp2_set.phpt --- trunk/ext/snmp/tests/snmp2_set.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmp2_set.phpt 2010-12-20 10:36:16.000000000 +0300 --- ext/snmp/tests/snmp2_set.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmp2_set.phpt 2010-12-20 10:36:16.000000000 +0300 @@ -0,0 +1,248 @@ +--TEST-- +Function snmp2_set +--CREDITS-- Line 1124 (now 819), was 11 lines, now 10 lines +Warning: snmp2_set(): Could not add variable: OID='%s' type='w' value='%s': Bad variable type ("w") in %s on line %d +bool(false) +bool(true) +bool(true) diff -ruN trunk/ext/snmp/tests/snmp2_walk.phpt snmp-new/ext/snmp/tests/snmp2_walk.phpt --- trunk/ext/snmp/tests/snmp2_walk.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmp2_walk.phpt 2010-12-21 23:31:59.000000000 +0300 --- ext/snmp/tests/snmp2_walk.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmp2_walk.phpt 2010-12-21 23:31:59.000000000 +0300 @@ -0,0 +1,99 @@ +--TEST-- +Function snmp2_walk +--CREDITS-- Line 1227 (now 921), was 14 lines, now 13 lines +Single nonexisting OID + +Warning: snmp2_walk(): Error in packet at '%s': No more variables left in this MIB View (It is past the end of the MIB tree) in %s on line %d +bool(false) diff -ruN trunk/ext/snmp/tests/snmp3-error.phpt snmp-new/ext/snmp/tests/snmp3-error.phpt --- trunk/ext/snmp/tests/snmp3-error.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmp3-error.phpt 2010-12-27 23:48:55.000000000 +0300 --- ext/snmp/tests/snmp3-error.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmp3-error.phpt 2010-12-21 22:11:55.000000000 +0300 @@ -0,0 +1,76 @@ +--TEST-- +SNMPv3 Support (errors) +SNMPv3 Support +--CREDITS-- +Boris Lytochkin +--SKIPIF-- +<?php Line 1308 (now 1001), was 12 lines, now 11 lines + +Warning: snmp3_set(): Single objid and multiple type or values are not supported in %s on line %d +bool(false) \ No newline at end of file diff -ruN trunk/ext/snmp/tests/snmp3.phpt snmp-new/ext/snmp/tests/snmp3.phpt --- trunk/ext/snmp/tests/snmp3.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmp3.phpt 2010-12-31 00:12:57.000000000 +0300 @@ -0,0 +1,127 @@ --- ext/snmp/tests/snmp3.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmp3.phpt 2010-12-21 23:32:14.000000000 +0300 @@ -0,0 +1,141 @@ +--TEST-- +SNMPv3 Support +--CREDITS-- +Boris Lytochkin +echo "GET multiple\n"; +var_dump(snmp3_get($hostname, $username, 'authNoPriv', 'MD5', $auth_pass, '', '', array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.1.1.3.0'), $timeout, $retries)); +echo "GETNEXT single\n"; +var_dump(snmp3_getnext($hostname, $username, 'authNoPriv', 'MD5', $auth_pass, '', '', '.1.3.6.1.2.1.1.1.0', $timeout, $retries)); +echo "REALGET single\n"; +var_dump(snmp3_real_get($hostname, $username, 'authNoPriv', 'MD5', $auth_pass, '', '', '.1.3.6.1.2.1.1.1.0', $timeout, $retries)); +echo "REALGETNEXT single\n"; +var_dump(snmp3_real_getnext($hostname, $username, 'authNoPriv', 'MD5', $auth_pass, '', '', '.1.3.6.1.2.1.1.1.0', $timeout, $retries)); + +echo "WALK single on single OID\n"; +$z = snmp3_walk($hostname, $username, 'authNoPriv', 'MD5', $auth_pass, '', '', '.1.3.6.1.2.1.1.1.0', $timeout, $retries); +var_dump(gettype($z)); +GET single: MD5/AES128 +%string|unicode%(%d) "%s" +GET multiple +array(2) { + ["%s"]=> + [0]=> + %string|unicode%(%d) "%s" + ["%s"]=> + [1]=> + %string|unicode%(%d) "%s" +} +GETNEXT single +%string|unicode%(%d) "%s" +REALGET single +array(1) { + ["%s"]=> + %string|unicode%(%d) "%s" +} +REALGETNEXT single +array(1) { + ["%s"]=> + %string|unicode%(%d) "%s" +} +WALK single on single OID +%string|unicode%(5) "array" +int(1) +array(1) { Line 1439 (now 1145), was 11 lines, now 10 lines +bool(true) +bool(true) +bool(true) +bool(true) diff -ruN trunk/ext/snmp/tests/snmp_get_quick_print.phpt snmp-new/ext/snmp/tests/snmp_get_quick_print.phpt --- trunk/ext/snmp/tests/snmp_get_quick_print.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmp_get_quick_print.phpt 2011-01-05 15:03:40.000000000 +0300 --- ext/snmp/tests/snmp_get_quick_print.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmp_get_quick_print.phpt 2010-12-19 14:03:23.000000000 +0300 @@ -0,0 +1,41 @@ +--TEST-- +Function snmp_get_quick_print / snmp_set_quick_print +--CREDITS-- Line 1484 (now 1189), was 12 lines, now 11 lines +bool(%s) +bool(false) +bool(true) + diff -ruN trunk/ext/snmp/tests/snmp_get_valueretrieval.phpt snmp-new/ext/snmp/tests/snmp_get_valueretrieval.phpt --- trunk/ext/snmp/tests/snmp_get_valueretrieval.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmp_get_valueretrieval.phpt 2010-12-30 20:14:38.000000000 +0300 @@ -0,0 +1,41 @@ --- ext/snmp/tests/snmp_get_valueretrieval.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmp_get_valueretrieval.phpt 2010-12-19 14:17:55.000000000 +0300 @@ -0,0 +1,37 @@ +--TEST-- +Function snmp_get_valueretrieval / snmp_set_valueretrieval +--CREDITS-- +Olivier Doucet Line 1503 (now 1207), was 9 lines, now 8 lines + +echo "Checking error handling\n"; +var_dump(snmp_get_valueretrieval('noarg')); +var_dump(snmp_set_valueretrieval('noarg')); +var_dump(snmp_set_valueretrieval(67)); + +echo "Checking working\n"; +var_dump(snmp_get_valueretrieval()); +snmp_set_valueretrieval(SNMP_VALUE_LIBRARY); Line 1520 (now 1223), was 20 lines, now 16 lines +Checking error handling +int(%d) + +Warning: snmp_set_valueretrieval() expects parameter 1 to be long, %s given in %s on line %d +bool(false) + +Warning: snmp_set_valueretrieval(): Unknown SNMP value retrieval method '67' in %s on line %d +bool(false) +Checking working +int(%d) +bool(true) +bool(true) +bool(true) diff -ruN trunk/ext/snmp/tests/snmp_getvalue.phpt snmp-new/ext/snmp/tests/snmp_getvalue.phpt --- trunk/ext/snmp/tests/snmp_getvalue.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmp_getvalue.phpt 2010-12-19 19:37:10.000000000 +0300 --- ext/snmp/tests/snmp_getvalue.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmp_getvalue.phpt 2010-12-19 19:37:10.000000000 +0300 @@ -0,0 +1,46 @@ +--TEST-- +Function snmp_getvalue +--CREDITS-- Line 1579 (now 1278), was 11 lines, now 10 lines +int(4) +string(%d) "%s" +Check parsing of different OID types +int(%d) diff -ruN trunk/ext/snmp/tests/snmp_include.inc snmp-new/ext/snmp/tests/snmp_include.inc --- trunk/ext/snmp/tests/snmp_include.inc 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmp_include.inc 2010-12-21 15:40:33.000000000 +0300 --- ext/snmp/tests/snmp_include.inc 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmp_include.inc 2010-12-21 15:40:33.000000000 +0300 @@ -0,0 +1,29 @@ +<?php + +/* Line 1612 (now 1310), was 11 lines, now 10 lines +$user_auth_prefix = getenv('SNMP_USER_PREFIX') ? getenv('SNMP_USER_PREFIX') : 'admin'; +$rwuser = getenv('SNMP_RWUSER') ? getenv('SNMP_RWUSER') : ($user_auth_prefix . 'MD5AES'); +$auth_pass = getenv('SNMP_AUTH_PASS') ? getenv('SNMP_AUTH_PASS') : 'test1234'; +$priv_pass = getenv('SNMP_PRIV_PASS') ? getenv('SNMP_PRIV_PASS') : 'test1234'; diff -ruN trunk/ext/snmp/tests/snmp_parse_oid.phpt snmp-new/ext/snmp/tests/snmp_parse_oid.phpt --- trunk/ext/snmp/tests/snmp_parse_oid.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmp_parse_oid.phpt 2010-12-20 15:10:06.000000000 +0300 --- ext/snmp/tests/snmp_parse_oid.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmp_parse_oid.phpt 2010-12-20 15:10:06.000000000 +0300 @@ -0,0 +1,36 @@ +--TEST-- +Function snmp_parse_oid +--CREDITS-- Line 1653 (now 1350), was 11 lines, now 10 lines + +Warning: snmp2_get(): Could not process more than %d OIDs in singe GET/GETNEXT/SET query in %s on line %d +bool(false) \ No newline at end of file diff -ruN trunk/ext/snmp/tests/snmp_read_mib.phpt snmp-new/ext/snmp/tests/snmp_read_mib.phpt --- trunk/ext/snmp/tests/snmp_read_mib.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmp_read_mib.phpt 2010-12-21 23:31:59.000000000 +0300 --- ext/snmp/tests/snmp_read_mib.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmp_read_mib.phpt 2010-12-21 23:31:59.000000000 +0300 @@ -0,0 +1,34 @@ +--TEST-- +Function snmp_read_mib +--CREDITS-- Line 1691 (now 1387), was 11 lines, now 10 lines +Warning: snmp_read_mib(): Error while reading MIB file '%s': No such file or directory in %s on line %d +bool(false) +Checking working +bool(true) diff -ruN trunk/ext/snmp/tests/snmp_set_enum_print.phpt snmp-new/ext/snmp/tests/snmp_set_enum_print.phpt --- trunk/ext/snmp/tests/snmp_set_enum_print.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmp_set_enum_print.phpt 2010-12-19 14:16:50.000000000 +0300 --- ext/snmp/tests/snmp_set_enum_print.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmp_set_enum_print.phpt 2010-12-19 14:16:50.000000000 +0300 @@ -0,0 +1,28 @@ +--TEST-- +Function snmp_set_enum_print +--CREDITS-- Line 1723 (now 1418), was 12 lines, now 11 lines +bool(false) +Checking working +bool(true) +bool(true) diff -ruN trunk/ext/snmp/tests/snmp_set_oid_output_format.phpt snmp-new/ext/snmp/tests/snmp_set_oid_output_format.phpt --- trunk/ext/snmp/tests/snmp_set_oid_output_format.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmp_set_oid_output_format.phpt 2011-01-05 17:34:04.000000000 +0300 @@ -0,0 +1,32 @@ --- ext/snmp/tests/snmp_set_oid_output_format.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmp_set_oid_output_format.phpt 2010-12-19 14:05:11.000000000 +0300 @@ -0,0 +1,28 @@ +--TEST-- +Function snmp_set_oid_output_format +--CREDITS-- +Olivier Doucet Line 1742 (now 1436), was 9 lines, now 8 lines +require_once(dirname(__FILE__).'/snmp_include.inc'); + +echo "Checking error handling\n"; +var_dump(snmp_set_oid_output_format()); +var_dump(snmp_set_oid_output_format(123)); + +echo "Checking working\n"; +var_dump(snmp_set_oid_output_format(SNMP_OID_OUTPUT_FULL)); +var_dump(snmp_set_oid_output_format(SNMP_OID_OUTPUT_NUMERIC)); Line 1752 (now 1445), was 19 lines, now 15 lines +--EXPECTF-- +Checking error handling + +Warning: snmp_set_oid_output_format() expects exactly 1 parameter, 0 given in %s on line %d +bool(false) + +Warning: snmp_set_oid_output_format(): Unknown SNMP output print format '123' in %s on line %d +bool(false) +Checking working +bool(true) +bool(true) diff -ruN trunk/ext/snmp/tests/snmpget.phpt snmp-new/ext/snmp/tests/snmpget.phpt --- trunk/ext/snmp/tests/snmpget.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmpget.phpt 2010-12-31 00:06:32.000000000 +0300 @@ -0,0 +1,109 @@ --- ext/snmp/tests/snmpget.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmpget.phpt 2010-12-19 18:07:17.000000000 +0300 @@ -0,0 +1,101 @@ +--TEST-- +Function snmpget +--CREDITS-- +Olivier Doucet & Boris Lytochkin Line 1784 (now 1473), was 12 lines, now 8 lines +var_dump(snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', '')); +var_dump(snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, '')); + +echo "Checking working\n"; +echo "Single OID, default timeout and retries\n"; +var_dump(snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0')); +echo "Single OID, default retries\n"; +var_dump(snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout)); +echo "Single OID\n"; +var_dump(snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, $retries)); +echo "Single OID in array\n"; +var_dump(snmpget($hostname, $community, array('.1.3.6.1.2.1.1.1.0'), $timeout, $retries)); Line 1822 (now 1507), was 24 lines, now 20 lines + +Warning: snmpget() expects parameter 5 to be long,%s given in %s on line %d +bool(false) +Checking working +Single OID, default timeout and retries +%unicode|string%(%d) "%s" +Single OID, default retries +%unicode|string%(%d) "%s" +Single OID +%unicode|string%(%d) "%s" +Single OID in array +array(1) { + ["%s"]=> + [0]=> + %unicode|string%(%d) "%s" +} +Multiple OID +array(2) { + ["%s"]=> + [0]=> + %unicode|string%(%d) "%s" + ["%s"]=> + [1]=> + %unicode|string%(%d) "%d" +} +More error handling +Single OID +Multiple OID + +Warning: snmpget(): Invalid object identifier: .1.3.6.1.2.1...1.1.0 in %s on line %d +array(1) { + ["%s"]=> + [0]=> + %unicode|string%(%d) "%d" +} +noSuchName checks +Single OID Line 1869 (now 1550), was 14 lines, now 13 lines +Multiple OID + +Warning: snmpget(): Error in packet at 'SNMPv2-MIB::sysUpTime.220': (noSuchName) There is no such variable name in this MIB. in %s on line %d +array(1) { + ["%s"]=> + [0]=> + %unicode|string%(%d) "%s" +} diff -ruN trunk/ext/snmp/tests/snmpgetnext.phpt snmp-new/ext/snmp/tests/snmpgetnext.phpt --- trunk/ext/snmp/tests/snmpgetnext.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmpgetnext.phpt 2010-12-31 00:07:43.000000000 +0300 --- ext/snmp/tests/snmpgetnext.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmpgetnext.phpt 2010-12-19 22:42:55.000000000 +0300 @@ -0,0 +1,39 @@ +--TEST-- +Function snmpgetnext +--CREDITS-- +?> +--EXPECTF-- +Single OID +%unicode|string%(%d) "%s" +Single OID in array +array(1) { + [0]=> + %unicode|string%(%d) "%s" +} +Multiple OID +array(2) { + [0]=> + %unicode|string%(%d) "%s" + [1]=> + %unicode|string%(%d) "%d" +} --- ext/snmp/tests/snmprealget.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmprealget.phpt 2010-12-19 18:40:08.000000000 +0300 @@ -0,0 +1,104 @@ +--TEST-- +Function snmprealget +--CREDITS-- +Olivier Doucet & Boris Lytochkin +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +require_once(dirname(__FILE__).'/snmp_include.inc'); + +//EXPECTF format is quickprint OFF +snmp_set_quick_print(false); +snmp_set_valueretrieval(SNMP_VALUE_PLAIN); + +echo "Checking error handling\n"; +var_dump(snmprealget($hostname, $community, '.1.3.6.1.2.1.1.1.0', '')); +var_dump(snmprealget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, '')); + +echo "Checking working\n"; +echo "Single OID\n"; +var_dump(snmprealget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, $retries)); +echo "Single OID in array\n"; +var_dump(snmprealget($hostname, $community, array('.1.3.6.1.2.1.1.1.0'), $timeout, $retries)); +echo "Multiple OID\n"; +var_dump(snmprealget($hostname, $community, array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.1.1.3.0'), $timeout, $retries)); + +echo "More error handling\n"; +echo "Single OID\n"; +var_dump(snmprealget($hostname, $community, '.1.3.6.1.2.1..1.1.0', $timeout, $retries)); +echo "Single OID in array\n"; +var_dump(snmprealget($hostname, $community, array('.1.3.6.1.2.1...1.1.0'), $timeout, $retries)); +echo "Multiple OID\n"; +var_dump(snmprealget($hostname, $community, array('.1.3.6.1.2.1...1.1.0', '.1.3.6.1.2.1.1.3.0'), $timeout, $retries)); + +echo "noSuchName checks\n"; +echo "Single OID\n"; +var_dump(snmprealget($hostname, $community, '.1.3.6.1.2.1.1.1.110', $timeout, $retries)); +echo "Single OID in array\n"; +var_dump(snmprealget($hostname, $community, array('.1.3.6.1.2.1.1.1.110'), $timeout, $retries)); +echo "Multiple OID\n"; +var_dump(snmprealget($hostname, $community, array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.1.1.3.220'), $timeout, $retries)); + + +?> +--EXPECTF-- +Checking error handling + +Warning: snmprealget() expects parameter 4 to be long,%s given in %s on line %d +bool(false) + +Warning: snmprealget() expects parameter 5 to be long,%s given in %s on line %d +bool(false) +Checking working +Single OID +array(1) { + ["%s"]=> + %unicode|string%(%d) "%s" +} +Single OID in array +array(1) { + ["%s"]=> + %unicode|string%(%d) "%s" + %unicode|string%(%d) "%s" + ["%s"]=> + %unicode|string%(%d) "%d" +} diff -ruN trunk/ext/snmp/tests/snmprealwalk.phpt snmp-new/ext/snmp/tests/snmprealwalk.phpt --- trunk/ext/snmp/tests/snmprealwalk.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmprealwalk.phpt 2010-12-21 23:31:59.000000000 +0300 +More error handling +Single OID + +Warning: snmprealget(): Invalid object identifier: .1.3.6.1.2.1..1.1.0 in %s on line %d +bool(false) +Single OID in array + +Warning: snmprealget(): Invalid object identifier: .1.3.6.1.2.1...1.1.0 in %s on line %d +bool(false) +Multiple OID + +Warning: snmprealget(): Invalid object identifier: .1.3.6.1.2.1...1.1.0 in %s on line %d +array(1) { + [%s]=> + %unicode|string%(%d) "%d" +} +noSuchName checks +Single OID + +Warning: snmprealget(): Error in packet at 'SNMPv2-MIB::sysDescr.110': (noSuchName) There is no such variable name in this MIB. in %s on line %d +bool(false) +Single OID in array + +Warning: snmprealget(): Error in packet at 'SNMPv2-MIB::sysDescr.110': (noSuchName) There is no such variable name in this MIB. in %s on line %d +bool(false) +Multiple OID + +Warning: snmprealget(): Error in packet at 'SNMPv2-MIB::sysUpTime.220': (noSuchName) There is no such variable name in this MIB. in %s on line %d +array(1) { + [%s]=> + %unicode|string%(%d) "%s" +} --- ext/snmp/tests/snmprealgetnext.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmprealgetnext.phpt 2010-12-20 11:16:47.000000000 +0300 @@ -0,0 +1,42 @@ +--TEST-- +Function snmprealgetnext +--CREDITS-- +Boris Lytochkin +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +require_once(dirname(__FILE__).'/snmp_include.inc'); + +//EXPECTF format is quickprint OFF +snmp_set_quick_print(false); +snmp_set_valueretrieval(SNMP_VALUE_PLAIN); + +echo "Single OID\n"; +var_dump(snmprealgetnext($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, $retries)); +echo "Single OID in array\n"; +var_dump(snmprealgetnext($hostname, $community, array('.1.3.6.1.2.1.1.1.0'), $timeout, $retries)); +echo "Multiple OID\n"; +var_dump(snmprealgetnext($hostname, $community, array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.1.1.6.0'), $timeout, $retries)); + +?> +--EXPECTF-- +Single OID +array(1) { + [%s]=> + %unicode|string%(%d) "%s" +} +Single OID in array +array(1) { + [%s]=> + %unicode|string%(%d) "%s" +} +Multiple OID +array(2) { + [%s]=> + %unicode|string%(%d) "%s" + [%s]=> + %unicode|string%(%d) "%d" +} --- ext/snmp/tests/snmprealwalk.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmprealwalk.phpt 2010-12-21 23:31:59.000000000 +0300 @@ -0,0 +1,86 @@ +--TEST-- +Function snmprealwalk +--CREDITS-- Line 2005 (now 1836), was 14 lines, now 13 lines +Single nonexisting OID + +Warning: snmprealwalk(): Error in packet at '%s': (noSuchName) There is no such variable name in this MIB. in %s on line %d +bool(false) diff -ruN trunk/ext/snmp/tests/snmpset-nomib.phpt snmp-new/ext/snmp/tests/snmpset-nomib.phpt --- trunk/ext/snmp/tests/snmpset-nomib.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmpset-nomib.phpt 2010-12-27 23:50:26.000000000 +0300 --- ext/snmp/tests/snmpset-nomib.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmpset-nomib.phpt 2010-12-21 23:32:27.000000000 +0300 @@ -0,0 +1,60 @@ +--TEST-- +Function snmpset (without MIBs loading) +Function snmpset +--CREDITS-- +Boris Lytochkin +--SKIPIF-- +<?php Line 2070 (now 1900), was 11 lines, now 10 lines +bool(true) +bool(true) +bool(true) \ No newline at end of file diff -ruN trunk/ext/snmp/tests/snmpset.phpt snmp-new/ext/snmp/tests/snmpset.phpt --- trunk/ext/snmp/tests/snmpset.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmpset.phpt 2010-12-21 23:31:59.000000000 +0300 --- ext/snmp/tests/snmpset.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmpset.phpt 2010-12-21 23:31:59.000000000 +0300 @@ -0,0 +1,248 @@ +--TEST-- +Function snmpset +--CREDITS-- Line 2322 (now 2151), was 11 lines, now 10 lines +Warning: snmpset(): Could not add variable: OID='%s' type='w' value='%s': Bad variable type ("w") in %s on line %d +bool(false) +bool(true) +bool(true) diff -ruN trunk/ext/snmp/tests/snmpwalk.phpt snmp-new/ext/snmp/tests/snmpwalk.phpt --- trunk/ext/snmp/tests/snmpwalk.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/snmpwalk.phpt 2010-12-21 23:31:59.000000000 +0300 --- ext/snmp/tests/snmpwalk.phpt 1970-01-01 03:00:00.000000000 +0300 +++ ext/snmp/tests/snmpwalk.phpt 2010-12-21 23:31:59.000000000 +0300 @@ -0,0 +1,99 @@ +--TEST-- +Function snmpwalk +--CREDITS-- Line 2425 (now 2253), was 31 lines, now 4 lines +Single nonexisting OID + +Warning: snmpwalk(): Error in packet at '%s': (noSuchName) There is no such variable name in this MIB. in %s on line %d +bool(false) diff -ruN trunk/ext/snmp/tests/wrong_hostname.phpt snmp-new/ext/snmp/tests/wrong_hostname.phpt --- trunk/ext/snmp/tests/wrong_hostname.phpt 1970-01-01 03:00:00.000000000 +0300 +++ snmp-new/ext/snmp/tests/wrong_hostname.phpt 2010-12-28 01:15:29.000000000 +0300 @@ -0,0 +1,22 @@ +--TEST-- +Generic timeout (wrong community) +--CREDITS-- +Boris Lytochkin +--SKIPIF-- +<?php +require_once(dirname(__FILE__).'/skipif.inc'); +?> +--FILE-- +<?php +require_once(dirname(__FILE__).'/snmp_include.inc'); + +//EXPECTF format is quickprint OFF +snmp_set_quick_print(false); +snmp_set_valueretrieval(SNMP_VALUE_PLAIN); + +var_dump(snmpget('192.168..6.1', 'community', '.1.3.6.1.2.1.1.1.0', $timeout, $retries)); + +?> +--EXPECTF-- +Warning: snmpget(): Could not open snmp connection: Unknown host (192.168..6.1) (Bad file descriptor) in %s on line %d +bool(false) \ No newline at end of file |
![]() All rights reserved. |
Last updated: Sun Nov 19 01:31:42 2017 UTC |