[go: up one dir, main page]

CN116974906A - Code verification methods, devices, computer equipment and storage media - Google Patents

Code verification methods, devices, computer equipment and storage media Download PDF

Info

Publication number
CN116974906A
CN116974906A CN202310605411.2A CN202310605411A CN116974906A CN 116974906 A CN116974906 A CN 116974906A CN 202310605411 A CN202310605411 A CN 202310605411A CN 116974906 A CN116974906 A CN 116974906A
Authority
CN
China
Prior art keywords
component
information
configuration
flow table
message
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310605411.2A
Other languages
Chinese (zh)
Inventor
赵春旭
朱萌
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN202310605411.2A priority Critical patent/CN116974906A/en
Publication of CN116974906A publication Critical patent/CN116974906A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3692Test management for test results analysis
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本申请涉及一种代码验证方法、装置、计算机设备、存储介质和计算机程序产品。本申请实施例涉及云技术。所述方法包括:通过待验证组件对接收到的针对流表信息的配置报文进行解析得到第一流表信息;配置报文是对通过全局配置组件配置的全局流表信息进行封装得到的,待验证组件的功能通过待验证的测试代码实现;通过待验证组件基于第一流表信息对接收到的网络报文进行处理得到第一处理结果;通过待验证组件将第一处理结果发送至结果比较组件,以使结果比较组件对第一处理结果和第二处理结果进行比较,得到测试代码对应的验证结果;第二处理结果是基于全局配置组件配置的全局流表信息对网络报文进行处理得到的。采用本方法能够降低代码验证复杂度。

This application relates to a code verification method, device, computer equipment, storage medium and computer program product. The embodiment of this application relates to cloud technology. The method includes: parsing the received configuration message for flow table information through the component to be verified to obtain the first flow table information; the configuration message is obtained by encapsulating the global flow table information configured through the global configuration component, and the configuration message is obtained by parsing the received configuration message for the flow table information. The function of the verification component is implemented through the test code to be verified; the component to be verified processes the received network message based on the first flow table information to obtain the first processing result; the component to be verified sends the first processing result to the result comparison component , so that the result comparison component compares the first processing result and the second processing result to obtain the verification result corresponding to the test code; the second processing result is obtained by processing the network packet based on the global flow table information configured by the global configuration component . Using this method can reduce the complexity of code verification.

Description

