[CORD-1360] migrating metro-net from 3.0 to master, merge with https://gerrit.opencord.org/#/c/4151/
Change-Id: I6d94a88b67ec4862290c1c0538f9cb269c5b76b3
diff --git a/xos/synchronizer/Dockerfile.synchronizer b/xos/synchronizer/Dockerfile.synchronizer
index 9440751..237d1fa 100644
--- a/xos/synchronizer/Dockerfile.synchronizer
+++ b/xos/synchronizer/Dockerfile.synchronizer
@@ -6,4 +6,5 @@
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
+
+CMD bash -c "cd /opt/xos/synchronizers/metro-net; chmod 755 ./run-from-api.sh; ./run-from-api.sh"
\ No newline at end of file
diff --git a/xos/synchronizer/metronetwork-synchronizer-devel.py b/xos/synchronizer/metronetwork-synchronizer-devel.py
index df697ec..de6028a 100755
--- a/xos/synchronizer/metronetwork-synchronizer-devel.py
+++ b/xos/synchronizer/metronetwork-synchronizer-devel.py
@@ -5,8 +5,10 @@
import importlib
import os
import sys
+from xosconfig import Config
-#observer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../synchronizers/base")
+config_file = os.path.abspath(os.path.dirname(os.path.realpath(__file)) + '/metronetwork_config.yaml')
+
sys.path.append("/opt/xos/synchronizers/base")
print sys.path
mod = importlib.import_module("xos-synchronizer")
diff --git a/xos/synchronizer/metronetwork-synchronizer.py b/xos/synchronizer/metronetwork-synchronizer.py
index a60c758..f65e222 100755
--- a/xos/synchronizer/metronetwork-synchronizer.py
+++ b/xos/synchronizer/metronetwork-synchronizer.py
@@ -5,6 +5,10 @@
import importlib
import os
import sys
+from xosconfig import Config
+
+config_file = os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + '/metronetwork_config.yaml')
+Config.init(config_file, 'synchronizer-config-schema.yaml')
observer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../synchronizers/new_base")
sys.path.append(observer_path)
diff --git a/xos/synchronizer/metronetwork_config.yaml b/xos/synchronizer/metronetwork_config.yaml
new file mode 100644
index 0000000..f4ff8b1
--- /dev/null
+++ b/xos/synchronizer/metronetwork_config.yaml
@@ -0,0 +1,7 @@
+name: metronetwork-synchronizer
+accessor:
+ username: xosadmin@opencord.org
+ password: "@/opt/xos/services/metro-net/credentials/xosadmin@opencord.org"
+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"
diff --git a/xos/synchronizer/metronetwork_from_api_config b/xos/synchronizer/metronetwork_from_api_config
deleted file mode 100644
index 0d6764c..0000000
--- a/xos/synchronizer/metronetwork_from_api_config
+++ /dev/null
@@ -1,20 +0,0 @@
-# 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/metronetwork_synchronizer_config b/xos/synchronizer/metronetwork_synchronizer_config
deleted file mode 100644
index 86847b9..0000000
--- a/xos/synchronizer/metronetwork_synchronizer_config
+++ /dev/null
@@ -1,38 +0,0 @@
-
-[plc]
-name=plc
-deployment=VICCI
-
-[db]
-name=xos
-user=postgres
-password=password
-host=localhost
-port=5432
-
-[api]
-host=128.112.171.237
-port=8000
-ssl_key=None
-ssl_cert=None
-ca_ssl_cert=None
-ratelimit_enabled=0
-omf_enabled=0
-mail_support_address=support@localhost
-nova_enabled=True
-
-[observer]
-name=metronetwork
-dependency_graph=/opt/xos/synchronizers/metronetwork/model-deps
-steps_dir=/opt/xos/synchronizers/metronetwork/steps
-sys_dir=/opt/xos/synchronizers/metronetwork/sys
-deleters_dir=/opt/xos/synchronizers/metronetwork/deleters
-log_file=console
-driver=None
-pretend=False
-backoff_disabled=True
-fofum_disabled=True
-
-[feefie]
-client_id='vicci_dev_central'
-user_id='pl'
diff --git a/xos/synchronizer/run-from-api.sh b/xos/synchronizer/run-from-api.sh
old mode 100644
new mode 100755
index 95ba5dd..a1f2fcc
--- a/xos/synchronizer/run-from-api.sh
+++ b/xos/synchronizer/run-from-api.sh
@@ -1,2 +1 @@
-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
+python metronetwork-synchronizer.py
diff --git a/xos/synchronizer/run.sh b/xos/synchronizer/run.sh
deleted file mode 100755
index 87b6b7d..0000000
--- a/xos/synchronizer/run.sh
+++ /dev/null
@@ -1,2 +0,0 @@
-export XOS_DIR=/opt/xos
-python metronetwork-synchronizer.py -C $XOS_DIR/synchronizers/metronetwork/metronetwork_synchronizer_config