Switch test method and system, electronic equipment and storage medium

The switch testing method automates the configuration and testing of switches using simulation messages, addressing inefficiencies in traditional manual methods by ensuring accurate and efficient testing across various scenarios, thereby enhancing switch performance in real-time communication systems.

CN119254659APending Publication Date: 2025-01-03GREAT WALL MOTOR CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411363554.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-27
Publication Date
2025-01-03

AI Technical Summary

Technical Problem

Traditional manual testing methods for the Qci protocol in switches are inefficient, prone to errors, and cannot meet the requirements of large-scale testing and complex network environments, failing to fully cover all possible traffic scenarios and configurations.

Method used

A switch testing method and system that automatically configures and tests switches by sending simulation messages, filtering test messages based on port configuration information, and determining test results without manual intervention, utilizing priority identification, frame length filtering, and rate limit filtering.

Benefits of technology

Improves testing efficiency and effectiveness by automatically configuring and testing switch ports, ensuring compliance with large-scale and diverse testing scenarios, reducing errors, and enhancing the reliability of switch performance in real-time communication applications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119254659A_ABST
    Figure CN119254659A_ABST
Patent Text Reader

Abstract

The embodiment of the invention relates to the technical field of switches, and provides a switch test method and system, an electronic device and a storage medium, applied to a switch test system, the switch test system comprises a host, a test device and a to-be-tested switch, and the test device is in communication connection with the host and the to-be-tested switch. The method comprises the following steps: in response to configuration completion for a switch to be tested, sending a test message to the switch to be tested through test equipment; obtaining port configuration information of the to-be-tested switch, filtering the test message based on the port configuration information through the to-be-tested switch, and returning a forwarding message; and displaying the forwarding message through the host, and determining that the test result of the to-be-tested switch is qualified under the condition that the forwarding message is detected to be matched with the port configuration information. The switch is automatically configured and tested through the simulation data flow, the test result of the switch is confirmed, and the test efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the technical field of switches, and in particular to a switch testing method, system, electronic equipment and storage medium. Background Art

[0002] With the continuous development of automotive technology, the demand for networks is growing. Ensuring the performance and security of mission-critical applications and improving user experience have become important challenges. As part of the Time-Sensitive Networking (TSN) protocol family, the 802.1Qci protocol, also known as Per-Stream Filtering and Policing (PSFP), focuses on providing enhanced security and network resource management. For the real-time communication needs of key applications such as braking, steering and power systems in modern automotive systems, the Qci protocol can ensure that the data packets of these key applications are given priority, reducing latency and packet loss, thereby improving system reliability and responsiveness.

[0003] In order to realize the effective support of in-vehicle networks for various complex functions in modern cars, it is particularly important to perform functional testing on the Qci protocol in the switch. In traditional testing methods, testers need to manually configure switches and test equipment to verify the flow filtering function of the switch. However, manual testing methods have problems such as low efficiency and prone to errors, and cannot meet the needs of large-scale testing and complex network environments. In addition, manual testing is difficult to fully cover all possible traffic scenarios and configurations, resulting in the omission of some potential problems. Summary of the invention

[0004] In view of this, the present invention aims to propose a switch testing method, system, electronic device and storage medium, wherein the switch testing system generates and sends simulation messages, automatically configures the switch and performs corresponding functional tests, and obtains the functional test results of the switch based on the forwarding messages returned by the switch without manual configuration, so as to solve the technical problems that manual configuration is inefficient, prone to errors, and cannot meet the requirements of large-scale testing.

[0005] To achieve the above object, the technical solution of the present invention is achieved as follows:

[0006] A first aspect of an embodiment of the present invention provides a switch testing method, which is applied to a switch testing system, wherein the switch testing system includes a host, a testing device, and a switch to be tested, wherein the testing device is respectively connected to the host and the switch to be tested in communication, and the method includes:

[0007] In response to the configuration of the switch to be tested being completed, sending a test message to the switch to be tested through the test device;

[0008] Acquire the port configuration information of the switch to be tested, filter the test message based on the port configuration information through the switch to be tested, and return the forwarded message, wherein the filtering process includes at least one of priority identification, frame length filtering, and rate limit filtering;

[0009] The forwarding message is displayed by the host, and when it is detected that the forwarding message matches the port configuration information, it is determined that the test result of the switch to be tested is qualified.

[0010] Further, in the case where the filtering process is priority identification, the filtering process of the test message by the switch to be tested and returning the forwarding message includes:

[0011] Obtaining a first priority of the test message, and extracting a target priority from the port configuration information;

[0012] In the case where it is detected that the first priority is the same as the target priority, taking the test message as the forwarding message and returning the forwarding message;

[0013] When it is detected that the first priority is different from the target priority, the test message is discarded.

[0014] Further, in the case where the filtering process is frame length filtering, the filtering process on the test message by the switch to be tested and returning the forwarding message includes:

[0015] Obtaining a first frame length of the test message, and extracting a target frame length from the port configuration information, wherein the target frame length is composed of a committed frame length and an additional frame length;

[0016] In the case of detecting that the first frame length is less than or equal to the target frame length, using the test message as the forwarding message;

