37
International Journal of Intelligent Engineering & Systems http://www.inass.org/ Monitoring Network through SNMP-based System Jianqing Liu * , Rongkai Lu School of Information Technology Engineering, Tianjin University of Technology and Education, Tianjin, China * Corresponding author’s Email: [email protected] Abstract: SNMP-based system for monitoring network is equipped with network management, monitoring system and statistic analysis of the network in it. It not only contains the function like network information capture that normal network devices have, but also has the ability to extend such applications as CPU usage rate, traffic flow information of interfaces and memory usage rate through plug-in mechanism. Simplifying the basic network man- agement tasks by centering on auto-topology mechanism and making a tradeoff between usability and extensibility, the auto-topology control which is implemented and designed independently could support almost networking devices with better flexibility. Completely supporting to capture TrapV1, TrapV2 and partial TrapV3 (limited by protocol) with embedded database to facilitate backend storage, the software has become a green-software except depending on .NET Framework 4. Keywords: SNMP; Automatic Topology; Weight Priority. 1. Introduction SNMP is widely used for the monitoring, manage- ment and controlling of the network devices. Now in its third release, SNMP has become the de facto stan- dard for network management since its development in 1987 [1]. Thus, it is a full-fledged network manage- ment protocol [2]. As we know, different network de- vices need to be supported by different programs; for example, Literature [3, 4, 5] focus on single function like traffic monitoring or topology display regardless of the scalability and generality of the system based on SNMP; so the SNMP-oriented matured framework of network management system is few and far between. Cisco Company is at the leading edge of supporting SNMP [6]. It not only provides fully support to the definition of MIB-2 in RFC1213, but also supports RMON of RFC2819 and RFC2021 embraced within some devices. Therefore, it is of significance to de- velop extensible SNMP-based network framework to support the prevalent Cisco devices. Two basic and important problems are confronted to software development when talked to programming; they are generality and scalability respectively. Gen- erality can assure devices’ basic functions to perform well in most networking environment while scalabil- ity can guarantee their special functions on the condi- tion that the generality of software is well conducted, which makes the job designing general framework mu- ch more difficult. How to simplify the network management tasks catc- hes more attention. This is mainly because the oper- ating behavior can be affected by the working way of software selected. C/S pattern or pure single-structured software no doubt has powerful graphic presentation while B/S pattern can show its merits on scalability and cross-platform. A tradeoff and efficiency alterna- tive is to implement generality and cross-platform on the level of framework while different solution can be adopted on this presentation. International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 1

Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

  • Upload
    others

  • View
    6

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

International Journal ofIntelligent Engineering & Systems

http://www.inass.org/

Monitoring Network through SNMP-based System

Jianqing Liu∗, Rongkai Lu

School of Information Technology Engineering,Tianjin University of Technology and Education, Tianjin, China

∗ Corresponding author’s Email: [email protected]

Abstract: SNMP-based system for monitoring network is equipped with network management, monitoring systemand statistic analysis of the network in it. It not only contains the function like network information capture thatnormal network devices have, but also has the ability to extend such applications as CPU usage rate, traffic flowinformation of interfaces and memory usage rate through plug-in mechanism. Simplifying the basic network man-agement tasks by centering on auto-topology mechanism and making a tradeoff between usability and extensibility,the auto-topology control which is implemented and designed independently could support almost networking deviceswith better flexibility. Completely supporting to capture TrapV1, TrapV2 and partial TrapV3 (limited by protocol)with embedded database to facilitate backend storage, the software has become a green-software except depending on.NET Framework 4.

Keywords: SNMP; Automatic Topology; Weight Priority.

1. Introduction

SNMP is widely used for the monitoring, manage-ment and controlling of the network devices. Now inits third release, SNMP has become the de facto stan-dard for network management since its developmentin 1987 [1]. Thus, it is a full-fledged network manage-ment protocol [2]. As we know, different network de-vices need to be supported by different programs; forexample, Literature [3, 4, 5] focus on single functionlike traffic monitoring or topology display regardlessof the scalability and generality of the system based onSNMP; so the SNMP-oriented matured framework ofnetwork management system is few and far between.Cisco Company is at the leading edge of supportingSNMP [6]. It not only provides fully support to thedefinition of MIB-2 in RFC1213, but also supportsRMON of RFC2819 and RFC2021 embraced withinsome devices. Therefore, it is of significance to de-velop extensible SNMP-based network framework to

support the prevalent Cisco devices.Two basic and important problems are confronted to

software development when talked to programming;they are generality and scalability respectively. Gen-erality can assure devices’ basic functions to performwell in most networking environment while scalabil-ity can guarantee their special functions on the condi-tion that the generality of software is well conducted,which makes the job designing general framework mu-ch more difficult.

How to simplify the network management tasks catc-hes more attention. This is mainly because the oper-ating behavior can be affected by the working way ofsoftware selected. C/S pattern or pure single-structuredsoftware no doubt has powerful graphic presentationwhile B/S pattern can show its merits on scalabilityand cross-platform. A tradeoff and efficiency alterna-tive is to implement generality and cross-platform onthe level of framework while different solution can beadopted on this presentation.

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 1

Page 2: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

2. System Analysis

2.1 Key issuesSince the supports to networking devices furnished

by SNMP are different between devices, developingsome general functions attached in software, whichare compatible with most of networking equipment, ischallengeable. On the basis of topology as its blueprint,the common network management tasks can be ful-filled properly. Therefore, no matter what diverse thenetworking equipments are, and how complicated theenvironment supported by SNMP is, automatic net-work topology discovery is undoubtedly an indispens-able and core function. Thus, how to extend functionon common compatible equipment becomes the focusof our research.

2.1.1 Compatible with most of existing equipmentRather than realizing compatibility, it would be bet-

ter to implement the functions backed by most hard-ware. One solution to it is to utilize MIB-2, the func-tional groups defined by RFC1213, which releases theroutine objects in networking administration and gainsthe general acceptance from most devices.

2.1.2 Obtain network topology through SNMPThere are no objects in functions relevant to SNMP

which can be directly used to obtain network topol-ogy. But they can be found in some MIB which is inthe possession of the private where Cisco can be takenan example. Some objects related to CDP (Cisco Dis-covery Protocol) from Cisco conduct such functionsof getting the topology immediately. However, it posesvery sticky requirement on network environment andthe equipment for CDP must be used in pure networkCisco-based, although a few non-Cisco start to givesupport to CDP. Thus, it is not a solution for generalpurpose.

To keep the compatibility between network equip-ment, the conservative objects should be the priorityto implement the core functions. And the automatictopology discovery can be deployed until we importemphasis on the MIB-2. The scheme is to find out theaddress translation table with the information about IPof PC among it. With these IP, the SNMP testing onPCs can be employed; consequently, the SNMP-basednetwork is well-supported.

Figure 1 Domain for Transformation

2.2 Difficulty in software design2.2.1 Layout of topology

Once the mechanism of topology is confirmed, anintractable issue, the layout of devices and devices’links, blocks the way to further the job. It is too hardto draw the topology the same as the physical structuretotally by software.

During the course of developing software, the strat-egy pattern is adopted to abstract the layout algorithm,so we can do some substitution manually.

2.2.2 Mapping from domain model to storage mo-del

The domain model is regarded as conceptual modelof a system, which is used to describe the relationshipbetween entities and their relations visually. For anapplication system based on SNMP, the domain modelis its main entity. Additional extensive function, man-aging the network devices, is associated with such ap-plication as assets appraisal, devices accounting, andmaintenance.

3. Framework Design

3.1 Logic design of domainThe main logic of Software to interact with SNMP

network is dependent on the SNMP object data trans-mission by SNMP protocol; meanwhile SNMP ob-jects are dependent on the relevant MIB to describe itscharacteristics and structure. Software needed logic ismainly concentrated on the operation of the SNMPentity, but not friendly to the program, that is, notthrough the smooth operation of API to make use ofthe software for SNMP.

So it is necessary to design domain logic to con-vert specific domains of SNMP into program friendlydomains. Now consider the domain transformationshown in Figure 1.

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 2

Page 3: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

Figure 2 Model with DSL Characteristics

From the figure above, SNMP operating primitive isconverted into the corresponding programming con-cepts, so that the domain of SNMP completely turnsinto the programming domain. This provides the basisfor the expansion of AOP programming and storagemodel.

3.2 DSL expressive forceDSL is a Domain-Specific Language [7], according

to Martin Fowler’s view; DSL is also a tool which canhelp users abstract a certain part from a system.

SNMP protocol itself is designed as an associatenetwork management tool, so it is a pity that if thisproperty is abandoned and a new administrative modelis developed from the beginning. Starting from a spe-cific language and using this feature of SNMP, AOP(aspect-oriented programming) model is made to achi-eve the specific features of DSL, which keeps the lan-guage and the framework itself easy to use and sim-plifies programming.

The benefits of using DSL features is obvious, fordata with strong type could be employed in the designstage, and the introduction of caching strategy andparallel optimization in later design step can becomeeasy by using excellent AOP framework. A relativelysimple example of using AOP with SNMP features isshown in Figure 2.

Store SNMP-related data into metadata and obtainSNMP entity through reflection, which not only hidesthe SNMP communication at the bottom, but also getsthe “shallow buffer”. This is the expression force ofDSL.

3.3 Scalability and flexibilityMatured framework is often evolved on the basis of

the continuous evolution, and a reasonable design isthe premise of this kind of smooth evolution. Soft-

Figure 3 Measurement Result of Code

ware takes the strategy of the incremental evolution–every time a small iteration to design and implementthe software framework–this makes framework main-tainable in later, meanwhile, better performance canalso be shown in scalability and flexibility.

The framework’s basic extension point lies in the in-cremental expansion of plug-in applications with cen-tered as topology, implementing the function of soft-ware extensions on the whole. Through the AOP modelimplemented and the application of the plug-in mech-anisms, the software has great flexibility in the func-tion and the maintainability for “upgrade” with no sideeffects available. The following Figure 3 shows mea-surement results of parts of code.

From the figure above, SNMP operating primitive isconverted into the corresponding programming con-cepts, so that the domain of SNMP completely turnsinto the programming domain. This provides the basisfor the expansion of AOP programming and storagemodel

The “maintainability index” 57 is the value of SMan-age project, the most top-level application, accord-ing to Robert C. Martin’s point of view, the top-levelapplication and framework of the maintainability in-dex is often pyramid-shaped distribution. The main-tainability index of core framework–Framework andTopology Control are respectively 89 and 87, whichbasically reaches the maintenance needs later.

3.4 Storage modelStorage model can provide the persistence mecha-

nism for the relevant extension applications; mean-while, it plays the essential role for statistic and anal-ysis which request the comparison of history data. Atthe earlier stage of our design, a work model calledsynchronous engine was put forward, which could syn-chronously store the MIB-2 information of found de-vices into storage model in fixed time. The work modelof Sync engine is illustrated in Figure 4.

However, when synchronous engine was tested, the

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 3

Page 4: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

Figure 4 Working Model of Synchronous Engine

discovery from test revealed that it wrote and readstorage model more frequently and the increasing amountof data was higher than before after every update. Sothe sync engine was discarded finally. From the angleof cost and deployment, the selectable database prod-ucts like Microsoft SQL Server Express, MicrosoftSQL CE, MongoDB, NoSQL, MongoDB, and NoSQLcan solve the problem of persistence. Combined withthe performance, Microsoft SQL CE is an alternative.

3.5 TestabilityAgile development declaration says:The individual and interaction is more important than

process and tools;Working software is more important than detailed

documentation;Corporation with Clients is more important than con-

tract negotiations;Prompt response to changes is more important than

following a plan.The rapid response to changes reflects the software’s

capabilities in scalability, maintainability, robustnessand so on. And the key technology of quick respond-ing to changes is the continuous integration and TDD(Test Driven Development).

In response to rapid changes in software, as well astaking into account the development cycle which doesnot allow much time to do the test and consider otherfactors, the software following up the part of the prin-ciple of “agile development” puts forward three prin-ciples to help software sustainable evolution: (1) Us-ing Microsoft Visual Studio Team Foundation Serverfor source code version management and continuousintegration; (2) give priority to the use of “ink test”,the core mechanism of “white box”; (3) add a smallincremental iterative function.

Software easy to test is rooted in the clear respon-sibilities of “class”. Through continuous reconstruc-tion [11], the software refines the core mechanism ofthe abstraction level; for example, Figure 5 shows theAOP abstracts model part of the interface, which makesit easier to test.

Figure 5 Public Interfaces Provided by Framework

Figure 6 Process of Auto Topology Discovery

4. Detailed Design

4.1 Automatic topology controlThe automatic topology Control is the core of SNMP-

based system which is the starting point of other ex-tensions. This control also provides functions such asadjusting topology, storing topology, loading topol-ogy and storing images. More details about imple-menting the function of automatic topology controlare involved.

4.1.1 Operating modeObtaining topological graph is a high-cost and time-

consuming process. Asynchronous discovery avoid-ing the congestion of UI threads is the best choice. Inthe mechanism of topological graph discovery, a spe-cial “hook” is added in. This is the observer pattern[8, 9, 10] which is normally employed in design field.When a station is found, mechanism will notify thesubscriber of this event. The station will be shown asan image corresponding to it in the software picture.

When topological mechanism finds a device, it willreport this event. The automatic topology control sub-scribing this event will receive the report that standsfor a device. Then automatic topology control willcheck the device which this report stands for. Initial-ization will be started until the checkup is finished.Initialization will complete a series of job to the cor-responding devices. Context Menu extension Mecha-nism is added in at this time. After initialization, thealgorithm of locating device will be conducted to lo-cate devices. Finally, the device discovered is added

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 4

