Page MenuHomeVyOS Platform

Add support for extending xml cache
Closed, ResolvedPublicFEATURE REQUEST

Description

Add support for adding supplemental entries to the vyos.xml_ref cache.py outside of the native vyos-1x build. The cache maintains a dictionary of attributes of the XML interface-definitions for use in the config dictionary and related constructions (notably node type and default values).. Here we extend the cache generation script and add an 'update' script to manage supplemental interface-definitions.

Details

Difficulty level
Normal (likely a few hours)
Version
vyos-1.4
Why the issue appeared?
Will be filled on close
Is it a breaking change?
Perfectly compatible
Issue type
Improvement (missing useful functionality)

Event Timeline

jestabro changed the task status from Open to In progress.Jul 26 2023, 6:51 PM
jestabro triaged this task as Normal priority.
jestabro created this task.
jestabro created this object in space S1 VyOS Public.
jestabro moved this task from Need Triage to Finished on the VyOS 1.4 Sagitta board.

Adding use outline from PR for future reference; the dir vyos-1x-current below refers to a local copy of the vyos-1x source:

"Add support for adding supplemental entries to the vyos.xml_ref cache.py outside of the native vyos-1x build.

Addon packages to supplement CLI interface definitions should call generate_cache during build, and update_cache in some_package.postinst, for example:

(In debian/rules, after transcluding interface definitions:)

./vyos-1x-current/python/vyos/xml_ref/generate_cache.py --xml-dir $(TMP_DIR)/${CLI_SRC_CONF} --package-name some_package --output-path ${TMP_DIR}

(and then:)

cp $(TMP_DIR)/some_package_cache.py $(DESTDIR)/${PYTHON_CACHE_DIR}

(In debian/some_package.postinst:)

python3 /usr/lib/python3/dist-packages/vyos/xml_ref/update_cache.py

In the above, ${PYTHON_CACHE_DIR} is /usr/lib/python3/dist-packages/vyos/xml_ref/pkg_cache

Similarly, in some_package.postrm, update_cache should be called after removing the package cache from ${PYTHON_CACHE_DIR}, thus the need to maintain package specific dict caches in the subdirectory, and update the central cache."