[0017] In the case where it is detected that the first frame length is greater than the target frame length, using the message data corresponding to the target frame length in the test message as the forwarding message;

[0018] Return the forwarded message.

[0019] Further, in the case where the filtering process is rate-limiting filtering, the filtering process on the test message by the switch to be tested and returning the forwarding message includes:

[0020] Acquire a first transmission rate of the test message, and extract a target transmission rate from the port configuration information, wherein the target transmission rate is composed of a committed rate and an additional rate;

[0021] When detecting that the first transmission rate is less than or equal to the target transmission rate, using the test message as the forwarding message;

[0022] In the case where it is detected that the first transmission rate is greater than the target transmission rate, using the message data corresponding to the target transmission rate in the test message as the forwarding message;

[0023] Return the forwarded message.

[0024] Further, returning the forwarded message includes:

[0025] Acquire first configuration information of the test message, where the first configuration information includes a first priority, a first frame length, and a first transmission rate of the test message;

[0026] Marking the committed frame length in the first frame length and the committed rate in the first transmission rate as green;

[0027] marking an extra frame length in the first frame length and an extra rate in the first transmission rate in yellow;

[0028] Marking a second frame length in the first frame length that is greater than the target frame length and a second transmission rate in the first transmission rate that is greater than the target transmission rate in red;

[0029] discarding the message data corresponding to the second frame length and the message data corresponding to the second transmission rate in the test message to obtain the forwarded message;

[0030] discarding the second frame length and the second transmission rate marked in red in the first configuration information, and obtaining the second configuration information of the forwarded message;

[0031] Return the forwarded message and the second configuration information.

[0032] Further, displaying the forwarding message by the host, and determining that the test result of the switch to be tested is qualified when detecting that the forwarding message matches the port configuration information, includes:

[0033] Acquire the second configuration information, where the second configuration information includes a second priority, a third frame length, and a third transmission rate of the forwarded message;

[0034] If the second priority is consistent with the target priority, confirming that the first test result of the switch to be tested is qualified;

[0035] If the third frame length does not include the second frame length marked in red, then confirming that the second test result of the switch to be tested is qualified;

[0036] If the third transmission rate does not include the second transmission rate marked in red, confirming that the third test result of the switch to be tested is qualified;

[0037] When it is detected that the first test result, the second test result and the third test result are all qualified, confirming that the forwarding message matches the port configuration information;

[0038] In the case where it is detected that one of the first test result, the second test result and the third test result is unqualified, confirming that the forwarding message does not match the port configuration information;

[0039] If the forwarding message matches the port configuration information, confirming that the test result of the switch to be tested is qualified;

[0040] If the forwarding message does not match the port configuration information, the test result of the switch to be tested is confirmed to be unqualified.

[0041] Furthermore, before the response to the configuration of the switch to be tested being completed, the method further includes:

[0042] Generate a configuration message through a test script in the host;

[0043] Sending the configuration message to the switch to be tested through the test device;

[0044] According to the configuration message, the port of the switch to be tested is configured to obtain the port configuration information of the switch to be tested.

[0045] A second aspect of an embodiment of the present invention provides a switch testing system, the system comprising: a host, a testing device and a switch to be tested, the testing device being communicatively connected to the host and the switch to be tested respectively, wherein:

[0046] The test device is configured to send a test message to the switch to be tested in response to completion of configuration of the switch to be tested:

[0047] The switch to be tested is used to obtain port configuration information of the switch to be tested, filter the test message based on the port configuration information, and return the forwarded message, wherein the filtering process includes at least one of priority identification, frame length filtering, and rate limit filtering;

[0048] The host is used to display the forwarding message, and when it is detected that the forwarding message matches the port configuration information, determine that the test result of the switch to be tested is qualified.

[0049] According to a third aspect of an embodiment of the present invention, an electronic device is provided, comprising: one or more processors; a memory; and one or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the switch testing method described in the first aspect.

[0050] According to a fourth aspect of an embodiment of the present invention, a non-volatile readable storage medium is further provided. When instructions in the non-volatile readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the switch testing method described in the first aspect.

[0051] Compared with the prior art, the embodiments of the present invention have the following advantages:

[0052] The switch testing method disclosed in the embodiment of the present invention tests the flow filtering function of the switch to be tested through the switch testing system, sends a test message to the switch to be tested through the testing device in response to the configuration completion of the switch to be tested; obtains the port configuration information of the switch to be tested, filters the test message based on the port configuration information through the switch to be tested, and returns the forwarding message, wherein the filtering process includes at least one of priority identification, frame length filtering and rate limit filtering; displays the forwarding message through the host, and determines that the test result of the switch to be tested is qualified when it is detected that the forwarding message matches the port configuration information. The embodiment of the present invention sets a switch testing system, controls the testing device to generate and send simulation test messages, performs automatic configuration of the port of the switch to be tested and various functional tests of the corresponding port, obtains detailed information of the sent test message and the returned forwarding message without manually configuring and debugging the switch to be tested and the device to be tested, and obtains the functional test result of the switch based on the forwarding message returned by the switch, thereby effectively improving the configuration and testing efficiency of the switch port, and meets the testing requirements of large-scale testing and different testing scenarios by automatically generating simulation data streams. BRIEF DESCRIPTION OF THE DRAWINGS

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

