Configuration information parsing method, device, electronic device and storage medium

By acquiring the raw text information of network devices, determining the preset rule file set based on attribute parameters, and parsing the configuration information of the rule file set, the problem of universality in parsing configuration information of network devices of different brands and models is solved, and the scalability and maintainability of the software are improved.

CN115604115BActive Publication Date: 2025-09-02GUANGDONG POWER GRID CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211216605.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-30
Publication Date
2025-09-02
Estimated Expiration
2042-09-30

AI Technical Summary

Technical Problem

Existing technologies cannot effectively parse configuration information of network devices of different brands and models. In particular, due to the inconsistency of commands and formats of the SSH protocol among different manufacturers, it is impossible to use a common program for configuration collection.

Method used

By obtaining the raw text information returned by the network device, a preset rule file set is determined based on the attribute parameters, and the configuration information is parsed using the parsing rules of the preset rule file set. This supports new network device interaction and parsing methods and allows the rule files to be modified according to the actual situation.

Benefits of technology

It increases the scalability and maintainability of the software program, enabling it to adapt to different brands and models of network devices and achieve unified parsing of configuration information.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115604115B_ABST
    Figure CN115604115B_ABST
Patent Text Reader

Abstract

Embodiments of the present invention disclose a configuration information parsing method, system, electronic device, and storage medium. The method includes: obtaining original text information returned by a network device, determining a preset rule file set based on attribute parameters of the original text information, and parsing the configuration information of the original text information according to the parsing rules of the preset rule file set. In embodiments of the present invention, a preset rule file set is determined based on attribute parameters corresponding to the original text information, and the configuration information of the original text information is parsed using the parsing rules of the preset rule file set. New rule files can be added based on new network device interaction and parsing methods, and the rule files can be modified according to actual conditions, thereby increasing the scalability and maintainability of the software program.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of communication technologies, and in particular to a configuration information parsing method, device, electronic device, and storage medium. Background Art

[0002] To obtain configuration status information for firewalls and switches, you can use the communication interfaces provided by network devices such as firewalls and switches. Commonly used communication interfaces include the standard Simple Network Management Protocol (SNMP), Hypertext Transfer Protocol (HTTP / HTTPS), and Secure Shell (SSH). The SNMP protocol relies on the manufacturer's public management information library interface to obtain configuration information, and is limited by the manufacturer's private, non-public management information library, so it cannot fully cover the management of all network devices. The HTTP / HTTPS protocol is an unsafe communication protocol in the production control area of ​​the power monitoring system and is not allowed to be used. The SSH protocol can automatically log in to the device and execute interactive commands to obtain configuration information. However, after logging in through SSH, the formats of the commands and configuration information obtained by each manufacturer are different, so it is impossible to use a universal program to adapt to SSH configuration collection for network devices of different brands. Summary of the Invention

[0003] In view of this, an embodiment of the present invention provides a configuration information parsing method, system, electronic device and storage medium, which can add new rule files based on new network device interaction methods and parsing methods, and the rule files can be modified according to actual conditions, thereby increasing the scalability and maintainability of the software program.

[0004] According to one aspect of the present invention, an embodiment of the present invention provides a configuration information parsing method, the method comprising:

[0005] Get the original text information returned by the network device;

[0006] Determining a preset rule file set according to the attribute parameters of the original text information;

[0007] The configuration information of the original text information is parsed according to the parsing rules of the preset rule file set.

[0008] According to another aspect of the present invention, an embodiment of the present invention further provides a configuration information parsing device, the device comprising:

[0009] An information acquisition module is used to obtain the original text information returned by the network device;

[0010] A determination module, configured to determine a preset rule file set based on attribute parameters of the original text information;

[0011] The parsing module is used to parse the configuration information of the original text information according to the parsing rules of the preset rule file set.

[0012] According to another aspect of the present invention, an embodiment of the present invention further provides an electronic device, comprising:

[0013] at least one processor; and

[0014] a memory communicatively connected to the at least one processor; wherein,

[0015] The memory stores a computer program executable by the at least one processor. The computer program is executed by the at least one processor so that the at least one processor can perform the configuration information parsing method described in any embodiment of the present invention.

[0016] According to another aspect of the present invention, an embodiment of the present invention further provides a computer-readable storage medium storing computer instructions, which are used to enable a processor to implement the configuration information parsing method described in any embodiment of the present invention when executed.

[0017] The above-mentioned technical solution of the embodiment of the present invention obtains the original text information returned by the network device, determines the preset rule file set based on the attribute parameters of the original text information, and parses the configuration information of the original text information according to the parsing rules of the preset rule file set. In the embodiment of the present invention, the preset rule file set is determined based on the attribute parameters corresponding to the original text information, and the configuration information of the original text information is parsed according to the parsing rules of the preset rule file set. New rule files can be added according to new network device interaction methods and parsing methods, and the rule files can be modified according to actual conditions, thereby increasing the scalability and maintainability of the software program.

[0018] It should be understood that the content described in this section is not intended to identify the key or important features of the embodiments of the present invention, nor is it intended to limit the scope of the present invention. Other features of the present invention will become readily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0020] Figure 1A flowchart of a configuration information parsing method provided by one embodiment of the present invention;

[0021] Figure 2 A flowchart of another configuration information parsing method provided by one embodiment of the present invention;

[0022] Figure 3 A flowchart of another configuration information parsing method provided by an embodiment of the present invention;

[0023] Figure 4 A structural block diagram of a configuration information parsing device provided by one embodiment of the present invention;

[0024] Figure 5 A schematic structural diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0025] In order to enable those skilled in the art to better understand the solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the embodiments described are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts should fall within the scope of protection of the present invention.

[0026] It should be noted that the terms "first, second" and the like in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the numbers used in this way are interchangeable where appropriate so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or apparatus.

[0027] In one embodiment, Figure 1 A flowchart of a configuration information parsing method provided for one embodiment of the present invention. This embodiment is applicable to situations when parsing the configuration information of a network device. The method can be executed by a configuration information parsing device. The configuration information parsing device can be implemented in the form of hardware and / or software, and the configuration information parsing device can be configured in an electronic device.

[0028] like Figure 1 As shown, the method includes:

[0029] S110: Obtain original text information returned by the network device.

[0030] Network devices include, but are not limited to, firewalls, switches, and other network devices. Raw text information can be understood as the raw text information obtained from network devices when corresponding configuration commands are sent. This raw text information includes, but is not limited to, model, brand, device type, Address Resolution Protocol (ARP) table, Media Access Control (MAC) address table, Internet Protocol (IP) configuration table for interconnection between networks, port configuration table, routing table, etc.

