Background technology
The formation of a SNMP (Simple Network Management Protocol, Simple Network Management Protocol) system is as shown in Figure 1 usually, comprises following element:
Several nodes, each node memory is acted on behalf of at a SNMP, and this entity has comprised response command and the application program that produces announcement; Node with the whole SNMP of comprising agency in some technical documentations is called the SNMP agency, then is meant the software module of intra-node completion SNMP agent functionality in this article;
At least one manager NMS (Network Management Station), this entity have comprised the application program that produces order and/or receive announcement.
A management agreement, promptly snmp protocol is used for transmit management information between NMS and agency.In the SNMP system, managed object defines according to the requirement of SMI (Structure of Management Information, structure of management information) standard, and this message structure main feature can be summarized as follows:
Whole management object system is with classification, tree structure tissue, and managed object is the leaf node of tree structure, and managed object is retrieved and traveled through with the mode of dictionary preface.
The database that defines all kinds of managed objects is called MIB (Management Information Base, management information bank), and the file of depositing these information is called mib file.In mib file; Managed object is divided into each module (MODULE) by its function of dominant; The module here is not meant software module; Both do not have necessary relation, and usually managed object possesses the equivalence value of an inside in software module, and the operation requests of managed object is converted into the operation to its equivalence value in software module.
As shown in Figure 2, the building method of interface between SNMP agency and the managed object in the prior art, SNMP node processing NMS operation requests specifically comprises step:
Step 201, the SNMP that receives input asks;
Step 202 is carried out syntactic analysis and is converted internal form to;
Step 203 is mapped to local equivalence value with mib variable;
Step 204, this locality of carrying out request obtains/stores;
Step 205 will be replied and converted foreign format to;
Step 206 is sent response and is given NMS.
In the above-mentioned steps, step (4) is accomplished by the module at managed object place, and other process is all accomplished by the SNMP proxy module.Because object distribution that SNMP managed is in each module of system, how the relation of treatment S NMP proxy module and these modules is technological emphasis that the SNMP agency designs, and concrete in the prior art implementation comprises:
The SNMP node of A, distributed formation;
As shown in Figure 3, the equipment of distributed formation generally includes with lower member:
A master control borad is responsible for the collaborative work of whole equipment, and management interface externally is provided, and for example, handles the order of man-machine interaction, the reception/transmission of the message in the SNMP mode;
A plurality of controlled board, each controlled board are comparatively independently computer subsystems, are responsible for the service part of equipment, and these business itself need externally provide management interface;
Possess management channels between master board and the controlled board, the control request of master board and response are through this management channels transmission.
In the equipment of distributed formation; Owing to possibly be distributed on a plurality of controlled board by administration module; Their address space is isolated, and can not adopt local function call to accomplish the operation requests of SNMP again, and the method for therefore above-mentioned mib compiling structure software can not directly be used again.
To above-mentioned situation, existing solution is normally acted on behalf of classification with SNMP: in master board, realize master agent, realize sub agent on the controlled board, the distribution of being responsible for snmp message by master agent with converge.For example, (RFC1227) (Agent Extensibility Protocol acts on behalf of Extended Protocol to standardized SMUX agreement, and what RFC2741) adopt all is this model with the AgentX agreement for SNMP multiplexing protocol, SNMP multiplex protocol.Below be the operation principle that example is introduced this model with SMUX:
As shown in Figure 4, mark off master agent and sub agent at intra-node, the step of SNMP node processing NMS operation requests comprises:
Step 401, after sub agent started, the MIB subtree that it is in charge of was registered on the master agent;
Step 402, master agent is resolved management request after the snmp management request that receives from NMS, judges the MIB subtree position of managed object, management request is transmitted to the sub agent of this MIB subtree of management;
If comprised the operation requests that mails to a plurality of sub agents in the snmp message, then handle complicated more: master agent sends to corresponding sub agent after need message being disassembled by subtree, also will the response of each sub agent be synthesized one and reply;
Step 403, sub agent after receiving the snmp management request that master agent forwards, accomplish handle after, will reply and send back to master agent;
Step 404, master agent will be replied relaying and sent to NMS;
This type is that based on multistage agency's distributed schemes major defect the complexity of scheme is higher, realizes that workload is bigger.If distributed apparatus is inner to be adopted multistagely when acting on behalf of scheme, following difficulty is arranged:
Master agent on the master control borad need be known the distribution of sub agent, resolves replying that the request mail to sub agent and sub agent beam back.When the operation requests of a plurality of sub agents need was crossed in processing, collaborative work was just complicated more, for example, and when having comprised the request to a plurality of sub agents in snmp message; And for example, when get-next operation when a sub-tree crosses another subtree, all need master agent further to handle according to the formation of MIB tree and the return results of sub agent;
Because master control borad this locality also has by administration module, master agent constitute two kinds of selections: the local sub agent of also being realized in the administration module, then master agent does not need directly with mutual by administration module; Perhaps master agent comprises tradition agency's function.No matter any method all makes the SNMP function of master control borad realize the complicacy than the tradition agency undoubtedly.
On each controlled board, all need realize the function of SNMP sub agent; It is redundant that master control borad and controlled board have partial function, like message parse, security control etc.;
Define the communication mode that adopts between master control borad and the controlled board, for example SNMP SMUX will use the TCP link.
Embodiment
A kind of node of on distributed constitution equipment, realizing the SNMP agency of the embodiment of the invention comprises master control borad and controlled board, comprises SNMP agency and RPC client computer in the said master control borad; Comprise managed object and RPC server in the said controlled board; Wherein, the Simple Network Management Protocol snmp message that SNMP agency, the person NMS that is used for the receiving management send; And convert the operation requests in this snmp message into invocation of procedure RPC request; This invocation of procedure RPC request is passed to the RPC client computer, and the return value that the RPC client computer is sent is interpreted as the SNMP operating result, and this SNMP operating result is packaged in sends back to said NMS in the SNMP response message; The RPC client computer is used to use RPC communication that said RPC request is sent to the RPC server, and receives the return value of RPC request; Said RPC server is used for converting the RPC request into to the local management object function call, sends function call request to said managed object, and said RPC client computer is returned in the return value transmission of said function call; Managed object is used to provide the function call interface of accomplishing management request, receives the call request that said RPC server sends, and will call the result and return to said RPC server.
For reaching the task of the SNMP proxy module of realizing distributed constitution equipment, the present technique scheme is docked the SNMP system with ONC RPC system, utilize ONC RPC to transmit the management operation request between master control borad and the controlled board.Shield the difference of remote procedure call and LPC by ONC RPC, make SNMP proxy module and constructed, avoid the multistage SNMP agency plant of complex structure by the mode that administration module can still call according to this locality.
Wherein RPC (Remote procedure call, remote procedure call) is specially:
RPC is a kind of inter-process communication mechanisms; It makes a computer program can call the process that is positioned at another address space; And need not pay close attention to the details of this remote interaction, need not be concerned about again when it makes coding the process that need call be local, or on remote system (said here process is exactly a function for the C programming language).
RPC has multiple implementation, can adopt ONC RPC (Open NetworkComputing Remote Procedure Call, open network calculate RPC) in embodiments of the present invention, wherein ONC RPC framework mainly comprise following characteristics:
Process can only have a parameter, a return value; When needs transmit a plurality of numerical value, can take they are encapsulated as the method for a structure;
The transport layer independence does not need transmission service reliably;
Call semanteme, call semantical definition client computer to calling the hypothesis that the result can do.ONC RPC provides " once minimum " semanteme, promptly calls when returning when one, and it has been performed once at least;
Data representation, the data type of ONC RPC adopt XDR (External Data Representation, External Data Representation) expression, and XDR is a kind of dtd standard, and it has defined the expression way of transmission data between the computer system of different systems.
XDR is a kind of data type by implication definition; The information that does not comprise data type in the data that this mode defines; Therefore require data producer and consumer that the explanation of data is reached an agreement through other means, as arranging to explain through additional document or interface.
A process is through tlv triple (program number, program version numbering, process numbering) sign
Program is meant the set of one group of correlated process, and each process wherein all has unique numbering.For example, NFS (Network File System, NFS) is exactly a program among the RPC, and its program number is 0x10_0002, and current version numbering is 3, and file operation such as read (reading), write (writing) etc. all are the processes among the NFS.
The uniqueness of numbering can adopt the whole bag of tricks to guarantee.This programme only relates to the numbering of device interior, and the scope that numbering is used is very little, so solution do not need very complicatedly, for example can take preallocated method.
Bind, which platform main frame is client computer need know service earlier on, then could the access services process.This problem can adopt several different methods to solve; For example; Can solidify the corresponding relation of service processes and address, more method in common is a service processes with its service registry in a certain appointed position, the client when operation from the corresponding relation of the appointed position service of obtaining with the address.
ONC RPC adopts the client-server working model, and client computer refers to call the program (or software systems) of RPC process, and server is meant the program (or software systems) that realizes the RPC process.
ONC RPC realizes that needed program frame adopts RPC CompilerTools (RPCLanguage Compiler) rpcgen to construct usually.Rpcgen can be according to the remote process explanation in the RPC specification file (RPCspecification); Generation is used to dock the program frame of client computer and server, makes the developer need not be concerned about that the RPC process accomplishes needed program module and reciprocal process.
The content of RPC specification file is to indicate client computer and server needs Sharing Information, generally includes the tabulation of program number/start context, process statement far away, comprises its parameter declaration, returned value specification and numbering:
For example, realize the process of a long-range integer summation, its RPC specification file is following:
The organization definition * of struct add_oper{/* procedure parameter/
int?oper1;
int?oper2;
};
program?ADDPROG{
version?ADDVERS{
Int ADD (struct add_oper)=1; / * process numbering */
}=1; / * program version */
}=100; / * program number */
According to this file, rpcgen just can generate the framework of client computer and server program.
Shown in Fig. 5 A, in the program frame that rpcgen generates, be usually directed to 6 modules in the RPC process, comprise module, the client program 1 that calls RPC, module, server program 2 and two RPC protocol modules of realizing RPC:
Client computer RPC interface module is responsible for converting the RPC request into the RPC protocol massages, and is received the return value from the invocation of procedure of server;
Server RPC interface module is responsible for converting the RPC message into invocation of procedure request again, and the process in the caller 2 is come complete call, and will call result's client of redispatching back;
The RPC protocol module is responsible for utilizing the transmission service of system that message is passed to the opposite end, or receives message from the opposite end, and this module all exists with serving in client computer;
There is not direct correlation with " client program 1 " in the upper module and " server program 2 "; For " client program 1 "; Do not know it calling a remote process, for " server program 2 ", it does not know that its caller is a long-range program.Other module generates by the RPC CompilerTools.
In embodiments of the present invention the SNMP proxy module with by administration module in the Different software system; The SNMP proxy module is resolved the snmp message production process and is called; The invocation of procedure that obtains through the RPC framework pass on the controlled board by administration module, the concrete realization comprises:
As shown in Figure 5, a kind of node of on distributed constitution equipment, realizing the SNMP agency of the embodiment of the invention comprises master control borad and controlled board, and wherein said master control borad comprises SNMP agency 501 and RPC client computer 502; Said controlled board comprises RPC server 503 and managed object 504:
Said SNMP agency 501; The Simple Network Management Protocol snmp message that the person NMS that is used for the receiving management sends; And convert the operation requests in this snmp message into invocation of procedure RPC request; This invocation of procedure RPC request is passed to RPC client computer 502, and the return value that RPC client computer 502 is sent is interpreted as the SNMP operating result, and this SNMP operating result is packaged in sends back to said NMS in the SNMP response message;
This SNMP agency 501 is used for that also the simple syntactic variable of self and applicational grammar variable are converted into external data XDR and representes.
In order to explain the improper value in the RPC invoked procedure, the mistake of the RPC invoked procedure that this SNMP agency 501 also is used for the RPC request is returned transforms the error condition " noAccess " of SNMP.
For the correct managed object 504 on the controlled board that calls, this SNMP agency 501 also is used for the object identity of the managed object of snmp message is converted into the address of managed object.
RPC client computer 502 on the master control borad, the invocation of procedure request that is used for SNMP agency 501 is sent passes to the RPC server 503 on the controlled board with the form of RPC message, and the invocation of procedure return value that RPC server 503 transmits is back returned to SNMP acts on behalf of 501;
RPC server 503 on the controlled board is used for converting the invocation of procedure from RPC client computer 502 into to local managed object 504 function call; And the return value of this function call passed to RPC client computer 502 with the RPC form of message;
Managed object 504 on the controlled board, being used to provides the function call interface of accomplishing management request, receives the call request that said RPC server sends, and accomplishes the SNMP operation requests, and the result is returned to caller.
Wherein, SNMP agency 501 will resolve snmp message; Convert internal form into, mib variable is mapped to local equivalence value, SNMP agency 501 can use distinct methods and realize; They but in fact all be that the SNMP operation requests is converted into by the function call of administration module, but the concrete form of function interface maybe be different.Because the information function interface corresponding with it in the snmp message exists fixing mapping relations usually; Therefore; Directly the function of information in the snmp message and RPC is contrasted analysis in the embodiment of the invention, this analysis conclusion is applicable to that also whether analyze RPC is enough to carry by the converted function call of snmp message, resolves snmp message in embodiments of the present invention; Convert internal form into, specifically comprise:
The XDR that ONC RPC uses in the embodiment of the invention can represent the data type of all objects among the SNMP, and transformation rule is following:
(A), three kinds of simple syntactic variables among the SNMP are converted into the XDR form:
Integer type INTEGER: directly corresponding to the Integer type among the XDR;
8 hyte character string OCTET STRING: because the type is a varying string; Use the string of XDR to represent it; Preceding 4 bytes in the inside of the string type of XDR are data lengths; Because ASN.1 is the explicit data definition, when using OCTECT STRING, must comprise the length of this character string, when conversion, this length taking-up is inserted in the length field of XDR string type.
Object identity OBJECT IDENTIFIER: i.e. the sign of managed object, this value is not used in function call, but when RPC calls, OBJECT IDENTIFIER will convert the address of the managed object in the RPC communication into.
(B), 6 kinds of applicational grammar variablees among the SNMP are converted into the XDR form:
IPv4 address IpAddress, the Fixed-Length Array (fixed length array) of use XDR, length is 4;
32 digit counter Counter32, the Unsigned Integer type of use XDR;
32 signless integer Unsigned32, the Unsigned Integer type of use XDR;
The time answer TimeTicks that ticks uses the Unsigned Integer type of XDR;
Nontransparent type Opaque is identical with the conversion of OCTET STRING;
64 digit counter Counter64, the Unsigned Hyper Integer type of use XDR;
64 signless integer Unsigned46, the Unsigned Integer type of use XDR;
In addition, for the SNMP object of form types, adopt a structure that the variable of form is encapsulated and get final product, because the form types member is made up of above-mentioned simple types, then can be regarded as be the conversion to member in the form in the conversion of form.
(C), the conversion of the improper value that returns of RPC call error value and SNMP operation requests:
The terminal error of the invocation of procedure has two kinds of possibilities, and the one, the mistake in the RPC invoked procedure is referred to as external error in embodiments of the present invention; Another kind of is internal error during the invocation of procedure realizes, and this moment, the RPC invoked procedure was successful, and type of error is referred to as internal error in embodiments of the present invention in the return value of the invocation of procedure;
In the RPC process issuable external error comprise that program does not exist, program does not match, process does not exist, parameter does not match, system mistake, authentication error and RPC version error.
More than except that " system mistake ", other wrong only possibility can convert all external error values into the error condition " noAccess " of SNMP owing to design mistake occurs.Because the error condition of SNMP just is used for prompting usually, NMS no longer further handles error condition, so the inaccuracy of error condition can not have influence on the management process of NMS.
Internal error is that the requirement according to SNMP when handling management request of far-end process produces improper value, does not need to change again, and this moment, the return value of RPC process was success.
(D), the implicit type of XDR definition:
The implicit type definition that XDR adopts needs the producer of data and consumer that the explanation of data is reached an agreement in advance, and this problem solves through the process statement of RPC.Comprised parameter and return value type in the statement of RPC process, therefore statement when data are dealt on the server by client computer, can guarantee that both are consistent for the explanation of data with the program that is used for simultaneously on client computer and the server.
(E), the semantic change of the invocation of procedure:
ONC RPC does not guarantee that the invocation of procedure is necessarily reliable, and snmp protocol has also been supposed the unreliability of SNMP operation requests, so the SNMP agency can tolerate the unreliability of RPC;
(F), by the addressing of administration module:
For accomplishing the SNMP agency to by the invocation of procedure of administration module; Need the OBJECT IDENTIFIER of managed object in the snmp message be converted into by the address of administration module; By the addressing of administration module is not the scope of the said concern of the embodiment of the invention, and present embodiment can be selected to be confirmed by the address of administration module by the address table that presets.Owing to constituted the network of device interior between master control borad and the controlled board; In the system schema addressing method must be arranged; The addressing scheme of device interior is generally all fairly simple; For example: if device interior uses is the TCP/IP network, then can with TCP or udp port with by the just curing when the system design of the mapping relations between the administration module.
As shown in Figure 6, the embodiment of the invention also provides a kind of method that on distributed constitution equipment, realizes the SNMP agency, specifically may further comprise the steps:
Step 601; When the agency of the SNMP in the master control borad receives the Simple Network Management Protocol snmp message of manager NMS transmission; Convert said snmp message into native data formats; And convert the operation requests in this snmp message into invocation of procedure RPC request, pass to the RPC client computer that is provided with on this master control borad;
Step 602, RPC client computer use RPC communication that the RPC request is sent to the RPC server on the controlled board;
Step 603, the RPC server on the controlled board converts RPC request into to the local management object function call, and calls and saidly accomplished the management request operation by administration module, and the RPC client computer on the master control borad is returned in the return value transmission of the invocation of procedure;
Step 604, the return value that the RPC client computer on the master control borad is called RPC pass to the SNMP agency;
Step 605 after the SNMP agency on the master control borad receives said return value, is interpreted as the SNMP operating result with this return value, is packaged in the SNMP response message and returns to NMS.
Because the information function interface corresponding with it in the snmp message exists fixing mapping relations usually; Therefore; The embodiment of the invention directly with snmp message in the function of information and RPC contrast analysis, this analysis conclusion is applicable to also whether analyze RPC is enough to carry by the converted function call of snmp message:
Then said step 601 converts said SNMP request into invocation of procedure RPC request, passes to the RPC client computer that is provided with on this master control borad, specifically comprises:
The XDR that ONC RPC uses in the embodiment of the invention can represent the data type of all objects among the SNMP, and transformation rule is following:
(A), three kinds of simple syntactic variables among the SNMP are converted into the XDR form:
INTEGER: directly corresponding to the Integer type among the XDR;
OCTET STRING: because the type is a varying string; Use the string of XDR to represent it; Preceding 4 bytes in the inside of the string type of XDR are data lengths; Because ASN.1 is the explicit data definition, when using OCTECT STRING, must comprise the length of this character string, when conversion, this length taking-up is inserted in the length field of XDR string type.
OBJECT IDENTIFIER: i.e. the sign of managed object, this value is not used in function call, but when RPC calls, OBJECT IDENTIFIER will convert the address of the managed object in the RPC communication into.
(B), 6 kinds of applicational grammar variablees among the SNMP are converted into the XDR form:
IpAddress, the Fixed-Length Array (fixed length array) of use XDR, length is 4;
Counter32, the Unsigned Integer type of use XDR;
Unsigned32, the Unsigned Integer type of use XDR;
TimeTicks, the Unsigned Integer type of use XDR;
Opaque is identical with the conversion of OCTET STRING;
Counter64, the Unsigned Hyper Integer type of use XDR;
Unsigned32, the Unsigned Integer type of use XDR;
In addition, for the SNMP object of form types, adopt a structure that the variable of form is encapsulated and get final product, because the form types member is made up of above-mentioned simple types, then can be regarded as be the conversion to member in the form in the conversion of form.
(C), the conversion of the improper value that returns of RPC call error value and SNMP operation requests:
The terminal error of the invocation of procedure has two kinds of possibilities, and the one, the mistake in the RPC invoked procedure is referred to as external error in embodiments of the present invention; Another kind of is internal error during the invocation of procedure realizes, and this moment, the RPC invoked procedure was successful, and type of error is referred to as internal error in embodiments of the present invention in the return value of the invocation of procedure;
In the RPC process issuable external error comprise that program does not exist, program does not match, process does not exist, parameter does not match, system mistake, authentication error and RPC version error.
More than except that " system mistake ", other wrong only possibility can convert all external error values into the error condition " noAccess " of SNMP owing to design mistake occurs.Because the error condition of SNMP just is used for prompting usually, NMS no longer further handles error condition, so the inaccuracy of error condition can not have influence on the management process of NMS.
Internal error is that the requirement according to SNMP when handling management request of far-end process produces improper value, does not need to change again, and this moment, the return value of RPC process was success.
(D), the implicit type of XDR definition:
The implicit type definition that XDR adopts needs the producer of data and consumer that the explanation of data is reached an agreement in advance, and this problem solves through the process statement of RPC.Comprised parameter and return value type in the statement of RPC process, therefore statement when data are dealt on the server by client computer, can guarantee that both are consistent for the explanation of data with the program that is used for simultaneously on client computer and the server.
(E), the semantic change of the invocation of procedure:
ONC RPC does not guarantee that the invocation of procedure is necessarily reliable, and snmp protocol has also been supposed the unreliability of SNMP operation requests, so the SNMP agency can tolerate the unreliability of RPC;
(F), by the addressing of administration module:
For accomplishing the SNMP agency to by the invocation of procedure of administration module; Need the OBJECT IDENTIFIER of managed object in the snmp message be converted into by the address of administration module; By the addressing of administration module is not the scope of the said concern of the embodiment of the invention, and present embodiment can be selected to be confirmed by the address of administration module by the address table that presets.Owing to constituted the network of device interior between master control borad and the controlled board; In the system schema addressing method must be arranged; The addressing scheme of device interior is generally all fairly simple; For example: if device interior uses is the TCP/IP network, then can with TCP or udp port with by the just curing when the system design of the mapping relations between the administration module.
The method and apparatus that the embodiment of the invention provides docks the SNMP system with ONC RPC system, utilize ONC RPC to transmit the management operation request between master control borad and the controlled board.Shield the difference of remote procedure call and LPC by ONC RPC, make SNMP proxy module and constructed, avoid the multistage SNMP agency plant of complex structure by the mode that administration module can still call according to this locality.
Method of the present invention is not limited to the embodiment described in the embodiment, and those skilled in the art's technical scheme according to the present invention draws other execution mode, belongs to technological innovation scope of the present invention equally.Obviously, those skilled in the art can carry out various changes and modification to the present invention and not break away from the spirit and scope of the present invention.Like this, belong within the scope of claim of the present invention and equivalent technologies thereof if of the present invention these are revised with modification, then the present invention also is intended to comprise these changes and modification interior.