CN107426041B - Method and device for analyzing command - Google Patents

Method and device for analyzing command Download PDF

Info

Publication number
CN107426041B
CN107426041B CN201710858374.0A CN201710858374A CN107426041B CN 107426041 B CN107426041 B CN 107426041B CN 201710858374 A CN201710858374 A CN 201710858374A CN 107426041 B CN107426041 B CN 107426041B
Authority
CN
China
Prior art keywords
command
matching
configuration
cache
matching cache
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.)
Active
Application number
CN201710858374.0A
Other languages
Chinese (zh)
Other versions
CN107426041A (en
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.)
Hangzhou DPTech Technologies Co Ltd
Original Assignee
Hangzhou DPTech Technologies 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 Hangzhou DPTech Technologies Co Ltd filed Critical Hangzhou DPTech Technologies Co Ltd
Priority to CN201710858374.0A priority Critical patent/CN107426041B/en
Publication of CN107426041A publication Critical patent/CN107426041A/en
Application granted granted Critical
Publication of CN107426041B publication Critical patent/CN107426041B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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/0889Techniques to speed-up the configuration process

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application provides a method and a device for analyzing commands, which are applied to terminal equipment, wherein the terminal equipment performs batch configuration on network equipment through a command line, the terminal equipment is pre-configured with a static matching cache, the static matching cache is used for storing analysis conditions and command execution functions corresponding to the analysis conditions, and the method comprises the following steps: when any configuration command is read, judging whether an analysis condition exists in the static matching cache; if the static matching cache has the analysis condition, searching the analysis condition matched with the currently read configuration command from the static matching cache; and if the analysis condition matched with the currently read configuration command is found, executing a command execution function corresponding to the analysis condition. By adopting the technical method provided by the application, the speed of batch configuration of the network equipment by the terminal equipment through the command line can be increased.

Description

