CN115643202A - Link selection control protocol switching method, device, equipment and medium - Google Patents

Link selection control protocol switching method, device, equipment and medium Download PDF

Info

Publication number
CN115643202A
CN115643202A CN202211190532.7A CN202211190532A CN115643202A CN 115643202 A CN115643202 A CN 115643202A CN 202211190532 A CN202211190532 A CN 202211190532A CN 115643202 A CN115643202 A CN 115643202A
Authority
CN
China
Prior art keywords
port
link
state information
information
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
CN202211190532.7A
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.)
Beijing Armyfly Technology Co Ltd
Original Assignee
Beijing Armyfly 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 Beijing Armyfly Technology Co Ltd filed Critical Beijing Armyfly Technology Co Ltd
Priority to CN202211190532.7A priority Critical patent/CN115643202A/en
Publication of CN115643202A publication Critical patent/CN115643202A/en
Pending legal-status Critical Current

Links

Images

Abstract

The embodiment of the invention discloses a method, a device, equipment and a medium for switching a link selection control protocol. Respectively sending messages to each slave device by adopting different links; when determining that the link does not receive response information of the slave equipment aiming at the message, acquiring current port state information of a first port corresponding to the link in an information maintenance table corresponding to the master equipment; when the current port state information is determined to be the main port state information, determining a target port from a first port corresponding to a link receiving the response information of the message; and updating the current port state information corresponding to the target port into the main port state information, and switching the link according to the link corresponding to the target port. By the method, the problem of port blockage caused by the fact that the other ends of all the ports of the main equipment are not in the same equipment and are not in the same network for communication is solved, the condition of communication abnormity caused by communication port blockage is avoided, and the reliability and effectiveness of communication are improved.

Description