[0054] Figure 1 It is a flow chart of a switch testing method provided in an embodiment of the present invention;

[0055] Figure 2 is a schematic diagram of switch port configuration in a switch testing method provided in an embodiment of the present invention;

[0056] Figure 3 is a schematic diagram of priority identification in a switch testing method provided in an embodiment of the present invention;

[0057] Figure 4 It is a schematic diagram of frame length filtering in a switch testing method provided in an embodiment of the present invention;

[0058] Figure 5 is a schematic diagram of rate limiting filtering in a switch testing method provided in an embodiment of the present invention;

[0059] Figure 6 is a structural block diagram of a switch testing system provided by an embodiment of the present invention;

[0060] Figure 7 It is a block diagram of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0061] In order to make the above-mentioned purposes, features and advantages of the present invention more obvious and easy to understand, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0062] In order to enable those skilled in the art to better understand the technical solutions in the embodiments of the present invention, some technical features involved in the embodiments of the present invention are explained and illustrated below:

[0063] 802.1Qci, also known as Per-Stream Filtering and Policing (PSFP), is part of the Time-Sensitive Networking (TSN) protocol suite and focuses on providing enhanced security and network resource management.

[0064] Spirent C50 is a high-performance network tester that is mainly used to evaluate and verify the performance and stability of Ethernet and other network infrastructure. In network testing, Spirent C50 is often used to simulate complex network scenarios, including high traffic, low latency, packet loss rate and other network conditions. It supports multiple network protocols and standards, and can generate and analyze various types of network packets.

[0065] STC (Spirent TestCenter) is a powerful network testing platform that is widely used by network equipment manufacturers, service providers and enterprises to verify the performance, functionality and reliability of network equipment. STC provides comprehensive testing functions, supports multiple network protocols and application scenarios, and helps users ensure the efficient operation and reliability of the network.

[0066] CIR (Committed Information Rate) refers to the minimum data transmission rate guaranteed by the service provider to the customer. At this rate, the data transmission will meet the pre-set QoS (Quality of Service) standards, such as delay and packet loss rate.

[0067] EIR (Excess Information Rate) refers to the data transmission rate that exceeds CIR (Committed Information Rate). It is an indicator of the network's ability to handle additional traffic after exceeding the basic guaranteed rate.

[0068] Traffic Policing is a network traffic management technology that allows users to control the maximum rate at which a flow is transmitted or received on an interface. Traffic Policing monitors and controls the transmission of network traffic by setting specific rate limits (such as CIR and EIR).

[0069] CBS (Committed Burst Size) is used to define the maximum burst data volume that a user device can send within a certain time interval, provided that this data volume does not exceed the CIR (Committed Information Rate).

[0070] EBS (Excess Burst Size) is used to define the maximum additional burst size allowed after exceeding the committed information rate (CIR) and committed burst size (CBS).

[0071] MaxSDU (Maximum SDU Size) refers to the maximum service data unit size allowed to be transmitted in the network, which limits the maximum length of a single message or frame. SDU is the data unit used by the transport layer protocol (such as TCP / IP) when transmitting data. The size of MaxSDU directly affects the performance and efficiency of the network because it determines the largest data block that can be processed during the transmission process.

[0072] As an example, the Qci protocol, which focuses on providing enhanced security and network resource management, can ensure that key applications in modern automobiles such as braking, steering and power systems require real-time communication, so that data packets are prioritized and latency and packet loss are reduced. In traditional testing methods for the Qci protocol, testers need to manually configure switches and test equipment to verify the flow filtering function of the switch. However, manual testing methods have problems such as low efficiency and prone to errors, and cannot meet the needs of large-scale switch testing and complex network environments. Manual testing is difficult to fully cover all possible traffic scenarios and configurations, which leads to the omission of some potential problems.

[0073] In this regard, in an embodiment of the present invention, a switch test system is set up to control the test equipment to send simulated messages to automatically configure the ports of the switch to be tested, and automatically test the various functions of the corresponding ports. Without manual configuration and debugging, the forwarding message returned by the switch is obtained, and the functional test result of the switch is confirmed, thereby effectively improving the configuration and testing efficiency of the switch port, and meeting the testing requirements of large-scale testing and different testing scenarios by automatically generating simulated data streams.

[0074] Reference Figure 1 , shows a schematic diagram of a flow chart of a switch testing method provided in an embodiment of the present invention, which is applied to Figure 6 The switch testing system shown in the figure includes a host, a testing device and a switch to be tested, and the testing device is respectively connected to the host and the switch to be tested in communication. The method may specifically include the following steps:

[0075] S101, in response to the configuration of the switch to be tested being completed, sending a test message to the switch to be tested through a test device.

[0076] When it is confirmed that the configuration of the designated port in the switch to be tested has been completed, the test can be started on the test device, and the test message generated by the host is forwarded to the switch to be tested through the test device. The test message enters the designated port of the switch to be tested, and the flow filtering function of the designated port is tested. The test device refers to a device used for performance, function and reliability testing of network equipment, services and applications. Currently, commonly used test equipment includes Spirent TestCenter, Ixia IxNetwork, etc. Preferably, in an embodiment of the present invention, Spirent C50 is used as the test device to forward and receive the test message.

