CN111064553B - Switch and loopback diagnosis method, device and storage medium of management network port thereof - Google Patents

Switch and loopback diagnosis method, device and storage medium of management network port thereof Download PDF

Info

Publication number
CN111064553B
CN111064553B CN201911276483.7A CN201911276483A CN111064553B CN 111064553 B CN111064553 B CN 111064553B CN 201911276483 A CN201911276483 A CN 201911276483A CN 111064553 B CN111064553 B CN 111064553B
Authority
CN
China
Prior art keywords
layer
broadcast packet
preset
packet
management network
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.)
Active
Application number
CN201911276483.7A
Other languages
Chinese (zh)
Other versions
CN111064553A (en
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.)
Suzhou Inspur Intelligent Technology Co Ltd
Original Assignee
Suzhou Inspur Intelligent 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 Suzhou Inspur Intelligent Technology Co Ltd filed Critical Suzhou Inspur Intelligent Technology Co Ltd
Priority to CN201911276483.7A priority Critical patent/CN111064553B/en
Publication of CN111064553A publication Critical patent/CN111064553A/en
Priority to PCT/CN2020/110949 priority patent/WO2021114722A1/en
Application granted granted Critical
Publication of CN111064553B publication Critical patent/CN111064553B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/24Testing correct operation
    • H04L1/242Testing correct operation by comparing a transmitted test signal with a locally generated replica
    • H04L1/243Testing correct operation by comparing a transmitted test signal with a locally generated replica at the transmitter, using a loop-back

Abstract

The invention discloses a loopback diagnosis method and device of a switch management network port, a switch and a computer readable storage medium, wherein the method comprises the following steps: the processor of the switch constructs a preset number of two-layer broadcast packets and sends the two-layer broadcast packets to a management network port of the switch; the two-layer broadcast packet is a broadcast packet adopting a preset two-layer protocol, and the BMC of the switch does not support the preset two-layer protocol; receiving a two-layer broadcast packet returned by the management network port, and counting the receiving quantity of the two-layer broadcast packet; determining a loopback diagnosis result of the management network port according to the preset number and the receiving number; when the processor utilizes the two-layer broadcast packet to carry out loopback diagnosis of the management network port, the network card driver of the BMC discards the received two-layer broadcast packet, so that the process of manually closing the network card driver at the BMC side by switching the serial port can be reduced; and the diagnosis of management network port hardware is carried out on the driving layer, the burden of an upper protocol layer can be avoided, and the time consumption of loopback diagnosis is reduced.

Description

