Embodiment
Embodiments of the invention are described with reference to the accompanying drawings.Be to be noted that in the following description, set forth many details in order to make those skilled in the art more fully understand the present invention.But, being apparent that for those skilled in the art, realization of the present invention can not have some in these details.In addition, should be understood that the specific embodiment that the present invention is not limited to introduce.On the contrary, can consider to implement the present invention with the combination in any of following feature and key element, and no matter whether they relate to different embodiment.Therefore, following aspect, feature, embodiment and advantage for illustrative purposes only use and should not be counted as key element or the restriction of claims, unless clearly propose in claim.
Referring now to Fig. 1, it shows equipment configurationspecification testing fixture 100 according to an embodiment of the invention.As shown in the figure, thisdevice 100 comprises:receiver module 101, be configured to receive the configuration template defined file, and this configuration template defined file has defined the correct configuration item of the functional module of examine; Readmodule 102, be configured to the fetch equipment configuration file; And matchingmodule 103, be configured to the correct configuration item Auto-matching in the configuration item in device configuration file and configuration template defined file, whether correct with the configuration item in the judgment device configuration file.
Describedreceiver module 101 can receive the configuration template defined file by any way, for example can be received from from network the configuration template defined file of remote transmission, read the configuration template definition part of storing from any Nonvolatile memory devices, receives by the configuration template defined file of user's input and establishment by user interface etc.Describedread module 102 is the fetch equipment configuration file by any way, for example,, by network slave fetch equipment configuration file, reads and is stored in local device configuration file etc.Describedmatching module 103 can carry out Auto-matching with the correct configuration item in the configuration item in device configuration file and configuration template defined file in any suitable manner, and can be with the user of matching result output.
Described configuration template defined file can be created and revise with any suitable document creation and edit tool by the user.For example, if this configuration template defined file is text, the user can create and revise this configuration template defined file with any the text edit tool.The user can create and revise the configuration template defined file according to the configuration specification of equipment and software and the business demand of self and equipment operating environment.
As those skilled in the art as can be known, the configuration file of present cyber-net equipment is text formatting.Therefore, according to embodiments of the invention, described configuration template defined file is also text formatting.Like this, whether matchingmodule 103 just can be with any text comparative approach with the correct configuration item Auto-matching in the configuration item in configuration file and configuration template defined file, correct to judge the configuration item in configuration file.
, according to embodiments of the invention, comprise the regular expression that mates for the configuration item with device configuration file in described configuration template defined file.As known in the art, the character string that regular expression is comprised of common character and the special character with specific syntax implication, it is used for mating with target string.For example, with the d representative digit ,+expression occurs continuously, d+ can mate any numeral, ntp clock-period d+ can mate ntp clock-period heel the character string of Any Digit is arranged.By comprise regular expression in the configuration template defined file, devices in accordance with embodiments of thepresent invention 100 can be adapted to equipment and be configured in variation in varying environment, improves its versatility.
The present inventor recognizes, although the configuration file of different vendor's equipment has different text formattings, but a large amount of configuration items in configuration file usually all can be according to certain text formatting (for example, according to row first key word, indentation etc.) be divided into different piece, these different pieces are usually corresponding to the difference in functionality module of equipment.Same group of relevant configuration item of a functional module can be described as the configuration class of this functional module, and each configuration item of same configuration class has the first key word of row of identical this functional module of expression usually in configuration file.Same configuration class can have one or more profile instance in configuration file, each profile instance comprises one group of relevant configuration item, its specific context corresponding to this functional module or running environment.The different profile instance of same configuration class can represent with different digital or the character of the first key word of the row of presentation function module and back usually in configuration file.For example,, for this functional module of network interface, can its configuration item be divided into different profile instance according to description, address field, order etc. in configuration file., for this functional module of bgp neighbor, can its configuration item be divided into different profile instance according to the AS grade in configuration file., for this functional module of ACL, can its configuration item be divided into different profile instance according to position of name, application etc. in configuration file.For example, take following configuration file fragment as example:
In this configuration file fragment example, the corresponding function module of the first keyword service of the row of each configuration item, aaa, interface, access-list indication equipment, each configuration item can be divided into corresponding configuration class by keyword first according to its row, and the first keyword of for example going is that each configuration item of service is divided into configuration class service.In addition, for configuration class access-list, it has two profile instance, and access-list7 and access-list101 comprise one group of relevant configuration item in each profile instance.
Therefore, according to embodiments of the invention, described configuration template defined file defines the correct configuration item of the functional module of examine according to the configuration class, described configuration class is corresponding to one group of relevant configuration item of functional module, and describeddevice 100 also comprises: optionally dividemodule 104, the configuration item that is configured in the device configuration file that will read is divided into the configuration class, in order to the correct configuration item according to the configuration class in the configuration template defined file, mate.That is to say, in described configuration template defined file, the definition of the correct configuration item of the functions of the equipments module of examine is also carried out according to the configuration class, namely the class that respectively configures for the functional module of examine defines the correct configuration item that belongs to this configuration class.According to further embodiment of the present invention, described configuration class has one or more profile instance, and described profile instance is corresponding to the context of functional module operation.
According to embodiments of the invention, describedreceiver module 101 also is configured to receive configuration class definition file, described configuration class definition document definition the configuration class that can be divided into of the configuration item in the device configuration file, and wherein, describeddivision module 104 also is configured to, according to described configuration class definition file, the configuration item in the device configuration file that reads is divided into the configuration class.Described configuration class definition file can define the configuration class by listing the title that respectively configures class, and the title of described configuration class can be for example the title of functional module.
According to embodiments of the invention, this configuration class definition file can be text formatting, and the user can create and revise this configuration class definition file with any the text edit tool.This configuration class definition file both can define the configuration class for the configuration file of a kind of computing machine or the network equipment, thereby this configuration class definition file is applicable to the standardization inspection of the configuration file of this kind equipment; Also can define the configuration class for the configuration file of multiple computing machine or the network equipment, thereby this configuration class definition file is applicable to the standardization inspection of the configuration file of plurality of devices.In addition, the configuration class of the configuration file for multiple computing machine or the network equipment can also be included in respectively in a plurality of configuration class definition files, and can specify concrete which configuration class definition file that uses in the configuration template defined file.
The present inventor recognizes, is sequential between the configuration item in some configuration classes, and namely the order between each configuration item is fixed, and can not change; And be not have sequentially between the configuration item of other configurations in classes, namely the order between each configuration item can change.Do not have sequential configuration class for configuration item, the order between its each configuration item in device configuration file can change.Therefore, before correct configuration item in the configuration item with in device configuration file and configuration template defined file mates, do not have sequential configuration class for configuration item, can at first the configuration item of the configuration item of this configuration class in device configuration file and this configuration class in the configuration template defined file be sorted respectively, so that both mate.
For this reason, according to embodiments of the invention, described configuration class definition file has also been specified the configuration class that can sort, configuration item in the described configuration class that sorts is not distinguished order, and thisdevice 100 also comprises:optional order module 105, before being configured to the correct configuration item Auto-matching in the configuration item with in device configuration file and configuration template defined file, the configuration item in the configuration class that sorts in device configuration file and the configuration item in the corresponding configuration class in the configuration template defined file are sorted.Described sequence can be carried out in any way, for example, and can the alphabet sequence sequence.Preferably, when creating the configuration template defined file, can at first the configuration item in the configuration class that can sort be sorted.Then, when the fetch equipment configuration file, the configuration item in the configuration class that can sort can be carried out identical sequence.
According to embodiments of the invention, comprise variable in described configuration template defined file, and described device also comprises:optional replacement module 106, before being configured to the correct configuration item Auto-matching in the configuration item with in device configuration file and configuration template defined file, the variable in the configuration template defined file is replaced with the actual relevant configuration value of equipment.For example, in one network, the router-id of equipment often is defined as the loopback0 address of equipment, and the loopback0 address of each equipment is different, but router-id always follows the loopback0 address and changes.Therefore, configuration item router-id in the configuration template defined file can be defined as loopback0, for example be expressed as // Loopback0::ip} //, and with device configuration file in configuration item mate before, the value of the configuration item router-id in the configuration template defined file can be replaced with the value of the loopback0 in existing network equipment.Its dependent variable example comprises address of broadcasting in the ip address, Routing Protocol of interface etc.
According to embodiments of the invention, comprise the hierarchical relationship between the configuration item that represents with indentation in described configuration template defined file, describedmatching module 103 also is configured to when correct configuration item in the configuration item with in device configuration file and configuration template defined file mates automatically consider described hierarchical relationship.As known in the art, usually represent hierarchical relationship between configuration item with indentation in configuration file, for this reason, according to embodiments of the invention, can represent the hierarchical relationship between (for example also in the mode of indentation, representing) correct configuration item in the configuration template defined file, and with configuration file in configuration item can consider this hierarchical relationship while mating.For example, for following configuration template defined file fragment example and configuration file fragment example:
Although all comprise configuration item command3 in configuration template defined file and configuration file, because both are subordinated to respectively different higher level's configuration item command21 and command22, so both do not mate.
According to embodiments of the invention, not only when mating, matchingmodule 103 need to consider the hierarchical relationship between configuration item, and also to consider hierarchical relationship between configuration item whenorder module 105 sorts, the hierarchical relationship before and after namely will guaranteeing to sort between configuration item is constant.
For example, for following configuration file fragment example:
Result after its sequence should be:
Also say will have the configuration item ip of hierarchical relationship and mtu1530 and mpls and mtu1518 and do as a wholely to treat in sequence, thereby kept the hierarchical relationship between them.
Below show the example of a configuration class definition file:
In this configuration class definition file example, to have listed and respectively configured class, these configuration classes are divided into several types, comprising: only have the row configuration class of a profile instance, such as aaa, ntp etc.; Profile instance with configuration class of a plurality of profile instance, such as access-list[1], ip community-list expanded[1] etc.; Profile instance with configuration class of indentation, such as policy-map[1], class-map[2] etc.; Routing Protocol configuration class, such as router static, router isis etc.This configuration class definition file has also been specified the configuration class that can sort, such as aaa, ntp etc.As understood by the skilled person in the art, in above configuration class definition file, the type of configuration class being divided and enumerating of configuration class waited is only example, configuring according to an embodiment of the invention the class definition file can be divided into the configuration class other types or not be divided into any type, can list other configuration class and examples, can specify other configuration classes that can sort or not specify the configuration class that can sort, etc.
Below show the example of a configuration template defined file:
In this configuration template defined file example, at first specify in SOFTWARE and use which configuration class definition file, specified and will be configured the functional module that standardization checks in the tobe_checked part, then defined respectively the template that respectively configures class, wherein the template of each configuration class comprises that this forms the correct configuration item of this configuration class.In this configuration template defined file, for example, configuration class line_vty has a plurality of profile instance, and the .* in@@line vty checklist is used to represent and will checks all profile instance, the@@line_vty actual template of having given a definition.Configuration class access-list also has a plurality of profile instance, lists under access-list checklist and needs to check profile instance 37,111, has then defined respectively the template of each profile instance.Comprised regular expression in the template of profile instance access-list111.Comprise the indentation of configuration line in the template of each profile instance interface.* that configures class interface.
Equipment configurationspecification testing fixture 100 has according to an embodiment of the invention more than been described.Be to be noted that above description and diagram only for example, rather than to the restriction of equipment configuration specification testing fixture of the present invention.In other embodiments of the invention, that this equipment configuration specification testing fixture can have is more, still less or different modules, and the connection between each module, comprise, the relation such as function can from describe and illustrated different.
Referring now to accompanying drawing, equipment configuration specification inspection method is according to an embodiment of the invention described.The method can be carried out or by other devices, be carried out by the above-mentioned configuration specification of equipment according to an embodiment of theinvention testing fixture 100, so each step of the method is corresponding to each operation of this device.For simplicity's sake, omit in the following description some details with above repetition, therefore can obtain more detailed understanding to the method referring to above description.
Fig. 2 shows equipment configuration specification inspection method according to an embodiment of the invention.As shown in the figure, the method comprises the following steps:
Instep 201, receive the configuration template defined file, this configuration template defined file has defined the correct configuration item of the functional module of examine.
Instep 202, the fetch equipment configuration file.
Instep 203, with the correct configuration item Auto-matching in the configuration item in device configuration file and configuration template defined file, whether correct with the configuration item in the judgment device configuration file.
, according to embodiments of the invention, comprise the regular expression that mates for the configuration item with device configuration file in described configuration template defined file.
According to embodiments of the invention, described configuration template defined file is text formatting.
According to embodiments of the invention, described configuration template defined file defines the correct configuration item of the functional module of examine according to the configuration class, and described configuration class is corresponding to one group of relevant configuration item of functional module, and described method also comprises following optional step:
, instep 204, the configuration item in the device configuration file that reads is divided into the configuration class, in order to the correct configuration item according to the configuration class in the configuration template defined file, carry out Auto-matching.
According to embodiments of the invention, the method also comprises following optional step: instep 205, receive configuration class definition file, described configuration class definition document definition the configuration class that can be divided into of the configuration item in the device configuration file, and wherein, described with the configuration item in the device configuration file that reads be divided into the configuration class carry out according to described configuration class definition file.
According to embodiments of the invention, described configuration class definition file has also been specified the configuration class that can sort, and the configuration item in the described configuration class that sorts is not distinguished order, and the method also comprises following optional step:
Instep 206, before correct configuration item Auto-matching in the configuration item with in device configuration file and configuration template defined file, with the configuration item in the configuration class that sorts in device configuration file sequence for the configuration template defined file in the corresponding configuration class in the order of configuration item identical.
According to embodiments of the invention, described configuration class has one or more profile instance, and described profile instance is corresponding to the context of functional module operation.
, according to embodiments of the invention, comprise variable in described configuration template defined file, and described method also comprises following optional step:
, instep 207, before the correct configuration item Auto-matching in the configuration item with in device configuration file and configuration template defined file, the variable in the configuration template defined file is replaced with the actual relevant configuration value of equipment.
According to embodiments of the invention, comprise the hierarchical relationship between the configuration item that represents with indentation in described configuration template defined file, described correct configuration item Auto-matching in configuration item in device configuration file and configuration template defined file is considered described hierarchical relationship.
Equipment configuration specification inspection method has according to an embodiment of the invention more than been described.Be to be noted that above description and diagram only for example, rather than to the restriction of equipment configuration specification inspection method of the present invention.In other embodiments of the invention, that this equipment configuration specification inspection method can have is more, still less or different steps, and the order between each step, comprise, the relation such as function can from describe and illustrated different.
The present invention can hardware, the mode of the combination of software or hardware and software realizes.The present invention can realize in a concentrated manner in a computer system, or with the distribution mode realization, in this distribution mode, different component distribution is in the computer system of some interconnection.Any computer system or other device that are suitable for carrying out each method of describing herein are all suitable.A kind of combination of typical hardware and software can be the general-purpose computing system with computer program, when this computer program is loaded and carries out, controls this computer system and makes it carry out the mode of describing herein.Present invention may also be embodied in computer program, this program product comprises all features that enable to realize the method for describing herein, and when it is loaded in computer system, can carry out these methods.
Process flow diagram in accompanying drawing and calcspar show framework, function and the operation of the possible embodiment of according to various embodiments of the present invention device, method.In this regard, each square in described process flow diagram or calcspar can represent module, section or the part of code, and it comprises the one or more executable instructions be used to (one or more) logic function that realizes appointment.Be also pointed out that in some alternate embodiment, the function that illustrates in square can be not according to occurring in sequence of illustrating in figure.For example, being shown two continuous squares in fact can substantially side by side be carried out, perhaps some the time, depend on related function, described square can be carried out in reverse order.Be also pointed out that each square of described calcspar and/or process flow diagram and the combination of described square can realize by carrying out appointed function or the system based on specialized hardware of operation or the combination of specialized hardware and computer instruction.
Although with reference to preferred embodiment, specifically illustrated and illustrated the present invention, those technician in this area should be understood that and can carry out various changes and can not deviate from the spirit and scope of the present invention it in form and details.