To develop a task,
you must first implement
During the process of setting up the task configuration interface, you must
determine what data is required to perform your task.
In the following
exposes details of the process of developing a
SNMP task is designed to enable SNMP on a Cisco Nexus device.
To proceed, you must
have the IP address of the Nexus device, the login, and the password.
You see the
annotation at the beginning of
@PersistenceCapable(detachable= "true", table = "foo_enable_snmp_config")
public class EnableSNMPConfig implements TaskConfigIf
You must provide a
PersistenceCapable annotation with a table name that is
prefixed with your module ID. You must follow this convention; because Cisco
UCS Director prevents a task from being registered if you try to use a table
name that is not prefixed with your module ID.
Next, see the
public static finald String HANDLER_NAME = "Enable SNMP for Nexus";
//configEntryId and actionId are mandatory fields
private long configEntryId
private long actionId
The handler name is
the name of the task. The name should be a unique string; you will create
problems if you use the same handler name in multiple tasks.
Each task must have
exactly as shown above. You must have corresponding getter and setters for
these two fields. These two fields are absolutely mandatory; you must have
these fields in your config object.
Next, you see the
data actually needed to perform the task:
//This is the ip address for the Nexus device on which you want to enable SNMP.
@FormField(label = "Host IP Address", help = "Host AP Address", mandatory = true,
type = FormFieldDefinition.FIELD_TYPE_EMBEDDED_LOV,
lovProvider = ModuleConstants.NEXUS_DEVICES_LOV_PROVIDER)
@USerInputField(type = ModuleConstants.NEXUS_DEVICE_LIST)
private String ipAddress = "";
@FormField(label = "Login", help = "Login", mandatory = true
private String login;
@FormField(label = "Password", help = "Password", mandatory = true
private String password;
As you review the
code sample above, note that the developer needs the following:
The IP address of the
example, an LOV is used to get this IP address. See
Annotations for more information about
annotations and LOVs.
The login and password,
which the user must enter.
To obtain these,
use the form field annotations to mark these fields as data that will be
provided by the user.
Getters and setters for each
of these fields.
Once the config
object is completed, you must mark it for Java Data Object (JDO) enhancement.
The handler object
is where you actually execute your custom code. A handler object must implement
executeCustomAction method enables you to retrieve the
corresponding config object that you developed previously to execute your code.