Data transmission method and device, test system and electronic equipment
By using a preset script to modify the virtual LAN label during automotive bus system testing, the problems of high hardware resource consumption and cost in existing technologies are solved, achieving efficient and low-cost VLAN management.
Patent Information
- Application Number
- CN202610047744.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-01-14
- Publication Date
- 2026-03-31
AI Technical Summary
In automotive bus system testing, existing technologies require the addition or removal of VLANs through external hardware to achieve simulation interaction, which leads to increased hardware resource consumption and costs.
By modifying the virtual LAN label based on the forwarding target channel of the packet to be forwarded using a preset script, VLANs can be added or removed, avoiding the use of external hardware devices.
It reduces hardware resource consumption and testing costs, while lowering the technical requirements for testers and improving modification efficiency and accuracy.
Smart Images

Figure CN121771085A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a data transmission method, apparatus, testing system, and electronic device. Background Technology
[0002] When testing automotive bus systems, if it is necessary to simulate signal transmission between controllers from different manufacturers, since the ARXML file only sets a single-layer VLAN (Virtual Local Area Network), it is necessary to add or remove VLANs through external hardware to achieve the simulation interaction effect. For example, it is necessary to add a second-layer VLAN through switches or other means, which will consume hardware resources and increase costs. Summary of the Invention
[0003] This application provides a data transmission method, apparatus, testing system, and electronic device to solve the technical problems in related technologies that require external hardware means to add or remove VLANs to achieve simulated interaction effects, which consumes hardware resources and is costly.
[0004] This application provides a data transmission method, the method comprising: acquiring a packet to be forwarded and determining a forwarding target channel for the packet to be forwarded; modifying the initial virtual local area network (VLAN) label of the packet to be forwarded according to a preset VLAN label of the forwarding target channel using a preset script to obtain a modified packet; and forwarding the modified packet to the forwarding target channel.
[0005] Compared with related technologies, this data transmission method has at least the following advantages: by modifying the virtual LAN label based on the forwarding target channel of the packet to be forwarded using a preset script, the modified packet is obtained, and then the modified packet is forwarded to the forwarding target channel. This can achieve the effect of adding or removing VLANs without the aid of external hardware, without occupying hardware resources, reducing testing costs, and also reducing the technical requirements for testers.
[0006] In one embodiment of this application, the initial virtual local area network (VLAN) label of the packet to be forwarded is modified by a preset script according to a preset VLAN tag of the forwarding target channel, including at least one of the following: if the forwarding target channel is a real Ethernet channel and the initial VLAN tag includes all the preset VLAN tags, the preset script is used to strip tags in the initial VLAN tag that are different from the preset VLAN tag until the initial VLAN tag is the same as the preset VLAN tag; if the forwarding target channel is a virtual Ethernet channel and the preset VLAN tag... Including all the initial VLAN tags, the preset script adds tags to the initial VLAN tags with preset VLAN tags that are different from the initial VLAN tags, until the initial VLAN tags are the same as the preset VLAN tags; if the initial VLAN tags and the preset VLAN tags are both different, the preset script strips the initial VLAN tags from the packets to be forwarded and adds the preset VLAN tags to the stripped packets to be forwarded. This allows for accurate and rapid modification of VLAN layers and VLAN values, improving modification efficiency.
[0007] In one embodiment of this application, before obtaining the packet to be forwarded, the method further includes: creating a virtual Ethernet channel and creating a gateway node in the virtual Ethernet channel; forwarding packets from the real Ethernet channel to the virtual Ethernet channel through the gateway node; and forwarding packets from the virtual Ethernet channel to the real Ethernet channel through the gateway node. The packet to be forwarded comes from the virtual Ethernet channel or the real Ethernet channel. By using the gateway node as a gateway route and sending and receiving packets in a gateway manner, the requirement for hardware devices such as network management switches can be saved.
[0008] In one embodiment of this application, the real Ethernet channel is created through a bus communication module, which simplifies the test bench and improves testing efficiency.
[0009] In one embodiment of this application, before obtaining the message to be forwarded, the method further includes: obtaining the associated node information of the real controller under test; performing node simulation based on the associated node information to obtain the associated simulation nodes of the real controller under test, wherein the associated simulation nodes include associated controller simulation nodes and / or associated actuator simulation nodes; using the message generated by at least one of the associated controller simulation nodes, associated actuator simulation nodes, and the real controller under test as the message to be forwarded; if the message to be forwarded is generated by the associated controller simulation node or the associated actuator simulation node, the forwarding target channel is determined as a real Ethernet channel; if the message to be forwarded is generated by the real controller under test, the forwarding target channel is determined as a virtual Ethernet channel. In this way, the forwarding target channel corresponding to the message from different channels can be intuitively known, making the direction of subsequent forwarding clearer.
[0010] In one embodiment of this application, the configuration method of the preset script includes: obtaining the IP information and source channel information of the target controller, wherein the target controller includes at least one of an associated controller simulation node, an associated actuator simulation node, and a real controller under test, the IP information and source channel information are used to filter packets to obtain the packets to be forwarded, and the source channel information indicates that the packets come from a virtual Ethernet channel or a real Ethernet channel; obtaining the virtual LAN layer number and virtual LAN tag value of each forwarding target channel, recording the virtual LAN layer number and virtual LAN tag value as a preset virtual LAN tag, and obtaining a preset virtual LAN tag for each forwarding target channel; through The IP information, source channel information, and preset VLAN tag are used to configure the preset script. Furthermore, if the target controller includes a real controller under test, when the real controller under test changes, the current data in the preset script is updated with updated data. The updated data includes the changed IP information of the real controller under test, the VLAN layer number corresponding to the changed real controller under test, and the VLAN tag value. The current data includes the current IP information of the real controller under test, the VLAN layer number corresponding to the current real Ethernet channel, and the VLAN tag value. This allows for efficient and rapid identification of which packets need to be forwarded, facilitating subsequent processing.
[0011] In one embodiment of this application, obtaining the virtual local area network (VLAN) layer number and VLAN tag value of each forwarding target channel includes: obtaining a packet from the forwarding target channel; parsing the packet to obtain the VLAN tag value and VLAN layer number, which can intuitively and quickly obtain the preset VLAN tag of the forwarding target channel.
[0012] This application embodiment also provides a data transmission device, the data transmission device comprising: an acquisition module, configured to acquire a packet to be forwarded and determine the forwarding target channel of the packet to be forwarded; a modification module, configured to modify the initial virtual local area network label of the packet to be forwarded according to a preset virtual local area network label of the forwarding target channel using a preset script, to obtain a modified packet; and a forwarding module, configured to forward the modified packet to the forwarding target channel.
[0013] This application also provides a testing system, which includes the data transmission device as described in claim 8.
[0014] This application also provides an electronic device, including: a memory storing a computer program thereon; and a processor for executing the computer program in the memory to implement the steps of the method described in any of the above embodiments.
[0015] This invention also provides a computer-readable storage medium having a computer program stored thereon, the computer program being used to cause a computer to perform the method provided in any of the above embodiments.
[0016] The beneficial effects of this application are as follows: The data transmission method, apparatus, testing system and electronic device proposed in the embodiments of this application modify the virtual local area network label based on the forwarding target channel of the packet to be forwarded by a preset script to obtain the modified packet, and then forward the modified packet to the forwarding target channel. This can achieve the effect of adding or removing VLANs without the aid of external hardware means, and achieve the effect of simulation interaction, without occupying hardware resources, reducing testing costs, and also reducing the technical requirements for testers. Attached Figure Description
[0017] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with this application and, together with the description, serve to explain the principles of this application. It is obvious that the drawings described below are merely some embodiments of this application, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.
[0018] In the attached diagram: Figure 1 This is a schematic diagram illustrating an application scenario of a data transmission method provided in an embodiment of this application. Figure 2 A schematic flowchart of a data transmission method provided in an embodiment of this application; Figure 3 A specific flowchart illustrating a data transmission method provided in an embodiment of this application; Figure 4This is another specific flowchart illustrating a data transmission method provided in an embodiment of this application; Figure 5 A schematic diagram of a data transmission apparatus provided in an embodiment of this application; Figure 6 A schematic diagram of the structure of a test system provided in an embodiment of this application; Figure 7 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0019] The following specific examples illustrate the implementation of this application. Those skilled in the art can easily understand other advantages and effects of this application from the content disclosed in this specification. This application can also be implemented or applied through other different specific embodiments. Various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of this application. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.
[0020] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of this application. The drawings only show the components related to this application and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the shape, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.
[0021] In the following description, numerous details are explored to provide a more thorough explanation of embodiments of the present application. However, it will be apparent to those skilled in the art that embodiments of the present application may be practiced without these specific details. In other embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring embodiments of the present application.
[0022] Control software used for automotive bus system testing, such as CANoe, has the function of controlling boards and testing modules. However, CANoe software still has certain limitations: when the ARXML file sets a single-layer VLAN, the second-layer VLAN needs to be added by a switch or other means, resulting in different simulation signal methods between controllers from different manufacturers. The simulation interaction effect can only be achieved by adding or removing VLANs through external hardware, which will consume hardware resources and increase costs.
[0023] To address the aforementioned technical issues, this application provides a data transmission method. This method modifies the virtual local area network (VLAN) tag based on the forwarding target channel of the packet to be forwarded using a preset script, obtains the modified packet, and then forwards the modified packet to the forwarding target channel. This allows for the addition or removal of VLANs without the aid of external hardware, achieving a simulated interactive effect without consuming hardware resources, reducing testing costs, and lowering the technical requirements for testers.
[0024] Please see Figure 1 , Figure 1 This is a schematic diagram illustrating an application scenario of a data transmission method provided in an embodiment of this application. For example... Figure 1 As shown, the actual controller under test 110 interacts with the automotive bus system test system 120 via message exchange. The automotive bus system test system 120 is equipped with CANoe software, in which one or more associated simulation nodes are set up and a virtual Ethernet channel is configured. A gateway node is set up in this virtual Ethernet channel, and a preset script is deployed on the gateway node. The preset script is generated based on CAPL (Communication Access Programming Language) statements. When the associated simulation node generates a message to be forwarded, the message to be forwarded has only one VLAN layer, and the forwarding target channel of the message to be forwarded is the actual Ethernet channel. After being intercepted by the preset script, the VLAN is added to the message to be forwarded based on the VLAN layer number (two layers) and VLAN value of the actual Ethernet channel, so that the message to be forwarded after the addition has two VLAN layers, and the VLAN value is the same as the VLAN value of the actual Ethernet channel. The added packet is then forwarded to the real Ethernet channel. When the real controller under test generates a packet to be forwarded, its target channel is the virtual Ethernet channel. This packet has two VLAN layers. After being intercepted by the preset script, the VLAN is stripped from the packet based on the number of VLAN layers (dual layers) and the VLAN value of the virtual Ethernet channel. This results in a single VLAN layer for the stripped packet, with the VLAN value matching the VLAN value of the virtual Ethernet channel. The stripped packet is then forwarded to the virtual Ethernet channel. This allows for VLAN stripping and addition without using a managed switch, reducing testing costs.
[0025] It should be noted that the above scenario is merely an example of an application scenario provided by the embodiments of this application. This method can also be applied to other scenarios according to the user's needs. The embodiments of this application do not limit the actual form of various devices, components, etc. included in this scenario. The number of VLAN layers above is only an example, and those skilled in the art can set it themselves as needed. In the specific application of the solution, it can be set according to actual needs. Please see Figure 2 , Figure 2 A schematic flowchart of a data transmission method provided in an embodiment of this application is shown below. Figure 2 As shown, the method includes the following steps: Step S210: Obtain the message to be forwarded and determine the forwarding target channel of the message to be forwarded.
[0026] Taking the scenario of testing a vehicle controller as an example, during the testing of a real controller of a vehicle using test equipment equipped with testing software such as CANoe, this real controller is designated as the controller under test. Messages sent by this controller under test can be treated as forwarding messages and forwarded to the virtual Ethernet channel (simulated Ethernet channel) of the test equipment, thus providing them to the emulation nodes. Messages sent by some emulation nodes built in the test equipment (such as the associated emulation nodes mentioned later) can also be treated as forwarding messages and need to be forwarded to the real Ethernet channel before being transmitted to the controller under test.
[0027] As an example, the target channel for forwarding can be determined by parsing the packet to be forwarded using software such as CANoe to obtain the packet's TX or RX attributes. Alternatively, the target channel can be determined by the direction of the packet to be forwarded, or by other methods known to those skilled in the art, which will not be elaborated here.
[0028] In one embodiment, before obtaining the packet to be forwarded, the method further includes: creating a virtual Ethernet channel, creating a gateway node in the virtual Ethernet channel, forwarding packets from the real Ethernet channel to the virtual Ethernet channel through the gateway node, and forwarding packets from the virtual Ethernet channel to the real Ethernet channel through the gateway node, wherein the packet to be forwarded originates from either the virtual Ethernet channel or the real Ethernet channel. For example, at least one simulated node is configured in the test device, and packets generated by the simulated node are transmitted through the virtual Ethernet channel. When these packets need to be forwarded to the real Ethernet channel, the forwarding of packets can be achieved through the gateway node. Using this gateway node as a gateway route and performing packet transmission and reception in a gateway manner can save the need for hardware devices such as network-managed switches.
[0029] Taking the application of this method to a device with testing software such as CANoe as an example, by establishing an identical virtual node in both the virtual Ethernet bus (virtual Ethernet path) and the real Ethereum bus (real Ethernet path) in CANoe, which is the gateway node mentioned in the embodiments of this application, and using it as a gateway for message sending and receiving, the virtual bus and the real bus can send and receive messages through the virtual node gateway routing method.
[0030] Following the above embodiments, the real Ethernet channel is created through bus communication modules such as the VN56XX series devices and VT6363. The specific model of the VN56XX series devices can be determined according to the test objectives; XX represents the specific selection, which can be determined based on the actual model used. This method simplifies the test bench and improves testing efficiency.
[0031] In one embodiment, before obtaining the message to be forwarded, the method further includes: obtaining the associated node information of the real controller under test; performing node simulation based on the associated node information to obtain the associated simulation nodes of the real controller under test, wherein the associated simulation nodes include associated controller simulation nodes and / or associated actuator simulation nodes; using a message generated by at least one of the associated controller simulation nodes, associated actuator simulation nodes, and the real controller under test as the message to be forwarded; if the message to be forwarded is generated by the associated controller simulation node or the associated actuator simulation node, the forwarding target channel is determined to be a real Ethernet channel; if the message to be forwarded is generated by the real controller under test, the forwarding target channel is determined to be a virtual Ethernet channel. For example, when testing a controller, the associated nodes related to the controller can be simulated through simulation, such as other controllers related to the controller or actuators related to the controller. The corresponding associated simulation nodes are generated based on ARXML files, which facilitates the testing of the real controller under test and achieves the goal of testing the real controller under test more simply, quickly, and at low cost.
[0032] In one embodiment, packets to be forwarded can be obtained by intercepting and parsing packets from both the virtual Ethernet channel and the real Ethernet channel. The packet's source IP address is compared to a pre-defined destination IP address to determine if it is a packet to be forwarded. If the source IP address matches a pre-configured destination IP address, the packet is considered a packet to be forwarded. This method efficiently and quickly identifies which packets need to be forwarded, facilitating subsequent processing.
[0033] Step S220: Modify the initial virtual local area network label of the packet to be forwarded according to the preset virtual local area network label of the forwarding target channel using a preset script to obtain the modified packet.
[0034] Modifications include at least one of adding or removing VLAN values, and at least one of adding or removing VLAN layers. For example, adding a layer to a single-layer VLAN and adding the corresponding VLAN value. Another example is removing a single-layer VLAN, then adding two layers of VLANs and adding the corresponding VLAN value for each layer. Modifying the initial VLAN tag via script can replace modifying it through physical devices, saving equipment costs and offering greater flexibility and convenience.
[0035] In one embodiment, a preset script modifies the initial virtual local area network (VLAN) label of the packet to be forwarded based on a preset VLAN label of the forwarding target channel, including at least one of the following: If the forwarding target channel is a real Ethernet channel, and the initial VLAN tag includes all the preset VLAN tags, the preset script will strip the tags that are different from the preset VLAN tags in the initial VLAN tag until the initial VLAN tag is the same as the preset VLAN tag. If the forwarding target channel is a virtual Ethernet channel, and the preset virtual LAN label includes all the initial virtual LAN labels, the preset script adds a preset virtual LAN label with a different preset virtual LAN label until the initial virtual LAN label is the same as the preset virtual LAN label. If the initial VLAN tag and the preset VLAN tag are different, the preset script will strip the initial VLAN tag from the packet to be forwarded and add the preset VLAN tag to the stripped packet.
[0036] A VLAN tag includes the VLAN layer number and VLAN value. If the initial VLAN tag has fewer layers than the preset VLAN tag number, and the VLAN value in the initial VLAN tag is one of the VLAN values in the preset VLAN tag, then it's necessary to add more layers to the initial VLAN tag and add the corresponding VLAN value for each added layer. If the initial VLAN tag has fewer layers than the preset VLAN tag number, and the VLAN values in the initial VLAN tag are all different from the VLAN values in the preset VLAN tag, then it's necessary to add more layers to the initial VLAN tag to reach the preset VLAN tag number, and add the corresponding VLAN value for each layer in the preset VLAN tag, stripping the original VLAN value. If the initial VLAN tag has more layers than the preset VLAN tag, and the VLAN value in the preset VLAN tag is one of the VLAN values in the VLAN tag, then the initial VLAN tag needs to be stripped of layers, and the corresponding VLAN values for the stripped layers need to be stripped synchronously. If the initial VLAN tag has more layers than the preset VLAN tag, and the VLAN values in the initial VLAN tag are all different from the VLAN values in the preset VLAN tag, then the initial VLAN tag needs to be stripped of layers to reach the number of layers specified by the preset VLAN tag, and the corresponding VLAN values for each layer in the preset VLAN tag need to be added, while the original VLAN values need to be stripped.
[0037] By using the above rules, the VLAN layer number and VLAN value can be modified accurately and quickly, improving modification efficiency.
[0038] In one embodiment, the preset script is generated based on the CAPL statement and is a CAPL script.
[0039] In one embodiment, the configuration method of the preset script includes: obtaining the IP information and source channel information of the target controller, wherein the target controller includes at least one of the associated controller simulation node, the associated actuator simulation node, and the real controller under test; the IP information and source channel information are used to filter packets to obtain packets to be forwarded; the source channel information indicates that the packets come from a virtual Ethernet channel or a real Ethernet channel; obtaining the virtual LAN layer number and virtual LAN tag value of each forwarding target channel, recording the virtual LAN layer number and virtual LAN tag value as preset virtual LAN tags to obtain preset virtual LAN tags for each forwarding target channel; and configuring the preset script using the IP information, source channel information, and preset virtual LAN tags.
[0040] It's understandable that when determining which packets to forward, the source channel information and IP information can be used. For example, virtual Ethernet channels are configured with specific IP information; if the source IP of a packet on a virtual Ethernet channel matches this information, then the packet is a packet to be forwarded. Similarly, real Ethernet channels are configured with specific IP information; if the source IP of a packet on a real Ethernet channel matches this information, then the packet is a packet to be forwarded. When removing and adding LAN tags, the corresponding operations can be performed using the pre-known LAN tags of the target forwarding channel. This configuration method requires minimal technical expertise from the configurer, is simple and convenient to execute, and offers high flexibility.
[0041] In one embodiment, if the target controller includes the real controller under test, when the real controller under test changes, the current data in the preset script is updated with update data. The update data includes the IP information of the changed real controller under test, the virtual LAN layer number and virtual LAN tag value corresponding to the changed real controller under test, and the current data includes the IP information of the current real controller under test, the virtual LAN layer number and virtual LAN tag value corresponding to the current real Ethernet channel. It can be understood that after the current real controller under test completes testing, if the controller needs to be replaced, the configuration of the preset script can be changed by modifying the IP of the new controller. If replacing the controller does not cause a change in the virtual LAN layer number and virtual LAN tag value, then the virtual LAN layer number and virtual LAN tag value do not need to be modified. By modifying the configuration of the preset script, the required packet IP and the VLAN values that need to be added can be quickly changed, reducing the testing difficulty and the technical requirements of the testers.
[0042] As an example, when the actual controller under test changes, the previous simulation nodes (associated simulation nodes) may also need to be changed accordingly. If changes are required, the configuration information (IP information, VLAN tags, etc.) related to the associated simulation nodes in the preset script also needs to be modified accordingly.
[0043] The virtual LAN label of the forwarding target channel can be obtained in a manner known to those skilled in the art.
[0044] The following provides an exemplary method for obtaining preset VLAN tags. In one example, obtaining the VLAN layer number and VLAN tag value for each forwarding target channel includes: obtaining packets from the forwarding target channel; parsing the packets to obtain the VLAN tag value and VLAN layer number. For example, packets in a virtual Ethernet channel can be parsed using software such as CANoe to obtain the VLAN layer number and VLAN tag value of the packet, which serves as the preset VLAN tag for the virtual Ethernet channel. Similarly, packets from the real controller under test in a real Ethernet channel can be parsed using CANoe software to obtain the VLAN layer number and VLAN tag value of the packet, which also serves as the preset VLAN tag for the real Ethernet channel. This method provides a direct and quick way to obtain the preset VLAN tag for the forwarding target channel.
[0045] Step S230: Forward the modified message to the target forwarding channel.
[0046] As mentioned in the above embodiments, modified packets can be routed to the forwarding target channel through a pre-configured gateway node. This can be achieved without the need for an external network management switch.
[0047] The data transmission method provided in the above embodiments modifies the virtual LAN label based on the forwarding target channel of the packet to be forwarded using a preset script, obtaining the modified packet, and then forwards the modified packet to the forwarding target channel. This achieves the simulation interaction effect without the need for external hardware to add or remove VLANs, without consuming hardware resources, reducing testing costs, and lowering the technical requirements for testers. This method allows for autonomous selection of interaction packets via IP, significantly reducing the total load on the bus. Script editing allows for quick modification of the required packet IP and the VLAN values to be added, reducing testing difficulty and the technical requirements for testers.
[0048] Based on CAPL scripts and VN56XX series products, the required packets are captured via IP and stripped and added to the packets by forwarding. The packets with stripped and added VLANs are sent to the corresponding vehicle Ethernet channels to achieve packet subscription, node acquisition and other behaviors. The method of forwarding packets to be forwarded by pre-set scripts reduces the investment in hardware costs and lowers the technical requirements of testers.
[0049] The following example demonstrates how this data transmission method can be applied to CANoe software, using the CAPL statements in CANoe software and the VLAN stripping and addition implemented with the VN56XX series products. A simulated Ethernet node (simulated node) is created based on an ARXML file; packets sent by the simulated Ethernet node are bound to a CANoe virtual Ethernet channel; packets in the virtual Ethernet channel are captured using the CAPL statement according to IP address (resulting in packets to be forwarded), and the captured packets are added to a VLAN and sent to a dual-VLAN real Ethernet channel for handshake, subscription, and other information exchange; dual-VLAN packets in the real Ethernet are captured according to IP address; after removing the IP address, they are forwarded to a single-VLAN virtual Ethernet channel to interact with the simulated node. This method of VLAN stripping and addition based on the CAPL statements in CANoe software and the VN56XX series reduces Ethernet bus channel usage, lowers bus load, and allows VLAN stripping and addition to be implemented at the software level, eliminating the need for a managed switch and reducing hardware costs.
[0050] When creating simulated Ethernet nodes based on ARXML files, you can import the ARXML file into CANoe and simulate the virtual nodes that need to be simulated through node simulation. Simulated nodes include all nodes except the real controller, such as other controllers or actuators.
[0051] During the message configuration phase, a virtual emulation channel (virtual Ethernet channel) and a real channel (real Ethernet channel) are created in CANoe. Emulated node messages are sent via the virtual emulation channel, while controller messages are sent via the real channel. The virtual emulation channel (virtual Ethernet channel) is used to send ARXML file messages, and the real channel (real Ethernet channel) can be a channel created by the controller through the VN56XX series devices. The virtual bus and the real bus transmit and receive messages via a virtual node gateway routing method. Gateway routing is achieved by establishing an identical virtual node in both the virtual bus and the real bus within CANoe, acting as a gateway for message transmission and reception.
[0052] The packet filtering method includes: filtering the IPs of packets to be forwarded, determining the forwarding direction, and when forwarding virtual bus packets to the real bus (real Ethernet channel) requires adding VLANs, the IPs of packets to be forwarded in the virtual bus (virtual Ethernet channel) are added to the script using a preset script (hereinafter referred to as the script), and the forwarding bus part of the script is set to the real bus. When forwarding real bus packets to the virtual bus requires removing VLANs, the IPs of packets to be forwarded in the real bus are added to the script using the script, and the forwarding bus part of the script is set to the virtual bus. The virtual bus and the real bus send and receive packets through virtual node gateway routing. By filtering the IPs of packets to be forwarded, packet interception, VLAN addition, or deletion is achieved through IPs, and then virtual node transmission is performed.
[0053] The configuration methods for VLAN layers and VLAN values include: VLAN layers and VLAN values can be set manually, or they can be configured in the following way: In the Detail View section of the Trace window, under the Ethernet layer VLAN, you can confirm the VLAN layer and VLAN value of the packets to be forwarded.
[0054] The script can be used to add or modify dual or multi-layer VLANs and VLAN values in the VLAN data section of the message header. Similarly, the script can be used to reduce or modify the number of VLAN layers and their values in the VLAN data section.
[0055] Taking a virtual Ethernet channel as a single-layer VLAN and a real Ethernet channel as a dual-layer VLAN as an example, please refer to [link to relevant documentation]. Figure 3 , Figure 3 A specific flowchart illustrating a data transmission method provided in an embodiment of this application is shown below. Figure 3As shown, the CANoe software generates CANoe emulation node packets and sends them through a virtual Ethernet channel. These CANoe emulation node packets are single-layer VLAN packets. By adding VLANs through a preset script, a double VLAN packet with added VLANs is obtained, which is then routed to the real Ethernet channel.
[0056] Continuing with the example of a virtual Ethernet channel as a single-layer VLAN and a real Ethernet channel as a dual-layer VLAN, please refer to [link to previous text]. Figure 4 , Figure 4 Another specific flowchart illustrating a data transmission method provided in an embodiment of this application is shown below. Figure 4 As shown, the real ECU (the real controller under test) sends dual VLAN packets and transmits them through the real Ethernet channel. After intercepting the dual VLAN packets on the real Ethernet, a layer of VLAN is stripped using a preset script to obtain the single VLAN packets after stripping the VLAN, and then the packets are routed to the virtual Ethernet channel.
[0057] In one embodiment, a data transmission apparatus is provided for performing the data transmission method provided in any of the above embodiments. See also... Figure 5 , Figure 5 A schematic diagram of a data transmission apparatus provided in an embodiment of this application is shown below. Figure 5 As shown, the data transmission device 500 includes: an acquisition module 510, used to acquire a message to be forwarded and determine the forwarding target channel of the message to be forwarded; a modification module 520, used to modify the initial virtual local area network label of the message to be forwarded according to the preset virtual local area network label of the forwarding target channel through a preset script, so as to obtain the modified message; and a forwarding module 530, used to forward the modified message to the forwarding target channel.
[0058] For specific limitations regarding the data transmission device, please refer to the limitations on the data transmission method above, which will not be repeated here. Each module in the aforementioned data transmission device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware or independently of the processor in the electronic device, or stored in software in the memory of the electronic device, so that the processor can call and execute the operations corresponding to each module.
[0059] In this embodiment, the data transmission device is essentially configured with multiple modules to execute the data transmission method in any of the above embodiments. The specific functions and technical effects can be referred to in the above embodiments, and will not be repeated here.
[0060] In one embodiment, a testing system is provided; please refer to [link to relevant documentation]. Figure 6 , Figure 6A schematic diagram of the structure of a test system provided in an embodiment of this application is shown below. Figure 6 As shown, the test system 600 includes the test apparatus 500 provided in any of the above embodiments, or is used to execute the data transmission method provided in any of the above embodiments.
[0061] For specific limitations regarding the testing system, please refer to the limitations of the testing methods described above, which will not be repeated here. Each module in the aforementioned testing system can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in hardware within or independently of the processor in the electronic device, or stored in software within the memory of the electronic device, so that the processor can call and execute the corresponding operations of each module.
[0062] In this embodiment, the testing system is essentially set up with multiple modules to execute the vehicle-side execution method in any of the above embodiments. The specific functions and technical effects can be referred to in the above embodiments, and will not be repeated here.
[0063] See Figure 7 , Figure 7 A schematic diagram of the structure of an electronic device provided in an embodiment of this application is shown below. Figure 7 As shown, this embodiment of the invention also provides an electronic device 700, including a processor 701, a memory 702, and a communication bus 703; the communication bus 703 is used to connect the processor 701 and the memory 702; the processor 701 is used to execute a computer program stored in the memory 702 to implement the method described in any of the above embodiments.
[0064] This invention also provides a computer-readable storage medium having a computer program stored thereon, the computer program being used to cause a computer to perform the method provided in any of the above embodiments.
[0065] This application also provides a non-volatile readable storage medium storing one or more modules (programs) that, when applied to a device, enable the device to execute the instructions included in the steps provided in this application.
[0066] This application also provides a computer program product, including a computer program that, when executed by a processor, can implement the steps and corresponding content of the aforementioned method embodiments.
[0067] It should be noted that the computer-readable medium described in this disclosure can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In this disclosure, a computer-readable storage medium can be any tangible medium containing or storing a program that can be used by or in conjunction with an instruction execution system, apparatus, or device. In this disclosure, a computer-readable signal medium can include a data signal propagated in baseband or as part of a carrier wave, carrying computer-readable program code. Such propagated data signals can take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. A computer-readable signal medium can be any computer-readable medium other than a computer-readable storage medium, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The program code contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to: wires, optical fibers, RF (radio frequency), etc., or any suitable combination thereof.
[0068] The aforementioned computer-readable medium may be included in the aforementioned electronic device; or it may exist independently and not assembled into the electronic device.
[0069] Computer program code for performing the operations of this disclosure can be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, and C++, as well as conventional procedural programming languages such as the "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a standalone software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In cases involving remote computers, the remote computer can be connected to the user's computer via any type of network, including a local area network (LAN) or a wide area network (WAN), or it can be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0070] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of methods and computer program products according to various embodiments of this disclosure. In this regard, each block in a flowchart or block diagram may represent a module, segment, or portion of code containing one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, and they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block in the block diagrams and / or flowcharts, and combinations of blocks in the block diagrams and / or flowcharts, may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.
[0071] It should be understood that the terms "first," "second," etc., used in this application are used to distinguish similar objects and do not necessarily indicate a specific order or sequence. The technical features to which these terms are used can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in a sequence other than that shown in the figures or text.
[0072] It should be understood that, if the term "multiple" is used in this application, it refers to two or more.
[0073] It should be understood that although the flowcharts provided in the embodiments of this application indicate the various steps with arrows, the order indicated by the arrows does not necessarily limit the implementation order of these steps. Those skilled in the art can perform these steps in other orders according to different implementation scenarios and requirements.
[0074] The above embodiments are merely illustrative of the principles and effects of this application and are not intended to limit this application. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of this application. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in this application should still be covered by the claims of this application.
Claims
1. A data transmission method, characterized by, The method comprises: acquiring a to-be-forwarded packet and determining a forwarding target channel of the to-be-forwarded packet; modifying an initial virtual local area network (VLAN) tag of the to-be-forwarded packet according to a preset VLAN tag of the forwarding target channel through a preset script to obtain a modified packet; forwarding the modified packet to the forwarding target channel.
2. The data transmission method of claim 1, wherein, The modifying of the initial VLAN tag of the to-be-forwarded packet according to the preset VLAN tag of the forwarding target channel through the preset script comprises at least one of the following: if the forwarding target channel is a real Ethernet channel and the initial VLAN tag comprises all the preset VLAN tags, performing tag stripping on tags in the initial VLAN tag that are different from the preset VLAN tags through the preset script until the initial VLAN tag is the same as the preset VLAN tags; if the forwarding target channel is a virtual Ethernet channel and the preset VLAN tags comprise all the initial VLAN tags, performing tag addition on the initial VLAN tags with preset VLAN tags that are different from the initial VLAN tags through the preset script until the initial VLAN tags are the same as the preset VLAN tags; if the initial VLAN tags and the preset VLAN tags are different, performing tag stripping on the initial VLAN tags of the to-be-forwarded packet through the preset script and adding the preset VLAN tags to the to-be-forwarded packet after the tag stripping.
3. The data transmission method of claim 1, wherein, Before acquiring the to-be-forwarded packet, the method further comprises: creating a virtual Ethernet channel and creating a gateway node in the virtual Ethernet channel, forwarding packets from a real Ethernet channel to the virtual Ethernet channel through the gateway node, and forwarding packets from the virtual Ethernet channel to the real Ethernet channel through the gateway node, the to-be-forwarded packet being from the virtual Ethernet channel or the real Ethernet channel.
4. The data transmission method of claim 3, wherein, The real Ethernet channel is created through a bus communication module.
5. The data transmission method according to any one of claims 1 to 4, characterized in that, Before acquiring the to-be-forwarded packet, the method further comprises: acquiring associated node information of a to-be-tested real controller; performing node simulation based on the associated node information to obtain associated simulation nodes of the to-be-tested real controller, the associated simulation nodes comprising an associated controller simulation node and / or an associated actuator simulation node; generating a packet from at least one of the associated controller simulation node, the associated actuator simulation node and the to-be-tested real controller as the to-be-forwarded packet; if the to-be-forwarded packet is generated by the associated controller simulation node or the associated actuator simulation node, determining the forwarding target channel as a real Ethernet channel; if the to-be-forwarded packet is generated by the to-be-tested real controller, determining the forwarding target channel as a virtual Ethernet channel.
6. The data transmission method according to any one of claims 1 to 4, wherein The configuration mode of the preset script comprises: Obtaining IP information and source channel information of a target controller, the target controller including at least one of an associated controller simulation node, an associated actuator simulation node, and a real controller to be tested, the IP information and the source channel information being used for screening a message to obtain the message to be forwarded, the source channel information indicating that the message comes from a virtual Ethernet channel or a real Ethernet channel; Obtaining a virtual local area network layer number and a virtual local area network label value of each forwarding target channel, and recording the virtual local area network layer number and the virtual local area network label value as a preset virtual local area network label to obtain a preset virtual local area network label of each forwarding target channel; Configuring the preset script by using the IP information, the source channel information, and the preset virtual local area network label; If the target controller includes the real controller to be tested, when the real controller to be tested is changed, updating current data in the preset script by using update data, the update data including IP information of the changed real controller to be tested and a virtual local area network layer number and a virtual local area network label value corresponding to the changed real controller to be tested, and the current data including IP information of the current real controller to be tested and a virtual local area network layer number and a virtual local area network label value corresponding to the current real Ethernet channel. Obtaining a virtual local area network layer number and a virtual local area network label value of each forwarding target channel includes:
7. The data transmission method of claim 6, wherein, Obtaining a message from the forwarding target channel; Analyzing the message to obtain a virtual local area network label value and a virtual local area network layer number. The device includes:
8. A data transmission apparatus, characterized by comprising: An obtaining module, configured to obtain a message to be forwarded and determine a forwarding target channel of the message to be forwarded; A modifying module, configured to modify an initial virtual local area network label of the message to be forwarded by using a preset script according to a preset virtual local area network label of the forwarding target channel to obtain a modified message; A forwarding module, configured to forward the modified message to the forwarding target channel. The test system includes the data transmission device of claim 8.
9. A test system, characterized by The processor implements the method of any one of claims 1 to 7 when executing the computer program.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, The processor implements the method of any one of claims 1 to 7 when executing the computer program.