Page 5: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

into the visual panel. Thus, the addition of device isfinished.

4.1.2 Double buffersThe links among devices of topology graph are drawn

by GDI +. An obvious problem is that topologicalgraph will blink when we adjust topological graphmanually. This problem has nothing to do with .NETplatform, but it is caused by the efficiency of the GDI+tool. Double buffers can reduce the frequency of draw-ing in order to speed up the drawing rate, which cansolve the drawing blink.

If DirectX is used to draw the topology, another dif-ficulty, interoperation of COMs, is brought in. Study-ing API related to Windows no doubt increases thecost of technique with a bit higher efficiency than GDI+.

Selecting GDI+ leads to the efficiency of itself. Thereason of using double buffers is that speeding up therate of drawing and reducing the blink may slow downthe drawing frequency.

A buffer container should be ready for the usage ofdouble buffers. This software adopts the default im-plementation provided by .NET. For instance, the fol-lowing code will start double buffers.

var bu f f eredGraphics = Bu f f eredGraphicsManager

.Current.Allocate(graphic,DisplayRectangle);

Then, the buffer can be used to draw pictures.

bu f f eredGraphics.Graphics.DrawLine(Pens.Black,

p1, p2);

Finally, pictures in buffers are drawn into visual panelafter all the drawing is done.

Double buffers decrease the blink but lead to an-other problem–transparency of the control, which bringsabout bad experience to users.

4.1.3 Smoothing modeDouble buffers can eliminate the drawing blink, but

there is still one more problem; that is unbeautifulgraph interface. Of course, a line with aliasing is ugly.Smoothing mode can be employed to clear the alias-ing, which is called anti-aliasing.

In terms of drawing, there is no difference betweenthe utilization of buffer container and GDI +. Thus,the setup of smoothing model is as same. Drawingcurve using smoothing model needs to set the Smooth-ing Mode property of Graphics before drawing.

Usually it is enough for system to only set the prop-erty Smoothing Mode. The other properties appear in

the occasion where there are many curves. However,the more properties are set, the more cost the diagramdrawn by GDI+ will take.

4.1.4 Synchronization contextEvent mechanism supporting asynchronous discov-

ery solves the problem of real-time response. But an-other serious problem occurs. The thread used to dis-cover topology is not the same one as UI thread. Ifthey are the same, the asynchronous model cannot beimplemented.

Topology mechanism will notify the subscriber onceit finds device(s), and at that time the functions, whichhave registered the events, are evoked. But the evok-ing thread is still the thread itself discovered by topol-ogy, not the one of UI threads. If there is no specialmechanism to tackle it, the exception will be thrownout.

An unofficial solution to it is to explicitly shut downthe checkup of thread in the constructors of UI achiev-ing this effectiveness by setting the property of Con-trol.CheckForIllegalCrossThreadCallsas false. How-ever, it is not safe to operate UI through cross-threadsfor it can invoke deadlock. Therefore, a mechanismtransferring UI operation to its own threads is in theurgent need.

.NET platform provide a mechanism to guaranteethe synchronization, which is called SynchronizationContext [12]. Synchronization Context has many ver-sions, such as Windows Forms Synchronization Con-text fit for Win FormDispatcher Synchronization Con-text used for the technique of WPF and Silverlight,ASP.NET Synchronization Context for ASP.NET andSynchronization Context based on threads. All of themhave common in unified abstract, though the imple-mentation of them are different from each other.

Since UI of the system is implemented by Win Form,Windows Forms Synchronization Context is the prior-ity.

Retile Searching implements the interface of ITopol-ogyStrategy, so the events subscribed from Found Sta-tion, found during the topology discovery can controlasynchronous present.

4.1.5 SerializabilityTopology structure as a structure of software is stored

in the memory of host, and its presentation is a struc-ture of Collection¡Station¿. The main tasks of stor-ing and loading topology are to store or restore thisstructure into persistence mechanism or memory. Themapping from data structure to persistence mechanism

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 5

Page 6: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

Figure 7 Working Process of Serialization

needs a mapping, but the programming is very time-consuming. The topology stored in form of a file is agood choice because it can be used conveniently andeasily.

Take all the above into account, serialization is theright scenario and .NET provides the function of se-rialization. What we need to do is to mark “serializ-able” on the data structure that needs to be serialized.The process of serialization is illustrated as Figure 7.

Auto-topology control forwards the request of save/loadto the class LoadSaveHelper, then LoadSaveHelperconverts it into the structure of StationInofo instead ofdirectly serializing it into Controls set of AuTopology.StationInofo keeps such information as IP address, co-ordinates, and links and so on. The real serializationis conducted in Serialize Formatter.

Serialize Formatter is classified into many types, suchas binary serialization, XML serialization and openstandard SOAP serialization. Since the interoperationbetween platforms is temporally not involved, binaryserialization with higher efficiency is a priority.

Topology is saved into a file with the suffix .tpg bydefault under the default directory Data. When thesystem starts, it will check up the directory Data. Ifthere are files with suffix .tpg, a dialogue box will ap-pear to enquire if the last topology is loaded. If thereis a topological file, the system will make a new topol-ogy according to the creating time of the files.

4.2 Device managementFor every found device, SNMS can check its infor-

mation and generate an exclusive hash code whichidentifies the device. SNMS is in charge of the fol-lowing information.

1) Location information: The logical location in topo-logical graph is not the physical location. SNMS should

Figure 8 The Intermediate Layer of Trap

hold the physical location of the devices.2) Device parameter: The statistic of device param-

eters can be helpful for maintaining the devices at laterstage.

3) Information of equipment: Assets appraisal al-ways involves the records of purchase, providers, andother relevant information, which is the starting pointof maintenance and statistic.

4) Maintenance record: It is important for networkadministrator to know the running state of the net-working equipment. The system provides users withthis function regarding to adding or updating mainte-nance records.

4.3 Trap detectionThere are many versions of traps. In order to be no-

tified when events occur, the system needs a kind ofmechanism which can receive trap and unify the dif-ferent versions of traps. The system uses intermedi-ate layer to act as an agent shown in Figure 8. Exceptmultiple versions, the multiple types of traps make thesoftware analysis a time-consuming job. SNMS couldnot predict the emerging traps with new definition be-cause of its scalability. Modeling trap, abstracting itscore into an expandable and configurable mode andimplementing it by XML file can make SNMP suit-able for different environment and easy deployment.

Filtering useful trap plays another import role, whichis determined by the management property of soft-ware. Filtering mode, white list and black list, is usedin filtration. White list shows the traps matching therules in the list while the traps mismatching the rulesin the list are in black list.

4.4 The application extension of context menuAs a major method of extending software, the con-

text menu of devices expresses itself in this way. Sincethe extension mechanism is added into topology dis-covery, the extension of the context menu behaves glob-ally. The system carries three extension functions it-

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 6

Page 7: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

Figure 9 Definition of interface IDevice&ITopology

self used for network routine tasks, which are pro-vided by the form of plug-in.

Every device has its unique identification to supportContext Menu. Thus, the system framework offers theinterface IDevice and designs the interface ITopologyfor assistance to topology mechanism. Figure 9 givesthe definitions of mentioned two interfaces.

IDevice, as the core interface of Context Menu, isimplemented by all the devices, so the plug-in can re-extend surrounding to IDevice. Compared with IDe-vice, ITopology interface supports the conversion be-tween different devices.

IDevice only provides the basic function in the earlysoftware making period, and it does not offer func-tions like grouping and extending icon, which will beconsidered in later development by gradually extend-ing more controls on this interface.

4.5 Algorithm of automatic topologyThe algorithm called weight circular distribution is

mainly due to introducing the weight of devices inthe network. As the goal of layout is to distribute themajor devices in reasonable and correct places in thescreen, this kind of topology layout make the findingof devices with highest weights as its first task. If sortand locate them in the weight orderthis algorithm iscomprised of four steps as follows:

The first step is to sort devices by weight. The sys-tem is routers and switches oriented. Therefore, themost sensitive information within topology is so rel-evant to routers. A device is regarded as a core one,which is always equipped with a wealth of routingscompared with others. Though the case like above iscontended to be absolute, it is the fact in most of thetime. Generally speaking, the number of devices withmore routings is not so much than the one with lessroutings. Consequently, the ones called core devicesshould be definitely placed on the core location, andthis is what the second step will do.

Locating by weight priority is the second step. Once

Figure 10 Distribution of satellite devices

the core devices have been settled down as well as thedevice group according to the weight, the first step isterminated. Then the ones in first group, the most cru-cial devices, averagely distribute on the circle sharedthe same length of radius and centered as the midpointof the screen. To define the radius often needs somesteps as follows. The more devices there are, the big-ger the value of radius is. When the devices locatingis done, the angle of the midpoint of the screen for thecorresponding device is confirmed. The angle, thus,becomes the starting point of next step.

Here comes the third step–“satellite” devices distri-bution. The devices adjacent to the core devices arenamed and classified into satellite devices. In thisalgorithm the conception of aggregation is not takeninto account, but the satellite devices used take theplace of it. Now an example is taken of the algorithmfor the distribution of satellite devices.

Assume that there are n core devices. The satellitedevices for every core device can only be within thesector of 360/n. Illustrated in the figure below.

There are three core devices shown in the picturewhich is divided into three sectors. Herein, take R2as an example. Its three satellite devices are well-distributed in the sector B according to the angle of 6 θand the radius can be adjusted following the amountof the satellite devices. Another correcting algorithmcan be like this. Observe if devices in other sectorsare apparently less than the ones in current sector ornot. If they are, distributing satellite devices will in-vade into the adjacent sectors in order to utilize thespace of screen to the full. Then, the satellite devicesof satellite devices distribute their topology using thesame algorithm.

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 7

Page 8: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

Figure 11 Drawing Links

Figure 12 Adjust for topology

The fourth one is to draw the links. The intersec-tion is permitted for links to core devices as there arealmost no possibilities to be not intersected. The prob-lem of intersection cannot become severe because ofthe guarantee furnished by annual distribution of de-vices. The links between core devices and satellitedevices can be directly connected. However, if theconnections happen to satellite devices, the layout ofsatellite devices should be slightly adjusted so that theoverlaps can be avoided. See the figure below.

Currently, if there are connections between device Xand device Z, the slight adjustment will be conductedin accordance with the space of the screen. Thus, thedistribution of links from X to Z seems much morereasonable as shown in the figure.

The direction of devices moving follows their upperdevices, of course, which is determined by the spaceof screen. That is, near to the upper or away from the

Figure 13 Simulation Testing

upper.Another moving is longitudinal. For example, when

Y is going to connect to R3, R2 is in the way obvi-ously. The adjustment to y is neither next to R2 noraway from R2, but in the direction of coordinate axisY . Consequently, further judgment should be made tocorrect the links and the best correctness is to move ydown shying from R2.

There is still one problem needing to be solved, thatis to set a value of a pixel, for instance, 50px, whichcan be used to adjust when the correctness should bedone if the distance from current link to the device inthe way is too small. If the distance is smaller than50 pixels, adjust the location of devices, and then thetopology is changed accordingly.

5. Testing and Deployment

5.1 TestingFirst, simulation testing is conducted under the Cisco-

simulating environment with matured simulation soft-ware. Figure 13 shows the system’s performance with10 devices in the LAN.

Second, the real environment testing is conducted.Medium-sized data exchange network of routing typeis used as testing environment. It consists of 5 Cisco7200 routers and 7 Cisco 3640 switches. After theconfiguration of the routing protocols, the SNMS issetup as well as the trap function. The real topologyof the mentioned network is illustrated as Figure 14before the test is done.

Using the system SMNS (SNMP-based MonitoringNetworks System), the testing result is displayed as

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 8

Page 9: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

Figure 15 Testing Result

Figure 14 Topology of Network

Figure 15.The discrepancy between original topology and test-

ing result is caused by the switch’s transparent role inthe network, which influences the judgment of topol-ogy logic. But the problems can occur until the topol-ogy happens to the computers.

5.2 Deployment1) Compile: SNMS aiming to serve network man-

agement could probably be run on X64 platform. There-fore, the guarantee that SNMS can be properly uti-lized on the platforms with the architecture of X64 orX86 should be taken into account. The best optionfor compiling the applications on different platformsis the compiling way-AnyCPU as one of the inherentattributions of .net to make compiling easy.

2) Installer: SNMS depends on the .NET Frame-work, so the computer without .NET Framework in-stalled could not run SNMS properly. Packing .NET

Framework together with SNMS facilitates the users.The software package should also include WindowsInstaller.

3) Running platform: One advantage of .NET plat-form is independent of running platform. .NET is alay of abstracting between SNMS and OS. Differentplatforms, such as Linux, Mac OS, IOS, and Androidcan run on the core framework of SNMP.

6. Conclusion and Future Work

As a kind of software used in upper application basedSNMP, SNMS not only implements the core mecha-nism of topology discovery, but also perfects the soft-ware frame, which makes it fit to develop different up-per application. The ideal evolution of software is tomake a basic framework based on SNMP, thus, otherapplications can be extended on it continuously. Dueto the maturity of SNMP, this kind of frame has greatpotential to share the future marketing.

The design of framework is an evolutionary process.This requires that back compatibility should be con-sidered when the increment and deletion of every APIis done. The first edition of SNMS only provides con-servative APIs for upper applications. With the evo-lution of frame, more APIs and functions will be pro-vided so as to simplify the difficulty of developing up-per applications.

