Skip to content
Permalink
Browse files

[OpenWrt] Allow overriding htmode option

  • Loading branch information
nemesisdesign committed Apr 1, 2016
1 parent 361ffe1 commit 45159e8a5e474fe81f5d7d8cf2b2fab65b1fa8a8
Showing with 28 additions and 0 deletions.
  1. +3 −0 netjsonconfig/backends/openwrt/renderers.py
  2. +25 −0 tests/openwrt/test_wireless.py
@@ -298,6 +298,9 @@ def __get_htmode(self, radio):
"""
only for mac80211 driver
"""
# allow overriding htmode
if 'htmode' in radio:
return radio['htmode']
if radio['protocol'] == '802.11n':
return 'HT{0}'.format(radio['channel_width'])
elif radio['protocol'] == '802.11ac':
@@ -1441,5 +1441,30 @@ def test_macaddr_override(self):
option mode 'ap'
option network 'wlan0'
option ssid 'open'
""")
self.assertEqual(o.render(), expected)

def test_htmode_override(self):
o = OpenWrt({
"radios": [
{
"name": "radio0",
"phy": "phy0",
"driver": "mac80211",
"protocol": "802.11n",
"channel": 140,
"channel_width": 40,
"htmode": "HT40+"
},
]
})
expected = self._tabs("""package wireless
config wifi-device 'radio0'
option channel '140'
option htmode 'HT40+'
option hwmode '11a'
option phy 'phy0'
option type 'mac80211'
""")
self.assertEqual(o.render(), expected)

0 comments on commit 45159e8

Please sign in to comment.
You can’t perform that action at this time.