blob: f4bf97be1ca580ae40c465bb24a97c9efd724996 [file] [log] [blame]
DR695Hccff30b2017-02-17 18:44:24 -05001#!/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#
22DNSIP=$1
23RATE_PER_SEC=$2
24ITERATIONS=$3
25ITERATIONS=${ITERATIONS:-300}
26
27for iter in `seq 1 $ITERATIONS`;
28do
29 for i in `seq 1 $RATE_PER_SEC`;
30 do
DR695Hc0cf6a42019-07-26 16:42:36 -040031 nslookup -timeout=1 host2.dnsdemo.onap.org $DNSIP >/dev/null 2>&1 &
DR695Hccff30b2017-02-17 18:44:24 -050032 done
33 sleep 1
34done