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.
Description
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)
Status | Subtype | Assigned | Task | ||
---|---|---|---|---|---|
Resolved | FEATURE REQUEST | jestabro | T5403 Add support for extending xml cache | ||
Resolved | FEATURE REQUEST | jestabro | T5412 Add support for extending config-mode dependencies in supplemental package |
Event Timeline
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."