CN115766510A - Testing method and readable medium for loop detection stability of switch - Google Patents

Testing method and readable medium for loop detection stability of switch Download PDF

Info

Publication number
CN115766510A
CN115766510A CN202211407526.2A CN202211407526A CN115766510A CN 115766510 A CN115766510 A CN 115766510A CN 202211407526 A CN202211407526 A CN 202211407526A CN 115766510 A CN115766510 A CN 115766510A
Authority
CN
China
Prior art keywords
loop detection
switch
port
network card
message
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211407526.2A
Other languages
Chinese (zh)
Inventor
陆芬
方海勤
骆雄辉
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Primestone Network Technology Co ltd
Original Assignee
Shenzhen Primestone Network Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Primestone Network Technology Co ltd filed Critical Shenzhen Primestone Network Technology Co ltd
Priority to CN202211407526.2A priority Critical patent/CN115766510A/en
Publication of CN115766510A publication Critical patent/CN115766510A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Small-Scale Networks (AREA)

Abstract

The invention discloses a testing method and a readable medium for the loop detection stability of a switch, wherein the testing method for the loop detection stability of the switch comprises the steps of constructing a cable misconnection testing topology, respectively connecting a first port and a second port of a tested switch with a first network card and a second network card of a PC (personal computer), and selecting the cable misconnection condition to be tested; issuing configuration to a tested switch, forbidding a loop detection function of a second port of the tested switch, and enabling the loop detection function of a first port of the tested switch; and sequentially judging whether all the cable misconnection conditions are selected, and carrying out loop detection stability test on the selected cable misconnection conditions. The invention uses the PC to simulate the auxiliary switch, the construction and the sending of the message can be finished by the automatic system controlling the PC, the test can be finished only by one switch and one PC, other switches can not be occupied, and the equipment resource cost is saved.

Description