[0077] Before testing the switch to be tested, the pre-written shell test script integrated in the host can be used to control the configuration of the test device and the switch port to be tested, wherein the test device is connected to the host and the switch through Ethernet cables respectively. As a preparatory work, the host and the test device are configured in the same network segment to realize information exchange. Configuration messages and test messages can be sent from the fixed sending port of the test device to the fixed receiving port of the switch, and the returned forwarding message can be sent from the fixed return port of the switch to the fixed receiving port of the test device. Through the designated port, the test device and the receiving port of the switch to be tested form a closed loop, so as to check the sending and receiving of messages from the fixed port.

[0078] Specifically, the STC test platform is correctly installed in the host and ensured to run normally. The relevant parameters of the 802.1Qci protocol are set in the STC configuration file according to the test requirements as the configuration information of the designated port of the switch to be tested. For example, the configuration information may include parameters such as the port MAC address, traffic rate limit (CIR and EIR), frame length (CBS and EBS), and the like. According to the configuration file, a simulated data stream is generated in the STC test platform as a configuration message. The test script controls the test device to forward the configuration message to the switch. The configuration message can enter the internal virtual machine of the switch to configure the designated port of the switch to be tested accordingly. For example, refer to Figure 2 , two MAC addresses are added to the forwarding database through configuration messages, address 00:00:00:00:00:22 is associated with the first stream handler (streamhandle1), address 00:00:00:00:00:66 is associated with the second stream handler (streamhandle2), the priority of the data stream allowed to pass is set to 0, the maximum transmission rate allowed to pass is set to 20mbps, and the maximum allowed frame length of streamhandle1 (MaxSDU) is set to 1100 bytes.

[0079] Among them, the host can be a personal computer, a server, a router and other devices. Preferably, in the embodiment of the present invention, a computer PC is set as the host, and the host generates and sends a simulated data stream to automatically test the switch, and configures the port of the switch according to the configuration message. It can be implemented through the command of the command line interface, and the present invention will not be repeated here.

[0080] S102, obtaining the port configuration information of the switch to be tested, filtering the test message based on the port configuration information through the switch to be tested, and returning a forwarding message.

[0081] The test device is controlled by the test script to send a test message to the designated port of the switch to be tested, corresponding to different functional tests of the flow filtering function in the switch. These test messages can contain different priority, frame length, transmission rate and other information, which are used to test different flow filtering functions of the switch. Preferably, a test message can be sent to test one or more flow filtering functions, and multiple test messages can also be sent to test at the same time to improve the efficiency of automatic testing. After receiving the transmission message, the switch to be tested filters the received test message according to the configured port, wherein the filtering process that the switch can perform on the test message can include at least one of priority identification, frame length filtering and rate limit filtering. Similarly, multiple filtering processes can be performed on the same test message. Exemplarily, the switch identifies and filters the test message according to the configured flow filtering rules (such as based on priority, frame length, rate, etc.), and returns the qualified test message as a forwarding message to the fixed receiving port of the test device for analyzing the test results of the switch.

[0082] In a possible example, when the filtering process is priority identification, the switch filters based on the priority of the test message. By comparing the test message with the forwarded message, the test result of the switch priority identification function can be confirmed. In network testing, priority identification is a common filtering processing method used to forward or discard messages based on their priority. Specifically, the switch extracts a first priority from the test message. Usually, the priority information is stored in the header field of the message. The message can be parsed and extracted by a test tool or a network analysis tool, such as an 802.1p priority tag or an IP priority (DSCP) field. The first priority is compared with a target priority of a specified port. The target priority represents the priority of a data flow that can pass through the specified port. The target priority can be extracted from the port configuration information.

[0083] If the first priority of the test message is the same as the target priority of the specified port, it means that the test message meets the flow filtering rules of the port, and the test message can be returned to the test device as a forwarding message. If the first priority of the test message is different from the target priority, it means that the priority of the test message does not meet the flow filtering rules of the port, and the test message is filtered, that is, the test message is discarded and not forwarded. As an example, refer to Figure 3, the current designated port allows data packets with a priority of 0 to pass through, the priority of the test message stream1 is 0, and the priority of the test message stream2 is 1. When the test message is filtered through the designated port, stream1 can be forwarded, but the priority of stream2 is not allowed to pass, so stream2 is discarded and not forwarded, that is, through the filtering of the designated port, stream1 that meets the priority is forwarded, and stream2 that does not meet the priority is discarded. Preferably, when testing the priority identification of the designated port, the frame length and transmission rate of stream1 and stream2 can be set to the configuration information that meets the port configuration. By automatically identifying and processing the priority of the test message, simulating the real network environment, and testing the designated port of the switch in different application scenarios, its performance and stability under different loads can be verified, thereby ensuring that through the reasonable configuration and real-time monitoring of the switch, the message data of key businesses or applications can be prioritized, reducing delays and jitter, and improving user experience.

