Port test method, device and system and vehicle

By forming multiple ports of the switch into closed ring links and sending test messages, the problem that the existing Ethernet box cannot meet the multi-channel Ethernet monitoring needs is solved, and rapid detection and efficient monitoring of switch port functions are achieved.

CN119030892AActive Publication Date: 2024-11-26CHONGQING SELIS PHOENIX INTELLIGENT INNOVATION TECH CO LTD

Patent Information

Application Number
CN202410984893.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-22
Publication Date
2024-11-26
Estimated Expiration
2044-07-22

AI Technical Summary

Technical Problem

Most of the existing Ethernet boxes are single-channel 100M designs, which cannot meet the monitoring requirements of the vehicle ECU for multi-channel Ethernet status. Moreover, using multiple Ethernet boxes is inefficient and difficult to configure and manage, so it is impossible to directly connect the car Ethernet to the computer. Perform monitoring.

Method used

By forming multiple ports of the switch into a closed ring link, a test message is sent to the first port, so that it can be transmitted in the closed ring link, and determining whether the functions of multiple ports are normal based on the return message, avoiding the problem of the correctness of the corresponding ports The tedious process of sending test messages separately from each port improves detection efficiency.

Benefits of technology

It realizes rapid function detection of multiple ports of the switch, simplifies the connection with external devices, solves the problem of inability to connect directly due to port types differences, and improves detection efficiency and compatibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119030892A_ABST
    Figure CN119030892A_ABST
Patent Text Reader

Abstract

The invention provides a port test method, device and system and a vehicle, belongs to the technical field of switches, and is used for testing a plurality of ports of a switch. The method comprises the following steps: establishing a closed annular link by a plurality of ports; wherein a first port in the plurality of ports is a starting node and a termination node in the closed ring link, and a second port, except the first port, in the plurality of ports is an intermediate node in the closed ring link; sending a test message to the first port, so that the test message is transmitted in the closed ring link; obtaining a return message output by the first port after the test message is transmitted in the closed ring link; and determining whether the functions of the plurality of ports are normal based on the return message. According to the port test method provided by the embodiment of the invention, the problem that the switch port cannot be directly connected with the external equipment due to the difference can be solved through the arrangement of the closed annular link.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of switches, and in particular relates to a port testing method, device, system and vehicle. Background Art

[0002] There are differences in the physical layer and interface between in-vehicle Ethernet and traditional Ethernet, which makes it impossible to directly connect in-vehicle Ethernet to a computer for monitoring. To solve this problem, an Ethernet box (such as a T1 to TX device) is needed for signal conversion. However, most Ethernet boxes on the market are single-channel 100M designs, which limits their ability to monitor multiple interfaces. At the same time, the use of multiple Ethernet boxes is not only inefficient, but also increases the difficulty of configuration management, and cannot meet the vehicle ECU (Electronic Control Unit)'s monitoring needs for multi-channel Ethernet status. Summary of the invention

[0003] In view of the above problems, embodiments of the present application provide a port testing method, device, system and vehicle to overcome the above problems or at least partially solve the above problems.

[0004] In a first aspect of an embodiment of the present application, a port testing method is provided for testing multiple ports of a switch, the method comprising:

[0005] The plurality of ports are organized into a closed loop link; wherein a first port among the plurality of ports is a starting node and an ending node in the closed loop link, and a second port among the plurality of ports except the first port is an intermediate node in the closed loop link;

[0006] Sending a test message to the first port so that the test message is transmitted in the closed ring link;

[0007] Acquire a return message outputted through the first port after the test message is transmitted in the closed loop link;

[0008] Based on the returned message, it is determined whether the functions of the multiple ports are normal.

[0009] Further, the plurality of the second ports include two third ports connected to the first port, and the test message carries a label;

[0010] The step of sending a test message to the first port so that the test message is transmitted in the closed ring link includes:

[0011] Sending the test message to the first port, so that the first port is used to determine a target port from the two third ports according to the label;

[0012] The test message is sent from the first port to the target port, so that after the test message is transmitted through the target port, it is fed back to the first port from the port other than the target port among the two third ports.

[0013] Furthermore, during the transmission of the test message in the closed loop link, the method further includes:

[0014] Using the second port currently receiving the test message to perform label processing on the label, so that the test message is sent to the next second port;

[0015] The label processing includes: if the received test message carries the label, stripping the label; if the received test message does not carry the label, adding the label.

[0016] Further, forming a first port and a plurality of second ports among the plurality of ports into a closed ring link comprises:

[0017] Obtaining an arrangement order among the multiple ports;

[0018] Based on the arrangement order, determining a connection mode between two adjacent ports on the closed loop link; wherein the connection mode includes a wiring harness connection and a local area network connection;

[0019] Based on the connection mode, a plurality of the ports are organized into the closed ring link.

[0020] Further, determining the connection mode between two adjacently connected ports on the closed ring link based on the arrangement order includes:

[0021] In the case where the port types of two adjacent ports on the closed loop link are the same, determining that the two ports are connected as the wiring harness;

[0022] In the case that the port types of two adjacently connected ports on the closed ring link are the same, the two ports are determined to be the local area network connections.

[0023] Further, determining whether the functions of the multiple ports are normal based on the returned message includes:

[0024] Obtaining a transmission direction of the test message in the closed loop link;

[0025] Based on the transmission direction, determining a preset return message; wherein the preset return message is a test message of a correct test result returned by the first port when the multiple ports function normally;

[0026] Based on comparing the returned message with the preset returned message, it is determined whether the functions of the multiple ports are normal.

[0027] Further, the comparing the returned message with the preset returned message to determine whether the functions of the multiple ports are normal includes:

[0028] Within a preset test period, obtaining a first number of times the test message is sent and a second number of times the return message is output by the first port;

[0029] Based on the difference between the first number and the second number, and the difference between the returned message and the preset returned message, it is determined whether the multiple ports are normal.

[0030] In a second aspect of an embodiment of the present application, a port testing device is provided for testing multiple ports of a switch, the device comprising:

[0031] A building module, used to build the multiple ports into a closed ring link; wherein the first port among the multiple ports is a starting node and an ending node in the closed ring link, and the second port among the multiple ports except the first port is an intermediate node in the closed ring link;

[0032] A sending module, configured to send a test message to the first port so that the test message is transmitted in the closed ring link;

[0033] An acquisition module, used for acquiring a return message outputted via the first port after the test message is transmitted in the closed ring link;

[0034] The determination module is used to determine whether the functions of the multiple ports are normal based on the returned message.

[0035] Further, the plurality of the second ports include two third ports connected to the first port, and the test message carries a label;

[0036] Wherein, the sending module includes:

[0037] A first determining module, configured to send the test message to the first port, so that the first port is used to determine a target port from the two third ports according to the label;

[0038] The test message is sent from the first port to the target port, so that after the test message is transmitted through the target port, it is fed back to the first port from the port other than the target port among the two third ports.

[0039] Furthermore, during the transmission of the test message in the closed ring link, the sending module further includes:

[0040] a configuration module, configured to perform label processing on the label by using the second port currently receiving the test message, so that the test message is sent to the next second port;

[0041] The label processing includes: if the received test message carries the label, stripping the label; if the received test message does not carry the label, adding the label.

[0042] Furthermore, the building module includes:

[0043] A first acquisition module, used to acquire an arrangement order between the multiple ports;

[0044] Based on the arrangement order, determining a connection mode between two adjacent ports on the closed loop link; wherein the connection mode includes a wiring harness connection and a local area network connection;

[0045] Based on the connection mode, a plurality of the ports are organized into the closed ring link.

[0046] Furthermore, the first acquisition module includes:

[0047] A second determination module is used to determine that two ports connected adjacent to each other on the closed loop link are connected as the wiring harness when the port types of the two ports are the same;

[0048] In the case that the port types of two adjacently connected ports on the closed ring link are the same, the two ports are determined to be the local area network connections.

[0049] Furthermore, the determination module includes:

[0050] A second acquisition module, used to acquire the transmission direction of the test message in the closed ring link;

[0051] Based on the transmission direction, determining a preset return message; wherein the preset return message is a message of a correct test result returned by the first port when the multiple ports function normally;

[0052] Based on comparing the returned message with the preset returned message, it is determined whether the functions of the multiple ports are normal.

[0053] Furthermore, the first acquisition module includes:

[0054] A third determining module, configured to obtain, within a preset test period, a first number of times the test message is sent and a second number of times the return message is output by the first port;

[0055] Based on the difference between the first number and the second number, and the difference between the returned message and the preset returned message, it is determined whether the multiple ports are normal.

[0056] According to a third aspect of an embodiment of the present application, a port testing system is provided, the system comprising: a main controller and a switch connected to the main controller; wherein the switch comprises a plurality of ports, the plurality of ports comprising a first port connected to the main controller, and a plurality of second ports; wherein the main controller is used to execute the port testing method as described in the first aspect of the embodiment of the present application.

[0057] According to a fourth aspect of the embodiments of the present application, a vehicle is provided, wherein the vehicle comprises the port testing device according to the second aspect of the embodiments of the present application.

[0058] A port testing method provided by this embodiment first forms a plurality of ports into a closed ring link; a first port among the plurality of ports is a starting node and an ending node in the closed ring link, and a second port among the plurality of ports except the first port is an intermediate node in the closed ring link, and then a test message is sent to the first port so that the test message is transmitted in the closed ring link; a return message outputted by the first port after the test message is transmitted in the closed ring link is obtained; and finally, based on the return message, it is determined whether the functions of the plurality of ports are normal.

[0059] By connecting the first port of the switch with multiple second ports to form a closed loop link, all ports in the entire closed loop link can be tested only by sending a test message to the first port, avoiding the cumbersome process of sending a test message to each port separately. Secondly, after the test message is transmitted in the closed loop link, it is only necessary to detect the return message output by the first port to determine whether the functions of multiple ports are normal at one time, thereby improving the detection efficiency. The setting of the closed loop link allows the first port to serve as the starting and ending node, replacing the original method of requiring multiple Ethernet boxes to connect each port separately. In this way, the first port is connected to an external detection device (such as a computer) as a single connection point, solving the problem of being unable to connect directly due to port differences. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.

[0061] Figure 1 is a flow chart of the steps of a port testing method provided in an embodiment of the present application;

[0062] Figure 2 is a schematic diagram of a port testing system and external devices provided in an embodiment of the present application;