The future direction to develop SNMS is to extend

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 9

Page 10: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

its transversal functions, but not application functions.Performance and buffer are the major direction to work.For example, the introduction of parallel concept canspeed up 5∼10 times in auto topology control, of course,the complexity of developing job will rise up.

Acknowledgment

This work was sponsored by the Scientific ResearchFoundation for the Returned Overseas Chinese Schol-ars, State Education Ministry. This work was also sup-ported by Tianjin Research Program of ApplicationFoundation and Cutting-Edge Technologies Grant 10J-CYBJC26100.

References[1] Jiang Guofeng, “Multiple vulnerability in SNMP,”

Computer, IEEE Computer Society, vol.35, pp.2-4,April 2002.

[2] Mingjiang Li, “SNMP simple network managementprotocol”, Beijing: Electronic Industry Press, 2007.

[3] CHEN Shu, ZHANG Jiang-Xin, “Design of the Net-work Topology Display M odule in SNM P-BasedGPON Network Management System”, ComputerSystems & Applications, vol.1, pp.84-88, 2011.

[4] ZHANG Tong, WU Shirong, “Research on Com-puter Network Traffic Monitoring System Based onSNMP,” Computer Technology and Development,vol.21, pp.88-91, Jan. 2011.

[5] CHU Jiu-liang, “The Construction and Realizationof Network Application Servers Monitoring Platformbased on SNMP,” Research and Exploration in Lab-oratory, vol.29, pp.65-68, Jan, 2010.

[6] Alexander Clemm, “Network Management Funda-mentals”, 1st ed., Cisco Press, 2006.

[7] Suman Pandey, Mi-Jung Choi et al. “IP NetworkTopology Discovery Using SNMP”. Korea: Dept. OfComputer Science and Engineering.

[8] ZHANG Yi, “the essence of software design andmodel”, Beijing: Electronic Industry Press, 2007.

[9] Wang Xiang, “Design Patterns-Engineering Imple-mentation and Extension Based on the C#”, Beijing:Electronic Industry Press, 2009.

[10] Alan Shalloway, James R. Trott, “Design PatternsExplained A New Perspective on Object-OrientedDesign”, Beijing, China Electric Power Press, 2006.

[11] Martin Fowler. “Refactoring-Improving the Designof Existing Code”. Addison Wesley, 1999.

[12] Jeffrey Richter. “CLR via C# 3nd”. Microsoft Press,2010.

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 10

Page 11: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

International Journal ofIntelligent Engineering & Systems

http://www.inass.org/

A Layered Approach Based on Objectives to Multi-Objective Optimization

Lian-Shuan Shi1,2∗, Yin-Mei Chen1

1 Tianjin University of Technology and Education, Tianjin 300222, China2 State Key Laboratory of Structural Analysis for Industrial Equipment, Dalian University of Technology,

Dalian 116023, China∗ Corresponding author’s Email: [email protected]

Abstract: A new multi-objective optimization approach based on layered objective is proposed. Two improvementson the non-dominated sorting genetic algorithm are given which are new layering method and the new selection mech-anism. On the basis of the traditional non-dominated sorting genetic algorithm, a new objective layer approach isadapted and cycle copy through the first half layers. Another one is making a restriction mechanism before crossoveron the classical non-dominated sorting genetic algorithm with elitist strategy. Through these operations, it can ef-fectively improve the convergence rate of the optimal solution set. At last, the corresponding non-inferior solutionswill be maintained. Several classic test functions commonly adopted in evolutionary multi-objective optimization andthe network design problem are used. The results indicate that the non-dominated sorting genetic algorithm based onlayered objective can effectively speed up the convergence rate.

Keywords: Genetic algorithm; Layered objective; Multi-objective programming; Network optimization.

1. Introduction

The multi-objective optimization problems widelyexist in real engineering world. And such problem isusually characterized by the presence of many con-flicting objectives. Because of the variety internal re-lations, these objectives are both interdependent andcompetitive. As a result, there is usually not a sin-gle solution which optimizes all objectives simultane-ously and a number of techniques have been devel-oped in order to find a “good” solution to the MOP.

For multi-objective optimization problems, there aremany methods available to tackle these kinds of prob-lems. One way to solve multi-objective problems is totransform the original problem into a single-objectiveone by using the weighted sum method with a weightvector. When the multi-objective optimization prob-lem is converted to a single objective optimization prob-lem, a few mature algorithms can be used to solve

the single objective optimization problem whose so-lutions are taken as one of the multi-objective opti-mization problems. But the obtained solution dependson the weight vector used in the weighting process,so some improving multi-objective optimization ap-proaches weighted are given [1, 2, 3].

Another way is to find the Pareto efficient solutionsto a multi-objective optimization problem. The Paretooptimality was introduced in the late 1800’s by theeconomist Vilfredo Pareto, and defined as follows: Asolution is said to be Pareto optimal if there exists noother solution that is better in all attributes. This im-plies that in order to achieve a better value in one ob-jective at least one of the other objectives is going todeteriorate if the solution is Pareto optimal. Thus, theoutcome of a Pareto optimization is not one optimalpoint, but a set of Pareto optimal solutions that visual-ize the trade-off between the objectives [4].

Goldberg [5] introduced non-dominated sorting to

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 11

Page 12: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

rank a search population according to Pareto optimal-ity. Firstly, the non-dominated individuals in the pop-ulation are identified. They are given the rank 1 andare removed from the population. Then the non-domi-nated individuals in the reduced population are identi-fied, given the rank 2, and then they are also removedfrom the population. This procedure of identifyingnon-dominated sets of individuals is repeated until thewhole population has been ranked.

The main purpose of the non-dominated sorting ge-netic algorithm (NAGA), which is developed from thebasic genetic algorithm, is to solve the multi-objectiveoptimization problem. The non-dominated sorting ge-netic algorithm [6] was proposed by Srinivas and Debin 1994 which is also known as non-poor classifica-tion genetic algorithm. This algorithm is the same asSGA algorithm except on the selective operator. Themain idea of this algorithm is to classify the popu-lations according to the idea of non-dominated sort-ing firstly, then, each individual that have been clas-sified will be given a certain shared virtual fitness inorder to maintain the diversity of the population. Non-dominated individuals in the population are identified,given a high initial individual score and are then re-moved from the population. These individuals areconsidered to be of the same rank. The score is thenreduced using sharing techniques between individualswith the same ranking. Thereafter, the non-dominatedindividuals in the remaining population are identifiedand scored lower than the lowest one of the previ-ously ranked individuals. At last, next generation isproduced by some selection operation with a certainprobability. After that, a number of genetic algorithmsis given, such as: NPGA [7] (Nich-Pareto)FFGA [8](Fonseca and Fleming GA), SPEA [9] (Stregth ParetoGA), NSGA- [10] (A fast elitist non-dominated ParetoGA).

Although the non-dominated sorting genetic algo-rithm has been well used in many engineering prob-lems, some problems still exist:

(1) Higher computation time complexity [10]. Itscomputation complexity is O(mN3), where, m repre-sents the number of objective function; N representsthe number of the population size. When the popu-lation size is large, the computing time cost will begreat, especially to sort the populations of every gen-eration, the time cost will be much bigger.

(2) Lack of elite strategy. The elite strategy guar-antees that the optimal solution has been found un-der a certain extent cannot be damaged by crossoverand mutation, but also can accelerate the convergence

speed.(3) That the sharing radius needs to be specified

makes the calculation more complex.Although the distribution of Pareto optimal solution

set which is got from the NSGA is fairly uniform, theconvergence speed is not fast because of the abovethree drawbacks. Aimed at the high computation timecomplexitywhen carrying out the algorithm, this ar-ticle proposes a new hierarchical approach based onobjective value to reduce the time complexity, so asto improve its convergence rate of the Pareto optimalsolution. Additionally, in some algorithm, the selec-tion operation is based on shared virtual fitness valueunder a certain probability, so some good individualscan not be selected, which results in the slower con-vergence.

In response to this phenomenon, this paper intro-duces a new selective mechanism, changing the de-fects resulted from the selective with probability in thepast, so that the convergence rate of the Pareto optimalsolution will be faster.

Aimed at the problem of slow convergence of opti-mal solutions in genetic algorithms, two improved ge-netic algorithms are proposed. The first one is basedon the objective layer of the non-dominated sortinggenetic algorithm. On the basis of the traditional non-dominated sorting genetic algorithm, it has two con-tributions. The first one is the adaptation of a newobjective layer approach and the second one is thenew selection mechanism. Its main idea is cycle copythrough the first 1/2 layer according to the hierarchy.Another one is based on the cross-limited with elitiststrategy of the non-dominated sorting genetic algo-rithm. It makes a restriction mechanism before crosso-ver on the classical non-dominated sorting genetic al-gorithm with elitist strategy. Through this operation,it can effectively improve the convergence rate of theoptimal solution set. Meanwhile, the algorithm alsocombines the objective layer approach to identify thenon-inferior solution. The two multi-objective opti-mization functions are used to do the test. The re-sults show that these improved algorithms speed upthe convergence rate of the optimal solution. Last,the improved algorithm is used to deal with the multi-objective network optimization problem. The mathe-matical model includes two objectives: the path lengthand the path delay. In practice, each different path hasdifferent node numbers in the network, so the vari-ant length of node index is used to code each path.Through the application of the improved algorithms,the Pareto optimal solution sets of network optimiza-

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 12

Page 13: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

tion are obtained. All of the programs are achievedby C++ language programming and the simulation re-sults are achieved with Matlab software.

2. Related Concepts of The Multi-objectiveOptimization

In most cases, the multi-objective optimization prob-lem is defined as the combinatorial optimization prob-lem under constrained conditions. It is mainly used tomaximize (or minimize) the objective function of dif-ferent objective.

A multi-objective optimization problem can be de-scribed as follows: the set of decision variables withthe number of n, the set of the objective function withthe number of k and the set of constraint functionswith the number of m. A constrained multi-objectiveoptimization problem (MOP) can be given as follows.Here, the optimization problem associated with eachobjective will be considered to be a minimization one,without loss of generality.

Minimize y = f (x) = ( f1(x), f2(x), . . . , fk(x))T

subject to e(x) = (e1(x), e2(x), . . . ,em(x))T ≤ 0x = (x1, x2, . . . ,xn)T ∈Ω⊂ Rn

y = (y1, y2, . . . ,yn)T ∈ Ywhere, f1(x), f2(x), . . . , fk(x) are k objective functions,x1, x2, . . . ,xn are n optimization parameters, x rep-resents the vector of decision variables, y representsthe vector of objective functions, Ω represents the de-cision variable space and Y represents the objectivefunction space, the constraint e(x)≤ 0 defines the setof feasible solutions.

In order to better understand the decision variablespace and the objective function space of the multi-objective optimization problem, some definitions aregiven as follows:

Definition 1For any two objective vector b and c,

b = (b1, b2, . . . ,bn)T , and c = (c1, c2, . . . ,cn)T ,b = c, If and only if bi = ci for all i ∈ 1,2, . . . ,k,b≤ c, If and only if bi ≤ ci for all i ∈ 1,2, . . . ,k,b < c, If and only if b ≤ c for all b 6= c. In the aboveformula, bi represents an element of the objective vec-tor b and ci represents an element of the objective vec-tor c.

Definition 2For any two objective vector u and v, the binary re-

lation ≺, ¹ and ∼ define as follows:u≺ v (u dominates v), If and only if f (u) < f (v).u ¹ v (u weakly dominates v), If and onlyif f (u) ≤f (v).v ∼ v (u indifferent v), If and only if f (u) ≮= f (v)

and f (v)≮= f (u).where, f (u) represents the objective function valueof the decision vector u, f (v) represents the objectivefunction value of the decision vector v.

Definition 3Suppose that x∗ ∈Ω , if fi(x∗)≤ fi(x) (i = 1,2, . . . ,m)

for all x ∈ Ω, then X∗ is one optimal solution of theMO (multi-objective optimization).

Definition 4If one solution x∗ ∈ Ω are non-dominated by any

x ∈Ω, then x∗ is called the Pareto optimal solution.In the algorithm process, the multi-objective func-

tion optimization problems are solved by the non-domi-nated hierarchical genetic algorithm. Firstly, each in-dividual in the group is given a certain virtual fitnessvalue using the non-domain hierarchical method. Then,the traditional genetic algorithm is used to choose theirmode, crossover and mutate. At last, the correspond-ing non-inferior solutions will be maintained.

3. Algorithm Design

3.1 The layered approach based on objective valueIn this algorithm, a new layered approach based on

objective value is introduced. The main idea of the ap-proach is shown according to the following example.A(20, 90) B(25, 85) C(30, 80) D(35, 75) E(40, 60)F(45, 55) H(40, 40) are the numbers of the exampleand the minimum number is taken as the best. Afterbeing layered, it can maintain the data of the first layerwith the number of A(20, 90) B(25, 85) C(30, 80)D(35, 75) H(40, 40) and the data of the second layerwith the number of D(35, 75) E(40, 60).

According to the layered data, some phenomena canbe found.

(1) In terms of the first objective, if the minimum ofthe first objectives has been found, this value will bedivided into the first layer. For instance, in the numberA(20, 90), the data 20 is the minimum data of all thefirst objective, so A(20, 90) is divided into the firstlayer.

(2)In terms of the second objective, if the minimumof the second objectives has been found, this data willbe divided into the first layer. For instance, in thenumber H(40, 40), the data 40 is the minimum dataof all the second objective, so H(40, 40) is dividedinto the first layer.

