aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--rumba/model.py15
1 files changed, 13 insertions, 2 deletions
diff --git a/rumba/model.py b/rumba/model.py
index b6cb15e..6d0af58 100644
--- a/rumba/model.py
+++ b/rumba/model.py
@@ -161,7 +161,7 @@ class ShimEthDIF(DIF):
def __init__(self, name, members=None, link_quality=None):
DIF.__init__(self, name, members)
- self._link_quality = link_quality
+ self._link_quality = link_quality if link_quality is not None else LinkQuality()
def get_ipcp_class(self):
return ShimEthIPCP
@@ -325,13 +325,22 @@ class LinkQuality(object):
"""
Link quality configuration
:param delay: Delay object holding delay configuration
- :param loss: Loss object holding delay configuration
+ or number corresponding to delay in ms
+ :type delay: :py:class:`.Delay` or :py:class:`int`
+ :param loss: Loss object holding delay configuration or
+ number corresponding to loss percentage
+ :type loss: :py:class:`.Loss` or :py:class:`float`
:param rate: The rate of the link in mbit
+ :type rate: :py:class:`int`
"""
if rate and not rate > 0:
raise ValueError("Rate needs to be higher than 0")
+ if isinstance(delay, int):
+ delay = Delay(delay)
+ if isinstance(loss, int) or isinstance(loss, float):
+ loss = Loss(loss)
self._delay = delay
self._loss = loss
self._rate = rate
@@ -383,6 +392,8 @@ class LinkQuality(object):
def deactivate(self, shim):
for ipcp in shim.ipcps:
+ if ipcp not in LinkQuality._active:
+ continue
if not ipcp.ifname:
logger.error("Could not remove LinkQuality from IPCP because "
"the interface name is None")