A method, system, device, electronic equipment, and medium for testing switches.

By calling the inheritance unit in the test platform and using the class of the process control unit for inheritance and operation, the flexibility and scalability of switch testing are realized, the complexity and compatibility issues of switch production testing are solved, and the testing efficiency and result consistency are improved.

CN116566855BActive Publication Date: 2025-10-31INSPUR SUZHOU INTELLIGENT TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310777172.9
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-06-28
Publication Date
2025-10-31
Estimated Expiration
2043-06-28

AI Technical Summary

Technical Problem

The production and testing process for switches is complex, manual testing is prone to errors, and it is difficult to record and analyze data. In addition, the short development cycle and rapid iteration of switch products lead to diverse and demanding testing requirements, and existing testing systems are difficult to be compatible with different switch models.

Method used

This paper provides a switch testing method. By calling the inheritance unit in the test platform, the method uses the class of the process control unit to perform inheritance and target operations to realize the functional testing of the switch. It supports the testing requirements of different switch models and enables simultaneous testing of multiple switches through a multi-process test interface.

Benefits of technology

It improves testing efficiency, reduces development cycle and cost, obtains consistent test results, facilitates analysis and collaboration, supports communication between different test tasks, and is compatible with different versions of switches.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116566855B_ABST
    Figure CN116566855B_ABST
Patent Text Reader

Abstract

This invention provides a method, system, device, electronic device, and medium for testing switches, belonging to the field of switch technology. The method includes: obtaining the design documents of the switch to be tested and determining the test content of the switch; calling an inheritance unit corresponding to the test content in a test platform; wherein the test platform includes different inheritance units, and different inheritance units correspond to different test content; the inheritance unit is obtained by inheriting from a process control unit class in the test platform and performing a target operation on the class; and testing the switch based on the target class in the inheritance unit. The method provided by this invention not only makes the test platform more flexible and scalable, but also allows it to cope with different versions of switches or different testing requirements, reducing development difficulty and cost.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of switch technology, specifically relating to a switch testing method, system, device, electronic equipment, and medium. Background Technology

[0002] Switch production testing is a large and complex process, requiring significant material and human resources. Manual testing is prone to errors and makes it difficult to record and analyze results. To ensure the proper functioning of manufactured switches, extensive testing is necessary, including firmware flashing, system installation, routine testing, reliability testing, and aging testing. Therefore, switch production testing is a complex and demanding process.

[0003] However, due to market and customer demands, the development cycle of switch products is short, product iteration is fast, and there are many switch product models. In order to meet market and customer demands and ensure that the switches produced are functional, the requirements for switch production testing are high. Since different product models have different functions, corresponding production testing of various types of switches is an urgent problem to be solved. Summary of the Invention

[0004] In view of the above problems, embodiments of this application provide a switch testing method, system, apparatus, device, and medium to overcome or at least partially solve the above problems.

[0005] A first aspect of this application provides a switch testing method, the method comprising:

[0006] Obtain the design documents of the switch to be tested and determine the test content of the switch;

[0007] The test platform calls the inheritance unit corresponding to the test content; wherein the test platform includes different inheritance units, and different inheritance units correspond to different test content; the inheritance unit is obtained by inheriting from the class of the process control unit in the test platform and performing a target operation on the class; wherein the class is used to indicate the functions that need to be tested on the switch and the test order between the functions, and the target operation includes at least one of deletion, addition and modification.

[0008] The switch is tested based on the target class in the inheritance unit.

[0009] Optionally, testing the switch based on the target class in the inheritance unit includes:

[0010] Obtain the configuration file of the switch; wherein the configuration file includes test items and test instructions, and the design document contains the test items in the configuration file;

[0011] Based on the target class, the test items in the configuration file are tested.

[0012] Optionally, before obtaining the configuration file of the switch, the method further includes:

[0013] The function of the test device for the switch is checked to ensure it is working properly; wherein, the test device is used to simulate the application scenarios of the switch.

[0014] If normal, perform basic tests on the switch; wherein, the basic tests are performed without reading the configuration file;

[0015] After the basic tests of the switch are completed, the configuration file of the switch is obtained.

[0016] Optionally, testing the test items in the configuration file based on the target class includes:

[0017] In accordance with the testing order among the functions to be tested in the target class, at least one test interface corresponding to the test item is called sequentially; wherein, one test item corresponds to one function to be tested;

[0018] The test command corresponding to the test item is sent to the switch through the invoked test interface to test the test item in the configuration file.

[0019] Optionally, the inheritance unit is obtained through the following steps:

[0020] In response to the inheritance operation on the process control unit, the class in the process control unit is copied;

[0021] In response to the target operation performed on the copied function in the class, the updated function is obtained;

[0022] Save the updated function to obtain the inherited unit.

