A device testing method, apparatus, equipment and medium

By acquiring hardware and test information files and combining them with the total number of tests, the system automatically executes network switching equipment tests, solving the problems of low efficiency and high cost caused by manually writing scripts, and achieving efficient and accurate equipment testing.

CN115665005BActive Publication Date: 2026-03-10北京东土军悦科技有限公司
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-10-31
Publication Date
2026-03-10

AI Technical Summary

Technical Problem

In existing technologies, testing network switching equipment requires manually writing scripts to interact with the network switching equipment and network testing instruments, resulting in low efficiency, high cost, and difficulty in guaranteeing test quality.

Method used

By acquiring the hardware information file and test information file of the target network switching device, and combining the total number of tests, the device test script is invoked to automatically execute test operations, including configuration, data traffic transmission, and result verification.

Benefits of technology

The automated equipment testing process saves labor and time costs and improves testing efficiency and accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115665005B_ABST
    Figure CN115665005B_ABST
Patent Text Reader

Abstract

This invention discloses a device testing method, apparatus, equipment, and medium. The method includes: acquiring a hardware information file, a test information file, and a total number of tests corresponding to a target network switching device; wherein the hardware information file includes device information of the target network switching device and instrument information of a target network test instrument connected to the target network switching device; the test information file includes device interaction association information of the target network switching device and instrument interaction association information of the target network test instrument; and invoking a device test script to test the target network switching device based on the hardware information file, the test information file, and the total number of tests. This invention can automatically complete multiple tests required during the device testing process of a network switching device using a device test script, based on the corresponding hardware information file, test information file, and total number of tests, saving labor and time costs.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of communication, and in particular to a device testing method and device, apparatus and medium. BACKGROUND

[0002] Before a network switching device is put into use, the network switching device needs to be tested multiple times. In each testing process, the network switching device and a network testing instrument need to be interacted with respectively: a configuration command is issued to the network switching device, and echo information returned by the network switching device is checked; after the checking is passed, the network testing instrument is controlled to send constructed data traffic to a port of the network switching device, data traffic forwarded by the network switching device through the port is received, and a time delay, throughput and other traffic statistical results of the network switching device processing the data traffic are obtained; the network testing instrument feeds back traffic statistical results of the network switching device, and the traffic statistical results are checked to obtain a testing result of the network switching device this time.

[0003] In the related art, a script for interacting with the network switching device and the network testing instrument is usually written by a technician, and then the script is called in the testing process of the network switching device.

[0004] The defect of the related art is that the script for interacting with the network switching device and the network testing instrument needs to be written and called manually for each network switching device, which consumes a large amount of manpower, is low in efficiency and large in error, is high in labor cost and time cost, and cannot guarantee the testing quality. SUMMARY

[0005] The present application provides a device testing method, device, apparatus and medium to solve the problem in the device testing scheme of the related art that a script for interacting with a network switching device and a network testing instrument needs to be written and called manually for each network switching device, which consumes a large amount of manpower, is low in efficiency and large in error, is high in labor cost and time cost, and cannot guarantee the testing quality.

[0006] According to an aspect of the present application, a device testing method is provided, comprising:

[0007] obtaining a hardware information file corresponding to a target network switching device, a testing information file and a total number of tests; wherein the hardware information file contains device information of the target network switching device and instrument information of a target network testing instrument connected to the target network switching device, and the testing information file contains device interaction association information of the target network switching device and instrument interaction association information of the target network testing instrument;

[0008] The device test script is invoked, and the target network switching device is tested according to the hardware information file, the test information file, and the total number of tests.

[0009] According to another aspect of the present invention, a device testing apparatus is provided, comprising:

[0010] The data acquisition module is used to acquire the hardware information file, test information file, and total number of tests corresponding to the target network switching device; wherein, the hardware information file includes the device information of the target network switching device and the instrument information of the target network test instrument connected to the target network switching device, and the test information file includes the device interaction association information of the target network switching device and the instrument interaction association information of the target network test instrument;

[0011] The device testing module is used to call the device testing script, and to test the target network switching device according to the hardware information file, the test information file, and the total number of tests.

[0012] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:

[0013] At least one processor;

[0014] and a memory communicatively connected to the at least one processor;

[0015] The memory stores a computer program that can be executed by the at least one processor, which is then executed by the at least one processor to enable the at least one processor to perform the device testing method according to any embodiment of the present invention.

[0016] According to another aspect of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium storing computer instructions for causing a processor to execute and implement the device testing method according to any embodiment of the present invention.

[0017] The technical scheme of the embodiment of the present application acquires the hardware information file corresponding to the target network switching device, the test information file and the total test times; the hardware information file contains the device information of the target network switching device and the instrument information of the target network test instrument connected with the target network switching device, and the test information file contains the device interaction correlation information of the target network switching device and the instrument interaction correlation information of the target network test instrument; then the device test script is called to test the target network switching device according to the hardware information file, the test information file and the total test times, thereby solving the problems in the device test scheme of the related art, i.e., the script for interacting with the network switching device and the network test instrument needs to be written and called manually for each network switching device, which needs to consume a large amount of manpower, is low in efficiency and large in error, is high in labor cost and time cost, and cannot guarantee the test quality, and the beneficial effects of automatically testing the network switching device according to the hardware information file corresponding to the network switching device, the test information file and the total test times in the device test process, thereby automatically completing the multiple tests needed in the device test process of the network switching device, saving the labor cost and time cost, and improving the efficiency and accuracy of the test.

