3 # Test using the pmfind app to find PCP servers using the active probing
4 # discovery mechanism. Probe inet only.
6 # Copyright (c) 2014 Red Hat. All Rights Reserved.
10 echo "QA output created by $seq"
12 # get standard environment, filters and checks
16 $service_discovery || _notrun
"No support for service discovery"
18 status
=1 # failure is the default!
19 $sudo rm -rf $tmp.
* $seq.full
20 trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15
24 # Only pmcd is guaranteed to be running, but other services may also be.
25 # Transform two cases - no servers vs found servers - into deterministic
26 # output for the --all invocations
28 -e 's/No \(pmproxy servers\) discovered/Sought \1/g' \
29 -e 's/No \(pmwebd servers\) discovered/Sought \1/g' \
30 -e 's/Discovered \(pmproxy servers\):/Sought \1/g' \
31 -e 's/Discovered \(pmwebd servers\):/Sought \1/g' \
45 # Pass unresolved urls, filter the resolved ones.
46 sed -e '/ pcp:\/\/[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/{p;b};
47 / proxy:\/\/[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/{p;b};
48 / http:\/\/[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+/{p;b};
55 # real QA test starts here
56 _control_service_discovery
58 # Obtain the inet address of an active network interface
59 # We're extracting a metric of the form:
61 # inst [0 or "eth0"] value "172.31.0.12"
63 # and then extracting the address
65 addr
=`pminfo -f network.interface.inet_addr | \
69 awk '{ print $6 }' | \
72 [ -z addr
] && _notrun
"no active inet interfaces"
74 # Probe the obtained network.
75 # Test various combinations of service queries and subnet sizes. Keep the
76 # subnet size small -- say max 4 bits.
77 echo "-m probe=$addr/32" >> $seq.full
78 echo "-m probe=INET_ADDR/32"
79 pmfind
-m probe
=$addr/32 | _unresolved_filter
80 echo "Exit status: $?" |
tee -a $seq.full
82 echo "-s pmcd -m probe=$addr/31" -r >> $seq.full
83 echo "-s pmcd -m probe=INET_ADDR/31 -r"
84 pmfind
-s pmcd
-m probe
=$addr/30 -r | _resolved_filter
85 echo "Exit status: $?" |
tee -a $seq.full
87 echo "-q -m probe=$addr/30" >> $seq.full
88 echo "-q -m probe=INET_ADDR/30"
89 pmfind
-q -m probe
=$addr/29 | _unresolved_filter
90 echo "Exit status: $?" |
tee -a $seq.full
92 echo "-q -s pmcd -m probe=$addr/29 --resolve" >> $seq.full
93 echo "-q -s pmcd -m probe=INET_ADDR/29 --resolve"
94 pmfind
-q -s pmcd
-m probe
=$addr/28 --resolve | _resolved_filter
95 echo "Exit status: $?" |
tee -a $seq.full
97 echo "-q -s pmcd -m probe=$addr/28,maxThreads=8" >> $seq.full
98 echo "-q -s pmcd -m probe=INET_ADDR/28,maxThreads=8"
99 pmfind
-q -s pmcd
-m probe
=$addr/28,maxThreads
=8 | _unresolved_filter
100 echo "Exit status: $?" |
tee -a $seq.full