[0063] Figure 3 It is a schematic diagram of a configuration table provided in an application embodiment;

[0064] Figure 4 against Figure 2 and Figure 3 A flow chart of the steps of a port test is provided;

[0065] Figure 5 It is a schematic diagram of a port testing device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0066] The exemplary embodiments of the present application will be described in more detail below in conjunction with the accompanying drawings in the embodiments of the present application. Although the exemplary embodiments of the present application are shown in the accompanying drawings, it should be understood that the present application can be implemented in various forms and should not be limited by the embodiments set forth herein. On the contrary, these embodiments are provided in order to enable a more thorough understanding of the present application and to enable the scope of the present application to be fully conveyed to those skilled in the art.

[0067] In the existing scheme, generally, an Ethernet box is set up for each port to connect an Ethernet and then transfer it to a computer, and then the computer tests the port. In practice, there are different port types in the switch, and the interfaces of the Ethernet boxes corresponding to different port types are also different. For Ethernet boxes, most of them are boxes with 100M interfaces, and there are very few boxes with other types of interfaces. It is very inconvenient and costly to use Ethernet boxes as adapters to assist computers in testing the ports of switches.

[0068] In view of this, the present embodiment provides a port testing method to solve the above problem, by connecting the first port of the multiple ports of the switch with the multiple second ports to form a closed ring link, then connecting the first port to an external device, and then sending a test message to the port to transmit it in the closed ring link. The external device can be a computer or a microcontroller, which is a device for sending a test message to the first port. By obtaining the return message through the first port and detecting the return message, the functional status of all ports in the switch can be determined at one time, avoiding the tedious process of configuring and detecting each port separately, and improving the detection efficiency.

[0069] Specifically, refer to Figure 1 , Figure 1 is a flow chart of the steps of a port testing method provided in an embodiment of the present application, Figure 1 The port test method in is used to test multiple ports of a switch. Figure 1 The steps of the process include:

[0070] Step S101: forming the plurality of ports into a closed loop link; wherein the first port among the plurality of ports is a starting node and an ending node in the closed loop link, and the second port among the plurality of ports except the first port is an intermediate node in the closed loop link.

[0071] In this embodiment, there are multiple ports in the switch, and the port types of the multiple ports can be the same or different. The first port and the second port of the multiple ports are formed into a closed ring link, and the closed ring link is connected end to end, and the first port is the starting node and the ending node in the closed ring link. The first port in the closed ring link can be configured to connect to an external device, simplifying the connection with the external device. Therefore, only one first port is used as an interface for receiving test messages and outputting return messages, which can solve the problem of being unable to directly connect to external devices due to differences in port types and requiring multiple Ethernet boxes to switch, thereby improving the compatibility between in-vehicle Ethernet and traditional Ethernet. The external device is a device that performs functional detection on multiple ports in the switch, which can be a computer or other detection equipment.

[0072] Step S102: Send a test message to the first port, so that the test message is transmitted in the closed ring link.

[0073] In this embodiment, since a MAC address table can be configured inside the switch, and the MAC address table records the corresponding information of all MAC addresses in the network and each port of the switch, when a port of the switch receives an Ethernet message, it will parse the Ethernet message, and search the MAC address table according to the destination MAC address of the test message frame, so as to obtain the port corresponding to the address and then forward the test message to the port. If the destination MAC address in the test message frame is not in the MAC address table, it will be forwarded to all ports. If the sent test message is a broadcast frame or a multicast frame, it will also be forwarded to all ports.

[0074] Therefore, referring to the logic of forwarding messages inside the switch, the multiple ports in the switch are configured accordingly, and the external device can send a test message to the first port so that the test message enters the closed ring link through the first port for transmission. Then, based on the transmission status of the test message in the closed ring link, the functional status of each port in the switch and the connection status with the external device can be verified.

[0075] Step S103: obtaining a return message outputted via the first port after the test message is transmitted in the closed ring link.

[0076] In this embodiment, since the test message has been sent to the first port, after the test message is sent to the first port, it will be processed and forwarded in sequence through all the second ports in the closed ring link until it is forwarded to the first port after the last processing is completed, and then the first port outputs the return message after the closed ring link test is completed.

[0077] Step S104: Based on the returned message, determine whether the functions of the multiple ports are normal.

[0078] In this embodiment, since each second port in the closed ring link processes the test message, the information carried in the test message is adjusted during the processing. Since the closed ring link is established before the test message, it is possible to know the corresponding correct preset return message outputted by the first port after the test message is transmitted in the closed ring link.

[0079] Therefore, by comparing the return message with the preset return message, when the return message is consistent with the preset return message, it can be determined that the functions of multiple ports in the switch are normal. In practice, if there is an impact of the environment, some errors are allowed, and it can also be determined that the difference between the return message and the preset return message is not large, and the functions of multiple ports in the switch are determined to be normal.

[0080] Through the port testing method provided in this embodiment, the first port of the switch can be connected to multiple second ports to form a closed ring link, and the first port can be connected to an external device (such as a computer), and a test message can be sent to transmit it in the closed ring link. By detecting the test message returned by the first port, the functional status of all ports in the switch can be determined at one time, avoiding the tedious process of configuring and testing the ports one by one, and improving the detection efficiency.

