WO2017219778A1 - Method for configuring service for router, router, and storage medium - Google Patents

Method for configuring service for router, router, and storage medium Download PDF

Info

Publication number
WO2017219778A1
WO2017219778A1 PCT/CN2017/083831 CN2017083831W WO2017219778A1 WO 2017219778 A1 WO2017219778 A1 WO 2017219778A1 CN 2017083831 W CN2017083831 W CN 2017083831W WO 2017219778 A1 WO2017219778 A1 WO 2017219778A1
Authority
WO
WIPO (PCT)
Prior art keywords
configuration
router
function
service
request
Prior art date
Application number
PCT/CN2017/083831
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 WO2017219778A1 publication Critical patent/WO2017219778A1/en

Links

Images

Landscapes

  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

Provided in the embodiments of the present invention are a method for configuring a service for a router, a router, and a storage medium. The method comprises: a router receiving a configuration request sent by a terminal, the configuration request being used for configuring at least one to-be-configured service on the router; the router invoking, according to the configuration request, a configuration function stored by the router locally to generate configuration data; and the router configuring, according to the generated configuration data, the to-be-configured service.

Description

路由器业务配置方法及路由器、存储介质Router service configuration method and router, storage medium
相关申请的交叉引用Cross-reference to related applications
本申请基于申请号为201610473604.7、申请日为2016年6月24日的中国专利申请提出,并要求该中国专利申请的优先权,该中国专利申请的内容在此引入本申请作为参考。The present application is based on a Chinese patent application filed on Jan. 24, 2016, the filing date of
技术领域Technical field
本发明涉及通信技术,尤其涉及路由器业务配置方法及路由器、存储介质。The present invention relates to communication technologies, and in particular, to a router service configuration method, a router, and a storage medium.
背景技术Background technique
网络之间互连的协议(IP,Internet Protocol)网络的核心数据设备,如中、高端路由器中,经常需要对设备进行极限性能测试以及进行大容量配置。大容量配置与极限性能测试都要求在极短的时间内完成对路由器进行大量的业务配置。大量业务配置中必然包含海量的业务配置数据,而相关技术中的配置方案都是由对路由器进行业务配置的终端将配置数据下发至路由器中,以此实现对路由器的业务配置。The core data devices of the IP (Internet Protocol) network, such as medium and high-end routers, often require extreme performance testing and large-capacity configuration of the device. Both the high-capacity configuration and the extreme performance test require a large amount of service configuration for the router in a very short time. A large number of service configurations inevitably include a large amount of service configuration data, and the configuration scheme in the related art is to deliver the configuration data to the router by the terminal configured for the service of the router, thereby implementing the service configuration of the router.
相关技术中的路由器配置方案在对路由器进行大量业务配置时,存在配置数据下发不全以及配置效率低的问题。The router configuration scheme in the related art has a problem that the configuration data is incompletely delivered and the configuration efficiency is low when a large number of services are configured on the router.
发明内容Summary of the invention
本发明实施例提供的路由器业务配置方法及路由器、存储介质,主要解决的技术问题是:提出一种与相关技术中不同的路由器业务配置方案,用以提高对路由器进行大量业务配置时的配置效率。 The router service configuration method and the router and the storage medium provided by the embodiments of the present invention mainly solve the technical problem that a router service configuration scheme different from the related technology is proposed to improve the configuration efficiency when performing a large number of service configurations on the router. .
为解决上述技术问题,本发明实施例提供一种路由器业务配置方法,包括:To solve the above technical problem, an embodiment of the present invention provides a router service configuration method, including:
路由器接收终端发送的配置请求,所述配置请求用于对所述路由器上的至少一个待配置业务进行配置;The router receives a configuration request sent by the terminal, where the configuration request is used to configure at least one to-be-configured service on the router;
所述路由器根据所述配置请求调用路由器本地存储的配置函数生成配置数据;The router generates a configuration data by using a configuration function stored locally by the router according to the configuration request;
所述路由器根据生成的所述配置数据对所述待配置业务进行配置。The router configures the to-be-configured service according to the generated configuration data.
本发明实施例还提供一种路由器,包括:The embodiment of the invention further provides a router, including:
接收模块,用于接收终端发送的配置请求,所述配置请求用于对所述路由器上的至少一个待配置业务进行配置;a receiving module, configured to receive a configuration request sent by the terminal, where the configuration request is used to configure at least one to-be-configured service on the router;
生成模块,用于根据所述配置请求调用路由器本地存储的配置函数生成配置数据;a generating module, configured to generate configuration data by calling a configuration function stored locally by the router according to the configuration request;
配置模块,用于根据生成的所述配置数据对所述待配置业务进行配置。And a configuration module, configured to configure the to-be-configured service according to the generated configuration data.
为解决上述技术问题,本发明实施例提供一种路由器,包括:To solve the above technical problem, an embodiment of the present invention provides a router, including:
存储器,用于存储计算机程序;a memory for storing a computer program;
处理器,配置为通过执行所述存储器中存储的所述计算机程序时实现以下步骤:A processor configured to implement the following steps by executing the computer program stored in the memory:
接收终端发送的配置请求,所述配置请求用于对路由器上的至少一个待配置业务进行配置;Receiving a configuration request sent by the terminal, where the configuration request is used to configure at least one to-be-configured service on the router;
根据所述配置请求调用所述存储器存储的配置函数生成配置数据;Resetting the configuration function of the memory storage according to the configuration request to generate configuration data;
根据生成的所述配置数据对所述待配置业务进行配置。And configuring the to-be-configured service according to the generated configuration data.
为解决上述技术问题,本发明实施例提供一种存储介质,存储有计算机程序,所述计算机程序被处理器执行时实现以下步骤:To solve the above technical problem, an embodiment of the present invention provides a storage medium, where a computer program is stored, and when the computer program is executed by the processor, the following steps are implemented:
接收终端发送的配置请求,所述配置请求用于对路由器上的至少一个待配置业务进行配置; Receiving a configuration request sent by the terminal, where the configuration request is used to configure at least one to-be-configured service on the router;
根据所述配置请求调用所述存储器存储的配置函数生成配置数据;Resetting the configuration function of the memory storage according to the configuration request to generate configuration data;
根据生成的所述配置数据对所述待配置业务进行配置。And configuring the to-be-configured service according to the generated configuration data.
本发明实施例的有益效果是:The beneficial effects of the embodiments of the present invention are:
本发明实施例中,路由器通过接收终端发送的配置请求,然后根据配置请求生成配置数据从而完成业务配置;通过在路由器侧生成进行业务配置的配置数据,使得对路由器进行业务配置的终端不需要下发海量的配置数据,而只需要将相对配置数据简单得多的配置请求发送给路由器即可,即使是对路由器的大量业务配置时,也不会存在配置数据下发慢、下发的配置数据不完整的问题存在,提高了业务配置的效率。In the embodiment of the present invention, the router receives the configuration request sent by the terminal, and then generates configuration data according to the configuration request to complete the service configuration. The configuration data for configuring the service is generated on the router side, so that the terminal that performs service configuration on the router does not need to be configured. A large amount of configuration data is sent, and only a configuration request with a relatively simple configuration data is sent to the router. Even when a large number of services are configured for the router, configuration data that is sent slow and delivered by the configuration data does not exist. Incomplete problems exist and improve the efficiency of business configuration.
附图说明DRAWINGS
图1为本发明实施例提供的路由器业务配置方法的一种流程图;FIG. 1 is a flowchart of a method for configuring a router service according to an embodiment of the present invention;
图2为本发明实施例中获取用户自定义批量处理函数的一种流程图;2 is a flowchart of obtaining a user-defined batch processing function according to an embodiment of the present invention;
图3为本发明实施例中根据配置请求生成配置数据的一种流程图;FIG. 3 is a flowchart of generating configuration data according to a configuration request according to an embodiment of the present invention;
图4为本发明实施例提供的路由器的第一种结构示意图;4 is a schematic diagram of a first structure of a router according to an embodiment of the present invention;
图5为本发明实施例提供的路由器的第二种结构示意图;FIG. 5 is a schematic diagram of a second structure of a router according to an embodiment of the present disclosure;
图6为本发明实施例提供的路由器的第三种结构示意图;FIG. 6 is a schematic diagram of a third structure of a router according to an embodiment of the present disclosure;
图7为本发明实施例提供的路由器的第四种结构示意图;FIG. 7 is a schematic diagram of a fourth structure of a router according to an embodiment of the present disclosure;
图8为本发明实施例提供的路由器业务配置方法的一种流程图;FIG. 8 is a flowchart of a method for configuring a router service according to an embodiment of the present invention;
图9为本发明实施例提供的路由器的硬件结构示意图。FIG. 9 is a schematic structural diagram of a hardware of a router according to an embodiment of the present invention.
具体实施方式detailed description
下面通过具体实施方式结合附图对本发明实施例作进一步详细说明。The embodiments of the present invention are further described in detail below with reference to the accompanying drawings.
对相关技术中的路由器配置方案进行简单的说明:A brief description of the router configuration scheme in the related art:
相关技术的一种配置方案中,配置数据预先生成,并被存储在以“.txt”为后缀的记事本文件当中,或者是存储在软件程序中的脚本文件当中,终 端从记事本文件或者从脚本文件中复制配置数据,然后粘贴到路由器当中。这种配置方式中,对终端的缓冲区性能的要求极高,因为终端需要将海量的配置数据存储至缓冲区中,然后又要将缓冲区的数据提取发送给路由器。对于少量业务配置,这种配置方式几乎不存在问题,但如果是针对大量配置数据的复制粘贴,可能一般的缓冲区都无法满足这么高的性能要求,因此,极有可能会出现下发的配置数据不完整的问题。In a configuration scheme of the related art, configuration data is pre-generated, and is stored in a notepad file suffixed with ".txt" or stored in a script file in a software program. Copy the configuration data from the Notepad file or from the script file and paste it into the router. In this configuration mode, the buffer performance of the terminal is extremely high, because the terminal needs to store a large amount of configuration data into the buffer, and then the data extraction of the buffer is sent to the router. For a small number of service configurations, there is almost no problem with this configuration. However, if copying and pasting a large amount of configuration data, the general buffer may not meet such high performance requirements. Therefore, it is highly probable that the configuration will be delivered. The problem of incomplete data.
在另外一种方案当中,配置数据被存储在工具命令语言(TCL,Tool Command Language)脚本文件当中,由支持TCL脚本语言的终端,对TCL脚本文件进行解析,并将解析后得到的配置数据发送给路由器,完成对路由器的业务配置。在这种方案中同样存在一些问题:首先,使用这种方案对路由器进行配置,那么完成对路由器进行配置的终端必须是支持TCL脚本语言的终端,也就是说,这种方案对配置终端有一定的要求,在实际使用过程中,如果用户的终端不支持TCL脚本语言,则用户无法实现对路由器的配置,或者用户需要再购置支持TCL脚本语言的终端设备以达到对路由器进行配置的目的。另一方面,也是这个方案存在的最大问题,那就是终端在对TCL脚本文件进行解析的时候,解析速度比较慢,当需要对大量业务进行配置时可能会存在配置缓慢的问题。In another solution, the configuration data is stored in a tool command language (TCL, Tool Command Language) script file, and the TCL script file is parsed by the terminal supporting the TCL script language, and the parsed configuration data is sent. Give the router the service configuration for the router. There are also some problems in this scheme: First, the router is configured using this scheme, then the terminal that configures the router must be a terminal that supports the TCL scripting language, that is, this scheme has a certain configuration terminal. In the actual use process, if the user's terminal does not support the TCL scripting language, the user cannot implement the configuration of the router, or the user needs to purchase the terminal device supporting the TCL scripting language to achieve the purpose of configuring the router. On the other hand, it is also the biggest problem with this solution. That is, when the terminal parses the TCL script file, the parsing speed is slow. When it is necessary to configure a large number of services, there may be a problem of slow configuration.
为了解决相关技术中在短时间内实现对路由器进行业务配置时存在的配置数据下发慢、下发不完整的问题,本发明实施例提供一种路由器业务配置方法,请参见图1:In order to solve the problem that the configuration data of the router is configured to be slow and incomplete during the configuration of the router in a short time, the embodiment of the present invention provides a router service configuration method, as shown in FIG. 1:
S102、路由器接收终端发送的配置请求。S102. The router receives a configuration request sent by the terminal.
在本发明实施例当中,终端可以是个人计算机(PC,Personal Computer)、平板电脑、台式计算机和智能手机等几种中的任意一种。In the embodiment of the present invention, the terminal may be any one of a personal computer (PC, Personal Computer), a tablet computer, a desktop computer, and a smart phone.
可以理解的是,在终端向路由器发送配置请求之前,终端应当与路由器建立通信连接,这里以路由器和终端之间最常用的Telnet(远程终端协议) 连接为例进行说明,Telnet协议是传输控制协议/因特网互联协议(TCP/IP,Transmission Control Protocol/Internet Protocol)协议族中的一员,是Internet远程登陆服务的标准协议和主要方式。它为用户提供了在本地终端上完成远程主机工作的能力。用户在终端上使用Telnet程序,用它连接到路由器。用户可以在终端的Telnet程序中输入命令,这些命令会在路由器上运行,就像直接在路由器的控制台上输入一样,以此达到在本地控制路由器的目的。It can be understood that before the terminal sends a configuration request to the router, the terminal should establish a communication connection with the router, here is the most commonly used Telnet (remote terminal protocol) between the router and the terminal. The connection is taken as an example. The Telnet protocol is a member of the Transmission Control Protocol/Internet Protocol (TCP/IP) protocol family and is the standard protocol and main method for the Internet remote login service. It provides users with the ability to complete remote host work on a local terminal. The user uses the Telnet program on the terminal and uses it to connect to the router. Users can enter commands in the terminal's Telnet program. These commands will run on the router as if they were directly entered on the router's console to achieve local control of the router.
配置请求可以以命令的形式从终端上下发,例如,在用户终端上向用户示出命令行界面(CLI,Command-Line Interface)界面,用户通过键盘输入等形式输入自己的配置请求,CLI界面不仅将用户的指令发送给路由器,同时还会对用户的输入进行回显,以便让用户确认自己输入的配置请求是否是自己期望下发的。The configuration request can be sent from the terminal in the form of a command. For example, a command line interface (CLI) is displayed on the user terminal, and the user inputs a configuration request by using a keyboard input. The CLI interface is not only The user's instructions are sent to the router, and the user's input is echoed back, so that the user can confirm whether the configuration request that he or she has entered is the one that he or she wishes to deliver.
配置请求主要用于对路由器上的某一个或者某一些待配置业务进行业务配置。在配置请求中可以包含待配置业务的业务类型以及业务数量,例如,配置请求中包含的信息是配置4000个子接口,那么待配置业务为配置子接口,而业务数量则为4000。另外,在配置请求中还可以包含一些其他信息,例如,用户特意指定了4000个子接口中的5个子接口的IP地址,那么在配置请求中除了待配置业务类型与业务数量之外,还包括5个IP地址,以及这5个IP地址与子接口的对应关系。The configuration request is mainly used to configure services for one or some of the services to be configured on the router. The configuration request can include the service type of the service to be configured and the number of services. For example, if the information contained in the configuration request is configured with 4,000 sub-interfaces, the service to be configured is configured as a sub-interface, and the number of services is 4000. In addition, the configuration request may also include some other information, for example, the user specifically specifies the IP address of the five sub-interfaces of the 4000 sub-interfaces, and the configuration request includes, in addition to the service type and the service quantity to be configured, IP addresses, and the correspondence between these five IP addresses and sub-interfaces.
在本发明实施例的一些示例当中,当路由器接收到终端下发的配置请求之后,需要对配置请求进行格式校验,以确定该配置请求是否合法。格式校验只针对配置请求的数据格式、数据长度等进行形式上的校验。只有当确定配置请求合法后才会进行后续的配置过程,否则直接向终端返回非法提示,以提示用户其输入的配置请求存在形式上的错误。In some examples of the embodiments of the present invention, after the router receives the configuration request sent by the terminal, the configuration request needs to be formatted to determine whether the configuration request is legal. Format verification only performs formal verification on the data format, data length, etc. of the configuration request. The subsequent configuration process is performed only after the configuration request is determined to be valid. Otherwise, an illegal prompt is directly returned to the terminal to prompt the user that the configuration request entered has a formal error.
S104、路由器根据配置请求本地(路由器本地)存储的配置函数生成 配置数据。S104. The router generates a local (router local) stored configuration function according to the configuration request. Configuration Data.
配置函数的主要功能是根据用户输入的配置请求输出相应的配置数据,如果用户对某一待配置业务进行配置的业务数量比较大,可能需要用到批量处理函数,常见的批量处理函数包括:用于批量创建虚拟专用网络路由转发表(VRF,Virtual Routing Forwarding)的函数、批量删除VRF的函数、批量创建三层子接口的函数、批量删除三层子接口的函数等,以及子接口批量绑定VRF的函数、子接口批量绑定开放式最短路径优先(OSPF,Open Shortest Path First)、中间系统到中间系统(ISIS,Intermediate System to Intermediate System)协议的函数、子接口批量配置IP地址的函数、子接口批量封装虚拟局域网(VLAN,Virtual Local Area Network)的函数等。The main function of the configuration function is to output the corresponding configuration data according to the configuration request input by the user. If the number of services configured by the user for a service to be configured is relatively large, a batch processing function may be needed. Common batch processing functions include: Create functions of the virtual private network forwarding table (VRF, Virtual Routing Forwarding) in batches, delete VRF functions in batches, create functions of three-layer sub-interfaces in batches, delete functions of three-layer sub-interfaces in batches, and batch bind sub-interfaces. VRF functions and sub-interfaces are bound to Open Shortest Path First (OSPF), intermediate system to Intermediate System (ISIS) functions, sub-interfaces to configure IP addresses in batches, The sub-interfaces encapsulate functions of the virtual local area network (VLAN) in batches.
路由器本地存储的配置函数可以满足用户绝大多数的配置请求,但在实际应用过程中,用户可能会有一些需求是路由器本地存储的配置函数无法实现的,针对这种情况,可能需要使用用户自定义的函数才能达到用户的需求,因此,本发明实施例还提供一种获取用户自定义函数的流程,如图2所示:The configuration function of the router's local storage can satisfy most of the user's configuration requests. However, in the actual application process, the user may have some requirements that the configuration function of the router's local storage cannot be implemented. For this situation, the user may need to use the user. The defined function can meet the requirements of the user. Therefore, the embodiment of the present invention further provides a process for obtaining a user-defined function, as shown in FIG. 2:
S202、路由器接收用户自定义的批处理函数。S202. The router receives a user-defined batch function.
在本发明实施例中,路由器上设置了对外开放的编程接口,该编程接口能够接收用户导入的自定义批处理函数。可以理解的是,用户可以在需要使用该编程接口时,开启编程接口,这时候,路由器具有导入用户自定义函数的功能,而如果用户不需要使用编程接口,则可以关闭该编程接口,这时,本发明实施例中的路由器与普通路由器的使用没有区别。In the embodiment of the present invention, a programming interface that is open to the outside is provided on the router, and the programming interface is capable of receiving a custom batch function imported by the user. It can be understood that the user can open the programming interface when the programming interface is needed. At this time, the router has the function of importing a user-defined function, and if the user does not need to use the programming interface, the programming interface can be closed. The router in the embodiment of the present invention is no different from the use of the ordinary router.
S204、路由器对用户自定义的批处理函数进行编译及激活处理。S204: The router compiles and activates a user-defined batch function.
接收到用户导入的自定义批处理函数之后,可以对该批处理函数进行编译及激活处理,编译过程就是把高级语言变成计算机可以识别的二进制语言,经过编译激活处理的批处理函数可以作为后续生成配置数据的配置 函数使用,其作为内嵌在路由器中的函数与其他本来路由器自带的函数没有区别。After receiving the custom batch function imported by the user, the batch function can be compiled and activated. The compilation process turns the high-level language into a binary language that can be recognized by the computer. The batch function that is compiled and activated can be used as a follow-up function. Generate configuration data configuration The function is used as a function embedded in the router and is no different from other functions that are native to the router.
S206、路由器将处理后的批处理函数作为配置函数存储在本地。S206. The router stores the processed batch function as a configuration function locally.
对批处理函数进行编译激活处理之后,可以将其作为配置函数存储在路由器本地。在本发明实施例中,无论是路由器自带的配置函数,还是从对外编程接口上导入的用户自定义的批量处理函数都可以以无差别的形式存储在数据库中。当然,在本发明实施例的另外一些示例当中,路由器自带的配置函数和用户自定义形成的配置函数也可以分开存储。After the batch function is compiled and activated, it can be stored locally as a configuration function on the router. In the embodiment of the present invention, both the configuration function of the router and the user-defined batch processing function imported from the external programming interface can be stored in the database in an undifferentiated form. Of course, in some other examples of the embodiments of the present invention, the configuration function built by the router and the configuration function formed by the user may also be stored separately.
在本发明实施例中,利用路由器上的对外编程接口获取用户自定义的批量处理函数作为配置函数,能够扩展路由器进行业务配置时的功能,使业务配置更加灵活、全面,提高了用户体验。In the embodiment of the present invention, the user-defined batch processing function is used as a configuration function by using the external programming interface on the router, which can expand the function of the router to perform service configuration, and make the service configuration more flexible and comprehensive, thereby improving the user experience.
下面对本发明实施例中根据用户下发的配置请求生成配置数据的过程进行进一步阐述,如图3所示:The process of generating configuration data according to the configuration request issued by the user in the embodiment of the present invention is further illustrated, as shown in FIG. 3:
S302、路由器对配置请求进行解析。S302: The router parses the configuration request.
路由器对配置请求进行解析主要是为了确定用户从终端上下发配置请求的实际目的。用户从终端下发的配置请求中可能用于对某一个或者多个待配置业务进行配置,而路由器如果要根据用户的配置请求对这些待配置业务进行配置,则需要知道用户想要对什么样的业务做什么样的配置。The router parses the configuration request mainly to determine the actual purpose of the user to send configuration requests from the terminal. The configuration request sent by the user may be used to configure one or more services to be configured. If the router needs to configure the services to be configured according to the configuration request of the user, it needs to know what the user wants to be. What kind of configuration does the business do?
S304、路由器根据解析结果确定出待配置业务以及配置函数的类型。S304. The router determines, according to the analysis result, a type of the service to be configured and a configuration function.
这里所说的配置函数是指用于生成对待配置业务进行配置的配置数据的配置函数。一般对配置请求进行解析之后,可以直接获取到待配置业务的业务类型、业务数量等信息,但是在配置请求中并不一定直接包含配置函数的类型。如果用户在终端上下发配置请的时候指定了生成配置数据的配置函数的类型,则可以直接将解析结果中包含的配置函数的类型作为后续调用配置函数的依据;但如果用户下发的配置请求中仅包括待配置业务 的类型,路由器也可以根据待配置业务的类型确定出对应的配置函数的类型,因为不同的待配置业务需要不同的配置函数来生成对应的配置数据,所以实质上,在待配置业务与配置函数之间存在一定的对应关系。The configuration function mentioned here refers to a configuration function for generating configuration data for configuring a service to be configured. Generally, after the configuration request is parsed, information such as the service type and the number of services of the service to be configured may be directly obtained, but the configuration function does not necessarily directly include the type of the configuration function. If the type of the configuration function that generates the configuration data is specified when the user sends the configuration to the terminal, you can directly use the type of the configuration function included in the analysis result as the basis for the subsequent call to the configuration function. Only include services to be configured The type of the configuration function can be determined by the router according to the type of the service to be configured, because different configuration services need different configuration functions to generate corresponding configuration data, so in essence, the service and configuration function to be configured There is a certain correspondence between them.
有时候,对于用户期望配置的一项待配置业务可能需要调用多种类型的配置函数,例如,用户虽然仅在配置请求中指示配置4000个子接口,但实际上,为了完成对4000个子接口的创建,可能需要调用子接口批量创建函数、子接口批量配置IP地址的函数,以及子接口批量封装VLAN的函数。Sometimes, for a service to be configured that the user expects to configure, multiple types of configuration functions may need to be called. For example, although the user only indicates that 4000 sub-interfaces are configured in the configuration request, in reality, in order to complete the creation of 4000 sub-interfaces. You may need to call the sub-interface to create functions in batches, the functions of sub-interfaces to configure IP addresses in batches, and the functions of sub-interfaces to encapsulate VLANs in batches.
S306、路由器根据配置函数的类型本地(路由器本地)对应的批处理函数作为配置函数生成配置数据。S306. The router generates configuration data according to a batch function corresponding to the type local (router local) of the configuration function as a configuration function.
确定要调用的配置函数的类型之后,可以从路由器本地的数据库中调用对应的批处理函数来生成配置数据。这里继续结合上述示例进行解释:当确定需要调用子接口批量创建函数、子接口批量配置IP地址的函数,以及子接口批量封装VLAN的函数这三种类型的配置函数之后,路由器从对应的数据库中获取到这三个批量处理函数对应的程序来生成配置数据。如果在终端发送的配置请求中包含用户指定的部分子接口的IP地址,例如用户指定序列号(ID)为39的子接口的IP地址为255.255.231.32,那么子接口批量配置IP地址的函数在为各子接口配置IP地址的时候,可以仅为其他3999个子接口配置对应的IP地址,然后将配置请求中携带的IP地址与ID为39的子接口进行关联。After determining the type of configuration function to call, you can call the corresponding batch function from the database local to the router to generate configuration data. Here continue to explain the above example: after determining the need to call the sub-interface batch creation function, the sub-interface batch configuration IP address function, and the sub-interface batch encapsulation VLAN function three types of configuration functions, the router from the corresponding database Get the programs corresponding to the three batch processing functions to generate configuration data. If the configuration request sent by the terminal includes the IP address of a part of the sub-interface specified by the user, for example, the IP address of the sub-interface whose serial number (ID) is 39 is 255.255.231.32, the function of configuring the IP address of the sub-interface in batches is When you configure an IP address for each sub-interface, you can configure the corresponding IP address for only the other 3,999 sub-interfaces. Then, associate the IP address carried in the configuration request with the sub-interface with ID 39.
可以理解的是,在路由器的数据库中存储的配置函数并非全都是批处理函数,当用户下发的配置请求中要求进行配置的业务数量不大时,可以直接采用这些非批量处理函数来生成配置数据。It can be understood that the configuration functions stored in the database of the router are not all batch functions. When the number of services required to be configured in the configuration request sent by the user is not large, these non-bulk processing functions can be directly used to generate the configuration. data.
在本发明实施例的另一示例当中,当获取到解析结果之后,路由器还可以根据自身的业务性能对解析结果进行校验,这一次的校验不再是对数据格式与数据长度的校验了,而是根据路由器本身的性能来确定用户下发 的配置请求是否有效,例如,如果用户需要在路由器上配置4000个子接口,但事实上,该路由器本身就只能承载2000个子接口,这种情况成为参数越界,说明该用户的配置请求是该路由器无法实现的,也即该配置请求无效。如果配置请求无效,则不需要再进行后续的配置过程了。除了参数越界以外,参数不完整也会导致配置请求无效,例如,在配置请求中没有包含待配置业务的类型或用户指定的配置函数中的任意一个,仅包含了业务数量,这种配置请求也属于无效的。In another example of the embodiment of the present invention, after obtaining the parsing result, the router may also perform parsing on the parsing result according to its own service performance. This time, the check is no longer a check on the data format and the data length. But based on the performance of the router itself to determine the user to issue Whether the configuration request is valid, for example, if the user needs to configure 4000 sub-interfaces on the router, in fact, the router itself can only carry 2000 sub-interfaces. In this case, the parameter is out of bounds, indicating that the configuration request of the user is the router. Unable to implement, that is, the configuration request is invalid. If the configuration request is invalid, no further configuration process is required. In addition to the parameter out of bounds, the parameter is incomplete, which will invalidate the configuration request. For example, the configuration request does not contain any type of service to be configured or a user-specified configuration function, and only contains the number of services. Is invalid.
S106、路由器根据生成的配置数据进行路由器业务配置。S106. The router performs router service configuration according to the generated configuration data.
生成配置数据以后,可以根据用户的需求组织配置数据,对配置数据进行打包,下发硬件表项,以供路由器转发面在后续路由转发业务中使用。After the configuration data is generated, the configuration data can be configured according to the user's requirements. The configuration data is packaged and the hardware entries are delivered for the router forwarding plane to be used in subsequent routing and forwarding services.
本发明实施例提供的路由器业务配置方法,通过在路由器侧预设生成配置数据的配置函数,从而使得终端在对路由器业务进行配置的时候只需要下发简单的配置请求,由路由器自身根据该配置请求生成对待配置业务进行配置的配置数据,从而使得终端不需要下发数量相对配置请求较庞大的配置数据,不会导致配置数据漏发、错发的现象发生,提高了路由器业务配置的准确性和效率,同时也减轻了终端与路由器间的数据传输压力。In the router service configuration method provided by the embodiment of the present invention, the configuration function of the configuration data is preset on the router side, so that the terminal only needs to deliver a simple configuration request when configuring the router service, and the router itself according to the configuration. Requests the configuration data to be configured for the service to be configured, so that the terminal does not need to deliver a large amount of configuration data with a relatively large number of configuration requests, which does not cause the configuration data to leak and send errors, and improves the accuracy of the router service configuration. And efficiency, but also reduce the pressure of data transmission between the terminal and the router.
本发明实施例提供一种路由器,如图4所示:The embodiment of the invention provides a router, as shown in FIG. 4:
路由器40包括接收模块402、生成模块404和配置模块406。接收模块402用于接收终端发送的配置请求,生成模块404可以根据配置请求调用路由器本地存储的配置函数生成配置数据,配置模块406则用于根据生成的配置数据对待配置业务进行配置。Router 40 includes a receiving module 402, a generating module 404, and a configuration module 406. The receiving module 402 is configured to receive a configuration request sent by the terminal, and the generating module 404 can generate configuration data by using a configuration function stored locally by the router according to the configuration request, and the configuration module 406 is configured to configure the service to be configured according to the generated configuration data.
在本发明实施例当中,终端可以是PC、平板电脑、台式计算机、智能手机等几种中的任意一种。In the embodiment of the present invention, the terminal may be any one of a PC, a tablet computer, a desktop computer, a smart phone, and the like.
可以理解的是,在终端向接收模块402发送配置请求之前,终端应当与路由器40建立通信连接,这里以路由器40和终端之间最常用的Telnet (远程终端协议)连接为例进行说明,Telnet协议是TCP/IP协议族中的一员,是Internet远程登陆服务的标准协议和主要方式。它为用户提供了在本地终端上完成远程主机工作的能力。用户在终端上使用Telnet程序,用它连接到路由器40。用户可以在终端的Telnet程序中输入命令,这些命令会在路由器40上运行,就像直接在路由器的控制台上输入一样,以此达到在本地控制路由器40的目的。It can be understood that before the terminal sends a configuration request to the receiving module 402, the terminal should establish a communication connection with the router 40, where the most commonly used Telnet between the router 40 and the terminal is used. (Remote Terminal Protocol) connection is an example. The Telnet protocol is a member of the TCP/IP protocol suite and is the standard protocol and main method for Internet remote login services. It provides users with the ability to complete remote host work on a local terminal. The user uses the Telnet program on the terminal and connects to the router 40. The user can enter commands in the terminal's Telnet program, which will run on the router 40, just as if it were entered directly on the router's console, to achieve local control of the router 40.
配置请求可以以命令的形式从终端上下发,例如,在用户终端上向用户示出CLI界面,用户通过键盘输入等形式输入自己的配置请求,CLI界面不仅将用户的指令发送给接收模块402,同时还会对用户的输入进行回显,以便让用户确认自己输入的配置请求是否是自己期望下发的。The configuration request can be sent from the terminal in the form of a command. For example, the CLI interface is displayed to the user on the user terminal, and the user inputs its own configuration request through keyboard input or the like. The CLI interface not only sends the user's instruction to the receiving module 402. At the same time, the user's input is echoed, so that the user can confirm whether the configuration request entered by him or she is expected to be delivered.
配置请求主要用于对路由器上的某一个或者某一些待配置业务进行业务配置。在配置请求中可以包含待配置业务的业务类型以及业务数量,例如,配置请求中包含的信息是配置4000个子接口,那么待配置业务为配置子接口,而业务数量则为4000。另外,在配置请求中还可以包含一些其他信息,例如,用户特意指定了4000个子接口中的5个子接口的IP地址,那么在配置请求中除了待配置业务类型与业务数量之外,还包括5个IP地址,以及这5个IP地址与子接口的对应关系。The configuration request is mainly used to configure services for one or some of the services to be configured on the router. The configuration request can include the service type of the service to be configured and the number of services. For example, if the information contained in the configuration request is configured with 4,000 sub-interfaces, the service to be configured is configured as a sub-interface, and the number of services is 4000. In addition, the configuration request may also include some other information, for example, the user specifically specifies the IP address of the five sub-interfaces of the 4000 sub-interfaces, and the configuration request includes, in addition to the service type and the service quantity to be configured, IP addresses, and the correspondence between these five IP addresses and sub-interfaces.
在本发明实施例的一些示例当中,如图5所示,路由器40还包括合法校验模块410,当接收模块402接收到终端下发的配置请求之后,合法校验模块410需要对配置请求进行格式校验,以确定该配置请求是否合法。合法校验模块410进行格式校验只针对配置请求的数据格式、数据长度等进行形式上的校验。只有当合法校验模块410确定配置请求合法后,路由器40才会进行后续的配置过程,否则直接向终端返回非法提示,以提示用户其输入的配置请求存在形式上的错误。In some examples of the embodiments of the present invention, as shown in FIG. 5, the router 40 further includes a legal check module 410. After the receiving module 402 receives the configuration request sent by the terminal, the legal check module 410 needs to perform the configuration request. Format verification to determine if the configuration request is legitimate. The legal check module 410 performs format verification only for the formal verification of the data format and data length of the configuration request. Only after the legal verification module 410 determines that the configuration request is legal, the router 40 performs the subsequent configuration process. Otherwise, an illegal prompt is directly returned to the terminal to prompt the user that the configuration request entered has a formal error.
配置函数的主要功能是根据用户输入的配置请求输出相应的配置数 据,如果用户对某一待配置业务进行配置的业务数量比较大,可能需要用到批量处理函数,常见的批量处理函数包括:用于批量创建VRF的函数、批量删除VRF的函数、批量创建三层子接口的函数、批量删除三层子接口的函数等,以及子接口批量绑定VRF的函数、子接口批量绑定OSPF、ISIS协议的函数、子接口批量配置IP地址的函数、子接口批量封装VLAN的函数等。The main function of the configuration function is to output the corresponding number of configurations according to the configuration request input by the user. If the number of services configured for a service to be configured is large, you may need to use the batch processing function. Common batch processing functions include: functions for creating VRFs in batches, functions for deleting VRFs in batches, and batch creation. The functions of the sub-interfaces, the functions of deleting the sub-interfaces in batches, and the functions of sub-interfaces that bind VRFs in batches, the functions of sub-interfaces bound to OSPF, ISIS, and the functions of sub-interfaces to configure IP addresses in batches. A function that encapsulates a VLAN, and so on.
路由器40本地存储的配置函数可以满足用户绝大多数的配置请求,但在实际应用过程中,用户可能会有一些需求是路由器本地存储的配置函数无法实现的,针对这种情况,可能需要使用用户自定义的函数才能达到用户的需求,因此,在本发明实施例的一种较好的示例当中,如图6所示,路由器40中除了包括接收模块402、生成模块404和配置模块406以外,还包括获取模块408:The configuration function stored locally by the router 40 can satisfy most of the user's configuration requests. However, in the actual application process, the user may have some requirements that cannot be implemented by the configuration function of the router's local storage. For this situation, the user may need to be used. A custom function can meet the needs of the user. Therefore, in a preferred example of the embodiment of the present invention, as shown in FIG. 6, the router 40 includes a receiving module 402, a generating module 404, and a configuration module 406. Also included is an acquisition module 408:
获取模块408可以通过路由器40上设置的对外开放的编程接口接收用户自定义的批处理函数,然后对用户自定义的批处理函数进行编译及激活处理,最后将将处理后的批处理函数作为配置函数存储在本地。The obtaining module 408 can receive a user-defined batch function through an open programming interface set on the router 40, and then compile and activate the user-defined batch function, and finally configure the processed batch function as a configuration. The function is stored locally.
在本发明实施例中,编程接口能够接收用户导入的自定义批处理函数。可以理解的是,可以在用户需要使用该编程接口时,开启编程接口,这时候,路由器具有导入用户自定义函数的功能,而如果用户不需要使用编程接口,则可以关闭该编程接口,这时,本发明实施例中的路由器与普通路由器的使用没有区别。In an embodiment of the invention, the programming interface is capable of receiving a custom batch function imported by the user. It can be understood that the programming interface can be turned on when the user needs to use the programming interface. At this time, the router has the function of importing a user-defined function, and if the user does not need to use the programming interface, the programming interface can be closed. The router in the embodiment of the present invention is no different from the use of the ordinary router.
获取模块408接收到用户导入的自定义批处理函数之后,可以对该批处理函数进行编译及激活处理,编译过程就是把高级语言变成计算机可以识别的二进制语言,经过编译激活处理的批处理函数可以作为后续生成配置数据的配置函数使用,其作为内嵌在路由器中的函数与其他本来路由器自带的函数没有区别。 After receiving the custom batch function imported by the user, the obtaining module 408 can compile and activate the batch function, and the compiling process turns the high-level language into a binary language that can be recognized by the computer, and the batch function that is compiled and activated. It can be used as a configuration function for generating configuration data later, and it is no different from other functions that are built into the router as functions that are inherent in the router.
获取模块408对批处理函数进行编译激活处理之后,可以将其作为配置函数存储在路由器本地。在本发明实施例中,无论是路由器40自带的配置函数,还是从对外编程接口上导入的用户自定义的批量处理函数都可以以无差别的形式存储在数据库中。当然,在本发明实施例的另外一些示例当中,路由器40自带的配置函数和用户自定义形成的配置函数也可以分开存储。After the acquisition module 408 performs the compilation activation process on the batch function, it can be stored as a configuration function locally on the router. In the embodiment of the present invention, both the configuration function provided by the router 40 and the user-defined batch processing function imported from the external programming interface can be stored in the database in an undifferentiated form. Of course, in other examples of the embodiments of the present invention, the configuration function built into the router 40 and the user-defined configuration function may also be stored separately.
在本发明实施例中,利用路由器上的对外编程接口获取用户自定义的批量处理函数作为配置函数,能够扩展路由器进行业务配置时的功能,使业务配置更加灵活、全面,提高了用户体验。In the embodiment of the present invention, the user-defined batch processing function is used as a configuration function by using the external programming interface on the router, which can expand the function of the router to perform service configuration, and make the service configuration more flexible and comprehensive, thereby improving the user experience.
生成模块404生成配置数据之前需要先对配置请求进行解析主要是为了确定用户从终端上下发配置请求的实际目的。用户从终端下发的配置请求中可能用于对某一个或者多个待配置业务进行配置,而路由器如果要根据用户的配置请求对这些待配置业务进行配置,则需要知道用户想要对什么样的业务做什么样的配置。Before the generation module 404 generates the configuration data, the configuration request needs to be parsed firstly to determine the actual purpose of the user to send the configuration request from the terminal. The configuration request sent by the user may be used to configure one or more services to be configured. If the router needs to configure the services to be configured according to the configuration request of the user, it needs to know what the user wants to be. What kind of configuration does the business do?
生成模块404根据解析结果确定出待配置业务以及配置函数的类型。这里的配置函数是指用于生成对待配置业务进行配置的配置数据的配置函数。一般生成模块404对配置请求进行解析之后,可以直接获取到待配置业务的业务类型、业务数量等信息,但是在配置请求中并不一定直接包含配置函数的类型。如果用户在终端上下发配置请的时候指定了生成配置数据的配置函数的类型,则生成模块404可以直接将解析结果中包含的配置函数的类型作为后续调用配置函数的依据;但如果用户下发的配置请求中仅包括待配置业务的类型,生成模块404也可以根据待配置业务的类型确定出对应的配置函数的类型,因为不同的待配置业务需要不同的配置函数来生成对应的配置数据,所以实质上,在待配置业务与配置函数之间存在一定的对应关系。 The generating module 404 determines the type of the service to be configured and the configuration function according to the analysis result. The configuration function here refers to a configuration function for generating configuration data for configuring the service to be configured. After the configuration request is parsed, the general generation module 404 can directly obtain information such as the service type and the number of services of the service to be configured, but does not necessarily directly include the type of the configuration function in the configuration request. If the type of the configuration function that generates the configuration data is specified when the user sends the configuration to the terminal, the generation module 404 can directly use the type of the configuration function included in the analysis result as the basis for the subsequent call configuration function; The configuration request includes only the type of the service to be configured, and the generation module 404 may determine the type of the corresponding configuration function according to the type of the service to be configured, because different configuration services need different configuration functions to generate corresponding configuration data. Therefore, in essence, there is a certain correspondence between the service to be configured and the configuration function.
有时候,对于用户期望配置的一项待配置业务,生成模块404可能需要调用多种类型的配置函数,例如,用户虽然仅在配置请求中指示配置4000个子接口,但实际上,为了完成对4000个子接口的创建,生成模块404可能需要调用子接口批量创建函数、子接口批量配置IP地址的函数,以及子接口批量封装VLAN的函数。Sometimes, for a service to be configured that the user desires to configure, the generating module 404 may need to invoke multiple types of configuration functions. For example, although the user only indicates that 4000 sub-interfaces are configured in the configuration request, in reality, in order to complete the 4000. For the creation of a sub-interface, the generation module 404 may need to call the sub-interface batch creation function, the sub-interface to configure the IP address in batches, and the sub-interface to encapsulate the VLAN function.
确定要调用的配置函数的类型之后,生成模块404可以从路由器本地的数据库中调用对应的批处理函数来生成配置数据。这里继续结合上述示例进行解释:当确定需要调用子接口批量创建函数、子接口批量配置IP地址的函数,以及子接口批量封装VLAN的函数这三种类型的配置函数之后,生成模块404从对应的数据库中获取到这三个批量处理函数对应的程序来生成配置数据。如果在终端发送的配置请求中包含用户指定的部分子接口的IP地址,例如用户指定ID为39的子接口的IP地址为255.255.231.32,那么生成模块404在利用子接口批量配置IP地址的函数在为各子接口配置IP地址的时候,可以仅为其他3999个子接口配置对应的IP地址,然后将配置请求中携带的IP地址与ID为39的子接口进行关联。After determining the type of configuration function to invoke, the generation module 404 can call the corresponding batch function from the database local to the router to generate configuration data. Here, the description continues with the above example: after determining the three types of configuration functions that need to call the sub-interface batch creation function, the sub-interface to configure the IP address in batches, and the sub-interface to encapsulate the functions of the VLAN, the generation module 404 is corresponding. The program corresponding to the three batch processing functions is obtained in the database to generate configuration data. If the IP address of the sub-interface specified by the user is included in the configuration request sent by the terminal, for example, the IP address of the sub-interface with the user-specified ID 39 is 255.255.231.32, the generating module 404 functions to configure the IP address in batches by using the sub-interface. When you configure an IP address for each sub-interface, you can configure the corresponding IP address for only the other 3,999 sub-interfaces. Then, associate the IP address carried in the configuration request with the sub-interface with ID 39.
可以理解的是,在路由器40的数据库中存储的配置函数并非全都是批处理函数,当用户下发的配置请求中要求进行配置的业务数量不大时,可以直接采用这些非批量处理函数来生成配置数据。It can be understood that the configuration functions stored in the database of the router 40 are not all batch functions. When the number of services required to be configured in the configuration request sent by the user is not large, these non-bulk processing functions can be directly used to generate. Configuration Data.
在本发明实施例的另一示例当中,如图7,路由器40包括接收模块402、生成模块404、配置模块406、获取模块408以及合法校验模块410和有效校验模块412。当生成模块404获取到解析结果之后,有效校验模块412还可以根据路由器40的业务性能对解析结果进行校验,这一次的校验不再是对数据格式与数据长度的校验,而是根据路由器40本身的性能来确定用户下发的配置请求是否有效,例如,如果用户需要在路由器上配置4000个子接口,但事实上,该路由器本身就只能承载2000个子接口,这种情况成为 参数越界,说明该用户的配置请求是该路由器无法实现的,有效校验模块412可以确定该配置请求无效。如果配置请求无效,则不需要再进行后续的配置过程了。除了参数越界以外,参数不完整也会导致配置请求无效,例如,在配置请求中没有包含待配置业务的类型或用户指定的配置函数中的任意一个,仅包含了业务数量,这种配置请求也属于无效的。In another example of the embodiment of the present invention, as shown in FIG. 7, the router 40 includes a receiving module 402, a generating module 404, a configuration module 406, an obtaining module 408, and a legal check module 410 and a valid check module 412. After the generation module 404 obtains the analysis result, the valid verification module 412 can also verify the analysis result according to the service performance of the router 40. This time, the verification is no longer a verification of the data format and the data length, but According to the performance of the router 40 itself, it is determined whether the configuration request sent by the user is valid. For example, if the user needs to configure 4000 sub-interfaces on the router, in fact, the router itself can only carry 2000 sub-interfaces, which becomes If the parameter is out of bounds, the configuration request of the user is unreachable by the router, and the valid check module 412 can determine that the configuration request is invalid. If the configuration request is invalid, no further configuration process is required. In addition to the parameter out of bounds, the parameter is incomplete, which will invalidate the configuration request. For example, the configuration request does not contain any type of service to be configured or a user-specified configuration function, and only contains the number of services. Is invalid.
配置模块406用于根据生成的配置数据对待配置业务进行业务配置。生成配置数据以后,配置模块406可以根据用户的需求组织配置数据,对配置数据进行打包,下发硬件表项,以供路由器转发面在后续路由转发业务中使用。The configuration module 406 is configured to perform service configuration on the service to be configured according to the generated configuration data. After the configuration data is generated, the configuration module 406 can organize the configuration data according to the requirements of the user, package the configuration data, and deliver the hardware entry for the router forwarding plane to use in the subsequent routing and forwarding service.
在本发明实施例中,接收模块402可以通过路由器上的通信装置来实现,而生成模块404和配置模块406的功能则可以由路由器中的CPU(中央处理器)来实现,获取模块408可以通过路由器上的对外编程接口来接收用户导入的自定义批量处理函数,然后由CPU实现对自定义批量处理函数进行编译激活处理,最后将进行存储。合法校验模块410和有效校验模块412的功能可以由路由器中的CPU来实现。In the embodiment of the present invention, the receiving module 402 can be implemented by a communication device on the router, and the functions of the generating module 404 and the configuration module 406 can be implemented by a CPU (Central Processing Unit) in the router, and the obtaining module 408 can pass The external programming interface on the router receives the custom batch processing function imported by the user, and then the CPU implements the compilation and activation processing of the custom batch processing function, and finally stores it. The functions of the legal check module 410 and the valid check module 412 can be implemented by a CPU in the router.
本发明实施例中提供的路由器40能够根据终端发送的配置请求生成对自身业务进行配置的配置数据,因此不需要从终端上获取配置数据,避免了配置数据下发不完整、下发速度慢的问题,提高了业务配置的效率及准确率;同时该路由器通过网络开放编程接口,支持加载用户自定义的批量处理函数,增加了业务配置的灵活性。The router 40 provided in the embodiment of the present invention can generate configuration data for configuring the service according to the configuration request sent by the terminal, so that the configuration data is not required to be obtained from the terminal, and the configuration data is incompletely delivered and the delivery speed is slow. The problem is that the efficiency and accuracy of the service configuration are improved. At the same time, the router supports the loading of user-defined batch processing functions through the network open programming interface, thereby increasing the flexibility of service configuration.
为了让本领域技术人员更加了解本发明的优点和细节,本发明实施例结合路由器业务配置的一种具体示例对实施例一提供的路由器业务配置方法和实施例二提供的路由器进行进一步的说明,请参见图8:In order to make those skilled in the art better understand the advantages and details of the present invention, the embodiment of the present invention further describes the router service configuration method provided in Embodiment 1 and the router provided in Embodiment 2 in combination with a specific example of the router service configuration. See Figure 8:
S801、终端与路由器建立Telnet连接。S801. The terminal establishes a Telnet connection with the router.
终端与路由器建立Telnet连接后,用户可以通过Telnet协议登录路由 器,路由器包括操作管理(OAM,Operation and Maintenance)界面,该界面可以在终端上进行显示,在该界面中包括用户可以调用的配置函数,同时,在终端上还显示有CLI界面,可以理解的是,CLI界面与OAM界面可以集成在一起。After the terminal establishes a Telnet connection with the router, the user can log in to the router through the Telnet protocol. The router includes an operation and maintenance (OAM) interface. The interface can be displayed on the terminal. The interface includes a configuration function that can be called by the user. At the same time, a CLI interface is displayed on the terminal. Yes, the CLI interface and the OAM interface can be integrated.
S802、终端根据用户的操作生成配置请求并发送给路由器。S802. The terminal generates a configuration request according to a user operation and sends the configuration request to the router.
用户可以根据自己需要拍配置的业务从CLI界面中输入配置指令,然后从OAM界面中选择对应的配置函数,终端根据用户输入的配置指令与选择的配置函数生成配置请求。The user can input the configuration command from the CLI interface according to the service that needs to be configured by the user, and then select the corresponding configuration function from the OAM interface, and the terminal generates a configuration request according to the configuration instruction input by the user and the selected configuration function.
S803、路由器对配置请求进行格式校验,判断配置请求是否合法。S803: The router performs format verification on the configuration request to determine whether the configuration request is legal.
路由器对配置请求进行格式校验主要包括确定配置请求的数据格式、数据长度等是否符合要求,如果配置请求合法,则执行S804,否则执行S805。The format check of the configuration request by the router mainly includes determining whether the data format and the data length of the configuration request meet the requirements. If the configuration request is legal, execute S804, otherwise execute S805.
S804、路由器对配置请求进行解析。S804: The router parses the configuration request.
路由器可以从配置请求中获取到待配置业务的属性(即类型),以及各待配置业务的业务数量,业务数量可以通过待配置业务中的对象ID来体现。例如,对象ID分别是从1~4000,那么说明业务数量为4000。The router can obtain the attribute (that is, the type) of the service to be configured and the number of services of the service to be configured from the configuration request. The number of services can be reflected by the object ID in the service to be configured. For example, if the object ID is from 1 to 4000, then the number of services is 4000.
S805、在OAM界面显示报错提示。S805 displays an error message on the OAM interface.
OAM界面中的错误提示用于指示用户,告诉用户其数据的配置请求格式不正确。The error message in the OAM interface is used to indicate the user, telling the user that the configuration request of its data is not in the correct format.
S806、根据路由器的业务性能确定配置请求是否有效。S806. Determine, according to the service performance of the router, whether the configuration request is valid.
对配置请求的有效校验过程与合法校验有些区别,有效校验不再是对数据格式与数据长度的校验了,而是根据路由器本身的性能来确定路由器是否能够实现用户下发的配置请求。当是时,执行S807,否则,执行S808。The valid check process of the configuration request is different from the legal check. The valid check is no longer a check on the data format and the data length. It is based on the performance of the router itself to determine whether the router can implement the configuration delivered by the user. request. When it is, S807 is executed, otherwise, S808 is executed.
S807、根据配置请求调用配置函数生成配置数据。S807. Calling a configuration function according to the configuration request to generate configuration data.
这里以直接调用路由器中已集成的函数端口列表(记为portlist)和虚拟局域网列表(记为vlanlist)来批量创建一个父接口下的4000个三层子接 口,并为子接口封装对应的VLAN为例进行说明,在该示例当中还会使用用户自定义的批量生成三层子接口IP地址的函数网际协议地址列表(记为iplist),以实现为每个子接口配置对应的IP地址的目的。Here, you can directly create 4000 three-layer sub-connections under a parent interface by directly calling the integrated function port list (denoted as portlist) and the virtual LAN list (denoted as vlanlist) in the router. Port, and the corresponding VLAN is encapsulated for the sub-interface as an example. In this example, a user-defined batch is used to generate a three-layer sub-interface IP address function Internet Protocol address list (denoted as iplist) to implement Configure the corresponding IP address for each sub-interface.
OAM调用系统中已集成的portlist命令一次批量创建4000个子接口,并调用vlanlist封装对应的VLAN:OAM calls the integrated portlist command in the system to create 4000 sub-interfaces in batches and invokes vlanlist to encapsulate the corresponding VLAN:
interface portlist gei-0/1/0/1.1-4000;Interface portlist gei-0/1/0/1.1-4000;
interface vlanlist gei-0/1/0/1.1-4000;Interface vlanlist gei-0/1/0/1.1-4000;
开启路由器用户函数自定义的可编程功能,即打开对外的可编程接口。由用户编写批量指定子接口IP地址的函数iplist:Turn on the programmable function of the router user function, that is, open the external programmable interface. The function iplist for the batch to specify the IP address of the subinterface by the user:
interface iplist(portlist,initIP,mask,count);Interface iplist(portlist,initIP,mask,count);
其中portlist为待配置IP地址的子接口列表,initIP为起始IP地址,mask为IP地址掩码,count为待配置IP地址的数目。The portlist is the sub-interface list to be configured with the IP address. The initIP is the starting IP address, the mask is the IP address mask, and the count is the number of IP addresses to be configured.
路由器从可编程接口中接收用户导入的iplist函数,对其进行编译并激活。最后调用interface iplist为4000个VLAN子接口配置相应的IP地址。以起始地址为10.0.1.1,掩码为255.255.255.0为例,即在CLI界面输入:The router receives the user-imported iplist function from the programmable interface, compiles and activates it. Finally, the interface iplist is called to configure the corresponding IP address for 4000 VLAN sub-interfaces. Take the start address as 10.0.1.1 and the mask as 255.255.255.0 as an example. Enter the CLI interface:
interface iplist gei-0/1/0/1.1-4000 10.0.1.1 24 4000;Interface iplist gei-0/1/0/1.1-4000 10.0.1.1 24 4000;
至此,完成配置数据的生成。At this point, the generation of configuration data is completed.
S808、返回针对配置请求的无效提示信息。S808. Return invalid prompt information for the configuration request.
无效提示信息用于告知用户其下发的配置请求中存在参数越界或者参数不完整等情况。The invalid prompt information is used to inform the user that there is a parameter out of bounds or an incomplete parameter in the configuration request issued by the user.
S809、打包配置数据,形成硬件表项并通过统一支撑平台下发。S809. Packing configuration data, forming a hardware entry and delivering the data through a unified support platform.
生成配置数据以后,可以根据用户的需求组织配置数据,对配置数据进行打包,通过统一支撑平台下发硬件表项,以供路由器转发面在后续路由转发业务中使用。After the configuration data is generated, the configuration data can be configured according to the requirements of the user, and the configuration data is packaged. The hardware table entry is sent through the unified support platform for the router forwarding plane to be used in subsequent routing and forwarding services.
在本发明实施例中,在路由器侧预设生成配置数据的配置函数,使得 终端不需要向路由器发送海量的配置数据,不会导致配置数据漏发、错发的现象发生,提高了路由器业务配置的准确性和效率;另外,结合可编程接口导入的用户自定义的批量处理函数,增强了路由器业务配置的灵活性,提高了用户体验。In the embodiment of the present invention, a configuration function for generating configuration data is preset on the router side, so that The terminal does not need to send a large amount of configuration data to the router, which will not cause the configuration data to leak and send errors. This improves the accuracy and efficiency of the router service configuration. In addition, user-defined batch processing combined with the programmable interface import. The function enhances the flexibility of router service configuration and improves the user experience.
为解决上述技术问题,参见图9,图9为本发明实施例提供的路由器50的硬件结构示意图,包括:处理器51、存储器53以及网络接口52(使用网络接口卡、集成网络接口的形式进行网络通信),组件可以经总线连接通信。To solve the above technical problem, referring to FIG. 9, FIG. 9 is a schematic diagram of a hardware structure of a router 50 according to an embodiment of the present invention, including: a processor 51, a memory 53, and a network interface 52 (using a network interface card and an integrated network interface) Network communication), components can communicate via a bus connection.
存储器53,用于存储计算机程序;a memory 53 for storing a computer program;
处理器51,配置为通过执行所述存储器53中存储的所述计算机程序时实现路由器业务配置方法,例如包括以下步骤:接收终端发送的配置请求,所述配置请求用于对路由器上的至少一个待配置业务进行配置;根据所述配置请求调用所述存储器存储的配置函数生成配置数据;根据生成的所述配置数据对所述待配置业务进行配置。The processor 51 is configured to implement a router service configuration method by executing the computer program stored in the memory 53, for example, comprising the steps of: receiving a configuration request sent by a terminal, the configuration request being used for at least one on a router The configuration to be configured is performed by using the configuration function of the memory storage to generate configuration data according to the configuration request; and configuring the to-be-configured service according to the generated configuration data.
为解决上述技术问题,本发明实施例提供一种存储介质,可以由任何类型的易失性或非易失性存储器、或者它们的组合来实现。其中,非易失性存储器可以是只读存储器(ROM,Read Only Memory)、可编程只读存储器(PROM,Programmable Read-Only Memory)、可擦除可编程只读存储器(EPROM,Erasable Programmable Read-Only Memory)、电可擦除可编程只读存储器。存储介质存储有计算机程序,所述计算机程序被处理器执行时实现路由器业务配置方法,例如,如图1、2和3任一附图所示的路由器业务配置方法。To solve the above technical problem, an embodiment of the present invention provides a storage medium, which can be implemented by any type of volatile or non-volatile memory, or a combination thereof. The non-volatile memory may be a Read Only Memory (ROM), a Programmable Read-Only Memory (PROM), or an Erasable Programmable Read (EPROM). Only Memory), electrically erasable programmable read only memory. The storage medium stores a computer program that, when executed by the processor, implements a router service configuration method, such as the router service configuration method as shown in any of Figures 1, 2, and 3.
显然,本领域的技术人员应该明白,上述本发明实施例的各模块或各 步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的程序代码来实现,从而,可以将它们存储在计算机存储介质(ROM/RAM、磁碟、光盘)中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。所以,本发明不限制于任何特定的硬件和软件结合。Obviously, those skilled in the art should understand that each module or each of the above embodiments of the present invention The steps may be implemented in a general-purpose computing device, which may be centralized on a single computing device or distributed across a network of computing devices, optionally in the form of program code executable by the computing device. Thus, they can be stored in a computer storage medium (ROM/RAM, disk, optical disk) by a computing device, and in some cases, the steps shown or described can be performed in a different order than here. Alternatively, they may be fabricated into individual integrated circuit modules, or a plurality of modules or steps thereof may be fabricated into a single integrated circuit module. Therefore, the invention is not limited to any particular combination of hardware and software.
以上内容是结合具体的实施方式对本发明实施例所作的进一步详细说明,不能认定本发明的具体实施只局限于这些说明。对于本发明所属技术领域的普通技术人员来说,在不脱离本发明构思的前提下,还可以做出若干简单推演或替换,都应当视为属于本发明的保护范围。The above is a detailed description of the embodiments of the present invention in conjunction with the specific embodiments, and the specific embodiments of the present invention are not limited to the description. It will be apparent to those skilled in the art that the present invention may be made without departing from the spirit and scope of the invention.
工业实用性Industrial applicability
本发明实施例提供路由器业务配置方法及路由器、存储介质,路由器通过接收终端发送的配置请求,然后自己根据配置请求生成配置数据从而完成业务配置;通过在路由器侧生成进行业务配置的配置数据,使得对路由器进行业务配置的终端不需要下发海量的配置数据,而只需要将相对配置数据简单得多的配置请求发送给路由器即可,使得即使是对路由器的大量业务配置时,也不会存在配置数据下发慢、下发的配置数据不完整的问题存在,提高了业务配置的效率和用户体验。 The embodiment of the present invention provides a router service configuration method, a router, and a storage medium. The router receives the configuration request sent by the terminal, and then generates configuration data according to the configuration request to complete the service configuration. The router generates the configuration data for the service configuration. A terminal that performs service configuration on a router does not need to deliver a large amount of configuration data, but only needs to send a configuration request with a relatively simple configuration data to the router, so that even when a large number of services are configured for the router, the terminal does not exist. The problem that the configuration data is slow and the configuration data is incomplete is incomplete, which improves the efficiency and user experience of service configuration.

Claims (12)

  1. 一种路由器业务配置方法,包括:A router service configuration method includes:
    路由器接收终端发送的配置请求,所述配置请求用于对所述路由器上的至少一个待配置业务进行配置;The router receives a configuration request sent by the terminal, where the configuration request is used to configure at least one to-be-configured service on the router;
    所述路由器根据所述配置请求调用所述路由器本地存储的配置函数生成配置数据;The router generates a configuration data by using a configuration function locally stored by the router according to the configuration request;
    所述路由器根据生成的所述配置数据对所述待配置业务进行配置。The router configures the to-be-configured service according to the generated configuration data.
  2. 如权利要求1所述的路由器业务配置方法,其中,所述路由器根据所述配置请求调用所述路由器本地存储的配置函数生成配置数据之前还包括:所述路由器对所述配置请求进行格式校验以确定所述配置请求合法。The router service configuration method according to claim 1, wherein the router further includes: the router performing format verification on the configuration request, before the configuration request to generate configuration data by using a configuration function locally stored by the router To determine that the configuration request is legitimate.
  3. 如权利要求1所述的路由器业务配置方法,其中,所述配置请求中至少包括待配置业务的业务类型和业务数量。The router service configuration method according to claim 1, wherein the configuration request includes at least a service type and a service quantity of a service to be configured.
  4. 如权利要求1-3任一项所述的路由器业务配置方法,其中,所述路由器根据所述配置请求调用所述路由器本地存储的配置函数生成配置数据之前还包括:The router service configuration method according to any one of claims 1 to 3, wherein before the router generates the configuration data by using the configuration function stored locally by the router according to the configuration request, the method further includes:
    所述路由器接收用户自定义的批处理函数;The router receives a user-defined batch function;
    所述路由器对所述用户自定义的批处理函数进行编译及激活处理;The router compiles and activates the user-defined batch function;
    所述路由器将处理后的所述批处理函数作为配置函数存储在所述路由器本地。The router stores the processed batch function as a configuration function locally at the router.
  5. 如权利要求1-3任一项所述的路由器业务配置方法,其中,所述根据所述配置请求生成配置数据包括:The router service configuration method according to any one of claims 1 to 3, wherein the generating configuration data according to the configuration request comprises:
    所述路由器对所述配置请求进行解析;The router parses the configuration request;
    所述路由器根据所述解析结果确定出所述待配置业务以及用于生成待配置业务的配置数据的所述配置函数的类型;Determining, according to the parsing result, the type of the configuration function of the to-be-configured service and configuration data for generating a to-be-configured service;
    所述路由器根据所述配置函数的类型调用所述路由器本地对应的批处 理函数作为所述配置函数生成配置数据。The router invokes the local corresponding batch of the router according to the type of the configuration function The function function generates configuration data as the configuration function.
  6. 如权利要求5所述的路由器业务配置方法,其中,所述路由器根据所述配置函数的类型调用所述路由器本地对应的批处理函数作为所述配置函数生成配置数据之前还包括:所述路由器基于其业务性能根据所述解析结果确定所述配置请求有效。The router service configuration method according to claim 5, wherein the router further includes: the router is based on the batch function corresponding to the type of the configuration function, and the batch function corresponding to the router is used as the configuration function to generate configuration data. The service performance determines that the configuration request is valid according to the parsing result.
  7. 一种路由器,包括:A router that includes:
    接收模块,配置为接收终端发送的配置请求,所述配置请求用于对所述路由器上的至少一个待配置业务进行配置;a receiving module, configured to receive a configuration request sent by the terminal, where the configuration request is used to configure at least one to-be-configured service on the router;
    生成模块,配置为根据所述配置请求调用所述路由器本地存储的配置函数生成配置数据;Generating a module, configured to generate configuration data by using a configuration function locally stored by the router according to the configuration request;
    配置模块,配置为根据生成的所述配置数据对所述待配置业务进行配置。The configuration module is configured to configure the to-be-configured service according to the generated configuration data.
  8. 如权利要求7所述的路由器,其中,还包括获取模块,配置为在根据所述配置请求调用所述路由器本地存储的配置函数生成配置数据之前,接收用户的自定义批处理函数;对所述用户自定义的批处理函数进行编译及激活处理;并将处理后的所述批处理函数作为配置函数存储在所述路由器本地。The router of claim 7, further comprising an acquisition module configured to receive a user's custom batch function before generating configuration data by invoking a configuration function locally stored by the router according to the configuration request; The user-defined batch function performs compilation and activation processing; and the processed batch function is stored as a configuration function locally on the router.
  9. 如权利要求7所述的路由器,其中,所述生成模块配置为:对所述配置请求进行解析;根据所述解析结果确定出所述待配置业务以及用于生成待配置业务的配置数据的所述配置函数的类型;并根据所述配置函数的类型调用所述路由器本地对应的批处理函数作为所述配置函数生成配置数据。The router according to claim 7, wherein the generating module is configured to: parse the configuration request; and determine, according to the parsing result, the service to be configured and the configuration data for generating a service to be configured. Determining the type of the configuration function; and invoking the batch-specific corresponding batch function of the router as the configuration function to generate configuration data according to the type of the configuration function.
  10. 如权利要求9所述的路由器,其中,还包括:有效校验模块,配置为根据所述配置函数的类型调用所述路由器本地对应的批处理函数作为所述配置函数生成配置数据之前,基于所述路由器的业务性能根据所述解 析结果确定所述配置请求有效。The router according to claim 9, further comprising: a valid check module configured to call the batch-local corresponding batch function as the configuration function to generate configuration data according to the type of the configuration function, based on The service performance of the router is based on the solution The result of the analysis determines that the configuration request is valid.
  11. 一种路由器,包括:A router that includes:
    存储器,用于存储计算机程序;a memory for storing a computer program;
    处理器,配置为通过执行所述存储器中存储的所述计算机程序时实现权利要求1至6任一项所述的路由器业务配置方法。A processor configured to implement the router service configuration method of any one of claims 1 to 6 by executing the computer program stored in the memory.
  12. 一种存储介质,存储有计算机程序,所述计算机程序被处理器执行时实现权利要求1至6任一项所述的路由器业务配置方法。 A storage medium storing a computer program, the computer program being executed by a processor to implement the router service configuration method according to any one of claims 1 to 6.
PCT/CN2017/083831 2016-06-24 2017-05-10 Method for configuring service for router, router, and storage medium WO2017219778A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201610473604.7 2016-06-24
CN201610473604.7A CN107547217B (en) 2016-06-24 2016-06-24 Router service configuration method and router

Publications (1)

Publication Number Publication Date
WO2017219778A1 true WO2017219778A1 (en) 2017-12-28

Family

ID=60783831

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/083831 WO2017219778A1 (en) 2016-06-24 2017-05-10 Method for configuring service for router, router, and storage medium

Country Status (2)

Country Link
CN (1) CN107547217B (en)
WO (1) WO2017219778A1 (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110417582B (en) * 2019-07-03 2021-01-29 华为技术有限公司 Router configuration method, terminal and router
CN114726717B (en) * 2020-12-22 2023-09-01 华为技术有限公司 Method and apparatus for configuring nodes
EP4246909A4 (en) * 2020-12-22 2024-04-10 Huawei Tech Co Ltd Method and apparatus for configuring node

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20070274230A1 (en) * 2006-05-23 2007-11-29 Werber Ryan A System and method for modifying router firmware
US7606888B2 (en) * 2003-11-24 2009-10-20 Cisco Technology, Inc. Approach for managing network device configuration data
CN101883049A (en) * 2010-06-29 2010-11-10 浙江工商大学 Method for realizing business configuration router based on architecture of transmitting and controlling separate networkware
US20140297774A1 (en) * 2013-03-29 2014-10-02 Bala Sridhar Munupalle System for managing configuration updates in cluster of computational devices

Family Cites Families (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1184772C (en) * 2002-04-30 2005-01-12 华为技术有限公司 Method of configuration and upgrade of network apparatus in communication system
FR2858502B1 (en) * 2003-08-01 2006-02-24 Cit Alcatel DEVICE AND METHOD FOR PROCESSING NETWORK TRAFFIC DATA FOR SELF CONFIGURATION OF A ROUTER
US8001245B2 (en) * 2005-06-01 2011-08-16 International Business Machines Corporation System and method for autonomically configurable router
CN100407705C (en) * 2006-04-12 2008-07-30 华为技术有限公司 Router control method and system
CN101056225A (en) * 2007-05-31 2007-10-17 中兴通讯股份有限公司 A router test method and its onsite simulation test device
CN100566357C (en) * 2007-07-24 2009-12-02 华为技术有限公司 Communication apparatus batch configuration managerial approach and device thereof
CN103248525A (en) * 2013-05-23 2013-08-14 北京奇虎科技有限公司 Method and device of configuring network resources
CN104936248A (en) * 2014-03-21 2015-09-23 中兴通讯股份有限公司 Establishment method of wireless network, system and wireless routing device
US9197671B1 (en) * 2014-05-12 2015-11-24 International Business Machines Corporation Connection configuration
CN105227346B (en) * 2015-08-24 2018-09-28 上海斐讯数据通信技术有限公司 It is a kind of based on the method for configuring routers scanned the two-dimensional code
CN105245382B (en) * 2015-10-23 2018-07-31 小米科技有限责任公司 Change the method and device of route configuration information

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7606888B2 (en) * 2003-11-24 2009-10-20 Cisco Technology, Inc. Approach for managing network device configuration data
US20070274230A1 (en) * 2006-05-23 2007-11-29 Werber Ryan A System and method for modifying router firmware
CN101883049A (en) * 2010-06-29 2010-11-10 浙江工商大学 Method for realizing business configuration router based on architecture of transmitting and controlling separate networkware
US20140297774A1 (en) * 2013-03-29 2014-10-02 Bala Sridhar Munupalle System for managing configuration updates in cluster of computational devices

Also Published As

Publication number Publication date
CN107547217A (en) 2018-01-05
CN107547217B (en) 2022-05-10

Similar Documents

Publication Publication Date Title
US10728110B2 (en) Network connectivity wizard to support automated creation of customized configurations for virtual private cloud computing networks
JP6742650B2 (en) Application calling method and device using mobile browser
WO2017054531A1 (en) Yang model-based compiling method, and corresponding interface, component, and system
US11740917B2 (en) System and method for platform-integrated custom applications
WO2016119631A1 (en) Method for accessing cloud service and access device
US20050278348A1 (en) System and method for a Web service definition
US20120017222A1 (en) Interface For Telecommunication Services Using Uniform Resource Identifiers
US9858105B1 (en) Service for managing custom virtual machine images
CN109361550A (en) The method, device and equipment of network equipments configuration management
KR20140033494A (en) Method and system for implementing function extension of open platform
CN110289983B (en) Load balancing application creation method and device, computer equipment and storage medium
CN109814943B (en) Service construction method, loading method and device, electronic equipment and storage medium
WO2017219778A1 (en) Method for configuring service for router, router, and storage medium
CN113301116A (en) Cross-network communication method, device, system and equipment for microservice application
US20110320286A1 (en) System And Method For Integrating An Ad Banner With A Calling Application
EP3047638B1 (en) Multi-channel delivery platform
CN108804100B (en) Method and device for creating interface element, storage medium and mobile terminal
WO2022099913A1 (en) Interface configuration method and apparatus, and device and medium
CN113626001A (en) API dynamic editing method and device based on script
CN113162807B (en) Method and device for realizing linkage of cloud management server and SDN
WO2022252040A1 (en) Configuration data packet and file generating method, processing method, device, and medium
CN110855745B (en) Program access method of communication software
CN114153488A (en) Application request processing method, device, system and medium
CN113986207A (en) Software architecture generating and calling method and device
CN115048098A (en) Process automation method, device, system and storage medium

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: 17814516

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: 17814516

Country of ref document: EP

Kind code of ref document: A1