[0018] It should be understood that the content described in this part is not intended to identify the key or important features of the embodiments of the present application, nor is it used to limit the scope of the present application. Other features of the present application will become apparent from the following description. BRIEF DESCRIPTION OF DRAWINGS

[0019] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed in the embodiment description will be briefly introduced below. 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.

[0020] Figure 1 A flowchart of a device test method provided for the first embodiment of the present application.

[0021] Figure 2A A flowchart of a device test method provided for the second embodiment of the present application.

[0022] Figure 2B A schematic diagram of the operations needed to be performed in the test provided for the second embodiment of the present application.

[0023] Figure 2C A schematic diagram of the operations performed in the test provided for the second embodiment of the present application.

[0024] Figure 3A structural schematic diagram of a device testing apparatus provided for the third embodiment of the present application.

[0025] Figure 4 A structural schematic diagram of an electronic device for implementing the device testing method of the embodiment of the present application. DETAILED DESCRIPTION

[0026] In order to enable persons skilled in the art to better understand the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all other embodiments obtained by persons skilled in the art without creative labor should fall within the protection scope of the present application.

[0027] It should be noted that the terms "target", "first", "second" and the like in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily have to be used to describe a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "comprise", "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device comprising a series of steps or units does not have to be limited to only those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to the process, method, product or device.

[0028] Embodiment One

[0029] Figure 1 A flowchart of a device testing method provided for the first embodiment of the present application, the present embodiment can be applicable to the case of automatically testing a target network switching device according to real-time testing requirements. The method can be executed by a device testing apparatus, which can be realized in the form of hardware and / or software, and the device testing apparatus can be configured in an electronic device. As shown in the figure, the method comprises the following steps. Figure 1

[0030] Step 101: Obtain a hardware information file, a testing information file and a total testing number corresponding to a target network switching device.

[0031] The hardware information file contains device information of the target network switching device and instrument information of a target network testing instrument connected to the target network switching device, and the testing information file contains device interaction correlation information of the target network switching device and instrument interaction correlation information of the target network testing instrument. ​

[0032] Optionally, the target network switch is the network switch that needs to be tested. The target network test instrument connected to the target network switch is an electronic device used to send constructed data traffic to the first port of the target network switch, receive the data traffic forwarded by the target network switch through its second port, and obtain traffic statistics such as latency and throughput of the target network switch in processing the data traffic. Data traffic refers to the transmission of a large number of messages to form traffic. The first port of the target network switch is used to receive data traffic. The second port of the target network switch is used to send data traffic.

[0033] Optionally, the hardware information file is a file used to store device information of the target network switching device and instrument information of the target network test instrument connected to the target network switching device.

[0034] Optionally, the device information of the target network switch includes the device connection information and device login information of the target network switch. The device connection information is used to connect to the target network switch. The device connection information can be the Internet Protocol (IP) address of the target network switch. The device login information is used to log in to the target network switch. The device login information includes a username and password for logging into the target network switch.

[0035] Optionally, the instrument information of the target network test instrument includes the instrument connection information of the target network test instrument. The instrument information of the target network test instrument is information used to connect to the target network test instrument. The instrument information of the target network test instrument can be the IP address of the target network test instrument.

[0036] Optionally, the test information file is a file used to store the device interaction association information of the target network switching device and the instrument interaction association information of the target network test instrument.

[0037] Optionally, the device interaction association information of the target network switching device includes: configuration instructions and expected feedback information. The configuration instructions are the configuration commands that need to be sent to the target network switching device. The expected feedback information is the feedback information that the target network switching device, in its normal operating state, needs to return after completing the configuration according to the configuration instructions following the issuance of the configuration command.

[0038] Optionally, the instrument interaction association information of the target network test instrument includes: message configuration information and expected traffic statistics results. Message configuration information sets the message header and message content of each message used to generate traffic. Expected traffic statistics results are traffic statistics results such as latency and throughput of the target network switching device processing data traffic under normal operating conditions.

[0039] Optionally, during the testing of the network switching device, multiple tests may be performed on the network switching device. The total number of tests is the number of tests required for the target network switching device. For example, the total number of tests is 50.

[0040] Optionally, before obtaining the hardware information file, test information file, and total number of tests corresponding to the target network switching device, the method further includes: obtaining the hardware information file, test information file, and total number of tests uploaded by the user corresponding to each network switching device; and storing the device number of each network switching device, the hardware information file, test information file, and total number of tests corresponding to each network switching device into a preset database.

[0041] Optionally, the preset database is used to store hardware information files, test information files, and the total number of tests corresponding to the target network switching devices. Users upload the hardware information files, test information files, and the total number of tests corresponding to each network switching device to the electronic device via their terminal devices. The electronic device stores the device number of each network switching device, the corresponding hardware information files, test information files, and the total number of tests into the preset database. Thus, the preset database provides unified storage and management of the hardware information files, test information files, and the total number of tests corresponding to each network switching device.

