CN118075181A - Automatic test method, equipment and medium for network equipment - Google Patents

Automatic test method, equipment and medium for network equipment Download PDF

Info

Publication number
CN118075181A
CN118075181A CN202410095788.2A CN202410095788A CN118075181A CN 118075181 A CN118075181 A CN 118075181A CN 202410095788 A CN202410095788 A CN 202410095788A CN 118075181 A CN118075181 A CN 118075181A
Authority
CN
China
Prior art keywords
test
configuration
functional module
event
file
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202410095788.2A
Other languages
Chinese (zh)
Inventor
尹莎
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Inspur Cisco Networking Technology Co Ltd
Original Assignee
Inspur Cisco Networking Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Inspur Cisco Networking Technology Co Ltd filed Critical Inspur Cisco Networking Technology Co Ltd
Priority to CN202410095788.2A priority Critical patent/CN118075181A/en
Publication of CN118075181A publication Critical patent/CN118075181A/en
Pending legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/0803Configuration setting
    • H04L41/0806Configuration setting for initial configuration or provisioning, e.g. plug-and-play
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L41/00Arrangements for maintenance, administration or management of data switching networks, e.g. of packet switching networks
    • H04L41/08Configuration management of networks or network elements
    • H04L41/085Retrieval of network configuration; Tracking network configuration history
    • H04L41/0859Retrieval of network configuration; Tracking network configuration history by keeping history of different configuration generations or by rolling back to previous configuration versions
    • H04L41/0863Retrieval of network configuration; Tracking network configuration history by keeping history of different configuration generations or by rolling back to previous configuration versions by rolling back to previous configuration versions

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The application discloses an automatic test method, equipment and medium of network equipment, wherein the method comprises the following steps: and initializing and configuring the tested functional module, executing a test process on the functional module through a test case, wherein the test case comprises a plurality of test steps, determining a designated test step corresponding to the test stopping event, and recovering the configuration executed by the test case in the test process based on the trigger of the configured recovery interface in the designated test step. When the test case is executed, a recovery interface is configured for each test step, so that when a test stopping event is triggered, the configuration executed in the test process of the test case can be recovered based on the triggering of the recovery interface corresponding to the test step, the function module is ensured to recover to an initialized state when the next test case is executed, the test time is saved, the test efficiency is improved, and the test stability is also improved.

Description

