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'
|
||||
),
|
||||
cfg.StrOpt('equivalences_dir',
|
||||
default='/etc/vitrage/equivalences',
|
||||
default='/etc/vitrage/templates/equivalences',
|
||||
help='A path for entity equivalences used by the evaluator'
|
||||
)
|
||||
]
|
||||
|
@ -36,8 +36,8 @@ EdgeKeyScenario = namedtuple('EdgeKeyScenario', ['label', 'source', 'target'])
|
||||
class ScenarioRepository(object):
|
||||
def __init__(self, conf):
|
||||
self._templates = {}
|
||||
self.entity_equivalences = \
|
||||
EquivalenceRepository().load_files(conf.evaluator.equivalences_dir)
|
||||
self.entity_equivalences = EquivalenceRepository().load_files(
|
||||
conf.evaluator.equivalences_dir)
|
||||
self.relationship_scenarios = defaultdict(list)
|
||||
self.entity_scenarios = defaultdict(list)
|
||||
self._load_templates_files(conf)
|
||||
|
@ -24,8 +24,9 @@ class EquivalenceTemplateTest(base.BaseTest):
|
||||
|
||||
def test_equivalence_template(self):
|
||||
|
||||
equivalence_path = '%s/equivalences/%s' % (utils.get_resources_dir(),
|
||||
self.BASIC_TEMPLATE)
|
||||
equivalence_path = '%s/templates/general/equivalences/%s' % (
|
||||
utils.get_resources_dir(),
|
||||
self.BASIC_TEMPLATE)
|
||||
equivalence_definition = file_utils.load_yaml_file(equivalence_path,
|
||||
True)
|
||||
equivalence_data = EquivalenceData(equivalence_definition)
|
||||
|
@ -28,8 +28,8 @@ class TestEquivalenceRepository(base.BaseTest):
|
||||
self.equivalence_repository = EquivalenceRepository()
|
||||
|
||||
def test_duplicate_entities_in_equivalence(self):
|
||||
equivalences_dup_dir = utils.get_resources_dir() + '/equivalences_dup'
|
||||
for directory in os.listdir(equivalences_dup_dir):
|
||||
base_dir = utils.get_resources_dir() + '/templates/equivalences_dup'
|
||||
for directory in os.listdir(base_dir):
|
||||
self.assertRaises(VitrageError,
|
||||
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):
|
||||
|
||||
BASE_DIR = utils.get_resources_dir() + '/templates/general'
|
||||
HOST_HIGH_CPU = 'host_high_cpu_load_to_instance_cpu_suboptimal'
|
||||
OPTS = [
|
||||
cfg.StrOpt('templates_dir',
|
||||
default=utils.get_resources_dir() + '/templates/general',
|
||||
default=BASE_DIR,
|
||||
),
|
||||
cfg.StrOpt('equivalences_dir',
|
||||
default=utils.get_resources_dir() +
|
||||
'/equivalences',
|
||||
default='equivalences',
|
||||
),
|
||||
]
|
||||
|
||||
@ -97,11 +96,11 @@ class ScenarioRepositoryTest(base.BaseTest):
|
||||
pass
|
||||
|
||||
|
||||
class ScenarioExpansionTest(base.BaseTest):
|
||||
BASE_DIR = utils.get_resources_dir() + '/scenario_expansion/'
|
||||
class EquivalentScenarioTest(base.BaseTest):
|
||||
BASE_DIR = utils.get_resources_dir() + '/templates/equivalent_scenarios/'
|
||||
OPTS = [
|
||||
cfg.StrOpt('templates_dir',
|
||||
default=BASE_DIR + 'templates'),
|
||||
default=BASE_DIR),
|
||||
cfg.StrOpt('equivalences_dir',
|
||||
default=BASE_DIR + '/equivalences')]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user