[0042] Optionally, obtaining the hardware information file, test information file, and total number of tests corresponding to the target network switching device includes: retrieving the hardware information file, test information file, and total number of tests corresponding to each network switching device from a preset database stored with respect to the device number of the target network switching device. The electronic device can, based on the correspondence between the device numbers of each network switching device and their corresponding hardware information files, test information files, and total number of tests, retrieve the hardware information file, test information file, and total number of tests corresponding to the target network switching device from a preset database stored with respect to the device number of the target network switching device.

[0043] Optionally, the method further includes: acquiring data update information corresponding to the target network switching device input by the user, and updating the hardware information file, test information file, and / or total number of tests corresponding to the target network switching device based on the data update information. The data update information corresponding to the target network switching device is information used to update the hardware information file, test information file, and / or total number of tests corresponding to the target network switching device. The data update information may include a new hardware information file, a new test information file, and / or a new total number of tests corresponding to the target network switching device. Therefore, the hardware information file, test information file, and total number of tests corresponding to the target network switching device can be updated in a timely manner according to the user's testing needs.

[0044] In one specific example, the data update information includes a new test information file corresponding to the target network switching device. The electronic device obtains the new test information file corresponding to the target network switching device input by the user, and updates the test information file corresponding to the target network switching device with the new test information file.

[0045] In another specific example, the data update information includes a new hardware information file, a new test information file, and a new total number of tests corresponding to the target network switching device. The electronic device obtains the new hardware information file, the new test information file, and the new total number of tests corresponding to the target network switching device input by the user, updates the hardware information file corresponding to the target network switching device to the new hardware information file, updates the test information file corresponding to the target network switching device to the new test information file, and updates the total number of tests corresponding to the target network switching device to the new total number of tests.

[0046] Step 102: Call the device test script and use the device test script to test the target network switching device according to the hardware information file, the test information file, and the total number of tests.

[0047] Optionally, the device test script is a script written and set by the user in the electronic device. It is used to execute various operations in the device testing process according to the hardware information file, test information file and total number of tests corresponding to the network switching device, and to test the network switching device, thereby completing the multiple tests required in the device testing process of the network switching device.

[0048] Optionally, the step of calling the device test script to test the target network switching device based on the hardware information file, the test information file, and the total number of tests includes: calling the device test script and performing the following operations: configuring the target network switching device according to the hardware information file and the test information file; after the target network switching device is configured, controlling the target network test instrument to send data traffic to the target network switching device according to the hardware information file and the test information file, determining the current test result of the target network switching device, and saving the current test result to a preset storage location; clearing the target network switching device and the target network test instrument, incrementing the test count of the target network switching device by 1, and checking whether the test count of the target network switching device is equal to the total number of tests; if the test count of the target network switching device is not equal to the total number of tests, then returning to execute the operation of configuring the target network switching device according to the hardware information file and the test information file.

[0049] Optionally, after detecting whether the number of tests of the target network switching device is equal to the total number of tests, the method further includes: if the number of tests of the target network switching device is equal to the total number of tests, then determining that the device testing process of the target network switching device has ended.

[0050] Optionally, configuring the target network switching device according to the hardware information file and the test information file includes: reading device connection information and device login information corresponding to the target network switching device from the device information contained in the hardware information file; establishing a connection with the target network switching device according to the device connection information; logging into the target network switching device according to the device login information; reading configuration instructions and expected echo information corresponding to the target network switching device from the device interaction association information contained in the test information file; sending the configuration instructions to the target network switching device; obtaining the echo information returned by the target network switching device; detecting whether the expected echo information is included in the echo information; if so, determining that the configuration of the target network switching device is complete.

[0051] Optionally, after detecting whether the echo information contains the desired echo information, the method further includes: if not, returning to the operation of sending the configuration instruction to the target network switching device.

[0052] Optionally, the step of controlling the target network test instrument to send data traffic to the target network switching device based on the hardware information file and the test information file, and determining the test result of the target network switching device, includes: reading instrument connection information corresponding to the target network test instrument from the instrument information contained in the hardware information file; establishing a connection with the target network test instrument based on the instrument connection information; reading message configuration information and expected traffic statistics corresponding to the target network test instrument from the instrument interaction association information contained in the test information file; controlling the target network test instrument to construct data traffic; and sending the message configuration information to the target network test instrument so that the target network test instrument can configure the data traffic according to the message configuration information. The system sets information to configure the header and content of each packet used to form the data traffic; it controls the target network test instrument to start sending the configured data traffic to the first port of the target network switching device through the target port; it controls the target network test instrument to stop sending the configured data traffic to the first port of the target network switching device through the target port; it controls the target network test instrument to receive the data traffic forwarded by the target network switching device through the second port, determines the traffic statistics result of the target network switching device, and feeds back the traffic statistics result; it obtains the traffic statistics result fed back by the target network test instrument, and determines the test result of the target network switching device based on the traffic statistics result and the expected traffic statistics result.

