Skip to content

Conterato

Contains a network switch power model definition.

ConteratoNetworkPowerModel

Network switch power model proposed in [1], which considers the switch's chassis and its ports' bandwidth.

[1] Conterato, Marcelo da Silva, et al. "Reducing energy consumption in SDN-based data center networks through flow consolidation strategies." ACM/SIGAPP Symposium on Applied Computing. 2019.

Source code in edge_sim_py/components/power_models/network/conterato_network_power_model.py
 4
 5
 6
 7
 8
 9
10
11
12
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
class ConteratoNetworkPowerModel:
    """Network switch power model proposed in [1], which considers the switch's chassis and its ports' bandwidth.

    [1] Conterato, Marcelo da Silva, et al. "Reducing energy consumption in SDN-based data center
    networks through flow consolidation strategies." ACM/SIGAPP Symposium on Applied Computing. 2019.
    """

    @classmethod
    def get_power_consumption(cls, device: object) -> float:
        """Gets the power consumption of a network switch.
        Args:
            device (object): Network switch whose power consumption will be computed.

        Returns:
            power_consumption (float): Network switch's power consumption.
        """
        # Calculating the power consumption of switch ports
        ports_power_consumption = 0
        for link in device.model.topology.edges(data=True, nbunch=device):
            port = link[2]
            if port.active:
                has_power_model_parameters = "ports_power_consumption" in device.power_model_parameters
                knows_port_power_consumption = f"{port.bandwidth}" in device.power_model_parameters["ports_power_consumption"]
                if has_power_model_parameters and knows_port_power_consumption:
                    ports_power_consumption += device.power_model_parameters["ports_power_consumption"][f"{port.bandwidth}"]
                else:
                    ports_power_consumption = None
                    break

        # Calculating the switch's power consumption
        if ports_power_consumption != None and "chassis_power" in device.power_model_parameters:
            power_consumption = device.power_model_parameters["chassis_power"] + ports_power_consumption
        else:
            power_consumption = None

        return power_consumption

get_power_consumption(device) classmethod

Gets the power consumption of a network switch.

Parameters:

Name Type Description Default
device object

Network switch whose power consumption will be computed.

required

Returns:

Name Type Description
power_consumption float

Network switch's power consumption.

Source code in edge_sim_py/components/power_models/network/conterato_network_power_model.py
11
12
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
@classmethod
def get_power_consumption(cls, device: object) -> float:
    """Gets the power consumption of a network switch.
    Args:
        device (object): Network switch whose power consumption will be computed.

    Returns:
        power_consumption (float): Network switch's power consumption.
    """
    # Calculating the power consumption of switch ports
    ports_power_consumption = 0
    for link in device.model.topology.edges(data=True, nbunch=device):
        port = link[2]
        if port.active:
            has_power_model_parameters = "ports_power_consumption" in device.power_model_parameters
            knows_port_power_consumption = f"{port.bandwidth}" in device.power_model_parameters["ports_power_consumption"]
            if has_power_model_parameters and knows_port_power_consumption:
                ports_power_consumption += device.power_model_parameters["ports_power_consumption"][f"{port.bandwidth}"]
            else:
                ports_power_consumption = None
                break

    # Calculating the switch's power consumption
    if ports_power_consumption != None and "chassis_power" in device.power_model_parameters:
        power_consumption = device.power_model_parameters["chassis_power"] + ports_power_consumption
    else:
        power_consumption = None

    return power_consumption