csle_collector.client_manager.dao package
Submodules
csle_collector.client_manager.dao.arrival_config module
- class csle_collector.client_manager.dao.arrival_config.ArrivalConfig(client_arrival_type: csle_collector.client_manager.dao.client_arrival_type.ClientArrivalType)[source]
Bases:
csle_base.json_serializable.JSONSerializable
Abstract arrival configuration class
- static from_dict(d: Dict[str, Any]) csle_collector.client_manager.dao.arrival_config.ArrivalConfig [source]
Converts a dict representation to an instance
- Parameters
d – the dict to convert
- Returns
the created instance
- static from_json_file(json_file_path: str) csle_collector.client_manager.dao.arrival_config.ArrivalConfig [source]
Reads a json file and converts it to a DTO
- Parameters
json_file_path – the json file path
- Returns
the converted DTO
csle_collector.client_manager.dao.client module
- class csle_collector.client_manager.dao.client.Client(id: int, workflow_distribution: List[float], arrival_config: csle_collector.client_manager.dao.arrival_config.ArrivalConfig, mu: float = 4, exponential_service_time: bool = False)[source]
Bases:
csle_base.json_serializable.JSONSerializable
,csle_base.grpc_serializable.GRPCSerializable
A client, which is characterized by its arrival process and its workflow distribution.
- copy() csle_collector.client_manager.dao.client.Client [source]
- Returns
a copy of the DTO
- static from_dict(d: Dict[str, Any]) csle_collector.client_manager.dao.client.Client [source]
Converts a dict representation to an instance
- Parameters
d – the dict to convert
- Returns
the created instance
- static from_grpc_object(obj: client_manager_pb2.ClientDTO) csle_collector.client_manager.dao.client.Client [source]
Instantiates the object from a GRPC DTO
- Parameters
obj – the object to instantiate from
- Returns
the instantiated object
- static from_json_file(json_file_path: str) csle_collector.client_manager.dao.client.Client [source]
Reads a json file and converts it to a DTO
- Parameters
json_file_path – the json file path
- Returns
the converted DTO
- generate_commands(workflows_config: csle_collector.client_manager.dao.workflows_config.WorkflowsConfig) List[str] [source]
Generate the commands for the client
- Parameters
workflows_config – the workflows configuration
- Returns
sampled list of commands for the client
csle_collector.client_manager.dao.client_arrival_type module
Type of process that generates new clients for an emulation
csle_collector.client_manager.dao.constant_arrival_config module
- class csle_collector.client_manager.dao.constant_arrival_config.ConstantArrivalConfig(lamb: float)[source]
Bases:
csle_collector.client_manager.dao.arrival_config.ArrivalConfig
DTO representing the configuration of a stationary poisson arrival process with exponential service times
- static from_dict(d: Dict[str, Any]) csle_collector.client_manager.dao.constant_arrival_config.ConstantArrivalConfig [source]
Converts a dict representation of the object to an instance
- Parameters
d – the dict to convert
- Returns
the created instance
- static from_grpc_object(obj: client_manager_pb2.ConstantArrivalConfigDTO) csle_collector.client_manager.dao.constant_arrival_config.ConstantArrivalConfig [source]
Instantiates the object from a GRPC DTO
- Parameters
obj – the object to instantiate from
- Returns
the instantiated object
- static from_json_file(json_file_path: str) csle_collector.client_manager.dao.constant_arrival_config.ConstantArrivalConfig [source]
Reads a json file and converts it to a DTO
- Parameters
json_file_path – the json file path
- Returns
the converted DTO
csle_collector.client_manager.dao.eptmp_arrival_config module
- class csle_collector.client_manager.dao.eptmp_arrival_config.EPTMPArrivalConfig(thetas: List[float], gammas: List[float], phis: List[float], omegas: List[float])[source]
Bases:
csle_collector.client_manager.dao.arrival_config.ArrivalConfig
DTO representing the configuration of a homogenous poisson arrival process with an Exponential-Polynomial-Trigonometric rate function having Multiple Periodicities
- static from_dict(d: Dict[str, Any]) csle_collector.client_manager.dao.eptmp_arrival_config.EPTMPArrivalConfig [source]
Converts a dict representation of the object to an instance
- Parameters
d – the dict to convert
- Returns
the created instance
- static from_grpc_object(obj: client_manager_pb2.EPTMPArrivalConfigDTO) csle_collector.client_manager.dao.eptmp_arrival_config.EPTMPArrivalConfig [source]
Instantiates the object from a GRPC DTO
- Parameters
obj – the object to instantiate from
- Returns
the instantiated object
- static from_json_file(json_file_path: str) csle_collector.client_manager.dao.eptmp_arrival_config.EPTMPArrivalConfig [source]
Reads a json file and converts it to a DTO
- Parameters
json_file_path – the json file path
- Returns
the converted DTO
csle_collector.client_manager.dao.piece_wise_constant_arrival_config module
- class csle_collector.client_manager.dao.piece_wise_constant_arrival_config.PieceWiseConstantArrivalConfig(breakvalues: List[float], breakpoints: List[int])[source]
Bases:
csle_collector.client_manager.dao.arrival_config.ArrivalConfig
DTO representing the configuration of a piece-wise constant poisson arrival process with exponential service times
- static from_dict(d: Dict[str, Any]) csle_collector.client_manager.dao.piece_wise_constant_arrival_config.PieceWiseConstantArrivalConfig [source]
Converts a dict representation of the object to an instance
- Parameters
d – the dict to convert
- Returns
the created instance
- static from_grpc_object(obj: client_manager_pb2.PieceWiseConstantArrivalConfigDTO) csle_collector.client_manager.dao.piece_wise_constant_arrival_config.PieceWiseConstantArrivalConfig [source]
Instantiates the object from a GRPC DTO
- Parameters
obj – the object to instantiate from
- Returns
the instantiated object
- static from_json_file(json_file_path: str) csle_collector.client_manager.dao.piece_wise_constant_arrival_config.PieceWiseConstantArrivalConfig [source]
Reads a json file and converts it to a DTO
- Parameters
json_file_path – the json file path
- Returns
the converted DTO
csle_collector.client_manager.dao.sine_arrival_config module
- class csle_collector.client_manager.dao.sine_arrival_config.SineArrivalConfig(lamb: float, time_scaling_factor: float, period_scaling_factor: float)[source]
Bases:
csle_collector.client_manager.dao.arrival_config.ArrivalConfig
DTO representing the configuration of a sine-modulated poisson arrival process with exponential service times
- static from_dict(d: Dict[str, Any]) csle_collector.client_manager.dao.sine_arrival_config.SineArrivalConfig [source]
Converts a dict representation of the object to an instance
- Parameters
d – the dict to convert
- Returns
the created instance
- static from_grpc_object(obj: client_manager_pb2.SineArrivalConfigDTO) csle_collector.client_manager.dao.sine_arrival_config.SineArrivalConfig [source]
Instantiates the object from a GRPC DTO
- Parameters
obj – the object to instantiate from
- Returns
the instantiated object
- static from_json_file(json_file_path: str) csle_collector.client_manager.dao.sine_arrival_config.SineArrivalConfig [source]
Reads a json file and converts it to a DTO
- Parameters
json_file_path – the json file path
- Returns
the converted DTO
csle_collector.client_manager.dao.spiking_arrival_config module
- class csle_collector.client_manager.dao.spiking_arrival_config.SpikingArrivalConfig(exponents: List[float], factors: List[float])[source]
Bases:
csle_collector.client_manager.dao.arrival_config.ArrivalConfig
DTO representing the configuration of a poisson arrival process with spiking arrivals
- static from_dict(d: Dict[str, Any]) csle_collector.client_manager.dao.spiking_arrival_config.SpikingArrivalConfig [source]
Converts a dict representation of the object to an instance
- Parameters
d – the dict to convert
- Returns
the created instance
- static from_grpc_object(obj: client_manager_pb2.SpikingArrivalConfigDTO) csle_collector.client_manager.dao.spiking_arrival_config.SpikingArrivalConfig [source]
Instantiates the object from a GRPC DTO
- Parameters
obj – the object to instantiate from
- Returns
the instantiated object
- static from_json_file(json_file_path: str) csle_collector.client_manager.dao.spiking_arrival_config.SpikingArrivalConfig [source]
Reads a json file and converts it to a DTO
- Parameters
json_file_path – the json file path
- Returns
the converted DTO
csle_collector.client_manager.dao.workflow_markov_chain module
- class csle_collector.client_manager.dao.workflow_markov_chain.WorkflowMarkovChain(transition_matrix: List[List[float]], initial_state: int, id: int)[source]
Bases:
csle_base.json_serializable.JSONSerializable
,csle_base.grpc_serializable.GRPCSerializable
A Markov chain representation of a workflow.
- copy() csle_collector.client_manager.dao.workflow_markov_chain.WorkflowMarkovChain [source]
- Returns
a copy of the DTO
- static from_dict(d: Dict[str, Any]) csle_collector.client_manager.dao.workflow_markov_chain.WorkflowMarkovChain [source]
Converts a dict representation to an instance
- Parameters
d – the dict to convert
- Returns
the created instance
- static from_grpc_object(obj: client_manager_pb2.WorkflowMarkovChainDTO) csle_collector.client_manager.dao.workflow_markov_chain.WorkflowMarkovChain [source]
Instantiates the object from a GRPC DTO
- Parameters
obj – the object to instantiate from
- Returns
the instantiated object
- static from_json_file(json_file_path: str) csle_collector.client_manager.dao.workflow_markov_chain.WorkflowMarkovChain [source]
Reads a json file and converts it to a DTO
- Parameters
json_file_path – the json file path
- Returns
the converted DTO
- static markov_next_state(row: List[float]) int [source]
Samples the next state of the Markov chain
- Parameters
row – a numpy array of probabilities that sum up to 1.
- Returns
an integer from 0 to len(row)-1.
- step_forward() int [source]
Move t forward by one and possibly transition to a new state. Returns the new state.
csle_collector.client_manager.dao.workflow_service module
- class csle_collector.client_manager.dao.workflow_service.WorkflowService(ips_and_commands: List[Tuple[str, List[str]]], id: int)[source]
Bases:
csle_base.json_serializable.JSONSerializable
,csle_base.grpc_serializable.GRPCSerializable
A service of the network. The service might be distributed across several network nodes. The service is defined by the series of commands that a client executes to make use of the service.
- copy() csle_collector.client_manager.dao.workflow_service.WorkflowService [source]
- Returns
a copy of the DTO
- create_execution_config(ip_first_octet: int) csle_collector.client_manager.dao.workflow_service.WorkflowService [source]
Creates a new config for an execution
- Parameters
ip_first_octet – the first octet of the IP of the new execution
- Returns
the new config
- static from_dict(d: Dict[str, Any]) csle_collector.client_manager.dao.workflow_service.WorkflowService [source]
Converts a dict representation to an instance
- Parameters
d – the dict to convert
- Returns
the created instance
- static from_grpc_object(obj: client_manager_pb2.WorkflowServiceDTO) csle_collector.client_manager.dao.workflow_service.WorkflowService [source]
Instantiates the object from a GRPC DTO
- Parameters
obj – the object to instantiate from
- Returns
the instantiated object
- static from_json_file(json_file_path: str) csle_collector.client_manager.dao.workflow_service.WorkflowService [source]
Reads a json file and converts it to a DTO
- Parameters
json_file_path – the json file path
- Returns
the converted DTO
- static replace_first_octet_of_ip(ip: str, ip_first_octet: int) str [source]
Utility function for changing the first octet in an IP address
- Parameters
ip – the IP to modify
ip_first_octet – the first octet to insert
- Returns
the new IP
csle_collector.client_manager.dao.workflows_config module
- class csle_collector.client_manager.dao.workflows_config.WorkflowsConfig(workflow_markov_chains: List[csle_collector.client_manager.dao.workflow_markov_chain.WorkflowMarkovChain], workflow_services: List[csle_collector.client_manager.dao.workflow_service.WorkflowService])[source]
Bases:
csle_base.json_serializable.JSONSerializable
,csle_base.grpc_serializable.GRPCSerializable
Workflows configuration
- commands() List[str] [source]
Gets the list of all commands across all services
- Returns
the list of commands
- copy() csle_collector.client_manager.dao.workflows_config.WorkflowsConfig [source]
- Returns
a copy of the DTO
- create_execution_config(ip_first_octet: int) csle_collector.client_manager.dao.workflows_config.WorkflowsConfig [source]
Creates a new config for an execution
- Parameters
ip_first_octet – the first octet of the IP of the new execution
- Returns
the new config
- static from_dict(d: Dict[str, Any]) csle_collector.client_manager.dao.workflows_config.WorkflowsConfig [source]
Converts a dict representation to an instance
- Parameters
d – the dict to convert
- Returns
the created instance
- static from_grpc_object(obj: client_manager_pb2.WorkflowsConfigDTO) csle_collector.client_manager.dao.workflows_config.WorkflowsConfig [source]
Instantiates the object from a GRPC DTO
- Parameters
obj – the object to instantiate from
- Returns
the instantiated object
- static from_json_file(json_file_path: str) csle_collector.client_manager.dao.workflows_config.WorkflowsConfig [source]
Reads a json file and converts it to a DTO
- Parameters
json_file_path – the json file path
- Returns
the converted DTO
- get_workflow_mc(id: int) Optional[csle_collector.client_manager.dao.workflow_markov_chain.WorkflowMarkovChain] [source]
Gets the workflow Markov chain with a specific id
- Parameters
id – the id of the MC
- Returns
the MC or None
- get_workflow_service(id: int) Optional[csle_collector.client_manager.dao.workflow_service.WorkflowService] [source]
Gets the workflow service with a specific id
- Parameters
id – the id of the service
- Returns
the service or None