add rebuild makefile target and rebuild script

Change-Id: Id956c1693d0d29ca79e2483f37a048b47b3731bd
diff --git a/common/rebuild.sh b/common/rebuild.sh
new file mode 100755
index 0000000..dbca3c8
--- /dev/null
+++ b/common/rebuild.sh
@@ -0,0 +1,21 @@
+#! /bin/bash
+
+display_usage() { 
+    echo -e "\nUsage:\n$0 [xos-listen-port] \n" 
+} 
+
+if [  $# -lt 1 ] 
+then 
+    display_usage
+    exit 1
+fi 
+
+echo "Sending rebuild request to XOS"
+STATUS=`curl -X POST 0.0.0.0:$1/api/utility/onboarding/xos/rebuild/ 2> /dev/null`
+if [[ "$STATUS" != "true" ]]; then
+    echo "Rebuild request failed"
+    exit -1
+fi
+
+echo "Rebuild request accepted"
+
diff --git a/cord-pod/Makefile b/cord-pod/Makefile
index f98893d..6fba6c0 100644
--- a/cord-pod/Makefile
+++ b/cord-pod/Makefile
@@ -102,6 +102,10 @@
 
 new-nodes: clean-nodes update-nodes vtn
 
+rebuild:
+	bash ../common/rebuild.sh $(XOS_BOOTSTRAP_PORT)
+	bash ../common/wait_for_onboarding_ready.sh 81 xos
+
 exampleservice: onboard-exampleservice
 	$(RUN_TOSCA) pod-exampleservice.yaml
 
diff --git a/frontend/Makefile b/frontend/Makefile
index 1a7a1f1..4ae7094 100644
--- a/frontend/Makefile
+++ b/frontend/Makefile
@@ -57,6 +57,10 @@
 containers: prereqs download_xos
 	make -f ../common/Makefile.containers xos_devel synchronizer onboarding_synchronizer
 
+rebuild:
+	bash ../common/rebuild.sh $(XOS_BOOTSTRAP_PORT)
+	bash ../common/wait_for_onboarding_ready.sh $(XOS_BOOTSTRAP_PORT) xos
+
 stop:
 	test ! -s $(DOCKER_COMPOSE_YML) || sudo docker-compose -p $(DOCKER_PROJECT) -f $(DOCKER_COMPOSE_YML) stop
 	sudo docker-compose -p $(BOOTSTRAP_PROJECT) -f $(BOOTSTRAP_YML) stop
diff --git a/test-standalone/Makefile b/test-standalone/Makefile
index 4354c6e..44a5363 100644
--- a/test-standalone/Makefile
+++ b/test-standalone/Makefile
@@ -122,6 +122,10 @@
 containers: prereqs download_xos devel-container
 	make -f ../common/Makefile.containers xos_test
 
+rebuild:
+	bash ../common/rebuild.sh $(XOS_BOOTSTRAP_PORT)
+	bash ../common/wait_for_onboarding_ready.sh $(XOS_BOOTSTRAP_PORT) xos
+
 stop:
 	test ! -s $(DOCKER_COMPOSE_YML) || sudo docker-compose -p $(DOCKER_PROJECT) -f $(DOCKER_COMPOSE_YML) stop
 	sudo docker-compose -p $(BOOTSTRAP_PROJECT) -f $(BOOTSTRAP_YML) stop