[0023] Optionally, during the testing of the switch, the method further includes:

[0024] The test progress of the switch is displayed in real time through a UI interface, and the test results of the switch are logged.

[0025] Optionally, testing the switch based on the target class in the inheritance unit includes:

[0026] Add a multi-process testing interface to the test platform;

[0027] Based on the multi-process test interface and the target class, multiple switches are tested simultaneously; wherein, multiple switches have the same product model.

[0028] A second aspect of this application provides a switch testing system applied to a testing platform. The system includes: a testing unit, a software tool unit, a process control unit, a switch configuration unit, and multiple inherited units; wherein...

[0029] The software tool unit includes multiple test interfaces for use by the test platform when testing the switch;

[0030] The process control unit is used to perform functional tests on the switch;

[0031] The switch configuration unit is used to acquire the test content of the switch;

[0032] Different inheritance units correspond to different test content. The inheritance unit is obtained by inheriting from the process control unit class in the test platform and performing target operations on the class.

[0033] The test unit is used to perform the switch test method as described in the first aspect of the embodiments of this application.

[0034] A third aspect of this application provides a switch testing apparatus, the apparatus comprising:

[0035] The determination module is used to obtain the design documents of the switch to be tested and determine the test content of the switch;

[0036] A calling module is used to call the inheritance unit corresponding to the test content in the test platform; wherein, the test platform includes different inheritance units, and different inheritance units correspond to different test contents; the inheritance unit is obtained by inheriting from the class of the process control unit in the test platform and performing a target operation on the class; wherein, the class is used to indicate the functions that need to be tested on the switch and the test order between the functions, and the target operation includes at least one of deletion, addition and modification.

[0037] The testing module is used to test the switch based on the target class in the inheritance unit.

[0038] Optionally, the test module includes:

[0039] An acquisition module is used to acquire the configuration file of the switch; wherein the configuration file includes test items and test instructions, and the design document contains the test items in the configuration file;

[0040] Based on the target class, the test items in the configuration file are tested.

[0041] Optionally, the device further includes:

[0042] The detection module is used to detect whether the function of the test device of the switch is normal; wherein, the test device is used to simulate the application scenario of the switch.

[0043] If normal, perform basic tests on the switch; wherein, the basic tests are performed without reading the configuration file;

[0044] After the basic tests of the switch are completed, the configuration file of the switch is obtained.

[0045] Optionally, the acquisition module includes:

[0046] The sending module is used to sequentially call at least one test interface corresponding to the test item according to the test order among the functions to be tested in the target class; wherein, one test item corresponds to one function to be tested;

[0047] The test command corresponding to the test item is sent to the switch through the invoked test interface to test the test item in the configuration file.

[0048] Optionally, the calling module includes:

[0049] A module is provided for copying the class in the process control unit in response to an inheritance operation on the process control unit;

[0050] In response to the target operation performed on the copied function in the class, the updated function is obtained;

[0051] Save the updated function to obtain the inherited unit.

[0052] Optionally, during the testing of the switch, the device further includes:

[0053] The display module is used to display the test progress of the switch in real time through a UI interface and to log the test results of the switch.

[0054] Optionally, the test module includes:

[0055] A parallel module is used to add a multi-process test interface to the test platform.

[0056] Based on the multi-process test interface and the target class, multiple switches are tested simultaneously; wherein, multiple switches have the same product model.

[0057] A fourth aspect of this application provides an electronic device, the electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the switch testing method as described in the first aspect of this application.

[0058] In a fifth aspect of this invention, a storage medium is provided, wherein when the program is executed by a processor, it implements the switch testing method as described in the first aspect of this application.

[0059] The switch testing method provided in this application first obtains the design documents of the switch to be tested and determines the test content of the switch. Then, it calls the inheritance unit corresponding to the test content in the test platform. The test platform includes different inheritance units, each corresponding to different test content. The inheritance unit is obtained by inheriting from the class of the process control unit in the test platform and performing target operations on the class. The class is used to indicate the functions that need to be tested on the switch and the test order between the functions. The target operation includes at least one of deletion, addition, and modification. Finally, the class in the inheritance unit is overloaded to obtain the target class for testing the switch, and the switch is tested based on the target class.

[0060] The method provided in this application allows for the selection of corresponding inheritance units to inherit the process control unit based on the test content of different switches. Without changing the process control unit, the inheritance of the process control unit and the target operation through the inheritance unit not only make the test platform flexible and scalable, enabling it to cope with different versions of switches or different test requirements, but also allow for the customization of test content according to the design requirements and test requirements of the switch, reducing the development cycle, development difficulty, and development cost.

