|
4 | 4 | from ...utils import get_copy |
5 | 5 | from ..base.converter import BaseConverter |
6 | 6 | 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, vlan, wireless |
| 7 | +from .interface import autonegotiation, bridge, bssid, flowcontrol, hidden_ssid, mode, protocol, radio, split_cidr, ssid, stp, vlan, wireless |
| 8 | +from .radio import radio_available_mode, radio_configuration |
8 | 9 | from .radius import radius_from_interface |
9 | 10 | from .schema import default_ntp_servers |
10 | | -from .radio import radio_device_base, radio_configuration |
11 | 11 | from .wpasupplicant import available_mode_authentication |
12 | 12 |
|
13 | 13 |
|
@@ -352,18 +352,24 @@ def to_intermediate(self): |
352 | 352 | class Radio(AirOsConverter): |
353 | 353 | netjson_key = 'radios' |
354 | 354 |
|
| 355 | + @property |
| 356 | + def radio(self): |
| 357 | + return get_copy(self.netjson, self.netjson_key, []) |
| 358 | + |
| 359 | + @property |
| 360 | + def wireless(self): |
| 361 | + return wireless(get_copy(self.netjson, 'interfaces', [])) |
| 362 | + |
355 | 363 | def to_intermediate(self): |
356 | 364 | result = [] |
357 | | - original = get_copy(self.netjson, self.netjson_key, []) |
358 | 365 | radios = [] |
359 | | - for r in original: |
360 | | - base = radio_device_base.copy() |
361 | | - user_configs = { |
362 | | - 'devname': r['name'], |
363 | | - 'txpower': r.get('tx_power', 24), |
364 | | - } |
365 | | - base.update(user_configs) |
366 | | - radios.append(base) |
| 366 | + wireless = {radio(w): w for w in self.wireless} |
| 367 | + for logic in self.radio: |
| 368 | + w = wireless.get(logic['name']) |
| 369 | + if w: |
| 370 | + user_config = radio_available_mode[mode(w)](logic) |
| 371 | + radios.append(user_config) |
| 372 | + |
367 | 373 | result.append(radios) |
368 | 374 | result.append(radio_configuration) |
369 | 375 | return (('radio', result),) |
|
0 commit comments