diff options
author | Thomas Mangin <thomas.mangin@exa.net.uk> | 2020-03-24 18:34:59 +0000 |
---|---|---|
committer | Thomas Mangin <thomas.mangin@exa.net.uk> | 2020-03-24 18:34:59 +0000 |
commit | 8ac524b6d12618d696fa883ff78ded8c35c26d05 (patch) | |
tree | a7fe1242c79cca0c3f6de8573a72092640f78118 /python/vyos/ifconfig | |
parent | 1a57edcb8e3052a70296808d394c3d166bcda275 (diff) | |
download | vyos-1x-8ac524b6d12618d696fa883ff78ded8c35c26d05.tar.gz vyos-1x-8ac524b6d12618d696fa883ff78ded8c35c26d05.zip |
ifconfig: T2057: convert STP to adapter
Diffstat (limited to 'python/vyos/ifconfig')
-rw-r--r-- | python/vyos/ifconfig/__init__.py | 1 | ||||
-rw-r--r-- | python/vyos/ifconfig/stp.py | 19 |
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 |