epyt_flow.rest_api.scenario
epyt_flow.rest_api.scenario.handlers
This module provides REST API handlers for some requests concerning scenarios.
- class epyt_flow.rest_api.scenario.handlers.ScenarioBaseHandler(scenario_mgr: ScenarioManager)[source]
Bases:
BaseHandlerBase class for all handlers concerning scenarios.
- Parameters:
scenario_mgr (
ScenarioManager) – Instance for managing all scenarios.
- class epyt_flow.rest_api.scenario.handlers.ScenarioConfigHandler(scenario_mgr: ScenarioManager)[source]
Bases:
ScenarioBaseHandlerClass for handling a GET request for getting the scenario configuration of a given scenario.
- on_get(_, resp: falcon.Response, scenario_id: str) None[source]
Gets the scenario configuration of a given scenario.
- Parameters:
resp (falcon.Response) – Response instance.
scenario_id (str) – UUID of the scenario.
- class epyt_flow.rest_api.scenario.handlers.ScenarioExportHandler(scenario_mgr: ScenarioManager)[source]
Bases:
ScenarioBaseHandlerClass for handling GET requests for exporting a given scenario to EPANET files – i.e. .inp and (otpionally) .msx files.
- class epyt_flow.rest_api.scenario.handlers.ScenarioGeneralParamsHandler(scenario_mgr: ScenarioManager)[source]
Bases:
ScenarioBaseHandlerClass for handling GET and POST requests for the general parameters of a given scenario.
- on_get(_, resp: falcon.Response, scenario_id: str) None[source]
Gets the general parameters (e.g. simulation duration, etc.) of a given scenario.
- Parameters:
resp – Response instance.
scenario_id (str) – UUID of the scenario.
- on_post(req: falcon.Request, resp: falcon.Response, scenario_id: str) None[source]
Sets the general parameters of a given scenario.
- Parameters:
req (falcon.Request) – Request instance.
resp – Request instance.
scenario_id (str) – UUID of the scenario.
- class epyt_flow.rest_api.scenario.handlers.ScenarioManager[source]
Bases:
ResourceManagerClass for managing all scenarios that are currently used by the REST API.
- close_item(item: ScenarioSimulator) None[source]
Closes a given resource item – i.e. all clean-up logic for an item should be called here.
- Parameters:
item (Any) – Resource item.
- class epyt_flow.rest_api.scenario.handlers.ScenarioNewHandler(scenario_mgr: ScenarioManager)[source]
Bases:
ScenarioBaseHandlerClass for handling POST requests for creating a new scenario.
- class epyt_flow.rest_api.scenario.handlers.ScenarioNodeDemandPatternHandler(scenario_mgr: ScenarioManager)[source]
Bases:
ScenarioBaseHandlerClass for handling POST requests for node demand patterns of a given scenario.
- class epyt_flow.rest_api.scenario.handlers.ScenarioQualityParamsHandler(scenario_mgr: ScenarioManager)[source]
Bases:
ScenarioBaseHandlerClass for handling POST requests for specifying (EPANET) quality parameters of a given scenario.
- class epyt_flow.rest_api.scenario.handlers.ScenarioRemoveHandler(scenario_mgr: ScenarioManager)[source]
Bases:
ScenarioBaseHandlerClass for handling a DELETE request for a given scenario.
- class epyt_flow.rest_api.scenario.handlers.ScenarioSensorConfigHandler(scenario_mgr: ScenarioManager)[source]
Bases:
ScenarioBaseHandlerClass for handling GET and POST requests for the sensor configuration of a given scenario.
- class epyt_flow.rest_api.scenario.handlers.ScenarioTopologyHandler(scenario_mgr: ScenarioManager)[source]
Bases:
ScenarioBaseHandlerClass for handling GET requests for getting the topology of a given scenario.
epyt_flow.rest_api.scenario.simulation_handlers
This module provides REST API handlers concerning the simulation of scenarios.
- class epyt_flow.rest_api.scenario.simulation_handlers.ScenarioAdvancedQualitySimulationHandler(scada_data_mgr: ScadaDataManager, **kwds)[source]
Bases:
ScenarioBaseHandlerClass for handling POST requests for runing an advanced quality simulation of a given scenario.
- Parameters:
scada_data_mgr (
ScadaDataManager) – SCADA data manager.
- class epyt_flow.rest_api.scenario.simulation_handlers.ScenarioBasicQualitySimulationHandler(scada_data_mgr: ScadaDataManager, **kwds)[source]
Bases:
ScenarioBaseHandlerClass for handling POST requests for runing a basic quality simulation of a given scenario.
- Parameters:
scada_data_mgr (
ScadaDataManager) – SCADA data manager.
- class epyt_flow.rest_api.scenario.simulation_handlers.ScenarioSimulationHandler(scada_data_mgr: ScadaDataManager, **kwds)[source]
Bases:
ScenarioBaseHandlerClass for handling GET requests for simulating a given scenario.
- Parameters:
scada_data_mgr (
ScadaDataManager) – SCADA data manager.
- on_get(_, resp: falcon.Response, scenario_id: str) None[source]
Runs the simulation of a given scenario.
- Parameters:
resp – Response instance.
scenario_id (str) – UUID of the scenario.
- on_post(req: falcon.Request, resp: falcon.Response, scenario_id: str) None[source]
Runs the simulation of a given scenario.
Note that in contrat to the GET request (
on_get()), the POST request allows to specify additional arguments passed torun_simulation().- Parameters:
req – Request instance.
resp – Response instance.
scenario_id (str) – UUID of the scenario.
epyt_flow.rest_api.scenario.control_handlers
This module provides REST API handlers for complex and simple control modules of scenarios.
- class epyt_flow.rest_api.scenario.control_handlers.ScenarioComplexControlHandler(scenario_mgr: ScenarioManager)[source]
Bases:
ScenarioBaseHandlerClass for handling GET and POST requests concerning complex control modules.
- class epyt_flow.rest_api.scenario.control_handlers.ScenarioSimpleControlHandler(scenario_mgr: ScenarioManager)[source]
Bases:
ScenarioBaseHandlerClass for handling GET and POST requests concerning simple control modules.
epyt_flow.rest_api.scenario.event_handlers
This module provides REST API handlers for scenario events.
- class epyt_flow.rest_api.scenario.event_handlers.ScenarioLeakageHandler(scenario_mgr: ScenarioManager)[source]
Bases:
ScenarioBaseHandlerClass for handling GET and POST requests concerning leakages.
- class epyt_flow.rest_api.scenario.event_handlers.ScenarioQualityEventHandler(scenario_mgr: ScenarioManager)[source]
Bases:
ScenarioBaseHandlerClass for handling GET and POST requests concerning quality events.
- class epyt_flow.rest_api.scenario.event_handlers.ScenarioSensorFaultHandler(scenario_mgr: ScenarioManager)[source]
Bases:
ScenarioBaseHandlerClass for handling GET and POST requests concerning sensor faults.
- class epyt_flow.rest_api.scenario.event_handlers.ScenarioSensorReadingAttackHandler(scenario_mgr: ScenarioManager)[source]
Bases:
ScenarioBaseHandlerClass for handling GET and POST requests concerning sensor reading attacks.
epyt_flow.rest_api.scenario.uncertainty_handlers
This module provides REST API handlers for model and sensor uncertainties of scenarios.
- class epyt_flow.rest_api.scenario.uncertainty_handlers.ScenarioModelUncertaintyHandler(scenario_mgr: ScenarioManager)[source]
Bases:
ScenarioBaseHandlerClass for handling GET and POST requests concerning model uncertainty.
- class epyt_flow.rest_api.scenario.uncertainty_handlers.ScenarioSensorUncertaintyHandler(scenario_mgr: ScenarioManager)[source]
Bases:
ScenarioBaseHandlerClass for handling GET and POST requests concerning sensor uncertainty (i.e. noise).