CORD-2510 Migrate vEG to dynamic load
Change-Id: I390345541c35d57c0eade808ddc7af79dddf2f82
diff --git a/xos/synchronizer/model_policies/test_model_policy_vegtenant.py b/xos/synchronizer/model_policies/test_model_policy_vegtenant.py
index 34c94ac..2761846 100644
--- a/xos/synchronizer/model_policies/test_model_policy_vegtenant.py
+++ b/xos/synchronizer/model_policies/test_model_policy_vegtenant.py
@@ -27,9 +27,17 @@
xos_dir=os.path.join(test_path, "../../../../../../orchestration/xos/xos")
services_dir=os.path.join(xos_dir, "../../xos_services")
-# ---------------------------------------------------------------------------------------------------------------------
-# End Model Policy Testing Framework
-# ---------------------------------------------------------------------------------------------------------------------
+# While transitioning from static to dynamic load, the path to find neighboring xproto files has changed. So check
+# both possible locations...
+def get_models_fn(service_name, xproto_name):
+ name = os.path.join(service_name, "xos", xproto_name)
+ if os.path.exists(os.path.join(services_dir, name)):
+ return name
+ else:
+ name = os.path.join(service_name, "xos", "synchronizer", "models", xproto_name)
+ if os.path.exists(os.path.join(services_dir, name)):
+ return name
+ raise Exception("Unable to find service=%s xproto=%s" % (service_name, xproto_name))
class TestModelPolicyVsgTenant(unittest.TestCase):
def setUp(self):
@@ -45,7 +53,8 @@
Config.init(config, 'synchronizer-config-schema.yaml')
from synchronizers.new_base.mock_modelaccessor_build import build_mock_modelaccessor
- build_mock_modelaccessor(xos_dir, services_dir, ["vEG/xos/veg.xproto", "addressmanager/xos/addressmanager.xproto"])
+ build_mock_modelaccessor(xos_dir, services_dir, [get_models_fn("vEG", "veg.xproto"),
+ get_models_fn("addressmanager", "addressmanager.xproto")])
import synchronizers.new_base.modelaccessor
import synchronizers.new_base.model_policies.model_policy_tenantwithcontainer