Method and device for analyzing command
Technical Field
The present application relates to the field of configuring network devices, and in particular, to a method and an apparatus for parsing a command.
Background
In order to ensure the normal operation of the network device, an administrator is usually required to perform maintenance on the network device. Currently, administrators usually maintain network devices in a Web mode and a command line mode. The Web mode refers to that an administrator uses a browser to access a Web server of the network equipment, and after logging in the network equipment, configuration is issued for the network equipment on the browser. The command line mode refers to that when the terminal device accesses the network device through the connection modes such as console and telnet, the terminal device provides a command line for maintaining the network device, and the administrator inputs a command under a prompt of the command line to maintain the network device.
For example, when the administrator enters the Show running-config in the command line, the administrator may obtain the configuration command for the network device. Wherein, the Show running-configuration is a configuration command that can view all the current running configurations of the network device.
The command line is a service program running on the equipment and providing functions of analyzing commands, executing commands and the like, and exists on the equipment in the form of an interactive terminal interface. The command line is divided into several different views and can be switched when the administrator inputs a command to execute a switch view in the command line. Because there are limitations on the commands that can be used in each command line view, an administrator can only use the commands that are allowed by the command line view when entering commands in the command line view. In addition, the command line stores all executable commands on the network device through the command tree, as well as the view of the command line in which each command is located. Wherein the command tree is a data structure.
When the hardware configuration or capacity of the network device cannot meet the requirement of network operation, it is usually necessary to replace the network device with a higher specification to work instead of the original device, or add the same type of network device to work together with the original device.
Since it is usually required that the configuration of the new device is the same as that of the original device, whether the new device is replaced or added, the administrator needs to acquire all the configuration commands of the original device. The administrator may log in the command line of the original device, enter the Show running-configuration in the command line to obtain all the configuration commands of the original device, and then copy and paste all the configuration commands of the original device to the command line of the new device, and perform batch configuration on the new device through the command line of the new device.
When the command line of the new device performs batch configuration on the new device, the configuration commands pasted to the command line of the new device are sequentially read, and each time one configuration command is read, a command uniquely matched with the configuration command needs to be searched from the command tree in a traversing manner, and then the uniquely matched command is executed.
As network devices become more and more configured, the number of configuration commands increases, for example, the number of routing entries, packet filtering entries, etc. may reach 10 ten thousand. The more the configuration commands are, the more time is consumed for performing batch configuration on the devices through the command lines, which causes great time consumption for an administrator to maintain the devices, and thus, the time consumed for performing batch configuration on the devices needs to be reduced.
In the prior art, the command line stores the matching result of the command matched to the command tree into the dynamic matching cache each time. When a command line subsequently searches for a command uniquely matched with any configuration command, firstly searching for the command uniquely matched with the configuration command from the dynamic matching cache, executing the uniquely matched command once the command uniquely matched with the configuration command is found, and traversing the commands on the command tree to search for the command uniquely matched with the configuration command if the command uniquely matched with the configuration command is not found from the dynamic matching cache. Because the configuration command has the repetitive configuration command, the time consumed for searching the command which is uniquely matched with the repetitive configuration command from the dynamic matching cache is far shorter than the time consumed for traversing the commands on the command tree and searching the command which is uniquely matched with the repetitive configuration command, so the time consumed for carrying out batch configuration on command lines can be reduced.
However, although the time consumed by the terminal device to perform batch configuration on the network devices through the command line is reduced to some extent in the prior art, when the number of configuration commands is huge, the time consumed by the terminal device to perform batch configuration on the network devices through the command line still far cannot meet the time requirement set by the administrator.
Disclosure of Invention
In view of this, the present application provides a method and an apparatus for parsing a command, which are applied to a terminal device and are used to accelerate a speed of the terminal device performing batch configuration on network devices through a command line.
Specifically, the method is realized through the following technical scheme:
a method for analyzing commands is applied to terminal equipment, the terminal equipment performs batch configuration on network equipment through a command line, the terminal equipment is pre-configured with a static matching cache, the static matching cache is used for storing analysis conditions and command execution functions corresponding to the analysis conditions, and the method comprises the following steps:
when any configuration command is read, judging whether an analysis condition exists in the static matching cache;
if the static matching cache has the analysis condition, searching the analysis condition matched with the currently read configuration command from the static matching cache;
and if the analysis condition matched with the currently read configuration command is found, executing a command execution function corresponding to the analysis condition.
A device for analyzing commands is applied to terminal equipment, the terminal equipment performs batch configuration on network equipment through a command line, the terminal equipment is pre-configured with a static matching cache, the static matching cache is used for storing analysis conditions and command execution functions corresponding to the analysis conditions, and the device comprises:
the judging unit is used for judging whether an analysis condition exists in the static matching cache or not when any configuration command is read;
the searching unit is used for searching the analysis condition matched with the currently read configuration command from the static matching cache if the analysis condition exists in the static matching cache;
and the execution unit is used for executing a command execution function corresponding to the analysis condition if the analysis condition matched with the currently read configuration command is found.
The application provides a beneficial effect that technical scheme brought:
in the application, a static matching cache is configured in advance on the terminal device and is used for storing the analysis condition and the command execution function corresponding to the analysis condition, wherein the analysis condition is specific to the configuration command with repeatability and unique characteristics, and when the configuration command read by the terminal device at present meets the analysis condition, the command execution function corresponding to the analysis condition is directly executed. The unique characteristic in the configuration command with repeatability and unique characteristic is used as the condition of the analysis command, the command execution function required when the analysis condition is met is bound with the analysis condition, and finally the command execution function is stored in the static matching cache.
Drawings
Fig. 1 is a flowchart illustrating a method for parsing a command according to an embodiment of the present disclosure;
fig. 2 is a hardware structure diagram of a terminal device where a device for parsing commands according to the present application is located;
fig. 3 is a device for parsing a command according to a second embodiment of the present application.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a", "an", and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It is to be understood that although the terms first, second, third, etc. may be used herein to describe various information, such information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. The word "if" as used herein may be interpreted as "at … …" or "when … …" or "in response to a determination", depending on the context.
In the prior art, when the command line of the original network device is registered on the terminal device, the administrator may input a Show running-config command in the command line, where the Show running-config command is used to obtain all configuration commands of the network device. After the Show running-configuring command is input in the command line of the original network device, the terminal device may send a command for acquiring all configuration commands of the original network device to the original network device, and after receiving the command, the original network device reads all configuration commands in the local device and then returns all configuration commands to the terminal device.
When the terminal device receives all the configuration commands of the original network device through the command line of the original network device, the administrator can log in the command line of the new network device and then copy all the configuration commands of the original network device from the command line of the original network device into the command line of the new network device.
The terminal equipment reads the configuration commands one by one through the command line of the new network equipment, and when the first configuration command is read, the read configuration command is sequentially matched with the commands in a command tree configured on the terminal equipment, wherein all the commands which can be configured by the network equipment and data related to the commands are stored in the command tree. When the read uniquely matched command in the configuration command matching is read, the terminal device may read the view where the uniquely matched command is located, the optimal matching level from the command tree, and then store the uniquely matched command, the view where the uniquely matched command is located, and the optimal matching level as matching results in the dynamic matching cache, that is, each matching result includes the uniquely matched command, the view where the uniquely matched command is located, and the optimal matching level. The content in the matching result may be adjusted according to actual needs, for example, other data related to the uniquely matched command may be added to the matching result.
In the prior art, when the terminal device continues to store the newly generated matching result into the dynamic matching cache, the terminal device may delete the matching result that is stored earliest in the dynamic matching cache, so as to leave a storage space for storing the newly generated matching result. The threshold N may be adjusted, and is not limited.
When the terminal equipment reads the configuration command subsequently, the terminal equipment matches the configuration command subsequently read with the matching result in the dynamic matching cache, if the matching result containing the only matched command is not found in the dynamic matching cache, the configuration command is matched with the command in the command tree so as to find the only matched command.
Since the number of matching results stored in the dynamic matching cache is much less than the number of commands in the command tree, finding a matching result from the dynamic matching cache for a previously matched configuration command takes less time than finding a command matching the configuration command from the command tree.
For example, 10000 commands are stored in the command tree, now a terminal device reads a configuration command, and the storage location of the command uniquely matching the configuration command in the command tree is 9998, that is, before the currently read configuration command matches the uniquely matching command, it needs to match with other 9997 commands. If the matching result containing the unique matching command exists in the dynamic matching cache, and the storage position of the cache entry in the dynamic matching cache is 2, the time consumed for sequentially matching the currently read configuration command with the commands in the command tree to search for the uniquely matched command is far longer than the time consumed for sequentially matching the currently read configuration command with the matching result in the dynamic matching cache to search for the uniquely matched command.
In the prior art, when a terminal device matches a configuration command with a command in a command tree or a command in a matching result through a command line, the terminal device needs to split the configuration command into a plurality of characters and/or character strings based on a preset splitting mechanism, and then judges whether the command is a command uniquely matched with the configuration command by judging whether the split characters and/or character strings are matched with the command in the command tree or the command in the matching result.
Specifically, the terminal device sequentially reads the characters and/or character strings obtained after splitting the configuration command, then matches the read characters and/or character strings with the commands in the matching results read one by one, and determines that the commands in the matching results are the commands uniquely matched with the configuration command if the characters and/or character strings obtained after splitting the configuration command and the commands in the matching results are successfully matched, and the terminal device may execute corresponding configuration operations based on the matching results, so as to complete the configuration operations based on the configuration command on the new network device.
If any character and/or character string in the character and/or character string obtained by splitting the configuration command is unsuccessfully matched, the remaining unmatched characters and/or character strings in the configuration command are not matched any more, the terminal device can determine that the command in the cache table entry is not matched with the configuration command, the terminal device needs to continuously read the matching result from the dynamic matching cache, match the character and/or character string obtained by splitting the configuration command with the command in the cache table entry until the matching result containing the command uniquely matched with the configuration command is found, if the matching result in the dynamic matching cache does not contain the matching result containing the command uniquely matched with the configuration command, the terminal device can match the configuration command with the command in the command tree and find the command uniquely matched with the configuration command, the terminal device matches the configuration command with the command in the command tree in the same way as the configuration command with the command in the matching result, which is not described herein again.
For example, the configuration command is split to obtain 3 character strings, which are a, B, and C, the terminal device may match the character string a with the command in the matching result read from the dynamic matching cache, if the character string a is successfully matched, the terminal device continues to match the character string B with the command in the matching result, if the character string B is successfully matched, the terminal device matches the last character string C with the command in the matching result, if the character string C is successfully matched, the terminal device may determine that the command in the matching result is the command uniquely matched with the configuration command, and then perform the corresponding configuration operation based on the matching result. If any one of the three character strings is unsuccessfully matched, determining that the command in the matching result is not matched with the configuration command, the terminal equipment needs to continuously read the matching result from the dynamic matching cache, matching the character string obtained by splitting the configuration command with the command in the matching result until the matching result containing the command uniquely matched with the configuration command is found, and if the matching result in the dynamic matching cache does not contain the matching result containing the command uniquely matched with the configuration command, the terminal equipment can match the configuration command with the command in the command tree and find the command uniquely matched with the configuration command.
However, although the time consumed by the terminal device to perform batch configuration on the network devices through the command line is reduced to some extent in the prior art, when the number of configuration commands is huge, the time consumed by the terminal device to perform batch configuration on the network devices through the command line still far cannot meet the time requirement set by the administrator.
Example one
In order to solve the problems in the prior art, an embodiment of the present application provides a method for parsing a command, which is applied to a terminal device, where a static matching cache is pre-configured on the terminal device, and the static matching cache is used to store a parsing condition and a command execution function corresponding to the parsing condition, please refer to fig. 1, where fig. 1 is a flowchart of a method for parsing a command, which is shown in an embodiment of the present application, and specifically executes the following steps:
step 101: when any configuration command is read, judging whether an analysis condition exists in the static matching cache;
step 102: if the static matching cache has the analysis condition, searching the analysis condition matched with the currently read configuration command from the static matching cache;
step 103: and if the analysis condition matched with the currently read configuration command is found, executing a command execution function corresponding to the analysis condition.
In this embodiment, a static matching cache is configured in advance on the terminal device, where the static matching cache is used to store the parsing condition and the command execution function corresponding to the parsing condition, and the parsing condition and the command execution function are stored in a bound manner. After the administrator copies the configuration command of the original network device to the command line of the new network device, the terminal device reads the configuration command item by item through the command line of the new network device. And when the terminal equipment reads the configuration command through the command line of the new network equipment, matching the configuration command with the analysis condition in the static matching cache. If the static matching cache has the analysis condition matched with the configuration command, the terminal equipment executes a command execution function corresponding to the analysis condition to complete the configuration operation, otherwise, the terminal equipment matches the configuration command with the matching result in the dynamic matching cache. If the matching result matched with the configuration command exists in the dynamic matching cache, the terminal equipment executes corresponding configuration operation based on the matching result in the matching, otherwise, the configuration command is matched with the command in the command tree to search the command uniquely matched with the configuration command.
In this embodiment, the administrator sets a threshold N for the number of analysis conditions that can be stored in the static matching cache, and when the number of analysis conditions in the static matching cache reaches the threshold, the terminal device may delete the analysis condition that was stored in the static matching cache earliest when the terminal device continues to store a new analysis condition in the static matching cache, so as to leave a storage space for storing the new analysis condition. The threshold value may be adjusted, and is not limited to a specific value.
In different application scenarios, in order to enable the terminal device to achieve the optimal speed state through batch configuration of the network devices by commands, the thresholds of the static matching cache are different, so that different thresholds need to be set in different application scenarios. In order to avoid readjusting the static matching cache in the interrupt configuration process, the static matching cache may be modified in a hot patch manner. The hot patch is some codes for repairing software bugs, and software can be repaired under the condition that equipment is not restarted.
The analysis condition is used for judging whether the configuration command meets the analysis condition, and the command execution function is used for executing the command execution function when the configuration command meets the analysis condition.
The following is a specific implementation procedure of this example:
specifically, after the administrator copies the configuration command of the original network device to the command line of the new network device, the terminal device reads the configuration command through the command line of the new network device. When the terminal device reads a command through the command line of the new network device, the configuration command may be split based on a preset splitting mechanism, and a plurality of characters and/or character strings are generated. For example, the terminal device may split the configuration command into several characters and/or character strings by taking a space in the configuration command as a split mark.
After the terminal device obtains a plurality of characters and/or character strings, the terminal device may determine whether an analysis condition exists in the static matching cache. And if the static matching cache does not have the analysis condition, the terminal equipment matches the configuration command containing a plurality of characters and/or character strings with the matching result in the dynamic matching cache. The process of matching the configuration command including a plurality of characters and/or character strings with the matching result in the dynamic matching cache is the prior art, please refer to the related content of this embodiment, and will not be described herein again.
If the static matching cache has the analysis condition, the terminal device can read the analysis condition from the static matching cache in sequence, and then judge whether the configuration command is successfully matched with the analysis condition by judging whether a plurality of characters and/or character strings obtained by splitting the configuration command have the characters or character strings meeting the analysis condition in the cache list item.
For example, the parsing condition is a configuration command including a character string "string a", and when the terminal device reads the parsing condition, the terminal device may determine that the read configuration command is split into a plurality of characters and/or whether the character string "string a" exists in the character string. If the configuration command is not matched with the analysis condition, the terminal equipment can determine that the read configuration command is not matched with the analysis condition successfully.
If the read configuration command is successfully matched with the analysis condition currently read from the static matching cache, the terminal device may read a command execution function bound to the analysis condition and then execute the command execution function.
If the read configuration command is unsuccessfully matched with the currently read resolution condition from the static matching cache, the configuration command may be matched with the matching result in the dynamic matching cache, and the specific matching process refers to the relevant contents in the present embodiment and is not described herein again.
It can be seen from the matching process of the configuration command and the parsing condition in the static matching cache that after the configuration command is split into a plurality of characters and/or character strings, the terminal device only needs to judge whether the characters and/or character strings satisfy the parsing condition, and when the conditions are satisfied, the terminal device can execute the command execution function bound with the parsing condition. However, in the prior art, the terminal device needs to match all the characters and/or character strings obtained by splitting the configuration command with the command in the matching result in the dynamic matching cache one by one, and only when all the characters and/or character strings are matched with the matching result, the terminal device can execute the relevant configuration operation based on the matching result.
Compared with the prior art, after the matching result matched with the configuration command is found, the time consumed by the terminal equipment for executing the relevant configuration operation based on the matching result to complete the configuration mode is less.
Moreover, the number of the resolution conditions in the static matching cache is much smaller than the number of the matching results in the dynamic matching cache, and the time consumed for finding the resolution conditions matched with the configuration command with repeatability and unique characteristics from the static matching cache is less than the time consumed for finding the matching results matched with the configuration command from the dynamic matching cache storing a large number of matching results.
Therefore, by configuring the static matching cache, taking the unique feature in the configuration command with repeatability and unique feature as the condition of the parsing command, binding the command execution function required when the parsing condition is met with the parsing condition, and finally storing the function into the static matching cache, when the terminal device reads the configuration command, preferentially matching the configuration command with the parsing condition stored in the static matching cache, once the parsing condition is met, executing the command execution function bound with the parsing condition, and increasing the static matching cache mode on the basis of the prior art, the speed of the terminal device for batch configuration of the network device through the command line can be further increased, so that the time requirement of an administrator for batch configuration of the network device through the command line by the terminal device is realized.
Example two
In order to solve the problems in the prior art, the present application further provides a second embodiment of an apparatus for parsing a command, which corresponds to the first embodiment of the method for parsing a command.
The second embodiment of the device for analyzing the command can be applied to the terminal device. The device embodiments may be implemented by software, or by hardware, or by a combination of hardware and software. The software implementation is taken as an example, and as a logical device, the device is formed by reading corresponding computer program instructions in the nonvolatile memory into the memory for operation through the processor of the terminal device where the device is located. From a hardware aspect, as shown in fig. 2, the present application is a hardware structure diagram of a terminal device where a device for resolving a command is located, where the terminal device where the device is located in the embodiment may further include other hardware according to an actual function of the resolving command in general, except for the processor, the memory, the network interface, and the nonvolatile memory shown in fig. 2, and details of this are not repeated.
Referring to fig. 3, fig. 3 is a device for parsing a command shown in the second embodiment of the present application, which is applied to a terminal device, where the terminal device performs batch configuration on network devices through a command line, and the terminal device is configured with a static matching cache in advance, where the static matching cache is used to store a parsing condition and a command execution function corresponding to the parsing condition, and the device includes: a judging unit 310, a searching unit 320 and an executing unit 330.
The determining unit 310 is configured to determine whether an analysis condition exists in the static matching cache when any configuration command is read;
a searching unit 320, configured to search, if an analysis condition exists in the static matching cache, an analysis condition that matches the currently read configuration command from the static matching cache;
the executing unit 330 is configured to, if an analysis condition matching the currently read configuration command is found, execute a command executing function corresponding to the analysis condition.
In this embodiment, the terminal device is preconfigured with a dynamic matching cache, where the dynamic matching cache is used to store a matching result obtained after any configuration command is successfully matched to a command in a command tree, and the apparatus further includes:
the matching unit is used for matching the currently read configuration command with the matching result in the dynamic matching cache by the command line if the static matching cache does not have the analysis condition;
and the configuration module is also used for matching the configuration command with the matching result in the dynamic matching cache if the currently read configuration command is not matched with all the analysis conditions in the static matching cache.
In addition, in this embodiment, the terminal device loads a hot patch program, and the apparatus further includes:
and the change unit is used for changing the static matching cache through the hot patch.
The implementation process of the functions and actions of each unit in the above device is specifically described in the implementation process of the corresponding step in the above method, and is not described herein again.
For the device embodiments, since they substantially correspond to the method embodiments, reference may be made to the partial description of the method embodiments for relevant points. The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the scheme of the application. One of ordinary skill in the art can understand and implement it without inventive effort.
The above description is only exemplary of the present application and should not be taken as limiting the present application, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present application should be included in the scope of protection of the present application.