[0031] In this embodiment, a corresponding configuration command can be sent to a network device through a program, so that when the network device receives the corresponding configuration command, it returns the original text information of the corresponding configuration command. In some embodiments, the (Secure Shell, SSH) protocol can automatically log in to the network device and execute interactive commands. When the SSH protocol is logged in, the configuration command to be sent in the preset rule file is read to send the corresponding configuration command to the network device to the switch, so that when the switch receives the corresponding command information, it returns the original text information corresponding to the command information, including the switch model, brand, device type, ARP table, IP configuration table, etc. For example, if the configuration command sent is display vlan, the switch VLAN configuration information is obtained, which may include VLAN ID, type, description information, status, statistical switch status, included interfaces, and the joining method of these interfaces; if the configuration command sent is display model, the switch model is obtained; if the configuration command sent is display rode, the routing table information is obtained accordingly.

[0032] S120: Determine a preset rule file set according to attribute parameters of the original text information.

[0033] The attribute parameters can be understood as information such as the device type, device model, and brand of the network device corresponding to the original text information, as well as the configuration command corresponding to obtaining the original text information. The preset rule file set can be understood as a pre-set rule parsing file set. The preset rule file set can be configured accordingly based on user needs, and relevant rule files can be added and / or removed from the original rule file set.

[0034] In this embodiment, the preset rule file set may include a main information area corresponding to the network device and sub-rules that constitute at least one sub-rule chain, and each sub-rule can be used to match and parse the corresponding input field information. It should be noted that each sub-rule in each sub-rule chain has corresponding field information, and this field information includes at least one of the following: input field information, matching field information, next parsing field information, output variable names corresponding to each parsing result, and parsing result field information corresponding to each sub-rule. In this embodiment, the main information area corresponding to the network device may include the device type, brand information, model information, sent configuration commands, output variable information corresponding to the text information to be parsed, and structured information results.

[0035] In this embodiment, by reading the information of at least one main information area corresponding to the preset rule file set, the device model of the network device corresponding to the original text information and the configuration command corresponding to the original text information can be matched with the information of each main information area respectively, so as to form at least one sub-rule that successfully matches the information of each main information area with the attribute parameters to form at least one sub-rule chain, and the at least one sub-rule chain formed is used as the preset rule file set for parsing the original text information.

[0036] S130: Parse the configuration information of the original text information according to the parsing rules of the preset rule file set.

[0037] The parsing rules can be understood as the rules for parsing the configuration information corresponding to the original text information. Of course, the parsing rules can include one or more sub-rule chains for parsing, and each sub-rule chain can contain one or more sub-rules. The configuration information can be understood as the parsing results corresponding to each sub-rule in each sub-rule chain.

[0038] In this embodiment, the network device returns the corresponding original text information and determines the corresponding preset rule file set. The original text information can be matched according to the field information corresponding to each sub-rule in the sub-rule chain composed of the preset rule file set, thereby determining the parsing result of at least one constituent sub-rule in the sub-rule chain, and merging each parsing result into configuration information; it should be noted that when parsing the original text information according to the preset rule file set, since the text format corresponding to the original text information is heterogeneous and complex, it is generally necessary to use multiple sub-rules for multiple matching and parsing until simple character content is output, and the sub-results corresponding to each sub-rule are combined.

[0039] The above-mentioned technical solution of the embodiment of the present invention obtains the original text information returned by the network device, determines the preset rule file set based on the attribute parameters of the original text information, and parses the configuration information of the original text information according to the parsing rules of the preset rule file set. In the embodiment of the present invention, the preset rule file set is determined based on the attribute parameters corresponding to the original text information, and the configuration information of the original text information is parsed according to the parsing rules of the preset rule file set. New rule files can be added according to new network device interaction methods and parsing methods, and the rule files can be modified according to actual conditions, thereby increasing the scalability and maintainability of the software program.

[0040] In one embodiment, the preset rule file set includes at least one sub-rule chain and a main information area corresponding to the network device;

[0041] The main information area includes at least one of the following: device type, brand information, model information, configuration commands sent, output variable information corresponding to the text information to be parsed, and structured information results corresponding to the network device;

[0042] The preset rule file set includes at least one sub-rule chain, and the field information corresponding to each sub-rule in each sub-rule chain includes at least one of the following: input field information, matching field information, next parsing field information, output variable name corresponding to each parsing result, and parsing result field information corresponding to each sub-rule.

[0043] A sub-rule chain can be understood as a sub-rule chain composed of sub-rules. A sub-rule chain contains at least one sub-rule, and each sub-rule can be sorted according to the next parsed field information. For example, a sub-rule chain can consist of sub-rules 1 through 6. A structured information result can be understood as the total output result corresponding to at least one sub-rule chain.

[0044] In this embodiment, the preset rule file contains two parts: one is the main information area corresponding to the switch, and the other is at least one sub-rule chain. The main information area can include the device type, brand information, model information, configuration commands sent, output variable information corresponding to the text information to be parsed, and structured information results corresponding to the network device. For example, the device type can be a switch or a firewall; the brand can be brand A, brand B, etc.; the model information can be model 1, model 2, etc.; the configuration commands sent include but are not limited to VLAN configuration information and IP configuration information;

[0045] In this embodiment, each sub-rule contains the following field information, and each sub-rule corresponds to at least one of the following field information to collaboratively complete the parsing of the original text information: input field information, matching field information, next parsing field information, output variable names corresponding to each parsing result, and parsing result field information corresponding to each sub-rule.

[0046] In this embodiment, the input field information may represent the original text information input by the sub-rule or the input field information corresponding to the next sub-rule. It can be understood that the input field information corresponding to the next sub-rule is the sub-parsing result information corresponding to the previous sub-rule, that is, it may be the continued parsing content output after other sub-rules are matched; the matching field information is used to match the input field information, and one or more matching variables can be extracted therefrom; the next parsing field information can be understood as the content that needs to be further parsed, which is the matching variable parsed in the matching field information. It should be noted that the next parsing field information may or may not exist in the sub-rule. If the next parsing field information exists, it means that there is text information to be further parsed and it is necessary to continue parsing. If it does not exist, it means that the sub-rule does not need to create new matching content for subsequent rule matching.

