Restarting an FPC
This example simply restarts a Flexible PIC Concentrator (FPC) and slightly modifies the output of the
request chassis fpccommand to include the FPC number that is restarting.There is no JUNOS Extensible Markup Language (XML) equivalent for the
request chassiscommands. Therefore, this script uses therequest chassis fpccommand directly rather that using a remote procedure call (RPC). For more information, see Using RPCs and Operational Mode Commands.<?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>Testing ex-fpc.xsl
To test the example in this section, perform the following steps:
- From Restarting an FPC, copy the Extensible Stylesheet Language Transformations (XSLT) script into a text file, and name the file ex-fpc.xsl. Copy the ex-fpc.xsl file to the
/var/db/scripts/opdirectory on your routing platform.- Include the file ex-fpc.xsl statement at the
[edit system scripts op]hierarchy level:[edit system scripts op]file ex-fpc.xsl;- Issue the
commit and-quitcommand.- When you issue the
op ex-fpcslotnumbercommand, the output looks like this:user@host>op ex-fpc slot 0Restarting the FPC in slot 0. To verify, issue the "show chassis fpc" command.