Code verification method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technology, and in particular, to a code verification method, apparatus, computer device, storage medium, and computer program product.
Background
With the development of computer technology, digital chips have emerged. In the front-end verification link of chip design, functional verification is required to be carried out on codes which are integrated on the chip, and the correctness of the codes is verified.
Typically, a verification platform formed by combining various components is built, and the function of the code is verified through the verification platform. However, there is a large number of repeated code between the various components in the verification platform, resulting in a high overall complexity of the code verification process.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a code verification method, apparatus, computer device, computer-readable storage medium, and computer program product that can reduce the complexity of code verification.
The application provides a code verification method. The method comprises the following steps:
receiving a configuration message aiming at flow chart information through a component to be verified, and analyzing the configuration message to obtain first flow chart information; the configuration message is obtained by packaging global flow table information configured by a global configuration component, and the function of the component to be verified is realized by a test code to be verified;
Receiving a network message through the component to be verified, and processing the network message based on the first flow table information to obtain a first processing result;
the first processing result is sent to a result comparison component through the component to be verified, so that the result comparison component compares the first processing result with the second processing result to obtain a verification result corresponding to the test code; and the second processing result is obtained by processing the network message based on the global flow table information configured by the global configuration component.
The application also provides a code verification device. The device comprises:
the configuration message analysis module is used for receiving the configuration message aiming at the flow chart information through the component to be verified, and analyzing the configuration message to obtain first flow chart information; the configuration message is obtained by packaging global flow table information configured by a global configuration component, and the function of the component to be verified is realized by a test code to be verified;
the network message processing module is used for receiving the network message through the component to be verified, processing the network message based on the first flow table information and obtaining a first processing result;
The processing result sending module is used for sending the first processing result to the result comparison module through the to-be-verified module so that the result comparison module compares the first processing result with the second processing result to obtain a verification result corresponding to the test code; and the second processing result is obtained by processing the network message based on the global flow table information configured by the global configuration component.
A computer device comprising a memory storing a computer program and a processor implementing the steps of the code verification method described above when the processor executes the computer program.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of the code verification method described above.
A computer program product comprising a computer program which when executed by a processor performs the steps of the code verification method described above.
The code verification method, the code verification device, the computer equipment, the storage medium and the computer program product are used for receiving the configuration message aiming at the flow chart information through the component to be verified, and analyzing the configuration message to obtain first flow chart information; the configuration message is obtained by packaging global flow table information configured by a global configuration component, and the function of the component to be verified is realized by a test code to be verified; receiving a network message through a component to be verified, and processing the network message based on first flow table information to obtain a first processing result; the first processing result is sent to the result comparison component through the component to be verified, so that the result comparison component compares the first processing result with the second processing result to obtain a verification result corresponding to the test code; the second processing result is obtained by processing the network message based on the global flow table information configured by the global configuration component. In this way, globally visible and globally available flow table information is uniformly configured in the global configuration component, other components do not need to independently maintain flow table configuration, the other components only need to use the global flow table information in the global configuration component, codes of the global configuration component and the other components are isolated, the environment architecture is clear, repeated codes are reduced, and the overall complexity is effectively reduced.
Drawings
FIG. 1 is an application environment diagram of a code verification method in one embodiment;
FIG. 2 is a flow diagram of a code verification method in one embodiment;
FIG. 3 is a schematic diagram of an architecture of a verification platform in one embodiment;
FIG. 4 is a schematic diagram of an architecture of a verification platform according to another embodiment;
FIG. 5 is a flow chart of determining a second processing result in one embodiment;
FIG. 6 is a schematic diagram of the architecture of a global configuration component in one embodiment;
FIG. 7 is a schematic diagram of the functionality that may be implemented by a master configuration subcomponent in a global configuration component in one embodiment;
FIG. 8 is a schematic diagram of processing a network message through test code in one embodiment;
FIG. 9 is a schematic diagram of the relationship between global configuration components and other components in one embodiment;
FIG. 10 is a block diagram of a code verification device in one embodiment;
FIG. 11 is a block diagram showing the structure of a code verification apparatus in another embodiment;
FIG. 12 is an internal block diagram of a computer device in one embodiment;
fig. 13 is an internal structural view of a computer device in another embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
Cloud technology (Cloud technology) refers to a hosting technology for integrating hardware, software, network and other series resources in a wide area network or a local area network to realize calculation, storage, processing and sharing of data. Cloud technology (Cloud technology) is based on the general terms of network technology, information technology, integration technology, management platform technology, application technology and the like applied by Cloud computing business models, and can form a resource pool, so that the Cloud computing business model is flexible and convenient as required. Cloud computing technology will become an important support. Background services of technical networking systems require a large amount of computing, storage resources, such as video websites, picture-like websites, and more portals. Along with the high development and application of the internet industry, each article possibly has an own identification mark in the future, the identification mark needs to be transmitted to a background system for logic processing, data with different levels can be processed separately, and various industry data needs strong system rear shield support and can be realized only through cloud computing.
The embodiment of the application relates to cloud technology, for example, test codes to be verified are used for being integrated on a chip applied to a cloud technology scene.
The code verification method provided by the embodiment of the application can be applied to an application environment shown in figure 1. Wherein the terminal 102 communicates with the server 104 via a network. The data storage system may store data that the server 104 needs to process. The data storage system may be integrated on the server 104 or may be located on the cloud or other servers. The terminal 102 may be, but not limited to, various desktop computers, notebook computers, smart phones, tablet computers, internet of things devices, and portable wearable devices, where the internet of things devices may be smart speakers, smart televisions, smart air conditioners, smart vehicle devices, and the like. The portable wearable device may be a smart watch, smart bracelet, headset, or the like. The server 104 may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDNs, basic cloud computing services such as big data and artificial intelligence platforms, and the like. The terminal and the server may be directly or indirectly connected through wired or wireless communication, and the present application is not limited herein.
In particular, a developer may write test code to be verified on the terminal 102. In order to verify the test code, a verification environment comprising a global configuration component, a component to be verified and a result comparison component can be built on the terminal 102, and a verification environment comprising a global configuration component, a component to be verified and a result comparison component can also be built on the server 104.
In the verification environment, the functions of the components to be verified are realized through the test codes to be verified. And receiving a configuration message aiming at the flow table information through the component to be verified, and analyzing the configuration message to obtain first flow table information, wherein the configuration message is obtained by packaging global flow table information configured through the global configuration component. And receiving the network message through the component to be verified, and processing the network message based on the first flow table information to obtain a first processing result. And sending the first processing result to a result comparison component through the component to be verified. And receiving a second processing result by the result comparison component, and comparing the first processing result with the second processing result to obtain a verification result corresponding to the test code, wherein the second processing result is obtained by processing the network message based on the global flow table information configured by the global configuration component.
In one embodiment, as shown in fig. 2, a code verification method is provided, and is applied to a computer device, which may be a terminal or a server, for illustration. It will be appreciated that the method may be performed by the terminal or the server itself, or may be implemented by interaction between the terminal and the server. Referring to fig. 2, the code verification method includes the steps of:
step S202, receiving configuration messages aiming at flow chart information through a component to be verified, and analyzing the configuration messages to obtain first flow chart information; the configuration message is obtained by packaging global flow table information configured by the global configuration component, and the function of the component to be verified is realized by the test code to be verified.
The component to be verified is formed based on the test code to be verified, and the function of the component to be verified is realized through the test code to be verified. For example, the test code to be verified is taken as the component to be verified.
And verifying the correctness of the test code based on the verification platform. The verification platform includes a global configuration component. The global configuration component is used to configure flow table information required to authenticate components on the platform. Network messages passing through the same network for the same period of time and having some common characteristics or attributes are combined into a stream. For example, a collection of network messages that start from the same source IP and access the same destination IP for the same period of time may be considered a single stream. The flow table information is information describing a flow table. The flow table is a set of policy entries for a specific flow, responsible for searching and forwarding data. The flow table records rules for forwarding packets (i.e., network packets). The flow table is composed of at least one flow table item, and each flow table item is a data packet forwarding rule. The flow entry includes matching domain information and corresponding operation domain information, which may also be referred to as action domain information or instruction domain information. The matching field information is used for matching with the data packet, and the matching field information is used for indicating which data packet is matched with the flow table item. For example, the matching domain information includes related information of a link layer, a network layer and a transmission layer related to the matched message; the matching domain information comprises five-tuple information of the matched message; the matching domain information comprises the source IP, the destination IP and the direction of the message of the matched message; etc. The operation domain information is used for processing the data packet, and the operation domain information is used for indicating the next operation to be performed on the data packet matched with the matching domain information. For example, the operation domain in the flow table item comprises two types of information, wherein the first type is used for jumping the matched message to the next flow table item to realize further processing, and corresponding message data can be transferred at the same time; the second is for implementing forwarding of the message.
The flow table information configured by the global configuration component is global flow table information. Other components in the verification platform may use the global flow table information configured by the global configuration component.
In one embodiment, information in the global configuration component may be passed to other components on the verification platform by way of handle passing. In this way, other components can use information in the global configuration component and modify information in the global configuration component, and after one component modifies related information, other components can also use newly modified information for processing later.
The configuration message is a message of configuration data. And packaging the global flow table information configured by the global configuration component to obtain a configuration message. The configuration message is used for transmitting the flow table information to the component to be verified. After receiving the configuration message, the component to be verified can analyze the configuration message so as to obtain the related flow table information.
And the component to be verified analyzes the received configuration message to obtain first flow table information. It will be appreciated that the first flow table information and the global flow table information may be the same or may be different. The analysis of the configuration message is realized through the test code to be verified, and if the test code is abnormal, the first flow table information obtained by analyzing the configuration message and the global flow table information in the global configuration component may be different.
Specifically, in order to verify the correctness of the test code, a verification platform is built to verify the test code. In a global configuration component that belongs to an environment component in the verification platform, global flow table information is configured. And packaging the global flow table information to obtain a configuration message for the flow table information, and sending the configuration message to the component to be verified. The method comprises the steps that a to-be-verified component belonging to a verification object in a verification platform receives a configuration message, analyzes the configuration message to obtain first flow table information, stores the first flow table information, and processes network messages based on the first flow table information by a subsequent to-be-verified component.
In one embodiment, the configuration message may be generated by a global configuration component. And packaging the global flow table information through a global configuration component to obtain a configuration message. The environment components in the verification platform further comprise an excitation component for applying various excitations to the component to be verified to trigger the component to be verified to process the received excitations according to the test code. The method comprises the steps of generating a configuration message through a global configuration component, sending the configuration message to an excitation component, and sending the configuration message to a component to be verified through the excitation component so as to trigger the component to be verified to analyze the configuration message.
In one embodiment, the configuration message may also be generated by the incentive component. The global flow table information is sent to the excitation component through the global configuration component, the global flow table information is packaged through the excitation component to obtain a configuration message, and the configuration message is sent to the component to be verified through the excitation component to trigger the component to be verified to analyze the configuration message.
It will be appreciated that if a configuration message is generated by the excitation component, then the excitation component needs to be configured with the relevant configuration information for generating the configuration message. If the global configuration component generates a configuration message, the incentive component need not configure the relevant configuration information for generating the configuration message. In this way, the global configuration component is used for uniformly managing various configuration information, so that the global configuration component is convenient to integrate to other verification environments for use. It will be appreciated that other test environments have their own stimulus components.
In one embodiment, the global flow table information is obtained by generating flow information through the global configuration component and generating flow table information based on the flow information. Further, to improve verification efficiency, the global configuration component may randomly generate flow information according to a flow information format, and randomly generate flow table information according to a flow table information format based on the flow information.
Step S204, through the component to be verified, the network message is received, and the network message is processed based on the first flow table information, so that a first processing result is obtained.
Wherein, the network message is a message for exchanging and transmitting data in the network.
Specifically, the test code to be verified is used for analyzing the configuration message, processing the network message and forwarding the network message. And receiving the network message, and processing the network message based on the first flow table information to obtain a first processing result. Inquiring a flow table item matched with the network message from the first flow table information, and processing the network message based on the inquired flow table item to obtain a first processing result. It may be appreciated that if no flow table entry matching the network packet is queried in the first flow table information, the preset processing result may be used as the first processing result.
In one embodiment, after the configuration message is parsed to obtain the first flow table information, the first flow table information is written into a preset storage space through the component to be verified, and each flow table item in the first flow table information is written into a corresponding storage unit in the preset storage space. And the component to be verified queries the flow table item matched with the network message from the preset storage space. For example, a storage address may be calculated based on the matching field information in the flow entry, and the flow entry may be written into a storage unit corresponding to the storage address.
In one embodiment, the network messages are valid network messages and invalid network messages, respectively. The valid network message is a network message that is expected to be processable, and the invalid network message is a network message that is not expected to be processable. For example, the valid network message is a network message in which the global configuration component can query the matched flow table entry, and the invalid network message is a network message in which the global configuration component cannot query the corresponding flow table entry.
Step S206, the first processing result is sent to the result comparison component through the component to be verified, so that the result comparison component compares the first processing result with the second processing result to obtain a verification result corresponding to the test code; the second processing result is obtained by processing the network message based on the global flow table information configured by the global configuration component.
Wherein the environment component in the verification platform further comprises a result comparison component. The result comparison component is used for comparing the first processing result output by the component to be verified with the second processing result serving as a reference to verify the correctness of the test code. And processing the network message based on the global flow table information configured by the global configuration component to obtain a second processing result. It can be understood that the first processing result is a processing result output by the component to be verified for the network message. The second processing result is a processing result for the same network message for reference, and the second processing result can be considered as an expected processing result.
Specifically, a result comparison component, which belongs to an environment component in the verification platform, is used to verify whether the first processing result is correct. The to-be-verified component sends the output first processing result to the result comparison component, the result comparison component obtains a second processing result serving as a standard, the result comparison component compares the first processing result with the second processing result, and a verification result corresponding to the test code is determined according to the comparison result. For example, if the first processing result and the second processing result are consistent, the test code is determined to pass verification, and if the first processing result and the second processing result are inconsistent, the test code is determined to not pass verification. For another example, the result comparing component collects respective processing result sets of the plurality of network messages, the processing result set corresponding to the same network message includes a first processing result and a second processing result, and each processing result set is divided into a first category indicating coincidence and a second category indicating non-coincidence according to whether the first processing result and the second processing result in the processing result set are coincidence, if the number ratio of the processing result sets belonging to the first category exceeds a preset proportion, it is determined that the test code passes the verification, otherwise, it is determined that the test code does not pass the verification.
In one embodiment, the environment components in the verification platform further comprise a reference component. The reference component represents a reference model corresponding to the intended function of the component to be verified. The processing result output by the reference component for the network message may be taken as a second processing result. The excitation component can also send the network message sent to the component to be verified to the reference component, the reference component acquires the flow table information matched with the network message from the global flow table information in the global configuration component, and the reference component processes the network message based on the acquired flow table information to obtain a second processing result. It can be understood that if the flow table information matched with the network packet is not queried in the global flow table information, the preset processing result may be used as the second processing result.
In the code verification method, a configuration message aiming at the flow chart information is received through a component to be verified, and the configuration message is analyzed to obtain first flow chart information; the configuration message is obtained by packaging global flow table information configured by a global configuration component, and the function of the component to be verified is realized by a test code to be verified; receiving a network message through a component to be verified, and processing the network message based on first flow table information to obtain a first processing result; the first processing result is sent to the result comparison component through the component to be verified, so that the result comparison component compares the first processing result with the second processing result to obtain a verification result corresponding to the test code; the second processing result is obtained by processing the network message based on the global flow table information configured by the global configuration component. In this way, globally visible and globally available flow table information is uniformly configured in the global configuration component, other components do not need to independently maintain flow table configuration, the other components only need to use the global flow table information in the global configuration component, codes of the global configuration component and the other components are isolated, the environment architecture is clear, repeated codes are reduced, and the overall complexity is effectively reduced.
In one embodiment, the code verification method further comprises:
generating stream information randomly based on preset stream configuration information through a global configuration component to obtain at least one target stream information; and generating target flow table information corresponding to each target flow information respectively based on preset flow table configuration information through a global configuration component, forming the global flow table information by each target flow table information, and packaging the global flow table information to obtain a configuration message.
Wherein the stream information is information describing a stream. The stream configuration information is preset configuration information related to the stream information. The stream configuration information is configuration information required to generate stream information. For example, the stream configuration information includes a stream information format for determining stream elements constituting the stream information. For another example, the stream configuration information may further include a random constraint for determining a range of values of stream elements constituting the stream information. For another example, the flow configuration information may further include a flow number for determining the generation number of flows.
The flow table configuration information is preset configuration information related to the flow table information. The flow table configuration information is configuration information required to generate the flow table information. For example, the flow table configuration information includes a flow table information format for determining a data structure of flow table entries constituting the flow table information, i.e., the flow table information format for determining flow table entry elements constituting the flow table entries. For another example, the flow table configuration information may further include a random constraint for determining a range of values of the flow table entry elements.
Specifically, the configuration message is generated by a global configuration component. The global configuration component generates stream information randomly, then generates stream table information corresponding to the stream information randomly, and packages and encapsulates each generated stream table information to obtain configuration messages.
Firstly, the global configuration component randomly generates stream information based on preset stream configuration information to obtain at least one target stream information. For example, each stream element constituting the stream information is determined based on the stream information format included in the stream configuration information, the value of each stream element constituting the stream information is determined at random, and each stream element determined by the value is combined to obtain the target stream information. For another example, each stream element constituting the stream information is determined based on the stream information format included in the stream configuration information, the value range of each stream element is determined based on the random constraint included in the stream configuration information, the value of each stream element is randomly determined within the value range of each stream element, and each stream element determined by the content is combined to obtain the target stream information. Then, the global configuration component generates target flow table information corresponding to each target flow information based on the preset flow table configuration information. For example, each flow table item composing the flow table information and each flow table item element composing the flow table item are determined based on the flow table information format contained in the flow table configuration information, the value of the flow element matched with the flow table item element is obtained from the target flow information as the value of the corresponding flow table item element for any flow table item, the values of other flow table item elements are randomly generated, each flow table item element composing the flow table item of the content determination is finally combined to obtain the target flow table information corresponding to the target flow information. The global configuration component forms the target flow table information into global flow table information, and encapsulates the global flow table information to obtain configuration messages for the flow table information.
In the above embodiment, the global configuration component is configured with the flow configuration information for generating the flow information and the flow table configuration information for generating the flow table information, and based on these configuration information, the canonical flow information and the flow table information can be quickly generated. The global configuration component generates stream information based on the stream configuration information, generates stream table information corresponding to the stream information based on the stream table configuration information, and finally packages each stream table information to obtain configuration messages, so that basic stream information is generated first, stream table information related to the stream information is regenerated, and finally packages the stream table information to quickly obtain the configuration messages.
In one embodiment, the global configuration component generates stream information randomly based on preset stream configuration information to obtain at least one target stream information, including:
randomly generating at least one initial stream information in a random constraint contained in preset stream configuration information through a global configuration component according to a stream information format contained in the preset stream configuration information; and filtering each piece of initial stream information based on a first stream field preset for the stream information to obtain at least one piece of target stream information.
The preset stream configuration information comprises a stream information format and random constraints. The stream information format is used to determine stream elements that make up the stream information. For example, the flow information format indicates that the flow elements constituting the flow information include elements such as a network message source IP (sip), a network message destination IP (dip), a direction from which the network message comes (dir), a port number, a protocol number, and the like. The random constraint is used for determining a value range corresponding to the stream element.
The preset first stream field is a stream field preset for judging whether different stream information is repeated. The stream field is the stream element.
Specifically, when generating the target stream information through the global configuration component, the stream information is randomly generated, the randomly generated stream information is used as initial stream information, the initial stream information is filtered, and the filtered initial stream information is used as the target stream information.
First, the global configuration component randomly generates at least one initial stream information according to a stream information format contained in the preset stream configuration information within a random constraint contained in the preset stream configuration information. Each stream element composing the stream information is determined based on the stream information format contained in the stream configuration information, the value range of each stream element is determined based on the random constraint contained in the stream configuration information, the value of each stream element is randomly determined in the value range of each stream element, and each stream element determined by the content is combined to obtain the initial stream information. For example, the stream elements constituting the stream information include sip, dip, dir, where sip1 is randomly generated in the value range of sip, dip1 is randomly generated in the value range of dip, dip1 is formed into the initial stream information a, dip2 is randomly generated in the value range of sip, dip2 is randomly generated in the value range of dip, and dip2, dip2 are formed into the initial stream information b. Then, the global configuration component compares the initial stream information based on the first stream field preset for the stream information, takes the initial stream information with the same field value of the first stream field as the same initial stream information, reserves any one initial stream information from the initial stream information with the same field value of the first stream field, filters and deletes the rest initial stream information, and takes the finally reserved initial stream information as target stream information. For example, a network message set starting from the same source IP within the same period of time is regarded as one stream, if the sip of two initial stream information is the same, the two initial stream information indicates the same stream, and any one of the two initial stream information can be deleted. For another example, the stream elements that constitute the stream information include vport (Virtual PORT), vlan (Virtual LAN, virtual local area network), and hash calculation is performed on vport and vlan in the same stream information, if the hash results corresponding to the two initial stream information are the same, any one initial stream information is reserved, and the remaining initial stream information is filtered and deleted.
In the above embodiment, in the random constraint included in the preset stream configuration information, according to the stream information format included in the preset stream configuration information, the initial stream information is randomly generated, so that the accuracy of the stream information generated randomly can be ensured when the stream information is generated randomly. Based on a first stream field preset for stream information, filtering each initial stream information to obtain at least one target stream information, so that errors caused by randomly generating stream information can be avoided, and each finally obtained stream information is ensured to be independent.
In one embodiment, generating, by a global configuration component, target flow table information corresponding to each target flow information based on preset flow table configuration information, forming the global flow table information from each target flow table information, and encapsulating the global flow table information to obtain a configuration message, including:
respectively combining stream table fields of each target stream information based on preset stream table configuration information through a global configuration component to obtain target stream table information corresponding to each target stream information; and forming the global flow table information by the global configuration component, and packaging the global flow table information based on the first message configuration information aiming at the configuration type message to obtain the configuration message.
The combination of the stream table fields refers to generating stream table fields based on stream information, and combining the stream table fields into stream table information. For example, each flow field representing the five-tuple information of the message is obtained from the flow information as a flow table field, other flow table fields are randomly generated, and each flow table field is combined to obtain the flow table information.
The first message configuration information is configuration information aiming at a configuration type message and is used for generating the configuration message. For example, the first message configuration information includes a message format of the configuration message.
Specifically, the global configuration component generates corresponding target flow table information based on the target flow information, and packages and encapsulates each target flow table information into a configuration message.
First, for any target flow information, the global configuration component performs flow table field combination on the target flow information based on preset flow table configuration information to obtain target flow table information corresponding to the target flow information. Specifically, a key flow field can be obtained from the target flow information based on preset flow table configuration information to serve as a part of flow table items, another part of flow table items are generated based on the preset flow table configuration information, and all the flow table items are combined to obtain the target flow table information corresponding to the target flow information. For example, sip, dip, dir is obtained from the target flow information as matching domain information in a flow table, and a preset operation domain information is randomly obtained from the set of preset operation domain information as operation domain information in the flow table, thereby obtaining a flow table. And then, forming the global flow table information by the global configuration component by each target flow table information, and packaging the global flow table information based on the first message configuration information aiming at the configuration type message to obtain the configuration message. For example, a header required for forming a configuration message is generated based on first message configuration information for the configuration type message, global flow table information is used as a message body (payload) required for forming the configuration message, and the header are combined to obtain the configuration message.
In the above embodiment, the target flow table information corresponding to the target flow information is generated based on the target flow information through the preset flow table configuration information, and the global flow table information obtained based on each target flow table information is packaged based on the first message configuration information aiming at the configuration type message, so that the configuration message can be obtained quickly.
In one embodiment, receiving, by a component to be authenticated, a configuration message for flow table information, comprising:
and receiving a configuration message aiming at the flow table information, which is sent by the excitation component through the driving component and is acquired from the global configuration component, through the component to be verified.
Wherein the environmental components in the verification platform further comprise an incentive component. The stimulus component is used for applying various stimulus to the component to be verified so as to trigger the component to be verified to process the received stimulus according to the test code. The environment components in the verification platform also include a drive component. The driving component is used for sending the excitation output by the excitation component to the component to be verified.
Specifically, the excitation component obtains a configuration message aiming at the flow table information from the global configuration component, the configuration message is sent to the driving component, and the driving component forwards the configuration message to the component to be verified.
In the above embodiment, the configuration message is sequentially transmitted to the component to be verified through the global configuration component, the excitation component and the driving component.
In a specific embodiment, the method of the present application may be applied to a UVM (Universal Verification Methodology ) based verification platform. In order to verify the correctness of the design codes of the chip, a verification platform based on UVM is built to verify the design codes.
Referring to fig. 3, in a UVM authentication environment, the authentication platform mainly includes: a driver, a monitor, a DUT, a reference model, and a score board.
The generator is used to generate stimulus data for the DUT. monitor is used to forward data. The DUT represents an RTL (register-transfer level) design component completely conforming to the chip function module, which processes received stimulus data according to a preset function and outputs the processed execution result. The RM represents a reference model corresponding to the expected function of the component to be verified, incentive data are sent to the RM for processing, and the RM sends the obtained expected result data to the Scorboard. The Scoreboard is used to compare the execution results output by the DUT with the execution results output by the RM to determine the verification result.
In the conventional method, the generator needs to contain a configuration for the flow table and the message, and can generate a configuration message according to the configuration information and send the configuration message to the DUT, and can generate a network message according to the configuration information and send the network message to the DUT. The generator sends the configuration message to the driver, which forwards the configuration message to the DUT. Monitor monitors data sent to the DUT by the driver in real time, samples the data and sends the sampled data to the RM. The RM needs to parse the monitor sampled configuration message including the configuration for the message, so as to independently maintain the flow table information in the RM, so as to query after receiving the network message.
The conventional verification environment has high code complexity, and because the RM and the generator need to maintain the flow table information, most of the flow table information is repeated, the code quantity is large, and repeated codes are more. Moreover, configuration delivery is inflexible, flow table information currently exists in generators and RMs, if redundant components are needed, such as splitting the RM into multiple module-level RMs for subsequent environment evolution, where the needed configuration information needs to be delivered between different RMs, possibly requiring multiple channels, each RM taking its own needed configuration.
However, in the method of the present application, a global configuration component (glb_cfg_mdl, global flow table configuration model) is designed. Role of global configuration model: 1. stream information and elements required by various configurations can be generated; 2. composing a configuration issuing format to facilitate subsequent issuing configurations; 3. the RM can directly read the configuration related information; 4. the RM may directly modify the information inside the configuration. In this way, the global configuration component and other component codes are isolated, the environment architecture is clear, repeated codes are reduced, and the overall complexity is reduced. In addition, the configuration transfer is flexible, other components can not only use tasks and functions in the glb_cfg_mdl, but also acquire related configurations, and meanwhile, related information in the glb_cfg_mdl can be modified so as to be convenient for synchronizing for subsequent messages. Furthermore, the global configuration component can be integrated upwards, so that the system simulation can be configured uniformly for the related modules.
Referring to fig. 4, in the UVM verification environment of the present application, the verification platform mainly includes: global configuration component (glb_cfg_mdl), stimulus component (generator), driver component (driver), monitor component (monitor), component to be verified (DUT, design Under test) reference component (RM, reference model), and result comparison component (Scoreboard).
The glb_cfg_mdl component is configured to generate flow information, generate flow table information based on the flow information, and generate a configuration message based on the flow table information. The generator acquires a configuration message from the glb_cfg_mdl component, the configuration message is sent to the DUT through the driver, and the DUT analyzes the configuration message to obtain first flow table information. The generator obtains flow information from the glb_cfg_mdl component and generates network messages based on the flow information. The generator sends the network message to the DUT through the driver, and the DUT processes the network message based on the first flow table information to obtain a first processing result and outputs the first processing result. The DUT outputs the first processing result to the monitor, which forwards the first processing result to the Scoreboard.
In the process that the generator sends the network message to the DUT through the driver, the monitor samples the network message and sends the network message obtained by sampling to the RM. The RM acquires second flow table information matched with the network message from the global configuration component, processes the network message based on the second flow table information to obtain a second processing result, and outputs the second processing result. The RM sends the second processing result to the Scoreboard.
The Scorboard compares the first processing result output by the DUT with the second processing result output by the RM, and can determine whether the function of the component to be verified is realized or not by comparing whether the first processing result and the second processing result are consistent, namely, the verification result of the component to be verified is obtained. If the function of the component to be verified is successfully realized, the verification result of the design code is passed verification.
In one embodiment, receiving, by a component to be authenticated, a network message includes:
acquiring second message configuration information and at least one target stream information aiming at the network type message from the global configuration component through the excitation component, and respectively packaging second stream fields preset in each target stream information based on the second message configuration information to obtain at least one network message; and receiving the network message sent by the excitation component through the component to be verified.
The second message configuration information is configuration information for a network type message and is used for generating the network message. For example, the second message configuration information includes a message format of the network message. The preset second flow field is a preset flow field for generating a network message. The stream field is the stream element.
Specifically, the excitation component acquires the target flow information generated by the global configuration component from the global configuration component, and generates a network message corresponding to the target flow information based on the target flow information. And the excitation component sends the generated network message to the component to be verified. The excitation component can send the network message to the driving component, and the driving component forwards the network message to the component to be verified.
The excitation component obtains second message configuration information for the network type message from the global configuration component and obtains at least one target flow information from the global configuration component. And for any target flow information, the excitation component encapsulates a second flow field preset in the target flow information based on the second message configuration information to obtain at least one network message. The excitation component can acquire a preset second stream field from the target stream information as a part of fields forming the network message, randomly generate another part of fields forming the network message, and combine the fields to obtain the network message. For example, sip, dip, dir and protocol number are obtained from the target flow information as a part of fields forming the network message, other fields forming the network message are randomly generated, and the fields are combined to obtain the network message.
In the above embodiment, the global configuration component is configured with the second message configuration information for generating the network message, and the excitation component can quickly generate the canonical network message corresponding to the target stream information without configuring itself, by acquiring the target stream information and the second message configuration information from the global configuration component.
In one embodiment, based on the second message configuration information, respectively encapsulating second flow fields preset in each target flow information to obtain at least one network message, including:
determining the number of effective messages and the number of ineffective messages aiming at the network type messages based on the message distribution proportion contained in the second message configuration information; based on a network message format contained in the second message configuration information, respectively packaging second stream fields preset in each target stream information to obtain a first message set; the number of messages corresponding to the first message set is the number of effective messages; based on the network message format contained in the second message configuration information, packaging the randomly generated random stream field to obtain a second message set; the random stream field and the second stream field are stream fields with the same field type and different field values, and the number of messages corresponding to the second message set is the number of invalid messages; and respectively taking the messages in the first message set and the second message set as network messages.
The second message configuration information comprises a message distribution proportion, and the message distribution proportion is used for determining the proportion between the effective network message and the ineffective network message. The effective network message is a network message generated based on the current correct flow information, is an effective network message, and can determine a message forwarding strategy corresponding to the effective network message based on the flow table information corresponding to the flow information. The invalid network message is an invalid network message, and a message forwarding strategy corresponding to the invalid network message cannot be determined based on the existing correct flow table information. The number of the effective messages refers to the number of the effective network messages to be generated. The number of invalid messages refers to the number of invalid network messages to be generated.
The second message configuration information further includes a network message format. The network message format is used to determine the composition and structure of the network message.
Specifically, in order to improve the verification accuracy for the component to be verified, an effective network message and an ineffective network message may be generated, and the verification result of the test code is comprehensively determined based on the processing results of the component to be verified for the effective network message and the ineffective network message, respectively.
The excitation component may obtain a message allocation proportion from the second message configuration information, and randomly generate an effective message number and an ineffective message number for the network type message, where a ratio between the effective message number and the ineffective message number is the message allocation proportion. For any target stream information, the excitation component can acquire a network message format from the second message configuration information, and package a second stream field preset in the target stream information based on the network message format to obtain at least one first message. And forming a first message set by each first message corresponding to each target stream information respectively, wherein the number of messages corresponding to the first message set is the effective number of messages. For any target stream information, the excitation component may randomly generate a stream field with the same field type as the second stream field but different field values as a random stream field, and encapsulate the random stream field based on a network message format included in the second message configuration information to obtain at least one second message. And forming a second message set by each second message corresponding to each target stream information respectively, wherein the number of messages corresponding to the second message set is the number of invalid messages. Finally, the excitation component respectively takes the messages in the first message set and the second message set as network messages, and sends the network messages to the component to be verified.
In one embodiment, the stimulating component may send messages in the first set of messages and the second set of messages in a message queue to the component to be authenticated in order.
In the above embodiment, based on the message allocation proportion and the network message format included in the second message configuration information, the effective network message and the ineffective network message with the message formats conforming to the network message formats and the number ratio between the different types of messages conforming to the message allocation proportion are quickly generated. The network comprises an effective network message and an ineffective network message, and the correctness of the test code can be verified from different perspectives.
In one embodiment, as shown in fig. 5, the code verification method further includes:
step S502, through the reference component, the network message forwarded by the monitoring component is received, and the flow identification corresponding to the flow to which the network message belongs is determined; the monitoring component is used for sampling the network message sent to the component to be verified by the excitation component.
Wherein the environment components in the verification platform further comprise a reference component representing a reference model corresponding to the intended function of the component to be verified. The stream identifier is an identifier for uniquely identifying a stream, and may specifically include a character string of at least one of letters, numbers, and symbols.
The environment component in the verification platform further comprises a monitoring component, wherein the monitoring component is used for sampling specific excitation data sent to the component to be verified by the excitation component and sending the excitation data obtained by sampling to the reference component. The monitoring component is mainly used for sampling the network message sent to the component to be verified by the excitation component and sending the network message obtained by sampling to the reference component.
Specifically, the reception of the second processing result by the result comparison component may be output by the reference component. The monitoring component monitors the excitation data sent to the component to be verified by the excitation component in real time, if the excitation data is monitored to be the network message, the monitoring component samples the network message, the sampled network message is sent to the reference component, and the reference component processes the received network message and outputs a second processing result.
It will be appreciated that sampling network messages is equivalent to copying network messages.
In one embodiment, the network message directly carries a flow identifier corresponding to the flow to which the network message belongs. For example, a flow identifier corresponding to a flow to which a network packet belongs may be placed in a reserved field of a reserved field in the network packet.
In one embodiment, the excitation component generates a plurality of network messages, generates a message queue recording flow identifications corresponding to flows to which each network message belongs, and stores the message queue in the global configuration component. And recording the flow identification corresponding to the flow to which the network message belongs according to the sending sequence of the network message in the message queue. The excitation component orderly sends each network message to the component to be verified, and the monitoring component orderly copies each network message and orderly sends each network message to the reference component. The reference component can query the global configuration component for the flow identifier corresponding to the flow to which the network message belongs according to the receiving sequence of the network message. Thus, the message queue maintains the flow identifier corresponding to the flow to which the network message belongs, so that the occupation of the message field in the network message can be avoided, and the data volume of the network message is reduced or the idle message field is reserved for other tasks. And the subsequent message queues can be cleaned in time, so that the occupation of resources of the global configuration component is avoided.
Step S504, through the reference component, based on the flow table reading interface provided by the global configuration component, the flow table information corresponding to the flow identification is read from the global flow table information configured by the global configuration component, and the second flow table information is obtained.
Step S506, the network message is processed based on the second flow table information through the reference component, and a second processing result is obtained.
Step S508, the second processing result is sent to the result comparing component through the reference component.
The global configuration component is provided with a flow table reading interface, and the flow table reading interface is used for other components to read flow table information in the global configuration component.
Specifically, after determining a flow identifier corresponding to a flow to which the network message belongs, the reference component reads flow table information corresponding to the flow identifier from global flow table information configured by the global configuration component through a flow table reading interface provided by the global configuration component, so as to obtain second flow table information. And the reference component inquires flow table information matched with the flow identifier from the global flow table information configured by the global configuration component through the flow table reading interface to obtain second flow table information. After the second flow table information is acquired, the reference component processes the network message based on the second flow table information to obtain a second processing result. The reference component sends the second processing result to the result comparison component so that the result comparison component compares the second processing result with the first processing result sent by the component to be verified.
It can be understood that if the flow table information matching the flow identifier cannot be queried from the global flow table information, the preset processing result may be used as the second processing result.
In the above embodiment, the reference component queries the correct flow table information from the global configuration component to process the network message, and determines the correctness of the actual processing result output by the component to be verified by taking the processing result output by the reference component as the expected processing result.
In one embodiment, processing the network packet based on the first flow table information to obtain a first processing result includes:
acquiring a preset message field from a network message as a key field; inquiring a corresponding flow table item from the first flow table information based on the key field; when a flow table item corresponding to a key field is queried, processing a network message based on a message forwarding strategy contained in the flow table item corresponding to the key field to obtain a first processing result; and when the flow table item corresponding to the key field is not queried, taking the preset processing result as a first processing result.
The preset message can be set according to actual needs. The preset processing result can also be set according to actual needs.
Specifically, when the component to be verified processes the network message, a preset message field is obtained from the network message and used as a key field; and inquiring the corresponding flow table item from the first flow table information based on the key field. For example, a message field related to a message quintuple is obtained from a network message as a key field, and a flow table item matched with the matching field information and the key field is queried from the first flow table information as a corresponding flow table item. It may be understood that the corresponding flow table entry may be queried in the first flow table information, or may not be queried, for example, if the network packet currently processed is an invalid network packet, the corresponding flow table entry may not be queried; if the configuration message is analyzed incorrectly, the corresponding stream table item may not be queried; etc. When the flow table item corresponding to the key field is queried, the component to be verified processes the network message based on the message forwarding strategy contained in the flow table item corresponding to the key field, and a first processing result is obtained. For example, if the operation domain information in the flow table entry is a discard message, the first processing result is a discard network message; if the operation domain information in the flow table item is that the message is forwarded to the port A, the first processing result is that the message is forwarded to the port A; if the operation domain information in the flow table item is to skip the message to the flow table item B for processing, the first processing result may be to skip the network message to the to-be-processed flow table item B for processing, or may acquire the flow table item B for processing the message until the operation domain information belonging to the second class is obtained from the corresponding flow table item, where the second processing result is the operation domain information belonging to the second class finally acquired. When the flow table item corresponding to the key field is not queried, the component to be verified takes the preset processing result as a first processing result. For example, the preset processing result may be that the network message is reported to other layers for processing.
In the above embodiment, the matched flow table entry is queried from the first flow table information based on the key field of the network message, so that the matched flow table entry can be quickly found.
In one embodiment, the component to be verified is configured to write each flow table entry in the first flow table information into different storage units in the preset memory space.
Based on the key field, querying the corresponding flow table item from the first flow table information comprises:
carrying out hash processing on the key field to obtain a hash result; inquiring a storage unit pointed by the hash result from a preset storage space, and taking a stream table item stored on the storage unit pointed by the hash result as a stream table item corresponding to the key field.
The preset memory space refers to a preset memory space. For example, the preset memory space may be a cache memory (cache memory) or a DDR memory (double rate synchronous dynamic random access memory).
Specifically, the component to be verified analyzes the configuration message to obtain first flow table information, the first flow table information is stored in a preset content space, and specifically, each flow table item in the first flow table information is written into different storage units in the preset memory space respectively. The component to be verified can acquire key table information from the stream table to carry out hash processing, and the obtained hash result is associated with the storage address of the storage unit written in by the stream table.
After the network message is received by the to-be-verified component, a preset message field is obtained from the network message and used as a key field, the key field is hashed to obtain a hash result, a storage unit pointed by the hash result is queried from a preset storage space, and the storage unit corresponding to the storage address associated with the hash result can be used as the storage unit pointed by the hash result. And finally, taking the flow table item stored on the storage unit pointed by the hash result as the flow table item corresponding to the key field by the component to be verified. It can be understood that if the storage unit pointed to by the hash result is not queried, the flow table entry corresponding to the key field is not queried.
In the above embodiment, the hash result obtained by performing the hash processing on the key field queries the storage unit pointed by the hash result from the preset storage space, so that the query speed can be improved, and the flow table item corresponding to the key field can be quickly queried.
In one embodiment, the code verification method further comprises:
when the first processing result and the second processing result are consistent, determining that the verification result corresponding to the test code is passing verification by the result comparison component; and when the first processing result and the second processing result are inconsistent, determining that the verification result corresponding to the test code is not verified by the result comparison component.
Specifically, the first processing result is an actual processing result output by the component to be verified, the second processing result is an expected processing result, and the result comparison component compares the first processing result with the second processing result. If the first processing result is consistent with the second processing result, the to-be-verified component can successfully output the expected processing result, the to-be-verified component realizes the corresponding function, and the test code is correct, so that the verification result corresponding to the test code is determined to pass verification. If the first processing result and the second processing result are inconsistent, it is indicated that the expected processing result is not output by the to-be-verified combination, and the test code may be in error, so that it is determined that the verification result corresponding to the test code is not passed.
In the above embodiment, by simply comparing whether the first processing result and the second processing result are consistent, the verification result corresponding to the test code can be quickly determined.
In one embodiment, the second processing result is obtained by processing the network message by the reference component based on the second flow table information obtained from the global configuration component, and the second processing result is sent to the result comparison component by the reference component.
The code verification method further comprises the following steps:
And when the second processing result is a valid processing result, writing the second processing result into second flow table information stored in the global configuration component based on the flow table writing interface provided by the global configuration component through the reference component.
The global configuration component is provided with a flow table writing interface which is used by other components to write information into flow table information in the global configuration component.
Specifically, after the reference component receives the network message, second flow table information matched with the network message is obtained from the global configuration component, and the network message is processed based on the second flow table information to obtain a second processing result. Further, the reference component can write the second processing result into the second flow table information stored in the global configuration component through the flow table writing interface provided by the global configuration component for data statistics or subsequent processing. For example, the second flow table information further includes statistical domain information for data traffic related information, and the second processing result may be used to update the statistical domain information. For example, for a TCP message, the second processing result may include a message state, which may be written to second flow table information stored in the global configuration component for processing of a subsequent TCP message.
In the above embodiment, the reference component may quickly write new information into the flow table information in the global configuration component through the flow table writing interface provided by the global configuration component, so as to perform data statistics or subsequent processing.
In one embodiment, the global configuration component includes a master configuration sub-component and a slave configuration sub-component that serves the master configuration sub-component.
Wherein the main configuration sub-component comprises main code in the test code for implementing the functionality provided by the global configuration component. The secondary configuration sub-component includes auxiliary code in the test code, and the secondary configuration sub-component serves as a primary configuration sub-component for assisting the primary configuration sub-component in implementing the functionality provided by the global configuration component.
The functions implemented by the main configuration sub-component include at least one of generating flow information, generating flow table information, generating configuration messages, generating flow table read-write interfaces. For example, in the global configuration component, the main configuration sub-component generates flow information, generates flow table information based on the flow information, generates configuration messages based on the flow table information, and generates flow table read-write interfaces for other components to use.
The slave configuration sub-components include a macro definition sub-component, a random configuration sub-component, a base template sub-component, and an adaptation sub-component.
The macro definition sub-component is used to define the calling code required by the main configuration sub-component in generating the data. For example, the macro definition sub-component is used for defining common codes required by the main configuration sub-component when generating data, and the common codes use macro definition to save the code quantity of the main configuration sub-component and avoid the error of writing the common codes for many times in the main configuration sub-component.
The random configuration subcomponent is used to configure the random range required by the main configuration component in randomly generating data. For example, the random configuration subcomponent is used to define random constraints in the flow configuration information, and the random configuration subcomponent is used to define random constraints in the flow table configuration information.
The base template subcomponent is used to define the calling tasks required by the main configuration subcomponent in generating data. For example, the basic template sub-component is used for defining common tasks or common functions required by the main configuration sub-component when generating data, and the common tasks or common functions use the basic template to save the code quantity of the main configuration sub-component and avoid the error of writing common codes for many times in the main configuration sub-component.
The adaptation sub-component is used for adapting the transmitted data among the components when the data generated by the main configuration component is transmitted to other components. For example, the auxiliary excitation component carries in the network message a flow identifier corresponding to a flow to which the network message belongs; after the excitation component generates the effective network message, the excitation component is assisted to modify the effective network message to quickly obtain the ineffective network message.
In one embodiment, referring to FIG. 6, the glb_cfg_mdl component (i.e., global configuration component) refers to a glb_cfg_def file (i.e., macro definition subcomponent), a glb_cfg_rand file (i.e., random configuration subcomponent), a glb_cfg_base file (i.e., base template subcomponent), a glb_cfg_mdl file (i.e., main configuration subcomponent), a glb_cfg_adapter file (i.e., adapter subcomponent).
The glb_cfg_def file mainly comprises macro definitions commonly used in components, such as printing formats commonly used by the glb_cfg_def file, weight randomness, table item data structures and the like, and is mainly used for saving code quantity by using macro definitions for commonly used codes, and avoiding mistakes of writing for many times.
The glb_cfg_rand file is mainly provided with information such as random configuration, stream information, signals of various required table items, random constraint, aggregate printing of all configuration and the like. The files of the random configuration and the files of the main code are decoupled, so that the structure is clear and the maintenance is convenient.
The glb_cfg_base file is a basic template and mainly comprises common tasks or functions, such as hash calculation and the like, which do not relate to the details of the flow table.
The glb_cfg_mdl file is a main code, inherited from the glb_cfg_base, and is mainly used globally later, and relates to information of streams, configuration structures of various stream tables and the like.
The glb_cfg_adapter file is used for modifying and adapting message part information when the flow information in the glb_cfg_mdl component is transmitted to the incentive.
Referring to fig. 7, the glb_cfg_mdl file may implement a stream information generation function, an entry information combination function, an entry initialization function, an entry read/write function, and other auxiliary functions. Aiming at the stream information generating function, mainly stream information such as sip, dip and the like and main information used in the table entry are generated, and because some coupling exists among partial signals, the information generated by random constraint of the glb_cfg_rand file is firstly adapted, and the stream information is finally generated in the functional module. For the function of combining the table information, for example, the new table is needed to be built, the format of the new table is formed by combining the flow information so as to be conveniently transmitted to the excitation side, and the new table is well transmitted to the DUT, and meanwhile, the content of the new table is written into the environment for internal storage. For the table item initializing function, in order to facilitate the initializing operation of each table item, general information is packaged into tasks, and the tasks are matched with other environment components to perform the initializing operation of the DUT flow table, namely, the flow table information is packaged into configuration messages so as to be conveniently transmitted to an excitation side, and the configuration messages are well issued to the DUT. Aiming at the reading and writing function of the table entry, the interface for writing and reading the table entry is convenient for writing and reading operations of other components of the environment to the table entry. For other auxiliary functions such as end checking of the environment, etc. For example, after verification is completed, the queues stored in the global configuration component are cleared; after verification is completed, the stream information and stream table information which are randomly generated in the global configuration component are cleared.
In one embodiment, the test code is code that implements virtual interactive machine hardware offload functions, and the validated test code is used to generate a chip that is placed on a cloud server.
Specifically, the test code is code that implements virtual interactive machine hardware offload functions. The virtual interactive machine refers to a virtualized interactive machine, and the switch obtains forwarding rules for forwarding the data packet by querying the flow table. The software system of the switch comprises a software layer and a hardware layer, and the test code is used for realizing network message forwarding through the hardware layer. After receiving a network message, the switch searches the flow table item matched with the network message in the flow table of the hardware layer, if the flow table item matched with the network message is not found in the flow table of the hardware layer, then searches the flow table item in the flow table of the software layer, if the flow table matched with the flow table item is not found in the flow table of the software layer, the network message is reported to the controller, the controller generates the flow table item matched with the network message, and the network message and the flow table item (the issued flow table item can be all the flow table items matched with the network message or all the flow table items which are not issued from all the flow table items matched with the network message) are issued to the switch. After receiving the flow table items issued by the controller, the switch firstly stores the flow table items into a flow table of a software layer, then searches all flow table items matched with the network message in the flow table of the software layer, finally aggregates all the matched flow table items into a flow table item of a hardware layer, and stores the flow table item of the hardware layer into the flow table of the hardware layer. After the exchanger receives the network message, it can search the matched flow list item in the flow list of the hardware layer, and transmit the network message according to the network message transmitting rule of the matched flow list item.
And verifying the test code based on the verification platform, if the test code passes the verification, the test code can be used for generating a chip with the virtual interactive machine hardware unloading function, and the chip can be finally placed on a cloud server to realize the virtual interactive machine hardware unloading function on the cloud server. It can be understood that the test code can be a code used for realizing the hardware uninstallation function of the virtual interactive machine in a chip, and the code with other functions can be integrated in the chip.
In one embodiment, when implementing the virtual interactive machine hardware offloading function through the test code, the N-tuple (e.g., the triplet or the quintuple) of the received network packet may be extracted, and the extracted packet information is used as a key information key, so that the flow table is searched according to the key, and the corresponding operation is performed according to the searched flow table information, for example, the searched flow table information may be used for performing a subsequent operation, or the searched flow table information may be changed.
For example, referring to fig. 8, if a network packet is received, the network packet is parsed by the test code, sip, dip, dir in the network packet is extracted as a target key, the target key is subjected to hash calculation (hash calculation) and then the relevant address is queried by the DDR, and the DDR returns to acquire the stored information from the relevant address as a query result. The query result comprises relevant flow table information for forwarding the network message, the relevant flow table information comprises a reference key for referring the network message, the reference key is compared with a target key, if the reference key is the same with the target key, the message is forwarded through the relevant flow table information, and part of the processed information is rewritten back to the DDR. If the key information is different in comparison, the message is sent to an SOC (System on Chip) to be processed by software, the software can issue flow table configuration according to the message information, the issued message is finally written into the DDR through a test code, the message with the same key is subsequently sent, and the test code can unload and forward the message by hardware.
In a specific embodiment, the method of the present application may be applied to verifying TVS codes based on a UVM verification platform. TVS code is code that implements hardware offloading of Virtual switches.
The verification platform constructed by the method mainly comprises the following steps: global configuration component (glb_cfg_mdl), stimulus component (generator), driver component (driver), monitor component (monitor), component to be verified (DUT, design Under test) reference component (RM, reference model), and result comparison component (Scoreboard).
Referring to fig. 9, the glb_cfg_mdl component only has new () in the verification environment, and then the information in the glb_cfg_mdl component can be transferred to other components by means of handle transfer, so that other components can use the information in the glb_cfg_mdl component, modify the information in the glb_cfg_mdl component, and after one component modifies the related information, the other components can also use the newly modified information for processing. By handle transfer of the glb_cfg_mdl component, the generator and the RM, and even other components can use the information in the glb_cfg_mdl component at any time, so that all information required to be associated by the RM and the generator is given to the glb_cfg_mdl component for unified processing, and the signal adaptation with the generator and the RM is finished. Meanwhile, the glb_cfg_mdl component can be integrated upwards, so that the System-level test Simulation (ST) is convenient to use under the condition of TVS module allocation.
The flow table of the TVS needs to be configured and issued in the verification platform, meanwhile, the flow table needs to be queried in the verification environment, and corresponding flow table information can be obtained after the query so as to facilitate the environment to carry out RM (resource management) implementation and other operations, so that a globally visible flow table model (namely a glb_cfg_mdl component) is used in the verification platform, flexible flow table configuration can be carried out, and meanwhile, the flow table model can also be used as a model for storing the flow table. The global flow table model can not only realize the requirement of verification environment, but also reduce configuration transfer, and can greatly reduce the complexity of an environment framework.
Because of the characteristics of the cooperative work of the software and hardware of the TVS module, a large number of operations such as item configuration, modification and deletion are required, the verification platform constructed by the method provided by the application more flexibly simulates the software behavior, greatly simplifies the environment configuration flow, reduces the error probability, and simultaneously integrates the glb_cfg_mdl component of the verification platform into the verification environment of the TCM subsystem (the subsystem comprises the TVS module and other modules) of the Xuanling chip to perform the relevant configuration of the TVS function.
Compared with the prior art, the method has the advantages that the code quantity is reduced by nearly 1/3, the method can be independently maintained, and the work is easy to decouple when a plurality of persons cooperate. The method of the application gives the complex information interaction to the independent environment components, so that the verifier can better organize the configuration and function verification of the flow table items, simplify the flow, ensure clear information transmission between environments and reduce the workload.
It should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a code verification device for realizing the above related code verification method. The implementation of the solution provided by the device is similar to the implementation described in the above method, so the specific limitation in one or more embodiments of the code verification device provided below may refer to the limitation of the code verification method hereinabove, and will not be repeated here.
In one embodiment, as shown in fig. 10, there is provided a code verification apparatus including: a configuration message parsing module 1002, a network message processing module 1004, and a processing result sending module 1006, where:
a configuration message parsing module 1002, configured to receive, through the component to be verified, a configuration message for the flow table information, parse the configuration message, and obtain first flow table information; the configuration message is obtained by packaging global flow table information configured by the global configuration component, and the function of the component to be verified is realized by the test code to be verified.
The network message processing module 1004 is configured to receive, through the component to be verified, a network message, and process the network message based on the first flow table information to obtain a first processing result.
The processing result sending module 1006 is configured to send, through the component to be verified, the first processing result to the result comparing component, so that the result comparing component compares the first processing result with the second processing result, and obtains a verification result corresponding to the test code; the second processing result is obtained by processing the network message based on the global flow table information configured by the global configuration component.
In one embodiment, as shown in fig. 11, the code verification apparatus further includes:
The information configuration module 1102 is configured to randomly generate stream information based on preset stream configuration information through the global configuration component, so as to obtain at least one target stream information; and generating target flow table information corresponding to each target flow information respectively based on preset flow table configuration information through a global configuration component, forming the global flow table information by each target flow table information, and packaging the global flow table information to obtain a configuration message.
In one embodiment, the information configuration module 1102 is further configured to:
randomly generating at least one initial stream information in a random constraint contained in preset stream configuration information through a global configuration component according to a stream information format contained in the preset stream configuration information; and filtering each piece of initial stream information based on a first stream field preset for the stream information to obtain at least one piece of target stream information.
In one embodiment, the information configuration module 1102 is further configured to:
respectively combining stream table fields of each target stream information based on preset stream table configuration information through a global configuration component to obtain target stream table information corresponding to each target stream information; and forming the global flow table information by the global configuration component, and packaging the global flow table information based on the first message configuration information aiming at the configuration type message to obtain the configuration message.
In one embodiment, the configuration message parsing module 1002 is further configured to:
and receiving a configuration message aiming at the flow table information, which is sent by the excitation component through the driving component and is acquired from the global configuration component, through the component to be verified.
In one embodiment, the network message processing module 1004 is further configured to:
acquiring second message configuration information and at least one target stream information aiming at the network type message from the global configuration component through the excitation component, and respectively packaging second stream fields preset in each target stream information based on the second message configuration information to obtain at least one network message; and receiving the network message sent by the excitation component through the component to be verified.
In one embodiment, the network message processing module 1004 is further configured to:
determining the number of effective messages and the number of ineffective messages aiming at the network type messages based on the message distribution proportion contained in the second message configuration information; based on a network message format contained in the second message configuration information, respectively packaging second stream fields preset in each target stream information to obtain a first message set; the number of messages corresponding to the first message set is the number of effective messages; based on the network message format contained in the second message configuration information, packaging the randomly generated random stream field to obtain a second message set; the random stream field and the second stream field are stream fields with the same field type and different field values, and the number of messages corresponding to the second message set is the number of invalid messages; and respectively taking the messages in the first message set and the second message set as network messages.
In one embodiment, the network message processing module 1004 is further configured to:
receiving the network message forwarded by the monitoring component through the reference component, and determining a flow identifier corresponding to a flow to which the network message belongs; the monitoring component is used for sampling the network message sent to the component to be verified by the excitation component; reading flow table information corresponding to the flow identifier from the global flow table information configured by the global configuration component based on the flow table reading interface provided by the global configuration component through the reference component to obtain second flow table information; processing the network message based on the second flow table information through the reference component to obtain a second processing result; and sending the second processing result to the result comparison component through the reference component.
In one embodiment, the network message processing module 1004 is further configured to:
acquiring a preset message field from a network message as a key field; inquiring a corresponding flow table item from the first flow table information based on the key field; when a flow table item corresponding to a key field is queried, processing a network message based on a message forwarding strategy contained in the flow table item corresponding to the key field to obtain a first processing result; and when the flow table item corresponding to the key field is not queried, taking the preset processing result as a first processing result.
In one embodiment, the component to be verified is configured to write each flow table entry in the first flow table information into a different storage unit in the preset storage space. The network message processing module 1004 is further configured to:
carrying out hash processing on the key field to obtain a hash result; inquiring a storage unit pointed by the hash result from a preset storage space, and taking a stream table item stored on the storage unit pointed by the hash result as a stream table item corresponding to the key field.
In one embodiment, the processing result sending module 1006 is further configured to:
when the first processing result and the second processing result are consistent, determining that the verification result corresponding to the test code is passing verification by the result comparison component; and when the first processing result and the second processing result are inconsistent, determining that the verification result corresponding to the test code is not verified by the result comparison component.
In one embodiment, the second processing result is obtained by processing the network message by the reference component based on the second flow table information obtained from the global configuration component, and the second processing result is sent to the result comparison component by the reference component. The processing result sending module 1006 is further configured to:
the second processing result is written into second flow table information stored in the global configuration component based on the flow table writing interface provided by the global configuration component by the reference component.
In one embodiment, the global configuration component includes a master configuration sub-component and a slave configuration sub-component serving the master configuration sub-component, the slave configuration sub-component including a macro definition sub-component, a random configuration sub-component, a base template sub-component, and an adaptation sub-component.
The functions realized by the main configuration sub-component comprise at least one of generating stream information, generating stream table information, generating configuration messages and generating stream table read-write interfaces; the macro definition sub-component is used for defining calling codes required by the main configuration sub-component when generating data; the random configuration sub-component is used for configuring a random range required by the main configuration component when randomly generating data; the basic module sub-component is used for defining a calling task required by the main configuration sub-component when generating data; the adaptation sub-component is used for adapting the transmitted data among the components when the data generated by the main configuration component is transmitted to other components.
In one embodiment, the test code is code that implements virtual interactive machine hardware offload functions, and the validated test code is used to generate a chip that is placed on a cloud server.
According to the code verification device, globally visible and globally available flow table information is uniformly configured in the global configuration component, other components do not need to independently maintain flow table configuration, the other components only need to use the global flow table information in the global configuration component, codes of the global configuration component and the other components are isolated, the environment architecture is clear, repeated codes are reduced, and the overall complexity is effectively reduced.
The respective modules in the above-described code verification apparatus may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, and the internal structure of which may be as shown in fig. 12. The computer device includes a processor, a memory, an Input/Output interface (I/O) and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used to store the various components. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a code verification method.
In one embodiment, a computer device is provided, which may be a terminal, and the internal structure thereof may be as shown in fig. 13. The computer device includes a processor, a memory, an input/output interface, a communication interface, a display unit, and an input means. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface, the display unit and the input device are connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless mode can be realized through WIFI, a mobile cellular network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a code verification method. The display unit of the computer equipment is used for forming a visual picture, and can be a display screen, a projection device or a virtual reality imaging device, wherein the display screen can be a liquid crystal display screen or an electronic ink display screen, the input device of the computer equipment can be a touch layer covered on the display screen, can also be a key, a track ball or a touch pad arranged on a shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by persons skilled in the art that the structures shown in fig. 12 and 13 are merely block diagrams of portions of structures associated with aspects of the present application and are not intended to limit the computer apparatus to which aspects of the present application may be applied, and that a particular computer apparatus may include more or less components than those shown, or may combine some of the components, or have a different arrangement of components.
In an embodiment, there is also provided a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps of the method embodiments described above when the computer program is executed.
In one embodiment, a computer-readable storage medium is provided, storing a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
In an embodiment, a computer program product is provided, comprising a computer program which, when executed by a processor, implements the steps of the method embodiments described above.
It should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data need to comply with the related laws and regulations and standards of the related country and region.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.

