Skip to content

Commit

Permalink
[schema] Added "wds" property & removed wds mode #41
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Mar 21, 2016
1 parent 32518e6 commit ec15a67
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 8 deletions.
1 change: 0 additions & 1 deletion netjsonconfig/backends/openwrt/renderers.py
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ def _get_wifi_interfaces(self):
'access_point': 'ap',
'station': 'sta',
'adhoc': 'adhoc',
'wds': 'wds',
'monitor': 'monitor',
'802.11s': 'mesh'
}
Expand Down
20 changes: 13 additions & 7 deletions netjsonconfig/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -241,43 +241,49 @@
"access_point",
"station",
"adhoc",
"wds",
"monitor",
"802.11s"
],
"propertyOrder": 2,
},
"wds": {
"title": "WDS",
"type": "boolean",
"default": False,
"format": "checkbox",
"propertyOrder": 3,
},
"ssid": {
"type": "string",
"maxLength": 32,
"propertyOrder": 3,
"propertyOrder": 4,
},
"bssid": {
"type": "string",
"propertyOrder": 4,
"propertyOrder": 5,
},
"hidden": {
"type": "boolean",
"default": False,
"format": "checkbox",
"propertyOrder": 5,
"propertyOrder": 6,
},
"ack_distance": {
"type": "integer",
"minimum": 1,
"propertyOrder": 6,
"propertyOrder": 7,
},
"rts_threshold": {
"type": "integer",
"minimum": 0,
"maximum": 2346,
"propertyOrder": 7,
"propertyOrder": 8,
},
"frag_threshold": {
"type": "integer",
"minimum": 0,
"maximum": 2346,
"propertyOrder": 8,
"propertyOrder": 9,
},
"encryption": {
"type": "object",
Expand Down
33 changes: 33 additions & 0 deletions tests/openwrt/test_wireless.py
Original file line number Diff line number Diff line change
Expand Up @@ -881,5 +881,38 @@ def test_no_encryption(self):
option mode 'ap'
option network 'wlan0'
option ssid 'open'
""")
self.assertEqual(o.render(), expected)

def test_wds_ap(self):
o = OpenWrt({
"interfaces": [
{
"name": "wlan0",
"type": "wireless",
"wireless": {
"radio": "radio0",
"mode": "access_point",
"wds": True,
"ssid": "MyWdsAp"
}
}
]
})
expected = self._tabs("""package network
config interface 'wlan0'
option ifname 'wlan0'
option proto 'none'
package wireless
config wifi-iface
option device 'radio0'
option ifname 'wlan0'
option mode 'ap'
option network 'wlan0'
option ssid 'MyWdsAp'
option wds '1'
""")
self.assertEqual(o.render(), expected)

0 comments on commit ec15a67

Please sign in to comment.