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

1.1       misho       1: --TEST--                                 
                      2: Function snmp2_get
                      3: --CREDITS--
                      4: 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_get($hostname, $community, '.1.3.6.1.2.1.1.1.0', ''));
                     19: var_dump(snmp2_get($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, ''));
                     20: echo "Empty OID array\n";
                     21: var_dump(snmp2_get($hostname, $community, array(), $timeout, $retries));
                     22: 
                     23: echo "Checking working\n";
                     24: echo "Single OID\n";
                     25: var_dump(snmp2_get($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, $retries));
                     26: echo "Single OID in array\n";
                     27: var_dump(snmp2_get($hostname, $community, array('.1.3.6.1.2.1.1.1.0'), $timeout, $retries));
                     28: echo "Multiple OID\n";
                     29: 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));
                     30: 
                     31: echo "More error handling\n";
                     32: echo "Single OID\n";
                     33: var_dump(snmp2_get($hostname, $community, '.1.3.6.1.2..1.1.1.0', $timeout, $retries));
                     34: echo "Single OID in array\n";
                     35: var_dump(snmp2_get($hostname, $community, array('.1.3.6.1.2.1...1.1.0'), $timeout, $retries));
                     36: echo "Multiple OID\n";
                     37: 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));
                     38: 
                     39: echo "noSuchName checks\n";
                     40: echo "Single OID\n";
                     41: var_dump(snmp2_get($hostname, $community, '.1.3.6.1.2.1.1.1.110', $timeout, $retries));
                     42: echo "Single OID in array\n";
                     43: var_dump(snmp2_get($hostname, $community, array('.1.3.6.1.2.1.1.1.110'), $timeout, $retries));
                     44: echo "Multiple OID\n";
                     45: 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));
                     46: 
                     47: 
                     48: ?>
                     49: --EXPECTF--
                     50: Checking error handling
                     51: 
                     52: Warning: snmp2_get() expects parameter 4 to be long,%s given in %s on line %d
                     53: bool(false)
                     54: 
                     55: Warning: snmp2_get() expects parameter 5 to be long,%s given in %s on line %d
                     56: bool(false)
                     57: Empty OID array
                     58: 
                     59: Warning: snmp2_get(): Got empty OID array in %s on line %d
                     60: bool(false)
                     61: Checking working
                     62: Single OID
                     63: %unicode|string%(%d) "%s"
                     64: Single OID in array
                     65: array(1) {
                     66:   ["%s"]=>
                     67:   %unicode|string%(%d) "%s"
                     68: }
                     69: Multiple OID
                     70: array(2) {
                     71:   ["%s"]=>
                     72:   %unicode|string%(%d) "%s"
                     73:   ["%s"]=>
                     74:   %unicode|string%(%d) "%d"
                     75: }
                     76: More error handling
                     77: Single OID
                     78: 
                     79: Warning: snmp2_get(): Invalid object identifier: .1.3.6.1.2..1.1.1.0 in %s on line %d
                     80: bool(false)
                     81: Single OID in array
                     82: 
                     83: Warning: snmp2_get(): Invalid object identifier: .1.3.6.1.2.1...1.1.0 in %s on line %d
                     84: bool(false)
                     85: Multiple OID
                     86: 
                     87: Warning: snmp2_get(): Invalid object identifier: .1.3.6.1.2.1...1.1.0 in %s on line %d
                     88: bool(false)
                     89: noSuchName checks
                     90: Single OID
                     91: 
                     92: Warning: snmp2_get(): Error in packet at 'SNMPv2-MIB::sysDescr.110': No Such Instance currently exists at this OID in %s on line %d
                     93: bool(false)
                     94: Single OID in array
                     95: 
                     96: Warning: snmp2_get(): Error in packet at 'SNMPv2-MIB::sysDescr.110': No Such Instance currently exists at this OID in %s on line %d
                     97: bool(false)
                     98: Multiple OID
                     99: 
                    100: Warning: snmp2_get(): Error in packet at 'SNMPv2-MIB::sysUpTime.220': No Such Instance currently exists at this OID in %s on line %d
                    101: array(1) {
                    102:   ["%s"]=>
                    103:   %unicode|string%(%d) "%s"
                    104: }

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