3 # Convert Network CIDR to Netmask
18 *) echo "Error: $dec is not recognized"; exit 1
28 # Configure VPP for vPacketGenerator
29 IPADDR1=$(ifconfig eth1 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
30 HWADDR1=$(ifconfig eth1 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
31 FAKE_HWADDR1=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null | hexdump -v -e '/1 ":%02X"')
32 PROTECTED_NET_CIDR=$(cat /opt/config/protected_net_cidr.txt)
33 FW_IPADDR=$(cat /opt/config/fw_ipaddr.txt)
34 SINK_IPADDR=$(cat /opt/config/sink_ipaddr.txt)
36 IPADDR1_MASK=$(ifconfig eth1 | grep "Mask" | awk '{print $4}' | awk -F ":" '{print $2}')
37 IPADDR1_CIDR=$(mask2cidr $IPADDR1_MASK)
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 $PROTECTED_NET_CIDR via $FW_IPADDR
53 # Install packet streams
54 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp1
55 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp2
56 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp3
57 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp4
58 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp5
59 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp6
60 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp7
61 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp8
62 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp9
63 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp10
64 vppctl exec /opt/pg_streams/stream_fw_udp1
65 vppctl exec /opt/pg_streams/stream_fw_udp2
66 vppctl exec /opt/pg_streams/stream_fw_udp3
67 vppctl exec /opt/pg_streams/stream_fw_udp4
68 vppctl exec /opt/pg_streams/stream_fw_udp5
69 vppctl exec /opt/pg_streams/stream_fw_udp6
70 vppctl exec /opt/pg_streams/stream_fw_udp7
71 vppctl exec /opt/pg_streams/stream_fw_udp8
72 vppctl exec /opt/pg_streams/stream_fw_udp9
73 vppctl exec /opt/pg_streams/stream_fw_udp10
77 VERSION=$(cat /opt/config/demo_artifacts_version.txt)
78 mkdir -p /var/lib/honeycomb/persist/{config,context}/
79 echo "" > /var/lib/honeycomb/persist/context/data.json
80 echo "" > /var/lib/honeycomb/persist/config/data.json
81 /opt/honeycomb/sample-distribution-$VERSION/honeycomb &>/dev/null &disown
84 # Enable traffic flows
86 chmod +x run_traffic_fw_demo.sh
87 ./run_traffic_fw_demo.sh &>/dev/null &disown