Annotation of embedaddon/php/ext/snmp/tests/snmp2_walk.phpt, revision 1.1.1.1

1.1       misho       1: --TEST--                                 
                      2: Function snmp2_walk
                      3: --CREDITS--
                      4: Olivier Doucet Olivier Doucet Boris Lytochkin
                      5: --SKIPIF--
                      6: <?php
                      7: require_once(dirname(__FILE__).'/skipif.inc');
                      8: ?>
                      9: --FILE--
                     10: <?php
                     11: require_once(dirname(__FILE__).'/snmp_include.inc');
                     12: 
                     13: //EXPECTF format is quickprint OFF
                     14: snmp_set_quick_print(false);
                     15: snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
                     16: 
                     17: echo "Checking error handling\n";
                     18: var_dump(snmp2_walk($hostname, $community, '.1.3.6.1.2.1.1', ''));
                     19: var_dump(snmp2_walk($hostname, $community, '.1.3.6.1.2.1.1', $timeout, ''));
                     20: 
                     21: echo "Checking working\n";
                     22: echo "Single OID\n";
                     23: $return = snmp2_walk($hostname, $community, '.1.3.6.1.2.1.1', $timeout, $retries);
                     24: 
                     25: var_dump(gettype($return));
                     26: var_dump(sizeof($return));
                     27: var_dump(gettype($return[0]));
                     28: var_dump(gettype($return[1]));
                     29: 
                     30: echo "Single OID in array\n";
                     31: $return = snmp2_walk($hostname, $community, array('.1.3.6.1.2.1.1'), $timeout, $retries);
                     32: var_dump(gettype($return));
                     33: var_dump(gettype($return[0]));
                     34: 
                     35: echo "Default OID\n";
                     36: $return = snmpwalk($hostname, $community, '', $timeout, $retries);
                     37: var_dump(gettype($return));
                     38: var_dump(gettype($return[0]));
                     39: 
                     40: echo "More error handling\n";
                     41: echo "Single incorrect OID\n";
                     42: $return = snmpwalk($hostname, $community, '.1.3.6...1', $timeout, $retries);
                     43: var_dump($return);
                     44: 
                     45: echo "Multiple correct OID\n";
                     46: $return = snmp2_walk($hostname, $community, array('.1.3.6.1.2.1.1', '.1.3.6'), $timeout, $retries);
                     47: var_dump($return);
                     48: 
                     49: echo "Multiple OID with wrong OID\n";
                     50: $return = snmp2_walk($hostname, $community, array('.1.3.6.1.2.1.1', '.1.3.6...1'), $timeout, $retries);
                     51: var_dump($return);
                     52: $return = snmp2_walk($hostname, $community, array('.1.3.6...1', '.1.3.6.1.2.1.1'), $timeout, $retries);
                     53: var_dump($return);
                     54: 
                     55: echo "Single nonexisting OID\n";
                     56: $return = snmp2_walk($hostname, $community, array('.1.3.6.99999.0.99999.111'), $timeout, $retries);
                     57: var_dump($return);
                     58: 
                     59: ?>
                     60: --EXPECTF--
                     61: Checking error handling
                     62: 
                     63: Warning: snmp2_walk() expects parameter 4 to be long, %s given in %s on line %d
                     64: bool(false)
                     65: 
                     66: Warning: snmp2_walk() expects parameter 5 to be long, %s given in %s on line %d
                     67: bool(false)
                     68: Checking working
                     69: Single OID
                     70: %unicode|string%(5) "array"
                     71: int(%d)
                     72: %unicode|string%(6) "string"
                     73: %unicode|string%(6) "string"
                     74: Single OID in array
                     75: %unicode|string%(5) "array"
                     76: %unicode|string%(6) "string"
                     77: Default OID
                     78: %unicode|string%(5) "array"
                     79: %unicode|string%(6) "string"
                     80: More error handling
                     81: Single incorrect OID
                     82: 
                     83: Warning: snmpwalk(): Invalid object identifier: %s in %s on line %d
                     84: bool(false)
                     85: Multiple correct OID
                     86: 
                     87: Warning: snmp2_walk(): Multi OID walks are not supported! in %s on line %d
                     88: bool(false)
                     89: Multiple OID with wrong OID
                     90: 
                     91: Warning: snmp2_walk(): Multi OID walks are not supported! in %s on line %d
                     92: bool(false)
                     93: 
                     94: Warning: snmp2_walk(): Multi OID walks are not supported! in %s on line %d
                     95: bool(false)
                     96: Single nonexisting OID
                     97: 
                     98: 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
                     99: bool(false)

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>