Initial commit of PassiveTest

Change-Id: Idcd9a0c72df5eae6b4eedc544e473ebc9763ccdb
(cherry picked from commit 9062322cffd03d2c56b66d040ad13bc562bb6544)
diff --git a/Makefile b/Makefile
new file mode 100644
index 0000000..3a57bd6
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,90 @@
+include ~/service-profile/mcord/Makefile
+
+VIAVI_REPO_SERVER="http://10.3.75.178"
+
+passivetest: probe_dependencies passivetest-onboard mcord_taa
+	$(RUN_TOSCA) $(SERVICE_DIR)/PassiveTest/pod-passivetest.yaml
+
+rebuild-passivetest: probe_dependencies 
+	bash $(COMMON_DIR)/rebuild.sh $(XOS_BOOTSTRAP_PORT) passivetest
+	bash $(COMMON_DIR)/wait_for_onboarding_ready.sh $(XOS_BOOTSTRAP_PORT) xos
+
+passivetest-onboard: 
+	cp $(SERVICE_DIR)/PassiveTest/xos/synchronizer/passivetest_config $(CONFIG_DIR)/files/passivetest_config
+	sudo cp $(CONFIG_DIR)/id_rsa $(CONFIG_DIR)/key_import/passivetest_rsa
+	sudo cp $(CONFIG_DIR)/id_rsa.pub $(CONFIG_DIR)/key_import/passivetest_rsa.pub
+	$(RUN_TOSCA_BOOTSTRAP) $(COMMON_DIR)/tosca/disable-onboarding.yaml
+	$(RUN_TOSCA_BOOTSTRAP) $(SERVICE_DIR)/PassiveTest/xos/PassiveTest-onboard.yaml
+	$(RUN_TOSCA_BOOTSTRAP) $(SERVICE_DIR)/PassiveTest/xos/synchronizer/passivetest-synchronizer.yaml
+	$(RUN_TOSCA_BOOTSTRAP) $(COMMON_DIR)/tosca/enable-onboarding.yaml
+	bash $(COMMON_DIR)/wait_for_onboarding_ready.sh $(XOS_BOOTSTRAP_PORT) services/passivetest
+	bash $(COMMON_DIR)/wait_for_onboarding_ready.sh $(XOS_BOOTSTRAP_PORT) xos
+	bash $(COMMON_DIR)/wait_for_xos_port.sh $(XOS_UI_PORT)
+
+clean: cleanup
+	./cleanup.sh
+	bash -c "source $(CONFIG_DIR)/admin-openrc.sh; nova list --all-tenants; neutron net-list"
+
+passivetest-acord:
+	bash install_monitoring_plugin.sh
+	$(RUN_TOSCA) $(SERVICE_DIR)/PassiveTest/passivetest-acord.yaml
+
+probe_dependencies: manifest
+
+manifest:
+	cp $(CONFIG_DIR)/id_rsa.pub $(SERVICE_DIR)/PassiveTest/xos/synchronizer/steps/roles/setup_probe/files/passivetest_rsa.pub
+	cd $(SERVICE_DIR)/PassiveTest/xos; bash $(SERVICE_DIR)/PassiveTest/xos/make_synchronizer_manifest.sh
+
+viv: viv.docker 
+	bash install_viv.sh
+
+viv.docker:
+	wget $(VIAVI_REPO_SERVER)/viv.docker
+
+mcord_taa: mcord_taa.qcow2
+	bash -c "source $(CONFIG_DIR)/admin-openrc.sh; glance image-show mcord_taa || glance image-create --name mcord_taa --container-format bare --disk-format qcow2 --progress --is-public True --file mcord_taa.qcow2"
+
+mcord_taa.qcow2:
+	wget $(VIAVI_REPO_SERVER)/mcord_taa.qcow2
+
+cord-monitoringservice: $(SERVICE_DIR)/monitoring monitoring_files
+	@echo "[Patching CORD-MONITORINGSERVICE]"
+	cp $(SERVICE_DIR)/PassiveTest/ceilometerdashboard.py $(SERVICE_DIR)/monitoring/xos/api/tenant/monitoring/dashboard/ceilometerdashboard.py
+	@echo "[CORD-MONITORINGSERVICE]"
+	sudo cp $(CONFIG_DIR)/id_rsa $(CONFIG_DIR)/key_import/monitoringservice_rsa
+	$(RUN_TOSCA_BOOTSTRAP) $(SERVICE_DIR)/monitoring/xos/monitoring-onboard.yaml
+	$(RUN_TOSCA_BOOTSTRAP) $(CONFIG_DIR)/monitoring_synchronizer.yaml
+	bash $(COMMON_DIR)/wait_for_onboarding_ready.sh $(XOS_BOOTSTRAP_PORT) services/monitoring
+	bash $(COMMON_DIR)/wait_for_onboarding_ready.sh $(XOS_BOOTSTRAP_PORT) xos
+	bash $(COMMON_DIR)/wait_for_xos_port.sh $(XOS_UI_PORT)
+	$(RUN_TOSCA) $(CONFIG_DIR)/monitoringservice.yaml
+	$(RUN_TOSCA) $(CONFIG_DIR)/monitoringtenant.yaml
+	@echo "waiting for monitoring service to be fully ready...."
+	ansible-playbook -i local $(SERVICE_DIR)/monitoring/xos/test/monitoring_test_initial.yaml
+
+monitoring_files: monitoring_synchronizer.yaml monitoringservice.yaml monitoringtenant.yaml
+
+monitoring%.yaml:
+	rm $(CONFIG_DIR)/$@
+	cp $(CONFIG_DIR)/../cord-pod/$@ $(CONFIG_DIR)
+
+inframonitoring.yaml:
+	export SETUPDIR=$(CONFIG_DIR); bash $(CONFIG_DIR)/../cord-pod/make-inframonitoring-yaml.sh
+
+rebuild-monitoringservice:
+	bash $(COMMON_DIR)/rebuild.sh $(XOS_BOOTSTRAP_PORT) monitoring
+	bash $(COMMON_DIR)/wait_for_onboarding_ready.sh $(XOS_BOOTSTRAP_PORT) xos
+
+install-inframonitoring-agents:
+	bash $(SERVICE_DIR)/monitoring/xos/synchronizer/ceilometer/monitoring_agent/install_monitoring_ceilometer.sh
+	@echo "Validate if infra metrics are available...."
+	ansible-playbook -i local $(SERVICE_DIR)/monitoring/xos/test/monitoring_test_inframetrics.yaml
+
+enable-inframonitoring: inframonitoring.yaml onos_monitoring_service_endpoints.json
+	$(RUN_TOSCA) $(CONFIG_DIR)/inframonitoring.yaml
+
+onos_monitoring_service_endpoints.json:
+	cp $(CONFIG_DIR)/../cord-pod/$@ $(CONFIG_DIR)/
+
+
+