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...

We're going to create a SLAX script, rpf-tool.slax, piece by piece, that will run as a JUNOS op script and will both audit and configure the JUNOS feature rpf-check in order to implement a source address check upon the traffic received on an interface.

  1. Firstly, define the SLAX boilerplate required for all JUNOS op scripts:
      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";
  1. Then declare the command-line arguments:
      param $interface="";      param $mode="check";      var $arguments = {          <argument> {              <name> "interface";              <description> "Operate on the nominated interface only";          } <argument> ...

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