A kind of SNMP Simulator design method and device based on XML
Technical field
The present invention relates to field of network management, more particularly, to a kind of SNMP Simulator design method and dress based on XML
It sets.
Background technique
Traditional network management system is all direct access real equipment during early development and later maintenance, this is for setting
This will not become bottleneck for the enterprise of standby resource abundance and network management environment opposing open;But for some small enterprises
For industry, device resource may just seem very rare, while research and develop network also relative closure, then be likely to occur developing
Cheng Zhongwu equipment be supplied to network management research staff test use, while when network management system existing network environment when something goes wrong, just very
Research staff may have to be arranged to live positioning analysis problem, this can bring about very big cost for small enterprise and throws
Enter.Say that the debud mode of direct access equipment relies on by force device resource from the debugging angle in R&D process, when do not have equipment or
When person is for upgrading the device version used, debugging efforts must just suspend, and waiting facilities resource could continue after in place, with regard to this
A little either for all inevitable problem of large enterprises or small enterprise and unacceptable problem.So needing one
This predicament can be broken or be alleviated to kind technology, reduce cost as far as possible, delivery risk is reduced as far as possible.
Summary of the invention
The technical problems to be solved by the present invention are: in view of the problems of the existing technology, providing a kind of based on XML's
SNMP Simulator design method and device.The present invention reaches by simulating multiple MIB nodes and meets different equipment access need
It asks, realizing can achieve the effect that access real equipment by accessing simulator, while support simulation multiple equipment.In network management
The technology is utilized in system, can solve the awkward situation of no test equipment, facilitates in development process from surveying, is network management continuous integrating
In unit testing link provide test equipment object;Research staff, which is in, can be remotely located Network Management Equipment problem;By matching
Different SNMP node file and the IP/PORT information for access are set, it can be simultaneously without restarting simulator program back and forth
Simulate the SNMP access ability of multiple equipment.
The technical solution adopted by the invention is as follows:
A kind of SNMP Simulator design method based on XML includes:
XML file obtaining step obtains the n MIB node and data XML file of the network equipment being modeled;It is described
MIB node and data XML file include MIB node definition and corresponding data information;
Virtual unit profile information step defines the information of the virtual unit for the virtual unit that n are modeled respectively;
Simulator initialization step, SnmpsAgent are visited by obtaining one of virtual unit profile information step
Ask the path of IP address, corresponding SNMP port address, equipment access protocol type and MIB node and data XML file
Initialize a simulator entity object;SnmpsAgent is inherited in third party's open source component Snmp4J-Agent
VariableProvider interface;
SNMP simulator simulates specific node step, and SnmpsAgent calls MOGroup to simulate specific node, i.e.,
MOGroup is obtained by the corresponding file content in path that DataXmlService parses MIB node and data XML file
MIB nodal information and data information, then MOGroup calls Snmp4J-Agent to simulate specific node, for each section
Dot cycle, which executes this step, can be completed the simulation of single virtual equipment.
Multiple SNMP simulator simulation steps execute simulator initialization step and SNMP simulator simulation tool by circulation
Body node step completes the simulation of each virtual unit one by one.
Further, the n is more than or equal to 1.
Further, the MIB node and data XML file include scalar sum table MIB node;MOGroup is responsible for
The simulation of specific scalar or table MIB node.
Further, the virtual device information includes the IP address of virtual unit, the port SNMP, equipment access protocol class
The path of type, MIB node and data XML file.
A kind of SNMP Simulator design device based on XML includes:
XML file obtains module, obtains the n MIB node and data XML file of the network equipment being modeled;It is described
MIB node and data XML file include MIB node definition and corresponding data information;
Virtual unit profile information module defines the virtual device information for the virtual unit that n are modeled respectively;
Simulator initialization module, SnmpsAgent are visited by obtaining one of virtual unit profile information module
Ask the path of IP address, corresponding SNMP port address, equipment access protocol type and MIB node and data XML file
Initialize a simulator entity object;SnmpsAgent is inherited in third party's open source component Snmp4J-Agent
VariableProvider interface;
SNMP simulator simulates specific node module, and SnmpsAgent calls MOGroup to simulate specific node, i.e.,
MOGroup is obtained by the corresponding file content in path that DataXmlService parses MIB node and data XML file
MIB nodal information and data information, then MOGroup calls Snmp4J-Agent to simulate specific node, for each section
Dot cycle, which executes this module, can be completed the simulation of single virtual equipment.
Multiple SNMP simulator analog modules execute simulator initialization module and SNMP simulator simulation tool by circulation
Body segment point module completes the simulation of each virtual unit one by one.
Further, the n is more than or equal to 1.
Further, the MIB node and data XML file include scalar sum table MIB node;MOGroup is responsible for
The simulation of specific scalar or table MIB node.
Further, the virtual device information include the access IP address of the network equipment, corresponding SNMP port address,
The path of equipment access protocol type, MIB node and data XML file.
In conclusion by adopting the above-described technical solution, the beneficial effects of the present invention are:
The present invention is based on the technologies such as XML, SNMP4J, while also relying on JAVA Open Framework SNMP4J-Agent.Pass through
To MIB node to be simulated and the design of data XML file, the XML file design for supporting simulation multiple equipment is needed, utilize
Snmp4J-Agent realizes the access ability of the SNMP of simulation individual equipment, decouples network management system and equipment as much as possible.
Simulator is accessed as the effect for accessing real equipment, such research staff rapidly can debug and position
Problem provides the device resource of sustainable access for the unit testing link in network management system continuous integrating, real equipment is allowed to provide
Source is fully utilized.Only it just can be carried out debugging efforts in the specific situation of MIB node simultaneously, set without waiting again
Standby debugging.It is last only to need primary configuration, it can achieve the effect that permanently to use.
Detailed description of the invention
Examples of the present invention will be described by way of reference to the accompanying drawings, in which:
Fig. 1 is that the present invention realizes class figure.
Fig. 2 is present invention operation timing diagram.
Fig. 3 is the nodes X ML file of one embodiment of the invention configuration.
Fig. 4 is one embodiment of the invention configuration file.
Specific embodiment
All features disclosed in this specification or disclosed all methods or in the process the step of, in addition to mutually exclusive
Feature and/or step other than, can combine in any way.
Any feature disclosed in this specification unless specifically stated can be equivalent or with similar purpose by other
Alternative features are replaced.That is, unless specifically stated, each feature is an example in a series of equivalent or similar characteristics
.
Related description of the present invention:
1, the n nodes X ML file that XML file obtaining step obtains the network equipment being modeled passes through customized or logical
Crossing application number is 201610715436.8, and title is: side described in " a kind of MIB data grab method based on XML technology "
Method obtains nodes X ML file.
2, the agent in Fig. 1.XML refers to the program file of Fig. 4;Datafile in Fig. 1.Xml is referred in Fig. 3
Program file;
Working principle of the present invention:
1, MIB node and data file, it is responsible to define the MIB nodal information being modeled, while also including each node
Corresponding value.
2, virtual unit configuration file, the port IP, SNMP comprising virtual unit, virtual unit access protocol type, MIB
Node and data file path.
3, simulator initialization only need the port IP, SNMP of virtual unit, equipment access protocol type, MIB node with
And data file path, do not need the content for specifically perceiving corresponding MIB node and data file.
4, single simulator simulates specific node, and SnmpsAgent calls MOGroup, and MOGroup needs to call
DataXmlService parses the MIB node and data of corresponding MIB node and data file configuration, while according to specific
The definition of each node and other interfaces of data call Snmp4J-Agent simulate individual node;
5, the simulation of multiple virtual units be according to the IP of each virtual unit, port, equipment access protocol type and
Corresponding MIB node and data file path message loop call simulator initialization and simulate specific node to complete.
Technical solution:
1) the n MIB node and data XML file (Fig. 3 of the network equipment being modeled XML file obtaining step: are obtained
This program file);The MIB node and data XML file include MIB node definition and corresponding data information;
2) virtual unit profile information step: the access IP address (figure for the virtual unit that n are modeled is defined respectively
" 172.16.1.17 " in " address=" udp:172.16.1.17/161 in 4 "), corresponding SNMP port address is (in Fig. 4
" 161 " in " address=" udp:172.16.1.17/161 "), equipment access protocol type (" type " in Fig. 4), MIB
The path (two " datafile " in Fig. 4) of node and data XML file, each virtual corresponding MIB section of equipment
The path of point and data XML file;
3) simulator initialization step: SnmpsAgent passes through one of acquisition virtual unit profile information step
Access the road of IP address, corresponding SNMP port address, equipment access protocol type and MIB node and data XML file
Diameter initializes a simulator entity object;SnmpsAgent is inherited in third party's open source component Snmp4J-Agent
VariableProvider interface;
4) SNMP simulator simulates specific node step: SnmpsAgent calls MOGroup to simulate specific node, i.e.,
MOGroup is obtained by the corresponding file content in path that DataXmlService parses MIB node and data XML file
MIB nodal information and data information, then MOGroup calls Snmp4J-Agent to simulate specific node, for each section
Dot cycle, which executes this step, can be completed the simulation of single virtual equipment.
5) multiple SNMP simulator simulation steps: simulator initialization step is executed by circulation and SNMP simulator is simulated
Specific node step completes the simulation of each virtual unit one by one.
Specially 1) in XML file obtaining step: the node letter for the network equipment that this nodes X ML document definition is modeled
Breath description and corresponding data, this file are the data foundations of SNMP simulator, and SNMP simulator program is by loading this section
Node and node data in point XML file information energy simulation files.This MIB node and data XML file can be base
A kind of MIB node in patent " MIB data grab method based on XML technology " is as the design of data XML file, simultaneously
The node data in MIB node and data XML file in SNMP simulator can also be taking human as filling in or change manually.Manually
Filling in or changing is when there is no when not issuing also for the equipment or device version of scanning, so that it may pass through manual configuration section
The data of point can achieve the effect that simulate real equipment.The design of XML file is substantially described again herein under.
MIB node and data XML definition file contain scalar sum table node, and wherein scalar node attribute includes node
Whether value node type (SNMP type of foundation), is 16 systems, access limit (read-write, read-only, read-write can simultaneously create);Table
Node includes the entry node of some Table, is indexed as IndexCols, and index can be combined index, and cols definition needs
The column of simulation configure, and wherein the index node of table must configure.Only need need to node to be simulated be configured to it is corresponding
XML node or attribute.For scalar, the value of simulation is the value in scalar node, and Table node mould
Quasi- data tissue in the way of data- > row- > col, data and row, row and col are one-to-many relationship, wherein
With " " connection between multiple indexes.What the child node of data node configured is a data in Table node, row generation
Table data line, indexCol represent the index of this row data.The major key of similar database, col represent non-index field column
Value, and colId is consistent with the colId in definition node attribute col.Wherein individual node data are used![CDATA] is included
Get up is in order to which the XML file for having spcial character when parsing (for example parses successfully just when node data includes "/> " in XML
Can malfunction) when still be able to normally parse.
2) simulation multiple equipment XML configuration file design
Multiple virtual units are once simulated in the invention support, and the virtual unit of each simulation corresponds to a data XML file,
Address between multiple virtual units and port cannot simultaneously as.Simulator program parses which needs simulate according to this XML
A little virtual unit, the access address of each virtual unit, the protocol type of simulation, corresponding data XML files.One agent section
Point represents a virtual unit, and address indicates access address and the port of virtual unit, and type indicates to need agreement to be simulated
Type, each virtual unit of datafile need MIB node and data XML to be simulated.SNMP simulator needs type field
In order to extend later, future may develop to not only only simulate snmp protocol ability, it is also possible to simulate http,
The protocol capabilities such as webservice.In addition the address address configured is also restricted, it is necessary to be the service for disposing SNMP simulator
IP address existing for the network interface card of device, because SNMP4J-Agent realizes that the principle of simulation SNMP is some end monitored on network interface card
Mouthful, then by the packet parsing received at corresponding snmp protocol object.Each virtual unit default supports the SNMP association of access
Discussing version is V2C, and read-write community name is all public.
The invention is not limited to specific embodiments above-mentioned.The present invention, which expands to, any in the present specification to be disclosed
New feature or any new combination, and disclose any new method or process the step of or any new combination.