Skip to content

nokia/twampy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

25 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

twampy

Python implementation of TWAMP/TWAMP-light (RFC 5357) and STAMP (RFC 8762)

twampy is a network measurement tool for latency, jitter, and packet loss testing. Originally developed to validate Nokia SR OS and SR Linux TWAMP implementations, it provides a standards-compliant implementation of the Two-Way Active Measurement Protocol and Simple Two-Way Active Measurement Protocol.

Features

  • Multiple Operation Modes - Controller, Control Client, Session Sender, Reflector
  • Dual Stack - IPv4 and IPv6 support
  • QoS Testing - DSCP/TOS marking for quality of service validation
  • Flexible Sizing - Custom padding, jumbo frames, IMIX traffic patterns
  • RFC Compliant - Implements RFC 5357 (TWAMP), RFC 8762 (STAMP), RFC 8972 (STAMP Extensions)
  • No Dependencies - Uses Python standard library only

Quick Start

Installation

# Clone and install
git clone https://github.com/nokia/twampy
cd twampy
pip install -e .

Basic Usage

# Start a reflector
twampy responder :862

# Run a test (from another terminal/host)
twampy controller 192.168.1.100

Example output:

===============================================================================
Direction         Min         Max         Avg          Jitter     Loss
-------------------------------------------------------------------------------
  Outbound:       92.89ms    196.63ms     95.15ms       576us      0.0%
  Inbound:            0us         0us         0us         0us      0.0%
  Roundtrip:        339us    103.53ms      1.91ms       638us      0.0%
-------------------------------------------------------------------------------
                                                    Jitter Algorithm [RFC1889]
===============================================================================

Command Overview

Command Description
controller Full TWAMP controller (control + sender)
sender TWAMP light session sender
responder TWAMP light reflector
controlclient TWAMP control client only
dscptable Display DSCP/QoS reference table

Common Options

# Send 1000 packets at 10ms intervals with DSCP EF marking
twampy sender 192.168.1.100 --count 1000 --interval 10 --dscp ef

# Run controller with verbose logging
twampy controller 192.168.1.100 --verbose

# Start reflector on custom port
twampy responder :20000

Requirements

  • Python 3.11 or higher (tested with 3.11 and 3.14)
  • No external dependencies (standard library only)

Documentation

📚 Full Documentation (or see docs/)

Platform Support

Platform Status Notes
Linux ✅ Full All features supported
Windows ✅ Full Requires registry mod for DSCP
macOS ⚠️ Partial DF flag not supported
FreeBSD ⚠️ Partial DF flag not supported

Limitations

  • Software timestamping only (typical accuracy: 100μs - 2ms)
  • Unauthenticated mode only (no encryption/authentication)

License

This project is licensed under the BSD-3-Clause license - see the LICENSE.

twampy can be imported and used in Python programs:

import twampy

# Your code here (API documentation coming soon)

Contributing

Contributions are welcome! Please feel free to submit issues or pull requests.

License

Licensed under the BSD-3-Clause License. See LICENSE for details.

Author

Sven Wisotzky - Nokia

References

About

Python tools for TWAMP and STAMP (TWAMP/light)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •  

Languages