Updating VnodGlobal to new build method with docker files, yml config and sh scripts

Change-Id: I56d1e78e2798db8cebe9807417ae9b8c1c8034e4
diff --git a/xos/synchronizer/Dockerfile.synchronizer b/xos/synchronizer/Dockerfile.synchronizer
new file mode 100644
index 0000000..9440751
--- /dev/null
+++ b/xos/synchronizer/Dockerfile.synchronizer
@@ -0,0 +1,9 @@
+FROM xosproject/xos-synchronizer-base:candidate
+
+ADD . /opt/xos/synchronizers/metro-net
+
+ENTRYPOINT []
+
+WORKDIR "/opt/xos/synchronizers/metro-net"
+
+CMD bash -c "cd /opt/xos/synchronizers/metro-net; ./run-from-api.sh
\ No newline at end of file
diff --git a/xos/synchronizer/Makefile b/xos/synchronizer/Makefile
new file mode 100644
index 0000000..790af0d
--- /dev/null
+++ b/xos/synchronizer/Makefile
@@ -0,0 +1,5 @@
+synchronizer:
+	sudo docker build --rm -f Dockerfile.synchronizer -t xosproject/metronetwork-synchronizer .
+
+up:
+	docker-compose -p metronetwork up -d
\ No newline at end of file
diff --git a/xos/synchronizer/docker-compose.yml b/xos/synchronizer/docker-compose.yml
new file mode 100644
index 0000000..6bc6cb8
--- /dev/null
+++ b/xos/synchronizer/docker-compose.yml
@@ -0,0 +1,22 @@
+version: '2'
+
+networks:
+  xos:
+    external: true
+
+services:
+  synchronizer:
+    image: xosproject/metronetwork-synchronizer
+    networks:
+      - xos
+    #command: bash -c "sleep 86400"
+    volumes:
+        - /opt/cord_profile/node_key:/opt/cord_profile/node_key:ro
+        - /opt/cord/build/platform-install/credentials/xosadmin@opencord.org:/opt/xos/services/metro-net/credentials/xosadmin@opencord.org
+    external_links:
+        - rcordbs_xos_redis_1:redis
+    logging:
+      driver: "json-file"
+      options:
+        max-size: "1000k"
+        max-file: "5"
\ No newline at end of file
diff --git a/xos/synchronizer/metronetwork-synchronizer.py b/xos/synchronizer/metronetwork-synchronizer.py
index 64d0b08..a60c758 100755
--- a/xos/synchronizer/metronetwork-synchronizer.py
+++ b/xos/synchronizer/metronetwork-synchronizer.py
@@ -6,7 +6,7 @@
 import os
 import sys
 
-observer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../synchronizers/base")
+observer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../synchronizers/new_base")
 sys.path.append(observer_path)
 mod = importlib.import_module("xos-synchronizer")
 mod.main()
diff --git a/xos/synchronizer/metronetwork_from_api_config b/xos/synchronizer/metronetwork_from_api_config
new file mode 100644
index 0000000..0d6764c
--- /dev/null
+++ b/xos/synchronizer/metronetwork_from_api_config
@@ -0,0 +1,20 @@
+# Sets options for the synchronizer
+[observer]
+name=metronetwork
+dependency_graph=/opt/xos/synchronizers/metro-net/model-deps
+steps_dir=/opt/xos/synchronizers/metro-net/steps
+sys_dir=/opt/xos/synchronizers/metro-net/sys
+#logfile=/var/log/xos_backend.log
+log_file=console
+log_level=debug
+pretend=False
+backoff_disabled=True
+save_ansible_output=True
+proxy_ssh=True
+proxy_ssh_key=/opt/cord_profile/node_key
+proxy_ssh_user=root
+accessor_kind=api
+accessor_password=@/opt/xos/services/metro-net/credentials/xosadmin@opencord.org
+
+[networking]
+use_vtn=True
\ No newline at end of file
diff --git a/xos/synchronizer/run-from-api.sh b/xos/synchronizer/run-from-api.sh
new file mode 100644
index 0000000..95ba5dd
--- /dev/null
+++ b/xos/synchronizer/run-from-api.sh
@@ -0,0 +1,2 @@
+export XOS_DIR=/opt/xos
+python metronetwork-synchronizer.py  -C $XOS_DIR/synchronizers/metro-net/metronetwork_from_api_config
\ No newline at end of file
diff --git a/xos/synchronizer/steps/sync_metronetworkservice.py b/xos/synchronizer/steps/sync_metronetworkservice.py
index 56fd5d5..3468d2b 100644
--- a/xos/synchronizer/steps/sync_metronetworkservice.py
+++ b/xos/synchronizer/steps/sync_metronetworkservice.py
@@ -1,8 +1,9 @@
 import os, sys
 from itertools import chain
 
-from synchronizers.base.syncstep import SyncStep
-from services.metronetwork.models import *
+from synchronizers.new_base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible #if needed
+from synchronizers.new_base.ansible_helper import run_template_ssh #if needed
+from synchronizers.new_base.modelaccessor import *
 from xos.logger import Logger, logging
 from synchronizers.metronetwork.providers.providerfactory import ProviderFactory
 from synchronizers.metronetwork.invokers.invokerfactory import InvokerFactory