[0084] When the filtering process is frame length filtering, the switch filters based on the frame length of the test message. By comparing the test message with the forwarded message, the test result of the switch frame length filtering function can be confirmed. In network testing, frame length filtering is a common filtering process used to forward or intercept messages based on their frame length. Specifically, the switch extracts the first frame length from the test message. Usually, the frame length information is stored in the header field of the message. The message can be parsed and extracted through a test tool or a network analysis tool. The first frame length is compared with the target frame length of the specified port. The target frame length indicates the maximum allowed frame length that can be passed through the port in the switch. The target frame length is composed of CBS and EBS, which can be extracted from the port configuration information.

[0085] If the first frame length of the test message is less than or equal to the target frame length of the specified port, it means that the test message is within the frame length range allowed by the specified port, and the test message can be returned to the test device as a forwarding message. If the first frame length of the test message is greater than the target frame length, it means that the data size of the test message exceeds the allowable range of the specified port. An excessively large frame length will increase the risk of network congestion, and the test message needs to be intercepted and forwarded. Exemplarily, the message data corresponding to the target frame length in the test message can be returned to the test device as a forwarding message, that is, the intercepted part of the test message is used as the message data, and only part of the data within the frame length range allowed by the specified port is forwarded. As an example, refer to Figure 4, the maximum allowed frame length of the current designated port is 1100 bytes, the frame length of the test message stream1 is 1100 bytes, and the frame length of the test message stream2 is 1200 bytes. When the test message is filtered through the designated port, stream1 can be forwarded directly, and stream2 needs to be intercepted, and only the first 1100 bytes are forwarded, and the 100 bytes exceeding the maximum allowed frame length are discarded. By automatically limiting the frame length of the test message and simulating the real network environment, testing the designated port of the switch under different frame lengths can verify its performance and stability under different loads, thereby ensuring that through the reasonable configuration and real-time monitoring of the switch, excessively long data frames can be limited to prevent network congestion, ensure the stable operation of the network under high load, reduce network delays, and improve network response speed.

[0086] When the filtering process is speed limit filtering, the switch filters based on the transmission rate of the test message. By comparing the test message with the forwarded message, the test result of the switch speed limit filtering function can be confirmed. In network testing, speed limit filtering is a common filtering process, which is used to forward or intercept messages according to their transmission rate. Specifically, the switch extracts a first transmission rate from the test message. The transmission rate can usually be calculated in real time by a test tool or a network analysis tool. The first transmission rate is compared with the target transmission rate of the specified port. The target transmission rate indicates the maximum transmission rate that the port in the switch can pass. The target transmission rate is composed of CIR and EIR, which can be extracted from the port configuration information.

[0087] If the first transmission rate of the test message is less than or equal to the target transmission rate of the designated port, it means that the transmission rate of the test message meets the bandwidth limit of the designated port, and the message will not exceed the bandwidth limit of the port during transmission, causing data loss. The test message can be returned to the test device as a forwarding message. If the first transmission rate of the test message is greater than the target transmission rate, it means that the transmission rate of the test message exceeds the bandwidth limit of the designated port, and the message will occupy too many bandwidth resources during forwarding. The test message needs to be intercepted and forwarded. Exemplarily, the message data corresponding to the target transmission rate in the test message can be returned to the test device as a forwarding message, that is, the intercepted part of the test message is used as the message data, and only part of the data within the bandwidth limit allowed by the designated port is forwarded. As an example, refer to Figure 5, the current CIR of the designated port is 10Mbps, and the EIR is 5Mbps. The total bandwidth of the designated port is 15Mbps, that is, the target transmission rate that the designated port can forward is 15Mbps. When the transmission rate of the test message stream1 is 20Mbps, in the process of filtering the test message through the designated port, stream1 will be intercepted, and only the message data corresponding to the target frame length will be intercepted as the forwarding message, that is, the data part with a transmission rate of 15Mbps will be intercepted, and the 5Mbps exceeding the target transmission rate will be discarded. By automatically limiting the transmission rate of the test traffic and simulating the real network environment, the designated port of the switch can be tested at different transmission rates to verify its performance and stability under different loads, thereby ensuring that the reasonable configuration and real-time monitoring of the switch can limit the traffic rate, prevent network congestion, ensure that the bandwidth requirements of key businesses and applications are met, and improve service quality.

[0088] In a possible example, in order to further improve the visualization effect of the test results, various configuration information of the returned forwarding message can be marked respectively with multiple colors, so that the test personnel can quickly identify and locate the key information of each part. Specifically, after the switch filters the test message to determine the forwarding message, the first configuration information corresponding to the test message is extracted, including the first priority, the first frame length and the first transmission rate, and the CIR committed frame length in the first frame length and the CBS committed rate in the first transmission rate are marked in green, the EBS additional frame length in the first frame length and the EIR additional rate in the first transmission rate are marked in yellow, and the second frame length in the first frame length that exceeds the target frame length and the second transmission rate in the first transmission rate that exceeds the target rate are marked in red. If the switch correctly executes the flow filtering rule, the message data exceeding the target frame length and the target rate are discarded, and only the message data is forwarded. Then, the second configuration information corresponding to the forwarding data returned to the test device does not contain the configuration information marked in red. The visibility of the test results is improved by color marking the configuration information of the forwarding data.

