summaryrefslogtreecommitdiffstats
path: root/docker/bgp_demo/init/init.sh
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-12-13 12:25:58 +0100
committerMarek Gradzki <mgradzki@cisco.com>2018-01-08 15:11:17 +0000
commit686309091cf77d9b35cf5ae19c80172ad29d68b6 (patch)
tree9c623ddef516d80f2ae981ae0512db8e54e97526 /docker/bgp_demo/init/init.sh
parentc127a6e1f1f7c37864bf9e11887cb7b84dfad826 (diff)
BGP-HC docker example
Shows how to announce BGP prefix from one HC instance to another. Configuration (RESTCONF) is done over builtin docker0 network. Data plane is using veth pair that connects containers. BGP is also using veth but via unnumbered tuntap. Change-Id: Ia18b0729e12a4893ba559d0a68a9e962e58d2a2f Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'docker/bgp_demo/init/init.sh')
-rwxr-xr-xdocker/bgp_demo/init/init.sh35
1 files changed, 35 insertions, 0 deletions
diff --git a/docker/bgp_demo/init/init.sh b/docker/bgp_demo/init/init.sh
new file mode 100755
index 000000000..14e60aa0b
--- /dev/null
+++ b/docker/bgp_demo/init/init.sh
@@ -0,0 +1,35 @@
+#!/bin/bash
+
+# Starts and initializes vpp.
+# Then starts honeycomb
+#
+
+NODE_ID=$1
+NODE_NAME=vpp$1
+
+echo "Enable tuntap interface in startup.conf"
+echo -e "tuntap {\n enable\n}\n" >> /etc/vpp/startup.conf
+
+/hc2vpp/vpp/start.sh
+echo "Waiting for vpp to start"
+sleep 5
+
+# Configure veth interfaces using VPP CLI
+# (not fully supported by hc2vpp 18.01)
+echo "Configuring vpp"
+vppctl exec /hc2vpp/bgp_demo/init/$NODE_NAME.cmd
+
+# Update address of interface BGP is listening on
+IP="10.12.1.${NODE_ID}"
+jshon -s $IP -i "bgp-binding-address" -I -F /opt/honeycomb/config/bgp.json
+
+# Set AS number
+AS_NUMBER=$((65000+NODE_ID))
+jshon -n $AS_NUMBER -i "bgp-as-number" -I -F /opt/honeycomb/config/bgp.json
+
+# Update module configuration
+# Enables BGP and disables some of the modules not used in the example
+cp /hc2vpp/bgp_demo/init/*-module-config /opt/honeycomb/modules
+
+echo "Starting honeycomb"
+/hc2vpp/honeycomb/start.sh