def setUp(self): global VOLTServiceInstancePolicy, MockObjectList self.sys_path_save = sys.path config = os.path.join(test_path, "../test_config.yaml") from xosconfig import Config Config.clear() Config.init(config, 'synchronizer-config-schema.yaml') from xossynchronizer.mock_modelaccessor_build import mock_modelaccessor_config mock_modelaccessor_config(test_path, [("olt-service", "volt.xproto"), ("rcord", "rcord.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 xossynchronizer.modelaccessor import model_accessor self.model_accessor = model_accessor from mock_modelaccessor import MockObjectList from model_policy_voltserviceinstance import VOLTServiceInstancePolicy # import all class names to globals for (k, v) in model_accessor.all_model_classes.items(): globals()[k] = v # Some of the functions we call have side-effects. For example, creating a ServiceInstance may lead to creation of # tags. Ideally, this wouldn't happen, but it does. So make sure we reset the world. model_accessor.reset_all_object_stores() self.policy = VOLTServiceInstancePolicy(model_accessor=self.model_accessor) self.si = Mock()
def setUp(self): self.sys_path_save = sys.path config = os.path.join(test_path, "../test_config.yaml") from xosconfig import Config Config.clear() Config.init(config, 'synchronizer-config-schema.yaml') from xossynchronizer.mock_modelaccessor_build import mock_modelaccessor_config mock_modelaccessor_config(test_path, [("ntt-workflow-driver", "ntt-workflow-driver.xproto"), ("olt-service", "volt.xproto"), ("rcord", "rcord.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 xossynchronizer.modelaccessor import model_accessor from model_policy_ntt_workflow_driver_serviceinstance import NttWorkflowDriverServiceInstancePolicy, NttHelpers self.NttHelpers = NttHelpers # import all class names to globals for (k, v) in model_accessor.all_model_classes.items(): globals()[k] = v # Some of the functions we call have side-effects. For example, creating a VSGServiceInstance may lead to # creation of tags. Ideally, this wouldn't happen, but it does. So make sure we reset the world. model_accessor.reset_all_object_stores() self.policy = NttWorkflowDriverServiceInstancePolicy(model_accessor=model_accessor) self.si = NttWorkflowDriverServiceInstance() self.si.owner = NttWorkflowDriverService() self.si.serial_number = "BRCM1234"
def setUp(self): self.sys_path_save = sys.path # Setting up the config module from xosconfig import Config config = os.path.join(test_path, "../test_config.yaml") Config.clear() Config.init(config, "synchronizer-config-schema.yaml") # END Setting up the config module from xossynchronizer.mock_modelaccessor_build import build_mock_modelaccessor # Can't use mock_modelaccessor_config because we're not in the xos-services directory, so do it # the long way... xos_dir = os.path.join(test_path, "../../../../xos") services_dir = os.path.join(test_path, "../../../..") service_xprotos = [ os.path.join(test_path, "../models/testservice.xproto") ] build_mock_modelaccessor(None, xos_dir, services_dir, service_xprotos) # mock_modelaccessor_config(test_path, [("testservice", "testservice.xproto")]) import xossynchronizer.modelaccessor import mock_modelaccessor imp.reload( mock_modelaccessor) # in case nose2 loaded it in a previous test imp.reload(xossynchronizer.modelaccessor ) # in case nose2 loaded it in a previous test from model_policy_testservice_serviceinstance import TestserviceServiceInstancePolicy from xossynchronizer.modelaccessor import model_accessor self.model_accessor = model_accessor # import all class names to globals for (k, v) in model_accessor.all_model_classes.items(): globals()[k] = v # Some of the functions we call have side-effects, reset the world. model_accessor.reset_all_object_stores() self.policy = TestserviceServiceInstancePolicy(self.model_accessor) self.si = Mock(sync_after_policy=False, sync_during_policy=False, policy_after_sync=False, policy_during_sync=False, update_during_sync=False, update_during_policy=False, create_duplicate=False)
def setUp(self): self.sys_path_save = sys.path # Setting up the config module from xosconfig import Config config = os.path.join(test_path, "../test_config.yaml") Config.clear() Config.init(config, "synchronizer-config-schema.yaml") # END Setting up the config module from xossynchronizer.mock_modelaccessor_build import build_mock_modelaccessor # Can't use mock_modelaccessor_config because we're not in the xos-services directory, so do it # the long way... xos_dir = os.path.join(test_path, "../../../../xos") services_dir = os.path.join(test_path, "../../../..") service_xprotos = [os.path.join(test_path, "../models/testservice.xproto")] build_mock_modelaccessor(None, xos_dir, services_dir, service_xprotos) # mock_modelaccessor_config(test_path, [("testservice", "testservice.xproto")]) import xossynchronizer.modelaccessor import mock_modelaccessor imp.reload(mock_modelaccessor) # in case nose2 loaded it in a previous test imp.reload(xossynchronizer.modelaccessor) # in case nose2 loaded it in a previous test from model_policy_testservice_serviceinstance import TestserviceServiceInstancePolicy from xossynchronizer.modelaccessor import model_accessor self.model_accessor = model_accessor # import all class names to globals for (k, v) in model_accessor.all_model_classes.items(): globals()[k] = v # Some of the functions we call have side-effects, reset the world. model_accessor.reset_all_object_stores() self.policy = TestserviceServiceInstancePolicy(self.model_accessor) self.si = Mock(sync_after_policy=False, sync_during_policy=False, policy_after_sync=False, policy_during_sync=False, update_during_sync=False, update_during_policy=False, create_duplicate=False)