Skip to content

nsg-ethz/NetPowerBench

Repository files navigation

NetPowerBench

The P4 code and the configuration files described in Jackie Lim's thesis, Power Modelling Framework for Network Switches [2] are available in the /archive directory.

NetPowerBench is a tool for generating a power model of a routing device. It is intended to be used in a lab setup.

The motivation behind the creation of the tool as well as a detailed description of the powermodel it generates is described in [1].

The workflow is separated into:

  • Configuring the device and running the measurements
  • Processing the data and deriving the model

These two steps are separated programs and are descirbed more in detail in the respective directories.

Environment and Prerequisites

Hardware

The tool needs the following componends:

  • Device under testing (DUT): A L2 or L3 routing device with at least 4 ports, ideally more
  • A powermeter. It needs to support the pinpoint submodule. The one we used is linked here
  • A workstation that is running the experiment. It need have two ports to send and receive traffic to the DUT and need to be able to generate the traffic volume that the user wants to test. Furthermore it needs a Serial connection to the DUT and a connection to the powermeter.

Software

In order to run the experiments, we used the following software environment:

  • Python: 3.10.12
  • IDE: Visual Studio Code
  • OS: Ubuntu 22.04

There is a requirements.txt available.

Repository structure

.
├── archive
│   └── ...
├── command
│   └── ...
├── data  # Will be created by the code
│   └── ...
├── devices
│   └── ...
├── legacy
│   └── ...
├── model_derivation
│   └── ...
├── power_measure
│   └── ...
├── traffic_gen
│   └── ...
├── README.md
└── requirements.txt

Directories

archive

The P4 code and the configuration of the Cisco devices used in [2] are available in \archive\configs_PowerModellingFrameworkforNetworkSwitches.

command

This directory contains the script that will execute pinpoint, the software used to conduct the measurements with the powermeter. Pinpoint is a submodule of this repository.

data

This directory will contain the raw data and metadata from the measurements.

log/ contains pinpoint.log, which is the log of the last measurements and is there for debugging reasons.

For each device tested there will be a subdirectory with the device identifier as name. In there there will be directories with names following one of these formats:

  • base
  • idle
  • port_<port_type>_<transceiver_type>_<port_speed>_<number_of_active_ports>p
  • trx_<port_type>_<transceiver_type>_<port_speed>_<number_of_active_ports>p
  • snake-test_<port_type>_<transceiver_type>_<port_speed>_<packet_size>_<bandwidth>

Note that each of these directories refers to a test type and the relevant parameters for this test. As base and idle are indepentend of the port type etc, they don't contain that information in the directory name.

Inside the respective subdirectory there will be a subdirectory for each measurements run with this configuration with the timestamp of the measurement as directory name. This directory contains:

  • metadata.yml: The metadata of the measurement
  • power.log: The acutal measurement data

A possible layout of data could look like this:

├── data
│   ├── log
│   │   └── pinpoint.log
│   └── ciscoNexus9336-FX2
│           └── snake-test_QSFP28_LR_100G_256B_2.5Gbps
│               ├── 2025-05-15_16:20:45
│               │   ├── metadata.yml
│               │   └── power.log

For further details on the test types and measurement procedure, please refer to the documentation in power_measure/.

devices

For each DUT there needs to be a subdirectory in devices/ with the device identifier as directory. That folder needs to contain the configuration files of that device. There are templates available. The processed data from the measurements and the parameter values of the power model will be stored there as well.

For further details please refer to the documentation in devices/.

legacy

This directory contains an older version of this code and is here for reference. It is not expected to be usable.

model_derivation

This directory contains the code to process the raw measurement data and derive the power model values.

power_measure

This directory contains the code to run the measurements needed for the model derivation.

test_config

This directory contains code intended to help with finding the right configuration commands for the tests.

traffic_gen

This directory contains all the files necessary for the traffic generation including the code, the configuration file and a setup script.

Usage specification

In order to get a power model for a device, the following steps are advised:

  • Clone the submodule pinpoint with git submodule init and git submodule update
  • Compile the pinpoint binary (location needed in config.yml)
  • Prepare the following files with the device specific information (details are in devices/):
    • devices/<device identifier>/config.yml
    • devices/<device identifier>/ports.yml
  • Follow the intructions in power_measure/ in order to set up and run the measurements on the device
  • Follow the instructions in model_derivation/ in order to derive a power model

Known issues

  • Sometimes the pinpoint software recognizes counters that are not from the powermeter and will also be present when it is unplugged. Our way of solving this is making the counters used a parameter in config.yml. In case of the pinpoint script getting stuck, we advise the user to verify that the counters used are the ones the powermeter writes to and adapt config.yml accordingly.
  • The traffic generation needs sudo rights in order to be executed properly. As this is not really resolvable for us, our workaround was to disable the necessity of a password for executing sudo commands.
  • Currently for many scrips there are dependencies on from where they are executed. This might be changed in the future but for now, in order to have everything properly executed, please run a script only from the directory it is in.

References

  1. Jacob, R., Röllin, L., Lim, J., Chung, J., Béhanzin, M., Wang, W., ... & Vanbever, L. (2025). Fantastic Joules and Where to Find Them. Modeling and Optimizing Router Energy Demand. In ACM Internet Measurement Conference (IMC 2025).

  2. Lim, J. (2024). Power Modelling Framework for Network Switches. Master's thesis, ETH Zurich.

  3. Ostinato Team. (2024, June 27). Snake Test for networking performance testing. Retrieved June 18, 2025

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •