WO2016206546A1 - Method and device for searching command on network device - Google Patents

Method and device for searching command on network device Download PDF

Info

Publication number
WO2016206546A1
WO2016206546A1 PCT/CN2016/085604 CN2016085604W WO2016206546A1 WO 2016206546 A1 WO2016206546 A1 WO 2016206546A1 CN 2016085604 W CN2016085604 W CN 2016085604W WO 2016206546 A1 WO2016206546 A1 WO 2016206546A1
Authority
WO
WIPO (PCT)
Prior art keywords
command
information
data source
query
mode
Prior art date
Application number
PCT/CN2016/085604
Other languages
French (fr)
Chinese (zh)
Inventor
陈维花
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2016206546A1 publication Critical patent/WO2016206546A1/en

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
    • 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

Definitions

  • This application relates to, but is not limited to, the field of communication technology.
  • a network device such as a switch, a router, etc.
  • a network device in the related art usually uses a Command Line Interface (CLI) on the Operation Administration and Maintenance (OAM) interface. Configure the device parameters by using the command line.
  • CLI Command Line Interface
  • OAM Operation Administration and Maintenance
  • the command line can include the execution mode of the command line, keywords, and parameters.
  • the corresponding operation can be performed correctly only when the user completes the command line.
  • This document provides a method and device for implementing command lookup on a network device, so that the user can easily obtain command information required for network device configuration, and improve the ease of use of the network device.
  • a method for implementing command lookup on a network device including:
  • command information to be retrieved by parsing the input query command, where the command information includes at least one of a command keyword, a command parameter, and command mode information;
  • each of the query data source files includes retrieval information of each command, and the retrieval information includes Command keyword, command parameter, command At least one of a syntax keyword, command execution mode information, and format information when the command is displayed;
  • the search result is displayed.
  • the method before the parsing of the input query command to obtain the command information to be retrieved, the method further includes:
  • the format of the query data source file includes a first part and a second part
  • the first part is a command mode area, where the command mode area includes command mode identification information, a number of commands corresponding to the command mode, location information of the command mode in the query data source file, and query number information of the command mode. ;
  • the second part is a command data area
  • the command data area includes module name length information, keyword length information, command format length information, NO command format length information, command identification information, and commands for each command corresponding to each command mode.
  • the method further includes:
  • the method before the parsing of the input query command to obtain the command information to be retrieved, the method further includes:
  • the performing, in the pre-generated query data source file, according to the command information includes:
  • the command information includes a command keyword and command mode information
  • the command mode indicated by the command mode information performing a search according to the command keyword to find command information matching the command keyword; and / or,
  • command information includes a command keyword
  • a search is performed according to the command keyword to find command information that matches the command keyword
  • the command information includes a command keyword
  • a search is performed according to the command keyword to find command information that matches the command keyword.
  • the displaying the search result includes:
  • the retrieved commands are sequentially displayed in the order in which the codes are sorted.
  • a device for implementing command lookup on a network device comprising:
  • the query command parsing module is configured to: obtain the command information to be retrieved by parsing the input query command, where the command information includes at least one of a command keyword, a command parameter, and command mode information;
  • the query command execution module is configured to perform a search in the pre-generated query data source file according to the command information obtained by the query command parsing module, and obtain a search result
  • the query data source file generation process includes : sequentially reading each script file in the script file set supported by the network device, and parsing each of the script files to generate a query data source file corresponding to each script file, and each of the query data source files Retrieving information for each command, the retrieval information including at least one of a command keyword, a command parameter, a command syntax keyword, command execution mode information, and format information when the command is displayed;
  • the query result display module is configured to: display the search result obtained by the query command execution module.
  • the device further includes:
  • the query data source file generating module is configured to: generate the query data source file.
  • the device further includes:
  • a sorting module configured to: adjust a position of the command mode in the query data source file according to query number information of a command mode included in a command mode area; and/or,
  • the sorting module is configured to: according to the number of queries of commands included in the command data area, The position of the command is adjusted in the command mode.
  • the device further includes:
  • the loading module is configured to: load the generated query data source file into a version set of the network device, so that when the network device starts, the query data source file is loaded into the network device.
  • the method and device for implementing command lookup on a network device obtains command information to be retrieved by parsing an input query command, where the command information includes a command keyword, a command parameter, and command mode information. At least one item; according to the command information, searching in a pre-generated query data source file to obtain a retrieval result, wherein the generating process of the query data source file includes: sequentially reading each script in the script file set supported by the network device a file, and parsing each script file to generate a query data source file corresponding to each script file, each query data source file includes retrieval information of each command, the retrieval information including command keywords, command parameters, commands At least one of a syntax keyword, command execution mode information, and format information when the command is displayed; thereby displaying the search result.
  • the embodiment of the invention achieves the technical effect of facilitating the user to obtain command information required for network device configuration, and improves the ease of use of the network device.
  • FIG. 1 is a schematic flowchart of a method for implementing command lookup on a network device according to an embodiment of the present invention
  • FIG. 2 is a schematic flowchart of another method for implementing command lookup on a network device according to an embodiment of the present invention
  • FIG. 3 is a schematic structural diagram of an apparatus for implementing command lookup on a network device according to an embodiment of the present disclosure
  • FIG. 4 is a schematic structural diagram of another apparatus for implementing command lookup on a network device according to an embodiment of the present invention.
  • FIG. 1 is a schematic flowchart diagram of a method for implementing command lookup on a network device according to an embodiment of the present invention.
  • the method provided in this embodiment may include the following steps, that is, steps 101 to 103:
  • Step 101 Acquire, by parsing the input query command, command information to be retrieved, where the command information includes at least one of a command keyword, a command parameter, and command mode information;
  • Step 102 Perform a search in the pre-generated query data source file according to the command information, and obtain a search result
  • the query data source file generation process includes: sequentially reading each script in the script file set supported by the network device. a file, and parsing each script file to generate a query data source file corresponding to each script file, each query data source file includes retrieval information of each command, the retrieval information includes a command keyword, a command parameter, At least one of a command syntax keyword, command execution mode information, and format information when the command is displayed;
  • step 103 the search result is displayed.
  • the implementation of the foregoing method in this embodiment may be used to solve the problem that a user who is unfamiliar with the network configuration command or knows a little is unable to execute the required command line because the complete command line cannot be remembered. It is convenient for users to obtain the command information required for network device configuration, which greatly improves the ease of use of network devices.
  • the query data source file required for the command line query retrieval may be generated in advance.
  • the technical solution provided by the embodiment of the present invention can utilize the characteristics of the script file language rich and powerful class library to write a packaging tool, which is supported by the network device during the compiling phase.
  • a set of script files each script file is read in turn, each script file is parsed and a query data source file corresponding to each script file is generated, and the query data source file includes each command generation command required for retrieval of the command.
  • Retrieving information wherein the retrieval information includes one or more of the following: a command keyword, a command parameter, a command syntax keyword, command execution mode information, and format information when the command is displayed.
  • the query data source file may also be packaged and loaded into a version set of the network device, so that when the network device is started, the query data source file is loaded on the network device, It is convenient for command query retrieval.
  • the format of the query data source file involved in the embodiment of the present invention may include a first part and a second part;
  • the first part is a command mode area, where the command mode area includes command mode identification information, a number of commands corresponding to the command mode, a position of the command mode in the query data source file, and a query mode information of the command mode;
  • the second part is a command data area
  • the command data area includes module name length information, keyword length information, command format length information, NO command format length information, command identification information, and command mode of each command corresponding to each command mode. Identification information, the location of the command in the command mode, and the number of times the command is queried.
  • the query quantity information of the command mode in the command mode area mentioned above may be used to adjust the position of the command mode in the query data source file, for example, the command mode is querying data.
  • the position in the source file is sorted according to the number of queries. The number of times the command mode is queried is adjusted once, so that the command mode with more queries can be found first.
  • the method provided by the embodiment of the present invention may further include: according to the information of the number of times of the command mode included in the command mode area, the position of the command mode in the query data source file Line adjustment.
  • the information of the number of times of command in the command data area involved in the foregoing may 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 inquired.
  • the number of times is sorted from the most to the least, and the number of times the command is queried is adjusted once every time, so that the command with a large number of queries can be preferentially found in the search.
  • the method provided by the embodiment of the present invention may further include the step of adjusting the position of the command in the command mode according to the number of queries of the command included in the command data area.
  • the user can input a query command in an input interface such as OAM provided by the network device, parse the information of the input query command, and parse the command information that needs to be retrieved.
  • an input interface such as OAM provided by the network device
  • the command information in the embodiment of the present invention may include a command keyword, a command parameter, a command mode information, and the like, and then the data source is read by the search engine to the query data source file, and the matching search of the command is performed.
  • multiple command keywords or command parameters may be separated by spaces to generate a command keyword or a command parameter set, and according to the command keyword set or command.
  • the parameter set is used for matching lookup.
  • the matching algorithm can be used to perform matching search according to the input command mode information.
  • FIG. 2 is a schematic flowchart diagram of another method for implementing command lookup on a network device according to an embodiment of the present invention.
  • the method provided in this embodiment may include the following steps, that is, steps 201 to 205:
  • Step 201 Generate a query data source file.
  • each script file may be sequentially read according to a script file set supported by the network device in the compiling stage, and each script file is parsed and a query data source file corresponding to each script file is generated.
  • Each of the query data source files includes retrieval information of each command, and the retrieval information includes: a ⁇ real-key-item> set required for command keyword matching, that is, a command keyword, a command parameter, and a command syntax keyword.
  • Command execution mode information and format information when the command is displayed At least one of them.
  • the method for generating the query data source file in the embodiment may further include: loading the generated query data source file into a version set of the network device, so that the query data source file is loaded when the network device starts. Go to the network device.
  • Step 202 Acquire a query command.
  • the query command input by the user may be obtained through an input interface such as OAM provided by the network device.
  • the query command of the embodiment may carry a search parameter such as a command keyword, a command parameter, and command mode information, and the query command may include a combination of one or more of the foregoing search parameters.
  • Step 203 Obtain command information to be retrieved by parsing the query command.
  • the command information included in the query command is obtained by parsing the query command.
  • the obtained command information includes a command keyword, a command parameter, or command mode information.
  • Step 204 Perform a search in the pre-generated query data source file according to the command information.
  • the step is the execution step of the query command, and the command information obtained by parsing the query command is searched in the query data source file, that is, the matching query is performed.
  • the query principle is: the command keyword and the command parameter included in the query and the command information. Whether the command mode information and other related commands exist, if it exists, the command format is returned; if there is a reverse NO command, the format of the NO command is also returned; if not, the next command is queried until all commands are queried.
  • the process of performing the retrieval in the pre-generated query data source file may include at least one of the following retrieval operations:
  • the search is performed according to the command keyword, and the command information matching the command keyword is searched;
  • the search is performed according to the command keyword, and the command information matching the command keyword is searched;
  • the command information includes a command keyword
  • a search is performed according to the command keyword to find command information that matches the command keyword.
  • Step 205 Display the search result.
  • the information returned according to the query retrieval result is displayed, and the displayed information may include, for example, one or a combination of a command mode, a command keyword, and a command parameter.
  • the embodiment may further include the following steps:
  • the retrieved commands are sequentially displayed in the order in which the codes are sorted.
  • FIG. 3 is a schematic structural diagram of an apparatus for implementing command lookup on a network device according to an embodiment of the present invention.
  • the apparatus provided in this embodiment may include:
  • the query command parsing module 301 is configured to: obtain, by parsing the input query command, command information to be retrieved, where the command information includes at least one of a command keyword, a command parameter, and command mode information;
  • the query command execution module 302 is configured to perform a search in the pre-generated query data source file according to the command information obtained by the query command parsing module 301, and obtain a search result, where the query data source file generation process includes: sequentially reading Taking each script file in the script file set supported by the network device, and parsing each script file to generate a query data source file corresponding to each script file, and each query data source file includes retrieval information of each command.
  • the retrieval information includes at least one of a command keyword, a command parameter, a command syntax keyword, command execution mode information, and format information when the command is displayed;
  • the query result display module 303 is configured to display the search result obtained by the query command execution module 302.
  • FIG. 4 is a schematic structural diagram of another apparatus for implementing command lookup on a network device according to an embodiment of the present invention. Based on the structure of the device shown in FIG. 3, the device provided in this embodiment may further include:
  • the query data source file generating module 304 is configured to generate a query data source file.
  • the method for generating the query data source file in this embodiment may be: 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 corresponding to each script file, and each query data source file includes retrieval information of each command, and the check
  • the information includes at least one of a command keyword, a command parameter, a command syntax keyword, command execution mode information, and command display format information.
  • the apparatus provided in this embodiment may further include:
  • the sorting module 305 is configured to: perform sorting adjustment on the position information of the command mode in the query data source file according to the query quantity information of the command mode included in the command mode area; and/or,
  • the sorting module 305 is configured to sort and adjust the position information of the command in the command mode according to the number of queries of the commands included in the command data area.
  • the apparatus provided in this embodiment may further include:
  • the loading module 306 is configured to: load the generated query data source file 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; wherein, the loading module is loaded in this embodiment.
  • the 306 loaded query data source file may be generated by the query data source file generation module 304.
  • the method and device for implementing command lookup on a network device obtains command information to be retrieved by parsing an input query command, where the command information includes a command keyword, a command parameter, and command mode information. At least one item; according to the command information, searching in a pre-generated query data source file to obtain a retrieval result, wherein the generating process of the query data source file includes: sequentially reading each script in the script file set supported by the network device a file, and parsing each script file to generate a query data source file corresponding to each script file, each query data source file includes retrieval information of each command, the retrieval information including command keywords, command parameters, commands At least one of a syntax keyword, command execution mode information, and format information when the command is displayed; thereby displaying the search result.
  • the technical effect of facilitating the user to obtain command information required for network device configuration is realized, and the ease of use of the network device is improved.
  • all or part of the steps of the foregoing embodiments may also be implemented by using an integrated circuit, and the steps may be separately fabricated into integrated circuit modules, or multiple modules thereof or The steps are made into a single integrated circuit module.
  • the devices/function modules/functional units in the above embodiments may be implemented by a general-purpose computing device, which may be centralized on a single computing device or distributed over a network of multiple computing devices.
  • the device/function module/functional unit in the above embodiment When the device/function module/functional unit in the above embodiment is implemented in the form of a software function module and sold or used as a stand-alone product, it can be stored in a computer readable storage medium.
  • the above mentioned computer readable storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
  • the embodiment of the present invention obtains the command information to be retrieved by parsing the input query command, and performs a search in the pre-generated query data source file according to the command information, and obtains the search result, thereby displaying the search result;
  • the command information includes at least one of a command keyword, a command parameter, and command mode information
  • the generating 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 The file is parsed to generate a query data source file corresponding to each script file, and the query data source file includes retrieval information of each command, where the retrieval information includes a command keyword, a command parameter, a command syntax keyword, a command execution mode information, At least one of the format information when the command is displayed; the embodiment of the present invention implements the technical effect of facilitating the user to obtain command information required for network device configuration, and improves the ease of use of the network device.

