Layer 2 Discovery and Mapping Tutorial

Table Of Contents

LAYER 2 DISCOVERY AND MAPPING TUTORIAL...... 2 1.1 Foreword ...... 3 1.2 Introduction...... 4 1.3 Layer2 Discovery and Mapping Tutorial Tour ...... 6 1.4 Application Overview...... 8 2. TRY IT YOURSELF ...... 10 3. APPLICATION DESIGN ...... 15 4. DETAILED IMPLEMENTATION ...... 17 4.1 Creating a Layer2 Project...... 18 4.2 Discovery...... 20 4.2.1 Creating Discovery Filter ...... 20 4.3 Mapping...... 22 4.3.1 Creating Map Filter ...... 22 4.3.2 Customizing and Configuring Custom Maps ...... 24 4.3.3 Navigating Custom Switch Map...... 28 4.3.4 Status Polling for Layer2 Devices...... 30 4.4 Packaging the Project ...... 33 5. FAST TRACT IMPLEMENTATION...... 34 6. CONTROL FLOW DIAGRAM...... 35 7 DEPLOYMENT AND TESTING ...... 36 7.1 Installation Notes...... 36 7.2 Application Testing ...... 38 8. KNOWN ISSUES ...... 39 9. TROUBLE SHOOTING TIPS...... 40 10. GLOSSARY ...... 41 11 APPENDIX...... 43 11.1 Fundamental Concepts ...... 43 11.2 Layer2 Application Classes ...... 45 12. OTHER TUTORIALS ...... 47

AdventNet Inc. 1 Layer 2 Discovery and Mapping Tutorial

Layer 2 Discovery and Mapping Tutorial AdventNet Web NMS

Version 1.0

This tutorial guides you in designing an application to discover the layer2 devices. It is supported by a working, illustrative example.

Copyright © 1996-2002 AdventNet, Inc. 5645 Gibraltar Drive Pleasanton, CA 95014 http://www.adventnet.com [email protected]

AdventNet Inc. 2 Layer 2 Discovery and Mapping Tutorial

1.1 Foreword

AdventNet Web NMS provides real world network management solutions to and enterprise markets with a range of advanced network management features. The two important needs of the market, easy customization and faster deployment are met with the help of AdventNet Web NMS Studio.

Different types of applications can be built with AdventNet Web NMS. This tutorial will serve as a simple guide to build a Layer2 Discovery and Mapping application.

• A Brief Note on AdventNet Web NMS • Understanding Fundamental Concepts

Real World Layer2 Discovery Solutions

Any / internetwork is designed based on the OSI standards. The design may adhere either strictly or loosely to the OSI Reference Model (an ANSI standard). Each layer performs a set of functions unique to it. Layer 2 in a network, is the 'data-link' layer. It is this layer where data- packets are encoded and decoded into 'bits'. Error handling and flow control is also handled in this layer. This layer comprises the MAC Layer (Media Access Control) and LLC Layer (Logical Link Layer). The MAC layer determines how a computer in a network gains access to data and transmits the same. The LLC handles frame-synchronization, flow control and error- checking. It therefore becomes important to monitor and manage any fault in this layer, especially in today's world where Network Management is a mammoth task. AdventNet Web NMS is a Network Management Solution. You can customize Web NMS to suit your requirements. If you need to discover and manage these layer2 devices, you can build your application on Web NMS. Optical Network Management Solution is one of the Real World Network Management Solutions.

A Brief Note on AdventNet Web NMS

AdventNet Web NMS is designed as a development framework for building management systems and applications in multiple domains. The core information model is simple and is easy to learn and extend for each application. The elements of the core model are designed for IP networks and are sufficient to represent common IP networks. Few factors that make AdventNet Web NMS the preferred network management solution are

• Immense scalability • Customizability • Extensibility • Easy deployment

AdventNet Web NMS uses the database mode. It uses MySql as the default RDBMS which stores the objects in the topology database in the form of relational tables.

Understanding Fundamental Concepts

Before we jump-start into building a custom application using AdventNet Web NMS, it is imperative to understand a few basic concepts. The 'Fundamental Concepts' section of this tutorial is a brief tour through these concepts. A quick run through the application life cycle will follow, giving you an idea of the flow in the application.

The concepts that you must be familiar with are

• OSI Reference Layers •

AdventNet Inc. 3 Layer 2 Discovery and Mapping Tutorial

1.2 Introduction

Here is a real time situation where you would like to build a solution for Layer2 Discovery and Mapping. Let us say you want a switch to be shown as a container with the switch in the middle and all the nodes that are connected to it. The port numbers to which the nodes are connected are to be displayed on the Links between the switch and the .

Objective of the Tutorial

This tutorial will help you understand and build a Layer2 Discovery and Mapping application using AdventNet Web NMS Studio to meet your needs. The use of AdventNet Web NMS Studio helps in building this application with very little or zero coding, resulting in faster development and easy deployment.

This tutorial helps you build only a sample application. The application 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. This example can be extended for applications with similar needs.

About this Tutorial

• Intended User • Prerequisites • Related Sources • Printed Version • Tutorial conventions

Intended User

Do you want to build an application for Layer2 Discovery and Mapping? Then you are in the right place! This tutorial will help you build one. As stated earlier, you may extend the given application too if it can meet your specific needs.

Prerequisites

You must have

• Knowledge of Network Management System • Knowledge of Java Programming • Fair knowledge of SQL and relational database concepts (not a must !)

Related Sources

This tutorial makes constant references to AdventNet Web NMS and AdventNet Web NMS Studio. Minimal information is provided in this tutorial. If you want to know more about the product and the tools, refer to the Web sites given below:

For AdventNet Web NMS Studio Documentation, visit

/StudioTools/Studio/help/index.html

For AdventNet Web NMS Documentation, visit

http://www.adventnet.com/products/webnms/help.html

AdventNet Inc. 4 Layer 2 Discovery and Mapping Tutorial

Printed Version

To print this tutorial

• Ensure that Adobe Acrobat Reader is installed in your system • Download the PDF version of this document from the following URL

http://www.adventnet.com/products/webnms/layer2_tutorial.pdf

Tutorial Conventions

The typographic conventions followed in this tutorial are

Font Style Uses Arial Bold Filename Arial Italic Directory Arial Bold Italic Methods / Interfaces / Classes Courier New Code snippet Courier New Bold Highlighting important code Italic snippets

AdventNet refers to the directory where Web NMS is installed.

Learning from This Tutorial

From this tutorial, you will learn how to

• Build an application for Layer2 Discovery and Mapping • Use AdventNet Web NMS Studio • Use the Nar and the Project bundled with the tutorial

AdventNet Inc. 5 Layer 2 Discovery and Mapping Tutorial

1.3 Layer2 Discovery and Mapping Tutorial Tour

This tutorial comprises three stages.

Stage 1

A ready built Application is provided in this stage. You can deploy this application in AdventNet Web NMS and see what it is all about. It gives you an experience of traversing through the application that you will eventually build.

