A link selection control protocol switching method, device, equipment and medium
Through the master device sending messages to the slave device and obtaining port status information, determining and switching the master port, it solves the problem of communication abnormalities in the existing protocol on the port not on the same network, and improves the reliability and effectiveness of communication.
Patent Information
- Application Number
- CN202211190532.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-09-28
- Publication Date
- 2024-12-13
- Estimated Expiration
- 2042-09-28
AI Technical Summary
The existing STP and LACP protocols cannot effectively select the main port when the ports are not on the same network, resulting in communication exceptions.
The master device sends messages to the slave device separately, obtains port status information, determines the master port status information, and performs link switching to ensure communication reliability.
It solves the problem of communication blockage in the ports not in the same device and network, and improves the reliability and effectiveness of communication.
Smart Images

Figure CN115643202B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to network communication technology, and in particular to a link selection control protocol switching method, device, equipment and medium. Background Art
[0002] The current standard spanning tree technology can prevent layer 2 loops in the network. After STP (Spanning-tree Protocol) is running, if there is a loop in the network, STP will break the loop by blocking specific interfaces, and converge in time when the network topology changes to ensure network redundancy. When the topology changes, the spanning tree protocol can detect these changes and automatically adjust the interface status in time to adapt to the changes in the network topology and achieve link redundancy.
[0003] Currently, LACP (Link Aggregation Control Protocol) is a protocol based on the IEEE802.3ad standard that implements dynamic link aggregation and deaggregation, so that devices can automatically form aggregated links and start sending and receiving data on aggregated links according to their own configurations. The LACP mode is a link aggregation mode that uses LACP. After the aggregated link is formed, LACP is responsible for maintaining the link status and automatically adjusting the link aggregation when the aggregation conditions change.
[0004] In the process of implementing the present invention, the inventors found that the defects of the prior art are: if the ports in the networking environment are not in the same network, STP cannot select only one port for data transmission among all the ports that are not in the same network. If LACP is used for communication, one end of the aggregated physical port can only belong to one device, and the remaining ports cannot be set to an unavailable state. At present, the existing protocol cannot be implemented in the scenario where one end of all ports is not in the same device or the same network, and communication abnormalities are prone to occur. Summary of the invention
[0005] The embodiments of the present invention provide a link selection control protocol switching method, device, equipment and medium to improve the reliability and effectiveness of communication.
[0006] In a first aspect, an embodiment of the present invention provides a link selection control protocol switching method, which is performed by a master device, wherein the method includes:
[0007] Sending messages to each slave device using different links, wherein a first port of the link is located at the master device, a second port of the link is located at the slave device, and the master device and the slave device are located in different networks;
[0008] When it is determined that there is a link that has not received response information from the slave device for the message, obtaining current port status information of the first port corresponding to the link in the information maintenance table corresponding to the master device;
[0009] When it is determined that the current port status information is the active port status information, determining the target port from the first port corresponding to the link that receives the response information of the message;
[0010] The current port status information corresponding to the target port is updated as the active port status information, and link switching is performed according to the link corresponding to the target port.
[0011] In a second aspect, an embodiment of the present invention provides a link selection control protocol switching device, which is executed by a master device, and the link selection control protocol switching device includes:
[0012] A message sending module, used to send messages to each slave device using different links, wherein the first port of the link is located at the master device, the second port of the link is located at the slave device, and the master device and the slave device are located in different networks;
[0013] A current port status information acquisition module, configured to acquire the current port status information of the first port corresponding to the link from the information maintenance table corresponding to the master device when it is determined that there is a link that has not received the response information of the slave device to the message;
[0014] A target port determination module, configured to determine a target port from a first port corresponding to a link receiving response information of the message when determining that the current port status information is active port status information;
[0015] The link switching module is used to update the current port status information corresponding to the target port to the active port status information, and perform link switching according to the link corresponding to the target port.
[0016] In a third aspect, an embodiment of the present invention further provides a computer device, comprising a storage device, one or more processors, and a computer program stored in the memory and executable on the processor, wherein when the one or more processors execute the computer program, the link selection control protocol switching method as described in any embodiment of the present invention is implemented.
[0017] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, wherein when the computer program is executed by a processor, the link selection control protocol switching method as described in any embodiment of the present invention is implemented.
[0018] The technical solution provided by the embodiment of the present invention uses different links to send messages to each slave device respectively; when it is determined that there is a link that has not received the response information of the slave device to the message, the current port status information of the first port corresponding to the link is obtained in the information maintenance table corresponding to the master device; when it is determined that the current port status information is the main port status information, the target port is determined from the first port corresponding to the link that received the response information of the message; the current port status information corresponding to the target port is updated to the main port status information, and the link is switched according to the link corresponding to the target port. Through the above method, the problem of port blockage caused by the other end of all ports of the master device not being in the same device and not being in the same network for communication is solved, the abnormal communication caused by the blocking of the communication port is avoided, and the reliability and effectiveness of communication are improved. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] Figure 1a is a flow chart of a link selection control protocol switching method provided by Embodiment 1 of the present invention;
[0020] Figure 1b It is a structural diagram of a specific LSCP configuration instance in the method provided in the first embodiment of the present invention;
[0021] Figure 2a is a flow chart of another link selection control protocol switching method provided by Embodiment 2 of the present invention;
[0022] Figure 2b It is a structural diagram of the port status information conversion of the first port in the method provided in the second embodiment of the present invention;
[0023] Figure 3 It is a structural schematic diagram of a link selection control protocol switching device provided in Embodiment 3 of the present invention;
[0024] Figure 4 It is a structural diagram of a computer device provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION
[0025] The embodiments of the present invention are further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the embodiments of the present invention, rather than to limit the embodiments of the present invention. It is also necessary to explain that, for ease of description, only parts related to the embodiments of the present invention are shown in the accompanying drawings, rather than all structures.
[0026] Embodiment 1
[0027] Figure 1aA flowchart of a link selection control protocol switching method provided in Embodiment 1 of the present invention. This embodiment is applicable to a plurality of slave devices associated with a master device, and the master device and the slave devices do not communicate in the same network. The method of this embodiment can be executed by a link selection control protocol switching device, which can be implemented by software and / or hardware, and can generally be executed by a master device.
[0028] Accordingly, the method specifically comprises the following steps:
[0029] S110, sending messages to each slave device using different links.
[0030] The first port of the link is located at the master device, the second port of the link is located at the slave device, and the master device and the slave device are located in different networks.
[0031] Specifically, a master device has multiple ports, and the port on the master device is a first port. Each first port can be connected to a second port corresponding to a different slave device. The line 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 to send messages.
[0032] Optionally, before sending messages to each slave device using different links respectively, it also includes: configuring a link selection control protocol LSCP instance, adding different first ports to each LSCP instance; determining the port priority, port type, port number, message sending cycle, and port status aging time of each first port through the LSCP instance; wherein the port type includes at least one of the following: optical fiber port, wireless port, and microwave port.
[0033] Among them, LSCP (Link selection control protocol) is a link selection control protocol, which can be a point-to-point communication, in which the sender and the receiver determine the necessary information in the data transmission by sending LSCP packets. The port priority can be the priority level of the first port. The port type can be a type that describes the first port, which can include a fiber port, a wireless port, and a microwave port. The port status aging time can be the time that the first port is allowed to not receive a response message. The fiber port can be a physical interface for connecting a fiber optic cable, the wireless port can be a physical interface for connecting a wireless cable, and the microwave port can be a physical interface for connecting a microwave cable.
[0034] Exemplarily, before sending messages to each slave device using different links, an LSCP instance needs to be configured.
[0035] like Figure 1bThe figure shows a structural diagram of a specific configuration LSCP instance. Specifically, it can be determined that the master device is device A, and there are three first ports (first port 1, first port 2, and first port 3) on device A, which are respectively connected to three slave devices (device B, device C, and device D). It can be further known that the first port 1 of device A and the second port of device B are connected by link 1; the first port 2 of device A and the second port of device C are connected by link 2; the first port 3 of device A and the second port of device D are connected by link 3. It can be set that device A is located in network A, and devices B, C, and D are located in network B, and network A and network B do not belong to the same network.
[0036] Correspondingly, the priority of the first port 1 connected to device B can be set to the first priority, the port type is an optical fiber port, and the port number is 1; the priority of the first port 2 connected to device C can be set to the 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 device D can be set to the third priority, the port type is a microwave port, and the port number is 3. Set the message sending period of device A to 1s and the port status aging time to 3s. Among them, the first priority is higher than the second priority, and the second priority is higher than the third priority.
[0037] The advantage of such a setting is that by configuring the LSCP instance to further determine the ports, links and other information of the master device and its multiple slave devices, the priority, port type and port number and other information of the first ports of other slave devices connected to the master device can be determined more clearly, so that the specific information of each first port can be determined more accurately, and the link switching can be performed more accurately.
[0038] Optionally, the sending of messages to each slave device using different links includes: using a first timer unit to send a heartbeat message to each slave device using different links according to the message sending period, wherein the heartbeat message is used to detect the connectivity status of the link; using a second timer unit to send a broadcast message to each slave device using different links according to the message sending period, wherein the broadcast message is used to obtain a MAC (Media Access Control Address) address of the second port of the link.
[0039] Among them, the message sending cycle can be a fixed time interval for the master device to send messages. The first timer unit can be a unit that sends heartbeat messages regularly according to the message sending cycle. The heartbeat message can be a string of information sent once to indicate the operating status of the network storage, and is sent in a broadcast or unicast manner of the user datagram protocol. The sending method and the interval between sending of the heartbeat message can be set by the user during the LSCP instance configuration process. The second timer can be a unit that sends broadcast messages regularly according to the message sending cycle. The broadcast message can be a data packet sent by the master device to multiple links, and the MAC address of the second port of the link can be obtained. The MAC address of the second port can be an address used to confirm the location of the target slave device corresponding to the second port. The MAC address is used to uniquely identify a network card in the network. If a device has one or more network cards, each network card needs and will have a unique MAC address.
[0040] Preferably, the sending periods of the first timer and the second timer may be the same or different.
[0041] Continuing with the previous example, according to the LSCP instance configured above, it can be assumed that device A uses the first timer unit to send heartbeat messages to device B, device C, and device D using different links according to the message sending cycle, that is, device A uses link 1 to send a heartbeat message to device B, device A uses link 2 to send a heartbeat message to device C, and device A uses link 3 to send a heartbeat message to device D. When device B, device C, and device D receive the heartbeat message, they can reply to the heartbeat message, so device A can determine the connectivity status of the link.
[0042] Similarly, assume that device A uses the second timer unit to send broadcast messages to device B, device C, and device D using different links according to the message sending cycle, that is, device A uses link 1 to send broadcast messages to device B, device A uses link 2 to send broadcast messages to device C, and device A uses link 3 to send broadcast messages to device D. When devices B, C, and D receive the broadcast messages, they can reply to the broadcast messages, so device A can determine the MAC address of the second port of the link.
[0043] The advantage of this arrangement is that the master device sends heartbeat messages and broadcast messages to each slave device using different links, so as to determine the connectivity status of each link and the MAC address of the second port of the link. This allows the master device to more accurately determine the specific conditions of each link, so that the information maintenance table corresponding to the master device can be updated in a timely manner, and it is also convenient for the master device to more accurately query the information maintenance table.
[0044] S120: When it is determined that there is a link that has not received response information from the slave device to the message, obtain current port status information of the first port corresponding to the link from the information maintenance table corresponding to the master device.
[0045] The information maintenance table may be a maintenance table stored in the master device and used to describe relevant information between the master device and each slave device.
[0046] Specifically, the master device is used to record the port status information and MAC address of the first port associated with each slave device, as well as the link status information associated with each slave device. When the port status information corresponding to the master device and each slave device changes, the information maintenance table needs to be updated.
[0047] The port status information may be information describing the port status of the first port. Specifically, the port status information may include active port status information, standby port status information, and unavailable port status information.
[0048] Among them, the main port status information can be the status of the port with the highest priority among all the first ports of the main device, which is a transmission port and can be used for receiving and sending data messages and protocol messages. The standby port status information can be the status of the port with a non-highest priority among all the first ports of the main device, which is a blocked port and is only used for receiving and sending protocol messages. The unavailable port status information can be the port that has not received a heartbeat message or a broadcast message response among all the first ports of the main device, which is a blocked port and can only be used for receiving protocol messages. The response information can be the message response information for responding to the received heartbeat message and broadcast message.
[0049] Continuing with the previous example, when device A uses link 1 to send heartbeat messages and broadcast messages to device B, device A uses link 2 to send heartbeat messages and broadcast messages to device C, and device A uses link 3 to send heartbeat messages and broadcast messages to device D.
[0050] It can be assumed that link 1 corresponding to device A has not received the response information of the corresponding slave device to the message, that is, link 1 has not received the response information of device B. However, link 2 has received the response information of device C, and link 3 has received the response information of device D.
[0051] Furthermore, since link 1 does not receive the response information from device B, the current port status information of the first port corresponding to link 1 can be obtained from the information maintenance table corresponding to the master device.
[0052] Optionally, when it is determined that there is a link that has not received response information from the slave device to the message, the current port status information of the first port corresponding to the slave device is obtained in the information maintenance table corresponding to the master device, including: when it is determined that there is a link that has not received the first response information from the slave device to the heartbeat message in the message, the current port status information of the first port corresponding to the link is obtained in the information maintenance table corresponding to the master device; and the information maintenance table is updated according to the current port status information.
[0053] The first response information may be a heartbeat message sent by the master device and received by the slave device. The slave device responds to the heartbeat message, and the master device can receive reply information of the heartbeat message from the slave device.
[0054] Specifically, the sending time of the heartbeat message is used to count the time when the heartbeat message is sent from the master device. When the time difference between the sending time of the heartbeat message and the time when the reply message is currently received is less than or equal to the port state aging time, it can be determined that the master device can send messages normally with the slave device corresponding to the link. When the time difference between the sending time of the heartbeat message and the time when the reply message is currently received is greater than the port state aging time, it can be determined that the master device cannot send messages normally with the slave device corresponding to the link.
[0055] Continuing with the previous example, assume that link 1 does not receive the first response information about the heartbeat message from device B, that is, device A does not receive the first response information. Further, in the information maintenance table corresponding to the master device, the current port status information of the first port 1 corresponding to link 1 is obtained, assuming that the current port status information obtained is the master port status information. Since the first port 1 corresponding to link 1 does not receive the first response information, the current port status information of the first port 1 is converted from the master port status information to the unavailable port status information, and the information maintenance table is updated.
[0056] The advantage of this setting is that when it is determined that the link has not received the first response information, the current port status information of the first port corresponding to the link is obtained, and the information maintenance table is updated. Since the first response information is fed back to the heartbeat message, the link quality can be accurately judged, so that the link that needs to be switched can be more accurately determined through the judgment of the link quality, and the information maintenance table can be updated more accurately and timely.
[0057] Optionally, the method further includes: when it is determined that the link has not received the second response information of the slave device to the broadcast message, deleting the MAC address of the second port matching the link in the information maintenance table.
[0058] 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 broadcast message from the slave device.
[0059] In this embodiment, when the master device sends a broadcast message to each slave device, the slave device does not reply the second response information to the master device, indicating that the slave device may be in a fault state at this time, and the second port corresponding to the slave device is in a blocked state, so it is necessary to delete the MAC address of the second port matched by the slave device in the information maintenance table associated with the master device. When the master device sends a broadcast message to each slave device again, if the slave device replies with the second response information, the MAC address of the second port is directly stored. In this way, the MAC address of the second port can be determined timely and accurately according to the information maintenance table, avoiding unnecessary MAC address information maintenance.
[0060] Continuing with the previous example, assume that link 1 does not receive the second response information of device B regarding the broadcast message, that is, device A does not receive the second response information. Further, since the first port 1 corresponding to link 1 does not receive the second response information, the MAC address of the second port matching link 1 in the information maintenance table is deleted.
[0061] The advantage of this setting is that when it is determined that the link has not received the second response information, the MAC address of the second port matching the link in the information maintenance table is deleted, so that the information maintenance table can be updated more accurately and timely, avoiding unnecessary MAC address information maintenance.
[0062] S130: When it is determined that the current port status information is the active port status information, a target port is determined from a first port corresponding to a link that receives response information of the message.
[0063] In this embodiment, if it is determined that the link has not received the response information of the slave device to the message, the current port status information of the first port corresponding to the link is obtained in the information maintenance table corresponding to the master device as the main port status information. It can be understood that among the first ports corresponding to the master device, the first port of the main port status information has a fault, so it is necessary to re-determine the target port among the first ports corresponding to the link that received the response information of the message.
[0064] Continuing with the previous example, since link 1 corresponding to device A did not receive the response information from the corresponding slave device for the message, link 1 did not receive the response information from device B (that is, first port 1 did not receive the response information). However, link 2 received the response information from device C, and link 3 received the response information from device D (that is, first port 2 and first port 3 received the response information).
[0065] It is understandable that the fault occurs in the first port 1 corresponding to device A. Since the first port 2 and the first port 3 have received the response information and no fault occurs, the target port needs to be determined in the first port 2 and the first port 3.
[0066] S140: Update the current port status information corresponding to the target port to the active port status information, and perform link switching according to the link corresponding to the target port.
[0067] In this embodiment, after the target port is determined, the current port status information of the target port needs to be updated and updated to the main port status information, and the link is switched, and the link corresponding to the target port is updated to the main link. The main link can be used to send data packets and protocol packets.
[0068] Continuing with the previous example, assume 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, the standby port status information corresponding to the first port 2 needs to be updated to the active port status information, and the link 2 corresponding to the first port 2 needs to be switched.
[0069] Optionally, after acquiring the current port status information of the first port corresponding to the link, the method further includes: when it is determined that the current port status information is the standby port status information, directly updating the current port status information to the unavailable port status information.
[0070] In this embodiment, it is assumed that the current port status information is determined to be the backup port status information, that is, for the main device, the port status information of the first port where the fault occurs is the backup port status information, so there is no need to perform link switching processing, and the current port status information can be directly updated to the unavailable port status information.
[0071] In addition, when the next cycle arrives, the master device sends heartbeat messages and broadcast messages, and still needs to send messages to the first port whose port status information is unavailable, which can be used to detect link quality and obtain MAC addresses. After receiving the response information, the port status information needs to be updated in the information maintenance table.
[0072] The advantage of such a setting is that by determining that the current port status information is the standby port status information, the current port status information is directly updated to the unavailable port status information. Since the current port status information of the first port that fails is the standby port status information, there is no need to perform link switching, and the port status information can be directly updated in the information maintenance table, thereby improving the reliability of communication.
[0073] The technical solution provided by the embodiment of the present invention uses different links to send messages to each slave device respectively; when it is determined that there is a link that has not received the response information of the slave device to the message, the current port status information of the first port corresponding to the link is obtained in the information maintenance table corresponding to the master device; when it is determined that the current port status information is the main port status information, the target port is determined from the first port corresponding to the link that received the response information of the message; the current port status information corresponding to the target port is updated to the main port status information, and the link is switched according to the link corresponding to the target port. Through the above method, the problem of port blockage caused by the other end of all ports of the master device not being in the same device and not being in the same network for communication is solved, the abnormal communication caused by the blocking of the communication port is avoided, and the reliability and effectiveness of communication are improved.
[0074] Embodiment 2
[0075] Figure 2a A flowchart of another link selection control protocol switching method provided in Embodiment 2 of the present invention. This embodiment is refined based on the above embodiments. In this embodiment, when the current port status information is determined to be the active port status information, the target port is further refined from the first port corresponding to the link that receives the response information of the message.
[0076] Accordingly, the method specifically comprises the following steps:
[0077] S210 , sending messages to each slave device using different links.
[0078] S220: When it is determined that there is a link that has not received response information from the slave device to the message, obtain current port status information of the first port corresponding to the link from the information maintenance table corresponding to the master device.
[0079] S230: When it is determined that the current port status information is the active port status information, obtaining a first open port in an open state from the first ports corresponding to the link that receives the response information of the message.
[0080] The first open port may be a first port describing a physical switch in an open state. 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 a first port in which the physical switch is in a closed state.
[0081] Continuing with the previous example, since the first port 1 corresponding to device A has a fault, the first port 1 of the active port status information needs to be switched, and the target port needs to be re-determined. Since the first port 2 and the first port 3 have received the response information and no fault has occurred, the target port needs to be determined between the first port 2 and the first port 3.
[0082] Assume that the first port 2 is in an open state, which is the first open port; and the first port 3 is in a closed state, which is the first closed state. Therefore, the first open port obtained is the first port 2.
[0083] In addition, assuming that the first port 2 is in an open state, and is the first open port; the first port 3 is also in an open state, and is the first open port. Therefore, the first open ports obtained are the first port 2 and the first port 3.
[0084] S240: Obtain the port priority of the first open port, and determine the target port according to the port priority of the first open port.
[0085] In this embodiment, in the first port corresponding to the link that has completed the response information of being able to receive the message, it is necessary to determine whether the first port is in an open state or a closed state. If it is in an open state, the first port is a first open port; if it is in a 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.
[0086] Furthermore, the size of 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.
[0087] Continuing with the previous example, assuming that the first open ports are determined to be the first port 2 and the first port 3, it is necessary to obtain the port priorities corresponding to the first port 2 and the first port 3. The target port is determined according to the port priorities.
[0088] Optionally, 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 there is one highest priority port among the first open ports, directly using the highest priority port as the target port; when the highest priority port among the first open ports is greater 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.
[0089] The highest priority port may be the port with the highest priority selected from the first open port. The port number may be the port number of the current port connected to the master device. The smaller the port number, the greater the possibility of selecting the current port as the master port.
[0090] Continuing with the previous example, according to the LSCP instance configured above, we can know that: the port priority of the first port 1 connected to device B can be set to the first priority, the port type is a fiber port, and the port number is 1; the port priority of the first port 2 connected to device C can be set to the second priority, the port type is a fiber port, and the port number is 2; the port priority of the first port 3 connected to device D can be set to the third priority, the port type is a microwave port, and the port number is 3. Set the message sending period of device A to 1s and the port status aging time to 3s. Among them, the first priority is higher than the second priority, and the second priority is higher than the third priority.
[0091] Since it is determined that the first open ports are the first port 2 and the first port 3, it is necessary to obtain the port priorities corresponding to the first port 2 and the first port 3. Since the port priority of the first port 2 is the second priority and 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.
[0092] In this case, since there is one highest priority port in the first open port, namely, the first port 2, the first port 2 is directly used as the target port. In addition, since the port type of the first port 1 connecting device A and device B is a fiber port, the first port 2 needs to be used as the target port, that is, the first port 2 is set to the main port state, and the port type of the first port 2 is also a fiber port, so there is no need to modify the relevant frame header of the message.
[0093] In addition, if the port type changes, it is necessary to add relevant frame headers when sending messages. For example, when wireless communication equipment performs link switching under the LSCP protocol, if the first port 3 (port type is a microwave port) is selected as the main port, special processing is required, such as adding special fields to the message.
[0094] In another optional embodiment of the present embodiment, it is assumed that the configuration of the LSCP instance is modified as follows: the port priority of the first port 2 connected to device C is the second priority, the port type is a fiber port, and the port number is 2; the port priority of the first port 3 connected to device D is the second priority, the port type is a microwave port, and the port number is 3.
[0095] Since in this case, the first port 2 and the first port 3 are both in the second priority, it can be determined that the number of the highest priority ports is greater than one, so it is necessary to obtain the port numbers corresponding to the first port 2 and the first port 3. It can be obtained that the port number corresponding to the first port 2 is 2; the port number corresponding to the first port 3 is 3, and the highest priority port with the smallest port number can be determined as the target port, that is, the first port 2 is set as the target port.
[0096] The advantage of this setting is that by determining the target port more accurately based on the port priority and port number of the first open port, the link can be switched and the information maintenance table can be updated based on the determined target port. This can more effectively solve the problem of port congestion caused by the other ends of all ports of the main device not being in the same device or communicating on the same network.
[0097] S250: Update the current port status information corresponding to the target port to the active port status information, and perform link switching according to the link corresponding to the target port.
[0098] like Figure 2b As shown, it is a schematic diagram of the conversion of the port status information of the first port. If the port status information of the first port is the main port status 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 a message within the port status aging time, then it is necessary to update the main port status information of the first port to unavailable port status information. In addition, when reconfiguring the LSCP instance, setting the priority of a first open port among other first open ports to be higher than the target first port (it is known that the port status information of the target first port is the main port status information in the previous instance configuration), then it is necessary to update the main port status information of the target first port to the backup port status information.
[0099] If the port status information of the first port is the standby port status information, because the first port is in a closed state, or the first port does not receive a message within the port status aging time, the standby port status information of the first port needs to be updated to the unavailable port status information. In addition, when reconfiguring the LSCP instance, the priority of the target first port is set to be the highest (it is known that the port status information of the target first port is the standby port status information in the previous instance configuration), then the standby port status information of the target first port needs to be updated to the active port status information.
[0100] If the port status of the first port is unavailable port status information, since the first port is currently in an open state (that is, the first port is the first open port) and has the highest port priority, the unavailable port status information of the first port needs to be updated to the main port status information. In addition, since the first port is currently in an open state but does not have the highest port priority, the unavailable port status information of the first port needs to be updated to the standby port status information.
[0101] The technical solution provided by the embodiment of the present invention uses different links to send messages to each slave device respectively; when it is determined that there is a link that has not received the response information of the slave device to the message, the current port status information of the first port corresponding to the link is obtained in the information maintenance table corresponding to the master device; when it is determined that the current port status information is the main port status information, the first open port in the first port that is in the open state is obtained from the first port corresponding to the link that receives the response information of the message; the port priority of the first open port is obtained, and the target port is determined according to the port priority of the first open port; the current port status information corresponding to the target port is updated to the main port status information, and the link is switched according to the link corresponding to the target port. It avoids the situation that when the physical port of the first port is in the closed state, it cannot communicate effectively, and solves the problem of how to select the target port. The target port can be determined more accurately, and the port status information is updated and the link switching process is performed according to the target port, thereby improving the reliability and effectiveness of communication.
[0102] Embodiment 3
[0103] Figure 3 1 is a schematic diagram of the structure of a link selection control protocol switching device provided in the third embodiment of the present invention. The link selection control protocol switching device provided in this embodiment can be implemented by software and / or hardware, and the device can generally be executed by a master device. It can be configured in a server to implement a link selection control protocol switching method in the embodiment of the present invention. Figure 3 As shown, the device may specifically include: a message sending module 310 , a current port status information acquisition module 320 , a target port determination module 330 and a link switching module 340 .
[0104] The message sending module 310 is used to send messages to each slave device using different links, wherein the first port of the link is located at the master device, the second port of the link is located at the slave device, and the master device and the slave device are located in different networks;
[0105] The current port status information acquisition module 320 is used to acquire the current port status information of the first port corresponding to the link from the information maintenance table corresponding to the master device when it is determined that there is a link that has not received the response information of the slave device to the message;
[0106] The target port determination module 330 is used to determine the target port from the first port corresponding to the link receiving the response information of the message when determining that the current port status information is the active port status information;
[0107] The link switching module 340 is used to update the current port status information corresponding to the target port to the active port status information, and perform link switching according to the link corresponding to the target port.
[0108] The technical solution provided by the embodiment of the present invention uses different links to send messages to each slave device respectively; when it is determined that there is a link that has not received the response information of the slave device to the message, the current port status information of the first port corresponding to the link is obtained in the information maintenance table corresponding to the master device; when it is determined that the current port status information is the main port status information, the target port is determined from the first port corresponding to the link that received the response information of the message; the current port status information corresponding to the target port is updated to the main port status information, and the link is switched according to the link corresponding to the target port. Through the above method, the problem of port blockage caused by the other end of all ports of the master device not being in the same device and not being in the same network for communication is solved, the abnormal communication caused by the blocking of the communication port is avoided, and the reliability and effectiveness of communication are improved.
[0109] On the basis of the above embodiments, the port status information includes: active port status information, standby port status information and unavailable port status information. The target port determination module 330 may specifically include: a first open port acquisition unit, which is used to, when determining that the current port status information is the active port status information, acquire the first open port in the first port corresponding to the link receiving the response information of the message, which is in an open state; a target port determination unit, which is used to acquire the port priority of the first open port, and determine the target port according to the port priority of the first open port.
[0110] Based on the above embodiments, the target port determination unit can be specifically used to: when there is one highest priority port among the first open ports, directly use the highest priority port as the target port; when the highest priority port among the first open ports is greater than one, determine the port number corresponding to the highest priority port, and determine the highest priority port with the smallest port number as the target port.
[0111] On the basis of the above embodiments, it also includes a current port status information updating unit, which can be specifically used to: after obtaining the current port status information of the first port corresponding to the link, when it is determined that the current port status information is the backup port status information, directly update the current port status information to the unavailable port status information.
[0112] On the basis of the above embodiments, the message sending module can be specifically used for: a heartbeat message sending module, which is used to use a first timer unit to send heartbeat messages to each slave device using different links according to the message sending period, wherein the heartbeat message is used to detect the connectivity status of the link; a broadcast message sending module, which is used to use a second timer unit to send broadcast messages to each slave device using different links according to the message sending period, wherein the broadcast message is used to obtain the media access control address MAC address of the second port of the link.
[0113] Based on the above embodiments, the current port status information acquisition module 320 can be specifically used for: when it is determined that there is a link that has not received the first response information from the slave device to the heartbeat message in the message, obtaining the current port status information of the first port corresponding to the link in the information maintenance table corresponding to the master device; and updating the information maintenance table according to the current port status information.
[0114] On the basis of the above embodiments, it can also be specifically used for: when it is determined that the link has not received the second response information of the slave device to the broadcast message, the media access control address MAC address of the second port matching the link in the information maintenance table is deleted.
[0115] On the basis of the above embodiments, it also includes an LSCP instance configuration module, which can also be specifically used to: before sending messages to each slave device using different links respectively, configure a link selection control protocol LSCP instance, and add different first ports to each LSCP instance; determine the port priority, port type, port number, message sending cycle, and port status aging time of each first port through the LSCP instance; wherein the port type includes at least one of the following: optical fiber port, wireless port, and microwave port.
[0116] The above-mentioned link selection control protocol switching device can execute the link selection control protocol switching method provided by any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0117] Embodiment 4
[0118] Figure 4is a structural diagram of a computer device provided by Embodiment 4 of the present invention. Figure 4 As shown, the device includes a processor 410, a memory 420, an input device 430, and an output device 440; the number of processors 410 in the device can be one or more. Figure 4 A processor 410 is taken as an example; the processor 410, memory 420, input device 430 and output device 440 in the device can be connected via a bus or other means. Figure 4 The example of connecting through bus is taken in the following.
[0119] The memory 420, as a computer-readable storage medium, 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 an embodiment of the present invention (for example, the message sending module 310, the current port status information acquisition module 320, the target port determination module 330 and the link switching module 340). The processor 410 executes various functional applications and data processing of the device by running the software programs, instructions and modules stored in the memory 420, that is, implements the above-mentioned link selection control protocol switching method, which includes: sending messages to each slave device using 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; when it is determined that there is a link that has not received the response information of the slave device to the message, in the information maintenance table corresponding to the master device, the current port status information of the first port corresponding to the link is obtained; when it is determined that the current port status information is the main port status information, the target port is determined from the first port corresponding to the link that receives the response information of the message; the current port status information corresponding to the target port is updated to the main port status information, and the link is switched according to the link corresponding to the target port.
[0120] 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 required for at least one function; the data storage area may store data created according to the use of the terminal, etc. In addition, the memory 420 may include a high-speed random access memory, and may also include a non-volatile memory, such as at least one disk storage device, a flash memory device, or other non-volatile solid-state storage device. In some instances, the memory 420 may further include a memory remotely arranged relative to the processor 410, and these remote memories may be connected to the device via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0121] The input device 430 may be used to receive input digital or character information and generate key signal input related to user settings and function control of the device. The output device 440 may include a display device such as a display screen.
[0122] Embodiment 5
[0123] Embodiment 5 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 method described in any embodiment of the present invention is implemented. Of course, a computer-readable storage medium provided by an embodiment of the present invention can execute a link selection control protocol switching method provided by any embodiment of the present invention. That is, when the computer program is executed by a processor, it is implemented: sending messages to each slave device using 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; when it is determined that there is a link that has not received the response information of the slave device for the message, in the information maintenance table corresponding to the master device, the current port status information of the first port corresponding to the link is obtained; when it is determined that the current port status information is the main port status information, the target port is determined from the first port corresponding to the link that receives the response information of the message; the current port status information corresponding to the target port is updated to the main port status information, and the link is switched according to the link corresponding to the target port.
[0124] Of course, the computer program of a computer-readable storage medium provided by an embodiment of the present invention is not limited to the method operations described above, but can also execute related operations in the link selection control protocol switching method provided by any embodiment of the present invention.
[0125] Through the above description of the implementation methods, the technicians in the relevant field can clearly understand that the present invention can be implemented by means of software and necessary general hardware, and of course it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as a computer floppy disk, a read-only memory (ROM), a random access memory (RAM), a flash memory (FLASH), a hard disk or an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment of the present invention.
[0126] It is worth noting that in the embodiment of the above-mentioned link selection control protocol switching device, the various units and modules included are only divided according to functional logic, but are not limited to the above-mentioned division, as long as the corresponding functions can be achieved; in addition, the specific names of the functional units are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of the present invention.
[0127] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. A link selection control protocol switching method, executed by a master device, characterized in that: include: Sending messages to each slave device using different links, wherein a first port of the link is located at the master device, a second port of the link is located at the slave device, and the master device and the slave device are located in different networks; When it is determined that there is a link that has not received response information from the slave device for the message, obtaining current port status information of the first port corresponding to the link in the information maintenance table corresponding to the master device, wherein the information maintenance table is stored in the master device and is a maintenance table for describing relevant information of the master device and each slave device; When it is determined that the current port status information is the active port status information, a target port is determined from a first port corresponding to a link that receives response information of the message; Updating the current port status information corresponding to the target port to the active port status information, and performing link switching according to the link corresponding to the target port; The sending of messages to each slave device using different links respectively includes: Using a first timer unit to send heartbeat messages to each slave device using different links according to the message sending period, wherein the heartbeat messages are used to detect the connectivity status of the links; Using a second timer unit to send broadcast messages to each slave device using different links according to the message sending cycle, wherein the broadcast message is used to obtain a media access control address MAC address of the second port of the link; The method further comprises: When it is determined that the link has not received the second response information of the slave device to the broadcast message, the media access control address MAC address of the second port matching the link in the information maintenance table is deleted, wherein the second response information is that the slave device receives the broadcast message sent by the master device, the slave device responds to the broadcast message, and the master device receives the reply information of the broadcast message of the slave device.
2. The method according to claim 1, characterized in that: The port status information includes: active port status information, standby port status information and unavailable port status information; When the current port status information is determined to be the active port status information, determining the target port from the first port corresponding to the link receiving the response information of the message includes: 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 the first port corresponding to the link receiving the response information of the message; The port priority of the first open port is obtained, and the target port is determined according to the port priority of the first open port.
3. The method according to claim 2, characterized in that: 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 there is one highest priority port among the first open ports, directly use the highest priority port as the target port; When there is more than one highest priority port in the first open ports, the port numbers corresponding to the highest priority ports are determined, and the highest priority port with the smallest port number is determined as the target port.
4. The method according to claim 2, characterized in that: After acquiring the current port status information of the first port corresponding to the link, the method further includes: When it is determined that the current port status information is the standby port status information, the current port status information is directly updated to the unavailable port status information.
5. The method according to claim 1, characterized in that When it is determined that there is a link that does not receive response information of the slave device to the message, obtaining the current port status information of the first port corresponding to the slave device in the information maintenance table corresponding to the master device includes: When it is determined that there is a link that has not received the first response information of the slave device to the heartbeat message in the message, obtaining the current port status information of the first port corresponding to the link in the information maintenance table corresponding to the master device; The information maintenance table is updated according to the current port status information.
6. The method according to any one of claims 1 to 5, characterized in that: Before sending the messages to the slave devices respectively using different links, the method further includes: Configure a link selection control protocol LSCP instance, and add a different first port to each LSCP instance; Determine the port priority, port type, port number, message sending period, and port status aging time of each of the first ports through the LSCP instance; The port type includes at least one of the following: a fiber optic port, a wireless port, and a microwave port.
7. A link selection control protocol switching device, executed by a master device, characterized in that: include: A message sending module, used to send messages to each slave device using different links, wherein the first port of the link is located at the master device, the second port of the link is located at the slave device, and the master device and the slave device are located in different networks; A current port status information acquisition module, used for, when it is determined that there is a link that has not received response information from the slave device to the message, acquiring the current port status information of the first port corresponding to the link from the information maintenance table corresponding to the master device, wherein the information maintenance table is stored in the master device and is a maintenance table used to describe the information related to the master device and each slave device; A target port determination module, configured to determine a target port from a first port corresponding to a link receiving response information of the message when determining that the current port status information is active port status information; A link switching module, used to update the current port status information corresponding to the target port to the active port status information, and perform link switching according to the link corresponding to the target port; Wherein, the message sending module is specifically used for: a heartbeat message sending module, which is used to use a first timer unit to send heartbeat messages to each slave device using different links according to the message sending cycle, wherein the heartbeat message is used to detect the connectivity status of the link; a broadcast message sending module, which is used to use a second timer unit to send broadcast messages to each slave device using different links according to the message sending cycle, wherein the broadcast message is used to obtain the media access control address MAC address of the second port of the link; The device is also specifically used for: when it is determined that the link has not received the second response information of the slave device to the broadcast message, deleting the media access control address MAC address of the second port matching the link in the information maintenance table, wherein the second response information is that the slave device receives the broadcast message sent by the master device, the slave device responds to the broadcast message, and the master device receives the reply information of the broadcast message of the slave device.
8. A computer device comprising a memory, a processor and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the computer program, the link selection control protocol switching method according to any one of claims 1 to 6 is implemented.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the link selection control protocol switching method according to any one of claims 1 to 6 is implemented.