Switch and loopback diagnosis method, device and storage medium of management network port thereof
Technical Field
The present invention relates to the field of switch technologies, and in particular, to a loopback diagnosis method and apparatus for a management network port of a switch, and a computer-readable storage medium.
Background
The management network port of the switch needs to pass the detection of a diagnostic program before leaving the factory. For the switch having a BMC (Baseboard Management Controller) as shown in fig. 1, because the BMC and the CPU (processor) share an outlet of a Management network port, when performing loop back diagnosis on the Management network port, the number of packets sent and received during loop back test viewed from the CPU may be unequal due to mutual interference between the BMC and the CPU.
In the prior art, when performing loopback diagnosis of a management network port, a network card of the BMC needs to be disabled by using a command at the BMC end, then a broadcast packet is sent by using an existing packet sending tool at the CPU end, and when the CPU end finds that the number of the sent packets is equal to that of the received packets at the speed that the CPU can bear, the loopback diagnosis of the management network port can be determined to be passed, so that the hardware function of the management network port at the CPU side is proved to be good. However, in the above scheme, the user needs to manually disable the network card drive of the BMC side and then switch the serial port back to the CPU side to run the diagnostic program, and because the switching of the serial port is involved, the management network port diagnostic program of the CPU side cannot be seamlessly connected with other programs of the CPU side; and limited by the influence of the network protocol stack and the processing speed of the CPU, the diagnostic program often cannot reach the maximum speed of the device without packet loss, that is, when the existing packet sending tool is used to send packets at a high rate, the number of received packets will be much smaller than the number of sent packets, the diagnostic result will fail, and if the number of received packets and the number of sent packets are equal, the corresponding packet sending and receiving rate will be very low, so that the time consumed for loopback diagnosis is long.
Therefore, how to enable the processor of the switch to automatically avoid the interference of the BMC to the management network port in the loopback diagnosis process of the management network port, reduce the process of switching the serial port to manually turn off the network card driver on the BMC side, and ensure that the maximum speed supported by the network device is approached as much as possible on the premise of no packet loss, thereby reducing the time consumption of loopback diagnosis, which is a problem that needs to be solved urgently nowadays.
Disclosure of Invention
The invention aims to provide a loopback diagnosis method and device for a management network port of a switch, the switch and a computer readable storage medium, so that the process of manually turning off a BMC (baseboard management controller) side network card driver by switching a serial port is reduced in the loopback diagnosis process of the management network port, and the time consumption of loopback diagnosis is reduced.
In order to solve the above technical problem, the present invention provides a loopback diagnosis method for a switch management network port, comprising:
the method comprises the steps that a processor of a switch constructs a preset number of two-layer broadcast packets and sends the two-layer broadcast packets to a management network port of the switch; the two-layer broadcast packet is a broadcast packet adopting a preset two-layer protocol, and the BMC of the switch does not support the preset two-layer protocol;
receiving the two-layer broadcast packet returned by the management network port, and counting the receiving quantity of the two-layer broadcast packet;
and determining a loopback diagnosis result of the management network port according to the preset number and the receiving number.
Optionally, the packet size of the two-layer broadcast packet is a preset packet size.
Optionally, the processor of the switch constructs a preset number of two-layer broadcast packets, including:
the processor constructs the preset number of the two-layer broadcast packets according to the acquired configuration command; wherein the configuration command includes the preset number and the preset packet size.
Optionally, the sending the two-layer broadcast packet to the management network port of the switch includes:
sequentially sending the 1 st layer two broadcast packet to the nth layer two broadcast packet to a management network port of the switch, and counting packet sending time; wherein n is the preset number, and the packet sending time is the difference between the sending completion time of the nth layer two broadcast packet and the sending start time of the 1 st layer two broadcast packet;
correspondingly, the receiving the two-layer broadcast packet returned by the management network port includes:
identifying the 1 st second-layer broadcast packet and the nth second-layer broadcast packet, and counting packet receiving time; wherein the packet sending time is a difference between a time of completing reception of the nth layer two broadcast packet and a time of starting reception of the 1 st layer two broadcast packet.
Optionally, the identifying the 1 st layer two broadcast packet and the nth layer two broadcast packet includes:
identifying the 1 st two-layer broadcast packet and the nth two-layer broadcast packet according to a byte value of a preset identification bit in a payload area of each received two-layer broadcast packet; the byte value of the preset identification bit in the payload area of the 1 st two-layer broadcast packet is a first preset byte value, the byte value of the preset identification bit in the payload area of the 2 nd two-layer broadcast packet is a second preset byte value, and the byte value of the preset identification bit in the payload area of the 2 nd two-layer broadcast packet to the (n-1) th two-layer broadcast packet is not the first preset byte value or the second preset byte value.
Optionally, all byte values in the payload area of each of the second-layer broadcast packets from the 2 nd second-layer broadcast packet to the n-1 st second-layer broadcast packet are results of modulo by a preset modulo value with respective sending sequence values; and all byte values except the preset identification bit in the payload area of the 1 st second-layer broadcast packet and the nth second-layer broadcast packet are the respective sending sequence values and the result of taking the modulus by a preset modulus value.
Optionally, the preset modulus value is 253.
The invention also provides a loopback diagnosis device of the switch management network port, which comprises:
the system comprises a sending module, a management network port and a switching module, wherein the sending module is used for constructing a preset number of two-layer broadcast packets and sending the two-layer broadcast packets to the management network port of the switching module; the two-layer broadcast packet is a broadcast packet adopting a preset two-layer protocol, and the BMC of the switch does not support the preset two-layer protocol;
a receiving module, configured to receive the two-layer broadcast packet returned by the management network port, and count the number of received two-layer broadcast packets;
and the determining module is used for determining the loopback diagnosis result of the management network port according to the preset quantity and the receiving quantity.
The present invention also provides a switch, comprising:
a memory for storing a computer program;
and the processor is used for realizing the steps of the loopback diagnosis method of the switch management network port when executing the computer program.
The present invention also provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the steps of the loopback diagnosis method for the switch management network interface.
The invention provides a loopback diagnosis method of a switch management network port, which comprises the following steps: the processor of the switch constructs a preset number of two-layer broadcast packets and sends the two-layer broadcast packets to a management network port of the switch; the two-layer broadcast packet is a broadcast packet adopting a preset two-layer protocol, and the BMC of the switch does not support the preset two-layer protocol; receiving a two-layer broadcast packet returned by the management network port, and counting the receiving quantity of the two-layer broadcast packet; determining a loopback diagnosis result of the management network port according to the preset number and the receiving number;
therefore, when the processor utilizes the two-layer broadcast packet to carry out loopback diagnosis of the management network port, the network card driver of the BMC discards the received two-layer broadcast packet because the BMC does not support the protocol adopted by the two-layer broadcast packet, thereby avoiding the interference of the BMC on the counting of the receiving and sending packets of the management network port and reducing the process of manually switching off the network card driver at the BMC side by switching the serial port; and the use of the two-layer broadcast packet can diagnose the management network port hardware on the driving layer, and can avoid the burden of an upper protocol layer, thereby being capable of approaching the maximum speed supported by the network equipment as much as possible on the premise of ensuring no packet loss, and reducing the time consumption of loopback diagnosis. In addition, the invention also provides a loopback diagnosis device of the switch management network port, a switch and a computer readable storage medium, and the loopback diagnosis device, the switch and the computer readable storage medium also have the beneficial effects.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
Fig. 1 is a schematic diagram of a switch in the prior art;
fig. 2 is a flowchart of a loopback diagnosis method for a switch management network port according to an embodiment of the present invention;
fig. 3 is a block diagram of a loopback diagnosis apparatus for a switch management network interface according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some, but not all, embodiments of the present invention. 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 invention.
Referring to fig. 2, fig. 2 is a flowchart of a loopback diagnosis method for a management network interface of an exchange according to an embodiment of the present invention. The method can comprise the following steps:
step 101: the processor of the switch constructs a preset number of two-layer broadcast packets and sends the two-layer broadcast packets to a management network port of the switch; the two-layer broadcast packet is a broadcast packet adopting a preset two-layer protocol, and the BMC of the switch does not support the preset two-layer protocol.
It can be understood that, in the embodiment, when performing loopback diagnosis of the management network port hardware, the processor of the switch, such as the CPU, runs a diagnostic program to send and receive a two-layer broadcast packet, i.e., an ethernet frame, at the drive level; because the network card driver of the BMC does not support the preset two-layer protocol adopted by the two-layer broadcast packet, when the two-layer broadcast packet returns from the management network port shared by the BMC and the processor, the network card driver of the BMC discards the received two-layer broadcast packet, so that the interference of the BMC on the management network port is avoided automatically, the network card driver on the BMC side is not required to be switched to manually close, and the management network port diagnostic program and other diagnostic programs on the CPU side can be integrated together conveniently; meanwhile, the influence of an upper protocol stack on the transmission rate of the two-layer broadcast packet is avoided, the maximum rate supported by the equipment can be embodied as high as possible, the equal or small difference between the packet receiving number and the packet sending number is realized at the rate as high as possible, namely, the time consumption of loopback diagnosis is reduced through loopback diagnosis.
Specifically, the preset two-layer protocol in this step may be a two-layer protocol that is not supported by the network card driver of the BMC, that is, the network card driver of the BMC does not support a numerical value, that is, a protocol code, of an EtherType (a field in an ethernet frame) field of the two-layer broadcast packet. For the specific selection of the preset two-layer protocol, that is, the specific value of the EtherType field of the two-layer broadcast packet constructed by the processor may be set by a designer or a user according to a practical scenario and a user requirement, for example, the value in the EtherType field of the two-layer broadcast packet may be a preset value, and the preset value may be any value in a test interval from 0x0101 (i.e., 257) to 0x01FF (i.e., 511), for example, the values in the EtherType field of the preset number of two-layer broadcast packets may all be 0x01 FF; the value in the EtherType field of the two-layer broadcast packet can also be other values; as long as it is ensured that the network card driver of the BMC does not support the value of the EtherType field of the two-layer broadcast packet, the received two-layer broadcast packet is discarded, which is not limited in this embodiment.
Correspondingly, for the specific packet size of the processor in this embodiment, which is to say, the number of bytes in the payload area of each two-layer broadcast packet, the specific packet size may be set by a designer or a user according to a practical scenario and a user requirement, for example, for convenience of performing other subsequent functional diagnostic tests, the packet sizes of the two-layer broadcast packets that the processor constructs in the preset number may be the same, that is, both the packet sizes are the preset packet sizes, for example, the preset packet size may be any value in a legal range from 46 to an MTU (maximum transmission unit) value set by the network card; the packet size of the processor constructing the preset number of two-layer broadcast packets may also be different, and this embodiment does not limit this.
It should be noted that, in this step, the specific manner of constructing the preset number of two-layer broadcast packets by the processor of the switch may be set by a designer, for example, the processor may automatically construct the preset number of two-layer broadcast packets when loop-back diagnosis of the management network port is required. The processor can also construct a preset number of two-layer broadcast packets according to the acquired configuration command, wherein the configuration command comprises the preset number and the size of the preset packets; such as a management portal diagnostic specific loadable and unloadable driver and an application layer program that may run in the processor. The application layer program is used in a form of a command line, the specified driver can be specified to send a specified number (namely a preset number) of two-layer broadcast packets with specified length (namely a preset packet size) by transmitting command line parameters to the driver, the application layer program can interact with the driver through an ioctl function and a sysfs file, and the application layer program sends a configuration command such as 'mgmtnet-diag < size >' to the driver, wherein mgmtnet-diag is a compiled binary executable program; the parameter < size > is the packet size of each two-layer broadcast packet, i.e., the preset packet size; the parameter < num > is the total number of the broadcast packets sent by running the diagnostic program once, namely the preset number, and the parameter < num > is not suitable to be overlarge, so that the phenomenon of packet loss caused by overlarge load is avoided; so that the user can control the number of second-layer broadcast packets and the packet size at the time of loopback diagnosis by setting the parameters < size > and < num >.
Specifically, the specific sending mode of the processor sending the preset number of second-layer broadcast packets to the management network port of the switch in this step may be set by a designer, for example, in order to make statistics of the sending time of the second-layer broadcast packets, the processor may send the preset number of second-layer broadcast packets to the management network port of the switch in this step, that is, send the 1 st second-layer broadcast packet to the nth second-layer broadcast packet to the management network port of the switch in sequence; wherein n is a preset number. As long as the processor can send a preset number of two-layer broadcast packets to the management network port of the switch, so as to complete the loop-back diagnosis of the management network port, this embodiment does not limit this.
Correspondingly, in this step, the processor may count packet sending time required for the subsequent test in the process of sending the preset number of two-layer broadcast packets, such as the packet sending time of the preset number of two-layer broadcast packets or the packet sending time of each two-layer broadcast packet. For example, in this step, the processor may sequentially send the 1 st layer two broadcast packet to the nth layer two broadcast packet to the management network port of the switch, and count the packet sending time; wherein n is a preset number, and the packet sending time is a difference between the time for completing sending the nth two-layer broadcast packet and the time for starting sending the 1 st two-layer broadcast packet, that is, the packet sending time of the preset number of two-layer broadcast packets.
For example, in order to facilitate the subsequent statistics of the receiving time of the second-layer broadcast packet received by the processor, in this embodiment, byte values of preset identification bits in the payload areas of the first transmitted second-layer broadcast packet and the last transmitted second-layer broadcast packet may be set to corresponding preset byte values different from byte values of preset identification bits in the payload areas of other second-layer broadcast packets, so as to identify nodes that start and end transmission or reception; that is, the byte value of the preset identification bit in the payload area of the 1 st second-layer broadcast packet is the first preset byte value, the byte value of the preset identification bit in the payload area of the 2 nd second-layer broadcast packet is the second preset byte value, and the byte value of the preset identification bit in the payload area of the 2 nd second-layer broadcast packet to the (n-1) th second-layer broadcast packet is not the first preset byte value or the second preset byte value, so that the processor can determine the 1 st second-layer broadcast packet and the 1 st second-layer broadcast packet according to the comparison between the byte value of the preset identification bit in the payload area of each received second-layer broadcast packet and the first preset byte value and the second preset byte value, and the preset number of second-layer broadcast packets except the 1 st second-layer broadcast packet and the nth second-layer broadcast packet is the respective preset byte value of each second-layer broadcast packet, and the preset number of second-layer broadcast packets is the respective preset byte value of each second-layer broadcast packet, and the second-layer broadcast packet is transmitted in the second-layer broadcast packet, and the second-layer broadcast packet is transmitted in the second-layer broadcast packet, and the second-layer broadcast packet is transmitted in the second-broadcast packet, and the second-layer broadcast packet, and the second-broadcast packet is transmitted in the second-layer broadcast packet, and the second-broadcast packet is transmitted in the second-broadcast packet, and the second-layer broadcast packet, the second-layer broadcast packet, the second-broadcast packet, and the second-layer broadcast packet, the second-broadcast packet, and the second-broadcast packet, and the second-layer broadcast packet, the second-broadcast packet, the second broadcast packet, all byte values except the preset identification bit in the payload area of the 1 st second-layer broadcast packet and the nth second-layer broadcast packet are respective sending sequence values to preset a modulus value modulus result so as to facilitate subsequent other tests; for example, the preset number (n) is 255, that is, 255 two-layer broadcast packets need to be sequentially transmitted, and the preset modulus value is 253, the first byte (i.e., the preset identification bit) in the payload area of the 1 st two-layer broadcast packet to be transmitted may be 0xFE (i.e., 254, the first preset byte value) and other bytes may have values of 1, all byte values in the payload area of the second two-layer broadcast packet may be 2, and so on, all byte values in the payload area of the 253 th two-layer broadcast packet may be 253, all byte values in the payload area of the 254 th two-layer broadcast packet may be 1, and the first byte in the payload area of the 255 th two-layer broadcast packet may be 0xFF (i.e., the second preset byte value) and other byte values may be 2. The present embodiment does not set any limit to this.
Step 102: and receiving the two-layer broadcast packet returned by the management network port, and counting the receiving quantity of the two-layer broadcast packet.
In this embodiment, after the two-layer broadcast packet sent by the processor reaches the management port, the two-layer broadcast packet may return to the network card of the processor through the loopback interface of the management port, and the network card driver of the processor may process the received two-layer broadcast packet. In this step, the processor may determine whether the received broadcast packet is a two-layer broadcast packet or not by analyzing the received broadcast packet, for example, determining whether an EtherType field of the received broadcast packet is a preset value or not, and counting the receiving number of the two-layer broadcast packet.
Specifically, the specific manner of counting the number of received second-layer broadcast packets in this step may be set by the designer, for example, the processor starts to count the received second-layer broadcast packets when recognizing that the received broadcast packet is the 1 st second-layer broadcast packet, increases the count of received packets each time the second-layer broadcast packet is received, increases the count of received packets and ends the count of received packets when recognizing that the received broadcast packet is the nth second-layer broadcast packet, and counts the number of received second-layer broadcast packets by using the received count result; the processor may also determine, for the first time, that the packet reception count is started when the received broadcast packet is the second layer broadcast packet, and thereafter, increase the packet reception count each time the second layer broadcast packet is received, and increase the packet reception count and end the packet reception count when the received broadcast packet is identified as the nth second layer broadcast packet, that is, the processor may identify only the nth second layer broadcast packet. The present embodiment does not set any limit to this.
Further, in this step, the processor may count a packet receiving time required for a subsequent test during the process of receiving the two-layer broadcast packet, such as a packet receiving time for receiving all the two-layer broadcast packets or a packet receiving time for receiving each two-layer broadcast packet. For example, in this step, the processor may identify the 1 st layer two broadcast packet and the nth layer two broadcast packet, and count the packet receiving time; the packet sending time is the difference between the time for completing the reception of the nth layer two broadcast packet and the time for starting the reception of the 1 st layer two broadcast packet, that is, the packet receiving time for receiving all the layer two broadcast packets.
Correspondingly, the embodiment does not limit the specific way in which the processor identifies the 1 st two-layer broadcast packet and the nth two-layer broadcast packet, for example, the processor identifies the 1 st two-layer broadcast packet and the nth two-layer broadcast packet according to a byte value of a preset identification bit in a payload area of each received two-layer broadcast packet, where a byte value of the preset identification bit in the payload area of the 1 st two-layer broadcast packet is a first preset byte value, a byte value of the preset identification bit in the payload area of the 2 nd two-layer broadcast packet is a second preset byte value, and byte values of the preset identification bits in the payload areas of the 2 nd two-layer broadcast packet to the n-1 st two-layer broadcast packet are not the first preset byte value or the second preset byte value; that is, the processor may identify the 1 st two-layer broadcast packet and the nth two-layer broadcast packet by comparing the byte value of the preset identification bit in the payload area of each received two-layer broadcast packet with the first preset byte value and the second preset byte value.
Further, the method provided by this embodiment may further include a step in which the processor calculates a packet sending rate according to the preset number and the counted packet sending time; and/or the processor calculates the packet receiving rate according to the packet receiving time and the packet receiving quantity obtained by statistics. For example, after the application layer program running in the processor invokes the driver to start the loopback diagnosis process, the application layer program starts to wait for the driver to return the packet sending time, the packet receiving number (i.e., the receiving number) and the packet receiving time, and then determines the loopback diagnosis result and calculates the packet sending rate and the packet receiving rate through step 103.
Step 103: and determining a loopback diagnosis result of the management network port according to the preset number and the receiving number.
It can be understood that the purpose of this step may be to determine, by the processor, a loopback diagnosis result of the management network interface, that is, whether the loopback diagnosis of the management network interface passes or not, according to the number, that is, the preset number and the received number, of the two-layer broadcast packets sent and received in the loopback diagnosis process.
Specifically, the specific manner in which the processor determines the loopback diagnosis result of the management network port according to the preset number and the received number in this step may be set by a designer, for example, the processor may determine whether the difference between the preset number and the received number is smaller than a threshold; if yes, determining that the loopback diagnosis result is loopback diagnosis; if not, the loopback diagnosis result can be determined to be failure loopback diagnosis.
In this embodiment, when the processor performs loopback diagnosis of the management port by using the two-layer broadcast packet, since the BMC does not support the protocol used by the two-layer broadcast packet, the network card driver of the BMC discards the received two-layer broadcast packet, thereby avoiding interference of the BMC on the packet receiving and sending count of the management port, and reducing the process of manually turning off the BMC side network card driver by switching the serial port; and the use of the two-layer broadcast packet can diagnose the management network port hardware on the driving layer, and can avoid the burden of an upper protocol layer, thereby being capable of approaching the maximum speed supported by the network equipment as much as possible on the premise of ensuring no packet loss, and reducing the time consumption of loopback diagnosis.
Referring to fig. 3, fig. 3 is a block diagram of a loopback diagnosis device of a switch management network interface according to an embodiment of the present invention. The apparatus may include:
a sending module 10, configured to construct a preset number of two-layer broadcast packets, and send the two-layer broadcast packets to a management network port of a switch; the two-layer broadcast packet is a broadcast packet adopting a preset two-layer protocol, and the BMC of the switch does not support the preset two-layer protocol;
a receiving module 20, configured to receive a two-layer broadcast packet returned by the management network port, and count the number of received two-layer broadcast packets;
and the determining module 30 is configured to determine a loopback diagnosis result of the management network port according to the preset number and the receiving number.
Optionally, the packet size of the two-layer broadcast packet is a preset packet size.
Optionally, the sending module 10 may include:
the construction sub-module is used for constructing a preset number of two-layer broadcast packets according to the acquired configuration command; wherein the configuration command includes a preset number and a preset packet size.
Optionally, the sending module 10 may include:
the transmission counting submodule is used for sequentially transmitting the 1 st layer two-layer broadcast packet to the nth layer two-layer broadcast packet to a management network port of the switch and counting the packet transmission time; wherein n is a preset number, and the packet sending time is the difference between the sending completion time of the nth layer two-layer broadcast packet and the sending start time of the 1 st layer two-layer broadcast packet;
correspondingly, the receiving module 20 may include:
the identification and statistics submodule is used for identifying the 1 st second-layer broadcast packet and the nth second-layer broadcast packet and counting the packet receiving time; wherein, the packet sending time is the difference between the receiving completion time of the nth layer two broadcast packet and the receiving start time of the 1 st layer two broadcast packet.
Optionally, the identifying statistics sub-module may include:
the identification unit is used for identifying the 1 st two-layer broadcast packet and the nth two-layer broadcast packet according to the byte value of the preset identification bit in the payload area of each received two-layer broadcast packet; the byte value of the preset identification bit in the payload area of the 1 st second-layer broadcast packet is a first preset byte value, the byte value of the preset identification bit in the payload area of the 2 nd second-layer broadcast packet is a second preset byte value, and the byte values of the preset identification bits in the payload areas from the 2 nd second-layer broadcast packet to the (n-1) th second-layer broadcast packet are not the first preset byte value or the second preset byte value.
Optionally, all byte values in the payload area of each two-layer broadcast packet from the 2 nd layer broadcast packet to the n-1 th layer broadcast packet are results of performing modulo operation on the respective sending sequence values by using preset modulo values; all byte values except the preset identification bit in the payload area of the 1 st layer two-layer broadcast packet and the nth layer two-layer broadcast packet are the respective sending sequence values and the result of taking the modulus by the preset modulus value.
In this embodiment, the sending module 10 constructs the two-layer broadcast packet, so that when the processor performs loopback diagnosis of the management port by using the two-layer broadcast packet, because the BMC does not support the protocol used by the two-layer broadcast packet, the network card driver of the BMC discards the received two-layer broadcast packet, thereby avoiding interference of the BMC on the packet receiving and sending count of the management port, and reducing the process of switching a serial port to manually turn off the BMC-side network card driver; and the use of the two-layer broadcast packet can diagnose the management network port hardware on the driving layer, and can avoid the burden of an upper protocol layer, thereby being capable of approaching the maximum speed supported by the network equipment as much as possible on the premise of ensuring no packet loss, and reducing the time consumption of loopback diagnosis.
An embodiment of the present invention further provides an exchange, including:
a memory for storing a computer program;
and the processor is used for implementing the steps of the loopback diagnosis method of the switch management network interface when executing the computer program.
Correspondingly, as shown in fig. 1, the Switch provided in this embodiment may further include BMC and Switch (Switch) chips.
The memory in this embodiment includes at least one type of readable storage medium, which includes a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, and the like. The memory may in some embodiments be an internal storage unit of the switch, e.g. a hard disk of the switch. The memory may also be an external storage device of the switch in other embodiments, such as a plug-in hard disk provided on the switch, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like. Further, the memory may also include both an internal storage unit of the switch and an external storage device. The memory can be used for storing application software installed in the switch and various data, such as: the code of the program or the like that executes the loopback diagnosis method of the switch management network port may also be used to temporarily store data that has been output or is to be output.
The processor in this embodiment may be a Central Processing Unit (CPU), a controller, a microcontroller, a microprocessor, or other data Processing chip in some embodiments, and is configured to run program codes stored in a memory or process data, for example, codes of a program that executes a loopback diagnosis method for a switch management network interface, and the like.
Furthermore, an embodiment of the present invention further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the loopback diagnosis method for a switch management network interface provided in the foregoing embodiment are implemented.
Wherein the computer-readable storage medium may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The embodiments are described in a progressive manner in the specification, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. The device, the switch and the computer readable storage medium disclosed by the embodiment correspond to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the description of the method part.
The present invention provides a loopback diagnosis method and apparatus for management network port of switch, a switch and a computer readable storage medium. The principles and embodiments of the present invention are explained herein using specific examples, which are presented only to assist in understanding the method and its core concepts. It should be noted that, for those skilled in the art, it is possible to make various improvements and modifications to the present invention without departing from the principle of the present invention, and those improvements and modifications also fall within the scope of the claims of the present invention.

