diff --git a/netjsonconfig/backends/openwrt/schema.py b/netjsonconfig/backends/openwrt/schema.py index 85a18cfd7..1983f267c 100644 --- a/netjsonconfig/backends/openwrt/schema.py +++ b/netjsonconfig/backends/openwrt/schema.py @@ -115,29 +115,22 @@ "firewall_policy": { "type": "string", "enum": ["ACCEPT", "REJECT", "DROP"], - "options": { - "enum_titles": [ - "Accept", "Reject", "Drop"] - }, - "default": "REJECT" + "options": {"enum_titles": ["Accept", "Reject", "Drop"]}, + "default": "REJECT", }, "zone_policy": { "type": "string", "enum": ["ACCEPT", "REJECT", "DROP"], - "options": { - "enum_titles": [ - "Accept", "Reject", "Drop"] - }, - "default": "DROP" + "options": {"enum_titles": ["Accept", "Reject", "Drop"]}, + "default": "DROP", }, "rule_policy": { "type": "string", "enum": ["ACCEPT", "REJECT", "DROP", "MARK", "NOTRACK"], "options": { - "enum_titles": [ - "Accept", "Reject", "Drop", "Mark", "Notrack"] + "enum_titles": ["Accept", "Reject", "Drop", "Mark", "Notrack"] }, - "default": "DROP" + "default": "DROP", }, "base_radio_settings": { "properties": { @@ -410,8 +403,8 @@ "interval": {"type": "integer", "propertyOrder": 8}, "message": {"type": "string", "propertyOrder": 9}, "mode": {"type": "string", "propertyOrder": 10}, - } - } + }, + }, }, "firewall": { "type": "object", @@ -433,7 +426,7 @@ "title": "input", "description": "policy for the INPUT chain of the filter table", "propertyOrder": 2, - } + }, ] }, "output": { @@ -443,7 +436,7 @@ "title": "output", "description": "policy for the OUTPUT chain of the filter table", "propertyOrder": 3, - } + }, ] }, "forward": { @@ -453,7 +446,7 @@ "title": "forward", "description": "policy for the FORWARD chain of the filter table", "propertyOrder": 4, - } + }, ] }, "forwardings": { @@ -464,36 +457,33 @@ "type": "object", "title": "Forwarding", "additionalProperties": False, - "required": [ - "src", - "dest", - ], + "required": ["src", "dest",], "properties": { "src": { "type": "string", "title": "src", "description": "specifies the traffic source zone and must " - "refer to one of the defined zone names", + "refer to one of the defined zone names", "propertyOrder": 1, }, "dest": { "type": "string", "title": "dest", "description": "specifies the traffic destination zone and must " - "refer to one of the defined zone names", + "refer to one of the defined zone names", "propertyOrder": 2, }, "family": { "type": "string", "title": "family", "description": "protocol family (ipv4, ipv6 or any) to generate " - "iptables rules for", + "iptables rules for", "enum": ["ipv4", "ipv6", "any"], "default": "any", - "propertyOrder": 3 - } - } - } + "propertyOrder": 3, + }, + }, + }, }, "zones": { "type": "array", @@ -503,16 +493,14 @@ "type": "object", "title": "Zones", "additionalProperties": True, - "required": [ - "name" - ], + "required": ["name"], "properties": { "name": { "type": "string", "title": "name", "description": "unique zone name", "maxLength": 11, - "propertyOrder": 1 + "propertyOrder": 1, }, "network": { "type": "array", @@ -524,17 +512,17 @@ "title": "Network", "type": "string", "maxLength": 15, - "pattern": "^[a-zA-z0-9_\\.\\-]*$" - } + "pattern": "^[a-zA-z0-9_\\.\\-]*$", + }, }, "masq": { "type": "boolean", "title": "masq", "description": "specifies wether outgoing zone traffic should be " - "masqueraded", + "masqueraded", "default": False, "format": "checkbox", - "propertyOrder": 3 + "propertyOrder": 3, }, "mtu_fix": { "type": "boolean", @@ -551,7 +539,7 @@ "title": "input", "description": "default policy for incoming zone traffic", "propertyOrder": 5, - } + }, ] }, "output": { @@ -561,7 +549,7 @@ "title": "output", "description": "default policy for outgoing zone traffic", "propertyOrder": 6, - } + }, ] }, "forward": { @@ -571,11 +559,11 @@ "title": "forward", "description": "default policy for forwarded zone traffic", "propertyOrder": 7, - } + }, ] - } - } - } + }, + }, + }, }, "rules": { "type": "array", @@ -585,100 +573,94 @@ "type": "object", "title": "Rules", "additionalProperties": True, - "required": [ - "src", - "target" - ], + "required": ["src", "target"], "properties": { "name": { "type": "string", "title": "name", "description": "name of the rule", - "propertyOrder": 1 + "propertyOrder": 1, }, "src": { "type": "string", "title": "src", "description": "specifies the traffic source zone and must " - "refer to one of the defined zone names", - "propertyOrder": 2 + "refer to one of the defined zone names", + "propertyOrder": 2, }, "src_ip": { "type": "string", "title": "src_ip", "description": "match incoming traffic from the specified " - "source ip address", - "propertyOrder": 3 + "source ip address", + "propertyOrder": 3, }, "src_mac": { "type": "string", "title": "src_mac", "description": "match incoming traffic from the specified " - "mac address", + "mac address", "pattern": "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$", "minLength": 17, "maxLength": 17, - "propertyOrder": 4 + "propertyOrder": 4, }, "src_port": { "type": "string", "title": "src_port", "description": "match incoming traffic from the specified " - "source port or port range, if relevant proto " - "is specified. Multiple ports can be specified " - "separated by blanks", - "propertyOrder": 5 + "source port or port range, if relevant proto " + "is specified. Multiple ports can be specified " + "separated by blanks", + "propertyOrder": 5, }, "proto": { "type": "string", "title": "proto", "description": "match incoming traffic using the given protocol. " - "Can be one of tcp, udp, tcpudp, udplite, icmp, esp, " - "ah, sctp, or all or it can be a numeric value, " - "representing one of these protocols or a different one. " - "A protocol name from /etc/protocols is also allowed. " - "The number 0 is equivalent to all", + "Can be one of tcp, udp, tcpudp, udplite, icmp, esp, " + "ah, sctp, or all or it can be a numeric value, " + "representing one of these protocols or a different one. " + "A protocol name from /etc/protocols is also allowed. " + "The number 0 is equivalent to all", "default": "tcpudp", - "propertyOrder": 6 + "propertyOrder": 6, }, "icmp_type": { "title": "icmp_type", "description": "for protocol icmp select specific icmp types to match. " - "Values can be either exact icmp type numbers or type names", + "Values can be either exact icmp type numbers or type names", "type": "array", "uniqueItems": True, "additionalItems": True, "propertyOrder": 7, - "items": { - "title": "ICMP type", - "type": "string" - } + "items": {"title": "ICMP type", "type": "string"}, }, "dest": { "type": "string", "title": "dest", "description": "specifies the traffic destination zone and must " - "refer to one of the defined zone names, or * for " - "any zone. If specified, the rule applies to forwarded " - "traffic; otherwise, it is treated as input rule", - "propertyOrder": 8 + "refer to one of the defined zone names, or * for " + "any zone. If specified, the rule applies to forwarded " + "traffic; otherwise, it is treated as input rule", + "propertyOrder": 8, }, "dest_ip": { "type": "string", "title": "dest_ip", "description": "match incoming traffic directed to the specified " - "destination ip address. With no dest zone, this " - "is treated as an input rule", - "propertyOrder": 9 + "destination ip address. With no dest zone, this " + "is treated as an input rule", + "propertyOrder": 9, }, "dest_port": { "type": "string", "title": "dest_port", "description": "match incoming traffic directed at the given " - "destination port or port range, if relevant " - "proto is specified. Multiple ports can be specified " - "separated by blanks", - "propertyOrder": 10 + "destination port or port range, if relevant " + "proto is specified. Multiple ports can be specified " + "separated by blanks", + "propertyOrder": 10, }, "target": { "allOf": [ @@ -686,8 +668,8 @@ { "title": "target", "description": "firewall action for matched traffic", - "propertyOrder": 11 - } + "propertyOrder": 11, + }, ] }, "family": { @@ -696,29 +678,29 @@ "description": "protocol family to generate iptables rules for", "enum": ["ipv4", "ipv6", "any"], "default": "any", - "propertyOrder": 12 + "propertyOrder": 12, }, "limit": { "type": "string", "title": "limit", "description": "maximum average matching rate; specified as a number, " - "with an optional /second, /minute, /hour or /day suffix", - "propertyOrder": 13 + "with an optional /second, /minute, /hour or /day suffix", + "propertyOrder": 13, }, "enabled": { "type": "boolean", "title": "enable rule", "default": True, "format": "checkbox", - "propertyOrder": 14 - } - } - } - } - } - } - } - } + "propertyOrder": 14, + }, + }, + }, + }, + }, + }, + }, + }, )