Upload config to juniper

Mark Bassett mbassett at intelius.com
Fri Jan 28 19:44:30 CST 2011

I use the Netconf API  and send xml config snippets like so:

      <address operation="delete">
       <address operation="delete">

-----Original Message-----
From: Mark Bassett [mailto:mbassett at intelius.com] 
Sent: Friday, January 28, 2011 5:39 PM
To: Jimmy Hess; Florin Veres
Cc: nanog at nanog.org
Subject: RE: Upload config to juniper

Actually if you use the JUNOS api and the reference scripts there are
examples to do just this.

-----Original Message-----
From: Jimmy Hess [mailto:mysidia at gmail.com] 
Sent: Wednesday, January 26, 2011 6:31 PM
To: Florin Veres
Cc: nanog at nanog.org
Subject: Re: Upload config to juniper

On Mon, Jan 24, 2011 at 7:39 AM, Florin Veres <florin at futurefreedom.ro>
> 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
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 at myfavoritehostname.example.com's password]);
$output1 = $ssh->exec("configure private");
# $blah = $ssh->exec("load merge
username at scriptserver.example.com:/path/to/scriptfile_to_load.txt");
print scalar $ssh->exec("show | compare");
# commit


More information about the NANOG mailing list