[135590] in North American Network Operators' Group
Re: Upload config to juniper
daemon@ATHENA.MIT.EDU (Jimmy Hess)
Wed Jan 26 21:34:04 2011
In-Reply-To: <AANLkTinEpsHaVcro9io3gCpHeCKwpNHg9zBSAY+7oZKJ@mail.gmail.com>
Date: Wed, 26 Jan 2011 20:31:26 -0600
From: Jimmy Hess <mysidia@gmail.com>
To: Florin Veres <florin@futurefreedom.ro>
Cc: nanog@nanog.org
Errors-To: nanog-bounces+nanog.discuss=bloom-picayune.mit.edu@nanog.org
On Mon, Jan 24, 2011 at 7:39 AM, Florin Veres <florin@futurefreedom.ro> wrote:
> Hey guys,
> Do any of you have any idea if it's possible to upload configuration from a
> script (prefix-list updates in this case) to a JunOS device (MX)?
> For Cisco devices I'm doing it using rcp.
>From config mode use a "load merge" command that specifies a SCP or FTP URL.
You'll need to setup SSH keys in advance to do so without an
additional password for the device to download the script.
Alternatively... SCP the file to a temporary file on the device then
"load merge" the uploaded file, to merge config from the script.
Net::SSH::Expect from CPAN to connect via ssh from perl.
Something like
use Net::SSH::Perl;
use Net::SSH::Expect;
my $ssh = Net::SSH::Expect->new( host =>
'myfavoritehostname.example.com', user => 'blahblahblah', password =>
'1234', raw_pty => 1);
$ssh->login(q[blahblah@myfavoritehostname.example.com's password]);
$output1 = $ssh->exec("configure private");
# $blah = $ssh->exec("load merge
username@scriptserver.example.com:/path/to/scriptfile_to_load.txt");
print scalar $ssh->exec("show | compare");
# commit
--
-JH