Repository navigation
Conversation
… in the lab directory The tools.network_xray plugin (loaded with the network_xray tool) can run 'netlab validate --format json' in the background while the lab is up and write the results into network_xray/validate.json, so the network-xray web page can show the validation results. * Opt-in: runs only when tools.network_xray.validate is True * tools.network_xray.validate_interval sets the interval (default: 30s) * Started after the tools by 'netlab up', stopped by 'netlab down', files removed by 'netlab down --cleanup' * Uses the plugin CLI hooks; the user CLI hooks are not changed
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
As discussed in #4015 (option 1), this adds an opt-in plugin to the network_xray tool definition, in
netsim/extra/tools/network_xray.What it does
When the user sets
tools.network_xray.validate: True, the plugin runsnetlab validate --format jsonin the lab directory while the lab is running and writes the results intonetwork_xray/validate.json. network-xray can read that file through the read-only/labmount and show the results as netlab reports them.tools.network_xray.validate.tools.network_xray.validate_intervalsets the interval (default: 30 seconds). The documentation notes that every run executes all validation tests, so VM-based labs should use a longer interval.post_shell_post_tools_start,pre_shell_pre_stop_lab,post_shell_post_cleanup) and does not touch the user CLI hooks.netlab downstops the background process,netlab down --cleanupremoves the files, andnetlab up --no-toolsdoes not start it. The process also stops when the lab snapshot disappears, after 12 hours (validate_max_hours), or after 20 failed runs in a row.pluginline; the docker commands are unchanged.Tested with FRR containers (OSPF, one validation test):
netlab up, the JSON file updates, a secondnetlab up,netlab down,netlab up --no-tools,netlab down --cleanup, withoutvalidate: True, and withplugin: []. ruff, mypy, yamllint, and the transformation/coverage tests pass.I wrote this with help from an AI coding assistant, and reviewed and tested it myself.
Happy to change names, defaults, or anything else you'd prefer.