Claims (8)

1. A method for analyzing commands is applied to terminal equipment, the terminal equipment performs batch configuration on network equipment through a command line, and the method is characterized in that the terminal equipment is configured with a static matching cache in advance, the static matching cache is used for storing analysis conditions and command execution functions corresponding to the analysis conditions, the analysis conditions comprise unique features in configuration commands with repeatability and unique features, and the method comprises the following steps:
when any configuration command is read, judging whether an analysis condition exists in the static matching cache;
if the static matching cache has the analysis condition, searching the analysis condition matched with the currently read configuration command from the static matching cache;
and if the analysis condition matched with the currently read configuration command is found, executing a command execution function corresponding to the analysis condition.
2. The method according to claim 1, wherein the terminal device is preconfigured with a dynamic matching cache, and the dynamic matching cache is used for storing a matching result obtained after any configuration command is successfully matched with a command in a command tree, and the method further comprises:
and if the static matching cache does not have the analysis condition, matching the currently read configuration command with the matching result in the dynamic matching cache.
3. The method of claim 2, further comprising:
and if the currently read configuration command is not matched with all the analysis conditions in the static matching cache, matching the configuration command with the matching result in the dynamic matching cache.
4. A method according to any one of claims 1 to 3, wherein the terminal device is loaded with a hot patch, the method further comprising: the static matching cache is modified by hot patching.
5. A device for resolving commands is applied to terminal equipment, and the terminal equipment performs batch configuration on network equipment through a command line, and is characterized in that the terminal equipment is pre-configured with a static matching cache, the static matching cache is used for storing resolving conditions and command execution functions corresponding to the resolving conditions, the resolving conditions comprise unique features in configuration commands with repeatability and unique features, and the device comprises:
the judging unit is used for judging whether an analysis condition exists in the static matching cache or not when any configuration command is read;
the searching unit is used for searching the analysis condition matched with the currently read configuration command from the static matching cache if the analysis condition exists in the static matching cache;
and the execution unit is used for executing a command execution function corresponding to the analysis condition if the analysis condition matched with the currently read configuration command is found.
6. The apparatus of claim 5, wherein the terminal device is preconfigured with a dynamic matching cache, and the dynamic matching cache is configured to store a matching result obtained after any configuration command is successfully matched to a command in a command tree, and the apparatus further includes:
and the matching unit is used for matching the currently read configuration command with the matching result in the dynamic matching cache by the command line if the static matching cache does not have the analysis condition.
7. The apparatus of claim 6, wherein the matching unit is further configured to:
and if the currently read configuration command is not matched with all the analysis conditions in the static matching cache, matching the configuration command with the matching result in the dynamic matching cache.
8. The apparatus as claimed in any one of claims 5-7, wherein the terminal device is loaded with a hot patch, the apparatus further comprising:
and the change unit is used for changing the static matching cache through the hot patch.
CN201710858374.0A 2017-09-21 2017-09-21 Method and device for analyzing command Active CN107426041B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710858374.0A CN107426041B (en) 2017-09-21 2017-09-21 Method and device for analyzing command

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710858374.0A CN107426041B (en) 2017-09-21 2017-09-21 Method and device for analyzing command

