Skip to content
This repository has been archived by the owner on Jan 16, 2019. It is now read-only.

Commit

Permalink
Merge 3224f96 into b69c73b
Browse files Browse the repository at this point in the history
  • Loading branch information
The-Loeki committed Jun 6, 2017
2 parents b69c73b + 3224f96 commit 09506f0
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions napalm_ios/ios.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,8 @@ def __init__(self, hostname, username, password, timeout=60, optional_args=None)
self.password = password
self.timeout = timeout

self.transport = optional_args.get('transport', 'ssh')

# Retrieve file names
self.candidate_cfg = optional_args.get('candidate_cfg', 'candidate_config.txt')
self.merge_cfg = optional_args.get('merge_cfg', 'merge_config.txt')
Expand Down Expand Up @@ -114,7 +116,7 @@ def __init__(self, hostname, username, password, timeout=60, optional_args=None)
except KeyError:
pass
self.global_delay_factor = optional_args.get('global_delay_factor', 1)
self.port = optional_args.get('port', 22)
self.port = optional_args.get('port', {'ssh': 22, 'telnet': 23}[self.transport])

self.device = None
self.config_replace = False
Expand All @@ -124,7 +126,10 @@ def __init__(self, hostname, username, password, timeout=60, optional_args=None)

def open(self):
"""Open a connection to the device."""
self.device = ConnectHandler(device_type='cisco_ios',
device_type = 'cisco_ios'
if self.transport != 'ssh':
device_type += '_' + self.transport
self.device = ConnectHandler(device_type=device_type,
host=self.hostname,
username=self.username,
password=self.password,
Expand Down

0 comments on commit 09506f0

Please sign in to comment.