reorg to use common/tosca/ directory for shared TOSCA files, update of opencloud service-profile
unified config into common/Makedefs, included common/Makefile
strip last path component to get directory
clarify container target names, dependency fixes on service dir
fix test-standalone
converted other configs, added .DEFAULT_GOAL's
immediately set paths, run docker under sudo
port and cleanup fixes
fixes after testing cord-pod
follow log files, fix typo metronetwork/xos.yaml

Change-Id: I3e28d10ffd37a22c4a2927288924db453ed6ec44
diff --git a/opencloud/Makefile b/opencloud/Makefile
index 03168ed..0424950 100644
--- a/opencloud/Makefile
+++ b/opencloud/Makefile
@@ -1,36 +1,45 @@
-xos:
-	sudo docker-compose up -d
-	bash ./wait_for_xos.sh
-	sudo docker-compose run xos python /opt/xos/tosca/run.py none /opt/xos/configurations/common/fixtures.yaml
-	sudo docker-compose run xos python /opt/xos/tosca/run.py padmin@vicci.org /opt/xos/configurations/opencloud/opencloud.yaml
+# opencloud/Makefile
 
-containers:
-	cd ../../../containers/xos; make devel
-	cd ../../../containers/synchronizer; make
+CONFIG_DIR         := $(dir $(abspath $(lastword $(MAKEFILE_LIST))))
+COMMON_DIR         := $(abspath ../common )
 
-stop:
-	sudo docker-compose stop
+.DEFAULT_GOAL      := xos
 
-showlogs:
-	sudo docker-compose logs
+DOCKER_PROJECT     ?= oc
+BOOTSTRAP_PROJECT  ?= ocb
 
-rm: stop
-	sudo docker-compose rm
+# Include common functions
+include $(COMMON_DIR)/Makefile
 
-ps:
-	sudo docker-compose ps
+xos: prereqs config_dirs xos_download opencloud_services bootstrap onboarding podconfig
 
-enter-xos:
-	sudo docker exec -it devel_xos_1 bash
+opencloud_services: $(SERVICE_DIR) \
+	$(SERVICE_DIR)/onos-service \
+	$(SERVICE_DIR)/openstack \
+	$(SERVICE_DIR)/vrouter \
+	$(SERVICE_DIR)/vtn
 
-enter-synchronizer:
-	sudo docker exec -it devel_xos_synchronizer_openstack_1 bash
+onboarding: synchronizers.yaml id_rsa id_rsa.pub
+	@echo "[ONBOARDING]"
+	bash $(COMMON_DIR)/wait_for_onboarding_ready.sh $(XOS_BOOTSTRAP_PORT) xos
+	$(RUN_TOSCA_BOOTSTRAP) $(COMMON_DIR)/tosca/disable-onboarding.yaml
+	sudo cp id_rsa key_import/onos_rsa
+	sudo cp id_rsa.pub key_import/onos_rsa.pub
+	$(RUN_TOSCA_BOOTSTRAP) $(SERVICE_DIR)/openstack/xos/openstack-onboard.yaml
+	$(RUN_TOSCA_BOOTSTRAP) $(SERVICE_DIR)/vrouter/xos/vrouter-onboard.yaml
+	$(RUN_TOSCA_BOOTSTRAP) $(SERVICE_DIR)/vtn/xos/vtn-onboard.yaml
+	$(RUN_TOSCA_BOOTSTRAP) $(SERVICE_DIR)/onos-service/xos/onos-onboard.yaml
+	$(RUN_TOSCA_BOOTSTRAP) synchronizers.yaml
+	$(RUN_TOSCA_BOOTSTRAP) $(COMMON_DIR)/tosca/enable-onboarding.yaml
+	bash $(COMMON_DIR)/wait_for_onboarding_ready.sh $(XOS_BOOTSTRAP_PORT) services/vrouter
+	bash $(COMMON_DIR)/wait_for_onboarding_ready.sh $(XOS_BOOTSTRAP_PORT) services/vtn
+	bash $(COMMON_DIR)/wait_for_onboarding_ready.sh $(XOS_BOOTSTRAP_PORT) services/onos
+	bash $(COMMON_DIR)/wait_for_onboarding_ready.sh $(XOS_BOOTSTRAP_PORT) xos
+	bash $(COMMON_DIR)/wait_for_xos_port.sh $(XOS_UI_PORT)
 
-upgrade_pkgs:
-	sudo pip install httpie --upgrade
+podconfig: nodes.yaml images.yaml
+	@echo "[PODCONFIG]"
+	$(RUN_TOSCA) $(COMMON_DIR)/tosca/setup.yaml
+	$(RUN_TOSCA) nodes.yaml
+	$(RUN_TOSCA) images.yaml
 
-rebuild_xos:
-	make -C ../../../containers/xos devel
-
-rebuild_synchronizer:
-	make -C ../../../containers/synchronizer