Link selection control protocol switching method, device, equipment and medium
Technical Field
The present invention relates to network communication technologies, and in particular, to a method, an apparatus, a device, and a medium for switching a link selection control protocol.
Background
The current standard spanning tree technology can prevent the two-layer loop from appearing in the network. After STP (Spanning-tree Protocol) runs, if a loop exists in a network, STP breaks the loop by blocking a specific interface and converges in time when a topology change occurs in the network, so as to ensure redundancy of the network. When the topology changes, the spanning tree protocol can detect the changes and timely and automatically adjust the interface state, so that the network topology changes are adapted, and link redundancy is realized.
Currently, an LACP (Link Aggregation Control Protocol) is a Protocol for implementing dynamic Aggregation and de-Aggregation of links based on ieee802.3ad standard, so that a device automatically forms an aggregated Link according to its configuration and starts the aggregated Link to transmit and receive data, and an LACP mode is a Link Aggregation mode that uses the LACP. After the aggregated link is formed, the LACP is responsible for maintaining the link state, and when the aggregation condition changes, the link aggregation is automatically adjusted.
In the process of implementing the invention, the inventor finds that the defects of the prior art are as follows: if the ports in the networking environment are not in the same network, the STP cannot realize that all the ports in the network are elected to be only one port for data transmission. If LACP is used for communication, the aggregated physical port can only belong to one device at one end, and the rest of the ports cannot be set to be unavailable. At present, under the scene that one end of all ports is not in the same equipment and the same network, the existing protocol cannot be realized, and the abnormal communication condition is easy to occur.
Disclosure of Invention
The embodiment of the invention provides a link selection control protocol switching method, a link selection control protocol switching device, link selection control protocol switching equipment and a link selection control protocol switching medium, so as to improve the reliability and effectiveness of communication.
In a first aspect, an embodiment of the present invention provides a link selection control protocol switching method, which is executed by a master device, where the method includes:
respectively sending messages to each slave device by adopting different links, wherein a first port of each link is positioned in the master device, a second port of each link is positioned in the slave device, and the master device and the slave device are positioned in different networks;
when determining that the link does not receive the response information of the slave equipment aiming at the message, acquiring the current port state information of the first port corresponding to the link in an information maintenance table corresponding to the master equipment;
when the current port state information is determined to be the main port state information, determining a target port from a first port corresponding to a link receiving the response information of the message;
and updating the current port state information corresponding to the target port to be the main port state information, and switching the link according to the link corresponding to the target port.
In a second aspect, an embodiment of the present invention provides a link selection control protocol switching apparatus, which is executed by a master device, and includes:
a message sending module, configured to send a message to each slave device by using different links, where a first port of each link is located in the master device, a second port of each link is located in the slave device, and the master device and the slave device are located in different networks;
a current port state information obtaining module, configured to, when it is determined that a link does not receive response information of the slave device for the packet, obtain, in an information maintenance table corresponding to the master device, current port state information of a first port corresponding to the link;
a target port determining module, configured to determine a target port from a first port corresponding to a link receiving the response information of the packet when it is determined that the current port state information is the master port state information;
and the link switching module is used for updating the current port state information corresponding to the target port into the main port state information and performing link switching according to the link corresponding to the target port.
In a third aspect, an embodiment of the present invention further provides a computer device, including a storage apparatus, one or more processors, and a computer program stored on a memory and executable on the processor, where the one or more processors, when executing the computer program, implement the link selection control protocol switching method according to any embodiment of the present invention.
In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the link selection control protocol switching method according to any embodiment of the present invention.
According to the technical scheme provided by the embodiment of the invention, messages are respectively sent to the slave devices by adopting different links; when determining that the link does not receive response information of the slave equipment aiming at the message, acquiring current port state information of a first port corresponding to the link in an information maintenance table corresponding to the master equipment; when the current port state information is determined to be the main port state information, determining a target port from a first port corresponding to a link receiving the response information of the message; and updating the current port state information corresponding to the target port into the main port state information, and switching the link according to the link corresponding to the target port. By the method, the problem of port blockage caused by the fact that the other ends of all the ports of the main equipment are not in the same equipment and are not in the same network for communication is solved, the condition of communication abnormity caused by communication port blockage is avoided, and the reliability and effectiveness of communication are improved.
Drawings
Fig. 1a is a flowchart of a method for switching a link selection control protocol according to an embodiment of the present invention;
fig. 1b is a schematic structural diagram of a specific configuration LSCP example in the method according to an embodiment of the present invention;
fig. 2a is a flowchart of another method for controlling protocol handover in link selection according to a second embodiment of the present invention;
fig. 2b is a schematic structural diagram of port state information conversion of the first port in the method according to the second embodiment of the present invention;
fig. 3 is a schematic structural diagram of a link selection control protocol switching apparatus according to a third embodiment of the present invention;
fig. 4 is a schematic structural diagram of a computer device according to a fourth embodiment of the present invention.
Detailed Description
The embodiments of the present invention will be described in further detail with reference to the drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of and not restrictive on the broad invention. It should be further noted that, for convenience of description, only some structures, not all structures, relating to the embodiments of the present invention are shown in the drawings.
Example one
Fig. 1a is a flowchart of a method for switching a link selection control protocol according to an embodiment of the present invention. The present embodiment is applicable to a case where a plurality of slave devices associated with a master device do not communicate with each other in the same network. The method of this embodiment may be performed by a link selection control protocol switching apparatus, which may be implemented by software and/or hardware, and may be generally performed by a master device.
Correspondingly, the method specifically comprises the following steps:
and S110, respectively sending messages to the slave devices by adopting different links.
Wherein the first port of the link is located in the master device, the second port of the link is located in the slave device, and the master device and the slave device are located in different networks.
Specifically, one master device has multiple ports, the ports on the master device are first ports, each first port can be connected to a second port corresponding to a different slave device, a line used for connecting the first port corresponding to the master device and the second port corresponding to the slave device is a link, and the link can be used for sending a message.
Optionally, before the sending the message to each slave device by using different links, the method further includes: configuring Link Selection Control Protocol (LSCP) instances, wherein each LSCP instance is added with a different first port; determining the port priority, the port type, the port number, the message sending period and the port state aging time of each first port through the LSCP example; wherein the port type includes at least one of: fiber ports, wireless ports, and microwave ports.
The LSCP (Link selection control protocol) is a Link selection control protocol, and may be a protocol in which, in point-to-point communication, a transmitting end and a receiving end determine necessary information in data transmission by transmitting an LSCP packet. The port priority may be a priority level of the first port. The port type may be a type describing the first port and may include a fiber port, a wireless port, and a microwave port. The port state aging time may be a time allowed by the first port to not receive the response packet. The optical fiber port may be a physical interface for connecting an optical fiber cable, the wireless port may be a physical interface for connecting a wireless cable, and the microwave port may be a physical interface for connecting a microwave cable.
Illustratively, the LSCP instance needs to be configured before sending messages to the slave devices respectively using different links.
Fig. 1b is a schematic structural diagram of a specific configuration LSCP example. Specifically, it may be determined that the master device is a device a, and the device a has 3 first ports (a first port 1, a first port 2, and a first port 3) which are respectively connected to 3 slave devices (a device B, a device C, and a device D). It can be further known that the first port 1 of the device a and the second port of the device B are connected by the link 1; the first port 2 of the device A and the second port of the device C are connected by a link 2; the first port 3 of device a and the second port of device D are connected by link 3. It may be set that device a is located in network a, device B, device C, and device D are located in network B, and network a and network B do not belong to the same network.
Correspondingly, the priority of the first port 1 connected with the device B can be set as a first priority, the port type is an optical fiber port, and the port number is 1; the priority of the first port 2 connected with the device C is a second priority, the port type is an optical fiber port, and the port number is 2; the priority of the first port 3 connected to the device D is the third priority, the port type is a microwave port, and the port number is 3. The message sending period of the device A is set to be 1s, and the aging time of the port state is set to be 3s. Wherein the first priority is higher than the second priority, which is higher than the third priority.
The advantages of such an arrangement are: the LSCP instance is configured to further determine the port, link and other information of the master device and the plurality of slave devices thereof, so that the priority, port type, port number and other information of the first port of other slave devices connected with the master device can be determined more clearly, the specific information of each first port can be determined more accurately, and the link can be switched more accurately.
Optionally, the sending the message to each slave device by using different links respectively includes: according to the message sending period, a first timer unit is adopted to send heartbeat messages to each slave device through different links, wherein the heartbeat messages are used for detecting the connection state of the links; and respectively sending broadcast messages to each slave device by adopting different links by adopting a second timer unit according to the message sending period, wherein the broadcast messages are used for acquiring Media Access Control (MAC) addresses of second ports of the links.
The message sending period may be a fixed time interval of the master device sending the message. The first timer unit may be a unit that performs heartbeat packet sending at regular time according to a packet sending period. The heartbeat message can be sent in a broadcast or unicast mode of a user datagram protocol, wherein the operation state of the network memory is represented by one-time sending character string information, and the sending mode and the sending interval of the heartbeat message can be set by a user in the LSCP instance configuration process. The second timer may be a unit that performs broadcast packet transmission at regular time according to a packet transmission period. The broadcast packet may be a packet sent by the host device to multiple links, and may obtain the MAC address of the second port of the link. The MAC address of the second port may be an address used to confirm a location of the target slave device corresponding to the second port, where the MAC address is used to uniquely identify a network card in the network, and if one or more network cards exist in a device, each network card needs to have a unique MAC address.
Preferably, the transmission periods of the first timer and the second timer may be the same or different.
In the previous example, according to the configured LSCP example, it may be assumed that the device a respectively sends heartbeat messages to the device B, the device C, and the device D by using different links according to a message sending period, that is, the device a sends heartbeat messages to the device B by using the link 1, sends heartbeat messages to the device C by using the link 2, and sends heartbeat messages to the device D by using the link 3. When the device B, the device C, and the device D receive the heartbeat message, the heartbeat message can be replied, and therefore, the device a can determine the connection state of the link.
Similarly, it is assumed that the device a sends the broadcast packet to the device B, the device C, and the device D by using different links according to the packet sending period, that is, the device a sends the broadcast packet to the device B by using the link 1, sends the broadcast packet to the device C by using the link 2, and sends the broadcast packet to the device D by using the link 3. When the device B, the device C, and the device D receive the broadcast packet, the device B, the device C, and the device D may reply to the broadcast packet, and thus, the device a may determine the MAC address of the second port of the link.
The advantages of such an arrangement are: the main device sends heartbeat messages and broadcast messages to each slave device by adopting different links, so that the connection state of each link can be determined, and the MAC address of the second port of each link can be determined. Therefore, the main equipment can more accurately determine the specific conditions of each link, so that the information maintenance table corresponding to the main equipment can be updated in time, and the main equipment can more accurately inquire the information maintenance table.
S120, when it is determined that the link does not receive the response information of the slave device to the message, acquiring the current port state information of the first port corresponding to the link in an information maintenance table corresponding to the master device.
The information maintenance table may be a maintenance table stored in the master device and used for describing relevant information of the master device and each slave device.
Specifically, the master device is configured to record port state information and a MAC address of a first port associated with each slave device, and information such as a link status associated with each slave device. When the port state information corresponding to the master device and each slave device changes, the update operation of the information maintenance table needs to be performed.
The port state information may be information describing a port state of the first port, and specifically, the port state information may include active port state information, standby port state information, and unavailable port state information.
The state information of the active port may be a state of a port with the highest priority among all the first ports of the master device, and is a transmission port, which may be used for receiving and sending data packets and protocol packets. The standby port status information may be a status of a port with a non-highest priority among all the first ports of the master device, and is a blocked port and is only used for receiving and sending protocol packets. The unavailable port state information may be a port which does not receive the response of the heartbeat message and the broadcast message in all the first ports of the master device, and is a blocked port which can only be used for receiving the protocol message. The response information may be message response information that responds to the received heartbeat message and broadcast message.
For the previous example, when the device a uses the link 1 to send the heartbeat message and the broadcast message to the device B, the device a uses the link 2 to send the heartbeat message and the broadcast message to the device C, and the device a uses the link 3 to send the heartbeat message and the broadcast message to the device D.
It can be assumed that link 1 corresponding to device a does not receive the response information of the slave device for the packet, that is, link 1 does not receive the response information of device B. However, link 2 receives the response message from device C and link 3 receives the response message from device D.
Further, since the link 1 does not receive the response information of the device B, the current port state information of the first port corresponding to the link 1 may be acquired in the information maintenance table corresponding to the master device.
Optionally, when it is determined that there is a link that does not receive response information of the slave device for the packet, acquiring, in an information maintenance table corresponding to the master device, current port state information of the first port corresponding to the slave device, where the acquiring includes: when determining that a link does not receive first response information of the slave equipment aiming at the heartbeat message in the message, acquiring current port state information of a first port corresponding to the link in an information maintenance table corresponding to the master equipment; and updating the information maintenance table according to the current port state information.
The first response information may be that the slave device receives a heartbeat message sent by the master device, the slave device responds to the heartbeat message, and the master device can receive reply information of the heartbeat message of the slave device.
Specifically, the sending time of the heartbeat message is used for counting the time of the heartbeat message sent from the master device, and when the time difference between the sending time of the heartbeat message and the time of currently receiving the reply message is less than or equal to the port state aging time, it can be determined that the master device can perform normal message sending with the slave device corresponding to the link. When the time difference between the sending time of the heartbeat message and the currently received reply message is greater than the port state aging time, it can be determined that the master device cannot normally send the message with the slave device corresponding to the link.
For the previous example, it is assumed that the link 1 does not receive the first response information of the device B about the heartbeat message, that is, the device a does not receive the first response information. Further, in the information maintenance table corresponding to the master device, the current port state information of the first port 1 corresponding to the link 1 is obtained, and it is assumed that the obtained current port state information is the master port state information. Because the first port 1 corresponding to the link 1 does not receive the first response information, the current port state information of the first port 1 is converted from the active port state information to the unavailable port state information, and the information maintenance table is updated.
The advantages of such an arrangement are: when the link is determined not to receive the first response information, the current port state information of the first port corresponding to the link is obtained, the information maintenance table is updated, and the first response information is fed back according to the heartbeat message, so that the link quality can be accurately judged, the link needing to be switched can be more accurately determined through the judgment of the link quality, and the information maintenance table can be more accurately and timely updated.
Optionally, the method further includes: and when determining that the link does not receive second response information of the slave equipment aiming at the broadcast message, deleting the MAC address of the second port matched with the link in the information maintenance table.
The second response information may be that the slave device receives a broadcast message sent by the master device, the slave device responds to the broadcast message, and the master device can receive reply information of the slave device broadcast message.
In this embodiment, when the master device sends a broadcast packet to each slave device, the slave device does not reply the second response information to the master device, which indicates that the slave device may be in a failure state at this time, and then the second port corresponding to the slave device is in a blocked state, so that the MAC address of the second port matched with the slave device needs to be deleted in the information maintenance table associated with the master device. When the master device sends the broadcast message to each slave device again, if the slave device replies the second response information, the MAC address of the second port is directly stored. Therefore, the MAC address of the second port can be timely and accurately determined according to the information maintenance table, and unnecessary information maintenance of the MAC address is avoided.
For the previous example, it is assumed that the link 1 does not receive the second response information of the device B about the broadcast packet, that is, the device a does not receive the second response information. Further, since the first port 1 corresponding to the link 1 does not receive the second response message, the MAC address of the second port matched with the link 1 in the information maintenance table is deleted.
The advantages of such an arrangement are: and when the link is determined not to receive the second response information, deleting the MAC address of the second port matched with the link in the information maintenance table, so that the information maintenance table can be updated more accurately and timely, and unnecessary information maintenance of the MAC address is avoided.
S130, when it is determined that the current port state information is the active port state information, determining a target port from the first port corresponding to the link receiving the response information of the packet.
In this embodiment, if it is determined that the link does not receive the response information of the slave device to the packet, the current port state information of the first port corresponding to the link is obtained as the active port state information in the information maintenance table corresponding to the master device. It can be understood that, in the first port corresponding to the master device, the first port with the state information of the master port that has failed needs to determine the destination port in the first port corresponding to the link that receives the response information of the packet again.
For example, since the link 1 corresponding to the device a does not receive the response information of the slave device for the packet, that is, the link 1 does not receive the response information of the device B (that is, the first port 1 does not receive the response information). However, the link 2 receives the response message from the device C, and the link 3 receives the response message from the device D (i.e., the first port 2 and the first port 3 receive the response messages).
It can be understood that, in the first port 1 corresponding to the device a, the failed first port 1 is the active port state information. Since the first port 2 and the first port 3 receive the response information and no failure occurs, it is necessary to determine a destination port among the first port 2 and the first port 3.
S140, updating the current port state information corresponding to the target port to the main port state information, and performing link switching according to the link corresponding to the target port.
In this embodiment, after the target port is determined, it is necessary to update the current port state information of the target port to be the active port state information, perform link switching, and update the link corresponding to the target port to be the active link, where the active link may be used to send data packets and protocol packets.
For the previous example, it is assumed that the target port is determined to be the first port 2, and the current port status information of the first port 2 is the standby port status information. Therefore, it is necessary to update the standby port state information corresponding to the first port 2 to the active port state information, and to perform link switching on the link 2 corresponding to the first port 2.
Optionally, after the obtaining of the current port state information of the first port corresponding to the link, the method further includes: and when the current port state information is determined to be the standby port state information, directly updating the current port state information to the unavailable port state information.
In this embodiment, it is assumed that the current port state information is determined to be the standby port state information, that is, for the primary device, the port state information of the first port that has a failure is the standby port state information, and therefore, link switching processing is not required, and the current port state information is directly updated to the unavailable port state information.
In addition, when the master device sends the heartbeat message and the broadcast message until the next cycle comes, the first port whose port state information is unavailable port state information still needs to be sent, and the first port can be used for detecting the link quality and acquiring the MAC address. After receiving the response information, the port state information needs to be updated in the information maintenance table.
The advantages of such an arrangement are: and directly updating the current port state information into the unavailable port state information by determining that the current port state information is the standby port state information. Because the current port state information of the first port with the fault is the standby port state information, the port state information is directly updated in the information maintenance table without switching the link, and the reliability of communication is improved.
According to the technical scheme provided by the embodiment of the invention, messages are respectively sent to the slave devices by adopting different links; when determining that the link does not receive response information of the slave equipment aiming at the message, acquiring current port state information of a first port corresponding to the link in an information maintenance table corresponding to the master equipment; when the current port state information is determined to be the main port state information, determining a target port from a first port corresponding to a link receiving the response information of the message; and updating the current port state information corresponding to the target port into the main port state information, and switching the link according to the link corresponding to the target port. By the method, the problem of port blockage caused by the fact that the other ends of all the ports of the main equipment are not in the same equipment and are not in the same network for communication is solved, the condition of communication abnormity caused by communication port blockage is avoided, and the reliability and effectiveness of communication are improved.
Example two
Fig. 2a is a flowchart of another method for switching a link selection control protocol according to a second embodiment of the present invention. In this embodiment, when it is determined that the current port state information is the active port state information, a target port is determined from a first port corresponding to a link receiving the response information of the packet, and the refinement is further performed based on the above embodiments.
Correspondingly, the method specifically comprises the following steps:
s210, respectively sending messages to each slave device by adopting different links.
S220, when it is determined that the link does not receive the response information of the slave equipment to the message, the current port state information of the first port corresponding to the link is obtained in the information maintenance table corresponding to the master equipment.
S230, when it is determined that the current port state information is the active port state information, obtaining a first open port in an open state from a first port corresponding to a link receiving the response information of the packet.
The first open port may be a first port describing that the physical switch is in an open state, and specifically, the physical switch of each first port may be in an open state or a closed state, that is, there may be a first open port and a first closed port. The first closed port describes the first port with the physical switch in the closed state.
For the previous example, the failed first port 1 in the first port 1 corresponding to the device a is the first port 1 of the active port state information, so that the link needs to be switched, and the target port needs to be determined again. Since the first port 2 and the first port 3 receive the response information and no failure occurs, it is necessary to determine a destination port among the first port 2 and the first port 3.
Assuming that the first port 2 is in an open state, it is a first open port; the first port 3 is in a closed state, which is a first closed state. Therefore, the acquired first open port is the first port 2.
In addition, it is assumed that the first port 2 is in an open state, which is a first open port; the first port 3 is also in an open state, being a first open port. Thus, the first open ports acquired are the first port 2 and the first port 3.
S240, acquiring the port priority of the first open port, and determining the target port according to the port priority of the first open port.
In this embodiment, in a first port corresponding to a link that has completed acquiring response information that can receive a message, it is necessary to determine whether the first port is in an open state or a closed state, and if the first port is in the open state, the first port is a first open port; if in the closed state, the first port is a first closed port. Therefore, the first open port in the open state among the first ports can be determined.
Further, the port priority corresponding to the first open port is obtained, and the target port is determined according to the specific situation of the port priority.
In the previous example, assuming that the first open ports are determined to be the first port 2 and the first port 3, the port priorities corresponding to the first port 2 and the first port 3 need to be obtained next. The target port is determined according to the port priority.
Optionally, the obtaining the port priority of the first open port and determining the target port according to the port priority of the first open port includes: when one port with the highest priority is arranged in the first opening ports, directly taking the port with the highest priority as the target port; and when the number of the highest priority port in the first open ports is more than one, judging the port number corresponding to the highest priority port, and determining the highest priority port with the smallest port number as the target port.
Wherein the highest priority port may be a port selected to be highest in priority among the first open ports. The port number may be a port number of the current port connected to the master device, and the smaller the port number is, the higher the possibility of selecting the current port as the master port is.
In the previous example, according to the LSCP example configured as above, it can be known that: the port priority of a first port 1 connected with the device B can be set as a first priority, the port type is an optical fiber port, and the port number is 1; the port priority of the first port 2 connected with the device C is a second priority, the port type is an optical fiber port, and the port number is 2; the port priority of the first port 3 connected to the device D is the third priority, the port type is a microwave port, and the port number is 3. The message sending period of the device A is set to be 1s, and the aging time of the port state is set to be 3s. Wherein the first priority is higher than the second priority, which is higher than the third priority.
Since it is determined that the first open ports are the first port 2 and the first port 3, the port priorities corresponding to the first port 2 and the first port 3 need to be obtained next. Since the port priority of the first port 2 is the second priority, the port priority of the first port 3 is the third priority, and since the second priority is higher than the third priority, the first port 2 is selected as the target port.
In this case, since there is one port of the highest priority among the first open ports, i.e., the first port 2 is directly taken as the target port. In addition, since the port type of the first port 1 connected to the device a and the device B is an optical fiber port, the first port 2 is now required to be used as a target port, that is, the first port 2 is set to be in the active port state, and the port type of the first port 2 is also an optical fiber port, so that it is not necessary to modify a relevant frame header of the packet.
In addition, if the port type changes, a related frame header needs to be added for sending when the message is sent. For example, when the LSCP protocol performs link switching, if the selected first port 3 (the port type is the microwave port) is the active port, special processing needs to be performed, such as adding a special field to a packet.
In another alternative embodiment of this embodiment, it is assumed that the configuration of the LSCP instance is modified: the port priority of the first port 2 connected with the device C is a second priority, the port type is an optical fiber port, and the port number is 2; the port priority of the first port 3 connected to the device D is the second priority, the port type is the microwave port, and the port number is 3.
In this case, both the first port 2 and the first port 3 are in the second priority level, and at this time, it may be determined that the number of the highest priority port is greater than one, so that the port numbers corresponding to the first port 2 and the first port 3 need to be obtained. The port number corresponding to the first port 2 can be obtained to be 2; if the port number corresponding to the first port 3 is 3, the highest priority port with the smallest port number may be determined as the target port, that is, the first port 2 is set as the target port.
The advantages of such an arrangement are: the target port can be more accurately determined according to the port priority and the port number of the first open port, and then link switching and information maintenance table updating are carried out according to the determined target port, so that the problem of port blockage caused by communication of the other ends of all ports of the main equipment which are not in the same equipment and the same network can be more effectively solved.
And S250, updating the current port state information corresponding to the target port to the main port state information, and switching the link according to the link corresponding to the target port.
Fig. 2b is a schematic diagram illustrating port state information transition of the first port. If the port state information of the first port is the active port state information, the active port state information of the first port needs to be updated to the unavailable port state information because the physical state of the first port is in the closed state (that is, the first port is the first closed port), or the first port does not receive the packet within the port state aging time. In addition, when the LSCP instance is reconfigured, if the priority of one of the other first open ports is set to be higher than that of the target first port (it is known that the port state information of the target first port is the active port state information in the previous instance configuration), the active port state information of the target first port needs to be updated to the standby port state information.
If the port state information of the first port is the standby port state information, the standby port state information of the first port needs to be updated to the unavailable port state information because the first port is in a closed state or the first port does not receive the message within the port state aging time. In addition, when the LSCP instance is reconfigured, the priority of the target first port is set to be the highest (it is known that the port state information of the target first port in the previous instance configuration is the standby port state information), and the standby port state information of the target first port needs to be updated to the active port state information.
If the port status of the first port is the unavailable port status information, since the current first port is in an open state (that is, the first port is the first open port) and is the highest port priority, the unavailable port status information of the first port needs to be updated to the active port status information. In addition, since the current first port is in an open state but not the highest port priority, the unavailable port status information of the first port needs to be updated to the standby port status information.
According to the technical scheme provided by the embodiment of the invention, messages are respectively sent to the slave devices by adopting different links; when determining that the link does not receive response information of the slave equipment aiming at the message, acquiring current port state information of a first port corresponding to the link in an information maintenance table corresponding to the master equipment; when the current port state information is determined to be the active port state information, acquiring a first open port in an open state from a first port corresponding to a link receiving the response information of the message; acquiring the port priority of the first opening port, and determining the target port according to the port priority of the first opening port; and updating the current port state information corresponding to the target port into the main port state information, and switching the link according to the link corresponding to the target port. The method and the device avoid the situation that effective communication cannot be carried out when the physical port of the first port is in a closed state, solve the problem of how to select the target port, can more accurately determine the target port, update port state information and switch the link according to the target port, and improve the reliability and effectiveness of communication.
EXAMPLE III
Fig. 3 is a schematic structural diagram of a link selection control protocol switching apparatus according to a third embodiment of the present invention. The link selection control protocol switching apparatus provided in this embodiment may be implemented by software and/or hardware, and the apparatus may be generally executed by a master device. The method for switching the link selection control protocol can be configured in a server to realize the method for switching the link selection control protocol in the embodiment of the invention. As shown in fig. 3, the apparatus may specifically include: a message sending module 310, a current port state information obtaining module 320, a target port determining module 330, and a link switching module 340.
The message sending module 310 is configured to send a message to each slave device by using different links, where a first port of each link is located in the master device, a second port of each link is located in the slave device, and the master device and the slave device are located in different networks;
a current port state information obtaining module 320, configured to, when it is determined that a link does not receive response information of the slave device for the packet, obtain, in an information maintenance table corresponding to the master device, current port state information of a first port corresponding to the link;
a target port determining module 330, configured to determine a target port from a first port corresponding to a link receiving the response information of the packet when it is determined that the current port state information is the active port state information;
the link switching module 340 is configured to update the current port state information corresponding to the target port to the active port state information, and perform link switching according to the link corresponding to the target port.
According to the technical scheme provided by the embodiment of the invention, messages are respectively sent to the slave devices by adopting different links; when determining that the link does not receive response information of the slave equipment aiming at the message, acquiring current port state information of a first port corresponding to the link in an information maintenance table corresponding to the master equipment; when the current port state information is determined to be the main port state information, determining a target port from a first port corresponding to a link receiving the response information of the message; and updating the current port state information corresponding to the target port into the main port state information, and switching the link according to the link corresponding to the target port. By the method, the problem of port blockage caused by the fact that the other ends of all the ports of the main equipment are not in the same equipment and are not in the same network for communication is solved, the condition of communication abnormity caused by communication port blockage is avoided, and the reliability and effectiveness of communication are improved.
On the basis of the foregoing embodiments, the port state information includes: primary port state information, standby port state information, and unavailable port state information. The target port determining module 330 may specifically include: a first open port acquiring unit, configured to, when it is determined that the current port state information is the active port state information, acquire a first open port in an open state in the first port from the first port corresponding to the link that receives the response information of the packet; and the target port determining unit is used for acquiring the port priority of the first opening port and determining the target port according to the port priority of the first opening port.
On the basis of the foregoing embodiments, the target port determining unit may be specifically configured to: when one port with the highest priority is arranged in the first opening ports, directly taking the port with the highest priority as the target port; and when the number of the highest priority port in the first open ports is more than one, judging the port number corresponding to the highest priority port, and determining the highest priority port with the smallest port number as the target port.
On the basis of the foregoing embodiments, the present port state information updating unit may be specifically configured to: after the current port state information of the first port corresponding to the link is obtained, when the current port state information is determined to be the standby port state information, directly updating the current port state information to the unavailable port state information.
On the basis of the foregoing embodiments, the message sending module may be specifically configured to: a heartbeat message sending module, configured to send heartbeat messages to each slave device by using different links according to the message sending period and using a first timer unit, where the heartbeat messages are used to detect a connection state of the links; and the broadcast message sending module is used for sending broadcast messages to each slave device by adopting different links according to the message sending period by adopting a second timer unit, wherein the broadcast messages are used for acquiring the MAC address of the second port of the link.
On the basis of the foregoing embodiments, the current port state information obtaining module 320 may be specifically configured to: when determining that a link does not receive first response information of the slave equipment aiming at the heartbeat message in the message, acquiring current port state information of a first port corresponding to the link in an information maintenance table corresponding to the master equipment; and updating the information maintenance table according to the current port state information.
On the basis of the foregoing embodiments, the following embodiments may be further specifically used: and when determining that the link does not receive second response information of the slave equipment aiming at the broadcast message, deleting the MAC address of the second port matched with the link in the information maintenance table.
On the basis of the foregoing embodiments, the LSCP instance configuration module may further be specifically configured to: before the messages are respectively sent to the slave devices by adopting different links, link selection control protocol LSCP instances are configured, and different first ports are respectively added to each LSCP instance; determining the port priority, the port type, the port number, the message sending period and the port state aging time of each first port through the LSCP example; wherein the port type includes at least one of: fiber ports, wireless ports, and microwave ports.
The link selection control protocol switching device can execute the link selection control protocol switching method provided by any embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method.
Example four
Fig. 4 is a structural diagram of a computer device according to a fourth embodiment of the present invention. As shown in fig. 4, the apparatus includes a processor 410, a memory 420, an input device 430, and an output device 440; the number of the processors 410 in the device may be one or more, and one processor 410 is taken as an example in fig. 4; the processor 410, the memory 420, the input device 430 and the output device 440 in the apparatus may be connected by a bus or other means, for example, in fig. 4.
The memory 420 is used as a computer-readable storage medium, and can be used to store software programs, computer-executable programs, and modules, such as program instructions/modules corresponding to the link selection control protocol switching method in the embodiment of the present invention (for example, the message sending module 310, the current port state information obtaining module 320, the target port determining module 330, and the link switching module 340). The processor 410 executes software programs, instructions and modules stored in the memory 420 to execute various functional applications and data processing of the device, that is, to implement the above-mentioned link selection control protocol switching method, and the method includes: respectively sending messages to each slave device by adopting different links, wherein a first port of each link is positioned in the master device, a second port of each link is positioned in the slave device, and the master device and the slave device are positioned in different networks; when determining that a link does not receive response information of the slave equipment aiming at the message, acquiring current port state information of a first port corresponding to the link in an information maintenance table corresponding to the master equipment; when the current port state information is determined to be the main port state information, determining a target port from a first port corresponding to a link receiving the response information of the message; and updating the current port state information corresponding to the target port to be the main port state information, and switching the link according to the link corresponding to the target port.
The memory 420 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required for at least one function; the storage data area may store data created according to the use of the terminal, and the like. Further, the memory 420 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other non-volatile solid state storage device. In some examples, memory 420 may further include memory located remotely from processor 410, which may be connected to devices through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input means 430 may be used to receive input numeric or character information and generate key signal inputs related to user settings and function control of the apparatus. The output device 440 may include a display device such as a display screen.
EXAMPLE five
Fifth, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the computer program implements the method according to any embodiment of the present invention. Of course, the computer-readable storage medium provided in the embodiments of the present invention may execute a method for switching a link selection control protocol provided in any embodiment of the present invention. That is, the computer program when executed by the processor implements: respectively sending messages to each slave device by adopting different links, wherein a first port of each link is positioned in the master device, a second port of each link is positioned in the slave device, and the master device and the slave device are positioned in different networks; when determining that a link does not receive response information of the slave equipment aiming at the message, acquiring current port state information of a first port corresponding to the link in an information maintenance table corresponding to the master equipment; when the current port state information is determined to be the main port state information, determining a target port from a first port corresponding to a link receiving the response information of the message; and updating the current port state information corresponding to the target port to be the main port state information, and switching the link according to the link corresponding to the target port.
Of course, the computer program of the computer-readable storage medium provided in the embodiments of the present invention is not limited to the method operations described above, and may also perform related operations in the link selection control protocol switching method provided in any embodiments of the present invention.
From the above description of the embodiments, it is obvious for those skilled in the art that the present invention can be implemented by software and necessary general hardware, and certainly, can also be implemented by hardware, but the former is a better embodiment in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as a floppy disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a FLASH Memory (FLASH), a hard disk or an optical disk of a computer, and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) to execute the methods according to the embodiments of the present invention.
It should be noted that, in the embodiment of the link selection control protocol switching apparatus, each unit and each module included in the embodiment are only divided according to functional logic, but are not limited to the above division, as long as the corresponding function can be implemented; in addition, specific names of the functional units are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present invention.
It is to be noted that the foregoing description is only exemplary of the invention and that the principles of the technology may be employed. It will be understood by those skilled in the art that the present invention is not limited to the particular embodiments described herein, but is capable of various obvious changes, rearrangements and substitutions as will now become apparent to those skilled in the art without departing from the scope of the invention. Therefore, although the present invention has been described in greater detail by the above embodiments, the present invention is not limited to the above embodiments, and may include other equivalent embodiments without departing from the spirit of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims (11)