According to all the above, a result can be concludedthat if there are m objectives, then the third objectivecan be layered to the m-th objective as the first or thesecond one. Here, the detail of the layered process

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 13

Page 14: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

is given (take the objectives of path length and pathdelay as an example).

Layered process: specify mark f ront = 1 as the be-ginning.

Step 1: Start to look from the first objective:¬ Find the individual with the minimum first objec-

tive values from all unmarked individuals, and mark‘Front’.

­ Check out whether there exist individuals with thesame minimum first objective values. If there exist theindividuals, mark ‘Front’.

® Find out the individuals with the minimum sec-ond objective values among the marked individualswith mark Front and remove the mark front for therest of the individuals which have the non-minimumsecond objective value.

Step 2: Start to look from the second objective:¬ Find out the individuals with the minimum sec-

ond objective value from the unmarked individuals orthe individuals that marked ‘front’ and mark ‘front+1’.

­ Then Check out whether there exist individualswith the same minimum second objective value. If itis true, make the same mark.

® Find out the individuals that has minimum secondobjective value with the mark ‘front+1’ and removethe mark of the individuals which have non-minimumsecond objective value.

¯ convert the mark of the individuals from ‘front+1’to ‘front’.

Step 3: The third objective to the m-th objective canbe done as the above.

Step 4: Compare all the individuals with the mark‘front’. If there exist the individuals dominated, re-move its mark.

Step 5: Find the individuals which are unrelated tothe marked individuals in the unmarked individualsand then mark ‘front’.

Step 6: Find out the non-dominated individuals ofthe current population with the mark ‘front’.

Step 7: Increment the mark ‘front’ by one.Step 8: Loop from step 1 to Step 6 until all the indi-

viduals are identified.

3.2 Selection mechanismAimed at the slow convergence problem for most of

the evolution algorithms, a new selective mechanismis proposed to accelerate the convergence speed of thepopulations that the idea is to cycle through the first1/2 layer according to the hierarchy until the numberof the individual copied is the same size as the popu-lation.

Figure 1 Flowchart of the Algorithm

For example, if the population size is 10, then theycan be divided into 4 layers. Three individuals areat the first layer, two individuals at the second layer,three individuals at the third layer and two individualsin the 4th layer.

The number of the loop copy is decided by the num-ber of the layer divided by 2, so the result is 4/2=2 andcopy the first two layers. Because of the number of thepopulation is 10, so at first, three individuals of thefirst layer is copied, then, copy two individuals of thesecond layer. Repeat it again until the number of theindividual copied is the same size as the population.

4. Algorithm Descriptions

In order to better understand the operation processof the algorithm, the following steps will describe thedetails of this algorithm. Suppose the size of the evo-lutionary population P is N.

Step 1: suppose the variable t is equal to 0, the algo-rithm randomly generates the initial population withsize n.

Step 2: Calculate the objective value of each indi-vidual in the initial population p(0).

Step 3: According to the objective value, the pop-ulation p(0) is layered by the objective value layeredmethod and make the variable ‘front’ equal to 1.

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 14

Page 15: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

Figure 2 The 10th objective space of NSGA algorithmbased on hierarchical objective value

¬ Select the first layer non-dominate individuals ofeach objective value and mark ‘front’.

­ Find out the dominated individuals having themark ‘front’ and then remove its mark.

® Make a judgment whether all the individuals havebeen layered. If not, increase 1 for front and imple-ment step 1; otherwise implement step 4.

Step 4: Do selective operation according to the re-sult of the layering operating.

Step 5: Do crossover and mutate operation on theselective individuals under a certain probability.

Step 6: If the variable t (the evolution generation) isless than the maximum evolution generation, imple-ment step 2; otherwise, end the operation.

The flowchart of the Algorithm is given as Figure 1.

5. Experimental Result

This paper uses two common multi-objective testfunctions to verify the performance of the non-dominatedsorting genetic algorithm objective based on layer. Thesetwo functions ZDT1 and ZDT2 were introduced byZitzler and Deb in references [12]. The two func-tions are the multi-objective test functions of the non-convex and convex Pareto optimal solution set.

Example1 ZDT1The non-convex Pareto optimal so-lution set

f1(x) = x1 ,

f2(x) = g(x)[1−√

x1

g(x)] ,

g(x) = 1+9

n−1

n

∑i=2

xi ,

xi ∈ [0,1], i = 1, . . . ,n, n = 6.

Figure 3 The 100th objective space of NSGA algorithm

The parameters of the algorithm for example1 are asfollows: the population size N is equal to 200, the ter-mination condition t of the algorithm is equal to 10,the crossover probability is set to 0.8, the mutationprobability is set to 0.1 and the number of the individ-ual goal m is equal to 2. The parameters of the NSGAare as follows: the population size N is equal to 200,the termination condition t of the algorithm is equalto 200, the crossover probability is set to 0.8, the mu-tation probability is set to 0.1 and the number of theindividual goal m is equal to 2.

The simulation results are shown in Figure 2. Thesimulation results of NSGA-II algorithm are shown inFigure 3:

Example 2 ZDT2: The convex Pareto optimal solu-tion set.

f1(x) = x1 ,

f2(x) = g(x)[1− (x1

g(x))2] ,

g(x) = 1+9

n−1

n

∑i=2

xi ,

xi ∈ [0,1], i = 1, . . . ,n, n = 6.

The parameters of the algorithm for the example 2are as follows: the population size N is equal to 200,the termination condition t of the algorithm is equalto 10, the crossover probability is set to 0.8, the mu-tation probability is set to 0.1 and the number of theindividual goal m is equal to 2. The parameters of theNSGA are as follows: the population size N is equalto 200, the termination condition t of the algorithm isequal to 200, the crossover probability is set to 0.8,the mutation probability is set to 0.1 and the numberof the individual goal m is equal to 2.

The simulation results are shown in Figure 4.The simulation results of NSGA-II algorithm are

shown in Figure 5:

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 15

Page 16: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

Figure 4 The 10th objective space of NSGA algorithmbased on hierarchical objective value

Figure 5 The 100th objective space of NSGA algorithm

From the above simulation results, it can be seenthat the distribution of non-inferior solution of this al-gorithm is just the same as the NSGA algorithm. Butthe convergence speed of this algorithm is much fasterthan NSGA algorithm.

6. The Application of The Algorithm to Net-work Optimization

6.1 Problem descriptionIn real application, the network design problem is

also a multi-objective problem. A telecommunica-tion network design is analyzed using various mea-surements such as communication cost, transmissiondelay, and routing policy.

Given locations of the nodes and other informationsuch as cost, distance and traffic between any pairof nodes, the main problem of a multi-objective net-work optimization design is how to construct a net-work which minimizes total link costs subject to cer-tain constraints. There are n network nodesthe net-line is used to connect node s to the node t, and onlya line is connected from the node s to the node t, withno looping. In this paper, the shortest path and min-imum delay is considered as the objectives of multi-

objective optimization problem.These two objectives of the network topology could

be described through the undirected graph G = (V, E,C, D). Set V is the set with n network nodes, V =[V1, V2, . . . , Vn], E is the set of links between nodepair, E = (si, ti)|i = 1,2, . . . ,m.si, ti ∈V. Only a di-rected arc exists between any two adjacent nodes. Thepath length between two adjacent nodes (si, ti) is de-noted as Ci (Ci ≥ 0), the delay is denoted as Di (Di ≥0). C = [C1,C2, . . . ,Cm] is the vector of path length,D = [D1,D2, . . . ,Dm] is the vector of delay. Supposethat s is the source node, t is the destination node, andthen the optimal path from the node s to the node tis denoted as Rs−t , the optimal length of path is de-noted as Cs−t , the optimal delay is denoted as Ds−t ,the mathematical model of the network optimizationcan be written as a multi-objective 0-1 integer pro-gramming problem as follows.

Minimize y = F(x) = (Cs−t ,Ds−t)where, Cs−t is the path length.

Cs−t =t

∑i=s

t

∑j 6=i, j=s

Ci j · xi j

Ds−t is the path delay:

Ds−t =t

∑i=s

t

∑j 6=i, j=s

Di j · xi j

The constraint is:

t

∑j=s, j 6=i

xi j−t

∑k=s,k 6=i

xki =

1, i = s;−1, i = t;0, i 6= s, i 6= t;

xi j =

1, (i, j) ∈ Rs−t ;0, (i, j) /∈ Rs−t ;

When (i, j) ∈ Rs−t , that is (i, j) the shortest path,xi j = 1, otherwise, xi j = 0.

Multi-objective network optimum problem is a typ-ical combinatorial optimization problem, and it wasa NP-hard, that is their possible searching number ofpaths is an exponential growth with the total numberof network nodes growing, so it is difficult to find outthe optimal solutions, only to find out relatively op-timal non-dominated solutions. This paper solves themulti-objective network using an improved genetic al-gorithm and can get better optimal solutions of non-dominated solutions.

6.2 Applications of hierarchic objective genetic al-gorithm

The algorithm is used to reflect primarily the fol-lowing aspects:

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 16

Page 17: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

(1) Coding:The most critical step in applying a genetic algo-

rithm to a network design is to choose a way to repre-sent a solution to the problem in a chromosome. Achromosome is the corresponding representation orgenetic encoding of the individual (solution). Althoughthe template of genetic algorithms is the same, differ-ent solution representations lead to complete differentalgorithms with different efficiency. In the algorithm,a chromosome represents a path from source node todestination node, which may be a feasible solutionand may be not, therefore the checking of the routingand constraints during each chromosome evaluationis inevitable, so that a large amount of computationtime is taken on such checking and a repair mecha-nism is required when any of the constraints is vio-lated, which can result in the loss of important geneticmaterial and, thus reduce the efficiency of the search.

In this genetic algorithm, to avoid such inefficientchecking of violation of the constraints, a repair mech-anism, a chromosome, no matter it is generated ini-tially or by genetic operators, is a feasible solution. Inpractice, different path has different nodes numbers inthe network, so the length of chromosome is different.

(2) Population generationAssuming the number of nodes at network is m,

Population size n. The chromosome is combined bythe node index 1,2 . . . ,m, and the first point (sourcenode of path) is s, and the last point node is t. Themaximum coding length is m, which is each node inthe network belongs to the path. The minimum lengthof possible path is 2, directly from the start node tothe end node, no other nodes between s and t.

In the process of generating the first path, the firstnode is fixed to node s, the second node k (k 6= s and k∈[1,m]) is produced by using random function. Whenk = t, the first path coding is ended.

Other paths can be generated by the same method.(3) The objective layered approachThe objective values include the path length and the

delay. They can be calculated as follows:

Cs−t =t

∑i=s

t

∑j 6=i, j=s

Ci j · xi j

Ds−t =t

∑i=s

t

∑j 6=i, j=s

Di j · xi j

Layered process: Specify mark Front = 1 as the be-ginning.

Step 1: Start to look from the first objective pathlength:

¬ Find out the shortest length from all unmarkedindividuals, and mark ‘front’.

­ Check out whether there exist individuals withthe same length as the shortest path length.

® Find out the individuals with the shortest delayamong the marked shortest path and remove the rest ofthe individuals which have non-minimum path delay.

Step 2: Start to look from the second objective pathlength:

¬ Find out the individuals with the shortest delayfrom the unmarked path or the path marked ‘front’and mark ‘front+1’.

­ Check out whether there exist individuals withthe same length as the shortest path length. If it istrue, make the same mark.

® Find out the individuals with the shortest pathlength with the mark of ‘front+1’ and remove the markof the individuals which have non-minimum path length.

¯ Convert the mark of the individuals from ‘front+1’to ‘front’

Step 3: Compare all the individuals with the mark‘front’. If there exist the individuals that are domi-nated, remove its mark.

Step 4: Find out the individuals which are unrelatedto the marked individuals in the unmarked individualsand then mark ‘front’.

Step 5: Find out the non-dominated individuals ofthe current population with the mark ‘front’.

Step 6: Increment the mark ‘front’ by one.Step 7: Loop from step 1 to Step 5 until all the indi-

viduals are identified.(4) Crossover operationGenetic operations here mainly include selection,

crossover and mutation.In order to speed up convergence, the chromosomes

are selected from the first 1/2 layers according to theabove hierarchy in selection process. Its benefit is thatthe fitness of the individual does not need to calculate,the individuals are choose directly to crossover andmutation operations.

There are lots of cross means. In this algorithm,because the encoded lengths of the paths may not besame, this will cause great inconvenience to crossover.In order to minimize the complexity of the crossover,here a single point crossover is used. The crossoverprocedure is the following:

First calculate cross paths with crossover probabil-ity, and then randomly generate cross-location, nextjudge the two genes of the first individuals on in thiscross-location. If the two genes are not the start nodeor end node, cross the two genes; otherwise the two

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 17

Page 18: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

genes do not cross.In the crossover process, a single point crossover

is used. First of all, a cross point is produced ran-domly. Two parent chromosomes are then partitionedinto two parts. Two new chromosomes are generatedby exchanging back part of two parent chromosomes.If there are duplicated nodes in the new chromosomesafter the exchanging, the operation of swapping dupli-cated nodes between the two resulting chromosomesis used.

(5) Mutation operationMutation, a single point mutation is employed. Firstly,

the number of mutation is calculated by mutation prob-ability. Then the mutation location is generated ran-domly and a new node between 1 and m is generatedrandomly. If this node exists on the individual, ran-domly repeat generating another node until a node ap-pears which does not exist on the individual.