[0089] S103, displaying the forwarding message through the host, and determining that the test result of the switch to be tested is qualified when detecting that the forwarding message matches the port configuration information.

[0090] The forwarded message is captured through the fixed receiving port of the test equipment and forwarded to the host. To improve the visualization of the test results, the configuration information of the forwarded message can be specifically displayed through the STC platform, such as priority, frame length, transmission rate, etc. The tester can confirm the test result of the switch by observing the various configuration information of the forwarded message, or judge the test result through the host, and compare the configuration information of the forwarded message with the port configuration information one by one. If the forwarded message matches the port configuration information, it indicates that the test message has been filtered by the switch, and the obtained forwarded message complies with the port configuration information, that is, it complies with the flow filtering rules of the switch, which further indicates that the configured switch correctly executes the flow filtering rules. In this way, it can be confirmed that the test result of the switch to be tested is qualified.

[0091] Specifically, after obtaining the forwarding message, the host can extract the second configuration information from the forwarding message, wherein the second configuration information may include the second priority, third frame length and third transmission rate of the forwarding message. By comparing the second configuration information with the port configuration information, the test result of the switch designated port can be confirmed.

[0092] Exemplarily, if the second priority of the forwarded message is consistent with the target priority, it means that the returned forwarded message complies with the priority filtering rules set for the port, and it can be confirmed that the first test result of the priority identification function of the switch to be tested is qualified; if the third frame length of the forwarded message does not include the second frame length marked in red, it means that the returned forwarded message complies with the maximum allowed frame length set for the port, and it can be confirmed that the second test result of the frame length filtering function of the switch to be tested is qualified; if the third transmission rate of the forwarded message does not include the second transmission rate marked in red, it means that the returned forwarded message complies with the total bandwidth limit set for the port, and it can be confirmed that the third test result of the speed limit filtering function of the switch to be tested is qualified.

[0093] When the first test result, the second test result and the third test result are all qualified, it indicates that the configuration information of the returned forwarding message meets the flow filtering rules configured by the switch, that is, it can be confirmed that the forwarding message matches the port configuration information; when one of the first test result, the second test result and the third test result is unqualified, it indicates that the configuration information of the returned forwarding message does not meet the flow filtering rules configured by the switch, and it can be confirmed that the forwarding message does not match the port configuration information; if the forwarding message matches the port configuration information, it indicates that the switch correctly executes each item of the flow filtering rules, and it can be confirmed that the test result of the switch to be tested is qualified; if the forwarding message does not match the port configuration information, it indicates that the switch does not correctly execute each item of the flow filtering rules during the execution of the flow filtering rules, and it can be confirmed that the test result of the switch to be tested is unqualified. By receiving the forwarding message through the host, setting the judgment rule to analyze the forwarding message, and quickly obtaining the test result, the test time can be effectively reduced and the test efficiency can be improved. In addition, the host can send multiple test messages at the same time, execute multiple test tasks in the same time period, and obtain the test results in batches to improve the test efficiency.

[0094] The switch testing method disclosed in the embodiment of the present invention sets a switch testing system, controls the test equipment to generate and send simulation test messages, automatically configures the ports of the switch to be tested and tests various functions of the corresponding ports, obtains detailed information of the sent test messages and the returned forwarding messages without manually configuring and debugging the switch to be tested and the device to be tested, and obtains the functional test results of the switch based on the forwarding messages returned by the switch, thereby effectively improving the configuration and testing efficiency of the switch ports, and meeting the testing requirements of large-scale testing and different testing scenarios by automatically generating simulation data streams.

[0095] It should be noted that, for the sake of simplicity, the method embodiments are described as a series of action combinations, but those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.

[0096] Reference Figure 6 , shows a switch testing system provided by an embodiment of the present invention, the system comprising: a host 610, a test device 620 and a switch to be tested 630, the test device 620 is respectively connected to the host 610 and the switch to be tested 630 for communication, wherein,

[0097] The test device 620 is used to send a test message to the switch under test in response to the configuration completion for the switch under test:

[0098] The switch to be tested 630 is used to obtain the port configuration information of the switch to be tested, filter the test message based on the port configuration information, and return the forwarded message, wherein the filtering process includes at least one of priority identification, frame length filtering, and rate limit filtering;

[0099] The host 610 is used to display the forwarding message, and when it is detected that the forwarding message matches the port configuration information, determine that the test result of the switch to be tested is qualified.

[0100] Further, when the filtering process is priority identification, the switch to be tested 630 is specifically used for:

[0101] Obtaining a first priority of the test message, and extracting a target priority from the port configuration information;

[0102] In the case where it is detected that the first priority is the same as the target priority, taking the test message as the forwarding message and returning the forwarding message;

[0103] When it is detected that the first priority is different from the target priority, the test message is discarded.

[0104] Furthermore, when the filtering process is frame length filtering, the switch to be tested 630 is further specifically configured to:

[0105] Obtaining a first frame length of the test message, and extracting a target frame length from the port configuration information, wherein the target frame length is composed of a committed frame length and an additional frame length;

[0106] In the case of detecting that the first frame length is less than or equal to the target frame length, using the test message as the forwarding message;