Abstract

A method and device for searching a command on a network device. The method comprises: parsing an inputted query command to acquire command information to be searched for; performing a search in a pre-generated query data source file according to the command information to acquire a search result; and displaying the search result, wherein the command information comprises at least one of a command keyword, a command parameter and command mode information, and a generation process of the query data source file comprises sequentially reading each of script files supported by the network device, and parsing the script files to generate the query data source files corresponding to the script files.

Description

一种在网络设备上实现命令查找的方法及装置Method and device for implementing command search on network device 技术领域Technical field
本申请涉及但不限于通信技术领域。This application relates to, but is not limited to, the field of communication technology.
背景技术Background technique
相关技术中的网络设备(例如交换机、路由器等)通常采用操作、管理和维护(Operation Administration and Maintenance,简称为:OAM)界面上的命令行接口(Command Line Interface,简称为:CLI)对设备参数进行配置,即采用命令行对设备参数进行配置。A network device (such as a switch, a router, etc.) in the related art usually uses a Command Line Interface (CLI) on the Operation Administration and Maintenance (OAM) interface. Configure the device parameters by using the command line.
通常地,命令行可以包括命令行的执行模式,关键字及参数几部分,只有在用户完整的输入命令行时才能正确执行相应的操作。随着用户需求的增加,网络设备所支持的业务功能越来越多,而与业务功能对应的命令集也随之越来越庞大,用户需要记住的命令行越来越多。Generally, the command line can include the execution mode of the command line, keywords, and parameters. The corresponding operation can be performed correctly only when the user completes the command line. As the demand of users increases, more and more business functions are supported by network devices, and the command set corresponding to the business functions becomes larger and larger, and more and more command lines need to be remembered by users.
发明内容Summary of the invention
以下是对本文详细描述的主题的概述。本概述并非是为了限制权利要求的保护范围。The following is an overview of the topics detailed in this document. This Summary is not intended to limit the scope of the claims.
本文提供一种在网络设备上实现命令查找的方法及装置,从而可方便用户获取网络设备配置所需的命令信息,提高了网络设备的易用性。This document provides a method and device for implementing command lookup on a network device, so that the user can easily obtain command information required for network device configuration, and improve the ease of use of the network device.
一种在网络设备上实现命令查找的方法,包括:A method for implementing command lookup on a network device, including:
通过对输入的查询命令进行解析,获取待进行检索的命令信息,所述命令信息包括命令关键字、命令参数以及命令模式信息中的至少一项;Obtaining command information to be retrieved by parsing the input query command, where the command information includes at least one of a command keyword, a command parameter, and command mode information;
根据所述命令信息,在预先生成的查询数据源文件中进行检索,获取检索结果,其中,所述查询数据源文件的生成过程包括:依次读取网络设备所支持的脚本文件集中每个脚本文件,并对所述每个脚本文件进行解析生成与所述每个脚本文件对应的查询数据源文件,每个所述查询数据源文件中包括每条命令的检索信息,所述所述检索信息包括命令关键字、命令参数、命令 语法关键字、命令执行模式信息和命令显示时的格式信息中的至少一项;And performing a search in the pre-generated query data source file to obtain a search result according to the command information, where the generating process of the query data source file includes: sequentially reading each script file in the script file set supported by the network device. And parsing each of the script files to generate a query data source file corresponding to each of the script files, each of the query data source files includes retrieval information of each command, and the retrieval information includes Command keyword, command parameter, command At least one of a syntax keyword, command execution mode information, and format information when the command is displayed;
显示所述检索结果。The search result is displayed.
可选地,所述通过输入的查询命令进行解析,获取待进行检索的命令信息之前,所述方法还包括:Optionally, before the parsing of the input query command to obtain the command information to be retrieved, the method further includes:
生成所述查询数据源文件。Generating the query data source file.
可选地,所述查询数据源文件的格式包括第一部分和第二部分;Optionally, the format of the query data source file includes a first part and a second part;
其中,所述第一部分为命令模式区,所述命令模式区包括命令模式标识信息、命令模式对应的命令条数、命令模式在所述查询数据源文件中的位置信息及命令模式的查询次数信息;The first part is a command mode area, where the command mode area includes command mode identification information, a number of commands corresponding to the command mode, location information of the command mode in the query data source file, and query number information of the command mode. ;
第二部分为命令数据区,所述命令数据区包括每个命令模式对应的每条命令的模块名长度信息、关键字长度信息、命令格式长度信息、NO命令格式长度信息、命令标识信息、命令模式标识信息、命令在命令模式中的位置信息及命令的查询次数信息。The second part is a command data area, and the command data area includes module name length information, keyword length information, command format length information, NO command format length information, command identification information, and commands for each command corresponding to each command mode. The mode identification information, the position information of the command in the command mode, and the number of times of querying the command.
可选地,所述方法还包括:Optionally, the method further includes:
根据所述命令模式区中包括的命令模式的查询次数信息,对所述命令模式在所述查询数据源文件中的位置进行调整;和/或Adjusting, according to the query number information of the command mode included in the command mode area, the position of the command mode in the query data source file; and/or
根据所述命令数据区中包括的命令的查询次数信息,对所述命令在所述命令模式中的位置进行调整。Adjusting the position of the command in the command mode according to the query number information of the command included in the command data area.
可选地,所述通过输入的查询命令进行解析,获取待进行检索的命令信息之前,所述方法还包括:Optionally, before the parsing of the input query command to obtain the command information to be retrieved, the method further includes:
将生成的所述查询数据源文件加载到所述网络设备的版本集中,以使得在所述网络设备启动时,将所述查询数据源文件加载到所述网络设备中。Loading the generated query data source file into a version set of the network device, so that when the network device is started, the query data source file is loaded into the network device.
可选地,所述根据所述命令信息,在预先生成的查询数据源文件中进行检索,包括:Optionally, the performing, in the pre-generated query data source file, according to the command information, includes:
当所述命令信息包括命令关键字和命令模式信息时,在所述命令模式信息所表示的命令模式中,根据所述命令关键字进行检索,查找与所述命令关键字匹配的命令信息;和/或, When the command information includes a command keyword and command mode information, in the command mode indicated by the command mode information, performing a search according to the command keyword to find command information matching the command keyword; and / or,
当所述命令信息包括命令关键字时,在所有的命令模式中,根据所述命令关键字进行检索,查找与所述命令关键字匹配的命令信息;和/或,When the command information includes a command keyword, in all command modes, a search is performed according to the command keyword to find command information that matches the command keyword; and/or,
当所述命令信息包括命令关键字时,在默认的命令模式中,根据所述命令关键字进行检索,查找与所述命令关键字匹配的命令信息。When the command information includes a command keyword, in the default command mode, a search is performed according to the command keyword to find command information that matches the command keyword.
可选地,所述显示所述检索结果,包括:Optionally, the displaying the search result includes:
根据检索到的命令在命令模式中的字母顺序或者所述检索到的命令的被检索次数,对所述检索到的命令进行编码排序;And encoding the retrieved commands according to an alphabetical order in the command mode or a retrieved number of the retrieved commands;
将所述检索到的命令按照所述编码排序顺序依次进行显示。The retrieved commands are sequentially displayed in the order in which the codes are sorted.
一种在网络设备上实现命令查找的装置,包括:A device for implementing command lookup on a network device, comprising:
查询命令解析模块,设置为:通过对输入的查询命令进行解析,获取待进行检索的命令信息,所述命令信息包括命令关键字、命令参数以及命令模式信息中的至少一项;The query command parsing module is configured to: obtain the command information to be retrieved by parsing the input query command, where the command information includes at least one of a command keyword, a command parameter, and command mode information;
查询命令执行模块,设置为:根据所述查询命令解析模块获取的所述命令信息,在预先生成的查询数据源文件中进行检索,获取检索结果,其中,所述查询数据源文件的生成过程包括:依次读取网络设备所支持的脚本文件集中每个脚本文件,并对所述每个脚本文件进行解析生成与所述每个脚本文件对应的查询数据源文件,每个所述查询数据源文件中包括每条命令的检索信息,所述检索信息包括命令关键字、命令参数、命令语法关键字、命令执行模式信息和命令显示时的格式信息中的至少一项;The query command execution module is configured to perform a search in the pre-generated query data source file according to the command information obtained by the query command parsing module, and obtain a search result, where the query data source file generation process includes : sequentially reading each script file in the script file set supported by the network device, and parsing each of the script files to generate a query data source file corresponding to each script file, and each of the query data source files Retrieving information for each command, the retrieval information including at least one of a command keyword, a command parameter, a command syntax keyword, command execution mode information, and format information when the command is displayed;
查询结果显示模块,设置为:显示所述查询命令执行模块获取的所述检索结果。The query result display module is configured to: display the search result obtained by the query command execution module.
可选地,所述装置还包括:Optionally, the device further includes:
查询数据源文件生成模块,设置为:生成所述查询数据源文件。The query data source file generating module is configured to: generate the query data source file.
可选地,所述装置还包括:Optionally, the device further includes:
排序模块,设置为:根据命令模式区中包括的命令模式的查询次数信息,对所述命令模式在所述查询数据源文件中的位置进行调整;和/或,a sorting module, configured to: adjust a position of the command mode in the query data source file according to query number information of a command mode included in a command mode area; and/or,
所述排序模块,设置为:根据命令数据区中包括的命令的查询次数,对 所述命令在所述命令模式中的位置进行调整。The sorting module is configured to: according to the number of queries of commands included in the command data area, The position of the command is adjusted in the command mode.
可选地,所述装置还包括:Optionally, the device further includes:
加载模块,设置为:将生成的所述查询数据源文件加载到所述网络设备的版本集中,以使得在所述网络设备启动时,将所述查询数据源文件加载到所述网络设备中。The loading module is configured to: load the generated query data source file into a version set of the network device, so that when the network device starts, the query data source file is loaded into the network device.
本发明实施例提供的在网络设备上实现命令查找的方法及装置,通过对输入的查询命令进行解析,获取待进行检索的命令信息,该命令信息包括命令关键字、命令参数以及命令模式信息中的至少一项;根据命令信息,在预先生成的查询数据源文件中进行检索,获取检索结果,其中,查询数据源文件的生成过程包括:依次读取网络设备所支持的脚本文件集中每个脚本文件,并对每个脚本文件进行解析生成与每个脚本文件对应的查询数据源文件,每个查询数据源文件中包括每条命令的检索信息,该检索信息包括命令关键字、命令参数、命令语法关键字、命令执行模式信息和命令显示时的格式信息中的至少一项;从而显示检索结果。本发明实施例实现了方便用户获取网络设备配置所需的命令信息的技术效果,并且提高了网络设备的易用性。The method and device for implementing command lookup on a network device according to an embodiment of the present invention obtains command information to be retrieved by parsing an input query command, where the command information includes a command keyword, a command parameter, and command mode information. At least one item; according to the command information, searching in a pre-generated query data source file to obtain a retrieval result, wherein the generating process of the query data source file includes: sequentially reading each script in the script file set supported by the network device a file, and parsing each script file to generate a query data source file corresponding to each script file, each query data source file includes retrieval information of each command, the retrieval information including command keywords, command parameters, commands At least one of a syntax keyword, command execution mode information, and format information when the command is displayed; thereby displaying the search result. The embodiment of the invention achieves the technical effect of facilitating the user to obtain command information required for network device configuration, and improves the ease of use of the network device.
在阅读并理解了附图和详细描述后,可以明白其他方面。Other aspects will be apparent upon reading and understanding the drawings and detailed description.
附图概述BRIEF abstract
图1为本发明实施例提供的一种在网络设备上实现命令查找的方法的流程示意图;FIG. 1 is a schematic flowchart of a method for implementing command lookup on a network device according to an embodiment of the present invention;
图2为本发明实施例提供的另一种在网络设备上实现命令查找的方法的流程示意图;2 is a schematic flowchart of another method for implementing command lookup on a network device according to an embodiment of the present invention;
图3为本发明实施例提供的一种在网络设备上实现命令查找的装置的结构示意图;FIG. 3 is a schematic structural diagram of an apparatus for implementing command lookup on a network device according to an embodiment of the present disclosure;
图4为本发明实施例提供的另一种在网络设备上实现命令查找的装置的结构示意图。FIG. 4 is a schematic structural diagram of another apparatus for implementing command lookup on a network device according to an embodiment of the present invention.
本发明的实施方式 Embodiments of the invention
下文中将结合附图对本发明的实施方式进行详细说明。需要说明的是,在不冲突的情况下,本文中的实施例及实施例中的特征可以相互任意组合。Embodiments of the present invention will be described in detail below with reference to the accompanying drawings. It should be noted that, in the case of no conflict, the features in the embodiments and the embodiments herein may be arbitrarily combined with each other.
在附图的流程图示出的步骤可以在诸根据一组计算机可执行指令的计算机系统中执行。并且,虽然在流程图中示出了逻辑顺序,但是在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤。The steps illustrated in the flowchart of the figures may be executed in a computer system in accordance with a set of computer executable instructions. Also, although logical sequences are shown in the flowcharts, in some cases the steps shown or described may be performed in a different order than the ones described herein.
本发明以下各实施例使用的技术术语或者科学术语应当为本发明所属领域内具有一般技能的人士所理解的通常意义。本发明专利申请说明书以及权利要求书中使用的“第一”、“第二”以及类似的词语并不表示任何顺序、数量或者重要性,而只是用来区分不同的组成部分。同样,“一个”或者“一”等类似词语也不表示数量限制,而是表示存在至少一个。“连接”或者“相连”等类似的词语并非限定于物理的或者机械的连接,而是可以包括电性的连接,不管是直接的还是间接的。“上”、“下”、“左”、“右”等仅用于表示相对位置关系,当被描述对象的绝对位置改变后,则该相对位置关系也相应地改变。The technical or scientific terms used in the following embodiments of the present invention should be of ordinary meaning as understood by those having ordinary skill in the art to which the invention pertains. The words "first", "second" and similar terms used in the specification and claims of the present invention do not denote any order, quantity, or importance, but are merely used to distinguish different components. Similarly, the words "a" or "an" and the like do not denote a quantity limitation, but mean that there is at least one. The words "connected" or "connected" and the like are not limited to physical or mechanical connections, but may include electrical connections, whether direct or indirect. "Upper", "lower", "left", "right", etc. are only used to indicate the relative positional relationship, and when the absolute position of the object to be described is changed, the relative positional relationship is also changed accordingly.
如图1所示,为本发明实施例提供的一种在网络设备上实现命令查找的方法的流程示意图。本实施例提供的方法可以包括以下步骤,即步骤101~步骤103:FIG. 1 is a schematic flowchart diagram of a method for implementing command lookup on a network device according to an embodiment of the present invention. The method provided in this embodiment may include the following steps, that is, steps 101 to 103:
步骤101,通过对输入的查询命令进行解析,获取待进行检索的命令信息,该命令信息包括命令关键字、命令参数以及命令模式信息中的至少一项;Step 101: Acquire, by parsing the input query command, command information to be retrieved, where the command information includes at least one of a command keyword, a command parameter, and command mode information;
步骤102,根据该命令信息,在预先生成的查询数据源文件中进行检索,获取检索结果,其中,该查询数据源文件的生成过程包括:依次读取网络设备所支持的脚本文件集中每个脚本文件,并对每个脚本文件进行解析生成与该每个脚本文件对应的查询数据源文件,每个查询数据源文件中包括每条命令的检索信息,该检索信息包括命令关键字、命令参数、命令语法关键字、命令执行模式信息和命令显示时的格式信息中的至少一项;Step 102: Perform a search in the pre-generated query data source file according to the command information, and obtain a search result, where the query data source file generation process includes: sequentially reading each script in the script file set supported by the network device. a file, and parsing each script file to generate a query data source file corresponding to each script file, each query data source file includes retrieval information of each command, the retrieval information includes a command keyword, a command parameter, At least one of a command syntax keyword, command execution mode information, and format information when the command is displayed;
步骤103,显示检索结果。In step 103, the search result is displayed.
本实施例中上述方法的实现,可用以解决对网络配置命令不熟悉或略知一二的用户,由于记不住完整的命令行而导致无法执行所需要命令行的问题, 方便用户获取网络设备配置所需的命令信息,极大提高了网络设备的易用性。The implementation of the foregoing method in this embodiment may be used to solve the problem that a user who is unfamiliar with the network configuration command or knows a little is unable to execute the required command line because the complete command line cannot be remembered. It is convenient for users to obtain the command information required for network device configuration, which greatly improves the ease of use of network devices.
可选地,在本发明的一个实施例中,可以预先生成命令行查询检索时所需的查询数据源文件。实际应用中,在获取待进行检索的命令信息之前,本发明实施例所提供的技术方案可利用脚本文件语言丰富和强大的类库的特点,编写打包工具,在编译阶段,依据网络设备所支持的脚本文件集,依次读取每个脚本文件,对每个脚本文件进行解析并生成与每个脚本文件对应的查询数据源文件,该查询数据源文件中包括每条命令生成命令检索时需要的检索信息,其中,该检索信息包括以下一项或多项:命令关键字、命令参数、命令语法关键字、命令执行模式信息和命令显示时的格式信息等。Optionally, in an embodiment of the present invention, the query data source file required for the command line query retrieval may be generated in advance. In the actual application, before obtaining the command information to be retrieved, the technical solution provided by the embodiment of the present invention can utilize the characteristics of the script file language rich and powerful class library to write a packaging tool, which is supported by the network device during the compiling phase. a set of script files, each script file is read in turn, each script file is parsed and a query data source file corresponding to each script file is generated, and the query data source file includes each command generation command required for retrieval of the command. Retrieving information, wherein the retrieval information includes one or more of the following: a command keyword, a command parameter, a command syntax keyword, command execution mode information, and format information when the command is displayed.
可选地,在本发明的一个实施例中,还可以将该查询数据源文件打包加载到网络设备的版本集中,以使得在网络设备启动时,将该查询数据源文件加载到网络设备上,便于命令查询检索时使用。Optionally, in an embodiment of the present invention, the query data source file may also be packaged and loaded into a version set of the network device, so that when the network device is started, the query data source file is loaded on the network device, It is convenient for command query retrieval.
可选地,本发明实施例中所涉及的查询数据源文件的格式可以包括第一部分和第二部分;Optionally, the format of the query data source file involved in the embodiment of the present invention may include a first part and a second part;
其中,第一部分为命令模式区,该命令模式区包括命令模式标识信息、命令模式对应的命令条数、命令模式在查询数据源文件中的位置及命令模式的查询次数信息;The first part is a command mode area, where the command mode area includes command mode identification information, a number of commands corresponding to the command mode, a position of the command mode in the query data source file, and a query mode information of the command mode;
第二部分为命令数据区,该命令数据区包括每个命令模式对应的每条命令的模块名长度信息、关键字长度信息、命令格式长度信息、NO命令格式长度信息、命令标识信息、命令模式标识信息、命令在命令模式中的位置及命令的查询次数信息。The second part is a command data area, and the command data area includes module name length information, keyword length information, command format length information, NO command format length information, command identification information, and command mode of each command corresponding to each command mode. Identification information, the location of the command in the command mode, and the number of times the command is queried.
可选地,在本发明实施例中,上述所涉及的命令模式区中命令模式的查询次数信息,可以用于对命令模式在查询数据源文件中的位置进行调整,例如,命令模式在查询数据源文件中的位置,按照查询次数从多到少进行排序,命令模式被查询的次数每增加一次就调整一次,这样在查找时可以优先查找到查询次数较多的命令模式。Optionally, in the embodiment of the present invention, the query quantity information of the command mode in the command mode area mentioned above may be used to adjust the position of the command mode in the query data source file, for example, the command mode is querying data. The position in the source file is sorted according to the number of queries. The number of times the command mode is queried is adjusted once, so that the command mode with more queries can be found first.
那么,本发明实施例所提供的方法中,还可以包括:根据命令模式区中包括的命令模式的查询次数信息,对命令模式在查询数据源文件中的位置进 行调整。Then, the method provided by the embodiment of the present invention may further include: according to the information of the number of times of the command mode included in the command mode area, the position of the command mode in the query data source file Line adjustment.
可选地,在本发明实施例中,上述所涉及的命令数据区中命令的询次数信息,可以用于对命令在命令模式中的位置进行调整,例如,命令在命令模式中的位置按查询次数从多到少进行排序,命令被查询的次数每增加一次就调整一次,这样在查找时可以优先查找到查询次数较多的命令。Optionally, in the embodiment of the present invention, the information of the number of times of command in the command data area involved in the foregoing may 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 inquired. The number of times is sorted from the most to the least, and the number of times the command is queried is adjusted once every time, so that the command with a large number of queries can be preferentially found in the search.
那么,本发明实施例所提供的方法中,还可以包括:根据命令数据区中包括的命令的查询次数,对命令在命令模式中的位置进行调整的步骤。Then, the method provided by the embodiment of the present invention may further include the step of adjusting the position of the command in the command mode according to the number of queries of the command included in the command data area.
本发明实施例中,用户可在网络设备所提供的OAM等输入界面中输入查询命令,对输入的查询命令的信息进行解析,解析出需要进行检索的命令信息。In the embodiment of the present invention, the user can input a query command in an input interface such as OAM provided by the network device, parse the information of the input query command, and parse the command information that needs to be retrieved.
本发明实施例中的命令信息可以包括命令关键字、命令参数以及命令模式信息等,然后通过搜索引擎到查询数据源文件中读取数据源,并进行命令的匹配查找。The command information in the embodiment of the present invention may include a command keyword, a command parameter, a command mode information, and the like, and then the data source is read by the search engine to the query data source file, and the matching search of the command is performed.
在实际应用中,若命令信息中存在多个命令关键字或者命令参数,则可以以空格分隔多个命令关键字或命令参数,生成命令关键字或命令参数集,并根据命令关键字集或命令参数集进行匹配查找。而对于命令模式,则可根据输入的命令模式信息,通过匹配算法进行匹配查找。In actual applications, if there are multiple command keywords or command parameters in the command information, multiple command keywords or command parameters may be separated by spaces to generate a command keyword or a command parameter set, and according to the command keyword set or command. The parameter set is used for matching lookup. For the command mode, the matching algorithm can be used to perform matching search according to the input command mode information.
下面通过一个可选实施例对本发明实施例所提供的在网络设备上实现命令查找的方法进行详细的说明。The method for implementing command lookup on a network device according to an embodiment of the present invention is described in detail below through an optional embodiment.
如图2所示,为本发明实施例提供的另一种在网络设备上实现命令查找的方法的流程示意图。本实施例提供的方法可以包括以下步骤,即步骤201~步骤205:FIG. 2 is a schematic flowchart diagram of another method for implementing command lookup on a network device according to an embodiment of the present invention. The method provided in this embodiment may include the following steps, that is, steps 201 to 205:
步骤201:生成查询数据源文件。Step 201: Generate a query data source file.
可选地,本实施例可以在编译阶段,依据网络设备所支持的脚本文件集,依次读取每个脚本文件,对每个脚本文件进行解析并生成与每个脚本文件对应的查询数据源文件,该每个查询数据源文件中包括每条命令的检索信息,该检索信息包括:命令关键字匹配需要的<real-key-item>集合,即命令关键字、命令参数、命令语法关键字,命令执行模式信息和命令显示时的格式信息中 的至少一项。Optionally, in this embodiment, each script file may be sequentially read according to a script file set supported by the network device in the compiling stage, and each script file is parsed and a query data source file corresponding to each script file is generated. Each of the query data source files includes retrieval information of each command, and the retrieval information includes: a <real-key-item> set required for command keyword matching, that is, a command keyword, a command parameter, and a command syntax keyword. Command execution mode information and format information when the command is displayed At least one of them.
可选地,本实施例中生成查询数据源文件的方式还可以包括:将生成的查询数据源文件打包加载到网络设备的版本集中,以使得在网络设备启动时,将该查询数据源文件加载到网络设备中。Optionally, the method for generating the query data source file in the embodiment may further include: loading the generated query data source file into a version set of the network device, so that the query data source file is loaded when the network device starts. Go to the network device.
步骤202:获取查询命令。Step 202: Acquire a query command.
在本实施例中,可以通过网络设备所提供的OAM等输入界面获取用户输入的查询命令。In this embodiment, the query command input by the user may be obtained through an input interface such as OAM provided by the network device.
本实施例的查询命令中可携带有命令关键字、命令参数以及命令模式信息等检索参数,该查询命令中可包括上述检索参数中的一种或多种的组合。The query command of the embodiment may carry a search parameter such as a command keyword, a command parameter, and command mode information, and the query command may include a combination of one or more of the foregoing search parameters.
步骤203:通过对查询命令进行解析,获取待进行检索的命令信息。Step 203: Obtain command information to be retrieved by parsing the query command.
本实施例通过对查询命令进行解析,以获取该查询命令中所包括的命令信息,例如获取到的命令信息包括命令关键字、命令参数或命令模式信息等。In this embodiment, the command information included in the query command is obtained by parsing the query command. For example, the obtained command information includes a command keyword, a command parameter, or command mode information.
步骤204:根据命令信息,在预先生成的查询数据源文件中进行检索。Step 204: Perform a search in the pre-generated query data source file according to the command information.
该步骤即为查询命令的执行步骤,根据解析查询命令而获取的命令信息,在查询数据源文件中进行检索即匹配查询,查询原则为:查询与命令信息中包括的命令关键字、命令参数及命令模式信息等相关的命令是否存在,如果存在,则返回命令格式;如果有反向NO命令,也返回NO命令的格式;如果不存在,则查询下一条命令,直到所有命令都查询完毕。The step is the execution step of the query command, and the command information obtained by parsing the query command is searched in the query data source file, that is, the matching query is performed. The query principle is: the command keyword and the command parameter included in the query and the command information. Whether the command mode information and other related commands exist, if it exists, the command format is returned; if there is a reverse NO command, the format of the NO command is also returned; if not, the next command is queried until all commands are queried.
可选地,在实施例中,根据命令信息,在预先生成的查询数据源文件中进行检索的过程可以包括如下检索操作中的至少一项:Optionally, in an embodiment, according to the command information, the process of performing the retrieval in the pre-generated query data source file may include at least one of the following retrieval operations:
当命令信息包括命令关键字和命令模式信息时,在该命令模式信息所表示的命令模式中,根据命令关键字进行检索,查找与该命令关键字匹配的命令信息;When the command information includes the command keyword and the command mode information, in the command mode indicated by the command mode information, the search is performed according to the command keyword, and the command information matching the command keyword is searched;
当命令信息包括命令关键字时,在所有的命令模式中,根据命令关键字进行检索,查找与该命令关键字匹配的命令信息;When the command information includes a command keyword, in all the command modes, the search is performed according to the command keyword, and the command information matching the command keyword is searched;
当命令信息包括命令关键字时,在默认的命令模式中,根据命令关键字进行检索,查找与该命令关键字匹配的命令信息。 When the command information includes a command keyword, in the default command mode, a search is performed according to the command keyword to find command information that matches the command keyword.
步骤205:显示检索结果。Step 205: Display the search result.
根据查询检索结果返回的信息进行显示,显示的信息例如可以包括命令模式、命令关键字和命令参数中的一种或多种组合。The information returned according to the query retrieval result is displayed, and the displayed information may include, for example, one or a combination of a command mode, a command keyword, and a command parameter.
可选地,本实施例在显示检索结果过程中,还可以包括以下步骤:Optionally, in the process of displaying the search result, the embodiment may further include the following steps:
根据检索到的命令在命令模式中的字母序或者该检索到的命令的检索次数,对该检索到的命令进行编码排序;Encoding and sorting the retrieved commands according to the alphabetic order of the retrieved commands in the command mode or the number of retrievals of the retrieved commands;
将检索到的命令按照编码排序顺序依次进行显示。The retrieved commands are sequentially displayed in the order in which the codes are sorted.
如图3所示,为本发明实施例提供的一种在网络设备上实现命令查找的装置的结构示意图。本实施例提供的装置可以包括:FIG. 3 is a schematic structural diagram of an apparatus for implementing command lookup on a network device according to an embodiment of the present invention. The apparatus provided in this embodiment may include:
查询命令解析模块301,设置为:通过对输入的查询命令进行解析,获取待进行检索的命令信息,该命令信息包括命令关键字、命令参数以及命令模式信息中的至少一项;The query command parsing module 301 is configured to: obtain, by parsing the input query command, command information to be retrieved, where the command information includes at least one of a command keyword, a command parameter, and command mode information;
查询命令执行模块302,设置为:根据查询命令解析模块301获取的命令信息,在预先生成的查询数据源文件中进行检索,获取检索结果,其中,该查询数据源文件的生成过程包括:依次读取网络设备所支持的脚本文件集中每个脚本文件,并对每个脚本文件进行解析生成与该每个脚本文件对应的查询数据源文件,每个查询数据源文件中包括每条命令的检索信息,该检索信息包括命令关键字、命令参数、命令语法关键字、命令执行模式信息和命令显示时的格式信息中的至少一项;The query command execution module 302 is configured to perform a search in the pre-generated query data source file according to the command information obtained by the query command parsing module 301, and obtain a search result, where the query data source file generation process includes: sequentially reading Taking each script file in the script file set supported by the network device, and parsing each script file to generate a query data source file corresponding to each script file, and each query data source file includes retrieval information of each command. The retrieval information includes at least one of a command keyword, a command parameter, a command syntax keyword, command execution mode information, and format information when the command is displayed;
查询结果显示模块303,设置为:显示查询命令执行模块302获取的检索结果。The query result display module 303 is configured to display the search result obtained by the query command execution module 302.
可选地,图4为本发明实施例提供的另一种在网络设备上实现命令查找的装置的结构示意图。在上述图3所示装置的结构基础上,本实施例提供的装置还可以包括:Optionally, FIG. 4 is a schematic structural diagram of another apparatus for implementing command lookup on a network device according to an embodiment of the present invention. Based on the structure of the device shown in FIG. 3, the device provided in this embodiment may further include:
查询数据源文件生成模块304,设置为:生成查询数据源文件;本实施例中生成该查询数据源文件的方式可以为:依次读取网络设备所支持的脚本文件集中每个脚本文件,并对每个脚本文件进行解析生成与每个脚本文件对应的查询数据源文件,每个查询数据源文件中包括每条命令的检索信息,该检 索信息包括命令关键字、命令参数、命令语法关键字、命令执行模式信息和命令显示格式信息中的至少一项。The query data source file generating module 304 is configured to generate a query data source file. The method for generating the query data source file in this embodiment may be: 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 corresponding to each script file, and each query data source file includes retrieval information of each command, and the check The information includes at least one of a command keyword, a command parameter, a command syntax keyword, command execution mode information, and command display format information.
可选地,如图4所示,本实施例提供的装置还可以包括:Optionally, as shown in FIG. 4, the apparatus provided in this embodiment may further include:
排序模块305,设置为:根据命令模式区中包括的命令模式的查询次数信息,对命令模式在查询数据源文件中的位置信息进行排序调整;和/或,The sorting module 305 is configured to: perform sorting adjustment on the position information of the command mode in the query data source file according to the query quantity information of the command mode included in the command mode area; and/or,
该排序模块305,设置为:根据命令数据区中包括的命令的查询次数,对命令在命令模式中的位置信息进行排序调整。The sorting module 305 is configured to sort and adjust the position information of the command in the command mode according to the number of queries of the commands included in the command data area.
可选地,如图4所示,本实施例提供的装置还可以包括:Optionally, as shown in FIG. 4, the apparatus provided in this embodiment may further include:
加载模块306,设置为:将生成的查询数据源文件加载到网络设备的版本集中,以使得在网络设备启动时,将该查询数据源文件加载到网络设备中;其中,本实施例中加载模块306加载的查询数据源文件可以是查询数据源文件生成模块304生成的。The loading module 306 is configured to: load the generated query data source file 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; wherein, the loading module is loaded in this embodiment. The 306 loaded query data source file may be generated by the query data source file generation module 304.
本发明实施例提供的在网络设备上实现命令查找的方法及装置,通过对输入的查询命令进行解析,获取待进行检索的命令信息,该命令信息包括命令关键字、命令参数以及命令模式信息中的至少一项;根据命令信息,在预先生成的查询数据源文件中进行检索,获取检索结果,其中,查询数据源文件的生成过程包括:依次读取网络设备所支持的脚本文件集中每个脚本文件,并对每个脚本文件进行解析生成与每个脚本文件对应的查询数据源文件,每个查询数据源文件中包括每条命令的检索信息,该检索信息包括命令关键字、命令参数、命令语法关键字、命令执行模式信息和命令显示时的格式信息中的至少一项;从而显示该检索结果。实现了方便用户获取网络设备配置所需的命令信息的技术效果,并且提高了网络设备的易用性。The method and device for implementing command lookup on a network device according to an embodiment of the present invention obtains command information to be retrieved by parsing an input query command, where the command information includes a command keyword, a command parameter, and command mode information. At least one item; according to the command information, searching in a pre-generated query data source file to obtain a retrieval result, wherein the generating process of the query data source file includes: sequentially reading each script in the script file set supported by the network device a file, and parsing each script file to generate a query data source file corresponding to each script file, each query data source file includes retrieval information of each command, the retrieval information including command keywords, command parameters, commands At least one of a syntax keyword, command execution mode information, and format information when the command is displayed; thereby displaying the search result. The technical effect of facilitating the user to obtain command information required for network device configuration is realized, and the ease of use of the network device is improved.
本领域普通技术人员可以理解上述实施例的全部或部分步骤可以使用计算机程序流程来实现,所述计算机程序可以存储于一计算机可读存储介质中,所述计算机程序在相应的硬件平台上(根据系统、设备、装置、器件等)执行,在执行时,包括方法实施例的步骤之一或其组合。One of ordinary skill in the art will appreciate that all or a portion of the steps of the above-described embodiments can be implemented using a computer program flow, which can be stored in a computer readable storage medium on a corresponding hardware platform (according to The system, device, device, device, etc. are executed, and when executed, include one or a combination of the steps of the method embodiments.
可选地,上述实施例的全部或部分步骤也可以使用集成电路来实现,这些步骤可以被分别制作成一个个集成电路模块,或者将它们中的多个模块或 步骤制作成单个集成电路模块来实现。Optionally, all or part of the steps of the foregoing embodiments may also be implemented by using an integrated circuit, and the steps may be separately fabricated into integrated circuit modules, or multiple modules thereof or The steps are made into a single integrated circuit module.
上述实施例中的装置/功能模块/功能单元可以采用通用的计算装置来实现,它们可以集中在单个的计算装置上,也可以分布在多个计算装置所组成的网络上。The devices/function modules/functional units in the above embodiments may be implemented by a general-purpose computing device, which may be centralized on a single computing device or distributed over a network of multiple computing devices.
上述实施例中的装置/功能模块/功能单元以软件功能模块的形式实现并作为独立的产品销售或使用时,可以存储在一个计算机可读取存储介质中。上述提到的计算机可读取存储介质可以是只读存储器,磁盘或光盘等。When the device/function module/functional unit in the above embodiment is implemented in the form of a software function module and sold or used as a stand-alone product, it can be stored in a computer readable storage medium. The above mentioned computer readable storage medium may be a read only memory, a magnetic disk or an optical disk or the like.
工业实用性Industrial applicability
本发明实施例通过对输入的查询命令进行解析,获取待进行检索的命令信息,根据该命令信息,在预先生成的查询数据源文件中进行检索,获取检索结果,从而显示该检索结果;其中,上述命令信息包括命令关键字、命令参数以及命令模式信息中的至少一项,查询数据源文件的生成过程包括:依次读取网络设备所支持的脚本文件集中每个脚本文件,并对每个脚本文件进行解析生成与每个脚本文件对应的查询数据源文件,查询数据源文件中包括每条命令的检索信息,该检索信息包括命令关键字、命令参数、命令语法关键字、命令执行模式信息、命令显示时的格式信息中的至少一项;本发明实施例实现了方便用户获取网络设备配置所需的命令信息的技术效果,并且提高了网络设备的易用性。 The embodiment of the present invention obtains the command information to be retrieved by parsing the input query command, and performs a search in the pre-generated query data source file according to the command information, and obtains the search result, thereby displaying the search result; The command information includes at least one of a command keyword, a command parameter, and command mode information, and the generating 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 The file is parsed to generate a query data source file corresponding to each script file, and the query data source file includes retrieval information of each command, where the retrieval information includes a command keyword, a command parameter, a command syntax keyword, a command execution mode information, At least one of the format information when the command is displayed; the embodiment of the present invention implements the technical effect of facilitating the user to obtain command information required for network device configuration, and improves the ease of use of the network device.

Claims (11)

  1. 一种在网络设备上实现命令查找的方法,包括:A method for implementing command lookup on a network device, including:
    通过对输入的查询命令进行解析,获取待进行检索的命令信息,所述命令信息包括命令关键字、命令参数以及命令模式信息中的至少一项;Obtaining command information to be retrieved by parsing the input query command, where the command information includes at least one of a command keyword, a command parameter, and command mode information;
    根据所述命令信息,在预先生成的查询数据源文件中进行检索,获取检索结果,其中,所述查询数据源文件的生成过程包括:依次读取网络设备所支持的脚本文件集中每个脚本文件,并对所述每个脚本文件进行解析生成与所述每个脚本文件对应的查询数据源文件,每个所述查询数据源文件中包括每条命令的检索信息,所述检索信息包括命令关键字、命令参数、命令语法关键字、命令执行模式信息和命令显示时的格式信息中的至少一项;And performing a search in the pre-generated query data source file to obtain a search result according to the command information, where the generating process of the query data source file includes: sequentially reading each script file in the script file set supported by the network device. And parsing each of the script files to generate a query data source file corresponding to each of the script files, each of the query data source files includes retrieval information of each command, and the retrieval information includes a command key At least one of a word, a command parameter, a command syntax keyword, command execution mode information, and format information when the command is displayed;
    显示所述检索结果。The search result is displayed.
  2. 根据权利要求1所述的方法,其中,所述通过对输入的查询命令进行解析,获取待进行检索的命令信息之前,所述方法还包括:The method according to claim 1, wherein the method further comprises: before parsing the input query command to obtain command information to be retrieved, the method further comprising:
    生成所述查询数据源文件。Generating the query data source file.
  3. 根据权利要求1或2所述的方法,其中,所述查询数据源文件的格式包括第一部分和第二部分;The method according to claim 1 or 2, wherein the format of the query data source file comprises a first part and a second part;
    其中,所述第一部分为命令模式区,所述命令模式区包括命令模式标识信息、命令模式对应的命令条数、命令模式在所述查询数据源文件中的位置信息及命令模式的查询次数信息;The first part is a command mode area, where the command mode area includes command mode identification information, a number of commands corresponding to the command mode, location information of the command mode in the query data source file, and query number information of the command mode. ;
    第二部分为命令数据区,所述命令数据区包括每个命令模式对应的每条命令的模块名长度信息、关键字长度信息、命令格式长度信息、NO命令格式长度信息、命令标识信息、命令模式标识信息、命令在命令模式中的位置信息及命令的查询次数信息。The second part is a command data area, and the command data area includes module name length information, keyword length information, command format length information, NO command format length information, command identification information, and commands for each command corresponding to each command mode. The mode identification information, the position information of the command in the command mode, and the number of times of querying the command.
  4. 根据权利要求3所述的方法,还包括:The method of claim 3 further comprising:
    根据所述命令模式区中包括的命令模式的查询次数信息,对所述命令模式在所述查询数据源文件中的位置进行调整;和/或,Adjusting, according to the query number information of the command mode included in the command mode area, the position of the command mode in the query data source file; and/or,
    根据所述命令数据区中包括的命令的查询次数信息,对所述命令在所述 命令模式中的位置进行调整。And according to the query quantity information of the command included in the command data area, the command is in the The position in the command mode is adjusted.
  5. 根据权利要求1或2所述的方法,其中,所述通过对输入的查询命令进行解析,获取待进行检索的命令信息之前,所述方法还包括:The method according to claim 1 or 2, wherein the method further comprises: before parsing the input query command to obtain command information to be retrieved, the method further comprising:
    将生成的所述查询数据源文件加载到所述网络设备的版本集中,以使得在所述网络设备启动时,将所述查询数据源文件加载到所述网络设备中。Loading the generated query data source file into a version set of the network device, so that when the network device is started, the query data source file is loaded into the network device.
  6. 根据权利要求1所述的方法,其中,所述根据所述命令信息,在预先生成的查询数据源文件中进行检索,包括:The method of claim 1, wherein the performing the searching in the pre-generated query data source file according to the command information comprises:
    当所述命令信息包括命令关键字和命令模式信息时,在所述命令模式信息所表示的命令模式中,根据所述命令关键字进行检索,查找与所述命令关键字匹配的命令信息;和/或,When the command information includes a command keyword and command mode information, in the command mode indicated by the command mode information, performing a search according to the command keyword to find command information matching the command keyword; and /or,
    当所述命令信息包括命令关键字时,在所有的命令模式中,根据所述命令关键字进行检索,查找与所述命令关键字匹配的命令信息;和/或,When the command information includes a command keyword, in all command modes, a search is performed according to the command keyword to find command information that matches the command keyword; and/or,
    当所述命令信息包括命令关键字时,在默认的命令模式中,根据所述命令关键字进行检索,查找与所述命令关键字匹配的命令信息。When the command information includes a command keyword, in the default command mode, a search is performed according to the command keyword to find command information that matches the command keyword.
  7. 根据权利要求1所述的方法,其中,所述显示所述检索结果,包括:The method of claim 1 wherein said displaying said search results comprises:
    根据检索到的命令在命令模式中的字母顺序或者所述检索到的命令的检索次数,对所述检索到的命令进行编码排序;Encoding and sorting the retrieved commands according to an alphabetical order of the retrieved commands in a command mode or a number of retrievals of the retrieved commands;
    将所述检索到的命令按照所述编码排序顺序依次进行显示。The retrieved commands are sequentially displayed in the order in which the codes are sorted.
  8. 一种在网络设备上实现命令查找的装置,包括:A device for implementing command lookup on a network device, comprising:
    查询命令解析模块,设置为:通过对输入的查询命令进行解析,获取待进行检索的命令信息,所述命令信息包括命令关键字、命令参数以及命令模式信息中的至少一项;The query command parsing module is configured to: obtain the command information to be retrieved by parsing the input query command, where the command information includes at least one of a command keyword, a command parameter, and command mode information;
    查询命令执行模块,设置为:根据所述查询命令解析模块获取的所述命令信息,在预先生成的查询数据源文件中进行检索,获取检索结果,其中,所述查询数据源文件的生成过程包括:依次读取网络设备所支持的脚本文件集中每个脚本文件,并对所述每个脚本文件进行解析生成与所述每个脚本文件对应的查询数据源文件,每个所述查询数据源文件中包括每条命令的检索信息,所述检索信息包括命令关键字、命令参数、命令语法关键字、命令执 行模式信息和命令显示时的格式信息中的至少一项;The query command execution module is configured to perform a search in the pre-generated query data source file according to the command information obtained by the query command parsing module, and obtain a search result, where the query data source file generation process includes : sequentially reading each script file in the script file set supported by the network device, and parsing each of the script files to generate a query data source file corresponding to each script file, and each of the query data source files Retrieving information for each command, including command keywords, command parameters, command syntax keywords, command execution At least one of line mode information and format information when the command is displayed;
    查询结果显示模块,设置为:显示所述查询命令执行模块获取的所述检索结果。The query result display module is configured to: display the search result obtained by the query command execution module.
  9. 根据权利要求8所述的装置,还包括:The apparatus of claim 8 further comprising:
    查询数据源文件生成模块,设置为:生成所述查询数据源文件。The query data source file generating module is configured to: generate the query data source file.
  10. 根据权利要求9所述的装置,还包括:The apparatus of claim 9 further comprising:
    排序模块,设置为:根据命令模式区中包括的命令模式的查询次数信息,对所述命令模式在所述查询数据源文件中的位置进行调整;和/或,a sorting module, configured to: adjust a position of the command mode in the query data source file according to query number information of a command mode included in a command mode area; and/or,
    所述排序模块,设置为:根据命令数据区中包括的命令的查询次数,对所述命令在所述命令模式中的位置进行调整。The sorting module is configured to: adjust a position of the command in the command mode according to a query number of commands included in the command data area.
  11. 根据权利要求8或9所述的装置,还包括:The apparatus of claim 8 or 9, further comprising:
    加载模块,设置为:将生成的所述查询数据源文件加载到所述网络设备的版本集中,以使得在所述网络设备启动时,将所述查询数据源文件加载到所述网络设备中。 The loading module is configured to: load the generated query data source file into a version set of the network device, so that when the network device starts, the query data source file is loaded into the network device.
PCT/CN2016/085604 2015-06-25 2016-06-13 Method and device for searching command on network device WO2016206546A1 (en)

Applications Claiming Priority (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
CN201510355553.3 2015-06-25

Publications (1)

Publication Number Publication Date
WO2016206546A1 true WO2016206546A1 (en) 2016-12-29

Family

ID=57584465

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2016/085604 WO2016206546A1 (en) 2015-06-25 2016-06-13 Method and device for searching command on network device

Country Status (2)

Country Link
CN (1) CN106301870A (en)
WO (1) WO2016206546A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
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

Citations (5)

* Cited by examiner, † Cited by third party
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

Patent Citations (5)

* Cited by examiner, † Cited by third party
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

Also Published As

Publication number Publication date
CN106301870A (en) 2017-01-04

Similar Documents

Publication Publication Date Title
ES2636758T3 (en) Procedure implemented by computer to improve query execution in standardized relational databases at level 4 and higher
JP5334333B2 (en) User-defined relevance ranking for search
US9152697B2 (en) Real-time search of vertically partitioned, inverted indexes
US8103705B2 (en) System and method for storing text annotations with associated type information in a structured data store
US9183261B2 (en) Lexicon based systems and methods for intelligent media search
US10078509B2 (en) Method and system for processing lifelong learning of terminal and apparatus
US9275155B1 (en) Querying across a composite join of multiple database tables using a search engine index
US9020951B2 (en) Methods for indexing and searching based on language locale
KR101083563B1 (en) Method and System for Managing Database
US11030242B1 (en) Indexing and querying semi-structured documents using a key-value store
US10437824B2 (en) Querying across a composite join of multiple database tables using a search engine index
JP2008234357A (en) Structured document retrieval system, program and index data structure
CN101320382B (en) Method and system for rearranging search result based on context
US10290126B2 (en) Computerized systems and methods for graph data modeling
US11386063B2 (en) Data edge platform for improved storage and analytics
JP6440542B2 (en) Knowledge engine for managing large amounts of complex structured data
US9734178B2 (en) Searching entity-key associations using in-memory objects
JP2020509519A (en) System and method for searching and indexing documents containing chemical information
CN110674087A (en) File query method and device and computer readable storage medium
US9984108B2 (en) Database joins using uncertain criteria
CN103646055B (en) The acquisition methods and device of a kind of programme setting
WO2016206546A1 (en) Method and device for searching command on network device
US7653886B2 (en) Crosslinking of netlists
US8965910B2 (en) Apparatus and method of searching for instance path based on ontology schema
US8498987B1 (en) Snippet search

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 16813662

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 16813662

Country of ref document: EP

Kind code of ref document: A1