Testing method and readable medium for loop detection stability of switch
Technical Field
The invention relates to the technical field of loop detection, in particular to a method for testing the loop detection stability of a switch and a readable medium.
Background
The loop detection function is an important function of the switch, and the main function is to automatically close a port with a problem to eliminate a loop when the loop exists in the network.
The error of network connection or configuration easily causes the forwarding loop in the two-layer network, so that the device can circularly and repeatedly send the broadcast, multicast, unknown unicast and other messages, thereby causing the waste of network resources and even the network paralysis, and the loop detection is specially for effectively preventing the loop and ensuring the stability and safety of the network. Therefore, the stability test of the loop detection function is particularly important.
In addition, the loop detection function has an automatic recovery time, when the automatic recovery time is over, the blocked port becomes a forwarding state, the network is in a loop state in this period of time, and if the time that the port is in the forwarding state is too long, a great negative effect is brought to the network, so that it is particularly important to test the duration time after the blocked port becomes the forwarding state after the loop detection automatic recovery time is over.
At present, the stability test mode of the existing loop detection function mainly has two types: 1. purchasing a network tester, and simulating a switch to perform networking test; 2. networking test is carried out by using a plurality of switches together. However, a network tester is purchased, a switch is simulated for networking test, one tester port can only simulate one switch, but the price of the network tester is expensive, and the test cost is greatly increased; and because the time required by the stability test is long, the stability test can occupy the equipment resources of a laboratory for a long time, and the test progress of other projects can be influenced. Meanwhile, the two testing modes require the testers to keep staring at the testers, so that great manpower is consumed, and the situations of insufficient testing or omission caused by human factors exist.
Therefore, there is a need to develop a fully automatic testing method for loop detection stability of switch to solve the above problems.
Disclosure of Invention
The invention provides a method and a readable medium for testing the loop detection stability of a switch, aiming at solving the problems that the existing stability testing mode with the loop detection function has higher price, occupies other switches and needs testers to keep staring.
The technical scheme of the invention is as follows:
in a first aspect, the present invention provides a method for testing loop detection stability of a switch, including the following steps:
s1, building a cable misconnection test topology, respectively connecting a first port and a second port of a tested switch with a first network card and a second network card of a PC (personal computer), and selecting the cable misconnection condition to be tested;
s2, issuing configuration to a tested switch, forbidding a loop detection function of a second port of the tested switch, and enabling the loop detection function of a first port of the tested switch;
s3, sequentially judging whether all the cable misconnection conditions are selected, and carrying out loop detection stability test on the selected cable misconnection conditions;
and S4, when the hooked cable misconnection condition is subjected to a loop detection stability test, setting the loop detection state of the first port of the tested switch to be a blocking state, then sending a two-layer data message to the first network card by the second network card of the PC, and calculating the duration time of the first port of the tested switch maintaining the forwarding state after the loop detection automatic recovery time is overtime through the transceiving time of the two-layer data message.
According to the testing method for the loop detection stability of the switch, in the step S1, after the cable misconnection condition to be tested is selected, the testing time of each cable misconnection condition is set.
According to the testing method for the loop detection stability of the switch in the scheme, in the step S1, the cable misconnection condition includes a first cable misconnection condition causing self-looping of the switch, a second cable misconnection condition causing self-looping of connected equipment under the switch, and a third cable misconnection condition causing looping between the switches.
Further, in step S4, the specific sub-step of performing the loop detection stability test on the first cable miswire condition includes:
step A1, a loop detection function of a first port of a tested switch is in an enabling state, a first loop detection message is sent out, after a first network card of the PC receives the first loop detection message, the first loop detection message is directly sent to a second port of the tested switch from a second network card of the PC, and after the tested switch receives the first loop detection message, the loop detection state of the first port of the tested switch is set to be in a blocking state;
step A2, constructing a first two-layer data message, and sending the first two-layer data message from a second network card of the PC to a first network card of the PC;
and A3, monitoring the condition that the first network card of the PC receives the first two-layer data message in real time, and calculating the duration time of the first port of the tested switch maintaining the forwarding state after the loop detection automatic recovery time is overtime according to the receiving and sending time of the first two-layer data message.
Further, in step A3, after the automatic recovery time of the loop detection is overtime, the first port of the switch under test is changed from the blocking state to the forwarding state, and the first network card of the PC receives the first two-layer data packet sent by the second network card of the PC.
Further, in step A3, after the first port of the tested switch enters the forwarding state, recording the time and the number of the messages when the first network card of the PC receives the first two-layer data message each time, and calculating the time for maintaining the forwarding state when the first port of the tested switch changes from the blocking state to the forwarding state each time;
further, in step A3, after the calculation is completed, the record is saved in an excel file.
Further, in step S4, the specific sub-step of performing a loop detection stability test on the second cable misconnection condition includes:
step B1, the loop detection function of the first port of the tested switch is in an enabling state, a second loop detection message is sent, after the first network card of the PC receives the second loop detection message, the last hop field in the second loop detection message is modified into the MAC address of the PC, the modified second loop detection message is sent to the first port of the tested switch from the first network card of the PC, and after the modified second loop detection message is received by the tested switch, the loop detection state of the first port of the tested switch is set to be in a blocking state;
b2, constructing a second two-layer data message, and sending the second two-layer data message to a first network card of the PC from a second network card of the PC;
and step B3, monitoring the condition that the first network card of the PC receives the second layer data message in real time, and calculating the duration time of the first port of the tested switch maintaining the forwarding state after the loop detection automatic recovery time is overtime according to the receiving and sending time of the second layer data message.
Further, in step B3, after the automatic recovery time of the loop detection is overtime, the first port of the switch under test is changed from the blocking state to the forwarding state, and the first network card of the PC receives the second layer data packet sent by the second network card of the PC.
Further, in step B3, after the first port of the tested switch enters the forwarding state, the time and the number of the second layer data packet received by the first network card of the PC each time are recorded, and the time for maintaining the forwarding state when the first port of the tested switch changes from the blocking state to the forwarding state each time is calculated.
Further, in step B3, after the calculation is completed, the record is saved in an excel file.
Further, in step S4, the specific sub-step of performing the loop detection stability test on the third cable misconnection condition includes:
step C1, a first port of the tested switch sends a third loop detection message, a first network card of the PC receives the third loop detection message, a first hop field in the third loop detection message is modified into an MAC address of the PC, the modified third loop detection message is sent to a second port of the tested switch from a second network card of the PC, and the loop detection state of the first port of the tested switch is set to be a blocking state after the modified third loop detection message is received by the tested switch;
step C2, constructing a third two-layer data message, and sending the third two-layer data message to the first network card of the PC from the second network card of the PC;
and step C3, monitoring the condition that the first network card of the PC receives the third two-layer data message in real time, and calculating the duration time of the first port of the tested switch maintaining the forwarding state after the loop detection automatic recovery time is overtime according to the receiving and sending time of the third two-layer data message.
Further, in step C3, after the automatic recovery time of the loop detection is overtime, the first port of the switch under test is changed from the blocking state to the forwarding state, and the first network card of the PC receives the third two-layer data packet sent by the second network card of the PC.
Further, in step C3, after the first port of the tested switch enters the forwarding state, the time and the number of the packets when the first network card of the PC receives the third two-layer data packet each time are recorded, and the time for maintaining the forwarding state when the first port of the tested switch changes from the blocking state to the forwarding state each time is calculated.
Further, in step C3, after the calculation is completed, the record is saved in an excel file.
Further, the first loop detection message, the second loop detection message, and the third loop detection message all include a destination MAC address, a source MAC address, a protocol type of the message, an MAC address of an exchange that sends the message, a port number of the exchange that sends the message, and a previous hop field.
In a second aspect, the present invention provides a computer-readable medium storing computer-executable instructions for performing the above-mentioned method for testing the loop detection stability of a switch.
The invention according to the scheme has the advantages that:
1. the invention uses the PC to simulate the auxiliary switch, the construction and the sending of the message can be completed by the automatic system controlling the PC, and the test can be completed only by one switch and one PC without purchasing any test instrument, thereby not occupying other switches, saving the cost of equipment resources, and simultaneously, the test can be performed at any time, such as at night or on weekends, not occupying the equipment and time of normal working time, and saving the time cost;
2. the two-layer data message constructed by the invention is sent from the PC network card, and after the loop detection automatic recovery time is overtime through the receiving and sending of the message, the duration time of the forwarding state of the port of the tested switch is maintained, and the time in millisecond unit can be tested, and the test precision is high;
3. the invention can monitor the running state of the loop detection of the exchanger in real time for a long time in the testing process, when the loop detection function of the exchanger fails, the system can monitor and record in real time, can better and more comprehensively test the stability of the loop detection function of the exchanger, has fewer operation steps and can greatly reduce manual misoperation.
Drawings
Fig. 1 is a schematic flow chart of a testing method for detecting the stability of a loop of a switch in the invention;
FIG. 2 is an enlarged view of portion A of FIG. 1;
FIG. 3 is an enlarged view of portion B of FIG. 1;
FIG. 4 is a first exemplary cable miswire schematic that causes a loop;
FIG. 5 is a second exemplary cable miswire schematic that causes looping;
FIG. 6 is a third exemplary cable miswire schematic that causes looping;
fig. 7 is a schematic diagram of a cable misconnection test topology established by the invention.
Detailed Description
In order to make the technical problems, technical solutions and advantageous effects to be solved by the present invention more clearly apparent, the present invention is further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
It is to be understood that the terms "comprises" and "comprising," and any variations thereof, in the description and claims of this invention are intended to cover non-exclusive inclusions. For example, a process, method, system, article, or apparatus that comprises a list of steps or elements is not limited to only those steps or elements but may alternatively include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
Referring to fig. 1 to fig. 3, an embodiment of the present invention provides a method for testing loop detection stability of an exchange, including the following steps:
s1, building a cable misconnection test topology, selecting the cable misconnection condition to be tested, and setting the test time of each cable misconnection condition.
Specifically, there are three typical cable misconnection conditions causing loops, the first is that a field wiring worker connects two ports of the same switch together by using one cable by mistake, which causes a cable misconnection condition of a self-loop of the switch, as shown in fig. 4; secondly, field wiring personnel mistakenly connect two ports of the switch lower connection equipment together by using one cable, so that the condition of cable misconnection of the self-loop of the switch lower connection equipment is caused, as shown in fig. 5; the third is that field wiring personnel mistakenly connects the first port and the second port of the switch to be tested to the first port and the second port of the auxiliary switch respectively, so that the cable looped between the switches is misconnected, as shown in fig. 6.
According to the three typical cable misconnection conditions causing the loop, the invention builds a cable misconnection test topology, as shown in fig. 7, the first port and the second port of the tested switch are respectively connected with the first network card and the second network card of the PC, and the three typical cable misconnection conditions causing the loop, as shown in fig. 1 to fig. 3, can be completed. In the invention, only one tested switch and one PC are needed during testing, the PC is used for simulating the auxiliary switch and sending the loop detection message of the system structure, a test instrument is not needed to be purchased, other switches are not occupied, and the equipment resource cost is saved.
And S2, calling the CRT to issue configuration to the tested switch, disabling the loop detection function of the second port of the tested switch, and enabling the loop detection function of the first port of the tested switch.
The CRT is a serial port debugging tool and can be used for issuing a configuration command to a tested switch through a serial port. In addition, only the first port of the switch to be tested is enabled, so as to eliminate the loop, thereby achieving the testing effect.
And S3, judging whether the first cable misconnection condition is selected, if not, indicating that the test is not carried out, executing the step S7, and if so, executing the step S4.
And S4, sending a first loop detection message from the first port of the tested switch, directly sending the first loop detection message from the second network card of the PC to the second port of the tested switch after the first network card of the PC receives the first loop detection message, considering that the network has a loop after the tested switch receives the first loop detection message, and setting the loop detection state of the first port of the tested switch to be a blocking state.
Specifically, the content of the first loop detection packet includes a destination MAC address, a source MAC address, a protocol type of the packet, an MAC address of a switch that sends the packet, a port number of the switch that sends the packet, and a previous hop field. The destination MAC address is set as a broadcast address, so that the message can be broadcast and forwarded as a broadcast message when passing through other switches. The source MAC address and the MAC address of the switch sending the message are both used for recording which switch sends the loop detection message; the port of the exchanger for sending the message is used for judging which port is blocked after looping, thereby achieving the effect of looping elimination; the last-hop field is the MAC address of the last switch through which the message passed.
And S5, constructing a first two-layer data message and sending the first two-layer data message to a first network card of the PC from a second network card of the PC.
The sending rate of the first layer and second layer data message is 1000 packets/second, the continuous sending time is T1, and the time in millisecond unit can be tested by adopting the setting.
And S6, monitoring the condition that the first network card of the PC receives the first two-layer data message in real time, and calculating the duration time of the first port of the tested switch maintaining the forwarding state after the loop detection automatic recovery time is overtime through the receiving and sending time of the first two-layer data message.
Specifically, when the first port of the switch under test is in a blocking state, the first network card of the PC cannot receive the first layer data packet sent by the second network card; when the automatic recovery time (such as interval of 30 seconds) of the loop detection is overtime, the first port of the detected switch is changed from a blocking state to a forwarding state, at the moment, the first network card of the PC can receive the first two-layer data message sent by the second network card, and after the detection time (such as interval of 5 seconds) of the detected switch is overtime, the first port of the detected switch sends the first loop detection message again and then enters the blocking state; when the first port of the tested switch enters a forwarding state, recording the time and the number of messages when the first network card of the PC receives the first two-layer data message each time, and calculating the duration time of maintaining the forwarding state when the first port of the tested switch is changed from a blocking state to the forwarding state each time, wherein the calculation method comprises the following steps: number of messages/1000 (packets/second); and after the calculation is finished, the record is stored in an excel file, so that the test personnel can conveniently check the record.
And S7, judging whether the second cable misconnection condition is selected, if not, indicating that the test is not carried out, executing the step S10, and if so, executing the step S8.
And S8, sending a second loop detection message by the first port of the tested switch, modifying a previous hop field in the second loop detection message into the MAC address of the PC after the first network card of the PC receives the second loop detection message, sending the modified second loop detection message to the first port of the tested switch from the first network card of the PC, considering that the network has a loop after the tested switch receives the modified second loop detection message, and setting the loop detection state of the first port of the tested switch as a blocking state.
In the invention, the PC is used for simulating the auxiliary switch because the second cable misconnection condition is the self-loop of the switch downlink equipment and passes through the auxiliary switch, so that the last-hop field in the second loop detection message needs to be modified into the MAC address of the PC to simulate the second cable misconnection condition. And the first cable misconnection condition is that the switch is self-loop, so the content of the first loop detection message does not need to be changed when the first loop detection message is the previous hop or the first cable misconnection condition is self. Meanwhile, the contents of the second loop detection message and the first loop detection message are consistent, and the second loop detection message also comprises a destination MAC address, a source MAC address, the protocol type of the message, the MAC address of the switch sending the message, the port number of the switch sending the message and a previous hop field.
And S9, constructing a second two-layer data message and sending the second two-layer data message to the first network card of the PC from the second network card of the PC.
The sending rate of the second layer data message is 1000 packets/second, the continuous sending time is T2, and the time in millisecond unit can be tested by adopting the setting.
And S10, monitoring the condition that the first network card of the PC receives the second layer data message in real time, and calculating the duration time of the first port of the tested switch maintaining the forwarding state after the loop detection automatic recovery time is overtime through the receiving and sending time of the second layer data message.
Specifically, when the first port of the switch under test is in a blocking state, the first network card of the PC cannot receive the second layer data packet sent by the second network card; when the automatic recovery time (such as interval 30 seconds) of the loop detection is overtime, the first port of the tested switch is changed from a blocking state to a forwarding state, at the moment, the first network card of the PC can receive a second layer data message sent by the second network card, and after the detection time (such as interval 5 seconds) of the tested switch is overtime, the first port of the tested switch sends a second loop detection message again and then enters the blocking state; when the first port of the tested switch enters a forwarding state, recording the time and the message quantity when the first network card of the PC receives the second layer data message each time, and calculating the time for maintaining the forwarding state when the first port of the tested switch is changed from a blocking state to the forwarding state each time, wherein the calculation method comprises the following steps: number of messages/1000 (packets/second); and after the calculation is finished, the record is stored in an excel file, so that the test personnel can conveniently check the record.
And S11, judging whether a third cable misconnection condition is selected, if not, indicating that the test is not carried out, directly ending the test, and if so, executing the step S12.
And step S12, a first port of the tested switch sends out a third loop detection message, after receiving the third loop detection message, a first network card of the PC modifies a first hop field in the third loop detection message into the MAC address of the PC, and then sends the modified third loop detection message to a second port of the tested switch from a second network card of the PC, after receiving the modified third loop detection message, the tested switch considers that the network has a loop, and sets the loop detection state of the first port as a blocking state.
In the invention, the PC is used for simulating the auxiliary switch because the third cable misconnection condition is the loop formation between the switches and passes through the auxiliary switch, so that the last hop field in the third loop detection message needs to be modified into the MAC address of the PC to realize the simulation of the third cable misconnection condition. Meanwhile, the third loop detection message and the first loop detection message have the same content, and also comprise a destination MAC address, a source MAC address, the protocol type of the message, the MAC address of the switch sending the message, the port number of the switch sending the message and a previous hop field.
And S13, constructing a third two-layer data message and sending the third two-layer data message to the first network card of the PC from the second network card of the PC.
Wherein, the sending rate of the third layer data packet is 1000 packets/second, the continuous sending time is T3, and the time in milliseconds can be tested by adopting the above setting.
And S14, monitoring the condition that the first network card of the PC receives the third two-layer data message in real time, and calculating the duration time of the first port of the tested switch maintaining the forwarding state after the loop detection automatic recovery time is overtime through the receiving and sending time of the third two-layer data message.
Specifically, when the first port of the switch under test is in a blocking state, the first network card of the PC cannot receive the third two-layer data packet sent by the second network card; when the automatic recovery time (such as interval 30 seconds) of the loop detection is overtime, the first port of the tested switch is changed from a blocking state to a forwarding state, at the moment, the first network card of the PC can receive a third layer data message sent by the second network card, and after the detection time (such as interval 5 seconds) of the tested switch is overtime, the first port of the tested switch sends the loop detection message again and then enters the blocking state; when the first port of the tested switch enters a forwarding state, recording the time and the message quantity when the first network card of the PC receives the third two-layer data message each time, and calculating the time for maintaining the forwarding state when the first port of the tested switch is changed from a blocking state to the forwarding state each time, wherein the calculation method comprises the following steps: number of messages/1000 (packets/second); and after the calculation is finished, the record is stored in an excel file, so that the test personnel can conveniently check the record.
According to the method for testing the loop detection stability of the switch, the PC is used for simulating the auxiliary switch, the construction and the sending of the message can be finished by controlling the PC through the automatic system, any test instrument does not need to be purchased, the test can be finished only by one switch and one PC, other switches cannot be occupied, and the equipment resource cost is saved; the invention can automatically complete the test, so the test can be carried out at any time, such as at night or on weekends, the equipment and time of normal working time are not occupied, and the time cost is saved; the constructed two-layer data message is sent from the PC network card, and after the loop detection automatic recovery time is calculated through the receiving and sending of the message, the duration time of the forwarding state of the port of the tested switch is maintained, so that the time in millisecond unit can be tested, and the testing precision is high; the running state of the loop detection of the switch can be monitored in real time for a long time in the testing process, when the loop detection function of the switch fails, the system can monitor and record in real time, the stability of the loop detection function of the switch can be better and more comprehensively tested, meanwhile, the number of operation steps is small, and manual misoperation can be greatly reduced.
As will be appreciated by one skilled in the art, aspects of the present invention may be embodied as a system, method or program product. Thus, various aspects of the invention may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
Any number of modules, sub-modules, units, sub-units, or at least part of the functionality of any number thereof according to the present embodiments may be implemented in one module. Any one or more of the modules, sub-modules, units, and sub-units according to the present embodiment may be implemented by being divided into a plurality of modules. Any one or more of the modules, sub-modules, units, sub-units according to the present embodiments may be implemented at least partly as a hardware circuit, e.g. a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or by any other reasonable way of integrating or packaging a circuit in hardware or firmware, or in any one of three implementations, or in a suitable combination of any of them. Alternatively, one or more of the modules, sub-modules, units, sub-units according to the present embodiment may be at least partially implemented as a computer program module, which when executed may perform the corresponding functions.
In one embodiment, the invention provides a testing device for detecting the stability of a switch loop, which comprises at least one processing unit and at least one storage unit. Wherein the storage unit stores program code which, when executed by the processing unit, causes the processing unit to perform the steps in the test for switch loop detection stability according to various exemplary embodiments of the present invention described above in this specification. For example, the processing unit may execute the flow of the test method for switch loop detection stability as shown in fig. 1.
In one embodiment, the present invention provides a computer-readable medium storing computer-executable instructions for performing the steps in the method for testing the loop detection stability of a switch according to various exemplary embodiments of the present invention described above in this specification.
The readable medium may be a readable signal medium or a readable storage medium. A readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. A readable signal medium may include a propagated data signal with readable program code embodied therein, for example, in baseband or as part of a carrier wave. A readable signal medium may also be any readable medium that is not a readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Moreover, while the operations of the method of the invention are depicted in the drawings in a particular order, this does not require or imply that the operations must be performed in this particular order, or that all of the illustrated operations must be performed, to achieve desirable results. Additionally or alternatively, certain steps may be omitted, multiple steps combined into one step execution, and/or one step broken down into multiple step executions.
It will be understood that modifications and variations can be made by persons skilled in the art in light of the above teachings and all such modifications and variations are intended to be included within the scope of the invention as defined in the appended claims.
The invention is described above with reference to the accompanying drawings, which are illustrative, and it is obvious that the invention is not limited to the above embodiments, and that the invention is within the scope of the invention as long as various modifications are made in the method concept and technical solution of the invention, or the concept and technical solution of the invention is directly applied to other occasions without modification.