Automatic test method, equipment and medium for network equipment
Technical Field
The application relates to the technical field of computer software testing, in particular to an automatic testing method, equipment and medium for network equipment.
Background
With the popularization of the internet and the development of network application, the network communication demands are increasing, no matter individual users or enterprises, the network is increasingly relied on for service operation and information transmission, and network equipment is a key component for realizing the network communication, so that the performance of the network equipment is ensured to keep the network communication unobstructed and stable.
In order to ensure the efficient operation and stability of the network device, an automatic test needs to be performed on the network device, in the automatic test process, a test case is generally used for testing, and when each test case is executed, a functional module of the network device needs to be initialized to provide a test environment for the next test case, so that the test time is wasted, the test efficiency is influenced, and the test cost is greatly improved.
Disclosure of Invention
In order to solve the above problems, the present application provides an automated testing method for a network device, including:
Initializing and configuring the tested functional modules;
executing a test process on the functional module by a test case, wherein the test case comprises a plurality of test steps;
Determining a corresponding designated test step when a test stopping event is triggered;
And recovering the configuration executed by the test case in the test process based on the trigger of the configured recovery interface in the specified test step.
In another aspect, the present application also provides an automated test apparatus for a network device, including:
at least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores instructions executable by the at least one processor to enable the at least one processor to perform operations such as: the method for automatically testing the network device according to the above example.
In another aspect, the present application also provides a non-volatile computer storage medium storing computer-executable instructions configured to: the method for automatically testing the network device according to the above example.
The automatic test method of the network equipment provided by the application has the following beneficial effects:
By initializing the functional module in the network equipment, the repeatability and stability of the test can be ensured when the network equipment is automatically tested, the test effect is better, the environment conditions required by the test can be provided, the influence of old data on the test result is avoided, and the reliability and consistency of the test are ensured.
When the test case is executed, a recovery interface is configured for each test step, so that when a test stopping event is triggered, the configuration executed in the test process of the test case can be recovered based on the triggering of the recovery interface corresponding to the test step, the function module is ensured to recover to an initialized state when the next test case is executed, the test time is saved, the test efficiency is improved, and the test stability is also improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
fig. 1 is a flow chart of an automated test method for network equipment according to an embodiment of the present application;
Fig. 2 is a schematic diagram of a functional module initialization flow of an automatic test method for network devices according to an embodiment of the present application;
Fig. 3 is a schematic configuration recovery flow chart of an automatic test method of a network device according to an embodiment of the present application;
fig. 4 is a schematic configuration comparison flow chart of an automatic test method for network equipment according to an embodiment of the present application;
Fig. 5 is a schematic diagram of an automated test equipment for a network device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the technical solutions of the present application will be clearly and completely described below with reference to specific embodiments of the present application and corresponding drawings. It will be apparent that the described embodiments are only some, but not all, embodiments of the application. All other embodiments, which can be made by those skilled in the art based on the embodiments of the application without making any inventive effort, are intended to be within the scope of the application.
The following describes in detail the technical solutions provided by the embodiments of the present application with reference to the accompanying drawings.
As shown in fig. 1, an embodiment of the present application provides an automatic test method for a network device, including:
s101, initializing and configuring the tested functional modules.
It should be noted that, in the conventional automatic test process for the network device, the test topology of the functional modules is consistent with the initialization configuration, the test topology is used to describe the relationship and connection manner between the functional modules, and the connection manner and configuration of the modules in the test environment, and the test topology may take different forms, such as a topology chart, a network chart, or a document. By using the test topology, the method can help to determine the range and strategy of the test in the test process, better organize and manage the test work and improve the test efficiency and accuracy.
It should be noted that, the network device may be a switch, a router, a firewall, etc., and when executing test cases, the first step is to perform initialization configuration on the modules, but if each test case is executed, a process of initializing the module or resetting the test topology is performed once, which wastes a lot of time and labor costs in the initialization, and affects the efficiency of the test.
Therefore, when testing the network device, the functional module needs to be tested separately and independently, only the operation of initializing the module or resetting the test topology is executed once by taking the module as a unit, and each test case is not executed any more, and the configuration executed in the test process of the test case is restored only after the execution of each test case is finished, so that the configuration after the initialization of the module is restored, and the next test case is ensured not to be influenced when being executed.
Specifically, as shown in fig. 2, a test case is executed based on a module, a test requirement of a functional module is acquired, a configuration file of a corresponding initialization configuration is created according to the test requirement, and the initialization configuration is performed on the functional module based on the configuration file of the initialization configuration.
The test requirement of the functional module is a preset requirement on the function and performance of the network device, and the function of the network device is tested to see whether the requirement meets the expected requirement, including the requirements on the basic functions (such as a routing function, a switching function, a firewall function and the like) of the network device, the support of a protocol, the transmission and processing of data and the like.
Further, creating a file directory, naming the file directory by taking the function module as a unit, and storing the configuration file of the initialization configuration under the file directory. For example, the module name of the tested function module is a mac module, and the created file directory is./ mac, and the initialization profile is./ mac/config.
S102, executing a test process on the functional module through a test case, wherein the test case comprises a plurality of test steps.
Specifically, a test case corresponding to the functional module is obtained, and the functional module is tested according to the test case. The test case comprises a plurality of test steps when being executed, and a recovery interface is required to be set to recover the configuration of the functional module in the test case execution process in order to ensure that the configuration of the functional module is recovered to the initialized state after the test case execution is finished.
It should be noted that, all test cases tested on the network device include test cases for each functional module, and corresponding test cases need to be determined according to different functional modules, and the test cases are executed according to the functional modules during testing so as to separately test each functional module of the network device.
In addition, program abnormality may occur during the test, resulting in deviation in the execution of the test steps. For example, when a test case is executed, an abnormality occurs in a certain test step, and a corresponding problem also occurs in a subsequent test step.
Therefore, in order to avoid the deviation of the configuration recovery of the functional module caused by the occurrence of the abnormality in the test execution process, a corresponding recovery interface needs to be set for each test step in the test case, and when the program abnormality occurs in the execution test step, the recovery interface corresponding to the abnormal test step can be directly called to recover the configuration of the functional module.
S103, when determining to trigger a test stopping event, the corresponding specified test step is carried out.
Specifically, the server executes the test case, and determines the corresponding designated test step when the test stop event is triggered according to the execution state. The stop event comprises a test completion event and a test exception event, wherein the test completion event refers to that the normal execution of the test case is completed, and no exception occurs; the abnormal event is that program abnormality occurs in the execution process of the test case.
More specifically, as shown in fig. 3, if each test step of the test case is normally executed during the execution of the test case, a test completion event is triggered when the execution of the last test step is completed. If program abnormality occurs in executing a certain test step in the process of executing the test case, triggering a test abnormal event, capturing the occurrence of the abnormality, and finding out an abnormal test step corresponding to the triggering test abnormal event according to the abnormality.
S104, based on the trigger of the configured recovery interface in the specified test step, recovering the configuration executed by the test case in the test process.
Specifically, as shown in fig. 3, if it is determined that the test completion event is triggered, the recovery interface of the last test step is called to recover the configuration executed by the test case in the test process to the configuration initialized by the functional module. If the triggering test abnormal event is determined, calling a recovery interface of the abnormal test step corresponding to the triggering test abnormal event, and skipping the subsequent test step to directly recover the configuration to the initialized state.
It should be noted that, when a program exception occurs in executing a certain test step during the execution of the test case, the test case already determines that the execution is wrong, and the subsequent test step will also execute the error, so that in order to save the test time, the reply interface of the exception test step is directly called, and the subsequent test step is skipped.
Further, as shown in fig. 4, after the test case is executed, in order to verify whether the configuration of the functional module is successfully restored, that is, restored to the initialized state, the configuration file stored before needs to be compared with the configuration file of the current configuration.
Specifically, the configuration file of the corresponding initialization configuration is obtained through the file directory of the previously set saved initialization configuration file. And acquiring a configuration file of the current configuration of the functional module, and comparing the configuration file of the initialization configuration with the configuration file of the current configuration. If the configuration is consistent, the configuration recovery is successful, and other test cases of the functional module are continuously executed; if the configuration is inconsistent, the configuration is not recovered successfully, the configuration file of the initialized configuration is used for covering the restarting configuration file of the network equipment, and then the network equipment is restarted to recover the initialized configuration.
It should be noted that, a default restart configuration file is generally set in the device, and when accidental restart or reset of the device is prevented, a pre-saved configuration file can be automatically loaded, so that after the default restart configuration file is covered by the configuration file of the initialization configuration and the network device is restarted, the function module can automatically load the configuration file of the initialization configuration and perform initialization, thus saving the operation and time of file configuration and quickly recovering the function module to the initialized state.
Furthermore, after all the test cases corresponding to the functional module are executed, the test of the functional module is completed, and in order to facilitate the test of other functional modules, the initialization configuration of the functional module is deleted, so that the resources of the network equipment are released, the resource waste is avoided, the mutual influence among the functional modules during the test is avoided, and the independence and the repeatability of the test are maintained.
By initializing the functional module in the network equipment, the repeatability and stability of the test can be ensured when the network equipment is automatically tested, the test effect is better, the environment conditions required by the test can be provided, the influence of old data on the test result is avoided, and the reliability and consistency of the test are ensured.
When the test case is executed, a recovery interface is configured for each test step, so that when a test stopping event is triggered, the configuration executed in the test process of the test case can be recovered based on the triggering of the recovery interface corresponding to the test step, the function module is ensured to recover to an initialized state when the next test case is executed, the test time is saved, the test efficiency is improved, and the test stability is also improved.
As shown in fig. 5, the embodiment of the present application further provides an automatic test device for a network device, including:
at least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores instructions executable by the at least one processor to enable the at least one processor to perform operations such as: the method for automatically testing network equipment according to any one of the embodiments.
The embodiment of the application also provides a nonvolatile computer storage medium, which stores computer executable instructions, wherein the computer executable instructions are configured to: the method for automatically testing a network device according to any one of the embodiments.
The embodiments of the present application are described in a progressive manner, and the same and similar parts of the embodiments are all referred to each other, and each embodiment is mainly described in the differences from the other embodiments. In particular, for the apparatus and medium embodiments, the description is relatively simple, as it is substantially similar to the method embodiments, with reference to the section of the method embodiments being relevant.
The devices and media provided in the embodiments of the present application are in one-to-one correspondence with the methods, so that the devices and media also have similar beneficial technical effects as the corresponding methods, and since the beneficial technical effects of the methods have been described in detail above, the beneficial technical effects of the devices and media are not repeated here.
It will be appreciated by those skilled in the art that embodiments of the present application may be provided as a method, system, or computer program product. Accordingly, the present application may take the form of an entirely hardware embodiment, an entirely software embodiment or an embodiment combining software and hardware aspects. Furthermore, the present application may take the form of a computer program product embodied on one or more computer-usable storage media (including, but not limited to, disk storage, CD-ROM, optical storage, and the like) having computer-usable program code embodied therein.
The present application is described with reference to flowchart illustrations and/or block diagrams of methods, apparatus (systems) and computer program products according to embodiments of the application. It will be understood that each flow and/or block of the flowchart illustrations and/or block diagrams, and combinations of flows and/or blocks in the flowchart illustrations and/or block diagrams, can be implemented by computer program instructions. These computer program instructions may be provided to a processor of a general purpose computer, special purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, create means for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable data processing apparatus to function in a particular manner, such that the instructions stored in the computer-readable memory produce an article of manufacture including instruction means which implement the function specified in the flowchart flow or flows and/or block diagram block or blocks.
These computer program instructions may also be loaded onto a computer or other programmable data processing apparatus to cause a series of operational steps to be performed on the computer or other programmable apparatus to produce a computer implemented process such that the instructions which execute on the computer or other programmable apparatus provide steps for implementing the functions specified in the flowchart flow or flows and/or block diagram block or blocks.
In one typical configuration, a computing device includes one or more processors (CPUs), input/output interfaces, network interfaces, and memory.
The memory may include volatile memory in a computer-readable medium, random Access Memory (RAM) and/or nonvolatile memory, such as Read Only Memory (ROM) or flash memory (flash RAM). Memory is an example of computer-readable media.
Computer readable media, including both non-transitory and non-transitory, removable and non-removable media, may implement information storage by any method or technology. The information may be computer readable instructions, data structures, modules of a program, or other data. Examples of storage media for a computer include, but are not limited to, phase change memory (PRAM), static Random Access Memory (SRAM), dynamic Random Access Memory (DRAM), other types of Random Access Memory (RAM), read Only Memory (ROM), electrically Erasable Programmable Read Only Memory (EEPROM), flash memory or other memory technology, compact disc read only memory (CD-ROM), digital Versatile Discs (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices, or any other non-transmission medium, which can be used to store information that can be accessed by a computing device. Computer-readable media, as defined herein, does not include transitory computer-readable media (transmission media), such as modulated data signals and carrier waves.
It should also be noted that the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, method, article or apparatus that comprises the element.
The foregoing is merely exemplary of the present application and is not intended to limit the present application. Various modifications and variations of the present application will be apparent to those skilled in the art. Any modification, equivalent replacement, improvement, etc. which come within the spirit and principles of the application are to be included in the scope of the claims of the present application.

Claims (10)

1. An automated testing method for network devices, comprising:
Initializing and configuring the tested functional modules;
executing a test process on the functional module by a test case, wherein the test case comprises a plurality of test steps;
Determining a corresponding designated test step when a test stopping event is triggered;
And recovering the configuration executed by the test case in the test process based on the trigger of the configured recovery interface in the specified test step.
2. The method of claim 1, wherein prior to the executing the test procedure on the functional module by the test case, the method further comprises:
And acquiring a test case corresponding to the functional module, and configuring a corresponding recovery interface based on the test case comprising each test step.
3. The method of claim 1, wherein the stop event comprises a test complete event and a test exception event;
when determining to trigger a test stopping event, the corresponding specified test steps specifically include:
if the test completion event is triggered, determining a designated test step when the test completion event is triggered, wherein the designated test step is the last test step;
if the test abnormal event is triggered, capturing the abnormality, and determining an abnormal test step corresponding to the triggering of the test abnormal event.
4. A method according to claim 3, characterized in that based on the triggering of the configured restoration interface in the specified test step, it comprises in particular:
if a test completion event is triggered, calling a recovery interface of the last test step;
And if the abnormal event is triggered, calling a recovery interface of the abnormal testing step, and skipping the subsequent testing steps.
5. The method according to claim 1, wherein the initializing configuration of the functional module for testing specifically comprises:
Acquiring a test requirement of a functional module, and creating a configuration file of corresponding initialization configuration according to the test requirement;
And carrying out initialization configuration on the functional module based on the configuration file of the initialization configuration.
6. The method of claim 5, wherein after initializing the configuration for the functional module under test, the method further comprises:
Creating a file directory, naming the file directory based on the functional module, and storing the configuration file of the initialization configuration under the corresponding file directory.
7. The method of claim 6, wherein after recovering the configuration performed by the test case during the test based on the triggering of the configured recovery interface in the specifying the test step, the method further comprises:
Acquiring a configuration file of the corresponding initialization configuration through the file directory;
And acquiring the current configuration of the functional module after recovery, comparing the configuration file of the current configuration with the configuration file of the initialization configuration, and verifying whether the configuration is successfully recovered.
8. The method according to claim 7, wherein comparing the configuration file of the current configuration with the configuration file of the initialization configuration, and verifying whether the configuration is successfully restored, comprises:
if the configuration is not recovered, replacing the restarting configuration file by using the configuration file of the initialization configuration, and restarting the network equipment;
if the configuration is restored, other test cases are continuously executed until the functional module test is completed, and the configuration file of the initialization configuration is deleted.
9. An automated test equipment for a network device, comprising:
at least one processor; and
A memory communicatively coupled to the at least one processor; wherein,
The memory stores instructions executable by the at least one processor to enable the at least one processor to perform operations such as: a method of automated testing of a network device as claimed in any one of claims 1 to 8.
10. A non-transitory computer storage medium storing computer-executable instructions, the computer-executable instructions configured to: a method of automated testing of a network device as claimed in any one of claims 1 to 8.
CN202410095788.2A 2024-01-23 2024-01-23 Automatic test method, equipment and medium for network equipment Pending CN118075181A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410095788.2A CN118075181A (en) 2024-01-23 2024-01-23 Automatic test method, equipment and medium for network equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410095788.2A CN118075181A (en) 2024-01-23 2024-01-23 Automatic test method, equipment and medium for network equipment

Publications (1)

Publication Number Publication Date
CN118075181A true CN118075181A (en) 2024-05-24

Family

ID=91098096

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410095788.2A Pending CN118075181A (en) 2024-01-23 2024-01-23 Automatic test method, equipment and medium for network equipment

Country Status (1)

Country Link
CN (1) CN118075181A (en)

Similar Documents

Publication Publication Date Title
CN113760311B (en) Micro-service deployment method, device and medium
CN110825420A (en) Configuration parameter updating method, device, equipment and storage medium for distributed cluster
CN109597626B (en) Component deployment method and device
CN106708608B (en) Distributed lock service method, acquisition method and corresponding device
CN104239156A (en) External service call method and system
WO2017198156A1 (en) Service deployment method, apparatus and system
CN107179982B (en) Cross-process debugging method and device
CN110647463B (en) Method and device for restoring test breakpoint and electronic equipment
CN114047941B (en) Configuration upgrading method and device for redis service nodes
CN113064755B (en) Data recovery method, device, equipment, medium and program product
CN112667259A (en) SDN controller version upgrading method, device and medium
CN118075181A (en) Automatic test method, equipment and medium for network equipment
CN116225617A (en) Management migration method and device for container instance, electronic equipment and storage medium
CN115525545A (en) Docker-based automatic testing method, system, equipment and medium
CN114676118A (en) Database switching method, device, equipment and storage medium
CN106933545B (en) Application system and start protection method and device thereof
CN114168389A (en) Method and device for recovering CAD file, storage medium and processor
CN114189496A (en) IP modification method and device of cluster system and related equipment
CN111857744A (en) Installation method, system, equipment and medium of super-fusion system
CN113467893A (en) Virtual machine automation test method and device, storage medium and processor
CN110971642B (en) Data processing method and device for cloud computing platform
CN114691309A (en) Batch business processing system, method and device
CN114691395A (en) Fault processing method and device, electronic equipment and storage medium
CN111966680A (en) Database storage expansion method and device
CN113225576B (en) Service migration system and method based on live broadcast platform edge computing scene

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination