diff --git a/generate-reader.uc b/generate-reader.uc index c971827..f2fca18 100755 --- a/generate-reader.uc +++ b/generate-reader.uc @@ -74,6 +74,12 @@ let GeneratorProto = { 'return match(value, /^[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]$/i);' ] }, + "uc-mobility": { + desc: 'Mobility Domain', + code: [ + 'return match(value, /^[0-9a-f][0-9a-f][0-9a-f][0-9a-f]$/i);' + ] + }, "uc-host": { desc: 'hostname or IP address', code: [ diff --git a/schema/interface.ssid.roaming.yml b/schema/interface.ssid.roaming.yml index f274720..53eae15 100644 --- a/schema/interface.ssid.roaming.yml +++ b/schema/interface.ssid.roaming.yml @@ -21,8 +21,7 @@ properties: description: Mobility Domain identifier (dot11FTMobilityDomainID, MDID). type: string - maxLength: 4 - minLength: 4 + format: uc-mobility examples: - abcd pmk-r0-key-holder: diff --git a/schemareader.uc b/schemareader.uc index 9b481c8..c325cc0 100644 --- a/schemareader.uc +++ b/schemareader.uc @@ -22,6 +22,10 @@ function matchUcMac(value) { return match(value, /^[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]:[0-9a-f][0-9a-f]$/i); } +function matchUcMobility(value) { + return match(value, /^[0-9a-f][0-9a-f][0-9a-f][0-9a-f]$/i); +} + function matchUcHost(value) { if (length(iptoarr(value)) != 0) return true; if (length(value) > 255) return false; @@ -2812,11 +2816,8 @@ function instantiateInterfaceSsidRoaming(location, value, errors) { function parseDomainIdentifier(location, value, errors) { if (type(value) == "string") { - if (length(value) > 4) - push(errors, [ location, "must be at most 4 characters long" ]); - - if (length(value) < 4) - push(errors, [ location, "must be at least 4 characters long" ]); + if (!matchUcMobility(value)) + push(errors, [ location, "must be a valid Mobility Domain" ]); } diff --git a/ucentral.schema.full.json b/ucentral.schema.full.json index 310b942..ef0112e 100644 --- a/ucentral.schema.full.json +++ b/ucentral.schema.full.json @@ -1683,8 +1683,7 @@ "domain-identifier": { "description": "Mobility Domain identifier (dot11FTMobilityDomainID, MDID).", "type": "string", - "maxLength": 4, - "minLength": 4, + "format": "uc-mobility", "examples": [ "abcd" ] diff --git a/ucentral.schema.json b/ucentral.schema.json index 98e97a2..341794c 100644 --- a/ucentral.schema.json +++ b/ucentral.schema.json @@ -1145,8 +1145,7 @@ }, "domain-identifier": { "type": "string", - "maxLength": 4, - "minLength": 4, + "format": "uc-mobility", "examples": [ "abcd" ] diff --git a/ucentral.schema.pretty.json b/ucentral.schema.pretty.json index 463c5b5..09c6fbc 100644 --- a/ucentral.schema.pretty.json +++ b/ucentral.schema.pretty.json @@ -1293,8 +1293,7 @@ "domain-identifier": { "description": "Mobility Domain identifier (dot11FTMobilityDomainID, MDID).", "type": "string", - "maxLength": 4, - "minLength": 4, + "format": "uc-mobility", "examples": [ "abcd" ]