[0047] In this embodiment, the parsing result field information corresponding to each sub-rule can be understood as the parsing sub-result corresponding to each sub-rule. The sub-result can be a json string or an output variable. The json string can include the matching variable in match, or an output variable. The output variable is integrated by the outname obtained after the subsequent next rule matching; the output variable name corresponding to each parsing result can be understood as the output variable name corresponding to the sub-result output of each sub-rule, which is used to be integrated into the outmsg of the upper layer.

[0048] It should be noted that for network devices of different models, versions and brands, the preset rule file sets are generally different. For example, there are switches 1 and switch 2 of different models and versions. The VLAN configuration information corresponding to switch 1 and switch 2 is obtained. At this time, the VLAN configuration information returned by switch 1 and switch 2 is different, and the format is also different. At this time, the corresponding preset rule file sets are also different. The preset rule file set corresponding to switch 1 can contain 8 sub-rules, each constituting two sub-rule chains; the preset rule file set corresponding to switch 2 can contain 4 sub-rules, each constituting 1 sub-rule chain.

[0049] In one embodiment, Figure 2This is a flow chart of another configuration information parsing method provided by one embodiment of the present invention. Based on the above embodiments, this embodiment further refines the method of determining a preset rule file set based on the attribute parameters of the original text information and parsing the configuration information of the original text information based on the parsing rules of the preset rule file set. Figure 2 As shown, the configuration information parsing method in this embodiment may specifically include the following steps:

[0050] S210: Obtain original text information returned by the network device.

[0051] S220: Read a main information area corresponding to at least one preset rule file set.

[0052] The main information area refers to the main information area of ​​the network device corresponding to the preset rule file set.

[0053] In this embodiment, the device type, brand information, model information, sent configuration commands, output variable information corresponding to the text information to be parsed, structured information results and other information corresponding to the network device in the main information area corresponding to at least one preset rule file set are read.

[0054] S230: Match the device model and configuration command in the attribute parameters with the information in each main information area.

[0055] In this embodiment, the device model and configuration commands in the original text are read and matched against the model information and sent configuration commands in each primary information area. Different operations are then performed based on the matching results. For example, if the device model is s5700 and the corresponding configuration command is "display vlan," this command retrieves the switch's VLAN configuration information and then matches the device model and configuration commands with the model information and sent configuration commands defined in the primary information area corresponding to the preset rule file set.

[0056] S240: Using the preset rule file set that successfully matches the information in the main information area with the attribute parameters as the preset rule file set for parsing the original text information.

[0057] In this embodiment, the device model and configuration command in the original text information are matched with the device model information defined in the main information area corresponding to the preset rule file set and the configuration command sent. If the match is successful, the preset rule file set is used as the preset rule file set for parsing the original text information, the corresponding original text information is obtained according to the configuration command, and the original text information is parsed according to the preset rule file set for parsing the original text information.

[0058] For example, the device model is s5700 model A×, and the corresponding configuration command is display vlan. Match it with the device model and configuration command in the original text information. The original text information obtained by the display vlan command is two tables, one is the vlan-associated network port table; the other is the vlan status table. At this time, the preset rule file set that is successfully matched contains sub-rules 1 to sub-rules 8, which contain two sub-rule chains. Sub-rules 1 to sub-rules 6 in sub-rule chain 1 are used to parse the vlan-associated network port table, and sub-rules 7 and sub-rules 8 are used to parse the vlan status table.

[0059] S250: Match the original text information according to the sub-rule chain to determine a parsing result of at least one constituent sub-rule in the sub-rule chain.

[0060] Among them, the parsing result can be understood as the sub-parsing result corresponding to each sub-rule when parsing the input field information, which can be a json string or an output variable. For example, the parsing result corresponding to sub-rule 1 is sub-result 1, the parsing result corresponding to sub-rule 2 is sub-result 2, and so on. This embodiment does not limit this. It should be noted that the parsing result corresponding to each sub-rule can be 1 parsing result, and can include multiple parsing results. For example, in sub-rule 1, 1 result is matched from vlanPortTableStr, and in rule 2, a total of 12 results are matched from vlanPortTableStr.

[0061] In this embodiment, the original text information can be matched according to the sub-rule chain to determine the parsing result of at least one component sub-rule in the sub-rule chain. Specifically, the first component sub-rule of the sub-rule chain can be determined as the current component sub-rule and the original text information can be used as the parsed text. The matching field information of the current component sub-rule is matched with the parsed text using a regular expression to determine the parsing result and record the parsing result as the new parsed text. The second component sub-rule is searched in the sub-rule chain according to the next parsing field information of the current component sub-rule. If the second component sub-rule is obtained, the second component sub-rule is used as the current component sub-rule to continue to determine the parsing result. If the second component sub-rule is not obtained, it is determined that the sub-rule chain has completed matching. It can be understood as determining at least one sub-rule corresponding to the sub-rule chain, inputting the original text information into the sub-rule chain, and determining the connection order of the sub-rule chain through the corresponding next parsing field information in each sub-rule, and taking the sub-rule at the head as the first sub-rule of the sub-rule chain. If the next parsing field information exists in the first sub-rule, it means that there is the next text information to be parsed, saving the parsing result of the first sub-rule, and taking the next text information to be parsed as the input field information of the next sub-rule, and continuing to use regular expressions to match the input field information until no new output variables are generated in the next text information to be parsed or the next parsing field information does not exist, the sub-rule chain parsing is completed, and the parsing results corresponding to each sub-rule are spliced.

[0062] In some embodiments, the corresponding field information in the constituent sub-rules includes at least one of the following: input field information, matching field information, next parsing field information, output variable names corresponding to each parsing result, and parsing result field information corresponding to each sub-rule.

[0063] In one embodiment, matching the original text information according to the sub-rule chain to determine the parsing result of at least one component sub-rule in the sub-rule chain includes:

[0064] Determine the first component sub-rule of the sub-rule chain as the current component sub-rule and use the original text information as the parsed text, wherein the first component sub-rule is located at the head of the sub-rule chain;

[0065] Matching the matching field information of the current constituent sub-rule with the parsed text to determine a parsing result and recording the parsing result as a new parsed text, wherein the matching field information includes a regular expression;

[0066] Search the second component sub-rule in the sub-rule chain according to the next parsed field information of the current component sub-rule;

[0067] If the second component sub-rule is obtained, the second component sub-rule is used as the current component sub-rule to continue determining the parsing result;

[0068] If the second component sub-rule is not obtained, it is determined that the sub-rule chain completes the match.

