The source code below is also available from the following GitHub locations:
SLAX Script Contents
01 Version 1.0;
02 ns junos = "http://xml.juniper.net/junos/*/junos";
03 ns xnm = "http://xml.juniper.net/xnm/1.1/xnm";
04 ns jcs = "http://xml.juniper.net/junos/commit-scripts/1.0";
05 ns ext = "http://xmlsoft.org/XSLT/namespace";
06
07 import "../import/junos.xsl";
08
09 /*
10 * This commit script checks that any interfaces with "CORE" or "core"
11 * in the description is configured with an MTU of 4484.
12 * The search criteria and MTU should be changed to fit the environment
13 * and requirements.
14 */
15
16 match configuration {
17 for-each (interfaces/interface) {
18 var $int = name;
19 var $unit = unit/name;
20 var $desc = unit/description;
21 var $mtu = mtu;
22 if (contains($desc, "CORE") || contains($desc, "core")) {
23 if (not ($mtu == 4484)) {
24 <xnm:warning> {
25 <message> {
26 expr "MTU on backbone interface";
27 expr $int;
28 expr ".";
29 expr $unit;
30 expr " is not set to 4484";
31 expr " (";
32 expr $mtu;
33 expr ")";
34 }
35 }
36 }
37 }
38 }
39 }
XML Script Contents
01 <?xml version="1.0"?>
02 <script>
03 <title>backbone-mtu.slax</title>
04 <author>jpanagos</author>
05 <synopsis>
06 This commit-script checks that any interface with "CORE" or "core" in the description is configured with an MTU of 4484.
07 </synopsis>
08 <coe>commit</coe>
09 <type>interfaces</type>
10
11 <description>
12 The search criteria and MTU should be changed to fit the environment and requirements.
13 </description>
14
15
16 <xhtml:script xmlns:xhtml="http://www.w3.org/1999/xhtml"
17 src="../../../../../web/leaf.js"
18 type="text/javascript"/>
19 </script>