Skip to content

Commit 7837ad8

Browse files
Reformat openwrt/schema.py (openwisp-qa-format)
1 parent e49605e commit 7837ad8

File tree

1 file changed

+76
-94
lines changed

1 file changed

+76
-94
lines changed

netjsonconfig/backends/openwrt/schema.py

Lines changed: 76 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -115,29 +115,22 @@
115115
"firewall_policy": {
116116
"type": "string",
117117
"enum": ["ACCEPT", "REJECT", "DROP"],
118-
"options": {
119-
"enum_titles": [
120-
"Accept", "Reject", "Drop"]
121-
},
122-
"default": "REJECT"
118+
"options": {"enum_titles": ["Accept", "Reject", "Drop"]},
119+
"default": "REJECT",
123120
},
124121
"zone_policy": {
125122
"type": "string",
126123
"enum": ["ACCEPT", "REJECT", "DROP"],
127-
"options": {
128-
"enum_titles": [
129-
"Accept", "Reject", "Drop"]
130-
},
131-
"default": "DROP"
124+
"options": {"enum_titles": ["Accept", "Reject", "Drop"]},
125+
"default": "DROP",
132126
},
133127
"rule_policy": {
134128
"type": "string",
135129
"enum": ["ACCEPT", "REJECT", "DROP", "MARK", "NOTRACK"],
136130
"options": {
137-
"enum_titles": [
138-
"Accept", "Reject", "Drop", "Mark", "Notrack"]
131+
"enum_titles": ["Accept", "Reject", "Drop", "Mark", "Notrack"]
139132
},
140-
"default": "DROP"
133+
"default": "DROP",
141134
},
142135
"base_radio_settings": {
143136
"properties": {
@@ -410,8 +403,8 @@
410403
"interval": {"type": "integer", "propertyOrder": 8},
411404
"message": {"type": "string", "propertyOrder": 9},
412405
"mode": {"type": "string", "propertyOrder": 10},
413-
}
414-
}
406+
},
407+
},
415408
},
416409
"firewall": {
417410
"type": "object",
@@ -433,7 +426,7 @@
433426
"title": "input",
434427
"description": "policy for the INPUT chain of the filter table",
435428
"propertyOrder": 2,
436-
}
429+
},
437430
]
438431
},
439432
"output": {
@@ -443,7 +436,7 @@
443436
"title": "output",
444437
"description": "policy for the OUTPUT chain of the filter table",
445438
"propertyOrder": 3,
446-
}
439+
},
447440
]
448441
},
449442
"forward": {
@@ -453,7 +446,7 @@
453446
"title": "forward",
454447
"description": "policy for the FORWARD chain of the filter table",
455448
"propertyOrder": 4,
456-
}
449+
},
457450
]
458451
},
459452
"forwardings": {
@@ -464,36 +457,33 @@
464457
"type": "object",
465458
"title": "Forwarding",
466459
"additionalProperties": False,
467-
"required": [
468-
"src",
469-
"dest",
470-
],
460+
"required": ["src", "dest",],
471461
"properties": {
472462
"src": {
473463
"type": "string",
474464
"title": "src",
475465
"description": "specifies the traffic source zone and must "
476-
"refer to one of the defined zone names",
466+
"refer to one of the defined zone names",
477467
"propertyOrder": 1,
478468
},
479469
"dest": {
480470
"type": "string",
481471
"title": "dest",
482472
"description": "specifies the traffic destination zone and must "
483-
"refer to one of the defined zone names",
473+
"refer to one of the defined zone names",
484474
"propertyOrder": 2,
485475
},
486476
"family": {
487477
"type": "string",
488478
"title": "family",
489479
"description": "protocol family (ipv4, ipv6 or any) to generate "
490-
"iptables rules for",
480+
"iptables rules for",
491481
"enum": ["ipv4", "ipv6", "any"],
492482
"default": "any",
493-
"propertyOrder": 3
494-
}
495-
}
496-
}
483+
"propertyOrder": 3,
484+
},
485+
},
486+
},
497487
},
498488
"zones": {
499489
"type": "array",
@@ -503,16 +493,14 @@
503493
"type": "object",
504494
"title": "Zones",
505495
"additionalProperties": True,
506-
"required": [
507-
"name"
508-
],
496+
"required": ["name"],
509497
"properties": {
510498
"name": {
511499
"type": "string",
512500
"title": "name",
513501
"description": "unique zone name",
514502
"maxLength": 11,
515-
"propertyOrder": 1
503+
"propertyOrder": 1,
516504
},
517505
"network": {
518506
"type": "array",
@@ -524,17 +512,17 @@
524512
"title": "Network",
525513
"type": "string",
526514
"maxLength": 15,
527-
"pattern": "^[a-zA-z0-9_\\.\\-]*$"
528-
}
515+
"pattern": "^[a-zA-z0-9_\\.\\-]*$",
516+
},
529517
},
530518
"masq": {
531519
"type": "boolean",
532520
"title": "masq",
533521
"description": "specifies wether outgoing zone traffic should be "
534-
"masqueraded",
522+
"masqueraded",
535523
"default": False,
536524
"format": "checkbox",
537-
"propertyOrder": 3
525+
"propertyOrder": 3,
538526
},
539527
"mtu_fix": {
540528
"type": "boolean",
@@ -551,7 +539,7 @@
551539
"title": "input",
552540
"description": "default policy for incoming zone traffic",
553541
"propertyOrder": 5,
554-
}
542+
},
555543
]
556544
},
557545
"output": {
@@ -561,7 +549,7 @@
561549
"title": "output",
562550
"description": "default policy for outgoing zone traffic",
563551
"propertyOrder": 6,
564-
}
552+
},
565553
]
566554
},
567555
"forward": {
@@ -571,11 +559,11 @@
571559
"title": "forward",
572560
"description": "default policy for forwarded zone traffic",
573561
"propertyOrder": 7,
574-
}
562+
},
575563
]
576-
}
577-
}
578-
}
564+
},
565+
},
566+
},
579567
},
580568
"rules": {
581569
"type": "array",
@@ -585,109 +573,103 @@
585573
"type": "object",
586574
"title": "Rules",
587575
"additionalProperties": True,
588-
"required": [
589-
"src",
590-
"target"
591-
],
576+
"required": ["src", "target"],
592577
"properties": {
593578
"name": {
594579
"type": "string",
595580
"title": "name",
596581
"description": "name of the rule",
597-
"propertyOrder": 1
582+
"propertyOrder": 1,
598583
},
599584
"src": {
600585
"type": "string",
601586
"title": "src",
602587
"description": "specifies the traffic source zone and must "
603-
"refer to one of the defined zone names",
604-
"propertyOrder": 2
588+
"refer to one of the defined zone names",
589+
"propertyOrder": 2,
605590
},
606591
"src_ip": {
607592
"type": "string",
608593
"title": "src_ip",
609594
"description": "match incoming traffic from the specified "
610-
"source ip address",
611-
"propertyOrder": 3
595+
"source ip address",
596+
"propertyOrder": 3,
612597
},
613598
"src_mac": {
614599
"type": "string",
615600
"title": "src_mac",
616601
"description": "match incoming traffic from the specified "
617-
"mac address",
602+
"mac address",
618603
"pattern": "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$",
619604
"minLength": 17,
620605
"maxLength": 17,
621-
"propertyOrder": 4
606+
"propertyOrder": 4,
622607
},
623608
"src_port": {
624609
"type": "string",
625610
"title": "src_port",
626611
"description": "match incoming traffic from the specified "
627-
"source port or port range, if relevant proto "
628-
"is specified. Multiple ports can be specified "
629-
"separated by blanks",
630-
"propertyOrder": 5
612+
"source port or port range, if relevant proto "
613+
"is specified. Multiple ports can be specified "
614+
"separated by blanks",
615+
"propertyOrder": 5,
631616
},
632617
"proto": {
633618
"type": "string",
634619
"title": "proto",
635620
"description": "match incoming traffic using the given protocol. "
636-
"Can be one of tcp, udp, tcpudp, udplite, icmp, esp, "
637-
"ah, sctp, or all or it can be a numeric value, "
638-
"representing one of these protocols or a different one. "
639-
"A protocol name from /etc/protocols is also allowed. "
640-
"The number 0 is equivalent to all",
621+
"Can be one of tcp, udp, tcpudp, udplite, icmp, esp, "
622+
"ah, sctp, or all or it can be a numeric value, "
623+
"representing one of these protocols or a different one. "
624+
"A protocol name from /etc/protocols is also allowed. "
625+
"The number 0 is equivalent to all",
641626
"default": "tcpudp",
642-
"propertyOrder": 6
627+
"propertyOrder": 6,
643628
},
644629
"icmp_type": {
645630
"title": "icmp_type",
646631
"description": "for protocol icmp select specific icmp types to match. "
647-
"Values can be either exact icmp type numbers or type names",
632+
"Values can be either exact icmp type numbers or type names",
648633
"type": "array",
649634
"uniqueItems": True,
650635
"additionalItems": True,
651636
"propertyOrder": 7,
652-
"items": {
653-
"title": "ICMP type",
654-
"type": "string"
655-
}
637+
"items": {"title": "ICMP type", "type": "string"},
656638
},
657639
"dest": {
658640
"type": "string",
659641
"title": "dest",
660642
"description": "specifies the traffic destination zone and must "
661-
"refer to one of the defined zone names, or * for "
662-
"any zone. If specified, the rule applies to forwarded "
663-
"traffic; otherwise, it is treated as input rule",
664-
"propertyOrder": 8
643+
"refer to one of the defined zone names, or * for "
644+
"any zone. If specified, the rule applies to forwarded "
645+
"traffic; otherwise, it is treated as input rule",
646+
"propertyOrder": 8,
665647
},
666648
"dest_ip": {
667649
"type": "string",
668650
"title": "dest_ip",
669651
"description": "match incoming traffic directed to the specified "
670-
"destination ip address. With no dest zone, this "
671-
"is treated as an input rule",
672-
"propertyOrder": 9
652+
"destination ip address. With no dest zone, this "
653+
"is treated as an input rule",
654+
"propertyOrder": 9,
673655
},
674656
"dest_port": {
675657
"type": "string",
676658
"title": "dest_port",
677659
"description": "match incoming traffic directed at the given "
678-
"destination port or port range, if relevant "
679-
"proto is specified. Multiple ports can be specified "
680-
"separated by blanks",
681-
"propertyOrder": 10
660+
"destination port or port range, if relevant "
661+
"proto is specified. Multiple ports can be specified "
662+
"separated by blanks",
663+
"propertyOrder": 10,
682664
},
683665
"target": {
684666
"allOf": [
685667
{"$ref": "#/definitions/rule_policy"},
686668
{
687669
"title": "target",
688670
"description": "firewall action for matched traffic",
689-
"propertyOrder": 11
690-
}
671+
"propertyOrder": 11,
672+
},
691673
]
692674
},
693675
"family": {
@@ -696,29 +678,29 @@
696678
"description": "protocol family to generate iptables rules for",
697679
"enum": ["ipv4", "ipv6", "any"],
698680
"default": "any",
699-
"propertyOrder": 12
681+
"propertyOrder": 12,
700682
},
701683
"limit": {
702684
"type": "string",
703685
"title": "limit",
704686
"description": "maximum average matching rate; specified as a number, "
705-
"with an optional /second, /minute, /hour or /day suffix",
706-
"propertyOrder": 13
687+
"with an optional /second, /minute, /hour or /day suffix",
688+
"propertyOrder": 13,
707689
},
708690
"enabled": {
709691
"type": "boolean",
710692
"title": "enable rule",
711693
"default": True,
712694
"format": "checkbox",
713-
"propertyOrder": 14
714-
}
715-
}
716-
}
717-
}
718-
}
719-
}
720-
}
721-
}
695+
"propertyOrder": 14,
696+
},
697+
},
698+
},
699+
},
700+
},
701+
},
702+
},
703+
},
722704
)
723705

724706

0 commit comments

Comments
 (0)