mirror of
https://github.com/Telecominfraproject/wlan-ucentral-schema.git
synced 2026-01-27 02:23:33 +00:00
Add config for vendor-class and request-options
When using dynamic (dhcp) addressing for IPv4, allow the vendor-class
and list of requested options to be configured, along with specific
defaults:
vendor-class default is "OpenLAN"
requested options default is [ 43, 60, 224 ]
These defaults enable support for cloud discovery FQDN (224) and the
DHCP-VSI feature (43, 60)
Fixes: WIFI-14271
Signed-off-by: Paul White <paul@shasta.cloud>
This commit is contained in:
@@ -20,7 +20,6 @@ set network.{{ afname }}.auto={{ interface.auto_start }}
|
||||
set network.{{ afname }}.proto=static
|
||||
{% elif ((length(afnames) == 1 || afidx == 0) && ipv4_mode == 'dynamic'): %}
|
||||
set network.{{ afname }}.proto=dhcp
|
||||
set network.{{ afname }}.reqopts='43 224'
|
||||
{% elif ((length(afnames) == 1 || afidx == 1) && ipv6_mode == 'dynamic'): %}
|
||||
set network.{{ afname }}.proto=dhcpv6
|
||||
{% else %}
|
||||
|
||||
@@ -7,6 +7,10 @@ set network.{{ name }}.gateway={{ ipv4.gateway }}
|
||||
{% else %}
|
||||
set network.{{ name }}.peerdns={{ b(!length(ipv4.use_dns)) }}
|
||||
{% endif %}
|
||||
{% if (ipv4_mode == 'dynamic'): %}
|
||||
set network.{{ name }}.vendorid={{ ipv4.vendor_class }}
|
||||
set network.{{ name }}.reqopts='{{ join(' ', ipv4.request_options) }}'
|
||||
{% endif %}
|
||||
{% for (let dns in ipv4.use_dns): %}
|
||||
add_list network.{{ name }}.dns={{ dns }}
|
||||
{% endfor %}
|
||||
|
||||
@@ -36,6 +36,24 @@ properties:
|
||||
default: true
|
||||
examples:
|
||||
- true
|
||||
vendor-class:
|
||||
description:
|
||||
Include the provided vendor-class inside DHCP requests
|
||||
type: string
|
||||
default: OpenLAN
|
||||
examples:
|
||||
- OpenLAN
|
||||
request-options:
|
||||
description:
|
||||
Define additional DHCP options to request inside DHCP requests
|
||||
type: array
|
||||
default: [43, 60, 224]
|
||||
items:
|
||||
type: integer
|
||||
minimum: 1
|
||||
maximum: 255
|
||||
examples:
|
||||
- 43
|
||||
use-dns:
|
||||
description:
|
||||
Define which DNS servers shall be used. This can either be a list of
|
||||
|
||||
@@ -1985,6 +1985,54 @@ function instantiateInterfaceIpv4(location, value, errors) {
|
||||
obj.send_hostname = true;
|
||||
}
|
||||
|
||||
function parseVendorClass(location, value, errors) {
|
||||
if (type(value) != "string")
|
||||
push(errors, [ location, "must be of type string" ]);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
if (exists(value, "vendor-class")) {
|
||||
obj.vendor_class = parseVendorClass(location + "/vendor-class", value["vendor-class"], errors);
|
||||
}
|
||||
else {
|
||||
obj.vendor_class = "OpenLAN";
|
||||
}
|
||||
|
||||
function parseRequestOptions(location, value, errors) {
|
||||
if (type(value) == "array") {
|
||||
function parseItem(location, value, errors) {
|
||||
if (type(value) in [ "int", "double" ]) {
|
||||
if (value > 255)
|
||||
push(errors, [ location, "must be lower than or equal to 255" ]);
|
||||
|
||||
if (value < 1)
|
||||
push(errors, [ location, "must be bigger than or equal to 1" ]);
|
||||
|
||||
}
|
||||
|
||||
if (type(value) != "int")
|
||||
push(errors, [ location, "must be of type integer" ]);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
return map(value, (item, i) => parseItem(location + "/" + i, item, errors));
|
||||
}
|
||||
|
||||
if (type(value) != "array")
|
||||
push(errors, [ location, "must be of type array" ]);
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
if (exists(value, "request-options")) {
|
||||
obj.request_options = parseRequestOptions(location + "/request-options", value["request-options"], errors);
|
||||
}
|
||||
else {
|
||||
obj.request_options = [ 43, 60, 224 ];
|
||||
}
|
||||
|
||||
function parseUseDns(location, value, errors) {
|
||||
if (type(value) == "array") {
|
||||
function parseItem(location, value, errors) {
|
||||
|
||||
@@ -1049,6 +1049,31 @@
|
||||
true
|
||||
]
|
||||
},
|
||||
"vendor-class": {
|
||||
"description": "Include the provided vendor-class inside DHCP requests",
|
||||
"type": "string",
|
||||
"default": "OpenLAN",
|
||||
"examples": [
|
||||
"OpenLAN"
|
||||
]
|
||||
},
|
||||
"request-options": {
|
||||
"description": "Define additional DHCP options to request inside DHCP requests",
|
||||
"type": "array",
|
||||
"default": [
|
||||
43,
|
||||
60,
|
||||
224
|
||||
],
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 255,
|
||||
"examples": [
|
||||
43
|
||||
]
|
||||
}
|
||||
},
|
||||
"use-dns": {
|
||||
"description": "Define which DNS servers shall be used. This can either be a list of static IPv4 addresse or dhcp (use the server provided by the DHCP lease)",
|
||||
"type": "array",
|
||||
|
||||
@@ -840,6 +840,29 @@
|
||||
true
|
||||
]
|
||||
},
|
||||
"vendor-class": {
|
||||
"type": "string",
|
||||
"default": "OpenLAN",
|
||||
"examples": [
|
||||
"OpenLAN"
|
||||
]
|
||||
},
|
||||
"request-options": {
|
||||
"type": "array",
|
||||
"default": [
|
||||
43,
|
||||
60,
|
||||
224
|
||||
],
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 255,
|
||||
"examples": [
|
||||
43
|
||||
]
|
||||
}
|
||||
},
|
||||
"use-dns": {
|
||||
"type": "array",
|
||||
"items": {
|
||||
|
||||
@@ -947,6 +947,31 @@
|
||||
true
|
||||
]
|
||||
},
|
||||
"vendor-class": {
|
||||
"description": "Include the provided vendor-class inside DHCP requests",
|
||||
"type": "string",
|
||||
"default": "OpenLAN",
|
||||
"examples": [
|
||||
"OpenLAN"
|
||||
]
|
||||
},
|
||||
"request-options": {
|
||||
"description": "Define additional DHCP options to request inside DHCP requests",
|
||||
"type": "array",
|
||||
"default": [
|
||||
43,
|
||||
60,
|
||||
224
|
||||
],
|
||||
"items": {
|
||||
"type": "integer",
|
||||
"minimum": 1,
|
||||
"maximum": 255,
|
||||
"examples": [
|
||||
43
|
||||
]
|
||||
}
|
||||
},
|
||||
"use-dns": {
|
||||
"description": "Define which DNS servers shall be used. This can either be a list of static IPv4 addresse or dhcp (use the server provided by the DHCP lease)",
|
||||
"type": "array",
|
||||
|
||||
Reference in New Issue
Block a user