Disclosure of Invention
The embodiment of the application provides a line testing method, device and system, which at least solve the technical problems that when a line between servers has a problem, the specific position and line of the fault cannot be located, and the line is inconvenient to maintain and adjust.
According to an aspect of an embodiment of the present application, there is provided a method for testing a line, including: sending a control instruction to a first switch corresponding to a first server, wherein the control instruction is used for controlling the first switch to send a test data packet to a second switch corresponding to a second server; obtaining a test result corresponding to the test data packet sent by the first switch, wherein the test result is used for reflecting a line state between the first switch and the second switch; and determining the line state between the first server and the second server according to the test result.
Optionally, the test data packet includes: a data packet for testing connectivity between a first switch and the second switch; determining the line state between the first server and the second server according to the test result comprises: and when the test result indicates that the packet loss rate of the data packet reaches a first preset threshold value, determining that the line state between the first server and the second server is disconnected.
Optionally, the test data packet includes: a data packet for testing the quality of a link between a first switch and the second switch; determining the line state between the first server and the second server according to the test result comprises: and when the test result indicates that the packet loss rate of the test data packet reaches a second preset threshold value, determining that the line state between the first server and the second server is abnormal in link quality.
Optionally, after determining the line status between the first server and the second server according to the test result, the method further includes: and when the test result shows that the line state between the first server and the second server is disconnected or the link quality is abnormal, sending alarm information to an alarm system, wherein the alarm information is used for prompting the fault type.
Optionally, the method further comprises: acquiring time information corresponding to a line state, inputting the time information into a preset model for analysis, and obtaining the line state between a first server and a second server corresponding to the time information, wherein the preset model is obtained through training of multiple groups of data, and each group of data in the multiple groups of data comprises: and the line state corresponding to the sample time information is identified.
According to an aspect of an embodiment of the present application, there is provided a method for testing a line, including: a first switch receives a control instruction, wherein the control instruction is used for instructing the first switch to send a test data packet to a second switch, the first switch corresponds to a first server, and the second switch corresponds to a second server; the first switch receives feedback information after the second switch acquires the test data packet; the first switch determines a test result according to the feedback information, wherein the test result is used for reflecting the line state between the first switch and the second switch; and the first switch sends the test result to a server.
According to an aspect of an embodiment of the present application, there is provided a system for testing a line, including: the system comprises a first server, a second server and a third server, wherein the first server is used for sending a control instruction to a first switch corresponding to the first server, the control instruction is used for controlling the first switch to send a test data packet to a second switch corresponding to the second server, and obtaining a test result from the first switch, the test result is used for reflecting the line state between the first switch and the second switch, and the line state between the first server and the second server is determined according to the test result; the first switch is used for receiving the control instruction, sending the test data packet, receiving feedback information obtained by the second switch after the test data packet is obtained, determining a test result according to the feedback information, and sending the test result to the first server; and the second switch is used for receiving the test data packet and sending feedback information corresponding to the test data packet to the first switch.
According to an aspect of an embodiment of the present application, there is provided an apparatus for testing a line, including: the system comprises a sending module, a first server and a second server, wherein the sending module is used for sending a control instruction to a first switch corresponding to the first server, and the control instruction is used for controlling the first switch to send a test data packet to a second switch corresponding to the second server; an obtaining module, configured to obtain a test result corresponding to the test data packet sent by the first switch, where the test result is used to reflect a line state between the first switch and the second switch; and the determining module is used for determining the line state between the first server and the second server according to the test result.
According to an aspect of the embodiments of the present application, there is provided a storage medium, wherein the storage medium includes a stored program, and wherein when the program runs, the storage medium controls a device to execute the above-mentioned method for testing a circuit.
According to an aspect of the embodiments of the present application, there is provided a processor, wherein the processor is configured to execute a program, and wherein the program executes the method for performing the above-mentioned line test.
In the embodiment of the application, a control instruction is sent to a first switch corresponding to a first server, and the control instruction is used for controlling the first switch to send a test data packet to a second switch corresponding to a second server; obtaining a test result corresponding to the test data packet sent by the first switch, wherein the test result is used for reflecting a line state between the first switch and the second switch; and determining the line state between the first server and the second server according to the test result. The detection of the circuit between the switches corresponding to the other server through the switch corresponding to the server is achieved, and the effect of accurately positioning the fault position is achieved. Therefore, the technical problem that when a line between servers goes wrong, the specific position and the line of the fault cannot be located, and line maintenance and adjustment are inconvenient is solved.
Detailed Description
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only partial embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and claims of this application and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the application described herein are capable of operation in sequences other than those illustrated or described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed, but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
In accordance with an embodiment of the present application, there is provided a method embodiment of line testing, it being noted that the steps illustrated in the flowchart of the drawings may be performed in a computer system such as a set of computer-executable instructions and that, although a logical order is illustrated in the flowchart, in some cases the steps illustrated or described may be performed in an order different than here.
Fig. 1 is a schematic flow chart of a method for testing a circuit according to an embodiment of the present application, and as shown in fig. 1, the method at least includes the following steps:
step S102, sending a control instruction to a first switch corresponding to a first server, wherein the control instruction is used for controlling the first switch to send a test data packet to a second switch corresponding to a second server;
in some optional embodiments of the present application, before sending the control instruction to the first switch, the first server may further log in to the first switch through a script, for example, log in to the first switch through a paramiko module, so that the first switch may receive the control instruction sent by the first server; the paramiko module is a module for remote control, and commands or file operations can be performed on a remote server by using the paramiko module.
In some optional embodiments of the present application, the first server may send the control command periodically, or may send the control command at any time as needed; the test data packet may be a data packet for verifying line connectivity, or may be a data packet for verifying link quality.
Step S104, obtaining a test result corresponding to the test data packet sent by the first switch, wherein the test result is used for reflecting a line state between the first switch and the second switch;
in some optional embodiments of the present application, after the first switch sends the detection packet to the second switch, the second switch sends feedback information to the first switch, where the feedback information may reflect a test result corresponding to the test packet.
And after the first switch acquires the feedback information sent by the second switch, determining a test result and sending the test result to the first server.
And step S106, determining the line state between the first server and the second server according to the test result.
In some optional embodiments of the present application, after the first server obtains the test result sent by the first switch, the first server analyzes the test result, and determines a line state of the test result corresponding to a line state between the first server and the second server; wherein the line status includes at least one of: normal line, disconnected line and abnormal link quality.
In some optional embodiments of the present application, the test data packet may be: a data packet for testing connectivity between a first switch and the second switch; when the test data packet is a data packet for testing connectivity between the first switch and the second switch, determining the line state between the first server and the second server according to the test result may be implemented in the following manner: and when the test result indicates that the packet loss rate of the data packet reaches a first preset threshold value, determining that the line state between the first server and the second server is disconnected.
In some optional embodiments of the present application, when the test packet is a packet for testing connectivity between the first switch and the second switch, the ping packet may be set to be 10 packets, the Maximum Transmission Unit (MTU) may be set to be 1500 bytes, and when a packet loss rate indicated by the test result reaches a first preset threshold 50%, it is determined that a line state between the first server and the second server is disconnected.
As can be seen from the above, the number of packets and the maximum transmission unit used in the test of connectivity are different from those used in the test of link quality. The number of data packets adopted when the connectivity is tested is smaller than that of the data packets adopted when the link quality is tested; the maximum transmission unit used when testing connectivity is smaller than the maximum transmission unit used when testing link quality.
In some optional embodiments of the present application, the test data packet may be: a data packet for testing the quality of a link between a first switch and the second switch; when the test data packet is a data packet for testing the link quality between the first switch and the second switch, determining the line state between the first server and the second server according to the test result may be implemented in the following manner: and when the test result indicates that the packet loss rate of the data packet reaches a second preset threshold value, determining that the line state between the first server and the second server is abnormal in link quality.
In some optional embodiments of the present application, when the test packet is a packet for testing the link quality between the first switch and the second switch, the ping packet may be set to be 1000 packets, the maximum transmission unit is 2000 bytes, and when the packet loss rate indicated by the test result reaches a second preset threshold (e.g., 3%), it is determined that the line status between the first server and the second server is abnormal in link quality.
In some optional embodiments of the present application, after determining the line status between the first server and the second server according to the test result in the above step, the following steps are further performed: and when the test result shows that the line state between the first server and the second server is disconnected or the link quality is abnormal, sending alarm information to an alarm system, wherein the alarm information is used for prompting the fault type.
When judging that the fault information exists in the line state, each server can independently alarm, for example:
when a first server tests that a fault exists in a line state between the first server and a second server, alarm information is sent to an alarm system, and when a second server tests that a fault exists in the line state between the first server and the second server, the alarm information is also sent to the alarm system; when one of the first server and the second server or the switch corresponding to one of the servers has a connection fault or other faults, the other server can still send the alarm information related to the line fault information between the first server and the second server to the alarm center.
In some optional embodiments of the present application, the alarm system is an alarm platform of the server, and after sending the alarm information to the alarm system, an administrator may conveniently maintain a line between the first server and the second server or replace the first switch or the second switch.
In some optional embodiments of the present application, after determining the line status between the first server and the second server according to the test result, the method further includes sending the test result and time information corresponding to the test result to a storage device.
In some optional real-time embodiments of the present application, the above-mentioned line testing method may further include the steps of,
acquiring time information, inputting the time information into a preset model for analysis, and obtaining a line state between a first server and a second server corresponding to the time information, wherein the preset model is obtained through training of multiple groups of data, and each group of data in the multiple groups of data comprises: and the line state corresponding to the sample time information is identified.
In some optional real-time embodiments of the present application, the above-mentioned line testing method may further include the steps of,
acquiring time information corresponding to a line state, inputting the time information into a preset model for analysis, and obtaining the line state between a first server and a second server corresponding to the time information, wherein the preset model is obtained through training of multiple groups of data, and each group of data in the multiple groups of data comprises: and the line state corresponding to the sample time information is identified.
In the embodiment of the application, a control instruction is sent to a first switch corresponding to a first server, and the control instruction is used for controlling the first switch to send a test data packet to a second switch corresponding to a second server; obtaining a test result corresponding to the test data packet sent by the first switch, wherein the test result is used for reflecting a line state between the first switch and the second switch; and determining the line state between the first server and the second server according to the test result. The detection of the circuit between the switches corresponding to the other server through the switch corresponding to the server is achieved, and the effect of accurately positioning the fault position is achieved. Therefore, the technical problem that when a line between servers goes wrong, the specific position and the line of the fault cannot be located, and line maintenance and adjustment are inconvenient is solved.
Secondly, the Ping test is carried out on the line state between the two servers through the switch, so that the test path can be reduced, the test time is shortened, and the test efficiency is improved.
Fig. 2 is a schematic flow chart of a method for testing a circuit according to an embodiment of the present application, and as shown in fig. 2, the method at least includes the following steps:
step S202, a first switch receives a control instruction, wherein the control instruction is used for instructing the first switch to send a test data packet to a second switch, the first switch corresponds to a first server, and the second switch corresponds to a second server;
in some optional embodiments of the present application, the first switch receives the control instruction from the first server, and the first server may further log in the first switch through a script before sending the control instruction to the first switch, so that the first switch may receive the control instruction sent by the first server.
In some optional embodiments of the present application, the first server may send the control command periodically, or may send the control command at any time as needed; the test data packet may be a data packet for verifying line connectivity, or may be a data packet for verifying link quality.
Step S204, the first switch receives feedback information after the second switch acquires the test data packet;
in some optional embodiments of the present application, after the first switch sends the detection packet to the second switch, the second switch sends feedback information to the first switch, where the feedback information may reflect a test result corresponding to the test packet.
Step S206, the first switch determines a test result according to the feedback information, and the test result is used for reflecting the line state between the first switch and the second switch;
step S208, the first switch sends the test result to a server.
And after the first switch acquires the feedback information sent by the second switch, determining a test result and sending the test result to the first server.
In some optional embodiments of the present application, after the first server obtains the test result sent by the first switch, the first server analyzes the test result, and determines a line state of the test result corresponding to a line state between the first server and the second server; wherein the line status includes at least one of: normal line, disconnected line and abnormal link quality.
In some optional embodiments of the present application, the test data packet may be: a data packet for testing connectivity between a first switch and the second switch; when the test packet is a packet for testing connectivity between the first switch and the second switch,
the first server may determine a line status between the first server and the second server according to the test result, and may be implemented in the following manner: and when the test result indicates that the packet loss rate of the data packet reaches a first preset threshold value, determining that the line state between the first server and the second server is disconnected.
In some optional embodiments of the present application, when the test packet is a packet for testing connectivity between the first switch and the second switch, the ping packet may be set to be 10 packets, the maximum transmission unit is 1500 bytes, and when the packet loss rate indicated by the test result reaches a first preset threshold 50%, the first server determines that the line state between the first server and the second server is disconnected.
In some optional embodiments of the present application, the test data packet may be: a data packet for testing the quality of a link between a first switch and the second switch; when the test packet is a packet for testing the link quality between the first switch and the second switch, the first server may determine the line state between the first server and the second server according to the test result, and may be implemented in the following manner: and when the test result indicates that the packet loss rate of the data packet reaches a second preset threshold value, the first server determines that the line state between the first server and the second server is abnormal in link quality.
In some optional embodiments of the present application, when the test data packet is a data packet for testing the link quality between the first switch and the second switch, the ping data packet may be set to be 1000 packets, the maximum transmission unit is 2000 bytes, and when the data packet loss rate indicated by the test result reaches a second preset threshold of 3%, the first server determines that the line status between the first server and the second server is abnormal in link quality.
In some optional embodiments of the present application, after the first server determines the line status between the first server and the second server according to the test result, the following steps are further performed: and when the test result shows that the line state between the first server and the second server is disconnected or the link quality is abnormal, sending alarm information to an alarm system, wherein the alarm information is used for prompting the fault type.
In some optional embodiments of the present application, the alarm system is an alarm platform of the server, and after sending the alarm information to the alarm system, an administrator may conveniently maintain a line between the first server and the second server or replace the first switch or the second switch.
In some optional embodiments of the present application, after the first server determines the line status between the first server and the second server according to the test result, the method further includes sending, by the server, the test result and/or the line status, and time information corresponding to the test result and/or the line status to a storage device, where the time information may be stored in a form of a text file.
In some optional real-time examples of the present application, the line testing method may further include the following steps that a first server or other intelligent devices obtains time information corresponding to a line state, and inputs the time information into a preset model for analysis to obtain the line state between the first server and a second server corresponding to the time information, where the preset model is obtained through training of multiple sets of data, and each set of data in the multiple sets of data includes: and the line state corresponding to the sample time information is identified.
In the embodiment of the application, a first switch receives a control instruction, wherein the control instruction is used for instructing the first switch to send a test data packet to a second switch, the first switch corresponds to a first server, and the second switch corresponds to a second server; the first switch receives feedback information after the second switch acquires the test data packet; the first switch determines a test result according to the feedback information, wherein the test result is used for reflecting the line state between the first switch and the second switch; and the first switch sends the test result to a server. The detection of the circuit between the switches corresponding to the other server through the switch corresponding to the server is achieved, and the effect of accurately positioning the fault position is achieved. Therefore, the technical problem that when a line between servers goes wrong, the specific position and the line of the fault cannot be located, and line maintenance and adjustment are inconvenient is solved.
Fig. 3 is a schematic structural diagram of a line testing system according to an embodiment of the present application, and as shown in fig. 3, the apparatus at least includes: a first server 32, a first switch 34, a second switch 36, a second server 38; wherein:
the system comprises a first server 32, a second server 32 and a third server, wherein the first server 32 is used for sending a control instruction to a first switch 34 corresponding to the first server 32, the control instruction is used for controlling the first switch 34 to send a test data packet to a second switch 36 corresponding to a second server 38, and obtaining a test result from the first switch 34, the test result is used for reflecting a line state between the first switch 34 and the second switch 36, and the line state between the first server 32 and the second server 38 is determined according to the test result;
the first switch 34 is configured to receive the control instruction, send the test data packet, receive feedback information obtained by the second switch 36 after the test data packet is obtained, determine a test result according to the feedback information, and send the test result to the first server 32;
the second switch 36 is configured to receive the test data packet, and send feedback information corresponding to the test data packet to the first switch 34;
a second server 38 connected to the second switch 36.
It should be noted that, reference may be made to the description related to the embodiment shown in fig. 1 for a preferred implementation of the embodiment shown in fig. 3, and details are not described here again.
Fig. 4 is a schematic structural diagram of an apparatus for testing a circuit according to an embodiment of the present application, the apparatus at least including: a sending module 42, an obtaining module 44, and a determining module 46; wherein:
a sending module 42, configured to send a control instruction to a first switch corresponding to a first server, where the control instruction is used to control the first switch to send a test data packet to a second switch corresponding to a second server;
an obtaining module 44, configured to obtain a test result corresponding to the test data packet sent by the first switch, where the test result is used to reflect a line state between the first switch and the second switch;
and a determining module 46, configured to determine a line status between the first server and the second server according to the test result.
It should be noted that, reference may be made to the description related to the embodiment shown in fig. 1 for a preferred implementation of the embodiment shown in fig. 4, and details are not described here again.
According to another aspect of the embodiments of the present application, there is also provided a storage medium, where the storage medium includes a stored program, and where the program is executed to control a device in which the storage medium is located to perform the above-mentioned method for testing a circuit.
According to another aspect of the embodiments of the present application, there is also provided a processor, configured to execute a program, where the program executes the method for testing a circuit described above.
The above-mentioned serial numbers of the embodiments of the present application are merely for description and do not represent the merits of the embodiments.
In the above embodiments of the present application, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments.
In the embodiments provided in the present application, it should be understood that the disclosed technology can be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, a division of a unit may be a division of a logic function, and an actual implementation may have another division, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or may not be executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, units or modules, and may be in an electrical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, and can also be realized in a form of a software functional unit.
The integrated unit, if implemented in the form of a software functional unit and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be substantially implemented or contributed to by the prior art, or all or part of the technical solution may be embodied in a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method of the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic or optical disk, and other various media capable of storing program codes.
The foregoing is only a preferred embodiment of the present application and it should be noted that those skilled in the art can make several improvements and modifications without departing from the principle of the present application, and these improvements and modifications should also be considered as the protection scope of the present application.