File tree 2 files changed +33
-9
lines changed
netjsonconfig/backends/airos
2 files changed +33
-9
lines changed Original file line number Diff line number Diff line change @@ -268,6 +268,26 @@ def type_to_role(self, typestr):
268
268
}
269
269
return roles .get (typestr , '' )
270
270
271
+ def autoneg_status (self , interface ):
272
+ if interface .get ('autoneg' ):
273
+ return 'enabled'
274
+ else :
275
+ return 'disabled'
276
+
277
+ def flowcontrol_status (self , interface ):
278
+ if interface .get ('flowcontrol' ):
279
+ status = 'enabled'
280
+ else :
281
+ status = 'disabled'
282
+ return {
283
+ 'rx' : {
284
+ 'status' : status ,
285
+ },
286
+ 'tx' : {
287
+ 'status' : status ,
288
+ },
289
+ }
290
+
271
291
def to_intermediate (self ):
272
292
result = []
273
293
interfaces = []
@@ -282,15 +302,9 @@ def to_intermediate(self):
282
302
}
283
303
# handle interface type quirks
284
304
if interface ['type' ] == 'ethernet' and '.' not in interface ['name' ]:
285
- base ['autoneg' ] = 'enabled'
286
- base ['flowcontrol' ] = {
287
- 'rx' : {
288
- 'status' : 'enabled' ,
289
- },
290
- 'tx' : {
291
- 'status' : 'enabled' ,
292
- },
293
- }
305
+ base ['autoneg' ] = self .autoneg_status (interface )
306
+
307
+ base ['flowcontrol' ] = self .flowcontrol_status (interface )
294
308
295
309
if interface ['type' ] == 'wireless' :
296
310
base ['devname' ] = interface ['wireless' ]['radio' ]
Original file line number Diff line number Diff line change 60
60
},
61
61
},
62
62
},
63
+ "interface_settings" : {
64
+ "properties" : {
65
+ "authoneg" : {
66
+ "type" : "boolean" ,
67
+ },
68
+ "flowcontrol" : {
69
+ "type" : "boolean" ,
70
+ }
71
+ }
72
+ }
63
73
},
64
74
"properties" : {
65
75
"netmode" : {
You can’t perform that action at this time.
0 commit comments