[0069] The first component sub-rule refers to the first sub-rule in the sub-rule chain, and the second component sub-rule can be understood as the sub-rules in the sub-rule chain excluding the first component sub-rule.

[0070] In this embodiment, the first component sub-rule is located at the head of the sub-rule chain. The input field information of the first component sub-rule, that is, the original text information is matched with the matching field information of the first component sub-rule to obtain the matching variable. If the first component sub-rule contains the next parsing field information, it means that the second component sub-rule exists. The next parsing field information in the first component sub-rule is used as the input field information in the second component sub-rule, and the second component sub-rule is used as the current component sub-rule to continue sub-rule matching. If the first component sub-rule does not contain the next parsing field information, it means that the second component sub-rule does not exist, and it is determined that the sub-rule chain completes the match.

[0071] It should be noted that when the next parsed field information is matched multiple times, the field information included each time is different. This can be understood as the field information included each time when using regular expressions to match input field information. For example, when sub-rule 1 is matched, the main fields included in the match are vid identifier, (type) type, and (ports) network port. When sub-rule 2 is matched, the main fields included in the match are vid identifier and portsstr (network port string).

[0072] For example, sub-rule 1 matches the vlanPortTable table string from the original text information. Sub-rule 1 can be expressed as: in: raw; match contains the main fields of vid identifier, (type) type, (ports) network port, and matching variable vlanPortTableStr; next: vlanPortTableStr; outname: vlanPortTable; outmsg: []! {vlanPortTablerow}]; In this embodiment, next is vlanPortTableStr, indicating that the matching variable vlanPortTableStr will be used to continue matching the rule and obtain a new output; outname: vlanPortTable, indicating that the result variable vlanPortTable is assigned the value of outmsg of sub-rule 1; at the same time, the result variable vlanPortTable is used as the usage variable of the SQL statement in the previous main information area; outmsg: [! {vlanPortTableRow}], indicating that the output result is an array composed of the result variable vlanPortTableRow. The input content of sub-rule 2 is the next content of sub-rule 1. Sub-rule 2: Match the content of each row of vlan configuration from the vlanPortTableStr string. in: vlanPortTableStr; match contains the main fields of vid and portsstr (network port string); next; portsstr; outname: vlanPortTablerow; outmsg: {"vid":${vid},"ports":[!{portite m}]}; next, the string to be processed in the next operation, the content is PortStr; the above matched 12 results, so the subsequent 12 PortStr rules are matched. outname, outmsg: sub-rule 2 output variable name. At this time, the output variable vlanPortTable of the previous rule has the following content:

[0073] [vlanPortTableRow1,vlanPortTableRow2,vlanPortTableRow3…,vlanPortTableRow12];

[0074] outmsg:{"VID":${VID},"Ports":[!{PortItem}]}, sub-rule 2 matches the output result, including VID and Ports, where PortItem is the output variable. The next match of PortStr will generate the content of the PortItem output variable and then replace it. At this time, the content of vlanPortTable 2 is as follows:

[0075] [{"vid":1,"ports":[subrule 2.1.!{portitem}]},{"vid":10,"ports":[subrule 2.2.!{portitem}]},…,{"vid":100,"ports":[subrule 2.12.!{portitem}]}]

[0076] S260: Merge the analysis results into configuration information.

[0077] In this embodiment, the parsing results corresponding to one or more sub-rules need to be spliced ​​into the sub-parsing result corresponding to the previous sub-rule in the order of parsing. The parsing results corresponding to each sub-rule in each sub-rule chain need to be merged to output the structured parsing results of the configuration information. It should be noted that since there may be one or more sub-rule chains, and the number of sub-rule questions in each sub-rule chain may be one or more, multiple factors need to be considered when merging the parsing results.

[0078] In this embodiment, if the number of sub-rule chains corresponding to the original text information is one, and the sub-rule contains one or more parsing results, the parsing results corresponding to the sub-rules can be merged in sequence according to the execution order of the corresponding sub-rules in the sub-rule chain, and the merged parsing results can be used as the structured configuration information after parsing; if the number of sub-rule chains corresponding to the original text information is two or more, and the sub-rule contains one or more parsing results, the parsing results corresponding to each sub-rule chain can be spliced ​​according to the identification number corresponding to each sub-rule chain and the preset structured query statement in the preset rule file set, so that the spliced ​​parsing results can be used as the structured configuration information corresponding to the original text information.

[0079] In one embodiment, the analysis results are combined into configuration information, including:

[0080] When there is only one sub-rule chain, the parsing results are sequentially merged into the configuration information according to the execution order of the corresponding sub-rules in the sub-rule chain;

[0081] When the number of sub-rule chains is at least two, determine the identification number corresponding to each sub-rule chain, and splice the parsing results corresponding to each sub-rule chain into the configuration information based on the identification number and the preset structured query statement in the preset rule file set.

[0082] In this embodiment, when the number of sub-rule chains is one, the parsing results can be merged into configuration information in sequence according to the execution order of the corresponding sub-rules in the sub-rule chain; it can be understood that, among the corresponding sub-rules in the sub-rule chain, starting from the first sub-rule, the parsing results corresponding to this sub-rule need to be merged into the parsing results corresponding to the previous sub-rule. For example, the original text information corresponding to a certain model of switch of brand A is a vlanPortTable table, which requires a sub-rule chain for parsing. The sub-rule chain contains sub-rules 1 to sub-rule 2. Starting from the input field information in sub-rule 1, regular expressions are used for matching and parsing. The parsing result corresponding to sub-rule 1 is an array composed of result variables vlanPortTableRow. The next parsing field information corresponding to sub-rule 1 is vlanPortTablestr. The next parsing field information of sub-rule 1 is used as the input of sub-rule 2, and the input field information is matched and parsed using regular expressions. When using regular expressions for parsing, there is no next parsing field information, which means that the parsing has been completed up to sub-rule 2. The parsing result corresponding to sub-rule 2 will be pieced back into sub-rule 1 to form a closed loop.

[0083] In this embodiment, when there are at least two sub-rule chains, the identification numbers corresponding to each sub-rule chain are determined, and the parsed results corresponding to each sub-rule chain are spliced ​​into configuration information based on the identification number and the preset structured query statement in the preset rule file set. It should be noted that the identification number is a unique identification number corresponding to the same network device. For example, the original text information corresponding to a certain model of switch of brand B is two tables: vlanPortTable table and vlanStatusTable table. Sub-rules 1 to 4 are used to parse the vlanPortTable table, and sub-rules 5 to 6 are used to parse the vlanStatusTable table. Sub-rules 1 to 4 all correspond to corresponding sub-results, and each sub-result is backfilled into sub-rule 1 to form a first result; sub-rules 5 to 6 also have corresponding sub-results, and each sub-result is backfilled into sub-rule 5 to form a second result. Then, the first result and the second result are spliced ​​using the vlan unique identification number and the structured query statement to form the final structured information result corresponding to the original text information, that is, the structured configuration information.

