CORD-2476 migrate vsg service to dynamic load
Change-Id: Ifadbf322b8f59f8e87a77822e652abb7ed107af6
diff --git a/xos/synchronizer/steps/test_sync_vsgserviceinstance.py b/xos/synchronizer/steps/test_sync_vsgserviceinstance.py
index c436d13..31f3674 100644
--- a/xos/synchronizer/steps/test_sync_vsgserviceinstance.py
+++ b/xos/synchronizer/steps/test_sync_vsgserviceinstance.py
@@ -27,6 +27,18 @@
xos_dir=os.path.join(test_path, "../../../../../../orchestration/xos/xos")
services_dir=os.path.join(xos_dir, "../../xos_services")
+# 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 TestSyncVSGServiceInstance(unittest.TestCase):
def setUp(self):
global SyncVSGServiceInstance, LeastLoadedNodeScheduler, MockObjectList
@@ -41,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, ["vsg/xos/vsg.xproto", "addressmanager/xos/addressmanager.xproto"])
+ build_mock_modelaccessor(xos_dir, services_dir, [get_models_fn("vsg", "vsg.xproto"),
+ get_models_fn("addressmanager", "addressmanager.xproto")])
import synchronizers.new_base.modelaccessor
import synchronizers.new_base.model_policies.model_policy_tenantwithcontainer