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 create tap hw-addr $HWADDR1
44 vppctl set int ip address tap0 $IPADDR1"/"$IPADDR1_CIDR
45 vppctl set int state tap0 up
51 vppctl ip route add $PROTECTED_NET_CIDR via $FW_IPADDR
54 # Install packet streams
55 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp1
56 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp2
57 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp3
58 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp4
59 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp5
60 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp6
61 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp7
62 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp8
63 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp9
64 sed -i -e "0,/UDP/ s/UDP:.*/UDP: "$IPADDR1" -> "$SINK_IPADDR"/" /opt/pg_streams/stream_fw_udp10
65 vppctl exec /opt/pg_streams/stream_fw_udp1
66 vppctl exec /opt/pg_streams/stream_fw_udp2
67 vppctl exec /opt/pg_streams/stream_fw_udp3
68 vppctl exec /opt/pg_streams/stream_fw_udp4
69 vppctl exec /opt/pg_streams/stream_fw_udp5
70 vppctl exec /opt/pg_streams/stream_fw_udp6
71 vppctl exec /opt/pg_streams/stream_fw_udp7
72 vppctl exec /opt/pg_streams/stream_fw_udp8
73 vppctl exec /opt/pg_streams/stream_fw_udp9
74 vppctl exec /opt/pg_streams/stream_fw_udp10
77 vppctl packet-generator enable
78 vppctl set int unnumbered pg0 use tap0
79 vppctl set int state pg0 up
82 VERSION=$(cat /opt/config/demo_artifacts_version.txt)
83 mkdir -p /var/lib/honeycomb/persist/{config,context}/
84 echo "" > /var/lib/honeycomb/persist/context/data.json
85 echo "" > /var/lib/honeycomb/persist/config/data.json
86 /opt/honeycomb/honeycomb &>/dev/null &disown
89 # Enable traffic flows
91 chmod +x run_traffic_fw_demo.sh
92 ./run_traffic_fw_demo.sh &>/dev/null &disown