6.3 The experiment result for network designThe network design problem is given by two 8*8

matrices. A matrix is the path length matrix A = [ai j]n×n,where, ai j is the path length between of the node i andthe node j.

0 6 3 5 15 20 50 906 0 8 17 20 30 12 163 8 0 50 70 8 2 355 17 50 0 60 30 24 1015 20 70 60 0 20 50 520 30 8 30 20 0 3 5015 12 2 24 10 3 0 2090 16 35 10 5 50 20 0

Another is delay matrix B = [bi j]n×n, where, bi j isthe delay between the node i and j.

0 3 5 4 8 10 15 133 0 11 6 7 5 12 15 11 0 4 2 8 30 274 6 4 0 20 17 11 28 7 2 20 0 13 16 210 15 8 17 13 0 7 1515 2 30 11 16 7 0 813 1 27 2 3 15 8 0

In the process of using the algorithm to solve thisnetwork, the parameters are set as follows:

The source node is 1 and the destination node isnode 8, the objective numbers is m = 2, the size ofpopulation is N = 50, the probability of crossover is0.8, the probability of mutation is 0.1, the terminationcondition is maximum generation = 100.

The optimum path is (1, 4, 8) and (1, 2, 8), thepath length and postpone are (15, 6) and (22, 4).

7. Conclusion

Aimed at the long running time of layered methodin NSGA algorithm and the slow convergence of thePareto optimal solution set resulted from the randomselection mechanism. This paper proposes a new lay-ered objective approach to deal with the long timecomputation during the layering process and also pro-poses a new selection mechanism to solve the slowconvergence problem of the Pareto optimal solutionset. There is an advantage of no need to calculate thefitness value with this selection mechanism. The ex-perimental results show that this algorithm with thenew objective value and the selection mechanism cangreatly accelerate the convergence speed.

The network designs are challenging problems, al-though the genetic algorithm proposed can achieve thebasic design task and give an optimal solution, it isnecessary to compare performance of this genetic al-gorithm with the best solution which could be verydifficult to get because it is a NP-hard problem.

The improved multi-objective optimization approachbased on layered objective is used to solve the networkdesign problems. the genetic algorithm designed insuch a way that it can be easily extended to a high-connectivity network design while some methods havea difficulty in doing so or are impossible to do so; thegenetic algorithm is suitable for large network designswhile some methods could break down when the net-work size increases up to a certain extent due to therealistic CPU constraints.

References[1] J.D. Schaffer. “Multiple Objective Optimization with

Vector Evaluated Genetic Algorithm”, Proc of 1stInt. Conf. Genetic Algorithm, Hillsdale, New Jersey,1985: 93-100.

[2] Zhimin Fang. “Artificial Intelligence and Computa-tional Intelligence”, AICI ’09. International Confer-ence on 2009. 2009(1): 373-377.

[3] Jiaquan Gao. “WBMOIGA: Weight-based multiob-jective immune genetic algorithm and its applica-tion”. Information and Automation, 2009. ICIA ’09.International Conference on. 2009: 1-6.

[4] Johan Andersson. “Multiobjective Optimization inEngineering Design, Applications to Fluid PowerSystems [Dissertations]”. Division of Fluid andechanical Engineering Systems, Department of Me-chanical Engineering Linkopings universitet SE-58183 Linkoping, Sweden Linkoping 2001.

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 18

Page 19: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

[5] Goldberg D.,“ Genetic Algorithms in Search and Ma-chine Learning”. Reading, Addison Wesley, 1989.

[6] Srinivas N, Deb K. “Multi-objective optimizationusing nondominated sorting in genetic algorithms”.Evolutionary Computation. 1994, 2(3): 221-248.

[7] Hom J, Nafpliotis N, Goldberg DE. “A niched Paretogenetic algorithm for multi-objective optimization”.In: Procof the 1st IEEE Conf. on EvolutionaryComputation. Piscataway: IEEE World Congress onComputational Computation. 1994, 1: 82-87.

[8] Fonseca CM, Fleming PJ. “Mul-tiobjective optimiza-tion and multiple constraint handling with evolution-ary algorithms-Part I: A unified formulation”. IEEETrans. Systems, Man, and Cybernetics, 1998, 28(1):26-37.

[9] Zitzler E, Thiele L. “Multi-objective evolutionary al-gorithms: A comparative case study and the strengthPareto approach.” IEEE Trans. Evolutionary Compu-tation. 1999, 3(9): 257-271.

[10] Deb Kalyanmoy, Sagrawal, Amrit Pratab. “AFast and Elitist Multi-objective Genetic Algorithm:NSGA-II [J].” IEEE Transactions on EvolutionaryComputation, 2002, 6(2): l82-197.

[11] Pan XiaoYin, Liu Fang, Jiao LiCheng. “Multiob-ject Social Evolutionary Algorithm Based on Multi-Agent”. Journal of Software. 20(7): 1703-1713.

[12] Zttzler E, Deb K, Thiele L. “Comparison of Multiob-jective Evolutionary Algorithms: Empirical Results[J]”. Evolutionary Computation, 2000, 8(2): 173-195.

[13] Runhe Huang, Jianhua Ma, D. Frank Hsu. “A GeneticAlgorithm for Optimal 3-connected Telecommunica-tion Network Designs”. Proceedings of the 1997 In-ternational Symposium on Parallel Architectures, Al-gorithms and Networks (ISPAN ’97). 1997, pp.344-350.

[14] Gen M, Cheng R W, Lin L. “Network models andoptimization [M]”. London: Springer-Verlag, 2008:30-82.

[15] Ahn C W. “A genetic algorithm for shortest pathrouting problem and the sizing of populations [J]”.IEEE Trans on Evolutionary Computation, 2002,6(6): 566-579.

[16] Wen H Y.“ Genetic algorithm based computation ofshortest path in discrete-time networks [J]”. Jour-nal of South China University of Technology, 2008,36(2): 13-16.

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 19

Page 20: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

International Journal ofIntelligent Engineering & Systems

http://www.inass.org/

Building Domain Ontologies From Relational Database Using Mapping Rules

Maruf Pasha∗, Abdul Sattar

Institute of Computing, Bahauddin Zakariya University, Multan.∗ Corresponding author’s Email: [email protected]

Abstract: Ontologies have long been considered the core of semantics as they offer shareable and reusable knowl-edge about a particular domain. Improving and sharing domain specific knowledge residing in a database is one ofthe key challenges faced while developing any application. Due to the ever growing amount of data on the Web, it isalmost impossible to extract meaningful data and the amount of manual work during creation of ontology poses seriesof challenges. And researchers are facing challenges such as the unavailability of well-formed databases, domainexpert’s help for extracting cardinality restrictions and generation of un-resolvable URIs. Therefore, we have focusedon domain specific relational databases for constructing ontologies as a solution. Our aim is to analyze the variousOntology construction approaches from relational databases and identify the advantages and disadvantages of thesetechniques, so that an enhanced and efficient approach can be proposed. We have performed detailed analysis of vari-ous ontology construction techniques from relational database (RDB) based on database schema analysis (meta-data,cardinality restrictions and datatype information), stored data (through data mining) and also performed a comparativeanalysis of these techniques.

Keywords: Ontology; Web Ontology Language (OWL); Relational database; Ontology construction.

1. Introduction

Semantic Web provides technology to capture, share,and reuse structured and machine-readable domain spe-cific knowledge and makes it available on web [1, 2].Ontology is a description of domain-specific knowl-edge in order to share it with different applications[3]. “Ontology is a defined specification of concep-tual model”, defined by Gruber [4].Machine and peo-ple also share information through ontology [5]. Maincomponents of ontology (web) are: classes, subclasses,properties (datatype, object), and individuals [6, 7].Ontology editors such as Protege [8] are used to en-tering more elements in ontology for completeness.Current ontology usages are digital library, SemanticWeb, and information intelligent retrieval system, etc[6]. Web Ontology Language (OWL) has been recom-mended by The World Wide Web Consortium (W3C)as a formal language for authoring ontology [7].

Improving and sharing domain specific knowledgethat resides in database is one of the challenges inimplementing applications. One of the ways for rep-resenting domain specific knowledge is to generateontology from relational database (RDB).Moreover;RDBs provide accessibility and scalability of storeduseful information [9] and serve as a useful data sourcefor the surface web [10]. Many works have been doneto add semantics to relational databases (RDBs) sche-mas [11].

In the schema mapping techniques, relation databaseschema is converted to ontology based on the mappingrules. One of the challenges in schema mapping tech-nique is how accurately translation process encom-passes all aspects represented by relational databaseschema. Various research groups have proposed vari-ous techniques to translate relational database schemacomponents to ontology elements [8]. Proposed a tech-

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 20

Page 21: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

nique to learn ontology from structured, semi-structuredand un-structured data. Automapper [12] is a Seman-tic Web interface for RDBs to generate the data sourceand the respective mapping ontology from relationaldatabase automatically. In this technique, relationaldatabase schema is used to create OWL ontology. Arule based translation process of relational databaseschema to ontology maps data-source to domain. ASemantic Bridge module for relational database is usedfor translating queries into OWL ontologies.

In XTR-RTO [13], Extensible Markup Language (XML) document is used as source for generating OWLontology. The transformation process converts XMLschema to RDB schema and then, RDB schema toOWL ontology. Different attributes used to describerelational database are: DbName, Relation, Relation-List, Table and Attribute. RTAXON [14] uses datamining approach for ontology construction. This workpresented a technique that mines (extracts) all databasecontent to identify categorization patterns (subsump-tion relation). These categorization patterns are usedto generate class hierarchies. Concept hierarchies canbe generated based on the relationships among attributesof a relation. This approach uses lexical clues identi-fied from attribute names that show specific role ofattribute in the relations (i.e. categorizing the tuplesin the relation). In [15], Li et al. presented an on-tology learning technique that generates OWL ontol-ogy, based on learning rules from normalized rela-tional database schemas (upto 3NF). Since these learn-ing rules depend upon relational database schema, there-fore learning rules are applied for concepts(classes),datatype and object properties (properties) and prop-erty characteristics (i.e. cardinalities that define prop-erty specifically with more details), subsumption rela-tionship(class hierarchy) and data instances. Mappingrules for generating ontology are (1) all inter-relatedtables/relations combined to make single class; (2)Map each table or relation to a class that represents en-tity rather than relation between relations/tables; and(3) instances used to identify inclusion dependenciesbased on subsumption relationship of classes.

2. Ontology Construction

This section contains various approaches to ontol-ogy construction based on different characteristics.

2.1 AutomapperAutomapper [12] is Semantic Web interface for gen-

erating ontology from relational database automati-cally. Automapper is an application independent tool

Table 1 Departments Table

ID∗ NAME1 System Solutions2 Research and Development3 Management

∗ ID is a Primary key

Table 2 Staffing Table

Staff Name Project DeptID Hours RoleMattf Alpha 1 100.5 DeveloperMikD Alpha 2 50.2 Tech LoadMattG Beta 1 92.0 ArchitectDaveK Beta 1 120.0 DeveloperMikD Beta 2 30.8 ConsultantDaveK Alpha 1 87.8 Indagator

that generates a basic ontology from a relational datab-ase schema and dynamically produces instance datausing ontology.

The following class descriptions, axioms and restric-tions are currently generated by Automapper:

• maxCardinality is set to 1 for all nullable columnsand is used for descriptive purposes.

• minCardinality is set to 1 for all non-nullablecolumns and is used for descriptive purposes.

• All datatype and object properties that representcolumns are marked as Functional Properties.To ensure global uniqueness and class speci-ficity, these columns are given URIs based onconcatenating the table and column names.

• All values from restriction reflect the datatypeor class associated with each column and is usedfor descriptive purposes.

Table 1 and Table 2 list the contents of departmentsand staffing tables, respectively.

From this schema, Automapper creates the data sourceontology and class-specific inverse functional rules, asshown in the Figure 1.

2.2 XTR-RTOIn XTR-RTO [13], Extensible Markup Language (

XML) document is used as source for generating OWLontology. The translation process converts XML schemato RDB schema and then, RDB schema to OWL on-tology. Different attributes used to describe RDB are:DbName, Relation, RelationList, Table and Attribute.

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 21

Page 22: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

Figure 1 Ontology and inverse functional rules created byAutomapper

All tables are mapped to rdb: Relation and rdb: Rela-tionList, where as each attribute is mapped to rdf: At-tribute and rdb: hasType. The entity-relation model isused for organizing database, which clearly expressesthe relationship between data. Therefore metadata in-formation and structural restrictions are extracted fromrelational database to construct ontologies. The ontol-ogy contains:

• Vocabularies for describing relational databasesystems such as: rdb: DBName, rdb: Relation,rdb: RelationList, rdb: Table, rdb: Attribute,rdb: PrimaryKeyAttribute, and rdb: ForeignKey-Attribute.

• Semantic relationships between vocabularies su-ch as: rdb: hasRelation, db: hasAttribute, rdb:primaryKey, db: hasType and rdb: isNullable.

• Restrictions on the vocabularies and their se-mantic relationships such as: each relation haszero or more attributes, and each attribute hasexactly one type.

Mapping approach used in XTR-RTO is described be-low:

• Each table is mapped to an instance of type rdb:Relation and added to type rdb: RelationList.

• Each attribute is mapped to an instance of typerdb: Attribute and an instance of type rdb: hasT-ype is generated simultaneously. If the attributeis the foreign key, an instance of type rdb: Ref-erenceAttribute and an instance of type rdb: Ref-erenceRelation are generated to represent thisinformation.

