4 # change the password because this script is run on a passwordless cloud-image
5 echo 'ubuntu:opnfv' | chpasswd
7 # Wait for a floating IP
8 # as a workaround to NAT breakage
11 # Variables to be filled in with python
14 # directly access the instance from the external net without NAT
21 if [[ $(getent hosts | awk '{{print $2}}') != *"$(cat /etc/hostname | awk '{{print $1}}')"* ]]
23 echo "127.0.1.1 $(cat /etc/hostname | awk '{{print $1}}')" | tee -a /etc/hosts
27 for net_int in $(netstat -ia | awk 'NR>2{{print $1}}');
29 if [ -z "$(ifconfig | grep $net_int)" ]
35 if [ -z "$quagga_int" ]
37 echo 'No available network interface'
40 ip link set $quagga_int up
41 ip addr add $OWN_IP/$EXT_NET_MASK dev $quagga_int
43 # Download quagga/zrpc rpms
45 wget http://artifacts.opnfv.org/sdnvpn/quagga4/quagga-ubuntu-updated.tar.gz
46 tar -xvf quagga-ubuntu-updated.tar.gz
48 dpkg -i c-capnproto_1.0.2.75f7901.Ubuntu16.04_amd64.deb
49 dpkg -i zmq_4.1.3.56b71af.Ubuntu16.04_amd64.deb
50 dpkg -i quagga_1.1.0.cd8ab40.Ubuntu16.04_amd64.deb
51 dpkg -i thrift_1.0.0.b2a4d4a.Ubuntu16.04_amd64.deb
52 dpkg -i zrpc_0.2.0efd19f.thriftv4.Ubuntu16.04_amd64.deb
54 nohup /opt/quagga/sbin/bgpd &
56 cat > /tmp/quagga-config << EOF1
60 no bgp log-neighbor-changes
61 bgp graceful-restart stalepath-time 90
62 bgp graceful-restart restart-time 900
64 bgp graceful-restart preserve-fw-state
65 bgp bestpath as-path multipath-relax
66 neighbor $NEIGHBOR_IP remote-as 100
67 no neighbor $NEIGHBOR_IP activate
75 neighbor $NEIGHBOR_IP activate
76 neighbor $NEIGHBOR_IP attribute-unchanged next-hop
79 route-map map permit 1
80 set ip next-hop $OWN_IP
85 network $IP_PREFIX rd $RD tag 100 route-map map
92 (sleep 1;echo "sdncbgpc";sleep 1;cat /tmp/quagga-config;sleep 1; echo "exit") |nc -q1 localhost 2605