[0061] Furthermore, using a unified testing platform and process control unit can yield consistent test results and report formats, which facilitates the comparison and analysis of test results and supports communication and collaboration between different test tasks. Due to minimal program modifications, testing of the production test system itself can be carried out on a very small scale, and it supports parallel testing of multiple switches, which can significantly improve testing efficiency. Attached Figure Description

[0062] To more clearly illustrate the technical solutions of the embodiments of this application, the drawings used in the description of the embodiments of this application will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0063] Figure 1 This is a flowchart of the steps of a switch testing method provided in an embodiment of this application;

[0064] Figure 2 This is a schematic diagram of an automatic test management system for switches provided in an embodiment of this application;

[0065] Figure 3 This is a flowchart of an automatic testing system for switches provided in an embodiment of this application;

[0066] Figure 4 This is a schematic diagram of a switch testing device provided in an embodiment of this application;

[0067] Figure 5 This is a schematic diagram of an electronic device provided in an embodiment of this application. Detailed Implementation

[0068] Exemplary embodiments of this application will now be described in more detail with reference to the accompanying drawings. While exemplary embodiments of this application are shown in the drawings, it should be understood that this application may be implemented in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided to enable a more thorough understanding of this application and to fully convey the scope of this application to those skilled in the art.

[0069] A switch is a general term for technologies that, according to the information transmission needs of both ends of a communication connection, send the information to the appropriate route according to the requirements, either manually or automatically. Based on the forwarding layer, switches can be divided into L2 switches and L3 switches; based on the system, they can be divided into black-box switches and white-box switches.

[0070] Compared to black-box switches, white-box switches are switches where both hardware and software are developed independently. That is, the switch hardware is developed by the hardware manufacturer, and the operating system uses open-source software. Based on the open-source software, secondary development can be carried out to add and remove functions according to one's own needs.

[0071] Against this backdrop, the problem addressed by this patent is how to enable the testing platform to run tests on switches automatically to the maximum extent possible, while being compatible with the testing of different switch models, reducing the development cycle of the switch testing system, and lowering development costs.

[0072] Therefore, this application provides a switch testing method, system, device, equipment, and medium to solve the above problems.

[0073] Example 1

[0074] Reference Figure 1 , Figure 1 This is a flowchart illustrating the steps of a switch testing method provided in an embodiment of this application. The method steps include:

[0075] Step S101: Obtain the design documents of the switch to be tested and determine the test content of the switch.

[0076] In this embodiment, the design document of the switch to be tested is first obtained. Before the development of the production test system, the R&D personnel will receive a design document about the switch. Through the design document, the R&D personnel can understand the characteristics of the switch and thus decide which functional tests to be performed on the switch. Through the design document, the R&D personnel can develop corresponding inheritance units and configuration files. The design document includes test content, thereby determining the test content of the switch.

[0077] Step S102: Invoke the inheritance unit corresponding to the test content in the test platform; wherein, the test platform includes different inheritance units, and different inheritance units correspond to different test contents; the inheritance unit is obtained by inheriting the class of the process control unit in the test platform and performing a target operation on the class; wherein, the class is used to indicate the functions that need to be tested on the switch and the test order between the functions, and the target operation includes at least one of deletion, addition and modification.

[0078] In this embodiment, the test platform includes different inheritance units. The test platform calls the inheritance unit corresponding to the test content. The test content includes the model of the switch. Different models will correspond to different inheritance units. The test programs will also be different for different models of switches. Therefore, the inheritance unit adapted to the switch can be called according to the test content of the switch.

[0079] An inheritance unit inherits from the process control unit class in the testing platform. Without changing the process control unit, the class is modified according to the test content. The class indicates the functions that need to be tested on the switch and the test order between these functions. The process control unit is like a production control template and cannot be arbitrarily modified. However, since the process control unit is implemented through a class and can be inherited and overridden, the inheritance unit can inherit from the process control unit class and, according to its own needs, perform at least one of the following operations: deletion, addition, or modification of the functions corresponding to the process control unit class. The inheritance unit can be implemented using the inheritance features of the Python language to inherit from the process control unit class.

[0080] For example, the switch to be tested needs to implement the installation of the customer's system. However, since this function is not implemented in the process control unit, the function can be added in the inheritance unit since the inheritance unit has inherited the class of the process control unit, and then added to the production test process, i.e., the test platform.

[0081] Step S103: Test the switch based on the target class in the inheritance unit.

[0082] In this embodiment, the target class in the inheritance unit is obtained by performing target operations on the class inherited by the inheritance unit, i.e., by overriding. Specifically, it is to illustrate that the function in the inheritance unit inherits from and performs target operations on the class of the process control unit, thereby realizing the specific functions of the switch and obtaining the target class of the test switch. Then, during the testing process, the test platform can test the switch according to the target class in the inheritance unit. The target class refers to the test function corresponding to the test content of the switch and the test order between the functions.