Generate the restrictions of each instance of type rdb:Attribute, such as cardinality restriction and foreignkey restriction. There is one table in this relationaldatabase, as illustrated in Table 3.

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 22

Page 23: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

Table 3 Book Table in Relational Model

BOOK ID TITLE AUTHOR PRINTER ID

Figure 2 OWL description of BOOK Table

Suppose the database is saved in local host (mylo-calpc), and the OWL ontology describing the databasehas a namespace ”http:// mylocalpc/book.owl”, whichis changeable as user desires. Figure 2 illustrates therelations in the ontology:

The ontology generated from table BOOK is shownin Figure 3.

2.3 RTAXONA data mines approach for ontology construction.

This technique mines (extracts) database contents tofind categorization patterns (subsumption relation). T-hese categorization patterns are then used to generateclass hierarchies. Concept hierarchy identification byidentifying the relations found in attributes of the rela-tion is used as a base for learning ontology. Due to theassumption that attribute names tell meaning full rolein the table/relation, lexical clues of attribute names

Figure 3 Relations in the ontology

are identified (i.e. for categorizing the tuples). In Fig-ure 4, the Products relation contain Category attributethat serves as categorizing attribute. RDBToOnto [16]is a tool that uses RTAXON [14] method for convert-ing RDB to ontology.

Section 1 presents the pattern identification proce-dure, whereas Section 2 discusses subclasses genera-tion base on identified patterns.

1) Categorizing attributes identification:There are two sources used to identify categorizing

attributes: names of columns/attributes and data di-versity in column.

a) Identification of lexical clues in attribute names:The lexical clue that shows specific role of the at-

tribute in the relation may be part of the name, as inthe attribute names Category or Product Type. In Fig-ure 4, for example, the Products contain Category at-tribute that is used as categorizing attribute.

b) Estimation of data diversity through entropy:First filtering step helps to identify categorizing at-

tribute using lexical clues. For example, Category col-umn in the Products relation can be used to derive sub-classes.

However, with complex or large databases, the firststep often chooses several candidates. Then select-ing suitable candidate based on data diversity in col-umn data where selected candidate might have typi-cal degree of redundancy identified by the concept ofentropy. Entropy is a measure of the uncertainty ofa data source. Attributes with highly repetitive con-tent will be characterized by low entropy. Conversely,among attributes of a given relation, the primary keywill have the highest entropy since all values in its ex-tension are distinct.

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 23

Page 24: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

Figure 4 Categories employed for hierarchy generation

2) Generation and population of the subclasses:Identified categorizing attribute is used to generate

subclasses. A subclass is created based on each valuetype of the attribute (i.e. for each element of the at-tribute active domain). However, proper handling ofthe categorization source may require more complexmappings. As illustrated in Figure 4, in the first part(a), each relation (or table) definition from the rela-tional database schema is the source of a class (orconcept) in the ontology. All attributes other than ref-erence keys translated into datatype properties. Theprimary-foreign key relations are the reliable sourcefor associating classes and, in this example, each re-lationship is translated into an object property, wherethe (b) part shows how subclasses are generated basedon categorizing attribute (Category) of Products table.

As illustrated in Figure 5, values used for subclassgeneration are extracted from other tables. In this ex-ample, CatId attribute used as categorizing attributein Albums table/relation is linked with Categories re-lation through foreign key relationship. Categories re-lation contains all album categories.

2.4 Learning Ontology from Relational DatabaseAn ontology learning technique generates ontology

(OWL) automatically based on learning rules from nor-malized relational database schemas (upto 3NF). Sincethese learning rules depend upon relational databaseschema, therefore learning rules are applied to con-

Figure 5 Categories employed for hierarchy generation arefurther defined in an external relation.

cepts (classes), datatype and object properties (prop-erties) and property characteristics (i.e. cardinalitiesthat define property specifically with more detail), sub-sumption relationship (class hierarchy) and data in-stances.

Mapping rules for generating ontology are (1) allinter-related tables/relations combined to make sin-gle class; (2) Map each table or relation to a classthat represents entity rather than relation between re-lations/tables; and (3) instances used to identify inclu-sion dependencies based on subsumption relationshipof classes.

Mapping rules are used to learn ontology from re-lational database. These rules are: rules for acquir-ing concepts (classes), datatype, and object proper-ties, class-subclass relationships (hierarchy), cardinal-ity and instances.

1) Acquiring classes:

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 24

Page 25: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

Figure 6 Ontology Learning Framework

During acquiring classes, several inter-related rela-tions are combined to derive single class. These rulesintegrate the several inter-related relations into singleclass, when these relations/tables are used to describesingle entity.

2) Learning properties and property characteristics:Object and datatype properties are two types of prop-

erties. Reference relationship between relations is usedto learn object properties. Complex or non-binary (n-ary) relations are not supported by ontology languagesand converted to several binary relations. All attributesconverted to datatype property except those used inobject properties.

3) Learning hierarchy:If two relations in database have primary-foreign

key relationship then these two classes or propertiesare organized in a hierarchy.

4) Learning cardinality:Cardinality restrictions are used to further specify

properties of ontology, minCardinality and maxCardi-nality of the property will be 1 if attribute is primaryor foreign key. The minCardinality of the property is1 if any attribute is declared as NOT NULL. Further-more, the maxCardinality of the property is 1, if anyattribute is declared as UNIQUE.

5) Learning instances:

For each class in ontology, tuples in relations aretranslated into its instances and the instances are linkedbased on foreign keys in the database tuples.

6) Implementation:The overall framework of ontology learning is pre-

sented in Figure 6. The input for the framework isdata stored in relational database. The framework usesdatabase analyzers to extract schema information fromdatabase, such as the primary keys, foreign keys anddependencies. Then the obtained information is trans-ferred to ontology generator. The ontology generatorwill generate ontology based on the schema informa-tion and rules. As a last step, user can modify andrefine the obtained ontology with the aid of ontologyreasoner and ontology editor.

The framework is a domain/application independentand can learn ontology for general or specific domainsfrom relational database.

3. Results and Discussions

This survey shows that each approach defines com-mon rules for mapping basic RDB schema pattern toontology such as relations, properties, reference keysand cardinalities as shown in the following Table 4.

Ontology built either from relational database us-ing automatic or semi-automatic ontology construc-tion or by using any ontology editor (from scratch)has attracted growing attention. However, the logicbehind ontology construction is to provide conceptsvocabularies and their relationships within a domainof discourse. As described in Table IV, the approachesused in ontology construction from relational databaseare based on schema mapping and data mining ap-proaches.

Automapper [12] is a Semantic Web interface forgenerating ontology from relational database automat-ically. Translation process of RDB schema into ontol-ogy is based on mapping rules that maps data-sourceto domain. These mapping rules depend on well-formedrelational database schema. In many applications, some-times well-formed relational database schema is notavailable, thus it is not guarantee for better results inontology construction process.

XTR-RTO [13] uses metadata information extractedfrom relational database to construct ontology basedon predefined schema translation rules. Effectivenessof theses translation rules depends upon well-formedrelational database schema. Sometimes the unavail-ability of well-designed relational database results inchallenges in ontology construction process.

RTXON [14] identifies lexical clues for attribute names

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 25

Page 26: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

Table 4 Comparative Analysis of Ontology Construction Approaches

Approach Mapping Creation Procedure Sources Used Mapping Rules LimitationsAutomapper: Relational Automatic -Construction of -Configuration file Class,datatype -Un-normalized RDBDatabase Semantic ontology from -RDB Schema property, and -Un-resolvableTranslation using OWL and RDB with the help -Mapping rules object property URIsSWRL [12] of Configuration

fileUsing Relational Database to Semi-Automatic - Construction of -RDB schema Relation,Attribute, -Un-normalized RDBBuild OWL Ontology from ontology from -Mapping rules and RefAttribute -Need domainXML Data Sources [13] RDB expert’s help for

extracting cardinalityrestrictions

Mining the Content of Semi-Automatic -Schema analysis - RDB schema Class,datatype -Attribute name doesRelational Database to Learn and Hierarchy - Mapping rules properties, not represent itsOntology with Deeper mining from - Stored data object property valueTaxonomies [14] stored dataLearning Ontology from Automatic - Construction of -RDB schema classes, properties, -Un-normalized RDBRelational Database[15] Ontology from -Mapping rules cardinalities and

RDB without instancesusing middlemodel

Figure 7 Framework for Ontology

(i.e. Category column represents a clue for categoriz-ing products). However, attribute names sometimesdo not reveal specific value (any lexical clue), thusbetter results cannot be guaranteed. The approach usedin [15] generated an OWL ontology automatically basedon learning rules from normalized relational databaseschemas. These learning rules depend upon relationaldatabase schema and in many applications, the un-availability of well-formed relational database resultsin inconsistent and incorrect ontology construction.

4. Proposed Framework

Table 4 summarizes each approach and defines com-mon rules for mapping basic RDB schema pattern toontology such as relations, properties, reference keysand cardinalities. Considering the above mentionedissues, we have proposed a novel framework that willtake different normalized/un-normalized relational da-tabases and will translate these relational databasesinto ontologies. Figure 7 illustrates the proposed frame-work.

Here we describe briefly how this framework willwork:

• Get different relational database schema

• At second step relational database schema willbe converted to ontology

5. Conclusion and Future Work

Mapping relational data into ontology from relationaldatabases plays an important role during the creationand updating of ontology. The unaddressed questionis how to correctly map RDB into ontology. The quan-tity of manual works during creation of ontology posesa series of challenges; therefore automated or semi-automated mapping based on rules is a good solu-tion. In this paper, different approaches have beendiscussed and some of the approaches are also simi-lar although ontology community relies more heavilyon the higher expressive power of ontology languagesand on reasoning techniques. In ontology constructionprocess, researchers are facing challenges such as un-availability of well-formed databases, domain expert’s

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 26

Page 27: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

help for extracting cardinality restrictions and genera-tion of un-resolvable URIs. On the other hand, ontol-ogy researchers are paying more attention toward fur-ther study of existing relational databases. It coverstranslation of additional relational database schemaaspects to improve the ontology structure.

It shows that additional definition patterns learnedfrom the data significantly enriches the ontology struc-ture. Our future work in this domain is to focus on on-tology construction from un-formed relational databaseand to explore how it is different between ontologiesconstructed and well-formed relational database.

References[1] John G. Breslin, D. O. Sullivan, A. Passant, L.

Vasiliu, “Semantics web computing in industry”,School of Engineering and Informatics, Galway, Ire-land, 2010.

[2] T. Berners-Lee, J. Hendler and O. Lassila, “The Se-mantic Web.”, Scientific American, 2001.

[3] C. Welty. “Ontology Research”. Artificial Intelli-gence (AI) Magzine, 24(3), 2003.

[4] Gruber TR.“ A translation approach to portable on-tology specifications”. Technical Report, KSL 92-71,Knowledgy System Laboratory, 1993.

[5] GU Fang and CAO Cun-Gen, “Ontology Researchand Existing Problems in Knowledgy Engineering”,Computer Science, 2004.

[6] Deng ZH, Tang SW, Zhang M, Yang DQ, Chen J.“Overview of Ontology”. Acta Scientiarum Natural-ium Universitaties Pekinensis, 2002. (in Chinese withEnglish Abract)

[7] P.F Patel-Schneider, P. Hayes and I. Horrock (Rec-ommendation 10 February 2004). “OWL Web On-tology Language Semantics and Abstract Syntax”,W3C. from http://www.w3.org/TR/owl-absyn/.

[8] DU Xiao-Yong, LI Man and WANG Shan, “A Surveyon Ontology Learning Research”, Journal of Soft-ware, Hangzhou, China, 2006.

[9] C. Ritchie, “Relational Database Principles”, Thom-son Learning, 2003, ISBN 0-8264-5713-4.

[10] K. C. C. Chang, B. He, C. Li, M. Patel, Z. Zhang,“Structured databases on the web: Observations andImplications”, Special Interest Group on Manage-ment of Data (SIGMOD) Record, New York, USA,2004.

[11] Biskup, J. : “Achievements of relational databaseschema design Tudory revisited”. Semantics inDatabase LCNS 1358. Springer Verlag, 1998.

[12] M. Fisher, M. Dean,“ Automapper: Relationaldatabase semantic translation using OWL andSWRL, OWLED 2008”: OWL experiences and Di-rections, Karlsruhe Germany 2008. Available from:http://www.webont.org/owled,2008.

[13] J. Xu, W. Li, “Using relational database to buildOWL ontology from XML data sources”, Proceed-ing International Conference on Computational In-telligence and Security Workshops, Suzhou, 2007.

[14] F. Cerbah, “Mining the content of relational databaseto learn ontology with deeper taxonomies”, Interna-tional Conference on Web Intelligence and IntelligentAgent Technology, Sydney, 2008.

[15] M. Li, X. Du, S. Wang, “Learning ontology from re-lational database”, Proceedings of the Fourth Inter-national Conference on Machine Learning and Cy-bernetics, Guangzhou, 2005.

[16] F. Cerbah, “Learning highly structured seman-tic repositories from relational databases: TheRDBToOnto”, Proceeding Extended Semantic WebConference, Tenerifi, 2008.

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 27

Page 28: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

International Journal ofIntelligent Engineering & Systems

http://www.inass.org/

Design of Embedded WEB Remote Monitoring System Based on µC/OS-IIOperating System

Xibo Wang, Zhen Zhang∗

School of Information Science and Engineering, Shenyang University of Technology,Shenyang 110870, China

