Fix vPacketGen IP address in change_ports script
[demo.git] / vnfs / vLB / scripts / vdnspacketgen_change_streams_ports.sh
1 #!/bin/bash
2
3 #Disable all streams
4 killall -9 run_streams_dns.sh
5
6 vppctl pac del dns1
7 vppctl pac del dns2
8 vppctl pac del dns3
9 vppctl pac del dns4
10 vppctl pac del dns5
11 vppctl pac del dns6
12 vppctl pac del dns7
13 vppctl pac del dns8
14 vppctl pac del dns9
15 vppctl pac del dns10
16
17 #Update destination (vLB) IP
18 VLB_IPADDR=$(cat /opt/config/vlb_ipaddr.txt)
19 IPADDR1=$(cat /opt/config/local_private_ipaddr.txt)
20 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns1
21 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns2
22 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns3
23 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns4
24 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns5
25 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns6
26 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns7
27 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns8
28 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns9
29 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns10
30
31 #Update source ports (make them random)
32 sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns1
33 sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns2
34 sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns3
35 sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns4
36 sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns5
37 sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns6
38 sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns7
39 sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns8
40 sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns9
41 sed -i -e "s/.*-> 53.*/    UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns10
42
43 vppctl exec /opt/dns_streams/stream_dns1
44 vppctl exec /opt/dns_streams/stream_dns2
45 vppctl exec /opt/dns_streams/stream_dns3
46 vppctl exec /opt/dns_streams/stream_dns4
47 vppctl exec /opt/dns_streams/stream_dns5
48 vppctl exec /opt/dns_streams/stream_dns6
49 vppctl exec /opt/dns_streams/stream_dns7
50 vppctl exec /opt/dns_streams/stream_dns8
51 vppctl exec /opt/dns_streams/stream_dns9
52 vppctl exec /opt/dns_streams/stream_dns10
53
54 #Resume stream execution
55 cd /opt
56 ./run_streams_dns.sh &>/dev/null &disown