CN103902269B - System and method for generating MIB files through XML files - Google Patents
System and method for generating MIB files through XML files Download PDFInfo
- Publication number
- CN103902269B CN103902269B CN201210581216.2A CN201210581216A CN103902269B CN 103902269 B CN103902269 B CN 103902269B CN 201210581216 A CN201210581216 A CN 201210581216A CN 103902269 B CN103902269 B CN 103902269B
- Authority
- CN
- China
- Prior art keywords
- mib
- xml
- node
- schema
- file
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Landscapes
- Computer And Data Communications (AREA)
Abstract
The invention discloses a system and method for generating MIB files through XML files. The system comprises a Schema rule defining unit, an XML syntax checking unit, an XML semantic parsing unit, an MIB file rule analyzing unit and an MIB file generating unit. The method includes that the Schema rule defining unit defines a checking and mapping Schema from XML to MIB; the XML semantic parsing unit defines mapping rules from XML elements to MIB elements, pares XML files passing syntax checking and completes mapping from the XML elements to the MIB elements; the MIB file generating unit generates MIB files according to a generating method of specific elements. By the aid of the system and method, the probability of errors in the MIB writing process can be reduced, and network management system development is accelerated; a familiar and generic XML form interface is exposed to a user, the XML files are written by the user on the basis of the XML Schema, the MIB files can be generated conveniently, and direct operations on the intricate MIB files are avoided.
Description
Technical field
The present invention relates to snmp network management technology, particularly to a kind of by xml document generate mib file system and
Method.
Background technology
Increasing with network size, the device type in network gets more and more.It is currently mainly used snmp
(simple network management protocol, Simple Network Management Protocol) is managed to the network equipment.snmp
Network management framework defines three critical pieces: structure of management information (smi), management information bank (mib) and management agreement
(snmp).Wherein, management information bank (mib) defines the collection of the management object that can conduct interviews by NMP
Close, be the basis of snmp management.The mib being write with asn.1 grammer only could be under development after compiling through mib compiler
Use.But asn.1 grammer and smi description message structure abstractness very strong, and general mib be based on text mode Lai
Write or generate, if by hand come to write, need mib file and related text macrodefinition to be needed to understand in depth, that is,
Make be using instrument it is also desirable to user's concept related to mib it should be understood that, the exploitation increasing NMS agency is difficult
Degree.
Traditional mib writes how to enter edlin by mib edit tool, by the visualization interface behaviour of mib edit tool
Make to generate mib file, but most of mib edit tool is required for license, and be also required to the language according to smi for the user
Method and semanteme enter edlin, simply eliminate the process write.This kind of method needs user that abstract smi is well aware of, and increases
Development difficulty.
Chinese Patent Application No. discloses a kind of mib file editor, this in the document of " cn101446896a "
In method, by writing of mib file is converted into a kind of selection to menu and operation and processes to generate mib file, it is similar to
In traditional mib edit tool.
By the analysis to prior art and patent, mostly existing public technology is directly to carry out mib according to the grammer of smi
File edit, if when user's hand-coding, increases error probability, and is not easy to read and changes.
Content of the invention
Present invention aim at, for reducing the difficulty of mib file edit and the mistake reducing during mib writes, the present invention carries
For a kind of system and method generating mib file by xml document.
For achieving the above object, the invention provides a kind of by xml document generate mib file system, described system
Comprise:
Schema rule definition unit, for defining a kind of schema rule for completing xml to mib verification and mapping
Then;
Xml syntactic verification unit, for the schema rule according to definition, the checker using xml is civilian to the xml of input
Part is verified;
Xml semanteme resolution unit, for defining xml element to the mapping ruler of mib element, and the xml that verification is passed through
File carries out dissection process;
Mib document convention resolution unit, for safeguarding semanteme and the grammer of mib file, and carries out the verification of mib file;
With
Mib file generating unit, for calling mib document convention resolution unit to the semanteme of mib element and syntactic representation
Method, generates mib file.
Above-mentioned xml semanteme resolution unit comprises further:
Mapping relations initialization submodule, for define schema and mib element to reply relation;
Processing method initialization submodule, for registration and the processing method to specific node for the instantiation;
Xml node-classification submodule, for the xml node being resolved to and its daughter element be divided into data type joint block,
Grand node block, scalar type joint block, table type node block and trap type node block;With
Analyzing sub-module, for being mapped to the xml node of point good class the specific processing method of its registration.
Based on said system the invention provides a kind of by xml document generate mib file method, methods described bag
Contain:
Step 101) a kind of schema for completing xml to mib verification and mapping of schema rule definition unit definition,
And carry out editor and the modification of file according to the schema of definition;
Step 102) xml syntactic verification unit is according to step 101) schema that defines carries out xml document verification;
Step 103) xml semanteme resolution unit define xml element to the mapping ruler of mib element, syntactic verification is passed through
Xml document carry out dissection process, and complete xml element to the mapping of mib element;
Step 104) mib file generating unit according to the concrete element of mib file generation method generate mib file.
Above-mentioned steps 101) comprise further:
Step 101-1) to adopt xml language to map mib document convention be the node element of xml, attribute for the schema that defines
And type;
Step 101-2) schema that defines is grand mib file, is mapped as specific xml node, grand concrete genus
Property is mapped as the element property of xml node;
Step 101-3) schema that defines, the tree-like relation of mib, is mapped as the filiation of node;
Step 101-4) schema that defines the data type in mib, be mapped as based on xml basic data type from
Define data type;
Step 101-5) schema that defines is three kinds the scalar object in mib, table object and trap object map
General node;
Step 101-6) schema that defines introduces back end datanode, and represent the concrete object in mib, also support
Datanode is quoted, for being compressed to xml document.
Above-mentioned steps 103) according to defined in schema define one to this schema xml semanteme resolution unit, and
In xml semanteme resolution unit dissection process, define schema and mib element to reply relation, processing specific xml
During element, search its corresponding mib element, by mib file generating unit, generate mib file fragment.
Above-mentioned steps 103) comprise further:
Step 103-1) load schema element and mib rule mapping table, put in Hash table, be the injection of schema element
Processing method;
Step 103-2) initialized and instantiation according to mapping table relation pair process function;
Step 103-3) load the xml document that verification is passed through;
Step 103-4) parse egress according to schema, and judge whether it is last node, if it is stop,
Otherwise enter next step;
Step 103-5) further determine whether it is dtd--data type definition, if it is, parsing its data type, and map
To the data type of mib, it is then back to step 103-4) carry out next node parsing;Otherwise, enter next step;
Step 103-6) judge whether it is macroelement definition again, if it is, it is grand fixed to be changed into mib according to mapping relations
Justice, and return to step 103-4) carry out next node parsing;Otherwise enter step;
Step 103-7) finally judge whether it is object type node, if it is, searching its registration from Hash table
Instantiation processing method, and generate mib tree construction return to step 103-4) carry out next node parsing, otherwise stop.
Step 103-7) described in object type node comprise: scalar object, table object and trap object.
Above-mentioned steps 104) comprise further:
Step 104-1) pass through mib document convention resolution unit, obtain mib element type and its attribute in mib file
Concrete syntax and method for expressing;
Step 104-2) generate mib file in head and import data type;
Step 104-3) generate mib file in intermediate node;
Step 104-4) if there are user-defined dada type, the dtd--data type definition generating in mib file is grand;
Step 104-5) the scalar type node in xml node, table type node and trap type node, according to
Method for expressing 104-1), is mapped to the attribute of xml node in corresponding mib attribute of an element, generates mib leaf node;And
Represent oid;
Step 104-6) generate mib file end mark.
System of the present invention mainly includes schema rule definition unit, xml syntactic verification unit, the semantic parsing of xml
Unit, mib document convention resolution unit and mib file generating unit.
Compared with prior art, the beneficial effects of the present invention is:
1. this method, to hand-coding mib file, can provide intelligent prompt and timely verification, decrease error probability,
Speeding up development progress.
2. this method can be used for the exploitation of mib edit tool simultaneously, is easy to do mediant between various edit tools
Interaction according to form.
3. the xml document that this method generates can easily be changed between different schema, can be used for base
NMS in xml.In the network management of heterogeneous system, can be changed between different platform well.
In a word, the method that the present invention provides is by being exposed to user, Yong Huji the interface being familiar with general xml form
To write xml document in xml schema, the method and system being provided by the present invention, in that context it may be convenient to generate mib file, is kept away
Exempt from directly to operate mib file hard to understand.
Brief description
Fig. 1 is that the present invention generates the system module figure of mib file by xml;
Fig. 2 is that the present invention generates the method flow diagram of mib file by xml;
Fig. 3 is xml semanteme resolution unit workflow diagram of the present invention.
Specific embodiment
To be described in detail below in conjunction with the accompanying drawings and to generate the implementation method of mib file by xml.
The present invention provides a kind of method and system generating mib file by xml document, and methods described comprises:
101) schema rule definition unit, defines a kind of general schema based on xml, is used for completing xml to mib
Verification and mapping;
102) xml syntactic verification unit, according to schema rule, the verification scheme using xml is entered to the xml document of input
Row verification;
103) xml semanteme resolution unit, the xml document for passing through to verification carries out dissection process, according to mapping relations,
It is mapped to corresponding mib element;
104) mib document convention resolution unit, parses mib document convention and carries out the verification of mib file, maintain mib
Element and its semanteme and the grammer that generate mib file;
105) mib file generating unit, calls mib document convention resolution unit to the semanteme of mib element and syntactic representation
Method, generates mib file.
Said units 101) comprise further:
Due to the mib with asn.1 grammer and smi description, complex structure, and abstract.This method carries out method for expressing
Simplify.First the description of schema is divided into following four part:
1) be directed to mib in grand, the present invention is represented by the specific node it being mapped in schema, grand
Specific object is mapped as the attribute of node elements;
2) it is directed to the data type in mib, the basic data type based on xml for the present invention is carried out encapsulating customization type
Represent;
3) it is directed to the concrete three kinds of value types in mib: scalar object, table object and trap object, be also mapped as three
Plant general node.
4) specific mib node is expressed as back end datanode, also supports datanode is quoted, for right
Xml document is compressed.
According to above-mentioned rule, or hand-coding or the edit tool based on xml, carry out xml document and write.Write in xml
During, you can carry out the timely verification of file and attribute is reminded, facilitate the xml document of management attribute to write.
Said units 102) comprise further:
Xml syntactic verification unit, can carry out intelligent prompting and attribute verification it is also possible to edit in compiling procedure
Verified after complete.For 101) in unit the verification of the file of output verified based on general xml instrument.
Said units 103) comprise further:
Xml semanteme resolution unit, the xml document for passing through to verification carries out dissection process, is mapped to corresponding mib
Semanteme and grammer.This element is the core component of the present invention.
Because mib needs to safeguard an overall tree structure, this unit enters to xml according to the mode based on dom in itself
Row parsing.Before parsing, this unit needs to load the concrete mapping relations of schema and mib, and is specifically initialized, and
Be placed in internal memory it is ensured that the process to concrete node only initialize and instantiation once, and corresponding instantiation method
It is registered to dom resolver.
When xml is resolved to specific node, check the registered instantiation processing method of this node, call place
Reason.
Said units 104) comprise further:
Mib document convention resolution unit, is the dictionary library of the message structure according to asn.1 grammer and smi description, maintains
The syntax and semantics structure of mib file itself, including, method for expressing of data type grand to common smi and generation method.
Said units 105) comprise further:
Mib file generating unit, according to mib document convention resolution unit to the method for expressing of concrete block and element and generation
Method, exports mib file.
Fig. 1 is that the present invention generates the system module figure of mib file by xml, specifically includes:
Schema rule definition unit 101, defines a kind of general schema based on xml, is used for completing xml to mib
Verification and mapping;
Xml syntactic verification unit 102, according to schema rule, the verification scheme using xml is entered to the xml document of input
Row verification;
Mib document convention resolution unit 103, for according to the semanteme of mib file and grammer, carrying out the verification of mib file
And parsing;
Xml semanteme resolution unit 104, for dissection process is carried out to the xml document that passes through of verification, according to schema and
The mapping relations of mib, call the corresponding function that processes to be processed.
Mib file generating unit 105, according to mib document convention resolution unit to the method for expressing of concrete mib object and life
One-tenth method, exports mib file.
Fig. 2 is that the present invention generates the workflow diagram of mib file by xml, specifically includes:
201) edit xml document according to schema
Schema according to definition carries out editor and the modification of xml document;
202) xml syntactic verification
Grammer and format check are carried out to the xml after the completion of editor, generates the xml document meeting schema rule;
203) xml semanteme dissection process
Xml semanteme dissection process, the xml document that verification is passed through carries out dissection process;
204) mib document convention mapping
Mib document convention maps, the rule of parsing mib file, maintains the mib rule of corresponding xml;
205) mib file generated
According to the method for expressing of mib document convention, generate mib file.
Fig. 3 is xml semanteme resolution unit workflow diagram of the present invention, with reference to specific example, explains and is generated by xml
The method of mib file:
According to schema rule, the xml document of generation is as follows:
Wherein, the module of the corresponding smi of mib, datatype be used for the basic data type of smi based on xml for the definition and
Growth data type, node identifies object-type, and user defines one of smi node, scalar and table is right respectively
Should be in the scalar object of smi and table object.Datanode therein, indicates specific scalar object and table object
Data type, this method supports data type is quoted, and have compressed the size of xml document itself.
For above xml document, by the method for the present invention and system, the mib file of generation is as follows:
The mib file relatively generating and the xml of input directly write mib file it can be seen that writing xml document ratio
Simply a lot, and it is not susceptible to the restriction of smi grammer.And, schema in the present invention also supports to datanode
Quote, to a certain extent xml document is compressed.
In a word, the method that the present invention generates mib file by xml, based on the semantic interpreter semantic to mib of a set of xml
System, is converted to mib file the management information of xml document, shows interface and the ways of writing of user's xml form, can drop
Error probability during the low file edit in mib, the exploitation of quickening NMS agency.Also allow for reading and school simultaneously
Error checking is by mistake.
Finally it should be noted that example described herein is only used for explaining the present invention, the present invention does not limit concrete schema
Method for expressing, method of calibration and analytic method, the conversion that above content is done also falls within the scope and spirit of the invention.
Claims (5)
1. a kind of system generating mib file by xml document, described system comprises:
Schema rule definition unit, for defining a kind of schema rule for completing xml to mib verification and mapping;
Xml syntactic verification unit, for the schema rule according to definition, the checker using xml enters to the xml document of input
Row verification;
Xml semanteme resolution unit, for defining xml element to the mapping ruler of mib element, and the xml document that verification is passed through
Carry out dissection process;
Mib document convention resolution unit, for safeguarding semanteme and the grammer of mib file, and carries out the verification of mib file;With
Mib file generating unit, for calling mib document convention resolution unit to the semanteme of mib element and syntactic representation method,
Generate mib file;
Described xml semanteme resolution unit comprises further:
Mapping relations initialization submodule, for define schema and mib element to reply relation;
Processing method initialization submodule, for registration and the processing method to specific node for the instantiation;
Xml node-classification submodule, for being divided into data type joint block, grand section the xml node being resolved to and its daughter element
Point block, scalar type joint block, table type node block and trap type node block;With
Analyzing sub-module, for being mapped to the xml node of point good class the specific processing method of its registration.
2. a kind of method generating mib file by xml document, the method is based on the system described in claim 1, methods described
Comprise:
Step 101) schema rule definition unit defines a kind of schema for completing xml to mib verification and mapping, and press
Schema according to definition carries out editor and the modification of file;
Step 102) xml syntactic verification unit is according to step 101) schema that defines carries out xml document verification;
Step 103) xml semanteme resolution unit define xml element to mib element mapping ruler, the xml that syntactic verification is passed through
File carries out dissection process, and completes xml element to the mapping of mib element;
Step 104) mib file generating unit according to the concrete element of mib file generation method generate mib file;Described step
104) comprise further:
Step 104-1) pass through mib document convention resolution unit, obtain the concrete of mib element type and its attribute in mib file
Grammer and method for expressing;
Step 104-2) generate mib file in head and import data type;
Step 104-3) generate mib file in intermediate node;
Step 104-4) if there are user-defined dada type, the dtd--data type definition generating in mib file is grand;
Step 104-5) the scalar type node in xml node, table type node and trap type node, according to 104-
1) method for expressing, is mapped to the attribute of xml node in corresponding mib attribute of an element, generates mib leaf node;
Step 104-6) generate mib file end mark.
3. according to claim 2 the method for mib file is generated it is characterised in that described step 101 by xml document)
Comprise further:
Step 101-1) schema that defines adopt xml language to map node element, attribute and class that mib document convention is xml
Type;
Step 101-2) schema that defines is grand mib file, and it is mapped as specific xml node, grand specific object is reflected
Penetrate the element property for xml node;
Step 101-3) schema that defines, the tree-like relation of mib, is mapped as the filiation of node;
Step 101-4) schema that defines, the data type in mib, is mapped as self-defined based on xml basic data type
Data type;
Step 101-5) schema that defines the scalar object in mib, table object and trap object map be three kinds general
Node;
Step 101-6) schema that defines introduces back end datanode, represents the concrete object in mib, it is right also to support
Datanode quotes, for being compressed to xml document.
4. according to claim 2 the method for mib file is generated it is characterised in that described step 103 by xml document)
Comprise further:
Step 103-1) load schema element and mib rule mapping table, put in Hash table, be that schema element injection is processed
Method;
Step 103-2) initialized and instantiation according to mapping table relation pair process function;
Step 103-3) load the xml document that verification is passed through;
Step 103-4) parse egress according to schema, and judge whether it is last node, if it is stop, otherwise
Enter next step;
Step 103-5) further determine whether it is dtd--data type definition, if it is, parsing its data type, and it is mapped to
The data type of mib, is then back to step 103-4) carry out next node parsing;Otherwise, enter next step;
Step 103-6) judge whether it is macroelement definition again, if it is, being changed into mib macrodefinition according to mapping relations, and
Return to step 103-4) carry out next node parsing;Otherwise enter step;
Step 103-7) finally judge whether it is object type node, if it is, searching the example of its registration from Hash table
Change processing method, and generate mib tree construction return to step 103-4) carry out next node parsing, otherwise stop.
5. according to claim 4 the method for mib file is generated it is characterised in that step 103-7 by xml document) institute
The object type node stated comprises: scalar object, table object and trap object.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210581216.2A CN103902269B (en) | 2012-12-27 | 2012-12-27 | System and method for generating MIB files through XML files |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201210581216.2A CN103902269B (en) | 2012-12-27 | 2012-12-27 | System and method for generating MIB files through XML files |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103902269A CN103902269A (en) | 2014-07-02 |
CN103902269B true CN103902269B (en) | 2017-02-01 |
Family
ID=50993613
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201210581216.2A Expired - Fee Related CN103902269B (en) | 2012-12-27 | 2012-12-27 | System and method for generating MIB files through XML files |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103902269B (en) |
Families Citing this family (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN104660447B (en) * | 2015-01-29 | 2018-10-26 | 杭州初灵信息技术股份有限公司 | A kind of management method of SNMP nodal informations and management system |
CN105426505A (en) * | 2015-11-26 | 2016-03-23 | 上海斐讯数据通信技术有限公司 | Management information base document processing system and method |
CN108509187B (en) * | 2018-03-29 | 2021-05-18 | 烽火通信科技股份有限公司 | Method and system for automatically generating MIB function code of software platform |
CN109194611B (en) * | 2018-07-24 | 2020-07-24 | 北京邮电大学 | Method for mapping internetwork interconnection security control strategy rules |
CN109241501A (en) * | 2018-08-15 | 2019-01-18 | 北京北信源信息安全技术有限公司 | Document analysis method and apparatus |
CN109582391B (en) * | 2018-12-04 | 2022-05-24 | 中国航空工业集团公司西安航空计算技术研究所 | XML-based equipment tree configuration method |
CN111796828A (en) * | 2019-06-27 | 2020-10-20 | 广州致讯信息科技有限责任公司 | AML language checking method |
CN111045661B (en) * | 2019-12-04 | 2023-07-04 | 鼎蓝惠民信息技术(西安)有限公司 | XML Schema generation method based on semantic and feature codes |
CN112632332B (en) * | 2021-01-04 | 2024-08-02 | 恩亿科(北京)数据科技有限公司 | Configurable verification method, system, equipment and storage medium for XML (extensive markup language) file |
Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1556638A (en) * | 2003-12-30 | 2004-12-22 | 上海交通大学 | Method of following SNMP/CIM protocol intermediate piece projection |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7734588B2 (en) * | 2005-11-03 | 2010-06-08 | Cisco Technology, Inc. | Method and system for creating management information base specifications |
-
2012
- 2012-12-27 CN CN201210581216.2A patent/CN103902269B/en not_active Expired - Fee Related
Patent Citations (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN1556638A (en) * | 2003-12-30 | 2004-12-22 | 上海交通大学 | Method of following SNMP/CIM protocol intermediate piece projection |
Also Published As
Publication number | Publication date |
---|---|
CN103902269A (en) | 2014-07-02 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN103902269B (en) | System and method for generating MIB files through XML files | |
US7908594B2 (en) | External programmatic interface for IOS CLI compliant routers | |
CN103077185B (en) | A kind of method of object-based self-defined extension information | |
CN100483419C (en) | Data format verification method and device | |
CN101751461A (en) | Document conversion method and device | |
CN107273117A (en) | A kind of quick Code automatic build system for programming friendly | |
US20070006179A1 (en) | Methods and systems for transforming a parse graph into an and/or command tree | |
CN109800258A (en) | Data file dispositions method, device, computer equipment and storage medium | |
CN109815242B (en) | Data processing method and system | |
CN104461531B (en) | A kind of implementation method of reporting system SQL | |
CN101859303A (en) | Metadata management method and management system | |
CN103559025A (en) | Software refactoring method through clustering | |
CN112287114A (en) | Knowledge graph service processing method and device | |
US9652478B2 (en) | Method and apparatus for generating an electronic document schema from a relational model | |
CN114692532A (en) | Chip system integration method and device and computer readable storage medium | |
CN108664546B (en) | XML data structure conversion method and device | |
CN109116828A (en) | Model code configuration method and device in a kind of controller | |
CN104021216B (en) | Message proxy server and information publish subscription method and system | |
CN116521621A (en) | Data processing method and device, electronic equipment and storage medium | |
CN113468873A (en) | Syntax analysis method and device of PL/SQL language | |
CN112506488A (en) | Method for generating programming language class based on sql creating statement | |
CN117112608A (en) | Antlr 4-based database statement conversion method and device | |
US9274910B2 (en) | Automatic test map generation for system verification test | |
CN115080011B (en) | Code generation method and system based on abstract syntax tree | |
KR20070062800A (en) | Method for transforming of electronic document based on mapping rule and system thereof |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20170201 Termination date: 20201227 |