[0081] In a specific embodiment, the plurality of second ports include two third ports connected to the first port, and the test message carries a label; and sending the test message to the first port so that the test message is transmitted in the closed ring link may include the following steps:

[0082] First, the test message is sent to the first port so that the first port is used to determine the target port from the two third ports according to the label; then the test message is sent to the target port by the first port so that after the test message is transmitted through the target port, it is fed back to the first port by the port of the two third ports except the target port.

[0083] In this embodiment, since the link formed by the first port and the second port is a closed ring link, there are two third ports connected to the first port among the multiple second ports, and the first port is the starting node and the ending node in the closed ring link, then for the closed ring link, there will be two directions for the transmission direction of the test message in the closed ring link. If the two third ports are A and B, respectively, assuming that the direction of transmission along A is the first direction, then the direction opposite to the first direction is the direction of transmission along B, which is recorded as the second direction. The starting node and the ending node are determined according to the transmission direction of the test message in the closed ring link. The test message is transmitted in different directions through the first port, and finally different return messages are output through the first port.

[0084] For example, assuming that there are four second ports, Port0, Port1, Port2 and Port3, Port9 is a first port, Port0 and Port3 are third ports, assuming that the first direction is Port9→Port0→Port1→Port2→Port3→Port9, then the second direction is Port9→Port3→Port2→Port1→Port0→Port9. Since the results of the return messages corresponding to the first direction and the second direction are different, in order to ensure the correctness of the preset return message, a label can be added to the test message to indicate that the test message is transmitted in the transmission direction indicated by the label through the added label.

[0085] Therefore, after the first port receives the test message, the first port will determine the third port corresponding to the label from the two third ports adjacent to the first port according to the label carried by the test message, that is, the target port. If the label indicates that Port0 is the target port, the test message sent by the first port will be transmitted to Port0. If the label indicates that Port3 is the target port, the test message sent by the first port will be transmitted to Port3. Since the transmission mode of the closed ring link is unidirectional transmission, it is only necessary to add the label corresponding to Port3 or Port0 in the test message to determine the transmission direction. At the same time, after the first port recognizes the label carried in the test message, it can also determine the transmission direction of the test message. In this embodiment, the label carried in the test message can be a local area network label, that is, Port0 and Port9, Port3 and Port9 are respectively set with different local area networks, Port9 is different from Port0 and Port3 in port type, and cannot be directly connected through a harness. If the test message carries the same local area network label as Port0 and Port9, Port9 can recognize and directly transmit the test message to Port0.

[0086] In a specific embodiment, during the transmission of the test message in the closed ring link, the method may further include the following steps:

[0087] The label is processed by the second port currently receiving the test message so that the test message is sent to the next second port; wherein the label processing includes: when the received test message carries the label, stripping the label; when the received test message does not carry the label, adding the label.

[0088] In this embodiment, since the closed ring link has two transmission directions and the transmission mode of the closed ring link is unidirectional transmission, in order to ensure that the test is correctly and sequentially transmitted in the closed ring link and to facilitate the distinction between the return messages finally obtained by the first direction and the second direction transmission, the second port configuration as an intermediate node is also used to process the label carried by the test message. In this embodiment, the first port is only used to connect to an external device and only forwards the test message, but does not process the test message.

[0089] The following further describes the label processing in the test message by taking the test message as an example, when the test message is transmitted in the first direction:

[0090] After the tag corresponding to Port0 is added to the test message, it is sent to Port9. Port9 will identify the tag in the test message and determine that the next second port to receive the test message is Port0. After receiving the test message, Port0 will still read the information of the test message and the configuration table corresponding to multiple ports in the switch. The configuration table contains tags corresponding to multiple ports in the switch, and one tag corresponds to two ports. Then it is determined that the next second port to receive the test message is Port1. If there is a tag, the tag will be deleted and the test message will be forwarded to Port1, which is the next port to receive the test message. If the tag is not deleted, it may indicate that the next second port to receive the test message of Port1 is Port0, which does not meet the unidirectional transmission along the first direction.

[0091] If the received test message does not carry a label, it is necessary to add the label corresponding to the second port currently receiving the test message to the test message so that the next second port receiving the test message can know the source of the test message. For example, if the second port is Port1, the label corresponding to Port1 is added to the test message. If Port2 receives this test message, it knows that the test message is transmitted along the first direction. Then, in the configuration table, it can be found that the next second port receiving the test message transmitted along the first direction is Port3. If the label corresponding to Port2 is not added, by querying the configuration table, it can be obtained that the next second port receiving the test message is Port1 and Port3. There are second ports in two directions, which cannot meet the requirement of unidirectional transmission of the test message.

[0092] Therefore, when the test message received at the second port carries a label, the label is stripped for forwarding. When the test message received at the second port does not carry a label, the label is added for forwarding. Then, when the test message is transmitted in the closed ring link, in addition, multiple second ports are generally paired in pairs, and bidirectional sending and receiving of test messages can be realized. When multiple ports function normally, if the test message is transmitted in the first direction, the final return message will carry the same label as Port3. If the test message is transmitted in the second direction, the final return message will carry the same label as Port0. It should be noted in this embodiment that the label addition process refers to adding a label corresponding to the second port that currently processes the test message, so that it is easy to identify whether the return message is correct.

[0093] In a specific embodiment, forming a closed ring link with a first port and a plurality of second ports among the plurality of ports may include the following steps:

[0094] First, the arrangement order between the multiple ports is obtained; then, based on the arrangement order, the connection mode between two adjacent ports on the closed loop link is determined; wherein the connection mode includes a wiring harness connection and a local area network connection; finally, based on the connection mode, the multiple ports are organized into the closed loop link.

[0095] In this embodiment, a first port among multiple ports and multiple second ports are formed into a closed ring link. The same port type means that the communication rate of the ports is the same. When the port types are the same, a wiring harness connection method can be selected for transmission. However, there are ports of different port types in the switch, and only wiring harness connection cannot meet the needs. Therefore, in order to meet the transmission between ports of different port types, a local area network connection method is introduced to connect different types of interfaces. Since the transmission of the test message in the closed ring link is a one-way transmission, that is, it is transmitted along a predetermined route, it is necessary to obtain the arrangement order between the multiple ports. Through the arrangement order, the port type corresponding to each of the two adjacent ports can be known, and then the connection method is determined according to the port type. Finally, through the connection method of the first port among the multiple ports and the multiple second ports, the multiple ports are formed into a closed ring link.

[0096] In a specific embodiment, determining the connection mode between two adjacent ports on the closed loop link based on the arrangement order may include the following steps: when the port types of two adjacent ports on the closed loop link are the same, determining that the two ports are connected as the wiring harness; when the port types of two adjacent ports on the closed loop link are the same, determining that the two ports are connected as the local area network.

[0097] In this embodiment, since the port types of two adjacent ports on the closed ring link can be known according to the arrangement order, when the port types are the same, the forwarding and reception of the test message can be realized through the wire harness connection. When the port types are different, the forwarding and reception of the test message cannot be realized through the wire harness connection. The LAN connection will be selected to realize the forwarding and reception of the test message between the two ports with different port types. In a specific embodiment, the determination of whether the functions of the multiple ports are normal based on the return message may include the following steps:

[0098] First, the transmission direction of the test message in the closed ring link is obtained; then, based on the transmission direction, a preset return message is determined; wherein, the preset return message is a message of correct test results returned by the first port when the multiple ports function normally; finally, based on the comparison between the return message and the preset return message, it is determined whether the functions of the multiple ports are normal.

[0099] In this embodiment, when determining whether the functions of multiple ports are normal through return messages, the transmission direction of the test message in the closed ring link can be first obtained, which can be specifically known through the label carried by the test message. By knowing the transmission direction through the label, it is possible to predict that when the multiple ports are functioning normally, the message with the correct test result returned by the first port can be obtained, that is, the preset return message.

[0100] For example, assume that a closed ring link consists of five ports (Port0, Port1, Port2, Port3, Port9), and the ports are connected in sequence to form a ring. The test message is sent from Port9, Port1 is the first port, and the remaining ports are the second ports. Port9 sends a test message. Because it is a closed ring link, the test message passes through Port1, Port2 and Port3 in sequence in the ring, and finally reaches Port9. Under normal function conditions, the test message should return from Port3 to Port9. Therefore, the preset return message is transmitted from Port3 to Port9, and the message carries the label of Port9. If the return message output by Port1 does not carry the label of Port3, it proves that the functions of multiple ports are abnormal. If the return message output by Port1 carries the label of Port3, it proves that the functions of multiple ports are normal.

[0101] In a specific embodiment, the determination of whether the functions of the multiple ports are normal based on comparing the return message with the preset return message may include the following steps: within a preset test cycle, obtaining a first number of times the test message is sent and a second number of times the return message is output by the first port; based on the difference between the first number and the second number, and the difference between the return message and the preset return message, determining whether the multiple ports are normal.

[0102] In this embodiment, in order to verify whether multiple ports are normal and avoid accidental faults that erroneously determine that multiple ports are abnormal, it is generally selected to continuously send test messages to the first port multiple times within a period of time. Therefore, within a preset test cycle, the difference between the first number of times the test message is sent and the second number of times the return message output by the first port, as well as the difference between the return message and the preset return message are obtained to jointly determine whether the multiple ports are normal. Assuming that the allowable error is within 5%, the first number is 100, the second number is 96, and the difference between the first number and the second number is 4, which is within the allowable error range, and the return message is consistent with the preset return message and is also within the allowable error range, then the multiple ports are determined to be normal. If there is a difference between the first number of times the test message is sent and the second number of times the return message output by the first port, or the difference between the return message and the preset return message exceeds the allowable error range, then the multiple ports of the switch are determined to be abnormal.

[0103] An embodiment of the present application also provides a port testing system, which includes: a main controller and a switch connected to the main controller; wherein the switch includes multiple ports, the multiple ports including a first port connected to the main controller, and multiple second ports; wherein the main controller is used to execute the port testing method as described in the embodiment.

[0104] In this embodiment, combined with Figure 2-Figure 4 The port testing method provided in this embodiment is applied to multiple port testing in a switch, and is described in detail:

