Set default directory of equivalence under templates directory
Putting the together will imply user about the inner connection between them. Change-Id: Ib78d1cf0dc0e83f2a7ecdccc822332dba71f69eb Signed-off-by: Yujun Zhang <zhang.yujunz@zte.com.cn>
This commit is contained in:
parent
2cb1fafe2b
commit
5468748d5c
@ -22,7 +22,7 @@ OPTS = [
|
|||||||
help='A path for the templates used by the evaluator'
|
help='A path for the templates used by the evaluator'
|
||||||
),
|
),
|
||||||
cfg.StrOpt('equivalences_dir',
|
cfg.StrOpt('equivalences_dir',
|
||||||
default='/etc/vitrage/equivalences',
|
default='/etc/vitrage/templates/equivalences',
|
||||||
help='A path for entity equivalences used by the evaluator'
|
help='A path for entity equivalences used by the evaluator'
|
||||||
)
|
)
|
||||||
]
|
]
|
||||||
|
@ -36,8 +36,8 @@ EdgeKeyScenario = namedtuple('EdgeKeyScenario', ['label', 'source', 'target'])
|
|||||||
class ScenarioRepository(object):
|
class ScenarioRepository(object):
|
||||||
def __init__(self, conf):
|
def __init__(self, conf):
|
||||||
self._templates = {}
|
self._templates = {}
|
||||||
self.entity_equivalences = \
|
self.entity_equivalences = EquivalenceRepository().load_files(
|
||||||
EquivalenceRepository().load_files(conf.evaluator.equivalences_dir)
|
conf.evaluator.equivalences_dir)
|
||||||
self.relationship_scenarios = defaultdict(list)
|
self.relationship_scenarios = defaultdict(list)
|
||||||
self.entity_scenarios = defaultdict(list)
|
self.entity_scenarios = defaultdict(list)
|
||||||
self._load_templates_files(conf)
|
self._load_templates_files(conf)
|
||||||
|
@ -24,7 +24,8 @@ class EquivalenceTemplateTest(base.BaseTest):
|
|||||||
|
|
||||||
def test_equivalence_template(self):
|
def test_equivalence_template(self):
|
||||||
|
|
||||||
equivalence_path = '%s/equivalences/%s' % (utils.get_resources_dir(),
|
equivalence_path = '%s/templates/general/equivalences/%s' % (
|
||||||
|
utils.get_resources_dir(),
|
||||||
self.BASIC_TEMPLATE)
|
self.BASIC_TEMPLATE)
|
||||||
equivalence_definition = file_utils.load_yaml_file(equivalence_path,
|
equivalence_definition = file_utils.load_yaml_file(equivalence_path,
|
||||||
True)
|
True)
|
||||||
|
@ -28,8 +28,8 @@ class TestEquivalenceRepository(base.BaseTest):
|
|||||||
self.equivalence_repository = EquivalenceRepository()
|
self.equivalence_repository = EquivalenceRepository()
|
||||||
|
|
||||||
def test_duplicate_entities_in_equivalence(self):
|
def test_duplicate_entities_in_equivalence(self):
|
||||||
equivalences_dup_dir = utils.get_resources_dir() + '/equivalences_dup'
|
base_dir = utils.get_resources_dir() + '/templates/equivalences_dup'
|
||||||
for directory in os.listdir(equivalences_dup_dir):
|
for directory in os.listdir(base_dir):
|
||||||
self.assertRaises(VitrageError,
|
self.assertRaises(VitrageError,
|
||||||
self.equivalence_repository.load_files,
|
self.equivalence_repository.load_files,
|
||||||
os.path.join(equivalences_dup_dir, directory))
|
os.path.join(base_dir, directory))
|
||||||
|
@ -24,15 +24,14 @@ from vitrage.utils import file as file_utils
|
|||||||
|
|
||||||
|
|
||||||
class ScenarioRepositoryTest(base.BaseTest):
|
class ScenarioRepositoryTest(base.BaseTest):
|
||||||
|
BASE_DIR = utils.get_resources_dir() + '/templates/general'
|
||||||
HOST_HIGH_CPU = 'host_high_cpu_load_to_instance_cpu_suboptimal'
|
HOST_HIGH_CPU = 'host_high_cpu_load_to_instance_cpu_suboptimal'
|
||||||
OPTS = [
|
OPTS = [
|
||||||
cfg.StrOpt('templates_dir',
|
cfg.StrOpt('templates_dir',
|
||||||
default=utils.get_resources_dir() + '/templates/general',
|
default=BASE_DIR,
|
||||||
),
|
),
|
||||||
cfg.StrOpt('equivalences_dir',
|
cfg.StrOpt('equivalences_dir',
|
||||||
default=utils.get_resources_dir() +
|
default='equivalences',
|
||||||
'/equivalences',
|
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -97,11 +96,11 @@ class ScenarioRepositoryTest(base.BaseTest):
|
|||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
class ScenarioExpansionTest(base.BaseTest):
|
class EquivalentScenarioTest(base.BaseTest):
|
||||||
BASE_DIR = utils.get_resources_dir() + '/scenario_expansion/'
|
BASE_DIR = utils.get_resources_dir() + '/templates/equivalent_scenarios/'
|
||||||
OPTS = [
|
OPTS = [
|
||||||
cfg.StrOpt('templates_dir',
|
cfg.StrOpt('templates_dir',
|
||||||
default=BASE_DIR + 'templates'),
|
default=BASE_DIR),
|
||||||
cfg.StrOpt('equivalences_dir',
|
cfg.StrOpt('equivalences_dir',
|
||||||
default=BASE_DIR + '/equivalences')]
|
default=BASE_DIR + '/equivalences')]
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user