Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Panel

Table of Contents
maxLevel3

Introduction

Universal Extensions are developed by adhering to a simple API.  This API is provided by the Universal Extension base package. The concise API documentation can be found here: /wiki/spaces/UC71x/pages/5180148.

Universal Extension Base Package

The Universal Extension Base Package (universal_extension) is a Python package provided by Stonebranch that contains a collection of classes and functionality required to develop Universal Extensions.  This package is distributed with the Universal Agent.  It is automatically installed with all installation types for all platforms that support Universal Extensions.  The package resides within a zip archive (universal_extension.zip) and is installed to the following locations:

WindowsC:\Program Files\Universal\UAGSrv\uext\universal_extension.zip
Unix/opt/universal/uagsrv/uext/universal_extension.zip

Extension Class

An Extension implementation must provide a Python class named Extension that derives from the Universal Extension base class UniversalExtension and resides in a file named extension.py

...

Code Block
languagepy
titleMinimum Extension implementation requirement (extension.py)
linenumberstrue
"""Minimum Universal Extension implementation."""
from universal_extension import UniversalExtension
from universal_extension import ExtensionResult
 
class Extension(UniversalExtension):
    """Universal Extension sample module."""
 
    def __init__(self):
        """Init class."""
        super(Extension, self).__init__()
 
    def extension_start(self, fields):
        """Universal Extension primary operation."""
 
        return ExtensionResult()

ExtensionResult Class

The ExtensionResult class is the required return type from all Universal Extension work requests.  It can be seen in the code snippet above returning from extension_start.  Each type of work request supports a different set of parameters that are used to return information from that request type back to the Controller.  The parameters are all optional, and appropriate defaults are set.  However, it would usually not make sense to return without setting some parameters (as in the code snippet above).  The use of ExtensionResult will be discussed further in the context of the specific work request types documented below.

Work Requests

Universal Extensions support three types of work requests from associated Universal Extension tasks in the Controller: Task Execution, Choice Commands, and Dynamic Commands.  These work requests are described below. 

Task Execution (extension_start)

Task Execution is the primary operation of a Universal Extension task.   This is the work request that results from launching a task.  All Extensions must implement extension_start. This is accomplished by adding a method named extension_start with the following signature to the Extension class in file extension.py.

...

Upon execution, the extension_start implemented above would result in the following output in the associated task instance in the Controller:

Choice Commands

Choice Commands support the task definition process in the Controller.  They allow a drop-down "Choice Field" on a task definition form to call down to a Universal Extension on an agent system and retrieve data to populate the drop-down.  This can be used to satisfy any number of scenarios but, typical use cases would be to pull values from a third-party system that may be needed to define the work the task is intended to perform (for example, job names, file names, modes of operation, etc.).

...

Execution, the Choice Command implemented above would result an associated Choice field drop-down in the Controller being populated:

Dynamic Commands

Dynamic Commands are intended to support the functionality of the Primary Operation of the Universal Extension (task execution). 

...

Additionally, the results of Dynamic Commands are persisted with the task instance and can be viewed on the Output tab of the task instance.

Publishing Events

With the 7.2.0.0 release, the ability to publish events was added to the Universal Extension API to extend the Controller's monitoring capabilities. This new addition has a multitude of use cases. For instance, Extensions can now be used to implement a custom Database Monitoring solution; Extensions publish events containing data from a database which Universal Monitors can use to detect a desired event. 

...

Once the sample-monitor-task is launched, the sample-1-task will automatically be launched as well. The sample-1-task will publish an event every second. Once the condition specified in the sample-monitor-task is met, both tasks will end up in the "Success" state.

Output Only Fields (update_extension_status/update_output_fields)

Universal Extensions provide support for an “Output Only” type field.  This is a field defined in a Universal Template of type Extension that is given a restriction of Output Only.

...

The animation below shows the task instance form being updated (note the refresh icon at the top right of the task instance form was clicked continuously for the real-time updates):


< Previous     Next >