fe16cef52a4a2a10055b7e72a6d2f191221c87c1
[demo.git] / vnfs / vFW / scripts / v_firewall_init.sh
1 #!/bin/bash
2
3 # Start VPP
4 start vpp
5 sleep 1
6
7 # Configure VPP for vFirewall
8 IPADDR1=$(ifconfig eth1 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
9 IPADDR2=$(ifconfig eth2 | grep "inet addr" | tr -s ' ' | cut -d' ' -f3 | cut -d':' -f2)
10 HWADDR1=$(ifconfig eth1 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
11 HWADDR2=$(ifconfig eth2 | grep HWaddr | tr -s ' ' | cut -d' ' -f5)
12 FAKE_HWADDR1=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null | hexdump -v -e '/1 ":%02X"')
13 FAKE_HWADDR2=$(echo -n 00; dd bs=1 count=5 if=/dev/urandom 2>/dev/null | hexdump -v -e '/1 ":%02X"')
14
15 ifconfig eth1 down
16 ifconfig eth2 down
17 ifconfig eth1 hw ether $FAKE_HWADDR1
18 ifconfig eth2 hw ether $FAKE_HWADDR2
19 ip addr flush dev eth1
20 ip addr flush dev eth2
21 ifconfig eth1 up
22 ifconfig eth2 up
23 vppctl tap connect tap111 hwaddr $HWADDR1
24 vppctl tap connect tap222 hwaddr $HWADDR2
25 vppctl set int ip address tap-0 $IPADDR1"/24"
26 vppctl set int ip address tap-1 $IPADDR2"/24"
27 vppctl set int state tap-0 up
28 vppctl set int state tap-1 up
29 brctl addbr br0
30 brctl addif br0 tap111
31 brctl addif br0 eth1
32 brctl addbr br1
33 brctl addif br1 tap222
34 brctl addif br1 eth2
35 ifconfig br0 up
36 ifconfig br1 up
37 sleep 1
38
39 # Start HoneyComb
40 echo "" > /var/lib/honeycomb/persist/context/data.json
41 echo "" > /var/lib/honeycomb/persist/config/data.json
42 /opt/honeycomb/sample-distribution-1.0.0/honeycomb &>/dev/null &disown
43 sleep 1
44
45 # Start VES client
46 cd /opt/VES/code/evel_training/VESreporting/
47 ./go-client.sh &>/dev/null &disown