Page MenuHomeVyOS Platform

override-default helper should support adding defaultValues to default less nodes
Closed, ResolvedPublicFEATURE REQUEST

Description

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 2

The 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!

Details

Difficulty level
Normal (likely a few hours)
Version
-
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Internal change (not visible to end users)

Event Timeline

c-po triaged this task as Wishlist priority.
c-po created this task.
c-po changed Difficulty level from Unknown (require assessment) to Normal (likely a few hours).
c-po changed Is it a breaking change? from Unspecified (possibly destroys the router) to Perfectly compatible.

A bit of background: the error here is is a result of the Relax-NG schema requiring a leaf node to have a 'properties' entry; that is considered a sanity check by the schema author, but emerges as an issue when we moved to a modular structure for the *.xml.i include files. Leaving that restriction as-is, the solution of merging leaf nodes in the lxml script should be straightforward (the general case more intricate), so I will look at amending the override-default script.

jestabro changed the task status from Open to Needs testing.Aug 11 2021, 5:14 PM
jestabro raised the priority of this task from Wishlist to Normal.

https://github.com/vyos/vyos-1x/compare/current...jestabro:T3732

This will be merged, pending discussion on pros/cons of preprocessing vs. relaxing schema restriction.

jestabro changed the task status from Needs testing to Backport pending.Aug 11 2021, 11:33 PM
jestabro moved this task from Need Triage to Finished on the VyOS 1.4 Sagitta board.
jestabro moved this task from Need Triage to Finished on the VyOS 1.3 Equuleus board.
jestabro added a project: test.
SrividyaA set Issue type to Internal change (not visible to end users).Sep 1 2021, 10:43 AM