SSH via a Jumphost to a router

I would expect it would be like the examples in Read Until and Read Until Prompt

I wasn’t aware of that, but now I see it in the doc, so if I understood correctly it looks like you need to do something like this:

*** Keywords ***
Open Connection To JumpHost
    Open Connection    ${JUMP_HOST}    alias=jumphost 	
    Login With Public Key     ${USERNAME}    /path/to/keyfile/

*** Test Cases ***
Execute Router Test
    # Execute Command  ssh ${ROUTER_HOST}
    Open Connection    ${ROUTER_HOST}    alias=router 	
    Login 	${ROUTER_USER} 	${ROUTER_PASS}    jumphost_index_or_alias=jumphost
    ${output}=  Execute Command  show version
    Log to console    ${\n}${output}

I don’t really understand how Open Connection can connect to the router without knowing about the jumphost or it’s alias, but perhaps it doesn’t even attempt the connection until login is called?

In Login there is also an example that uses proxy_cmd which looks like it might be useful to you as well.

Dave.

1 Like