A switch aging test method, device and medium
By creating a virtual LAN and configuring the internal loopback state within the switch, and using the CPU to send aging test messages, the aging test of the switch is automated and efficient, solving the problems of high cost and low efficiency in traditional testing methods, and improving the stability and accuracy of the test.
Patent Information
- Application Number
- CN202411862021.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-17
- Publication Date
- 2025-11-25
- Estimated Expiration
- 2044-12-17
AI Technical Summary
Traditional switch aging tests require a large number of expensive test instruments and consumables, and the manual operation is complicated, resulting in high costs, low efficiency, and difficulty in comprehensively evaluating the stability of switches over long periods of time and under different environments.
An automated aging test method is adopted. By creating a virtual local area network (VLAN) and configuring the internal loopback state inside the switch, the CPU is used to send aging test messages to achieve continuous performance testing, simplifying the testing process and reducing hardware costs.
It improves testing efficiency, reduces costs, enhances testing stability and resource utilization, can more comprehensively simulate real-world usage environments, reduces human error, and improves testing accuracy and consistency.
Smart Images

Figure CN119676136B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present specification relates to the technical field of computer technology, and particularly relates to a switch aging test method, device and medium. BACKGROUND
[0002] With the rapid development of information technology, digitalization, networking and intelligentization have become an important force to promote the progress of modern society. Under this background, network equipment, as the cornerstone of information transmission, its stability and reliability are particularly important. Switches, as the core component of network equipment, bear the key tasks of data transmission, storage and processing, and their performance directly affects the normal operation of the entire network system. Switch aging test is an important means to evaluate the durability and reliability of switch products under long-term use and different environmental conditions. Through aging test, problems and defects in product design can be found in time, so as to improve product design, improve product quality, ensure the qualification rate of products, and improve the stability and reliability of switch products.
[0003] In the traditional switch aging test method, in order to verify the stability of the switch under different temperatures for a long time, not only the device is powered on and placed in a high temperature environment, but also the switch ports are connected in a serpentine shape through external network cables (optical modules + optical fibers), and the test instrument is continuously tested with full port load. After the test is completed, the number of sent and received messages is compared to determine whether the device passes the aging test.
[0004] During the switch aging test, test flow is required. When switch devices are mass produced, multiple devices are often used for aging at the same time, which requires a large number of test instrument ports. Currently, switch test instrument devices are often expensive, resulting in a sharp increase in test costs. At the same time, the current switch aging scheme requires external Ethernet cables or optical modules + cables to form a serpentine flow test scheme. First, a large amount of manpower is required for switch port wiring. Second, in a high temperature environment, long-term flow test and module plugging will cause the device consumables to deteriorate rapidly, resulting in loss and increasing test costs. SUMMARY
[0005] One or more embodiments of the present specification provide a switch aging test method, device and medium to solve the technical problems in the background art.
[0006] One or more embodiments of the present specification adopt the following technical solutions:
[0007] The switch aging test method provided by one or more embodiments of the present specification comprises:
[0008] The aging test switch is configured with aging test parameters, wherein the aging test parameters include a preset aging test time;
[0009] after the aging test switch is started, the system background calls the aging test script corresponding to the aging test switch;
[0010] During the running of the aging test script, one or more virtual local area networks (VLANs) are created based on the number of ports of the aging test switch, each pair of ports in the aging test switch is assigned to the same VLAN, each port in each VLAN is configured as an inner loopback state, the CPU sends aging test packets to each port in each VLAN, and the inner loopback state is used to cyclically send and receive the aging test packets between the ports, so as to form continuous aging test traffic and perform persistent performance testing on the aging test switch.
[0011] When the test time of the aging test reaches the preset aging test time, the operation of sending and receiving the aging test packets between each pair of ports is terminated, and the aging test result of the aging test switch is generated based on the cyclic sending and receiving of the aging test packets between the ports in each VLAN.
[0012] It should be noted that the embodiments of the present specification have the following beneficial effects through the above-mentioned solutions:
[0013] Improved test efficiency: by calling the preset aging test script in the system background and automatically executing the aging test process, manual operation is reduced, thereby improving the test efficiency.
[0014] Simplified test process: by creating a virtual local area network (VLAN) and configuring an inner loopback state, the complex operation of traditional snake-shaped concatenation of external network cables is simplified, making the test process more intuitive and easy to manage.
[0015] Reduced test cost: inner loopback testing is performed using the ports of the switch itself, without the need for additional external network cables, reducing hardware costs. At the same time, the demand for test instrument ports is reduced, reducing the purchase and maintenance costs of the test instrument.
[0016] Enhanced test stability: through continuous aging test traffic, the actual use environment can be more comprehensively simulated, and the stability test of the switch under long-time operation is enhanced.
[0017] Improved resource utilization: by creating a virtual VLAN inside the switch, existing port resources can be effectively utilized, so that multiple devices can simultaneously perform aging tests, improving the utilization of test resources.
[0018] Further, the aging test parameters further include a preset aging test flag, and before the system background calls the aging test script corresponding to the aging test switch, the method further includes:
[0019] determining whether the aging test flag of the aging test switch is in a set state based on the preset aging test flag and a current aging test flag of the aging test switch;
[0020] If yes, executing the calling of the aging test script corresponding to the aging test switch in the system background.
[0021] It should be noted that the embodiments of the present specification have the following beneficial effects through the above-mentioned solutions:
[0022] Automatic control: through the comparison of the preset aging test flag and the current aging test flag, the automatic control of the aging test process is realized. This method can avoid manual intervention, reduce human error, and improve the accuracy and consistency of the test.
[0023] State monitoring: by judging the flag state of the aging test switch, the aging test state of the switch can be monitored in real time. If the flag is in the set state, it indicates that the switch is ready for aging test, which can ensure that the test starts at the right time.
[0024] Flexibility of test start: the introduction of the preset flag makes the start of the test more flexible. Only when the specific condition (such as the flag being set) is met, the test script will be executed, which helps to avoid unnecessary test start and save resources.
[0025] Further, the calling of the aging test script corresponding to the aging test switch in the system background comprises:
[0026] calling the aging test script corresponding to the aging test switch in the system background;
[0027] obtaining the model information of the aging test switch, and initializing the variable information in the aging test script based on the model information of the aging test switch, the variable information including one or more of the port quantity, the port type and the log file type of the aging test switch.
[0028] It should be noted that the embodiments of the present specification have the following beneficial effects through the above-mentioned solutions:
[0029] Individualized test script: by obtaining the model information of the aging test switch and initializing the variable information in the test script accordingly, it can be ensured that the test script is optimized for a specific model of switch. This method makes the test more individualized and accurate, and improves the effectiveness of the test.
[0030] Adaptability enhancement: The variable information initialized based on the switch model information (such as the number of ports, port type, and log file type) can ensure that the test script is compatible with different models of switches, enhancing the adaptability of the test method.
[0031] Test parameter optimization: By setting different test parameters for different models of switches, actual use scenarios can be simulated more accurately, thereby optimizing test conditions and improving the reliability of test results.
[0032] Further, the port type includes an electrical port and an optical port, and the configuration of each port in the VLAN to an inner loopback state includes:
[0033] If the port type in the VLAN is an electrical port, the physical layer device associated with the port is configured to an inner loopback state.
[0034] If the port type in the VLAN is an optical port, the serializer and deserializer associated with the port are configured to an inner loopback state.
[0035] It should be noted that the above-mentioned scheme has the following beneficial effects:
[0036] Compatibility support: By supporting both electrical and optical ports, this method can adapt to different types of network devices, enhancing the compatibility of the test.
[0037] Simplified test environment: By configuring each port in the VLAN to an inner loopback state, the complexity of external network connections can be avoided, simplifying the test environment and making the test more direct and controllable.
[0038] Further, the generation of the aging test results of the aging test switch based on the cyclic sending and receiving of aging test packets between ports in each VLAN includes:
[0039] Statistical first quantity of cyclic sending of aging test packets between ports in each VLAN, and second quantity of cyclic receiving of aging test packets between ports in each VLAN;
[0040] Comparing the first data quantity and the second quantity of the ports in each VLAN;
[0041] If the same, it is determined that the aging test switch passes the aging test.
[0042] It should be noted that the above-mentioned scheme has the following beneficial effects:
[0043] Comprehensive testing: By sending and receiving aging test packets between ports in each VLAN, this method can comprehensively test the data forwarding capability of the switch between different VLANs, ensuring that the switch can work stably in various network environments.
[0044] Data accuracy: By counting the number of sent and received packets, the data transmission performance of the switch can be accurately measured, which helps to identify potential problems in the data transmission process.
[0045] Performance evaluation: By comparing the amount of data sent and received, the performance of the switch can be evaluated for consistency, so as to determine whether the switch can continuously and stably handle data traffic.
[0046] Further, the configuration of each port in each VLAN to an inner loopback state includes:
[0047] By calling the underlying software development kit (SDK) interface, each port in each VLAN is configured to an inner loopback state.
[0048] It should be noted that the above-mentioned scheme has the following beneficial effects:
[0049] Simplified configuration process: By calling the underlying software development kit (SDK) interface to configure the port, the configuration process of the network device is simplified, and the errors and time required for manual configuration are reduced.
[0050] Further, before the CPU sends aging test packets to each port in each VLAN, the method further includes:
[0051] Clearing the statistical data of each port in each VLAN.
[0052] It should be noted that the above-mentioned scheme has the following beneficial effects:
[0053] Initial state consistency: By clearing the statistical data of each port, it is ensured that the initial state of all ports is consistent before sending aging test packets. This helps to obtain more accurate test results, because the test will not be affected by previous data transmission activities.
[0054] Further, the aging test script is a Python-based aging test script.
[0055] One or more embodiments of the present specification provide a switch aging test device, comprising:
[0056] At least one processor; and,
[0057] The memory is in communication connection with the at least one processor; wherein,
[0058] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to:
[0059] configuring an aging test parameter for the aging test switch, wherein the aging test parameter comprises a preset aging test time;
[0060] after the aging test switch is started, calling a corresponding aging test script of the aging test switch in the background of a system;
[0061] when the aging test script is running, creating one or more virtual local area networks (VLANs) based on the number of ports of the aging test switch, assigning each pair of ports in the aging test switch to the same VLAN, configuring each port in each VLAN as an inner loopback state, sending aging test packets to each port in each VLAN by using a CPU, and sending and receiving the aging test packets between the ports by using the inner loopback state, so as to form continuous aging test traffic and perform persistent performance testing on the aging test switch;
[0062] when the test time of the aging test reaches the preset aging test time, terminating the operation of sending and receiving the aging test packets between each pair of ports, and generating an aging test result of the aging test switch based on the sending and receiving of the aging test packets between the ports in each VLAN.
[0063] One or more embodiments of the present specification provide a non-volatile computer storage medium storing computer executable instructions, which, when executed by a computer, can implement:
[0064] configuring an aging test parameter for the aging test switch, wherein the aging test parameter comprises a preset aging test time;
[0065] after the aging test switch is started, calling a corresponding aging test script of the aging test switch in the background of a system;
[0066] when the aging test script is running, creating one or more virtual local area networks (VLANs) based on the number of ports of the aging test switch, assigning each pair of ports in the aging test switch to the same VLAN, configuring each port in each VLAN as an inner loopback state, sending aging test packets to each port in each VLAN by using a CPU, and sending and receiving the aging test packets between the ports by using the inner loopback state, so as to form continuous aging test traffic and perform persistent performance testing on the aging test switch;
[0067] When the test time of the aging test reaches the preset aging test time, the operation of sending and receiving the aging test packet between each pair of ports is terminated, and the aging test result of the aging test switch is generated based on the cyclic sending and receiving of the aging test packet between the ports in each VLAN.
[0068] The above at least one technical solution adopted by the embodiments of the present specification can achieve the following beneficial effects:
[0069] Improve test efficiency: by calling the preset aging test script in the system background, the aging test process is automatically executed, reducing manual operation and improving test efficiency.
[0070] Simplify the test process: by creating a virtual local area network (VLAN) and configuring an inner loopback state, the complex operation of traditional snake-shaped concatenation of external network cables is simplified, making the test process more intuitive and easy to manage.
[0071] Reduce test cost: use the ports of the switch itself for inner loopback testing, without the need for additional external network cables, reducing hardware costs. At the same time, the demand for tester ports is reduced, reducing the purchase and maintenance costs of the tester.
[0072] Enhance test stability: through continuous aging test traffic, the actual use environment can be more comprehensively simulated, enhancing the stability test of the switch under long-time operation.
[0073] Improve resource utilization: by creating a virtual VLAN inside the switch, existing port resources can be effectively utilized, allowing multiple devices to perform aging tests simultaneously, improving the utilization of test resources. BRIEF DESCRIPTION OF DRAWINGS
[0074] In order to more clearly illustrate the technical solutions in the embodiments of the present specification or the prior art, the following will briefly introduce the drawings needed to be used in the embodiment or prior art description. Obviously, the drawings in the following description are only some embodiments described in the present specification, and those skilled in the art can obtain other drawings according to these drawings without creative labor. In the drawings:
[0075] Figure 1 A flowchart of a switch aging test method provided for one or more embodiments of the present specification;
[0076] Figure 2 A flowchart of a low-cost full-automatic Ethernet switch aging test method provided for one or more embodiments of the present specification;
[0077] Figure 3A structural diagram of a switch aging test device is provided for one or more embodiments of the present specification. DETAILED DESCRIPTION
[0078] Embodiments of the present specification provide a switch aging test method, device and medium.
[0079] In order for those skilled in the art to better understand the technical solutions in the present specification, the technical solutions in the embodiments of the present specification will be described clearly and completely in conjunction with the drawings in the embodiments of the present specification. Obviously, the described embodiments are only part of the embodiments of the present specification, not all. Based on the embodiments of the present specification, all other embodiments obtained by those skilled in the art without creative labor should be within the scope of protection of the present specification.
[0080] Figure 1 A flowchart of a switch aging test method is provided for one or more embodiments of the present specification, which can be executed by a switch aging test system. Some input parameters or intermediate results in the flow allow manual intervention to adjust to help improve accuracy.
[0081] The method flow steps of the embodiments of the present specification are as follows:
[0082] S101, configuring aging test parameters for the aging test switch, wherein the aging test parameters include a preset aging test time.
[0083] In the embodiments of the present specification, the purpose of the aging test can be determined first, such as verifying the long-time running stability of the switch, detecting potential performance degradation, etc. According to the purpose of the aging test, a reasonable preset aging test time is set. For example, it can be set to 24 hours, 48 hours or more.
[0084] S102, after the aging test switch is started, the aging test script corresponding to the aging test switch is called in the background of the system.
[0085] In the embodiments of the present specification, it is ensured that the aging test script corresponding to the aging test switch has been prepared and can run in the background of the switch aging test system.
[0086] S103, during the running of the aging test script, creating one or more virtual local area networks (VLANs) based on the number of ports of the aging test switch, assigning each pair of ports in the aging test switch to the same VLAN, configuring each port in each VLAN as an inner loopback state, sending aging test packets to each port in each VLAN using a CPU, and sending and receiving the aging test packets between the ports in the inner loopback state to form continuous aging test traffic, so as to perform a persistent performance test on the aging test switch.
[0087] In the embodiments of the present specification, the number of ports of the aging test switch can be confirmed first. According to the number of ports of the switch, a corresponding number of VLANs can be created in the switch management interface. Each pair of ports is assigned to the same VLAN. For example, if the switch has 8 ports, 4 VLANs can be created, each containing 2 ports. The ports in each VLAN are configured as an inner loopback state. This can be achieved by setting the link mode of the port to "loopback". At the same time, the aging test script can be continuously running to perform a persistent test on the performance of the switch. The performance test can be used to collect performance indicators such as throughput, delay, packet loss rate, etc. to evaluate the performance of the switch.
[0088] S104, when the test time of the aging test reaches the preset aging test time, terminating the operation of sending and receiving the aging test packets between each pair of ports, and generating the aging test result of the aging test switch based on the cyclic sending and receiving of the aging test packets between the ports in each VLAN.
[0089] Further, the aging test parameters further include a preset aging test flag. Before the aging test script corresponding to the aging test switch is called in the background of the system, whether the aging test flag of the aging test switch is in a set state can be determined based on the preset aging test flag and the current aging test flag of the aging test switch. If yes, the aging test script corresponding to the aging test switch is called in the background of the system.
[0090] It should be noted that the above content can be implemented through the following specific embodiments:
[0091] Define a flag: define a preset aging test flag, which can be an environment variable, a parameter in a configuration file, a system variable, or an entry in a database.
[0092] Monitor the flag: set a monitoring program or service in the background of the system to periodically check the state of the current aging test flag.
[0093] Comparison logic: Write logic to compare the preset burn-in test flag with the current burn-in test flag. If they are consistent and the current flag is in the set state (e.g., value is 1 or on state), proceed to execute the script.
[0094] Execute script: If the current flag is in the set state, execute the command that invokes the burn-in test script corresponding to the burn-in test switch in the system background.
[0095] It should be noted that the embodiments of the present specification have the following beneficial effects through the above-mentioned solutions:
[0096] Automatic control: Through the comparison of the preset burn-in test flag and the current burn-in test flag, the automatic control of the burn-in test process is realized. This method can avoid manual intervention, reduce human error, and improve the accuracy and consistency of the test.
[0097] State monitoring: By judging the flag state of the burn-in test switch, the burn-in test state of the switch can be monitored in real time. If the flag is in the set state, it indicates that the switch is ready for burn-in test, which can ensure that the test starts at the right time.
[0098] Flexibility of test start: The introduction of the preset flag makes the start of the test more flexible. Only when certain conditions are met (such as the flag being set), the test script will be executed, which helps to avoid unnecessary test start and save resources.
[0099] Further, when the system background invokes the burn-in test script corresponding to the burn-in test switch, the system background can invoke the burn-in test script corresponding to the burn-in test switch; obtain the model information of the burn-in test switch, and initialize the variable information in the burn-in test script based on the model information of the burn-in test switch, the variable information including one or more of the port number, port type and log file type of the burn-in test switch.
[0100] It should be noted that regarding the above-mentioned content, the following specific implementation solutions can be used:
[0101] Model identification: Develop or use existing system commands or tools to obtain the model information of the burn-in test switch. This may require accessing the management interface of the switch or querying through network management protocols (such as SNMP).
[0102] Variable definition: Define variables in the burn-in test script, including port number, port type and log file type, etc.
[0103] Model information association: Set the corresponding variable value according to the obtained switch model information.
[0104] Background execution: Ensure that the aging test script can be executed in the system background. This may require setting it as a system service or using a cron job.
[0105] It should be noted that the embodiments in this specification, through the above-described solution, have the following beneficial effects:
[0106] Personalized test scripts: By obtaining the model information of the switch being tested for aging and initializing the variables in the test script accordingly, it is possible to ensure that the test script is optimized for a specific switch model. This method makes the testing more personalized and accurate, improving the effectiveness of the testing.
[0107] Enhanced adaptability: Variable information initialized based on switch model information (such as the number of ports, port type, and log file type) ensures that the test script is compatible with different switch models, enhancing the adaptability of the test method.
[0108] Test parameter optimization: By setting different test parameters for different switch models, real-world usage scenarios can be simulated more accurately, thereby optimizing test conditions and improving the reliability of test results.
[0109] Furthermore, the port types include electrical ports and optical ports. When configuring each port in each VLAN to be in an internal loopback state, if the port type in the VLAN is an electrical port, the physical layer device (PHY) associated with that port is configured to be in an internal loopback state; if the port type in the VLAN is an optical port, the serializer and deserializer (serdes) associated with that port are configured to be in an internal loopback state.
[0110] It should be noted that the embodiments in this specification, through the above-described solution, have the following beneficial effects:
[0111] Compatibility Support: By supporting both electrical and optical port types, this method can adapt to different types of network devices, enhancing test compatibility.
[0112] Simplified testing environment: By configuring ports within each VLAN to loopback mode, the complexity of external network connections can be avoided, simplifying the testing environment and making testing more direct and controllable.
[0113] Furthermore, when generating the aging test results of the aging test switch based on the cyclic sending and receiving of aging test messages between ports in each VLAN, the first number of aging test messages cyclically sent between ports in each VLAN and the second number of aging test messages cyclically received between ports in each VLAN can be counted; the first data volume and the second volume of ports in each VLAN can be compared to see if they are the same; if they are the same, the aging test switch is determined to have passed the aging test.
[0114] In the embodiments of the present specification, the aging test packet can be sent to other ports in the same VLAN from one port in each VLAN, and each port in the same VLAN can be configured to receive the packet sent by the sending port. The first number of the aging test packet sent between the ports in each VLAN, i.e., the number of times the sending end sends the packet, is counted. The second number of the aging test packet received between the ports in each VLAN, i.e., the number of times the receiving end receives the packet, is counted. The first data of the ports in each VLAN (the number of sending times) is compared with the second number (the number of receiving times) to check whether they are completely consistent. If the first data of the ports in all VLANs is the same as the second number, it is determined that the aging test switch passes the test; if there is an inconsistency, it is determined that the test fails.
[0115] It should be noted that the embodiments of the present specification have the following beneficial effects through the above-mentioned scheme:
[0116] Comprehensive testing: by circulating the aging test packet between the ports in each VLAN, this method can comprehensively test the data forwarding capability of the switch between different VLANs, and ensure that the switch can work stably in various network environments.
[0117] Data accuracy: counting the number of sent and received packets can accurately measure the data transmission performance of the switch, which helps to identify potential problems in the data transmission process.
[0118] Performance evaluation: by comparing the amount of data sent and received, it can be evaluated whether the performance of the switch is consistent, so as to determine whether the switch can continuously and stably process data flow.
[0119] Further, when each port in each VLAN is configured to be in an inner loopback state, the underlying software development kit (SDK) interface can be called to configure each port in each VLAN to be in an inner loopback state. The underlying SDK (software development kit) interface is called to configure the port, and the SDK provides an interface for interacting with the hardware underlying layer.
[0120] It should be noted that the embodiments of the present specification have the following beneficial effects through the above-mentioned scheme:
[0121] Simplified configuration process: the underlying software development kit (SDK) interface is called to configure the port, which simplifies the configuration process of the network device and reduces the errors and time required for manual configuration.
[0122] Further, before the CPU sends the aging test packet to each port in each VLAN, the statistical data of each port in each VLAN can be cleared to ensure that the test data is accurate and reliable.
[0123] It should be noted that the embodiments of the present specification have the following beneficial effects through the above-mentioned solutions.
[0124] Initial state consistency: By clearing the statistics of each port, it is ensured that the initial state of all ports is consistent before sending the aging test packet. This helps to obtain more accurate test results, because the test is not affected by previous data transmission activities.
[0125] Further, the aging test script is a Python-based aging test script. Python is an interpreted scripting language originally designed to write automation scripts (Shell). With the continuous updating of versions and the addition of new language features, it is increasingly used for independent large project development, covering web application development, data extraction, scientific computing and statistics, artificial intelligence and big data, system operation and maintenance, graphical interface development and many other fields. Python syntax and dynamic type, as well as the nature of interpreted language, make it a programming language for scripting and rapid application development on most platforms. With the continuous updating of versions and the addition of new language features, it is gradually used for independent and large project development. The present specification embodiments can select python script to develop an automated aging program.
[0126] The problem to be solved by the embodiments of the present specification is:
[0127] 1. The switch aging program is integrated into the switch network operating system to realize full-automatic processing of the aging process: loading the aging configuration, realizing automatic setting of the port, CPU packet sending processing, aging of the received and sent packet result statistics and judgment.
[0128] 2. The switch aging flow is controlled through the internal switch chip SDK interface to control the CPU to send test packets, saving external test instrument resources
[0129] 3. The switch device is configured with a VLAN isolation domain through the test port two by two, and the port self-loop is set, the long-time loopback test of the test packet is realized, the aging test effect is guaranteed, the aging process is simplified, and the cost of network cable and optical module is saved.
[0130] In view of the above problems, the purpose of the present application is to provide a low-cost full-automatic Ethernet switch aging test method.
[0131] The technical scheme adopted by the present application is that in the network operating system of the switch, a python running environment is integrated, an aging automation test script is run, automatic configuration is performed by using the script, specified packets are sent by using virtual local area network technology and CPU control switch chip, aging continuous flow test is realized, and after the test is completed, the test record is automatically judged and recorded. Figure 2A flowchart of a low-cost full-automatic Ethernet switch aging test method provided by an embodiment of the present specification is shown. Step 1: the switch device is normally started on the corresponding production test station, and after the aging flag and aging test time are enabled through the CLI command line configuration, the device is powered off. Step 2: the switch device is placed in the aging machine room, normally powered on, the software program is normally loaded and configured, and after the aging flag is obtained, the Python script for aging test is automatically called. Step 3: the Python script is automatically run, the initialization configuration of the device aging is performed according to the device model, the switch device ports are divided into two, an independent loop is formed, the switch chip bottom layer is controlled to configure, the port PHY / Serdes self-loop is set, and after the configuration is completed, the CPU controls the aging test message to be sent at each port, the control message is formed in the two ports through the self-loop and VLAN isolation. Step 4: after the Python script judges that the aging time is reached, the aging message loopback sending is stopped through the chip bottom layer control, the aging test result is obtained by comparing the number of messages received at each interface through the automatic test script, and recorded in the test result file, and the aging test flag bit and related configuration are cleared.
[0132] Most of the current switch network operating systems can easily integrate python runtime environment support.
[0133] Step 1: after the switch device is started on the production test station, the aging test time is set through the CLI (Comman Line Interface) aging configuration command line, and the aging test flag bit is set. The related configuration is saved to FLASH (non-volatile storage medium).
[0134] Step 2: thereafter, the switch device will be placed in the aging machine room, and after the switch device hardware self-checking is completed after power-on, the bootrom (basic input / output system) starts to work and loads the network operating system from the FLASH. The network operating system is loaded into the RAM and runs, and the network operating system is started (at this time, the system is in an executable state). The system will load the configuration to the current running environment running-config according to the current switch device configuration file. In this process, whether the device is normally started can be judged according to the state of the related device indicator light, and whether the related device is normally judged. After the network operating system is loaded and the management process is normally started, the switch device will judge the setting state of the aging test flag bit, if the setting is set, the Python script for aging test is called in the background of the system; otherwise, the switch enters the normal use state.
[0135] Step three: The corresponding test process specified in the aging test script. First, it will get the switch device model information to initialize the variable information in the script (port number, port type, log file path, etc.). After that, the script will start the relevant background service process, simulate user login to the switch CLI interface, and perform basic configuration of the switch. Including creating test VLAN according to the number of ports, used to isolate and manage test traffic, and testing ports are added to the same isolated VLAN, ensuring that they do not communicate directly, but can receive broadcast and multicast traffic from other ports. Before starting the flow test, clear the port statistics.
[0136] Then, by calling the underlying SDK interface, configure the port type. If it is an electrical port, configure the corresponding PHY of the port to loopback mode. If it is an optical port, configure the corresponding serdes of the port to loopback mode. Traverse all ports of the switch to complete the relevant configuration, specifically:
[0137] Call SDK interface: The script configures the port by calling the underlying SDK (Software Development Kit) interface. SDK provides an interface to interact with the hardware layer.
[0138] Electrical port configuration: For electrical ports, configure the corresponding PHY (Physical Layer Device) of the port to loopback mode. This mode allows the port to receive its own transmitted traffic, enabling testing.
[0139] Optical port configuration: For optical ports, configure the corresponding serdes (serializer-deserializer) of the port to loopback mode. Similarly, this is to achieve local traffic reception.
[0140] Traverse all ports: The script traverses all ports of the switch and completes the above configuration for each port.
[0141] Finally, control the SDK through the central processing unit (CPU) interface to send a specified number of aging test packets on the specified port. Since the ports of the switch device are divided into an isolated VLAN, through flooding and loopback, it ensures that the aging test packets are looped back between the specified ports, forming a continuous test controllable flow, specifically:
[0142] The CPU of the switch is responsible for control, and sends the aging test packet on the specified port to perform the aging test. After the aging test packet is sent from the specified port, the test packet is sent back to the same port due to the loopback set on the port. After the port receives the packet, the switch chip sends the data packet to all ports under the same VLAN except the source port through flooding. Since the ports of the switch are configured in pairs, they are divided into a separate VLAN. This means that the ports between different VLANs are isolated from each other, and the data packet will only be transmitted between ports in the same VLAN. After the packet is sent out of another port, the above process is repeated. Through the flooding and loopback mechanisms, the aging test packet can be sent in a loop between the specified ports, forming a closed-loop test flow. This means that the packet is sent between two ports, received by loopback, processed by the switch chip, and sent out again, and so on. Aging test usually needs to run for a long time to ensure the stability of the device or link under long-time running. In this way, the size of the test flow can be controlled, making the test result more reliable and repeatable.
[0143] Step four: The python script runs in the background, and after the aging time is reached, it stops the sending and receiving of loopback packets by breaking the VLAN isolation domain of the two-port pair. The automated test script automatically collects the packet transmission and reception statistics of all ports, and obtains the aging test results by comparison. According to the current script-controlled test packet transmission technology, the number of sent and received packets is exactly the same, which can be determined to pass the aging test.
[0144] After the aging test is completed, the relevant statistics and analysis results are recorded in the aging log file for subsequent production measurement machine position to read the information. At the same time, the aging test flag bit is automatically cleared. The device that has completed the aging test will behave the same as a normal device after subsequent startup.
[0145] It should be noted that the aging program of the embodiments of the present specification is integrated in the switch and automatically runs without human intervention, which is convenient for large-scale aging of devices; the aging test flow of the embodiments of the present specification is realized by using self-loop and CPU packet sending, which saves the cost of test instruments and devices; the port self-loop technology in the embodiments of the present specification can be used without external cables and optical modules, which simplifies the aging test process and also avoids related device consumable expenses, reducing costs.
[0146] Figure 3 A structural diagram of a switch aging test device provided by one or more embodiments of the present specification includes:
[0147] at least one processor; and
[0148] a memory in communication with the at least one processor; wherein
[0149] The memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to:
[0150] configuring an aging test parameter for the aging test switch, wherein the aging test parameter includes a preset aging test time;
[0151] after the aging test switch is started, calling a corresponding aging test script of the aging test switch in the background of the system;
[0152] when the aging test script is running, creating one or more virtual local area networks (VLANs) based on the number of ports of the aging test switch, assigning each pair of ports in the aging test switch to the same VLAN, configuring each port in each VLAN to an inner loopback state, sending aging test packets to each port in each VLAN using a CPU, and using the inner loopback state to cyclically send and receive aging test packets between the ports to form continuous aging test traffic and perform persistent performance testing on the aging test switch;
[0153] when the test time of the aging test reaches the preset aging test time, terminating the operation of sending and receiving aging test packets between each pair of ports, and generating an aging test result of the aging test switch based on the cyclic sending and receiving of aging test packets between the ports in each VLAN.
[0154] One or more embodiments of the present specification provide a non-volatile computer storage medium storing computer executable instructions, which, when executed by a computer, can implement:
[0155] configuring an aging test parameter for the aging test switch, wherein the aging test parameter includes a preset aging test time;
[0156] after the aging test switch is started, calling a corresponding aging test script of the aging test switch in the background of the system;
[0157] when the aging test script is running, creating one or more virtual local area networks (VLANs) based on the number of ports of the aging test switch, assigning each pair of ports in the aging test switch to the same VLAN, configuring each port in each VLAN to an inner loopback state, sending aging test packets to each port in each VLAN using a CPU, and using the inner loopback state to cyclically send and receive aging test packets between the ports to form continuous aging test traffic and perform persistent performance testing on the aging test switch;
[0158] When the test time of the aging test reaches the preset aging test time, the operation of sending and receiving the aging test packet between each pair of ports is terminated, and the aging test result of the aging test switch is generated based on the cyclic sending and receiving of the aging test packet between the ports in each VLAN.
[0159] The various embodiments in the specification are described in a progressive manner, and the same or similar parts between the various embodiments can be referred to each other. Each embodiment focuses on the difference from other embodiments. In particular, for the device and non-volatile computer storage medium embodiments, since they are basically similar to the method embodiments, the description is relatively simple, and the relevant parts can be referred to the part of the method embodiment.
Claims
1. A method for aging test of a switch, characterized in that, include: Configure aging test parameters for the aging test switch, wherein the aging test parameters include a preset aging test time; After the aging test switch is powered on and started, the corresponding aging test script of the aging test switch is called in the system background. When the aging test script runs, one or more Virtual Local Area Networks (VLANs) are created based on the number of ports of the aging test switch. Each pair of ports in the aging test switch is assigned to the same VLAN, and each port in each VLAN is configured in an inner loopback state. The CPU sends aging test packets to each port in each VLAN. The inner loopback state is used to send and receive aging test packets between ports in a loop to form continuous aging test traffic and perform persistent performance testing on the aging test switch. When the aging test time reaches the preset aging test time, the operation of sending and receiving aging test messages between each pair of ports is terminated, and aging test messages are sent and received cyclically between ports in each VLAN to generate the aging test result of the aging test switch. The aging test parameters also include preset aging test flags. Before calling the aging test script corresponding to the aging test switch in the system background, the method further includes: Based on the preset aging test flag and the current aging test flag of the aging test switch, determine whether the aging test flag of the aging test switch is in the set state. If so, execute the aging test script corresponding to the aging test switch that is called in the system background; The step of calling the aging test script corresponding to the aging test switch in the system background includes: The system background calls the aging test script corresponding to the aging test switch; Obtain the model information of the aging test switch, and initialize the variable information in the aging test script based on the model information of the aging test switch. The variable information includes one or more of the following: the number of ports, port type, and log file type of the aging test switch. The port types include electrical ports and optical ports. Configuring each port within each VLAN to be in an internal loopback state includes: If the port type within the VLAN is an electrical port, configure the physical layer device associated with that port in an internal loopback state; If the port type within the VLAN is an optical port, configure the serializer and deserializer associated with that port to be in inner loopback mode; The process of generating aging test results for the aging test switch based on the cyclical sending and receiving of aging test messages between ports in each VLAN includes: Count the first number of aging test packets cyclically sent between ports in each VLAN, and the second number of aging test packets cyclically received between ports in each VLAN; Compare whether the first and second data volumes of ports in each VLAN are the same; If they are the same, the aging test switch is determined to have passed the aging test; The aging test script is an aging test script generated based on Python.
2. The method according to claim 1, characterized in that, The step of configuring each port within each VLAN to be in an internal loopback state includes: By calling the underlying software development kit (SDK) interface, each port within each VLAN can be configured to be in inner loopback mode.
3. The method according to claim 1, characterized in that, Before sending aging test messages to each port in each VLAN using the CPU, the method further includes: Clear the statistics for each port in each VLAN.
4. A switch aging test device, characterized in that, include: At least one processor; as well as, A memory communicatively connected to the at least one processor; wherein, The memory stores instructions executable by the at least one processor, which, when executed by the at least one processor, enable the at least one processor to: Configure aging test parameters for the aging test switch, wherein the aging test parameters include a preset aging test time; After the aging test switch is powered on and started, the corresponding aging test script of the aging test switch is called in the system background. When the aging test script runs, one or more Virtual Local Area Networks (VLANs) are created based on the number of ports of the aging test switch. Each pair of ports in the aging test switch is assigned to the same VLAN, and each port in each VLAN is configured in an inner loopback state. The CPU sends aging test packets to each port in each VLAN. The inner loopback state is used to send and receive aging test packets between ports in a loop to form continuous aging test traffic and perform persistent performance testing on the aging test switch. When the aging test time reaches the preset aging test time, the operation of sending and receiving aging test messages between each pair of ports is terminated, and aging test messages are sent and received cyclically between ports in each VLAN to generate the aging test result of the aging test switch. The aging test parameters also include preset aging test flags. Before calling the aging test script corresponding to the aging test switch in the system background, the following steps are also included: Based on the preset aging test flag and the current aging test flag of the aging test switch, determine whether the aging test flag of the aging test switch is in the set state. If so, execute the aging test script corresponding to the aging test switch that is called in the system background; The step of calling the aging test script corresponding to the aging test switch in the system background includes: The system background calls the aging test script corresponding to the aging test switch; Obtain the model information of the aging test switch, and initialize the variable information in the aging test script based on the model information of the aging test switch. The variable information includes one or more of the following: the number of ports, port type, and log file type of the aging test switch. The port types include electrical ports and optical ports. Configuring each port within each VLAN to be in an internal loopback state includes: If the port type within the VLAN is an electrical port, configure the physical layer device associated with that port in an internal loopback state; If the port type within the VLAN is an optical port, configure the serializer and deserializer associated with that port to be in inner loopback mode; The process of generating aging test results for the aging test switch based on the cyclical sending and receiving of aging test messages between ports in each VLAN includes: Count the first number of aging test packets cyclically sent between ports in each VLAN, and the second number of aging test packets cyclically received between ports in each VLAN; Compare whether the first and second data volumes of ports in each VLAN are the same; If they are the same, the aging test switch is determined to have passed the aging test; The aging test script is an aging test script generated based on Python.
5. A non-volatile computer storage medium, characterized in that, It stores computer-executable instructions, which, when executed by a computer, can achieve the following: Configure aging test parameters for the aging test switch, wherein the aging test parameters include a preset aging test time; After the aging test switch is powered on and started, the corresponding aging test script of the aging test switch is called in the system background. When the aging test script runs, one or more Virtual Local Area Networks (VLANs) are created based on the number of ports of the aging test switch. Each pair of ports in the aging test switch is assigned to the same VLAN, and each port in each VLAN is configured in an inner loopback state. The CPU sends aging test packets to each port in each VLAN. The inner loopback state is used to send and receive aging test packets between ports in a loop to form continuous aging test traffic and perform persistent performance testing on the aging test switch. When the aging test time reaches the preset aging test time, the operation of sending and receiving aging test messages between each pair of ports is terminated, and aging test messages are sent and received cyclically between ports in each VLAN to generate the aging test result of the aging test switch. The aging test parameters also include preset aging test flags. Before calling the aging test script corresponding to the aging test switch in the system background, the following steps are also included: Based on the preset aging test flag and the current aging test flag of the aging test switch, determine whether the aging test flag of the aging test switch is in the set state. If so, execute the aging test script corresponding to the aging test switch that is called in the system background; The step of calling the aging test script corresponding to the aging test switch in the system background includes: The system background calls the aging test script corresponding to the aging test switch; Obtain the model information of the aging test switch, and initialize the variable information in the aging test script based on the model information of the aging test switch. The variable information includes one or more of the following: the number of ports, port type, and log file type of the aging test switch. The port types include electrical ports and optical ports. Configuring each port within each VLAN to be in an internal loopback state includes: If the port type within the VLAN is an electrical port, configure the physical layer device associated with that port in an internal loopback state; If the port type within the VLAN is an optical port, configure the serializer and deserializer associated with that port to be in inner loopback mode; The process of generating aging test results for the aging test switch based on the cyclical sending and receiving of aging test messages between ports in each VLAN includes: Count the first number of aging test packets cyclically sent between ports in each VLAN, and the second number of aging test packets cyclically received between ports in each VLAN; Compare whether the first and second data volumes of ports in each VLAN are the same; If they are the same, the aging test switch is determined to have passed the aging test; The aging test script is an aging test script generated based on Python.
Citation Information
Patent Citations
Switch port self-checking method and system, terminal and storage medium
CN110278126A
Method for carrying out aging test on network equipment based on test accompanying switch
CN118337682A