|
Aim
In this topic, you will create a simple provisioning template that configures an SNMP Device. This template configures the device with the values given by user and also updates the respective field in database.
To give a brief introduction about this provisioning template, this template will aim at configuring the sysName and sysLocation OIDs from the SystemGroup of RFC1213 mib. Before executing this SNMP set operation, it will first retrieve values of the systemGroup OIDs from the database for the managed object that we are trying to provision. The current system Group values fetched from the database are rendered in a form (or screens) where the user view the values for the OIDs got from the topology database.
The second form / screen will show these OID values as fetched from the Network element or the device by doing a SNMP query to the device. The user can change the value for sysName and sysLocation parameter in the second screen which will be set to the device through a configuration task. Once the configuration is completed successfully, the sysName property is updated in the database so that the value set in the Network Element and the values in the database are synchronized.
Effort Estimate
This task can be accomplished in less than two hours.
Instructions
Creating the Provisioning Template
In the Package Explorer window, Right Click and select New->Folder to Create a new folder named provisioningtemplates under <ProjectName>\resources.
Right Click and select New->File, to Create a new file named eBon_template.xml under the folder provisioningtemplates. As a result the empty file will be created. Now copy and paste the following TAGS into eBon_template.xml file.
Create the RootNode for the Xml file by giving the below entry. Here we will specify the name of the template and the owner for this template.
|
<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE Template SYSTEM "Template.dtd"> <Template name="eBon_template" owner="root"> |
Every provisioning template should have atleast one Stage TAG as shown below.
|
<Stage label="1#"> |
Configure the InventoryInput tag to get the input from the DataBase. Inventory Input means fetching the input from DataBase.
|
<InventoryInput id="1" MOName="$TemplateParam$HOST" MOField="sysDescr" default="Unknown"/> <InventoryInput id="2" MOName="$TemplateParam$HOST" MOField="sysName" default="Unknown"/> <InventoryInput id="3" MOName="$TemplateParam$HOST" MOField="sysOID" default="Unknown"/> <InventoryInput id="4" MOName="$TemplateParam$HOST" MOField="community" default="Unknown"/> <InventoryInput id="5" MOName="$TemplateParam$HOST" MOField="snmpport" default="Unknown"/> |
Once the input is fetched from DB, fetch the input from the device. As our device is snmp based, we are setting the snmp protocol related properties and OIDs to fetch the input from the Network Element or device.
|
<NEInput> <ProtocolMap name="snmp"> <Device community="$InventoryInput$4" host="$TemplateParam$HOST" port="$TemplateParam$PORT" retries="3" timeout="5000" version="v1"/> </ProtocolMap> <Attribute identifier="1.1.0" label="sysDescr" default="Unknown"/> <Attribute identifier="1.4.0" label="sysContact" default="Unknown"/> <Attribute identifier="1.5.0" label="sysName" default="Unknown"/> <Attribute identifier="1.6.0" label="sysLocation" default="Unknown"/> </NEInput> |
Design two forms for user input inorder to to get the user/administrator inputs for the provisioning. The entries for the two forms are shown below.
First form entry:
This form displays all the values retrieved from the topology database. All fields in the form, except the community string are non-editable. The user can change the community string here for the device that we are going to configure, the community string provided by the user in this form will be user for the configuration task while provisioning the device.
|
<Form id="1#" title="SNMP Node Provisioning Form - Database" description="Simple template for configuring an SNMP node. Inputs that queried from the database for the managed object name $TemplateParam$HOST are shown as default values."> <UserInput id="1" label="Snmp Node Name" default="$TemplateParam$HOST" editable="false"/> <UserInput id="2" label="System Description" default="$InventoryInput$1" editable="false"/> <UserInput id="3" label="System Name" default="$InventoryInput$2" editable="false"/> <UserInput id="4" label="System Object Identifier" default="$InventoryInput$3" editable="false"/> <UserInput id="5" label="Community" default="$InventoryInput$4"/> <UserInput id="6" label="Snmp Port" default="$TemplateParam$PORT" editable="false"/> </Form> |
Second form entry:
This form displays the values retrieved by querying the device. Here the user can change the System Name and the System Location values. The new values will be configured/set in the device.
|
<Form id="2#" title="SNMP Node Provisioning Form - Device" description="Simple template for configuring an SNMP node. Inputs that queried from the device $TemplateParam$HOST are shown as default values."> <UserInput id="7" label="SNMP Agent Hostname" default="$TemplateParam$HOST" editable="false"/> <UserInput id="8" label="System Description" default="$NEInput$sysDescr" editable="false"/> <UserInput id="9" label="System Contact" default="$NEInput$sysContact" editable="false"/> <UserInput id="10" label="System Name" default="$NEInput$sysName"/> <UserInput id="11" label="System Location" default="$NEInput$sysLocation" editable="false"> <Qualifier type="choice"> <Enum name="$NEInput$sysLocation" value="$NEInput$sysLocation"/> <Enum name="Office A" value="Office A"/> <Enum name="Office B" value="Office B"/> <Enum name="Office C" value="Office C"/> </Qualifier> </UserInput> </Form> |
Configure the task to perform Provisioning and the entry should be as follows. This XML tag is responsible for configuring the device by doing an SNMP set for the OIDs 1.5.0 and 1.6.0. Here the protocol related parameters need to be set for performing SNMP set on the device.
|
<ConfigTask taskName="SnmpTask" isNewTask="true" isOverwrite="true" isSequential="false"> <ProtocolMap name="snmp"> <Device community="$UserInput$5" host="$TemplateParam$HOST" port="$TemplateParam$PORT" retries="1" timeout="5000" version="v1"/> </ProtocolMap> <Attribute identifier="1.5.0" type="4" label="sysName" value="$UserInput$10"/> <Attribute identifier="1.6.0" type="4" label="sysLocation" value="$UserInput$11"/> </ConfigTask> |
In the final step , Update the DataBase with the lastest values that have been provisioned. This is done by using InventoryUpdate tag. Any ManagedObject property can be updated in the database using the InventoryUpdate tag, here the property being updated is sysName of SnmpNode.
|
<InventoryUpdate> <MOUpdate MOName="$TemplateParam$HOST" MOClass="com.adventnet.nms.topodb.SnmpNode" isNew="false" when="onSuccess"> <Property name="sysName" value="$UserInput$10"/> <Property name="displayName" value="$UserInput$10.success"/> </MOUpdate> <MOUpdate MOName="$TemplateParam$HOST" MOClass="com.adventnet.nms.topodb.SnmpNode" isNew="false" when="onFailure"> <Property name="displayName" value="$UserInput$10.failure"/> </MOUpdate> </InventoryUpdate> |
Finish the xml with the closing tag shown below.
|
</Stage> </Template> |
Save the eBon_template.xml file, once these entries were made.
Integrating with the EMS
Copy the snmpmenu.xml located under <WebNMS Home>\mapdata\menus to <ProjectName>\resources\mapdata\menus.
Add the entries with the below details.
|
Attribute Name |
Attribute Value |
|
name |
eBon Provisioning Example |
|
action_type |
openframe |
|
action_value |
test.provisioning.TemplateNmsFrame?HOST=${name}&PORT=8001&TemplateName=eBon_Template |
The entries will be as shown below.
|
<MENU-ITEM name="eBon Provisioning Example"> <JAVA-UI action_value="test.provisioning.TemplateNmsFrame?HOST=${name}&PORT=8001&TemplateName=eBon_Template" action_type="openframe"/> </MENU-ITEM> |
Save the snmpmenu.xml file.
|
|
Note: The eBon_template.xml will be deployed under <Web NMS Home>/proviosioningtemplates directory and snmpmenu.xml under <Web NMS Home>/mapdata/menus. This will be handled while packaging the project and deploying the Nar. |
Result
This completes the customization of Provisioning service of Web NMS.
|