init.sh revision 30b088af
1#!/bin/bash
2
3# Starts and initializes vpp.
4# Then starts honeycomb
5#
6
7NODE_ID=$1
8NODE_NAME=vpp$1
9
10echo "Enable tuntap interface in startup.conf"
11echo -e "tuntap {\n  enable\n}\n" >> /etc/vpp/startup.conf
12
13/hc2vpp/vpp/start.sh & VPP_PID=$!
14echo "Waiting 5s for vpp to start"
15sleep 5
16VPP_VERSION=$(vppctl show version)
17if [ "${VPP_VERSION}" != "" ]
18then
19  echo "VPP started successfully. Version:"
20  echo "${VPP_VERSION}"
21else
22  echo "VPP failed to start. Stopping initialization script."
23  exit 1
24fi
25
26# Configure veth interfaces using VPP CLI
27# (not fully supported by hc2vpp 18.01)
28echo "Configuring vpp"
29vppctl exec /hc2vpp/bgp_demo/init/$NODE_NAME.cmd
30
31# Update address of interface BGP is listening on
32IP="10.12.1.${NODE_ID}"
33jshon -s $IP -i "bgp-binding-address" -I -F /opt/honeycomb/config/bgp.json
34
35# Set AS number
36AS_NUMBER=$((65000+NODE_ID))
37jshon -n $AS_NUMBER -i "bgp-as-number" -I -F /opt/honeycomb/config/bgp.json
38
39# Update module configuration
40# Enables BGP and disables some of the modules not used in the example
41cp /hc2vpp/bgp_demo/init/*-module-config /opt/honeycomb/modules
42
43echo "Starting honeycomb"
44/hc2vpp/honeycomb/start.sh
45