O'Reilly logo

JUNOS Automation Cookbook by Adam Chappell

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

How to do it...

The following are the steps for the recipe:

  1. Start with the show-int.slax source code from the previous recipe, but this time use the new filename show-int-regex.slax.
  2. Right after the boiler-plate, declare a command-line argument that is to be user provided in order to nominate the regular expression to use:
        param $description=".*";        var $arguments = {           <argument> {           <name> "description";           <description> "Match subset of interfaces based upon           description";          }        }
  1. Modify the for-each control statement and use an XPath predicate that references the jcs:regex() function in order to test a regular expression:
       for-each ($result//                 logical-interface[jcs:regex(                   $description, description)]       ) {
  1. Copy the script to the JUNOS router—both ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required