Metadata-Version: 2.1
Name: robotframework-sshtunnellibrary
Version: 1.0.0
Summary: SSH Tunnel Library for Robot framework
Home-page: https://github.com/C-Squad/robotframework-sshtunnellibrary
Author: C-Squad
Author-email: csquad.dev@gmail.com
License: Apache-2.0
Platform: any
Classifier: Development Status :: 5 - Production/Stable
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Topic :: Software Development :: Testing
Classifier: Framework :: Robot Framework
Classifier: Framework :: Robot Framework :: Library
Requires-Dist: robotframework
Requires-Dist: sshtunnel

# robotframework-sshtunnellibrary

SSHTunnelLibrary is a Robotframework library to support SSHTunnels. It will help to connect to remote host using SSH Local Forwarding.

## Usage
Install robotframework-sshtunnellibrary and its dependencies via pip

```
pip install -U sshtunnel
pip install -U robotframework-sshtunnellibrary
```

## Example

SSH Tunnel Library can be used with libraries like SSHLibrary, RequestLibrary, DatabaseLibrary, SeleniumLibrary to make connection to ssh, rest api, database connection, web application respectively. 

Here is an example to make SSH connection using request library via SSH Server.

``` robotframework
*** Settings ***
Library  SSHTunnelLibrary
Library  SSHLibrary

*** Variables ***
${REMOTE_HOST}=  <Remote_IP/Name>
${REMOTE_PORT}=  22 
${SSH_SERVER}=  <SSH_Server_IP/Name>
${SSH_SERVER_PORT}=  22
${SSH_SERVER_USERNAME}=  <SSH_Server_Username>
${SSH_SERVER_PASSWORD}=  <SSH_Server_Password>
${LOCAL_HOST}=  localhost
${LOCAL_PORT}=  0

${REMOTE_USERNAME}=  <Remote_host_Username>
${REMOTE_PASSWORD}=  <Remote_host_Password>

*** Test Cases ***
SSH Connection using SSH Tunnel
    # Create Tunnel
    Start SSH Tunnel  MySshTunnel  ${REMOTE_HOST}  ${REMOTE_PORT}  ${SSH_SERVER}  ${SSH_SERVER_PORT}  ${SSH_SERVER_USERNAME}  ${SSH_SERVER_PASSWORD}  ${LOCAL_HOST}  ${LOCAL_PORT}
    ${LOCAL_BIND_PORT}=  Get Local Port

    # Connection using local bind
    Open Connection     ${LOCAL_HOST}  port=${LOCAL_BIND_PORT}
    Login               ${REMOTE_USERNAME}        ${REMOTE_PASSWORD}

    # Closing the Tunnel
    Stop SSH Tunnel  MySshTunnel
```