[0083] Then, based on the target class, the switch is tested. The process control unit can read the keywords and content of the configuration file to judge the branch structure and realize the production test of a specific switch.

[0084] For example, the test functions of classes in the process control unit are A, B, and C, and the test order of each function is also A, B, C. The inheritance unit inherits the classes from the process control unit, that is, it copies classes A, B, and C from the process control unit. Assuming the target operation is to delete B and add D, then the target classes in the inheritance unit are A, C, and D, and the test order is also A, C, D. At this point, the switch will be tested according to the test functions and test order corresponding to the target classes.

[0085] In one embodiment, testing the switch based on the target class in the inheritance unit includes:

[0086] Obtain the configuration file of the switch; wherein the configuration file includes test items and test instructions, and the design document contains the test items in the configuration file; test the test items in the configuration file based on the target class.

[0087] In this embodiment, the test platform includes a switch configuration unit. The switch configuration unit obtains the switch's configuration file. It should be noted that the configuration file includes test items and test instructions. Test items are test objectives or tasks defined in the switch test, describing specific aspects of the system or software that need to be verified. Test instructions are specific guidance given to testers during the test execution phase, used to perform specific test operations and record test results. The switch is tested using the test items and test instructions in the configuration file.

[0088] The switch configuration unit consists of two main parts. One part contains largely unchanging configurations, such as the IP address, username, and password for the MES (Manufacturing Execution System), the IP address, username, and password for the version control server, and the serial port IP address. This information is a fixed configuration for the switch product line and is not affected by changes in switch models; it applies to all switches. Furthermore, the switch configuration file is extracted from the switch's design documents. Therefore, some test items do not need to be extracted to the configuration file, as they are already present in the process control unit within the test platform. This saves time in extracting test items and improves efficiency. Therefore, the design documents include all test items from the configuration file.

[0089] In one embodiment, before obtaining the configuration file of the switch, the method further includes: detecting whether the function of the switch's auxiliary testing device is normal; wherein, the auxiliary testing device is used to simulate the application scenario of the switch; if normal, then performing basic tests on the switch; wherein, the basic tests are tests completed without reading the configuration file; after the basic tests of the switch are completed, obtaining the configuration file of the switch.

[0090] In this embodiment, before obtaining the switch's configuration file, it is necessary to check whether the testing platform's auxiliary testing equipment is functioning correctly. The auxiliary testing equipment is used to simulate the application scenarios of the switch, such as ensuring that the MES and version control server are working properly before testing, thus avoiding test failures due to auxiliary testing equipment malfunctions. If the auxiliary testing equipment is functioning correctly, then basic tests will be performed on the switch. Basic tests refer to functional tests that do not require reading the configuration file. These are tests based on the common characteristics of different switches, already stored in the testing platform, and will not be changed. These are functional tests that all switches need to undergo. Therefore, after the basic tests of the switch are completed, the switch's configuration file is obtained, and its potentially changed functions are tested according to the test items in the configuration file.

[0091] In addition, when testing the inherent functions of a switch, there is a possibility of reading the configuration file for testing. The configuration file may contain some differences from the inherent functional test methods and specific test content. Therefore, this application does not limit whether the test items in the configuration file include the inherent functional test content. R&D personnel can develop the configuration file according to the actual test needs.

[0092] In one embodiment, testing the test items in the configuration file based on the target class includes: sequentially calling at least one test interface corresponding to the test item according to the test order among the functions to be tested in the target class; wherein, one test item corresponds to one function to be tested; and sending the test instruction corresponding to the test item to the switch through the called test interface to test the test item in the configuration file.

[0093] In this embodiment, based on the test items and test instructions in the configuration file, and following the test order among the functions to be tested in the target class, since multiple test interfaces may be involved in testing a single test item, at least one test interface corresponding to each test item is called sequentially in the test order to test the switch. Each test item corresponds to one function to be tested. Specifically, the test is conducted by sending test instructions to the switch through the test interface. If the switch can correctly complete the test items and test instructions, then it can be determined that the switch is functioning normally.

[0094] In one embodiment, the inheritance unit is obtained through the following steps: in response to the inheritance operation of the process control unit, the class in the process control unit is copied; in response to the target operation performed on the function in the copied class, the updated function is obtained; the updated function is saved to obtain the inheritance unit.

[0095] In this embodiment, the inheritance unit, in response to the inheritance operation of the process control unit, copies the class in the process control unit, obtains the class in the process control unit, and does not modify the process control unit. Then, in response to the target operation performed on the function in the copied class, the target operation includes any one of deletion, addition, and modification, and then obtains the updated function. Finally, the updated function is saved in the inheritance unit, thus obtaining the inheritance unit corresponding to the switch. When the test platform tests the switch, it can call the corresponding inheritance unit to implement the special function test of the switch.

