File tree 3 files changed +54
-9
lines changed
netjsonconfig/backends/airos
3 files changed +54
-9
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,27 @@ As an example here is a snippet that set the vlan ``eth0.2`` to be the managemen
91
91
]
92
92
}
93
93
94
+ Ethernet
95
+ ========
96
+
97
+ The ``ethernet `` interface can be configured to allow auto-negotiation and flow control with the properties ``autoneg `` and ``flowcontrol ``
98
+
99
+ As an example here is a snippet that enables both auto-negotiation and flow control
100
+
101
+ .. code-block :: json
102
+
103
+ {
104
+ "interfaces" : [
105
+ {
106
+ "type" : " ethernet" ,
107
+ "name" : " eth0" ,
108
+ "autoneg" : true ,
109
+ "flowcontrol" : true
110
+ }
111
+ ]
112
+ }
113
+
114
+
94
115
DNS servers
95
116
-----------
96
117
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