[Contents] [Prev] [Next] [Index] [Report an Error]

<jcs:emit-change> Template

The <jcs:emit-change> template generates a <change> element, which results in a persistent change to the configuration.

This template includes the following optional parameters:

The following example demonstrates how to call this template in a commit script:

<xsl:template match="configuration">
    <xsl:for-each select="interfaces/interface/unit[family/iso]">
        <xsl:if test="not(family/mpls)">
<xsl:call-template name="jcs:emit-change">
                <xsl:with-param name="message">
                    <xsl:text>Adding 'family mpls' to ISO-enabled interface</xsl:text>
                </xsl:with-param>
                <xsl:with-param name="content">
                    <family>
                        <mpls/>
                    </family>
                </xsl:with-param>
            </xsl:call-template>
        </xsl:if>
    </xsl:for-each>
</xsl:template>

When you commit a configuration that includes one or more interfaces that have Intermediate System-to-Intermediate System (IS-IS) enabled but do not have the family mpls statement included at the [edit interfaces interface-name unit logical-unit-number] hierarchy level, the <jcs:emit-change> template adds the family mpls statement to the configuration and generates the following CLI output:

[edit]
user@host# commit
[edit interfaces interface so-1/2/3 unit 0]
    warning: Adding 'family mpls' to ISO-enabled interface
[edit interfaces interface so-1/2/3 unit 0]
    warning: Adding ISO-enabled interface so-1/2/3.0 to [protocols mpls]
[edit interfaces interface so-1/3/2 unit 0]
    warning: Adding 'family mpls' to ISO-enabled interface
[edit interfaces interface so-1/3/2 unit 0]
    warning: Adding ISO-enabled interface so-1/3/2.0 to [protocols mpls]
commit complete

The content parameter of the <jcs:emit-change> template provides a simpler method for specifying a change to the configuration. For example, consider the following code:

<xsl:with-param name="content">
    <family>
        <mpls/>
    </family>
</xsl:with-param>

The <jcs:emit-change> template converts the content parameter into a <change> request. The <change> request inserts the provided partial configuration content into the complete hierarchy of the current context node. Thus, the <jcs:emit-change> template changes the hierarchy information in the content parameter into the following code:

<change>
    <interfaces>
        <interface>
            <name><xsl:value-of select="name"/></name>
            <unit>
                <name><xsl:value-of select="unit/name"/></name>
                <family>
                    <mpls/>
                </family>
            </unit>
        </interface>
    </interfaces>
</change>

If a transient change is required, the tag parameter can be passed in as 'transient-change', as shown here:

<xsl:with-param name="tag" select="'transient-change'"/>

The extra quotation marks are required to allow XSLT to distinguish between the string "transient-change" and the contents of a node named "transient-change". If the change is relative to a node other than the context node, the parameter "dot" can be set to that node, as shown in the following example, where context is set to the [edit chassis] hierarchy level:

<xsl:with-param name="dot" select="chassis"/>

[Contents] [Prev] [Next] [Index] [Report an Error]