CN106301870A - A kind of method and device realizing command lookup on network devices - Google Patents
A kind of method and device realizing command lookup on network devices Download PDFInfo
- Publication number
- CN106301870A CN106301870A CN201510355553.3A CN201510355553A CN106301870A CN 106301870 A CN106301870 A CN 106301870A CN 201510355553 A CN201510355553 A CN 201510355553A CN 106301870 A CN106301870 A CN 106301870A
- Authority
- CN
- China
- Prior art keywords
- command
- information
- data source
- order
- source file
- 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
Links
- 238000000034 method Methods 0.000 title claims abstract description 40
- 238000013515 script Methods 0.000 claims abstract description 36
- 235000013399 edible fruits Nutrition 0.000 claims 1
- 238000007689 inspection Methods 0.000 claims 1
- 238000010586 diagram Methods 0.000 description 4
- 238000012423 maintenance Methods 0.000 description 3
- 230000006870 function Effects 0.000 description 2
- 238000004806 packaging method and process Methods 0.000 description 2
- 238000004422 calculation algorithm Methods 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
- H04L41/08—Configuration management of networks or network elements
- H04L41/0889—Techniques to speed-up the configuration process
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L41/00—Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
Landscapes
- Engineering & Computer Science (AREA)
- Computer Networks & Wireless Communication (AREA)
- Signal Processing (AREA)
- Information Transfer Between Computers (AREA)
- Computer And Data Communications (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
Description
技术领域technical field
本发明涉及通信技术领域,特别是涉及一种在网络设备上实现命令查找的方法及装置。The invention relates to the field of communication technology, in particular to a method and device for realizing command search on network equipment.
背景技术Background technique
目前,网络设备(交换机、路由器等)通常采用OAM(OperationAdministration and Maintenance,操作、管理和维护)界面上的CLI(CommandLine Interface,即命令行接口)接口对设备参数进行配置,即采用命令行对设备参数进行配置。命令行通常包括命令行的执行模式,关键字及参数几部分,而只有用户完整的输入命令行才能正确执行。随着用户需求的增加,网络设备所支持的业务功能越来越多,而与业务功能对应的命令集越来越庞大,用户需要记住的命令行越来越多。At present, network devices (switches, routers, etc.) usually use the CLI (CommandLine Interface, command line interface) interface on the OAM (Operation Administration and Maintenance) interface to configure device parameters, that is, use the command line to configure the device parameters. parameters to configure. The command line usually includes the execution mode of the command line, keywords and parameters, and only when the user completes the command line can it be executed correctly. As user demands increase, network devices support more and more business functions, and the command sets corresponding to business functions become larger and larger, and users need to memorize more and more command lines.
发明内容Contents of the invention
本发明提供一种在网络设备上实现命令查找的方法及装置,从而可方便用户获取网络设备配置所需的命令信息,提高了网络设备的易用性。The invention provides a method and a device for realizing command search on network equipment, thereby facilitating users to obtain command information required for network equipment configuration, and improving the ease of use of the network equipment.
本发明提供方案如下:The present invention provides scheme as follows:
本发明实施例提供了一种在网络设备上实现命令查找的方法,包括:An embodiment of the present invention provides a method for realizing command search on a network device, including:
通过对输入的查询命令进行解析,获取需要进行检索的命令信息,所述命令信息包括命令关键字、命令参数以及命令模式信息中的至少一项;Obtain command information to be retrieved by parsing the input query command, where the command information includes at least one of command keywords, command parameters, and command mode information;
基于所述命令信息,在预先生成的查询数据源文件中进行检索,获取一检索结果,所述查询数据源文件的生成过程包括:依次读取网络设备所支持的脚本文件集中每个脚本文件,并对每个脚本文件进行解析生成查询数据源文件,所述查询数据源文件中包括每条命令的检索信息,所述检索信息包括命令关键字、命令参数、命令语法关键字、命令执行模式信息、命令显示时的格式信息中的至少一项;Based on the command information, search in the pre-generated query data source file to obtain a search result, the generation process of the query data source file includes: sequentially reading each script file in the script file set supported by the network device, And each script file is parsed to generate a query data source file, the query data source file includes the retrieval information of each command, and the retrieval information includes command keywords, command parameters, command syntax keywords, command execution mode information , at least one of the format information when the command is displayed;
显示所述检索结果。Display the search results.
优选的,所述方法在对输入的查询命令进行解析,获取需要进行检索的命令信息之前还包括:Preferably, the method further includes before parsing the input query command and obtaining the command information that needs to be retrieved:
生成所述查询数据源文件。Generate the query data source file.
优选的,所述查询数据源文件的格式分为第一部分和第二部分;其中:Preferably, the format of the query data source file is divided into a first part and a second part; wherein:
第一部分为命令模式区,包括命令模式标识信息、命令模式对应的命令条信息数、命令模式在查询数据源文件中的位置信息及命令模式的查询次数信息;The first part is the command mode area, including the command mode identification information, the number of command bar information corresponding to the command mode, the position information of the command mode in the query data source file, and the query times information of the command mode;
第二部分为命令数据区,包括每个命令模式对应的每条命令的模块名长度信息、关键字长度信息、命令格式长度信息、NO命令格式长度信息、命令标识信息、命令模式标识信息、命令在命令模式中的位置信息及命令的查询次数信息。The second part is the command data area, including the module name length information, keyword length information, command format length information, NO command format length information, command identification information, command mode identification information, command The position information in the command mode and the query times information of the command.
优选的,所述方法还包括:Preferably, the method also includes:
基于命令模式区中所包括的命令模式查询次数信息,对命令模式在查询数据源文件中的位置进行调整;和/或Adjust the position of the command mode in the query data source file based on the command mode query times information included in the command mode area; and/or
基于命令数据区中命令的查询次数信息,对命令在命令模式中的位置进行调整。Based on the query times information of the command in the command data area, the position of the command in the command mode is adjusted.
优选的,所述方法在对输入的查询命令进行解析,获取需要进行检索的命令信息之前还包括:Preferably, the method further includes before parsing the input query command and obtaining the command information that needs to be retrieved:
将生成的查询数据源文件加载至网络设备的版本集中,以便在网络设备启动时,将所述查询数据源文件加载至所述网络设备中。The generated query data source file is loaded into the version set of the network device, so that the query data source file is loaded into the network device when the network device is started.
优选的,所述基于所述命令信息,在预先生成的查询数据源文件中进行检索包括:Preferably, the searching in the pre-generated query data source file based on the command information includes:
当所述命令信息包括命令关键字以及命令模式信息时,在所述命令模式中,基于所述命令关键字进行检索,查找与所述命令关键字匹配的命令信息;和/或When the command information includes command keywords and command mode information, in the command mode, search based on the command keywords to find command information matching the command keywords; and/or
当所述命令信息包括命令关键字时,在所有命令模式中,基于所述命令关键字进行检索,查找与所述命令关键字匹配的命令信息;和/或When the command information includes a command keyword, in all command modes, search based on the command keyword to find command information matching the command keyword; and/or
当所述命令信息包括命令关键字时,在默认的命令模式中,基于所述命令关键字进行检索,查找与所述命令关键字匹配的命令信息。When the command information includes a command keyword, in a default command mode, a search is performed based on the command keyword to find command information matching the command keyword.
优选的,所述显示所述检索结果包括:Preferably, the displaying the search results includes:
基于被检索到的命令在命令模式中的字母顺序或者被检索到的命令的被检索次数,对检索到的命令进行编码排序;sorting the retrieved commands based on their alphabetical order in the command pattern or the number of times the retrieved commands have been retrieved;
将检索到的命令按照所述编码排序顺序依次进行显示。The retrieved commands are displayed sequentially according to the encoding sort order.
本发明实施例还提供了一种在网络设备上实现命令查找的装置,包括:The embodiment of the present invention also provides a device for realizing command search on network equipment, including:
查询命令解析模块,用于通过对输入的查询命令进行解析,获取需要进行检索的命令信息,所述命令信息包括命令关键字、命令参数以及命令模式信息中的至少一项;The query command parsing module is used to obtain command information that needs to be retrieved by parsing the input query command, and the command information includes at least one of command keywords, command parameters and command mode information;
查询命令执行模块,用于基于所述命令信息,在预先生成的查询数据源文件中进行检索,获取一检索结果,所述查询数据源文件的生成过程包括:依次读取网络设备所支持的脚本文件集中每个脚本文件,并对每个脚本文件进行解析生成查询数据源文件,所述查询数据源文件中包括每条命令的检索信息,所述检索信息包括命令关键字、命令参数、命令语法关键字、命令执行模式信息、命令显示时的格式信息中的至少一项;The query command execution module is used to search in the pre-generated query data source file based on the command information and obtain a search result. The generation process of the query data source file includes: sequentially reading the scripts supported by the network device Each script file is collected in the file, and each script file is parsed to generate a query data source file. The query data source file includes retrieval information for each command, and the retrieval information includes command keywords, command parameters, and command syntax. At least one of keywords, command execution mode information, and format information when the command is displayed;
查询结果显示模块,用于显示所述检索结果。The query result display module is used to display the retrieval result.
优选的,所述装置还包括:Preferably, the device also includes:
查询数据源文件生成模块,用于生成所述查询数据源文件。A query data source file generating module, configured to generate the query data source file.
优选的,所述装置还包括:Preferably, the device also includes:
排序模块,用于基于命令模式区中所包括的命令模式查询次数信息,对命令模式在查询数据源文件中的位置进行调整;和/或,用于基于命令数据区中命令的查询次数,对命令在命令模式中的位置进行调整。The sorting module is used to adjust the position of the command mode in the query data source file based on the command mode query times information included in the command mode area; The position of the command in command mode is adjusted.
优选的,所述装置还包括:Preferably, the device also includes:
加载模块,用于将查询数据源文件生成模块生成的查询数据源文件加载至网络设备的版本集中,以便在网络设备启动时,将所述查询数据源文件加载至所述网络设备中。The loading module is configured to load the query data source file generated by the query data source file generation module into the version set of the network device, so that the query data source file is loaded into the network device when the network device is started.
从以上所述可以看出,本发明提供的在网络设备上实现命令查找的方法及装置,通过对输入的查询命令进行解析,获取需要进行检索的命令信息,所述命令信息包括命令关键字、命令参数以及命令模式信息中的至少一项;基于所述命令信息,在预先建立的查询数据源文件中进行检索,获取一检索结果,所述查询数据源文件的生成过程包括:依次读取网络设备所支持的脚本文件集中每个脚本文件,并对每个脚本文件进行解析生成查询数据源文件,所述查询数据源文件中包括每条命令的检索信息,所述检索信息包括命令关键字、命令参数、命令语法关键字、命令执行模式信息、命令显示时的格式信息中的至少一项;显示所述检索结果。从而可方便用户获取网络设备配置所需的命令信息,提高了网络设备的易用性。It can be seen from the above that the method and device for realizing command search on network equipment provided by the present invention obtain command information that needs to be retrieved by analyzing the input query command, and the command information includes command keywords, At least one of command parameters and command mode information; based on the command information, search in the pre-established query data source file to obtain a search result, and the generation process of the query data source file includes: sequentially reading the network The script files supported by the device collect each script file, and analyze each script file to generate a query data source file, the query data source file includes retrieval information for each command, and the retrieval information includes command keywords, At least one of command parameters, command syntax keywords, command execution mode information, and command display format information; displaying the search result. Therefore, it is convenient for the user to obtain the command information required for network device configuration, and the usability of the network device is improved.
附图说明Description of drawings
为了更清楚地说明本发明实施例或现有技术中的技术方案,下面将对实施例或现有技术描述中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本发明的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动性的前提下,还可以根据这些附图获得其他的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the following will briefly introduce the drawings that need to be used in the description of the embodiments or the prior art. Obviously, the accompanying drawings in the following description are only These are some embodiments of the present invention. For those skilled in the art, other drawings can also be obtained according to these drawings without any creative effort.
图1为本发明实施例提供的在网络设备上实现命令查找的方法流程示意图一;FIG. 1 is a first schematic flow diagram of a method for implementing command search on a network device provided by an embodiment of the present invention;
图2为本发明实施例提供的在网络设备上实现命令查找的方法流程示意图二;FIG. 2 is a second schematic flow diagram of a method for implementing command search on a network device provided by an embodiment of the present invention;
图3为本发明实施例提供的在网络设备上实现命令查找的装置结构示意图一;FIG. 3 is a first schematic structural diagram of an apparatus for realizing command search on a network device provided by an embodiment of the present invention;
图4为本发明实施例提供的在网络设备上实现命令查找的装置结构示意图二。FIG. 4 is a second structural diagram of an apparatus for implementing command search on a network device provided by an embodiment of the present invention.
具体实施方式detailed description
为使本发明实施例的目的、技术方案和优点更加清楚,下面将结合本发明实施例的附图,对本发明实施例的技术方案进行清楚、完整地描述。显然,所描述的实施例是本发明的一部分实施例,而不是全部的实施例。基于所描述的本发明的实施例,本领域普通技术人员所获得的所有其他实施例,都属于本发明保护的范围。In order to make the purpose, technical solutions and advantages of the embodiments of the present invention more clear, the following will clearly and completely describe the technical solutions of the embodiments of the present invention in conjunction with the drawings of the embodiments of the present invention. Apparently, the described embodiments are some, not all, embodiments of the present invention. All other embodiments obtained by those skilled in the art based on the described embodiments of the present invention belong to the protection scope of the present invention.
除非另作定义,此处使用的技术术语或者科学术语应当为本发明所属领域内具有一般技能的人士所理解的通常意义。本发明专利申请说明书以及权利要求书中使用的“第一”、“第二”以及类似的词语并不表示任何顺序、数量或者重要性,而只是用来区分不同的组成部分。同样,“一个”或者“一”等类似词语也不表示数量限制,而是表示存在至少一个。“连接”或者“相连”等类似的词语并非限定于物理的或者机械的连接,而是可以包括电性的连接,不管是直接的还是间接的。“上”、“下”、“左”、“右”等仅用于表示相对位置关系,当被描述对象的绝对位置改变后,则该相对位置关系也相应地改变。Unless otherwise defined, the technical terms or scientific terms used herein shall have the usual meanings understood by those skilled in the art to which the present invention belongs. "First", "second" and similar words used in the patent application specification and claims of the present invention do not indicate any order, quantity or importance, but are only used to distinguish different components. Likewise, words like "a" or "one" do not denote a limitation in quantity, but indicate that there is at least one. Words such as "connected" or "connected" are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Up", "Down", "Left", "Right" and so on are only used to indicate the relative positional relationship. When the absolute position of the described object changes, the relative positional relationship also changes accordingly.
本发明实施例提供了一种在网络设备上实现命令查找的方法,如图1所示,该方法具体可以包括:The embodiment of the present invention provides a method for realizing command search on a network device, as shown in FIG. 1 , the method may specifically include:
步骤101,通过对输入的查询命令进行解析,获取需要进行检索的命令信息,所述命令信息包括命令关键字、命令参数以及命令模式信息中的至少一项;Step 101: Obtain command information to be retrieved by parsing the input query command, where the command information includes at least one item of command keywords, command parameters and command mode information;
步骤102,基于所述命令信息,在预先建立的查询数据源文件中进行检索,获取一检索结果,所述查询数据源文件的生成过程包括:依次读取网络设备所支持的脚本文件集中每个脚本文件,并对每个脚本文件进行解析生成查询数据源文件,所述查询数据源文件中包括每条命令的检索信息,所述检索信息包括命令关键字、命令参数、命令语法关键字、命令执行模式信息、命令显示时的格式信息中的至少一项;Step 102, based on the command information, perform a search in the pre-established query data source file to obtain a search result. The generation process of the query data source file includes: sequentially reading each script file set supported by the network device Script files, and each script file is parsed to generate a query data source file, the query data source file includes the retrieval information of each command, and the retrieval information includes command keywords, command parameters, command syntax keywords, command At least one of the execution mode information and the format information when the command is displayed;
步骤103,显示所述检索结果。Step 103, displaying the search results.
上述方法的实现,可用以解决对网络配置命令不熟悉或略知一二的用户,由于记不住完整的命令行而导致无法执行所需要命令行的问题,方便用户获取网络设备配置所需的命令信息,极大提高了网络设备的易用性。The implementation of the above method can be used to solve the problem that users who are not familiar with network configuration commands or have a little knowledge of them cannot execute the required command lines because they cannot remember the complete command lines, and it is convenient for users to obtain the required information for network device configuration. Command information greatly improves the usability of network devices.
在一具体实施例中,可预先生成命令行查询检索时所需的查询数据源文件。具体的,在获取需要进行检索的命令信息之前,本发明实施例所提供的技术方案可利用脚本文件语言丰富和强大的类库的特点,编写打包工具,在编译阶段,依据网络设备所支持的脚本文件集,依次读取每个脚本文件,对每个脚本文件进行解析并生成查询数据源文件,该文件中根据每条命令生成命令检索时需要的如下信息:命令关键字、命令参数、语法关键字、及命令回显时的命令格式信息等。In a specific embodiment, the query data source files required for command line query and retrieval can be generated in advance. Specifically, before obtaining the command information that needs to be retrieved, the technical solution provided by the embodiment of the present invention can use the characteristics of rich script file language and powerful class library to write a packaging tool. Script file set, which reads each script file in turn, parses each script file and generates a query data source file, in which the following information required for command retrieval is generated according to each command: command keywords, command parameters, syntax Keywords, and command format information when the command is echoed.
进一步地,本发明实施例中还可以将该查询数据源文件打包加载至网络设备的版本集中,当网络设备启动时,可使查询数据源文件加载到网络设备上,便于命令查询检索时使用。Furthermore, in the embodiment of the present invention, the query data source file can also be packaged and loaded into the version set of the network device. When the network device is started, the query data source file can be loaded onto the network device for use in command query retrieval.
本发明实施例中所涉及的查询数据源文件的格式具体可分为第一部分和第二部分;其中:The format of the query data source file involved in the embodiment of the present invention can be specifically divided into a first part and a second part; wherein:
第一部分为命令模式区,包括命令模式标识、命令模式对应的命令条数、命令模式在查询数据源文件中的位置及命令模式的查询次数;The first part is the command mode area, including the command mode identification, the number of commands corresponding to the command mode, the position of the command mode in the query data source file and the query times of the command mode;
第二部分为命令数据区,包括每个命令模式对应的每条命令的模块名长度、关键字长度、命令格式长度、NO命令格式长度、命令标识、命令模式标识、命令在命令模式中的位置及命令的查询次数。The second part is the command data area, including the module name length, keyword length, command format length, NO command format length, command identifier, command mode identifier, and command position in the command mode of each command corresponding to each command mode and the query times of the command.
上述所涉及的命令模式查询次数,具体可用于对命令模式在查询数据源文件中的位置进行调整,例如,命令模式在查询数据源文件中的位置,按照查询次数从多到少进行排序,命令模式被查询次数每增加一次就调整一次,这样当查找时会优先查找到该命令模式。The query times of the command mode mentioned above can be used to adjust the position of the command mode in the query data source file. For example, the position of the command mode in the query data source file is sorted according to the number of queries from more to less. The command The pattern is adjusted every time the number of queries is increased, so that the command pattern will be searched first when searching.
那么,本发明实施例所提供的方法中,即还可以包括:基于命令模式区中所包括的命令模式查询次数信息,对命令模式在查询数据源文件中的位置进行调整的步骤。Then, the method provided by the embodiment of the present invention may further include: a step of adjusting the position of the command pattern in the query data source file based on the query times information of the command pattern included in the command pattern area.
上述所涉及的命令数据区中的查找次数,具体可用于对命令在命令模式中的位置进行调整,例如,命令在命令模式中的位置按查询次数从多到少进行排序,命令被查询次数每增加一次就调整一次,这样,当查找时会优先查找到该命令。The number of searches in the command data area mentioned above can be used to adjust the position of the command in the command mode. For example, the position of the command in the command mode is sorted according to the number of queries from the most to the least. Adjust it once it is increased, so that the command will be searched first when searching.
那么,本发明实施例所提供的方法中,即还可以包括:基于命令数据区中命令的查询次数,对命令在命令模式中的位置进行调整的步骤。Then, the method provided by the embodiment of the present invention may further include: a step of adjusting the position of the command in the command mode based on the query times of the command in the command data area.
本发明实施例中,用户可在网络设备所提供的OAM(OperationAdministration and Maintenance,操作、管理和维护)等输入界面输入查询命令,根据输入的查询命令的信息进行解析,解析出需要进行检索的命令信息。In the embodiment of the present invention, the user can input a query command on an input interface such as OAM (Operation Administration and Maintenance) provided by the network device, analyze according to the information of the input query command, and parse out the command that needs to be retrieved information.
具体的,命令信息可以包括命令关键字、命令参数以及命令模式信息等,然后通过搜索引擎到查询数据源文件中读取数据源,并进行命令的匹配查找。Specifically, the command information may include command keywords, command parameters, and command mode information, etc., and then read the data source from the query data source file through the search engine, and perform command matching search.
进一步说明的是,若命令信息中存在多个关键字或者命令参数,则可以以空格分隔多个关键字或参数,生成关键字或参数集,并基于关键字或参数集进行匹配查找。而对于命令模式,则可基于输入的命令模式信息,通过匹配算法进行匹配查找。It should be further explained that if there are multiple keywords or command parameters in the command information, the multiple keywords or parameters can be separated by spaces to generate a keyword or parameter set, and a matching search can be performed based on the keyword or parameter set. As for the command mode, based on the input command mode information, a matching search can be performed through a matching algorithm.
下面对本发明实施例所提供的在网络设备上实现命令查找的方法的一个具体实施例进行详细的说明。A specific embodiment of the method for realizing command search on a network device provided by the embodiment of the present invention will be described in detail below.
如图2所示,该实施例具体可以包括:As shown in Figure 2, this embodiment may specifically include:
步骤201:生成查询数据源文件。Step 201: Generate query data source files.
具体的,可在编译阶段,依据网络设备所支持的脚本文件集,依次读取每个脚本文件,对每个脚本文件进行解析并生成查询数据源文件,该文件中根据每条命令生成如下信息:命令关键字匹配需要的<real-key-item>集合,即命令关键字、命令参数、语法关键字,命令回显时需要的命令格式。Specifically, in the compilation stage, according to the script file set supported by the network device, each script file can be read in turn, each script file can be parsed and a query data source file can be generated, and the following information can be generated according to each command in the file : The command keyword matches the required <real-key-item> set, that is, the command keyword, command parameter, syntax keyword, and the command format required when the command is echoed.
进一步地,该步骤中具体还可以包括将生成的查询数据源文件打包到网络设备的版本集中。Further, this step may specifically include packaging the generated query data source file into the version set of the network device.
步骤202:获取查询命令。Step 202: Obtain a query command.
具体的,可通过网络设备所提供的OAM(Operation Administration andMaintenance,操作、管理和维护)等输入界面获取用户输入的查询命令。Specifically, the query command input by the user may be obtained through an input interface such as OAM (Operation Administration and Maintenance) provided by the network device.
该查询命令中具体可携带有命令关键字、命令参数、命令模式等检索参数,该查询命令中可包括上述检索参数中的一种或多种的组合。The query command may specifically carry search parameters such as command keywords, command parameters, and command modes, and the query command may include one or a combination of the above search parameters.
步骤203:通过解析查询命令,获取需要进行检索的命令信息。Step 203: Obtain command information to be retrieved by parsing the query command.
即通过对查询命令进行解析,以获取该查询命令中所包括的命令信息,例如命令关键字、命令参数或命令模式等。That is, the query command is parsed to obtain command information included in the query command, such as command keywords, command parameters, or command modes.
步骤204:基于所述命令信息,在预先建立的查询数据源文件中进行检索。Step 204: Based on the command information, search in pre-established query data source files.
该步骤即为查询命令的执行步骤,根据解析查询命令而获取的命令信息,在查询数据源文件中进行检索即匹配查询,查询原则为:查询与命令信息中命令关键字、命令参数及命令模式等相关的命令是否存在,如果存在,则返回命令格式;如果有反向NO命令,也返回NO命令的格式;如果不存在,则查询下一条命令,直到所有命令都查询完毕。This step is the execution step of the query command. According to the command information obtained by parsing the query command, searching in the query data source file is a matching query. The query principle is: command keywords, command parameters and command modes in the query and command information Whether the relevant commands exist, if so, return the command format; if there is a reverse NO command, also return the format of the NO command; if not, query the next command until all commands are queried.
该实施例中,基于所述命令信息,在预先建立的查询数据源文件中进行检索的过程具体可以包括如下检索操作中的至少一项:In this embodiment, based on the command information, the process of searching in the pre-established query data source file may specifically include at least one of the following retrieval operations:
当所述命令信息包括命令关键字以及命令模式信息时,在所述命令模式中,基于所述命令关键字进行检索,查找与所述命令关键字匹配的命令信息;When the command information includes command keywords and command mode information, in the command mode, search based on the command keywords to find command information matching the command keywords;
当所述命令信息包括命令关键字时,在所有命令模式中,基于所述命令关键字进行检索,查找与所述命令关键字匹配的命令信息;When the command information includes a command keyword, in all command modes, search based on the command keyword to find command information matching the command keyword;
当所述命令信息包括命令关键字时,在默认的命令模式中,基于所述命令关键字进行检索,查找与所述命令关键字匹配的命令信息。When the command information includes a command keyword, in a default command mode, a search is performed based on the command keyword to find command information matching the command keyword.
步骤205:显示检索结果。Step 205: Display the search results.
根据查询检索结果返回的信息进行显示,显示的信息具体可以包括命令模式、命令关键字、命令参数中的一种或多种组合。The display is performed according to the information returned by the query and retrieval results, and the displayed information may specifically include one or more combinations of command modes, command keywords, and command parameters.
在显示检索结果过程中,具体还可以包括以下步骤:In the process of displaying the retrieval results, the following steps may be specifically included:
基于被检索到的命令在命令模式中的字母序或者被检索到的命令的被检索次数,对检索到的命令进行编码排序;Based on the alphabetical order of the retrieved commands in the command mode or the number of times the retrieved commands are retrieved, the retrieved commands are coded and sorted;
将检索到的命令按照所述编码排序顺序,依次进行显示。The retrieved commands are displayed sequentially according to the encoding sort order.
本发明实施例还提供了一种在网络设备上实现命令查找的装置,如图3所示,该装置具体可以包括:The embodiment of the present invention also provides an apparatus for realizing command search on a network device, as shown in FIG. 3 , the apparatus may specifically include:
查询命令解析模块301,用于通过对输入的查询命令进行解析,获取需要进行检索的命令信息,所述命令信息包括命令关键字、命令参数以及命令模式信息中的至少一项;The query command parsing module 301 is configured to obtain command information that needs to be retrieved by parsing the input query command, and the command information includes at least one of command keywords, command parameters and command mode information;
查询命令执行模块302,用于基于所述命令信息,在预先建立的查询数据源文件中进行检索,获取一检索结果,所述查询数据源文件的生成过程包括:依次读取网络设备所支持的脚本文件集中每个脚本文件,并对每个脚本文件进行解析生成查询数据源文件,所述查询数据源文件中包括每条命令的检索信息,所述检索信息包括命令关键字、命令参数、命令语法关键字、命令执行模式信息、命令显示时的格式信息中的至少一项;The query command execution module 302 is used to search in the pre-established query data source file based on the command information and obtain a search result. The generation process of the query data source file includes: sequentially reading the Script files are collected for each script file, and each script file is parsed to generate a query data source file. The query data source file includes retrieval information of each command, and the retrieval information includes command keywords, command parameters, command At least one of syntax keywords, command execution mode information, and format information when the command is displayed;
查询结果显示模块303,用于显示所述检索结果。The query result display module 303 is configured to display the retrieval result.
在一具体实施例中,如图4所示,上述装置具体还可以包括:In a specific embodiment, as shown in FIG. 4, the above-mentioned device may further include:
查询数据源文件生成模块304,用于依次读取网络设备所支持的脚本文件集中每个脚本文件,并对每个脚本文件进行解析生成查询数据源文件,所述查询数据源文件中包括每条命令的检索信息,所述检索信息包括命令关键字、命令参数、命令语法关键字、命令执行模式信息、命令显示格式信息中的至少一项。The query data source file generation module 304 is used to sequentially read each script file in the script file set supported by the network device, and parse each script file to generate a query data source file, which includes each The retrieval information of the command, the retrieval information includes at least one item of command keywords, command parameters, command syntax keywords, command execution mode information, and command display format information.
在一具体实施例中,如图4所示,上述装置具体还可以包括:In a specific embodiment, as shown in FIG. 4, the above-mentioned device may further include:
排序模块305,用于基于命令模式区中所包括的命令模式查询次数信息,对命令模式在查询数据源文件中的位置信息进行排序调整;和/或,用于基于命令数据区中命令的查询次数,对命令在命令模式中的位置信息进行排序调整。The sorting module 305 is used to sort and adjust the position information of the command mode in the query data source file based on the command mode query times information included in the command mode area; and/or, to query based on the command in the command data area Number of times, sort and adjust the position information of the command in the command mode.
在一具体实施例中,如图4所示,上述装置具体还可以包括:In a specific embodiment, as shown in FIG. 4, the above-mentioned device may further include:
加载模块306,用于将查询数据源文件生成模块生成的查询数据源文件加载至网络设备的版本集中,以便在网络设备启动时,将所述查询数据源文件加载至所述网络设备中。The loading module 306 is configured to load the query data source file generated by the query data source file generation module into the version set of the network device, so that the query data source file is loaded into the network device when the network device is started.
从以上所述可以看出,本发明提供的在网络设备上实现命令查找的方法及装置,通过对输入的查询命令进行解析,获取需要进行检索的命令信息,所述命令信息包括命令关键字、命令参数以及命令模式信息中的至少一项;基于所述命令信息,在预先建立的查询数据源文件中进行检索,获取一检索结果,所述查询数据源文件的生成过程包括:依次读取网络设备所支持的脚本文件集中每个脚本文件,并对每个脚本文件进行解析生成查询数据源文件,所述查询数据源文件中包括每条命令的检索信息,所述检索信息包括命令关键字、命令参数、命令语法关键字、命令执行模式信息、命令显示时的格式信息中的至少一项;显示所述检索结果。从而可方便用户获取网络设备配置所需的命令信息,提高了网络设备的易用性。It can be seen from the above that the method and device for realizing command search on network equipment provided by the present invention obtain command information that needs to be retrieved by analyzing the input query command, and the command information includes command keywords, At least one of command parameters and command mode information; based on the command information, search in the pre-established query data source file to obtain a search result, and the generation process of the query data source file includes: sequentially reading the network The script files supported by the device collect each script file, and analyze each script file to generate a query data source file, the query data source file includes retrieval information for each command, and the retrieval information includes command keywords, At least one of command parameters, command syntax keywords, command execution mode information, and command display format information; displaying the search result. Therefore, it is convenient for the user to obtain the command information required for network device configuration, and the usability of the network device is improved.
以上所述仅是本发明的优选实施方式,应当指出,对于本技术领域的普通技术人员来说,在不脱离本发明技术原理的前提下,还可以做出若干改进和替换,这些改进和替换也应视为本发明的保护范围。The above is only a preferred embodiment of the present invention, it should be pointed out that for those of ordinary skill in the art, without departing from the technical principle of the present invention, some improvements and replacements can also be made, these improvements and replacements It should also be regarded as the protection scope of the present invention.
Claims (11)
Priority Applications (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510355553.3A CN106301870A (en) | 2015-06-25 | 2015-06-25 | A kind of method and device realizing command lookup on network devices |
| PCT/CN2016/085604 WO2016206546A1 (en) | 2015-06-25 | 2016-06-13 | Method and device for searching command on network device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| CN201510355553.3A CN106301870A (en) | 2015-06-25 | 2015-06-25 | A kind of method and device realizing command lookup on network devices |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| CN106301870A true CN106301870A (en) | 2017-01-04 |
Family
ID=57584465
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| CN201510355553.3A Pending CN106301870A (en) | 2015-06-25 | 2015-06-25 | A kind of method and device realizing command lookup on network devices |
Country Status (2)
| Country | Link |
|---|---|
| CN (1) | CN106301870A (en) |
| WO (1) | WO2016206546A1 (en) |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108632437A (en) * | 2017-03-17 | 2018-10-09 | 北京搜狗科技发展有限公司 | A kind of information processing method and device, a kind of device for information processing |
| CN114417286A (en) * | 2022-01-27 | 2022-04-29 | 北京金山云网络技术有限公司 | Access method and device of electronic health record system and electronic equipment |
Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1336770A (en) * | 2000-09-15 | 2002-02-20 | 深圳市中兴通讯股份有限公司 | Operation and maintenance of router and storage and explanation of configuration command |
| CN1534460A (en) * | 2003-03-28 | 2004-10-06 | 烽火通信科技股份有限公司 | Management method possessing real time helping function in insertion type system |
| US20050138557A1 (en) * | 2003-12-04 | 2005-06-23 | Alcatel | Method of configuring managed entities in a communications network using configuration templates |
| CN101009591A (en) * | 2005-12-01 | 2007-08-01 | 阿尔卡特公司 | Method and system for configuring network devices through an operations support system interface |
| CN102006183A (en) * | 2010-11-12 | 2011-04-06 | 百度在线网络技术(北京)有限公司 | Configuration parameter based Method and configuration equipment for configuring network equipment |
-
2015
- 2015-06-25 CN CN201510355553.3A patent/CN106301870A/en active Pending
-
2016
- 2016-06-13 WO PCT/CN2016/085604 patent/WO2016206546A1/en not_active Ceased
Patent Citations (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN1336770A (en) * | 2000-09-15 | 2002-02-20 | 深圳市中兴通讯股份有限公司 | Operation and maintenance of router and storage and explanation of configuration command |
| CN1534460A (en) * | 2003-03-28 | 2004-10-06 | 烽火通信科技股份有限公司 | Management method possessing real time helping function in insertion type system |
| US20050138557A1 (en) * | 2003-12-04 | 2005-06-23 | Alcatel | Method of configuring managed entities in a communications network using configuration templates |
| CN101009591A (en) * | 2005-12-01 | 2007-08-01 | 阿尔卡特公司 | Method and system for configuring network devices through an operations support system interface |
| CN102006183A (en) * | 2010-11-12 | 2011-04-06 | 百度在线网络技术(北京)有限公司 | Configuration parameter based Method and configuration equipment for configuring network equipment |
Cited By (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108632437A (en) * | 2017-03-17 | 2018-10-09 | 北京搜狗科技发展有限公司 | A kind of information processing method and device, a kind of device for information processing |
| CN114417286A (en) * | 2022-01-27 | 2022-04-29 | 北京金山云网络技术有限公司 | Access method and device of electronic health record system and electronic equipment |
Also Published As
| Publication number | Publication date |
|---|---|
| WO2016206546A1 (en) | 2016-12-29 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN101996195B (en) | Method, device and equipment for searching voice information in audio files | |
| JP5600736B2 (en) | Database management method and system | |
| CN104991905B (en) | A kind of mathematic(al) representation search method based on level index | |
| US20140108418A1 (en) | Searching code by specifying its behavior | |
| CN102647414B (en) | Protocol analysis method, protocol analysis device and protocol analysis system | |
| JP4722195B2 (en) | Database message analysis support program, method and apparatus | |
| CN110515896B (en) | Model resource management method, model file manufacturing method, device and system | |
| CN110532347A (en) | A kind of daily record data processing method, device, equipment and storage medium | |
| JP5800441B2 (en) | Method and apparatus for document compression, decompression and query | |
| CN101477527A (en) | Multimedia resource retrieval method and apparatus | |
| CN115422167B (en) | Cross-data source database view visualization construction method and system | |
| CN102841886B (en) | Split the method and apparatus of document | |
| CN102346765B (en) | A kind of method of audit memory data and device | |
| CN108491326A (en) | Behavioral test recombination method, device and storage medium | |
| CN105183916A (en) | Device and method for managing unstructured data | |
| CN104156373B (en) | Coding format detection method and device | |
| CN102004640B (en) | Method and device for rapidly providing customized software package | |
| CN106301870A (en) | A kind of method and device realizing command lookup on network devices | |
| CN101944117B (en) | Sorting and searching method and system based on database | |
| CN101650738A (en) | Omnidirectional intelligent search method for Kara OK songs | |
| KR100899930B1 (en) | Method and system for generating association data class | |
| CN103473264A (en) | A note-taking and rapid reproduction method applied to literature reading in farmhouse bookstores | |
| KR101134073B1 (en) | Search Method for using word association between search keyword and search result and system thereof | |
| JP2012252694A (en) | Method and apparatus of searching for instance path based on ontology schema | |
| CN103365966B (en) | Method and device for storing node information in Internet of things |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| C06 | Publication | ||
| PB01 | Publication | ||
| SE01 | Entry into force of request for substantive examination | ||
| SE01 | Entry into force of request for substantive examination | ||
| WD01 | Invention patent application deemed withdrawn after publication | ||
| WD01 | Invention patent application deemed withdrawn after publication |
Application publication date: 20170104 |