CN112822031A - Network equipment configuration file analysis method and device - Google Patents

Network equipment configuration file analysis method and device Download PDF

Info

Publication number
CN112822031A
CN112822031A CN201911127170.5A CN201911127170A CN112822031A CN 112822031 A CN112822031 A CN 112822031A CN 201911127170 A CN201911127170 A CN 201911127170A CN 112822031 A CN112822031 A CN 112822031A
Authority
CN
China
Prior art keywords
configuration
information
item information
configuration item
command set
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201911127170.5A
Other languages
Chinese (zh)
Inventor
王建
宋蓬
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhongying Youchuang Information Technology Co Ltd
Original Assignee
Zhongying Youchuang Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhongying Youchuang Information Technology Co Ltd filed Critical Zhongying Youchuang Information Technology Co Ltd
Priority to CN201911127170.5A priority Critical patent/CN112822031A/en
Publication of CN112822031A publication Critical patent/CN112822031A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0876Aspects of the degree of configuration automation
    • H04L41/0886Fully automatic configuration
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/42Syntactic analysis
    • G06F8/427Parsing
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files
    • G06F9/4451User profiles; Roaming
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0813Configuration setting characterised by the conditions triggering a change of settings
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/2866Architectures; Arrangements
    • H04L67/30Profiles

Abstract

The invention discloses a method and a device for analyzing a configuration file of network equipment, wherein the method comprises the following steps: decomposing a configuration file of the network equipment into a plurality of configuration item information; analyzing and processing the configuration item information according to different modes to obtain a configuration command set; updating the configuration command set according to the configuration file of the network equipment; and analyzing the configuration file content of each network device according to the updated configuration command set, and analyzing the configuration file content into metadata of the configuration information of the network device. The invention can automatically respond to the change of the telecommunication operator network without the help of the professional knowledge of network experts, once the telecommunication operator network changes, a series of work such as modification, test and the like can be automatically carried out on the existing configuration file analysis program, no manual intervention is needed all the time, the labor cost is low, and the working efficiency is high.

Description

