Ems Tutorial
Ems Tutorial
Ems Tutorial
Table Of Contents
EMS TUTORIAL ........................................................................................................ 3
1.1 Foreword........................................................................................................................ 4
1.2 Introduction .................................................................................................................... 8
1.3 EMS Tutorial Tour........................................................................................................ 10
1.4 Application Overview ................................................................................................... 11
5. IMPLEMENTATION ............................................................................................. 28
5.1 Creating EMS Project .................................................................................................. 30
5.2 Modeling the Switch and Its Components ................................................................... 31
5.2.1 Managed Resource Modeling............................................................................................... 32
5.2.2 Customizing TrunkPort Object.............................................................................................. 35
5.2.3 Customizing Port Object for Status Polling........................................................................... 36
5.2.4 Customizing Other Objects................................................................................................... 38
AdventNet, Inc.
AdventNet, Inc.
EMS Tutorial
AdventNet, Inc.
4900 Hopyard Rd., Suite 310
Pleasanton, CA 94588, USA
Phone: +1-925-924-9500
Fax : +1-925-924-9600
http://www.adventnet.com
info@adventnet.com
AdventNet, Inc.
1.1 Foreword
AdventNet Web NMS aims at providing real world network management solutions to
telecommunications and enterprise markets.
It meets the demand of the market for advanced network management features.
It fulfills the need of the market for shortest possible deployment time.
EMS tutorial will demonstrate how the above market expectations are met by AdventNet Web NMS.
Metro Network
Massive scalability
High availability
Customization
o
It can be customized and extended to suit your needs. The extensibility makes the design of the
application more organized.
The customization addresses the specific needs of the application to manage your custom equipment.
Eclipse, Integrated Development Environment is a widely used open source development
environment. AdventNet now provides WebNMSEclipsePlugin which will seamlessly plug into the
Eclipse IDE and provide you with a powerful suite of Wizards and Tools that help you to develop your
management application very fast.
AdventNet, Inc.
The time taken to deploy the application is lesser compared to the conventional development
and deployment techniques.
It supports user from the level of novice to professional. The webnms plugin has wizards that
auto generate the required stub code as well as place entries in respective configuration files
making the development easier.
It liberates the user to concentrate on the business logic or the domain specific requirements
rather than learning the configurations for the WebNMS framework.
All these benefits put together will make AdventNet Web NMS a wise choice for your network
management solution.
AdventNet, Inc.
Step 3: Packaging
You can package your application resources alone as a NAR (NMS Archive file) that can be
installed over the AdventNet Web NMS.
Step 4: Deploying
The nar for Project created using the Package Properties Wizard in the Eclipse Plugin has
to be installed over Web NMS. This task can be performed using the Nar Installer present in
the Deployment Wizard. The Installer wizard with an easy- to- use interface helps you walk
through the process of installing the nar.
You can invoke the Deployment Wizard by using the WebNMS > Tools > Deployment
Wizard menu.
AdventNet, Inc.
Step 6: Testing
Before testing your management solution, make sure all the third-party packages are
installed correctly and you have the required privileges to use them for your testing. Once
you start your application, look at the Web NMS server log files to make sure all the services
are started successfully and are running.
Having deployed your application at a customer's site, you will be required to support the
product and provide upgrades as part of support. The EMS Project created using the
WebNMS Eclipse Plugin makes it easy to handle upgrades.
AdventNet, Inc.
1.2 Introduction
The purpose of this tutorial is to guide you through designing an EMS and provide working, illustrative
examples to help you understand the choices to be made during development. This describes how
AdventNet Web NMS EclipsePlugin can be used to simplify the development of an EMS.
The Tutorial
Consider a real life scenario wherein you need to manage five Switches, which support SNMP. This
tutorial will help you achieve the same by using AdventNet Web NMS by building an EMS (Element
Management System) to manage the Switches.
The tutorial will walk through a series of steps, which will help you understand how a unique EMS
solution can be built using AdventNet Web NMS EclipsePlugin to suit your needs. Using AdventNet
Web NMS EclipsePlugin the EMS application is just a few clicks away requiring you to incorporate
only your network specific business logic. This makes the development faster.
This tutorial helps you to build only a sample application. In which, it adopts a generic network device
(i.e., a Switch, which supports SNMP) as an example. This limited scope example will serve only to
illustrate what can be built on AdventNet Web NMS and it is only a subset of the custom capabilities
of AdventNet Web NMS. However, for many EMS applications of specific needs, this basic example
can be extended.
This topic covers the following details of the tutorial:
Prerequisites
Related Information
Printed Version
Tutorial Conventions
Prerequisites
To develop this tutorial application, you will need a good knowledge of Network Management System
and basic Java Programming.
Knowledge of SQL, and relational database concepts will be an added advantage, but it is not
essential.
Related Information
This tutorial provides concise information about AdventNet Web NMS EclipsePlugin and AdventNet
Web NMS. For detailed information, refer to the Web sites listed below:
AdventNet, Inc.
Printed version
To print this tutorial, follow these steps:
1. Ensure that Adobe Acrobat Reader is installed in your system.
2. Download the PDF version of this document from the following
URL:http://www.adventnet.com/products/webnms/tutorials/ems_tutorial.pdf
3. Click the printer icon in Adobe Acrobat Reader.
Tutorial Conventions
The following table lists the typographic conventions followed in this tutorial:
Font style
Uses
Arial Bold
File name
Arial Italic
Directory
Code snippet
Build an EMS by customizing AdventNet Web NMS with the help of AdventNet Web NMS
EclipsePlugin.
Model Objects.
AdventNet, Inc.
AdventNet, Inc.
10
Application Specification
Implementation in a Nutshell
Application Specification
Name of the Application
Platform-specific
requirements
: No special requirements
AdventNet, Inc.
11
Implementation in a nutshell
The tutorial application covers various aspects of network management. Various modules of
AdventNet Web NMS are used to achieve the network management objectives as listed below:
AdventNet, Inc.
12
AdventNet, Inc.
13
2. Try It Yourself
In this section, the steps to deploy the ready built application are provided. This would help you run
the application by yourself and view the results.
The steps involved are
Start NMS
For pertinent information, refer to the following document resources in the Installation Guide of
AdventNet Web NMS 5
System Requirements
Startup Options
AdventNet, Inc.
14
Start NMS
Prior to installing the NAR, if the server was running, Stop the server then Reinitialize the WebNMS
server and Now start the server.
To Reinitialize WebNMS Server, Run reinitialize_nms.bat under <WebNMS Home>/bin directory.
(or) To reinitialize the Server from the launcher, it is essential to add EMS_Tutorial_Server.jar in the
classpath. Follow the below steps to add EMS_Tutorial_Server.jar in the classpath.
Start the Web NMS Launcher, by invoking WebNMSLauncher.bat/sh file in the <Web
NMSHOME> directory. In the WebNMS Launcher, Select Options->Settings menu. Settings
dialog screen is opened. In this dialog, select "Reinitialize Web NMS" in the left side tree.
"ClassPath" details will be seen in the Right-side panel.
Click on the Add button, a line will be added in the ClassPath text area, Now click on the
button "...", this will allow you to browse and select the EMS_Tutorial_Server.jar from the
<WebNMS Home>/NetMonitor/build directory. Now, This jar will get added in the classpath.
Now, Invoke the "Reinitialize Web NMS" icon in the Web NMS Launcher to reinitialize the
server.
Start the WebNMS Server by running startnms.sh/bat under <WebNMS Home>/bin directory.
Alternatively you can also start the server from Web NMS Launcher. To start the Web NMS Server
from the launcher, it is essential to add EMS_Tutorial_Server.jar in the classpath. Follow the below
steps to add EMS_Tutorial_Server.jar in the classpath.
Start the Web NMS Launcher, by invoking WebNMSLauncher.bat/sh file in the <Web
NMSHOME> directory. In the WebNMS Launcher, Select Options->Settings menu. Settings
dialog screen is opened. In this dialog, select "Start Web NMS Server" in the left side tree.
"ClassPath" details will be seen in the Right-side panel.
Click on the Add button, a line will be added in the ClassPath text area, Now click on the
button "...", this will allow you to browse and select the EMS_Tutorial_Server.jar from the
<WebNMS Home>/NetMonitor/build directory. Now, This jar will get added in the classpath.
Now, Invoke the "Start Web NMS Server" icon in the Web NMS Launcher to Start the
server.
AdventNet, Inc.
15
On double-clicking the individual Switch nodes, you can see the Chassis view of the individual
switches.
The Switch elements have right-click menu with four menu items, viz., Alerts, Events,
Configuration, Chassis View. Select Chassis View menu item will display the Chassis view
of the Switch element.
AdventNet, Inc.
16
Alerts from the Switch Device and Sub-components and Its Propagation
Right-click a device and select Alerts from the pop-up menu to see its alerts. The following
diagram depicts how events are propagated from a child node (Port) to the parent container
(Card) and how they are correlated to generate more meaningful alarms.
AdventNet, Inc.
17
AdventNet, Inc.
18
3. Application Design
Aim
To come up with the design on customizing the AdventNet Web NMS platform features in order to
provide various functions to the EMS, as specified in the requirements.
Tasks
Define the resources to be managed by the EMS. The properties of the Device and its
Components that will be used for modeling the resources are given below:
Switch
Shelf
Slot
Card
Port
Access Port
Trunk Port
Trunk
serialno, location
serialno
slotno, state
serialno, cardType
portno, speed, snmpInterface, switchnode
remoteID, remoteStatus, portType
trunk, remotePortID, portType
source, destination, srcPort, destPort, bandwidth
AdventNet, Inc.
19
Tasks
Create a Discovery Filter defining the containment hierarchy of the device and its
components.
Tasks
Create a criteria map to filter out all the Switches and display in a separate map
Create a MapFilter class that will create links to visually represent the Trunk objects
connecting the switches on the criteria map
Tasks
Tasks
Identify the Configuration commands to activate and deactivate the Switch Card.
AdventNet, Inc.
20
Tasks
Replace the existing AdventNet & Web NMS images and logo with Acme.
Internationalize the text and buttons that appear in the Client of the EMS.
AdventNet, Inc.
21
2.
The former is a quick solution requiring minimal design effort but a cumbersome design. The later is a
cleaner design. The second choice will serve our application needs better, because it provides a neat
design. This approach also results in a better table structure for storing our objects in an RDBMS.
Hence, the second approach is adopted in this tutorial.
ManagedObject
TopoObject
Network
Node
SNMP Node
IP Address
SNMP Interface
: This object represents an IP interface with an SNMP Agent in its parent node.
AdventNet, Inc.
22
Shelf
: The switch consists of one or more shelves. For this example, we will
work with only one shelf, though the example can be extended to
multiple shelves.
Slot
Card
Port
: Each card can have multiple ports. A port can be an access port or a
trunk port.
Trunk
These components are modeled in the Web NMS topology database and these definitions are used to
build an EMS functionality into our application.
AdventNet, Inc.
23
Switch
Shelf
Slot
Card
Note: Another benefit of this ManagedObject property, namely ParentKey is, it
allows for quick look up of the component object hierarchy as required when
propagating alarms.
AdventNet, Inc.
24
serialno, location
serialno
slotno, state
serialno, cardType
portno, speed, snmpInterface, switchnode
remoteID, remoteStatus, portType
trunk, remotePortID, portType
source, destination, srcPort, destPort, bandwidth
Switch
The Switch object will extend an SNMP Node object instead of ManagedObject directly. This is
because our example assumes the switch supports SNMP and will be discovered as an SNMP Node.
In your case, if the switch does not support SNMP you may extend node or ManagedObject directly
as appropriate. We will provide the following additional properties in the switch, in addition to what is
available in an SNMP Node class:
Location
Serial
number
Shelf
The Shelf object will extend ManagedObject. We will provide the following additional properties in the
shelf, in addition to what is available in a ManagedObject class:
Serial
number
Slot
We will create a ManagedObject subclass to model the Slot. We will provide the following additional
properties in the slot object, in addition to what is available in a ManagedObject class:
Slot number : The slot number is the identification of position on the shelf.
State
Card
The Card object is modeled using a ManagedObject subclass. We will provide the following additional
properties in the card object, in addition to what is available in a ManagedObject class:
Serial
number
Card Type
AdventNet, Inc.
25
Port
The Port object is also directly sub classed from ManagedObject. To capture the containment of ports
in switches, we will add a property to capture this relationship. We do not keep a reference to the
switch, but rather store the key that identifies the switch that we can query from the database. We will
provide the following additional properties in the port object, in addition to what is available in a
ManagedObject class.
SNMP
Interface
: The network interface object (IP Address) associated with this port, if
any.
Port number : The port number is the identification of position on the card.
Speed
Note: The Switch Node property will help us in querying for all ports of a particular
type belonging to a switch, as we do in the discovery filter for linking switches using
trunks.
We add this property to this port object so that we can make the query quickly and
easily. But this is not a must. We can also get the TrunkPorts of a given switch by
traversing/scanning recursively across the containment hierarchy using the
getChildrenKeys() method of the ManagedObject. Or we can also use SQL queries,
fired from the discovery filter, under database mode. Only the query will be
somewhat complicated.
AccessPort
The AccessPort object is sub classed from Port. We will provide the following additional properties in
the AccessPort object, in addition to what is available in the port class:
Remote ID
Remote
Status
portType
TrunkPort
The TrunkPort object is sub classed from port. We will provide the following additional properties in
TrunkPort object, in addition to what is available in the port class:
Trunk
: The trunk that terminates on this port. This is a reference to the trunk
object.
Remote Port
ID
portType
AdventNet, Inc.
26
Trunk
The Trunk object is sub classed from ManagedObject. We will provide the following additional
properties in the trunk object, in addition to what is available in the ManagedObject class:
Source
Destination
Source Port
Destination
Port
: The port on which this trunk terminates, i.e., the port on the destination
switch.
Bandwidth
AdventNet, Inc.
27
5. Implementation
This tutorial application has been created using AdventNet Web NMS Eclipse Plugin. This comes
bundled with AdventNet Web NMS.
Implementation overview
Model the Managed Resource
Model your Switch devices and their components into Managed Resources of AdventNet Web
NMS Topology database. You will be filling up the Managed Resource's Name, Parent
Resource, and its attributes in the Model Managed Object Wizard. In the end, you will get the
Managed Resource's class and the corresponding Hibernate mapping file.
Build Maps, Layouts, and Other Related Files Using Maps Service and
Chassis Wizard
Modify maps.conf file to add Custom Map. Create a Map filter to display the discovered
Switches. Add custom code in this filter to represent the Trunk object as a link between the
switches in the map. Configure mapIcon.data file to specify map iconName, its corresponding
device type and the menuName. Create a Chassis view and other related screens for the
Switch using Chassis Wizard.
AdventNet, Inc.
28
guest
root
Configure authorization for the Users to carryout various operations using the Security
Administrator Tool.
Rebrand the Application Using the Rebranding Tool and i18N Editor
Tools
Change the splash image, logo, and frame icons etc. in the Rebranding tool and Company
Name, Product, and Version in the i18N Editor tool.
AdventNet, Inc.
29
Instructions
Follow the steps given below to create the project.
- EMS_Project
- C:\AdventNet\WebNMS
Leave it unchecked
Click Finish.
You will find the created project under the Package Explorer tree
Result
The Workspace for the Project is now created. Using the Model Managed Object Wizard, we will
see how to model the Switch Device and its components in the next section. You can proceed with
modeling the device. You can also invoke the wizard by clicking WebNMS > Modeling > Model
Managed Object menu.
AdventNet, Inc.
30
Managed
Resource
Switch
Shelf
Slot
Card
Port
Access Port
Trunk Port
Trunk
Properties to Be
Managed
com.adventnet.nms.topodb.SnmpNode
com.adventnet.nms.topodb.ManagedObject
com.adventnet.nms.topodb.ManagedObject
com.adventnet.nms.topodb.ManagedObject
com.adventnet.nms.topodb.ManagedObject
serialno, location
serialno
slotno, state
serialno, cardType
portno, speed,
snmpInterface,
switchnode
com.adventnet.nms.tutorials.ems.Port
remoteID, remoteStatus,
portType
com.adventnet.nms.tutorials.ems.Port
trunk, remotePortID,
portType
com.adventnet.nms.topodb.ManagedObject source, destination,
srcPort, destPort,
bandwidth
Refer to the Detailed resource modeling topic in Appendix to this document, for more explanation
about the Modeled Resources and their Properties.
This chapter explains the procedure to model the Managed Resources of EMS, using AdventNet Web
NMS EclipsePlugIn.
The topics in this chapter cover the following procedures:
AdventNet, Inc.
31
Instructions
The Switch system consists of seven major components. The components with a short description is
given below.
Switch
: This represents a manageable switch that is initially discovered via SNMP, i.e., Web
NMS finds it as an SNMP Node in the network or is manually added by an operator.
Shelf
: The switch consists of one or more shelves. For this example we will work with only
one shelf, though the example can be extended to multiple shelves.
Slot
Card
: Each slot consists of a card, which can be of different types. In this example, we will
work with only one card type. The card object has a field called Card type to specify
the card type.
Port
AccessPort
: A port can be an access port or a trunk port. The AccessPort class is a subclass of
port and models a port on an access card.
TrunkPort
Trunk
: This models a link between switches, i.e., a trunk connecting two switches.
com.adventnet.nms.tutorials.ems
Switch
AdventNet, Inc.
32
Parent Resource
Properties to Be Managed
Select the project or source folder in the Package Explorer, you can notice
Generate Java Source menu. (or) Select WebNMS > Modeling > Generate Java
Source menu. Java Source Generator screen pops up.
AdventNet, Inc.
33
In Java Source Generator screen , select the Xml file (multiple Xml files can also
be selected) for Generating Java Source and click >> button.
Select the source folder to generate the Java source.
Click OK.
Compile the Shelf, Slot, Card, Port, AccessPort, TrunkPort, and Trunk nodes.
The details of the custom code meant for TrunkPort object added to the Managed Resource class are
discussed in the next topic.
AdventNet, Inc.
34
java.sql.*;
com.adventnet.nms.severity.SeverityInfo;
com.adventnet.nms.topodb.TopoAPI;
com.adventnet.nms.util.NmsUtil;
For providing the above two convenience methods, you have to write the custom code in the
TrunkPort source file directly.
Add the User code as given below at the end before the last "}":
public TrunkPort getRemotePort()
{
if (trunk == null) return null;
try {
Trunk trunkObj = (Trunk)((TopoAPI)
NmsUtil.getAPI("TopoAPI")).getByName(trunk);
if (trunkObj == null) return null;
if (getName().equals(trunkObj.getSrcPort()))
return (TrunkPort)
(
(TopoAPI)(NmsUtil.getAPI("TopoAPI"))).getByName(trunkObj.
getDestPort());
if (getName().equals(trunkObj.getDestPort()))
return (TrunkPort)
((TopoAPI)(NmsUtil.getAPI("TopoAPI"))).getByName(trunkObj.
getSrcPort());
}
catch (Exception ex) {
System.err.println("Exception getting remote port: "+ex);
ex.printStackTrace();
}
return null;
}
AdventNet, Inc.
35
java.sql.*;
com.adventnet.nms.severity.SeverityInfo;
com.adventnet.nms.severity.SeverityIterator;
com.adventnet.nms.topodb.TopoAPI;
com.adventnet.nms.util.NmsUtil;
com.adventnet.snmp.beans.SnmpTarget;
The default constructor will be auto-generated with only the setClassname("Port"); call inside it. Add
the lines as below to set the Type property and the PollInterval property inside the constructor:
public Port()
{
setType("Port");
setClassname("Port");
setPollInterval(300);
}
The method below in the managed object class is called whenever status polling of this object is
scheduled. Using this method, you can directly control what happens when status polling is to be
done for this object. Also each managed object can be configured to support failure counts, i.e.,
allowing multiple failures before a managed object failure is reported to the system. This is done by
using the setFailureThreshold() method in the ManagedObject class. Here you have two methods
for the status polling of Port object. The actual status polling is done by the second method
checkObjStatus() below, which is invoked by the first checkStatus() which overrides the super class
method.
Add the User code as given below at the end before the last "}":
/** This does the real check to the managed object **/
int checkObjStatus()
{
// As an example, we'll use the interface status, ifOperStatus,
// of the node as the status of the port. We'll use the
// port number to check status of the port.
// Alarm propagation will be used to notify containers
if ((switchnode == null) || (switchnode.equals("unknown"))) {
TopoAPI tapi = (TopoAPI)NmsUtil.getAPI("TopoAPI");
String temp = getParentKey();
for (int i = 0; i < 3; i++) {
try {
if (temp != null) temp =
tapi.getByName(temp).getParentKey();
} catch (Exception ex) {
System.err.println("Exception fetching the parent "+
"switch of the port: " +getName()+ex);
return
SeverityInfo.getInstance().getSpecialPurposeSeverity();
AdventNet, Inc.
36
}
}
switchnode = temp;
}
SnmpTarget target = new SnmpTarget();
target.setTargetHost(switchnode);
int index = portno+1;
target.setObjectID("ifOperStatus."+index);
String status = target.snmpGet();
if (status == null) {
SeverityIterator s_iter = SeverityInfo.getInstance().getIterator();
s_iter.moveToHighest(SeverityInfo.LEFT); // Default. So optional.
return s_iter.getPreviousCriticality();
// MAJOR severity
}
if (status.equals("1") || status.startsWith("up")) {
return SeverityInfo.getInstance().getClear(); // CLEAR severity
}
SeverityIterator s_iter = SeverityInfo.getInstance().getIterator();
s_iter.moveToHighest(SeverityInfo.LEFT);
// Default. So optional.
return s_iter.getPreviousCriticality();
// MAJOR severity
} // end checkObjStatus()
//End User Code
The check is done to see that the interface is operational for the given index corresponding to the port
number on the card.
Based on the return value, a status update message is generated by the server. The fields of the
generated event are based on the values in the managed object.
Note: When the devices are status polled at periodic interval, the output may be
either
Status Up Events (in which case, the default severity will be Clear)
Status Down Events (in which case, the default severity will be Major)
AdventNet, Inc.
37
Switch
public Switch()
{
setType("Switch");
setClassname("Switch");
}
Shelf
public Shelf()
{
setType("Shelf");
setClassname("Shelf");
}
Slot
public Slot()
{
setType("Slot");
setClassname("Slot");
}
Card
public Card()
{
setType("Card");
setClassname("Card");
}
Trunk
public Trunk()
{
setType("Trunk");
setClassname("Trunk");
}
Result
All the Managed Resources were created and customizations were also done. The Next task is to
define a Discovery Filter to discover the Switch components.
AdventNet, Inc.
38
Adding Custom code in the source of Discovery Filter, to the achieve the following tasks:
o
AdventNet, Inc.
39
AdventNet, Inc.
40
- com.adventnet.nms.tutorials.ems
Filter ClassName
- SwitchDiscoveryFilter
Click Finish.
You will find the <Discovery Filter class> under <Your Project>/source folder in the Project Explorer
window. You can add the custom code or modify the existing code of the source using the editor
directly as per your requirement.
The corresponding entry for this Discovery Filter implementation class will be inserted in the
discovery.filters file present in <Your Project>/resources/conf directory. You can rearrange the order
of the discover filter entry in this file as per your requirement as each Managed Object discovered in
WebNMS will be passed through all the discovery filters listed in the discovery.filters conf file.
The details of the custom code added to the Discovery filter class is discussed in four parts.
AdventNet, Inc.
41
AdventNet, Inc.
42
if ((warmstart)) {
// We will have the first 5 SnmpNodes as carrier class
// switches for this example.
if(((!(switch_name_vect.contains(mo.getName())))&&(switch_count
>=5)))
{
return mo;
}
}
Next we handle the scenario when there is a Cold Start of the WebNMS server. Here when the
filterObject method is called for the new MO, we need to check if 5 Switches are already present in
the database, in which case the mo should be returned without processing it as a Switch. Add the
below code to achieve this. This part of the code should follow the above code.
if (switch_count >= 5)
return mo; //we are not going to convert this as a switch.
Step 2: Add the code to create a new instance of the Switch object fill its
properties by quering the device
This part of the code should follow the above code.
In the above code we are replacing the SNMPNode object passed to this discovery filter with our
custom object i.e. the Switch. You will set some properties of the switch as per our requirement. One
such property which warants a mention here is the Tester property. The Status of any Parent has to
reflect the maximum severity including the status of its children. Hence, the "Tester" property of the
AdventNet, Inc.
43
switch is set to "max". Also to assertain the containment relationship for this Switch to its subcomponents, you first have to set the isContainer property for the switch to true, so that you can add
this object as a parent for other sub-components to be added later to the topology database.
Copy over the SNMP Node properties to the switch. But before applying all properties, you would
eliminate the ones that are unique to the Switch and could be overwritten, e.g., classname. The
properties classname and type are set to Switch in the Switch Class. So, remove the properties that
are not to be updated. Then, set these properties to the new Switch object created.
Next, set some of the switch's specific properties. In reality, you will have to actually discover details
for these properties from the switch. However, you will use some arbitrary values and set the serial
number property in this example.
Add the Switch Object to the database.
Next, you will discover and add all the switch's components such as slots, ports, etc. Details on this
are provided below.
// Discover switch components' details and populate the database
getSwitchComponentsInfo(theSwitch, topoApi);
You will add trunks between switches, as described later in this section, for illustration purposes.
addTrunks(theSwitch, topoApi);
Finally, the class should return null as the switch and all its components have already been added to
the topology database. Please note that the switch object was added instead of the SNMP Node
object.
return null;
The next section covers how to add the details on each discovered device component.
AdventNet, Inc.
44
System.err.println("Exceptio
n adding shelf: " + shelf.getName()
+ ex);
rollbackTransaction(ex);
return;
AdventNet, Inc.
45
}
for (int i = 0; i < 16; i++)
addSlot(i, shelf, s, api);
}
Next, add slots as given below. Again, you need to explicitly add the slot to the database. For Slot,
Shelf is the parent Object and set the state of the slot based on the card type you are adding into the
slot. Odd-numbered slots are kept empty and even-numbered slots are plugged with Trunk and
Access Cards.
Add after the code given in the above table.
The card objects are added in a similar fashion. For cards, alternate between trunk cards and access
cards. So you will end up with four trunk cards and four access cards.
AdventNet, Inc.
46
Finally, add the port objects. Instantiate different subclasses of Port depending on the card that this
port is attached to. To illustrate getting data from the device to drive the setup of the configuration,
use the SNMPNode interfaces to determine the configuration of the ports. Check the operational
status of the interfaces and based on the status for each port index, set whether the port is managed
or not. This is done for each card.
AdventNet, Inc.
47
AdventNet, Inc.
48
commitTransaction();
} catch (Exception ex) {
System.err.println("Exception adding port: " + port.getName()
+ ex);
rollbackTransaction(ex);
}
}
Thus, for an SNMP Node with three active interfaces and index numbers 1-3, each access card will
have the first three AccessPorts as managed as well as active and the last AccessPort as
unmanaged. The trunk card will have one managed and active TrunkPort. If the interface with an
index of 1 is not active or goes down, none of the TrunkPorts will be active ports, but they are
managed.
The above discovery filter will add five switches and their related components into the topology
database.
AdventNet, Inc.
49
AdventNet, Inc.
50
trunk.setSource(source);
trunk.setDestination(destination);
trunk.setBandwidth("20MB");
// Get the next available source port
TrunkPort srcport = getTrunkPort(source, api);
if (srcport == null) {
System.err.println("No trunk port found for source: "+ source);
continue;
}
srcport.setTrunk(trunk.getName());
destport.setTrunk(trunk.getName());
trunk.setSrcPort(srcport.getName());
trunk.setDestPort(destport.getName());
srcport.setRemotePortID(destport.getName());
destport.setRemotePortID(srcport.getName());
beginTransaction();
api.addObject(trunk);
api.updateObject(srcport, false, false);
api.updateObject(destport, false, false);
commitTransaction();
}
}
catch (Exception ex)
{
System.err.println("Error in adding trunk: " + ex);
ex.printStackTrace();
rollbackTransaction(ex);
}
}
Use this method to fetch the next available free trunk port in a given switch. If the switch does not
have a free TrunkPort, the method returns null. Use the switchnode property of Port object to query
the database for ports belonging to a particular switch. You further narrow down our search by using
the property trunk with value unknown, applicable only for free TrunkPorts. Once the Trunk object is
added to the topology database, the source ports and destination ports are also updated with the
trunk name for associativity.
Add the following code after the addTrunks() method.
com.adventnet.management.transaction.UserTransactionException,java.rm
tion
{
if (switchname == null) {
System.err.println("Fetching available trunk port, switch n
null");
return null;
}
Properties poppy = new Properties();
poppy.put("switchnode", switchname);
poppy.put("trunk", "unknown");
AdventNet, Inc.
51
The trunks will be represented as map links, which will be described in the Maps section.
AdventNet, Inc.
52
All the object addition and updating has to be done within transaction blocks
Next, define method to begin transactions as this code snippet may be used very frequently.
AdventNet, Inc.
53
transaction ",
}
}
ex);//No I18N
beginTransaction();
try {
...............
if (!checkMO) //This implies an object with this name is not
already present in DB hence we can add this object
{
topoApi.addObject(theSwitch);
//NOTE: as we have added the object to database we must
return null
} else {
topoApi.updateObject(theSwitch, false, true);
//Here we are updating the object as it is already present in
the database.
}
commitTransaction();
...............
} catch (Exception e) {
NmsLogMgr.TOPOERR.fail(
" Exception while
adding/updating the object ", e);//No I18N
rollbackTransaction(e);
}
AdventNet, Inc.
54
Note:
If the necessary import statements have not imported then Eclipse prompt for the
error message. so it is necessary to import the statements such as import
java.rmi.RemoteException, import java.util.Enumeration, import java.util.Properties,
import java.util.Vector.
Include the corresponding import statements for all the java files in this project.
AdventNet, Inc.
55
Adding Custom map and configuring the custom map in maps.conf file
Customizing Map filter code to change the symbol of the Link and configuring the filter in
mapIcon.data file
AdventNet, Inc.
56
AdventNet, Inc.
57
- com.adventnet.nms.tutorials.ems
Filter ClassName
- TrunkMapFilter
Click Finish..
You will find the <Map Filter class> under <Your Project>/source folder in the Project Explorer
window.
You can add the custom code or modify the existing code of the source using the editor directly as per
your requirement.
The entry for this MapFilter implementation class will be appended to the map.filters configuration file
present in <Your Project>/resources/conf directory. You can rearrange the entries as per your
requirement as the filters will be invoked based on the order in which they are listed in this file.
The details of the custom code added to the Map filter class are discussed in the next topic.
AdventNet, Inc.
58
AdventNet, Inc.
59
The Chassis is built as a separate project using the Chassis Wizard of the AdventNet Client
Builder.
Now, the Chassis view of the Switch will become part of the EMS application.
Select WebNMS > Import Client Nar menu. Client Application Import Wizard" screen
pops up.
In the Client Application Import Wizard screen, Select the ChassisScreen.nar from <Web
NMS Home>/StudioTools/ClientBuilder directory using the Browse button.
In the " Users Information" page , select the users for whom the Nar has to be installed.
In the "Menu Details" screen configure the Map Menu details. Enter Map Menu File , Menu
Item name and the name of the Map Icon File. Enter Menu Name as SwitchMenu (this is the
new SwitchMenu.xml menu file that we will create as part of this application. This menu
should be placed in the <EMS Project>/resources/mapdata/menus directory) and Menu Item
Name as ChassisView
AdventNet, Inc.
60
This application can be invoked from the device node in the Switch -> Chassis View.
AdventNet, Inc.
61
The Status polling topic deals in a detailed manner on how to carryout surveillance of
Switch and components periodically.
AdventNet, Inc.
62
Tasks
Convert the failure notifications (Traps) into meaningful Event Objects using the Trap Filter
Wizard
Status Poll the Switch Device and its components using the Status Poller Wizard.
Instructions
Follow the steps given below to define a Trap Filter and after completion proceed to the Status Poller
Wizard. For details on Creating Trap Filter, refer to the Web NMS EclipsePlugin Guide.
- com.adventnet.nms.tutorials.ems
Filter ClassName
- TrapHandling
Enter the Match Criteria for filtering the trap. It includes V1 Trap, V2 Trap. For V1 Trap ,
enter the Enterprise OID , Generic Trap Type and Specific Trap Type. For V2 Trap , enter
the Trap OID.
Enterprise OID
Generic Trap Type
Specific Trap Type
*
6
100
Click Finish.
You will find the <Trap Filter class> under <Your Project>/ source folder in the Project
Explorer window. You can add the custom code or modify the existing code of the source
using the editor directly as per your requirement.
In order to capture handle the V1 Traps for the card addtion also you need to edit the
trap.filters file to provide a similar entry as the one auto-generated using the above input for
card deletion. Copy and paste the entry as below in the trap.filter file:
<FILTER
name="Switch_CardAddition"
classname="com.adventnet.nms.tutorials.ems.TrapHandling"
enable="true"
GT="6"
ST="200"
enterprise="*" />
AdventNet, Inc.
63
The appropriate entry for this trap filter will be appended in the trap.filters file in the <Your
Project>/resources/conf folder. You can rearrange the entries in this file as per your requirement to
change the order in which the trap.filters are invoked.
The details of the custom code added to the Trap filter class is discussed in the next topic.
AdventNet, Inc.
64
AdventNet, Inc.
65
For Deletion of Card the following custom code is added to the TrapHandling class inside the if loop
which checks for the Trap with Generic Type as 6 and Specific Type as 100
//Retrieving the card object from the database and deleting it.
try {
Card
card=(Card)api.getByName(pdu.getAgentAddress().getHostName()+"_Shelf1_"+slotNam
//No I18N
Properties p=new Properties();
p.put("parentKey",card.getName());//No I18N
Vector v=api.getObjectNamesWithProps(p);
boolean b=api.deleteObject(card,false,false);
if(b)
{
for (Enumeration e = v.elements() ; e.hasMoreElements() ;)
{
boolean
bool=api.deleteObject(api.getByName((String)e.nextElement()),false,false);
}
}
}
catch(Exception e) {
System.err.println(" Error while deleting card");//No I18N
return pdu; //log the trap message
}
AdventNet, Inc.
66
Since the card and its children need to be deleted, we need to get the corresponding Card object.
Using the Topo API handle, the api.getByName() method returns the Managed Object corresponding
to the card.
The TopoAPI method deleteObjectAndSubElements() deletes the ManagedObject specified (Card)
and its children (Ports). Once the object is deleted from the database, the map module is notified
and it in turn deletes these Objects from the Map database.
If a new card is inserted then in the received trap we will get the slot number where the card needs to
be added and accordingly add the card and ports. The code snippet for Addition of Card is as given
below. Add the code inside the if loop which checks for the Trap with Generic Type as 6 and Specific
Type as 200
//Retrieving the Slot object from the database to which a
card has been added.
try{
String ifObjectName= pdu.getAgentAddress().getHostName();
Switch sw=(Switch)api.getByName(ifObjectName);
Slot
slot=(Slot)api.getByName(ifObjectName+"_Shelf1_"+slotName);//
No I18N
//Invoking the addCard method that will take care of adding
the card object to the database.
SwitchDiscoveryFilter.addCard(slot,sw,api);
}
catch(RemoteException e) {
System.err.println("Unable to get the managed object");
//No I18N
return pdu; //log the trap message
}
catch(Exception e) {
System.err.println(" Error while adding card");//No I18N
return pdu; //log the trap message
}
The name of the agent (Device) from which the trap was received can be obtained from the
pdu.getAgentAddress().getHostName() method. Using the Topo API handle we will get the Managed
Object of the device as done before. As we need to add the cards and its children in the specified slot
we need to get the Slot Object of the corresponding slot. This can be obtained by the following
method.
Slot slot=(Slot)api.getByName(ifObjectName+"_Shelf1_"+slotName);
After getting the slot object we will invoke the addCard() method of the SwitchDiscoveryFilter which
will add the card and its corresponding ports. Once the managed objects are added the map module
is notified which in turn adds the objects to its database and updates the UI.
AdventNet, Inc.
67
AdventNet, Inc.
68
When the Configure Switches option in the object menu (appears when switches are selected in the
Switches map) is selected the screen for the parameters that need to be configured appears. The
information regarding the parameters that can be configured has already been discussed above. After
all the changes to the parameters are made, you can get back to the original settings of the device by
selecting the refresh option. This option will also be useful to know whether a device has been
configured successfully. On clicking the refresh option all the modifications that has been done
previously for the device are deleted and a fresh query is made to the device to get the values.
In this application you will explore some of the features of the Configuration Management. The
functionality described here is only a small subset of what can be done with AdventNet Web NMS
Configuration Management.
AdventNet, Inc.
69
Bridge Priority
: The value that all bridges use for MaxAge when this bridge is
acting as the root.
Hello Time
: This value determines how often the switch broadcasts its hello
message to other switches.
Forward Delay
Port Number
State
: Displays the spanning-tree state of the port. This can take any
one of these values
Blocking, Listening, Learning, Forwarding or Disabled.
Forward
Transitions
Path Cost
Priority
Port Enabled
Note: If Spanning Tree Protocol is not enabled in the switch you cannot view the
Spanning Tree Protocol values.
AdventNet, Inc.
70
The Configuration screens of the Switch has been built using the Configuration Wizard of the
AdventNet Management Builder.
This NAR has to be imported into the EMS project created using the WebNMS Eclipse Plugin.
The NAR has to be imported using the Client Application Import Wizard invoked through
the Import Client Nar menu of the Eclipse Plugin.
Select WebNMS > Import Client Nar menu. Client Application Import Wizard" screen
pops up.
In the Client Application Import Wizard screen, Select the SwitchConfiguration.nar from
<Web NMS Home>/StudioTools/ClientBuilder/projects/EMS_Configuration directory using the
Browse button
In the " Users Information" page , select the users for whom the Nar has to be installed.
In the "Menu Details" screen configure the Map Menu details. Enter Map Menu File , Menu
Item name and the name of the Map Icon File. Enter Menu Name as SwitchMenu (this is the
new SwitchMenu.xml menu file that we will create as part of this application. This menu
should be placed in the <EMS Project>/resources/mapdata/menus directory) and Menu Item
Name as Configuration.
Now the Configuration screens of the Switch will become part of the EMS application.
Caution:
It is not advisable to change the values of Spanning Tree Configurations in a real
switch which is a part of an active network, as it may inadvertently affect the
operation of the switch.
The AdventNet Agent Simulator can be used to simulate the switch by recording
the values from a real switch.
AdventNet, Inc.
71
Switch Chassis
In this section, you will learn to build chassis application to represent Switch device along with its subcomponents such as Shelf, Slot, etc. This representation is known as Chassis View.
Building chassis application using Chassis Wizard is explained in the Building Chassis section.
The Output
The Chassis View is dynamic, i.e., the application updates based on the status of the components in
Web NMS Database.
Once EMS is deployed in Web NMS, this application can be invoked from the device node by rightclicking the node and selecting View Chassis.
Configuration Screen
In this section, you will be building the configuration screens with the help of Configuration Wizard to
configure Switch device parameters.
Building Configuration Management Application using Configuration Wizard of AdventNet
Management Builder is explained in the Building Configuration Application section.
The Output
The Configuration Management application configures, saves the Configuration data to Cache and
loads the Configuration data from Cache for Scalar properties updates based on the status of the
components in Web NMS Database.
Once EMS is deployed in Web NMS, this application can be invoked from the device node by rightclicking the node and select Configure Device.
AdventNet, Inc.
72
No of Slots in the
Shelf
No of Card Types in
the Shelf1
Before creating the chassis application, you must know how the MOs are populated in the Web NMS
Database. Hence make a SQL query from the Web NMS Database using the mysql commands given
below
mysql>select name,parentkey, type from ManagedObject where name like "%Switch1%";
where the Switch1 is the MO name of the chassis device you have populated.
You shall get the query result similar to the table given below
name
parentkey
Switch1
Switch1_Shelf1
Switch1_Shelf1_Slot0
Switch1_Shelf1_Slot0_Card
Switch1_Shelf1_Slot0_Card_Port0
Switch1_Shelf1_Slot1
Switch1_Shelf1_Slot10
Switch1_Shelf1_Slot10_Card
Switch1_Shelf1_Slot10_Card_Port0
Switch1_Shelf1_Slot10_Card_Port1
Switch1_Shelf1_Slot10_Card_Port2
Switch1_Shelf1_Slot10_Card_Port3
Switch1_Shelf1_Slot11
Switch1_Shelf1_Slot12
Switch1_Shelf1_Slot12_Card
Switch1_Shelf1_Slot12_Card_Port0
Switch1_Shelf1_Slot13
Switch1_Shelf1_Slot14
NULL
Switch1
Switch1_Shelf1
Switch1_Shelf1_Slot0
Switch1_Shelf1_Slot0_Card
Switch1_Shelf1
Switch1_Shelf1
Switch1_Shelf1_Slot10
Switch1_Shelf1_Slot10_Card
Switch1_Shelf1_Slot10_Card
Switch1_Shelf1_Slot10_Card
Switch1_Shelf1_Slot10_Card
Switch1_Shelf1
Switch1_Shelf1
Switch1_Shelf1_Slot12
Switch1_Shelf1_Slot12_Card
Switch1_Shelf1
Switch1_Shelf1
AdventNet, Inc.
name
Switch
Shelf
Slot
Card
Port
Slot
Slot
Card
Port
Port
Port
Port
Slot
Slot
Card
Port
Slot
Slot
73
name
Switch1_Shelf1_Slot14_Card
Switch1_Shelf1_Slot14_Card_Port0
Switch1_Shelf1_Slot14_Card_Port1
Switch1_Shelf1_Slot14_Card_Port2
Switch1_Shelf1_Slot14_Card_Port3
Switch1_Shelf1_Slot15
Switch1_Shelf1_Slot2
Switch1_Shelf1_Slot2_Card
Switch1_Shelf1_Slot2_Card_Port0
Switch1_Shelf1_Slot2_Card_Port1
Switch1_Shelf1_Slot2_Card_Port2
Switch1_Shelf1_Slot2_Card_Port3
Switch1_Shelf1_Slot3
Switch1_Shelf1_Slot4
Switch1_Shelf1_Slot4_Card
Switch1_Shelf1_Slot4_Card_Port0
Switch1_Shelf1_Slot5
Switch1_Shelf1_Slot6
Switch1_Shelf1_Slot6_Card
Switch1_Shelf1_Slot6_Card_Port0
Switch1_Shelf1_Slot6_Card_Port1
Switch1_Shelf1_Slot6_Card_Port2
Switch1_Shelf1_Slot6_Card_Port3
Switch1_Shelf1_Slot7
Switch1_Shelf1_Slot8
Switch1_Shelf1_Slot8_Card
Switch1_Shelf1_Slot8_Card_Port0
Switch1_Shelf1_Slot9
parentkey
Switch1_Shelf1_Slot14
Switch1_Shelf1_Slot14_Card
Switch1_Shelf1_Slot14_Card
Switch1_Shelf1_Slot14_Card
Switch1_Shelf1_Slot14_Card
Switch1_Shelf1
Switch1_Shelf1
Switch1_Shelf1_Slot2
Switch1_Shelf1_Slot2_Card
Switch1_Shelf1_Slot2_Card
Switch1_Shelf1_Slot2_Card
Switch1_Shelf1_Slot2_Card
Switch1_Shelf1
Switch1_Shelf1
Switch1_Shelf1_Slot4
Switch1_Shelf1_Slot4_Card
Switch1_Shelf1
Switch1_Shelf1
Switch1_Shelf1_Slot6
Switch1_Shelf1_Slot6_Card
Switch1_Shelf1_Slot6_Card
Switch1_Shelf1_Slot6_Card
Switch1_Shelf1_Slot6_Card
Switch1_Shelf1
Switch1_Shelf1
Switch1_Shelf1_Slot8
Switch1_Shelf1_Slot8_Card
Switch1_Shelf1
name
Card
Port
Port
Port
Port
Slot
Slot
Card
Port
Port
Port
Port
Slot
Slot
Card
Port
Slot
Slot
Card
Port
Port
Port
Port
Slot
Slot
Card
Port
Slot
On querying the Card MO table using the SQL query given below
mysql>select name,cardType from Card where name like "Switch1%";
You shall get the query result similar to the table given below
name
cardtype
Switch1_Shelf1_Slot0_Card
Switch1_Shelf1_Slot10_Card
Switch1_Shelf1_Slot12_Card
Switch1_Shelf1_Slot14_Card
Switch1_Shelf1_Slot2_Card
Switch1_Shelf1_Slot4_Card
Switch1_Shelf1_Slot6_Card
Switch1_Shelf1_Slot8_Card
Trunk
Access
Trunk
Access
Access
Trunk
Access
Trunk
Using the cardType property, you can provide the type property in Chassis Wizard.
Device Description
To built the dynamic chassis application for the above device Switch1, you have to build the chassis
project with the following parameters
Number of Shelves
: One
Number of Slots
: 16
: Three
AdventNet, Inc.
74
Since the position of Cards in the Slots is subject to change, the Project is built with Dynamic
Chassis.
Note:
The Managed Objects in Web NMS Database are populated by discovery of
the devices based on the criterion in Discovery Filter.
The Chassis Application created for these Managed Objects is Dynamic
Chassis because the card screen panels are fitted in slot holder panels
based on the Managed Objects in the Web NMS Database.
Device Information
The following classes and XML are required to build the chassis project
ManagedObject.xml
AdventNet, Inc.
75
None. For Example, WebNMS_Server_HOST = test2 means the Web NMS is running in host
machine test2.
4. Click OK button to close the Servers Properties list dialog.
5. Restart the Management Server using the Stop and Start buttons.
Get back to Chassis Wizard and follow the steps given below.
3. Chassis Configuration
4. Compiling and Packaging the Application
AdventNet, Inc.
76
Initial Settings
Click the Main Screen Node of the "EMS_Chassis" Project Tree. Change the build type of the
Main Screen to "NMS Frame" using the menu command Built >Type > NMS Frame
AdventNet, Inc.
77
2. Check the "Is Slot Modeled" and "Is Shelf Modeled" check boxes in the first screen of MO
Properties Wizard. Since these are the known parameters. Click "Next" button to proceed to
the next screen as given below.
AdventNet, Inc.
78
AdventNet, Inc.
79
AdventNet, Inc.
80
2. In the Card Screen Parameter of the "Access_Card" screen provide the "Number of
Distinct Port Types"=1 and "Number. of Ports"=4. For detailed explanation for usage
follow the topic Card Screen Parameter Panel.
3. Configure the screen size with the value "Width"=54 and "Height"=430 (in pixels).
Expand the "Access_Card" node to can find a port node named "Port_0".
Right-click the Port_0 node to get the Port Popup menu, Select the 'Modify' menu item from
the Popup to invoke Port Configuration dialog.
In the "Component Properties", browse and select the "networkport1.png" for the property
"Image File".
Expand the "Access_Card" node to can find a port node named "Port_0".
Right-click the Port_0 node to get the Port Popup menu, Select the 'Modify' menu item from
the Popup to invoke Port Configuration dialog.
AdventNet, Inc.
81
Repeat the a, b, and c steps for the ports Port2, Port3 and Port4 also.
Property
Value
Threshold Color 1
Red
Threshold Color 2
Orange
Threshold Color 3
Yellow
Threshold Color 4
Cyan
Threshold Color 5
Green
Threshold Color 6
Magenta Red
Threshold Color 7
Grey
Threshold Value 1
Threshold Value 2
Threshold Value 3
Threshold Value 4
Threshold Value 5
Threshold Value 6
Threshold Value 7
AdventNet, Inc.
82
AdventNet, Inc.
83
2. Double-click the draw area to invoke the Property From for the card screen. Configure the
background image property with the "fourport.png" present in
<Client_Builder_Home>images folder.
AdventNet, Inc.
84
6. Remove the existing code (if any) in the text area (under the "Hide Menu Item Details"
button) and enter the following code as in the above figure
Properties prop = new Properties ();
prop.put ("PANEL_NAME", "AlertApplet");
String portName=currentManagedObjectName;
if(! name.equals("Card"))
{
portName=currentManagedObjectName+"_"+name;
}
prop.put ("entity", "<" + portName + ">");
prop.put ("tobeselected", "Alerts");
java.awt.Event event = new java.awt.Event (this,
NmsPanel.CHANGE_PANEL_EVENT, prop);
NmsPanelEvent nmsevt = new NmsPanelEvent (event);
NmsClientUtil.getMainPanel().handleNmsPanelEvent (nmsevt);
7. Repeat the above steps (Steps: 3,4,5, and 6) to add the following JMenuItems with there
respective user codes as in the table below
JMenuItem
Name
Events
AdventNet, Inc.
85
JMenuItem
Name
Property
10. Right-click the port component with the instance name "Port1" to invoke the pop-up menu.
Select Popup Menus > AccessCard (radio button) as given in the figure below. This done to
invoke the "AccessCard" pop-up designed in "Screen Menu Configuration UI" on rightclicking the port component in the card screen at run time.
AdventNet, Inc.
86
11. Follow the above step (Step-10) to configure the "AccessCard" pop-up menu for other port
components (with the instance name) "Port2", "Port3", and "Port4".
javax.swing.*;
java.awt.*;
java.awt.event.*;
java.io.*;
com.adventnet.beans.chassis.*;
java.util.*;
com.adventnet.nms.startclient.*;
com.adventnet.nms.util.*;
AdventNet, Inc.
87
Port2.addMouseListener(this);
Port1.addMouseListener(this);
Port1.setName("Port0");
Port2.setName("Port1");
Port3.setName("Port2");
Port4.setName("Port3");
Top.setName("Card");
2. Scroll down to end of the class and write the following code before the end of class (closing
brace "}").
public String name=null;
public void mouseClicked(MouseEvent me)
{
if(((Component)me.getSource()).getName().equals("Card"))
{
name=((Component)me.getSource()).getName();
}
else
{
Component
comp=componentAt((JComponent)me.getSource(),me.getX(),me.getY());
name=comp.getName();
}
}
public void mouseReleased(MouseEvent me)
{
}
public void mousePressed(MouseEvent me)
{
}
public void mouseEntered(MouseEvent me)
{
}
public void mouseExited(MouseEvent me)
{
}
public Component componentAt(Container parent,int x,int y)
{
if (!parent.contains(x, y))
{
return null;
}
int ncomponents = parent.getComponentCount();
Component component[] = parent.getComponents();
for (int i = 0 ; i < ncomponents ; i++)
{
Component comp = component[i];
if (comp != null)
{
Rectangle rect = comp.getBounds();
int compx = rect.x;
int compy = rect.y;
if (comp instanceof Container)
{
if(comp instanceof com.adventnet.beans.images.StatusIcon)
{
AdventNet, Inc.
88
return comp;
}
else
{
comp = componentAt(((Container)comp),x - compx, y - compy);
}
}
else
{
comp = parent.getComponentAt(x compx, y - compy);
}
if (comp != null && comp.isVisible()) {
return comp;
}
}
}
return parent;
}
3. Switch back to Screen view tab
4. Save the Project using the menu command File > Save > Project.
The design of "Access_Card" screen is complete.
AdventNet, Inc.
89
2. In the Card Screen Parameter of the "Trunk_Card" screen provide the "Number of Distinct
Port Types"=1 and "Number. of Ports"=1. For detailed explanation for usage follow the topic
Card Screen Parameter Panel.
3. Configure the screen size with the value "Width"=54 and "Height"=430.
Expand the "Trunk_Card" node to can find a port node named "Port_0".
Right-click the Port_0 node to get the Port Popup menu, Select the 'Modify' menu item from
the Popup to invoke Port Configuration dialog.
In the "Component Properties", browse and select the "networkport1.png" for the property
"Image File".
Expand the "Trunk_Card" node to can find a port node named "Port_0".
Right-click the Port_0 node to get the Port Popup menu, Select the 'Modify' menu item from
the Popup to invoke Port Configuration dialog.
In the Card Screen's Draw Area, you can find the Port component "Port1".
Right-click the "Port1" port component to get the Bean Popup menu, Select the
Protocol Property Form-->Client_Port (the client property instance) from the Popup to
invoke Client Property dialog. In the Client Property dialog all the field are
inaccessible except the Index/Key field.
AdventNet, Inc.
90
Property
Value
Threshold Color 1
Red
Threshold Color 2
Orange
Threshold Color 3
Yellow
Threshold Color 4
Cyan
Threshold Color 5
Green
Threshold Color 6
Magenta Red
Threshold Color 7
Grey
Threshold Value 1
Threshold Value 2
Threshold Value 3
Threshold Value 4
Threshold Value 5
Threshold Value 6
Threshold Value 7
AdventNet, Inc.
91
2. Double-click the draw area to invoke the Property From for the card screen. Configure the
background image property with the "singleport.png" present in the images folder under the
<Client Builder Home> folder.
AdventNet, Inc.
92
Right-click the Draw Area to invoke the Card Screen Popup Menu, select Menus >Create
Menu to invoke the Screen Menu Configuration UI.
Select the "PopUpMenu" node from the tree (in left side pane) and click "Add" button (at the
bottom of the UI) to invoke a dialog asking for Pop up menu name, provide the value
"TrunkCard" and click "OK" button. You can find a node with the name "TrunkCard" is added
under the "PopUpMenu" node.
Select the "TrunkCard" node and click "Add" button to invoke the "Choose Menu" dialog.
Select "JMenuItem" radio button and provide the value "Alerts" in the text field labeled "Enter
Menu Item Name". You can find the "Alerts" is added under the "TrunkCard" node.
Select the "Alerts" node to invoke the respective panel in the right side of the split pane.
Remove the existing code (if any) in the text area (under the "Hide Menu Item Details" button)
and enter the following code
Properties prop = new Properties ();
prop.put ("PANEL_NAME", "AlertApplet");
String portName=currentManagedObjectName;
if(! name.equals("Card"))
{
System.out.println(" name is "+name);
portName=currentManagedObjectName+"_"+name;
}
prop.put ("entity", "<" + portName + ">");
prop.put ("tobeselected", "Alerts");
java.awt.Event event = new java.awt.Event (this,
NmsPanel.CHANGE_PANEL_EVENT, prop);
NmsPanelEvent nmsevt = new NmsPanelEvent (event);
NmsClientUtil.getMainPanel().handleNmsPanelEvent (nmsevt);
7. Repeat the above steps (Steps: 3,4,5, and 6) to add the following JMenuItems with there
respective user codes as in the table below
JMenuItem
Name
Events
Property
AdventNet, Inc.
93
JMenuItem
Name
if(! name.equals("Card"))
{
portName=currentManagedObjectName+"_"+name;
type="Trunk" ;
}
pp.setValue(portName,type);
AdventNet, Inc.
94
2. Scroll down to end of the class and write the following code before the end of class (closing
brace "}").
public String name=null;
public void mouseClicked(MouseEvent me)
{
if(((Component)me.getSource()).getName().equals("Card"))
{
name=((Component)me.getSource()).getName();
}
else
{
Component
comp=componentAt((JComponent)me.getSource(),me.getX(),me.getY());
name=comp.getName();
}
}
public void mouseReleased(MouseEvent me)
{
}
public void mousePressed(MouseEvent me)
{
}
public void mouseEntered(MouseEvent me)
{
}
public void mouseExited(MouseEvent me)
{
}
public Component componentAt(Container parent,int x,int y)
{
if (!parent.contains(x, y))
{
return null;
}
int ncomponents = parent.getComponentCount();
Component component[] = parent.getComponents();
for (int i = 0 ; i < ncomponents ; i++)
{
Component comp = component[i];
if (comp != null)
{
Rectangle rect = comp.getBounds();
int compx = rect.x;
int compy = rect.y;
if (comp instanceof Container)
{
if(comp instanceof com.adventnet.beans.images.StatusIcon)
{
return comp;
}
else
{
comp = componentAt(((Container)comp),x - compx, y - compy);
}
}
else
{
AdventNet, Inc.
95
AdventNet, Inc.
96
Initial Settings
1. Create a new screen under "Screens" node using the menu command File > New > Screen
and rename the screen name as "Property_Screen".
2. Change the layout of the screen by right-clicking the Draw Area and select Layouts > Border
Layout.
3. Click and drop a two JPanels from SwingBeans.list tab of the Beans Pallete.
4. Change the instance name of these JPanels as Details_Panel and Button_Panel.
Value
InstanceName
NameL
horizontalTextPosition
RIGHT
horizontalAlignment
RIGHT
text
Name
foreground
bottle green
3. Drop 11 JLabels from SwingBeans.list tab of the Beans Palette. Select "RIGHT" option for
"horizontalTextPosition" and "horizontalAlignment" properties. Change the instance name
and text properties for these JLabels as listed in the Instance Name in the table given below.
Set the properties for each component as given in the table below (Similar to the above step6)
Instance Name Property Value
DisplayNameL
Display Name
TypeL
Type
AdventNet, Inc.
97
ManagedL
Managed
StatusL
Status
ParentKeyL
Parent Key
SwitchL
Switch
PortTypeL
Port Type
SpeedL
Speed
PortNoL
Port Number
TrunkL
Trunk
RemotePortL
Remote Port
8. Drop a JTextField from SwingBeans.list tab of the Beans Palette in the "Details_Panel"
JPanel. Invoke the Property Form, provide the "Instance Name" property with the value
"NameTF" and choose "False" option for the "editable " property.
9. Drop 11 JTextFields from SwingBeans.list tab of the Beans Palette. Change the instance
name as listed below.
DisplayNameTF
TypeTF
ManagedTF
StatusTF
ParentKeyTF
SwitchTF
PortTypeTF
SpeedTF
PortNoTF
TrunkTF
RemotePortTF
10. Choose "False" option for the "editable " property for all the above JTextField components.
11. Change the layout of the "Details_Panel" panel by right-clicking the Draw Area and select
Layouts > GridBag Layout.
AdventNet, Inc.
98
12. Position the components in the Details_Panel JPanel GridBag Layout Customizer (invoked
by right-clicking the Draw Area and select Layouts Properties ) as given in the table below
(also refer the figure above).
13. In the GridBag Layout Customizer, set the following properties for all the components:
Property
Grid Width
Grid Height
Fill
Anchor
Insets
Value
1
1
Horizontal
Center
5,5,5,5
AdventNet, Inc.
99
Component (Identified
with Instance Name)
Grid
GridX
GridY
NameL
DisplayL
TypeL
ManagedL
StatusL
ParentKeyL
SwitchL
PortTypeL
SpeedL
PortNoL
10
TrunkL
11
RemortPortL
12
NameTF
DisplayNameTF
TypeTF
ManagedTF
ParentKeyTF
StatusTF
SwitchTF
PortTypeTF
SpeedTF
PortNOTF
10
TrunkTF
11
RemortPortTF
12
AdventNet, Inc.
100
AdventNet, Inc.
101
PortTypeTF.setText(prop.getProperty("serialno"));
SpeedTF.setVisible(false);
StatusTF.setVisible(false);
PortNoTF.setVisible(false);
TrunkTF.setVisible(false);
RemotePortTF.setVisible(false);
SpeedL.setVisible(false);
StatusL.setVisible(false);
PortNoL.setVisible(false);
TrunkL.setVisible(false);
RemotePortL.setVisible(false);
}
}catch (Exception remoteException)
{
System.out.println ( "Error in getting api.getByName using
portname " + portname);
remoteException.printStackTrace();
return;
}
}
The design of "Property_Screen" screen dialog is complete.
AdventNet, Inc.
102
AdventNet, Inc.
103
Slot
Slot1
Slot2
Slot3
Slot4
Slot5
Slot6
Slot7
Slot8
Slot9
Slot10
Slot11
Slot12
Slot13
Slot14
Slot15
Slot16
Default Type
Card_2
Card Value
Access
Trunk
Blank
Note: The correct card values should be provided as in the Web NMS Database
because the incorrect card values will not poll the cards in slots.
Save the Project using the menu command File > Save > Project.
AdventNet, Inc.
104
AdventNet, Inc.
105
7. Click "Finish" button to close the Package Wizard to get the confirmation dialog with the
message "Chassis_Tree" created successfully at <specified location>.
8. Import the NAR in the EMS Project using the Client Application Import Wizard with the
required menu name and menu item.
Note: The above project is also available in <Web NMS
Home>/StudioTools/ClientBuilder/projects directory with the project name
EMS_Chassis. You can also load and see this project for your reference.
AdventNet, Inc.
106
Final Output
Pre-requisites
Copy the following images from the Web NMS to <Client Builder Home>/images directory.
Image
Source Directory
Device Information
AdventNet, Inc.
107
RFC1213-MIB - The device details such as System Name, Description, Physical Location,
User/Contact Name are configured or displayed in Switch Configuration Application using this
MIB.
AdventNet, Inc.
108
AdventNet, Inc.
109
Steps Involved
Initial Settings
1. Create a new screen under the "EMS_Configuration" project and rename it as
"SwitchConfiguration".
2. Change the build type of the Screen to "NMS Frame" using the menu command Build >
Type > NMS Frame.
3. Change the layout of the Screen to "Border Layout" by right-clicking the Draw Area to
invoke the screen pop-up menu, select Layouts > Border Layout.
AdventNet, Inc.
110
2. Drop the JTabbedPane bean and change its instance name by following the steps below
o
Click and drop the JTabbedPane bean in the "Center" position of the Draw Area.
3. Drop the JPanel bean and change its instance name by following the steps below
o
Click and drop the "JPanel" bean in the "South" position of the Draw Area.
Change the instance name of the JPanel bean instance as "Button_Panel" using the
Property Form.
Invoke the "Border Layout" dialog to arrange the components by right-clicking the Draw Area and
select "Layout Properties" menu item.
Select each component in the "Component" combo box and ensure the parameters are as in the
table given below, if not provide the values and click "OK" button to close the dialog.
Component
Position
Button_panel
South
Switch_Tree
West
Details_TappedPane
Center
HGap
VGap
Provide the value "Configure Switches" in the "Node Name" text field.
Select the "logo.png" from the <Client Builder Home>/images using the "Browse"
button.
Similarly, add following nodes under the root node (Configure Switches) of the tree with the
respective icons as given in the table below.
Node Name
Switch Name
View Result
Icon Name
ems_tut_switch_tick.jpg
properties.png
4. Click "Apply" button after adding the above nodes and Click "Close" to close the dialog.
AdventNet, Inc.
111
Ensure that the "Create New Connection class" option is selected in the
first screen of the Interaction Wizard. click "Next" button.
String name=null;
TreePath tp=arg0.getNewLeadSelectionPath();
if(tp != null)
{
AdventNetTreeNode an=(AdventNetTreeNode)tp.getLastPathComponent();
name=an.getName();
if(name.equals("View Result"))
{
Details_TabbedPane.setEnabledAt(0,false);
if (userOperations.toString().indexOf("Ems") != -1)
{
if ( userOperations.contains("Ems Configure All") &&
(! userOperations.contains("Ems Configure None")))
{
Details_TabbedPane.setEnabledAt(1,false);
Details_TabbedPane.setEnabledAt(2,false);
}
}
if (userOperations.toString().indexOf("Ems") == -1)
{
Details_TabbedPane.setEnabledAt(1,false);
Details_TabbedPane.setEnabledAt(2,false);
}
if(Details_TabbedPane.indexOfTab("Results") == -1)
Details_TabbedPane.insertTab("Results",null,Results_Panel,
null,Details_TabbedPane.getTabCount());
Details_TabbedPane.setSelectedIndex(Details_TabbedPane.getTabCount()-1);
configure.setEnabled(false);
refresh.setEnabled(false);
}
if(name.equals(getParameter("HOST")))
{
if((Details_TabbedPane.indexOfTab("Results")) != -1)
{
Details_TabbedPane.removeTabAt(Details_TabbedPane.indexOfTab("Results"));
}
Details_TabbedPane.setEnabledAt(0,true);
if (userOperations.toString().indexOf("Ems") != -1)
{
if ( userOperations.contains("Ems Configure All") && (!
userOperations.contains("Ems Configure None")))
{
Details_TabbedPane.setEnabledAt(1,true);
Details_TabbedPane.setEnabledAt(2,true);
}
}
Details_TabbedPane.setSelectedIndex(0);
refresh.setEnabled(true);
AdventNet, Inc.
112
if (userOperations.toString().indexOf("Ems") != -1)
{
if ( (userOperations.contains("Ems Configure Scalar") ||
userOperations.contains("Ems Configure All")) && !
userOperations.contains("Ems Configure None"))
{
configure.setEnabled(true);
}
}
if (userOperations.toString().indexOf("Ems") == -1)
{
Details_TabbedPane.setEnabledAt(1,true);
Details_TabbedPane.setEnabledAt(2,true);
configure.setEnabled(true);
}
}
}
o
7. Switch to Source View tab and scroll to the setVisible method. Write the following code under
the //<End_setVisible_boolean> tag.
if(bl)
{
String icon2="../images/ems_tut_switch_small.png";
AdventNetTreeNode node=Switch_Tree.getNode(getParameter("HOST"),icon2);
Switch_Tree.setSelectionInterval(1,1);
Switch_Tree.addNode(node);
Switch_Tree.selectNode(node);
if (userOperations.toString().indexOf("Ems") != -1)
{
if(userOperations.contains("Ems Configure Scalar") && ( !
userOperations.contains("Ems Configure All") && ! (userOperations.contains("Ems
Configure None"))
))
{
Details_TabbedPane.removeTabAt(Details_TabbedPane.indexOfTab("STP"));
Details_TabbedPane.removeTabAt(Details_TabbedPane.indexOfTab("PortParameters"));
}
if (userOperations.contains("Ems Configure None"))
{
configure.setEnabled(false);
}
}
}
8. Add the following code under the package import declarations as given below :
import
import
import
import
import
import
import
import
java.net.*;
javax.swing.tree.TreePath;
java.util.Vector;
java.rmi.Naming;
com.adventnet.beans.utilbeans.AdventNetTreeNode;
com.adventnet.nms.util.NmsClientUtil;
com.adventnet.nms.util.BrowserControl;
com.adventnet.security.authorization.AuthorizationEngine;
9. Add the following code under the package variable declarations as given below :
private Vector userOperations=new Vector();
AdventNet, Inc.
113
10. Add the following code in the init method before the closing braces ("}") of this method as
given below :
checkUserOperations();
setResizable(false);
11. Add the following code in stop method before the closing braces ("}") of this method as given
below :
PortDetails1.stop();
12. Add the following code in start method after the opening braces ("{") of this method as given
below :
PortDetails1.start();
Custom code that need to be added in the Configuration management screen to cater for
Security administration
In the Configuration wizard, we have created the screens for configuring the Switches. In the
SwitchConfiguration.java file of the EMS configuration project, the following code was
accommodated in order to cater for Security administration.
When the switch configuration screen is invoked from the client, the checkUserOperations() method
makes a RMI lookup to the AuthorizationEngineAPI for retrieving the operations for the logged-in
user.
private void checkUserOperations()
{
try{
URL BE_Url = NmsClientUtil.applet.getCodeBase();
String BEHostName = "localhost";
BEHostName = BE_Url.getHost();
if(BEHostName.trim().equalsIgnoreCase("localhost"))
try
{
BEHostName =
InetAddress.getLocalHost().getHostName();
}
catch(UnknownHostException unknownhostexception1)
{
System.err.println("unknown host : " +
unknownhostexception1);
}
if(BE_Url != null && BEHostName != null)
{
String name = "//" + BEHostName +
"/NmsAuthEngineAPI";
AuthorizationEngine authEngine =
(AuthorizationEngine) Naming.lookup(name);
if(authEngine == null)
{
System.out.println("Could not get rmi handle to
AuthAPI");
}
else
{
String userName =
NmsClientUtil.getUserName();
userOperations =
authEngine.getOperationsForUser(userName);
AdventNet, Inc.
114
}
}
}
catch(AuthorizationException ex)
{
System.out.println("Exception while getting RMI
handle to Authorization Engine " + ex.getMessage());
}
catch(Exception exp)
{
System.out.println("Exception while getting RMI
handle to Authorization Engine " + exp.getMessage());
}
}
Whenever a component in the UI is added, disabled or enabled, a check is made if the user logged in
has the required permission to perform the operation. Based on the user operation, the component is
enabled or disabled.
if(userOperations.toString().indexOf("Ems") != -1)
{
if (userOperations.contains("Ems Configure None"))
{
configure.setEnabled(false);
}
}
13. Switch back to Screen View tab.
Text Property
Refresh
Help
Close
3. Resize the bean components to the required size (refer the Design Time View screen shot).
Note: The actions for each of the above buttons are provided after the panel
screens are designed and integrated.
AdventNet, Inc.
115
AdventNet, Inc.
116
Steps Involved
Initial Settings
1. Create a new screen under the "EMS_Configuration" project and rename it as
"SystemConfig".
2. Change the build type of the Screen to "Panel" using the menu command Build > Type >
Panel.
3. Change the layout of the Screen to "Border Layout" by right-clicking the Draw Area to
invoke the screen pop-up menu, select Layouts > Border.
Text Property
descL
Description
phys_locL
Physical Location
cont_nameL
User/Control Name
5. Expand the RFC1213-MIB node in the XML tree and scroll down to RFC1213-MIB > org >
dod > internet > mgmt > mib-2 > system.
6. Click and drop the "sysName" representation (View1 node under this node) and change the
instance name as nameTF. Similarly drop the representation for the nodes given in the table
below and change the their respective instance name.
Representation for the Node
Instance Name
sysDescr
descTF
sysLocation
phy_locTF
sysContact
cont_nameTF
7. Invoke the "GridBag Layout Customizer" window for the "Sys_Details_Panel" by rightclicking the screen and select "Layout Properties". \
AdventNet, Inc.
117
8. In the GridBag Layout Customizer, set the following properties for all the components:
Property
Value
Fill
Horizontal
Anchor
Center
Insets
5,5,5,5
9. Arrange the components in the "GridBag Layout Customizer" window as given below
Component (Identified
with Instance Name)
Grid
nameL
descL
IPadX
WeightX
EAST
0.0
WEST
0.1
0
0
phys_locL
cont_nameL
nameTF
descTF
Anchor
GridX GridY
phy_locTF
cont_nameTF
AdventNet, Inc.
118
Steps Involved
Initial Settings
1. Create a new screen under the "EMS_Configuration" project and rename it as "STP".
2. Change the build type of the Screen to "Panel" using the menu command Build > Type >
Panel.
3. Change the layout of the Screen to "Border Layout" by right-clicking the Draw Area to
invoke the screen pop-up menu, select Layouts > Border.
Text Property
max_ageL
Max.Age
hello_timeL
Hello Time
forw_delayL
Forward Delay
5. Expand the BRIDGE-MIB node in the XML tree and scroll down to BRIDGE-MIB > mib-2 >
dot1dBridge > dot1dStp.
6. Click and drop the "dot1dStpPriority" representation ("View1" node under this node) from
the XML tree in the "ST_Details_Panel" bean. Change the instance name of the dropped
bean "bridge_priorityTF".
7. Drop a JTextField from the SwingBeans.list tab of BeansPalette and change its instance
name as "max_ageTF". Similarly, drop two more text fields and change their instance names
as "hello_timeTF" and "forw_delay_TF" respectively.
8. Switch to the Config tab.
9. Select the "dot1dStpBridgeMaxAge" node from the XML Tree, and click the "Add
Attribute"
button to add the attributes from the Xml Tree to the Config Tree.
AdventNet, Inc.
119
10. Edit the code in the "Code Area" and change the bolded code line as given below.
Properties valueProp = new Properties();
valueProp.setProperty(LABEL,"dot1dStpBridgeMaxAge");
valueProp.setProperty(TYPE,"2");
valueProp.setProperty(VALUE,String.valueOf(max_ageTF.getText()));
return valueProp;
11. Similarly repeat the above steps for the nodes dot1dStpBridgeHelloTime,
dot1dStpBridgeForwardDelay. The corresponding code lines to be modified are
respectively.
valueProp.setProperty(VALUE,String.valueOf(hello_timeTF.getText()));
valueProp.setProperty(VALUE,String.valueOf(forw_delay_TF.getText()));
12. Click and drop the "dot1dStpBridgeMaxAge" node from the XML Tree on the "max_ageTF"
bean to invoke the Client Property dialog. Select the "setText" method from the "Result
Method" list and click OK button to close the Client Property dialog.
13. Follow the above step (Step-7) to drop the nodes and setting the "setText" method in Client
Property dialog.
Bean Instance Name
hello_timeTF
dot1dStpBrideHelloTime
forw_delay_TF
dot1dStpBridgeForwardDelay
14. Invoke the "GridBag Layout Customizer" window for the "Sys_Details_Panel" by rightclicking the screen and select "Layout Properties".
15. Arrange the components in the "GridBag Layout Customizer" window as given below.
16. In the GridBag Layout Customizer, set the following properties for all the components:
Property
Value
Fill
Horizontal
Insets
5,5,5,5
Component
(Identified with
Instance Name)
Grid
GridX
bridge_priorityL
max_ageL
hello_timeL
GridY
1
2
3
bridge_priorityTF
hello_timeTF
forw_delay_TF
IPadX
WeightX
EAST
0.0
WEST
0.1
forw_delayL
max_ageTF
Anchor
1
2
3
AdventNet, Inc.
120
Steps Involved
Initial Settings
1. Create a new screen under the "EMS_Configuration" project and rename it as
"PortDetails".
2. Change the build type of the Screen to "Panel" using the menu command Build > Type >
Panel.
3. Change the layout of the Screen to "Border Layout" by right-clicking the Draw Area to
invoke the screen pop-up menu, select Layouts > Border.
dot1dStpPort
dot1dStpPortPriority
dot1dStpPortState
dot1dStpPortEnable
dot1dStpPortPathCost
dot1dStpPortForwardTransitions
4. Click the "Advanced Properties" button and change the 'PollInterval' to "0".
5. Click "Next" button to proceed to final screen of the Wizard.
6. Scroll down to end of the Class and add the following methods namely "getColumnClass",
"getValueAt", and "setValueAt" before the closing brace ("}") of the class.
public Class getColumnClass(int c)
{
if(c == 3)
{
return Boolean.class;
}
else
AdventNet, Inc.
121
{
return super.getColumnClass(c);
}
}
public Object getValueAt(int row, int col)
{
if(col == 3)
{
String portEnabled = super.getValueAt(row,col).toString();
if(portEnabled.indexOf("1") != -1)
{
return Boolean.TRUE;
}
else
{
return Boolean.FALSE;
}
}
else
{
return super.getValueAt(row,col);
}
}
public void setValueAt(Object value , int row , int col)
{
if(col == 3)
{
Boolean enabled = (Boolean)value;
if(enabled.booleanValue())
{
super.setValueAt("1",row,col);
}
else
{
super.setValueAt("2",row,col);
}
}
else
{
super.setValueAt(value,row,col);
}
}
7. Click "Finish" button to close the Virtual Table Model Wizard.
8. Click and drop the "PortParametersTable1" node under the "Virtual Table Model" node of
the XML tree outside the Draw Area. You can find the name of dropped bean is
"PortParmetersTable11" .
9. Double-click the "Port_Details_Table" to invoke the Property Form. Select the "model" and
choose the "PortParmetersTable11" from the combo box.
AdventNet, Inc.
122
button to add the attributes from the Xml Tree to the Config Tree.
7. Edit the code in the "Code Area" and the following code
AdventNet, Inc.
123
AdventNet, Inc.
124
Steps Involved
1. Switch to "Project Classes" tab of the Beans Palette and select
"com.adventnet.nms.tutorials.ems.SystemConfig" from the "Enter Class Name" combo
box. Click and drop the button in the "Details_TabbedPane" bean. Thus you have dropped
the "SystemConfig" class as bean. You can find tab with the name "SystemConfig1" in the
"Details_TabbedPane" bean. Similarly drop the "com.adventnet.nms.tutorials.ems.STP"
and "com.adventnet.nms.tutorials.ems.PortDetails" in the "Details_TabbedPane" bean.
You can find the "STP1" and "PortDetails1" in the "Details_TabbedPane" bean.
AdventNet, Inc.
125
Invoke the Property Form for the "Results_Table" bean and set the model property
with "ConfigResultTableModel1" and close the Property Form.
3. Ensure that the order of screen instance and panel beans in the "Details_TabbedPane" is as
in the above Design Time View screen shot.
4. Invoke the "Layout Properties" dialog for the "Details_TabbedPane" bean by right-clicking
it and selecting "Layout Properties" menu item.
5. Provide the "Title" text field value for "SystemConfig1" bean as "System Configuration"
(refer the above figure).
AdventNet, Inc.
126
Similarly, provide the "Title" text field value for the other beans in the "Details_TabbedPane"
as given in the table below
Bean
STP1
PortDetails1
Results_Panel
Title
STP
PortParameters
Results
AdventNet, Inc.
127
}
public void screenConfiguration()
{
try{
ConfigResultTableModel1.clearAllRows();
Configurator1.resetAll();
Configurator1.setTaskName("SwitchConfiguration_task");
Configurator1.addGroup("group1", SystemConfig1, null);
if (userOperations.toString().indexOf("Ems") != -1)
{
if ( userOperations.contains("Ems Configure All") && (!
userOperations.contains("Ems Configure None")))
{
Configurator1.addGroup("group1", STP1, null);
PortDetails1.saveTableValues();
Configurator1.addGroupInfoCaches(
PortDetails1.getSavedTableValues());
}
}
else
{
Configurator1.addGroup("group1", STP1, null);
PortDetails1.saveTableValues();
Configurator1.addGroupInfoCaches(
PortDetails1.getSavedTableValues());
}
Configurator1.doConfiguration();
Switch_Tree.setSelectionInterval((Switch_Tree.getRowCount())1,(Switch_Tree.getRowCount())-1);
}
catch(java.lang.Exception ex)
{
ex.printStackTrace();
}
}
AdventNet, Inc.
128
5. Select the Configurator Bean to be used for applying the Configuration. This is
applicable when there are some Configurator Beans already available in the Screen.
Since you do not have a Configurator Bean till now, this Select Instance combo box
is disabled. This means you need to instantiate a new one.
6. Specify the Instance Name in the New Instance Name text field (default is
Configurator1).
AdventNet, Inc.
129
12. Click "Finish" to close the Interaction Wizard. If you now go to the Component Tree
and click "Connections" you find two new connections created. This completes the
construction of the application.
AdventNet, Inc.
130
AdventNet, Inc.
131
Note: For security features, include four classes from the package
com.adventnet.security.authorization located in <Web NMS Home>/classes
directory into in <Client Builder Home>/projects/EMS_Configuration/classes
directory. The required classes are AuthorizationException.class,
AuthorizationEngine.class, AuthorizationEngineImpl.class, and
AuthorizationEngineImpl_Stub.class.
6.
Click Finish button to close the Package Wizard to get the confirmation dialog with the
message SwitchConfiguration.nar created successfully at <specified location>.
7. Import the NAR into the EMS Project, using the Client Application Import Wizard.
8. Deploy the NAR in Web NMS Client using the Deployment Wizard in Web NMS with the
required menu name and menu item
Note: The above project is also available in <Web NMS
Home>/StudioTools/ClientBuilder/projects
directory as EMS_Configuration that can be loaded for your reference.
AdventNet, Inc.
132
Start the server using WebNMS > Launch > Start WebNMS Server menu.
Start the client using WebNMS > Launch > Start WebNMS Client menu.
For more details on Debugging Applications Built in Eclipse, refer to the Web NMS EclipsePlugin
Guide.
- EMS_Tutorial
Output Directory
- C:\AdventNet\WebNMS\projects
- 1.0
Readme Path
C:\eclipse\workspace\EMS_Tutorial\README.html
Click Finish.
This will generate a NAR file called EMS_Tutorial1.0.nar..
You can deploy this NAR directly into Web NMS to install the application.
AdventNet, Inc.
133
Under the Operation Tree Root node the Ems Operations node was added and under the
Ems Operations node the three nodes Ems Configure All, Ems Configure Scalar, and Ems
Configure None were added.
AdventNet, Inc.
134
Operation
Ems Configure All
Ems Configure Scalar
Ems Configure None
So far it has been explained how to carry out the security configuration through a tool in the
AdventNet Web NMS.
Basically, the two default users (root and guest) are used to demonstrate this feature. The first user
root belonging to the Admin group to which the Ems Configure All operation is assigned, allows the
user to configure all the parameters of the switch. The Configure button remains enabled for this user.
The second user guest belonging to the Users group to which the Ems Configure Scalar operation is
assigned, allows the user only to configure the scalar parameters of the switch. The Configure button
remains enabled, but the second and the third tab is removed from the UI.
The screen shot below show the configuration UI when the Ems Configure Scalar operation is
assigned to a user. i.e., The user is authorized to configure only the scalar parameters of the switch.
Login to the Application Client with root or guest to see the difference in the Switch Configuration
Screen.
AdventNet, Inc.
135
Instructions
Follow the steps given below to assign Groups and Permissions for effective security Administration
Select Users and click the Add Operation Icon from the toolbar
Enter the name of the operation in the text field provided at the bottom. Say for
Example 'EMS Operations'.
Click Add. Scroll down the Operations tree to see the operation added. Select the
new operation that is added and add the Permitted EMS Operations ( say for
example Ems Configure All, Ems Configure Scalar) Click Add. Now Click OK.
Now, in the Security Administration screen, click Set Permissions to see 'Assign
Permissions' screen pop-up
Scroll down this screen and check the corresponding box against the new operation
added.
Click Done.
Admin
AdventNet, Inc.
136
Users
Users
root, guest
Admin
root
Result
The EMS users are grouped and different authorization levels are created. The Authorization for
operations is achieved for all the groups. The task that follows next is Re-branding.
AdventNet, Inc.
137
AdventNet, Inc.
138
5.10 Re-branding
In building your EMS, you may wish to customize the basic user interface functions. Web NMS
supports such customization for creating new products in multiple ways. To illustrate how this can be
done, you will make a few changes to the user interface to build an EMS that we will call as Acme
EMS. These are only a subset of the many changes that can be made to the user interface for specific
applications.
Aim
This section details on how to Rebrand the application built to suit the customers requirements.
Rebranding includes changing the name of the product its version, splash images, logo images etc.
Rebranding can be achieved using the Rebranding tool.
For details on Rebranding the Project, refer to the Web NMS Developer Guide..
Instructions
Follow the steps given below to Rebrand the EMS.
Change the values of the rebrandable entities as given in the table below:
Entity Name
Values
Company Name
Acme
Product Name
EMS
Version
1.1
Company URL
www.acme.com
Motto
Copyright
2003 - 2004
Splash Image
Frame Icon
Product Logo
Contact Address
Language
en
Country
US
Click on Rebrand button to carryout Rebranding and the Close button to close the screen.
Result
The AdventNet Web NMS is rebranded as Acme EMS.
AdventNet, Inc.
139
Note: It is mandatory to change the WebNMS Home with respect to your Web
NMS Installation using the WebNMS ->Project Properties menu in Eclipse IDE
before proceeding with development in this EMS_Tutorial project.
Open Eclipse IDE, please use File->Import menu. In the wizard, select General->Existing
Projects into Workspace and click Next.
This opens the EMS project in the workspace. Next, Select WebNMS ->Project Properties menu item
and Change the WebNMS Home with respect to your Web NMS Installation. Click OK. Now it is
possible to work with the EMS project.
AdventNet, Inc.
140
Stop the Web NMS Server if it is running (double-click Shutdown NMS Server icon from the
Web NMS Launcher or invoke ShutDown.bat/sh from <Web NMS Home>bin directory
This will install and show the status in the progress bar. See that the progress is 100%.
Now the installation is complete. Three entries will be listed in the Uninstall section of the
Deployment Tool. The entries are EMS_Tutorial1.0.nar, ChassisScreen and
SwitchConfiguration.
Reinitialize Web NMS using reinitialize_nms.bat/.sh under <Web NMS Home>/bin directory.
Both, the data and configuration are reinitialized.
Caution:
This tutorial will function only if Web NMS is reinitialized. Hence, after installing the
tutorial, reinitialize Web NMS.
Ensure you use separate Web NMS installation for tutorial application development
and installation.
Do not experiment on Web NMS deployed in real world.
AdventNet, Inc.
141
When this tutorial application is installed, the existing files which require changes, from the installed
Web NMS are backed up. However, when you un-install this tutorial application, the files modified will
be restored from the backup.
This will uninstall and show the status in the progress bar. See that the progress is 100%.
Click Close button. All the three entries pertaining to the Nar will be removed. Now the
uninstallation is complete.
Use File -> Import to invoke Import Wizard in Eclipse then select Import Existing Project
option in the tree.
Check the "Project from file system" option and browse and give the root directory of the
project as <Web NMS HOME>/StudioTools/Studio/projects/EMS_Tutorial directory.
Make the changes (supported by the AdventNet Web NMS EclipsePlugin) to the project as
per your requirement.
Un-install the existing installed NAR and install the new NAR generated with your changes.
Caution: Un-installing the original NAR is mandatory as only one Eclipse NAR is
permitted to be deployed in AdventNet Web NMS.
For complete details on Working with EclipsePlugin, refer to the Web NMS EclipsePlugin Guide.
AdventNet, Inc.
142
General testing
In the client, In addition to the ipnet and all other nodes, Switches node also get appears in
this tutorial application.
Check whether switches map has been created and also see whether the first five switches
are seen in the map with their interconnections.
In the switch chassis view (i.e., the tree node name ending with _view), see whether all the
components of the switch are seen. There should be empty cards in the alternate slots and in
each active card there will be a trunk port or four access ports depending on the type of the
card.
Try to update the status of the ports and see whether corresponding events are generated in
the events node.
The splash screen that comes up with the progress bar at the bottom will now show Acme
Element Manager instead of the default splash screen.
Wherever the name AdventNet appears in the client, it will now be seen as Acme. ( Note: If
Rebranding was done, the rebranded image will be displayed. Else the default WebNMS 5
Splash Image, Logo will be displayed. Refer the Rebranding section for more details.)
AdventNet, Inc.
143
Install the tutorial application NAR generated with the above changes.
Reinitialize Web NMS and start the Web NMS server again.
Once the server is up and running, start the Java client. Check for expected behaviour that is the
trunks will not be present for switch 4 and 5 as they would be rolled back. The same can also be
verified in the database.
You can also use the HTML client for this application.
Invoke the Security Administration screen from the tools menu of Web NMS client.
Select the Users -> root node from the Security tree.
In the Assign Permissions screen, you will see Permissions tree hierarchy.
In the Ems Operations tree under the Operation Tree Root node, un-select the Ems
Configure All operation and select the Ems Configure None.
When the above operation is performed, the configuration UI appears with the Configure button
disabled. i.e., not allowing the user to configure any of the switch parameters, but only viewing them.
AdventNet, Inc.
144
Discovery
This diagram shows the interaction and message flow among Web NMS components while
processing a newly discovered network element (device).
AdventNet, Inc.
145
3. To confirm the existence of the IP or nodes, performs test viz., user-defined test and
SNMP/TL1/ICMP ping process. When the whole address range is swept for the networks
identified, the discovery engine schedules the rediscovery process.
4. It locates the user-defined discovery filter class from oidtype.data or discovery.filters file.
The custom filter is searched in oidtype.data followed by discovery.filters. The
device(sysOID)-specific filters are contained in the oidtype.data file, whereas general filters
are specified in the discovery.filters file.
5. It then creates a ManagedObject (via TopoAPI) which models the discovered device. It
invokes filterObject() method of the custom discovery filter for the discovered device type.
General filters are invoked (in sequence as listed in discovery.filters) for every device that
has been discovered.
6. Using these filters, the Managed Object properties can be modified, new ones can be added,
and existing ones can be deleted before adding the Object to the database.
7. The discovery engine then adds the nodes (objects) into the topology database after carrying
out the above operations. The custom discovery filter calls TopoAPI.addObject() method for
Topology Module to add the ManagedObject into TopoDB.
8. If a user tester class has been specified in oidtype.data for this device type, Topology
Module registers the tester with Polling Engine so that it (tester) will be invoked in poll interval
(also defined in oidtype.data) for status poll.
9. Map Server is registered as an observer of the Topology Module. The topology module
notifies Map Server whenever a ManagedObject gets added for the newly discovered device.
10. Map Server locates the custom map filter for the device type from mapicon.data. General
map filters from map.filters are invoked in sequence once the device-specific filter completes
execution.
11. Map Server invokes filterMapSymbol() method of the map filter found at Step 10 and passes
the ManagedObject.
12. The custom map filter creates map symbol(s) (and link(s) if necessary) for the discovered
device. A new map can also be created by the filter.
13. Map Server receives the map symbol(s) (and possibly a new map) from the map filter and
saves them into MapDB.
14. Map Server invokes the map renderer to display the symbols on the map panel of the Client.
Topology Update
This diagram shows the interaction and message flow among Web NMS components when the
topology database is updated for any changes in an existing ManagedObject. MO update/delete can
be triggered from Client GUI (via Map menus), Trap/event filters and status polls (escalating severity),
Policy Engine (deleting orphan objects), or configuration change (via Client).
AdventNet, Inc.
146
1. At periodic intervals based on the configured Status Poll interval, Polling Engine invokes
test() method of the registered custom poll class (see Step 8 in the Discovery Process
above).
2. The default / user defined Tester class performs status checks on the target device and
returns an appropriate Severity level (defined in severityinfo.conf).
3. Polling Engine invokes TopoAPI.updateStatus() method if the severity level returned by test()
method is different from the current level of the managed object. Topology Module, in turn,
updates the managed object in the TopoDB and notifies Map Server for map update (Step 9).
4. User sets configuration parameter(s) for a selected device from Client GUI. Client sends the
set request (in XML format) to Config Server.
5. Config Server parses the XML message and performs SNMP SET for requested config
parameter(s). If one or more parameters correspond to property(ies) of the managed object
in TopoDB, Config Server invokes TopoAPI.updateStatus() method. Topology Module, in turn,
updates the managed object in the TopoDB and notifies Map Server for map update (Step 9).
6. For an incoming trap, Event Server searches (based on trapID) for the corresponding filter
class in trap.filters and invokes applyTrapFilter() method for processing.
AdventNet, Inc.
147
7. The trap filter calls TopoAPI.updateStatus() if ManagedObjects status (i.e., severity) needs to
be escalated or downgraded, updateObject() if one or more properties are to be changed, or
deleteObject() if one or more ManagedObjects are to be deleted (due to removed devices).
Topology Module, in turn, updates the managed object in the TopoDB and notifies Map
Server for map update (Step 9).
8. Policy Engine invokes a custom Policy Class, if provided, to delete orphan object(s) based on
its rule (such as special severity level).
9. After updating the database, Topology Module notifies Map Server. The notification includes
the type of change such as deleted (MO removal), manage (MO managed property), status
(MO severity), property (other MO properties).
10. Map Server locates the custom map filter for the given device type from mapIcon.data.
General map filters from map.filters are invoked in sequence once the device-specific filter
completes execution.
11. Map Server invokes update() method and passes the ManagedObject along with update type
(update/delete).
12. The Map Filter walks through all map symbols associated with the ManagedObject and
changes the properties of each map symbol (if required). It calls MapAPI.updateSymbol() for
Map Server to update MapDB.
13. Map Server invokes renderer to update the map display on Client.
AdventNet, Inc.
148
9. Known Issues
When this application is installed, it replaces some of the existing conf files with the new ones
needed for this tutorial. If the user has made any changes in the already existing filters, then
the changes will not take effect during the tutorial session. Though all the original conf files
will be restored once the tutorial is uninstalled.
AdventNet, Inc.
149
Solution
In the "Switch Configuration", unable Check if the SNMP Agent Simulator is running with
to configure Variables in Port
the appropriate Configuration file.
Parameters Table.
Ensure that the Enter key is pressed after entering values in
the Port Parameters Table of Switch Configuration.
Also ensure that the "Configure" button is pressed before the
next polling as the polling is very fast.
The
"java.lang.NoClassDefFoundError:
org/apache/xalan/serialize/Serializ To overcome this exception, it is necessary to add the
erToXML"
following jar files in startApplicationClient.sh/bat
exception can occur when classes
from the ManagementServer.jar and 1. ManagementServer.jar
NmsServerClasses.jar
2. NmsServerClasses.jar
were not present in the classpath
while starting the server.
To overcome this exception, please follow the endorsed
mechanism as per steps given below:
The "
java.lang.ClassNotFoundException"
can occur while starting the client.
This exception occurs when classes
from the crimson.jar, jaxp.jar and
xalan.jar were not present in the
classpath.
AdventNet, Inc.
150
Problem
Solution
Scenario 1 :
javax.xml.transform.TransformerExc
eption:
java.io.FileNotFoundException:
file:\C:\Program%20Files\AdventNet\ Kindly install the WebNMS in a directory which does not have
WebNMS\NetMonitor\build\uninstall. space characters in its path.
xml
(The filename, directory name, or
volume label syntax is incorrect)
at
org.apache.xalan.transformer.Transf
ormerIdentityImpl.createResultConte
ntHandler
(TransformerIdentityImpl.java:260)
at
org.apache.xalan.transformer.Transf
ormerIdentityImpl.transform
(TransformerIdentityImpl.java:291)
Scenario 2 :
java.net.MalformedURLException:
unknown protocol: c
These above two exceptions
occurs when there is a space in the
directory path where WebNMS is
installed and trying to install a NAR
file in WebNMS. This is a JDK bug
which occurs in some scenarios
where Xalan parsing of XML file is
done.
AdventNet, Inc.
151
11. Glossary
This glossary list contains some of the definitions for the terms that are used in this tutorial. Click here
to see the complete AdventNet Web NMS Glossary List.
Switch
In networks, a device that filters and forwards packets between LAN segments. Switches operate at
the data link layer (layer 2) of the OSI Reference Model and therefore support any packet protocol.
Slot
An opening in a switch where you can insert printed cards.
Card
A printed circuit board that you can insert into a slot to give it added capabilities.
Access Port
This port is the physical gateway between a customer's local loop and the frame relay network.
Trunk Port
An input on a PABX (Private Automatic Battery Exchange) or KSU (Key Service Unit) that is used to
interface the system with C.O. (Central Office) lines.
Trunk
A telephone communication path or channel between two points, one usually being a Central Office.
KSU
A central control cabinet serving many multi-button key telephones. Contains equipment which
enables the user to pick up and hold PABX or Central Office lines and provide flashing line, steady,
busy and wink hold signals. Dial intercom service is also an option.
C.O./CO
A main telephone office where switching equipment is housed and customer lines originate. Also
contains trunk line connections to other Central Offices.
FAQ
The list of Frequently Asked Questions (FAQ) which serves as a guide to understand the AdventNet
Web NMS.
To see the Web NMS FAQ click the following link
Web NMS FAQ - These contains questions that will arise in the minds of a Web NMS user.
AdventNet, Inc.
152
AdventNet, Inc.
153