File tree 2 files changed +33
-0
lines changed
2 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 331
331
"bssid" : {
332
332
"type" : "string" ,
333
333
"title" : "BSSID" ,
334
+ "pattern" : "^([0-9A-Fa-f]{2}[:-]){5}([0-9A-Fa-f]{2})$" ,
334
335
"minLength" : 17 ,
335
336
"maxLength" : 17 ,
336
337
"propertyOrder" : 4 ,
Original file line number Diff line number Diff line change @@ -1130,3 +1130,35 @@ def test_mesh_80211s(self):
1130
1130
option network 'lan'
1131
1131
""" )
1132
1132
self .assertEqual (o .render (), expected )
1133
+
1134
+ def test_bssid_format (self ):
1135
+ o = OpenWrt ({
1136
+ "interfaces" : [
1137
+ {
1138
+ "name" : "wlan0" ,
1139
+ "type" : "wireless" ,
1140
+ "wireless" : {
1141
+ "radio" : "radio1" ,
1142
+ "mode" : "adhoc" ,
1143
+ "ssid" : "adhoc-ssid" ,
1144
+ "bssid" : "00:11:22:33:44:55"
1145
+ }
1146
+ }
1147
+ ]
1148
+ })
1149
+ o .validate ()
1150
+ # too short
1151
+ o .config ['interfaces' ][0 ]['wireless' ]['bssid' ] = '00:11:22:33:44'
1152
+ with self .assertRaises (ValidationError ):
1153
+ o .validate ()
1154
+ # valid
1155
+ o .config ['interfaces' ][0 ]['wireless' ]['bssid' ] = '00-11-22-33-44-55'
1156
+ o .validate ()
1157
+ # should not be valid
1158
+ o .config ['interfaces' ][0 ]['wireless' ]['bssid' ] = '00:11:22:33:44:ZY'
1159
+ with self .assertRaises (ValidationError ):
1160
+ o .validate ()
1161
+ # empty is not valid
1162
+ o .config ['interfaces' ][0 ]['wireless' ]['bssid' ] = ''
1163
+ with self .assertRaises (ValidationError ):
1164
+ o .validate ()
You can’t perform that action at this time.
0 commit comments