Network equipment configuration file analysis method and device
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method and an apparatus for parsing a configuration file of a network device.
Background
At present, the stable and efficient operation of a telecommunication operator network depends on the normal operation of each network device, and the normal operation of the network device depends on the content of a configuration file of the network device, so that the configuration file is generally analyzed for the subsequent functions of front-end presentation and statistical analysis.
In the prior art, when a configuration file is analyzed, a network expert needs to provide a configuration command and a grammar rule of a network device by the aid of professional knowledge of the network expert. And the programmer extracts the metadata of the configuration information of the network equipment in a programming mode according to the configuration command and the grammar rule thereof, and completes the analysis of the configuration file for subsequent front-end presentation and statistical analysis functions.
The inventor finds that the prior art has at least the following problems:
the method used by the prior art cannot automatically respond to the change of the telecommunication operator network, such as the network access of new manufacturer equipment, or the change of configuration file grammar rules caused by the software upgrade of network equipment, and the like. Once the situation occurs, a network expert needs to reorganize the change of the grammar rules of the configuration files of the network equipment, and a series of work such as modification and testing is carried out on the existing analysis programs of the configuration files, so that the working efficiency is low, and the labor cost is high.
Disclosure of Invention
The embodiment of the invention provides a method for analyzing a configuration file of network equipment, which is used for reducing labor cost and improving working efficiency and comprises the following steps:
decomposing a configuration file of the network equipment into a plurality of configuration item information;
analyzing and processing the configuration item information according to different modes to obtain a configuration command set;
updating the configuration command set according to the configuration file of the network equipment;
and analyzing the configuration file content of each network device according to the updated configuration command set, and analyzing the configuration file content into metadata of the configuration information of the network device.
Optionally, analyzing and processing the configuration item information according to different modes to obtain a configuration command set, including:
judging the levels of a plurality of configuration item information;
and analyzing and processing the configuration item information of the same level according to different modes to obtain a configuration command set.
Optionally, each configuration entry information includes at least one line of text information;
judging the level of a plurality of configuration item information, comprising:
acquiring line head indentation information of text information in each configuration item information;
and judging the levels of the plurality of configuration item information according to the line head indentation information.
Optionally, the determining the levels of the multiple configuration entry information according to the line head indentation information includes:
judging the size relationship of a plurality of line head indentation information;
taking the configuration item information with the same line head indentation information as the configuration item information of the same level;
and taking the configuration item information with larger line head indentation as the upper-level configuration item information and taking the configuration item information with smaller line head indentation as the lower-level configuration item information.
Optionally, analyzing and processing the configuration item information of the same level according to different modes to obtain a configuration command set, including:
splitting the configuration item information of the same level into a plurality of vocabulary information according to a preset rule, and acquiring word mode information of the configuration item information according to the vocabulary information;
acquiring row mode information of configuration item information according to the word mode information;
taking the first word information in the configuration item information as an anchor point, and grouping the configuration item information at the same level according to the anchor point, the word mode information and the line mode information;
comparing the configuration item information in the same group word by word, and generating a configuration command according to the comparison result;
and acquiring a configuration command set according to the configuration commands generated by the plurality of different groups of configuration item information.
Optionally, analyzing the content of the configuration file of each network device according to the updated configuration command set, including:
and according to the updated configuration command set, sequentially processing the configuration file content of each network device, and marking the content of each configuration file information with a corresponding configuration command.
The embodiment of the invention also provides a device for analyzing the configuration file of the network equipment, which is used for reducing the labor cost and improving the working efficiency and comprises the following components:
the decomposition module is used for decomposing the configuration file of the network equipment into a plurality of configuration item information;
the analysis processing module is used for analyzing and processing the configuration item information according to different modes to obtain a configuration command set;
the updating module is used for updating the configuration command set according to the configuration file of the network equipment;
and the analysis module is used for analyzing the configuration file content of each network device according to the updated configuration command set and analyzing the configuration file content into metadata of the configuration information of the network devices.
Optionally, the analysis processing module is further configured to:
judging the levels of a plurality of configuration item information;
and analyzing and processing the configuration item information of the same level according to different modes to obtain a configuration command set.
Optionally, each configuration entry information includes at least one line of text information;
the analysis processing module is further configured to:
acquiring line head indentation information of text information in each configuration item information;
and judging the levels of the plurality of configuration item information according to the line head indentation information.
Optionally, the analysis processing module is further configured to:
judging the size relationship of a plurality of line head indentation information;
taking the configuration item information with the same line head indentation information as the configuration item information of the same level;
and taking the configuration item information with larger line head indentation as the upper-level configuration item information and taking the configuration item information with smaller line head indentation as the lower-level configuration item information.
Optionally, the analysis processing module is further configured to:
splitting the configuration item information of the same level into a plurality of vocabulary information according to a preset rule, and acquiring word mode information of the configuration item information according to the vocabulary information;
acquiring row mode information of configuration item information according to the word mode information;
taking the first word information in the configuration item information as an anchor point, and grouping the configuration item information at the same level according to the anchor point, the word mode information and the line mode information;
comparing the configuration item information in the same group word by word, and generating a configuration command according to the comparison result;
and acquiring a configuration command set according to the configuration commands generated by the plurality of different groups of configuration item information.
Optionally, the parsing module is further configured to:
and according to the updated configuration command set, sequentially processing the configuration file content of each network device, and marking the content of each configuration file information with a corresponding configuration command.
The embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the method when executing the computer program.
An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program for executing the above method is stored.
In the embodiment of the invention, the configuration file of the network equipment is decomposed into a plurality of pieces of configuration item information, the configuration item information is analyzed and processed according to different modes to obtain the configuration command set, the configuration command set is updated according to the configuration file of the network equipment, the content of the configuration file of each network equipment is analyzed and processed according to the updated configuration command set, the content of the configuration file is analyzed into the metadata of the configuration information of the network equipment, the change of a telecommunication operator network can be automatically responded without the help of professional knowledge of network experts, once the telecommunication operator network changes, a series of work such as modification, test and the like can be automatically carried out on the existing configuration file analysis program, no manual intervention is needed all the time, the labor cost is low, and the work efficiency is high.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the drawings without creative efforts. In the drawings:
FIG. 1 is a flowchart of a method for parsing a configuration file of a network device according to an embodiment of the present invention;
fig. 2 is a schematic structural diagram of a network device profile parsing apparatus in an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention more apparent, the embodiments of the present invention are further described in detail below with reference to the accompanying drawings. The exemplary embodiments and descriptions of the present invention are provided to explain the present invention, but not to limit the present invention.
First, terms related to embodiments of the present invention are described:
a network device: the network equipment refers to physical entities forming a telecommunication operator network and mainly comprises a switch, a broadband remote access server, a router and the like. Modern telecom operator networks consist of thousands of network devices.
Configuration files: a file on the network device records various configuration parameters of the network device, and is important for the normal operation of the network device. The contents of the configuration file relate to aspects of the operation of the network device including clock configuration, AAA (authentication, authorization, accounting) configuration, device port configuration, VPN (virtual private network) traffic configuration, routing settings, and the like. The profile contents of switches, broadband remote access servers, include thousands of lines of text data, while the profile of backbone routers often includes tens of thousands of lines of text data.
Fig. 1 is a flowchart illustrating a method for parsing a configuration file of a network device according to an exemplary embodiment of the present invention, where as shown in fig. 1, the method includes:
step 101, decomposing the configuration file of the network equipment into a plurality of configuration item information.
And 102, analyzing and processing the configuration item information according to different modes to obtain a configuration command set.
In this embodiment, step 102 includes: judging the levels of a plurality of configuration item information;
and analyzing and processing the configuration item information of the same level according to different modes to obtain a configuration command set.
Each configuration item information comprises at least one line of text information;
judging the level of a plurality of configuration item information, comprising:
acquiring line head indentation information of text information in each configuration item information;
and judging the levels of the plurality of configuration item information according to the line head indentation information.
Specifically, the determining the level of the plurality of configuration entry information according to the first line indentation information includes:
judging the size relationship of a plurality of line head indentation information;
taking the configuration item information with the same line head indentation information as the configuration item information of the same level;
and taking the configuration item information with larger line head indentation as the upper-level configuration item information and taking the configuration item information with smaller line head indentation as the lower-level configuration item information.
In specific implementation, the configuration entry information includes simple configuration entry information and complex configuration entry information, wherein the simple configuration entry information is composed of a line of text. In the following, consider the configuration file of a router as an example, the configuration files of network devices of other manufacturers may be processed similarly, and the configuration items of the device are:
sysname XX-XX-XX-X-X.XXX;
where X refers to a specific configuration entry value, which is handled as follows.
The complex configuration entry information includes a plurality of next-level configuration entries, and the next-level configuration entries may further include a plurality of next-level configuration entries, and so on. The levels of the texts are distinguished by the line head contraction of the texts, the same configuration items are contracted by the line heads, and the levels are the same; the line head is slightly indented, the hierarchy is lowered by one level, and the upper level configuration entry which belongs to the nearest neighbor of the line head is subordinate to the hierarchy. For example, bgp (border gateway protocol) configuration entry:
Figure BDA0002277228530000051
Figure BDA0002277228530000061
among them, the configuration items such as router-id, as-path-limit, peer. However, the head of line indentation of the configuration entries is larger than that of the bgp, so that the hierarchy is one level lower than the hierarchy of the bgp and is subordinate to the bgp. And, according to a similar analysis, network.
The above-mentioned bgp configuration entry can be represented by a tree diagram, and can be segmented according to spaces because it is an english text.
Based on the above, analyzing and processing the configuration item information of the same level according to different modes to obtain a configuration command set, including:
splitting the configuration item information of the same level into a plurality of vocabulary information according to a preset rule, and acquiring word mode information of the configuration item information according to the vocabulary information;
acquiring row mode information of configuration item information according to the word mode information;
taking the first word information in the configuration item information as an anchor point, and grouping the configuration item information at the same level according to the anchor point, the word mode information and the line mode information;
comparing the configuration item information in the same group word by word, and generating a configuration command according to the comparison result;
and acquiring a configuration command set according to the configuration commands generated by the plurality of different groups of configuration item information.
In specific implementation, the content of the configuration file is extracted as a configuration entry tree according to the level and the dependency relationship. Taking a blank space as a separator, splitting the content of the configuration entry into a plurality of words, and analyzing the word patterns of the words, such as: IPv4 addresses, IPv6 addresses, pure numbers, combinations of english and arabic numbers, whether special characters are included (e.g., #, $), and the like. Further, the word pattern of each word, the word number of each configuration item, and the like are analyzed to obtain the "line pattern".
And regarding the configuration items of the same level, taking the first word of the configuration items as an anchor point. Analyzing according to a line mode and a word mode, grouping the contents with the same anchor points and the same mode into a group, carrying out word-by-word comparison on configuration items in the same group, taking the same contents as configuration commands, and acquiring a configuration command set according to the configuration commands generated by the information of the configuration items in a plurality of different groups.
The following are exemplary:
for configuration entry sysname XJ-SHZ-ZXJ-S-5, there are no other configuration entries in the configuration file that are at the same level and have the same anchor point and the same line pattern, so sysname XJ-SHZ-ZXJ-S-5 is directly extracted as a configuration command;
bgp 1234
undo default ipv4-unicast
timer keepalive 30hold 90
peer 121.171.212.222as-number 12345
peer 121.171.212.222description FOR-USER1
peer 159.243.16.27as-number 1234
peer 159.243.16.27description FOR-USER2
......;
for the timer keepalive 30hold 90, directly identifying 30 and 90 as configuration command values according to word modes, and extracting the timer keepalive as a configuration command;
for the 4 configuration items at the beginning of the peer, the configuration items are divided into two groups according to the line mode and the word mode, wherein the first group is as follows:
peer 121.171.212.222as-number 12345
peer 159.243.16.27as-number 1234
the mode is as follows: the peer/ipv4 address/word/value are compared, and the configuration command can be extracted as: as-number.
The second group is:
peer 121.171.212.222description FOR-USER1
peer 159.243.16.27description FOR-USER2
the mode is as follows: the peer/ipv4 address/word is compared, and the configuration command can be extracted as: ..
Adopting a longest matching principle:
interface GigabitEthernet1/2/3.1234
vlan-type dot1q 1234
description For USER1 VPN12345A 50M-T
ip binding vpn-instance VPN12345
ip address 1.2.3.4 255.255.255.252
traffic-policy t_p12345A-50M-in inbound
traffic-policy t_p12345A-50M-out outbound
qos-profile q_p12345A-50M-in.p inbound identifier none
qos-profile q_p12345A-50M-out.p outbound identifier none
statistic enable
#
interface GigabitEthernet1/2/3.2345
vlan-type dot1q 2345
description For USER1 VPN12345A 100M-N
ip binding vpn-instance VPN12345
ip address 1.2.3.5 255.255.255.252
traffic-policy t_p12345A-100M-in inbound
traffic-policy t_p12345A-100M-out outbound
user-queue cir 102400pir 102400inbound
user-queue cir 102400pir 102400flow-queue fq12345A-100M-out outbound
statistic enable
when analyzing the next level configuration entries of interface gigabit Ethernet1/2/3.1234, interface gigabit Ethernet1/2/3.2345, the following are grouped into one group as follows:
traffic-policy t_p12345A-50M-in inbound
traffic-policy t_p12345A-50M-out outbound
traffic-policy t_p12345A-100M-in inbound
traffic-policy t_p12345A-100M-out outbound
according to the principle of longest match, the method is further divided into two groups as shown in table 1:
TABLE 1
Figure BDA0002277228530000081
Two configuration commands are extracted: the traffic-policy.
And 103, updating the configuration command set according to the configuration file of the network equipment.
In this embodiment, a configuration file of a network device is selected and analyzed from the configuration file of the network device. After the configuration file of the network device is analyzed, the obtained configuration command set of the network device may be incomplete, and some misjudgments may also exist. On this basis, the configuration file of the next network device is continuously processed, so that the configuration command set of the network device acquired before is supplemented and corrected. This continues until all configuration files have been processed, resulting in a complete and accurate set of device configuration commands.
As an example, for the configuration command sysname XJ-SHZ-ZXJ-S-5, when analyzing another network device configuration file, the configuration entry with the same level and the same mode is sysname XJ-SHZ-ZXJ-S-1, and the two are compared according to the above method, so as to update the configuration command sysname XJ-SHZ-ZXJ-S-5 to sysname.
And 104, analyzing the configuration file content of each network device according to the updated configuration command set, and analyzing the configuration file content into metadata of the configuration information of the network devices.
In this embodiment, step 104 includes: and according to the updated configuration command set, sequentially processing the configuration file content of each network device, and marking the content of each configuration file information with a corresponding configuration command.
For example, the configuration entry of a network device configuration file is sysname XJ-SZZ-ZXJ-S-8, the configuration command corresponding to the configuration entry is marked as sysname according to the network device configuration command set, and XJ-SZZ-ZXJ-S-8 is marked as the parameter value of the configuration command sysname. It should be noted that some configuration commands are parameter-free, such as the static enable command exemplified above.
As can be seen from fig. 1, in the method for parsing a configuration file of a network device according to an embodiment of the present invention, a configuration file of a network device is decomposed into a plurality of pieces of configuration entry information, the pieces of configuration entry information are analyzed and processed according to different modes to obtain a configuration command set, the configuration command set is updated according to a configuration file of the network device, and then the content of the configuration file of each network device is parsed according to the updated configuration command set, so that the content of the configuration file is parsed into metadata of the configuration information of the network device, a change of a network of a telecommunication operator can be automatically responded without using professional knowledge of a network expert, once the network of the telecommunication operator changes, a series of operations such as modification and testing of an existing configuration file analysis program can be automatically performed by the method, without manual intervention from beginning to end, and with low labor cost, the working efficiency is high.
Based on the same inventive concept, the embodiment of the present invention further provides a text file configuring apparatus, as described in the following embodiments. Because the principle of the text file configuration device for solving the problems is similar to the text file configuration method, the implementation of the text file configuration device can refer to the implementation of the text file configuration method, and repeated parts are not described again. As used hereinafter, the term "unit" or "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 2 illustrates a network device profile parsing apparatus according to an exemplary embodiment of the present invention, as shown in fig. 2, the apparatus includes:
the parsing module 201 is configured to parse a configuration file of a network device into a plurality of configuration entry information.
The analysis processing module 202 is configured to perform analysis processing on the configuration entry information according to different modes, and obtain a configuration command set.
And the updating module 203 is configured to update the configuration command set according to the configuration file of the network device.
And the parsing module 204 is configured to parse the configuration file content of each network device according to the updated configuration command set, and parse the configuration file content into metadata of the network device configuration information.
In an embodiment of the present invention, the analysis processing module 202 is further configured to:
judging the levels of a plurality of configuration item information;
and analyzing and processing the configuration item information of the same level according to different modes to obtain a configuration command set.
In the embodiment of the present invention, each configuration entry information includes at least one line of text information;
the analysis processing module 202 is further configured to:
acquiring line head indentation information of text information in each configuration item information;
and judging the levels of the plurality of configuration item information according to the line head indentation information.
In an embodiment of the present invention, the analysis processing module 202 is further configured to:
judging the size relationship of a plurality of line head indentation information;
taking the configuration item information with the same line head indentation information as the configuration item information of the same level;
and taking the configuration item information with larger line head indentation as the upper-level configuration item information and taking the configuration item information with smaller line head indentation as the lower-level configuration item information.
In an embodiment of the present invention, the analysis processing module 202 is further configured to:
splitting the configuration item information into a plurality of vocabulary information according to a preset rule, and acquiring word mode information of the configuration item information according to the plurality of vocabulary information;
acquiring row mode information of configuration item information according to the word mode information;
taking the first word information in the configuration item information as an anchor point, and grouping the configuration item information at the same level according to the anchor point, the word mode information and the line mode information;
comparing the configuration item information in the same group word by word, and generating a configuration command according to the comparison result;
and acquiring a configuration command set according to the configuration commands generated by the plurality of different groups of configuration item information.
In an embodiment of the present invention, the parsing module 204 is further configured to:
and according to the updated configuration command set, sequentially processing the configuration file content of each network device, and marking the content of each configuration file information with a corresponding configuration command.
The embodiment of the present invention further provides a computer device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and the processor implements the above method when executing the computer program.
An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program for executing the above method is stored.
In summary, the present invention is based on text data mining technology: classifying all network devices in the whole network of a telecom operator according to manufacturers (such as Huashi, Zhongxing and Cisco) and device types (such as switches and routers), carrying out automatic and intelligent text analysis on the classified mass configuration file contents by using a computer program under the condition of no need of manual intervention, analyzing all configuration command complete sets of a certain manufacturer and a certain device type, analyzing the configuration files of corresponding network devices according to the result, and analyzing the text contents of the configuration files into organized network device configuration information metadata for subsequent front-end presentation and statistical analysis functions. The configuration file of the network equipment is decomposed into a plurality of configuration item information, the configuration item information is analyzed and processed according to different modes to obtain a configuration command set, the configuration command set is updated according to the configuration file of the network equipment, the content of the configuration file of each network equipment is analyzed and processed according to the updated configuration command set, the content of the configuration file is analyzed into metadata of the configuration information of the network equipment, the change of a telecommunication operator network can be automatically responded without the help of professional knowledge of network experts, once the telecommunication operator network changes, a series of work such as modification, testing and the like can be automatically carried out on an existing configuration file analysis program, manual intervention is not needed from beginning to end, the labor cost is low, and the work efficiency is high.
As will be appreciated by one skilled in the art, embodiments of the present invention may be provided as a method, system, or computer program product. Accordingly, the present invention may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present invention may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present invention is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of the invention. It will be understood that each flow and/or block of the flow diagrams and/or block diagrams, and combinations of flows and/or blocks in the flow diagrams and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
The above-mentioned embodiments are intended to illustrate the objects, technical solutions and advantages of the present invention in further detail, and it should be understood that the above-mentioned embodiments are only exemplary embodiments of the present invention, and are not intended to limit the scope of the present invention, and any modifications, equivalent substitutions, improvements and the like made within the spirit and principle of the present invention should be included in the scope of the present invention.

Claims (14)

1. A method for parsing a configuration file of a network device, comprising:
decomposing a configuration file of the network equipment into a plurality of configuration item information;
analyzing and processing the configuration item information according to different modes to obtain a configuration command set;
updating the configuration command set according to the configuration file of the network equipment;
and analyzing the configuration file content of each network device according to the updated configuration command set, and analyzing the configuration file content into metadata of the configuration information of the network device.
2. The method of claim 1, wherein analyzing the configuration entry information according to different patterns to obtain the configuration command set comprises:
judging the levels of a plurality of configuration item information;
and analyzing and processing the configuration item information of the same level according to different modes to obtain a configuration command set.
3. The method of claim 2, wherein each configuration entry information includes at least one line of text information;
judging the level of a plurality of configuration item information, comprising:
acquiring line head indentation information of text information in each configuration item information;
and judging the levels of the plurality of configuration item information according to the line head indentation information.
4. The method as claimed in claim 3, wherein determining the level of the plurality of configuration entry information according to the head-of-line indentation information comprises:
judging the size relationship of a plurality of line head indentation information;
taking the configuration item information with the same line head indentation information as the configuration item information of the same level;
and taking the configuration item information with larger line head indentation as the upper-level configuration item information and taking the configuration item information with smaller line head indentation as the lower-level configuration item information.
5. The method of claim 4, wherein analyzing and processing the configuration item information of the same level according to different modes to obtain the configuration command set comprises:
splitting the configuration item information of the same level into a plurality of vocabulary information according to a preset rule, and acquiring word mode information of the configuration item information according to the vocabulary information;
acquiring row mode information of configuration item information according to the word mode information;
taking the first word information in the configuration item information as an anchor point, and grouping the configuration item information at the same level according to the anchor point, the word mode information and the line mode information;
comparing the configuration item information in the same group word by word, and generating a configuration command according to the comparison result;
and acquiring a configuration command set according to the configuration commands generated by the plurality of different groups of configuration item information.
6. The method of claim 1, wherein parsing the configuration file content for each network device according to the updated configuration command set comprises:
and according to the updated configuration command set, sequentially processing the configuration file content of each network device, and marking the content of each configuration file information with a corresponding configuration command.
7. A network device profile parsing apparatus, comprising:
the decomposition module is used for decomposing the configuration file of the network equipment into a plurality of configuration item information;
the analysis processing module is used for analyzing and processing the configuration item information according to different modes to obtain a configuration command set;
the updating module is used for updating the configuration command set according to the configuration file of the network equipment;
and the analysis module is used for analyzing the configuration file content of each network device according to the updated configuration command set and analyzing the configuration file content into metadata of the configuration information of the network devices.
8. The apparatus of claim 7, wherein the analysis processing module is further to:
judging the levels of a plurality of configuration item information;
and analyzing and processing the configuration item information of the same level according to different modes to obtain a configuration command set.
9. The apparatus of claim 8, wherein each configuration entry information includes at least one line of text information;
the analysis processing module is further configured to:
acquiring line head indentation information of text information in each configuration item information;
and judging the levels of the plurality of configuration item information according to the line head indentation information.
10. The apparatus of claim 9, wherein the analysis processing module is further to:
judging the size relationship of a plurality of line head indentation information;
taking the configuration item information with the same line head indentation information as the configuration item information of the same level;
and taking the configuration item information with larger line head indentation as the upper-level configuration item information and taking the configuration item information with smaller line head indentation as the lower-level configuration item information.
11. The apparatus of claim 10, wherein the analysis processing module is further to:
splitting the configuration item information of the same level into a plurality of vocabulary information according to a preset rule, and acquiring word mode information of the configuration item information according to the vocabulary information;
acquiring row mode information of configuration item information according to the word mode information;
taking the first word information in the configuration item information as an anchor point, and grouping the configuration item information at the same level according to the anchor point, the word mode information and the line mode information;
comparing the configuration item information in the same group word by word, and generating a configuration command according to the comparison result;
and acquiring a configuration command set according to the configuration commands generated by the plurality of different groups of configuration item information.
12. The apparatus of claim 7, wherein the parsing module is further to:
and according to the updated configuration command set, sequentially processing the configuration file content of each network device, and marking the content of each configuration file information with a corresponding configuration command.
13. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the method of any one of claims 1 to 6 when executing the computer program.
14. A computer-readable storage medium, characterized in that the computer-readable storage medium stores a computer program for executing the method of any one of claims 1 to 6.
CN201911127170.5A 2019-11-18 2019-11-18 Network equipment configuration file analysis method and device Pending CN112822031A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911127170.5A CN112822031A (en) 2019-11-18 2019-11-18 Network equipment configuration file analysis method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911127170.5A CN112822031A (en) 2019-11-18 2019-11-18 Network equipment configuration file analysis method and device

Publications (1)

Publication Number Publication Date
CN112822031A true CN112822031A (en) 2021-05-18

Family

ID=75852350

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911127170.5A Pending CN112822031A (en) 2019-11-18 2019-11-18 Network equipment configuration file analysis method and device

Country Status (1)

Country Link
CN (1) CN112822031A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116932305A (en) * 2023-09-15 2023-10-24 新华三信息技术有限公司 Test file generation method and device, electronic equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100153322A1 (en) * 2008-12-16 2010-06-17 Mandelbaum Yitzhak Method and apparatus for providing an adaptive parser
US20140379881A1 (en) * 2011-12-21 2014-12-25 International Business Machines Corporation Network Device Configuration Management
CN110224878A (en) * 2019-06-28 2019-09-10 北京金山云网络技术有限公司 Gateway configures update method, device and server

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20100153322A1 (en) * 2008-12-16 2010-06-17 Mandelbaum Yitzhak Method and apparatus for providing an adaptive parser
US20140379881A1 (en) * 2011-12-21 2014-12-25 International Business Machines Corporation Network Device Configuration Management
CN110224878A (en) * 2019-06-28 2019-09-10 北京金山云网络技术有限公司 Gateway configures update method, device and server

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116932305A (en) * 2023-09-15 2023-10-24 新华三信息技术有限公司 Test file generation method and device, electronic equipment and storage medium
CN116932305B (en) * 2023-09-15 2023-12-12 新华三信息技术有限公司 Test file generation method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
US10439926B2 (en) Network analysis
CN106790170B (en) Data packet filtering method and device
US8135764B2 (en) Configuration management server, name recognition method and name recognition program
JP2013502130A (en) Automatic address range detection for IP networks
CN110650037B (en) Heterogeneous network device configuration method and device
RU2658889C1 (en) Openflow tables table search method and device, and also the data media
CN110336808B (en) Attack tracing method and system for power industrial control network
EP3101842B1 (en) Method, system and computer readable medium for network management automation
US20150200860A1 (en) Method and apparatus for packet classification
WO2016184163A1 (en) Method and device for generating a dpi rules
EP2916516A1 (en) Packet processing method and apparatus
CN102780681A (en) URL (Uniform Resource Locator) filtering system and URL filtering method
CN111045992A (en) Tree structure based configuration file checking method and system
CN112019449A (en) Traffic identification packet capturing method and device
CN112822031A (en) Network equipment configuration file analysis method and device
CN111030971A (en) Distributed access control method and device and storage equipment
CN107070700B (en) Network service providing method based on automatic identification of identity
US11909592B2 (en) Method for multi-policy conflict avoidance in autonomous network
US11502902B2 (en) Network event correlation
Sija et al. Automatic payload signature generation for accurate identification of internet applications and application services
CN105991373B (en) A kind of application protocol recognition methods and device
CN109067574B (en) Method for processing configuration residue of router control plane
CN109947429B (en) Data processing method and device
JP3779619B2 (en) Packet transfer device, network, program, and recording medium
JP7466878B2 (en) Information processing device, information processing method, and program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20210518