[0096] In one embodiment, during the testing of the switch, the method further includes:

[0097] The test progress of the switch is displayed in real time through a UI interface, and the test results of the switch are logged.

[0098] In this embodiment, a UI operation interface was developed to facilitate operation for production line workers during the testing of the switch. Through this interface, users can select the product and test station, perform switch testing by simply clicking buttons, and the UI interface can display the current test progress in real time, and log and summarize the test results.

[0099] The specific implementation method is illustrated using Redis (Remote Dictionary Server) as an example. During testing, the switch testing system broadcasts the test progress through the Redis service, and the UI interface can receive the test progress by subscribing to the broadcast and display the test progress on the UI interface, thus realizing the real-time display of test progress.

[0100] In one embodiment, testing the switch based on the target class in the inheritance unit includes: adding a multi-process test interface to the test platform; and simultaneously testing multiple switches based on the multi-process test interface and the target class; wherein the multiple switches have the same product model.

[0101] In this embodiment, since the testing program for switches of the same product model is the same, a multi-process testing interface can be added to the testing platform. By calling this interface, the testing platform will start multiple processes to run the production test program, enabling simultaneous testing of multiple switches of the same model and improving the testing efficiency of the switches.

[0102] Example 2

[0103] Reference Figure 2 , Figure 2This is a schematic diagram of an automatic test management system for switches provided in an embodiment of this application; applied to a test platform, the system includes: a test unit 201, a software tool unit 202, a process control unit 203, a switch configuration unit 204, and multiple inheritance units 205; wherein,

[0104] The software tool unit 202 includes multiple test interfaces for use by the test platform when testing the switch.

[0105] The process control unit 203 is used to perform functional tests on the switch.

[0106] The switch configuration unit 204 is used to acquire the test content of the switch.

[0107] Different inheritance units 205 correspond to different test contents. The inheritance unit 205 is obtained by inheriting the class of the process control unit in the test platform and performing target operations on the class.

[0108] The test unit 201 is used to perform the switch test method as described in the first aspect of the embodiments of this application.

[0109] Combination Figure 2 The following section further elaborates on the automatic test management system for switches, detailing the main functions and relationships of each unit:

[0110] First, there is the test unit 201, which is used to execute the switch test method provided in the embodiments of this application.

[0111] Software Tool Unit 202: In this embodiment, although different switches have different characteristics and testing methods, since the production testing environment and testing content of the switches are basically the same, commonly used software tool libraries can be developed based on these similarities. Common software libraries include: a general interface, which implements common interfaces used in the switch testing process, such as file upload and command issuance functions; a serial communication interface, which enables the switch testing system to interact with the switch through serial port services, including issuing commands to the switch and obtaining switch information; a multi-process interface, which enables parallel testing of the switch. By calling this interface, the industrial control machine can start multiple processes to run production testing programs, enabling simultaneous testing of multiple switches and greatly improving the testing efficiency of the switch; an MES interface, which is used to interact with the MES system. The MES system is an industrial production information maintenance system. Each time a switch is produced, the information of the switch to be produced must be maintained in advance, such as the switch's serial number, MAC address, firmware download path, etc. In actual production, the production information of the switch is obtained through the MES interface, such as obtaining the switch's MAC address and burning the obtained MAC address to the switch; and PDU (Protocol Data Unit). The Unit (Protocol Data Unit) control interface is used to communicate with the intelligent PDU and realize the PDU's power-on and power-off functions; the Redis service interface is used to send broadcast information; and the log recording interface is used to record logs during the production process for easy problem tracing.

[0112] In addition, other commonly used interfaces can be added to the software tool unit. These interfaces are highly reusable and can be called by the upper-level production test programs.

[0113] Process Control Unit 203: The process control unit is equivalent to a production control template. The production processes of different switches are roughly the same, so a process control unit was developed for the production process of typical switches. This unit is equivalent to a standard switch testing process, including two main parts: pre-test preparation and formal testing. Since the process control unit is implemented through a class and can be inherited and overridden, developers can overload the process control unit.

[0114] Switch Configuration Unit 204: The switch configuration unit consists of two main parts. One part contains basic, unchanging configurations, such as the MES IP address, username, password, version server IP address, username, password, and serial port IP address. This information is a fixed configuration for the switch product line and is applicable to all switches regardless of the switch model. The other part contains variable configurations. Specifically, it is used to retrieve the switch's configuration file. As mentioned earlier, the process control unit implements switch testing. Except for a few special cases where the basic process needs to be rewritten by calling an inherited unit, the testing of almost every switch follows the process control unit. Therefore, the process control unit needs to consider the characteristics of the switches to the greatest extent possible to achieve high compatibility. To this end, the switch testing system maintains a switch configuration unit, which maintains the characteristics of different switch products.

