The script vyos-1x/scripts/override-default was invented to support the exchange of the defaultValue XML node.
The first use case was to replace the 1500 byte MTU inherited from the ethernet interfaces by 1492 for PPPoE interfaces and now this approach is used to replace other values like ttl.
There is one "missing" feature in this script, as this only works, if the node that we are "overrideing" already contains a defaultValue.
Imagine a "service" or "interface" that want's to to reuse the generic port-number XML building block:
#inlcude <include/port-number.xml.i> <leafNode name="port"> <defaultValue>8472</defaultValue> </leafNode>
And simply define a port number here (this is an example for VXLAN), it does not work.
overridding default in mtu, path 'interfaces l2tpv3'
overridding default in mtu, path 'interfaces wireguard'
overridding default in mtu, path 'interfaces wwan'
overridding default in mtu, path 'interfaces macsec'
Traceback (most recent call last):
File "/vyos/vyos-1x/scripts/override-default", line 102, in <module>
main()
File "/vyos/vyos-1x/scripts/override-default", line 99, in main
collect_and_override(dir_name)
File "/vyos/vyos-1x/scripts/override-default", line 69, in collect_and_override
tree = etree.parse(fname)
File "src/lxml/etree.pyx", line 3521, in lxml.etree.parse
File "src/lxml/parser.pxi", line 1859, in lxml.etree._parseDocument
File "src/lxml/parser.pxi", line 1885, in lxml.etree._parseDocumentFromURL
File "src/lxml/parser.pxi", line 1789, in lxml.etree._parseDocFromFile
File "src/lxml/parser.pxi", line 1177, in lxml.etree._BaseParser._parseDocFromFile
File "src/lxml/parser.pxi", line 615, in lxml.etree._ParserContext._handleParseResultDoc
File "src/lxml/parser.pxi", line 725, in lxml.etree._handleParseResult
File "src/lxml/parser.pxi", line 654, in lxml.etree._raiseParseError
File "build/interface-definitions/interfaces-vxlan.xml", line 377
lxml.etree.XMLSyntaxError: error parsing attribute name, line 377, column 28
Failed to load interface definition file build/interface-definitions/interfaces-vxlan.xml
error parsing attribute name, line 377, column 28 (interfaces-vxlan.xml, line 377)
<string>:0:0:ERROR:RELAXNGV:RELAXNG_ERR_INTEREXTRA: Extra element children in interleave
build/interface-definitions/interfaces-pppoe.xml:4:0:ERROR:RELAXNGV:RELAXNG_ERR_CONTENTVALID: Element node failed to validate content
Interface definition file build/interface-definitions/interfaces-pppoe.xml does not match the schema!
<string>:0:0:ERROR:RELAXNGV:RELAXNG_ERR_INTEREXTRA: Extra element children in interleave
build/interface-definitions/interfaces-tunnel.xml:4:0:ERROR:RELAXNGV:RELAXNG_ERR_CONTENTVALID: Element node failed to validate content
Interface definition file build/interface-definitions/interfaces-tunnel.xml does not match the schema!
make[2]: *** [Makefile:23: interface_definitions] Error 1
make[2]: Leaving directory '/vyos/vyos-1x'
make[1]: *** [debian/rules:25: override_dh_auto_build] Error 2
make[1]: Leaving directory '/vyos/vyos-1x'
make: *** [debian/rules:19: build] Error 2The root cause is that this only works if the building block we leverage already contains a <defaultValue>123</defaultValue> setting. If this behavior would be changed we can increase the re-usage of such building blocks and make the already generic CLI implementation even more generic.
@jestabro as you invented this, could you be so kind and check that up? Thanks!