Using a commit script, make a transient configuration change that sets PPP encapsulation on all SONET/SDH interfaces with the IPv4 protocol family enabled:
XSLT Syntax
<?xml version="1.0" standalone="yes"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:junos="http://xml.juniper.net/junos/*/junos"
xmlns:xnm="http://xml.juniper.net/xnm/1.1/xnm"
xmlns:jcs="http://xml.juniper.net/junos/commit-scripts/1.0">
<xsl:import href="../import/junos.xsl"/>
<xsl:template match="configuration">
<xsl:for-each select="interfaces/interface[starts-with(name, 'so-') and unit/family/inet]">
<xsl:call-template name="jcs:emit-change">
<xsl:with-param name="tag" select="'transient-change'"/>
<xsl:with-param name="content">
<encapsulation>ppp</encapsulation>
</xsl:with-param>
</xsl:call-template>
</xsl:for-each>
</xsl:template>
</xsl:stylesheet>
SLAX Syntax
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 configuration {
for-each (interfaces/interface[starts-with(name, 'so-') and unit/family/inet]) {
call jcs:emit-change($tag = 'transient-change') {
with $content = {
<encapsulation> "ppp";
}
}
}
}
To display a detailed trace of commit script processing, issue the commit check | display detail command:
[edit]
user@host# commit check | display detail
2005-06-14 12:07:30 PDT: reading commit script configuration
2005-06-14 12:07:30 PDT: testing commit script configuration
2005-06-14 12:07:30 PDT: opening commit script '/var/db/scripts/commit/transient.xsl'
2005-06-14 12:07:30 PDT: reading commit script 'transient.xsl'
2005-06-14 12:07:30 PDT: running commit script 'transient.xsl'
2005-06-14 12:07:30 PDT: processing commit script 'transient.xsl'
2005-06-14 12:07:30 PDT: no errors from transient.xsl
2005-06-14 12:07:30 PDT: saving commit script changes
2005-06-14 12:07:30 PDT: summary: changes 0, transients 2 (allowed), syslog 0
2005-06-14 12:07:30 PDT: no commit script changes
2005-06-14 12:07:30 PDT: exporting juniper.conf
2005-06-14 12:07:30 PDT: loading transient changes
2005-06-14 12:07:30 PDT: loading commit script changes(transient)
2005-06-14 12:07:30 PDT: finished loading commit script changes
2005-06-14 12:07:30 PDT: expanding groups
2005-06-14 12:07:30 PDT: finished expanding groups
2005-06-14 12:07:30 PDT: setup foreign files
2005-06-14 12:07:30 PDT: propagating foreign files
2005-06-14 12:07:31 PDT: complete foreign files
2005-06-14 12:07:31 PDT: daemons checking new configuration
configuration check succeeds
To display the configuration with the transient change, issue the show interfaces | display commit-scripts configuration mode command. If there are one or more SONET/SDH interfaces with the IPv4 protocol family enabled, the output is similar to this:
[edit]
user@host# show interfaces | display commit-scripts
... # Other configured interface types ...
so-1/2/3 {
mtu 576;
encapsulation ppp; /* Added by transient change. */
unit 0 {
family inet {
address 10.0.0.3/32;
}
}
}
so-1/2/4 {
encapsulation ppp; /* Added by transient change. */
unit 0 {
family inet {
address 10.0.0.4/32;
}
}
}
so-2/3/4 {
encapsulation cisco-hdlc; # Not affected by this script, because IPv4 protocol
# family is not configured on this interface.
unit 0 {
family mpls;
}
}
... # Other configured interface types ...