[0107] In the case where it is detected that the first frame length is greater than the target frame length, using the message data corresponding to the target frame length in the test message as the forwarding message;

[0108] Return the forwarded message.

[0109] Furthermore, when the filtering process is rate-limiting filtering, the switch to be tested 630 is further specifically configured to:

[0110] Acquire a first transmission rate of the test message, and extract a target transmission rate from the port configuration information, wherein the target transmission rate is composed of a committed rate and an additional rate;

[0111] When detecting that the first transmission rate is less than or equal to the target transmission rate, using the test message as the forwarding message;

[0112] In the case where it is detected that the first transmission rate is greater than the target transmission rate, using the message data corresponding to the target transmission rate in the test message as the forwarding message;

[0113] Return the forwarded message.

[0114] Furthermore, the switch to be tested 630 may also be specifically used for:

[0115] Acquire first configuration information of the test message, where the first configuration information includes a first priority, a first frame length, and a first transmission rate of the test message;

[0116] Marking the committed frame length in the first frame length and the committed rate in the first transmission rate as green;

[0117] marking an extra frame length in the first frame length and an extra rate in the first transmission rate in yellow;

[0118] Marking a second frame length in the first frame length that is greater than the target frame length and a second transmission rate in the first transmission rate that is greater than the target transmission rate in red;

[0119] discarding the message data corresponding to the second frame length and the message data corresponding to the second transmission rate in the test message to obtain the forwarded message;

[0120] discarding the second frame length and the second transmission rate marked in red in the first configuration information, and obtaining the second configuration information of the forwarded message;

[0121] Return the forwarded message and the second configuration information.

[0122] Furthermore, the host 610 is specifically used for:

[0123] Acquire the second configuration information, where the second configuration information includes a second priority, a third frame length, and a third transmission rate of the forwarded message;

[0124] If the second priority is consistent with the target priority, confirming that the first test result of the switch to be tested is qualified;

[0125] If the third frame length does not include the second frame length marked in red, then confirming that the second test result of the switch to be tested is qualified;

[0126] If the third transmission rate does not include the second transmission rate marked in red, confirming that the third test result of the switch to be tested is qualified;

[0127] When it is detected that the first test result, the second test result and the third test result are all qualified, confirming that the forwarding message matches the port configuration information;

[0128] In the case where it is detected that one of the first test result, the second test result and the third test result is unqualified, confirming that the forwarding message does not match the port configuration information;

[0129] If the forwarding message matches the port configuration information, confirming that the test result of the switch to be tested is qualified;

[0130] If the forwarding message does not match the port configuration information, the test result of the switch to be tested is confirmed to be unqualified.

[0131] Furthermore, the testing device 620 is specifically used for:

[0132] Sending the configuration message to the switch to be tested, wherein the configuration message is generated by a test script in a host;

[0133] According to the configuration message, the port of the switch to be tested is configured to obtain the port configuration information of the switch to be tested.

[0134] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.

[0135] refer to Figure 7 The embodiment of the present invention further provides an electronic device, including a processor 701, a communication interface 702, a memory 703 and a communication bus 704, wherein the processor 701, the communication interface 702 and the memory 703 communicate with each other via the communication bus 704.

[0136] Memory 703, used for storing computer programs;

[0137] The processor 701 is used to execute the program stored in the memory 703 to implement the following steps:

[0138] In response to the configuration of the switch to be tested being completed, sending a test message to the switch to be tested through the test device;

[0139] Acquire the port configuration information of the switch to be tested, filter the test message based on the port configuration information through the switch to be tested, and return the forwarded message, wherein the filtering process includes at least one of priority identification, frame length filtering, and rate limit filtering;

[0140] The forwarding message is displayed by the host, and when it is detected that the forwarding message matches the port configuration information, it is determined that the test result of the switch to be tested is qualified.

[0141] The memory may include a random access memory (RAM) or a non-volatile memory, such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0142] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0143] The embodiment of the present invention also provides a non-volatile readable storage medium. When the instructions in the non-volatile readable storage medium are executed by the processor of the electronic device, the electronic device can perform the various processes of the above switch test method embodiment and achieve the same technical effect. To avoid repetition, it is not repeated here. The computer-readable storage medium is, for example, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0144] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, article or 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 device. In the absence of further restrictions, an element defined by the sentence "comprises a ..." does not exclude the existence of other identical elements in the process, method, article or device including the element.

[0145] In the description provided herein, a large number of specific details are described. However, it is understood that embodiments of the present invention can be practiced without these specific details. In some instances, well-known methods, structures and techniques are not shown in detail so as not to obscure the understanding of this description.

[0146] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, a magnetic disk, or an optical disk), and includes a number of instructions for enabling a terminal (which can be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) to execute the methods described in each embodiment of the present invention.

[0147] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed in the embodiments of the present invention can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.

[0148] The above is only a specific embodiment of the present invention, but the protection scope of the present invention is not limited thereto. Any person skilled in the art can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention should be based on the protection scope of the claims.

Claims

