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

Restarting an FPC

This example simply restarts a Flexible PIC Concentrator (FPC) and slightly modifies the output of the request chassis fpc command to include the FPC number that is restarting.

There is no JUNOS Extensible Markup Language (XML) equivalent for the request chassis commands. Therefore, this script uses the request chassis fpc command directly rather that using a remote procedure call (RPC). For more information, see Using RPCs and Operational Mode Commands.

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:variable name="arguments">
        <argument>
            <name>slot</name>
            <description>Slot number of the FPC</description>
        </argument>
    </xsl:variable>

    <xsl:param name="slot"/>

    <xsl:template match="/">
        <op-script-results>
            <xsl:variable name="restart">
                <command>
                    <xsl:value-of select="concat('request chassis fpc slot ', $slot,'                                                                                                        restart')"/>
                </command>
            </xsl:variable>

            <xsl:variable name="result" select="jcs:invoke($restart)"/>

            <output>
                <xsl:text>Restarting the FPC in slot </xsl:text>
                <xsl:value-of select="$slot"/>
                <xsl:text>. </xsl:text>
                <xsl:text>To verify, issue the "show chassis fpc" command.</xsl:text>
            </output>
        </op-script-results>
    </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";

var $arguments = {
    <argument> {
        <name> "slot";
        <description> "Slot number of the FPC";
    }
}
param $slot;

match / {
    <op-script-results> {
        var $restart = {
            <command> 'request chassis fpc slot ' _ $slot _ ' restart';
        }
        var $result = jcs:invoke($restart);
        <output> {
            expr "Restarting the FPC in slot ";
            expr $slot;
            expr ". ";
            expr "To verify, issue the \"show chassis fpc\" command.";
        }
    }
}

Testing ex-fpc.xsl

To test the example in this section, perform the following steps:

  1. From Restarting an FPC, copy the Extensible Stylesheet Language Transformations (XSLT) or Stylesheet Language Alternative Syntax (SLAX) script into a text file, and name the file ex-fpc.xsl. Copy the ex-fpc.xsl file to the /var/db/scripts/op directory on your routing platform.
  2. Include the file ex-fpc.xsl statement at the [edit system scripts op] hierarchy level. If you are using the SLAX version of the script, change the filename to filename.slax.
    [edit system scripts op]
    file ex-fpc.xsl;
  3. Issue the commit and-quit command.
  4. When you issue the op ex-fpc slot number command, the output looks like this:
    user@host> op ex-fpc slot 0
    Restarting the FPC in slot 0. To verify, issue the "show chassis fpc" command.

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