[0115] For example, regarding the CPU architecture of a switch, there are two types: ARM and x86. After determining the switch's CPU architecture, during actual testing, the production test system reads the configuration file to obtain the switch's CPU architecture. If it's ARM, it upgrades the uboot (Universal Bootloader); if it's x86, it upgrades the BIOS (Basic Input / Output System). It also checks whether the switch includes the BMC (Baseboard Management Controller), flow control commands, firmware upgrade lists, etc. The switch test system's process control unit reads the keywords and content of these configuration files, judges the branch structure, and implements production testing for specific switches.

[0116] Inheritance Unit 205: As mentioned above, the process control unit has developed a standard test process for switches. However, the test content and test process may differ for different switches. For example, some switches do not include the BMC (Baseboard Management Controller) function, so it is not necessary to test the BMC-related functions. Therefore, the relevant functions in the process control unit need to be deleted. Inheritance Unit 205 inherits the class of Process Control Unit 203. This unit inherits the class of Process Control Unit 203 and can override the methods in the class. By overriding the methods, specific functions of a particular switch can be implemented. Developers can modify the process control unit to reduce the workload. Due to the existence of the inheritance unit, the functions of the process control unit can be deleted, added, and modified.

[0117] Inheritance Unit 205: As mentioned above, the process control unit has developed a standard test process for switches. However, the test content and test process may differ for different switches. For example, some switches do not include the BMC (Baseboard Management Controller) function, so it is not necessary to test the BMC-related functions. Therefore, the relevant functions in the process control unit need to be deleted. Inheritance Unit 205 inherits the class of Process Control Unit 203. This unit inherits the class of Process Control Unit 203 and can override the methods in the class. By overriding the methods, specific functions of a particular switch can be implemented. Developers can modify the process control unit to reduce the workload. Due to the existence of the inheritance unit, the functions of the process control unit can be deleted, added, and modified.

[0118] In addition, a UI unit can be added to the automatic switch test management system. Through this interface, users can select products and test sites, and perform switch tests with simple button clicks. Simultaneously, the UI can display the current test progress in real time and summarize the test results.

[0119] Reference Figure 3 , Figure 3 This is a flowchart of an automatic switch testing system provided in an embodiment of this application; the automatic switch testing system is described below:

[0120] First, place the switch in the designated test location. According to the local database binding information, plug the PDU power cable into the power interface of the switch, plug the serial cable of the serial server into the serial port of the switch, and plug the network cable into the network port of the switch. If necessary, you will also need to prepare a USB flash drive and plug it into the USB interface of the switch.

[0121] The automated production testing system is started on the industrial control computer, i.e. the testing platform. The backend program is invisible to the user, but the user can operate it through the UI interface. After the user clicks "Start Test", the UI interface starts a multi-threaded service through the API (Application Programming Interface) provided by the backend program. This service then calls the main entry point of the backend program to start the test.

[0122] To prevent multiple system calls caused by users clicking the "Start Test" button repeatedly, the current switch's test status is maintained in a local real-time status database. When a user clicks the "Start Test" button for the first time, this status is set to "Running." When the user clicks "Start Test" again, the program first reads the switch's test status. If the current status is "Running," the program will not execute again, and the original test will not be affected. Finally, after the test is completed, the status is set to "Completed," and the user can start testing the next switch.

[0123] Step S301: After clicking "Start Test," the program first enters the precheck phase. The main task of this phase is to check whether the test devices, such as the MES, PDU, serial server, and server, are functioning properly. If any test device is found to be malfunctioning, the test terminates, and the user is notified of the name of the malfunctioning device through the UI. If all test devices are functioning properly, the program will power on the switch based on the PDU information provided by the local binding information database.

[0124] After the switch is powered on, the program first obtains the switch's serial number (SN) and uploads it to the MES system. It then asks the MES whether to allow the switch to continue testing. If permission is granted, the test continues. If the MES determines that the switch has a problem and testing should not continue, the test is terminated, and the user is notified of the reason for the termination.

[0125] Step S302: The program officially enters the switch functional testing phase, and Fwupgrade 1 is performed sequentially. st (First firmware upgrade test), Dual flash check (backup link check test), Fwupgrade 2 nd (Second firmware upgrade test), Fwversion check (firmware version check). The above tests are a general process, so these tests will definitely be performed. There is no situation where the configuration file is read to determine whether to perform the test.

[0126] Step S303: After the general process test is completed, the program reads the configuration file to determine the specific test item names and test commands that the switch needs to perform, referring to... Figure 3After reading the configuration file, the program will find Traffic test, Hbm test (High Bandwidth Memory Test), Krtest (Kernel Regression Test), Prbs test (Pseudo Random Bit Sequence Test), Uart test (Universal Asynchronous Receiver-Transmitter Test), and Rtc test (Real-Time Clock Test). Once the program obtains the test information, it calls the corresponding test interface. The test interface sends the test commands to the switch and executes them. After execution, it returns the test results and test logs. For example, if the configuration file specifies that Traffic test should not be performed, the production test program will not execute Traffic test.

