File: 776

package info (click to toggle)
pcp 7.1.0-1
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 252,748 kB
  • sloc: ansic: 1,483,656; sh: 182,366; xml: 160,462; cpp: 83,813; python: 24,980; perl: 18,327; yacc: 6,877; lex: 2,864; makefile: 2,738; awk: 165; fortran: 60; java: 52
file content (102 lines) | stat: -rwxr-xr-x 2,855 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/sh
# PCP QA Test No. 776
# Test using the pmfind app to find pmcd servers using the active probing
# discovery mechanism
#
# Copyright (c) 2014-2015 Red Hat.  All Rights Reserved.
#

seq=`basename $0`
echo "QA output created by $seq"

# get standard environment, filters and checks
. ./common.discovery

_get_libpcp_config
$ipv6 || _notrun "No libpcp or local host support for IPv6"
$service_discovery || _notrun "No support for service discovery"
addr=`_host_to_ipv6addrs local: | head -1`
[ ! -z "$addr" ] || _notrun "No active IPv6 interfaces"

status=1	# failure is the default!
trap "cd $here; rm -rf $tmp.*; exit \$status" 0 1 2 3 15

_sought_filter()
{
    # Only pmcd is guaranteed to be running, but other services may also be.
    # Transform two cases - no servers vs found servers - into deterministic
    # output for the --all invocations
    sed \
	-e 's/No \(pmproxy servers\) discovered/Sought \1/g' \
	-e 's/No \(pmwebapi servers\) discovered/Sought \1/g' \
	-e 's/Discovered \(pmproxy servers\):/Sought \1/g' \
	-e 's/Discovered \(pmwebapi servers\):/Sought \1/g' \
    # end
}

_unresolved_filter()
{
    sed -e '/  pcp:/d;
	    /  proxy:/d;
	    /  http:/d' \
    | _sought_filter
}

_resolved_filter()
{
    # Pass unresolved urls, filter the resolved ones.
    sed -e '/  pcp:\/\/[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*/{
p
n
}' \
	-e '/  proxy:\/\/[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*/{
p
n
}' \
	-e '/  http:\/\/[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*/{
p
n
}' \
	-e '/  pcp:/d' \
	-e '/  proxy:/d' \
	-e '/  http:/d' \
    | _sought_filter
}

# real QA test starts here
echo "Using IPv6 addr=$addr" > $seq_full

_control_service_discovery

# Probe the obtained network.
# Test various combinations of service queries and subnet sizes. Keep the
# subnet size small -- say max 4 bits.
echo "-m probe=$addr/128" >> $seq_full
echo "-m probe=IPV6_ADDR/128"
pmfind -m probe=$addr/128 | _unresolved_filter
echo "Exit status: $?" | tee -a $seq_full

echo "-s pmcd -m probe=$addr/127 -r" >> $seq_full
echo "-s pmcd -m probe=IPV6_ADDR/127 -r"
pmfind -s pmcd -m probe=$addr/126 -r | _resolved_filter
echo "Exit status: $?" | tee -a $seq_full

echo "-q -m probe=$addr/126" >> $seq_full
echo "-q -m probe=IPV6_ADDR/126"
pmfind -q -m probe=$addr/125 | _unresolved_filter
echo "Exit status: $?" | tee -a $seq_full

echo "-q -s pmcd -m probe=$addr/125 --resolve" >> $seq_full
echo "-q -s pmcd -m probe=IPV6_ADDR/125 --resolve"
pmfind -q -s pmcd -m probe=$addr/124 --resolve | _resolved_filter
echo "Exit status: $?" | tee -a $seq_full

echo "-q -s pmcd -m probe=$addr/124,maxThreads=8" >> $seq_full
echo "-q -s pmcd -m probe=IPV6_ADDR/124,maxThreads=8"
pmfind -q -s pmcd -m probe=$addr/124,maxThreads=8 | _unresolved_filter
echo "Exit status: $?" | tee -a $seq_full

# success, all done
status=0

exit