[0015] The method of the present invention will be further described below in conjunction with the accompanying drawings and embodiments.
[0016] figure 1 The process shown is as follows: first, the topology information collection device sends a topology information collection request message from the local node to the adjacent node according to its adjacent node information. The request message contains a field for limiting the number of message forwarding times, and the following steps are repeated: operate:
[0017] The node receiving the request message returns a response message containing the information of the node and the connection information between the node and the adjacent node to the topology information collection device;
[0018] Determine whether the number of packet forwarding times reaches the limit value, if yes, end the operation; if not, continue the following processing;
[0019] The node that receives the request message forwards the request message to all its adjacent nodes. The field that limits the number of message forwarding is to control the scope of topology collection. It can be an integer. After the initial value is set, each device will decrement this field by 1 when forwarding the request message. When the field value is 0, the request will no longer be forwarded. message.
[0020] The request message may include a source path field for recording the sending order of the messages, and the response message may include a response path field for determining the sending order of the messages, and each time the request message is sent, the node The device ID of the device is written into the source path field, and the response path field is reversely obtained from the corresponding source path field. The path is the sequence of device IDs of all passing devices. Before a device forwards a request to its adjacent device, it adds its own device ID at the end of the source path field of the request message, and a certain device responds to the received request. When sending a message, it is necessary to reverse the order of the contents of the source path field of the request message as the path of the response message. exist figure 2 In the example shown, when device A sends topology request message 1 to device B, the source path field of the message is only one device identifier, that is, A. Before device B forwards the request to its adjacent devices, it needs to add its own device identification at the end of the source path of the request message, so the source path fields of request messages 2 and 3 are A and B; when a device When responding to the received request message, the content order of the source path field of the corresponding request message needs to be reversed as the response path field, that is, the response path fields of the response messages 4 and 5 of devices D and E are B and A.
[0021] In order to further prevent circular packet forwarding, when a device receives a topology information collection request, if the source route field of the packet contains the device identifier of the device, the packet will be discarded. If the destination address of the packet, that is, the last address in the source path field, is not the local device, it will be forwarded to its adjacent device according to the path indication.
[0022] When the topology request message diffuses in the network, a certain device may receive request messages forwarded to it from multiple adjacent devices. In order to prevent repeated response messages from being sent when receiving repeated request messages, the request Including the topology collection identification field in the message, its value is generated when the topology information collection device initiates a topology information collection request. Each time the collection is completed, add 1 to this value as the topology collection identification for the next collection. The response message includes The topology collection identifier field, whose value is the value of the topology collection identifier field in the corresponding request message, after receiving the request message, judge whether the topology collection identifier is the same as the topology collection identifier of the responded message, if they are the same, discard the request message; otherwise, process the request message.
[0023] When the topology request message diffuses in the network, a large number of network devices will receive the topology request at the same time and send the response message at the same time, which may cause network congestion and topology collection devices are busy. In order to reduce the occurrence of this situation, each device in Before sending the topology request message, it can wait for a certain period of time. In the specific implementation, wait for a period of time T1 between returning the response message and forwarding the request message; when forwarding the request message, it is forwarded one by one according to the order of the device ports, and its order is consistent with the order of the adjacent nodes in the response message. For example, T1=(X+Δ) milliseconds can be set, wherein X is a certain value, and Δ is a random number, and the topology collection request message includes the maximum value of Δ and the time interval value of forwarding one by one by the device port, and the specific implementation The reference value of X in the middle may be 200 milliseconds, and the time interval value of forwarding one by one device port may be 20 milliseconds.
[0024] In order to further ensure the integrity of the topology collection, when the topology information collection device receives the response message, it will record and mark the node device that returns the message as a responding node, and mark the nodes that have not responded among its adjacent nodes as unresponsive nodes. The responding node waits for a period of time, and performs the specified topology collection operation on the unresponsive node. When it is found that the response of a certain device has not been received, it will collect the topology information of the device through the specified topology collection process. The routing information of the device can be addressed by source routing instead of the above-mentioned step-by-step broadcasting method, thereby reducing network congestion and improving execution efficiency.