∗ Corresponding authors’ Email: [email protected]

Abstract: Isolating embedded system has not been adapted to current development tendency. More and more em-bedded systems need networking for communicating with each other. µC/OS-II, which is a typical embedded realtime operating system and contains a kernel without network protocol, has been widely used in a large number ofembedded systems. So it is of significance to join network protocol into µC/OS-II. In this paper, a networking methodis proposed to embedded equipments based on µC/OS-II. LPC2200 based on ARM7TDMI-S is used as the core ofhardware platform, µC/OS-II embedded real-time operating system and LwIP (Light Weight IP) are used as softwareplatform, ADS1.2 as compiler. Through the realization of files that are related to the processor LPC2200, the portingof µC/OS-II into ARM7 is implemented. Through the realization of the LwIP operating system emulation layer andrealization network chip RTL8019AS driver, the porting of LwIP into µC/OS-II is implemented. On these founda-tions, a remote monitoring application is successfully developed. Experiment results show that proposed approach canbe successfully used for embedded equipments networking control.

Keywords: embedded system; LwIP; µC/OS-II.

1. Introduction

Embedded system [1] has been widely used in var-ious fields. The import of embedded operating sys-tem can enable embedded systems to administer allkinds of resources, run system correctly and steadily,provide bottom interfaces to upper soft, and be conve-nient for secondary development.

In recent years, with the rapid development of com-munications technology and internet and progress ofembedded technology, embedded system has a greatinfluence on human, and changes human’s future lifestyle. But the isolating embedded system has not beenadapted to current development tendency. Since moreand more needs such as “remote monitoring” [2] and“smart home appliances” [3] are put forward, embed-ded devices should not only have the traditional con-

trol, monitor, auxiliary equipment, machinery and eq-uipment operation function, but also be connected tothe Internet, make full use of network resources torealize remote monitoring, remote control and widerrange of information sharing and intelligent data pro-cessing functions. So the use of operating system andnetwork protocol in embedded systems is of vital andpractical significance.

µC/OS-II [4] is a multitask real time operating sys-tem with open source code which is written by JeanJ. Labrosse. µC/OS-II is a high-performance kerneland its instantaneity is guaranteed. µC/OS-II oper-ating system reduces the complexity of program andmakes the design and maintenance of application sys-tem simple [5]. µC/OS-II operating system can beused in the 8-bit processors, the 16-bit processors andthe 32-bit processors. The functions of µC/OS-II op-

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 28

Page 29: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

erating system can be tailored according to differentapplications. µC/OS-II operating system demands forlow hardware. Its scheduling mode is preemptive i.e.Task whose state is ready and has highest priority canbe run [6]. It has implemented task scheduling, task totask communication, management of system memory,but it has no file system and network protocol.

LwIP is a realization of TCP/IP protocol stack. Itsgoal is to reduce usage rates of memory and the size ofcode, so LwIP can be applied to this platform such asembedded system whose resource is limited. In orderto simplify the process and reduce memory require-ment, LwIP has clipping API and in this way LwIP isa high-performance network protocol.

This paper introduces a method that joins LwIP net-work protocol stack into µC/OS-II. Thus embeddedsystem can access the Internet. On this basis, a simpleWEB server is implemented. So users can access andcontrol the development board via the browser.

2. The Overview of µC/OS-II

µC/OS-II is a multitask real-time operating systemwhich is based on preemptive kernel [7, 8]. µC/OS-IIis a real time operation system (RTOS) indeed, whichis very suitable for intelligent control on site [9]. µC/-OS-II has no file system, no network system, no in-terface system, no peripherals management system,etc. Because the source code of µC/OS-II is clipping,open, portable, it is very suitable to be used as instru-ment inline micro controller [10].

µC/OS-II uses ANSI C language, contains a smallpart assembly code. This enables it to be used for mi-croprocessors of different structures [11]. The soft-ware structure of µC/OS-II contains three parts code.The first part is core code which is independent of theprocessor; the second part is header file which is as-sociated with the application configuration; the thirdpart is the code which is dependent of the processor.When porting, it is necessary to write the code whichis dependent of the processor. The software structureof µC/OS-II is shown in Figure 1.

3. The Overview of LwIP

TCP/IP protocol is complex. Its implementation isdifficult for the embedded devices which lack the pow-erful support of operating systems. For a particularapplication, embedded devices often only need a smallpart of TCP/IP protocol. According to particular re-quest, we use an existing simplified TCP/IP protocol-LwIP, and recompose TCP/IP protocol based on LwIP

Figure 1 The software structure of µC/OS-II.

Figure 2 Diagram of the µC/OS-II and LwIP.

[12]. LwIP is an open-source embedded TCP/IP pro-tocol stack. Its name in English is “Light Weight IP”- lightweight TCP/IP protocol stack. Its purpose isto reduce the usage of memory and the size of codeand to make LwIP suitable for the embedded systemwhose resource is very strained. In order to reduceprocessing program and internal demand, LwIP usestailored API without data replication [13].

Referring to hierarchical protocol, LwIP has desig-ned and implemented the TCP/IP protocol stack. LwI-P is composed of several modules, including the im-plementation modules of TCP/IP(IP, ICMP, UDP andTCP), operating system emulation layer, buffer andmemory management subsystem, network interface f-unctions and a group of Internet verifying and calcu-lating functions. At the same time, LwIP also pro-vides a set of abstract API interfaces. Thereby it isgreatly convenient for the developers to develop ap-plications. After putting LwIP in µC/OS-II operatingsystem, the whole system is shown in Figure 2.

4. The Porting of µC/OS-II

The so-called porting means enabling a real timekernel to run on certain microprocessor or microcon-

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 29

Page 30: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

Figure 3 The phenomenon of critical area is cut off.

troller [14]. According to the porting request of µC/-OS-II, the process of porting µC/OS-II to a new sys-tem structure needs 3 files: “OS CPU.H” (C headerfile ), “OS CPU C.C” (C language program sourcefile) and “OS CPU A.S” (assembler source file).

“OS CPU.h” uses “typedef” to define some data ty-pes which are connected with processor, uses C pre-processor directive “#define” to define some constantsand macros which are also connected with processor.Because ADS1.2 only supports full stack decrease pr-ogressively, the value of the constant “OS STK GRO-WTH” that decides growth direction of the stack mustbe “1”. After defining macro “OS CPU EXT”, wecan use “OS CPU EXT” to define a global variable.Because the word length of different CPUs might bedifferent, so the data types of C language must be re-defined.

Towards the processing program of critical codes,because the use of the first kind of interrupt mode mayproduce a status in the critical area of main function,sub function that includes critical area is called. Be-fore the return of sub function the interrupt has beenopened, then it will lead to the interrupt having beenopened before the critical area of main function hasrun completely. This phenomenon is shown in Figure3. So the first interrupt mode can not be used. For thesecond interrupt mode, critical area code has modifiedstack pointer that is used to save interrupt state, thus itmay cause an error when interrupt open/close state isresumed, therefore the second interrupt mode can notbe used. The open/close interrupt way of µC/OS-IIis defined as “3”, the interrupt states are saved as lo-cal variables, so this method can avoid the two wrongmethods what we said above.

Macro “OS ENTER CRITICAL()” and “OS EXITCRITICAL()” are defined and used to open/close in-

Table 1 List of functions

Function Must be realizedOSTaskStkInit() Yes

OSInitHookBegin() NoOSInitHookEnd() No

OSTaskCreateHook() NoOSTaskDelHook() NoOSTaskIdleHook() NoOSTaskStatHook() NoOSTaskSwHook() NoOSTCBInitHook() No

OSTimeTickHook() No

terrupt. In this file, some function prototypes are de-clared, so that other files can use them expediently.These functions include OSTickISR(), OSCtxSw(), O-SIntCtxSw(), OSStartHighRdy(), ARMCoreDisalbeI-tExt(),ARMCoreRestoreIntStatus(). These functionswill be realized in file “OS CPU A.s”.

In “OS CPU C.c” file, there are two group func-tions. The first group functions must be realized, andthe second group function can be realized as emptyfunctions. These functions are shown in Table 1. FromTable 1, we can see there is only one function thatmust be realized. The other functions are hook func-tions. These hook functions can be put into the kernelof µC/OS-II, then the function of kernel can be ex-tended. But there is no need to extend the functionof kernel in this paper. These hook functions are onlydefined.

µC/OS-II is a multitasking operating system, thetask will not run immediately after it has been created,it must wait for the kernel scheduler program whichhas pushed it into the CPU registers from stack, then itruns. So every task stack must always keep right dataand the data is enough to make the task run or recoverrunning state. This theory is shown in Figure 4. So thestack of task must be properly initialized when a taskis created, in other words, function “OSTaskStkInit()”must be realized in file “OS CPU C.c”. When a taskis created, the function “OSTaskStkInit()” is called.Function “OSTaskStkInit()” realizes the stack of taskshown in Figure 4. Task enter address is saved in PCregister in the stack of task. When scheduler programputs task enter address into PC register in CPU, CPUwill run this task. Some other user functions are calledwhen µC/OS-II do some operation defined as emptyfunctions.

µC/OS-II is a deprivable kernel, before it starts, the

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 30

Page 31: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

Figure 4 The relationship Between task stack and CPU reg-ister group

CPU should be owned by the highest priority task wh-ose status is ready. Function “OSStart()” looks uptask which should be run first. After function “OS-Start()” finds one task, function “OSStartHighRdy()”will put stack of this task into stack of CPU. Becausethis belongs to operation of registers, it belongs tothe porting of µC/OS-II. It needs to realize code inline with different CPUs. The only work that func-tion “OSStartHigRdy()” should do is to put stack oftask, whose priority is the highest and whose statusis ready, into stack of CPU, and recover task scenethat function “OSTaskStkInit()” simulates into stackof CPU, then the task can run.

When interrupt returns, function “OSIntCtxSw()” isused to switch tasks. After ISR finishes the treatmentof interruption, µC/OS-II has to make a task sched-ule. The aim is to ensure that interrupt handling re-sults can get timely response. So the all interruptionsof µC/OS-II must have one and only entry and exit.In order to achieve this goal, exception vectors mustbe modified. IRQ and FIQ point to a uniform entryfunction. After user-defined interruption is disposedcompletely, µC/OS-II makes a task schedule. Theprocess of function “OSIntCtxSw()” is shown in Fig-ure 5. In Figure 5, we can see that variable “OSPri-oCur”, where priority of current task is saved, is re-vised as priority of task being about to run. Variable“OSTCBCur”, where address of current task OS TCBis saved, will be revised as the address of task be-ing about to run. The stack pointer register (SP svc)points to the top of stack of task being about to run.CPSR register pops from the stack. AIC EOICR reg-ister is written. This notices that the interruption isend. The task that being about to run pops from stack.Then the task can run.

Function “OSTickISR()” is used for interrupt ser-

vice routine of clock tick. “OSTickISR()” must becalled by µC/OS-II kernel ISR. “OSTickISR()” re-duce “OSTCBDly” of every task.

Function “OSSched()” needs function “OS TASKSW()” to complete task switching work. Because taskswitching needs to operate CPU registers, and differ-ent CPUs have different operation instructions to op-erate registers, function “OS TASK SW()” is realizedaccording to different CPUs in “OS CPU A.s” file.The process of function “OS TASK SW()” is shownin Figure 6. From Figure 6, we can see that runningscene of current task is saved into stack of task, thepointer of current task is saved into OS TCB of cur-rent task, variable “OSPrioCur”, where priority of cur-rent task is saved, is revised as priority of task beingabout to run, variable ”OSTCBCur” where address ofcurrent task OS TCB is revised as address of task be-ing about to run, the pointer of task being about to runis recovered from OS TCB to SP register, the scene oftask being about to run is recovered into CPU register,then the task being about to run can run.

5. The Porting of LwIP

The porting of LwIP is divided into two parts: onepart is to realize the operating system emulation layer,i.e. “interface layer”; another part is to realize bottom-level driver. The operating system emulation layerprovides a common interface between the LwIP codeand the underlying operating system kernel. The gen-eral idea is that porting LwIP to new architectures re-quires only small changes to a few header file. In or-der to facilitate porting of LwIP, functions and datastructure that belongs to operating system are not useddirectly, but an interface layer is used to take the placeof these functions. Therefore, in order to the portingof complete LwIP, the interface layer must be realized[15]. So interface layer should be modified accordingto a given operating system. Because different net-work card chip has different operation, bottom-leveldriver should be realized according to different hard-ware.

Environment variables and data types are defined infile “cc.h”. These common data types are used in op-erating system emulation interface functions and low-level protocol stack. Towards the critical-protectingfunctions of LwIP, LwIP and µC/OS-II have the sameway to handle this, so same method can be used torealize critical-area-protecting functions as µC/OS-II.Macro “SYS ARCH PROTECT()” and “SYS ARCHUNPROTECT()” are defined and used to realize the

protection of critical area.

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 31

Page 32: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

Figure 5 The task switching process at interruption level

Figure 6 The task switching process at task level

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 32

Page 33: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

Because ARM7 aligns as 4 bytes as default, if struc-ture designed can not align as 4 bytes, then compiler“ADS1.2” will readjust structure and make sure thestructure aligns as 4 bytes, because the visit efficiencyis the highest when the structure aligns as 4 bytes.But sometimes structure needs to be visited as actualmember boundary, especially in network structures.LwIP has thought about this problem and providedsome macros to package structure, so these macrosneed to be defined. These macros include”PACK STRUCT FIELD(x)”,”PACK STRUCT STRUCT”,”PACK STRUCT BEGIN”, and”PACK STRUCT END”.