[0105] Reference Figure 2 , Figure 2 is a schematic diagram of a port test system and external devices provided in an embodiment of the present application; Figure 2 It can be seen that MCU (Microcontroller Unit) is the main controller, and the switch is connected to the MCU. The switch and MCU are part of the electronic control unit on the vehicle. In this way, the MCU can be directly connected to the external device (computer) without the need to connect each port in the switch to the computer for detection through an Ethernet box. The switch has 5 Ethernet channels, namely Port0, Port1, Port2, Port3 and Port9. Assume that the interface type of Port0 and Port1 is the same, which is a 100BASE_T1 interface, and the interface type of Port2 and Port3 is the same, which is a 1000BASE_T1 interface. Port0, Port1, Port2, Port3 are the second ports, and Port9 is the first port.

[0106] The connection method of each Ethernet channel is:

[0107] Port9 and MCU are connected through the SGMII protocol between MCU and Port9, and four wires are used for connection, namely TX - data transmission signal line, TXCLK - data transmission clock line signal line, RX - data reception signal line, and RXCLK - data reception clock line. Port0 and Port1 are connected through a harness. The harness of 100BASE_T1 has two wires, which can be connected at will regardless of positive and negative poles. Port2 and Port3 are connected through a harness. The harness of 1000BASE_T1 also has two wires, but there is a difference in positive and negative poles. When connecting, the positive pole needs to be connected to the positive pole, and the negative pole needs to be connected to the negative pole, otherwise normal communication will not be possible. The CAN of the computer and the MCU is connected through a harness plus a CAN adapter box.

[0108] In the Ethernet message forwarding of the switch, the IEEE 802.1Q protocol will add a 4-byte LAN tag to the ordinary Ethernet message, among which there is a test message that is the tag corresponding to each port. Ports with the same LAN will be divided into a virtual LAN, that is, the same tag. They can communicate with each other, but ports in different LANs cannot communicate with each other. You can also configure the tag function during configuration. Generally, the tag functions are tag Port (tag port) and untag Port (untag port). When a port configured with tag Port receives a test message with a tag, it compares it with its own tag. If it is different, it discards the test message. If it is the same, it forwards it according to the original test message. When receiving a test message without a tag, it adds its own tag to the test message and then forwards it. When a port configured with untag Port receives a test message with a tag, it removes the tag and forwards it. When receiving a test message without a tag, it adds its own tag to the test message and then forwards it.

[0109] Reference Figure 3 , Figure 3 is a schematic diagram of a configuration table provided in the application embodiment, from Figure 3 As can be seen, the configuration of the switch is as follows:

[0110] First, configure the basic configuration of each port of the switch, mainly configuring the default label, that is, the label and the master-slave mode. Other configurations can keep the default values. The port with label 10 can receive all test messages. Ethernet is a point-to-point communication, and both ends need to be master and slave. Port9 is configured with the default label 10 and connected to the ETH (Ethernet) pin of the MCU. It uses the RMII protocol and cannot be configured with the master-slave mode. Port0 is configured with the default label 10 and the configuration mode is slave mode. Port1 is configured with the default label 11 and the configuration mode is master mode. Port2 is configured with the default label 12 and the configuration mode is slave mode. Port3 is configured with the default label 13 and the configuration mode is slave mode. In addition, the industrial Ethernet does not need to be configured with the master-slave mode, and the two ports can automatically negotiate to determine the role. Configuring the master-slave of the automotive Ethernet can reduce the time for the successful connection between the two ports, because the car has requirements for the startup time. The master device can control and decide when to send the test message, and the slave device can receive and process the data transmission.

[0111] from Figure 3 As can be seen, the main members (Member Ports) with the configuration tag (Valid VLAN ID) of 10 are Port0 and Port9, the main members with the configuration tag of 11 are Port1 and Port2; the members with the configuration tag of 13 are Port3 and Port9. Port0, Port1, Port2 and Port3 are all configured as Untagged Ports, that is, when receiving a test message without a tag, the test message will be forwarded with its own tag added. When receiving a test message with a tag, the tag will be removed and forwarded. When receiving a test message without a tag, the test message will be forwarded with its own tag added.

[0112] Therefore, for Figure 2 Generally speaking, the entire communication process consists of three communication modes. The first is the communication between MCU and switch, which sends and receives test messages through hardware-designed circuits. The second is the Ethernet test message with a label. After receiving the test message, the first port queries the configuration table to determine the second port with the same configuration label, and then forwards the test message to the second port with the same configuration label. The third is the test message without a label, which is transmitted between the ports of the switch through the connection of the wiring harness.

[0113] exist Figure 3 After the configuration table is completed, you can test multiple ports in the switch. The test process refers to Figure 4 , Figure 4 against Figure 2 and Figure 3 A flow chart of the steps of a port test is provided; the flow chart includes:

[0114] Step S401: the MCU sends a test message with a label of 10, and the number of sent test messages increases by one.

[0115] Step S402: Port 9 receives the test message and forwards the test message.

[0116] Step S403: Query the configuration table.

[0117] Step S404: Port0 receives the test message and sends the test message without a label.

[0118] Step S405: Port 1 receives the test message and adds a label to forward it.

[0119] Step S406: Query the configuration table.

[0120] Step S407: Port 2 receives the test message and sends a test message without a label.

[0121] Step S408: Port 3 receives the test message and adds a label to forward it.

[0122] Step S409: Query the configuration table.

[0123] Step S410: Port 1 receives the return message, forwards it to the MCU, and increases the number of received test messages by one.

