Search

1 to 10 of 29
Sort by

Discussion Reply
RE: Help about Python script for fxp0 ip recovery.

Hi simonev, Greetings, To answer your first part, how to fetch the fxp IP you could use something like below : from jnpr.junos import Device from lxml import etree with Device ( host = 'router.example.com' , use filter = True ) as dev : sax input = '<interface...



Blog Entry
Scripting How-To: Converting a Junos XML Configuration to a Junos OS CLI Configuration

You could craft a template that makes a best-effort conversion from a Junos XML configuration to a Junos OS CLI configuration as shown in the following example: From: <protocols> <bgp> <group> <name>23</name> <import>policy1<...


Blog Entry
Scripting How-To: Tracking the Failure or Success of a SLAX Script with Variables

To track the failure or success of a SLAX script, you typically look through several blocks of XML. If a certain value exists in one of more of the blocks, run a "success" block of code; otherwise, run a "failure" block of code. This would be trivial if the SLAX script had variables that you...


Discussion Post
How to write SLAX result tree to STDOUT in XML format?

I work with the following slax op script: --snip-- version 1.0; ns junos = " http://xml.juniper.net/junos/*/junos"; ns xnm = " http://xml.juniper.net/xnm/1.1/xnm"; ns jcs = " http://xml.juniper.net/junos/commit-scripts/1.0"; import "../import/junos.xsl"; match / ( <op-script-results> ( ...



Blog Entry
Scripting How-To: Output XML, HTML, or text to an output file

While the XSLT 1.1 standard was never finalized, libxslt adopted some parts of it anyway, including the <xsl:document> instruction element, which later came to be known as <xsl:result-document> in XSLT 2.0. This element is used to output XML, HTML, or text to an output file. ...


Blog Entry
How can I examine two sets of XML and figure out what's different?

The exsit "set" extension is perfect for finding identifying differences in two samples of XML. See the page titled Using set:difference() in SLAX to Quickly Figure Out What's Different for information on its usage in SLAX. #Slax #How-To #xml


Blog Entry
Scripting How-To: Space your script output

If you want spaced columns then you will want to use the jcs: printf() function. This returns a correctly spaced string which can then be displayed on the console through the jcs: output() function. The following page has an example from eol-scanner.slax that uses jcs: printf(): ...


Blog Entry
Scripting How-To: Write rtt details into an accounting profile file periodically

Writing rtt Details into an Accounting Profile File For SLAX version 1.0 and higher, the op script runs every 5 minutes, pinging the remote host and writing the rtt details into an accounting profile file . This op script is similar to op-ping-rtt.slax but without using jcs...