P4 programming language multi-service scene test method, device, DPU and system
By executing the multi-business scenario testing method of P4 programming language in the system-on-chip SoC of DPU, the physical resource limitation and parallel transplantation problems of P4 programming language when passing data in different platforms are solved, and efficient testing and data transfer are achieved.
Patent Information
- Application Number
- CN202411324026.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-23
- Publication Date
- 2025-02-11
- Estimated Expiration
- 2044-09-23
AI Technical Summary
The P4 programming language is subject to physical resources when passing data in different platforms, and lacks parallel porting methods between different platforms, resulting in each platform that supports the P4 programming language that needs to have its own product architecture model and compiler.
By executing the P4 programming language multi-service scenario testing method in the system-on-chip SoC in the data processor DPU, the assembly files of the P4 programming language description business files for each business scenario are obtained, the target files in plain text format are generated, and the table items are configured. , and finally test each business scenario.
It realizes the parallel porting method of P4 programming language between different platforms, solves the problem of physical resource limitation, and improves the testing efficiency and the reliability of data transmission.
Smart Images

Figure CN119420683A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data processing technology, and in particular to a P4 programming language multi-business scenario testing method, device, DPU and system. Background Art
[0002] P4 (Programming Protocol-Independent Packet Processors) is a protocol-independent packet processing programming language. The P4 programming language supports user-defined matching fields, protocol parsing processes, and forwarding processes, thereby realizing a truly protocol-independent programmable network data plane. As a dedicated programming language, the P4 programming language first defines the processing flow of data packets, and then uses the compiler to generate specific configurations on switches or network cards that are not restricted to specific protocols, thereby realizing the packet processing logic expressed in the P4 programming language. Network devices are not bound to any specific network protocol, and users can use the P4 programming language to describe any network data plane protocol and packet processing behavior. This feature is implemented through custom packet parsers, matching processes of match-action tables, and flow control programs.
[0003] However, the P4 programming language transmits structured data between different systems to define the communication between the control plane and the data plane of network devices. These communications have deficiencies in different programming languages and hardware architectures. The configuration and commands sent by the P4 programming language from the control plane to the data plane, the P4 programming language ultimately controls the data plane forwarding chip with limited resources, so it does not have ultra-high external storage resources like the computing plane where the CPU is located. Therefore, the P4 programming language is subject to physical resource limitations on different platforms, and because it does not have a parallel transplantation method between different platforms, each platform that supports the P4 programming language must have its own product architecture model and compiler, and must select the corresponding physical platform during compilation to implement it.
[0004] Based on this, there is an urgent need to design a solution that can solve the problems of physical resource limitations when the P4 programming language transfers data between different platforms and the lack of parallel transplantation between different platforms. Summary of the invention
[0005] In view of this, the embodiments of the present application provide a P4 programming language multi-business scenario testing method, device, DPU and system to eliminate or improve one or more defects existing in the prior art.
[0006] One aspect of the present application provides a P4 programming language multi-service scenario testing method, the method is executed in a system on chip SoC in a data processor DPU, the method comprising:
[0007] Obtain the assembly files corresponding to the business files described in the P4 programming language for each business scenario;
[0008] Generate a target file in a plain text format corresponding to each of the assembly files, and configure table entries of each of the target files respectively;
[0009] The business scenarios corresponding to the respective target files generated after configuration are tested respectively.
[0010] In some embodiments of the present application, each of the business scenarios includes: a business forwarding scenario based on the VLAN protocol, a business forwarding scenario based on the IPV4 protocol or the IPV6 protocol, a stream forwarding scenario based on the TCP / UDP protocol, an encapsulation and decapsulation scenario based on the VxLAN protocol, an encapsulation and decapsulation scenario based on the GRE protocol, an encapsulation and decapsulation scenario based on the GENEVE protocol, and at least two of the encapsulation and decapsulation scenarios based on the MPLS protocol.
[0011] In some embodiments of the present application, the obtaining of the assembly files corresponding to the P4 programming language description business files of each business scenario includes:
[0012] An assembly file corresponding to each business scenario is received, wherein each assembly file is generated in advance by a P4 compiler on the host side compiling a business file described in a P4 programming language corresponding to each business scenario.
[0013] In some embodiments of the present application, generating a target file in a plain text format corresponding to each of the assembly files includes:
[0014] Based on the local assembler, binary files corresponding to each of the assembly files are generated respectively, and each of the binary files is converted into a target file in a plain text format respectively, wherein the plain text format includes: CSV format.
[0015] In some embodiments of the present application, respectively configuring each of the business scenarios includes:
[0016] Install the driver locally and start the local control plane software;
[0017] Based on the control plane software, configuration information for each of the business scenarios is received respectively and table item configuration is performed respectively according to each of the configuration information, so as to respectively determine the processing method of each of the target files in the network device.
[0018] In some embodiments of the present application, the testing of the business scenarios corresponding to the target files generated according to the configurations respectively includes:
[0019] According to each of the configured target files, the test for each of the business scenarios is performed together with the accompanying test device with which the communication connection has been established.
[0020] In some embodiments of the present application, the control plane software includes: a Stratum control plane and a P4RT controller.
[0021] Another aspect of the present application provides a P4 programming language multi-service scenario testing device, the device is set in a system on chip SoC in a data processor DPU, and the device includes:
[0022] A file acquisition module is used to obtain the assembly files corresponding to the business files described in the P4 programming language for each business scenario;
[0023] A format conversion and configuration module, used to generate a target file in a plain text format corresponding to each of the assembly files, and respectively configure table entries of each of the target files;
[0024] The scenario testing module is used to test the business scenarios corresponding to each of the target files generated after configuration.
[0025] A third aspect of the present application provides a DPU, wherein a P4 programming language multi-service scenario testing device is provided in a system-on-chip SoC of the DPU;
[0026] The P4 programming language multi-business scenario testing device is used to execute the P4 programming language multi-business scenario testing method;
[0027] The P4 programming language multi-service scenario testing device is provided with an assembler, control plane software and the P4 programmable software switch model;
[0028] The assembler is used to generate binary files corresponding to each of the assembly files and convert each of the binary files into a target file in a plain text format;
[0029] The control plane software is used to receive configuration information for each of the business scenarios and perform table item configuration according to each of the configuration information, so as to determine the processing method of each of the target files in the network device.
[0030] A fourth aspect of the present application provides a P4 programming language multi-service scenario testing system, comprising: the DPU, a host and a companion test device respectively connected to the P4 programming language multi-service scenario testing device in the system-on-chip SoC of the DPU, and the companion test device is also connected to the host;
[0031] The host is provided with a P4 compiler, which is used to compile the business files described in the P4 programming language corresponding to each business scenario respectively, so as to generate assembly files corresponding to each business scenario respectively, and copy each of the assembly files, and send the copied assembly files to the P4 programming language multi-business scenario testing device;
[0032] The accompanying test device is used to perform tests for each of the business scenarios together with the P4 programming language multi-business scenario testing device.
[0033] The P4 programming language multi-business scenario testing method provided in the present application is executed in the system-on-chip SoC in the data processor DPU. The method obtains the assembly files corresponding to the P4 programming language description business files of each business scenario; generates target files in plain text format corresponding to each of the assembly files, and configures the table items of each of the target files respectively; tests the corresponding business scenarios respectively according to each of the configured target files, and by implementing the testing of the P4 programming language in multiple business scenarios, it is possible to provide a parallel transplantation method of the P4 programming language between different platforms, which is helpful for the flexible expansion of business under the DPU network card platform; by implementing the P4 programming language multi-business scenario testing based on the DPU, it is possible to solve the problem that the P4 programming language is limited by physical resources in different platforms, thereby effectively improving the efficiency and reliability of the P4 programming language testing and data transmission in different platforms.
[0034] Additional advantages, purposes, and features of the present application will be partially described in the following description, and will become partially apparent to those skilled in the art after studying the following, or may be learned from the practice of the present application. The purposes and other advantages of the present application can be achieved and obtained by the structures specifically pointed out in the specification and the drawings.
[0035] Those skilled in the art will understand that the purposes and advantages that can be achieved by the present application are not limited to the above specific description, and the above and other purposes that can be achieved by the present application will be more clearly understood based on the following detailed description. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] The drawings described herein are used to provide a further understanding of the present application, constitute a part of the present application, and do not constitute a limitation of the present application. The components in the drawings are not drawn to scale, but are only for the purpose of illustrating the principles of the present application. In order to facilitate the illustration and description of some parts of the present application, the corresponding parts in the drawings may be enlarged, that is, they may become larger relative to other components in the exemplary device actually manufactured according to the present application. In the drawings:
[0037] Figure 1This is a first flow chart of a multi-business scenario testing method of the P4 programming language in one embodiment of the present application.
[0038] Figure 2 This is a second flow chart of the P4 programming language multi-business scenario testing method in one embodiment of the present application.
[0039] Figure 3 This is a schematic diagram of the structure of a P4 programming language multi-business scenario testing device in one embodiment of the present application.
[0040] Figure 4 Schematic diagram of the architecture of the DPU in one embodiment of the present application.
[0041] Figure 5 This is a schematic diagram of the structure of a P4 programming language multi-business scenario testing system in one embodiment of the present application.
[0042] Figure 6 This is a schematic diagram of the logical architecture of a P4 programming language multi-business scenario testing process executed by a P4 programming language multi-business scenario testing system in an application example of the present application. DETAILED DESCRIPTION
[0043] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the implementation modes and the accompanying drawings. Here, the illustrative implementation modes and descriptions of the present application are used to explain the present application, but are not intended to limit the present application.
[0044] It should also be noted here that in order to avoid obscuring the present application due to unnecessary details, only the structures and / or processing steps closely related to the scheme according to the present application are shown in the accompanying drawings, while other details that are not very relevant to the present application are omitted.
[0045] It should be emphasized that the term “include / comprises” when used herein refers to the presence of features, elements, steps or components, but does not exclude the presence or addition of one or more other features, elements, steps or components.
[0046] 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.
[0047] Hereinafter, embodiments of the present application 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.
[0048] In one or more embodiments of the present application, DPU (Data Process Unit) refers to a data processing unit; P4 (Programming Protocol-Independent Packet Processors) refers to a packet processing programming language; NP (Networking Processor) refers to a network microprocessor; PPE (Packet Processing Engine) refers to a packet processing engine; DOE (Database Offload Engine) refers to a database offload engine; SOC (System on chip) refers to a DPU system on chip; VLAN (Virtual Local Area Network) refers to a virtual local area network; VXLAN (Visual eXtensible Local Area Network) refers to a virtual extended local area network; GRE (Generic Routing Encapsulation) refers to a generic routing encapsulation; TCP (Transmission Control Protocol) refers to a transmission control protocol; UDP (User Datagram Protocol) refers to a user datagram protocol; GENEVE (Generic Network Virtualization Encapsulation) refers to a network virtualization basic protocol; MPLS (Multi-Protocol Label Switching) refers to multi-protocol label switching.
[0049] In order to solve the problem that the P4 programming language is subject to physical resource limitations when transmitting data in different platforms and there is no parallel transplantation method between different platforms, the embodiments of the present application respectively provide a P4 programming language multi-business scenario testing method, a P4 programming language multi-business scenario testing device for executing the P4 programming language multi-business scenario testing method, a DPU and a P4 programming language multi-business scenario testing system. By implementing the test of the P4 programming language in multiple business scenarios, a parallel transplantation method of the P4 programming language between different platforms can be provided; by implementing the P4 programming language multi-business scenario test based on the DPU, the problem that the P4 programming language is subject to physical resource limitations in different platforms can be solved.
[0050] The details are described in detail through the following examples.
[0051] Based on this, the embodiment of the present application provides a P4 programming language multi-business scenario testing method that can be implemented by a P4 programming language multi-business scenario testing device. The method is executed in a system on chip SoC in a data processor DPU. The P4 programming language multi-business scenario testing device can be a functional module in the SoC. Figure 1 The P4 programming language multi-business scenario testing method specifically includes the following contents:
[0052] Step 100: Obtain the assembly files corresponding to the P4 programming language description business files of each business scenario.
[0053] In step 100, the P4 programming language multi-business scenario testing device obtains the assembly files corresponding to the P4 programming language description business files of each business scenario in the system on chip SoC in the data processor DPU. Among them, the P4 programming language description business files of each business scenario can be received from the outside by the P4 programming language multi-business scenario testing device, or can be generated by the DPU itself and then handed over to the P4 programming language multi-business scenario testing device for processing.
[0054] In one or more embodiments of the present application, a business scenario refers to a protocol, a multi-business scenario refers to at least two protocols, a multi-business scenario test refers to at least one of forwarding, encapsulation and decapsulation for each of the protocols, and a P4 programming language multi-business scenario test refers to testing of each of the business scenarios executed based on relevant format files (such as csv files, etc.) corresponding to the business files described in the P4 programming language of each business scenario.
[0055] It can be understood that the assembly file specifically refers to an assembly program file (Assembly Program File), which is a computer program file. The assembly file in this application refers to an assembly program file written in P4 assembly language, which is used to convert P4 assembly language instructions into machine language instructions so that the DPU can execute them.
[0056] In one or more embodiments of the present application, the business file described in the P4 programming language is a business file described in the P4 programming language.
[0057] In step 100, the P4 programming language multi-business scenario testing device can generate a configuration file for the control plane while compiling the business file described in the P4 language to generate an assembly file of the corresponding hardware architecture in the system on chip SoC in the data processor DPU, so that the tester can send corresponding table item configuration information or instructions to the P4 programming language multi-business scenario testing device based on the configuration file, thereby enabling the P4 programming language multi-business scenario testing device to execute the following step 200 to configure the contents of the table items of each of the target files according to the received table item configuration information or instructions.
[0058] Step 200: Generate a target file in a plain text format corresponding to each of the assembly files, and configure table entries of each of the target files respectively.
[0059] In step 200, the P4 programming language multi-service scenario testing device translates the assembly language into a program of machine target code in the system on chip SoC in the data processor DPU to generate a target file in a plain text format corresponding to each of the assembly files. The P4 programming language multi-service scenario testing device configures the table items of each of the target files according to the received table item configuration information or instructions, so that the tester can define different types of table items, operations, counters, etc., thereby determining the processing method of the target file in the network device.
[0060] Step 300: testing the business scenarios corresponding to the target files generated according to the configuration.
[0061] In step 300, the developer can use the P4 programmable software switch model to develop, test and debug the configured target files according to the corresponding business scenarios. It can be understood that the corresponding business scenarios refer to the target files.
[0062] In one or more embodiments of the present application, the P4 programmable software switch model specifically refers to a virtual model of a P4 programmable software switch, wherein the P4 programmable switch is a new, highly flexible and customizable network device that can realize intelligent management and autonomous control of the network, and can support multiple network protocols and application scenarios.
[0063] In one example, the P4 programmable software switch model can specifically adopt the BM-NP (BMv2 NetworkProcessor, network processing simulator) switching model, which is a P4 behavior model derived from a P4 programmable software switch model implemented by the P4 project. It is only used by developers to develop, test, and debug P4 programs. The BMv2 project not only provides a software switch, but also a framework through which developers can implement their own software switch architecture. On the BMv2 framework, the BM-NP switching model can be developed and adapted based on the hardware architecture and characteristics of the third-generation DPU chip K2-Pro.
[0064] From the above description, it can be seen that the P4 programming language multi-business scenario testing method provided in the embodiment of the present application can provide a parallel transplantation method of the P4 programming language between different platforms by implementing the testing of the P4 programming language in multiple business scenarios, which is conducive to the flexible expansion of business under the DPU network card platform; by implementing the P4 programming language multi-business scenario testing based on DPU, it can solve the problem that the P4 programming language is limited by physical resources in different platforms, thereby effectively improving the efficiency and reliability of P4 programming language testing and data transmission in different platforms.
[0065] In order to further improve the comprehensiveness and wide applicability of the P4 programming language multi-business scenario test, in a P4 programming language multi-business scenario test method provided in an embodiment of the present application, each of the business scenarios specifically includes at least two of the following scenarios:
[0066] (1) Service forwarding scenario based on VLAN protocol;
[0067] (2) Service forwarding scenarios based on the IPV4 or IPV6 protocol;
[0068] (3) Stream forwarding scenario based on TCP / UDP protocol;
[0069] (4) Encapsulation and decapsulation scenarios based on the VxLAN protocol;
[0070] (5) Encapsulation and decapsulation scenarios based on the GRE protocol;
[0071] (6) Encapsulation and decapsulation scenarios based on the GENEVE protocol;
[0072] (7) Encapsulation and decapsulation scenarios based on the MPLS protocol.
[0073] Among them, the service forwarding scenario based on the VLAN protocol corresponds to the Layer 2 L2 switch, the service forwarding scenario based on the IPV4 protocol or the IPV6 protocol corresponds to the Layer 3 L3 switch, the stream forwarding scenario based on the TCP / UDP protocol corresponds to the Layer 4 L4 switch, the encapsulation and decapsulation scenario based on the VxLAN protocol corresponds to the Layer 5 L5 switch, the encapsulation and decapsulation scenario based on the GRE protocol corresponds to the Layer 5 L5 switch, the encapsulation and decapsulation scenario based on the GENEVE protocol corresponds to the Layer 5 L5 switch, and the encapsulation and decapsulation scenario based on the MPLS protocol corresponds to the 2.5-layer L2.5 switch.
[0074] Correspondingly, the tests corresponding to each of the business scenarios specifically include:
[0075] (1) Forwarding test for the forwarding scenario based on the VLAN protocol, which can be abbreviated as: VLAN forwarding test;
[0076] (2) Forwarding test for the service forwarding scenario based on the IPV4 protocol or the IPV6 protocol, which can be abbreviated as: L3 IPV4 / IPV6 forwarding test;
[0077] (3) Stream forwarding test for the stream forwarding scenario based on TCP / UDP protocol, which can be abbreviated as: L4TCP / UDP stream forwarding test;
[0078] (4) Encapsulation and decapsulation test for the encapsulation and decapsulation scenario based on the VxLAN protocol, which can be abbreviated as: VxLAN encapsulation / decapsulation test;
[0079] (5) Encapsulation and decapsulation test for the encapsulation and decapsulation scenario based on the GRE protocol, which can be abbreviated as: GRE encapsulation / decapsulation database control table test;
[0080] (6) Encapsulation and decapsulation test for the encapsulation and decapsulation scenario based on the GENEVE protocol, which can be abbreviated as: GENEVE encapsulation / decapsulation test;
[0081] (7) The encapsulation and decapsulation test for the MPLS protocol-based encapsulation and decapsulation scenario can be abbreviated as: MPLS encapsulation / decapsulation test.
[0082] Based on this, the P4 programming language multi-business scenario testing method provided in the embodiment of the present application can realize the control plane in different application scenarios, allowing the administrator to configure the data plane behavior of the network device, mainly through the seamless connection test of the protocol, application interface, Stratum control plane, and data processing plane. Specifically, the testing methods under different protocols and encapsulation and decapsulation can be solved through testing in application scenarios such as VLAN, IPV4, IPV6, TCP, UDP, VxLAN encapsulation / decapsulation, GRE encapsulation table / GRE decapsulation table, GENEVE encapsulation / GENEVE decapsulation, MPLS encapsulation / MPLS decapsulation.
[0083] In order to further improve the reliability and effectiveness of obtaining the assembly files corresponding to the P4 programming language description business files of each business scenario, in a P4 programming language multi-business scenario testing method provided in an embodiment of the present application, see Figure 2 , step 100 in the P4 programming language multi-business scenario testing method specifically includes the following contents:
[0084] Step 110: receiving assembly files corresponding to respective business scenarios, wherein each of the assembly files is generated in advance by a P4 compiler on the host side by compiling business files corresponding to respective business scenarios described in the P4 programming language.
[0085] Specifically, the P4 compiler can also be called the P4 language compiler, which is used to compile business files described in the P4 language into assembly files corresponding to the hardware architecture, and at the same time generate configuration files for the control plane. Users do not need to worry about the details of the underlying hardware to implement the programming description of how to process data packets.
[0086] In one example, the P4 compiler may use the P4c compiler, which is a compiler for the P4 programming language. Its design goal is to build a modular system that allows developers to add new backends to adapt to different hardware platforms and provides standard front-end and mid-end processing.
[0087] In order to further improve the reliability and effectiveness of generating the target files in plain text format corresponding to each of the assembly files, in a P4 programming language multi-business scenario testing method provided in an embodiment of the present application, see Figure 2 , step 200 in the P4 programming language multi-business scenario testing method specifically includes the following contents:
[0088] Step 210: Generate binary files corresponding to each of the assembly files based on a local assembler, and convert each of the binary files into a target file in a plain text format, wherein the plain text format includes: CSV format.
[0089] Specifically, an assembler is a program that translates assembly language into machine target code. The P4 programming language multi-business scenario testing device generates binary files corresponding to each assembly file based on a local assembler, converts each binary file into a target file in a plain text format, and then updates the corresponding microcode.
[0090] In order to further improve the reliability and effectiveness of configuring each of the business scenarios separately, in a P4 programming language multi-business scenario testing method provided in an embodiment of the present application, see Figure 2 , step 200 in the P4 programming language multi-business scenario testing method further includes the following contents executed after step 210:
[0091] Step 220: Install the driver locally and start the local control plane software.
[0092] Step 230: Based on the control plane software, configuration information for each of the business scenarios is received respectively and table item configuration is performed respectively according to each of the configuration information to respectively determine a processing method for each of the target files in the network device.
[0093] Specifically, the P4 programming language multi-business scenario testing device can locally install the driver specified by the driver installation instruction issued by the tester.
[0094] Among them, control plane software refers to software that allows administrators to configure the data plane behavior of network devices. Through control logic written in the P4 language, administrators can define different types of table entries, operations, counters, etc., thereby determining how data packets are processed in network devices.
[0095] In one example, the control plane software may include: a Stratum control plane and a P4RT (P4Runtime) controller.
[0096] Stratum is a chip-independent control plane platform for software-defined networks that can run on a variety of switch silicon chips and white box switch platforms. P4Runtime is a P4 open source project.
[0097] Considering that the global perspective of network access solves traditional network problems such as network congestion, it only completes the work of the data plane, and the forwarding process also requires the participation of the control plane, which makes the existing technology have deficiencies in solving problems at the control level, and further improves the reliability and effectiveness of the P4 programming language multi-business scenario test. In a P4 programming language multi-business scenario test method provided in an embodiment of the present application, see Figure 2 , step 300 in the P4 programming language multi-business scenario testing method specifically includes the following contents:
[0098] Step 310: executing tests for each of the business scenarios together with the accompanying test device with which the communication connection has been established according to each of the configured target files.
[0099] In one or more embodiments of the present application, the accompanying test device can be written as the Target end, and the P4 programming language multi-business scenario testing device in the SoC implements testing for each of the business scenarios through the accompanying test device that is communicatively connected to itself.
[0100] Specifically, the P4 programming language multi-business scenario test method implements the DPU to solve the data flow forwarding, encapsulation and decapsulation test in business scenarios such as VLAN under L2, IPV4 / IPV6 under L3, TCP / UDP under L4, and VxLAN encapsulation / decapsulation under L5 in the P4 software stack. The details are as follows:
[0101] (1) Define the Layer 2 Ethernet VLAN service forwarding behavior, configure VLAN table entries through the control plane, provide matching table and forwarding action behaviors, and have hardware forwarding processing to improve the Layer 2 VLAN service forwarding test;
[0102] (2) Define the Layer 3 IPV4 / IPV6 service forwarding capability, configure the destination IP address forwarding table through the control plane, specify the table action, and when it matches the table IP Key configured on the control plane, forward the packet to the specified table interface;
[0103] (3) Define the Layer 4 TCP / UDP flow forwarding behavior and Layer 4 TCP / UDP service flow processing, forward the traffic normally through the TCP / UDP five-tuple ID, configure the table entry for TCP / UDP flow five-tuple ID forwarding on the control plane, formulate the action table entry action, forward the traffic from the specified port, and effectively control the forwarding or discarding behavior of the traffic;
[0104] (4) Define the service forwarding behavior of Layer 5 VxLAN, GRE, and GENEVE encapsulation / decapsulation. For Layer 5 VxLAN services, the IPv4 table of the destination IPv4 in the IPv4 header is used to determine whether it is IPV4 forwarding or VxLAN encapsulation / decapsulation. The control plane performs table entries for the IPv4 address, formulates table entry action, specifies the port from which the packet is forwarded, and performs VxLAN encapsulation / decapsulation. When the control plane key matches, the packet is forwarded to the table entry configuration interface, effectively improving the table entry configuration and data forwarding efficiency.
[0105] (5) P4 has 2.5-layer MPLS service encapsulation / decapsulation and forwarding behavior. It configures the forwarding table entries through the control plane, encapsulates / decapsulates the MPLS header, and forwards it from the specified port. When the IPv4 Key is matched, the packet is MPLS encapsulated / decapsulated and sent to the table entry configuration interface.
[0106] Based on the P4 programming language multi-service scenario testing method provided in the above embodiment, the network device is not bound to any specific network protocol, and the user can use the P4 language to describe any network data plane protocol and data packet processing behavior. This feature is implemented through a custom packet parser, a matching process of a match-action table, and a flow control program, as follows:
[0107] (1) P4 Compiler (P4C): It compiles the business file described in P4 language into an assembly file corresponding to the hardware architecture and generates a configuration file for the control plane.
[0108] (2) Assembler: An assembler is a program that translates assembly language into machine object code.
[0109] (3) BM-NP switching model: A P4 programmable software switch model derived from the P4 project. It is only used by developers to develop, test, and debug P4 programs. The BMv2 project not only provides a software switch, but also a framework through which developers can implement their own software switch architecture. On this framework, the BM-NP switching model is developed and adapted based on the K2PRO hardware architecture and features.
[0110] (4) Control plane software (PI & Stratum): The control plane allows administrators to configure the data plane behavior of network devices. Through control logic written in the P4 language, administrators can define different types of table entries, operations, counters, etc., thereby determining how data packets are processed in network devices.
[0111] In short, users can programmatically describe how to process data packets without having to worry about the details of the underlying hardware. This feature is implemented through the P4 front-end and back-end compilers. The front-end compiler converts the P4 high-level language program into an intermediate representation IR, and the back-end compiler compiles the IR into a device configuration to automatically configure the target device.
[0112] In summary, the above embodiments of the present application can solve the problems of being limited by physical resources, deficiencies in porting between different architectures and different platforms, high costs, and limitations in applications on different platforms in the implementation of a platform based on its own hardware architecture.
[0113] The present application also provides a P4 programming language multi-service scenario testing device for executing all or part of the P4 programming language multi-service scenario testing method, wherein the device is arranged in a system on chip SoC in a data processor DPU, see Figure 3 The P4 programming language multi-business scenario testing device specifically includes the following contents:
[0114] The file acquisition module 10 is used to obtain the assembly files corresponding to the business files described in the P4 programming language of each business scenario.
[0115] The format conversion and configuration module 20 is used to generate a target file in a plain text format corresponding to each of the assembly files, and configure the table entries of each of the target files respectively.
[0116] The scenario testing module 30 is used to test the business scenarios corresponding to the target files generated after configuration.
[0117] The embodiment of the P4 programming language multi-business scenario testing device provided in the present application can be specifically used to execute the processing flow of the embodiment of the P4 programming language multi-business scenario testing method in the above-mentioned embodiment. Its functions will not be repeated here, and reference can be made to the detailed description of the above-mentioned P4 programming language multi-business scenario testing method embodiment.
[0118] From the above description, it can be seen that the P4 programming language multi-business scenario testing device provided in the embodiment of the present application can provide a parallel transplantation method of the P4 programming language between different platforms by implementing the testing of the P4 programming language in multiple business scenarios, which is conducive to the flexible expansion of business under the DPU network card platform; by implementing the P4 programming language multi-business scenario testing based on DPU, it can solve the problem that the P4 programming language is limited by physical resources in different platforms, thereby effectively improving the efficiency and reliability of P4 programming language testing and data transmission in different platforms.
[0119] Based on the P4 programming language multi-service scenario testing method and / or P4 programming language multi-service scenario testing device provided in the above embodiments, the present application also provides an embodiment of a DPU, see Figure 4 , a P4 programming language multi-service scenario testing device is provided in the system-on-chip SoC of the DPU, and the P4 programming language multi-service scenario testing device is used to execute the P4 programming language multi-service scenario testing method provided in the aforementioned embodiment;
[0120] The P4 programming language multi-service scenario testing device is provided with an assembler, control plane software and the P4 programmable software switch model;
[0121] The assembler is used to generate binary files corresponding to each of the assembly files and convert each of the binary files into a target file in a plain text format;
[0122] The control plane software is used to receive configuration information for each of the business scenarios and perform table item configuration according to each of the configuration information, so as to determine the processing method of each of the target files in the network device.
[0123] Based on the P4 programming language multi-business scenario testing method and / or P4 programming language multi-business scenario testing device provided in the above embodiments, the present application also provides an embodiment of a P4 programming language multi-business scenario testing system, see Figure 5 The P4 programming language multi-business scenario testing system specifically includes the following contents:
[0124] A DPU, a host and a companion test device respectively connected to the P4 programming language multi-service scenario test device in the system on chip SoC of the DPU, and the companion test device is also connected to the host;
[0125] The system on chip SoC is used to execute the P4 programming language multi-service scenario testing method provided in the above embodiment;
[0126] The host (HOST side) is provided with a P4 compiler, which is used to compile the business files described in the P4 programming language corresponding to each business scenario respectively, so as to generate assembly files corresponding to each business scenario respectively, and copy each of the assembly files, and send the copied assembly files to the P4 programming language multi-business scenario testing device;
[0127] The accompanying test device (Target end) is used to jointly execute the test for each of the business scenarios with the P4 programming language multi-business scenario testing device.
[0128] See also Figure 6 The process of using the P4 programming language multi-business scenario test system to perform the P4 programming language multi-business scenario test specifically includes the following contents:
[0129] S1: The tester (Actor side) logs in to the host (HOST side) through the control terminal and the command line to generate assembly files for L2, L3, L4, and L5 through commands;
[0130] S2: The host will return a message that the assembly file has been successfully generated;
[0131] S3: The tester copies the assembly file generated by the host to the SoC end of the DPU;
[0132] S4: SoC returns a message that the copy is successful;
[0133] S5: Load and copy the generated assembly file on the SoC side and update the microcode;
[0134] S6: After the SoC is loaded successfully, it will return to the loading completion and prompt that the microcode update is completed;
[0135] S7: Load the driver file on the SoC side and start the Stratum and P4TR services;
[0136] S8: Returns that the driver is loaded, Stratum and P4RT services are started successfully;
[0137] S9: The tester logs in to the test device (Target end) through the control terminal and command line, issues a message sending instruction to port 0, and returns a success message to the issued instruction;
[0138] S10: Target port 1 captures the sent message normally.
[0139] This application mainly integrates the programmable language P4 tool chain through the DPU card, and directly connects the DPU MAC interface on the HOST side with the Target device MAC interface on the Target remote side, so as to realize the P4 programmable language in the hardware environment to implement various scenarios (such as: L2 VLAN, L3 IPV4 / V6, L4 TCP / UDP, VxLAN, GRE, GENEVE, MPLS, etc.) and other different business scenarios testing, including but not limited to functional testing, performance and security testing. Specifically, the specific examples of the tests for each of the business scenarios are as follows:
[0140] (1) The test method in the L2 VLAN scenario mainly includes the following steps:
[0141] 1) Use the P4C assembler to compile the file "VLAN Layer 2 forwarding through P4" (L2_vlan.p4) to generate assembly files, such as parser.asm (parser file), ma.asm (match action splitter), and deparser.asm (reverse analyzer) files;
[0142] 2) Generate the corresponding binary file .bin file from the .asm format file through the assembler;
[0143] 3) Convert the file into a .csv format file;
[0144] 4) Install the driver on the SoC side and check whether the installation is successful through commands;
[0145] 5) Start the Stratum and P4RT controllers on the SoC side and configure the table entries;
[0146] 6) Compile the software package and data packet on the Target side and set the data table item Key;
[0147] 7) Use Wireshark (network packet analysis software) to capture the packets from the Target 0 and 1 interfaces respectively;
[0148] 8) Configure the packet sending command, such as "sudo. / xb_ether_tester.exe-i enp1s0-f tcp_74.etc--burst-num=1" (data sending instruction);
[0149] 9) Use Wireshark to capture packets and compare data packets to see if there are any changes between the output packets and the input packets. P4 defines the packet forwarding of VLAN and DMAC (destination mac address).
[0150] (2) Testing method in L3 IPV4 / IPV6 scenario. The main implementation steps are as follows:
[0151] 1) Use the P4C compiler to compile the l3_ipv4.p4 (L3 layer ipv4 protocol type) file to generate assembly files, such as parser.asm, ma.asm, and deparser.asm;
[0152] 2) Use the assembler to assemble the parser.asm, ma.asm, and deparser.asm files to generate the corresponding binary files parser.bin (parser file), ma.bin (divider file), and deparser.bin (deparser file);
[0153] 3) Convert the binary files parser.bin, ma.bin, and deparser.bin into .csv files through the trans.py (python script name) file;
[0154] 4) Install the driver on the SoC side and check whether the installation is successful through commands;
[0155] 5) Start the Stratum and P4RT controllers on the SoC side and configure the table entries;
[0156] 6) Compile the software package on the Target side, compile a data package, and set the data table item Key;
[0157] 7) Use Wireshark to capture the packets from interface 0 and interface 1 of the Target end respectively;
[0158] 8) Configure the packet sending command;
[0159] 9) Compare the packets captured by Wireshark to see if there are any changes between the output and input packets. Because P4 defines IPv4 / IPv6 as packet forwarding and TTL (Time To Live, i.e., the maximum number of network hops) is reduced by 1, it is determined that packets are being sent and received and the TTL is paid attention to.
[0160] (3) Testing method in L4 TCP / UDP scenario. The main implementation steps are as follows:
[0161] 1) Use the P4C compiler to compile the l4_tcp.p4 / l4_udp.p4 (L4 layer TCP protocol / L4 layer UDP protocol) files to generate assembly files parser.asm, ma.asm, and deparser.asm;
[0162] 2) Use the assembler to assemble the parser.asm, ma.asm, and deparser.asm files into corresponding binary files parser.bin, ma.bin, and deparser.bin;
[0163] 3) Convert the binary files parser.bin, ma.bin, and deparser.bin into .csv files through the trans.py file;
[0164] 4) Install the driver on the SoC side and check whether the installation is successful through commands;
[0165] 5) Start the Stratum and P4RT controllers on the SoC side and configure the table entries;
[0166] 6) Compile the software package and data packet on the Target side and set the data table item Key;
[0167] 7) Use Wireshark to capture the packets from interface 0 and interface 1 of the Target end respectively;
[0168] 8) Configure the packet sending command, such as "sudo python3. / packet_send.py enp1s0f0np0 tcp" (interface execution configuration instruction);
[0169] 9) Compare the packets captured by Wireshark to see if there are any changes between the output and input packets. Because P4 defines IPv4 / IPv6 as packet forwarding and TTL is reduced by 1, it is determined that packets are being sent and received and the TTL is paid attention to.
[0170] (4) Encapsulation / decapsulation test method in L5 VxLAN scenario, the main implementation steps are as follows:
[0171] 1) Use the P4C compiler to compile the l5_VxLAN.p4 file to generate assembly files parser.asm, ma.asm, and deparser.asm;
[0172] 2) Use the assembler to assemble the parser.asm, ma.asm, and deparser.asm files into corresponding binary files parser.bin, ma.bin, and deparser.bin;
[0173] 3) Convert the binary files parser.bin, ma.bin, and deparser.bin into .csv files through the trans.py file;
[0174] 4) Install the driver on the SoC side and check whether the installation is successful through commands;
[0175] 5) Start the Stratum and P4RT controllers on the SoC side and configure the table items, such as "sudo stratum_yusur&python3-m p4runtime_sh--grpc-addr 127.0.0.1:9559--device-id 1\--election-id0,1--config l5_vxlan_p4info.txt,null" (the SoC side issues VXLAN configuration instructions);
[0176] 6) Compile the software package and data packet on the Target side and set the data table item Key;
[0177] 7) Use Wireshark to capture the packets from interface 0 and interface 1 of the Target end respectively;
[0178] 8) Compare the packets captured by Wireshark to see if there are any changes between the output and input packets;
[0179] 9) Execute the packet sending command, such as "sudo python3. / packet_send.py enp1s0f0np0 vxlan_encap" (specify the interface to send the sending instruction and send the packet).
[0180] (5) Encapsulation / decapsulation test method in L5 GRE scenario, the main implementation steps are as follows:
[0181] 1) Use the P4C compiler to compile the l5_gre.p4 (compile L5 layer GRE file) file to generate assembly files parser.asm, ma.asm, and deparser.asm;
[0182] 2) Use the assembler to assemble the parser.asm, ma.asm, and deparser.asm files into corresponding binary files parser.bin, ma.bin, and deparser.bin;
[0183] 3) Convert the binary files parser.bin, ma.bin, and deparser.bin into .csv files through the trans.py file;
[0184] 4) Install the driver on the SoC side and check whether the installation is successful through commands;
[0185] 5) Start the Stratum and P4RT controllers on the SoC side and configure the table entries, such as "sudo stratum_yusur&python3-m p4runtime_sh --grpc-addr 127.0.0.1:9559 --device-id 1\--election-id0,1--config l5_gre_p4info.txt,null" (configure table entry instructions on the SoC side);
[0186] 6) Compile the software package and data packet on the Target side and set the data table item Key;
[0187] 7) Use Wireshark to capture the packets from interface 0 and interface 1 of the Target end respectively;
[0188] 8) Compare the packets captured by Wireshark to see if there are any changes between the output and input packets;
[0189] 9) Execute the packet sending command, such as "sudo python3. / packet_send.py enp1s0f0np0 gre_decap" (send the packet to the specified interface through instructions).
[0190] (6) Encapsulation / decapsulation test method in L5 GENEVE scenario, the main implementation steps are as follows:
[0191] 1) Use the P4C compiler to compile the l5_geneve.p4 (compile L5 layer GENEVE file) file to generate assembly files parser.asm, ma.asm, and deparser.asm;
[0192] 2) Use the assembler to assemble the parser.asm, ma.asm, and deparser.asm files into corresponding binary files parser.bin, ma.bin, and deparser.bin;
[0193] 3) Convert the binary files parser.bin, ma.bin, and deparser.bin into .csv files through the trans.py file;
[0194] 4) Install the driver on the SoC side and check whether the installation is successful through commands;
[0195] 5) Start the Stratum and P4RT controllers on the SoC side and configure the table entries;
[0196] 6) Compile the software package and data packet on the Target side and set the data table item Key;
[0197] 7) Use Wireshark to capture the packets from interface 0 and interface 1 of the Target end respectively;
[0198] 8) Compare the packets captured by Wireshark to see if there are any changes between the output and input packets;
[0199] 9) Execute the packet sending command, such as "sudo python3. / packet_send.py enp1s0f0np0 geneve_encap (execute the packet sending instruction and send the packet to the specified interface)".
[0200] (7) Encapsulation / decapsulation test method in L2.5 MPLS scenario, the main implementation steps are as follows:
[0201] 1) Use the P4C compiler to compile the l5_mpls.p4 (compile L5 MPLS file) file to generate assembly files parser.asm, ma.asm, and deparser.asm;
[0202] 2) Use the assembler to assemble the parser.asm, ma.asm, and deparser.asm files into corresponding binary files parser.bin, ma.bin, and deparser.bin;
[0203] 3) Convert the binary files parser.bin, ma.bin, and deparser.bin into .csv files through the trans.py file;
[0204] 4) Install the driver on the SoC side and check whether the installation is successful through commands;
[0205] 5) Start the Stratum and P4RT controllers on the SoC side and configure the table entries;
[0206] 6) Compile the software package and data packet on the Target side and set the data table item Key;
[0207] 7) Use Wireshark to capture the packets from interface 0 and interface 1 of the Target end respectively;
[0208] 8) Compare the packets captured by Wireshark to see if there are any changes between the output and input packets;
[0209] 9) Execute the packet sending command, such as "sudo python3. / packet_send.py enp1s0f0np0 mpls_encap (start packet sending command)".
[0210] In summary, the P4 programming language multi-business scenario testing method provided by the present application is implemented through software and hardware in the DPU network card. P4 is programmable to interact based on the DPU network card hardware platform, and the P4 tool set, assembler and linker are designed. According to the operation of the present application, the control plane and data plane of the programmable tool P4 are flexibly compiled and flexibly configured on different software and hardware platforms based on the DPU network card, and the upper layer application Stratum, the effective conversion of the intermediate remote protocol PI, the BM-NPU bottom layer table management or the NPU table management are realized; the control layer simulates the BM-NPU driver loading of the hardware behavior through Stratum, and uses the PI interface to complete the P4 control layer p4runtime implementation, and can configure the hardware and BM-NPU forwarding flow tables respectively to realize the logical correctness and grammatical accuracy of the P4 business input source test, so that the tool is the Yusur-P4C compiler and the DPU hardware platform verification test, and the DPU network card packet sending and packet capture operations based on the hardware environment are effectively analyzed and verified, and the PI or Stratum control plane component can be used for the sending configuration.
[0211] The assembler outputs the target generation file and error prompts. According to the DPU hardware platform instruction set, the instruction scheduling function and implementation are effectively completed inside the assembler. BMv2 simulates the functional behavior of the hardware in an independent chip hardware environment under the test environment.
[0212] The business flow test of P4 language is carried out on BM-NP; the input of the target file is obtained through the assembler, and the label positioning is realized through the redirection operation, and the file header in the standard ELF format is generated to effectively realize the location analysis of the problem, and CRC check is added to ensure the integrity of the final binary file. An effective check will be performed first to ensure the integrity and uniformity of the file during the transmission or packaging process.
[0213] Flexible configuration and data interaction in any environment improves test efficiency, and implements P4 programmable language testing of various scenarios in software and hardware environments (such as L2 ETH, L2 LVAN, L3 IPV4 / V6, L4 TCP / UDP, VxLAN, L5GRE, GENEVE, L2.5 MPLS, etc.), achieving effective verification of different business scenarios, which helps to flexibly expand the business under the DPU network card platform and improve the rapid and efficient implementation of L2, L3, L4, L5 and other scenarios testing requirements in different scenarios.
[0214] It should be understood by those skilled in the art that the 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 this application. 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 this application are programs or code segments 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.
[0215] It should be clear that the present application is not limited to the specific configuration and processing described above and shown in the figures. For the sake of simplicity, a detailed description of the known method is omitted here. In the above embodiments, several specific steps are described and shown as examples. However, the method process of the present application is not limited to the specific steps described and shown, and those skilled in the art can make various changes, modifications and additions, or change the order between the steps after understanding the spirit of the present application.
[0216] In the present application, features described and / or illustrated for one embodiment may be used in the same manner or in a similar manner in one or more other embodiments, and / or combined with features of other embodiments or replace features of other embodiments.
[0217] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the embodiments of the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A P4 programming language multi-business scenario testing method, characterized in that: The method is executed in a system on chip (SoC) in a data processor (DPU), and the method comprises: Obtain the assembly files corresponding to the business files described in the P4 programming language for each business scenario; Generate a target file in a plain text format corresponding to each of the assembly files, and configure table entries of each of the target files respectively; The business scenarios corresponding to the respective target files generated after configuration are tested respectively.
2. The P4 programming language multi-business scenario testing method according to claim 1, characterized in that: Each of the business scenarios includes: a business forwarding scenario based on the VLAN protocol, a business forwarding scenario based on the IPV4 protocol or the IPV6 protocol, a stream forwarding scenario based on the TCP / UDP protocol, an encapsulation and decapsulation scenario based on the VxLAN protocol, an encapsulation and decapsulation scenario based on the GRE protocol, an encapsulation and decapsulation scenario based on the GENEVE protocol, and at least two of the encapsulation and decapsulation scenarios based on the MPLS protocol.
3. The P4 programming language multi-business scenario testing method according to claim 1, characterized in that: The obtaining of the assembly files corresponding to the P4 programming language description business files of each business scenario includes: An assembly file corresponding to each business scenario is received, wherein each assembly file is generated in advance by a P4 compiler on the host side compiling a business file described in a P4 programming language corresponding to each business scenario.
4. The P4 programming language multi-business scenario testing method according to claim 1, characterized in that: The generating of the target files in plain text format corresponding to the respective assembly files comprises: Based on the local assembler, binary files corresponding to each of the assembly files are generated respectively, and each of the binary files is converted into a target file in a plain text format respectively, wherein the plain text format includes: CSV format.
5. The P4 programming language multi-business scenario testing method according to claim 1, characterized in that: The configuring each of the business scenarios separately includes: Install the driver locally and start the local control plane software; Based on the control plane software, configuration information for each of the business scenarios is received respectively and table item configuration is performed respectively according to each of the configuration information, so as to respectively determine the processing method of each of the target files in the network device.
6. The P4 programming language multi-business scenario testing method according to claim 1, characterized in that: The testing of the business scenarios corresponding to the target files generated according to the configurations respectively includes: According to each of the configured target files, the test for each of the business scenarios is performed together with the accompanying test device with which the communication connection has been established.
7. The P4 programming language multi-business scenario testing method according to claim 5, characterized in that: The control plane software includes: Stratum control plane and P4RT controller.
8. A P4 programming language multi-business scenario testing device, characterized in that: The device is arranged in a system on chip SoC in a data processor DPU, and the device comprises: A file acquisition module is used to obtain the assembly files corresponding to the business files described in the P4 programming language for each business scenario; A format conversion and configuration module, used to generate a target file in a plain text format corresponding to each of the assembly files, and respectively configure table entries of each of the target files; The scenario testing module is used to test the business scenarios corresponding to each of the target files generated after configuration.
9. A DPU, characterized in that: The DPU's system-on-chip SoC is equipped with a P4 programming language multi-business scenario test device; The P4 programming language multi-business scenario testing device is used to execute the P4 programming language multi-business scenario testing method according to any one of claims 1 to 7; The P4 programming language multi-service scenario testing device is provided with an assembler, control plane software and the P4 programmable software switch model; The assembler is used to generate binary files corresponding to each of the assembly files and convert each of the binary files into a target file in a plain text format; The control plane software is used to receive configuration information for each of the business scenarios and perform table item configuration according to each of the configuration information, so as to determine the processing method of each of the target files in the network device.
10. A P4 programming language multi-business scenario testing system, comprising: The DPU according to claim 9, a host and a companion test device respectively connected to the P4 programming language multi-service scenario test device in the system on chip SoC of the DPU, and the companion test device is also connected to the host; The host is provided with a P4 compiler, which is used to compile the business files described in the P4 programming language corresponding to each business scenario respectively, so as to generate assembly files corresponding to each business scenario respectively, and copy each of the assembly files, and send the copied assembly files to the P4 programming language multi-business scenario testing device; The accompanying test device is used to perform tests for each of the business scenarios together with the P4 programming language multi-business scenario testing device.
Citation Information
Patent Citations
P4 programming language-oriented SDN data plane software consistency test system and method
CN110674027A
Extensible test generation method for programmable data plane
CN116302971A
Methods, systems, and computer readable media for configuring a test system using source code of a device being tested
US20200401504A1