[0124] Step S411: The number of test messages sent and returned messages received is fed back to the computer

[0125] The process of steps S401 to S411 is explained as follows: the MCU performs test message grouping, records the number of Ethernet messages sent plus one, and sends a test message with label 10 to Port9. Since Port9 is configured with label 10, it will receive all test messages with label 10, and then query the configuration table. The only members configured with label 10 in the table are Port0 and Port9, so the test message with label 10 received by Port9 will be forwarded to Port0. Port0 is configured with the label function. When sending a test message, the label in the message will be stripped, and then the test message will be forwarded to Port1 connected by the wiring harness. At this time, the test message received by Port1 has no label. Since Port1 is configured with the label function, it will add its own label to the test message without a label and then forward it. Therefore, data with label 11 is added to the message. Then the configuration table is queried. The members configured with label 11 are Port1 and Port2, so Port2 receives the test message. Port2 is configured as an untag Port, so it will strip the label and then send the test message to Port3 connected by the wiring harness. Port3 adds a test message with label 13 and forwards it to Port9. Port9 then sends the test message to the MCU. At this time, the MCU determines whether the label in the received test message is equal to 13. If so, the number of Ethernet received messages is recorded plus one. The MCU feeds back the number of Ethernet test messages sent and the number of received return messages to the computer through CAN. Considering that there will be a certain delay in the mutual forwarding of test messages in Ethernet, this process can be carried out in a cycle of 100ms. It is normal for the number of received and sent to differ slightly, and there will be a small amount of packet loss in the returned message. When the number of received is 0 or the difference is large, it can be judged that the wiring harness connection is poor, resulting in some test messages not completing the entire process. The tester can judge the communication status of Ethernet based on the comparison of the number.

[0126] Reference Figure 5 , Figure 5 It is a schematic diagram of a port testing device provided in an embodiment of the present application. Figure 5 The provided port testing device is used to test multiple ports of a switch. The device includes: a building module 501, a sending module 502, an acquisition module 503 and a determination module 504. Each module is configured to have the following functions:

[0127] The assembly module 501 is used to assemble the multiple ports into a closed ring link; wherein the first port among the multiple ports is the starting node and the ending node in the closed ring link, and the second port among the multiple ports except the first port is the intermediate node in the closed ring link.

[0128] The sending module 502 is configured to send a test message to the first port, so that the test message is transmitted in the closed ring link.

[0129] The acquisition module 503 is used to acquire a return message outputted via the first port after the test message is transmitted in the closed ring link.

[0130] The determination module 504 is configured to determine whether the functions of the multiple ports are normal based on the returned message.

[0131] In this embodiment, the plurality of second ports include two third ports connected to the first port, and the test message carries a label;

[0132] Among them, the sending module 502 includes: a first determination module, used to send the test message to the first port, so that the first port is used to determine the target port from the two third ports according to the label; the first port sends the test message to the target port, so that after the test message is transmitted through the target port, it is fed back to the first port by the port of the two third ports except the target port.

[0133] In this embodiment, during the transmission of the test message in the closed ring link, the sending module 502 further includes:

[0134] A configuration module is used to perform label processing on the label using the second port that currently receives the test message so that the test message is sent to the next second port; wherein the label processing includes: when the received test message carries the label, stripping the label; when the received test message does not carry the label, adding the label.

[0135] In this embodiment, the assembly module includes: a first acquisition module, used to obtain the arrangement order between the multiple ports; based on the arrangement order, determining the connection mode between two adjacent ports on the closed loop link; wherein the connection mode includes a wiring harness connection and a local area network connection; based on the connection mode, the multiple ports are assembled into the closed loop link.

[0136] In this embodiment, the first acquisition module includes: a second determination module, which is used to determine that the two ports are connected as the wiring harness when the port types of two adjacent ports on the closed loop link are the same; and to determine that the two ports are connected as the local area network when the port types of two adjacent ports on the closed loop link are the same.

[0137] In this embodiment, the determination module includes: a second acquisition module, used to obtain the transmission direction of the test message in the closed ring link; based on the transmission direction, determine a preset return message; wherein the preset return message is a message of correct test results returned by the first port when the multiple ports are functioning normally; based on comparing the return message with the preset return message, determine whether the functions of the multiple ports are normal.

[0138] In this embodiment, the first acquisition module includes: a third determination module, which is used to obtain the first number of times the test message is sent and the second number of times the return message is output by the first port within a preset test cycle; based on the difference between the first number and the second number, and the difference between the return message and the preset return message, determine whether the multiple ports are normal.

[0139] An embodiment of the present application further provides a vehicle, which includes the port testing device described in this embodiment.

[0140] The various embodiments in this specification are described in a progressive manner, and each embodiment focuses on the differences from other embodiments. The same or similar parts between the various embodiments can be referenced to each other.

[0141] The embodiments of the present invention are described with reference to the flowcharts and / or block diagrams of the methods and apparatuses according to the embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of the processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable test message processing terminal device to generate a machine, so that the instructions executed by the processor of the computer or other programmable test message processing terminal device generate instructions for implementing the process in the flowchart. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0142] These computer program instructions may also be stored in a computer readable memory capable of directing a computer or other programmable test message processing terminal device to operate in a specific manner, so that the instructions stored in the computer readable memory produce a manufactured product including an instruction device, which is implemented in the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0143] These computer program instructions may also be loaded onto a computer or other programmable test message processing terminal device, so that a series of operating steps are executed on the computer or other programmable terminal device to produce a computer-implemented process, thereby providing instructions executed on the computer or other programmable terminal device for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0144] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the embodiments of the present invention.

