[CORD-1360] Using new config
Change-Id: Iee7c2c456cf45e131fef0330a6f657ad0080449f
diff --git a/xos/attic/header.py b/xos/attic/header.py
index 9075b45..e483538 100644
--- a/xos/attic/header.py
+++ b/xos/attic/header.py
@@ -8,14 +8,11 @@
from operator import itemgetter, attrgetter, methodcaller
import traceback
from xos.exceptions import *
-from xos.config import Config
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes.fields import GenericForeignKey
class ConfigurationError(Exception):
+ # FIXME log the error
pass
VTR_KIND = "vTR"
-
-CORD_USE_VTN = getattr(Config(), "networking_use_vtn", False)
-
diff --git a/xos/synchronizer/run-from-api.sh b/xos/synchronizer/run-from-api.sh
index b5abcf7..623b657 100755
--- a/xos/synchronizer/run-from-api.sh
+++ b/xos/synchronizer/run-from-api.sh
@@ -1,2 +1 @@
-export XOS_DIR=/opt/xos
-python vtr-synchronizer.py -C $XOS_DIR/synchronizers/vtr/vtr_from_api_config
+python vtr-synchronizer.py
diff --git a/xos/synchronizer/steps/sync_vtrtenant.py b/xos/synchronizer/steps/sync_vtrtenant.py
index 7de64a8..7cc480f 100644
--- a/xos/synchronizer/steps/sync_vtrtenant.py
+++ b/xos/synchronizer/steps/sync_vtrtenant.py
@@ -3,7 +3,6 @@
import sys
import base64
import time
-from xos.config import Config
from synchronizers.new_base.SyncInstanceUsingAnsible import SyncInstanceUsingAnsible
from synchronizers.new_base.modelaccessor import *
from xos.logger import Logger, logging
@@ -14,8 +13,6 @@
logger = Logger(level=logging.INFO)
-CORD_USE_VTN = getattr(Config(), "networking_use_vtn", False)
-
class SyncVTRTenant(SyncInstanceUsingAnsible):
provides=[VTRTenant]
observes=VTRTenant
diff --git a/xos/synchronizer/vtr-synchronizer.py b/xos/synchronizer/vtr-synchronizer.py
index 26b44df..8d397c7 100755
--- a/xos/synchronizer/vtr-synchronizer.py
+++ b/xos/synchronizer/vtr-synchronizer.py
@@ -5,7 +5,16 @@
import importlib
import os
import sys
-observer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)),"../../synchronizers/new_base")
+
+from xosconfig import Config
+config_file = os.path.abspath(os.path.dirname(os.path.realpath(__file__)) + '/vtr_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")
+
+# observer_path = os.path.join(os.path.dirname(os.path.realpath(__file__)), "../../../../xos/xos/synchronizers/new_base")
+# sys.path.append('/Users/teone/Sites/opencord/orchestration/xos/xos')
+
sys.path.append(observer_path)
mod = importlib.import_module("xos-synchronizer")
mod.main()
diff --git a/xos/synchronizer/vtr_config.yaml b/xos/synchronizer/vtr_config.yaml
new file mode 100644
index 0000000..cc23d33
--- /dev/null
+++ b/xos/synchronizer/vtr_config.yaml
@@ -0,0 +1,12 @@
+name: vtr-synchronizer
+accessor:
+ username: xosadmin@opencord.org
+ password: "@/opt/xos/services/vtr/credentials/xosadmin@opencord.org"
+required_models:
+ - VSGService
+ - VTRService
+ - VTRTenant
+ - CordSubscriberRoot
+dependency_graph: "/opt/xos/synchronizers/vtr/model-deps"
+steps_dir: "/opt/xos/synchronizers/vtr/steps"
+sys_dir: "/opt/xos/synchronizers/vtr/sys"
\ No newline at end of file
diff --git a/xos/synchronizer/vtr_from_api_config b/xos/synchronizer/vtr_from_api_config
deleted file mode 100644
index 27c52d7..0000000
--- a/xos/synchronizer/vtr_from_api_config
+++ /dev/null
@@ -1,21 +0,0 @@
-# Sets options for the synchronizer
-[observer]
-name=vtr
-dependency_graph=/opt/xos/synchronizers/vtr/model-deps
-steps_dir=/opt/xos/synchronizers/vtr/steps
-sys_dir=/opt/xos/synchronizers/vtr/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/vtr/credentials/xosadmin@opencord.org
-required_models=VSGService, VTRService, VTRTenant, CordSubscriberRoot
-
-[networking]
-use_vtn=True