• Try It Yourself - The steps given in this topic helps you deploy and experience the Application. • Application Design - This topic gives you an overview on the Application Design. It explains the purpose of the Application and the different stages involved in building it.

Stage 2

This stage guides you in building the Application yourself using AdventNet Web NMS Studio. The topics in the Detailed Implementation section helps you understand and build the Application.

• Creating a Project - This topic describes the steps to create a Project using the Studio. A project work-space is created. You can proceed to the next stages of building the Application once the project is created. • Discovering Devices - This topic guides you in creating a Discovery Filter to discover Switches with the SNMP Devices connected to it. • Mapping Devices - This section helps you in creating a Map Filter and represent the discovered Switches on a Map. • Status Polling - This topic helps you create a Status Poller. The important methods in the corresponding class file are explained in depth. • Packaging - This is the final stage. Once

AdventNet Inc. 6 Layer 2 Discovery and Mapping Tutorial

Stage 3

In this tier, you are guided to work with the bundled project If you are unable to proceed with building the Application yourself.

The topic Fast Track Implementation, helps you do this.

Have an AdventNet Experience!

Following flow line diagram has image mapping to the respective topics :

Fig: Tutorial Tour-Flowline

AdventNet Inc. 7 Layer 2 Discovery and Mapping Tutorial

1.4 Application Overview

Layer2 Discovery and Mapping Tutorial involves very few additional tools for building the components. It uses the existing map containers and map symbols for displaying the switch map.

The current version of this application is bundled as a separate tutorial which also has the NAR created for the application. The NAR can be installed or uninstalled in the Web NMS using the Deployment Wizard. Due to some changes in the logging of messages in the current version, this version of the application is not compatible with the earlier versions.

• Application Specification • Description of System Used in the Application • Description of the Application • Functioning of the Application • Implementation in a Nutshell • Modules Covered

Application Specification

Name of the Application : Layer2 Discovery and Mapping Application Version of Web NMS : Web NMS Release 4.7.0 Compatibility with other : Not compatible with previous versions of Web NMS Versions Tools used and their : AdventNet Web NMS Studio Versions Platform-specific : No special requirements requirements

Description of System Used in the Application

This application models any device as a switch that has

• One or more hardware ports • The SNMP Agent on the device implements the Spanning Tree Protocol

The application displays a Switches Map that appears as soon as a switch is discovered by the discovery module. A separate switches map appears for each of the network discovered. This separate switches map is required to avoid the clustering of the switches of various networks and to improve visual representation. The Switches Maps are named as .switches for each discovered network.

A Switch is shown as a container (A square with a cloud image inside) with the switch in the middle and all the directly connected nodes around it. The port numbers to which the node is connected is displayed on the link between them. The Spanning Tree Protocol Link between the switches is also mapped.

Description of the Application

This example application is an illustration on developing useful Layer2 Topology, Discovery and Mapping features using the APIs of Web NMS. It also brings forth the customizability and extensibility of the Web NMS framework and also eases the network management applications developer into the development framework. It also familiarises some of the important APIs of Web NMS.

AdventNet Inc. 8 Layer 2 Discovery and Mapping Tutorial

Note: This Tutorial Application is only an example and not a full-fledged scalable feature. However, this example can be extended for your specific needs.

Functioning of the Application

• Identifies a Switch once Web NMS discovers the device. • Queries the Switch periodically (status polling) using SNMP for machine addresses linked to the Switch. This data is queried from the Bridge MIB implemented by the Switch's SNMP Agent. • Processes the data obtained from the switch to find all the SNMP Nodes (devices running SNMP Agent) connected to the Switch directly. Excludes other switches from this list. • Maps the Switch and all its directly connected SNMP Nodes on a Layer2 Map as and when the devices come up. This map, called switchmap, is on per IP Network basis. • Queries the Switch periodically (status polling) using SNMP for Spanning Tree data and processes this data to map Switch to Switch links. This Spanning Tree data is queried from the Bridge MIB implemented by the Switch's SNMP Agent. • Updates the status of the Switches and other devices periodically. • The Map symbols representing the devices can be selected to view the device properties like IP Address, Name, Ports, Physical location, etc.

Implementation in a Nutshell

The tutorial application is designed using AdventNet Web NMS Studio Tool that is bundled with AdventNet Web NMS. The Project created using Studio is compiled and packaged into a NAR file (with a .nar extension). This NAR is installed in AdventNet Web NMS using the Deployment Wizard. Optimum use of the Studio Tool is made in this application. It also contains some custom code, tailored to suit some specific needs of the application. Files specific to the tutorial application are added as other files in the Studio (Look into the corresponding Studio documentation for more details). The Project is also bundled with the tutorial. If you wish to try using the Project, make the required changes, compile, and package it. Uninstall the existing NAR and install the new NAR created.

Warning: Uninstalling the original NAR is mandatory as only one Studio NAR is permitted to be deployed in AdventNet Web NMS.

This application implements the Spanning Tree Protocol.

Modules Covered

Discovery Module : Uses the switch discovery filter class after the discovery process to identify the switches. Topology Module : Uses TopoAPI and MapAPI to add objects into the database. Protocol Module : Uses SNMP Calls to the devices for Device-specific information. Map Module : Uses the SwitchMapFilter, SwitchContainerLayout to layout the components into the map.

AdventNet Inc. 9 Layer 2 Discovery and Mapping Tutorial

2. Try It Yourself

You would surely like to deploy the tutorial application and run it. Try the following simple steps and see it yourself!

Using the NAR

The application is provided as a NAR file (with a .nar extension). You simply have to deploy this NAR in AdventNet Web NMS to see the output.

The steps to try the tutorial application are:

• Before You Begin • Obtain the NAR • Deploy the NAR • Start NMS Server • Start the Client • See the Result!

Before You Begin

Ensure that AdventNet Web NMS 4 is installed. If not, download and install the same from the following url: http://www.adventnet.com/products/webnms/download.html

Refer to 'Installation Guide' of AdventNet Web NMS if you require any help for installation, available in the following location: http://www.adventnet.com/products/webnms/help/installation_guide/index.html

Note: By default, Web NMS will discover the local network. The network must contain Switches. You can also configure the networks / some devices in a network to be discovered by editing the seed.file available in /conf directory. You can also add nodes from the client. Select Network Database node in the tree. From the Edit menu, choose the Add Node option, and provide the IP address of the required node.

Obtain the NAR

• Use the bundled NAR

As stated above, the application is bundled as a NAR along with AdventNet Web NMS

Select the following NAR file from the /tutorials/layer2_tutorial directory:

Layer2_Tutorial1.0.Nar

Deploy the NAR in AdventNet Web NMS

• Deploy the NAR file using the Deployment Wizard present in /bin directory. Refer to Installing the Application section to know the step-by-step procedure of installing the NAR.

• Reinitialize Web NMS using reinitialize.bat/sh present in bin directory before you start the server.