[0053] Optionally, controlling the target network test instrument to construct data traffic includes: sending a data traffic construction instruction to the target network test instrument. The data traffic construction instruction instructs the target network test instrument to construct data traffic at a target port, that is, to create a preset number of packets at the target port. The preset number of packets constitutes the data traffic. The preset number can be set according to business requirements. For example, the preset number is 1000. The target port of the target network test instrument is a port used to send data traffic. The target port of the target network test instrument is connected to the first port of the target network switching device. After receiving the data traffic construction instruction, the target network test instrument constructs data traffic at the target port.

[0054] Optionally, timing begins when the target network test instrument starts sending the configured data traffic to the first port of the target network switching device through the target port; when the timing duration equals a preset duration, the target network test instrument stops sending the configured data traffic to the first port of the target network switching device through the target port. The preset duration can be set according to business needs. For example, the preset duration is 15 minutes.

[0055] Optionally, controlling the target network testing instrument to receive data traffic forwarded by the target network switching device through the second port, determining the traffic statistics result of the target network switching device, and feeding back the traffic statistics result includes: sending a result statistics instruction to the target network testing instrument. The result statistics instruction is used to instruct the target network testing instrument to: receive data traffic forwarded by the target network switching device through the second port via the traffic receiving port; determine the traffic statistics result of the target network switching device based on the forwarded data traffic; and feed back the traffic statistics result to the electronic device.

[0056] Optionally, the traffic statistics results of the target network switching device include the latency and throughput of the target network switching device in processing data traffic. Determining the traffic statistics results of the target network switching device based on the forwarded data traffic includes: determining the latency of the target network switching device in processing data traffic as the difference between the time when the target network switching device begins receiving forwarded data traffic and the time when it begins sending the data traffic after the setting to the target network switching device; and determining the throughput of the target network switching device in processing data traffic as the ratio between the total number of packets in the received forwarded data traffic and the total duration of the forwarded data traffic.

[0057] Optionally, the test result of the target network switching device in this test refers to the test result of the target network switching device in this test. The preset storage location is the storage location in the electronic device used to store the test results of the target network switching device in each test.

[0058] Optionally, the test result of the target network switching device is determined based on the traffic statistics result and the expected traffic statistics result, including: detecting whether the traffic statistics result and the expected traffic statistics result are the same; if so, the test result of the target network switching device is determined to be qualified; if not, the test result of the target network switching device is determined to be unqualified.

[0059] Optionally, a clearing operation is performed on the target network switching device and the target network test instrument, including: clearing the configuration information in the target network switching device; and clearing the data in the target network test instrument.

[0060] Optionally, the number of tests performed on the target network switching device is the number of tests completed by the target network switching device. Initially, the number of tests performed on the target network switching device is 0.

[0061] The technical solution of this invention obtains the hardware information file, test information file, and total number of tests corresponding to the target network switching device. The hardware information file includes the device information of the target network switching device and the instrument information of the target network test instrument connected to the target network switching device. The test information file includes the device interaction association information of the target network switching device and the instrument interaction association information of the target network test instrument. Then, a device test script is invoked to test the target network switching device according to the hardware information file, test information file, and the total number of tests. This solves the problem in related technology device testing schemes that require manual writing and invoking of scripts for interaction with network switching devices and network test instruments for each network switching device. This is labor-intensive, inefficient, and prone to errors, resulting in high labor and time costs and unreliable test quality. The solution achieves the beneficial effect of automatically executing various operations in the device testing process based on the hardware information file, test information file, and total number of tests corresponding to the network switching device through the device test script, thereby automatically completing the multiple tests required in the device testing process of the network switching device, saving labor and time costs, and improving the efficiency and accuracy of testing.

[0062] Example 2

[0063] Figure 2A This is a flowchart of a device testing method provided in Embodiment 2 of the present invention. This embodiment of the present invention can be combined with various optional solutions from one or more of the above embodiments. For example... Figure 2A As shown, the method includes:

[0064] Step 201: Obtain the hardware information file, test information file, and total number of tests corresponding to the target network switching device.

[0065] The hardware information file contains device information of the target network switching device and instrument information of the target network test instrument connected to the target network switching device. The test information file contains device interaction association information of the target network switching device and instrument interaction association information of the target network test instrument.

[0066] Step 202: Call the device test script. Using the device test script, configure the target network switching device according to the hardware information file and the test information file.

[0067] Optionally, configuring the target network switching device according to the hardware information file and the test information file includes: reading device connection information and device login information corresponding to the target network switching device from the device information contained in the hardware information file; establishing a connection with the target network switching device according to the device connection information; logging into the target network switching device according to the device login information; reading configuration instructions and expected echo information corresponding to the target network switching device from the device interaction association information contained in the test information file; sending the configuration instructions to the target network switching device; obtaining the echo information returned by the target network switching device; detecting whether the expected echo information is included in the echo information; if so, determining that the configuration of the target network switching device is complete.

[0068] Optionally, after detecting whether the echo information contains the desired echo information, the method further includes: if not, returning to the operation of sending the configuration instruction to the target network switching device.

[0069] Step 203: After the target network switching device is configured, the target network test instrument is controlled to send data traffic to the target network switching device according to the hardware information file and the test information file, based on the device test script, to determine the test result of the target network switching device and save the test result to a preset storage location.

