23.01.2012 18:42, Dan Chevrie wrote:
thanks alot Pavel.
if possible, please share some example scripts which can be utilize to
push SRX configuration etc.?
Let me give you these links instead :)
http://www.juniper.net/support/products/netconf/11.4/#doc
http://www.juniper.net/us/en/community/junos/training-certification/day-one/automation-series/
http://www.juniper.net/us/en/community/junos/script-automation/library/
When you need to automate some one-time template pushing or even
relatively simple recurring config change, especially if it does not
rely on the current device state, you can just simply push a bunch of
commands though ssh. All you need is to configure rsa-keys to avoid
password auth. This approach works for any ssh CLI :)
Like this:
user@plunin:~$
user@plunin:~$ cat ./set-descr.txt
conf
set interface ge-0/0/19 descr "blah 1"
commit
q
user@plunin:~$ cat ./del-descr.txt
conf
del interface ge-0/0/19 descr
commit
q
user@plunin:~$
user@plunin:~$
user@plunin:~$ ssh junos-device.lab< ./set-descr.txt
Pseudo-terminal will not be allocated because stdin is not a terminal.
[email protected]> configure
Entering configuration mode
[edit]
[email protected]# set interfaces ge-0/0/19 description "blah 1"
[edit]
[email protected]# commit
configuration check succeeds
commit complete
[edit]
[email protected]# quit
Exiting configuration mode
[email protected]>
user@plunin:~$
user@plunin:~$ ssh junos-device.lab "show int ge-0/0/19 | match descr"
Description: blah 1
user@plunin:~$
user@plunin:~$ ssh junos-device.lab< ./del-descr.txt
Pseudo-terminal will not be allocated because stdin is not a terminal.
[email protected]> configure
Entering configuration mode
[edit]
[email protected]# delete interfaces ge-0/0/19 description
[edit]
[email protected]# commit
configuration check succeeds
commit complete
[edit]
[email protected]# quit
Exiting configuration mode
[email protected]>
user@plunin:~$
user@plunin:~$ ssh junos-device.lab "show int ge-0/0/19 | match descr"
user@plunin:~$
user@plunin:~$
Don't ask me, how to do this under Windows, I don't know :)
Sometimes it's preferable to generate a piece of JUNOS text config (with
curly brackets, like in the show command output) or in a form of normal
JUNOS patch (like in the 'show | compare' command output), than copy it
as a file to the device using scp and issue (remotely with ssh as shown
above) something like "load merge <filename>" or "load patch <terminal>".
--
Pavel
_______________________________________________
juniper-nsp mailing list [email protected]
https://puck.nether.net/mailman/listinfo/juniper-nsp