Skip to content

tgagneret/python_tc_qos

 
 

Repository files navigation

QoS with TC and Python

When you are setting a QoS with TC with a shellscript, the syntax is not easy to read. This tool tries to give a better way to interact with TC.

Dependencies

  • python 2.7 or 3.4 (it certainly works with prior versions, just not tested)

Configuration

Copy the default configuration file config.py.default as config.py. Please do not modify or remove config.py.default if you cloned this repository. Always do your modifications in config.py. Then modify config.py for your setup (documentation is inside).

Usage

QoS rules are is the rules folder. It doesn't exist from scratch, but you can copy the rules.example as rules, where there are some examples corresponding to my actual setup.

The source file tools.py contains all the useful functions for rules, which are documented with docstrings. built_in_classes contains different classes you can inherit. Take a look to the examples to see how it works.

A function apply_rules() has been created in rules.example/__init__.py to apply all the rules once.

When your rules are created, just run qos.py :

python3 qos.py [-h] [-d] {start,stop,show} ...

Script to set, show or delete QoS rules with TC

positional arguments:
  {start,stop,show}
    start            set QoS rules
    stop             Remove all QoS rules
    show             Show QoS rules

optional arguments:
  -h, --help         show this help message and exit
  -d, --debug        Set the debug level

Readings about tc

License

Tool under the BSD license. Do not hesitate to report bugs, ask me some questions or do some pull request if you want to !

About

Set your QoS on Linux with tc and Python

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 100.0%