Using the Operational Script Policy (7.x)

Learn how to create your own custom policy and how to associate it with different components of a service's definition (organizations, services, operations, bindings, and access points).

About Policies Managing Policies Policy Manager Scripting API

Supported Platforms: 7.2

Table of Contents

  1. Introduction
  2. Configuration


The Operational Script Policy allows you create your own custom policy using custom utility scripts that you can associate with different components of a service's definition (organizations, services, operations, bindings, and access points). Scripts can be defined using JavaScript, Jython, or BeanShell script languages.

The Policy Manager Scripting API, located in the \docs\scriptDocs folder of the Policy Manager installation folder, provides a series of interfaces and classes you can use to build process-related scripts. The API includes lots of use cases and sample code you can experiment with and use as a baseline when building your own custom operational policy scripts.

You can also access the API on the Akana docs site: Policy Manager Scripting API.

Note: This policy is considered Private and is not available to the Network Director when attached to a physical service.

Configuration Options

The policy includes the following configuration options:

  • Imports: This section includes common functions that you might need to perform in your scripts that have been saved in Script objects, using the Policy Manager > Workbench > Organization > Scripts > Add Script function. The available scripts are listed in the Available Scripts tree. You can move any number of the scripts in that tree to the Imported Scripts list box. Only scripts that match the language type are available for selection in the tree.
  • Script Language: A drop-down list box that allows you to select the script language for the script to be added. Supported options: JavaScript, Jython, and BeanShell Engine script language types.
  • Expression: A text box that allows you to enter your script.
  • Test Script: A button that allows you to test the entered expression to make sure it is properly formed.


Let's take a quick walkthrough of the Policy configuration process to get you started.

Step 1: Review Script Creation Process

The first step is to review the following documentation, to become familiar with the script creation process, available tools, and the Policy Manager scripting API:

Step 2: Add Policy

In Policy Manager, to create an Operational Script Policy instance, go to Policies > Operational Policies and choose Add Policy.

Step 3: Modify Policy

When you click Modify to make changes to the Operational Script Policy on the Policy Details page, the initial policy looks like this:

To illustrate how to use the policy, we are going to add script code that will generate an Alert that we can check at the registry level.

In the Source section, select JavaScript as the Script Language, add the following code to the Expression section, and save the policy:

alerter.alert("12121212","Operational Script policy Enforced");

Step 4: Attach Policy

After you've saved your policy, attach it to a web service operation.

Step 5: Test Policy

To test the policy, send a request, and then view the Alerts portlet in the Registry of the Organization Tree. An alert is generated for each request sent.

Back to top