#2350: configurable NMNE category thresholds
This commit is contained in:
@@ -5,8 +5,9 @@ from typing import Union
|
||||
import yaml
|
||||
|
||||
from primaite.config.load import data_manipulation_config_path
|
||||
from primaite.game.agent.interface import ProxyAgent, RandomAgent
|
||||
from primaite.game.agent.interface import ProxyAgent
|
||||
from primaite.game.agent.scripted_agents.data_manipulation_bot import DataManipulationAgent
|
||||
from primaite.game.agent.scripted_agents.probabilistic_agent import ProbabilisticAgent
|
||||
from primaite.game.game import APPLICATION_TYPES_MAPPING, PrimaiteGame, SERVICE_TYPES_MAPPING
|
||||
from primaite.simulator.network.container import Network
|
||||
from primaite.simulator.network.hardware.nodes.host.computer import Computer
|
||||
@@ -43,15 +44,15 @@ def test_example_config():
|
||||
|
||||
# green agent 1
|
||||
assert "client_2_green_user" in game.agents
|
||||
assert isinstance(game.agents["client_2_green_user"], RandomAgent)
|
||||
assert isinstance(game.agents["client_2_green_user"], ProbabilisticAgent)
|
||||
|
||||
# green agent 2
|
||||
assert "client_1_green_user" in game.agents
|
||||
assert isinstance(game.agents["client_1_green_user"], RandomAgent)
|
||||
assert isinstance(game.agents["client_1_green_user"], ProbabilisticAgent)
|
||||
|
||||
# red agent
|
||||
assert "client_1_data_manipulation_red_bot" in game.agents
|
||||
assert isinstance(game.agents["client_1_data_manipulation_red_bot"], DataManipulationAgent)
|
||||
assert "data_manipulation_attacker" in game.agents
|
||||
assert isinstance(game.agents["data_manipulation_attacker"], DataManipulationAgent)
|
||||
|
||||
# blue agent
|
||||
assert "defender" in game.agents
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
from pathlib import Path
|
||||
from typing import Union
|
||||
|
||||
import yaml
|
||||
|
||||
from primaite.config.load import data_manipulation_config_path
|
||||
from primaite.game.game import PrimaiteGame
|
||||
from tests import TEST_ASSETS_ROOT
|
||||
|
||||
BASIC_CONFIG = TEST_ASSETS_ROOT / "configs/basic_switched_network.yaml"
|
||||
|
||||
|
||||
def load_config(config_path: Union[str, Path]) -> PrimaiteGame:
|
||||
"""Returns a PrimaiteGame object which loads the contents of a given yaml path."""
|
||||
with open(config_path, "r") as f:
|
||||
cfg = yaml.safe_load(f)
|
||||
|
||||
return PrimaiteGame.from_config(cfg)
|
||||
|
||||
|
||||
def test_thresholds():
|
||||
"""Test that the game options can be parsed correctly."""
|
||||
game = load_config(data_manipulation_config_path())
|
||||
|
||||
assert game.options.thresholds is not None
|
||||
Reference in New Issue
Block a user