Permalink
Browse files

[OpenWrt] Fixed autostart when False

  • Loading branch information...
nemesisdesign committed Apr 1, 2016
1 parent 269c7bf commit 2cbc24278cf2e9ad9fd58a5491082f109da15e8d
Showing with 21 additions and 1 deletion.
  1. +1 −1 netjsonconfig/backends/openwrt/renderers.py
  2. +20 −0 tests/openwrt/test_network.py
@@ -44,7 +44,7 @@ def _get_interfaces(self):
uci_interface = deepcopy(interface)
if network:
del uci_interface['network']
if uci_interface.get('autostart'):
if 'autostart' in uci_interface:
uci_interface['auto'] = interface['autostart']
del uci_interface['autostart']
if uci_interface.get('disabled'):
@@ -1039,3 +1039,23 @@ def test_igmp(self):
o.config['interfaces'][0]['igmp_snooping'] = 'wrong'
with self.assertRaises(ValidationError):
o.validate()
def test_autostart(self):
o = OpenWrt({
"interfaces": [
{
"name": "eth0",
"type": "ethernet",
"autostart": False
}
]
})
expected = self._tabs("""package network
config interface 'eth0'
option auto '0'
option ifname 'eth0'
option proto 'none'
""")
self.assertEqual(o.render(), expected)

0 comments on commit 2cbc242

Please sign in to comment.