1. A switch testing method, characterized in that: Applied to a switch test system, the switch test system includes a host, a test device and a switch to be tested, the test device is respectively connected to the host and the switch to be tested in communication, and the method includes: In response to the configuration of the switch to be tested being completed, sending a test message to the switch to be tested through the test device; Acquire the port configuration information of the switch to be tested, filter the test message based on the port configuration information through the switch to be tested, and return the forwarded message, wherein the filtering process includes at least one of priority identification, frame length filtering, and rate limit filtering; The forwarding message is displayed by the host, and when it is detected that the forwarding message matches the port configuration information, it is determined that the test result of the switch to be tested is qualified.

2. The method according to claim 1, characterized in that In the case where the filtering process is priority identification, the filtering process of the test message by the switch to be tested and returning the forwarding message includes: Obtaining a first priority of the test message, and extracting a target priority from the port configuration information; In the case where it is detected that the first priority is the same as the target priority, taking the test message as the forwarding message and returning the forwarding message; When it is detected that the first priority is different from the target priority, the test message is discarded.

3. The method according to claim 1, characterized in that In the case where the filtering process is frame length filtering, the filtering process on the test message by the switch to be tested and returning the forwarding message includes: Obtaining a first frame length of the test message, and extracting a target frame length from the port configuration information, wherein the target frame length is composed of a committed frame length and an additional frame length; When detecting that the first frame length is less than or equal to the target frame length, using the test message as the forwarding message; In the case where it is detected that the first frame length is greater than the target frame length, using the message data corresponding to the target frame length in the test message as the forwarding message; Return the forwarded message.

4. The method according to claim 3, characterized in that In the case where the filtering process is rate-limiting filtering, the filtering process on the test message by the switch to be tested and returning the forwarding message includes: Acquire a first transmission rate of the test message, and extract a target transmission rate from the port configuration information, wherein the target transmission rate is composed of a committed rate and an additional rate; When detecting that the first transmission rate is less than or equal to the target transmission rate, using the test message as the forwarding message; In the case where it is detected that the first transmission rate is greater than the target transmission rate, using the message data corresponding to the target transmission rate in the test message as the forwarding message; Return the forwarded message.

5. The method according to any one of claims 2 to 4, characterized in that: The returning the forwarded message comprises: Acquire first configuration information of the test message, where the first configuration information includes a first priority, a first frame length, and a first transmission rate of the test message; Marking the committed frame length in the first frame length and the committed rate in the first transmission rate as green; marking an extra frame length in the first frame length and an extra rate in the first transmission rate in yellow; Marking a second frame length in the first frame length that is greater than the target frame length and a second transmission rate in the first transmission rate that is greater than the target transmission rate in red; discarding the message data corresponding to the second frame length and the message data corresponding to the second transmission rate in the test message to obtain the forwarded message; discarding the second frame length and the second transmission rate marked in red in the first configuration information, and obtaining the second configuration information of the forwarded message; Return the forwarded message and the second configuration information.

6. The method according to claim 5, characterized in that The displaying the forwarding message by the host, and determining that the test result of the switch to be tested is qualified when detecting that the forwarding message matches the port configuration information, includes: Acquire the second configuration information, where the second configuration information includes a second priority, a third frame length, and a third transmission rate of the forwarded message; If the second priority is consistent with the target priority, confirming that the first test result of the switch to be tested is qualified; If the third frame length does not include the second frame length marked in red, then confirming that the second test result of the switch to be tested is qualified; If the third transmission rate does not include the second transmission rate marked in red, confirming that the third test result of the switch to be tested is qualified; When it is detected that the first test result, the second test result and the third test result are all qualified, confirming that the forwarding message matches the port configuration information; In the case where it is detected that one of the first test result, the second test result and the third test result is unqualified, confirming that the forwarding message does not match the port configuration information; If the forwarding message matches the port configuration information, confirming that the test result of the switch to be tested is qualified; If the forwarding message does not match the port configuration information, the test result of the switch to be tested is confirmed to be unqualified.

7. The method according to claim 1, characterized in that Before the response to the configuration of the switch to be tested being completed, the method further includes: Generate a configuration message through a test script in the host; Sending the configuration message to the switch to be tested through the test device; According to the configuration message, the port of the switch to be tested is configured to obtain the port configuration information of the switch to be tested.

8. A switch testing system, characterized in that: The system includes: a host, a test device and a switch to be tested, wherein the test device is respectively connected to the host and the switch to be tested for communication, wherein: The test device is configured to send a test message to the switch to be tested in response to completion of configuration of the switch to be tested: The switch to be tested is used to obtain port configuration information of the switch to be tested, filter the test message based on the port configuration information, and return the forwarded message, wherein the filtering process includes at least one of priority identification, frame length filtering, and rate limit filtering; The host is used to display the forwarding message, and when it is detected that the forwarding message matches the port configuration information, determine that the test result of the switch to be tested is qualified.

9. An electronic device, comprising: one or more processors; Memory; One or more programs, wherein the one or more programs are stored in the memory and configured to be executed by the one or more processors, and the one or more programs are configured to execute the switch testing method according to any one of claims 1 to 7. 10 . A non-volatile readable storage medium, when instructions in the non-volatile readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the switch testing method according to any one of claims 1 to 7.