Skip to content

Commit c81760c

Browse files
committed
[airos] moved stp status function to interface module
1 parent 1585d8c commit c81760c

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

netjsonconfig/backends/airos/converters.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from ...utils import get_copy
55
from ..base.converter import BaseConverter
66
from .aaa import bridge_devname, profile_from_interface, status_from_interface
7-
from .interface import autonegotiation, bridge, bssid, flowcontrol, hidden_ssid, protocol, radio, split_cidr, ssid, stp, wireless
7+
from .interface import autonegotiation, bridge, bssid, flowcontrol, hidden_ssid, protocol, radio, split_cidr, ssid, stp, vlan, wireless
88
from .radius import radius_from_interface
99
from .schema import default_ntp_servers
1010
from .radio import radio_device_base, radio_configuration
@@ -80,11 +80,6 @@ def to_intermediate(self):
8080
class Bridge(AirOsConverter):
8181
netjson_key = 'interfaces'
8282

83-
def stp_status(self, interface):
84-
if interface.get('stp', False):
85-
return 'enabled'
86-
else:
87-
return 'disabled'
8883

8984
def to_intermediate(self):
9085
result = []
@@ -104,7 +99,7 @@ def to_intermediate(self):
10499
'devname': interface['name'],
105100
'port': bridge_ports,
106101
'status': status(interface),
107-
'stp': {'status': self.stp_status(interface)}
102+
'stp': {'status': stp(interface)}
108103
})
109104

110105
result.append(bridges)

netjsonconfig/backends/airos/interface.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,16 @@ def ssid(interface):
9696
return interface['wireless']['ssid']
9797

9898

99+
def stp(interface):
100+
"""
101+
Return wether the spanning tree protocol is enabled
102+
"""
103+
if interface.get('stp', False):
104+
return 'enabled'
105+
else:
106+
return 'disabled'
107+
108+
99109
def vlan(interfaces):
100110
"""
101111
Return the vlan interfaces from the interfaces list

0 commit comments

Comments
 (0)