[0127] Step S304: After completing the above functional tests, the switch begins to execute sysdiag (System Diagnostics) tests. Sysdiag tests require executing a series of test commands and reading configuration files. The configuration file determines which sysdiag tests to execute.

[0128] Step S305: After the above tests are completed, the test will end. If any test fails during the test, the test will also end.

[0129] It should be noted that the test process can be integrated with the UI. After the program obtains the return information from the switch, it processes the information to obtain the test results and feed them back to the UI. The UI then displays the results in the status bar, allowing the user to see the current test results. On the other hand, the program saves the test logs in a specified local location. Users can view the test results by clicking the log viewing function in the UI. To facilitate log viewing, this system can use a method of saving logs for individual test items, allowing users to view the logs of any test item.

[0130] In addition, the program summarizes the final test results. If all test items pass, the UI will indicate that the test has passed and the test on this machine has ended. If the program analysis finds that one or more test items failed during the test, the program will indicate the specific failure item and the reason for the failure through the UI. The user can locate the fault in the switch based on the reason for the failure.

[0131] Finally, if the test fails and the user repairs the switch according to the reason for the failure, the user can retest the switch. The test steps are repeated from steps S301S to S304 until all test items pass.

[0132] Example 3

[0133] Reference Figure 4 , Figure 4 This is a schematic diagram of a switch testing device provided in an embodiment of this application; the device includes: a determining module 401, a calling module 402, and a testing module 403.

[0134] The determination module 401 is used to obtain the design documents of the switch to be tested and determine the test content of the switch.

[0135] The calling module 402 is used to call the inheritance unit corresponding to the test content in the test platform; wherein, the test platform includes different inheritance units, and different inheritance units correspond to different test contents; the inheritance unit is obtained by inheriting from the class of the process control unit in the test platform and performing a target operation on the class; wherein, the class is used to indicate the functions that need to be tested on the switch and the test order between the functions, and the target operation includes at least one of deletion, addition and modification.

[0136] Test module 403 is used to test the switch based on the target class in the inheritance unit.

[0137] In this embodiment, the test module 403 includes:

[0138] An acquisition module is used to acquire the configuration file of the switch; wherein the configuration file includes test items and test instructions, and the design document contains the test items in the configuration file;

[0139] Based on the target class, the test items in the configuration file are tested.

[0140] In this embodiment, the device further includes: a detection module, used to detect whether the function of the test device of the switch is normal; wherein, the test device is used to simulate the application scenario of the switch; if normal, a basic test is performed on the switch; wherein, the basic test is a test completed without reading the configuration file; after the basic test of the switch is completed, the configuration file of the switch is obtained.

[0141] In this embodiment, the acquisition module includes a sending module, configured to sequentially call at least one test interface corresponding to the test item according to the test order among the functions to be tested in the target class; wherein, one test item corresponds to one function to be tested; and send the test instruction corresponding to the test item to the switch through the called test interface to test the test item in the configuration file.

[0142] In this embodiment, the calling module 402 includes: a obtaining module, configured to copy the class in the process control unit in response to the inheritance operation of the process control unit; obtain the updated function in response to the target operation performed on the function in the copied class; and save the updated function to obtain the inheritance unit.

[0143] In this embodiment, during the testing of the switch, the device further includes a display module, which is used to display the test progress of the switch in real time through a UI interface and log the test results of the switch.

[0144] In this embodiment, the test module 403 includes: a parallel module, used to add a multi-process test interface to the test platform; and to test multiple switches simultaneously based on the multi-process test interface and the target class; wherein the multiple switches have the same product model.

[0145] Example 4

[0146] This application provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the switch testing method described in this application.

[0147] In this embodiment, reference is made to... Figure 5 , Figure 5 This is a schematic diagram of an electronic device provided in an embodiment of this application; as shown... Figure 5 As shown, the electronic device 100 includes a memory 110 and a processor 120. The memory 110 and the processor 120 are connected via a bus communication connection. The memory 110 stores a computer program, which can run on the processor 120 to implement the switch testing method described in the embodiments of this application.

[0148] Example 5

[0149] This application provides a storage medium that, when executed by a processor, implements the switch testing method described in this application.

[0150] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.

[0151] Embodiments of the present invention are described with reference to flowchart illustrations and / or block diagrams of methods and apparatus according to embodiments of the invention. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing terminal device to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing terminal device, generate instructions for implementing the flowchart illustrations. Figure 1 One or more processes and / or boxes Figure 1 A device that provides the functions specified in one or more boxes.