Claims (10)

1. A loopback diagnosis method of a switch management network port is characterized by comprising the following steps:
the method comprises the steps that a processor of a switch constructs a preset number of two-layer broadcast packets and sends the two-layer broadcast packets to a management network port of the switch; the two-layer broadcast packet is a broadcast packet adopting a preset two-layer protocol, the sizes of the two-layer broadcast packets are the same, and the BMC of the switch does not support the preset two-layer protocol;
receiving the two-layer broadcast packet returned by the management network port, and counting the receiving quantity of the two-layer broadcast packet;
and determining a loopback diagnosis result of the management network port according to the preset number and the receiving number.
2. The loopback diagnosis method for a switch management network port according to claim 1, wherein the packet size of the two-layer broadcast packet is a preset packet size.
3. The loopback diagnostic method of a switch management network port according to claim 2, wherein the processor of the switch constructs a preset number of two-layer broadcast packets, comprising:
the processor constructs the preset number of the two-layer broadcast packets according to the acquired configuration command; wherein the configuration command includes the preset number and the preset packet size.
4. The loopback diagnosis method for the management network interface of the switch according to any one of claims 1 to 3, wherein the sending the layer two broadcast packet to the management network interface of the switch comprises:
sequentially sending the 1 st layer two broadcast packet to the nth layer two broadcast packet to a management network port of the switch, and counting packet sending time; wherein n is the preset number, and the packet sending time is the difference between the sending completion time of the nth layer two broadcast packet and the sending start time of the 1 st layer two broadcast packet;
correspondingly, the receiving the two-layer broadcast packet returned by the management network port includes:
identifying the 1 st second-layer broadcast packet and the nth second-layer broadcast packet, and counting packet receiving time; wherein the packet sending time is a difference between a reception completion time of the nth layer two broadcast packet and a reception start time of the 1 st layer two broadcast packet.
5. The loopback diagnostic method of a switch management network port according to claim 4, wherein the identifying the 1 st layer two broadcast packet and the nth layer two broadcast packet comprises:
identifying the 1 st two-layer broadcast packet and the nth two-layer broadcast packet according to a byte value of a preset identification bit in a payload area of each received two-layer broadcast packet; the byte value of the preset identification bit in the payload area of the 1 st two-layer broadcast packet is a first preset byte value, the byte value of the preset identification bit in the payload area of the 2 nd two-layer broadcast packet is a second preset byte value, and the byte value of the preset identification bit in the payload area of the 2 nd two-layer broadcast packet to the (n-1) th two-layer broadcast packet is not the first preset byte value or the second preset byte value.
6. The loopback diagnosis method for switch management network interface according to claim 5, wherein all byte values in payload area of each of the second layer broadcast packets from the 2 nd layer broadcast packet to the n-1 th layer broadcast packet are the result of taking module by the preset module value of the sending sequence value; and all byte values except the preset identification bit in the payload area of the 1 st second-layer broadcast packet and the nth second-layer broadcast packet are the respective sending sequence values and the result of taking the modulus by a preset modulus value.
7. The loopback diagnostic method for a switch management network port as recited in claim 6, wherein the preset modulus value is 253.
8. A loopback diagnostic device for a switch management network port, comprising:
the system comprises a sending module, a management network port and a switching module, wherein the sending module is used for constructing a preset number of two-layer broadcast packets and sending the two-layer broadcast packets to the management network port of the switching module; the two-layer broadcast packet is a broadcast packet adopting a preset two-layer protocol, the sizes of the two-layer broadcast packets are the same, and the BMC of the switch does not support the preset two-layer protocol;
a receiving module, configured to receive the two-layer broadcast packet returned by the management network port, and count the number of received two-layer broadcast packets;
and the determining module is used for determining the loopback diagnosis result of the management network port according to the preset quantity and the receiving quantity.
9. A switch, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the loopback diagnostic method of the switch management portal according to any of claims 1 to 7 when executing said computer program.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a computer program which, when executed by a processor, implements the steps of the loopback diagnostic method of a switch management portal according to any of claims 1 to 7.
CN201911276483.7A 2019-12-12 2019-12-12 Switch and loopback diagnosis method, device and storage medium of management network port thereof Active CN111064553B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201911276483.7A CN111064553B (en) 2019-12-12 2019-12-12 Switch and loopback diagnosis method, device and storage medium of management network port thereof
PCT/CN2020/110949 WO2021114722A1 (en) 2019-12-12 2020-08-25 Switch, loopback diagnosis method and apparatus for management network port thereof, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911276483.7A CN111064553B (en) 2019-12-12 2019-12-12 Switch and loopback diagnosis method, device and storage medium of management network port thereof

Publications (2)

Publication Number Publication Date
CN111064553A CN111064553A (en) 2020-04-24
CN111064553B true CN111064553B (en) 2022-07-05

Family

ID=70300912

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911276483.7A Active CN111064553B (en) 2019-12-12 2019-12-12 Switch and loopback diagnosis method, device and storage medium of management network port thereof

Country Status (2)

Country Link
CN (1) CN111064553B (en)
WO (1) WO2021114722A1 (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111064553B (en) * 2019-12-12 2022-07-05 苏州浪潮智能科技有限公司 Switch and loopback diagnosis method, device and storage medium of management network port thereof
CN111669255B (en) * 2020-07-09 2023-05-12 深圳市信锐网科技术有限公司 Communication equipment network port loopback test method, device, circuit, equipment and medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101291261A (en) * 2008-04-28 2008-10-22 华为技术有限公司 Method and system for in-board device testing
CN105306357A (en) * 2015-11-10 2016-02-03 上海斐讯数据通信技术有限公司 System and method for detecting loopback

Family Cites Families (17)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100461717C (en) * 2006-01-17 2009-02-11 华为技术有限公司 Communication device and its detecting method
CN1983969A (en) * 2006-04-24 2007-06-20 华为技术有限公司 System and realization for re-directing interface network
CN100546262C (en) * 2007-07-04 2009-09-30 北京航空航天大学 A kind of broadband aviation electronic bus testing apparatus and method of operation thereof
US8718561B2 (en) * 2007-11-20 2014-05-06 Aruba Networks, Inc. Method and apparatus for detecting and avoiding interference in a communications network
CN101753211A (en) * 2008-12-18 2010-06-23 华为技术有限公司 A kind of method of testing and device
CN102315964B (en) * 2011-08-19 2013-12-18 华为技术有限公司 Loopback method for testing message and exchange device
CN102984035A (en) * 2013-01-04 2013-03-20 盛科网络(苏州)有限公司 Loopback test method and system of packet loss probability of network data
CN103533665A (en) * 2013-06-08 2014-01-22 北京星河亮点技术股份有限公司 Realization method of LTE terminal comprehensive tester state machine
US10312936B2 (en) * 2014-01-17 2019-06-04 Texas Instruments Incorporated Using CRC residual value to distinguish a recipient of a data packet in a communication system
CN104283712B (en) * 2014-10-13 2017-10-27 新华三技术有限公司 The network equipment and the management network port collocation method for the network equipment
US11349701B2 (en) * 2015-03-09 2022-05-31 Vapor IO Inc. Data center management with rack-controllers
CN104901843A (en) * 2015-04-23 2015-09-09 广西电网有限责任公司电力科学研究院 Interchangeability tester of communication unit
CN106230718A (en) * 2016-08-03 2016-12-14 天津光电聚能专用通信设备有限公司 Based on XilinxFPGA many kilomega networks converging system and implementation method
CN107547304A (en) * 2017-07-13 2018-01-05 紫光华山信息技术有限公司 Network card testing method, device and machinable medium
US10778561B2 (en) * 2017-09-08 2020-09-15 Avago Technologies International Sales Pte. Limited Diagnostic port for inter-switch and node link testing in electrical, optical and remote loopback modes
CN110278126A (en) * 2019-06-28 2019-09-24 苏州浪潮智能科技有限公司 A kind of switch port self checking method, system, terminal and storage medium
CN111064553B (en) * 2019-12-12 2022-07-05 苏州浪潮智能科技有限公司 Switch and loopback diagnosis method, device and storage medium of management network port thereof

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101291261A (en) * 2008-04-28 2008-10-22 华为技术有限公司 Method and system for in-board device testing
CN105306357A (en) * 2015-11-10 2016-02-03 上海斐讯数据通信技术有限公司 System and method for detecting loopback

Also Published As

Publication number Publication date
CN111064553A (en) 2020-04-24
WO2021114722A1 (en) 2021-06-17

Similar Documents

Publication Publication Date Title
US6580697B1 (en) Advanced ethernet auto negotiation
CN111064553B (en) Switch and loopback diagnosis method, device and storage medium of management network port thereof
USRE38309E1 (en) Full duplex flow control for Ethernet networks
US8089907B2 (en) Duplex mismatch detection
RU2487483C2 (en) Method and filtering device for filtering messages received by communication network subscriber over serial data bus of said network
US7146438B2 (en) Device and method for controlling packet flow
US20080002735A1 (en) Device network
CN106817264B (en) Method, device and system for detecting link fault
CN110300040B (en) Communication method and related equipment
CN106063198A (en) Subscriber station for a bus system and method for improving the quality of transmission in a bus system
US20050207360A1 (en) Configuring a transmission mode between devices
US10404611B2 (en) Discovering path maximum transmission unit
CN113312284A (en) Data transmission method, device, system, storage medium and electronic device
US6778551B1 (en) Collision control systems and methods utilizing an inter-frame gap code counter
CN108882312B (en) RTS frame sending rate adjusting method, device, equipment and storage medium
CN105119788A (en) Ethernet network interface system, network environment adaptive method thereof, and Ethernet equipment
US20210058495A1 (en) Communication device, communication system, and protocol switchover method
CN108882310B (en) Method, device and medium for determining operation state of RTS/CTS mechanism
CN112787886B (en) Processing method, device driver, readable storage medium and computer for real-time system network device auto-negotiation
US10523235B2 (en) Transmission checking method, node, system and computer storage medium
EP1999882B1 (en) Duplex mismatch detection
US20040174819A1 (en) Physical layer (PHY) with smart cable analyzing (SCA) and apparatus employing the same
KR102474800B1 (en) Gateway and Method for controlling Gateway
CN107926061A (en) A kind of back-off method, transmission message approach and device
US9473597B2 (en) Implementing multiple MAC protocols using a single wireless communication unit

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
GR01 Patent grant
GR01 Patent grant