Annotation of embedaddon/php/ext/snmp/tests/snmpget.phpt, revision 1.1.1.1
1.1 misho 1: --TEST--
2: Function snmpget
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(snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', ''));
19: var_dump(snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, ''));
20:
21: echo "Checking working\n";
22: echo "Single OID, default timeout and retries\n";
23: var_dump(snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0'));
24: echo "Single OID, default retries\n";
25: var_dump(snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout));
26: echo "Single OID\n";
27: var_dump(snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.0', $timeout, $retries));
28: echo "Single OID in array\n";
29: var_dump(snmpget($hostname, $community, array('.1.3.6.1.2.1.1.1.0'), $timeout, $retries));
30: echo "Multiple OID\n";
31: var_dump(snmpget($hostname, $community, array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.1.1.3.0'), $timeout, $retries));
32:
33: echo "More error handling\n";
34: echo "Single OID\n";
35: var_dump(snmpget($hostname, $community, '.1.3.6.1.2.1..1.1.0', $timeout, $retries));
36: echo "Single OID in array\n";
37: var_dump(snmpget($hostname, $community, array('.1.3.6.1.2.1...1.1.0'), $timeout, $retries));
38: echo "Multiple OID\n";
39: var_dump(snmpget($hostname, $community, array('.1.3.6.1.2.1...1.1.0', '.1.3.6.1.2.1.1.3.0'), $timeout, $retries));
40:
41: echo "noSuchName checks\n";
42: echo "Single OID\n";
43: var_dump(snmpget($hostname, $community, '.1.3.6.1.2.1.1.1.110', $timeout, $retries));
44: echo "Single OID in array\n";
45: var_dump(snmpget($hostname, $community, array('.1.3.6.1.2.1.1.1.110'), $timeout, $retries));
46: echo "Multiple OID\n";
47: var_dump(snmpget($hostname, $community, array('.1.3.6.1.2.1.1.1.0', '.1.3.6.1.2.1.1.3.220'), $timeout, $retries));
48:
49:
50: ?>
51: --EXPECTF--
52: Checking error handling
53:
54: Warning: snmpget() expects parameter 4 to be long,%s given in %s on line %d
55: bool(false)
56:
57: Warning: snmpget() expects parameter 5 to be long,%s given in %s on line %d
58: bool(false)
59: Checking working
60: Single OID, default timeout and retries
61: %unicode|string%(%d) "%s"
62: Single OID, default retries
63: %unicode|string%(%d) "%s"
64: Single OID
65: %unicode|string%(%d) "%s"
66: Single OID in array
67: array(1) {
68: ["%s"]=>
69: %unicode|string%(%d) "%s"
70: }
71: Multiple OID
72: array(2) {
73: ["%s"]=>
74: %unicode|string%(%d) "%s"
75: ["%s"]=>
76: %unicode|string%(%d) "%d"
77: }
78: More error handling
79: Single OID
80:
81: Warning: snmpget(): Invalid object identifier: .1.3.6.1.2.1..1.1.0 in %s on line %d
82: bool(false)
83: Single OID in array
84:
85: Warning: snmpget(): Invalid object identifier: .1.3.6.1.2.1...1.1.0 in %s on line %d
86: bool(false)
87: Multiple OID
88:
89: Warning: snmpget(): Invalid object identifier: .1.3.6.1.2.1...1.1.0 in %s on line %d
90: bool(false)
91: noSuchName checks
92: Single OID
93:
94: Warning: snmpget(): Error in packet at 'SNMPv2-MIB::sysDescr.110': (noSuchName) There is no such variable name in this MIB. in %s on line %d
95: bool(false)
96: Single OID in array
97:
98: Warning: snmpget(): Error in packet at 'SNMPv2-MIB::sysDescr.110': (noSuchName) There is no such variable name in this MIB. in %s on line %d
99: bool(false)
100: Multiple OID
101:
102: 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
103: array(1) {
104: ["%s"]=>
105: %unicode|string%(%d) "%s"
106: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>