Claims (18)

1.一种代码验证方法,其特征在于,所述方法包括:1. A code verification method, characterized in that the method includes: 通过待验证组件,接收针对流表信息的配置报文,对所述配置报文进行解析,得到第一流表信息;所述配置报文是对通过全局配置组件配置的全局流表信息进行封装得到的,所述待验证组件的功能通过待验证的测试代码实现;Through the component to be verified, a configuration message for flow table information is received, and the configuration message is parsed to obtain the first flow table information; the configuration message is obtained by encapsulating the global flow table information configured through the global configuration component. , the function of the component to be verified is implemented through the test code to be verified; 通过所述待验证组件,接收网络报文,基于所述第一流表信息对所述网络报文进行处理,得到第一处理结果;Receive network messages through the component to be verified, process the network messages based on the first flow table information, and obtain a first processing result; 通过所述待验证组件,将所述第一处理结果发送至结果比较组件,以使所述结果比较组件对所述第一处理结果和第二处理结果进行比较,得到所述测试代码对应的验证结果;所述第二处理结果是基于所述全局配置组件配置的全局流表信息对所述网络报文进行处理得到的。Through the component to be verified, the first processing result is sent to the result comparison component, so that the result comparison component compares the first processing result and the second processing result to obtain the verification corresponding to the test code Result: The second processing result is obtained by processing the network packet based on the global flow table information configured by the global configuration component. 2.根据权利要求1所述的方法,其特征在于,所述方法还包括:2. The method according to claim 1, characterized in that, the method further comprises: 通过所述全局配置组件,基于预设的流配置信息随机生成流信息,得到至少一个目标流信息;Through the global configuration component, flow information is randomly generated based on preset flow configuration information to obtain at least one target flow information; 通过所述全局配置组件,基于预设的流表配置信息生成各个目标流信息分别对应的目标流表信息,将各个目标流表信息组成全局流表信息,封装所述全局流表信息得到所述配置报文。Through the global configuration component, target flow table information corresponding to each target flow information is generated based on the preset flow table configuration information, each target flow table information is composed of global flow table information, and the global flow table information is encapsulated to obtain the above Configuration packet. 3.根据权利要求2所述的方法,其特征在于,所述通过所述全局配置组件,基于预设的流配置信息随机生成流信息,得到至少一个目标流信息,包括:3. The method of claim 2, wherein the global configuration component randomly generates flow information based on preset flow configuration information to obtain at least one target flow information, including: 通过所述全局配置组件,在预设的流配置信息包含的随机约束内,按照所述预设的流配置信息包含的流信息格式,随机生成至少一个初始流信息;Through the global configuration component, within the random constraints contained in the preset flow configuration information, at least one initial flow information is randomly generated according to the flow information format included in the preset flow configuration information; 基于针对流信息预设的第一流字段,对各个初始流信息进行过滤处理,得到至少一个目标流信息。Based on the first flow field preset for the flow information, each initial flow information is filtered to obtain at least one target flow information. 4.根据权利要求2所述的方法,其特征在于,所述通过所述全局配置组件,基于预设的流表配置信息生成各个目标流信息分别对应的目标流表信息,将各个目标流表信息组成全局流表信息,封装所述全局流表信息得到所述配置报文,包括:4. The method according to claim 2, characterized in that, through the global configuration component, target flow table information corresponding to each target flow information is generated based on the preset flow table configuration information, and each target flow table is The information constitutes global flow table information, and the global flow table information is encapsulated to obtain the configuration message, including: 通过所述全局配置组件,基于预设的流表配置信息,分别对各个目标流信息进行流表字段组合,得到所述各个目标流信息分别对应的目标流表信息;Through the global configuration component, based on the preset flow table configuration information, flow table fields are combined for each target flow information to obtain target flow table information corresponding to each target flow information; 通过所述全局配置组件,将各个目标流表信息组成全局流表信息,基于针对配置类型报文的第一报文配置信息,对所述全局流表信息进行封装,得到所述配置报文。Through the global configuration component, each target flow table information is composed of global flow table information, and based on the first packet configuration information for the configuration type packet, the global flow table information is encapsulated to obtain the configuration packet. 5.根据权利要求1所述的方法,其特征在于,所述通过待验证组件,接收针对流表信息的配置报文,包括:5. The method according to claim 1, characterized in that receiving a configuration message for flow table information through the component to be verified includes: 通过待验证组件,接收激励组件通过驱动组件发送过来的、从所述全局配置组件中获取到的针对流表信息的配置报文。Through the component to be verified, the configuration message for the flow table information obtained from the global configuration component and sent by the excitation component through the driver component is received. 6.根据权利要求1所述的方法,其特征在于,所述通过所述待验证组件,接收网络报文,包括:6. The method according to claim 1, characterized in that, receiving network messages through the component to be verified includes: 通过激励组件,从所述全局配置组件中获取针对网络类型报文的第二报文配置信息和至少一个目标流信息,基于所述第二报文配置信息,分别对各个目标流信息中预设的第二流字段进行封装,得到至少一个网络报文;Through the stimulating component, the second packet configuration information and at least one target flow information for network type packets are obtained from the global configuration component, and based on the second packet configuration information, presets in each target flow information are respectively Encapsulate the second stream field to obtain at least one network message; 通过所述待验证组件,接收所述激励组件发送过来的所述网络报文。The network message sent by the stimulating component is received through the component to be verified. 7.根据权利要求6所述的方法,其特征在于,所述基于所述第二报文配置信息,分别对各个目标流信息中预设的第二流字段进行封装,得到至少一个网络报文,包括:7. The method according to claim 6, characterized in that, based on the second packet configuration information, the preset second flow fields in each target flow information are respectively encapsulated to obtain at least one network packet. ,include: 基于所述第二报文配置信息包含的报文分配比例,确定针对网络类型报文的有效报文数量和无效报文数量;Based on the packet allocation ratio included in the second packet configuration information, determine the number of valid packets and the number of invalid packets for network type packets; 基于所述第二报文配置信息包含的网络报文格式,分别对各个目标流信息中预设的第二流字段进行封装,得到第一报文集;所述第一报文集对应的报文数量为所述有效报文数量;Based on the network packet format included in the second packet configuration information, the preset second flow fields in each target flow information are respectively encapsulated to obtain a first packet set; the number of packets corresponding to the first packet set is the number of valid messages; 基于所述第二报文配置信息包含的网络报文格式,对随机生成的随机流字段进行封装,得到第二报文集;所述随机流字段和所述第二流字段为字段类型相同字段值不同的流字段,所述第二报文集对应的报文数量为所述无效报文数量;Based on the network message format included in the second message configuration information, the randomly generated random flow field is encapsulated to obtain a second message set; the random flow field and the second flow field have the same field type and value. For different flow fields, the number of messages corresponding to the second message set is the number of invalid messages; 将所述第一报文集和所述第二报文集中的报文分别作为网络报文。The messages in the first message set and the second message set are respectively used as network messages. 8.根据权利要求1所述的方法,其特征在于,所述方法还包括:8. The method according to claim 1, characterized in that, the method further comprises: 通过参考组件,接收监测组件转发过来的所述网络报文,确定所述网络报文所属流对应的流标识;所述监测组件用于对激励组件发送至所述待验证组件的网络报文进行采样;Through the reference component, the network message forwarded by the monitoring component is received, and the flow identifier corresponding to the flow to which the network message belongs is determined; the monitoring component is used to perform the network message sent by the incentive component to the component to be verified. sampling; 通过所述参考组件,基于所述全局配置组件提供的流表读取接口,从所述全局配置组件配置的全局流表信息中,读取所述流标识对应的流表信息,得到第二流表信息;Through the reference component, based on the flow table reading interface provided by the global configuration component, the flow table information corresponding to the flow identifier is read from the global flow table information configured by the global configuration component to obtain the second flow table information; 通过所述参考组件,基于所述第二流表信息,对所述网络报文进行处理,得到所述第二处理结果;Through the reference component, the network message is processed based on the second flow table information to obtain the second processing result; 通过所述参考组件,将所述第二处理结果发送至所述结果对比组件。Through the reference component, the second processing result is sent to the result comparison component. 9.根据权利要求1所述的方法,其特征在于,所述基于所述第一流表信息对所述网络报文进行处理,得到第一处理结果,包括:9. The method according to claim 1, characterized in that, processing the network packet based on the first flow table information to obtain a first processing result includes: 从所述网络报文中获取预设的报文字段作为关键字段;Obtain preset message fields from the network message as key fields; 基于所述关键字段,从所述第一流表信息中查询对应的流表项;Based on the key field, query the corresponding flow table item from the first flow table information; 当查询到所述关键字段对应的流表项时,基于所述关键字段对应的流表项包含的报文转发策略,对所述网络报文进行处理,得到第一处理结果;When the flow entry corresponding to the key field is queried, the network packet is processed based on the packet forwarding policy contained in the flow entry corresponding to the key field to obtain the first processing result; 当未查询到所述关键字段对应的流表项时,将预设的处理结果作为第一处理结果。When the flow entry corresponding to the key field is not queried, the preset processing result is used as the first processing result. 10.根据权利要求9所述的方法,其特征在于,所述待验证组件用于将所述第一流表信息中的各个流表项分别写入预设存储空间中不同的存储单元;10. The method according to claim 9, characterized in that the component to be verified is used to write each flow table item in the first flow table information into different storage units in the preset storage space; 所述基于所述关键字段,从所述第一流表信息中查询对应的流表项,包括:Querying the corresponding flow table item from the first flow table information based on the key field includes: 对所述关键字段进行哈希处理,得到哈希结果;Perform hash processing on the key fields to obtain the hash result; 从所述预设存储空间中查询所述哈希结果指向的存储单元,将所述哈希结果指向的存储单元上存储的流表项作为所述关键字段对应的流表项。Query the storage unit pointed by the hash result from the preset storage space, and use the flow entry stored in the storage unit pointed by the hash result as the flow entry corresponding to the key field. 11.根据权利要求1所述的方法,其特征在于,所述方法还包括:11. The method according to claim 1, characterized in that, the method further comprises: 当所述第一处理结果和所述第二处理结果一致时,通过所述结果比较组件确定所述测试代码对应的验证结果为通过验证;When the first processing result and the second processing result are consistent, the result comparison component determines that the verification result corresponding to the test code is passed verification; 当所述第一处理结果和所述第二处理结果不一致时,通过所述结果比较组件确定所述测试代码对应的验证结果为未通过验证。When the first processing result and the second processing result are inconsistent, the verification result corresponding to the test code is determined to be failed verification through the result comparison component. 12.根据权利要求1所述的方法,其特征在于,所述第二处理结果是参考组件基于从所述全局配置组件中获取的第二流表信息,对所述网络报文进行处理得到的,所述第二处理结果是通过所述参考组件发送至所述结果比较组件;12. The method of claim 1, wherein the second processing result is obtained by processing the network packet by a reference component based on the second flow table information obtained from the global configuration component. , the second processing result is sent to the result comparison component through the reference component; 所述方法还包括:The method also includes: 通过所述参考组件,基于所述全局配置组件提供的流表写入接口,将所述第二处理结果写入存储在所述全局配置组件中的第二流表信息。Through the reference component, the second processing result is written into the second flow table information stored in the global configuration component based on the flow table writing interface provided by the global configuration component. 13.根据权利要求1所述的方法,其特征在于,所述全局配置组件包括主配置子组件和服务于所述主配置子组件的从配置子组件,所述从配置子组件包括宏定义子组件、随机配置子组件、基础模板子组件和适配子组件;13. The method according to claim 1, characterized in that the global configuration component includes a main configuration sub-component and a slave configuration sub-component serving the main configuration sub-component, and the slave configuration sub-component includes a macro definition sub-component. Components, random configuration sub-components, basic template sub-components and adaptation sub-components; 所述主配置子组件实现的功能包括生成流信息、生成流表信息、生成配置报文、生成流表读写接口中的至少一者;The functions implemented by the main configuration subcomponent include at least one of generating flow information, generating flow table information, generating configuration messages, and generating a flow table read and write interface; 所述宏定义子组件用于定义所述主配置子组件在生成数据时所需的调用代码;The macro definition sub-component is used to define the calling code required by the main configuration sub-component when generating data; 所述随机配置子组件用于配置所述主配置组件在随机生成数据时所需的随机范围;The random configuration subcomponent is used to configure the random range required by the main configuration component when randomly generating data; 所述基础模板子组件用于定义所述主配置子组件在生成数据时所需的调用任务;The basic template subcomponent is used to define the calling tasks required by the main configuration subcomponent when generating data; 所述适配子组件用于在将所述主配置组件生成的数据发送至其他组件时,对发送的数据在组件之间进行适配。The adaptation subcomponent is used to adapt the data generated between components when the data generated by the main configuration component is sent to other components. 14.根据权利要求1至13中任一项所述的方法,其特征在于,所述测试代码为实现虚拟交互机硬件卸载功能的代码,通过验证的所述测试代码用于生成放置在云服务器上的芯片。14. The method according to any one of claims 1 to 13, characterized in that the test code is a code that implements the hardware offloading function of the virtual interactive machine, and the verified test code is used to generate a code placed on the cloud server. on the chip. 15.一种代码验证装置,其特征在于,所述装置包括:15. A code verification device, characterized in that the device includes: 配置报文解析模块,用于通过待验证组件,接收针对流表信息的配置报文,对所述配置报文进行解析,得到第一流表信息;所述配置报文是对通过全局配置组件配置的全局流表信息进行封装得到的,所述待验证组件的功能通过待验证的测试代码实现;The configuration message parsing module is used to receive the configuration message for the flow table information through the component to be verified, and parse the configuration message to obtain the first flow table information; the configuration message is configured through the global configuration component. The global flow table information is encapsulated, and the functions of the component to be verified are implemented through the test code to be verified; 网络报文处理模块,用于通过所述待验证组件,接收网络报文,基于所述第一流表信息对所述网络报文进行处理,得到第一处理结果;A network message processing module, configured to receive network messages through the component to be verified, process the network messages based on the first flow table information, and obtain a first processing result; 处理结果发送模块,用于通过所述待验证组件,将所述第一处理结果发送至结果比较组件,以使所述结果比较组件对所述第一处理结果和第二处理结果进行比较,得到所述测试代码对应的验证结果;所述第二处理结果是基于所述全局配置组件配置的全局流表信息对所述网络报文进行处理得到的。The processing result sending module is configured to send the first processing result to the result comparison component through the component to be verified, so that the result comparison component compares the first processing result and the second processing result to obtain The verification result corresponding to the test code; the second processing result is obtained by processing the network message based on the global flow table information configured by the global configuration component. 16.一种计算机设备,包括存储器和处理器,所述存储器存储有计算机程序,其特征在于,所述处理器执行所述计算机程序时实现权利要求1至14中任一项所述的方法的步骤。16. A computer device, comprising a memory and a processor, the memory stores a computer program, characterized in that when the processor executes the computer program, the method of any one of claims 1 to 14 is implemented. step. 17.一种计算机可读存储介质,其上存储有计算机程序,其特征在于,所述计算机程序被处理器执行时实现权利要求1至14中任一项所述的方法的步骤。17. A computer-readable storage medium having a computer program stored thereon, characterized in that when the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 14 are implemented. 18.一种计算机程序产品,包括计算机程序,其特征在于,该计算机程序被处理器执行时实现权利要求1至14中任一项所述的方法的步骤。18. A computer program product, comprising a computer program, characterized in that, when executed by a processor, the computer program implements the steps of the method according to any one of claims 1 to 14.
CN202310605411.2A 2023-05-25 2023-05-25 Code verification methods, devices, computer equipment and storage media Pending CN116974906A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310605411.2A CN116974906A (en) 2023-05-25 2023-05-25 Code verification methods, devices, computer equipment and storage media

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310605411.2A CN116974906A (en) 2023-05-25 2023-05-25 Code verification methods, devices, computer equipment and storage media

