Moved init of mappings to init file

This commit is contained in:
Shay Nehmad 2019-08-21 18:32:39 +03:00
parent db58bf9a87
commit 3f85c336b9
2 changed files with 20 additions and 21 deletions

View File

@ -0,0 +1,2 @@
from zero_trust_consts import populate_mappings
populate_mappings()

View File

@ -128,6 +128,11 @@ TESTS_MAP = {
},
}
EVENT_TYPE_ISLAND = "island"
EVENT_TYPE_MONKEY_NETWORK = "monkey_network"
EVENT_TYPE_MONKEY_LOCAL = "monkey_local"
EVENT_TYPES = (EVENT_TYPE_MONKEY_LOCAL, EVENT_TYPE_MONKEY_NETWORK, EVENT_TYPE_ISLAND)
PILLARS_TO_TESTS = {
DATA: [],
PEOPLE: [],
@ -138,6 +143,16 @@ PILLARS_TO_TESTS = {
AUTOMATION_ORCHESTRATION: []
}
DIRECTIVES_TO_TESTS = {}
DIRECTIVES_TO_PILLARS = {}
def populate_mappings():
populate_pillars_to_tests()
populate_directives_to_tests()
populate_directives_to_pillars()
def populate_pillars_to_tests():
for pillar in PILLARS:
@ -146,11 +161,6 @@ def populate_pillars_to_tests():
PILLARS_TO_TESTS[pillar].append(test)
populate_pillars_to_tests()
DIRECTIVES_TO_TESTS = {}
def populate_directives_to_tests():
for single_directive in DIRECTIVES:
DIRECTIVES_TO_TESTS[single_directive] = []
@ -158,11 +168,6 @@ def populate_directives_to_tests():
DIRECTIVES_TO_TESTS[test_info[DIRECTIVE_KEY]].append(test)
populate_directives_to_tests()
DIRECTIVES_TO_PILLARS = {}
def populate_directives_to_pillars():
for directive, directive_tests in DIRECTIVES_TO_TESTS.items():
directive_pillars = set()
@ -170,11 +175,3 @@ def populate_directives_to_pillars():
for pillar in TESTS_MAP[test][PILLARS_KEY]:
directive_pillars.add(pillar)
DIRECTIVES_TO_PILLARS[directive] = directive_pillars
populate_directives_to_pillars()
EVENT_TYPE_ISLAND = "island"
EVENT_TYPE_MONKEY_NETWORK = "monkey_network"
EVENT_TYPE_MONKEY_LOCAL = "monkey_local"
EVENT_TYPES = (EVENT_TYPE_MONKEY_LOCAL, EVENT_TYPE_MONKEY_NETWORK, EVENT_TYPE_ISLAND)