[0084] The above-mentioned technical solution of the embodiment of the present invention uses the preset rule file set that successfully matches the information in the main information area with the attribute parameters as the preset rule file set for parsing the original text information, matches the original text information according to the sub-rule chain to determine the parsing result of at least one component sub-rule in the sub-rule chain, and merges the various parsing results into configuration information. New rules can be modified according to actual conditions and added according to new device interaction methods and parsing methods without being hard-coded in the main acquisition program, thereby increasing the scalability and maintainability of the software program.

[0085] In one embodiment, to facilitate a better understanding of the configuration information parsing method, Figure 3 A flowchart of another configuration information parsing method provided by an embodiment of the present invention is provided. Figure 3 This can be used as a preferred embodiment to illustrate a configuration information parsing method. The next field information in this embodiment represents the next parsed field information in the above embodiment.

[0086] like Figure 3 As shown, the configuration information parsing method in this embodiment may specifically include the following steps:

[0087] S310: Search for a matching rule file in the preset rule files according to the device model and configuration command of the network device.

[0088] S320: Use the corresponding field information in the rule file to send the matching ssh command to the network device.

[0089] S330: Obtain original text information returned by the network device.

[0090] S340: Determine a preset rule file set according to the attribute parameters of the original text information.

[0091] S350: Determine the matching mode of the current sub-rule in the centralized parsing of the preset rule file, and output the next text information to be parsed and the sub-parsing result corresponding to the current sub-rule according to the field information corresponding to the current sub-rule.

[0092] S360: If the field information corresponding to the current sub-rule includes the next field information, it indicates that there is new text information to be parsed, and the new sub-rule matching method is used to parse the next text information to be parsed.

[0093] S370: Determine whether the next text information to be parsed is parsed. If so, execute S480; if not, return to execute the new sub-rule matching method to parse the next text information to be parsed.

[0094] S380: Combine the parsing results corresponding to the sub-rules into a structured information result for output.

[0095] In one embodiment, to facilitate a better understanding of the configuration information parsing method, this embodiment uses the network device type of a switch, the brand information of the brand of ××, the model of the model of ccc, and the command configuration information of display vlan as an example for explanation. In this embodiment, in: input content represents the input information field in the above embodiment, match: regular expression represents the matching field information in the above embodiment, next: content to be parsed represents the next parsed field information in the above embodiment, outmsg: the sub-result output this time represents the parsed result corresponding to the current component sub-rule in the above embodiment, outname: the output variable name corresponding to the sub-result output this time represents the parsed result field information corresponding to the sub-rule in the above embodiment. In this embodiment, the original command result content represents the original text information in the above embodiment.

[0096] In this embodiment, a preset rule file set corresponding to the switch is pre-set. The preset rule file set contains two parts: one is the main information area corresponding to the switch, and the other is the rule set corresponding to the content to be parsed. The main information area corresponding to the switch mainly includes: the device type, brand, model, configuration command sent, the variable names of the vlanPortTable and vlanStatusTable tables output by the rule file, and the output operation of the final structured result; the rule set corresponding to the content to be parsed includes: sub-rule 1, sub-rule 2, sub-rule 3, sub-rule 4, sub-rule 5, sub-rule 6, sub-rule 7, and sub-rule 8. It should be noted that the sub-rules in the sub-rule set can be customized by the user according to the actual parsing method.

[0097] In this embodiment, each sub-rule has the following fields, which work together to complete content parsing: in: input content, but raw represents original text information, that is, the content returned by the network device after sending the execution command; it can be the continued parsing content output after other rules are matched, and this field is required in each rule; match: regular expression, used to match in, and extract one or more matching variables, and this field is required in each rule; next: content to continue parsing, which is the matching variable parsed in match, and this field is optional in each rule. There is no next field, which means that the rule does not need to create new matching content for subsequent rule matching; outmsg: the sub-result output this time, which is a json string or an output variable; the json string can include the matching variable in match, or an output variable. The output variable is integrated with the outname obtained after the subsequent next rule matching, and the outmsg corresponding to the content outname, and this field is required in each rule; outname: the output variable name corresponding to the sub-result output this time, used to be integrated into the outmsg of the previous layer.

[0098] Specifically, the configuration information parsing method in this embodiment includes the following steps:

[0099] a1. Collect VLAN information of the ×× brand switch and send the display VLAN configuration command.

[0100] a2. The original text information returned by the ×× brand switch includes vlanPortTable (vlan network port table) and vlanStatusTable (vlan status table).

[0101] In this embodiment, the display vlan command returns two tables: the first table is the VLAN-associated network port table (displaying the network port corresponding to the VLAN ID), and the second is the VLAN status table (displaying whether the VLAN is up or down). The two tables are associated based on the VID.

[0102] a3. Set the main information area configuration corresponding to the network device.

[0103] In this embodiment, the switch's corresponding main information area is configured as follows based on the display vlan command: device type devType: switch; brand brand: Brand A; model models: 5700. The command is sent: display vlan; in (vlanPortTable and vlanStatusTable table names), where vlanPortTable and vlanStatusTable are the two output variables. The specific contents of these two output variables, outmsg, are generated by matching other rules described below. The output operation outOp (used for outputting the final result) is a SQL statement that performs an external join between the vlanPortTable and vlanStatusTable tables based on the VID.

[0104] a4. Determine the rule set of the content to be parsed, and perform multiple matching rules on the input content based on the rule set of the content to be parsed to obtain corresponding sub-parsing results, and assemble and output the sub-parsing results.

[0105] In this embodiment, sub-rules 1 to 6 in the preset rule file set are used to parse vlanPortTable (vlan network port table), and sub-rules 7 to 8 are used to parse vlanStatusTable (vlan status table).

