Component Manager
This class provides auxiliary methods that facilitate object manipulation.
Source code in edge_sim_py/component_manager.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
__repr__()
Defines how the object is represented inside the console.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Object representation. |
Source code in edge_sim_py/component_manager.py
26 27 28 29 30 31 32 |
|
__str__()
Defines how the object is represented inside print statements.
Returns:
Name | Type | Description |
---|---|---|
obj |
str
|
Object representation |
Source code in edge_sim_py/component_manager.py
18 19 20 21 22 23 24 |
|
all()
classmethod
Returns the list of created objects of a given class.
Returns:
Name | Type | Description |
---|---|---|
list |
list
|
List of objects from a given class. |
Source code in edge_sim_py/component_manager.py
106 107 108 109 110 111 112 113 |
|
count()
classmethod
Returns the number of instances from a given class.
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Number of instances from a given class. |
Source code in edge_sim_py/component_manager.py
136 137 138 139 140 141 142 143 |
|
export_scenario(ignore_list=['Simulator', 'Topology', 'NetworkFlow'], save_to_file=False, file_name='dataset')
classmethod
Exports metadata about the simulation model to a Python dictionary. If the "save_to_file" attribute is set to True, the external dataset file generated is saved inside the "datasets/" directory by default.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ignore_list |
list
|
List of entities that will not be included in the output dict. Defaults to ["Simulator", "Topology", "NetworkFlow"]. |
['Simulator', 'Topology', 'NetworkFlow']
|
save_to_file |
bool
|
Attribute that tells the method if it needs to save the scenario to an external file. Defaults to False. |
False
|
file_name |
str
|
Output file name. Defaults to "dataset". |
'dataset'
|
Returns:
Name | Type | Description |
---|---|---|
scenario |
dict
|
Python dictionary representing the simulation model. |
Source code in edge_sim_py/component_manager.py
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
|
find_by(attribute_name, attribute_value)
classmethod
Finds objects from a given class based on an user-specified attribute.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
attribute_name |
str
|
Attribute name. |
required |
attribute_value |
object
|
Attribute value. |
required |
Returns:
Name | Type | Description |
---|---|---|
object |
object
|
Class object. |
Source code in edge_sim_py/component_manager.py
79 80 81 82 83 84 85 86 87 88 89 90 91 |
|
find_by_id(obj_id)
classmethod
Finds a class object based on its ID attribute.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj_id |
int
|
Object ID. |
required |
Returns:
Name | Type | Description |
---|---|---|
class_object |
object
|
Class object found. |
Source code in edge_sim_py/component_manager.py
93 94 95 96 97 98 99 100 101 102 103 104 |
|
first()
classmethod
Returns the first object within the list of instances from a given class.
Returns:
Name | Type | Description |
---|---|---|
object |
object
|
Class object. |
Source code in edge_sim_py/component_manager.py
115 116 117 118 119 120 121 122 123 124 125 |
|
last()
classmethod
Returns the last object within the list of instances from a given class.
Returns:
Name | Type | Description |
---|---|---|
object |
object
|
Class object. |
Source code in edge_sim_py/component_manager.py
127 128 129 130 131 132 133 134 |
|
remove(obj)
classmethod
Removes an object from the list of instances of a given class.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
obj |
object
|
Object to be removed. |
required |
Source code in edge_sim_py/component_manager.py
145 146 147 148 149 150 151 152 153 154 155 |
|