nokia/pysros

Add option to use SSH Tunnels

hendriksthomas opened this issue · 1 comments

Scenario
In my team's setup we use virtualized routers and connect to them using the hypervisors (Ubuntu) as jump hosts for SSH tunneling. We have used ncclient in the past and relied on it working with SSH Tunnels configured in ~/.ssh/config. This is currently not possible with pySROS though it could be.

Proposed change
Modify the definition of management::connect

def connect(*, host, port=830, username, password, yang_directory=None,

and the creation of a Connection object therein

return Connection(host=host, port=port, username=username, password=password,

to allow for an optional parameter ssh_config that is passed to the ncclient manager via the Connection constructor and set to None by default. If None, this parameter will change nothing. If this parameter is True, the ncclient will use a platform-specific value as an SSH configuration file. If set to a path, the file located at this path will be used by ncclient instead.

Advantages
It is a relatively small change and allows flexibility for users to use, test and develop scripts using pySROS through SSH tunnels.

See #3

By adding 'kwargs' to connect, one can pass additional parameters such as this ssh_config