Skip to content

Commit acbd54d

Browse files
okraitskkreitmair
authored andcommitted
Add new dialup interface type to the OpenWRT backend
1 parent cadb36b commit acbd54d

2 files changed

Lines changed: 128 additions & 3 deletions

File tree

docs/source/backends/openwrt.rst

Lines changed: 72 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -288,11 +288,12 @@ The network interface settings reside in the ``interfaces`` key of the
288288
`NetJSON interface objects <http://netjson.org/rfc.html#interfaces1>`_
289289
(see the link for the detailed specification).
290290

291-
There are 3 main type of interfaces:
291+
There are 4 main types of interfaces:
292292

293293
* **network interfaces**: may be of type ``ethernet``, ``virtual``, ``loopback`` or ``other``
294294
* **wireless interfaces**: must be of type ``wireless``
295295
* **bridge interfaces**: must be of type ``bridge``
296+
* **dialup interfaces**: must be of type ``dialup``
296297

297298
Interface object extensions
298299
~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -376,7 +377,12 @@ Will be rendered as follows::
376377

377378
package network
378379

379-
config interface 'eth0' option ifname 'eth0' option ip6addr 'fdb4:5f35:e8fd::1/48' option ipaddr '10.27.251.1' option netmask '255.255.255.0' option proto 'static'
380+
config interface 'eth0'
381+
option ifname 'eth0'
382+
option ip6addr 'fdb4:5f35:e8fd::1/48'
383+
option ipaddr '10.27.251.1'
384+
option netmask '255.255.255.0'
385+
option proto 'static'
380386

381387
DNS servers and search domains
382388
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -431,7 +437,22 @@ Will return the following UCI output::
431437

432438
package network
433439

434-
config interface 'eth0' option dns '10.11.12.13 8.8.8.8' option dns_search 'openwisp.org netjson.org' option ifname 'eth0' option ipaddr '192.168.1.1' option netmask '255.255.255.0' option proto 'static' config interface 'eth1' option dns_search 'openwisp.org netjson.org' option ifname 'eth1' option proto 'dhcp' config interface 'eth1_31' option ifname 'eth1.31' option proto 'none'
440+
config interface 'eth0'
441+
option dns '10.11.12.13 8.8.8.8'
442+
option dns_search 'openwisp.org netjson.org'
443+
option ifname 'eth0'
444+
option ipaddr '192.168.1.1'
445+
option netmask '255.255.255.0'
446+
option proto 'static'
447+
448+
config interface 'eth1'
449+
option dns_search 'openwisp.org netjson.org'
450+
option ifname 'eth1'
451+
option proto 'dhcp'
452+
453+
config interface 'eth1_31'
454+
option ifname 'eth1.31'
455+
option proto 'none'
435456

436457
DHCP ipv6 ethernet interface
437458
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -1190,6 +1211,54 @@ UCI Output::
11901211
option password 'test-password'
11911212
option ssid 'enterprise-client'
11921213

1214+
Dialup settings
1215+
---------------
1216+
1217+
Interfaces of type ``dialup`` contain a few options that are specific to dialup connections.
1218+
1219+
The ``OpenWrt`` backend NetJSON extensions for dialup interfaces:
1220+
1221+
+--------------+---------+-----------+------------------------------------------------------------------------------------------------------------+
1222+
| key name | type | default | allowed values |
1223+
+==============+=========+===========+============================================================================================================+
1224+
| ``proto`` | string | ``pppoe`` | ``3g``, ``6in4``, ``aiccu``, ``l2tp``, ``ncm``, ``ppp``, ``pppoa``, ``pppoe``, ``pptp``, ``qmi``, ``wwan`` |
1225+
+--------------+---------+-----------+------------------------------------------------------------------------------------------------------------+
1226+
| ``password`` | string | ``""`` | |
1227+
+--------------+---------+-----------+------------------------------------------------------------------------------------------------------------+
1228+
| ``username`` | string | ``""`` | |
1229+
+--------------+---------+-----------+------------------------------------------------------------------------------------------------------------+
1230+
1231+
Dialup interface example
1232+
~~~~~~~~~~~~~~~~~~~~~~~~
1233+
1234+
The following *configuration dictionary*:
1235+
1236+
.. code-block:: python
1237+
1238+
{
1239+
"interfaces": [
1240+
{
1241+
"name": "dsl0",
1242+
"network": "xdsl",
1243+
"proto": "pppoe",
1244+
"password": "jf93nf82o023$",
1245+
"username": "dsluser",
1246+
"mtu": 1448
1247+
}
1248+
]
1249+
}
1250+
1251+
Will be rendered as follows::
1252+
1253+
package network
1254+
1255+
config interface 'xdsl'
1256+
option ifname 'dsl0'
1257+
option proto 'pppoe'
1258+
option username 'dsluser'
1259+
option password 'jf93nf82o023$'
1260+
option mtu '1448'
1261+
11931262
Radio settings
11941263
--------------
11951264

netjsonconfig/backends/openwrt/schema.py

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,49 @@
112112
}
113113
]
114114
},
115+
"dialup_interface": {
116+
"title": "Dialup interface",
117+
"required": [
118+
"proto",
119+
"username",
120+
"password"
121+
],
122+
"allOf": [
123+
{
124+
"properties": {
125+
"proto": {
126+
"type": "string",
127+
"enum": [
128+
"3g",
129+
"6in4",
130+
"aiccu",
131+
"l2tp",
132+
"ncm",
133+
"ppp",
134+
"pppoa",
135+
"pppoe",
136+
"pptp",
137+
"qmi",
138+
"wwan"
139+
],
140+
"default": "pppoe",
141+
"propertyOrder": 8,
142+
},
143+
"username": {
144+
"type": "string",
145+
"description": "username for authentication in protocols like PPPoE",
146+
"propertyOrder": 9,
147+
},
148+
"password": {
149+
"type": "string",
150+
"description": "password for authentication in protocols like PPPoE",
151+
"propertyOrder": 10,
152+
}
153+
}
154+
},
155+
{"$ref": "#/definitions/interface_settings"},
156+
]
157+
},
115158
"base_radio_settings": {
116159
"properties": {
117160
"driver": {
@@ -165,6 +208,19 @@
165208
"timezone": {"enum": list(timezones.keys()), "default": "UTC"}
166209
}
167210
},
211+
"interfaces": {
212+
"type": "array",
213+
"title": "Interfaces",
214+
"uniqueItems": True,
215+
"additionalItems": True,
216+
"propertyOrder": 2,
217+
"items": {
218+
"title": "Interface",
219+
"oneOf": [
220+
{"$ref": "#/definitions/dialup_interface"}
221+
]
222+
}
223+
},
168224
"routes": {
169225
"items": {
170226
"properties": {

0 commit comments

Comments
 (0)