3

I am trying to assign a variable the return value of the Keyword (Get Ipsec Pkt Stat) if a condition is true. The following is the syntax I am using, however my variable ${ipsec_stats} gets assigned None, even though the condition is being satisfied:

Run Keyword If    '${chassis_cluster}' == 'True'
...    ${ipsec_stat} =  Get Ipsec Pkt Stats   ${R0}     node=local
...    ELSE
...    ${ipsec_stat} =  Get Ipsec Pkt Stats   ${R0} 
[Return]    ${ipsec_stat}

1 Answer 1

3

run keyword if requires keywords as arguments, not variable names followed by keywords.

The correct way to assign a variable with run keyword if is to set the variable to the result of that keyword:

${ipsec_stat}=  Run keyword if  '${chassis_cluster}' == 'True'
...  Get ipsec Pkt Stats  ${R0}  node=local
...  ELSE
...  Get ipsec Pkt Stats  ${R0}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.