Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,3 +239,4 @@ Troubleshooting (Ubuntu12.04LTS or higher version)

- [Ganesh Nalawade](https://github.com/ganeshnalawade)
- [Priyal Jain](https://github.com/Jainpriyal)
- [Ruairi Carroll](https://github.com/rucarrol)
18 changes: 15 additions & 3 deletions lib/Net/Netconf/Access/ssh.pm
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,23 @@ sub start
}

# This implementation assumes OpenSSH.
my $command = $echostate . $sshprog . ' -l ' .
$self->{'login'} . ' -p ' . $rport .
' -s ' . $self->{'hostname'} .

## Lets try get some ssh key auth going
our $command;
if ( defined( $self->{'keyfile'} ) ) {
$command = $echostate . $sshprog . ' -l ' .
$self->{'login'} . ' -p ' . $rport .
' -i ' . $self->{'keyfile'} .
' -s ' . $self->{'hostname'} .
' ' . $self->{'server'};

}
else {
$command = $echostate . $sshprog . ' -l ' .
$self->{'login'} . ' -p ' . $rport .
' -s ' . $self->{'hostname'} .
' ' . $self->{'server'};
}

# take expect object from user ow build your own
if (defined $self->{'exp_obj'}){
Expand Down
13 changes: 11 additions & 2 deletions lib/Net/Netconf/Device.pm
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,19 @@ sub new
my ($class, %args) = @_;
my $self = { %args };

# Make sure we have 'login', 'hostname' and 'password'
# Make sure we have 'login', 'hostname' and 'password'. Dont need password if keyfile is set.
croak 'missing information <hostname>' unless exists $args{'hostname'};
croak 'missing information <login>' unless exists $args{'login'};
croak 'missing information <password>' unless exists $args{'password'};

## Only die if password is unset and keyfile is unset...
if (!defined($args{'keyfile'})) { croak 'missing information <password>' unless exists $args{'password'} ; }

## Only die if keyfile is unset and password is unset...
if (!defined($args{'password'})) { croak 'missing information <keyfile>' unless exists $args{'keyfile'} ; }

## check to see if the keyfile actually exists
if (!defined($args{'password'})) { croak '<keyfile> not found in specified location' unless (-e $args{'keyfile'}); }


# SAX Parser
my $handler = new Net::Netconf::SAXHandler('ErrorContext' => 5);
Expand Down
1 change: 1 addition & 0 deletions lib/Net/Netconf/Manager.pm
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ It also does error handling.
'hostname' => 'routername',
'login' => 'loginname',
'password' => 'secret',
'keyfile' => 'keyfile',
'access' => 'ssh',
'server' => 'netconf',
'command' => 'junoscript netconf',
Expand Down