Skip to content

Commit c5a79ce

Browse files
Refactor mac_address_regex usage in schema
1 parent 986a49f commit c5a79ce

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

netjsonconfig/backends/openwrt/schema.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
port_range_regex = "^([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])(-([1-9][0-9]{0,3}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5]))?$" # noqa
1313

1414
# Match against a MAC address
15-
mac_address_regex = "^([0-9A-F]{2}[:-]){5}([0-9A-F]{2})$"
15+
mac_address_regex = "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$"
1616

1717
# Match against a yyyy-mm-dd format date. Note that draft07 of the JSON schema standard
1818
# include a "date" pattern which can replace this.
@@ -100,7 +100,7 @@
100100
"items": {
101101
"type": "string",
102102
"title": "MAC address",
103-
"pattern": "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$",
103+
"pattern": mac_address_regex,
104104
"minLength": 17,
105105
"maxLength": 17,
106106
},
@@ -613,7 +613,7 @@
613613
"title": "src_mac",
614614
"description": "match incoming traffic from the specified "
615615
"mac address",
616-
"pattern": "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$",
616+
"pattern": mac_address_regex,
617617
"minLength": 17,
618618
"maxLength": 17,
619619
"propertyOrder": 4,
@@ -760,6 +760,8 @@
760760
"title": "src_mac",
761761
"description": "Match incoming traffic from the specified MAC address.",
762762
"pattern": mac_address_regex,
763+
"minLength": 17,
764+
"maxLength": 17,
763765
"propertyOrder": 5,
764766
},
765767
"src_port": {

0 commit comments

Comments
 (0)