AdventNet Inc. 10 Layer 2 Discovery and Mapping Tutorial

Start Web NMS Server

• Invoke WebNMSLauncher.bat/sh file in the directory to start Web NMS. • Click Start NMS Server icon in the Web NMS Launcher.

Connect to the Web NMS Client

After the server is started, connect to the Web NMS Client. To connect, open a browser and enter the following url in the address bar:

*http://:9090 (name or the IP of the machine in which the Web NMS Server is running) [OR] You can also connect to the Application Client. Run startApplicationClient.bat/sh from /bin directory. Enter the host name and the port number in the corresponding fields.

Log in (both, Applet or Application Client) with the user name as root and password as public.

See the Result

The first screen of the tutorial application displays the switches map containing all the discovered switches in a network. For each discovered switch, a switch map is added as a sub node under the switches map of the corresponding network. Click on the images to see the enlarged map.

Switches Map

Click on a switch map node to see the enlarged switch with the nodes connected to it and their corresponding link and port numbers. See the reference snapshot.

AdventNet Inc. 11 Layer 2 Discovery and Mapping Tutorial

Individual Switch Map

Map Link Properties

The Map Links are displayed in different colors based on their Link Speed (ifSpeed). You can configure two user properties; linkSpeed and linkColor. The default linkColor is blue. A detailed description of configuring linkSpeed is discussed in the Implementation --> Customizing and Configuring Custom Maps section of this document.

Map Links

AdventNet Inc. 12 Layer 2 Discovery and Mapping Tutorial

Switch and Port Status

In Web NMS, device status is indicated using different colors. The colors and their corresponding status mapping is provided in the table given below.

Status Colors

Clear Green Warning Cyan Minor Yellow Major Orange Critical Red

The status of the discovered container is clear at startup (green color). The status of the switch gets updated during the subsequent status pollings. The Nodes in the switch container displays labels when zoomed. The labels disappear when the size is restored. Right-click the switch and select 'Status' option to see the Switch status. Reference snapshot is provided below.

The port-wise details of each switch can also be seen. Each port status can be identified by the color of the port and these ports are connected based on their ifSpeed. Click on each port to see the port details displayed on the status panel on the top.

Switch and Port Status

AdventNet Inc. 13 Layer 2 Discovery and Mapping Tutorial

LayerTwo Alarm node in the tree

LayerTwo is added as a sub node under the Fault Management > Alarms node. The LayerTwo Alarm custom view segregates the Alarms from the Layer 2 Switch Elements and displays them separately. The custom view filters out the alarms received from rest of the Elements. The Tutorial Application creates this custom view and displays when the first Alarm from the Layer 2 Switch Element is received.

Note: This is only an example and not a full-fledged scalable feature. However, this application can be extended for your specific needs.

AdventNet Inc. 14 Layer 2 Discovery and Mapping Tutorial

3. Application Design

Aim

Depict the switches as Containers. The SNMP Nodes connected to the switch are to be shown inside the Container along with the port numbers on their links. The status of the discovered switches and the nodes connected to it must be updated. The Switches and the nodes must be represented on a Map. The Map must also show the switch-to-switch spanning tree protocol link.

The application limits itself to the switches and the SNMP Nodes discovered. Other objects in the network are not managed by this application. The discovered switches and nodes are updated periodically by status polling.

Requirements

• Create Discovery Filter to discover Switches in a network along with the nodes • Create and Configure Map Filter • Create Custom Map to show Switches • Update Switch and Port Status by status polling

Requirement Details Tasks Role of Studio Create Discovery Enables you to • Create a Discovery Wizard Filter discover Switches in Simple is used a Network along Discovery Filter with the SNMP • Specify the Nodes that are filtering criteria connected to the for the Filter Switches directly. Create Map Filter Enables you to • Create the Map Map Filter Wizard specify the filter filter named is used criteria. Some SwitchMapFilte custom code has r. gone into map filter • Customize the to change the Map filter. symbol • Configure the automatically Map filter by generated for each editing trunk to a link on the mapIcon.data map. file.

Create Custom Custom Maps are • Create Custom Other Files option Map to show created to show Map by is used. Switches custom maps other extending than the default MapApplet. maps • Configure the created Custom Map by editingNmsPa nel.conf file. • Create the Switch Map Link Renderer class to

AdventNet Inc. 15 Layer 2 Discovery and Mapping Tutorial

Requirement Details Tasks Role of Studio support the Custom Map. • Create the switchLink.prop erties file to configure the properties of Switch Map Link Renderer class.

Create and Enables you to • Create the Other Files option Configure Status update the status of Status Poller is used to write Poller the Switches and named SwitchStatusPoller the Ports by status SwitchStatusP class polling. Some oller. custom code is • Customize the involved to suit the Status Poller. Application • Create other requirements. classes used in the Status Poller class for making various SNMP calls to the switch's Bridge MIB.

AdventNet Inc. 16 Layer 2 Discovery and Mapping Tutorial

4. Detailed Implementation

The Studio Implementation of the Layer 2 Discovery and Mapping application is explained in this section. Unlike most other tutorial applications, this application places emphasis mainly on the Map Module, and Discovery Module of AdventNet Web NMS. The application uses the existing Managed Object model for the devices and does not dwell into details of modeling an object, re-branding the application etc. The application implementation is explained in a few stages.

The implementation stages are:

• Creating a Layer2 Project • Creating and Configuring Discovery Filter • Creating and Configuring Custom Maps • Creating and Configuring Map Filter • Status Polling for Layer2 Devices

Using AdventNet Web NMS Studio

A Project is created for the Application using the Project Wizard of Studio. The Discovery Filter Wizard and Map Filter Wizard are used to create the Discovery Filter, and Map Filter respectively. The OTHER FILES option of Studio is extensively used in this Application. See the following image to know the Studio Architecture. Note that only few of the services represented in the diagram are used by this application.

AdventNet Inc. 17 Layer 2 Discovery and Mapping Tutorial

4.1 Creating a Layer2 Project

The Application is built by first creating a Project using AdventNet Web NMS Studio. Follow the given steps to create a Project with Studio.

Refer AdventNet Web NMS Studio documentation to know more about creating a Studio Project.

Starting AdventNet Web NMS Studio

Invoke the Studio from the Web NMS Launcher by double-clicking the Studio icon or run startWebNMSStudio.bat/sh from /StudioTools/Studio/bin directory. The Project Wizard is invoked.

To Create a Layer2 Project

Step 1: Invoke the Project Wizard by selecting File --> New --> Project menu item.

Step 2: Add Project Details.

• Enter the following Project details in the corresponding fields.

Project Name - Layer2_User Package Name - com.adventnet.nms.tutorials.layer2 Application Name - Layer2_User Version - 1.0

• Click Next to proceed.

Step 3: Select Device Details.

• Provide the following device details.

Protocol - SNMP Device Type - Switch Device OID - .1 Poll Interval - 300 seconds

