network-unit-testing-system / nuts

NUTS defines a desired network state and checks it against a real network using pytest and nornir.
https://nuts.readthedocs.io/
MIT License
106 stars 5 forks source link

Enable different identifiers in YAML-File than hosts #41

Closed bytinbit closed 1 year ago

bytinbit commented 3 years ago

@ubaumann raised a good issue in his PR #34 : Currently, the host is the identifier in each test case of a YAML file. This is unpractical and rigid, it would be better to allow other data entries as identifier, such as tags in VRF tests as demonstrated by @ubaumann .

However, this requires a larger refactoring of the code base. PR #34 suggests a solution, but it has several drawbacks, one of which is that the context has to be loaded twice just so that the data fro the YAML can be unpacked, i.e. enhanced with data.

Several solutions have to be assessed before the code is refactored:

Please add further ideas in comments.

Related: #27

bytinbit commented 2 years ago

Idea: build CLI, do preprocessing of yaml file, then invoke pytest internally: https://docs.pytest.org/en/latest/how-to/usage.html#calling-pytest-from-python-code

ubaumann commented 2 years ago

In my opinion we would lose a lot of pytest features and nuts would not need to be a plugin anymore

bytinbit commented 2 years ago

it's an idea worth trying