Publications (1)

Publication Number Publication Date
CN116974906A true CN116974906A (en) 2023-10-31

Family

ID=88470152

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310605411.2A Pending CN116974906A (en) 2023-05-25 2023-05-25 Code verification methods, devices, computer equipment and storage media

Country Status (1)

Country Link
CN (1) CN116974906A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117494629A (en) * 2023-11-14 2024-02-02 飞腾信息技术有限公司 A peripheral device verification method, parameter configuration method and device during peripheral device verification
CN118093064A (en) * 2024-04-22 2024-05-28 深圳市楠菲微电子有限公司 A Model component and a method for synchronizing a Sequence using the Model component

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117494629A (en) * 2023-11-14 2024-02-02 飞腾信息技术有限公司 A peripheral device verification method, parameter configuration method and device during peripheral device verification
CN118093064A (en) * 2024-04-22 2024-05-28 深圳市楠菲微电子有限公司 A Model component and a method for synchronizing a Sequence using the Model component

Similar Documents

Publication Publication Date Title
CN111522922B (en) Log information query method, device, storage medium and computer equipment
US12430186B2 (en) Hardware accelerator service aggregation
CN114817389A (en) Data processing method, data processing device, storage medium and electronic equipment
CN116974906A (en) Code verification methods, devices, computer equipment and storage media
CN112445700B (en) Test method and device
WO2023098824A1 (en) Vehicle data management method and apparatus, and server and storage medium
CN112015534A (en) Configurated platform scheduling method, system and storage medium
CN115694699A (en) Time delay parameter acquisition method, device, electronic equipment and storage medium
WO2022028170A1 (en) Data transmission method, related network node and storage medium
CN112667508A (en) Mock method, system and device based on user-defined Mock platform and storage medium
CN110737662B (en) Data analysis method, device, server and computer storage medium
CN107783728A (en) Date storage method, device and equipment
CN112764995B (en) Server hardware resource monitoring method, device and medium
CN116846816A (en) Multipath transmission method, multipath transmission device, computer equipment and storage medium
CN113934767A (en) Data processing method and device, computer equipment and storage medium
CN116436989B (en) Message conversion method, device, equipment and storage medium
CN111857985A (en) Browser plug-in calling method, device, storage medium and terminal
CN114201264B (en) A method, device, equipment and storage medium for verifying mixed object placement
CN112861004B (en) A method and device for determining rich media
CN115985099A (en) Rail transit data unloading method and device
HK40098048A (en) Code verification method, apparatus, computer device, and storage medium
CN116701004A (en) Cloud function development method, device, electronic device and storage medium
US7849164B2 (en) Configuring a device in a network via steps
CN119484355B (en) Testing methods, apparatus, computer equipment, and storage media for network elements
CN119484466B (en) Cloud communication method, cloud communication device, computer device, readable storage medium, and program product

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40098048

Country of ref document: HK

SE01 Entry into force of request for substantive examination