Semaphores are represented by the type “sys sem t”which is defined in the “sys arch.h” file. Mailboxesare equivalently represented by the type “sys mbox t”.LwIP does not place any restrictions on how “sys semt” or “sys mbox t” are represented internally.Macro used for performance measurement is defined

as an empty macro in file “perf.h”.The following 4 groups of functions must be imple-

mented by the operating system emulation layer.(1) Semaphore operation functionsLwIP needs semaphores to achieve communication

within processes, so semaphore processing functionsneed to be realized. Semaphores can be either count-ing or binary - LwIP works with both kinds. Thesefunctions are shown as follows.

1) sys sem t sys sem new(u8 t count)This function creates and returns a new semaphore.

The “count” argument specifies the initial state of thesemaphore.

2) void sys sem free(sys sem t sem)This function deallocates a semaphore.3) void sys sem signal(sys sem t sem)This function signals a semaphore.4) u32 t sys arch sem wait(sys sem t sem, u32 t ti-

meout)This function blocks the thread while waiting for the

semaphore to be signaled. If the “timeout” argumentis non-zero, the thread should only be blocked for thespecified time (measured in milliseconds).

If the timeout argument is non-zero, the return valueis the number of milliseconds spent waiting for thesemaphore to be signaled. If the semaphore isn’t sig-naled within the specified time, the return value is“SYS ARCH TIMEOUT”. If the thread doesn’t haveto wait for the semaphore (i.e., it is already signaled),the function may return zero.

Because µC/OS-II has already provided semaphore,

these functions mentioned above can be realized bypackaging or rewriting semaphore operation functionsthat µC/OS-II has already provided.

(2) Mailbox operation functionsMailboxes are used for message passing and can be

implemented either as a queue which allows multi-ple messages to be posted to a mailbox, or as a pointwhere only one message can be posted at a time. LwIPworks with both kinds, but the former type will bemore efficient. A message in a mailbox is just a pointe-r, nothing more. So mailbox operation functions mustbe realized. These functions are shown as follows.

1) sys mbox t sys mbox new(void)This function creates an empty mailbox.2) void sys mbox free(sys mbox t mbox)This function deallocates a mailbox. If there are

messages still present in the mailbox when the mail-box is deallocated, it is an indication of a program-ming error in LwIP and the developer should be noti-fied.

3) void sys mbox post(sys mbox t mbox, void *msg)This function posts the message to the mailbox.4) u32 t sys arch mbox fetch(sys mbox t mbox, void

**msg, u32 t timeout)This function blocks the thread until a message ar-

rives in the mailbox, but does not block the threadlonger than “timeout” milliseconds (similar to the “sysarch sem wait()” function). The message argument

is a result parameter that is set by the function (i.e., bydoing “*msg = ptr”). The message parameter maybe“NULL” to indicate that the message should be dropp-ed.

The return values are the same as for the “sys arch s-em wait()” function: Number of milliseconds spentwaiting or “SYS ARCH TIMEOUT” if there was atimeout.

µC/OS-II has realized the message queue, and itprovides abundant function of message queue oper-ation, then it is needed to package these functions forthe need of LwIP.

(3) “sys arch timeout” functionIn LwIP, each thread has a list of timeouts which

is represented as a linked list of “sys timeout” struc-tures. The “sys timeouts” structure holds a pointer toa linked list of timeouts. This function is called by theLwIP timeout scheduler and can not return a “NULL”value. The function prototype of “sys arch timeouts”is shown as follows.

struct sys timeouts *sys arch timeouts(void)This function returns a pointer to the per-thread “sys

timeouts” structure. In a single thread the operating

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 33

Page 34: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

system emulation layer implementation, this functionwill simply return a pointer to a global “sys timeouts”variable stored in the operating system emulation laye-r module.

(4) Functions that are related to threadThese functions are shown as follows.1) sys thread t sys thread new(void (* thread)(void

*arg), void *arg, int prio)This function starts a new thread with priority “prio”

that will begin its execution in the function “thread()”.The “arg” argument will be passed as an argument tothe “thread()” function. The id of the new thread isreturned. Both the id and the priority are system de-pendent.

For µC/OS-II, a creation of a new thread means acreation of a task. It is needed to package the func-tion “OSTaskCreate()” that µC/OS-II has provided.In the way of arrangement of priority, in order thatpriority conflict does not occur, initiative thread prior-ity of LwIP i.e. “T LWIP THREAD START PRIO”is defined.

2) sys prot t sys arch protect(void)This optional function does a “fast” critical region

protection and returns the previous protection level.This function is only called during very short criticalregions. An embedded system which supports ISR-based drivers might want to implement this functionby disabling interrupts. Task-based systems might w-ant to implement this by using a mutex or disablingtasking. This function should support recursive callsfrom the same task or interrupt. In other words, “sysarch protect()” could be called while already protect-

ed. In that case the return value indicates that it isalready protected.

3) void sys arch unprotect(sys prot t pval)This optional function does a “fast” set of critical

region protection to the value specified by “pval”. Seethe documentation for “sys arch protect()” for moreinformation. This function is required for this portsupports an operating system.

6. System Initialization for LwIP

A truly complete and generic sequence for initial-izing the LwIP stack cannot be given because it de-pends on the build configuration and additional ini-tializations for your runtime environment. But thereis a general method. The following functions must becalled in turn.

(1) stats init()This function clears the structure where runtime statis-

tics are gathered.

(2) sys init()The operating system emulation layer is initialized

in this function.(3) mem init()This function initializes the dynamic memory heap

defined by MEM SIZE.(4) memp init()This function initializes the memory pools defined

by MEMP NUM x.(5) pbuf init()This function initializes the pbuf memory pool de-

fined by PBUF POOL SIZE.(6) etharp init()This function initializes the ARP table and queue.(7) ip init()This function should be called to handle future chan-

ges.(8) udp init()This function clears the UDP PCB list.(9) tcp init()This function clears the TCP PCB list and clears

some internal TCP timers.(10) netif add( struct netif *netif, struct ip addr *ipaddr,

struct ip addr *netmask, struct ip addr *gw, void *state,err t (* init)(struct netif *netif), err t (* input)(structpbuf *p, struct netif *netif) )

This function adds your network interface to the “n-etif” list. This function allocates a “netif ”struct andpasses a pointer to this structure as the first argument.The “init” function pointer must point to a initializa-tion function for Ethernet “netif” interface. In this pa-per this function is “ethernetif init()”. “Ethernetif ini-t()” function is an entry function for the initializa-tion of underlying network interface. The main workof “ethernetif init()” function is “send-function” (thesending of data is completed by “send-function” ).“Send-function” is written in line with specific hard-ware. “Send-function” is registered to LwIP on datalink layer. A semaphore handle is created for the block-ing access to network card. MAC address is filled in“ethernetif” stuct. Network card chip is initialized inorder to build a physical connection link and a threadfor receiving data is created. At last, the timing up-date for ARP table is opened. The process of “eth-ernetif init()” function is shown in figure 7. In fact,“etherneif init()” function calls a number of functions,these functions is shown in table 2.

(11) netif set default(struct netif *netif)This function registers the default network interface.(12) netif set up(struct netif *netif) When the netif

is fully configured, this function must be called.

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 34

Page 35: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

Figure 7 Process of “ethernetif init()” function.

Table 2 Functions that ”etherneif init” calls

Name Effectetherneif init initialization entry function for

underlying network interfacelow level output send-function on data

link layerEMACSendPacket send frame

low level init network initialization on data linklayer

EMACInit network card chip initializationGetPacketLen get length of frame

low levle input receive-function on data link layerEMACReadPacket receive frame

(13) dhcp start(struct netif *netif)This function creates a new DHCP client for this

interface on the first call.

7. Network Device Driver

In this paper, network card chip is RT-L8019AS.RTL8019AS is a highly integrated Ethernet chip, co-mpatible with NE2000 on software level. So the driverof RTL8019AS can be written according to the stan-dard of NE2000. These mainly include initialization,receiving data and sending data.

The initialization function flow chart of RTL8019ASis shown in Figure 8.

The sending function flow chart of RTL8019AS isshown in Figure 9.

The receiving function flow chart of RTL8019AS is

Figure 8 The initialization function flow chart ofRTL8019AS.

Figure 9 The sending function flow chart of RTL8019AS.

shown in Figure 10.Regarding the interface between network drive and

LwIP, the author of LwIP has designed a template.This template is in “/src/netif/ethernetif.c”. In LwIP,each network card corresponds with a “netif” struc-ture. LwIP calls function “netif-input” and “netif-out-put” of “netif” for receiving and sending of Ethernetpackets. It is needed to realize these functions thatare between upper layer(IP layer) and lower layer(linklayer) in “ethernetif.c” file. These functions include“ethernetif init()” used for initialization of bottom net-work interface, “low level output()” used for sendingdata on link layer, “low level init()” used for initial-ization of network card, “ethernetif input()” used forreceiving data, “low level input()” used for reading aframe.

8. Application design and test

After the porting, application test program can bewritten. This application is designed to build a WEBserver. User can access development board throughbrowser, click on the “submit” button, then the LEDsof the development board are lightened, and LEDsdisplay as water lamp. The main thought is to handleHTTP1.1 protocol. The message that browser submitscan be distinguished into “GET” and “POST” request.If a “GET” request arrives, the WEB server sends adefault web page to browser. If a “POST” requestarrives, according to the function name and param-eter that browser submit, the WEB server finds ho-mologous service function, and makes response anddeals with the current request. The flow char Figure

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 35

Page 36: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

Figure 10 Receiving function flow chart of RTL8019AS.

11 shows the core of application.After the IP address of development board is input

in the address field of browser, a “GET” request is sentto development board. Then development board sendsa static Web page to browser. The result of visitingdevelopment board in the browser is shown in Figure12.

After clicking “submit”, a “POST” request is sent todevelopment board. Then development board enableswater lamp according to the “POST” request. The sta-tus of development board is shown in Figure 13.

9. Conclusion

In this paper, embedded light weight network pro-tocol stack (LwIP) is designed and implemented suc-cessfully. A simple WEB server is implemented. Loo-king from the status of development board, the ex-pected result is obtained. TCP/IP protocol is addedinto µC/OS-II successfully. The µC/OS-II operatingsystem suits for various embedded equipments prefer-ably.

Figure 11 Flow char of the application core.

Figure 12 Result of visiting development board in thebrowser.

Figure 13 Status of development board.

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 36

Page 37: Monitoring Network through SNMP-based Systemˆ并20120331.pdfMonitoring Network through SNMP-based System ... work topology discovery is undoubtedly an indispens-able and core function

Acknowledgments

We would like to thank Qiao Zhou for his supportand helpful comments.

References[1] H. Liu, “Simple discussion on the development ten-

dency of embedded system”, In: China ConstructionEducation, Beijing, China, pp.51-54, 2006.

[2] L. Li, J. He, C. Cao and J. Li, “PLC RemoteMonitoring Application Research Based on TCP/IPprotocol”, In: Microcomputer Information, Beijing,China, pp.57-59, 2011.

[3] Z. Chai, “Intelligent Home Systems of Remote Con-trol Based On Internet”, In: Computer Knowledgeand Technology, Hefei, China, pp.7194-7195, 2009.

[4] J. L. Jean, The Embedded Real-Time Operating Sys-tem µC/OS-II, Beijing University of Aeronautics andAstronautics Press, Beijing, 2005.

[5] H. Qin, Y. Tang, “Transplant of Real-time Oper-ating System, µC/OS-II on the HFRK2410C”, In:Computer Knowledge and Technology, Hefei, China,pp.1544-1547, 2010.

[6] H. Ji, S. Fu, X. Che and L. Zhou, “Analysis and Im-provement of Real-time Embedded Operating Sys-tem µC/OS-II Kernel”, In: Computer Engineering,Beijing, China, pp.246-247, 2007.

[7] J. Shen, and X. Liu, “Analysis of µC/OS-II Kerneland Realization of Multi-task Schedulers”, In: Com-puter Engineering, Beijing, China, pp.85-87, 2006.

[8] Y. Wu, W. Chen, S. Zheng and H. Xu, EmbeddedReal-Time Operating System µC/OS- Course, XidianUniversity Press, Xi’an,2007.

[9] Y. Liu, L. Cao, “Acceleration and Deceleration Con-trol for Step Motor Base on UC/OS-II”, In: Intelli-gent Information Technology Application Workshops,Shanghai, China, pp.180-183, 2008.

[10] L. Zhou,ARM Embedded System Foundation Course,Bei Hang University Press, Beijing, 2005.

[11] J. Luo Y. Xie H. Shu and Y. Zhang, “Implementationof LwIP in uC/0S II”, In: Microcomputer Informa-tion, Beijing, China, pp.46-47, 2005.

[12] H. Jiao, The Design of Embedded Network System,Bei Hang University Press, Beijing, 2008.

[13] Adam Dunkels, LwIP-1.4.0 source code, 2011.

[14] C. Li, M. Huang, X. Zhang, J. Hu, Y. Liuand Y. Wang, “Transplant Method of µC/OS- onXC164CS”, In: Computer Engineering, Beijing,China, pp.242-244, 2010.

[15] M. Cheng, Z. Yu, Y. Su and X. Guo, “Porting LwIPinto µC/OS- and Testing”, In: Microcomputer Infor-mation, Beijing, China, pp.79-90, 2008.

International Journal of Intelligent Engineering and Systems, Vol.5, No.1, 2012 37