perfsim.scenario

Contents

perfsim.scenario#

Module contents#

Submodules#

perfsim.scenario.affinity_scenario module#

class perfsim.scenario.affinity_scenario.AffinityScenario[source]#

Bases: TypedDict

This class represents an affinity scenario.

microservice: Dict[str, affinity_ruleset]#

microservice is a dictionary of microservices in the affinity scenario

perfsim.scenario.placement_scenario module#

class perfsim.scenario.placement_scenario.PlacementScenario(name, algorithm, options=None)[source]#

Bases: object

This class represents a placement scenario.

Parameters:
  • name (str)

  • algorithm (Literal['least_fit', 'first_fit', 'first_fit_decreasing'])

  • options (dict)

algorithm: str#

The algorithm used for placement.

name: str#

The name of the placement scenario.

options: Dict#

The options for the placement scenario.

perfsim.scenario.resource_allocation_scenario module#

class perfsim.scenario.resource_allocation_scenario.ResourceAllocationScenario(name, cpu_requests=-1, cpu_limits=-1, memory_requests=0, ingress_bw='', egress_bw='', ingress_latency=0, egress_latency=0, blkio_capacity=0)[source]#

Bases: object

This class represents a resource allocation scenario.

Parameters:
  • name (str)

  • cpu_requests (int)

  • cpu_limits (int)

  • memory_requests (int)

  • ingress_bw (Union[int, str])

  • egress_bw (Union[int, str])

  • ingress_latency (float)

  • egress_latency (float)

  • blkio_capacity (int)

static copy_to_dict(res_alloc_scenarios)[source]#

Copy the resource allocation scenarios to a dictionary.

Parameters:

res_alloc_scenarios (Union[List[ResourceAllocationScenario], Dict[str, ResourceAllocationScenario]]) – The resource allocation scenarios to copy.

Return type:

Dict[str, ResourceAllocationScenario]

Returns:

The copied resource allocation scenarios.

static from_config(conf)[source]#

Create resource allocation scenarios from a configuration.

Parameters:

conf (dict) – The configuration in the form of a dictionary.

Return type:

Dict[str, ResourceAllocationScenario]

Returns:

The resource allocation scenarios.

perfsim.scenario.results_storage_driver_dict module#

class perfsim.scenario.results_storage_driver_dict.ResultsStorageDriverDict[source]#

Bases: TypedDict

driver_class: str#
classpath: str#

The classpath of the driver class for dynamic loading

params: dict[str, Any]#

perfsim.scenario.scaling_scenario module#

class perfsim.scenario.scaling_scenario.ScalingScenario[source]#

Bases: TypedDict

microservice: dict[str, ScalingSettingScenario]#

perfsim.scenario.simulation_scenario module#

class perfsim.scenario.simulation_scenario.SimulationScenario[source]#

Bases: TypedDict

This class represents a simulation scenario.

name: str#

name is the name of the simulation scenario

traffic_scenario: TrafficScenario#

traffic_scenario is the traffic scenario of the simulation scenario

scaling_scenarios: List[ScalingScenario]#

scaling_scenarios is the scaling scenario of the simulation scenario

affinity_scenarios: List[AffinityScenario]#

affinity_scenarios is the affinity scenario of the simulation scenario

placement_algorithm: str#

placement_algorithm is the placement algorithm of the simulation scenario

topology: str#

topology is the topology of the simulation scenario

network_timeout: int#

network_timeout is the network timeout of the simulation scenario

debug: DebugDict#

The debug configuration of the simulation scenario.

static from_config(conf)[source]#

Create a dictionary of simulation scenarios from a configuration dictionary.

Parameters:

conf (Dict)

Return type:

dict[str, SimulationScenario]

Returns:

perfsim.scenario.simulation_scenario_manager module#

class perfsim.scenario.simulation_scenario_manager.TopologyEquipmentSet[source]#

Bases: TypedDict

hosts: Dict[str, Host]#
routers: Dict[str, Router]#
class perfsim.scenario.simulation_scenario_manager.SimulationScenarioManager(simulation_scenarios, service_chains, topology_prototypes, placement_algorithms, res_alloc_scenarios, affinity_prototypes, traffic_prototypes, results_storage_driver)[source]#

Bases: object

This class represents a simulation scenario manager. It is responsible for managing simulation scenarios.

Parameters:
microservice_prototypes_dict: dict[str, MicroservicePrototype]#
host_prototypes_dict: dict[str, HostPrototype]#
router_prototypes_dict: dict[str, RouterPrototype]#
topology_equipments_dict: dict[str, TopologyEquipmentSet]#
placement_scenarios_dict: dict[str, PlacementScenario]#
classmethod from_config_file(config_file_path=None)[source]#
Parameters:

config_file_path (str)

static get_obj(subj, key, attr, attr_key, conf, sm, **other)[source]#

This method first checks if the provided key is exists in the provided configuration dictionary. If it is, it returns the result of from_config method of the provided class (subj). If not, it checks if an existing SimulationScenarioManager is provided (e.g., if the scenario manager is already initialized). If it is, it returns the requested attribute (attr_key) of the provided SimulationScenarioManager (sm). If not, it raises a ValueError exception.

The benefit of this method is that it allows to use the same configuration file and/or an existing SimulationScenarioManager to initialize a new SimulationScenarioManager.

Parameters:
classmethod from_config(conf=None, existing_scenario_manager=None)[source]#
Parameters:
res_alloc_scenarios_dict: dict[str, ResourceAllocationScenario]#
affinity_prototypes_dict: dict[str, AffinityPrototype]#
service_chains_dict: dict[str, ServiceChain]#
microservices_dict: dict[str, Microservice]#
topologies_prototype_dict: dict[str, TopologyPrototype]#
placement_algorithms_dict: dict[str, PlacementAlgorithm]#
traffic_prototypes_dict: dict[str, TrafficPrototype]#
simulation_scenarios_dict: dict[str, SimulationScenario]#
results_storage_driver: ResultsStorageDriver#
simulations_dict: dict[str, Simulation]#
validate_simulation_scenarios()[source]#
validate_traffic_prototype(traffic_prototype)[source]#
Parameters:

traffic_prototype (str)

validate_service_chain(service_chain)[source]#
Parameters:

service_chain (str)

validate_scaling_scenarios(scaling_scenarios)[source]#
Parameters:

scaling_scenarios (List[ScalingScenario])

validate_affinity_scenarios(affinity_scenarios)[source]#
Parameters:

affinity_scenarios (List[AffinityScenario])

validate_placement_algorithms(placement_algorithm)[source]#
Parameters:

placement_algorithm (str)

validate_topology(topology)[source]#
Parameters:

topology (str)

get_all_latencies()[source]#
Return type:

SimulationScenarioManagerResultDict

save_all()[source]#

perfsim.scenario.simulation_scenario_manager_result_dict module#

class perfsim.scenario.simulation_scenario_manager_result_dict.SimulationScenarioManagerResultDict[source]#

Bases: TypedDict

simulation_scenarios: Dict[str, SimulationScenarioResultDict]#

perfsim.scenario.simulation_scenario_result_dict module#

class perfsim.scenario.simulation_scenario_result_dict.SimulationScenarioResultDict[source]#

Bases: TypedDict

service_chains: Dict[str, ServiceChainResultDict]#

perfsim.scenario.traffic_scenario module#

class perfsim.scenario.traffic_scenario.TrafficScenario[source]#

Bases: TypedDict

name: str#
service_chains: Dict[str, traffic_type]#