summaryrefslogtreecommitdiffstats
path: root/vagrant-demo
diff options
context:
space:
mode:
authorDave Wallace <dwallacelf@gmail.com>2016-02-10 07:53:21 -0500
committerDave Wallace <dwallacelf@gmail.com>2016-02-10 08:49:50 -0500
commit787aa52413444e4c985a73f89fdb7c34436a3849 (patch)
treeb965c888682d6a37ef36134cbd529bed6a9b2a27 /vagrant-demo
parent765e4716032083f5d702ed1f5a942d6d03f70e19 (diff)
Add scripts to reset / configure VDB application and VPP Honeycomb Agents
Change-Id: I01abc34d43795d183a3b9e6441883f530b456e6b Signed-off-by: Dave Wallace <dwallacelf@gmail.com>
Diffstat (limited to 'vagrant-demo')
-rwxr-xr-xvagrant-demo/scripts/host1-cfg.sh23
-rwxr-xr-xvagrant-demo/scripts/host2-cfg.sh23
-rwxr-xr-xvagrant-demo/scripts/vbd-reset.sh57
-rwxr-xr-xvagrant-demo/scripts/vpp1-reset.sh95
-rwxr-xr-xvagrant-demo/scripts/vpp2-reset.sh105
5 files changed, 303 insertions, 0 deletions
diff --git a/vagrant-demo/scripts/host1-cfg.sh b/vagrant-demo/scripts/host1-cfg.sh
new file mode 100755
index 0000000..14ee102
--- /dev/null
+++ b/vagrant-demo/scripts/host1-cfg.sh
@@ -0,0 +1,23 @@
+#! /bin/bash
+#
+# Script to configure host1.
+#
+# Copyright (c) 2016 Cisco Systems, Inc. and/or others. All rights reserved.
+
+if [ "$(id -un)" != "vagrant" ] || [ "$VM_NAME" != "(host1)" ]; then
+ echo "ERROR: Must be run inside the vpp1 vagrant VM!"
+ exit 1
+fi
+
+HOST1_IP_ADDR="172.16.10.11"
+HOST2_IP_ADDR="172.16.10.12"
+echo
+echo "Configuring eth1 with $HOST1_IP_ADDR"
+sudo ifconfig eth1 $HOST1_IP_ADDR/24 up
+echo
+echo "ifconfig eth1:"
+ifconfig eth1
+echo
+echo "Run the following command to ping host2:"
+echo " ping $HOST2_IP_ADDR"
+echo
diff --git a/vagrant-demo/scripts/host2-cfg.sh b/vagrant-demo/scripts/host2-cfg.sh
new file mode 100755
index 0000000..92a663f
--- /dev/null
+++ b/vagrant-demo/scripts/host2-cfg.sh
@@ -0,0 +1,23 @@
+#! /bin/bash
+#
+# Script to configure host2.
+#
+# Copyright (c) 2016 Cisco Systems, Inc. and/or others. All rights reserved.
+
+if [ "$(id -un)" != "vagrant" ] || [ "$VM_NAME" != "(host2)" ]; then
+ echo "ERROR: Must be run inside the vpp1 vagrant VM!"
+ exit 1
+fi
+
+HOST1_IP_ADDR="172.16.10.11"
+HOST2_IP_ADDR="172.16.10.12"
+echo
+echo "Configuring eth1 with $HOST2_IP_ADDR"
+sudo ifconfig eth1 $HOST2_IP_ADDR/24 up
+echo
+echo "ifconfig eth1:"
+ifconfig eth1
+echo
+echo "Run the following command to ping host1:"
+echo " ping $HOST1_IP_ADDR"
+echo
diff --git a/vagrant-demo/scripts/vbd-reset.sh b/vagrant-demo/scripts/vbd-reset.sh
new file mode 100755
index 0000000..a56b96f
--- /dev/null
+++ b/vagrant-demo/scripts/vbd-reset.sh
@@ -0,0 +1,57 @@
+#! /bin/bash
+#
+# Script to reset the ODL Virtual Bridge Domain application
+#
+# Copyright (c) 2016 Cisco Systems, Inc. and/or others. All rights reserved.
+
+if [ "$(id -un)" != "vagrant" ] || [ "$VM_NAME" != "(vbd)" ]; then
+ echo "ERROR: Must be run inside the vbd vagrant VM!"
+ exit 1
+fi
+
+APP_NAME="ODL VBD application"
+KARAF_HOME="$(dirname /opt/honeycomb/vbd-karaf*/bin)"
+BIN_DIR="$KARAF_HOME/bin"
+KARAF_LOG="$KARAF_HOME/data/log/karaf.log"
+CURRENT_DIR="$KARAF_HOME/etc/opendaylight/current"
+DATA_DIR="$KARAF_HOME/data"
+PERSISTENT_STATE="$CURRENT_DIR $DATA_DIR"
+
+echo
+echo "Stopping $APP_NAME"
+sudo $BIN_DIR/stop
+echo -n "Waiting"
+cnt=0
+while [ "$(ps -eaf | grep -v grep | grep karaf)" != "" ] ; do
+ echo -n "."
+ sleep 2
+ let "cnt = cnt + 1"
+ if [ "$cnt" -eq "10" ] ; then
+ echo
+ echo -n "$APP_NAME won't stop! Killing it.."
+ sudo kill $(ps -eaf | grep -v grep | grep karaf | awk '{ print $2 }')
+ fi
+done
+echo "Done"
+echo
+echo "Deleting $APP_NAME persistent state."
+sudo rm -rf $CURRENT_DIR
+sudo rm -rf $DATA_DIR
+echo
+echo "Starting $APP_NAME"
+sudo $BIN_DIR/start
+sleep 2
+echo -n "Waiting"
+while [ "$(grep xsql $KARAF_LOG | grep Successfully)" = "" ] ; do
+ echo -n "."
+ sleep 2
+done
+cnt=0
+while [ "$cnt" -lt "5" ] ; do
+ echo -n "."
+ sleep 2
+ let "cnt = cnt + 1"
+done
+echo
+echo "Reset $APP_NAME is complete!"
+
diff --git a/vagrant-demo/scripts/vpp1-reset.sh b/vagrant-demo/scripts/vpp1-reset.sh
new file mode 100755
index 0000000..a407ad1
--- /dev/null
+++ b/vagrant-demo/scripts/vpp1-reset.sh
@@ -0,0 +1,95 @@
+#! /bin/bash
+#
+# Script to reset the vpp1 Honeycomb agent.
+#
+# Copyright (c) 2016 Cisco Systems, Inc. and/or others. All rights reserved.
+
+if [ "$(id -un)" != "vagrant" ] || [ "$VM_NAME" != "(vpp1)" ]; then
+ echo "ERROR: Must be run inside the vpp1 vagrant VM!"
+ exit 1
+fi
+
+APP_NAME="VPP1 Honeycomb Agent"
+KARAF_HOME="$(dirname /opt/honeycomb/v3po-karaf*/bin)"
+BIN_DIR="$KARAF_HOME/bin"
+KARAF_LOG="$KARAF_HOME/data/log/karaf.log"
+CURRENT_DIR="$KARAF_HOME/etc/opendaylight/current"
+DATA_DIR="$KARAF_HOME/data"
+VPP2VPP_SRC_IP_ADDR="10.10.10.11"
+VPP2VPP_DST_IP_ADDR="10.10.10.12"
+VNI=1
+VRF_ID=7
+BRIDGE_ID=1
+SHG=1
+
+echo
+echo "Stopping VPP..."
+sudo stop vpp
+echo "Done"
+echo
+echo "Stopping $APP_NAME"
+sudo $BIN_DIR/stop
+echo -n "Waiting"
+cnt=0
+while [ "$(ps -eaf | grep -v grep | grep karaf)" != "" ] ; do
+ echo -n "."
+ sleep 2
+ let "cnt = cnt + 1"
+ if [ $cnt -eq 10 ] ; then
+ echo
+ echo -n "$APP_NAME won't stop! Killing it.."
+ sudo kill $(ps -eaf | grep -v grep | grep karaf | awk '{ print $2 }')
+ fi
+done
+echo "Done"
+echo
+echo "Deleting $APP_NAME persistent state."
+sudo rm -rf $DATA_DIR
+sudo rm -rf $CURRENT_DIR
+echo
+echo "Starting $APP_NAME"
+sudo $BIN_DIR/start
+echo "Starting VPP"
+sudo start vpp
+echo "Configuring vpp"
+sudo vppctl set int state GigabitEthernet0/9/0 up
+sudo vppctl set int state GigabitEthernet0/a/0 up
+sudo vppctl set int ip table GigabitEthernet0/a/0 7
+sudo vppctl set int ip address GigabitEthernet0/a/0 $VPP2VPP_SRC_IP_ADDR/24
+if [ "$1" = "vxlan" ] ; then
+ sudo vppctl set int l2 bridge GigabitEthernet0/9/0 $BRIDGE_ID
+ sudo vppctl create vxlan tunnel src $VPP2VPP_SRC_IP_ADDR dst $VPP2VPP_DST_IP_ADDR vni $VNI encap-vrf-id $VRF_ID decap-next l2
+ sudo vppctl set int l2 bridge vxlan_tunnel0 $BRIDGE_ID $SHG
+fi
+
+echo
+echo "Waiting for $APP_NAME to initialize..."
+while [ "$(grep VPPOPER $KARAF_LOG)" = "" ] ; do
+ echo -n "."
+ sleep 2
+done
+cnt=0
+while [ "$cnt" -lt "5" ] ; do
+ echo -n "."
+ sleep 2
+ let "cnt = cnt + 1"
+done
+echo
+echo VPP configuration:
+echo
+echo "show hardware:"
+sudo vppctl show hard
+echo
+echo "show inteface:"
+sudo vppctl show int
+echo
+echo "show ip fib:"
+sudo vppctl show ip fib
+if [ "$1" = "vxlan" ] ; then
+ echo
+ echo "show bridge $BRIDGE_ID detail:"
+ sudo vppctl show bridge $BRIDGE_ID detail
+fi
+echo
+echo "Reset $APP_NAME is complete!"
+
diff --git a/vagrant-demo/scripts/vpp2-reset.sh b/vagrant-demo/scripts/vpp2-reset.sh
new file mode 100755
index 0000000..49be70d
--- /dev/null
+++ b/vagrant-demo/scripts/vpp2-reset.sh
@@ -0,0 +1,105 @@
+#! /bin/bash
+#
+# Script to reset the vpp1 Honeycomb agent.
+#
+# Copyright (c) 2016 Cisco Systems, Inc. and/or others. All rights reserved.
+
+if [ "$(id -un)" != "vagrant" ] || [ "$VM_NAME" != "(vpp2)" ]; then
+ echo "ERROR: Must be run inside the vpp2 vagrant VM!"
+ exit 1
+fi
+
+APP_NAME="VPP2 Honeycomb Agent"
+KARAF_HOME="$(dirname /opt/honeycomb/v3po-karaf*/bin)"
+BIN_DIR="$KARAF_HOME/bin"
+KARAF_LOG="$KARAF_HOME/data/log/karaf.log"
+CURRENT_DIR="$KARAF_HOME/etc/opendaylight/current"
+DATA_DIR="$KARAF_HOME/data"
+PERSISTENT_STATE="$CURRENT_DIR $DATA_DIR"
+VPP2VPP_SRC_IP_ADDR="10.10.10.12"
+VPP2VPP_DST_IP_ADDR="10.10.10.11"
+VNI=1
+VRF_ID=7
+BRIDGE_ID=1
+SHG=1
+
+echo
+echo "Stopping VPP..."
+sudo stop vpp
+echo "Done"
+echo
+echo "Stopping $APP_NAME"
+sudo $BIN_DIR/stop
+echo -n "Waiting"
+cnt=0
+while [ "$(ps -eaf | grep -v grep | grep karaf)" != "" ] ; do
+ echo -n "."
+ sleep 2
+ let "cnt = cnt + 1"
+ if [ $cnt -eq 10 ] ; then
+ echo
+ echo -n "$APP_NAME won't stop! Killing it.."
+ sudo kill $(ps -eaf | grep -v grep | grep karaf | awk '{ print $2 }')
+ fi
+done
+echo "Done"
+echo
+echo "Deleting $APP_NAME persistent state."
+sudo rm -rf $DATA_DIR
+sudo rm -rf $CURRENT_DIR
+echo
+echo "Starting $APP_NAME"
+sudo $BIN_DIR/start
+echo "Starting VPP"
+sudo start vpp
+echo "Configuring vpp"
+sudo vppctl set int state GigabitEthernet0/9/0 up
+sudo vppctl set int state GigabitEthernet0/a/0 up
+sudo vppctl set int ip table GigabitEthernet0/a/0 7
+sudo vppctl set int ip address GigabitEthernet0/a/0 $VPP2VPP_SRC_IP_ADDR/24
+if [ "$1" = "vxlan" ] ; then
+ sudo vppctl set int l2 bridge GigabitEthernet0/9/0 $BRIDGE_ID
+ sudo vppctl create vxlan tunnel src $VPP2VPP_SRC_IP_ADDR dst $VPP2VPP_DST_IP_ADDR vni $VNI encap-vrf-id $VRF_ID decap-next l2
+ sudo vppctl set int l2 bridge vxlan_tunnel0 $BRIDGE_ID $SHG
+fi
+if [ "$1" = "vxlan" ] ; then
+ echo
+ echo "show bridge $BRIDGE_ID detail:"
+ sudo vppctl show bridge $BRIDGE_ID detail
+fi
+echo
+echo "Waiting for $APP_NAME to initialize"
+while [ "$(grep VPPOPER $KARAF_LOG)" = "" ] ; do
+ echo -n "."
+ sleep 2
+done
+cnt=0
+while [ "$cnt" -lt "5" ] ; do
+ echo -n "."
+ sleep 2
+ let "cnt = cnt + 1"
+done
+while [ $cnt -lt 5 ] ; do
+ echo -n "."
+ sleep 2
+ let "cnt = cnt + 1"
+done
+echo
+echo VPP configuration:
+echo
+echo "show hardware:"
+sudo vppctl show hard
+echo
+echo "show inteface:"
+sudo vppctl show int
+echo
+echo "show ip fib:"
+sudo vppctl show ip fib
+if [ "$1" = "vxlan" ] ; then
+ echo
+ echo "show bridge $BRIDGE_ID detail:"
+ sudo vppctl show bridge $BRIDGE_ID detail
+fi
+echo
+echo "Reset $APP_NAME is complete!"
+