perfsim.scenario#
Module contents#
Submodules#
perfsim.scenario.affinity_scenario module#
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#
perfsim.scenario.scaling_scenario module#
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
- static from_config(conf)[source]#
Create a dictionary of simulation scenarios from a configuration dictionary.
- Parameters:
conf (
Dict
)- Return type:
dict
[str
,SimulationScenario
]- Returns:
-
name:
perfsim.scenario.simulation_scenario_manager module#
- 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:
simulation_scenarios (
Union
[List
[SimulationScenario
],Dict
[str
,SimulationScenario
]])service_chains (
Union
[List
[ServiceChain
],Dict
[str
,ServiceChain
]])topology_prototypes (
Union
[List
[TopologyPrototype
],Dict
[str
,TopologyPrototype
]])placement_algorithms (
Union
[List
[PlacementAlgorithm
],Dict
[str
,PlacementAlgorithm
]])res_alloc_scenarios (
Union
[List
[ResourceAllocationScenario
],Dict
[str
,ResourceAllocationScenario
]])affinity_prototypes (
Union
[List
[AffinityPrototype
],Dict
[str
,AffinityPrototype
]])traffic_prototypes (
Union
[List
[TrafficPrototype
],Dict
[str
,TrafficPrototype
]])results_storage_driver (
ResultsStorageDriver
)
-
microservice_prototypes_dict:
dict
[str
,MicroservicePrototype
]#
-
host_prototypes_dict:
dict
[str
,HostPrototype
]#
-
router_prototypes_dict:
dict
[str
,RouterPrototype
]#
-
link_prototypes_dict:
dict
[str
,TopologyLinkPrototype
]#
-
topology_equipments_dict:
dict
[str
,TopologyEquipmentSet
]#
-
placement_scenarios_dict:
dict
[str
,PlacementScenario
]#
- 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:
subj (
Any
)key (
str
)attr (
str
)attr_key (
Optional
[str
])conf (
Dict
)sm (
Optional
[SimulationScenarioManager
])
- classmethod from_config(conf=None, existing_scenario_manager=None)[source]#
- Parameters:
conf (
Dict
)existing_scenario_manager (
SimulationScenarioManager
)
-
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_scaling_scenarios(scaling_scenarios)[source]#
- Parameters:
scaling_scenarios (
List
[ScalingScenario
])
- validate_affinity_scenarios(affinity_scenarios)[source]#
- Parameters:
affinity_scenarios (
List
[AffinityScenario
])