1. A method for controlling protocol switching for link selection performed by a master device, comprising:
respectively sending messages to each slave device by adopting different links, wherein a first port of each link is positioned in the master device, a second port of each link is positioned in the slave device, and the master device and the slave device are positioned in different networks;
when determining that a link does not receive response information of the slave equipment aiming at the message, acquiring current port state information of a first port corresponding to the link in an information maintenance table corresponding to the master equipment;
when the current port state information is determined to be the main port state information, determining a target port from a first port corresponding to a link receiving the response information of the message;
and updating the current port state information corresponding to the target port to be the main port state information, and switching the link according to the link corresponding to the target port.
2. The method of claim 1, wherein the port state information comprises: state information of a main port, state information of a standby port and state information of an unavailable port;
when it is determined that the current port state information is the active port state information, determining a target port from a first port corresponding to a link receiving the response information of the packet includes:
when the current port state information is determined to be the active port state information, acquiring a first open port in an open state from a first port corresponding to a link receiving the response information of the message;
and acquiring the port priority of the first open port, and determining the target port according to the port priority of the first open port.
3. The method of claim 2, wherein the obtaining the port priority of the first open port and determining the target port according to the port priority of the first open port comprises:
when one port with the highest priority in the first opening ports exists, directly taking the port with the highest priority as the target port;
and when the number of the highest priority port in the first open ports is more than one, judging the port number corresponding to the highest priority port, and determining the highest priority port with the smallest port number as the target port.
4. The method according to claim 2, further comprising, after the obtaining the current port state information of the first port corresponding to the link, the step of:
and when the current port state information is determined to be the standby port state information, directly updating the current port state information to the unavailable port state information.
5. The method of claim 2, wherein the sending the message to each slave device using different links respectively comprises:
according to the message sending period, a first timer unit is adopted to send heartbeat messages to each slave device through different links, wherein the heartbeat messages are used for detecting the connection state of the links;
and respectively sending broadcast messages to each slave device by adopting different links by adopting a second timer unit according to the message sending period, wherein the broadcast messages are used for acquiring the MAC address of the second port of the link.
6. The method according to claim 5, wherein when it is determined that there is a link that does not receive response information of the slave device for the packet, acquiring, in an information maintenance table corresponding to a master device, current port state information of a first port corresponding to the slave device, includes:
when determining that a link does not receive first response information of the slave equipment aiming at the heartbeat message in the message, acquiring current port state information of a first port corresponding to the link in an information maintenance table corresponding to the master equipment;
and updating the information maintenance table according to the current port state information.
7. The method of claim 5, further comprising:
and when determining that the link does not receive second response information of the slave equipment aiming at the broadcast message, deleting the MAC address of the second port matched with the link in the information maintenance table.
8. The method according to any one of claims 1 to 7, wherein before the sending the message to each slave device using different links, the method further comprises:
configuring Link Selection Control Protocol (LSCP) instances, wherein each LSCP instance is added with a different first port;
determining the port priority, the port type, the port number, the message sending period and the port state aging time of each first port through the LSCP example;
wherein the port type includes at least one of: fiber ports, wireless ports, and microwave ports.
9. A link selection control protocol switching apparatus, executed by a master device, comprising:
a message sending module, configured to send a message to each slave device by using different links, where a first port of the link is located in the master device, a second port of the link is located in the slave device, and the master device and the slave device are located in different networks;
a current port state information obtaining module, configured to, when it is determined that a link does not receive response information of the slave device for the packet, obtain, in an information maintenance table corresponding to the master device, current port state information of a first port corresponding to the link;
a target port determining module, configured to determine a target port from a first port corresponding to a link receiving the response information of the packet when it is determined that the current port state information is the master port state information;
and the link switching module is used for updating the current port state information corresponding to the target port into the main port state information and performing link switching according to the link corresponding to the target port.
10. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, wherein the processor implements the link selection control protocol switching method according to any one of claims 1 to 8 when executing the computer program.
11. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the link selection control protocol switching method according to any one of claims 1 to 8.
CN202211190532.7A 2022-09-28 2022-09-28 Link selection control protocol switching method, device, equipment and medium Pending CN115643202A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211190532.7A CN115643202A (en) 2022-09-28 2022-09-28 Link selection control protocol switching method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211190532.7A CN115643202A (en) 2022-09-28 2022-09-28 Link selection control protocol switching method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN115643202A true CN115643202A (en) 2023-01-24