[0106] Sub-Rule 1: Matches the vlanPortTable table string from the original text. The fields corresponding to Sub-Rule 1 are: input field information is represented by "in", match field information is represented by "match", next parsed field information is represented by "next", the output variable name corresponding to the parsed result of Sub-Rule 1 is represented by "outname", and the parsed result field information corresponding to Sub-Rule 1 is represented by "outmsg". Sub-Rule 1 can be represented as: in: raw; match contains the main fields of vid, (type), (ports), and the matching variable vlanPortTableStr; next: vlanPortTableStr; outname: vlanPortTable; outmsg: []! {vlanPortTablerow}]; In this embodiment, the match regular expression is used to match the vid, (type), and (ports) in the original text to obtain the matching variable vlanPortTableStr. vlanPortTableStr only matches one result. The value assigned to next is vlanPortTableStr, indicating that the matching variable vlanPortTableStr will be used to match the rule and obtain new output. outname:vlanPortTable indicates that the result variable vlanPortTable uses the value assigned to outmsg in this rule. This result variable vlanPortTable is also used as a reference variable in the SQL statement in the previous main information area. outmsg:[!{vlanPortTableRow}] indicates that the output result is an array consisting of the result variable vlanPortTableRow. The content of the vlanPortTableRow result variable is generated by the subsequent content of next in the rule matching.

[0107] In this embodiment, the input content of sub-rule 2 is the next content of sub-rule 1.

[0108] Sub-rule 2: Matches each row of VLAN configuration from the vlanPortTableStr string. in: vlanPortTableStr; match contains the vid identifier and portsstr (network port string); next: portsstr; outname: vlanPortTablerow; outmsg: {“vid”: ${vid},”ports”: [! {portitem}]}; the input is vlanPortTableStr, which is the content of next in sub-rule 1; match is a regular expression, which is matched according to the input content. If the match is successful, the VID and PortStr are extracted according to the regular expression; a total of 12 results are matched from vlanPortTableStr; in each result, the number in front of the VID result and the PortStr content are the content after COMMON of each result; since 12 results are matched, next, outname, and outmsg have 12 different values ​​at this time; next, identifies the string to be processed in the next operation, and the content is PortStr; 12 results are matched above, and the subsequent rule matching of 12 PortStrs is performed, outname, identifies the output variable name of this outmsg, where outname is vlanPortTableRow, indicating that the output of the previous match will be matched and replaced according to the variable name; the last output was 15 lines of outmsg:[! {vlanPortTableRow}], this time 12 results are matched, and the 12 results outmsg output of this match will be placed in line 15 outmsg: [! {vlanPortTableRow}] according to the name vlanPortTableRow; at this time, the output variable vlanPortTable of the previous rule is as follows: [vlanPortTableRow1, vlanPortTableRow2, vlanPortTableRow3…, vlanPortTableRow12]; outmsg: {"VID":${VID},"Ports":[! {PortItem}]}, the result content output by this rule match includes VID and Ports, where PortItem is the output variable, which will be replaced by the content of the PortItem output variable generated by the next match of PortStr; at this time, the content of vlanPortTable 2 is as follows:

[0109] [{"vid":1,"ports":[zRule 2.1.!{portitem}]},{"vid":10,"ports":[zRule 2.2.!{portitem}]},…,{"vid":100,"ports":[zRule 2.12.!{portitem}]}]

[0110] Sub-rule 3: Get the UT type string from PortsStr. There are two types of PortsStr, one is Untagged, expressed in the format of 'UT:XX XX XX'; the other is tagged, expressed in the format of 'GT:XX XXXX'; Sub-rule 3: Get the untagged type Port string, Sub-rule 4: Get the tagged type Port string; in: portsstr; match: match the ut type string (utportstr); next: utportstr; outmsg:! {portitem}; outname: portitem; The rule matches the input PortStr, PortStr is the output of the previous rule 2; regular expression, used to match the content after UT: in PortStr, the matching variable is UTPortStr; UTPortStr matches 1 result, which is the string after UT:; next: UTPortStr, indicating that the next match is the result of the matched UTPortStr string; outmsg, using the result variable UTPortItem, which is generated by subsequent matches; outname: PortItem, indicating that the matching result outmsg of this rule is assigned to PortItem;

[0111] After matching, the content of vlanPortTable 3 is:

[0112] [{"vid":1,"ports":[rule 2.1.!{utportitem},…,rule 2.1.!{PortItem}]},{"vid":10,"ports":[rule 2.2.!{utportitem},…,rule 2.1.!{PortItem}]},…,{"vid":100,"ports":[rule 2.12.!{utportitem},…,rule 2.1.!{PortItem}]}].

[0113] Rule 4: Get UTPortItem from UTPortStr, in: utportstr; match: match portname, portstatus; outmsg: {"portname": ${portname}, "portstatus": ${portstatus}, "porttype": "untagged"}; outname: UTPortItem; This rule has no next, indicating that the last rule is the final format match; UTPortStr is input, which is the next in rule 3; regular expression matching, get the matching variables PortName and PortStatus,

