Add support for txqueuelen
This commit is contained in:
parent
549c548e7c
commit
0664442648
4 changed files with 12 additions and 3 deletions
8
mknet
8
mknet
|
@ -87,21 +87,23 @@ class Bandwidth:
|
||||||
|
|
||||||
|
|
||||||
class LinkInfo:
|
class LinkInfo:
|
||||||
def __init__(self, bandwidth, latency, jitter = None, offset = None, limit = None, **kwargs):
|
def __init__(self, bandwidth, latency, jitter = None, offset = None, limit = None, txqueuelen = None, **kwargs):
|
||||||
self.bandwidth = Bandwidth(bandwidth)
|
self.bandwidth = Bandwidth(bandwidth)
|
||||||
self.latency = Latency(latency, offset)
|
self.latency = Latency(latency, offset)
|
||||||
self.jitter = Latency(jitter or 0)
|
self.jitter = Latency(jitter or 0)
|
||||||
self.limit = limit
|
self.limit = limit
|
||||||
|
self.txqueuelen = txqueuelen
|
||||||
|
|
||||||
def __eq__(self, o):
|
def __eq__(self, o):
|
||||||
return (isinstance(o, LinkInfo) and
|
return (isinstance(o, LinkInfo) and
|
||||||
o.bandwidth == self.bandwidth and
|
o.bandwidth == self.bandwidth and
|
||||||
o.latency == self.latency and
|
o.latency == self.latency and
|
||||||
o.jitter == self.jitter and
|
o.jitter == self.jitter and
|
||||||
o.limit == self.limit)
|
o.limit == self.limit and
|
||||||
|
o.txqueuelen == self.txqueuelen)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'LinkInfo{{bw: {self.bandwidth}, latency: {self.latency}, jitter: {self.jitter}, limit: {self.limit}}}'
|
return f'LinkInfo{{bw: {self.bandwidth}, latency: {self.latency}, jitter: {self.jitter}, limit: {self.limit}, txqueuelen: {self.txqueuelen}}}'
|
||||||
|
|
||||||
class Server:
|
class Server:
|
||||||
def __init__(self, name, link):
|
def __init__(self, name, link):
|
||||||
|
|
3
net.py
3
net.py
|
@ -56,6 +56,9 @@ def create_veth(name1, ns1, name2, ns2, ip = None, subnet=0, link=None):
|
||||||
run_netns("exec", ns2, "ip", "link", "set", "dev", name2, "up")
|
run_netns("exec", ns2, "ip", "link", "set", "dev", name2, "up")
|
||||||
|
|
||||||
if link:
|
if link:
|
||||||
|
if link.txqueuelen:
|
||||||
|
run_netns("exec", ns1, "ip", "link", "set", "dev", name1, "txqueuelen", str(link.txqueuelen))
|
||||||
|
run_netns("exec", ns2, "ip", "link", "set", "dev", name2, "txqueuelen", str(link.txqueuelen))
|
||||||
tc(ns1, name1, link)
|
tc(ns1, name1, link)
|
||||||
tc(ns2, name2, link, True)
|
tc(ns2, name2, link, True)
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ links:
|
||||||
- &slow
|
- &slow
|
||||||
bandwidth: 1M
|
bandwidth: 1M
|
||||||
latency: 500us
|
latency: 500us
|
||||||
|
txqueuelen: 10
|
||||||
- &1000
|
- &1000
|
||||||
bandwidth: 1000M
|
bandwidth: 1000M
|
||||||
latency: 100us
|
latency: 100us
|
||||||
|
|
|
@ -5,16 +5,19 @@ links:
|
||||||
- &1000
|
- &1000
|
||||||
bandwidth: 1000M
|
bandwidth: 1000M
|
||||||
latency: 100us
|
latency: 100us
|
||||||
|
txqueuelen: 10000
|
||||||
- &vdsl
|
- &vdsl
|
||||||
bandwidth:
|
bandwidth:
|
||||||
up: 3M
|
up: 3M
|
||||||
down: 55M
|
down: 55M
|
||||||
latency: 50ms
|
latency: 50ms
|
||||||
jitter: 10ms
|
jitter: 10ms
|
||||||
|
txqueuelen: 100
|
||||||
- &fiber
|
- &fiber
|
||||||
bandwidth: 400M
|
bandwidth: 400M
|
||||||
latency: 10ms
|
latency: 10ms
|
||||||
jitter: 3ms
|
jitter: 3ms
|
||||||
|
txqueuelen: 1000
|
||||||
|
|
||||||
zones:
|
zones:
|
||||||
- &dc1
|
- &dc1
|
||||||
|
|
Loading…
Reference in a new issue