[0070] Optionally, the step of controlling the target network test instrument to send data traffic to the target network switching device based on the hardware information file and the test information file, and determining the test result of the target network switching device, includes: reading instrument connection information corresponding to the target network test instrument from the instrument information contained in the hardware information file; establishing a connection with the target network test instrument based on the instrument connection information; reading message configuration information and expected traffic statistics corresponding to the target network test instrument from the instrument interaction association information contained in the test information file; controlling the target network test instrument to construct data traffic; and sending the message configuration information to the target network test instrument so that the target network test instrument can configure the data traffic according to the message configuration information. The system sets information to configure the header and content of each packet used to form the data traffic; it controls the target network test instrument to start sending the configured data traffic to the first port of the target network switching device through the target port; it controls the target network test instrument to stop sending the configured data traffic to the first port of the target network switching device through the target port; it controls the target network test instrument to receive the data traffic forwarded by the target network switching device through the second port, determines the traffic statistics result of the target network switching device, and feeds back the traffic statistics result; it obtains the traffic statistics result fed back by the target network test instrument, and determines the test result of the target network switching device based on the traffic statistics result and the expected traffic statistics result.

[0071] Step 204: Using the device test script, perform a clear operation on the target network switching device and the target network test instrument, increment the test count of the target network switching device by 1, and check whether the test count of the target network switching device is equal to the total test count: if yes, proceed to step 205; if no, return to step 202.

[0072] Step 205: Determine the end of the device testing process for the target network switching device using the device test script.

[0073] The technical solution of this invention achieves the beneficial effect of automatically performing various operations in the device testing process by using a device test script, based on the hardware information file, test information file, and total number of tests corresponding to the network switching device, thereby automatically completing the multiple tests required in the device testing process of the network switching device, saving manpower and time costs, and improving the efficiency and accuracy of testing.

[0074] In one optional embodiment of the present invention, optionally, such as Figure 2BAs shown, the operations that need to be performed in a test of the target network switching device include:

[0075] Step 211: Establish a connection with the target network switching device based on the device connection information.

[0076] Step 212: Log in to the target network switching device based on the device login information.

[0077] Step 213: Send the configuration command to the target network switching device.

[0078] Step 214: Obtain the echo information returned by the target network switching device.

[0079] Step 215: Check if the echo information contains the expected echo information: if yes, proceed to step 216; if no, return to step 213.

[0080] Step 216: Confirm that the target network switching device configuration is complete.

[0081] Step 217: Establish a connection with the target network test instrument based on the instrument connection information.

[0082] Step 218: Control the network test instrument to build data traffic.

[0083] Step 219: Send the message configuration information to the target network test instrument so that the target network test instrument can set the message header and message content of each message used to form data traffic according to the message configuration information.

[0084] Step 220: Control the target network test instrument to start sending the configured data traffic to the first port of the target network switching device through the target port.

[0085] Step 221: Control the target network test instrument to stop sending the configured data traffic to the first port of the target network switching device through the target port.

[0086] Step 222: Control the target network test instrument to receive the data traffic forwarded by the target network switching device through the second port, determine the traffic statistics results of the target network switching device, and feed back the traffic statistics results.

[0087] Step 223: Obtain the traffic statistics results fed back by the target network test instrument, and generate the test results of the target network switching device based on the traffic statistics results and the expected traffic statistics results.

[0088] In one optional embodiment of the present invention, optionally, such as Figure 2CAs shown, the operations performed in a single test of the target network switching device using the device test script, based on the hardware information file, test information file, and total number of tests corresponding to the network switching device, include:

[0089] Step 231: Read the device connection information and device login information corresponding to the target network switching device from the device information contained in the hardware information file.

[0090] Step 232: Based on the device connection information, establish a connection with the target network switching device.

[0091] Step 233: Log in to the target network switching device based on the device login information.

[0092] Step 234: Read the configuration instructions and expected feedback information corresponding to the target network switching device from the device interaction association information contained in the test information file.

[0093] Step 235: Send the configuration command to the target network switching device.

[0094] Step 236: Obtain the echo information returned by the target network switching device.

[0095] Step 237: Check if the echoed information contains the expected echoed information: if yes, proceed to step 238; if no, return to step 235.

[0096] Step 238: Confirm that the target network switching device configuration is complete.

[0097] Step 239: Read the instrument connection information corresponding to the target network test instrument from the instrument information contained in the hardware information file.

[0098] Step 240: Establish a connection with the target network test instrument based on the instrument connection information.

[0099] Step 241: Read the message configuration information and expected traffic statistics results corresponding to the target network test instrument from the instrument interaction association information contained in the test information file.

[0100] Step 242: Control the target network test instrument to construct data traffic.

[0101] Step 243: Send the message configuration information to the target network test instrument so that the target network test instrument can set the message header and message content of each message used to form data traffic according to the message configuration information.

[0102] Step 244: Control the target network test instrument to start sending the configured data traffic to the first port of the target network switching device through the target port.

[0103] Step 245: Control the target network test instrument to stop sending the configured data traffic to the first port of the target network switching device through the target port.

[0104] Step 246: Control the target network test instrument to receive the data traffic forwarded by the target network switching device through the second port, determine the traffic statistics results of the target network switching device, and feed back the traffic statistics results.

[0105] Step 247: Obtain the traffic statistics results fed back by the target network test instrument, and generate the test results of the target network switching device based on the traffic statistics results and the expected traffic statistics results.