Claims (10)

1. A method for testing the loop detection stability of a switch is characterized by comprising the following steps:
s1, building a cable misconnection test topology, connecting a first port and a second port of a tested switch with a first network card and a second network card of a PC (personal computer) respectively, and selecting the misconnection condition of the cable to be tested;
s2, issuing configuration to a tested switch, forbidding a loop detection function of a second port of the tested switch, and enabling the loop detection function of a first port of the tested switch;
s3, sequentially judging whether all the cable misconnection conditions are subjected to hook selection, and carrying out loop detection stability test on the hooked cable misconnection conditions;
and S4, when the hooked cable misconnection condition is subjected to a loop detection stability test, setting the loop detection state of the first port of the tested switch to be a blocking state, then sending a two-layer data message to the first network card by the second network card of the PC, and calculating the duration time of the first port of the tested switch maintaining the forwarding state after the loop detection automatic recovery time is overtime through the transceiving time of the two-layer data message.
2. The method for testing the loop detection stability of the switch according to claim 1, wherein in step S1, after the cable misconnection condition to be tested is selected, a test time for each cable misconnection condition is set.
3. The method for testing the loop detection stability of the switch according to claim 1, wherein in step S1, the cable misconnection conditions include a first cable misconnection condition causing a self-loop of the switch, a second cable misconnection condition causing a self-loop of a device connected under the switch, and a third cable misconnection condition causing a loop between the switches.
4. The method for testing the loop detection stability of the switch according to claim 3, wherein in step S4, the specific sub-step of performing the loop detection stability test on the first cable miswire condition includes:
step A1, a loop detection function of a first port of a tested switch is in an enabling state, a first loop detection message is sent out, after a first network card of the PC receives the first loop detection message, the first loop detection message is directly sent to a second port of the tested switch from a second network card of the PC, and after the tested switch receives the first loop detection message, the loop detection state of the first port of the tested switch is set to be in a blocking state;
a2, constructing a first two-layer data message, and sending the first two-layer data message to a first network card of the PC from a second network card of the PC;
and A3, monitoring the condition that the first network card of the PC receives the first two-layer data message in real time, and calculating the duration time of the first port of the tested switch maintaining the forwarding state after the loop detection automatic recovery time is overtime according to the receiving and sending time of the first two-layer data message.
5. The method for testing the loop detection stability of the switch according to claim 4, wherein the first loop detection message includes a destination MAC address, a source MAC address, a protocol type of the message, an MAC address of a switch sending the message, a port number of the switch sending the message, and a previous hop field.
6. The method according to claim 4, wherein in step A3, when the automatic recovery time of the loop detection is over, the first port of the switch under test is changed from a blocking state to a forwarding state, and the first network card of the PC receives the first layer data packet sent by the second network card of the PC.
7. The method according to claim 4, wherein in step A3, after the first port of the switch under test enters the forwarding state, the time and the number of packets of the first layer data packet received by the first network card of the PC each time are recorded, and the time for maintaining the forwarding state when the first port of the switch under test changes from the blocking state to the forwarding state each time is calculated.
8. The method for testing the loop detection stability of the switch according to claim 3, wherein in step S4, the specific sub-step of performing the loop detection stability test on the second cable miswire condition includes:
step B1, the loop detection function of the first port of the detected switch is in an enabling state, a second loop detection message is sent out, after the first network card of the PC receives the second loop detection message, the last hop field in the second loop detection message is modified into the MAC address of the PC, the modified second loop detection message is sent to the first port of the detected switch from the first network card of the PC, and after the detected switch receives the modified second loop detection message, the loop detection state of the first port of the detected switch is set to be in a blocking state;
b2, constructing a second layer data message, and sending the second layer data message to the first network card of the PC from the second network card of the PC;
and step B3, monitoring the condition that the first network card of the PC receives the second layer data message in real time, and calculating the duration time of the first port of the tested switch maintaining the forwarding state after the loop detection automatic recovery time is overtime according to the receiving and sending time of the second layer data message.
9. The method for testing the loop detection stability of the switch according to claim 3, wherein in step S4, the specific sub-step of performing the loop detection stability test on the third cable misconnection condition includes:
step C1, a first port of the tested switch sends a third loop detection message, a first network card of the PC receives the third loop detection message, a first hop field in the third loop detection message is modified into an MAC address of the PC, the modified third loop detection message is sent to a second port of the tested switch from a second network card of the PC, and the loop detection state of the first port of the tested switch is set to be a blocking state after the modified third loop detection message is received by the tested switch;
c2, constructing a third two-layer data message, and sending the third two-layer data message to the first network card of the PC from the second network card of the PC;
and step C3, monitoring the condition that the first network card of the PC receives the third two-layer data message in real time, and calculating the duration time of the first port of the tested switch maintaining the forwarding state after the loop detection automatic recovery time is overtime according to the receiving and sending time of the third two-layer data message.
10. A computer-readable medium storing computer-executable instructions for performing the method for testing the stability of loop detection of a switch according to any one of claims 1 to 9.
CN202211407526.2A 2022-11-10 2022-11-10 Testing method and readable medium for loop detection stability of switch Pending CN115766510A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211407526.2A CN115766510A (en) 2022-11-10 2022-11-10 Testing method and readable medium for loop detection stability of switch

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211407526.2A CN115766510A (en) 2022-11-10 2022-11-10 Testing method and readable medium for loop detection stability of switch

