summaryrefslogtreecommitdiff
path: root/python/vyos/ifconfig/stp.py
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-03-25 09:57:21 +0100
committerGitHub <noreply@github.com>2020-03-25 09:57:21 +0100
commit6e7739e0b69e1d3371ebe36218604cbb1aca18b1 (patch)
treec745b79a378c75e928931073bfddbf8cc76ca730 /python/vyos/ifconfig/stp.py
parent7c4d21639d9594ba4a0d96a5d6d90f25189c2817 (diff)
parentbbea850ea5f8ff0402cd276ab63963ece7e0c763 (diff)
downloadvyos-1x-6e7739e0b69e1d3371ebe36218604cbb1aca18b1.tar.gz
vyos-1x-6e7739e0b69e1d3371ebe36218604cbb1aca18b1.zip
Merge pull request #265 from thomas-mangin/2057-dhcp-vlan
ifconfig: T2057: break down DHCP, add register, STP and VLAN as adapters
Diffstat (limited to 'python/vyos/ifconfig/stp.py')
-rw-r--r--python/vyos/ifconfig/stp.py19
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