xref: /PHP-8.3/ext/snmp/tests/snmprealwalk.phpt (revision b5a14e6c)
1--TEST--
2Function snmprealwalk
3--CREDITS--
4Olivier Doucet Olivier Doucet Boris Lytochkin
5--EXTENSIONS--
6snmp
7--SKIPIF--
8<?php
9require_once(__DIR__.'/skipif.inc');
10?>
11--FILE--
12<?php
13require_once(__DIR__.'/snmp_include.inc');
14
15//EXPECTF format is quickprint OFF
16snmp_set_quick_print(false);
17snmp_set_valueretrieval(SNMP_VALUE_PLAIN);
18
19echo "Checking working\n";
20echo "Single OID\n";
21$return = snmprealwalk($hostname, $community, '.1.3.6.1.2.1.1', $timeout, $retries);
22var_dump(gettype($return));
23var_dump(sizeof($return));
24var_dump(key($return));
25var_dump(array_shift($return));
26
27echo "Single OID in array\n";
28$return = snmprealwalk($hostname, $community, array('.1.3.6.1.2.1.1'), $timeout, $retries);
29var_dump(gettype($return));
30var_dump(sizeof($return));
31var_dump(key($return));
32var_dump(array_shift($return));
33
34echo "More error handling\n";
35echo "Multiple correct OID\n";
36$return = snmprealwalk($hostname, $community, array('.1.3.6.1.2.1.1', '.1.3.6'), $timeout, $retries);
37var_dump($return);
38
39echo "Multiple OID with wrong OID\n";
40$return = snmprealwalk($hostname, $community, array('.1.3.6.1.2.1.1', '.1.3.6...1'), $timeout, $retries);
41var_dump($return);
42$return = snmprealwalk($hostname, $community, array('.1.3.6...1', '.1.3.6.1.2.1.1'), $timeout, $retries);
43var_dump($return);
44
45echo "Single nonexisting OID\n";
46$return = snmprealwalk($hostname, $community, array('.1.3.6.99999.0.99999.111'), $timeout, $retries);
47var_dump($return);
48
49?>
50--EXPECTF--
51Checking working
52Single OID
53string(5) "array"
54int(%d)
55string(%d) "%s"
56string(%d) "%s"
57Single OID in array
58string(5) "array"
59int(%d)
60string(%d) "%s"
61string(%d) "%s"
62More error handling
63Multiple correct OID
64
65Warning: snmprealwalk(): Multi OID walks are not supported! in %s on line %d
66bool(false)
67Multiple OID with wrong OID
68
69Warning: snmprealwalk(): Multi OID walks are not supported! in %s on line %d
70bool(false)
71
72Warning: snmprealwalk(): Multi OID walks are not supported! in %s on line %d
73bool(false)
74Single nonexisting OID
75
76Warning: snmprealwalk(): Error in packet at '%s': (noSuchName) There is no such variable name in this MIB. in %s on line %d
77bool(false)
78