Publications (1)

Publication Number Publication Date
CN115766510A true CN115766510A (en) 2023-03-07

Family

ID=85369164

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211407526.2A Pending CN115766510A (en) 2022-11-10 2022-11-10 Testing method and readable medium for loop detection stability of switch

Country Status (1)

Country Link
CN (1) CN115766510A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116866250A (en) * 2023-09-05 2023-10-10 空间液态金属科技发展(江苏)有限公司 Local area network data storm suppression method based on spacecraft application

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116866250A (en) * 2023-09-05 2023-10-10 空间液态金属科技发展(江苏)有限公司 Local area network data storm suppression method based on spacecraft application
CN116866250B (en) * 2023-09-05 2023-11-14 空间液态金属科技发展(江苏)有限公司 Local area network data storm suppression method based on spacecraft application

Similar Documents

Publication Publication Date Title
CN101789889B (en) Method and system for automatic testing communication equipment
US9565064B2 (en) Frame transmission apparatus and method for checking normality
CN104486791B (en) The anti-interference test system and method for radio reception device
CN107659434A (en) A kind of automatic test approach of Devices to test, apparatus and system
CN103138988B (en) Positioning treatment method and positioning treatment device of network faults
CN106452942B (en) The vehicle-mounted Ethernet exchanging software performance test system and method for track transportation industry
CN111314180B (en) Ethernet link test method, terminal and storage medium
TW201225553A (en) Achieving greater test efficiencies using acknowledgement signal suppression
CN101873236B (en) Method and system for testing message
CN106411637A (en) Internet-of-things device scenario testing method
CN115766510A (en) Testing method and readable medium for loop detection stability of switch
CN110022238A (en) A kind of test method and device of Ethernet switching chip
CN109428778A (en) Mainboard network connectivty test method and device
CN107426755B (en) Base station problem troubleshooting method and device, computer readable storage medium and computer equipment
US6751761B1 (en) Method and apparatus for testing network, and recording medium
CN108562805A (en) A kind of interactive mode break-make electric test device, system and method
CN107707299A (en) A kind of detection method and device of FC aggregated links
WO2023155699A1 (en) Method and apparatus for mining security vulnerability of air interface protocol, and mobile terminal
CN116244130A (en) Board card detection method, device, test equipment and storage medium
CN105262635B (en) The method, apparatus and system of looped network protection protocol switching time automatic test
CN109412851A (en) Link layer path detection method, apparatus and system
CN110166320A (en) MPLS-TP OAM realization method and system based on OpenFlow interchanger
US6173244B1 (en) System and method for testing a switching system in a telecommunication network
CN100512062C (en) Method for detecting chain circuit cross misconnection
CN113037581B (en) Backboard channel testing method and device, board card and computer readable storage medium

Legal Events

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