CORD-2510 Migrate VNaaS to dynamic load
Change-Id: Ie786c452379ae96706b2319f98ccddfc82b8b205
diff --git a/xos/synchronizer/steps/test_sync_vnaaseline.py b/xos/synchronizer/steps/test_sync_vnaaseline.py
index 4aa34af..3fcd380 100644
--- a/xos/synchronizer/steps/test_sync_vnaaseline.py
+++ b/xos/synchronizer/steps/test_sync_vnaaseline.py
@@ -54,6 +54,18 @@
ELINE_VLANIDS = "100"
ELINE_NAME = "testeline"
+# 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 TestSyncvNaaSEline(unittest.TestCase):
def setUp(self):
global SyncvNaaSEline, MockObjectList
@@ -68,7 +80,7 @@
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, ["vnaas/xos/vnaas.xproto"])
+ build_mock_modelaccessor(xos_dir, services_dir, [get_models_fn("vnaas", "vnaas.xproto")])
import synchronizers.new_base.modelaccessor
import synchronizers.new_base.model_policies.model_policy_tenantwithcontainer