Testing Method, System, Device, Electronic Equipment and Storage Medium of Switch
Automatically obtaining the switch model through the server and sending test system files, solving the problem of cumbersome switch testing steps and too long startup time, achieving an efficient switch testing process, and improving production efficiency and accuracy.
Patent Information
- Application Number
- CN202310020155.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-06
- Publication Date
- 2025-08-01
- Estimated Expiration
- 2043-01-06
AI Technical Summary
In the prior art, the switch testing steps are cumbersome and the startup time is too long, resulting in waste of production time and increased labor costs. The GRUB configuration is complex and prone to errors, affecting production efficiency.
The server sends test instructions to the switch, automatically obtains the machine model and determines the target version of the test system files, uses the DHCP protocol to establish a communication connection, and directly sends the test system files to the switch, simplifying the test process and reducing startup time.
It realizes efficient automation of switch testing, reduces startup time and manual configuration errors, and improves productivity and test accuracy.
Smart Images

Figure CN116032815B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of switch testing, and in particular, to a method, system, device, electronic device, and storage medium for testing a switch. Background Art
[0002] With the development of technology, the types of switches are becoming more and more numerous, and the types of system platforms are increasing, such as X86 (Central Processing Unit Instruction Set Architecture), ARM architecture (Acorn RISC Machine), MIPS architecture (Microprocessor without Interlocked Piped Stages architecture), etc. The production output requirements are also increasing accordingly. At this time, it is necessary to compress the test time of the switch and improve the test efficiency.
[0003] In the related art, GRUB (Multiboot) is used as a network boot loader to start and test the switch. Specifically, the switch to be tested reads the configuration file in the server directory after power-on; the system automatically starts from the Diag7.6 version, obtains the UUID (Universally Unique Identifier) of the switch, creates a file according to the machine model number and uploads it to the server directory, finds the system version corresponding to the machine model number, and needs to restart the switch after completion; the switch downloads the above file to the local machine through the protocol, and starts to run the test program after starting the corresponding system.
[0004] It should be noted that in the related art, on the one hand, each switch to be tested needs to start the Diag7.6 system once additionally during the test, which additionally increases the startup time by 2 minutes. Each machine requires about 4 minutes of startup time, resulting in a waste of production time. On the other hand, due to restarting the system, the storage data files in the server directory will become more. After several months, the search time of the switch to be tested will increase, and file management will be difficult. On the other hand, the GRUB configuration is complex, and mistakes that cause the production line to stop due to GRUB configuration errors have occurred repeatedly. In addition, when the e-COM card (switch dedicated CPU board) is replaced, the production line test engineer needs to manually configure the switch to generate a configuration file corresponding to the universal identification code for each switch, which greatly wastes human costs and time.
[0005] In view of the above problems, no effective solution has been proposed yet. Summary of the Invention
[0006] Embodiments of the present invention provide a method, system, device, electronic device, and storage medium for testing a switch, so as to at least solve the technical problems of cumbersome test steps and too long startup time of the switch to be tested in the related art.
[0007] According to one aspect of an embodiment of the present invention, a method for testing a switch is provided. The method includes: a server sending a test instruction to the switch to be tested; the server receiving the target machine model fed back by the switch to be tested based on the test instruction, wherein the switch calls a target method from the server to obtain its own machine model; the server determining a test system of a target version through the target machine model, and sending the test system file of the target version and the files required for testing to the switch to be tested.
[0008] Optionally, before the server sends the test instruction to the switch to be tested, the method further includes: configuring a configuration file of the Dynamic Host Configuration Protocol in the server, allocating IP information for the switch to be tested through the Dynamic Host Configuration Protocol, and establishing a communication connection between the switch to be tested and the server through the IP information.
[0009] Optionally, a first script is stored in the root directory of the text transfer protocol of the server, and a target method for obtaining the machine model is stored in the first script. The switch to be tested calls the target method from the first script through remote call, and obtains the target machine model from its own memory through the target method.
[0010] Optionally, a second script is stored in the root directory of the text transfer protocol of the server, and a first relationship table between the machine model and an intermediate value, and a second relationship table between the intermediate value and the version number of the test system are stored in the second script. The server determining the test system of the target version through the target machine model includes: the server executing the second script stored in the root directory of the text transfer protocol, determining the target intermediate value corresponding to the machine model according to the first relationship table, and determining the target version number corresponding to the target intermediate value according to the second relationship table; the server determining the test system corresponding to the target version number as the test system of the target version.
[0011] Optionally, in the case where there is no intermediate value corresponding to the target machine model in the second script, the server determines the test system corresponding to the preset version number as the test system of the target version.
[0012] Optionally, sending the test system file of the target version and the files required for testing to the switch to be tested includes: the server obtaining the test system file of the target version and the files required for testing from the root directory of the text transfer protocol, and sending the test system file of the target version and the files required for testing to the switch to be tested through the text transfer protocol.
[0013] According to one aspect of the present application, a method for testing a switch is provided. The method includes: the switch to be tested receives a test instruction sent by a server; the switch to be tested responds to the test instruction, calls a target method from the server to obtain its own target machine model number, and sends the target machine model number to the server; the switch to be tested receives the test system file of the target version and the files required for testing fed back by the server based on the target machine model number, and executes a test task based on the test system file of the target version and the files required for testing.
[0014] Optionally, a first script is stored in the root directory of the text transfer protocol of the server, and a target method for obtaining the machine model number is stored in the first script. The switch to be tested responds to the test instruction, and calling the target method from the server to obtain its own target machine model number includes: the switch to be tested calls the target method from the first script by means of remote call, and obtains the target machine model number from its own memory through the target method.
[0015] Optionally, a second script is stored in the root directory of the text transfer protocol of the server, and a first relationship table between the machine model number and an intermediate value, and a second relationship table between the intermediate value and the version number of the test system are stored in the second script. After receiving the target machine model number, the server executes the second script, determines the target intermediate value corresponding to the machine model number according to the first relationship table, and determines the target version number corresponding to the target intermediate value according to the second relationship table, and determines the test system corresponding to the target version number as the test system of the target version.
[0016] Optionally, in the case where there is no intermediate value corresponding to the target machine model number in the second script, the server determines the test system corresponding to the preset version number as the test system of the target version.
[0017] Optionally, a configuration file of the Dynamic Host Configuration Protocol is configured in the server. Before the switch to be tested receives the test instruction sent by the server, the method further includes: the switch to be tested obtains IP information through the Dynamic Host Configuration Protocol, and establishes a communication connection with the server through the IP information.
[0018] Optionally, the switch to be tested receives the test system file of the target version and the files required for testing fed back by the server based on the target machine model number, and executing a test task based on the test system file of the target version and the files required for testing includes: the switch to be tested receives the test system file of the target version and the files required for testing based on the File Transfer Protocol, and stores the test system file of the target version and the files required for testing in the local storage space; the switch to be tested starts the test system of the target version and runs the files required for testing.
[0019] According to another aspect of the embodiments of the present invention, a test system for a switch is further provided. The system includes: a server for sending a test instruction to the switch to be tested, receiving the target machine model fed back by the switch to be tested based on the test instruction, determining the test system of the target version through the target machine model, and sending the test system file of the target version and the files required for the test to the switch to be tested; the switch to be tested, communicatively connected to the server, for responding to the test instruction sent by the server, obtaining its own target machine model by remotely calling the target method from the server, sending the target machine model to the server, receiving the test system file of the target version and the files required for the test fed back by the server, and performing the test task based on the test system file of the target version and the files required for the test.
[0020] Optionally, a configuration file of the Dynamic Host Configuration Protocol is configured in the server, and the switch to be tested obtains the IP information through the Dynamic Host Configuration Protocol and establishes a communication connection with the server through the IP information.
[0021] Optionally, a first script is stored in the root directory of the Trivial File Transfer Protocol of the server, and a target method for obtaining the machine model is stored in the first script. The switch to be tested remotely calls the target method from the first script and obtains the target machine model from its own memory through the target method.
[0022] Optionally, a second script is stored in the root directory of the Trivial File Transfer Protocol of the server. A first relationship table between the machine model and the intermediate value, and a second relationship table between the intermediate value and the version number of the test system are stored in the second script. The server executes the second script stored in the root directory of the Trivial File Transfer Protocol, determines the target intermediate value corresponding to the machine model according to the first relationship table, determines the target version number corresponding to the target intermediate value according to the second relationship table, and determines the test system corresponding to the target version number as the test system of the target version.
[0023] Optionally, in the case where there is no intermediate value corresponding to the target machine model in the second script, the server determines the test system corresponding to the preset version number as the test system of the target version.
[0024] Optionally, the server obtains the test system file of the target version and the files required for the test from the root directory of the Trivial File Transfer Protocol, and sends the test system file of the target version and the files required for the test to the switch to be tested through the Trivial File Transfer Protocol.
[0025] According to another aspect of the embodiments of the present invention, there is also provided a test device for a switch. The device includes: a sending unit, configured to send a test instruction to the switch to be tested through a server; a receiving unit, configured to receive, through the server, the target machine model fed back by the switch to be tested based on the test instruction, wherein the switch calls a target method from the server to obtain its own machine model; a determining unit, configured to determine, through the server, a test system of a target version based on the target machine model, and send the test system file of the target version and the files required for testing to the switch to be tested.
[0026] According to another aspect of the embodiments of the present invention, there is also provided a test device for a switch, including: a first receiving unit, configured to receive, through the switch to be tested, a test instruction sent by a server; a response unit, configured to respond to the test instruction through the switch to be tested, call a target method from the server to obtain its own target machine model, and send the target machine model to the server; a second receiving unit, configured to receive, through the switch to be tested, the test system file of the target version and the files required for testing fed back by the server based on the target machine model, and execute a test task based on the test system file of the target version and the files required for testing.
[0027] According to another aspect of the embodiments of the present invention, there is also provided a computer-readable storage medium, where the computer-readable storage medium includes a stored computer program, and wherein when the computer program runs, it controls the device where the computer-readable storage medium is located to execute the above-mentioned test method for the switch.
[0028] According to another aspect of the embodiments of the present invention, there is also provided an electronic device, including one or more processors and a memory, where the memory is used to store one or more programs, and wherein when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the above-mentioned test method for the switch.
[0029] In the present disclosure, the following steps are adopted: the server sends a test instruction to the switch to be tested, and the switch to be tested receives the test instruction sent by the server; the switch to be tested responds to the test instruction, calls a target method from the server to obtain its own target machine model, and sends the target machine model, and the server receives the target machine model fed back based on the test instruction; the server determines a test system of a target version based on the target machine model, and sends the test system file of the target version and the files required for testing to the switch to be tested, and the switch to be tested receives the test system file of the target version and the files required for testing fed back by the server based on the target machine model and executes a test task based on the files. Thereby, the technical problems in the related art that the test steps of the switch to be tested are cumbersome and the startup time is too long are solved. Description of the Drawings
[0030] The accompanying drawings described herein are used to provide a further understanding of the present invention and form a part of this application. The illustrative embodiments of the present invention and their descriptions are used to explain the present invention and shall not unduly limit the present invention. In the drawings:
[0031] Figure 1 is a flowchart of an optional method for testing a switch according to an embodiment of the present invention Figure 1 ;
[0032] Figure 2 is a flowchart of an optional method for testing a switch according to an embodiment of the present invention Figure 2 ;
[0033] Figure 3 is a flowchart of an optional method for testing a switch according to an embodiment of the present invention Figure 3 ;
[0034] Figure 4 is a schematic diagram of a testing system for a switch according to an embodiment of the present invention;
[0035] Figure 5 is a schematic illustration of an optional testing device for a switch according to an embodiment of the present invention Figure 1 ;
[0036] Figure 6 is a schematic illustration of an optional testing device for a switch according to an embodiment of the present invention Figure 2 ;
[0037] Figure 7 is a block diagram of the hardware structure of a mobile terminal for a method of testing a switch according to an embodiment of the present application. Detailed implementation manners
[0038] In order to enable those skilled in the art of this technology to better understand the solution of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments of the present invention without creative efforts shall fall within the scope of protection of the present invention.
[0039] It should be noted that the terms "first", "second", etc. in the specification, claims and above-mentioned drawings of the present invention 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 used in this way can be interchanged under appropriate circumstances, so that the embodiments of the present invention described here can be implemented in an order other than those illustrated or described here. In addition, the terms "comprising" and "having" 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 those steps or units clearly listed, but may include other steps or units not clearly listed or inherent to these processes, methods, products or devices.
[0040] For the convenience of those skilled in the art to understand the present invention, the following explains some terms or nouns involved in each embodiment of the present invention:
[0041] 1. iPXE (Open source boot firmware): An open-source network loading protocol for operating systems.
[0042] 2. GRUB (GRand Unified Bootloader): A multi-operating system boot program from the GNU project.
[0043] 3. UUID (Universally Unique Identifier): A globally unique identifier automatically generated based on the MAC address and time by the switch firmware.
[0044] 4. FRU (Field Replace Unit): A storage chip for model information.
[0045] 5. diag7.6, diag7.9, diag8.3: Switch test systems developed based on Redhat Linux Enterprise Edition 7.6, 7.9, and 8.3 respectively.
[0046] 6. e-COM card: A dedicated CPU board for switches.
[0047] 7. PN (Product Name): Model name, such as SC5630EL, CN9508H.
[0048] 8. DHCP (Dynamic Host Configuration Protocol): A dynamic host configuration protocol for automatically obtaining an IP in a local area network.
[0049] It should be noted that the relevant information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data for display, data for analysis, etc.) involved in this disclosure are all information and data authorized by users or fully authorized by all parties. For example, an interface is set between this system and relevant users or institutions. Before obtaining relevant information, a request for acquisition needs to be sent to the aforementioned users or institutions through the interface, and after receiving the consent information feedback from the aforementioned users or institutions, the relevant information is obtained.
[0050] The present invention will be described in detail below in conjunction with each embodiment.
[0051] Embodiment 1
[0052] According to an embodiment of the present invention, an embodiment of a method for testing a switch is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0053] Figure 1 is a flowchart of an optional method for testing a switch according to an embodiment of the present invention Figure 1 , as Figure 1 shown, the method includes the following steps:
[0054] Step S101, the server sends a test instruction to the switch to be tested.
[0055] Specifically, the server is a device that provides computing or application services for the test of the switch to be tested. The server sending a test instruction to the switch to be tested can cause the switch to be tested to start running and prepare to start the test program. A switch is a network device for forwarding electrical signals. According to the needs of transmitting information at both ends of communication, it uses manual or automatic methods to send the information to be transmitted to the corresponding route that meets the requirements. It can provide an electrical signal path for any two network nodes connected to the switch, and can be divided into wide area network switches and local area network switches according to different working positions. The working condition of the switch affects the transmission of information, and thus, there is a need to test the switch.
[0056] Step S102, the server receives the target machine model fed back by the switch to be tested based on the test instruction, where the switch calls a target method from the server to obtain its own machine model.
[0057] Specifically, the target machine model refers to the machine model of the switch to be tested. The server first configures the DHCP file to assign an IP address to the switch to be tested, enabling normal communication between the switch to be tested and the server. The switch calls a script in the server to obtain its own machine model and returns the machine model to the server.
[0058] Step S103, the server determines the test system of the target version based on the target machine model, and sends the test system file of the target version and the files required for the test to the switch to be tested.
[0059] Specifically, the target machine model determines that the switch to be tested runs test systems of different versions. Among them, the test systems of different versions can include: diag7.6, diag7.9, diag8.3, etc. The server determines the test system of the target version based on the target model, and sends the test system version and the required files to the switch to be tested through the http protocol.
[0060] Optionally, in the switch test method provided in the embodiments of the present application, before the server sends a test instruction to the switch to be tested, the method further includes: configuring a configuration file of the Dynamic Host Configuration Protocol in the server, assigning IP information to the switch to be tested through the Dynamic Host Configuration Protocol, and establishing a communication connection between the switch to be tested and the server through the IP information.
[0061] Specifically, DHCP is a network protocol for a local area network, which is the Dynamic Host Configuration Protocol. It means that a server controls a range of IP addresses. When the switch to be tested logs in to the server, it can automatically obtain the IP address and subnet mask assigned by the server. Its function is that the server assigns an IP address to the switch so that the environment and the server can communicate better and improve the utilization rate of the address. Before the server sends a test instruction to the switch to be tested, configure the DHCP protocol file in the server, assign IP address information to the switch to be tested through this protocol, and after assigning the IP address, the server and the switch to be tested can establish a communication connection for communication.
[0062] Before the test starts, a script needs to be configured. Optionally, in the switch test method provided in the embodiments of the present application, a first script is stored in the root directory of the text transfer protocol of the server. The first script stores a target method for obtaining the machine model. The switch to be tested remotely calls the target method from the first script and obtains the target machine model from its own memory through the target method.
[0063] It should be noted that the DHCP configuration file / etc / dhcp / dhcpd.conf is configured so that after the switch under test obtains an IP address, it executes the ipxe_setting.php startup script in the http root directory of the server, that is, the first script. The method for obtaining PN information and the method for calling to obtain SN, that is, the method for obtaining the machine model, are added to the first script. The target method is called from the first script, that is, the serial number and machine model of the target switch are obtained from this script.
[0064] Specifically, the switch under test reads out the information in the script, calls the method in the server, obtains the PN in its own storage medium and then returns it to the server. For example, the storage medium is EPROM, EEPROM, etc. If the information cannot be obtained, it means that the switch board of this machine needs to be returned to the board factory for re-burning ONIEFRU. Among them, ONIEEEPROM represents a non-volatile storage medium that stores information such as SN, PN, and machine model. ONIEFRU is a quick response unit in the open source network hardware ecosystem and is used to record important information about system configuration.
[0065] It should be noted that the partial code for configuring the IP address for the switch under test and obtaining the switch machine model is as follows:
[0066]
[0067] To make the machine model correspond to the test version number, optionally, in the switch test method provided in the embodiments of the present application, a second script is stored in the text transfer protocol root directory of the server. The first relationship table between the machine model and the intermediate value, and the second relationship table between the intermediate value and the version number of the test system are stored in the second script. The server determining the test system of the target version through the target machine model includes: the server executes the second script stored in the text transfer protocol root directory, determines the target intermediate value corresponding to the machine model according to the first relationship table, and determines the target version number corresponding to the target intermediate value according to the second relationship table; the server determines the test system corresponding to the target version number as the test system of the target version.
[0068] Specifically, the second script is the ipxe_menu.php script, the target intermediate value is the entry value, and the test systems of the target version are different versions of diagOS. The test systems can include multiple different versions of test systems. For example, diag7.6, diag7.9, diag8.3. The second script is placed in the http root directory of the server and stores the first relationship table between the organic model number and the intermediate value and the second relationship table between the intermediate value and the version number of the test system. The organic model number can be represented as a PN value. Determine the target intermediate value corresponding to the machine model number according to the first relationship table, and determine the target version number corresponding to the target intermediate value according to the second relationship table. Different versions correspond to different intermediate values. Write ipxe_setting.php. After obtaining the corresponding entry, different PNs need to run different test systems. According to the obtained PN value, select the corresponding entry value for the PN value, and then select the corresponding diagOS through the entry. That is, the server determines the test system corresponding to the target version number as the test system of the target version.
[0069] Optionally, in the test method of the switch provided in the embodiment of the present application, when the intermediate value corresponding to the target machine model number does not exist in the second script, the server determines the test system corresponding to the preset version number as the test system of the target version.
[0070] For example, the test system corresponding to the preset version number is diag7.6. Since there is a preset relationship between different versions of test systems and different target intermediate values, if there is no corresponding preset relationship between the target machine model number and the intermediate value, that is, the obtained PN value has no corresponding intermediate value, then directly select the intermediate value as the defaul tentry value and adjust the test system of the target version to the diag7.6 system.
[0071] Among them, the code for the preset relationship between the machine model number and the system version is:
[0072] #!ipxe
[0073] set menu-timeout 16000
[0074] isset${ip}||dhcp
[0075] isset${next-server}||set next-server 10.0.0.10
[0076] set entry diag7.6
[0077] iseq${serial}61A7F4663&&set entry diag7.9&&gotoshowmenu
[0078] iseq${produt}NF6280M5 && set entry diag7.6 && gotoshowmenu
[0079] iseq${produt}NS5480M6 && set entry diag8.3 && gotoshowmenu
[0080] :showmenu
[0081] chain--autofree http: / / 10.0.0.10 / ipxe_menu.php
[0082] Optionally, sending the test system files of the target version and the files required for testing to the switch to be tested includes: The server obtains the test system files of the target version and the files required for testing from the root directory of the text transfer protocol, and sends the test system files of the target version and the files required for testing to the switch to be tested through the text transfer protocol.
[0083] Specifically, the text transfer protocol is the http protocol. Obtain the test system files of the target version and the files required for testing from this protocol. The test system file is diagOS, and the files required for testing are the corresponding kernel file vmlinuz and the file system. Further, call the corresponding diagOS according to the entry value to start the corresponding kernel and file system. If the corresponding diagOS cannot be found for the entry value, directly start the default diagOS. The corresponding diagOS is quickly transferred from the server side to the switch to be tested through the http protocol in a short time to start the testing work. Among them, Kernel generally refers to a real-time operating system, which means that when data is generated, it can accept and process it at a fast enough speed and schedule all available resources. vmlinuz is a bootable and compressed kernel, that is, an executable Linux kernel.
[0084] It should be noted that the partial code for calling and starting the corresponding version system according to the intermediate value is:
[0085]
[0086] The following is a detailed description in combination with another embodiment.
[0087] Embodiment 2
[0088] According to an embodiment of the present invention, an embodiment of a method for testing a switch is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions. And although the logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in a different order than here.
[0089] Figure 2 is a flowchart of an optional method for testing a switch according to an embodiment of the present invention Figure 2 , as Figure 2 shown, the method includes the following steps:
[0090] Step S201, the switch to be tested receives a test instruction sent by the server.
[0091] It should be noted that the switch, according to the needs of transmitting information between the two communication ends, uses a method completed manually or automatically by equipment to send the information to be transmitted to the corresponding route that meets the requirements. It can provide an electrical signal path for any two network nodes accessing the switch, and can be divided into a wide area network switch and a local area network switch according to different working positions.
[0092] Since the working condition of the switch affects the transmission of information, therefore, there is a need for testing. The test instruction can be sent by a server that provides computing or application services for the test of the switch to be tested. The switch to be tested receives the test instruction sent by the server to prepare for subsequent test operations.
[0093] Step S202, the switch to be tested responds to the test instruction, calls the target method from the server to obtain its own target machine model, and sends the target machine model to the server.
[0094] Specifically, when the switch to be tested responds to the test instruction sent by the server, the server configures the DHCP file to assign an IP address to the switch to be tested, so that normal communication can be carried out between the switch to be tested and the server. Then, the switch calls the target method from the server to obtain its own model and sends it to the server.
[0095] Step S203, the switch to be tested receives the test system file of the target version and the files required for testing fed back by the server based on the target machine model, and executes the test task based on the test system file of the target version and the files required for testing.
[0096] Specifically, the target machine model determines the test systems of different versions that the switch under test runs. Among them, the test systems of different versions can include: diag7.6, diag7.9, diag8.3, etc. The switch under test feeds back information to the server, enabling it to determine the test system of the target version based on the target model, and sending back the test system version and required files to the switch under test through the http protocol, and then executing the test task.
[0097] The embodiments of the present invention will be described in detail below in combination with the above steps.
[0098] Before the test instruction starts, a script needs to be configured. Optionally, in the switch test method provided in the embodiments of the present application, a first script is stored in the root directory of the text transfer protocol of the server. The first script stores a target method for obtaining the machine model. The switch under test responds to the test instruction and calls the target method from the server to obtain its own target machine model, including: the switch under test calls the target method from the first script through a remote call method, and obtains the target machine model from its own memory through the target method.
[0099] Specifically, the text transfer protocol is the http protocol. Execute the ipxe_setting.php start script in the http root directory of the server, that is, the first script. The target method is added to the first script, that is, the method for obtaining PN information and the method for calling to obtain SN. Specifically, the switch under test responds to the test instruction, calls the target method from the first script through a remote call method, reads out the information in the script, obtains the PN in its own storage medium, and returns it to the server after obtaining it. For example, the storage medium is EPROM, EEPROM, etc., and ONIEEEPROM represents a non-volatile storage medium.
[0100] To enable the machine model of the switch to correspond one-to-one with the version of the test system, optionally, in the switch test method provided in the embodiments of the present application, a second script is stored in the root directory of the text transfer protocol of the server. The second script stores a first relationship table between the machine model and the intermediate value, and a second relationship table between the intermediate value and the version number of the test system. After receiving the target machine model, the server executes the second script, determines the target intermediate value corresponding to the machine model according to the first relationship table, and determines the target version number corresponding to the target intermediate value according to the second relationship table, and determines the test system corresponding to the target version number as the test system of the target version.
[0101] Specifically, the second script is the ipxe_menu.php script, the target intermediate value is the entry value, and the test systems of the target version are different versions of diagOS. The test systems can include multiple different versions of test systems. For example, diag7.6, diag7.9, diag8.3. The second script is placed in the http root directory of the server and stores the first relationship table between the organic model number and the intermediate value, as well as the second relationship table between the intermediate value and the version number of the test system. The organic model number can be represented as a PN value. Determine the target intermediate value corresponding to the machine model number according to the first relationship table, and determine the target version number corresponding to the target intermediate value according to the second relationship table. Different versions correspond to different intermediate values. Write ipxe_setting.php. Different PNs will obtain corresponding entries, and different test systems need to be run. According to the obtained PN value, select the corresponding diagOS, that is, the server determines the test system corresponding to the target version number as the test system of the target version.
[0102] Optionally, in the switch test method provided in the embodiments of the present application, when the intermediate value corresponding to the target machine model number does not exist in the second script, the server determines the test system corresponding to the preset version number as the test system of the target version.
[0103] Specifically, different PNs need to run different diagOSs, that is, different versions of test systems, such as diag7.6, diag7.9, diag8.3. The test system corresponding to the preset version number is diag7.6. According to the PN value obtained in the previous step, the PN value selects the corresponding entry value, and selects the corresponding version of the diag system through the entry. Among them, the entry represents the intermediate value, that is, different versions correspond to different intermediate values. Since there is a preset relationship between different versions of test systems and different target intermediate values, if the obtained PN does not have a corresponding intermediate value, the intermediate value is directly selected as the defaultentry value, and the test system is adjusted to the diag7.6 system.
[0104] Among them, part of the code for the preset relationship between the machine model number and the system version is:
[0105] #!ipxe
[0106] set menu-timeout 16000
[0107] isset${ip}||dhcp
[0108] isset${next-server}||set next-server 10.0.0.10
[0109] set entry diag7.6
[0110] iseq${serial}61A7F4663&&set entry diag7.9&&gotoshowmenu
[0111] iseq${produt}NF6280M5&&set entry diag7.6&&gotoshowmenu
[0112] iseq${produt}NS5480M6&&set entry diag8.3&&gotoshowmenu
[0113] :showmenu
[0114] chain--autofree http: / / 10.0.0.10 / ipxe_menu.php
[0115] Optionally, in the switch testing method provided by the embodiments of the present application, a configuration file of the Dynamic Host Configuration Protocol is configured in the server. Before the switch to be tested receives the test instruction sent by the server, the method further includes: the switch to be tested obtains IP information through the Dynamic Host Configuration Protocol, and establishes a communication connection with the server through the IP information.
[0116] Specifically, the Dynamic Host Configuration Protocol refers to the DHCP protocol, which also means that a range of IP addresses is controlled by the server. When the switch to be tested logs in to the server, it can automatically obtain the IP address and subnet mask assigned by the server. The switch obtains its IP address information through the DHCP protocol, and can establish communication with the server, which is convenient for subsequent operations.
[0117] Optionally, in the switch testing method provided by the embodiments of the present application, the switch to be tested receives the test system file of the target version and the files required for testing fed back by the server based on the target machine model, and executing the test task based on the test system file of the target version and the files required for testing includes: the switch to be tested receives the test system file of the target version and the files required for testing through the File Transfer Protocol, and stores the test system file of the target version and the files required for testing in the local storage space; the switch to be tested starts the test system of the target version and runs the files required for testing.
[0118] Specifically, the switch under test receives the test system file of the target version and the files required for testing feedback by the server based on the target machine model, stores them in the local space, calls the corresponding diagOS according to the entry value, starts the corresponding kernel and file system. If the corresponding diagOS cannot be found for the entry value, the default diagOS is directly started. Under the http protocol, the switch receives the diagOS transmitted from the server and starts the test operation. Similarly, the kernel file vmlinuz and the file system need to be placed in the http root directory of the server. Among them, Kernel generally refers to a real-time operating system, which means that when data is generated, it can accept and process it at a fast enough speed and schedule all available resources. vmlinuz is a bootable and compressed kernel, that is, an executable Linux kernel.
[0119] The following is a detailed description in combination with another embodiment.
[0120] Embodiment 3
[0121] Figure 3 It is a flow of an optional test method for a switch according to an embodiment of the present invention Figure 3 , as Figure 3 shown, the method includes:
[0122] First, the server sends an instruction to the switch under test and configures the DHCP protocol file so that the switch under test can communicate with the server after obtaining an IP address.
[0123] Then, the server reads the PN information in the ONIEEEPROM. If the server fails to read successfully, it means there is a problem with the switch, and the spring-out ring of the switch needs to be returned to the factory to re-burn configuration information, etc.; if it can be read smoothly, the server executes the first script of ipxe_setting.php in the http root directory of the server. Among them, the method of calling the switch SN is stored in the ipxe_setting.php script.
[0124] Secondly, it is judged whether there is a corresponding intermediate value for the PN in the ipxe_setting.php script. If there is a corresponding intermediate value, the corresponding intermediate value is selected according to the obtained PN; if there is no corresponding intermediate value for the PN, the intermediate value needs to be selected as the defaultentry value.
[0125] Finally, according to the selected intermediate value, call the ipxe_menu.php script to find the corresponding diag system name in it, that is, find the test system of the corresponding version. If the corresponding diagOS is not found for the intermediate value, directly start the default diagOS. After finding the corresponding test system, the corresponding diagOS is quickly transferred from the server side to the switch to be tested via the http protocol within 10 seconds to start the test work.
[0126] Embodiment 4
[0127] A test system for a switch provided in this embodiment.
[0128] Figure 4 It is a schematic diagram of a test system for a switch according to an embodiment of the present invention. As Figure 4 shown, the system includes:
[0129] A server 41, configured to send a test instruction to the switch 42 to be tested, receive the target machine model fed back by the switch 42 to be tested based on the test instruction, determine the test system of the target version through the target machine model, and send the test system file of the target version and the files required for the test to the switch 42 to be tested.
[0130] It should be noted that the server 41 is a device that provides computing or application services for the test of the switch 42 to be tested. Sending a test instruction from the server 41 to the switch 42 to be tested can cause the switch 42 to be tested to start running and prepare to start the test program. Specifically, the server 41 configures the DHCP file to assign an IP address to the switch 42 to be tested, so that normal communication can be established between the switch 42 to be tested and the server 41. The switch calls the script in the server 41 to obtain its own machine model and returns the machine model to the server 41.
[0131] The switch 42 to be tested, communicatively connected to the server 41, is configured to respond to the test instruction sent by the server 41, obtain its own target machine model by calling the target method from the server 41, send the target machine model to the server 41, receive the test system file of the target version and the files required for the test fed back by the server 41, and execute the test task based on the test system file of the target version and the files required for the test.
[0132] Specifically, a switch is a network device for forwarding electrical signals. According to the needs of transmitting information between two communication ends, it manually or automatically completes the method of sending the information to be transmitted to the corresponding route that meets the requirements. When the switch under test 42 responds to the test instruction sent by the server 41, the server 41 configures the DHCP file to assign an IP address to the switch under test 42, so that normal communication can be established between the switch under test 42 and the server 41. Then, the switch calls the target method from the server 41, obtains its own model, and sends it to the server 41.
[0133] Optionally, a configuration file of the Dynamic Host Configuration Protocol is configured in the server 41. The switch under test 42 obtains IP information through the Dynamic Host Configuration Protocol and establishes a communication connection with the server 41 through the IP information.
[0134] Specifically, the Dynamic Host Configuration Protocol refers to the DHCP protocol, which also means that the server 41 controls a range of IP addresses. When the client logs in to the server 41, it can automatically obtain the IP address and subnet mask assigned by the server 41. The switch obtains its IP address information through the DHCP protocol and can establish communication with the server 41, which is convenient for subsequent operations.
[0135] Optionally, a first script is stored in the root directory of the text transfer protocol of the server 41. The target method for obtaining the machine model is stored in the first script. The switch under test 42 calls the target method from the first script through remote call and obtains the target machine model from its own memory through the target method.
[0136] Specifically, configure the DHCP configuration file / etc / dhcp / dhcpd.conf so that after the switch under test 42 obtains the IP address, it executes the start script ipxe_setting.php in the http root directory of the server 41, that is, the first script, which adds the method for obtaining the PN information and the method for calling to obtain the SN, that is, the method for obtaining the machine model. Call the target method from the first script, that is, obtain the serial number and machine model of the target switch from this script. Specifically, the switch under test 42 reads out the information in the script, calls the method in the server 41, obtains the PN in its own storage medium and then returns it to the server 41.
[0137] Optionally, a second script is stored in the root directory of the text transfer protocol of the server 41. The first relationship table between the machine model number and the intermediate value, and the second relationship table between the intermediate value and the version number of the test system are stored in the second script. The server 41 executes the second script stored in the root directory of the text transfer protocol, determines the target intermediate value corresponding to the machine model number according to the first relationship table, determines the target version number corresponding to the target intermediate value according to the second relationship table, and determines the test system corresponding to the target version number as the test system of the target version.
[0138] Specifically, the second script is the ipxe_menu.php script, the target intermediate value is the entry value, and the test systems of the target version are different versions of diagOS. The test system can include multiple different versions of the test system. For example, diag7.6, diag7.9, diag8.3. The second script is placed in the http root directory of the server 41, and stores the first relationship table between the machine model number and the intermediate value and the second relationship table between the intermediate value and the version number of the test system. The machine model number can be represented as the PN value. Determine the target intermediate value corresponding to the machine model number according to the first relationship table, and determine the target version number corresponding to the target intermediate value according to the second relationship table. Different versions correspond to different intermediate values. Write ipxe_setting.php. After obtaining the corresponding entry, different PNs need to run different test systems. According to the obtained PN value, select the corresponding entry value, and then select the corresponding diagOS through the entry, that is, the server 41 determines the test system corresponding to the target version number as the test system of the target version.
[0139] Optionally, in the case where the intermediate value corresponding to the target machine model number does not exist in the second script, the server 41 determines the test system corresponding to the preset version number as the test system of the target version.
[0140] Specifically, the test system corresponding to the preset version number is diag7.6. Since there is a preset relationship between different versions of the test system and different target intermediate values, if there is no corresponding preset relationship between the target machine model number and the intermediate value, that is, the obtained PN value has no corresponding intermediate value, then directly select the intermediate value as the defaul tentry value, and adjust the test system of the target version to the diag7.6 system.
[0141] Optionally, the server 41 obtains the test system file of the target version and the files required for the test from the root directory of the text transfer protocol, and sends the test system file of the target version and the files required for the test to the switch 42 to be tested through the text transfer protocol.
[0142] Specifically, the text transfer protocol is the http protocol. The test system file of the target version and the files required for testing are obtained under this protocol. The test system file is diagOS, and the files required for testing are the corresponding kernel file vmlinuz and the file system. Specifically, the corresponding diagOS is called according to the entry value to start the corresponding kernel and file system. If the corresponding diagOS cannot be found for the entry value, the default diagOS is directly started. The corresponding diagOS is quickly transferred from the server 41 to the switch 42 to be tested via the http protocol in a short time, and the testing work begins.
[0143] Embodiment 5
[0144] A test device for a switch provided in this embodiment includes multiple implementation units, and each implementation unit corresponds to each implementation step in Embodiment 1 above.
[0145] Figure 5 It is a schematic diagram of an optional test device for a switch according to an embodiment of the present invention Figure 1 , such as Figure 5 shown. The test device for the switch may include: a sending unit 50, a receiving unit 51, and a determining unit 52. Among them,
[0146] The sending unit 50 is configured to send a test instruction to the switch to be tested through the server;
[0147] The receiving unit 51 is configured to receive, through the server, the target machine model feedback by the switch to be tested based on the test instruction. Among them, the switch calls a target method from the server to obtain its own machine model;
[0148] The determining unit 52 is configured to determine, through the server, the test system of the target version based on the target machine model, and send the test system file of the target version and the files required for testing to the switch to be tested.
[0149] For the above-mentioned test device for a switch, the sending unit 50 can send a test instruction to the switch to be tested through the server; the receiving unit 51 can receive, through the server, the target machine model feedback by the switch to be tested based on the test instruction. Among them, the switch calls a target method from the server to obtain its own machine model; the determining unit 52 can determine, through the server, the test system of the target version based on the target machine model, and send the test system file of the target version and the files required for testing to the switch to be tested.
[0150] Optionally, in the switch testing device provided in the embodiments of the present application, the device further includes: a configuration unit, configured to configure a configuration file of the Dynamic Host Configuration Protocol in the server before the server sends a test instruction to the to-be-tested switch, allocate IP information to the to-be-tested switch through the Dynamic Host Configuration Protocol, and establish a communication connection between the to-be-tested switch and the server through the IP information.
[0151] Optionally, in the switch testing device provided in the embodiments of the present application, the receiving unit 51 includes: a first storage module, configured to store a first script under the text transfer protocol root directory of the server, where the first script stores a target method for obtaining the machine model number. The to-be-tested switch remotely calls the target method from the first script and obtains the target machine model number from its own memory through the target method.
[0152] Optionally, in the switch testing device provided in the embodiments of the present application, the receiving unit 51 includes: a second storage module, configured to execute a second script stored under the text transfer protocol root directory of the server, determine a target intermediate value corresponding to the machine model number according to a first relationship table, and determine a target version number corresponding to the target intermediate value according to a second relationship table; a first determination module, configured to determine the test system corresponding to the target version number as the test system of the target version through the server.
[0153] Optionally, in the switch testing device provided in the embodiments of the present application, the receiving unit 51 includes: a second determination module, configured to, when there is no intermediate value corresponding to the target machine model number in the second script, the server determines the test system corresponding to the preset version number as the test system of the target version.
[0154] Optionally, in the switch testing device provided in the embodiments of the present application, the determining unit 52 includes: an obtaining module, configured to obtain a test system file of the target version and files required for testing from under the text transfer protocol root directory through the server, and send the test system file of the target version and the files required for testing to the to-be-tested switch through the text transfer protocol.
[0155] The above-mentioned switch testing device may further include a processor and a memory. The above-mentioned sending unit 50, receiving unit 51, determining unit 52, etc. are all stored in the memory as program units, and the corresponding functions are implemented by the processor executing the above program units stored in the memory.
[0156] The above-mentioned processor includes a kernel, and the kernel retrieves the corresponding program unit from the memory. One or more kernels can be set, and the comparison result is sent to the target terminal by adjusting the kernel parameters.
[0157] The above-mentioned memory may include non-permanent memory in the form of computer-readable media, such as random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM (flash random access memory), and the memory includes at least one memory chip.
[0158] Embodiment VI
[0159] A test device for a switch provided in this embodiment includes a plurality of implementation units, and each implementation unit corresponds to each implementation step in Embodiment I above.
[0160] Figure 6 It is a schematic diagram of an optional test device for a switch according to an embodiment of the present invention Figure 2 , such as Figure 6 shown, the test device for the switch may include: a first receiving unit 60, a response unit 61, and a second receiving unit 62. Among them,
[0161] The first receiving unit 60 is used to receive a test instruction sent by the server through the switch to be tested;
[0162] The response unit 61 is used to respond to the test instruction through the switch to be tested, call a target method from the server to obtain its own target machine model, and send the target machine model to the server;
[0163] The second receiving unit 62 is used to receive the test system file of the target version and the files required for the test fed back by the server based on the target machine model through the switch to be tested, and execute the test task based on the test system file of the target version and the files required for the test.
[0164] For the above-mentioned test device for the switch, the first receiving unit 60 can receive the test instruction sent by the server through the switch to be tested; the response unit 61 can respond to the test instruction through the switch to be tested, call a target method from the server to obtain its own target machine model, and send the target machine model to the server; the second receiving unit 62 can receive the test system file of the target version and the files required for the test fed back by the server based on the target machine model through the switch to be tested, and execute the test task based on the test system file of the target version and the files required for the test.
[0165] Optionally, in the test device for the switch provided in the embodiment of the present application, the second receiving unit 62 includes: a first script is stored under the root directory of the text transfer protocol of the server, and a target method for obtaining the machine model is stored in the first script. The switch to be tested responds to the test instruction, and calling the target method from the server to obtain its own target machine model includes: a calling module, which is used to call the target method from the first script through the switch to be tested by means of remote call, and obtain the target machine model from its own memory through the target method.
[0166] Optionally, in the switch testing device provided in the embodiments of the present application, the second receiving unit 62 includes: a second script is stored under the text transfer protocol root directory of the server, and a first relationship table between the machine model number and the intermediate value, and a second relationship table between the intermediate value and the version number of the test system are stored in the second script. After receiving the target machine model number, the server executes the second script, determines the target intermediate value corresponding to the machine model number according to the first relationship table, determines the target version number corresponding to the target intermediate value according to the second relationship table, and determines the test system corresponding to the target version number as the test system of the target version.
[0167] Optionally, in the switch testing device provided in the embodiments of the present application, the second receiving unit 62 includes: in the case where there is no intermediate value corresponding to the target machine model number in the second script, the server determines the test system corresponding to the preset version number as the test system of the target version.
[0168] Optionally, in the switch testing device provided in the embodiments of the present application, the device further includes: an obtaining unit, configured to obtain IP information through a configuration file with a dynamic host configuration protocol in the server. Before the switch to be tested receives the test instruction sent by the server, the switch to be tested obtains the IP information through the dynamic host configuration protocol and establishes a communication connection with the server through the IP information.
[0169] Optionally, in the switch testing device provided in the embodiments of the present application, the second receiving unit 62 includes: a receiving module, configured to receive the test system file of the target version and the files required for testing through the switch to be tested based on the file transfer protocol, and store the test system file of the target version and the files required for testing in the local storage space; a starting module, configured to start the test system of the target version through the switch to be tested and run the files required for testing.
[0170] The above-mentioned switch testing device may further include a processor and a memory. The above-mentioned first receiving unit 60, response unit 61, second receiving unit 62, etc. are all stored in the memory as program units, and the processor executes the above program units stored in the memory to implement corresponding functions.
[0171] On the other hand, according to an embodiment of the present invention, there is also provided a computer-readable storage medium, and the computer-readable storage medium includes a stored computer program, wherein when the computer program runs, it controls the device where the computer-readable storage medium is located to execute the above-mentioned switch testing method.
[0172] The method embodiments provided in the embodiments of the present application may be executed on a mobile terminal, a computer terminal, or a similar computing device. Taking running on a mobile terminal as an example, Figure 7The following is a block diagram of the hardware structure of a mobile terminal for a method of testing a switch according to an embodiment of the present application. As Figure 7 shown, the mobile terminal may include one or more ( Figure 7 only one is shown in the figure) processors 702 (the processor 702 may include, but is not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 704 for storing data. Among them, the above-mentioned mobile terminal may further include a transmission device 706 for communication functions and an input / output device 708. Those of ordinary skill in the art can understand that Figure 7 the structure shown in the figure is only schematic and does not limit the structure of the above-mentioned mobile terminal. For example, the mobile terminal may further include more or fewer components than Figure 7 shown in the figure, or have a different configuration from Figure 7 shown in the figure.
[0173] The memory 704 may be used to store computer programs. For example, software programs and modules of application software, such as the computer program corresponding to the method of testing a switch in an embodiment of the present application. The processor 702 executes various functional applications and data processing by running the computer programs stored in the memory 704, that is, implements the above-mentioned method. The memory 704 may include a high-speed random access memory, and may further include a non-volatile memory, such as one or more magnetic storage devices, flash memories, or other non-volatile solid-state memories. In some instances, the memory 704 may further include a memory remotely provided with respect to the processor 702, and these remote memories may be connected to the mobile terminal through a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an enterprise intranet, a local area network, a mobile communication network, and combinations thereof.
[0174] The transmission device 706 is used to receive or send data via a network. Specific examples of the above-mentioned network may include a wireless network provided by a communication provider of the mobile terminal. In one instance, the transmission device 706 includes a network adapter (Network Interface Controller, abbreviated as NIC), which can be connected to other network devices through a base station and thus communicate with the Internet. In one instance, the transmission device 706 may be a radio frequency (Radio Frequency, abbreviated as RF) module, which is used to communicate with the Internet wirelessly.
[0175] According to another aspect of an embodiment of the present invention, an electronic device is further provided, including one or more processors and a memory, where the memory is used to store one or more programs. Among them, when the one or more programs are executed by the one or more processors, the one or more processors implement the above-mentioned method of testing a switch.
[0176] The serial numbers of the above embodiments of the present invention are only for description and do not represent the superiority or inferiority of the embodiments.
[0177] In the above embodiments of the present invention, the descriptions of the various embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.
[0178] In the several embodiments provided by the present application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only illustrative. For example, the division of the units can be a logical function division. In actual implementation, there may be other division methods. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the displayed or discussed coupling or direct coupling or communication connection between each other can be through some interfaces. The indirect coupling or communication connection of the units or modules can be in an electrical or other form.
[0179] The units described as separate components may or may not be physically separated. The components displayed as units may or may not be physical units, that is, they can be located in one place or distributed to multiple units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0180] In addition, the functional units in the various embodiments of the present invention can be integrated into one processing unit, or each unit can exist physically alone, or two or more units can be integrated into one unit. The above integrated units can be implemented in the form of hardware or in the form of software functional units.
[0181] If the above integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of this technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to enable a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The foregoing storage medium includes: USB flash drives, read-only memories (ROMs), random access memories (RAMs), mobile hard disks, magnetic disks, or optical disks, and other media that can store program codes.
[0182] The above are only the preferred embodiments of the present invention. It should be noted that for those of ordinary skill in the art, without departing from the principle of the present invention, several improvements and refinements can be made, and these improvements and refinements should also be regarded as the protection scope of the present invention.
Claims
1. A testing method for a switch, characterized in that, Including: The server sends a test instruction to the switch to be tested; The server receives the target machine model fed back by the switch to be tested based on the test instruction, wherein the switch calls a target method from the server to obtain its own machine model; The server determines the test system of the target version through the target machine model, and sends the test system file of the target version and the files required for the test to the switch to be tested; Wherein, a first script is stored in the root directory of the text transfer protocol of the server, and a target method for obtaining the machine model is stored in the first script. The switch to be tested calls the target method from the first script through remote call, and obtains the target machine model from its own memory through the target method.
2. The method according to claim 1, wherein Before the server sends a test instruction to the switch to be tested, the method further includes: Configuring a configuration file of the Dynamic Host Configuration Protocol in the server, allocating IP information for the switch to be tested through the Dynamic Host Configuration Protocol, and establishing a communication connection between the switch to be tested and the server through the IP information.
3. The method according to claim 1, wherein A second script is stored in the root directory of the text transfer protocol of the server. A first relationship table between the machine model and the intermediate value, and a second relationship table between the intermediate value and the version number of the test system are stored in the second script. The server determines the test system of the target version through the target machine model, including: The server executes the second script stored in the root directory of the text transfer protocol, determines the target intermediate value corresponding to the machine model according to the first relationship table, and determines the target version number corresponding to the target intermediate value according to the second relationship table; The server determines the test system corresponding to the target version number as the test system of the target version.
4. The method according to claim 3, wherein In the case that there is no intermediate value corresponding to the target machine model in the second script, the server determines the test system corresponding to the preset version number as the test system of the target version.
5. The method according to claim 1, wherein Sending the test system file of the target version and the files required for the test to the switch to be tested includes: The server obtains the test system file of the target version and the files required for the test from the root directory of the text transfer protocol, and sends the test system file of the target version and the files required for the test to the switch to be tested through the text transfer protocol.
6. A test method for a switch, characterized in that, Including: The switch to be tested receives the test instruction sent by the server; The switch to be tested responds to the test instruction, calls a target method from the server to obtain its own target machine model, and sends the target machine model to the server; The switch to be tested receives the test system file of the target version and the files required for the test fed back by the server based on the target machine model, and executes a test task based on the test system file of the target version and the files required for the test; Among them, a first script is stored in the root directory of the text transfer protocol of the server, and a target method for obtaining the machine model is stored in the first script. The to-be-tested switch responds to the test instruction and obtains its own target machine model from the server by calling the target method, including: the to-be-tested switch calls the target method from the first script through remote call, and obtains the target machine model from its own memory through the target method.
7. The method according to claim 6, characterized in that A second script is stored in the root directory of the text transfer protocol of the server. A first relationship table between the machine model and the intermediate value, and a second relationship table between the intermediate value and the version number of the test system are stored in the second script. After receiving the target machine model, the server executes the second script, determines the target intermediate value corresponding to the machine model according to the first relationship table, determines the target version number corresponding to the target intermediate value according to the second relationship table, and determines the test system corresponding to the target version number as the test system of the target version.
8. The method according to claim 7, wherein In the case that there is no intermediate value corresponding to the target machine model in the second script, the server determines the test system corresponding to the preset version number as the test system of the target version.
9. The method according to claim 6, wherein A configuration file of the Dynamic Host Configuration Protocol is configured in the server. Before the to-be-tested switch receives the test instruction sent by the server, the method further includes: The to-be-tested switch obtains IP information through the Dynamic Host Configuration Protocol, and establishes a communication connection with the server through the IP information.
10. The method according to claim 6, characterized in that The to-be-tested switch receives the test system file of the target version and the files required for testing fed back by the server based on the target machine model, and executes the test task based on the test system file of the target version and the files required for testing, including: The to-be-tested switch receives the test system file of the target version and the files required for testing based on the File Transfer Protocol, and stores the test system file of the target version and the files required for testing in the local storage space; The to-be-tested switch starts the test system of the target version and runs the files required for testing.
11. A test system for a switch, characterized in that, Including: A server, which is used to send a test instruction to the to-be-tested switch, receive the target machine model fed back by the to-be-tested switch based on the test instruction, determine the test system of the target version through the target machine model, and send the test system file of the target version and the files required for testing to the to-be-tested switch; The to-be-tested switch is communicatively connected to the server, and is used to respond to the test instruction sent by the server, call the target method from the server to obtain its own target machine model, send the target machine model to the server, receive the test system file of the target version and the files required for testing fed back by the server, and execute the test task based on the test system file of the target version and the files required for testing; Among them, a first script is stored under the root directory of the text transfer protocol of the server. A target method for obtaining the machine model is stored in the first script. The switch to be tested remotely calls the target method from the first script and obtains the target machine model from its own memory through the target method.
12. The test system for a switch according to claim 11, characterized in that, A configuration file of the Dynamic Host Configuration Protocol is configured in the server. The switch to be tested obtains IP information through the Dynamic Host Configuration Protocol and establishes a communication connection with the server through the IP information.
13. The test system of the switch according to claim 11, characterized in that, Among them, a first script is stored under the root directory of the text transfer protocol of the server. A target method for obtaining the machine model is stored in the first script. The switch to be tested remotely calls the target method from the first script and obtains the target machine model from its own memory through the target method.
14. The test system for a switch according to claim 11, characterized in that, A second script is stored under the root directory of the text transfer protocol of the server. A first relationship table between the machine model and the intermediate value, and a second relationship table between the intermediate value and the version number of the test system are stored in the second script. The server executes the second script stored under the root directory of the text transfer protocol, determines the target intermediate value corresponding to the machine model according to the first relationship table, and determines the target version number corresponding to the target intermediate value according to the second relationship table, and determines the test system corresponding to the target version number as the test system of the target version.
15. The test system for a switch according to claim 14, characterized in that, In the case where there is no intermediate value corresponding to the target machine model in the second script, the server determines the test system corresponding to the preset version number as the test system of the target version.
16. The test system for a switch according to claim 11, characterized in that, The server obtains the test system file of the target version and the files required for testing from the root directory of the text transfer protocol, and sends the test system file of the target version and the files required for testing to the switch to be tested through the text transfer protocol.
17. A test device for a switch, characterized in that, Including: A sending unit, configured to send a test instruction to a switch to be tested through a server; A receiving unit, configured to receive, through a server, a target machine model fed back by the switch to be tested based on the test instruction, wherein the switch calls a target method from the server to obtain its own machine model; A determining unit, configured to determine, through a server, a test system of a target version based on the target machine model, and send the test system file of the target version and the files required for testing to the switch to be tested; The receiving unit includes: a first storage module, configured to store a first script under the root directory of the text transfer protocol of the server, wherein a target method for obtaining a machine model is stored in the first script, and the switch to be tested remotely calls the target method from the first script and obtains the target machine model from its own memory through the target method.
18. A test device for a switch, characterized in that, Including: A first receiving unit, configured to receive, through the switch to be tested, a test instruction sent by the server; A response unit, configured to respond to the test instruction through the switch to be tested, call a target method from the server to obtain its own target machine model, and send the target machine model to the server; A second receiving unit, configured to receive, through a switch under test, a test system file of a target version and files required for testing fed back by a server based on a target machine model, and execute a test task based on the test system file of the target version and the files required for testing; Wherein, the response unit includes: a calling module, configured to remotely call a target method from a first script through a switch under test, and obtain a target machine model from its own memory through the target method, wherein the first script is stored in a text transfer protocol root directory of the server, and the target method for obtaining a machine model is stored in the first script.
19. A computer-readable storage medium, characterized in that, The computer-readable storage medium includes a stored computer program, wherein, when the computer program runs, it controls the device where the computer-readable storage medium is located to execute the test method of the switch according to any one of claims 1 to 5, or execute the test method of the switch according to any one of claims 6 to 10.
20. An electronic device, characterized in that, Comprising one or more processors and a memory, the memory is configured to store one or more programs, wherein, when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the test method of the switch according to any one of claims 1 to 5, or implement the test method of the switch according to any one of claims 6 to 10.
Citation Information
Patent Citations
Automatic test method and device for switch
CN113485928A
Switch system installation method, system, equipment and medium
CN114448788A