[0106] Example 3

[0107] Figure 3 This is a schematic diagram of a device testing apparatus provided in Embodiment 3 of the present invention. The apparatus can be configured in an electronic device. Figure 3 As shown, the device includes a data acquisition module 301 and a device testing module 302.

[0108] The data acquisition module 301 is used to acquire the hardware information file, test information file, and total number of tests corresponding to the target network switching device. The hardware information file includes device information of the target network switching device and instrument information of the target network test instrument connected to the target network switching device. The test information file includes device interaction association information of the target network switching device and instrument interaction association information of the target network test instrument. The device testing module 302 is used to call a device test script to test the target network switching device based on the hardware information file, the test information file, and the total number of tests.

[0109] The technical solution of this invention obtains the hardware information file, test information file, and total number of tests corresponding to the target network switching device. The hardware information file includes the device information of the target network switching device and the instrument information of the target network test instrument connected to the target network switching device. The test information file includes the device interaction association information of the target network switching device and the instrument interaction association information of the target network test instrument. Then, a device test script is invoked to test the target network switching device according to the hardware information file, test information file, and the total number of tests. This solves the problem in related technology device testing schemes that require manual writing and invoking of scripts for interaction with network switching devices and network test instruments for each network switching device. This is labor-intensive, inefficient, and prone to errors, resulting in high labor and time costs and unreliable test quality. The solution achieves the beneficial effect of automatically executing various operations in the device testing process based on the hardware information file, test information file, and total number of tests corresponding to the network switching device through the device test script, thereby automatically completing the multiple tests required in the device testing process of the network switching device, saving labor and time costs, and improving the efficiency and accuracy of testing.

[0110] In an optional embodiment of the present invention, the device testing module 302 is specifically configured to: call the device testing script and perform the following operations through the device testing script: configure the target network switching device according to the hardware information file and the test information file; after the target network switching device is configured, control the target network testing instrument to send data traffic to the target network switching device according to the hardware information file and the test information file, determine the current test result of the target network switching device, and save the current test result to a preset storage location; perform a clear operation on the target network switching device and the target network testing instrument, increment the test count of the target network switching device by 1, and check whether the test count of the target network switching device is equal to the total test count; if the test count of the target network switching device is not equal to the total test count, then return to execute the operation of configuring the target network switching device according to the hardware information file and the test information file.

[0111] In an optional embodiment of the present invention, the device testing module 302 may be further configured to determine that the device testing process of the target network switching device ends if the number of tests of the target network switching device is equal to the total number of tests.

[0112] In an optional embodiment of the present invention, the device testing module 302, when performing the operation of configuring the target network switching device according to the hardware information file and the test information file, is specifically configured to: read device connection information and device login information corresponding to the target network switching device from the device information contained in the hardware information file; establish a connection with the target network switching device according to the device connection information; log in to the target network switching device according to the device login information; read configuration instructions and expected echo information corresponding to the target network switching device from the device interaction association information contained in the test information file; send the configuration instructions to the target network switching device; obtain the echo information returned by the target network switching device; detect whether the echo information contains the expected echo information; if so, determine that the configuration of the target network switching device is complete.

[0113] In an optional embodiment of the present invention, the device testing module 302, when performing the operation of controlling the target network testing instrument to send data traffic to the target network switching device according to the hardware information file and the test information file, and determining the test result of the target network switching device, specifically performs the following: reading instrument connection information corresponding to the target network testing instrument from the instrument information included in the hardware information file; establishing a connection with the target network testing instrument according to the instrument connection information; reading message configuration information and expected traffic statistics results corresponding to the target network testing instrument from the instrument interaction association information included in the test information file; controlling the target network testing instrument to construct data traffic; and sending the message configuration information to the target network testing instrument so that... The target network testing instrument sets the header and content of each packet used to form the data traffic according to the packet configuration information; controls the target network testing instrument to start sending the set data traffic to the first port of the target network switching device through the target port; controls the target network testing instrument to stop sending the set data traffic to the first port of the target network switching device through the target port; controls the target network testing instrument to receive the data traffic forwarded by the target network switching device through the second port, determines the traffic statistics result of the target network switching device, and feeds back the traffic statistics result; obtains the traffic statistics result fed back by the target network testing instrument, and determines the test result of the target network switching device based on the traffic statistics result and the expected traffic statistics result.

[0114] In an optional embodiment of the present invention, the data acquisition module 301 is specifically configured to: based on the device number of the target network switching device, obtain the hardware information file, test information file, and total number of tests corresponding to each network switching device stored in a preset database.

[0115] In an optional embodiment of the present invention, the data acquisition module 301 may be further configured to: acquire data update information input by the user corresponding to the target network switching device, and update the hardware information file, test information file and / or total number of tests corresponding to the target network switching device according to the data update information.

[0116] Regarding the apparatus in the above embodiments, the specific manner in which each module performs its operation has been described in detail in the embodiments related to the method, and will not be elaborated upon here.

[0117] The above-mentioned equipment testing apparatus can execute the equipment testing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects for executing the equipment testing method.

[0118] Example 4

