Open dbarrosop opened 7 years ago
You can ignore my comment, the double git confused me
Just tested briefly, it looks nice. It will need some more ordering logic though, for example with access-lists. I sent in #278, which Travis seems happy with but it doesn't look like the tests are run. It fails locally for me due to ordering issues. It could possibly work sometimes but it will be random. Perhaps an ordered dict would do it.
Out of curiosity: what happens if you load a configuration that removes an entire (sub-)block? Let's have a better example:
running-config
:
ntp server 1.2.3.4
ntp peer 5.6.7.8
Loading no ntp
I would expect to provide the diff:
- ntp server 1.2.3.4
- ntp peer 5.6.7.8
Would that be the case?
@ogenstad, yes an ordereddict is probably a good idea. Will look at your PR and at changing the logic to use an ordereddict to preserve order.
@mirceaulinic regarding the ntp case you gave, that’s exactly how it works. Check test case 1, there is a logging and a bgp neighbor examples that I think behave as you described.
This framework does two things:
IndentedConfig
objects.What I would like to do is have people help testing (2). To do it you need to create a folder like this one;
test/unit/test_indent_differ/test_case_1/
. Inside, you have to put three files:cli.1.show_running_config.0
. A configuration file retrieved from a device with a poor configuration model like IOS uses.candidate.txt
. A bunch of commands you want to merge on the device.diff.txt
. The expected diff.Finally, run the test with
py.test test/unit/test_indent_differ.py::Test_Indent_differ
Feel free to send PRs against the branch
indent_differ
for tests both passing and failing. The more we have the more assurance we will have this actually works.