aFleX Tutorial

Elements of an aFleX script

  • aFleX scripts are made up of three basic elements:
    • Events
    • Operators
    • aFleX commands
  • aFleX scripts are event-driven, which means the aFleX script is triggerd when the specified event occurs.
  • Examples:
    • HTTP_REQUEST event occurs when an HTTP request is received.
    • CLIENT_ACCCEPTED event occurs when a client has established a connection.
  • Standard Tcl operators Note: Tcl tutorial
  • Relational operators:  contains, matches, equals, starts_with, ends_with, matches_regex
  • Logical operators: not, and, or
aFleX commands
  • Used to query for data, manipulate data, or specify a traffic destination. These may be grouped into three main categories:
    • Statement commands Example: pool directs traffic to the named load balancing pool.
    • Commands that query or manipulate data Examples:
      • IP::remote_addr returns the remote IP address of a connection.
      • HTTP::header remove removes the last occurrence of the named header from a request or response.
    • Utility commands - useful for parsing and manipulating content Example: decode_uridecodes the named string using HTTP URI encoding and returns the result.
Note: aFleX is extensible. In future AX software releases, additional aFleX events and aFleX commands will be added. The list of supported Events, Operators, and Commands is available in the AX Series aFleX Reference.

aFleX configuration

  aFleX configuration is done in 2 steps:

  1. Place the aFleX script on the AX device.
    • Using the CLI
      • Use a computer with any text editor to write an aFleX script and save it as a file.
      • Use the import aflex command to import the aFleX file from the computer to the AX device.
      • aFleX CLI syntax check: aflex check script-name
    • Using the WebUI
      • With the AX’s web interface, you can directly type in aFleX scripts and save them on the AX device. In the AX WebUI, navigate to Config Mode > Service > aFleX.
    • Using the aFleX Editor
      • The aFleX Editor is a separate PC application you can use to download/upload aFleX scripts from/to the AX device. Moreover, the aFleX Editor can do syntax checking. As an editor, it also has syntax highlighting, keyword auto-completion, etc.
  2. Assign the aFleX script to VIP port
    • Using the WebUI: Config Mode > Service > SLB > Virtual Server > Port
    • CLI: AX(config)# slb virtual-server name [ipaddr] AX(config-slb vserver)# port N tcp AX(config-slb vserver-vport)# aflex script-name
aFleX statistics are available in the WebUI or CLI:
  • WebUI: Monitor Mode > Service > aFleX
  • CLI: AX# show aflex script-name

Add new comment