[0152] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing terminal device to operate in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One or more processes and / or boxes Figure 1 The function specified in one or more boxes.

[0153] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal equipment, causing a series of operational steps to be performed on the computer or other programmable terminal equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable terminal equipment for implementing the process. Figure 1 One or more processes and / or boxes Figure 1 The steps of the function specified in one or more boxes.

[0154] Although preferred embodiments of the present invention have been described, those skilled in the art, upon learning the basic inventive concept, can make other changes and modifications to these embodiments. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments as well as all changes and modifications falling within the scope of the embodiments of the present invention.

[0155] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.

[0156] The present invention has provided a detailed description of a switch testing method, system, device, electronic device, and medium. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.

Claims

1. A method for testing a switch, characterized in that, The method includes: Obtain the design documents of the switch to be tested and determine the test content of the switch; The test platform calls the inheritance unit corresponding to the test content; wherein the test platform includes different inheritance units, and different inheritance units correspond to different test content; the inheritance unit is obtained by inheriting from the class of the process control unit in the test platform and performing a target operation on the class; the process control unit is a production control template that cannot be arbitrarily modified; wherein the class is used to indicate the functions that need to be tested on the switch and the test order between the functions, and the target operation is: selecting at least one operation among deleting, adding and modifying functions; The switch is tested based on the target class in the inheritance unit; The inheritance unit is obtained through the following steps: In response to the inheritance operation on the process control unit, the class in the process control unit is copied; In response to the target operation performed on the copied function in the class, the updated function is obtained; Save the updated function to obtain the inherited unit.

2. The method according to claim 1, characterized in that, The testing of the switch based on the target class in the inheritance unit includes: Obtain the configuration file of the switch; wherein the configuration file includes test items and test instructions, and the design document contains the test items in the configuration file; Based on the target class, the test items in the configuration file are tested.

3. The method according to claim 2, characterized in that, Before obtaining the configuration file of the switch, the method further includes: The function of the test device for the switch is checked to ensure it is working properly; wherein, the test device is used to simulate the application scenarios of the switch. If normal, perform basic tests on the switch; wherein, the basic tests are performed without reading the configuration file; After the basic tests of the switch are completed, the configuration file of the switch is obtained.

4. The method according to claim 2, characterized in that, The step of testing the test items in the configuration file based on the target class includes: In accordance with the testing order among the functions to be tested in the target class, at least one test interface corresponding to the test item is called sequentially; wherein, one test item corresponds to one function to be tested; The test command corresponding to the test item is sent to the switch through the invoked test interface to test the test item in the configuration file.

5. The method according to claim 1, characterized in that, During the testing of the switch, the method further includes: The test progress of the switch is displayed in real time through a UI interface, and the test results of the switch are logged.

6. The method according to claim 1, characterized in that, The testing of the switch based on the target class in the inheritance unit includes: Add a multi-process testing interface to the test platform; Based on the multi-process test interface and the target class, multiple switches are tested simultaneously; wherein, multiple switches have the same product model.

7. A switch testing system, characterized in that, Applied to a testing platform, the system includes: a testing unit, a software tool unit, a process control unit, a switch configuration unit, and multiple inherited units; wherein, The software tool unit includes multiple test interfaces for use by the test platform when testing the switch; The process control unit is used to perform functional tests on the switch; The switch configuration unit is used to acquire the test content of the switch; Different inheritance units correspond to different test content. The inheritance unit is obtained by inheriting from the process control unit class in the test platform and performing target operations on the class. The test unit is used to perform the switch test method as described in any one of claims 1-6.

8. A switch testing device, characterized in that, The device includes: The determination module is used to obtain the design documents of the switch to be tested and determine the test content of the switch; A calling module is used to call the inheritance unit corresponding to the test content in the test platform; wherein, the test platform includes different inheritance units, and different inheritance units correspond to different test contents; the inheritance unit is obtained by inheriting from the class of the process control unit in the test platform and performing a target operation on the class; the process control unit is a production control template that cannot be arbitrarily modified; wherein, the class is used to indicate the functions that need to be tested on the switch and the test order between the functions; the target operation is: selecting at least one operation among deleting, adding, and modifying functions; The testing module is used to test the switch based on the target class in the inheritance unit; The calling module includes: A module is provided for copying the class in the process control unit in response to an inheritance operation on the process control unit; In response to the target operation performed on the copied function in the class, the updated function is obtained; Save the updated function to obtain the inherited unit.

9. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the switch testing method as described in any one of claims 1-6.

10. A computer-readable storage medium having a computer program stored thereon, characterized in that, When executed by the processor, the program implements the switch testing method as described in any one of claims 1-6.

Citation Information

Patent Citations

  • Method to dynamically change microprocessor test software to reflect different silicon revision levels

    US6385740B1