Family

ID=84941544

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211190532.7A Pending CN115643202A (en) 2022-09-28 2022-09-28 Link selection control protocol switching method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN115643202A (en)

Similar Documents

Publication Publication Date Title
US10003525B2 (en) Methods and apparatus to provide redundancy in a process control system
CN109525445B (en) Link switching method, link redundancy backup network and computer readable storage medium
WO2016165463A1 (en) Software defined network-based link failure reporting method and forwarding device
US20080019265A1 (en) Systems and methods for configuring a network to include redundant upstream connections using an upstream control protocol
US10797986B2 (en) Link discovery method and apparatus
CN109040295B (en) Method and device for determining abnormal disconnection, terminal and storage medium
CN114866365B (en) Arbitration machine election method, device, intelligent equipment and computer readable storage medium
CN111147303B (en) Message processing method, device, network system, electronic equipment and storage medium
CN108055156B (en) AP management method and device
CN111030877A (en) Main/standby equipment switching method and device
KR101075462B1 (en) Method to elect master nodes from nodes of a subnet
US9246796B2 (en) Transmitting and forwarding data
US20100172245A1 (en) Monitoring connectivity in ring networks
CN114244736A (en) Multi-master detection method, equipment and medium based on stacking environment
CN113037798B (en) Multi-gateway communication method, system, electronic device and storage medium
US10659251B2 (en) Ring protection network division
CN115643202A (en) Link selection control protocol switching method, device, equipment and medium
CN115514719A (en) Message sending method, device, switch and readable storage medium
CN115152192B (en) PCE controlled network reliability
US10491421B2 (en) Ring protection network module
CN110224950B (en) Stack system detection system, method, device and computer readable storage medium
CN114401324A (en) Message forwarding method, network equipment and system
CN111698163A (en) OVS-based full-switching network communication method, device and medium
CN115065649B (en) Method, device, equipment and storage medium for determining service message forwarding mode
CN113904980B (en) Channel switching method, device, switch and 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