SEBA-405 Update addressmanager service to use synchronizer library

Change-Id: I753ac0414caadff95de19aa32257f641512126bc
diff --git a/xos/synchronizer/steps/test_sync_addressmanagerserviceinstance.py b/xos/synchronizer/steps/test_sync_addressmanagerserviceinstance.py
index fa6a073..68c3b61 100644
--- a/xos/synchronizer/steps/test_sync_addressmanagerserviceinstance.py
+++ b/xos/synchronizer/steps/test_sync_addressmanagerserviceinstance.py
@@ -19,13 +19,7 @@
 
 import os, sys
 
-# Hack to load synchronizer framework
 test_path=os.path.abspath(os.path.dirname(os.path.realpath(__file__)))
-xos_dir=os.path.join(test_path, "../../..")
-if not os.path.exists(os.path.join(test_path, "new_base")):
-    xos_dir=os.path.join(test_path, "../../../../../../orchestration/xos/xos")
-    services_dir = os.path.join(xos_dir, "../../xos_services")
-# END Hack to load synchronizer framework
 
 def match_json(desired, req):
     if desired!=req.json():
@@ -33,26 +27,12 @@
         return False
     return True
 
-# generate model from xproto
-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))
-# END generate model from xproto
-
 class TestSyncAddressManagerServiceInstance(unittest.TestCase):
 
     def setUp(self):
         global MockObjectList, model_accessor, SyncStep
 
         self.sys_path_save = sys.path
-        sys.path.append(xos_dir)
-        sys.path.append(os.path.join(xos_dir, 'synchronizers', 'new_base'))
 
         # Setting up the config module
         from xosconfig import Config
@@ -61,17 +41,20 @@
         Config.init(config, "synchronizer-config-schema.yaml")
         # END Setting up the config module
 
-        from synchronizers.new_base.mock_modelaccessor_build import build_mock_modelaccessor
-        build_mock_modelaccessor(xos_dir, services_dir, [get_models_fn("fabric", "fabric.xproto"),
-                                                         get_models_fn("addressmanager", "addressmanager.xproto"),
-                                                         get_models_fn("onos-service", "onos.xproto")])
-        import synchronizers.new_base.modelaccessor
-        from synchronizers.new_base.syncstep import SyncStep
-        from sync_addressmanagerserviceinstance import SyncAddressManagerServiceInstance, model_accessor
+        from xossynchronizer.mock_modelaccessor_build import mock_modelaccessor_config
+        mock_modelaccessor_config(test_path, [("fabric", "fabric.xproto"),
+                                              ("addressmanager", "addressmanager.xproto"),
+                                              ("onos-service", "onos.xproto")])
 
+        import xossynchronizer.modelaccessor
+        import mock_modelaccessor
+        reload(mock_modelaccessor) # in case nose2 loaded it in a previous test
+        reload(xossynchronizer.modelaccessor)      # in case nose2 loaded it in a previous test
+
+        from sync_addressmanagerserviceinstance import SyncAddressManagerServiceInstance, model_accessor, SyncStep
         from mock_modelaccessor import MockObjectList
 
-        self.sync_step = SyncAddressManagerServiceInstance()
+        self.sync_step = SyncAddressManagerServiceInstance(model_accessor = model_accessor)
 
         # import all class names to globals
         for (k, v) in model_accessor.all_model_classes.items():