[0145] Finally, it should be noted that, in this article, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the terms "include", "comprise" or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article or terminal device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, article or terminal device. In the absence of further restrictions, the elements defined by the sentence "including one..." do not exclude the existence of other identical elements in the process, method, article or terminal device including the elements.

[0146] The above is a detailed introduction to a port testing method, device, system and vehicle provided by the present invention. Specific examples are used in this article to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only used to help understand the method of the present invention and its core idea; at the same time, for general technical personnel in this field, according to the idea of ​​the present invention, there will be changes in the specific implementation method and application scope. In summary, the content of this specification should not be understood as a limitation on the present invention.

Claims

1. A port testing method for testing multiple ports of a switch, characterized in that: The method comprises: The plurality of ports are organized into a closed loop link; wherein a first port among the plurality of ports is a starting node and an ending node in the closed loop link, and a second port among the plurality of ports except the first port is an intermediate node in the closed loop link; Sending a test message to the first port so that the test message is transmitted in the closed ring link; Acquire a return message outputted through the first port after the test message is transmitted in the closed loop link; Based on the returned message, it is determined whether the functions of the multiple ports are normal.

2. The port testing method according to claim 1, characterized in that: The plurality of second ports include two third ports connected to the first port, and the test message carries a label; The step of sending a test message to the first port so that the test message is transmitted in the closed ring link includes: Sending the test message to the first port, so that the first port is used to determine a target port from the two third ports according to the label; The test message is sent from the first port to the target port, so that after the test message is transmitted through the target port, it is fed back to the first port from the port other than the target port among the two third ports.

3. The port testing method according to claim 2, characterized in that: During the transmission of the test message in the closed loop link, the method further includes: Using the second port currently receiving the test message to perform label processing on the label, so that the test message is sent to the next second port; The label processing includes: if the received test message carries the label, stripping the label; if the received test message does not carry the label, adding the label.

4. The port testing method according to claim 1, characterized in that: The step of forming a closed ring link with a first port and a plurality of second ports among the plurality of ports includes: Obtaining an arrangement order among the multiple ports; Based on the arrangement order, determining a connection mode between two adjacent ports on the closed loop link; wherein the connection mode includes a wiring harness connection and a local area network connection; Based on the connection mode, a plurality of the ports are organized into the closed ring link.

5. The port testing method according to claim 4, characterized in that: The step of determining, based on the arrangement order, a connection mode between two adjacently connected ports on the closed ring link comprises: In the case where the port types of two adjacent ports on the closed loop link are the same, determining that the two ports are connected as the wiring harness; In the case that the port types of two adjacently connected ports on the closed ring link are the same, the two ports are determined to be the local area network connections.

6. The port testing method according to claim 2, characterized in that: The determining, based on the returned message, whether the functions of the multiple ports are normal includes: Obtaining a transmission direction of the test message in the closed loop link; Based on the transmission direction, determining a preset return message; wherein the preset return message is a test message of a correct test result returned by the first port when the multiple ports function normally; Based on comparing the returned message with the preset returned message, it is determined whether the functions of the multiple ports are normal.

7. The port testing method according to claim 6, characterized in that: The comparing the returned message with the preset returned message to determine whether the functions of the multiple ports are normal includes: Within a preset test period, obtaining a first number of times the test message is sent and a second number of times the return message is output by the first port; Based on the difference between the first number and the second number, and the difference between the returned message and the preset returned message, it is determined whether the multiple ports are normal.

8. A port testing device for testing multiple ports of a switch, characterized in that: The device comprises: A building module, used to build a first port and a plurality of second ports among the plurality of ports into a closed ring link; wherein the first port is configured to be connected to an external device, and the second port is a port among the plurality of ports except the first port; A sending module, configured to send a test message to the first port so that the test message is transmitted in the closed ring link; An acquisition module, used for acquiring a return message outputted via the first port after the test message is transmitted in the closed ring link; The determination module is used to determine whether the functions of the multiple ports are normal based on the returned message.

9. A port testing system, characterized in that: The system comprises: a main controller and a switch connected to the main controller; wherein the switch comprises a plurality of ports, the plurality of ports comprising a first port connected to the main controller, and a plurality of second ports; wherein the main controller is used to execute the port testing method described in any one of claims 1 to 7.

10. A vehicle, characterized in that: The vehicle includes the port testing device of claim 8.

Citation Information

Patent Citations

  • Method for testing port connectivity of switch

    CN102664774A

  • Method and device for testing Ethernet passive optical network devices

    CN102917285A

  • Method and network device for loop detection

    CN103973509A

  • Ethernet link test method, terminal and storage medium

    CN111314180A

  • Vehicle-mounted Ethernet loopback test method and system based on BroadR-Reach technology

    CN112104466A

Cited By

  • Interface test method, device and test system of cockpit domain controller

    CN120143795A

  • Method for constructing multilayer octagonal network structure, method for determining path of multilayer octagonal network structure and switch

    CN120880962A