A method and system for switch testing using digital twin technology
By constructing switch models using digital twin technology, designing test scenarios, and using automated tools for testing, the problems of low test coverage and high cost in traditional switch testing are solved, achieving efficient and accurate switch testing.
Patent Information
- Application Number
- CN202310530346.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-09
- Publication Date
- 2026-01-02
- Estimated Expiration
- 2043-05-09
AI Technical Summary
Traditional switch testing struggles to cover all workloads and scenarios, resulting in low testing efficiency, high costs, and the need for significant manpower and resources.
Digital twin technology is used to construct a digital twin model of the switch. By simulating the hardware, software and network topology model of the switch, functional test scenarios are designed, black-box tests are performed using scripts written with automated testing tools, and the test results are recorded and analyzed.
It enables efficient and comprehensive switch testing, reduces costs, improves test coverage and efficiency, accurately simulates actual system behavior, and supports operational and management decisions.
Smart Images

Figure CN116633836B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of communication technology, in particular to a method and system for testing switch using digital twin technology. BACKGROUND
[0002] Traditional switch testing has become outdated in the current era of efficiency and profit, mainly having three problems: 1, it is difficult to cover all workloads and scenarios, resulting in unsatisfactory test results; 2, it is low in test efficiency by testing switches one by one; 3, it requires a large amount of manpower, material resources and time, and is high in cost.
[0003] Chinese patent CN112653593A "Ethernet traffic generation method based on switch" discloses a switch testing method, which generates full-bandwidth traffic through a switch to replace network testing instruments. The above method generates Ethernet traffic through a switch when testing the switch, but the switch still needs to be deployed and tested in the field to create an actual running environment of the switch, and lacks comprehensive performance testing and troubleshooting, affecting the operation and maintenance of the switch. SUMMARY
[0004] Therefore, the present application provides a method and system for testing switch using digital twin technology, which uses digital twin modeling method to perform comprehensive and efficient simulation testing in a computer virtual environment, saves time and resource cost, and completes the design, development and operation and maintenance of the switch.
[0005] The technical solution of the present application is as follows: on the one hand, the present application provides a method for testing switch using digital twin technology, comprising the following steps:
[0006] S1, using digital twin technology to construct a digital twin model of the switch, including a hardware model, a software model and a network topology structure model of the switch;
[0007] S2, based on the digital twin model, designing a function test scenario of the switch, including a VLAN configuration, a cross-switch link aggregation and a multi-path scheduling function test scenario;
[0008] S3, using an automatic test tool to write an automatic test script, and inserting test cases into the automatic test script;
[0009] S4, running the automatic test script to perform black box testing on the digital twin model, and recording the execution result of the test cases;
[0010] S5, comparing the execution result with the expected result to determine whether the test cases pass, and performing error tracking and positioning for the test cases that do not pass, locating and repairing problems in the switch.
[0011] Preferably, the step S2 comprises:
[0012] S21, modifying the digital twin model according to the actual running environment of the switch, and designing a test scenario;
[0013] S22, simulating a fault condition on the basis of the digital twin model, and testing the fault tolerance of the switch,
[0014] S23, writing a test case according to the test scenario;
[0015] S24, updating the test case according to the update of the software and hardware of the switch.
[0016] Preferably, the step S3 comprises:
[0017] S31, selecting an automated test tool, the automated test tool comprising Spirent Test Center, IxNetwork and TCL;
[0018] S32, writing a test script according to the test case;
[0019] S33, debugging, adjusting the test flow and the test case, and ensuring the test to be effectively performed when writing and running the test script;
[0020] S34, managing the version of the test script, the script library and the script document.
[0021] Preferably, the step S32 comprises:
[0022] According to the test case, a test script is written, the script comprising:
[0023] S321, connecting to a tool of the digital twin model;
[0024] S322, initializing a test environment, the initializing a test environment comprising a switch configuration and a configuration of a sent data packet;
[0025] S323, a test execution step, the test execution step comprising sending a data packet and checking a result;
[0026] S324, result output and summary, the result output and summary comprising outputting a test result and an error log.
[0027] Preferably, the step S4 comprises:
[0028] S41, collecting a test result: a test script generates a test result, and the test result is saved to a database, the test result comprising a test pass rate, a test failure number, a test case coverage rate and a test time;
[0029] S42, classify test results: classify test results into normal results and abnormal results, the abnormal results including test failure, test exception and test timeout; check and optimize abnormal results by test cases and test scenarios;
[0030] S43, analyze test results: according to test results, perform data analysis and problem discovery; the data analysis including statistics of test pass rate, test coverage, test cost and test time; the problem discovery including locating failed test cases and scenarios, locating failure causes, finding and solving problems;
[0031] S44, result report output: according to analysis results, output test report, the test report used for presenting test results, analyzing test data and explaining improvement suggestions;
[0032] S45, result tracing: trace problems occurred in test process to find out sources of problems.
[0033] Preferably, step S5 includes:
[0034] S51, monitor test data: monitor and statistics test cases, test execution time and test scenarios to find opportunities to improve test effect;
[0035] S52, track test problems: find test problems occurred in test by monitoring test data, analyze test problems, find out root causes, take measures to solve test problems, record and track test problems and solutions;
[0036] S53, optimize test environment: including configuring switches, adjusting network topology and optimizing virtualization environment;
[0037] S54, optimize test cases: use automated test tools, test case automatic generation tools and coverage analysis tools to improve test effect and increase test coverage;
[0038] S55, optimize test scripts: use automated test tools, write high-quality test scripts and focus on fault-tolerant and adaptive optimization methods of test scripts to improve test script quality.
[0039] Preferably, step S1 includes:
[0040] S11, hardware model: the hardware model includes physical elements of the switch, the physical elements including processor, memory, interface card, port and power supply; describe connection mode and running state of physical components of the switch, and use computer-aided design or three-dimensional modeling tool to establish the hardware model;
[0041] S12, software model: the software model includes the operating system, network protocol software and management software of the switch; describes the running state, interface, parameter setting and protocol support of the switch software, and uses a simulator or emulator tool to construct the software model;
[0042] S13, network topology model: the network topology model includes the connection mode and transmission path between the switch and other network devices, describes the line, bandwidth and delay of the network topology, and uses a network emulator tool to establish the topology model.
[0043] In another aspect, the present application also provides a system for testing a switch using digital twin technology, the system comprising:
[0044] a digital twin modeling module for constructing a digital twin model of the switch using digital twin technology, including a hardware model, a software model and a network topology model of the switch;
[0045] a scenario design and test case generation module for designing a functional test scenario of the switch based on the digital twin model, including a VLAN configuration, a cross-switch link aggregation and a multi-path scheduling functional test scenario;
[0046] a test script writing module for writing an automated test script using an automated test tool and inserting the test case into the automated test script;
[0047] a test script execution module for running the automated test script, performing black box testing on the digital twin model and recording the execution result of the test case;
[0048] a result analysis and error tracking module for comparing the execution result with an expected result, determining whether the test case passes, tracking and locating errors for the test case that does not pass, locating and fixing problems in the switch.
[0049] In another aspect, an embodiment of the present application also provides a device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the computer program is executed by the processor to implement the steps of the method for testing a switch using digital twin technology.
[0050] In another aspect, the present application also provides a computer readable storage medium, wherein a computer program is stored on the computer readable storage medium, and the computer program is executed by a processor to implement the steps of the method for testing a switch using digital twin technology.
[0051] The method and system for testing a switch using digital twin technology of the present application have the following beneficial effects over the prior art:
[0052] (1) Using digital twin technology for switchboard testing, realizing automatic testing, by simulating the actual physical system of the switchboard and the virtual system of the digital simulation of the switchboard, various switchboard testing scenes can be built, without the need to actually build various test environments, the prediction and optimization of different test environments of the switchboard can also be completed;
[0053] (2) For the key step of switchboard testing - scene design and test case generation, digital twin modeling can simulate the principles of physical and virtual systems, design and generate various test scenes, test reliable test scenes and generate sufficient and high-coverage test cases, improve test efficiency and test coverage, shorten test cycle and reduce test cost;
[0054] (3) Accurately simulate and test the behavior and performance of the actual system, thereby improving the test accuracy, realizing the decision support of operation and management, simulating different decision schemes in the digital model, thereby quickly evaluating the risk and decision effect. BRIEF DESCRIPTION OF DRAWINGS
[0055] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or the prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present application, and other drawings can be obtained by those skilled in the art without creative labor.
[0056] Figure 1 A method flow chart for testing a switchboard using digital twin technology according to the present application;
[0057] Figure 2 A system structure diagram for testing a switchboard using digital twin technology according to the present application. DETAILED DESCRIPTION
[0058] The technical solutions in the embodiments of the present application will be described in detail below, obviously, the described embodiments are only some embodiments of the present application, not all embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor are within the scope of protection of the present application.
[0059] It should be noted that the following explanations are made for digital modeling, establishing a digital twin model and switchboard testing:
[0060] (1) Digital modeling: First, the switch needs to be digitally modeled, modeling and describing the physical structure, electrical characteristics, software functions, and other elements of the switch. Through digital modeling, a digital twin model of the switch can be quickly established, and various test scenarios and test cases can be added. Virtual simulation: After establishing the digital twin model, the switch can be simulated and simulated through virtual simulation technology. Through the virtualized switch system, different test environments and test scenarios can be created, and various use cases can be tested to predict and optimize the performance and stability of the switch. Automatic control: During automated testing, various intelligent algorithms and control strategies are often used to automatically control and optimize the switch system. For example, adaptive control algorithms can be used to optimize and adaptively adjust the switch system online, so that the switch can maintain high efficiency and stability in different test scenarios. In summary, using digital twin technology for switch testing can achieve prediction and optimization of different test environments for the switch through digital modeling, virtual simulation, and automatic control, greatly improving test efficiency and accuracy, and providing strong support for optimization and improvement of the switch system.
[0061] (2) Establish a digital twin model: Based on the hardware, software, and topology of the switch, a digital twin model is established, and different modules and functions are combined to build a complex test sample. Design function and performance matrix: Based on test objectives and requirements, design a function and performance matrix to classify and combine various functions and performance indicators of the switch to form a matrix. Each cell in the matrix represents a specific test case, indicating the function and performance indicators that need to be tested. Generate test samples: Based on the function and performance matrix, generate test samples by combining different test cases to form a complete test sample. Test samples should cover various possible situations, including normal and abnormal situations.
[0062] (3) To ensure the stability and reliability of the switch in actual use, a series of tests and evaluations need to be conducted. At this time, digital twin technology can be used to establish a digital model of the switch and simulate and evaluate different test schemes to quickly evaluate risks and decision-making effects.
[0063] The specific steps are as follows:
[0064] 1. Digital modeling: First, the switch needs to be digitally modeled, modeling and describing the physical structure, electrical characteristics, software functions, and other elements of the switch. Through digital modeling, a digital twin model of the switch can be quickly established, and various test scenarios and test cases can be added.
[0065] 2. Virtual simulation: After establishing the digital twin model, various test scenarios and test cases can be simulated and emulated for the switch through virtual simulation technology. For example, the forwarding performance, transmission rate, network topology, etc. of the switch can be tested, and the configuration and parameters of the switch can be optimized according to the test results.
[0066] 3. Decision support: After simulation and testing, different test schemes can be evaluated and compared according to the simulation results and test data, and the optimal scheme can be selected for actual application. For example, the optimal configuration of the switch can be determined according to the simulation results, the operation strategy of the switch can be adjusted, and the performance of the switch can be improved, thereby providing decision support for operation and management.
[0067] In summary, through the digital twin technology, the behavior and performance of the switch can be accurately simulated and tested, which can improve the test accuracy, quickly evaluate the risk and decision effect, and provide strong support for the network construction and maintenance of enterprises.
[0068] A method for testing a switch using digital twin technology is provided, as shown in Figure 1 , comprising the following steps:
[0069] S1, using digital twin technology to construct a digital twin model of the switch, including a hardware model, a software model and a network topology structure model of the switch;
[0070] S2, based on the digital twin model, designing a functional test scenario of the switch, including a VLAN configuration, a cross-switch link aggregation, and a multi-path scheduling functional test scenario;
[0071] S3, using an automated test tool to write an automated test script, and inserting a test case into the automated test script;
[0072] S4, running the automated test script to perform black-box testing on the digital twin model, and recording the execution results of the test case;
[0073] S5, comparing the execution results with the expected results to determine whether the test case passes or not, and for the test case that does not pass, performing error tracking and positioning, locating and repairing the problems in the switch.
[0074] It should be noted that digital twin technology is applied in: 1. aerospace field; 2. automotive field; 3. energy field; 4. medical field. Digital twin technology is a technology that digitizes actual physical systems, aiming to predict, optimize and control actual physical systems through digital simulation models. It can be applied to various fields to support the research and development, design, testing, maintenance and optimization of actual physical systems.
[0075] There are three problems in switch testing:
[0076] 1. Cost of switch testing: Traditional switch testing requires a lot of manpower, material resources and time, and the cost is relatively high. However, using digital twin technology for switch testing can greatly reduce the cost of testing. Because digital twin technology can simulate the actual physical system, reducing the dependence on the actual physical system, thereby reducing the cost of testing.
[0077] 2. Coverage of switch testing: Traditional switch testing is difficult to cover all workloads and scenarios, resulting in less than ideal testing results. However, using digital twin technology for switch testing can simulate various different situations and scenarios through digital simulation models, thereby improving test coverage and effectiveness.
[0078] 3. Efficiency of switch testing: Traditional switch testing requires a lot of manpower, material resources and time, and the testing efficiency is relatively low. However, using digital twin technology for switch testing can greatly improve the efficiency of testing. Because digital twin technology can realize automatic testing, reducing the input of manpower, thereby improving the efficiency of testing.
[0079] The difficulty of implementation mainly lies in the following aspects:
[0080] 1. Data acquisition: Digital twin models need to be highly matched with actual physical systems, so a large amount of accurate and comprehensive data is needed to drive the digitalization process. For some actual physical systems, such as complex systems such as buildings and factories, it is necessary to integrate various data sources and perform data fusion, which is relatively difficult.
[0081] 2. Modeling and simulation: Digital twin technology needs to establish accurate and reliable mathematical models and conduct large-scale simulation and optimization testing. This requires professional knowledge and skills, as well as a large amount of computing resources and time investment.
[0082] 3. Model updating and iteration: As the actual physical system changes and develops, the digital twin model needs to be updated and iterated in real time to maintain its match with the actual physical system. Therefore, digital twin technology needs to establish an effective data feedback and updating mechanism, as well as a flexible model management and maintenance process.
[0083] 4. Security and privacy protection: Digital twin models often involve a large amount of sensitive information and confidential data, so data security and privacy protection issues need to be fully considered when establishing and using digital twin technology, and appropriate data encryption and data access control measures need to be taken.
[0084] The implementation of digital twin technology mainly reflects in data acquisition and processing, modeling and simulation, model updating and iteration, security and privacy protection, etc. Various factors and risks need to be fully considered, and appropriate technical and management strategies need to be taken to ensure the feasibility and effectiveness of actual application.
[0085] The method for testing the switch using the digital twin technology solves the problems of cost, coverage rate and efficiency of the traditional switch testing, and improves the effect and quality of the switch testing.
[0086] Step S1 comprises:
[0087] S11, hardware model: the hardware model includes the physical elements of the switch, including the processor, memory, interface card, port and power supply; the connection mode and running state of the physical components of the switch are described, and computer-aided design or three-dimensional modeling tools are used to establish the hardware model;
[0088] S12, software model: the software model includes the operating system, network protocol software and management software of the switch; the running state, interface, parameter setting and protocol support of the switch software are described, and the software model is constructed using a simulator or emulator tool;
[0089] S13, network topology model: the network topology model includes the connection mode and transmission path between the switch and other network devices, describes the line, bandwidth and delay of the network topology, and uses a network simulator tool to establish the topology model.
[0090] It should be noted that:
[0091] Hardware model: the switch hardware model includes the physical elements of the switch, such as processor, memory, interface card, port, power supply, etc. The connection mode and running state of each physical component of the switch need to be accurately described. Computer-aided design or three-dimensional modeling tools are usually used to establish the hardware model.
[0092] The process of digital twin modeling of hardware model needs to follow the basic process of hardware design and manufacturing, but adds the link of establishing digital twin. The following is the specific process of digital twin modeling:
[0093] 1. Data collection: collect data of switch hardware elements, including physical size, layout, circuit connection, input and output port, etc. Data collection can be obtained through sensors, test tools and simulation software.
[0094] 2. Model establishment: establish the switch hardware model through computer-aided design software or three-dimensional modeling tools, including circuit structure, element layout, connection mode, etc.
[0095] 3. Digital Twin Modeling: Apply the collected data to the model to establish a digital twin switch model. The performance and reliability of the switch hardware can be verified using simulation software. During the process of digital twin modeling, consider how to model each physical component and simulate its physical and logical interactions.
[0096] 4. Joint Verification: Jointly verify the digital twin switch model with the actual hardware. During this process, you can predict hardware failures, optimize design schemes, and improve the performance and reliability of the switch through the digital twin model.
[0097] 5. Application Promotion: Digital twin technology provides a new means for the design, development, and maintenance of switch hardware products. Using digital twin technology can significantly reduce costs and shorten development cycles, improving the quality and reliability of hardware products.
[0098] Software Model: The switch software model includes the operating system, network protocol software, and management software of the switch. It needs to describe the running state, interface, parameter settings, and protocol support of the switch software. Usually, a simulator or emulator tool is used to build the software model.
[0099] The specific process of using digital twin technology for software modeling of the switch is as follows:
[0100] 1. Data Collection: Collect data on the switch software, including parameter settings, protocol support, and interface information for the operating system, network protocol software, and management software, as well as the corresponding algorithm formulas.
[0101] 2. Model Establishment: Use a simulator or emulator tool to establish a switch software model, including simulators for the operating system, network protocol software, and management software.
[0102] 3. Digital Twin Modeling: Apply the collected data to the model to establish a digital twin switch software model. The performance and functionality of the switch software can be verified using simulation software. During the process of establishing a digital twin model, consider the network topology graph of the network topology structure model and the specific algorithm formulas in the software model.
[0103] 4. Joint Verification: Jointly verify the digital twin switch software model with the actual hardware. During this process, you can predict software failures, optimize design schemes, and improve the performance and reliability of the switch software through the digital twin model.
[0104] 5. Application Promotion: Digital twin technology provides a new means for the design, development, and maintenance of switch software products. Using digital twin technology can significantly reduce costs and shorten development cycles, improving the quality and reliability of software products.
[0105] Network topology model: The switch network topology model includes the connection mode and transmission path between switches and other network devices. Key parameters such as lines, bandwidth, delay, etc. need to be described to describe the network topology. Network simulator tools are usually used to establish the topology model.
[0106] By integrating the above three models, a complete digital twin model can be obtained, which can fully reflect the running state and behavior of the actual switch. In testing, the digital twin model can be used for black box testing to check whether each function of the switch is working properly, such as forwarding performance, routing capability, VLAN isolation, etc. Through the digital twin technology for switch testing, the test process can be carried out on the digital twin model, realizing efficient and fast switch testing.
[0107] Step S2 includes:
[0108] S21, according to the actual running environment of the switch, modifying the digital twin model, designing the test scene;
[0109] S22, on the basis of the digital twin model, simulating the fault condition, testing the fault tolerance of the switch, it should be pointed out that: step S2 can be divided into the following steps:
[0110] 1. Determine the test target and requirement: First, the function and performance indicators of the switch to be tested need to be determined, and the test target and requirement need to be determined.
[0111] 2. Establish a digital twin model: According to the information of the hardware, software and topology structure of the switch, establish a digital twin model, and design it in the Lego way, combine different modules and functions, and build a complex test sample.
[0112] 3. Design function and performance matrix diagram: Based on the test target and requirement, design the function and performance matrix diagram, classify and combine the functions and performance indicators of the switch, and form a matrix diagram. Each cell in the matrix diagram represents a specific test case, and the function and performance indicators to be tested by the test case are marked.
[0113] 4. Generate test sample: According to the function and performance matrix diagram, generate test sample, combine different test cases to form a complete test sample. The test sample should cover various possible situations, including normal and abnormal situations, etc.
[0114] 5. Execute test and analysis: Use automated test tools to execute test sample, record test data in time during test process, analyze test result, locate problem, and put forward improvement suggestion.
[0115] 6. Optimization of test samples and models: By continuously optimizing the digital twin model and test samples, the test efficiency and coverage are improved, further enhancing the accuracy and reliability of test results.
[0116] Based on the actual operating environment of the switch, different test scenarios can be designed according to the digital twin model. For example, the following two test scenarios can be designed:
[0117] 1. Load testing: Based on the digital twin model, modify the configuration parameters of the switch, increase the workload of the switch, simulate a large number of concurrent access and data transmission, etc., to test the performance and stability of the switch.
[0118] 2. Fault recovery testing: In the digital twin model, simulate the fault conditions of the switch, such as power failure, faulty components, etc., and then test the fault tolerance and recovery capabilities of the switch.
[0119] The following is a specific implementation:
[0120] 1. Load testing:
[0121] (1) Modify the configuration parameters of the digital twin model, increase the bandwidth and cache capacity of the switch, etc., to enhance the performance and workload capacity of the switch;
[0122] (2) Design test cases, including a large number of data transmission, concurrent access, etc. test scenarios to test the performance and stability of the switch;
[0123] (3) Use simulation software to perform virtual simulation, simulate test cases, and record test results and performance indicators;
[0124] (4) According to the test results, adjust and optimize the configuration parameters of the switch to improve the performance and load capacity of the switch.
[0125] 2. Fault recovery testing:
[0126] (1) In the digital twin model, simulate the fault conditions of the switch, such as power failure, faulty components, etc.
[0127] (2) Test the fault tolerance and recovery capabilities of the switch, record time and recovery speed, etc. performance indicators;
[0128] (3) Optimize and adjust the emergency measures and fault recovery process of the switch to improve the fault tolerance and recovery capabilities of the switch.
[0129] The following is a test scenario:
[0130] Before load testing: In the digital twin model, the switch configuration is low and cannot withstand a large number of concurrent access and data transmission, etc. load conditions.
[0131] After load testing: By modifying the configuration parameters of the switch and conducting load testing, better performance and stability are tested in the digital twin model.
[0132] Before fault recovery testing: In the digital twin model, the failure of the switch is not simulated.
[0133] After fault recovery testing: In the digital twin model, the failure of the switch is simulated, and its fault tolerance and recovery capabilities are tested.
[0134] S23, according to the test scenario, write test cases;
[0135] S24, according to the update of the switch software and hardware, update the test cases.
[0136] It should be noted that: scene design and test case generation: based on the digital twin model, design the test scenarios of each function of the switch, such as VLAN configuration, cross-switch link aggregation, multi-path scheduling, etc. Then generate the corresponding test cases according to the test scenarios. The following is the specific implementation process:
[0137] 1. Scene design: according to the actual running environment, design the test scene. For example, are the links between switches gigabit or gigabit? Which ports need to be isolated by VLAN? What type of data stream needs to be tested, such as video, audio, image, etc.? How to simulate the fault condition and test the fault tolerance of the switch, etc.
[0138] 2. Test case generation: according to the test scenario, write the corresponding test case. Test case refers to the specific test steps and input data. For example, test case can describe how to configure VLAN parameters, how to send data packets, how to check the forwarding path of data packets, how to simulate link failure, etc. Test cases need to include expected results to check whether the switch works as expected.
[0139] 3. Test case optimization: for large-scale test environment, the number and coverage of test cases need to be improved, otherwise the test results may not reflect the actual switch working condition. In order to improve the number and coverage of test cases, test case automatic generation tool or custom script can be used to quickly generate test cases.
[0140] 4. Test case maintenance: because the switch software and hardware often need to be updated, the test cases also need to be updated to ensure the effectiveness of the test.
[0141] Step S3 includes:
[0142] S31, select an automated testing tool, including Spirent Test Center, IxNetwork, and TCL;
[0143] S32, write a test script according to the test case;
[0144] S33, debug, adjust the test process and test case when writing and running the test script, and ensure that the test is effective;
[0145] S34, manage the version of the test script, script library, and script document.
[0146] According to the test case, write a test script, which includes:
[0147] S321, connect to the tool of the digital twin model;
[0148] S322, initialize the test environment, including switch configuration and sent packet configuration;
[0149] S323, test execution step, including sending data packets and checking results;
[0150] S324, result output and summary, including outputting test results and error logs.
[0151] It should be noted that the automated test script is written: using an automated test tool to write a test script, and inserting a test case into the script. The test case needs to contain the expected result.
[0152] Automated test script writing is one of the key steps of using digital twin technology for switch testing. The following is the specific implementation process of this step:
[0153] 1. Select an automated testing tool: The automated testing tool is a key tool for writing a test script. Selecting the appropriate automated testing tool can significantly improve the efficiency of the test. Common automated testing tools include Selenium, Appium, etc. For switch testing, tools such as Spirent Test Center, IxNetwork, TCL, etc. can be used for automated testing.
[0154] 2. Write test scripts: According to the test cases, write test scripts. Test scripts usually use programming languages such as Python, C++, etc. In the script, the following content needs to be included: (1) Connect to the digital twin model tool; (2) Initialize the test environment, including switch configuration, send data packets, etc.; (3) Test execution steps, including sending data packets, checking results, etc.; (4) Result output and summary, including test results and error logs.
[0155] 3. Script debugging: When writing and running test scripts, debugging is needed to adjust the test process and test cases to ensure correct and effective testing.
[0156] 4. Test script management: As the test requirements change and the switch updates, the test script also needs to be constantly updated and improved. Management of test scripts includes management of script versions, management of script libraries, and management of script documents, etc.
[0157] Automated test script writing is a very important step in using digital twin technology to test switches. By reasonably designing the test process and writing automated test scripts, we can achieve automation while improving test coverage, test efficiency, shortening test cycle, and reducing test cost.
[0158] Step S4 includes:
[0159] S41, collect test results: Test scripts generate test results and save test results to a database, including test pass rate, test failure times, test case coverage, and test time;
[0160] S42, classify test results: classify test results into normal results and abnormal results, including test failure, test exception and test timeout; check and optimize abnormal results by test cases and test scenarios;
[0161] S43, analyze test results: According to the test results, data analysis and problem discovery are carried out; the data analysis includes statistics of test pass rate, test coverage, test cost and test time; the problem discovery includes locating the failed test cases and scenarios, locating the failure reasons, finding and solving the problems;
[0162] S44, result report output: According to the analysis results, output the test report, which is used to present the test results, analyze the test data and explain the improvement suggestions;
[0163] S45, result tracing: Trace the problems that occur during the test process to find the source of the problem.
[0164] It should be noted that: test execution: run automated test scripts, perform black-box testing on digital twin models. During the test process, record the execution results of the test cases.
[0165] Test result analysis is the last step of using digital twin technology to test the switch. The following is the specific implementation process of this step:
[0166] 1. Collect test results: test results are generated by test scripts and saved to the test result database. Test results include test pass rate, test failure times, test case coverage, test time, etc.
[0167] 2. Classify test results: test results are usually classified into normal results and abnormal results. Abnormal results include test failure, test exception, test timeout, etc. For abnormal results, test cases and test scenarios need to be checked and optimized.
[0168] 3. Analyze test results: based on test results, perform data analysis and problem discovery. Data analysis includes statistics of test pass rate, test coverage, test cost and test time, etc. Problem discovery includes quickly locating test failed cases and scenarios, locating failure causes, finding and solving problems.
[0169] 4. Result report output: according to the analysis results, output test report. Test report presents test results, analyzes test data and explains improvement suggestions. Test report should be readable, understandable and traceable.
[0170] 5. Result trace: for problems that occur during the test process, the root cause of the problem needs to be found.
[0171] Step S5 includes:
[0172] S51, monitor test data: monitor and count test cases, test execution time and test scenarios to find opportunities to improve test effectiveness;
[0173] S52, track test problems: find test problems in the test process by monitoring test data, analyze test problems, find out the root cause, take measures to solve test problems, record and track test problems and solutions;
[0174] S53, optimize test environment: including configuring switches, adjusting network topology and optimizing virtualization environment;
[0175] S54, optimize test cases: use automated test tools, test case generation tools and coverage analysis tools to improve test effectiveness and increase test coverage;
[0176] It should be noted that coverage analysis tools and methods are used to evaluate the quality, scope and effectiveness of software testing, which can help testers classify, combine and optimize test cases. The following examples introduce several common coverage analysis tools and methods:
[0177] 1. Statement coverage: Statement coverage refers to the coverage of program statements by test cases, which reflects the coverage of test cases at the code level. Common statement coverage analysis tools include GCov and JaCoCo, etc.
[0178] 2. Branch coverage: Branch coverage refers to the coverage of branch statements by test cases, which reflects the coverage of test cases on program control flow. Common branch coverage analysis tools include Cobertura and Emma, etc.
[0179] 3. Condition coverage: Condition coverage refers to the coverage of conditional statements by test cases, which reflects the coverage of test cases on program logic. Common condition coverage analysis tools include LCov and BullseyeCoverage, etc.
[0180] 4. Path coverage: Path coverage refers to the coverage of program paths by test cases, which reflects the coverage of test cases on code execution paths. Common path coverage analysis tools include PathCov and Klee, etc.
[0181] In addition to the above common coverage analysis tools, there are other more advanced methods, such as model detection and symbolic execution, etc. Model detection is a testing method based on formalized model, which can analyze and verify the state, behavior and nature of the system comprehensively. Symbolic execution is a testing method based on symbolic calculation, which can decompose variables and parameters in the program into symbolic variables, and perform complete path exploration and coverage analysis.
[0182] In summary, coverage analysis tools and methods can help testers quickly evaluate the quality and omissions of test cases, and provide guidance and suggestions, so as to optimize the testing process and improve the quality and stability of software switches.
[0183] S55, optimize test script: use automated testing tools, write high-quality test scripts, and focus on fault tolerance and adaptability optimization methods to improve the quality of test scripts.
[0184] It should be noted that result analysis and error tracking: compare the test results with the expected results to determine whether the test cases pass. For test cases that do not pass, perform error tracking and positioning to quickly locate and fix problems in the switch.
[0185] The continuous optimization of digital twin technology in switch testing refers to the continuous improvement and optimization of test environment, test case, test script, etc. to achieve continuous improvement of test effect. The following is the specific implementation process of this step:
[0186] 1. Monitor test data: monitoring test data is an important means to realize the continuous optimization of digital twin technology. Monitor and count test case, test execution time, test scene data to find opportunities to improve test effect.
[0187] 2. Track test problems: through monitoring test data, problems in testing can be found in time. Analyze the problem in detail, find out the root cause and take measures to solve the problem. At the same time, record and track test problems and solutions for later reference and reuse.
[0188] 3. Optimize test environment: test environment is the basis of testing. Optimizing test environment can improve test effect and test coverage. Optimizing test environment includes configuring switch, adjusting network topology structure, optimizing virtualization environment, etc.
[0189] 4. Optimize test case: test case is the guarantee of test effect. Optimizing test case can improve test effect and test coverage. Use automated testing, test case automatic generation tool, coverage analysis tool, etc. to optimize test case and increase test coverage.
[0190] 5. Optimize test script: test script is the key to realize automated testing. Optimizing test script can improve test efficiency and test reliability. Use automated testing tools, write high-quality test scripts, pay attention to fault tolerance and adaptability of test scripts, etc. to improve the quality of test scripts.
[0191] The continuous optimization of digital twin technology in switch testing is a continuous improvement and improvement process. Through monitoring test data, tracking test problems, optimizing test environment, optimizing test case and optimizing test script, etc., the application effect of digital twin technology in switch testing is continuously optimized.
[0192] For a certain type of industrial-grade switch, a method for testing switch using digital twin technology is applied, and the steps are as follows:
[0193] 1. Digital twin modeling: for a certain type of industrial-grade switch, detailed data collection is carried out on its hardware and software, including internal chip, operating system, network protocol, etc. Parameters such as setting, protocol support and interface information, as well as corresponding algorithm formula. Then, use digital simulation software to model these data and build a digital twin switch model.
[0194] 2. Data collection and storage: During the actual operation of the switch, corresponding sensors and test tools are used to collect data, including port traffic, network delay, port status, etc. The collected data is stored in the database.
[0195] 3. Data processing and analysis: Machine learning, data mining and other technologies are used to process and analyze the collected data, analyze the performance indicators of the switch, such as port utilization, bandwidth utilization, delay, throughput, etc. Extract useful information, optimize and improve the digital twin model.
[0196] 4. Result presentation and optimization: Through the digital twin model, the running state and performance of the digital twin switch model are presented, and the model is optimized and improved, such as port scheduling strategy, network topology optimization, etc. Reasonable suggestions and solutions are proposed to improve the performance and reliability of the switch.
[0197] 5. Error tracking analysis: Analyze and track problems in the digital twin switch model, such as port failure, network failure, etc. Through the digital twin model, errors in switch hardware, software and network can be quickly found and eliminated, improving the efficiency and accuracy of switch troubleshooting.
[0198] Comparison with traditional methods for switch testing:
[0199] Using traditional methods, personnel need to be deployed and tested on site, creating an actual running environment for the switch, requiring a lot of manpower and material resources, making it difficult to conduct comprehensive scene simulation and stress testing, and the test results may be disturbed by external factors or operation errors, resulting in large errors. In contrast, using digital twin modeling methods, comprehensive and efficient simulation testing can be performed in a computer virtual environment, digital simulation software can accurately reflect the actual switch running state and performance, comprehensive performance testing and fault troubleshooting can be performed, improving the efficiency and accuracy of fault troubleshooting, while saving a lot of time and human and material resources costs. It is of great significance to the design, development and operation of the switch.
[0200] The above only describes the preferred embodiments of the present application and does not limit the present application. Any modification, equivalent replacement, improvement, etc. within the spirit and principles of the present application shall be included in the protection scope of the present application.
Claims
1. A method for switch testing using digital twin technology, the method comprising: The method comprises the following steps: S1, constructing a digital twin model of the switch using digital twin technology, including a hardware model, a software model, and a network topology model of the switch; S2, designing a functional test scenario for the switch based on the digital twin model, including VLAN configuration, cross-switch link aggregation, and multi-path scheduling functional test scenarios; S3, using an automated test tool to write an automated test script and inserting test cases into the automated test script; S4, running the automated test script to perform black-box testing on the digital twin model and recording the execution results of the test cases; S5, comparing the execution results with the expected results to determine whether the test cases pass, and for test cases that do not pass, performing error tracking and positioning to locate and fix problems in the switch; The step S5 comprises: S51, monitoring test data: monitoring and statistics of test cases, test execution time, and test scenarios to find opportunities to improve test effectiveness; S52, tracking test problems: finding and analyzing test problems that occur during testing to identify root causes, taking measures to solve the test problems, and recording and tracking the test problems and solutions; S53, optimizing the test environment: including configuring the switch, adjusting the network topology, and optimizing the virtualization environment; S54, optimizing test cases: using automated test tools, test case generation tools, and coverage analysis tools to improve test effectiveness and increase test coverage; S55, optimizing test scripts: using automated test tools, writing test scripts, and focusing on fault tolerance and adaptability optimization methods to improve the quality of test scripts.
2. The method for switch testing using digital twin technology of claim 1, wherein, The step S2 comprises: S21, modifying the digital twin model according to the actual operating environment of the switch and designing the test scenario; S22, writing test cases according to the test scenario; S23, updating the test cases according to the updates of the switch software and hardware.
3. The method for testing a switch using digital twin technology of claim 1, wherein, The step S3 comprises: S31, selecting an automated test tool, including Spirent TestCenter, IxNetwork, and TCL; S32, writing test scripts according to test cases; S33, debugging, adjusting test procedures and test cases, and ensuring effective testing when writing and running test scripts; S34, managing the version, script library, and script documentation of the test script.
4. The method for switch testing using digital twin technology of claim 3, wherein, The step S32 comprises: According to the test cases, the script comprises: S321, connecting to the digital twin model tool; S322, initializing the test environment, including switch configuration and sent data packet configuration; S323, test execution steps, including sending data packets and checking results; S324, result output and summary, including outputting test results and error logs.
5. The method for testing a switch using digital twin technology of claim 1, wherein, The step S4 comprises: S41, collecting test results: the test script generates test results, and saves the test results into a database, the test results including test pass rate, test failure times, test case coverage rate and test time; S42, classifying test results: classifying the test results into normal results and abnormal results, the abnormal results including test failure, test exception and test timeout; checking and optimizing the abnormal results through test cases and test scenes; S43, analyzing test results: analyzing data and finding problems according to the test results; the data analysis including statistics of test pass rate, test coverage rate, test cost and test time; the problem finding including locating failed test cases and scenes, locating failure causes, finding and solving problems; S44, outputting test reports: outputting test reports according to the analysis results, the test reports being used for presenting test results, analyzing test data and explaining improvement suggestions; S45, tracing results: tracing problems occurred in the test process to find the source of the problems.
6. The method for switch testing using digital twin technology of claim 1, wherein, The step S1 further includes: S11, hardware model: the hardware model including physical elements of the switch, the physical elements including processors, memories, interface cards, ports and power supplies; describing connection modes and running states of physical components of the switch, and establishing the hardware model by using computer-aided design or three-dimensional modeling tools; S12, software model: the software model including operating systems, network protocol software and management software of the switch; describing running states, interfaces, parameter settings and protocol supports of software of the switch, and constructing the software model by using simulators or emulators; S13, network topology structure model: the network topology structure model including connection modes and transmission paths between the switch and other network devices; describing lines, bandwidths and delays of the network topology, and establishing the topology structure model by using network emulator tools.
7. A system for switch testing using digital twin technology for performing a method for switch testing using digital twin technology according to any one of claims 1-6, characterized in that, The system includes: a digital twin modeling module for constructing a digital twin model of the switch by using digital twin technology, including a hardware model, a software model and a network topology structure model of the switch; a scene design and test case generation module for designing functional test scenes of the switch based on the digital twin model, including functional test scenes of VLAN configuration, cross-switch link aggregation and multi-path scheduling; a test script writing module for writing an automated test script by using an automated test tool, and inserting test cases into the automated test script; a test script execution module for running the automated test script, performing black-box testing on the digital twin model, and recording execution results of the test cases; a result analysis and error tracking module for comparing the execution results with expected results, determining whether the test cases pass, tracking and locating errors for test cases that do not pass, and locating and repairing problems in the switch.
8. An apparatus, comprising: The device includes a memory, a processor and a computer program stored on the memory and executable on the processor, the computer program implementing steps of the method according to any one of claims 1 to 6 when executed by the processor.
9. A computer-readable storage medium, characterized in that, The computer program is stored on a computer readable storage medium and comprises instructions which, when executed on a processor, implement the steps of the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Switch-based Ethernet generation method and device and switch test method
CN112653593A
Substation relay protection equipment parameter testing method and device based on digital twinning
CN114447874A
Automatic test method and system for switch
CN115208787A