[0119] Figure 4 A schematic diagram of an electronic device 10, which can be used to implement the device testing method of embodiments of the present invention, is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processors, cellular phones, smartphones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely illustrative and are not intended to limit the implementation of the invention described and / or claimed herein.

[0120] like Figure 4As shown, the electronic device 10 includes at least one processor 11 and a memory, such as a read-only memory (ROM) 12 or a random access memory (RAM) 13, communicatively connected to the at least one processor 11. The memory stores computer programs executable by the at least one processor. The processor 11 can perform various appropriate actions and processes based on the computer program stored in the ROM 12 or a computer program constructed from storage unit 18 into the RAM 13. The RAM 13 can also store various programs and data required for the operation of the electronic device 10. The processor 11, ROM 12, and RAM 13 are interconnected via a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.

[0121] Multiple components in electronic device 10 are connected to I / O interface 15, including: input unit 16, such as keyboard, mouse, etc.; output unit 17, such as various types of displays, speakers, etc.; storage unit 18, such as disk, optical disk, etc.; and communication unit 19, such as network card, modem, wireless transceiver, etc. Communication unit 19 allows electronic device 10 to exchange information / data with other devices through computer networks such as the Internet and / or various telecommunications networks.

[0122] Processor 11 can be a variety of general-purpose and / or special-purpose processing components with processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special-purpose artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any suitable processor, controller, microcontroller, etc. Processor 11 performs the various methods and processes described above, such as device testing methods.

[0123] In some embodiments, the device testing method may be implemented as a computer program tangibly contained in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via ROM 12 and / or communication unit 19. When the computer program is built into RAM 13 and executed by processor 11, one or more steps of the device testing method described above may be performed. Alternatively, in other embodiments, processor 11 may be configured to perform the device testing method by any other suitable means (e.g., by means of firmware).

[0124] Various embodiments of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field-programmable gate arrays (FPGAs), application-specific integrated circuits (ASICs), application-specific standard products (ASSPs), systems-on-a-chip (SoCs), payload-programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various embodiments may include implementations in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which may be a dedicated or general-purpose programmable processor, capable of receiving data and instructions from a storage system, at least one input device, and at least one output device, and transmitting data and instructions to the storage system, the at least one input device, and the at least one output device.

[0125] Computer programs used to implement the device testing methods of the present invention can be written in any combination of one or more programming languages. These computer programs can be provided to a processor of a general-purpose computer, a special-purpose computer, or other programmable data processing device, such that when executed by the processor, the computer programs cause the functions / operations specified in the flowcharts and / or block diagrams to be implemented. The computer programs can be executed entirely on a machine, partially on a machine, as a standalone software package partially on a machine and partially on a remote machine, or entirely on a remote machine or server.

[0126] In the context of this invention, a computer-readable storage medium can be a tangible medium that may contain or store a computer program for use by or in conjunction with an instruction execution system, apparatus, or device. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, apparatus, or devices, or any suitable combination thereof. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. More specific examples of machine-readable storage media include electrical connections based on one or more wires, portable computer disks, hard disks, random access memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fibers, portable compact disk read-only memory (CD-ROM), optical storage devices, magnetic storage devices, or any suitable combination thereof.

[0127] To provide interaction with a user, the systems and techniques described herein can be implemented on an electronic device having: a display device for displaying information to the user (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor); and a keyboard and pointing device (e.g., a mouse or trackball) through which the user provides input to the electronic device. Other types of devices can also be used to provide interaction with the user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including sound input, voice input, or tactile input).

[0128] The systems and technologies described herein can be implemented in computing systems that include backend components (e.g., as data servers), or computing systems that include middleware components (e.g., application servers), or computing systems that include frontend components (e.g., user computers with graphical user interfaces or web browsers through which users can interact with implementations of the systems and technologies described herein), or any combination of such backend, middleware, or frontend components. The components of the system can be interconnected via digital data communication of any form or medium (e.g., communication networks). Examples of communication networks include local area networks (LANs), wide area networks (WANs), blockchain networks, and the Internet.

[0129] A computing system can include clients and servers. Clients and servers are generally located far apart and typically interact through communication networks. The client-server relationship is created by computer programs running on the respective computers and having a client-server relationship with each other. The server can be a cloud server, also known as a cloud computing server or cloud host, which is a hosting product within the cloud computing service system to address the shortcomings of traditional physical hosts and VPS services, such as high management difficulty and weak business scalability.

[0130] It should be understood that the various forms of processes shown above can be used, with steps reordered, added, or deleted. For example, the steps described in this invention can be executed in parallel, sequentially, or in different orders, as long as the desired result of the technical solution of this invention can be achieved, and this is not limited herein.

[0131] The specific embodiments described above do not constitute a limitation on the scope of protection of this invention. Those skilled in the art should understand that various modifications, combinations, sub-combinations, and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this invention should be included within the scope of protection of this invention.

Claims