• Provide MIB details by adding the required MIB (BRIDGE-MIB) using browse button.

Step 4: Select Web NMS Service Details.

• Select only required services for the Application (all services are selected by default).

• Discovery • Map • Security • Rebranding • Server_Configuration

• Click Next to proceed.

Step 5 : Select Databases

Select only the required databases for the Application (all databases are selected by default). • MySQL • Oracle

Click Next to proceed.

AdventNet Inc. 18 Layer 2 Discovery and Mapping Tutorial

Step 6 : Provide User Details

• Select Single User to give 'Admin' permission to a user for all Services and click Next.

Step 7 : Complete the Project.

• Verify if all the details furnished in the above steps are correctly displayed in the 'Project Summary' screen that follows: • Click Finish.

The Project Workspace is created once you click Finish. The Resource Factory Wizard starts next. This application does not require the help of this wizard. So, click Cancel. The next topic will help you create and configure a discovery filter.

AdventNet Inc. 19 Layer 2 Discovery and Mapping Tutorial

4.2 Discovery

4.2.1 Creating Discovery Filter

Aim

Creating a Discovery Filter to discover Layer2 devices.

The Discovery Filter wizard of the Studio takes care of package structure, variable declaration, filtering criteria, list of managed objects, their instances, property form, and return value of the discovery filter class. The discovery filter will eliminate objects that are not managed and the objects that are non-SNMP.

Refer AdventNet Web NMS Studio documentation to know more about creating a Discovery Filter.

Creating Discovery Filter

AdventNet Web NMS Studio is used to create the Discovery Filter. The two types of Discovery Filters available are -- Shallow and Deep. You can opt Shallow Discovery to discover only a particular device. Deep Discovery option helps you discover the device and its components. Opt Shallow Discovery for the tutorial application. This will only discover a Switch and the SNMP Nodes that are connected to it and not the Chassis.

The conditions that need to be satisfied are, • the discovered object must be a switch with at least one hardware port • it must implement the spanning tree protocol

Step 1 : Invoke the Discovery Filter Wizard

• From the tree nodes, select Services -->Discovery -->Discovery Filter (right-click) -->New option • Select 'Shallow Discovery' option from the prompted dialog box

Step 2: Enter the following Filter Details and click Next to proceed.

• class name of the Discovery Filter - SwitchDiscFilter

Step 3 : In the Variable Declaration screen, click Next to proceed.

Step 4 : Enter the following criteria in Criteria Table using the Add button. The specified criteria will eliminate objects that are not managed, or if the managed object is not a TopoObject or a non-SNMP object.

Note: To add Criteria2, Criteria3 etc., select and right-click on the Criteria node in the tree. From the popup menu, choose, Add Node option.

Criteria 1 (managedObject==null) Criteria 2 (!(TopoObject)managedObject).getIsNode() Criteria 3 (!(TopoObject)managedObject).getIsSNMP()

Step 5: Click Next till you get to the Source Preview screen. Click Finish.

This file will be available as a sub-node under DISCOVERY FILTER in the Studio tree. When you select this file, it opens in JMACS editor. You can make any required changes to the file and compile it.

AdventNet Inc. 20 Layer 2 Discovery and Mapping Tutorial

SwitchDiscFilter Class

The SwitchDiscFilter class implements FoundFilter() method (com.adventnet.nms.topodb.FoundFilter). This Discovery Filter identifies a switch element from other elements and sets in UserTest class name. It queries the object's SNMP Agent for its number of ports. If the managed object has a hardware port and implements the Spanning Tree Protocol, set the UserTest class to this ManagedObject.

synchronized(target) //Since SnmpTarget is not thread safe. { //Query object for the number of ports. target.setTargetHost(((TopoObject)managedObject).getName()); target.setSnmpOID(new SnmpOID("17.1.2.0")); String numPorts = target.snmpGet(); if (numPorts != null) //Object has a hardware port. {

{ managedObject.setTester("usertest"); managedObject.setType("Switch"); managedObject.setUClass("com.adventnet.nms.tutorials. layer2.DummyStatusPoller"); managedObject.setStatusPollEnabled(true); managedObject.setPollInterval(300); target.setObjectID(".1.3.6.1.2.1.17.1.1.0"); String nodeMac = target.snmpGet(); String nodeIp = ((SnmpNode)managedObject).getIpAddress(); System.out.println(" nodeMac -- >"+nodeMac + " node Ip -->"+nodeIp); managedObject.setUserProperty("macAdd",nodeMac); // WARNING: This property should not be updated externally. managedObject.setUserProperty("isFDBTablePopulated", "false"); MacVsIPdisc.macVsIp.put(nodeMac,nodeIp); } } }

AdventNet Inc. 21 Layer 2 Discovery and Mapping Tutorial

4.3 Mapping

4.3.1 Creating Map Filter

Aim

Create and configure a Map Filter for Layer2 devices in a network.

Refer AdventNet Web NMS Studio documentation to know more about creating a Map Filter.

Creating Map Filter

In this Application, Custom Maps are created in SwitchStatusPoller class by implementing the test() method that is called from SwitchMapFilter class.

AdventNet Web NMS Studio is used to create a Map Filter for this application. The Map Filter Wizard takes care of package structure, variable declaration, filtering criteria, list of managed objects, their instances, property form and return value of the map filter class. Some amount of custom code is involved. Code snippet of the same is available in this topic for easier implementation.

Step 1: Invoke the Map Filter Wizard

From the tree nodes, select Services > Map > Map Filter

Step 2: Enter the following Filter Details and click Next to proceed

• class name of the Discovery Filter - SwitchMapFilter • package name - com.adventnet.nms.tutorials.layer2

Step 3: Skip the Variable Declaration details. Click Next in this screen

Step 4: Enter the following criteria in the Criteria Table using Add button

Criteria1 (managedObject.getUClass() != null & managedObject.getUClass().equals("com.adventnet.nms.tutorials.layer2.DummyStatusPoller")) Criteria2 (mapSymbols != null)

Step 5: Click Next till you get to Source Preview screen. Click Finish.

You can see this file as a subnode under MAP FILTER in the Studio tree. When you click this file, it opens in the right panel in JMACS editor. The required changes can be made here.

SwitchMapFilter Class

The SwitchMapFilter class implements com.adventnet.nms.mapdb.MapFilter. In this class, the UserTest class is checked and the test() method of the DummyStatusPoller class is invoked which in turn uses a static instance of the SwitchStatusPoller class to add the corresponding map containers and map symbols to the Map.

AdventNet Inc. 22 Layer 2 Discovery and Mapping Tutorial

//Create the switch map with the switches, all their //connected nodes, and links; and the link to root switch //for the first time. try { TopoAPI tapi = (TopoAPI) NmsUtil.getAPI("TopoAPI"); DummyStatusPoller dummyStatusPoller = new DummyStatusPoller(); int not_used = dummyStatusPoller.test(managedObject, tapi); } catch (Exception e) { NmsLogMgr.MISCUSER.log("SwitchMapFilter :" + managedObject.getName() + ":",Log.SUMMARY); NmsLogMgr.MISCERR.log("Error running \"DummyStatusPoller\"" + " from the map filter : \"SwitchMapFilter\"" + " : " + e.getMessage(),Log.SUMMARY); NmsLogMgr.MISCERR.fail("Trace " ,e); }

AdventNet Inc. 23 Layer 2 Discovery and Mapping Tutorial

4.3.2 Customizing and Configuring Custom Maps

Aim

Customize and configure the Custom Maps created to represent the status-updates during the subsequent status-polling.

In this Application, Custom Maps are created in SwitchStatusPoller class by implementing the test() method of SwitchMapFilter class. When a switch is discovered, it is added to the Custom Switch Map in that network. During subsequent status-polling, the status is updated based on the link speed. The Custom Maps created here can be customized.

• Customize Custom Maps • Configure the Custom Map • Render Map Symbols • Create other relevant classes • Configure Map Link Properties

Customizing Custom Maps

Custom maps are created for showing the Switches in a network in the SwitchStatusPoller class. The first custom map is created for the switches under each discovered Network. On discovering the first switch, a .switches.netmap is created under the corresponding network map. The subsequent discovered switches in that network are added to the same map. The Custom Maps thus created can be 'customized' by extending the MapApplet class.

Please note that this tutorial Application involves some amount of custom code in customizing custom map.

Extending MapApplet Using Studio

To extend the MapApplet, follow the steps given below:

Step 1:

• Right-click Other Files node in the Project tree and select New

A New File dialog opens. Provide the following details:

File Type Client Java File Name ExtMapApplet.java Extends com.adventnet.nms.mapui.MapApplet Package Name com.adventnet.nms.tutorials.layer2

Step 2:

• Click OK

A java file - ExtMapApplet.java is created under the OTHER FILES node. The file is opened in the right panel. You can take a look at the source file located at:

/tutorials/layer2_tutorial/otherfiles directory

AdventNet Inc. 24 Layer 2 Discovery and Mapping Tutorial

Step 3:

• Extend the MapApplet class and add Custom Components to the Map Panel by

o Writing a class extending MapApplet class from the com.adventnet.nms.mapui package. o Overriding the constructUI(EditableMap emap) method in the extended class.

The example code for the constructUI() method below illustrates this.

public void constructUI(EditableMap emap) { splitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT); if (currentMapViewed.endsWith("Switch.netmap")) { setLayout (new BorderLayout()); splitPane.setOneTouchExpandable(true); splitPane.setTopComponent(emap); tabPane.add("Properties",buildPropertiesPanel (getProperties(),mapPropsToShow)); altPanel = new AlertPanel(); tabPane.add("Alarms",altPanel); splitPane.setBottomComponent(tabPane); add("Center",splitPane); } else { super.constructUI(emap); } }

