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 don't need to capture any detailed output from the operation of our event script in this recipe, so we can skip the steps associated with ensuring that we have a valid output destination and a compatible SSH/SCP server, and jump straight into the code.

  1. Create a new SLAX script, handle-link-flap.slax, composed of three parts. First the mandatory event script boilerplate:
        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. Secondly, create the configuration template that we'll apply if we need to disable the interface:
       template disable-interface($interface, $comment) { <configuration> ...

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