+ ${rcode} = BuiltIn.Run Keyword And Return Status
+ ... OpenStackOperations.Check If Console Is VmInstance
+ ... ${console}
+ IF ${rcode}
+ ${output} = Utils.Write Commands Until Expected Prompt
+ ... ${cmd}
+ ... ${OS_SYSTEM_PROMPT}
+ ... timeout=${cmd_timeout}
+ ELSE
+ ${output} = Set Variable ${None}
+ END
+ RETURN ${output}
+ [Teardown] Exit From Vm Console ${console}
+
+Execute Command on VM Instance With PublicKey Auth
+ [Documentation] Login to the vm instance using ssh publickey in the network, executes a command inside the VM and returns the ouput.
+ [Arguments] ${net_name} ${vm_ip} ${cmd} ${user}=centos ${idfile}=/tmp/odlkey ${console}=cirros
+ OpenStackOperations.Get ControlNode Connection
+ ${net_id} = OpenStackOperations.Get Net Id ${net_name}
+ ${output} = Utils.Write Commands Until Expected Prompt
+ ... sudo ip netns exec qdhcp-${net_id} ssh -i ${idfile} ${user}@${vm_ip} -o MACs=hmac-sha1 -o ConnectTimeout=5 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o PreferredAuthentications=publickey
+ ... prompt=${OS_SYSTEM_PROMPT}
+ ... timeout=60s
+ ${rcode} = BuiltIn.Run Keyword And Return Status
+ ... OpenStackOperations.Check If Console Is VmInstance
+ ... ${console}
+ IF ${rcode}
+ ${output} = Utils.Write Commands Until Expected Prompt ${cmd} ${OS_SYSTEM_PROMPT}
+ ELSE
+ ${output} = Set Variable ${None}
+ END
+ RETURN ${output}
+ [Teardown] Exit From Vm Console ${console}
+
+Copy File To VM Instance With PublicKey Auth
+ [Documentation] Login to the vm instance using ssh publickey in the network, executes a command inside the VM and returns the ouput.
+ [Arguments] ${net_name} ${vm_ip} ${file_to_copy} ${user}=centos ${idfile}=/tmp/odlkey
+ OpenStackOperations.Get ControlNode Connection
+ ${net_id} = OpenStackOperations.Get Net Id ${net_name}
+ ${rc} = SSHLibrary.Execute Command
+ ... sudo ip netns exec qdhcp-${net_id} scp -i ${idfile} -o MACs=hmac-sha1 -o ConnectTimeout=5 -o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null -o PreferredAuthentications=publickey ${file_to_copy} ${user}@${vm_ip}:/tmp/
+ ... return_stdout=False
+ ... return_rc=True
+ BuiltIn.Should Be True '${rc}' == '0'