The currentMapViewed.endsWith("switches.netmap") check is made to make this feature available only to maps ending with switches.netmap i.e., to Network switches map.

The EditableMap emap is the Map added to the map panel. Custom components can be added to the map panel containing the EditableMap, before the panel gets added..

Configure Custom Maps

The configuration file NmsPanels.conf (XML file) must have an entry of the Custom Map class created. Follow the steps given below to provide the required entry.

Steps :

• Right-click the OTHER FILES node in the Studio tree. • Select Open option • Browse to the directory under ../studio/projects// directory • Select and open the configuration file - NmsPanels.conf • See the file appended to the list of OTHER FILES in the Studio tree. The file opens on the right panel in an XML Editor. • In the node, change the className attribute's value from 'com.adventnet.nms.mapui.MapApplet' to 'com.adventnet.nms.tutorials.layer2ExtMapApplet'.

The configured details will take effect.

AdventNet Inc. 25 Layer 2 Discovery and Mapping Tutorial

Rendering Map Symbols

To effect the map symbol rendering in the Custom Map, you must configure mapIcon.data file.

Steps to configure

• Browse to the directory under ../studio/projects// directory • Select mapIcon.data file and open in an editor • Add the following entry in the mapIcon.data file, where

.....

Create other classes

The classes listed in the table below must be created as Client Java using the OTHER FILES node in the Studio tree. The steps are same as used to create the MapApplet class. Other classes to be created are :

Class Name Purpose SwitchContainerLayout Laying out the switches on the map SwitchMapSymbolRendererImpl Rendering map symbols on the map SwitchMapLinkRendererImpl Rendering links on the map (extends com.adventnet.nms.mapui.MapLinkRendererImpl class)

You can take a look at the above classes located in the following path:

/StudioTools/Studio/projects/Layer2_Tutorial/otherfiles directory

The paintLabelString() and paintMapLink() methods are overridden to draw the map link. Following is the code snippet:

public void paintMapLink(Graphics g, MapLinkComponent mapLink, Point sourcePoint, Point destPoint, Color bg, boolean selected) { String color = null; int rd=0; int gr=0; int bl=0; color=mapLink.getUserProperty("linkColor"); if(color != null) { StringTokenizer stok = new StringTokenizer(color,","); rd=Integer.parseInt(stok.nextToken()); gr=Integer.parseInt(stok.nextToken()); bl=Integer.parseInt(stok.nextToken());

AdventNet Inc. 26 Layer 2 Discovery and Mapping Tutorial

bg = new Color(rd,gr,bl); } else { bg = new Color(0,255,0); } super.paintMapLink(g,mapLink,sourcePoint,destPoint,bg,selected); }

Configure Map Link Properties

A configuration file- switchLink.properties is created to configure Map Link Properties using OTHER FILES option. The link-speed-to-color mappings can be configured in this file.

Map Links are displayed in different colors based on their Link Speed (ifSpeed)

This file is read once after the server is started with the tutorial installed. It is added when the link is added to the Topo DB. linkColor and linkSpeed are added to the link object as user properties based on which the color is set in the Map Link Renderers.

To configure map link color, modify the switchLink.properties file under the conf directory and specify a different color. The Server has to be reinitialized and re-started for the changes to take effect. The entries in the file for this application are as shown below:

10\ Mbps =255,0,0 100\ Mbps =0,0,255 Link colors are specified in RGB format against the Link speed. 200\ Mbps =0,0,0

The code given above illustrates how the map link properties are set using the entries in the switchLink.properties file.

AdventNet Inc. 27 Layer 2 Discovery and Mapping Tutorial

4.3.3 Navigating Custom Switch Map

See how your Application works! To know how to navigate your custom Switch Map, read through.....

Map Symbol Properties

Select a symbol to see its Properties displayed in the panel at the bottom of the screen. By default, MapApplet implements MapListener that listens for the map events. Implementing the changeMap(MapEvent me) method of the MapListener, the properties of the selected objects can be displayed on the properties panel.

A SplitPane is added to the Map Panel where,

