| 1 |
{ |
| 2 |
# substring data expression |
| 3 |
# empty configs are not accepted by Kea |
| 4 |
"Dhcp4": { |
| 5 |
"valid-lifetime": 1800, |
| 6 |
"client-classes": [ |
| 7 |
# use substring in a reductible match |
| 8 |
/// match: substring(option dhcp.host-name, 0, 3) |
| 9 |
{ |
| 10 |
"name": "reductible" |
| 11 |
}, |
| 12 |
/// subclass selector 'www' |
| 13 |
{ |
| 14 |
"name": "sub#reductible#0", |
| 15 |
/// from: match substring(option dhcp.host-name, 0, 3) |
| 16 |
/// data: 'www' |
| 17 |
"test": "substring(option[12].hex,0,3) == 'www'" |
| 18 |
}, |
| 19 |
# reduce literals too |
| 20 |
{ |
| 21 |
"name": "literal", |
| 22 |
/// from: match if (option dhcp.host-name) = (substring('www.example.com', 0, 3)) |
| 23 |
"test": "option[12].hex == 'www'" |
| 24 |
} |
| 25 |
], |
| 26 |
"option-data": [ |
| 27 |
// # raw |
| 28 |
// { |
| 29 |
// "space": "dhcp4", |
| 30 |
// "name": "domain-name", |
| 31 |
// "code": 15, |
| 32 |
// "csv-format": false, |
| 33 |
// "expression": { |
| 34 |
// "substring": { |
| 35 |
// "expression": { |
| 36 |
// "option": { |
| 37 |
// "universe": "dhcp", |
| 38 |
// "name": "domain-name", |
| 39 |
// "code": 15 |
| 40 |
// } |
| 41 |
// }, |
| 42 |
// "offset": 4, |
| 43 |
// "length": 1000 |
| 44 |
// } |
| 45 |
// } |
| 46 |
// } |
| 47 |
] |
| 48 |
} |
| 49 |
} |