Learn OpenScript

OpenScript Basics

by Derek_Kang on ‎01-04-2012 11:49 AM (805 Views)

What is OpenScript

OpenScript provides a Perl-based scripting environment to create event-driven configurations that can adapt to a real-time network environment. This Perl-based environment provides the functionality of the Perl scripting language with a series of extensions that mirror much of the capability provided by the CLI interface. Consequently, the OpenScript environment allows you to create configurations using scripts written in Perl to obtain traffic information from the ServerIron ADX and react to that information by making changes to the application switch and then respond through changes in operation. A simple example of this process could be an script that enables load-balancing based on a URL match in an HTTP request.

How OpenScript Is Executed

In a multipass Scripting Engine such as Perl, the initial phase involves scanning and parsing the input script to generate an intermediate byte code representation. The final run phase executes the generated byte code by invoking underlying machine operations associated with each node in the parsed byte code tree. Because script parsing is highly CPU-intensive it is performed entirely on the management processor (MP) of the ServerIron ADX. If the compilation succeeds on the MP, the script is downloaded to the application processor (or Barrel Processor) for installation. The BP prepares the script by generating machine byte code and binds it by inlining it in the packet processing path for the virtual server and service. The following figure shows the execution flow of OpenScript.

openscript run.gif

OpenScript Performance Estimator

The scripting engine provies the estimated performance in connections per second of a given OpenScript when you compile it. For details and an example, click here.

Using Perl on the ServerIron ADX

The Perl implementation on ServerIron ADX is based on Perl Version 5.12. It preserves the core syntax and semantics of the core language as specified at this external web site: http://perldoc.perl.org/perlsyn.html.

Script runtime behavior has been tailored for the ADX platform. Specifically, the ability to dynamically load user provided extensions during compile time via use or at runtime via require, has been disabled except for the ServerIron ADX supported extensions which are described in the OpenScript API guide and the built-in extensions listed below.

  • ersion.pm
  • exporter.pm
  • base.pm
  • strict.pm
  • warnings.pm
  • warnings::register.pm
  • vars.pm
  • Carp.pm
  • overload.pm

OpenScript Fundamentals