1. A device testing method, characterized by, The method comprises the following steps: obtaining a hardware information file corresponding to a target network switching device, a test information file, and a total test number; wherein the hardware information file contains device information of the target network switching device and instrument information of a target network test instrument connected to the target network switching device, and the test information file contains device interaction correlation information of the target network switching device and instrument interaction correlation information of the target network test instrument; calling a device test script to test the target network switching device according to the hardware information file, the test information file, and the total test number through the device test script, which comprises the following steps: calling the device test script to perform the following operations through the device test script: configuring the target network switching device according to the hardware information file and the test information file; after the configuration of the target network switching device is completed, controlling the target network test instrument to send data flow to the target network switching device according to the hardware information file and the test information file, determining a test result of the target network switching device, and saving the test result to a preset storage location; performing a cleaning operation on the target network switching device and the target network test instrument, adding 1 to a test number of the target network switching device, and detecting whether the test number of the target network switching device is equal to the total test number; if the test number of the target network switching device is not equal to the total test number, returning to perform the operation of configuring the target network switching device according to the hardware information file and the test information file; wherein the operation of configuring the target network switching device according to the hardware information file and the test information file comprises the following steps: reading device connection information and device login information corresponding to the target network switching device from the device information contained in the hardware information file; establishing a connection between the target network switching device according to the device connection information; logging into the target network switching device according to the device login information; reading configuration instructions and expected echo information corresponding to the target network switching device from the device interaction correlation information contained in the test information file; sending the configuration instructions to the target network switching device; obtaining echo information returned by the target network switching device; detecting whether the echo information contains the expected echo information; if yes, determining that the configuration of the target network switching device is completed; if no, returning to perform the operation of sending the configuration instructions to the target network switching device.

2. The method of claim 1, wherein, after detecting whether the test number of the target network switching device is equal to the total test number, the method further comprises the following steps: if the test number of the target network switching device is equal to the total test number, determining that a device test process of the target network switching device is completed.

3. The method of claim 1, wherein, The method comprises the following steps: reading, from the instrument information contained in the hardware information file, instrument connection information corresponding to the target network test instrument; establishing a connection with the target network test instrument according to the instrument connection information; reading, from the instrument interaction correlation information contained in the test information file, packet configuration information and expected traffic statistics results corresponding to the target network test instrument; controlling the target network test instrument to construct data traffic; sending the packet configuration information to the target network test instrument, so that the target network test instrument sets packet headers and packet contents of each packet used to form the data traffic according to the packet configuration information; controlling the target network test instrument to start sending the set data traffic to the first port of the target network switch device through the target port; controlling the target network test instrument to stop sending the set data traffic to the first port of the target network switch device through the target port; controlling the target network test instrument to receive data traffic forwarded by the target network switch device through the second port, determine traffic statistics results of the target network switch device, and feed back the traffic statistics results; obtaining the traffic statistics results fed back by the target network test instrument, and determining the test results of the target network switch device according to the traffic statistics results and the expected traffic statistics results.

4. The method of claim 1, wherein, The method comprises the following steps: obtaining the hardware information file, the test information file and the total test times corresponding to the target network switch device according to the device number of the target network switch device, from the hardware information file, the test information file and the total test times corresponding to each network switch device stored in a preset database.

5. The method of claim 1, wherein, The method further comprises the following steps: obtaining data update information corresponding to the target network switch device input by a user, and updating the hardware information file, the test information file and / or the total test times corresponding to the target network switch device according to the data update information.

6. An apparatus testing device, characterized by The method comprises the following steps: a data obtaining module is configured to obtain the hardware information file, the test information file and the total test times corresponding to the target network switch device; wherein the hardware information file contains device information of the target network switch device and instrument information of a target network test instrument connected to the target network switch device, and the test information file contains device interaction correlation information of the target network switch device and instrument interaction correlation information of the target network test instrument; a device testing module is configured to call a device testing script, and test the target network switch device according to the hardware information file, the test information file and the total test times through the device testing script. The device test module is specifically configured to invoke the device test script and perform the following operations through the device test script: configure the target network switch device according to the hardware information file and the test information file; after the target network switch device is configured, control the target network test instrument to send data traffic to the target network switch device according to the hardware information file and the test information file, determine a current test result of the target network switch device, and save the current test result to a preset storage location; perform a cleaning operation on the target network switch device and the target network test instrument, add 1 to a test number of the target network switch device, and detect whether the test number of the target network switch device is equal to the total test number; if the test number of the target network switch device is not equal to the total test number, return to perform the operation of configuring the target network switch device according to the hardware information file and the test information file; In the operation of configuring the target network switch device according to the hardware information file and the test information file, the device test module is specifically configured to: read device connection information and device login information corresponding to the target network switch device from device information contained in the hardware information file; establish a connection between the device test module and the target network switch device according to the device connection information; log in to the target network switch device according to the device login information; read configuration instructions and expected echo information corresponding to the target network switch device from device interaction association information contained in the test information file; send the configuration instructions to the target network switch device; obtain echo information returned by the target network switch device; detect whether the echo information contains the expected echo information; if yes, it is determined that the target network switch device is configured; if no, return to perform the operation of sending the configuration instructions to the target network switch device.

7. An electronic device, comprising: The electronic device comprises: at least one processor; and a memory connected in communication with the at least one processor; wherein the memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to perform the device test method of any one of claims 1-5.

8. A computer-readable storage medium, characterized in that, The computer readable storage medium stores computer instructions for enabling the processor to perform the device test method of any one of claims 1-5 when executed.

Citation Information

Patent Citations

  • Automatic test method and system for switch

    CN115208787A