7 # Compute the network CIDR from the Netmask
22 *) echo "Error: $dec is not recognized"; exit 1
28 IPADDR1_MASK=$(ifconfig eth1 | grep "Mask" | awk '{print $4}' | awk -F ":" '{print $2}')
29 IPADDR1_CIDR=$(mask2cidr $IPADDR1_MASK)
31 # Configure VPP for vPacketGenerator
32 IPADDR1=$(ifconfig eth1 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
33 HWADDR1=$(ifconfig eth1 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
34 FAKE_HWADDR1=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null | hexdump -v -e '/1 ":%02X"')
35 VLB_IPADDR=$(cat /opt/config/vlb_ipaddr.txt)
36 VLB_MAC=$(cat /opt/config/vlb_mac.txt)
37 GW=$(route -n | grep "^0.0.0.0" | awk '{print $2}')
40 ifconfig eth1 hw ether $FAKE_HWADDR1
41 ip addr flush dev eth1
43 vppctl tap connect tap111 hwaddr $HWADDR1
44 vppctl set int ip address tap-0 $IPADDR1"/"$IPADDR1_CIDR
45 vppctl set int state tap-0 up
47 brctl addif br0 tap111
50 vppctl ip route add 0.0.0.0/0 via $GW
53 # Set br0 with public IP and valid MAC so that Linux will have public network access
54 ifconfig br0 hw ether $HWADDR1
55 ifconfig br0 $IPADDR1 netmask $IPADDR1_MASK
56 route add default gw $GW
58 vppctl set ip arp tap-0 $VLB_IPADDR $VLB_MAC
60 # Install packet streams
61 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns1
62 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns2
63 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns3
64 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns4
65 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns5
66 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns6
67 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns7
68 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns8
69 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns9
70 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$VLB_IPADDR"/" /opt/dns_streams/stream_dns10
72 sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns1
73 sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns2
74 sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns3
75 sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns4
76 sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns5
77 sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns6
78 sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns7
79 sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns8
80 sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns9
81 sed -i -e "s/.*-> 53.*/ UDP: $RANDOM -> 53/" /opt/dns_streams/stream_dns10
83 vppctl exec /opt/dns_streams/stream_dns1
84 vppctl exec /opt/dns_streams/stream_dns2
85 vppctl exec /opt/dns_streams/stream_dns3
86 vppctl exec /opt/dns_streams/stream_dns4
87 vppctl exec /opt/dns_streams/stream_dns5
88 vppctl exec /opt/dns_streams/stream_dns6
89 vppctl exec /opt/dns_streams/stream_dns7
90 vppctl exec /opt/dns_streams/stream_dns8
91 vppctl exec /opt/dns_streams/stream_dns9
92 vppctl exec /opt/dns_streams/stream_dns10
94 vppctl set int ip address pg0 $(cat /opt/config/pg_int.txt)"/"$IPADDR1_CIDR
98 VERSION=$(cat /opt/config/nb_api_version.txt)
100 ./honeycomb-api/vnfs/vLBMS/apis/vlb-vnf-onap-distribution/target/vlb-vnf-onap-distribution-$VERSION-hc/vlb-vnf-onap-distribution-$VERSION/honeycomb &>/var/log/honeycomb.log &disown
103 chmod +x run_streams_dns.sh
104 ./run_streams_dns.sh &>/dev/null &disown