4 # Convert Network CIDR to Netmask
19 *) echo "Error: $dec is not recognized"; exit 1
26 if ! which start; then
27 echo "#!/bin/bash" > /usr/local/sbin/start
28 echo "systemctl start \$1" >> /usr/local/sbin/start
29 chmod u+x /usr/local/sbin/start
34 # Configure VPP for vPacketGenerator
35 IPADDR1=$(ifconfig enp2s0 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
36 HWADDR1=$(ifconfig enp2s0 | grep -Po "HWaddr \K(.*)")
37 FAKE_HWADDR1=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null | hexdump -v -e '/1 ":%02X"')
38 PROTECTED_NET_CIDR=$(cat /opt/config/protected_net_cidr.txt)
39 FW_IPADDR=$(cat /opt/config/fw_ipaddr.txt)
40 SINK_IPADDR=$(cat /opt/config/sink_ipaddr.txt)
42 IPADDR1_MASK=$(ifconfig enp2s0 | grep "Mask" | awk '{print $4}' | awk -F ":" '{print $2}')
43 IPADDR1_CIDR=$(mask2cidr $IPADDR1_MASK)
46 ifconfig enp2s0 hw ether $FAKE_HWADDR1
47 ip addr flush dev enp2s0
49 vppctl tap connect tap111 hwaddr $HWADDR1
50 vppctl set int ip address tapcli-0 $IPADDR1"/"$IPADDR1_CIDR
51 vppctl set int state tapcli-0 up
53 brctl addif br0 tap111
54 brctl addif br0 enp2s0
56 vppctl ip route add $PROTECTED_NET_CIDR via $FW_IPADDR
59 # Install packet streams
60 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp1
61 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp2
62 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp3
63 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp4
64 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp5
65 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp6
66 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp7
67 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp8
68 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp9
69 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp10
70 vppctl exec /opt/pg_streams/stream_fw_udp1
71 vppctl exec /opt/pg_streams/stream_fw_udp2
72 vppctl exec /opt/pg_streams/stream_fw_udp3
73 vppctl exec /opt/pg_streams/stream_fw_udp4
74 vppctl exec /opt/pg_streams/stream_fw_udp5
75 vppctl exec /opt/pg_streams/stream_fw_udp6
76 vppctl exec /opt/pg_streams/stream_fw_udp7
77 vppctl exec /opt/pg_streams/stream_fw_udp8
78 vppctl exec /opt/pg_streams/stream_fw_udp9
79 vppctl exec /opt/pg_streams/stream_fw_udp10
83 #VERSION=$(cat /opt/config/demo_artifacts_version.txt)
84 mkdir -p /var/lib/honeycomb/persist/{config,context}/
85 echo "" > /var/lib/honeycomb/persist/context/data.json
86 echo "" > /var/lib/honeycomb/persist/config/data.json
87 #/opt/honeycomb/sample-distribution-$VERSION/honeycomb &>/dev/null &disown
88 systemctl restart honeycomb
91 # Enable traffic flows
93 chmod +x run_traffic_fw_demo.sh
94 ./run_traffic_fw_demo.sh &>/dev/null &disown