Publications (2)

Publication Number Publication Date
CN107426041A CN107426041A (en) 2017-12-01
CN107426041B true CN107426041B (en) 2020-08-04

Family

ID=60433410

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710858374.0A Active CN107426041B (en) 2017-09-21 2017-09-21 Method and device for analyzing command

Country Status (1)

Country Link
CN (1) CN107426041B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109927280B (en) * 2017-12-15 2021-01-15 深圳市七号科技有限公司 Method and device for analyzing outline command and color 3D printer
CN108647043B (en) * 2018-04-03 2021-03-16 烽火通信科技股份有限公司 Method and system for realizing command line input
CN109471675B (en) * 2018-10-30 2021-11-19 北京无限自在文化传媒股份有限公司 Method and system for changing hardware
CN109639487B (en) * 2018-12-17 2022-03-01 杭州迪普科技股份有限公司 Policy configuration method, device, network equipment and storage medium
CN110008003A (en) * 2019-04-10 2019-07-12 苏州浪潮智能科技有限公司 A kind of order line validation checking method and relevant apparatus
CN116185497B (en) * 2023-01-06 2024-05-07 格兰菲智能科技有限公司 Command analysis method, device, computer equipment and storage medium

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1490977A (en) * 2002-10-17 2004-04-21 华为技术有限公司 Analysis of universal route platform command lines
CN106227821A (en) * 2016-07-21 2016-12-14 杭州华三通信技术有限公司 A kind for the treatment of method and apparatus of order line order
CN106951213A (en) * 2017-03-27 2017-07-14 杭州迪普科技股份有限公司 A kind of command analysis method and device

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9632728B2 (en) * 2008-03-28 2017-04-25 International Business Machines Corporation Apparatus and method to establish a logical configuration for a data storage library

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1490977A (en) * 2002-10-17 2004-04-21 华为技术有限公司 Analysis of universal route platform command lines
CN106227821A (en) * 2016-07-21 2016-12-14 杭州华三通信技术有限公司 A kind for the treatment of method and apparatus of order line order
CN106951213A (en) * 2017-03-27 2017-07-14 杭州迪普科技股份有限公司 A kind of command analysis method and device

