DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 1 | #!/bin/bash |
| 2 | # |
| 3 | # This script is run by the policy closed loop to generate traffic (DNS packets) to the DNS |
| 4 | # |
| 5 | # Usage: dnstraffic.sh <DNSIP> <RATE_PER_SEC> <ITERATIONS> |
| 6 | # |
| 7 | # The DNSIP is that of the DNS vLoadBalancer. |
| 8 | # The RATE_PER_SEC is the approximate number of nslookup requests generated per second. |
| 9 | # The ITERATIONS is roughly the number of seconds to run the test. Note that the Robot |
| 10 | # will kill this script after the validation is complete. |
| 11 | # |
| 12 | # The validation portion of the script has done a successful lookup, so the point of |
| 13 | # these requests is to generate DNS packets. We do not care about the results. The timeout |
| 14 | # of 1 second is to ensure we do not flood the process table with long waits |
| 15 | # on failed lookups. |
| 16 | # |
| 17 | # We generate an approximate rate because we sleep for a full second so the RATE_PER_SEC |
| 18 | # should have some slop in it. We only need to drive this to 20+ per second, so a 35 |
| 19 | # per second should fall within the range to trigger the polciy check and prvide enough |
| 20 | # to validate even distribution without spawning a 3rd DNS |
| 21 | # |
| 22 | DNSIP=$1 |
| 23 | RATE_PER_SEC=$2 |
| 24 | ITERATIONS=$3 |
| 25 | ITERATIONS=${ITERATIONS:-300} |
| 26 | |
| 27 | for iter in `seq 1 $ITERATIONS`; |
| 28 | do |
| 29 | for i in `seq 1 $RATE_PER_SEC`; |
| 30 | do |
DR695H | c0cf6a4 | 2019-07-26 16:42:36 -0400 | [diff] [blame^] | 31 | nslookup -timeout=1 host2.dnsdemo.onap.org $DNSIP >/dev/null 2>&1 & |
DR695H | ccff30b | 2017-02-17 18:44:24 -0500 | [diff] [blame] | 32 | done |
| 33 | sleep 1 |
| 34 | done |