• EditableMap is the top component • Tabbed pane is the bottom component where you have o Properties Panel - Displays symbol properties when you select a symbol o Alarm Panel - Displays alarms if any; alarms are filtered at run time based on the selected symbol

See the attached snapshots to see Properties Panel and Alarm Panel invoked:

Properties Panel

AdventNet Inc. 28 Layer 2 Discovery and Mapping Tutorial

Alarm Panel

AdventNet Inc. 29 Layer 2 Discovery and Mapping Tutorial

4.3.4 Status Polling for Layer2 Devices

Aim

Creating a Status Poller to perform status polling for the Layer2 devices.

Overview

The Status Poller created in this application is SwitchStatusPoller. It is a user-test class used by the Status Poller for Web NMS Switches. This class is invoked using DummyStatusPoller class by SwitchMapFilter class. Only one instance of this class is used for all the Switches. Addition of Switch Map Containers and Switch symbols to the Containers are done in this class.

To Create Status Poller

• Right-click the OTHER FILES option in the Studio tree • Select the submenu option new to bring a New File dialog • Enter the details as below:

File Type Server Java File Name SwitchStatusPoller Extends --- Package Name com.adventnet.nms.tutorials.layer2

• Click OK. Now, SwitchStatusPoller.java is appended to the list of Other Files in the Studio tree. The file is open in the right panel in a JMACS editor. You can edit the file straightaway, save the changes, and compile it.

SwitchStatusPoller Class

The following table shows the main Vectors and the details that are stored here:

Vector Details switchVect Unique name / key of all the discovered switches macAddVect Machine addresses of all the SNMP Nodes mapsVector Maps added to the database mapThisStart Differentiates cold-start from warm-start