[0114] Output variable content: JSON-formatted characters containing matching variables; output variable name, replaces the output variable UTPortItem above. After matching, the vlanPortTable content 4 is: {"vid":1,"ports":[{"portname":"ge1 / 0 / 1,""portstatus":"u","porttype":"untagged"},…,{"portname":"ge1 / 0 / 48,"portstatus":"d","porttype":"untagged"},Rule 2.1!{portitem}]…}

[0115] Similarly, use rules 5 and 6 to obtain TGPort information;

[0116] Rule 5: Get the TG type string TGPortsStr from PortsStr. This rule matches the input PortsStr, which is the content of next in Rule 2; matches the string after the output TG:; matches the variable TGPortsStr; the next match is TGPortsStr; the output content is TGPortItem, which is supplemented by subsequent regular expression matches; the output variable name is PortItem, which is used to fill TGPortItem into the PortItem in outmsg in Rule 2; after matching, the content of vlanPortTable 5 is: {"vid":1,"ports":[{"portname":"ge1 / 0 / 1","portstatus":"u","porttype":"vid-untagged"},…,{"portname":"ge1 / 0 / 48","portstatus":"d","porttype":"untag ged"},Rule 2.1! {tgportitem}]…}

[0117] Rule 6: Get TGPortItem from TGPortsStr. This rule has no next, indicating that the last rule is the final format match. The input TGPortStr is the next in Rule 5. The regular expression is matched to obtain the matching variables PortName and PortStatus. The output variable content: JSON format characters containing matching variables. The output variable name replaces the output variable TGPortItem above. After matching, the content of vlanPortTable 6 is:

[0118] {"vid":1,"ports":[{"portname":"ge1 / 0 / 1",""portstatus":"u","porttype":"untagged"},…,{"portname":"ge1 / 0 / 48","portstatus":"d","porttype":"untagged"}…}

[0119] Integrate the sub-results corresponding to rule 1 and rule 6 to form the first result.

[0120] Rule 7: Match the vlanStatusTable string from the original command result. The in input matches the original command result, and the regular expression matches. The matching variable is vlanStatusTableStr. The output next is vlanStatusTableStr, and the outname is vlanStatusTable, which is used as the variable in the SQL statement in the main information area above. The output format is represented by the [] array.

[0121] After matching, the content of vlanStatusTable is: [vlanstatustalebow1,…]

[0122] Rule 8: Matches the VLAN status content of each row in the vlanStatusTableStr string. Since this rule has no next clause, it is the last matching rule and no subsequent matches occur. The input is vlanStatusTableStr, and the regular expression matches the VID, status, and description in vlanStatusTableStr.

[0123] 12 results can be matched; outname is vlanStatusTableRow, so the content of vlanStatusTable 1 is:

[0124] [vlanstatustalebow1,…vlanstatustalebow12], outmsg outputs a string in jso format. The json string uses the variables VID, Status, and Description from this match. After matching, the content of vlanStatusTable 2 is: [{"vid":1,"status":"enable","desciption":"vlan 0001"},…,{"vid":1000,"status":"enable","desciption":"1ds"}]

[0125] Complete the parsing of VlanStatusTable using the above rules. Integrate vlanStatusTable content 2 into vlanStatusTable content 1 to form the second result corresponding to rules 7 and 8.

[0126] The first result and the second result are identified by vid id and the set SQL statement, and the first result and the second result are put together to output the total result.

[0127] In one embodiment, Figure 4 This is a structural block diagram of a configuration information parsing device provided in one embodiment of the present invention. The device is suitable for parsing the configuration information of a network device. The device can be implemented by hardware / software. It can be configured in an electronic device to implement a configuration information parsing method in an embodiment of the present invention. Figure 4 As shown, the device includes: an information acquisition module 410, a determination module 420, and a parsing module 430.

[0128] The information acquisition module 410 is used to obtain the original text information returned by the network device;

[0129] A determination module 420 is configured to determine a preset rule file set based on the attribute parameters of the original text information;

[0130] The parsing module 430 is configured to parse the configuration information of the original text information according to the parsing rules of the preset rule file set.

[0131] In the embodiment of the present invention, the determination module determines the preset rule file set through the attribute parameters corresponding to the original text information, and the parsing module parses the configuration information of the original text information through the parsing rules of the preset rule file set. New rule files can be added according to new network device interaction methods and parsing methods, and the rule files can be modified according to actual conditions, thereby increasing the scalability and maintainability of the software program.

[0132] In one embodiment, the determination module 420 includes:

[0133] An information reading unit, configured to read a main information area corresponding to at least one of the preset rule file sets;

[0134] a matching unit, configured to match the device model and configuration command in the attribute parameters with the information in each of the main information areas;

[0135] The parsing file determining unit is configured to use the preset rule file set that successfully matches the information in the main information area with the attribute parameters as the preset rule file set for parsing the original text information.

[0136] In one embodiment, the parsing rule includes at least one sub-rule chain, and the parsing module 430 includes:

[0137] a result determination unit, configured to match the original text information according to the sub-rule chain to determine a parsing result of at least one constituent sub-rule in the sub-rule chain;

[0138] A merging unit is used to merge the analysis results into the configuration information.

[0139] In one embodiment, the corresponding field information in the constituent sub-rules includes at least one of the following:

[0140] Input field information, matching field information, next parsing field information, output variable names corresponding to each parsing result, and parsing result field information corresponding to each sub-rule.

[0141] In one embodiment, the result determination unit includes:

[0142] a first text determination subunit, configured to determine a first component sub-rule of the sub-rule chain as a current component sub-rule and to use the original text information as a parsed text, wherein the first component sub-rule is located at the head of the sub-rule chain;

[0143] A result determination subunit, configured to match the matching field information of the current constituent sub-rule with the parsed text to determine the parsing result and record the parsing result as the new parsed text, wherein the matching field information includes a regular expression;

[0144] a rule search subunit, configured to search for a second component sub-rule in the sub-rule chain according to the next parsed field information of the current component sub-rule;

[0145] a result determination subunit, configured to, if the second component sub-rule is obtained, continue to determine the parsing result by using the second component sub-rule as the current component sub-rule;

[0146] The determination subunit is configured to determine whether the sub-rule chain completes matching if the second component sub-rule is not obtained.

[0147] In one embodiment, the merging unit includes:

[0148] a first merging subunit, configured to, when there is only one sub-rule chain, sequentially merge the parsing results into the configuration information according to the execution order of the corresponding component sub-rules in the sub-rule chain;

[0149] The second merging sub-unit is used to determine the identification number corresponding to each sub-rule chain when the number of the sub-rule chains is at least two, and to splice the parsing results corresponding to each sub-rule chain into the configuration information based on the identification number and the preset structured query statement in the preset rule file set.

[0150] In one embodiment,

[0151] The preset rule file set includes at least one sub-rule chain and a main information area corresponding to the network device;

[0152] The main information area includes at least one of the following: device type, brand information, model information, sent configuration commands, output variable information corresponding to the text information to be parsed, and structured information results corresponding to the network device;

[0153] The preset rule file set includes at least one sub-rule chain, and the field information corresponding to each sub-rule in each sub-rule chain includes at least one of the following: input field information, matching field information, next parsing field information, output variable name corresponding to each parsing result, and parsing result field information corresponding to each sub-rule.

[0154] The configuration information parsing device provided in the embodiment of the present invention can execute the configuration information parsing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0155] In one embodiment, Figure 5 A schematic diagram of the structure of an electronic device provided for one embodiment of the present invention. The electronic device 10 is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (such as helmets, glasses, watches, etc.) and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or claimed herein.

[0156] like Figure 5 As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., which is communicatively connected to the at least one processor 11. The memory stores a computer program that can be executed by the at least one processor. The processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 into the random access memory (RAM) 13. Various programs and data required for the operation of the electronic device 10 can also be stored in the RAM 13. The processor 11, ROM 12, and RAM 13 are connected to each other via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0157] Multiple components in the electronic device 10 are connected to the I / O interface 15, including an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a magnetic disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices via a computer network such as the Internet and / or various telecommunication networks.

[0158] The processor 11 can be any general-purpose and / or specialized processing component with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various specialized artificial intelligence (AI) computing chips, various processors that run machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the configuration information parsing method.

[0159] In some embodiments, the configuration information parsing method may be implemented as a computer program that is tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the configuration information parsing method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the configuration information parsing method in any other appropriate manner (e.g., by means of firmware).

[0160] Various embodiments of the systems and techniques described herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), system-on-chip systems (SOCs), programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments can include being implemented in one or more computer programs that are executable and / or interpreted on a programmable system that includes at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.

[0161] Computer programs for implementing the methods of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable configuration information parsing device, so that when executed by the processor, the functions / operations specified in the flowcharts and / or block diagrams are implemented. The computer programs can be executed entirely on the machine, partially on the machine, as a stand-alone software package, partially on the machine and partially on a remote machine, or entirely on a remote machine or server.

[0162] In the context of the present invention, computer-readable storage media can be tangible media that can contain or store a computer program for use with an instruction execution system, device or equipment or used in combination with an instruction execution system, device or equipment. Computer-readable storage media can include but are not limited to electronic, magnetic, optical, electromagnetic, infrared or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, computer-readable storage media can be machine-readable signal media. More specific examples of machine-readable storage media can include electrical connections based on one or more lines, portable computer disks, hard disks, random access memories (RAM), read-only memories (ROM), erasable programmable read-only memories (EPROM or flash memory), optical fibers, portable compact disk read-only memories (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination of the foregoing.

[0163] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).

[0164] The systems and techniques described herein can be implemented in a computing system that includes back-end components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes front-end components (e.g., a user computer with a graphical user interface or web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such back-end components, middleware components, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.

[0165] A computing system may include clients and servers. The clients and servers are typically remote from each other and typically interact via a communication network. This client-server relationship arises through computer programs running on the respective computers, creating a client-server relationship. The server may be a cloud server, also known as a cloud computing server or cloud host. This server is a hosting product within the cloud computing service ecosystem that addresses the management difficulties and limited scalability of traditional physical hosting and VPS services.

[0166] It should be understood that the various forms of the processes shown above can be used to reorder, add, or delete steps. For example, the steps described in the present invention can be performed in parallel, sequentially, or in a different order, as long as the desired results of the technical solution of the present invention can be achieved. This is not limited herein.

[0167] The above specific embodiments do not limit the scope of protection of the present invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions may be made based on design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of the present invention are intended to be included within the scope of protection of the present invention.

Claims

1. A configuration information parsing method, characterized in that: include: Get the original text information returned by the network device; Determining a preset rule file set according to the attribute parameters of the original text information; Parsing the configuration information of the original text information according to the parsing rules of the preset rule file set; The preset rule file contains a main information area corresponding to the network device and sub-rules constituting at least one sub-rule chain, each sub-rule being used to match and parse corresponding input field information; The step of determining a preset rule file set according to the attribute parameters of the original text information includes: Reading a main information area corresponding to at least one of the preset rule file sets; Matching the device model and configuration command in the attribute parameters with the information in each of the main information areas; The preset rule file set that successfully matches the information in the main information area with the attribute parameters is used as the preset rule file set for parsing the original text information.

2. The method according to claim 1, characterized in that The parsing rule includes at least one sub-rule chain, and the configuration information of parsing the original text information according to the parsing rule of the preset rule file set includes: Matching the original text information according to the sub-rule chain to determine a parsing result of at least one constituent sub-rule in the sub-rule chain; The analysis results are combined into the configuration information.

3. The method according to claim 2, wherein the corresponding field information in the constituent sub-rules includes at least one of the following: Input field information, matching field information, next parsing field information, output variable names corresponding to each parsing result, and parsing result field information corresponding to each sub-rule.

4. The method according to claim 2, characterized in that The matching the original text information according to the sub-rule chain to determine a parsing result of at least one constituent sub-rule in the sub-rule chain includes: Determining a first component sub-rule of the sub-rule chain as a current component sub-rule and using the original text information as parsed text, wherein the first component sub-rule is located at the head of the sub-rule chain; Matching the matching field information of the current component sub-rule with the parsed text to determine the parsing result and recording the parsing result as the new parsed text, wherein the matching field information includes a regular expression; Searching for a second component sub-rule in the sub-rule chain according to the next parsed field information of the current component sub-rule; If the second component sub-rule is obtained, the second component sub-rule is used as the current component sub-rule to continue determining the parsing result; If the second component sub-rule is not obtained, it is determined that the sub-rule chain completes the matching.

5. The method according to claim 2, characterized in that The combining of the analysis results into the configuration information includes: In the case where the number of the sub-rule chain is one, the parsing results are sequentially merged into the configuration information according to the execution order of the corresponding component sub-rules in the sub-rule chain; When the number of sub-rule chains is at least two, determine the identification number corresponding to each sub-rule chain, and splice the parsing results corresponding to each sub-rule chain into the configuration information based on the identification number and the preset structured query statement in the preset rule file set.

6. The method according to claim 1, characterized in that The preset rule file set includes at least one sub-rule chain and a main information area corresponding to the network device; The main information area includes at least one of the following: device type, brand information, model information, sent configuration commands, output variable information corresponding to the text information to be parsed, and structured information results corresponding to the network device; The preset rule file set includes at least one sub-rule chain, and the field information corresponding to each sub-rule in each sub-rule chain includes at least one of the following: input field information, matching field information, next parsing field information, output variable name corresponding to each parsing result, and parsing result field information corresponding to each sub-rule.

7. A configuration information analysis device, characterized in that: include: An information acquisition module is used to obtain the original text information returned by the network device; A determination module, configured to determine a preset rule file set based on attribute parameters of the original text information; A parsing module, configured to parse the configuration information of the original text information according to the parsing rules of the preset rule file set; The preset rule file contains a main information area corresponding to the network device and sub-rules constituting at least one sub-rule chain, each sub-rule being used to match and parse corresponding input field information; Wherein, the determination module includes: An information reading unit, configured to read a main information area corresponding to at least one of the preset rule file sets; a matching unit, configured to match the device model and configuration command in the attribute parameters with the information in each of the main information areas; The parsing file determining unit is configured to use the preset rule file set that successfully matches the information in the main information area with the attribute parameters as the preset rule file set for parsing the original text information.

8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the configuration information parsing method according to any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the configuration information parsing method according to any one of claims 1 to 6 when executed.

Citation Information

Patent Citations

  • Data processing method and apparatus, electronic device and storage medium

    CN109672562A

  • Data acquisition method and device and storage medium

    CN110912782A