Creating DataScripts in the Avi UI
This article covers creation of DataScripts via the Avi UI.
Log into the Avi Controller, navigate to Templates -> Scripts, and click on the DataScripts sub-tab, as shown below.
The DataScript Editor
- Name: Choose a string descriptive of the DataScript’s purpose.
- Request/Response Event Script fields: Either by entering syntax directly into the window or by uploading a pre-existing file, supply the DataScript logic to be applied to an inbound request or an outbound response. No save operation is possible until one or both of these windows has been used to supply some valid DataScript syntax.
An attempt to save invalid syntax will result in the immediate display of an error, as illustrated below.
- Syntax errors are detected and reported when saving a new or modified DataScript. Run-time errors can only be detected after the DataScript is placed into operation. When a DataScript execution encounters a failure at run-time, script execution aborts for the particular HTTP request or response. An HTTP Internal Server Error is sent to the client and a client log is generated with the stack trace of the aborted script to aid in debugging.
- When creating DataScripts for upload, save them in plain-text files to avoid syntax errors that might be induced by “fancy characters” such as curly quotes and the like.
- Pools, Pool Groups, IP Groups, and String Groups fields: Identify any of these entities if their existence is required for proper execution of the DataScript being created. As shown below, in each case the editor offers a pulldown of pre-existing entities from which selections can be made. A Create option is offered, should the user prefer to immediately create the entity, rather than postponing such for a later time. Starting with release 17.1.2, when the list is very long, the Search field permits one to rapidly cull through the list by typing the first few characters of the desired entity.