Island: Add set_simulation_mode Island event handler

This commit is contained in:
Shreya Malviya 2022-09-21 16:20:05 +05:30
parent 9ce652f1a5
commit b4c1879bf9
2 changed files with 20 additions and 0 deletions

View File

@ -1,3 +1,4 @@
from .reset_agent_configuration import reset_agent_configuration
from .reset_machine_repository import reset_machine_repository
from .set_agent_configuration_per_island_mode import set_agent_configuration_per_island_mode
from .set_simulation_mode import set_simulation_mode

View File

@ -0,0 +1,19 @@
from typing import Any
from monkey_island.cc.repository import ISimulationRepository
class set_simulation_mode:
"""
Callable class that sets the Island's mode
"""
def __init__(
self,
simulation_repository: ISimulationRepository,
):
self._simulation_repository = simulation_repository
def __call__(self, event: Any = None):
mode = event
self._simulation_repository.set_mode(mode)