diff options
Diffstat (limited to 'python/vyos/ifconfig/stp.py')
-rw-r--r-- | python/vyos/ifconfig/stp.py | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/python/vyos/ifconfig/stp.py b/python/vyos/ifconfig/stp.py index 741322d0d..97a3c1ff3 100644 --- a/python/vyos/ifconfig/stp.py +++ b/python/vyos/ifconfig/stp.py @@ -19,12 +19,20 @@ from vyos.ifconfig.interface import Interface from vyos.validate import * -class STPIf(Interface): +class STP: """ A spanning-tree capable interface. This applies only to bridge port member interfaces! """ - _sysfs_set = {**Interface._sysfs_set, **{ + + @classmethod + def enable (cls, adaptee): + adaptee._sysfs_set = {**adaptee._sysfs_set, **cls._sysfs_set} + adaptee.set_path_cost = cls.set_path_cost + adaptee.set_path_priority = cls.set_path_priority + return adaptee + + _sysfs_set = { 'path_cost': { # XXX: we should set a maximum 'validate': assert_positive, @@ -37,15 +45,8 @@ class STPIf(Interface): 'location': '/sys/class/net/{ifname}/brport/priority', 'errormsg': '{ifname} is not a bridge port member' }, - }} - - default = { - 'type': 'stp', } - def __init__(self, ifname, **kargs): - super().__init__(ifname, **kargs) - def set_path_cost(self, cost): """ Set interface path cost, only relevant for STP enabled interfaces |