A kind of SNMP Simulator design method and devices based on XML
Technical field
The present invention relates to field of network management, more particularly, to a kind of SNMP Simulator designs method based on XML and dress
Put.
Background technology
Traditional network management system is all directly to access real equipment during early development and later maintenance, and this is for setting
For the enterprise of standby resource abundance and webmaster environment opposing open, this will not become bottleneck;But for some small enterprises
For industry, device resource may just seem very rare, while researching and developing network also relative closure, be then likely to appearance and developed
It is supplied to webmaster research staff test to use without equipment in journey, while when network management system goes wrong in existing network environment, just very
Research staff may have to be arranged to live positioning analysises problem, this can bring about very big cost for small enterprise and throws
Enter.Debugging angle from R&D process says that the debud mode of direct access equipment relies on by force device resource, when no equipment or
Person be available for upgrading the device version for using when, 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 big business or small enterprise, it is also unacceptable problem.So needing one badly
This predicament can be broken or be alleviated to kind of technology, as far as possible reduces cost, and delivery risk is reduced as far as possible.
The content of the invention
The technical problem to be solved is:For the problem that prior art is present, there is provided a kind of based on XML's
SNMP Simulator design method and devices.The present invention is reached and meets different equipment access need by simulating multiple MIB nodes
Ask, realize the effect for accessing real equipment can just being reached by accessing simulator, while supporting simulation multiple equipment.In webmaster
The technology is utilized in the middle of system, the awkward situation without test equipment can be solved, tested oneself in facilitating development process, be webmaster continuous integrating
In unit testing link provide test equipment object;Research staff is in just can long range positioning Network Management Equipment problem;By matching somebody with somebody
Put different SNMP node files and be available for access IP/PORT information, without restart back and forth simulator program just can while
The SNMP access abilities of simulation multiple equipment.
The technical solution used in the present invention is as follows:
A kind of SNMP Simulator design methods based on XML include:
XML file obtaining step, obtains the n MIB node and data XML file of the network equipment being modeled;The MIB sections
Point and data XML file include MIB node definitions and corresponding data message;
Virtual unit profile information step, defines the information of the virtual unit of the n virtual unit being modeled respectively;
Simulator initialization step, SnmpsAgent access IP by one that obtains virtual unit profile information step
Address, corresponding SNMP port address, equipment access protocal type and MIB nodes and data XML file path it is initial
Change a simulator entity object;SnmpsAgent is inherited and is increased income in component Snmp4J-Agent in third party
VariableProvider interfaces;
SNMP simulators simulate concrete node step, and SnmpsAgent calls MOGroup to simulate concrete node, i.e. MOGroup
The corresponding file content in path that MIB nodes and data XML file are parsed by DataXmlService obtains MIB nodes letter
Cease and data message, then MOGroup calls Snmp4J-Agent to simulate specific node, perform for each node circulation
This step can complete the simulation of single virtual equipment.
Multiple SNMP simulators simulation steps, perform simulator initialization step and SNMP simulators simulation tool by circulating
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 nodes and data XML file include scalar sum form MIB nodes;MOGroup is responsible for
The simulation of concrete scalar or form MIB nodes.
Further, the virtual device information includes the IP address of virtual unit, SNMP ports, equipment access protocal class
The path of type, MIB nodes and data XML file.
A kind of SNMP Simulator design devices based on XML include:
XML file acquisition module, obtains the n MIB node and data XML file of the network equipment being modeled;The MIB sections
Point and data XML file include MIB node definitions and corresponding data message;
Virtual unit profile information module, defines the virtual device information of the n virtual unit being modeled respectively;
Simulator initialization module, SnmpsAgent access IP by one that obtains virtual unit profile information module
Address, corresponding SNMP port address, equipment access protocal type and MIB nodes and data XML file path it is initial
Change a simulator entity object;SnmpsAgent is inherited and is increased income in component Snmp4J-Agent in third party
VariableProvider interfaces;
SNMP simulators simulate concrete node module, and SnmpsAgent calls MOGroup to simulate concrete node, i.e. MOGroup
The corresponding file content in path that MIB nodes and data XML file are parsed by DataXmlService obtains MIB nodes letter
Cease and data message, then MOGroup calls Snmp4J-Agent to simulate specific node, perform for each node circulation
This module can complete the simulation of single virtual equipment.
Multiple SNMP simulators analog modules, perform simulator initialization module and SNMP simulators simulation tool by circulating
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 nodes and data XML file include scalar sum form MIB nodes;MOGroup is responsible for
The simulation of concrete scalar or form MIB nodes.
Further, the virtual device information include the access IP address of the network equipment, corresponding SNMP port address,
The path of equipment access protocal type, MIB nodes and data XML file.
In sum, as a result of above-mentioned technical proposal, the invention has the beneficial effects as follows:
The present invention is based on the technologies such as XML, SNMP4J, while also relying on JAVA Open Framework SNMP4J-Agent.By to needing
MIB nodes to be simulated and the design of data XML file, the XML file design for supporting simulation multiple equipment, using Snmp4J-
Agent realizes the access ability of the SNMP of simulation individual equipment, network management system and equipment is decoupled as much as possible.
Simulator is accessed as the effect of real equipment is accessed, such research staff just can rapidly debug and position
Problem, provides the device resource of sustainable access for the unit testing link in network management system continuous integrating, allows real equipment to provide
Source is fully utilized.Debugging efforts can be carried out in the case of MIB nodes are clear and definite, just only simultaneously, set without waiting again
Standby debugging.Finally only need to once configure, can just reach the effect for forever using.
Description of the drawings
Examples of the present invention will be described by way of reference to the accompanying drawings, wherein:
Fig. 1 is that the present invention realizes class figure.
Fig. 2 is present invention operation sequential chart.
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 during the step of, except mutually exclusive
Feature and/or step beyond, can combine by any way.
Any feature disclosed in this specification, unless specifically stated otherwise, can be equivalent or with similar purpose by other
Alternative features are replaced.I.e., unless specifically stated otherwise, each feature is an example in a series of equivalent or similar characteristics
.
Related description of the present invention:
1st, n nodes X ML file of the network equipment that the acquisition of XML file obtaining step is modeled passes through self-defined or passes through Shen
Please number be 201610715436.8, title is:《A kind of MIB data grab methods based on XML technology》Described in method obtain
Obtain nodes X ML file.
2nd, 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;
Operation principle of the present invention:
1st, MIB nodes and data file, the MIB nodal informations that responsible definition is modeled, while also comprising each node correspondence
Value.
2nd, virtual unit configuration file, IP, SNMP port comprising virtual unit, virtual unit access protocal type, MIB
Node and data file path.
3rd, simulator initialization only need to IP, SNMP port of virtual unit, equipment access protocal type, MIB nodes with
And data file path, it is not necessary to specifically perceive the content of corresponding MIB nodes and data file.
4th, single simulator simulates concrete node, and SnmpsAgent calls MOGroup, and MOGroup needs to call
DataXmlService parses the MIB nodes and data of correspondence MIB nodes and data file configuration, while according to concrete
The definition of each node and data call Snmp4J-Agent other interfaces simulate individual nodes;
5th, the simulation of multiple virtual units is according to the IP of each virtual unit, port, equipment access protocal type and correspondence
MIB nodes and data file path message loop call simulator initialization and simulate concrete node to complete.
Technical scheme:
1)XML file obtaining step:The n MIB node and data XML file of the network equipment that acquisition is modeled(Fig. 3 this
Program file);The MIB nodes and data XML file include MIB node definitions and corresponding data message;
2)Virtual unit profile information step:The access IP address of the n virtual unit being modeled is defined respectively(In Fig. 4
“address="udp:172.16.1.17/161 " in " 172.16.1.17 "), corresponding SNMP port address(In Fig. 4
“address="udp:172.16.1.17/161 " in " 161 "), equipment access protocal 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 is accessed by one that obtains virtual unit profile information step
At the beginning of IP address, corresponding SNMP port address, the path of equipment access protocal type and MIB nodes and data XML file
One simulator entity object of beginningization;SnmpsAgent is inherited and is increased income in component Snmp4J-Agent in third party
VariableProvider interfaces;
4)SNMP simulators simulate concrete node step:SnmpsAgent calls MOGroup to simulate concrete node, i.e.,
MOGroup is obtained by the corresponding file content in path that DataXmlService parses MIB nodes and data XML file
MIB nodal informations and data message, then MOGroup call Snmp4J-Agent to simulate specific node, for each section
Dot cycle completes the simulation of single virtual equipment by performing this step.
5)Multiple SNMP simulators simulation steps:Simulator initialization step and the simulation of SNMP simulators are performed by circulating
Concrete node step completes the simulation of each virtual unit one by one.
Specially 1)In XML file obtaining step:The node letter of 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 simulators, and SNMP simulator programs are by loading this section
Point XML file information is with regard to the node and node data in energy simulation files.This MIB node and data XML file can be bases
In patent《A kind of MIB data grab methods based on XML technology》In the design of MIB nodes and data XML file as, while
The node data in MIB nodes and data XML file in SNMP simulators artificially can also be filled in manually or be changed.Manually
Filling in or changing is when the equipment or device version that are not available for scanning also are not issued, it is possible to manually configuration section
The data of point, can just reach the effect of simulation real equipment.Again the design of XML file is substantially described down herein.
MIB nodes and data XML definition file contain scalar sum table node, and wherein scalar node attribute includes node
Value, node type(SNMP type of foundations), whether be 16 systems, access limit(Read-write, read-only, read-write can simultaneously be created);Form
Entry node of the node comprising certain Table, indexes as IndexCols, and index can be combined index, and cols definition needs
The row configuration of simulation, wherein the index node of table must be configured.Only need to by need simulation node be configured to it is corresponding
XML node or attribute.For scalar, the value of simulation is the value in scalar nodes, and Table node moulds
The data of plan are according to data->row->The mode of col is organized, and data and row, row and col are the relation of one-to-many, wherein
With ". " connection between multiple indexes.The child node configuration of data nodes is a data in the middle of Table nodes, row generations
Table data line, indexCol represent the index of this row data.The major key of similar data base, col represent non-index field row
Value, and colId is consistent with the colId in nodal community col is defined.Wherein individual node data are used![CDATA] is included
Get up is for the XML file for having spcial character when parsing(Such as when node data comprising "/>" when just parse successfully in XML
Can malfunction)When remain able to normal parsing.
2)The XML configuration file design of simulation multiple equipment
This invention is supported once to simulate multiple virtual units, virtual unit one data XML file of correspondence of each simulation, multiple
Address between virtual unit and port can not simultaneously as.Simulator program is parsed according to this XML needs which void simulated
The reference address for proposing standby, each virtual unit, the protocol type simulated, corresponding data XML file.One agent node generation
One virtual unit of table, address represent the reference address of virtual unit and port, and type represents the protocol class for needing simulation
Type, datafile each virtual unit need the MIB nodes and data XML of simulation.SNMP simulators need the type fields to be
Later extension, future may develop into the ability for not only only simulating snmp protocol, it is also possible to simulate http,
The protocol capabilities such as webservice.The address addresses of configuration are also restricted in addition, it is necessary to be the service for disposing SNMP simulators
The IP address that the network interface card of device is present, because SNMP4J-Agent realizes that the principle of simulation SNMP is to monitor certain end on network interface card
Mouthful, then by the packet parsing for receiving into corresponding snmp protocol object.Each virtual unit acquiescence supports the SNMP associations for accessing
View version is V2C, and read-write community name is all public.
The invention is not limited in aforesaid specific embodiment.The present invention is expanded to and any is disclosed in this manual
New feature or any new combination, and the arbitrary new method that discloses or the step of process or any new combination.