The test() method is invoked for every switch discovered during the status polling. public int test(ManagedObject obj, TopoAPI tapi) {

//Construct the map name and the map label String objName = ((Node)obj).getName(); //Get the unique name/key*/ String switchMapName = objName; String switchMapKey = objName + ".netmap";

//Get the handle of MapAPI MapAPI mapi = (MapAPI) NmsUtil.getAPI("MapAPI"); //Create & add the map into the system if it isn't already

AdventNet Inc. 30 Layer 2 Discovery and Mapping Tutorial

done(*.switches.netmap) try { if(!mapi.doesTheMapExist(parentSwitchMap+".netmap")) { addParentSwitchMap(mapi); }

if(!mapi.doesTheMapExist(switchMapKey)) { addSwitchMap(mapi, switchMapName, parentSwitchMap);//adds map for each switch. } } catch(Exception e) { e.printStackTrace(); }

//Check and add switch map container(dummy and ori switch) and map symbol.

addSwitchToMap(obj, parentSwitchMap, mapi) ; addSwitchToMap(obj, switchMapName, mapi);

nodeProcess(obj, parentSwitchMap, tapi, mapi, switchMapName); return obj.getStatus(); }

The test() method performs the following

• Creates a Parent Switch Map in which all discovered switches are displayed. • Creates the Individual Switch map for each switch discovered with the switch name as the map name. • Creates a switch symbol for a switch in both the Parent Switch map and the individual switch map. • Maps the switches and the Snmp Nodes that are directly connected to it. • Maps the Spanning Tree Link between the switches.

You can access the source file from the location:

/tutorials/layer2_tutorial/otherfiles directory.

Server Java Classes for Making Various SNMP Calls to the Switch's Bridge MIB

Class Name Details ConnectedNodes Used to fetch • machine addresses of the nodes • the corresponding switch ports • the machine address of uplinked switches and nodes using the OIDs dot1dTpFdbAddress(1.3.6.1.2.1.17.4.3.1.1) and dot1dTpFdbPort(1.3.6.1.2.1.17.4.3.1.2) implemented by the Bridge MIB. BaseBridgeAddress Used to fetch the Base Bridge Address for a given switch using the OID 13612117110

AdventNet Inc. 31 Layer 2 Discovery and Mapping Tutorial

Class Name Details and assigns it to an instance variable baseBridgeAddres. SptRootBridge Used to fetch the following from the Bridge MIB for the given switch element: • dot1dStpDesignatedRoot • dot1dStpRootPort • dot1dStpPortDesignatedBridge (from the dot1dStpPortTable)

Refer to the SwitchStatusPoller Class file available in /otherfiles directory.

For more details on working with Other Files , refer AdventNet Web NMS Studio documentation.

Studio > Working with Studio > Working with Files

AdventNet Inc. 32 Layer 2 Discovery and Mapping Tutorial

4.4 Packaging the Project

After you complete creating your project successfully, you have to compile and package it. The project is then ready to be deployed.

The Project is compiled and packaged into a NAR file.

Refer AdventNet Web NMS Studio documentation to know more about Packaging a Project.

Save and Compile the Project

In Studio, save the created Project and select Project --> Compile menu. The project gets compiled.

Package the Project

From the Project menu, select Package. This will 'package' the Project as a NAR file called Layer2_User1.0.nar.

You can deploy this NAR into Web NMS using the Deployment Wizard to install the Application.

For Installation / Uninstallation details, refer to Installation Notes topic.

Note: The installation notes gives the steps to install the bundled NAR (Layer2_Tutorial1.0.nar). To install the Application you have built, select its corresponding NAR ( Layer2_User1.0.nar).

AdventNet Inc. 33 Layer 2 Discovery and Mapping Tutorial

5. Fast Tract Implementation

If you are unable to complete the Studio Project successfully, try using the Studio project bundled along with AdventNet Web NMS Studio.

Project Name - Layer2_Tutorial.proj Location - /StudioTools/Studio/projects

Open this project from AdventNet Web NMS Studio from the specified location, make the supported changes, and compile and package the application. Deploy the NAR to see the changes effected.

AdventNet Inc. 34 Layer 2 Discovery and Mapping Tutorial

6. Control Flow Diagram

The following diagram shows the flow of control and the usage of the corresponding application class files in the modules.

AdventNet Inc. 35 Layer 2 Discovery and Mapping Tutorial

7 Deployment and Testing

7.1 Installation Notes

This application is bundled with Web NMS 4. You can also download this tutorial from the AdventNet Web site. Use the following URL to download the tutorial.

http://www.adventnet.com/products/webnms/tutorials/layer2_tutorial.zip

If you are using the downloaded tutorial from the Web site, then extract the tutorial under directory.

Installing the Application

To install the tutorial application,

• Run the DeploymentWizard.bat/.sh file under /bin directory and also ensure that the server is not running. • Select the NarInstall/Uninstall tab. • Select the Install button in the screen. • Click the Browse button in the NAR INSTALLER pop-up screen. • Select the tutorials/layer2_tutorial/layer2_Tutorial1.0.nar from the File Chooser pop-up screen and click the Select button. • Click the OK button in the NAR INSTALLER pop-up screen to see the NmsPwsNarInstaller screen. • Select the Application Database (in which you want to run the tutorial) listed from the combo box. • Click the Next button. • In this screen, click Install button. This will install and show the status in the progress bar. See that the progress is 100%. • Click the Close button. Now the installation is complete. The entries are Layer2_Tutorial1.0, ExtMapApplet • Click the Exit button to quit the Deployment Wizard and click the Yes button in the confirmation message that pops up. • Reinitialize Web NMS using reinitialize_nms.bat/.sh. Click Yes to confirm reinitialization. Click OK button in the ensuing dialog.

Caution: This tutorial will function only if Web NMS is reinitialized. Hence, after installing the tutorial, reinitialize Web NMS.

When this tutorial application is installed, the existing files that require changes from the installed Web NMS are backed up. However, when you un-install this tutorial application, the modified files will be restored from the backup.

Uninstalling the Application

To uninstall the tutorial application,

• Run the DeploymentWizard.bat/.sh file under /bin directory. • Select the NarInstall/Uninstall tab. • Select the layer2_Tutorial1.0.nar entry in the Uninstall section

AdventNet Inc. 36 Layer 2 Discovery and Mapping Tutorial

• Click the Uninstall button in the screen. The NmsPwsNarUninstaller screen will pop-up. • Here, click the Uninstall button. • This will uninstall and show the status in the progress bar. See that the progress is 100%. • Click the Close button. You will see Uninstalled Successfully pop-up message with an OK button. • Click the OK button. Now the uninstallation is complete. • Click the Exit button to quit the Deployment Wizard.

Note: To install the NAR for the Application that you have created, you must select Layer2_User1.0.nar.

AdventNet Inc. 37 Layer 2 Discovery and Mapping Tutorial

7.2 Application Testing

After you install the tutorial application, reinitialize and start the Web NMS server. The network should contain Switches. The application will discover the Switches (shallow discovery only) and represent them on Custom Switch Map as Containers. The Switch with all the SNMP nodes connected to it will be displayed, with the Switch in the middle and the nodes around it.

Discovering Layer2 Switches

1. After installing the NAR, open the Discovery Configurator tool. 2. In the Node Discovery panel, add IP Addresses of the switches to be discovered. 3. In the Network Discovery panel, add IP Addresses of the networks in which the devices (connected to the switch) are present.

Modifying the Application

Status updates take place depending on the link speed. You can try removing the network connections to see the switch status change from clear to warning / minor /major, etc. You can also configure the link properties in the configuration file switchLink.properties and see the changes effected.

To Modify the Application bundled with this tutorial,

• Open the project's layer2_Tutorial.proj file from the /tutorials/layer2_tutorial directory, in the AdventNet Web NMS Studio tool • Make the changes (supported by the AdventNet Web NMS Studio) to the project to meet your requirements • Compile the project and package it into NAR. • Now, uninstall the existing installed NAR and install the new NAR generated with your changes.

Caution: Uninstalling the original NAR is mandatory as only one Studio NAR is permitted to be deployed in AdventNet Web NMS.

For complete details of Working with AdventNet Web NMS Studio, refer the AdventNet Web NMS Studio documentation.

The conf files that change when this application is installed are :

• clientparameters.conf • discovery.filters • map.filters • mapIcon.data • NmsPanels.conf • NmsProcessesBE.conf

AdventNet Inc. 38 Layer 2 Discovery and Mapping Tutorial

8. Known Issues

• The Switch Container maps only the SNMP Nodes connected to the Switch directly. All the Non-SNMP Nodes are not mapped. • Only the Spanning Tree Link between the Switches are shown in the map. The switches may be connected through other links as well. Thus only a part of the switch to switch link topology is mapped. • Every node is mapped to only one switch. But occasionally there can be a node having two or more interfaces connected to different switches. In such a case the node is mapped to any one of the switches. But in such a case an error indicating the connection to the other switch(es) is logged in the stderr.txt file. • When this application is installed, it replaces the discovery and map filters with the new conf files. Therefore, any user defined filters installed does not take effect. When the application is un-installed, the conf files are restored.

Caution: You need to configure the Spanning Tree data on the Switch's SNMP Agent.

AdventNet Inc. 39 Layer 2 Discovery and Mapping Tutorial

9. Trouble Shooting Tips

Problem Solution Check if the network has network switches or if the The switches map does not come network has some devices that has more than 1 hardware up under the corresponding port and is capable of forwarding. It must implement the Network maps. Spanning Tree Protocol. There are no nodes mapped inside Check if the network in which the application is running the switch container. has SNMP Nodes. The switch container does not Check for the cloud.png image in /images directory. Check if the SwitchContainerLayout.class file is present ClassNotFoundException is raised in the Layer2_Tutorial.jar file under the /NetMonitor/Build directory. Check if the SwitchMapLinkRendererImpl and The switches are not laid out SwitchMapSymbolRendererImpl classes are present in the properly. Layer2_Tutorial.jar file under the /NetMonitor/Build directory. After the initial display of the map, Check whether the ENABLE_SP_FOR_IFC_PARENTS the number of nodes that get parameter is set to 'true' in the NmsProcessesBE.conf mapped to the switch container file under the ../projects//conf directory. does not increase in the If this parameter is set to 'false' (by default) then the status subsequent status polling. polling for the nodes does not take place.

AdventNet Inc. 40 Layer 2 Discovery and Mapping Tutorial

10. Glossary

A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Bridge Brouter Designated Switch Designated Port MAC Address MAC Layer OSI Root Switch Root Port SNMP SNMP Node Switch Switch Map STP

Bridge

A bridge is a device that connects one (LAN) to another local area network that uses the same protocol (for example, or ). A bridge usually offers only one path to a given interconnected LAN. A router connects a network to one or more other networks that are usually part of a (WAN) and may offer a number of paths to destinations on those networks.

Brouter

A brouter (pronounced as BRAU-tuhr or sometimes BEE-rau-tuhr) is a network bridge and a router combined in a single product.

Designated Switch

A designated switch is elected by the smallest Root Path Cost in each .

Designated Port

The ports that connect to switches further away from the Root Switch than the switch. The Root Switch only has Designated Ports.

MAC Address

Media Access Control address, a hardware address that uniquely identifies each node of a network.

MAC Layer

The Media Access Control Layer is one of two sub-layers that make up the Layer of the OSI model.

Root Switch

A root switch is elected by the smallest Switch ID in the entire switched network. Only one root switch can exist among the entire switched network.

Root Port

The port that is closest to the root switch. The root port is selected from each switch within the network. Only one port on each switch is assigned as the Root Port.

AdventNet Inc. 41 Layer 2 Discovery and Mapping Tutorial

Router

A Router is a device connected to at least two networks and decides which way to send each information packet based on its current understanding of the state of the networks it is connected to. A router is located at any gateway (where one network meets another), including each point-of- presence. A router is often included as part of a network switch.

SNMP

SNMP is abbreviation of Simple Network Management Protocol, a set of protocols for managing complex networks. The first versions of SNMP were developed in the early 80s. SNMP works by sending messages, called protocol data units (PDUs), to different parts of a network. SNMP-compliant devices, called agents, store data about themselves in Management Information Bases (MIBs) and return this data to the SNMP requesters.

SNMP Node

A Device that runs the SNMPAgent.

Switch

In networks, a Switch is a device that filters and forwards packets between LAN segments. Switches operate at the (Layer 2) of the OSI Reference Model and therefore support any packet protocol. LANs that use switches to join segments are called switched LANs or in the case of Ethernet networks, switched Ethernet LANs.

Switches Map

The map that displays all the switches for a particular network with the Spanning Tree Links between them. This map is created separately for each new network discovered and is placed below the tree node for that network.

STP

It is a bridge-based mechanism for providing fault tolerance on networks. It is used by bridges (or switches) to remove redundant links from networks. The switch sends configuration BDPUs to communicate and compute the Spanning Tree Topology.

AdventNet Inc. 42 Layer 2 Discovery and Mapping Tutorial

11 Appendix

11.1 Fundamental Concepts

This section explains the following concepts that help you understand this tutorial better.

• OSI Reference Layers • Spanning Tree Protocol

Familiarity with the above concepts will provide clear visibility into the nature of application being built.

OSI Reference Layers

The OSI model is composed of the following seven interconnected layers:

Layer7 - Provides different services to Applications (eg: FTP, e-mail etc) Application Layer6 - Converts information (eg: data encryption / decryption / translation) Presentation Layer5 - Establishes and maintains session between two hosts Session Layer4 - Provides end-to-end communication control (flow control, error detection Transport etc.) Layer3 - Routes the information in a network / internetwork Network Layer2 - Data Specifies topology such as Ethernet or Token Ring and frames data Link according to that topology. Hardware (MAC) addresses are involved at this layer Layer1 - Connects the entity to the transmission media Physical

Following is one of the several mnemonics devised to help remember this model (top to bottom approach):

All People Seem To Need Data Processing

Data Link Layer (Layer2): The that contains the physical address of a client or server station is called the Data Link Layer. Layer 2 processing is faster than layer 3 processing as less analysis of the packet is required. It has the following two sublayers:

• Media Access Control Layer (MAC) • Logical Link Control Layer (LLC)

MAC Layer

o Controls how a computer on the network gains access to the data and permission to transmit it o Responsible to move data packets from a Network Interface Card to another or vice versa across a shared channel. o Uses MAC protocols to ensure that signals sent from different stations across the same channel don't collide.

MAC Address: Hardware address that uniquely identifies each node in a network

LLC Layer

o Controls frame synchronization, flow control and error checking

AdventNet Inc. 43 Layer 2 Discovery and Mapping Tutorial

Spanning Tree Protocol

Use of Spanning Tree Protocol (STP) makes your network more intelligent for achieving network fault tolerance. The following sections throw more light on STP and its supported features.

About Spanning Tree Protocol

It is a bridge-based mechanism for providing fault tolerance on networks. It is used by bridges (or switches) to remove redundant links from networks. The switch sends configuration BDPUs to communicate and compute the Spanning Tree Topology. A MAC frame conveying a BPDU sends the switch group address to the destination address field. All switches connected to the LAN on which the frame is transmitted receive the BPDU. BPDUs are not directly forwarded by the switch, but the information contained in the frame can be used to calculate a BPDU by the receiving switch, and, if the topology changes, instigate a BPDU transmission.

Spanning Tree Protocol Features

It allows spanning tree devices to communicate path cost and identification information so that each device can block the highest cost path that is redundant. Thereby, it allows implementation of parallel paths for network traffic and ensures that,

• Redundant paths are blocked (or disabled) when the main paths (the lowest cost path) are operational. • Redundant paths are enabled if the main path fails.

The path cost factor is used to calculate the distance from each port of a switch to the Root Switch. Each switch is identified by a switch ID and each switch port (interface) on a switch is identified by a Port ID.

Ports can either be disabled or enabled. Ports that are enabled can be in one of the following states:

Listening The switches send BPDU messages to one another to establish the and the optimal paths to the different segments of the network. Other data is not transmitted. Blocking The switch enters the Blocking State if a path with higher priority is found to exist during the Listening State. Normal data is not transmitted. Learning The switch enters the Learning State if no path with a higher priority is found during the Listening State. Learned entries are entered in the Unicast Destination Forwarding Table. Normal data is not transmitted. Forwarding The switch enters the Forwarding State after having been in the Learning State for a predefined forward delay time period. Normal data is transmitted.

AdventNet Inc. 44 Layer 2 Discovery and Mapping Tutorial

11.2 Layer2 Application Classes

This application uses the following classes:

Package Name: com.adventnet.nms.tutorials.layer2 Class Name Details Server Java files DummyStatusPoller Status polling classes SwitchStatusPoller ConnectedNodes Classes for making various SNMP calls to the switch's Bridge BaseBridgeAddress MIB SptRootBridge SwitchConFinder Classes to derive all connections between the switch and the DiscoverLayer2Link devices. MacVsIPdisc Class to store MAC Address vs IP Address mapping Client Java files ExtMapApplet Extended Map Applet class for adding custom components to the Map Panel SwitchContainerLayout Map layout class for laying out the switches on the map SwitchMapSymbolRendererImpl Classes for rendering the map symbols and map links on the map SwitchMapLinkRendererImpl Classes for rendering the map symbols and map links on the map AlertPanel Class for showing the Alarms and the Alarm Navigation Panel

AdventNet Inc. 45 Layer 2 Discovery and Mapping Tutorial

12. Other tutorials

AdventNet Web NMS is vast in its capability to serve its different class of users. It would be hard for anyone to understand all of its features at one time. We strongly recommend you to go through some of our other tutorials to get of feel of what could be done on our Web NMS.

Building an Element Management System.

This tutorial provides working illustrative examples to guide the developer through designing an EMS. Design aspects and the usage of Web NMS tools to simplify the development of an EMS are elaborated here.

Building an EMS with CORBA as southbound Interface

This tutorial explains how a developer can build Element Management Systems, which support CORBA as the southbound interface. In this tutorial, we have used TR-005 and TR-035 standards specified by the ANSI T1M1 forum. It explains, how developer can implement the Working Text, WT- 046 Version 3.0 as specified in the DSL forum.

CORBA Northbound tutorial

This CORBA Northbound Tutorial shows how easily AdventNet Web Network Management System (NMS) can be used for distributed NMS applications by providing CORBA northbound support to interact with other Northbound Operational Support Systems (OSS).

Managing a TL1 Device

This tutorial guides the developer on how to manage a device using the TL1 Protocol. Various features in AdventNet Web NMS to manage a TL1 Device are explained. The design aspects and the usage of Web NMS tools to simplify the development of an EMS and the ease of managing a device using the TL1 Protocol are described here .

XML southbound tutorial

This tutorial builds an EMS with the information got from an XML enabled device. From the responses received the EMS chassis is built and some other functions are included.

AdventNet Inc. 47