summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig/__init__.py1
-rw-r--r--python/vyos/ifconfig/stp.py19
2 files changed, 10 insertions, 10 deletions
diff --git a/python/vyos/ifconfig/__init__.py b/python/vyos/ifconfig/__init__.py
index d6584215b..d08a8b528 100644
--- a/python/vyos/ifconfig/__init__.py
+++ b/python/vyos/ifconfig/__init__.py
@@ -23,7 +23,6 @@ from vyos.ifconfig.ethernet import EthernetIf
from vyos.ifconfig.geneve import GeneveIf
from vyos.ifconfig.loopback import LoopbackIf
from vyos.ifconfig.macvlan import MACVLANIf
-from vyos.ifconfig.stp import STPIf
from vyos.ifconfig.vxlan import VXLANIf
from vyos.ifconfig.wireguard import WireGuardIf
from vyos.ifconfig.vtun import VTunIf
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