Open mihaigabi opened 5 years ago
@mihaigabi What is the output you are expecting?
I would like to get the below output:
The snapshot version for
Thanks!
The snapshot-medium is not a part of software-version but a sibling to it. So with the above implementation, it will always take the first value of snapshot-medium as the id-value(ex - /dev/da0s1a in above dataset).
You may try with something like the below.
test:
- rpc: get-snapshot-information
- args:
media: internal
- iterate:
xpath: "//snapshot-information/software-version/package[normalize-space(package-name)='junos']"
id: "../preceding-sibling::snapshot-medium[1]"
tests:
- contains: package-version, 14.1
info: "Test Succeeded! The snapshot version for <{{post['package-name']}}> on medium <{{id_0}}> is <{{post['package-version']}}>!"
err: "Test Failed! The snapshot version for <{{post['package-name']}}> on medium <{{id_0}}> is <{{post['package-version']}}>!"
I tested it locally and gives the desired output as expected. This workaround should help.
I am trying to get the junos snapshot version on an EX switch but I can't make the tool to display the correct "snapshot-medium". It is always the first in the XML. Am I doing it wrong? Thanks!
The configuration:
The result:
The XML: