Online dynamic programming method and system of programmable network equipment and storage medium
By inserting a custom protocol header into the IP data packet and parsing the network service instructions in the programmable network device, the problems of high performance and insufficient online programming flexibility in the existing technology are solved, and efficient and scalable online dynamic programming is realized, avoiding business interruption and performance loss.
Patent Information
- Application Number
- CN202510598560.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-09
- Publication Date
- 2025-09-05
- Estimated Expiration
- 2045-05-09
AI Technical Summary
Existing programmable network technologies cannot simultaneously meet the requirements of high performance and online programming flexibility, resulting in the need to recompile programs every time network service functions are added or deleted, leading to business service interruptions and performance losses.
By inserting a custom protocol header into an IP data packet, which contains a network service instruction sequence, and parsing and executing these instructions in a programmable network device, the network service is dynamically adjusted, and a recycling processing mechanism is supported to implement a network service instruction sequence of any length.
It achieves a combination of high performance and online programming flexibility, avoids business interruptions, ensures high throughput and low latency network services, supports network service instruction sequences of arbitrary length, and realizes efficient and scalable online dynamic programming.
Smart Images

Figure CN120602572A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of communication networks, and in particular to an online dynamic programming method, system and storage medium for programmable network equipment. Background Art
[0002] With the continuous development of internet services, the scale and number of data centers are increasing, leading to increased complexity in network management and operations. To address this challenge, Software-Defined Networking (SDN) was proposed. Its core concept is to separate the data forwarding plane from the control plane, enabling more refined control of network resources and greater service flexibility. With the development of SDN, the data forwarding plane has become more flexible, giving rise to programmable network technology, including key achievements such as network programming languages (such as P4), network programming models, and programmable network devices. The importance of programmable network technology lies in not only simplifying network configuration and management processes but also bringing a higher level of intelligence to the network, enabling it to meet complex service requirements. Therefore, programmable network technology is a core element in building an efficient, intelligent, and flexible network infrastructure.
[0003] However, current programmable network technology cannot simultaneously achieve high performance and online programming flexibility. Specifically, programming on programmable network devices, especially programmable switches, requires recompiling the entire program every time a network service function is added or removed. This then interrupts the programmable network device's service and requires re-issuing and redeploying the program. This leads to significant application traffic interruptions, severely impacting service quality. While software switches like Click Router support flexible online adjustments to avoid service interruptions, they run on general-purpose servers whose hardware and software are not specifically designed for network processing, resulting in limited performance. CPU processing power is limited, and the operating system and protocol stack also introduce significant latency, resulting in low forwarding efficiency. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a method, system, and storage medium for online dynamic programming of programmable network devices to eliminate or improve one or more deficiencies in the prior art, and to address the problem that existing programmable network technologies cannot simultaneously meet high performance and online programming flexibility.
[0005] One aspect of the present invention provides an online dynamic programming method for a programmable network device, which is used in a control terminal and includes:
[0006] According to the network service function indicated by the user configuration or application requirements, the corresponding network service function definition is called to generate the corresponding network service instruction sequence;
[0007] A custom protocol header is constructed based on the network service instruction sequence and the custom protocol structure and inserted into the IP data packet; the custom protocol structure includes the protocol type, the number of instructions and the instruction sequence; the instruction sequence includes the instruction type and instruction data;
[0008] In the type field of the IP data packet, mark whether the current data packet belongs to a normal data packet or contains a tag value of a custom protocol header;
[0009] An IP data packet is sent to a programmable network device so that the programmable network device directly forwards it when the tag value of the type field indicates that the current data packet belongs to a normal data packet; when the tag value indicates that the current data packet contains a custom protocol header, the programmable network device parses the custom protocol header, executes and removes the network service instruction sequence one by one, and dynamically adjusts the network service of the programmable network device.
[0010] In some embodiments of the present invention, constructing a custom protocol header based on a network service instruction sequence and a custom protocol structure and inserting it into an IP data packet includes:
[0011] Mark the forwarding protocol type recorded in the original type field of the IP data packet to the protocol type;
[0012] Fill the instruction quantity, instruction type and instruction data of the network service instruction sequence into the custom protocol structure in sequence to obtain a custom protocol header;
[0013] Insert the custom protocol header into the IP data packet after the IP header.
[0014] In some embodiments of the present invention, the network service function is pre-stored in a preset network service function library;
[0015] According to the network service function indicated by the user configuration or application requirements, the corresponding network service function definition is called to generate the corresponding network service instruction sequence, including:
[0016] According to the network service function, select and call the corresponding network service function from the network service function library;
[0017] generating at least one network service instruction based on a function definition of the called network service function;
[0018] All network service instructions are sorted according to a preset execution order to obtain a network service instruction sequence.
[0019] In some embodiments of the present invention, the network service function library is deployed in the control terminal and interacts with the control terminal through a unified library interface;
[0020] In the case of a failure to call a function from the network service library, it also includes:
[0021] Generate and output prompt information; the prompt information is used to prompt the user to add the network service function corresponding to the network service function in the network service function library;
[0022] When receiving new network service function codes uploaded by users or external development tools, perform syntax verification, security testing, and compatibility verification with network service function libraries on the new network service functions to obtain verification results;
[0023] If the verification result indicates that the verification is passed, register the new network service function to the network service function library and establish a mapping relationship with the corresponding network service function;
[0024] Updated the function call list and metadata index in the library interface.
[0025] Another aspect of the present invention provides an online dynamic programming method for a programmable network device, which is used in a programmable network device and includes:
[0026] In response to a received IP data packet, a tag value of a type field in the IP data packet is parsed; the tag value is used to indicate whether the IP data packet contains a custom protocol header or is a normal data packet; the custom protocol header includes a protocol type, a number of instructions, and an instruction sequence; the protocol type is used to record a forwarding protocol type of the IP data packet; the instruction sequence includes an instruction type and instruction data;
[0027] When the tag value indicates that the IP data packet contains a custom protocol header, the custom protocol header is parsed, the network service instructions in the instruction sequence are executed and removed in sequence, and the instruction number is updated until the value of the instruction number is 0, completing the execution of all network service instructions.
[0028] In some embodiments of the present invention, when the value of the number of instructions is 0, the method further includes:
[0029] Mark the forwarding protocol type into the type field;
[0030] Delete the custom protocol header and forward the IP packet.
[0031] In some embodiments of the present invention, a programmable network device includes at least one instruction function module; each instruction function module is responsible for processing a specified type of network service instruction;
[0032] Execute and remove network service instructions from the instruction sequence in order, including:
[0033] Extracting a network service instruction from the instruction sequence in sequence and removing it from the instruction sequence; the extracted network service instruction includes a corresponding instruction type and instruction data;
[0034] According to the preset mapping relationship between the extracted instruction type and the instruction function module, query and determine the corresponding instruction function module as the target instruction function module;
[0035] The extracted instruction data is sent to the target instruction function module for execution.
[0036] In some embodiments of the present invention, when the tag value indicates that the IP data packet is a common data packet, the method further includes: directly forwarding the IP data packet.
[0037] Another aspect of the present invention provides an online dynamic programming system for a programmable network device, comprising a processor, a memory, and a computer program / instruction stored in the memory, wherein the processor is configured to execute the computer program / instruction. When the computer program / instruction is executed, the system implements the steps of the online dynamic programming method for a programmable network device as described above.
[0038] Another aspect of the present invention provides a computer-readable storage medium, in which a program is stored. When the program is executed by a processor, it is used to implement the steps of the online dynamic programming method of a programmable network device as described above.
[0039] The beneficial effects of the present invention include at least:
[0040] The online dynamic programming method and system of the programmable network device of the present invention are as follows: the control terminal is used to call the corresponding network service function definition to generate the corresponding network service instruction sequence according to the network service function indicated by the user configuration or application requirements; based on the network service instruction sequence and the custom protocol structure, a custom protocol header is constructed and inserted into the IP data packet, and the type field of the IP data packet is marked as a tag value indicating that the current data packet belongs to a normal data packet or contains a network service instruction; the custom protocol structure includes a protocol type, the number of instructions and the instruction sequence; the instruction sequence includes the instruction type and the instruction data; the programmable network device is used to receive the IP data packet sent by the control terminal; when the type field of the IP data packet marks that the current data packet belongs to a normal data packet, it is directly forwarded; when the type field of the IP data packet marks that the current data packet contains a network service instruction, the custom protocol header is parsed, the network service instruction sequence is executed and removed one by one, and the network service of the programmable network device is dynamically adjusted; it solves the existing programmable network technology The problem of being unable to simultaneously meet high performance and online programming flexibility; by focusing on the hardware design and implementation of programmable network devices, it is possible to avoid relying on software switches and general servers, thereby ensuring excellent performance of high throughput and low latency, and fully meeting the requirements of high-performance network services; at the same time, the control terminal side generates the corresponding network service instruction sequence by calling the network service function, inserts it into the IP data packet, and modifies the type field of the IP data packet to mark the data packet; in the programmable network device, when the tag value in the received data packet indicates that the current data packet includes a network service instruction sequence, the network service instruction sequence carried in the data packet is parsed and executed in sequence, otherwise the data packet is forwarded directly; in this way, developers only need to write or expand the corresponding network service function on the control terminal side, without modifying the program on the programmable network device, and without stopping the service of the programmable network device, to complete the online update and deployment of the network service function, thereby realizing efficient and dynamic network programming.
[0041] In addition, programmable network devices support a recirculating processing mechanism. After each network service instruction is executed, if the data packet still contains unexecuted instructions, it will be re-entered into the program entry point for the next round of processing. After all instructions are executed, the data packet is forwarded. This mechanism enables the system to support network service instruction sequences of any length, thereby achieving efficient and scalable online dynamic programming capabilities.
[0042] Additional advantages, objects, and features of the present invention will be set forth in part in the following description and will become apparent to those skilled in the art upon examination of the following or may be learned from practice of the present invention. The objects and other advantages of the present invention may be realized and obtained by the structures particularly pointed out in the description and drawings.
[0043] Those skilled in the art will understand that the purposes and advantages that can be achieved by the present invention are not limited to the above specific descriptions, and the above and other purposes that can be achieved by the present invention will be more clearly understood based on the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] The drawings described herein are used to provide a further understanding of the present invention, constitute a part of this application, and do not constitute a limitation of the present invention. In the drawings:
[0045] Figure 1 A schematic diagram of the structure of an online dynamic programming system for programmable network devices provided by one embodiment of the present invention.
[0046] Figure 2 A schematic diagram of the structure of a custom protocol header provided by an embodiment of the present invention.
[0047] Figure 3 A schematic diagram of a flow chart of a programmable network device processing an IP data packet according to an embodiment of the present invention.
[0048] Figure 4 A schematic diagram of the process of online dynamic programming of a programmable network device provided by another embodiment of the present invention. DETAILED DESCRIPTION
[0049] In order to make the purpose, technical solutions and advantages of the present invention more clearly understood, the present invention is further described in detail below in conjunction with the embodiments and the accompanying drawings. Here, the exemplary embodiments of the present invention and their descriptions are used to explain the present invention, but are not intended to limit the present invention.
[0050] It should also be noted that, in order to avoid obscuring the present invention due to unnecessary details, the accompanying drawings only show structures and / or processing steps closely related to the solutions according to the present invention, while other details that are not closely related to the present invention are omitted.
[0051] It should be emphasized that the term "include / comprises" when used herein refers to the existence of features, elements, steps or components, but does not exclude the existence or addition of one or more other features, elements, steps or components.
[0052] It should also be noted that, unless otherwise specified, the term "connection" herein may refer not only to a direct connection but also to an indirect connection involving an intermediate.
[0053] Hereinafter, embodiments of the present invention will be described with reference to the accompanying drawings. In the accompanying drawings, the same reference numerals represent the same or similar components, or the same or similar steps.
[0054] This embodiment provides a schematic diagram of the structure of an online dynamic programming system for a programmable network device. Figure 1 As shown, the online dynamic programming system of a programmable network device at least includes: a control terminal 110 and a programmable network device 120.
[0055] like Figure 1 As shown, the number of control terminals 110 and the number of programmable network devices 120 are both 1. In actual implementation, the number of control terminals 110 and the number of programmable network devices 120 are at least one.
[0056] In some embodiments of the present invention, the control terminal 110 refers to an electronic device that can communicate with the programmable network device 120 (including wired communication connection or wireless communication connection) to implement the network service function configuration and management of the programmable network device 120, including but not limited to a mobile phone or tablet computer.
[0057] Programmable network devices 120 are network devices that can be flexibly configured and dynamically adjusted through programming, including but not limited to programmable switches or programmable routers. Network service functions include various network services provided by programmable network devices 120, such as traffic management, security policy enforcement, and Quality of Service (QoS) assurance.
[0058] In some embodiments of the present invention, an encapsulation mechanism based on a custom protocol structure is adopted. The mechanism constructs a custom protocol header through a network service instruction sequence and a custom protocol structure, which is used to carry the network service instruction and its related parameters, thereby realizing the transmission of the network service instruction.
[0059] Specifically, the control terminal 110 is used to call the corresponding network service function definition to generate a corresponding network service instruction sequence according to the network service function indicated by the user configuration or application requirements; build a custom protocol header based on the network service instruction sequence and the custom protocol structure and insert it into the IP data packet, and mark the type field of the IP data packet as a normal data packet or a tag value containing a network service instruction; and send the IP data packet to the programmable network device 120.
[0060] User configuration refers to parameter information input by a user through an input module (such as a keyboard, mouse, touch screen, or remote management interface) connected to the control terminal 110, used to instruct the programmable network device 120 to perform a specific network service function. Such parameter information includes, but is not limited to, the name, identifier, priority, scope, and related policy rules of the network service to be enabled, modified, or deleted.
[0061] Application requirements refer to the objective demands that applications running on the network place on the network environment based on their own characteristics. Different applications have significantly different requirements for network quality of service. For example, real-time audio and video applications (such as video conferencing and online gaming) typically require a high-bandwidth, low-latency, and low-jitter network environment; whereas background tasks such as data synchronization and file backup are more focused on transmission reliability and integrity and are less sensitive to latency.
[0062] An IP packet is the basic unit of Internet Protocol (IP) transmission at the network layer. It is used to transmit information between different hosts and consists of two parts: the IP header and data (Data / Payload).
[0063] In some embodiments of the present invention, the control terminal 110 can automatically identify or allow the user to manually specify network service requirements corresponding to different applications, and call corresponding network service functions accordingly to implement application-oriented network service function deployment.
[0064] Among them, network service function refers to the code module or program unit used to define and implement specific network functions in a programmable network environment.
[0065] In some embodiments of the present invention, the network service function is stored in a preset network service function library and is implemented based on a custom protocol field, including an instruction type and instruction data corresponding to the network service instruction.
[0066] In the network service function library, each network service function corresponds to a specific network service processing function. The network service functions in the library can be accessed through the library interface provided by the network service function library, and the network service instruction sequence can be obtained by combining and sorting them according to specific needs.
[0067] Specifically, according to the network service function indicated by the user configuration or application requirements, the corresponding network service function is called, and the corresponding network service instruction sequence is generated according to the functional definition of the network service function, including: according to the network service function, selecting and calling the corresponding network service function from the network service function library; generating at least one network service instruction based on the functional definition of the called network service function; sorting all network service instructions according to a preset execution order to obtain a network service instruction sequence.
[0068] In some embodiments of the present invention, the network service function library is deployed in the control terminal 110 and interacts with the control terminal 110 through a unified library interface.
[0069] Specifically, the network service function library is a functional module installed on the control terminal 110. It is used to store and manage multiple network service functions and provides a unified calling interface so that applications or users can dynamically select and call corresponding network service functions based on actual needs. Users call the required network service functions through the library interface provided by the network service function library. The library interface automatically generates the corresponding network service instruction sequence and inserts it into the IP data packet.
[0070] In other embodiments of the present invention, the system further includes a cloud server; the network service function library is deployed in the cloud server; and the control terminal 110 establishes a communication connection with the cloud server.
[0071] In addition, when a new network service needs to be developed, it is only necessary to write the corresponding network service function on the control terminal 110 side, and call and integrate it through the library interface of the network service function, thereby realizing the online dynamic programmability of the system.
[0072] If the control terminal 110 cannot automatically identify or the automatic identification result indicates that the corresponding network service function is missing in the network service function library, resulting in a failure in calling the network service function, the control terminal 110 is further configured to generate and output a prompt message, wherein the prompt message is used to prompt the user to add the network service function corresponding to the network service function in the network service function library.
[0073] Specifically, the control terminal 110 is also used to receive new network service function codes uploaded by users or external development tools; perform syntax checking, security testing and compatibility verification with the network service function library on the new network service function to obtain a verification result; when the verification result indicates that the verification is passed, register the new network service function to the network service function library and establish a mapping relationship with the corresponding network service function; update the function call list and metadata index in the library interface.
[0074] like Figure 2 As shown, in some embodiments of the present invention, the custom protocol structure includes a protocol type, a number of instructions, and an instruction sequence; the instruction sequence includes an instruction type and instruction data.
[0075] The protocol type is used to mark the forwarding protocol type (such as TCP / UDP) recorded in the original type field of the IP packet. This prevents the insertion of a custom protocol header into the IP packet from affecting the parsing of the original IP packet information. The number of instructions is used to record the total number of network service instructions. The instruction type is used to specify the specific operation type of the network service instruction. The instruction data corresponds to the operation parameters of each instruction, such as the target port, priority, and action parameters.
[0076] In the process of generating a custom protocol header, the forwarding type recorded in the original type field of the IP data packet is first tagged with the protocol type in the custom protocol structure. Next, the instruction number, instruction type of each network service instruction, and instruction data are sequentially filled into the corresponding fields to generate the custom protocol header. After being inserted into the IP header, the value of the original protocol field in the IP header is modified to the preset custom protocol type value (for example, 145) to indicate that the packet contains a network service instruction sequence.
[0077] Specifically, in the control terminal 110, a custom protocol header is constructed based on the network service instruction sequence and the custom protocol structure and inserted into the IP data packet, including: marking the forwarding protocol type recorded in the original protocol field in the IP data packet to the protocol type field; filling the instruction number, instruction type and instruction data of the network service instruction sequence into the custom protocol structure in sequence to obtain a custom protocol header; and inserting the custom protocol header after the IP header in the IP data packet.
[0078] After receiving the data packet sent by the control terminal 110, the programmable network device 120 determines whether the currently received data packet is a common data packet that needs to be directly forwarded or a data packet containing a custom protocol header based on the tag value of the protocol field in the IP data packet.
[0079] Specifically, the programmable network device 120 is used to receive the IP data packet sent by the control terminal 110, parse and obtain the tag value of the type field in the IP data packet; when the tag value indicates that the current data packet is a normal data packet, directly forward it; when the tag value indicates that the current data packet contains a custom protocol header, parse the custom protocol header, execute and remove the network service instructions in the instruction sequence in sequence, and update the number of instructions until the value of the number of instructions is 0, complete the execution of all network service instructions, and dynamically adjust the network services of the programmable network device.
[0080] In some embodiments of the present invention, a program written in a network programming language runs in the programmable network device 120. The program refers to a set of general programs that can be implemented on the programmable network device 120 (such as a programmable switch). The key is the general program control flow, including multiple key operations, such as field update, memory access, forwarding, recycling, etc.
[0081] The network programming language refers to a network data plane programming language, including the Protocol for Packet Parsing and Processing (P4) or the Behavioral Model Language (BMv2). In actual implementation, the network programming language may also be the Network Kernel Automated Tool (NetKAT) based on Kleene algebra. This embodiment does not limit the type of network programming language.
[0082] The traditional network data processing process typically includes three key modules: a protocol parser, a matching execution pipeline, and a reverse parser. Incoming packets first enter the protocol parser, where they are parsed according to the state transition diagram defined in network programming languages like P4. The packet fields are extracted and stored in predefined structures. Subsequently, the protocol parser enters the matching execution pipeline, where field matching and behavior execution are performed sequentially to determine, modify, and control packet forwarding. Finally, the reverse parser encapsulates the packet back into a standard format.
[0083] However, the current usage model for network programming languages like P4 is an integrated "write-compile-deploy" process. All functions (such as basic forwarding, firewall, load balancing, etc.) must be integrated into a single program. Because hardware resources are statically allocated at compile time, adding any new functions requires re-adjusting the entire program, resulting in high development costs and poor flexibility. Furthermore, P4 programs are compiled and deployed as a whole, and updates require replacing the original program. This can cause service interruptions for programmable network devices, affecting business continuity and severely impacting service quality.
[0084] To address the aforementioned issues with conventional technologies, a recurring processing feature is introduced into the program control flow of programmable network device 120. The program parses the network service instructions carried in data packets and sequentially executes the required network processing. This allows for a concise and universal network programming language program to support network service instructions of varying lengths, thus enabling an extensible dynamic programming mechanism.
[0085] like Figure 3 As shown, the program control process run by the programmable network device 120 can be divided into three parts: instruction parsing, instruction processing, and branch decision making.
[0086] In the instruction parsing process, in order to avoid performing instruction parsing on ordinary data packets that do not carry a custom protocol header, when the programmable network device 120 receives a data packet, it is necessary to first parse the protocol field of the IP header in the IP data packet.
[0087] If the tag value of the protocol field in the IP header indicates that the data packet contains a custom protocol header (for example, 145), proceed to the next instruction processing flow, otherwise forward normally (for example, the tag value is TCP or UDP).
[0088] In the instruction processing flow, a network service instruction is extracted from the instruction sequence of the custom protocol header in sequence, and the instruction type and instruction data corresponding to the network service instruction are removed from the field, and the value of the number of instructions in the custom protocol header is reduced by 1; then, the parsed network service instruction is executed to determine whether the value of the number of instructions in the custom protocol header is 0. If it is not 0, it means that there are still network service instructions in the instruction sequence that have not been executed, and the branch decision process is entered.
[0089] In the branch decision process, all network service instructions are executed sequentially through recirculation processing. After processing a network service instruction, the recirculation port is entered to re-enter the processing program entry to process the next hop command until all network service instructions in the instruction sequence are completed.
[0090] When the value of the instruction number is 0, it means that the execution has been completed, the value of the type field in the IP header is restored (such as TCP or UDP), the custom protocol header is deleted, and the data packet is forwarded.
[0091] Specifically, when the value of the instruction number is 0, the method further includes: marking the forwarding protocol type to the type field; deleting the custom protocol header, and forwarding the IP data packet.
[0092] In addition, in some embodiments of the present invention, the programmable network device 120 includes at least one instruction function module.
[0093] Each instruction module is responsible for processing specific network service instructions. For example, the encryption module handles encryption-related instructions, such as encrypting or decrypting data packets; the Quality of Service (QoS) module handles traffic prioritization instructions, such as setting packet priority or bandwidth limits; and the routing module handles routing-related instructions, such as specifying the next hop address or path for a data packet.
[0094] After parsing the instruction type from the custom protocol header, the programmable network device 120 searches for the instruction function module corresponding to the instruction type based on a predefined mapping relationship. The parsed instruction data is then passed to the selected instruction function module, which then performs the corresponding operation. For example, if the instruction type is "encryption," the encryption module is selected for processing; if the instruction type is "QoS," the Quality of Service module is selected for processing.
[0095] Specifically, in the programmable network device 120, the network service instructions in the instruction sequence are executed and removed in sequence, including: extracting a network service instruction from the instruction sequence in sequence and removing it from the instruction sequence; the extracted network service instruction includes a corresponding instruction type and instruction data; according to the preset mapping relationship between the extracted instruction type and the instruction function module, querying and determining the corresponding instruction function module as the target instruction function module; and sending the extracted instruction data to the target instruction function module for execution.
[0096] In summary, the online dynamic programming system of programmable network devices provided in this embodiment includes a control terminal and a programmable network device, and the programmable network device runs a program written in a network programming language; the control terminal is used to call the corresponding network service function definition to generate a corresponding network service instruction sequence according to the network service function indicated by the user configuration or application requirements; a custom protocol header is constructed based on the network service instruction sequence and the custom protocol structure and inserted into the IP data packet, and the type field of the IP data packet is marked as a normal data packet or a tag value containing a network service instruction; the custom protocol structure includes a protocol type, the number of instructions and the instruction sequence; the instruction sequence contains the instruction type and instruction data; the programmable network device is used to receive the IP data packet sent by the control terminal; when the type field of the IP data packet marks that the current data packet belongs to a normal data packet, it is directly forwarded; when the type field of the IP data packet marks that the current data packet contains a network service instruction, the custom protocol header is parsed, and the network service instruction sequence is executed and removed one by one, and the programmable network device is dynamically adjusted. Programming network services for network devices; solving the problem that existing programmable network technologies cannot simultaneously meet high performance and online programming flexibility; by focusing on the hardware design and implementation of programmable network devices, it can avoid relying on software switches and general servers, thereby ensuring excellent performance of high throughput and low latency, and fully meeting the requirements of high-performance network services; at the same time, the control terminal side generates the corresponding network service instruction sequence by calling the network service function, inserts it into the IP data packet, and modifies the type field of the IP data packet to mark the data packet; in the programmable network device, when the tag value in the received data packet indicates that the current data packet includes a custom protocol header, the instruction sequence in the custom protocol header is parsed and executed in sequence, otherwise the data packet is forwarded directly; in this way, developers only need to write or extend the corresponding network service function on the control terminal side, without modifying the program on the programmable network device, and without stopping the service of the programmable network device, to complete the online update and deployment of the network service function, and realize efficient and dynamic network programming.
[0097] In addition, programmable network devices support a recirculating processing mechanism. After each network service instruction is executed, if the data packet still contains unexecuted instructions, it will be re-entered into the program entry point for the next round of processing. After all instructions are executed, the data packet is forwarded. This mechanism enables the system to support network service instruction sequences of any length, thereby achieving efficient and scalable online dynamic programming capabilities.
[0098] The following is a detailed introduction to the online dynamic programming method for programmable network devices provided by this application.
[0099] like Figure 4 As shown, the embodiment of the present application provides an online dynamic programming method for a programmable network device. Figure 1 Taking the system shown in FIG. 1 as an example, the method includes at least the following steps:
[0100] Step S401 : The control terminal calls the corresponding network service function definition to generate a corresponding network service instruction sequence according to the network service function indicated by the user configuration or application requirements.
[0101] User configuration refers to the parameter information entered by the user through an input module connected to the control terminal (such as a keyboard, mouse, touch screen, or remote management interface) to instruct the programmable network device to perform specific network service functions. This parameter information includes, but is not limited to, the name, identifier, priority, scope, and related policy rules of the network service to be enabled, modified, or deleted.
[0102] Application requirements refer to the objective demands that applications running on the network place on the network environment based on their own characteristics. Different applications have significantly different requirements for network quality of service. For example, real-time audio and video applications (such as video conferencing and online gaming) typically require a high-bandwidth, low-latency, and low-jitter network environment; whereas background tasks such as data synchronization and file backup are more focused on transmission reliability and integrity and are less sensitive to latency.
[0103] An IP packet is the basic unit of Internet Protocol (IP) transmission at the network layer. It is used to transmit information between different hosts and consists of two parts: the IP header and data (Data / Payload).
[0104] In some embodiments of the present invention, the network service function is stored in a preset network service function library and is implemented based on a custom protocol field, including an instruction type and instruction data corresponding to the network service instruction.
[0105] In the network service function library, each network service function corresponds to a specific network service processing function. The network service functions in the library can be accessed through the library interface provided by the network service function library, and the network service instruction sequence can be obtained by combining and sorting them according to specific needs.
[0106] Specifically, according to the network service function indicated by the user configuration or application requirements, the corresponding network service function is called, and the corresponding network service instruction sequence is generated according to the functional definition of the network service function, including: according to the network service function, selecting and calling the corresponding network service function from the network service function library; generating at least one network service instruction based on the functional definition of the called network service function; sorting all network service instructions according to a preset execution order to obtain a network service instruction sequence.
[0107] In some embodiments of the present invention, the network service function library is deployed in the control terminal and interacts with the control terminal through a unified library interface.
[0108] Specifically, the network service function library is a functional module installed on the control terminal side. It is used to store and manage multiple network service functions and provides a unified calling interface so that applications or users can dynamically select and call corresponding network service functions based on actual needs. Users call the required network service functions through the library interface provided by the network service function library. The library interface automatically generates the corresponding network service instruction sequence and inserts it into the IP data packet.
[0109] In other embodiments of the present invention, the network service function library is deployed in a cloud server; and a communication connection is established between the control terminal and the cloud server.
[0110] In addition, when a new network service needs to be developed, it is only necessary to write the corresponding network service function on the control terminal side and call and integrate it through the library interface of the network service function, thereby realizing the system's online dynamic programmability.
[0111] If the control terminal cannot automatically identify or the automatic identification result indicates that the corresponding network service function is missing in the network service function library, resulting in a failure in calling the network service function, the control terminal 110 is further configured to generate and output a prompt message, wherein the prompt message is used to prompt the user to add the network service function corresponding to the network service function in the network service function library.
[0112] Specifically, the control terminal is also used to receive new network service function codes uploaded by users or external development tools; perform syntax verification, security testing and compatibility verification with the network service function library on the new network service function to obtain a verification result; if the verification result indicates that the verification is passed, register the new network service function to the network service function library and establish a mapping relationship with the corresponding network service function; update the function call list and metadata index in the library interface.
[0113] Step S402: The control terminal constructs a custom protocol header based on the network service instruction sequence and the custom protocol structure and inserts the header into the IP data packet.
[0114] like Figure 2 As shown, in some embodiments of the present invention, the custom protocol structure includes a protocol type, a number of instructions, and an instruction sequence; the instruction sequence includes an instruction type and instruction data.
[0115] The protocol type is used to mark the forwarding protocol type (such as TCP / UDP) recorded in the original type field of the IP packet. This prevents the insertion of a custom protocol header into the IP packet from affecting the parsing of the original IP packet information. The number of instructions is used to record the total number of network service instructions. The instruction type is used to specify the specific operation type of the network service instruction. The instruction data corresponds to the operation parameters of each instruction, such as the target port, priority, and action parameters.
[0116] In the process of generating a custom protocol header, the forwarding type recorded in the original type field of the IP data packet is first tagged with the protocol type in the custom protocol structure. Next, the instruction number, instruction type of each network service instruction, and instruction data are sequentially filled into the corresponding fields to generate the custom protocol header. After being inserted into the IP header, the value of the original protocol field in the IP header is modified to the preset custom protocol type value (for example, 145) to indicate that the packet contains a network service instruction sequence.
[0117] Specifically, a custom protocol header is constructed based on a network service instruction sequence and a custom protocol structure and inserted into an IP data packet, including: marking the forwarding protocol type recorded in the original protocol field in the IP data packet to the protocol type field; filling the instruction quantity, instruction type and instruction data of the network service instruction sequence into the custom protocol structure in sequence to obtain a custom protocol header; and inserting the custom protocol header after the IP header in the IP data packet.
[0118] Step S203: The control terminal marks the type field of the IP data packet as a normal data packet or a tag value containing a custom protocol header.
[0119] Step S204: The control terminal sends the IP data packet to the programmable network device.
[0120] Step S205 : The programmable network device responds to the received IP data packet by parsing and obtaining a tag value of the type field in the IP data packet.
[0121] After receiving the IP data packet sent by the control terminal, the programmable network device determines whether the currently received data packet is an ordinary data packet that needs to be forwarded directly or a data packet containing a custom protocol header based on the tag value of the protocol field in the IP data packet.
[0122] In step S206, when the tag value indicates that the IP data packet contains a custom protocol header, the programmable network device parses the custom protocol header, executes and removes the network service instructions in the instruction sequence in sequence, and updates the instruction number until the value of the instruction number is 0, completing the execution of all network service instructions.
[0123] When the value of the instruction number is 0, the method further includes: marking the forwarding protocol type to the type field; deleting the custom protocol header, and forwarding the IP data packet.
[0124] In some embodiments of the present invention, a programmable network device includes at least one instruction function module.
[0125] Each instruction module is responsible for processing specific network service instructions. For example, the encryption module handles encryption-related instructions, such as encrypting or decrypting data packets; the Quality of Service (QoS) module handles traffic prioritization instructions, such as setting packet priority or bandwidth limits; and the routing module handles routing-related instructions, such as specifying the next hop address or path for a data packet.
[0126] After parsing the instruction type from the custom protocol header, the programmable network device searches for the instruction function module corresponding to that instruction type based on a predefined mapping relationship. The parsed instruction data is then passed to the selected instruction function module, which then performs the corresponding operation. For example, if the instruction type is "encryption," the encryption module is selected for processing; if the instruction type is "QoS," the Quality of Service module is selected for processing.
[0127] Specifically, the network service instructions in the instruction sequence are executed and removed in sequence, including: extracting a network service instruction from the instruction sequence in sequence and removing it from the instruction sequence; the extracted network service instruction includes a corresponding instruction type and instruction data; according to a preset mapping relationship between the extracted instruction type and the instruction function module, querying and determining the corresponding instruction function module as the target instruction function module; and sending the extracted instruction data to the target instruction function module for execution.
[0128] In summary, the online dynamic programming method of the programmable network device provided by the present embodiment calls the corresponding network service function definition to generate the corresponding network service instruction sequence through the control terminal according to the network service function indicated by the user configuration or application requirements; constructs a custom protocol header based on the network service instruction sequence and the custom protocol structure and inserts it into the IP data packet, and marks the type field of the IP data packet as a normal data packet or a tag value containing a network service instruction; the custom protocol structure includes the protocol type, the number of instructions and the instruction sequence; the instruction sequence includes the instruction type and the instruction data; receives the IP data packet sent by the control terminal through the programmable network device; when the type field of the IP data packet marks that the current data packet belongs to a normal data packet, it is directly forwarded; when the type field of the IP data packet marks that the current data packet contains a network service instruction, the custom protocol header is parsed, the network service instruction sequence is executed and removed one by one, and the network service of the programmable network device is dynamically adjusted; it can solve the existing Programmable network technology cannot simultaneously meet the needs of high performance and online programming flexibility. By focusing on the hardware design and implementation of programmable network devices, it is possible to avoid relying on software switches and general servers, thereby ensuring excellent performance of high throughput and low latency, and fully meeting the requirements of high-performance network services. At the same time, the network service function is called through the control terminal to generate the corresponding network service instruction sequence, which is inserted into the IP data packet, and the type field of the IP data packet is modified to mark the data packet. When the tag value in the received data packet indicates that the current data packet includes a custom protocol header, the programmable network device parses and executes the instruction sequence in the custom protocol header in sequence, otherwise the data packet is forwarded directly. In this way, developers only need to write or expand the corresponding network service function on the control terminal side, without modifying the program on the programmable network device, and without stopping the service of the programmable network device, to complete the online update and deployment of the network service function, thereby realizing efficient and dynamic network programming.
[0129] In addition, programmable network devices support a recirculating processing mechanism. After each network service instruction is executed, if the data packet still contains unexecuted instructions, it will be re-entered into the program entry point for the next round of processing. After all instructions are executed, the data packet is forwarded. This mechanism enables the system to support network service instruction sequences of any length, thereby achieving efficient and scalable online dynamic programming capabilities.
[0130] The present application also provides an online dynamic programming system for a programmable network device, comprising a processor, a memory, and a computer program / instruction stored in the memory. The processor is configured to execute the computer program / instruction. When the computer program / instruction is executed, the system implements the online dynamic programming method for a programmable network device of the above-mentioned method embodiment.
[0131] The present application also provides a computer-readable storage medium, in which a program is stored. When the program is executed by a processor, it is used to implement the online dynamic programming method of the programmable network device of the above-mentioned method embodiment.
[0132] It should be understood by those skilled in the art that the various exemplary components, systems and methods described in conjunction with the embodiments disclosed herein can be implemented in hardware, software or a combination of the two. Whether it is specifically performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention. When implemented in hardware, it can be, for example, an electronic circuit, an application specific integrated circuit (ASIC), appropriate firmware, a plug-in, a function card, etc. When implemented in software, the elements of the present invention are programs or code segments that are used to perform the required tasks. The program or code segment can be stored in a machine-readable medium, or transmitted on a transmission medium or a communication link via a data signal carried in a carrier.
[0133] It should be understood that the present invention is not limited to the specific configurations and processes described above and illustrated in the figures. For the sake of brevity, a detailed description of known methods is omitted. In the above embodiments, several specific steps are described and illustrated as examples. However, the method of the present invention is not limited to the specific steps described and illustrated. Those skilled in the art may make various changes, modifications, and additions, or change the order of the steps after understanding the spirit of the present invention.
[0134] In the present invention, features described and / or illustrated for one embodiment may be used in the same or similar manner in one or more other embodiments, and / or combined with or replace features of other embodiments.
[0135] The foregoing description is merely a preferred embodiment of the present invention and is not intended to limit the present invention. Those skilled in the art will readily appreciate that various modifications and variations of the present invention are possible. Any modifications, equivalent substitutions, or improvements made within the spirit and principles of the present invention are intended to be within the scope of protection of the present invention.
Claims
1. An online dynamic programming method for a programmable network device, characterized in that: Used in a control terminal, the method includes: According to the network service function indicated by the user configuration or application requirements, the corresponding network service function definition is called to generate the corresponding network service instruction sequence; A custom protocol header is constructed based on the network service instruction sequence and the custom protocol structure and inserted into the IP data packet; the custom protocol structure includes a protocol type, a number of instructions and an instruction sequence; the instruction sequence includes an instruction type and instruction data; Marking the type field of the IP data packet as a normal data packet or a tag value containing a custom protocol header; The IP data packet is sent to a programmable network device so that the programmable network device directly forwards it when the tag value of the type field indicates that the current data packet is a normal data packet; when the tag value indicates that the current data packet contains the custom protocol header, the programmable network device parses the custom protocol header, executes and removes the network service instruction sequence one by one, and dynamically adjusts the network service of the programmable network device.
2. The online dynamic programming method of a programmable network device according to claim 1, characterized in that: The step of constructing a custom protocol header based on the network service instruction sequence and the custom protocol structure and inserting the header into the IP data packet includes: Marking the forwarding protocol type recorded in the original type field in the IP data packet to the protocol type; Filling the instruction quantity, instruction type and instruction data of the network service instruction sequence into the custom protocol structure in sequence to obtain the custom protocol header; The custom protocol header is inserted after the IP header in the IP data packet.
3. The online dynamic programming method of a programmable network device according to claim 1, characterized in that: The network service function is pre-stored in a preset network service function library; The network service function indicated by the user configuration or application requirements, calling the corresponding network service function definition to generate the corresponding network service instruction sequence, includes: According to the network service function, select and call a corresponding network service function from the network service function library; generating at least one network service instruction based on a function definition of the called network service function; All network service instructions are sorted according to a preset execution order to obtain the network service instruction sequence.
4. The online dynamic programming method of a programmable network device according to claim 3, characterized in that: The network service function library is deployed in the control terminal and interacts with the control terminal through a unified library interface; In the case where calling a function from the network service function library fails, the method further includes: Generate and output prompt information; the prompt information is used to prompt the user to add the network service function corresponding to the network service function in the network service function library; Upon receiving a new network service function code uploaded by a user or an external development tool, performing syntax verification, security testing, and compatibility verification with the network service function library on the new network service function to obtain a verification result; If the verification result indicates that the verification is passed, registering the new network service function to the network service function library and establishing a mapping relationship with the corresponding network service function; The function call list and metadata index in the library interface are updated.
5. An online dynamic programming method for a programmable network device, characterized in that: Used in a programmable network device, the method comprises: In response to a received IP data packet, parsing to obtain a tag value of a type field in the IP data packet; the tag value is used to indicate whether the IP data packet contains a custom protocol header or is a normal data packet; the custom protocol header includes a protocol type, a number of instructions, and an instruction sequence; the protocol type is used to record a forwarding protocol type of the IP data packet; the instruction sequence includes an instruction type and instruction data; When the tag value indicates that the IP data packet contains a custom protocol header, the custom protocol header is parsed, the network service instructions in the instruction sequence are executed and removed in sequence, and the number of instructions is updated until the value of the number of instructions is 0, completing the execution of all network service instructions.
6. The online dynamic programming method of a programmable network device according to claim 5, characterized in that: When the value of the instruction number is 0, the method further includes: Marking the forwarding protocol type to the type field; Delete the custom protocol header and forward the IP data packet.
7. The online dynamic programming method of a programmable network device according to claim 5, characterized in that: The programmable network device includes at least one instruction function module; each instruction function module is responsible for processing a specified type of network service instruction; The sequentially executing and removing the network service instructions in the instruction sequence includes: Extracting a network service instruction from the instruction sequence in sequence and removing it from the instruction sequence; the extracted network service instruction includes a corresponding instruction type and instruction data; According to the preset mapping relationship between the extracted instruction type and the instruction function module, query and determine the corresponding instruction function module as the target instruction function module; The extracted instruction data is sent to the target instruction function module for execution.
8. The online dynamic programming method of a programmable network device according to claim 5, characterized in that: In the case that the tag value indicates that the IP data packet is a common data packet, the method further includes: directly forwarding the IP data packet.
9. An online dynamic programming system for a programmable network device, comprising a processor, a memory, and a computer program / instruction stored in the memory, characterized in that: The processor is configured to execute the computer program / instruction. When the computer program / instruction is executed, the system implements the steps of the online dynamic programming method for a programmable network device according to any one of claims 1 to 8.
10. A computer-readable storage medium, characterized in that The storage medium stores a program, which, when executed by a processor, is used to implement the steps of the online dynamic programming method for a programmable network device according to any one of claims 1 to 8.
Citation Information
Patent Citations
Method and device for encoding and decoding Internet of Things equipment protocol adaptive to micro-service architecture
CN112291235A
Protocol analysis method and system of programmable network and readable storage medium
CN114885047A
Programmable switch supporting domain name resolution and network message processing method
CN115022283A
Network element management method, device and equipment
CN117376428A
Multi-protocol data transmission method and device, network and storage medium
CN117441318A