Service Providers

Greg.Hankins

The Brocade OpenScript Engine: Carrier-Grade Flexibility for Scalable and Reliable Application Delivery

by Greg.Hankins on ‎02-02-2012 02:38 PM (75 Views)

We just announced software release 12.4 for the ADX which has a number of key features for service providers: the OpenScript engine, double the IPv6 performance, an XML management API, and a really snazzy new web interface with real-time dashboards.  The press release has more detail on the key features, if you are interested.


The feature that I'm most excited about is the OpenScript engine, and that’s what I want to tell you about today.  Basically, we ported the Perl programming language to the ADX application processor (BP) so that you can use APIs to control application delivery with a script.  This means you get all the Perl goodness that you know and love for writing custom scripts to read or write Layer 3 – 7 headers based on your particular application needs.  It’s pretty much infinite flexibility sauce in a can for packet headers.  The other key feature of the OpenScript engine is that you can set resource bounds and get connections per second (CPS) estimates before the script is activated, so you know the performance impact in advance.


Here’s how the OpenScript engine works.  You write a Perl script on whatever development platform you want (I personally still use vi and CVS).  Then you upload it to the ADX using the CLI or GUI.  Once the script is on the ADX, we use a multipass process for parsing and execution.  First, the script is parsed and compiled into byte code on the control plane management processor (MP).  This has a couple of advantages, the most important one being that the process doesn't interfere at all with data plane forwarding, and that parsing and activation are two distinct different steps for that rare case when you might have a syntax error.  After the script has been compiled into byte code, it can be activated on the BP in the data plane where it is run to control application delivery.

Picture1.png

So what kind of cool stuff can you do with the OpenScript engine?  Let’s look at my favorite example, using the X-Forwarded-For header.  This is an interesting example because both cases come from real customers.  One customer needed the header to be there, and the other customer required that the header be removed.  These are two completely opposite requirements that are both valid for their particular application delivery requirements.  How can we solve this problem then?  It’s really pretty simple.  Here’s a script that appends or adds the X-Forwarded-For header if it’s missing:

use OS_SLB;
use OS_HTTP_REQUEST;
use OS_IP;
sub HTTP_REQUEST {
   # copy header and source IP address
   $x_forward = OS_HTTP_REQUEST::header ("X-Forwarded-For");
   $source_ip = OS_IP::src;
   # if the header exists, append the source IP address
   if (defined $x_forward) {
      $x_forward = $x_forward.", ".$source_ip;
      OS_HTTP_REQUEST::header ("X-Forwarded-For", $x_forward);
   # if not, create the header
   } else {
      OS_HTTP_REQUEST::smileytongue:ush_header ("X-Forwarded-For", $source_ip);
   }
   # forward request to server-group 30
   OS_SLB::forward("30");
}

And here’s a script that removes the X-Forwarded-For header:


use OS_SLB;
use OS_HTTP_REQUEST;

sub HTTP_REQUEST {
   # remove "Client-IP" and "X-Forwarded-For" headers
   OS_HTTP_REQUEST::remove_header("Client-IP");
   OS_HTTP_REQUEST::remove_header("X-Forwarded-For");
   # forward request to server-group 10
   OS_SLB::forward("10");
}

Simple and elegant, isn't it?


To support OpenScript development and to foster developer interaction we created the OpenScript community, a collaboration platform where you can learn, share, and discuss dynamic data-driven application development and delivery.  You'll find the API documentation, introductory and advanced OpenScript guides, as well as lots of validated example scripts provided by Brocade on the community site.  You can also contribute your own custom scripts to the community.


To learn more about the OpenScript engine, you can download the technical brief that goes into detail about the technology and has some more real-world examples.  Or you can head on over to the OpenScript community to look at some example scripts, and to share ideas.


For more information on Brocade’s application delivery solutions, please visit the Brocade ADX product page.  To download the Brocade ADX 12.4 software release with the OpenScript engine feature, visit my.brocade.com or contact your primary support provider.