This policy framework enables scalable administration of the Web NMS server and the network elements managed by it. The primary goal of the policy engine is to enable administration of complex functions easily. In Web NMS, policies can be used to customize the behaviour of the NMS and to provide a framework for adding policies for different network elements.
Web NMS policies can be broadly classified into two categories :
The data stored in the database of Web NMS is of critical importance and human error, system crash and other disasters can result in the loss of valuable data which could prove to be costly. To overcome any such eventuality, Web NMS provides Backup Service. As the name itself indicates, backup refers to the process of taking a copy of the data and keeping it separately. In case, any data loss occurs, the backedup contents can be restored to the database and made use of. The backup of data can be taken at any time as well as any desired periodic interval. This example explains how backup of the Web NMS system can be taken using policies.
Web NMS BackupPolicy extends PolicyObject of com.adventnet.management.policydb package. The important methods of the Policy are
The"setProperties(properties p) " method sets the Base and User Properties. The User Properties are first removed in this method. They are then set to avoid duplication of Property names. The User Properties that are set are"BackUpClassNames" and"test.BackupImpl" "BackUpClassNames" is the Property name and "test.BackupImpl" is the name of the class to be invoked for backing up of Web NMS.
The user-written backup class should implement the com.adventnet.nms.startnms.BackUpInterface. The Base Properties in this Policy are helpURL, Status and Group Name. The super.setBaseProperties() method is invoked to set the Base Properties.
getProperties() method returns the Base and UserProperties.
The getPolicyObjectCustomizer() method returns the customizer class if any.
The getHelpURL() method returns the Help URL of theWebNMSBackupPolicy. The URL must be relative to the Help Directory
The executeAction() method is the main method from where the execution of the Policy begins.
Code Snippets
| public void executeAction(PolicyEvent
policyEvt)
{ String backUpClassNames = getUserProperty("BackUpClassNames"); if( backUpClassNames == null || backUpClassNames.length() == 0) { System.out.println(" No Class name is specified to run BackUp"); return; } try { com.adventnet.nms.startnms.StartWebNMSBackUp backup = new com.adventnet.nms.startnms.StartWebNMSBackUp(backUpClassNames); } |
Classpath Settings
Set the classpath as <WebNMS Home>\classes; <Web NMS Home>\ classes\AdventNetFramework.jar;
Compiling and Bundling with Web NMS
Compile it over the destination directory using the following syntax in the command prompt.
javac -d <Web NMS Home>classes WebNMSBackupPolicy.java.
If you want to write your own Policy you should make an entry in relationalclasses.conf file. A sample entry from that file is shown below :
com.adventnet.nms.policies.UserDefinedPolicy policydb RelationalPolicyObject PolicyObject
To work on the Policy from the client end make an entry in Policy.conf file
Policy.conf file sample
<POLICY
classname="com.adventnet.nms.policies.User Defined Policy"
display_name="User Defined Policy" />
(The "classname"should be the fully qualified classname of your Policy and the "display name" should be name of the policy)
Invoking the Example
This Policy is only for taking a Backup of Web NMS tables. You can write a similar Policy to create a backup for the other tables in the database.
Copyright © 1996-2002, AdventNet Inc. All Rights Reserved.