Skip to content

Commit

Permalink
[fix] Updated modem-manager interface code
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Apr 3, 2021
1 parent c8f1962 commit fc9f4cf
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 41 deletions.
3 changes: 2 additions & 1 deletion netjsonconfig/backends/openwrt/converters/interfaces.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ def __intermediate_interface(self, interface, uci_name):
def _intermediate_modem_manager(self, interface):
interface['proto'] = 'modemmanager'
interface['pincode'] = interface.pop('pin', None)
return interface

def _intermediate_wireguard(self, interface):
interface['proto'] = 'wireguard'
Expand Down Expand Up @@ -320,7 +321,7 @@ def _netjson_dialup(self, interface):
interface['type'] = 'dialup'
return interface

_modem_manager_schema = schema['definitions']['modemmanager_interface']
_modem_manager_schema = schema['definitions']['modemmanager_interface']['allOf'][0]

def _netjson_modem_manager(self, interface):
del interface['proto']
Expand Down
91 changes: 51 additions & 40 deletions netjsonconfig/backends/openwrt/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,47 +168,58 @@
"type": "object",
"title": "Modem manager interface",
"required": ["name", "device"],
"properties": {
"name": interface_settings["name"],
"mtu": interface_settings["mtu"],
"autostart": interface_settings["autostart"],
"disabled": interface_settings["disabled"],
"type": {
"type": "string",
"enum": ["modem-manager"],
"default": "dialup",
"propertyOrder": 1,
},
"apn": {"type": "string", "title": "APN", "propertyOrder": 1.1},
"pin": {
"type": "string",
"title": "PIN code",
"propertyOrder": 1.2,
},
"device": {
"type": "string",
"description": "Leave blank to use the hardware default",
"propertyOrder": 1.3,
},
"username": {"type": "string", "propertyOrder": 1.4},
"password": {"type": "string", "propertyOrder": 1.5},
"metric": {"type": "integer", "default": 50, "propertyOrder": 1.6},
"iptype": {
"type": "string",
"title": "IP type",
"default": "ipv4",
"enum": ["ipv4", "ipv6", "ipv4v6"],
"options": {"enum_titles": ["IPv4", "IPv6", "IPv4 and IPv6"]},
"propertyOrder": 1.7,
},
"lowpower": {
"type": "boolean",
"title": "Low power mode",
"format": "checkbox",
"default": False,
"propertyOrder": 1.8,
"allOf": [
{
"properties": {
"type": {
"type": "string",
"enum": ["modem-manager"],
"default": "dialup",
"propertyOrder": 1,
},
"apn": {
"type": "string",
"title": "APN",
"propertyOrder": 1.1,
},
"pin": {
"type": "string",
"title": "PIN code",
"propertyOrder": 1.2,
},
"device": {
"type": "string",
"description": "Leave blank to use the hardware default",
"propertyOrder": 1.3,
},
"username": {"type": "string", "propertyOrder": 1.4},
"password": {"type": "string", "propertyOrder": 1.5},
"metric": {
"type": "integer",
"default": 50,
"propertyOrder": 1.6,
},
"iptype": {
"type": "string",
"title": "IP type",
"default": "ipv4",
"enum": ["ipv4", "ipv6", "ipv4v6"],
"options": {
"enum_titles": ["IPv4", "IPv6", "IPv4 and IPv6"]
},
"propertyOrder": 1.7,
},
"lowpower": {
"type": "boolean",
"title": "Low power mode",
"format": "checkbox",
"default": False,
"propertyOrder": 1.8,
},
}
},
},
{"$ref": "#/definitions/base_interface_settings"},
],
},
"wireguard_interface": {
"type": "object",
Expand Down

0 comments on commit fc9f4cf

Please sign in to comment.