Junos Automation (Scripting)
Highlighted
Junos Automation (Scripting)

What tools do you use to develop Junos automation scripts?

[ Edited ]
‎09-09-2010 08:22 AM

Are there any tools available, open source, or commercial, for easy editing and development of scripts?

5 REPLIES 5
Highlighted
Junos Automation (Scripting)

Re: What tools do you use to develop Junos automation scripts?

‎09-09-2010 02:00 PM

For SLAX editing, I used jEdit (www.jedit.org).  This is freely available and there appears to be a very good "plug-in" community.  Curtis and I have put together a "SLAX mode" file to color/highlight and indent SLAX code.  This file is attached to this post.

 

Another question that tends to come up is: "Can I develop scripts directly on the device?".  The answer is yes.  You can use programs like WinSCP or ExpanDrive to mount the Junos device and edit the files directly on the box.  That being said, I do not recommend this.  If you forget to copy off your scripts to a backup server, you may lose your work.

Cheers,
-- Jeremy

@nwkautomaniac

Attachments

Highlighted
Junos Automation (Scripting)

Re: What tools do you use to develop Junos automation scripts?

‎08-12-2012 07:38 PM

Hi guys - looks like JEdit now ships with that module as standard - although the two are not the same.  I'm guessing we should use the standard distro version.

Highlighted
Junos Automation (Scripting)

Re: What tools do you use to develop Junos automation scripts?

[ Edited ]
‎08-21-2012 08:12 PM

Hi guys,

 

I'm brand new to scripting, but both of the slax.xml files -- the one that comes with the standard jedit distro and the one attached to this thread -- seem to require an additional fix to get the jedit edit mode to highlight properly.  I'm not sure if it's just me, but the whitespace within a tag is not being detected properly for me.  From a quick review of the slax.xml files, it seems the \s whitespace definition isn't being properly recognized as a regular expression:

 

==================

jedit distro slax.xml

==================

line 99 reads:

<BEGIN>(\s)+(?!&gt;)</BEGIN>

 

line 99 works better with:

<BEGIN>(/\s/)+(?!&gt;)</BEGIN>

 

 

==================

attached slax.xml

==================

line 137 reads:

<BEGIN>(\s)+(?!&gt;)</BEGIN>

 

line 137 works better with:

<BEGIN>(/\s/)+(?!&gt;)</BEGIN>

 

 

In short, it's the same fix to the same line of code; it's just located in different spots within the two different slax.xml versions.

 

The whitespace regex (\s) can be bookended using either slashes (/) or double quotes (").  I've chosen to use slashes.  

 

Any comments?

 

Cheers,
Joe

 

Highlighted
Junos Automation (Scripting)

Re: What tools do you use to develop Junos automation scripts?

‎12-09-2013 09:49 AM

Hi experts,

 

i'm another brand new to script...

and now i'm not able to successfully install plugin attached above (slax.xml) on jEdit, or what right procedure i should follow? thanks!

 

Any response is appreciate.

360软件小助手截图20131210014733.jpg

 

RE/China

Steve Zhang

Highlighted
Junos Automation (Scripting)

Re: What tools do you use to develop Junos automation scripts?

‎10-19-2015 08:28 AM

Hi Steve,

 

I had the same question as you and after some messing around I found the answer. So I'll share it here in case others run into the same question. My example is from a mac.

 

The above attached file modes.zip from Jeremy contains two files: catalog and slax.xml

 

- The slax.xml file needs to be copied to the "modes" directory, in my case /Users/myusername/Library/jEdit/modes/

 

- In the same directory there is already a "catalog" file which in my case is empty. In that file simply paste the relevant part for slax from the provided catalog file. Then you get this content (the text in bold is the added part):

 

% more catalog
<?xml version="1.0"?>
<!DOCTYPE MODES SYSTEM "catalog.dtd">

<MODES>

<!-- Add lines like the following, one for each edit mode you add: -->
<!-- <MODE NAME="foo" FILE="foo.xml" FILE_NAME_GLOB="*.foo" /> -->

<MODE NAME="slax"               FILE="slax.xml"
                                FILE_NAME_GLOB="*.slax" />

</MODES>

 

 

Next you can open files that have extension .slax using jEdit and get proper and helpful coloring.

 

Regards,

Casper

 

 

 

Feedback