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

1.1       misho       1: --TEST--                                 
                      2: Function snmp_getvalue
                      3: --CREDITS--
                      4: 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: 
                     16: echo "Get with SNMP_VALUE_LIBRARY\n";
                     17: snmp_set_valueretrieval(SNMP_VALUE_LIBRARY);
                     18: var_dump(snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, $retries));
                     19: 
                     20: echo "Get with SNMP_VALUE_PLAIN\n";
                     21: snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
                     22: var_dump(snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, $retries));
                     23: 
                     24: echo "Get with SNMP_VALUE_OBJECT\n";
                     25: snmp_set_valueretrieval(SNMP_VALUE_OBJECT);
                     26: $z = snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, $retries);
                     27: echo gettype($z)."\n";
                     28: var_dump($z->type);
                     29: var_dump($z->value);
                     30: 
                     31: echo "Get with SNMP_VALUE_OBJECT | SNMP_VALUE_PLAIN\n";
                     32: snmp_set_valueretrieval(SNMP_VALUE_OBJECT | SNMP_VALUE_PLAIN);
                     33: $z = snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, $retries);
                     34: echo gettype($z)."\n";
                     35: var_dump($z->type);
                     36: var_dump($z->value);
                     37: 
                     38: echo "Get with SNMP_VALUE_OBJECT for BITS OID\n";
                     39: snmp_set_valueretrieval(SNMP_VALUE_OBJECT);
                     40: $z = snmpget($hostname, $community, '.1.3.6.1.2.1.88.1.4.2.1.3.6.95.115.110.109.112.100.95.108.105.110.107.68.111.119.110', $timeout, $retries);
                     41: echo gettype($z)."\n";
                     42: var_dump($z->type);
                     43: var_dump($z->value);
                     44: 
                     45: echo "Get with SNMP_VALUE_OBJECT | SNMP_VALUE_PLAIN for BITS OID\n";
                     46: snmp_set_valueretrieval(SNMP_VALUE_OBJECT | SNMP_VALUE_PLAIN);
                     47: $z = snmpget($hostname, $community, '.1.3.6.1.2.1.88.1.4.2.1.3.6.95.115.110.109.112.100.95.108.105.110.107.68.111.119.110', $timeout, $retries);
                     48: echo gettype($z)."\n";
                     49: var_dump($z->type);
                     50: var_dump(is_numeric($z->value));
                     51: var_dump(is_string($z->value));
                     52: var_dump(bin2hex($z->value));
                     53: 
                     54: echo "Check parsing of different OID types\n";
                     55: snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
                     56: var_dump(count(snmp2_walk($hostname, $community, '.', $timeout, $retries)));
                     57: 
                     58: ?>
                     59: --EXPECTF--
                     60: Get with SNMP_VALUE_LIBRARY
                     61: string(%d) "STRING: %s"
                     62: Get with SNMP_VALUE_PLAIN
                     63: string(%d) "%s"
                     64: Get with SNMP_VALUE_OBJECT
                     65: object
                     66: int(4)
                     67: string(%d) "STRING: %s"
                     68: Get with SNMP_VALUE_OBJECT | SNMP_VALUE_PLAIN
                     69: object
                     70: int(4)
                     71: string(%d) "%s"
                     72: Get with SNMP_VALUE_OBJECT for BITS OID
                     73: object
                     74: int(4)
                     75: string(25) "BITS: %d %s"
                     76: Get with SNMP_VALUE_OBJECT | SNMP_VALUE_PLAIN for BITS OID
                     77: object
                     78: int(4)
                     79: bool(false)
                     80: bool(true)
                     81: string(2) "%d"
                     82: Check parsing of different OID types
                     83: int(%d)

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