File tree Expand file tree Collapse file tree 2 files changed +21
-1
lines changed
netjsonconfig/backends/openwrt Expand file tree Collapse file tree 2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change @@ -44,7 +44,7 @@ def _get_interfaces(self):
44
44
uci_interface = deepcopy (interface )
45
45
if network :
46
46
del uci_interface ['network' ]
47
- if uci_interface . get ( 'autostart' ) :
47
+ if 'autostart' in uci_interface :
48
48
uci_interface ['auto' ] = interface ['autostart' ]
49
49
del uci_interface ['autostart' ]
50
50
if uci_interface .get ('disabled' ):
Original file line number Diff line number Diff line change @@ -1039,3 +1039,23 @@ def test_igmp(self):
1039
1039
o .config ['interfaces' ][0 ]['igmp_snooping' ] = 'wrong'
1040
1040
with self .assertRaises (ValidationError ):
1041
1041
o .validate ()
1042
+
1043
+ def test_autostart (self ):
1044
+ o = OpenWrt ({
1045
+ "interfaces" : [
1046
+ {
1047
+ "name" : "eth0" ,
1048
+ "type" : "ethernet" ,
1049
+ "autostart" : False
1050
+ }
1051
+ ]
1052
+ })
1053
+ expected = self ._tabs ("""package network
1054
+
1055
+ config interface 'eth0'
1056
+ option auto '0'
1057
+ option ifname 'eth0'
1058
+ option proto 'none'
1059
+ """ )
1060
+ self .assertEqual (o .render (), expected )
1061
+
You can’t perform that action at this time.
0 commit comments