YAML file variables passed to robot cannot be used as lists
Closed this issue · 1 comments
If I define a list variable inside my config YAML file it will be passed to robot as scalar variable and could not be used as a list-like in for loops.
For example, I want to make sure a list of prefixes are received from my RIP neighbor. So my config file would contain:
NAT_ROUTES:
- 10.0.1.0/24
- 10.0.2.0/24
Next, in my test case file I'm doing the following:
*** Test Cases ***
Verify RIP is redistributing static NAT routes to PE CE
Expect all ${NAT_ROUTES} to be present in routing table
*** Keywords ***
Expect all ${rip_routes} to be present in routing table
${output}= enable show ip route rip
:FOR ${route} IN @{rip_routes}
\ Log ${route}
\ Should contain ${output[0]['result']['vrfs']['default']['routes']} ${route}
Which results in my testcase failing with the following error:
Verify RIP is redistributing static NAT routes to PE CE | FAIL |
Value of variable '@{rip_routes}' is not list or list-like.
The only workaround I've found is to define a list variable inside the testcase itself.
I'm not sure if this is possible with robot, looks like all variables are converted to scalar when they are passed in to .run()
. Perhaps it's possible to accomplish this with variablefile
?
Closing this as I accidentally opened it in the wrong repository. There's a https://github.com/arista-eosplus/network_validation/issues/20 opened instead