CORD-1010 Dcokerfile and docker-compose and onboarding recipe for refactored openstack synchronizer

Change-Id: I361381882e1987a5cad45f82a99c9640563662d4
diff --git a/xos/openstack-onboardnew.yaml b/xos/openstack-onboardnew.yaml
new file mode 100644
index 0000000..1cec5cd
--- /dev/null
+++ b/xos/openstack-onboardnew.yaml
@@ -0,0 +1,15 @@
+tosca_definitions_version: tosca_simple_yaml_1_0
+
+description: Onboard the OpenStack service
+
+imports:
+   - custom_types/xos.yaml
+
+topology_template:
+  node_templates:
+    servicecontroller#openstack:
+      type: tosca.nodes.ServiceController
+      properties:
+          base_url: file:///opt/xos_services/openstack/xos/
+          no_build: true
+          image: xosproject/openstack-synchronizer
diff --git a/xos/synchronizer/Dockerfile.synchronizer b/xos/synchronizer/Dockerfile.synchronizer
new file mode 100644
index 0000000..93e7ac7
--- /dev/null
+++ b/xos/synchronizer/Dockerfile.synchronizer
@@ -0,0 +1,9 @@
+FROM xosproject/xos-synchronizer-base
+
+ADD . /opt/xos/synchronizers/openstack
+
+ENTRYPOINT []
+
+WORKDIR "/opt/xos/synchronizers/openstack"
+
+CMD bash -c "cd /opt/xos/synchronizers/openstack; ./run-from-api.sh"
diff --git a/xos/synchronizer/Makefile b/xos/synchronizer/Makefile
new file mode 100644
index 0000000..b784fd8
--- /dev/null
+++ b/xos/synchronizer/Makefile
@@ -0,0 +1,5 @@
+synchronizer:
+	sudo docker build --rm -f Dockerfile.synchronizer -t xosproject/openstack-synchronizer .
+
+up:
+	docker-compose -p openstack up -d
diff --git a/xos/synchronizer/docker-compose.yml b/xos/synchronizer/docker-compose.yml
new file mode 100644
index 0000000..82737c3
--- /dev/null
+++ b/xos/synchronizer/docker-compose.yml
@@ -0,0 +1,21 @@
+version: '2'
+
+networks:
+  xos:
+    external: true
+
+services:
+  synchronizer:
+    image: xosproject/openstack-synchronizer
+    networks:
+      - xos
+    #command: bash -c "sleep 86400"
+    volumes:
+        - /opt/cord/build/platform-install/credentials/xosadmin@opencord.org:/opt/xos/services/openstack/credentials/xosadmin@opencord.org
+    external_links: 
+        - rcordbs_xos_redis_1:redis
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "1000k"
+        max-file: "5"
diff --git a/xos/synchronizer/openstack_from_api_config b/xos/synchronizer/openstack_from_api_config
new file mode 100644
index 0000000..066ca22
--- /dev/null
+++ b/xos/synchronizer/openstack_from_api_config
@@ -0,0 +1,25 @@
+[api]
+nova_enabled=True
+
+[nova]
+ca_ssl_cert=/etc/ssl/certs/ca-certificates.crt
+
+# Sets options for the synchronizer
+[observer]
+name=openstack
+dependency_graph=/opt/xos/model-deps
+steps_dir=/opt/xos/synchronizers/openstack/steps
+sys_dir=/opt/xos/synchronizers/openstack/sys
+model_policies_dir=/opt/xos/synchronizers/openstack/model_policies
+#logfile=/var/log/xos_backend.log
+log_file=console
+log_level=debug
+pretend=False
+backoff_disabled=True
+save_ansible_output=True
+accessor_kind=api
+accessor_password=@/opt/xos/services/openstack/credentials/xosadmin@opencord.org
+images_directory=/opt/xos/images
+
+[networking]
+use_vtn=True
diff --git a/xos/synchronizer/run-from-api.sh b/xos/synchronizer/run-from-api.sh
new file mode 100755
index 0000000..031528e
--- /dev/null
+++ b/xos/synchronizer/run-from-api.sh
@@ -0,0 +1,2 @@
+export XOS_DIR=/opt/xos
+python xos-synchronizer.py  -C $XOS_DIR/synchronizers/openstack/openstack_from_api_config