Also Published As

Publication number Publication date
CN107426041A (en) 2017-12-01

Similar Documents

Publication Publication Date Title
CN107426041B (en) Method and device for analyzing command
CN107948314B (en) Business processing method and device based on rule file and server
US20150234927A1 (en) Application search method, apparatus, and terminal
US9053053B2 (en) Efficiently determining identical pieces of memory used by virtual machines
CN108536745B (en) Shell-based data table extraction method, terminal, equipment and storage medium
US11100047B2 (en) Method, device and computer program product for deleting snapshots
CN107239701B (en) Method and device for identifying malicious website
US11386067B2 (en) Data integrity checking in a distributed filesystem using object versioning
US20170142203A1 (en) Method for host scheduling for container deployment, electronic device and non-transitory computer-readable storage medium
CN110287696A (en) A kind of detection method, device and the equipment of the shell process that rebounds
JP2016099857A (en) Fraudulent program handling system and fraudulent program handling method
CN111984892A (en) Page access method, device, equipment and storage medium
CN110135163B (en) Security detection method, device and system based on target application
CN111026765A (en) Dynamic processing method, equipment, storage medium and device for strictly balanced binary tree
US11656977B2 (en) Automated code checking
CN102333123B (en) File storage method and device, searching method and device and network device
CN110765125B (en) Method and device for storing data
CN109582347B (en) Method and device for acquiring front-end codes
CN110515905B (en) Method, device and server for configuring route
CN104951550B (en) Date storage method and device
CN106407260A (en) Processing method and apparatus for obtaining file type
CN109635175B (en) Page data splicing method and device, readable storage medium and electronic equipment
US10866993B2 (en) Managing online help information in a data center
US9438607B2 (en) Information processing apparatus and verification control method
CN110795297B (en) Electronic equipment testing method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant