OSPF routing rapid convergence method and simulation method based on dual-mode coupling
By using a dual-mode coupling optimization algorithm to dynamically adjust the Hello packet sending interval and fault detection time in the OSPF routing protocol, the problems of routing convergence delay and resource waste are solved, and the NS3 platform simulation method is used to break through the technical limitations of OSPF protocol simulation, achieving more efficient routing convergence and network simulation.
Patent Information
- Application Number
- CN202510512432.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-23
- Publication Date
- 2025-05-27
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing OSPF routing protocols have delays in fault detection and routing convergence, especially when a node with less centrality fails, which can lead to packet loss and waste of network resources. At the same time, the NS3 platform cannot effectively simulate the OSPF protocol and its related algorithms, limiting the depth and breadth of network simulation.
The OSPF routing fast convergence method based on dual-mode coupling is adopted, and the node's Hello packet transmission interval time and fault detection time are dynamically adjusted, and the link state and node state evaluation functions are used to achieve routing convergence. At the same time, the OSPF protocol module and interface state machine are built using the NS3 platform, and the dual-mode coupling optimization algorithm is deployed to realize the simulation of the fast convergence method of OSPF routing.
It improves the routing convergence speed, reduces routing overhead, enhances the stability and efficiency of the network, and breaks through the technical bottleneck of the NS3 platform in the OSPF protocol simulation technology, achieving more efficient simulation and verification.
Smart Images

Figure CN120050221A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of information engineering, and particularly to a method for rapid convergence of OSPF routing based on dual-mode coupling and a simulation method therefor. Background Art
[0002] In modern networks, the OSPF protocol, as a link-state routing protocol, has become a key protocol for the backbone networks of the modern Internet. It ensures that data packets can be transmitted along the optimal path by rapidly and dynamically updating the routing table, thereby maintaining the efficiency and reliability of the network. The routing convergence speed of the OSPF protocol directly affects the stability and quality of service of the network. If the convergence speed is too slow, problems such as routing loops, packet loss, or increased latency may occur, and in severe cases, it may even lead to network paralysis. Moreover, the high overhead caused by excessive routing convergence will increase the network load and reduce the resource utilization efficiency.
[0003] There are existing technologies that adjust the sending frequency of Hello packets through betweenness centrality, enabling nodes with higher betweenness centrality to increase the sending frequency, thereby accelerating fault detection and reducing routing overhead; there are also existing technologies that optimize the sending of Hello packets based on load centrality, by directly running the load centrality algorithm in distributed routers, reducing the computational complexity, overcoming the limitations of centralized computing, and significantly improving the routing convergence efficiency. However, the Hello packet optimization algorithm based on centrality has deficiencies in robustness and flexibility. Nodes with lower centrality in the network may become key routing nodes. When such nodes fail, the fault detection and convergence of the relevant links are often delayed, which may lead to a large amount of packet loss; on the contrary, nodes with higher and more stable centrality may cause unnecessary network resource waste due to frequent sending of Hello packets. Therefore, it is crucial to balance optimizing the routing convergence speed and reducing routing overhead for enhancing the overall stability and efficiency of the network.
[0004] Meanwhile, by constructing a simulation environment, the performance of OSPF under different topologies, traffic loads, and abnormal scenarios can be deeply analyzed. NS3 (Network Simulator Version-3), as a free and open-source discrete-time network simulation simulator that integrates the characteristics of many excellent simulators, is mainly applied in the field of network simulation. It provides many network protocols and communication models, and also offers a large number of interfaces and base classes for network developers, featuring easy extensibility and high integration. Researchers can conduct network simulation according to their own needs and also design algorithms for each layer of the network and improve the model. However, the module library currently provided by the official NS3 cannot implement the simulation of the OSPF protocol and its related algorithms, resulting in limited simulation of the OSPF protocol and its related algorithms based on NS3. Therefore, how to apply the NS3 platform to the simulation of the OSPF protocol and its related algorithms is an issue worthy of attention. Summary of the Invention
[0005] To solve the above technical problems, the present invention provides a method for rapid convergence of OSPF routing based on dual-mode coupling and a simulation method.
[0006] To achieve the above object, the present invention adopts the following technical solutions: On the one hand, the present invention provides a method for rapid convergence of OSPF routing based on dual-mode coupling, which dynamically adjusts the Hello message sending interval time and fault detection time of each node in the target network in real time according to the following steps to achieve rapid convergence of the target network: Step S1, for each node in the target network and the communication links between each node, construct a network topology graph of the target network; Step S2, based on the network topology graph of the target network, obtain the Hello message statistical information of each node within a preset evaluation period, calculate the link state between each link using a link state evaluation function, calculate the node state of each node using a node state evaluation function, and use a comprehensive evaluation function to comprehensively evaluate each node to obtain the comprehensive evaluation function value of each node; Step S3, using a state transfer mechanism, transfer the node state of each node to each of its connected neighbor nodes respectively to achieve information sharing of the node state among each node in the target network, and determine a specified node from each node in the target network with the highest node state as the goal; Step S4: Based on the comprehensive evaluation function values of each node, determine whether there are nodes in the target network that do not meet the target function value. If so, the specified node calls the dual-mode coupling optimization algorithm to dynamically adjust the Hello message sending interval time and the fault detection time of the specified node, and through the OSPF interval synchronization mechanism, achieve the global synchronization of the Hello message sending interval time and the fault detection time of each node in the target network. Otherwise, do not adjust the Hello message sending interval time and the fault detection time of each node in the target network.
[0007] Further, after determining a specified node from each node of the target network in step S3, it further includes the step of: based on the preset Hello message sending interval time and the preset fault detection time of the specified node, using the OSPF interval synchronization mechanism, synchronize the Hello message sending interval time and the fault detection time of each non-specified node in the target network.
[0008] On the other hand, the present invention provides a simulation method for a fast OSPF routing convergence method based on dual-mode coupling. According to the following steps, use the NS3 platform deployed with a preset number of NS3 nodes to implement the simulation of the fast OSPF routing convergence method based on dual-mode coupling: Step T1: Based on the Ipv4RoutingProtocol base class of the NS3 platform, construct the NS3 routing basic function module for deploying the OSPF protocol; Step T2: Construct the message of the OSPF protocol based on the Header base class of the NS3 platform; Step T3: Based on the NS3 platform, construct the OspfInterface class of the OSPF protocol interface state machine for converting the interface state of the OSPF protocol; Step T4: Based on the NS3 platform, construct the OspfNeighbor class of the OSPF protocol neighbor state machine for converting the neighbor state of the OSPF protocol; Step T5: Deploy the dual-mode coupling OSPF routing fast convergence algorithm for dynamically adjusting the Hello message sending time and the fault detection time; Step T6: Based on the vector of the NS3 platform, construct the neighbor table, link state table and routing table of OSPF, where the neighbor table records neighbor relationships, the link state table stores all link state advertisements (LSAs), and the routing table calculates the optimal path using the SPF algorithm; Step T7: Create a simulation script in the folder of the NS3 platform. Based on the basic routing function module of NS3, use the message-driven interface state machine and neighbor state machine conversion of the OSPF protocol to maintain the neighbor table and link state table. Use the dual-mode coupled OSPF routing fast convergence algorithm to dynamically adjust the Hello message sending interval and fault detection time, and calculate the optimal path through the SPF algorithm to update the routing table. Further, based on the inherent mechanism of the NS3 platform network layer, transfer the converged routing information to each NS3 node to achieve fast routing convergence.
[0009] Beneficial effects brought by the above technical solutions: (1) The present invention uses the link state evaluation function and node state evaluation function to monitor the link state and node state of the target network in real time, solves the problem of excessive flooding of LSAs and frequent routing updates caused by the instability of links or nodes, and further solves the problem of routing oscillation. (2) The present invention uses the OSPF interval synchronization mechanism to synchronize the Hello message sending interval parameter and fault detection time parameter of all nodes in the target network, and solves the problems of asymmetry of neighbor state perception and detection delay or misjudgment. (3) The present invention uses the dual-mode coupled optimization algorithm to dynamically adjust the Hello message sending interval and fault detection time, speeds up the fault detection speed, further improves the routing convergence speed, and reduces the routing overhead. (4) The present invention uses the NS3 platform to simulate the fast OSPF routing convergence method based on dual-mode coupling, breaks through the technical bottleneck in the simulation and verification of the OSPF protocol on the NS3 platform, and at the same time realizes the efficient simulation and comprehensive verification of OSPF and related algorithms, significantly improving the applicability and operation convenience of the NS3 platform in the simulation of the OSPF protocol and its related algorithms. Description of the Drawings
[0010] Figure 1 It is a flowchart of the fast OSPF routing convergence method based on dual-mode coupling in the embodiment;
[0011] Figure 2 It is a flowchart of the interval synchronization mechanism in the embodiment;
[0012] Figure 3 It is a flowchart of the dual-mode coupled optimization sub-algorithm 1 in the embodiment;
[0013] Figure 4 It is a flowchart of the dual-mode coupled optimization sub-algorithm 2 in the embodiment;
[0014] Figure 5 It is the overall block diagram of the structure of the simulation method of the fast OSPF routing convergence method based on dual-mode coupling in the embodiment;
[0015] Figure 6 Structural diagram of NS3-OSPF message construction in the embodiment
[0016] Figure 7 Structural diagram of NS3-OSPF interface state machine construction in the embodiment
[0017] Figure 8 Structural diagram of NS3-OSPF neighbor state machine construction in the embodiment
[0018] Figure 9 Flowchart of the SPF algorithm in the embodiment
[0019] Figure 10 NS3-OSPF simulation scenario diagram in the embodiment
[0020] Figure 11 Comparison diagram of link fault number - fault detection time in the embodiment
[0021] Figure 12 Comparison diagram of link fault number - fault detection accuracy rate in the embodiment
[0022] Figure 13 Comparison diagram of link fault number - routing overhead in the embodiment
[0023] Figure 14 Comparison diagram of link fault number - packet delivery ratio in the embodiment Specific implementation manner
[0024] The technical solution of the present invention will be described in detail below in conjunction with the accompanying drawings.
[0025] Embodiment 1 Refer to Figure 1 , a method for fast convergence of OSPF routing based on dual-mode coupling described in this embodiment dynamically adjusts the Hello message sending interval time and fault detection time of each node in the target network in real time according to the following steps to achieve fast convergence of the target network: Step S1, for each node in the target network and the communication links between each node, construct a network topology diagram of the target network. In this implementation, there are no independent nodes in the target network, that is, all nodes in the target network are associated; Step S2, based on the network topology diagram of the target network, obtain the Hello message statistical information of each node within a preset evaluation period, calculate the link state between each link using the link state evaluation function, calculate the node state of each node using the node state evaluation function, and use the comprehensive evaluation function to comprehensively evaluate each node to obtain the comprehensive evaluation function value of each node; Step S3: Using the state transfer mechanism, transfer the node state of each node to each of its connected neighbor nodes respectively, so that each node contains its own node state and the node states of other nodes, realizing information sharing of node states among all nodes in the target network, and determining a specified node from all nodes in the target network with the highest node state as the goal; Step S4: Based on the comprehensive evaluation function values of each node, determine whether there are nodes in the target network that do not meet the objective function value. If so, the specified node calls the dual-mode coupling optimization algorithm to dynamically adjust the sending interval time and fault detection time of the Hello message of the specified node, and through the OSPF interval synchronization mechanism, realize the global synchronization of the sending interval time and fault detection time of the Hello message of each node in the target network. Otherwise, do not adjust the sending interval time and fault detection time of the Hello message of each node in the target network. In this embodiment, by dynamically adjusting the sending interval time and fault detection time of the Hello message, when the link state is poor, the fault detection can be accelerated, so that each node in the target network can more quickly and flexibly identify and respond to link faults, thereby shortening the overall routing convergence time; when the link state is good, reduce the sending frequency of the Hello message and reduce the network routing overhead.
[0026] Further, after determining a specified node from all nodes in the target network in step S3, it further includes the step of: based on the preset sending interval time and preset fault detection time of the specified node, using the OSPF interval synchronization mechanism to synchronize the sending interval time and fault detection time of the Hello message of each non-specified node in the target network.
[0027] Further, referring to Figure 2 , the OSPF interval synchronization mechanism includes the following steps: Step M1: Embed the sending interval time and fault detection time of the Hello message of the specified node into the Hello message of the specified node to form the target sending interval time and target detection time, and send the Hello message of the specified node to each non-specified node in the target network; Step M2: When each non-specified node receives the Hello message of the specified node, extract the target sending interval time and target detection time, compare the target sending interval time with its Hello message sending interval time, and compare the target detection time with its fault detection time to determine whether to update. If so, update the Hello message sending interval time parameter and fault detection time parameter of the non-specified node, otherwise do not perform parameter update.
[0028] Further, in step S2, the link state evaluation function, node state evaluation function, and comprehensive state evaluation function are as follows: ; ; ; Among them, uv is a link between node u and node v . is a link state evaluation function, indicating the link state between node u and node v ; is a preset evaluation period, indicating the time occupied by the missing Hello message of link uv within the preset evaluation period; is a node state evaluation function, indicating the node state of node u ; E is a set of links associated with node u , is 's cardinality, indicating the number of links associated with node u ; is a comprehensive evaluation function, indicating the overall link state and the overall node state between node u and its neighbor nodes; is a link state weight coefficient, is a node state weight coefficient.
[0029] Furthermore, the dual-mode coupling optimization algorithm described in step S4 consists of a dual-mode coupling optimization sub-algorithm 1 and a dual-mode coupling optimization sub-algorithm 2. When the comprehensive evaluation function value of a node is greater than the objective function value, sub-algorithm 1 is executed. When the comprehensive evaluation function value of a node is less than the objective function value, sub-algorithm 2 is executed: Referring to Figure 3 , the specific steps of the dual-mode coupling optimization sub-algorithm 1 are as follows: Step A1, determine whether the number of times the dual-mode coupling optimization sub-algorithm 1 can run at the target time is 0. If so, execute step A7. Otherwise, set the iteration count to 0 and execute step A2; Step A2, determine whether the iteration count exceeds the preset iteration count threshold. If so, execute step A6. Otherwise, execute step A3; Step A3, based on the Hello message sending interval time at the target time, calculate the Hello message sending interval time at the next target time using the following formula s nh : ; Among them, U(-4, 2) is a random number between -4 and 2, U (-2, 4) is a random number between -2 and 4, T h is the sending interval time of the Hello message at the target time, is the comprehensive evaluation function value of the specified node, is the objective function value of the comprehensive evaluation function; Step A4, use the following formula to calculate the difference between the sending interval time of the Hello message at the next target time and the sending interval time of the Hello message at the target time, and determine whether the difference is greater than or equal to 0. If so, set the sending interval time of the Hello message at the next target time to s nh Otherwise, set the sending interval time of the Hello message at the next target time according to the Metropolis criterion: ; Among them, s nh is the sending interval time of the Hello message at the next target time, T h is the sending interval time of the Hello message at the target time; Step A5, increase the number of iterations, and iterate and repeat Steps A2 to A5; Step A6, reduce the number of runs of the dual-mode coupling optimization sub-algorithm 1, and calculate the fault detection time at the next target time according to the following formula: ; Among them, T d is the fault detection time at the next target time, and 40 is the preset maximum value of the fault detection time, s nh is the sending interval time of the Hello message at the next target time; Step A7, increase the number of times the dual-mode coupling optimization sub-algorithm 2 can run, and end the dual-mode coupling optimization sub-algorithm 1; Refer to Figure 4 The dual-mode coupling optimization sub-algorithm 2 specifically includes the following steps: Step P1, determine whether the number of times the dual-mode coupling optimization sub-algorithm 2 can run at the target time is 0. If so, execute Step P7. Otherwise, set the number of iterations to 0 and execute Step P2; Step P2, determine whether the number of iterations exceeds the preset threshold of the number of iterations. If so, execute Step P6. Otherwise, execute Step P3; Step P3, based on the sending interval time of the Hello message at the target time, use the following formula to calculate the sending interval time of the Hello message at the next target times nh : ; Among them, U (-4, 2) is a random number between -4 and 2, U (-2, 4) is a random number between -2 and 4, T h is the sending interval time of the Hello message at the target time, is the comprehensive evaluation function value of the specified node, is the objective function value of the comprehensive evaluation function; Step P4, calculate the difference between the sending interval time of the Hello message at the next target time and the sending interval time of the Hello message at the target time using the following formula, and determine whether the difference is greater than or equal to 0. If so, set the sending interval time of the Hello message at the next target time as s nh , otherwise set the sending interval time of the Hello message at the next target time according to the Metropolis criterion: ; Among them, s nh is the sending interval time of the Hello message at the next target time, T h is the sending interval time of the Hello message at the target time; Step P5, increase the number of iterations, and iteratively repeat steps A2 to A5; Step P6, reduce the number of runs of the dual-mode coupling optimization sub-algorithm 2, and calculate the fault detection time at the next target time according to the following formula: ; Among them, T d is the fault detection time at the next target time, 40 is the preset maximum value of the fault detection time, s nh is the sending interval time of the Hello message at the next target time; Step P7, increase the number of times the dual-mode coupling optimization sub-algorithm 1 can run, and end the dual-mode coupling optimization sub-algorithm 2.
[0030] Embodiment 2: Refer to Figure 5 , for the simulation method of a dual-mode coupling-based OSPF routing fast convergence method described in this embodiment, according to the following steps, use the NS3 platform deployed with a preset number of NS3 nodes to implement the simulation of dual-mode coupling-based OSPF routing fast convergence: Step T1: Based on the Ipv4RoutingProtocol base class of the NS3 platform, construct the NS3 routing basic function module for deploying the OSPF protocol. Step T2: Construct the packets of the OSPF protocol based on the Header base class of the NS3 platform. Step T3: Based on the NS3 platform, construct the OspfInterface class of the OSPF protocol's interface state machine for converting the interface state of the OSPF protocol. Step T4: Based on the NS3 platform, construct the OspfNeighbor class of the OSPF protocol's neighbor state machine for converting the neighbor state of the OSPF protocol. Step T5: Deploy the dual-mode coupled OSPF routing fast convergence algorithm for dynamically adjusting the Hello packet sending time and the fault detection time. Step T6: Based on the vector of the NS3 platform, construct the neighbor table, link state table, and routing table of OSPF. The neighbor table records neighbor relationships, the link state table stores all link state advertisements (LSAs), and the routing table calculates the optimal path using the SPF algorithm. Step T7: Create a simulation script in the folder of the NS3 platform. Based on the NS3 routing basic function module, use the packets of the OSPF protocol to drive the conversion of the interface state machine and the neighbor state machine, maintain the neighbor table and the link state table, use the dual-mode coupled OSPF routing fast convergence algorithm to dynamically adjust the Hello packet sending interval and the fault detection time, calculate the optimal path through the SPF algorithm, update the routing table, and further, based on the inherent mechanism of the NS3 platform's network layer, transfer the converged routing information to each NS3 node to achieve fast routing convergence.
[0031] Further, refer to Figure 6 In step T2, the packets of the OSPF protocol are constructed as follows, including Hello packets, database description packets (DD), link state request packets (LSR), link state update packets (LSU), and link state acknowledgment packets (LSAck): Step T21: Create the OSPF packet header information, including version number (Version), packet type (Type), packet length (Packet Length), NS3 node ID (Router ID), area ID (Area ID), checksum (Checksum), authentication type (Authentication Type), and authentication field (Authentication). Step T22: Create a Hello message structure, which includes the priority (Router Priority) of the NS3 node participating in the election of a specified or unspecified node, the preset Hello message sending interval (Hello Interval) of the NS3 node, the preset failure detection time (Dead Interval) of the NS3 node, and the node ID (Neighbor ID) sent by the neighbor NS3 node that establishes two-way communication with the target NS3 node. Also, create a function for the Hello message structure to implement the invocation and parsing of Hello message information; Step T23: Create an LSU message structure, which specifically includes the following steps: Step T23-1: Create an LSA Header structure, including the existing time (LSA Age) of the LSA, the sequence number (LSA Sequence Number) of the LSA, and the length (Length) of the LSA. Also, create a function for the LSA Header structure to implement the invocation and parsing of LSA Header message information; where the existing time of the LSA is in seconds, the sequence number of the LSA is used for version control to ensure that the latest LSA is used, and the length of the LSA includes the LSA Header and the content; Step T23-2: Create an LSA message structure, including the NS3 node LSA (Router-LSA) and the network LSA (Network-LSA). Also, create a function for the LSA message structure to implement the invocation and parsing of LSA message information; Step T24: Create a DD message structure, including a sequence number and an LSA Header message, where the sequence number is used to ensure sequential processing of the message, and the LSA Header message is used to display the type, identifier, and sequence number of the LSA; Step T25: Create an LSR message structure, including multiple request entries, and each request entry describes an LSA; Step T26: Create an LSAck structure, including at least two LSA Header structures, to reply with the header information of at least one received LSA; Step T27: Construct other target OSPF messages.
[0032] Further, referring to Figure 7 , the above Step T3 constructs the OspfInterface class of the OSPF protocol interface state machine according to the following steps: Step T31: Create the interface states of the OspfInterface class, including Down, Waiting, DR Other, Backup, and DR; Among them, the Down state indicates that the interface is in an inactive state, that is, the interface is not enabled or OSPF is not running on the interface; the Waiting state indicates that the interface is in a waiting state, that is, the interface is waiting for the election of the designated node and the backup designated node to be completed; the DR Other state indicates that the interface type is not the designated node or the backup designated node, that is, other types; Backup indicates that the interface is elected as the backup designated node; the DR state indicates that the interface is elected as the designated node; Step T32, create the state transition event trigger function of the OspfInterface class, including Interface Up, Wait Timer, Backup Seen, Neighbor Change. Among them, Interface Up represents the interface startup event, WaitTimer represents the waiting timer, Backup Seen represents the discovery of the backup event, and Neighbor Change represents the neighbor change event. The specific trigger conditions, state transition logic, and implementation mechanisms are as follows: Step T32-1, construct the Interface Up state transition event and processing: Trigger condition: Triggered when the interface corresponding to the target NS3 node is enabled and can send and receive OSPF packets; State transition logic: If the interface type of the target NS3 node is in the point-to-point state (Point-to-Point, PtP) or the loopback state, the state of the OspfInterface class directly enters the point-to-point state or the loopback state; if the interface type of the target NS3 node is broadcast, the state of the OspfInterface class enters the Waiting state and starts the waiting timer; Implementation mechanism: The OspfInterface class listens for the interface startup event, triggers the state change, and starts the NS3 timer and the Hello packet sending mechanism after the state transition; Step T32-2, construct the Wait Timer state transition event and processing: Trigger condition: The waiting timer (Wait Timer) times out, indicating that the interface cannot obtain the designated node or backup designated node information from the Hello packets sent by the neighbor NS3 node; State transition logic: If the timer times out and the interface does not receive a Hello message from the neighboring NS3 node, the NS3 node of the interface elects itself as the designated node; if the interface receives a Hello message from the neighboring NS3 node but does not determine the designated node or the candidate designated node, the state of the OspfInterface class enters the DR Other state; if the interface receives a Hello message and obtains information about the designated node or the candidate designated node, the state of the OspfInterface class enters the Backup state or the DR state according to the election result; Implementation mechanism: In the OspfInterface class, when the timer expires, a status check is triggered, the designated node or candidate designated node election logic is executed, and the interface status is updated; Step T32-3, construct the Backup Seen state transition event and process: Trigger condition: During the waiting period of the interface, a Hello message is received from another NS3 node, and the message specifies the candidate designated node; State transition logic: If the interface is in the Waiting state and obtains the information of the candidate designated node from the Hello message, the Wait Timer timeout logic is not executed, and the state of the OspfInterface class enters the DR Other state, the Backup state, or the DR state; if the priority of the target NS3 node is higher than that of other NS3 nodes, the state of the OspfInterface class enters the DR state or the Backup state; Implementation mechanism: When parsing the Hello message, the OspfInterface class checks the fields of the candidate designated node and immediately updates the OspfInterface class status to avoid waiting time; Step T32-4, construct the Neighbor Change state transition event and its processing: Trigger condition: Neighbor status changes; State transition logic: If an NS3 node in DR or Backup state fails, the designated node and candidate designated node elections are re-performed, and the target interface state is adjusted; if the target NS3 node has a higher priority than other NS3 nodes and meets the designated node and candidate designated node election conditions, the target NS3 node can change from DR Other state to Backup state or DR state; if the new neighbor NS3 node has a higher priority than other NS3 nodes, the target NS3 node changes from DR state to Backup state or DR Other state; Implementation mechanism: In the OspfInterface class, maintain the neighbor list based on the Hello message information, and trigger the election process of the designated node and the backup designated node after detecting neighbor changes, and adjust the target interface status.
[0033] Furthermore, referring to Figure 8 , the step T4 constructs the OspfNeighbor class of the OSPF protocol neighbor state machine as follows: Step T41, create the interface status of the OspfNeighbor class, including Down, Init, 2-Way, ExStart, Exchange, Loading, Full; Among them, the Down state indicates that the interface is in an inactive state, that is, no neighbor is detected; the Init state indicates that the interface is in an initialization state, that is, the neighbor NS3 node discovers the target NS3 node, but no two-way communication is established; the 2-Way state indicates that the interface is in a two-way link state, that is, the target NS3 node and the neighbor NS3 node establish two-way communication and reach a stable state; the ExStart state indicates that the interface is in a pre-start state, that is, the database synchronization process starts; the Exchange state indicates that the interface is in an exchange state, that is, the target NS3 node and the neighbor NS3 node exchange the summary information of the LSA and confirm the LSAs that need to be further obtained; the Loading state indicates that the interface is in a loading state, that is, the target NS3 node requests the neighbor NS3 node to send the missing or updated LSAs and waits to receive the complete LSAs; the Full state indicates that the interface is in a completed state, that is, the link state database synchronization is completed; Step T42, create the state transition event trigger functions of the OspfNeighbor class, including HelloReceived, 2-WayReceived, NegotiationDone, ExchangeDone, LoadingDone, AdjOk?, SeqNumberMismatch, BadLSReq, 1-WayReceived, where HelloReceived represents receiving the Hello message, 2-WayReceived represents receiving the two-way message, NegotiationDone represents the negotiation is completed, that is, parse the received DD message and confirm the sequence number and the master-slave relationship; ExchangeDone represents the exchange is completed, LoadingDone represents the loading is completed, SeqNumberMismatch represents the sequence number is incorrect, that is, the message sequence numbers do not match; BadLSReq represents the LSA sequence number is incorrect, that is, the LSA does not exist or is invalid; 1-WayReceived represents receiving the one-way message, and the specific trigger conditions, state transition logic, and implementation mechanism are as follows: Step T42-1, construct the HelloReceived state transition event and handling to transition from the Down state to the Init state: Trigger condition: The target NS3 node receives a Hello message sent by a neighbor NS3 node, but the neighbor list in the message does not contain the Router ID of the target NS3 node; State transition logic: When the target NS3 node first detects a Hello message sent by a neighbor NS3 node, the state of the OspfNeighbor class enters the Init state, indicating that a neighbor has been detected but a two-way communication has not been established yet; Implementation mechanism: Listen for the Hello message sent by the neighbor NS3 node, parse the message content, check the neighbor list field in the message. If the Router ID of the target NS3 node does not appear in the neighbor list, the state of the OspfNeighbor class enters the Init state and record the information of the neighbor NS3 node; Step T42-2, construct the 2-WayReceived state transition event and handling to transition from the Init state to the 2-Way state: Trigger condition: The target NS3 node receives a Hello message sent by a neighbor NS3 node and finds the Router ID of the target NS3 node in it; State transition logic: The state of the OspfNeighbor class enters the 2-Way state, indicating that the target NS3 node and the neighbor NS3 node have established a two-way communication and only establish a full adjacency relationship with the designated node or the backup designated node; Implementation mechanism: Parse the Hello message sent by the neighbor NS3 node, check if it contains the Router ID of the target NS3 node. If so, the state of the OspfNeighbor class enters the 2-Way state; Step T42-3, construct the AdjOk? state transition event and handling to transition from the 2-Way state to the ExStart state, where AdjOk means checking if the neighbor NS3 node is the designated node or the backup designated node, and? means the judgment made during the checking process: Trigger condition: The election of the designated node or the backup designated node changes, or the neighbor NS3 node is the designated node or the backup designated node at the target moment; State transition logic: If the neighbor NS3 node is the designated node or the backup designated node, the state of the OspfNeighbor class enters the ExStart state to start the link state database synchronization; Implementation mechanism: Obtain the election results of the specified node or backup specified node sent by the neighbor NS3 node, check whether the neighbor NS3 node is the specified node or backup specified node. If so, the state of the OspfNeighbor class enters the ExStart state, and the master-slave relationship is set. The master NS3 node initializes the DD packet sequence number; Step T42-4, construct the NegotiationDone state transition event and its handling to transition from the ExStart state to the Exchange state: Trigger condition: Complete the initial exchange of DD packets, determine the master-slave relationship and the DD packet sequence number; State transition logic: After determining the master-slave relationship, the state of the OspfNeighbor class enters the Exchange state and starts LSA exchange; Implementation mechanism: In the ExStart state of the OspfNeighbor class, the master NS3 node sends a DD packet containing the summary information of the link state database, parses the DD packet received by the target NS3 node, confirms the sequence number and the master-slave relationship, and the state of the OspfNeighbor class enters the Exchange state; Step T42-5, construct the ExchangeDone state transition event and its handling to transition from the Exchange state to the Loading state: Trigger condition: Exchange all DD packets and determine the LSAs to be synchronized; State transition logic: The state of the OspfNeighbor class enters the Loading state and waits for the required LSA data; Implementation mechanism: Parse the DD packet sent by the neighbor NS3 node, extract the LSA summary information, and the target NS3 node sends an LS Request to request the missing LSAs. The state of the OspfNeighbor class enters the Loading state; Step T42-6, construct the LoadingDone state transition event and its handling to transition from the Loading state to the Full state: Trigger condition: Successfully receive and process all LSAs and complete the link state database synchronization; State transition logic: The state of the OspfNeighbor class enters the Full state and establishes a complete adjacency relationship; Implementation mechanism: Obtain and parse the LS Update packet sent by the neighbor NS3 node, update the local link state database to ensure that all requested LSAs have been processed, and the state of the OspfNeighbor class enters the Full state; Step T42-7, construct the SeqNumberMismatch state transition event and its handling to transition the ExStart / Exchange state to the ExStart state: Trigger condition: When exchanging DD packets, a packet sequence number mismatch is detected; State transition logic: Terminate the current link state database synchronization process and fallback to the ExStart state to re-establish the session; Implementation mechanism: Detect whether the DD packet sequence number sent by the neighbor NS3 node matches the DD packet sequence number determined by the NegotiationDone state. If not, end the current DD session and the state of the OspfNeighbor class enters the ExStart state to restart synchronization; Step T42-8, construct the BadLSReq state transition event and its handling to transition the Loading state to the Exchange state: Trigger condition: In the Loading state, an invalid LS Request packet is received, that is, the requested LSA does not exist or is invalid; State transition logic: Fallback to the Exchange state and re-request the LSA summary information; Implementation mechanism: Parse the LS Request packet sent by the neighbor NS3 node and check whether the requested LSA exists in the link state database constructed by the target NS3 node. If the requested LSA is invalid, the state of the OspfNeighbor class enters the Exchange state to re-perform the LSA exchange; Step T42-9, construct the 1-WayReceived state transition event and its handling to transition the 2-Way or higher state to the Init state; Trigger condition: A Hello packet sent by the neighbor NS3 node is received, but the Router ID of the target NS3 node is not included in the Hello packet of the neighbor NS3 node; State transition logic: The state of the OspfNeighbor class enters the Init state to re-attempt to establish an adjacency relationship; Implementation mechanism: Obtain the Hello packets sent by other neighbor NS3 nodes and check whether the Router ID of the target NS3 node is included. If not, the state of the OspfNeighbor class enters the Init state to fallback the neighbor state and restart the adjacency process.
[0034] Furthermore, refer to Figure 9 , the SPF algorithm described in step T6 calculates the optimal path as follows: Step W1: Construct an SPF tree. Add the Router ID of the target NS3 node as the initial starting point to the SPF tree, and initialize the candidate set. Add the neighbor NS3 nodes of the target NS3 node to the candidate set, and further calculate the initial path costs between the target NS3 node and each neighbor NS3 node. Step W2: Select the neighbor NS3 node with the minimum initial path cost from the candidate set, and add this neighbor NS3 node to the SPF tree. If there are multiple neighbor NS3 nodes with the same initial path cost, sort the NS3 node IDs of the neighbor NS3 nodes in descending order, and make a sequential selection according to the sorting result. Step W3: For the neighbor NS3 nodes of the node newly added to the SPF tree, determine whether each neighbor NS3 node is in the candidate set. If so, for the neighbor NS3 nodes not added to the SPF tree, calculate the path cost from the initial starting point to the neighbor NS3 node. If this path cost is less than the initial path cost, update the initial path cost; otherwise, add this neighbor NS3 node to the candidate set. Step W4: Determine whether the candidate set is empty or whether all nodes have been added to the SPF tree. If so, execute Step W5; otherwise, execute Step W2. Step W5: Generate a routing table based on the SPF tree.
[0035] Figure 10 This is the simulation scenario diagram for simulating the OSPF routing fast convergence method based on dual-mode coupling using the NS3 platform in this embodiment. Five nodes deployed with the dual-mode coupling optimization algorithm are designed in the NS3 platform, and the simulation time is set to 20 seconds. It can be observed from the figure that node 4 is sending Hello messages to its neighbor nodes, and at the same time, nodes 0, 1, 2, and 3 are also sending Hello messages to node 4. This shows that the interval synchronization mechanism proposed by the present invention can effectively achieve the unification of the Hello message sending intervals within the same subnet, thereby ensuring the stability of neighbor relationships and the efficiency of fault detection.
[0036] Figures 11 to 14In this embodiment, simulations are respectively carried out on the OSPF routing fast convergence method based on dual-mode coupling (OSPF-ICSA), BFD algorithm, load centrality algorithm (LC), and OSPF protocol using the NS3 platform, and then the comparison graphs of link fault number - fault detection time, link fault number - fault detection accuracy rate, link fault number - routing overhead, and link fault number - packet delivery rate are obtained. As can be seen from the figures, the simulation method proposed by the present invention successfully realizes the simulation construction of various OSPF protocol methods, breaks through the technical bottleneck of the NS3 platform in the simulation and analysis of OSPF protocol and related algorithms, and based on the simulation results, it can be observed that compared with the traditional OSPF protocol, the OSPF-ICSA proposed by the present invention can reduce the average fault detection time by 64%, increase the average fault detection accuracy rate by 9.71%, reduce the average routing overhead by 1.48%, and increase the average packet delivery rate by 36%.
[0037] The above are only the preferred embodiments of the present invention and do not impose any limitations on the present invention. Any simple modifications, changes, and equivalent structural changes made to the above embodiments according to the technical essence of the present invention still fall within the protection scope of the technical solution of the present invention.
Claims
1. A fast OSPF routing convergence method based on dual-mode coupling, characterized in that: The Hello message sending interval and fault detection time of each node in the target network are dynamically adjusted in real time according to the following steps to achieve rapid convergence of the target network: Step S1, constructing a network topology diagram of the target network for each node of the target network and the communication links between each node; Step S2, based on the network topology of the target network, obtain the statistical information of the Hello messages of each node within the preset evaluation period, use the link state evaluation function to calculate the link state between each link, use the node state evaluation function to calculate the node state of each node, and use the comprehensive evaluation function to comprehensively evaluate each node to obtain the comprehensive evaluation function value of each node; Step S3, using the state transfer mechanism, the node state of each node is transferred to each of its connected neighboring nodes, so as to realize the information sharing of the node state by each node in the target network, and determine a designated node from each node in the target network with the highest node state as the goal; Step S4, based on the comprehensive evaluation function value of each node, determine whether there is a node in the target network that does not meet the target function value. If so, the designated node calls the dual-mode coupling optimization algorithm to dynamically adjust the Hello message sending interval and fault detection time of the designated node, and through the OSPF interval synchronization mechanism, achieve global synchronization of the Hello message sending interval and fault detection time of each node in the target network. Otherwise, the Hello message sending interval and fault detection time of each node in the target network will not be adjusted.
2. The OSPF routing fast convergence method based on dual-mode coupling according to claim 1 is characterized in that: After determining a designated node from various nodes of the target network, step S3 further includes the steps of: based on the preset Hello message sending interval time and the preset fault detection time of the designated node, using the OSPF interval synchronization mechanism to synchronize the Hello message sending interval time and the fault detection time of various non-designated nodes in the target network.
3. The OSPF routing fast convergence method based on dual-mode coupling according to claim 1 or 2, characterized in that: The OSPF interval synchronization mechanism comprises the following steps: Step M1, embedding the Hello message sending interval time and fault detection time of the designated node into the Hello message of the designated node to form the target sending interval time and target detection time, and sending the Hello message of the designated node to each non-designated node in the target network; Step M2, when each non-designated node receives the Hello message from the designated node, it extracts the target sending interval time and the target detection time, and compares the target sending interval time with its Hello message sending interval time, and compares the target detection time with its fault detection time, to determine whether to update, if so, update the Hello message sending interval time parameters and fault detection time parameters of the non-designated node, otherwise do not update the parameters.
4. The OSPF routing fast convergence method based on dual-mode coupling according to claim 2 is characterized in that: In step S2, the link status evaluation function, node status evaluation function, and comprehensive status evaluation function are as follows: ; ; ; in, uv For Node u and nodes v A link between is the link state evaluation function, representing the node u and nodes v The link status between them; To preset the evaluation cycle, Indicates link uv The time occupied by the defective Hello messages within the preset evaluation period; is the node status evaluation function, indicating that the node u The node status; E For the node u The set of associated links, for The cardinality of the node u The number of associated links; is a comprehensive evaluation function, representing the node u The overall status of the links between neighboring nodes and the overall status of the node; is the link state weight coefficient, is the node status weight coefficient.
5. The OSPF routing fast convergence method based on dual-mode coupling according to claim 1 is characterized in that: Step S4: The dual-mode coupling optimization algorithm is composed of dual-mode coupling optimization sub-algorithm 1 and dual-mode coupling optimization sub-algorithm 2. When the comprehensive evaluation function value of the node is greater than the objective function value, the dual-mode coupling optimization sub-algorithm 1 is executed, and when the comprehensive evaluation function value of the node is less than the objective function value, the dual-mode coupling optimization sub-algorithm 2 is executed: The dual-mode coupling optimization sub-algorithm 1 specifically includes the following steps: Step A1, determining whether the number of times the dual-mode coupling optimization sub-algorithm 1 can be run at the target time is 0, if yes, executing step A7, otherwise, setting the number of iterations to 0, and executing step A2; Step A2, determining whether the number of iterations exceeds a preset threshold of the number of iterations, if yes, executing step A6, otherwise executing step A3; Step A3: Based on the Hello message sending interval at the target time, the Hello message sending interval at the next target time is calculated using the following formula: s nh : ; in, U (-4,2) is a random number between -4 and 2. U (-2,4) is a random number between -2 and 4. T h The interval for sending Hello messages at the target time. is the comprehensive evaluation function value of the specified node, is the objective function value of the comprehensive evaluation function; Step A4, using the following formula to calculate the difference between the Hello message sending interval at the next target time and the Hello message sending interval at the target time, and determine whether the difference is greater than or equal to 0, if so, the Hello message sending interval at the next target time is s nh Otherwise, set the next target time Hello message sending interval according to the Metropolis principle: ; in, s nh The interval for sending Hello messages at the next target time. T h The interval for sending Hello messages at the target time; Step A5, increase the number of iterations, and iteratively repeat steps A2 to A5; Step A6, reduce the number of runs of the dual-mode coupling optimization sub-algorithm 1, and calculate the fault detection time at the next target moment according to the following formula: ; in, T d is the fault detection time of the next target moment, 40 is the preset maximum value of the fault detection time, s nh The interval for sending Hello messages at the next target time; Step A7, increasing the number of times the dual-mode coupling optimization sub-algorithm 2 can be run, and ending the dual-mode coupling optimization sub-algorithm 1; The dual-mode coupling optimization sub-algorithm 2 specifically includes the following steps: Step P1, determine whether the number of times the dual-mode coupling optimization sub-algorithm 2 can be run at the target time is 0, if yes, execute step P7, otherwise set the number of iterations to 0 and execute step P2; Step P2, determine whether the number of iterations exceeds a preset threshold of the number of iterations, if yes, execute step P6, otherwise execute step P3; Step P3, based on the Hello message sending interval at the target time, calculate the Hello message sending interval at the next target time using the following formula: s nh : ; in, U (-4,2) is a random number between -4 and 2. U (-2,4) is a random number between -2 and 4. T h The interval for sending Hello messages at the target time. is the comprehensive evaluation function value of the specified node, is the objective function value of the comprehensive evaluation function; Step P4, using the following formula to calculate the difference between the Hello message sending interval at the next target time and the Hello message sending interval at the target time, and determine whether the difference is greater than or equal to 0. If so, the Hello message sending interval at the next target time is s nh Otherwise, set the next target time Hello message sending interval according to the Metropolis principle: ; in, s nh The interval for sending Hello messages at the next target time. T h The interval for sending Hello messages at the target time; Step P5, increase the number of iterations, and iteratively repeat steps A2 to A5; Step P6, reduce the number of runs of the dual-mode coupling optimization sub-algorithm 2, and calculate the fault detection time at the next target moment according to the following formula: ; in, T d is the fault detection time of the next target moment, 40 is the preset maximum value of the fault detection time, s nh The interval for sending Hello messages at the next target time; Step P7, increase the number of times the dual-mode coupling optimization sub-algorithm 1 can be run, and end the dual-mode coupling optimization sub-algorithm 2.
6. A simulation method for the OSPF routing fast convergence method based on dual-mode coupling as claimed in claim 1, characterized in that: Follow the steps below to simulate the OSPF routing fast convergence method based on dual-mode coupling using the NS3 platform with a preset number of NS3 nodes deployed: Step T1, based on the Ipv4RoutingProtocol basic class of the NS3 platform, construct the NS3 routing basic function module for deploying the OSPF protocol; Step T2, constructing an OSPF protocol message based on the Header basic class of the NS3 platform; Step T3, constructing the interface state machine OspfInterface class of the OSPF protocol based on the NS3 platform, which is used to convert the interface state of the OSPF protocol; Step T4, constructing the neighbor state machine OspfNeighbor class of the OSPF protocol based on the NS3 platform, which is used to convert the neighbor state of the OSPF protocol; Step T5, deploying a dual-mode coupled OSPF routing fast convergence algorithm to dynamically adjust the Hello message sending time and fault detection time; Step T6, construct OSPF neighbor table, link state table and routing table based on vector of NS3 platform, where neighbor table records neighbor relationship, link state table stores all link state advertisement LSA, and routing table calculates optimal path using SPF algorithm; Step T7, create a simulation script in the folder of the NS3 platform, based on the NS3 routing basic function module, use the OSPF protocol message to drive the interface state machine and the neighbor state machine conversion, maintain the neighbor table and link state table, use the dual-mode coupled OSPF routing fast convergence algorithm, dynamically adjust the Hello message sending interval and fault detection time, and calculate the optimal path through the SPF algorithm, update the routing table, and further based on the inherent mechanism of the NS3 platform network layer, pass the converged routing information to each NS3 node to achieve fast routing convergence.
7. The simulation method according to claim 6, characterized in that: The step T2 constructs the message of OSPF protocol according to the following steps: Step T21, create OSPF message header information, including version number, message type, message length, NS3 node ID, area ID, checksum, verification type, and verification field; Step T22, creating a Hello message structure, including the priority of the NS3 node participating in the designated node or non-designated node election, the preset Hello message sending interval of the NS3 node, the preset fault detection time of the NS3 node, the node ID sent by the neighbor NS3 node that establishes two-way communication with the target NS3 node, and creating a Hello message structure function for implementing the call and parsing of the Hello message information; Step T23, creating an LSU message structure, specifically includes the following steps: Step T23-1, create an LSA Header structure, including the existing time of the LSA, the sequence number of the LSA, and the length of the LSA, and create an LSA Header structure function for implementing the call and analysis of the LSA Header message information; Step T23-2, create an LSA message structure, including NS3 node LSA and network LSA, and create an LSA message structure function for implementing the call and analysis of LSA message information; Step T24, creating a DD message structure, including a sequence number and an LSA Header message; Step T25, creating an LSR message structure, including multiple request entries, and each request entry describes an LSA; Step T26, creating an LSAck structure, including at least two LSA Header structures, to reply to the header information of at least one received LSA; Step T27, construct other target OSPF messages.
8. The simulation method according to claim 6, characterized in that: The step T3 constructs the interface state machine OspfInterface class of the OSPF protocol according to the following steps: Step T31, create the interface status of the OspfInterface class, including Down, Waiting, DR Other, Backup, and DR; The Down state indicates that the interface is not enabled or OSPF is not running on the interface; the Waiting state indicates that the interface is waiting for the designated node and candidate designated node election to complete; the DR Other state indicates that the interface type is not a designated node or a candidate designated node; the Backup state indicates that the interface is elected as a candidate designated node; and the DR state indicates that the interface is elected as a designated node. Step T32, create the state transition event trigger function of the OspfInterface class, including Interface Up, WaitTimer, Backup Seen, and Neighbor Change. The specific trigger conditions, state transition logic, and implementation mechanism are as follows: Step T32-1, constructing the Interface Up state transition event and processing: Trigger condition: Triggered when the corresponding interface of the target NS3 node is enabled and can send and receive OSPF packets; State transition logic: If the interface type of the target NS3 node is point-to-point or loopback, the state of the OspfInterface class directly enters the point-to-point state or loopback state; if the interface type of the target NS3 node is broadcast, the state of the OspfInterface class enters the Waiting state and starts the waiting timer; Implementation mechanism: The OspfInterface class listens to the interface enable event, triggers the state change, and starts the NS3 timer and Hello message sending mechanism after the state transition; Step T32-2, construct the Wait Timer state transition event and process: Trigger condition: The waiting timer times out, indicating that the interface cannot obtain the designated node or candidate designated node information from the Hello message sent by the neighbor NS3 node; State transition logic: If the timer times out and the interface does not receive a Hello message from the neighboring NS3 node, the NS3 node of the interface elects itself as the designated node; if the interface receives a Hello message from the neighboring NS3 node but does not determine the designated node or the candidate designated node, the state of the OspfInterface class enters the DR Other state; if the interface receives a Hello message and obtains information about the designated node or the candidate designated node, the state of the OspfInterface class enters the Backup state or the DR state according to the election result; Implementation mechanism: In the OspfInterface class, when the timer expires, a status check is triggered, the designated node or candidate designated node election logic is executed, and the interface status is updated; Step T32-3, construct the Backup Seen state transition event and process: Trigger condition: During the waiting period of the interface, a Hello message is received from another NS3 node, and the message specifies the candidate designated node; State transition logic: If the interface is in the Waiting state and obtains the information of the candidate designated node from the Hello message, the Wait Timer timeout logic is not executed, and the state of the OspfInterface class enters the DR Other state, the Backup state, or the DR state; if the priority of the target NS3 node is higher than that of other NS3 nodes, the state of the OspfInterface class enters the DR state or the Backup state; Implementation mechanism: When parsing the Hello message, the OspfInterface class checks the fields of the candidate designated node and immediately updates the OspfInterface class status to avoid waiting time; Step T32-4, construct the Neighbor Change state transition event and its processing: Trigger condition: Neighbor status changes; State transition logic: If an NS3 node in DR or Backup state fails, the designated node and candidate designated node elections are re-performed, and the target interface state is adjusted; if the target NS3 node has a higher priority than other NS3 nodes and meets the designated node and candidate designated node election conditions, the target NS3 node can change from DR Other state to Backup state or DR state; if the new neighbor NS3 node has a higher priority than other NS3 nodes, the target NS3 node changes from DR state to Backup state or DR Other state; Implementation mechanism: In the OspfInterface class, the neighbor list is maintained based on the Hello message information, and after detecting a neighbor change, the election process of the designated node and the candidate designated node is triggered to adjust the target interface state.
9. The simulation method according to claim 6, characterized in that: The step T4 constructs the neighbor state machine OspfNeighbor class of the OSPF protocol according to the following steps: Step T41, create the interface status of the OspfNeighbor class, including Down, Init, 2-Way, ExStart, Exchange, Loading, and Full; Among them, the Down state means that no neighbor is detected; the Init state means that the neighbor NS3 node discovers the target NS3 node, but two-way communication is not established; the 2-Way state means that the target NS3 node establishes two-way communication with the neighbor NS3 node and reaches a stable state; the ExStart state means that the database synchronization process starts; the Exchange state means that the target NS3 node and the neighbor NS3 node exchange LSA summary information and confirm the LSA that needs to be further obtained; the Loading state means that the target NS3 node requests the neighbor NS3 node to send missing or updated LSAs and waits to receive complete LSAs; the Full state means that the link state database synchronization is completed; Step T42, create a state transition event trigger function of the OspfNeighbor class, including HelloReceived, 2-WayReceived, NegotiationDone, ExchangeDone, LoadingDone, AdjOk?, SeqNumberMismatch, BadLSReq, 1-WayReceived. The specific trigger conditions, state transition logic, and implementation mechanism are as follows: Step T42-1, construct the HelloReceived state transition event and process to transition the Down state to the Init state: Trigger condition: The target NS3 node receives a Hello message from a neighboring NS3 node, but the neighbor list in the message does not contain the Router ID of the target NS3 node; State transition logic: When the target NS3 node detects the Hello message sent by the neighbor NS3 node for the first time, the state of the OspfNeighbor class enters the Init state, indicating that the neighbor has been detected, but two-way communication has not yet been established; Implementation mechanism: Listen to the Hello message sent by the neighbor NS3 node, parse the message content, check the neighbor list field in the message, if the Router ID of the target NS3 node does not appear in the neighbor list, the state of the OspfNeighbor class enters the Init state and records the information of the neighbor NS3 node; Step T42-2, construct the 2-WayReceived state transition event and process to transition the Init state to the 2-Way state: Trigger condition: The target NS3 node receives a Hello message from a neighboring NS3 node and finds the Router ID of the target NS3 node in the message. State transition logic: The state of the OspfNeighbor class enters the 2-Way state, indicating that the target NS3 node has established two-way communication with the neighbor NS3 node, and has established a complete adjacency relationship only with the designated node or the backup designated node; Implementation mechanism: Parse the Hello message sent by the neighbor node and check whether it contains the Router ID of the target NS3 node. If so, the state of the OspfNeighbor class enters the 2-Way state; Step T42-3, construct the AdjOk? state transition event and process to transition the 2-Way state to the ExStart state: Trigger conditions: the designated node or backup designated node election changes, or the neighbor NS3 node is the designated node or backup designated node at the target time; State transition logic: If the neighbor NS3 node is a designated node or a backup designated node, the state of the OspfNeighbor class enters the ExStart state and starts link state database synchronization; Implementation mechanism: obtain the designated node or backup designated node election result sent by the neighbor NS3 node, check whether the neighbor NS3 node is a designated node or backup designated node, if yes, the state of the OspfNeighbor class enters the ExStart state, and sets the master-slave relationship, and the master NS3 node initializes the DD message sequence number; Step T42-4, construct the NegotiationDone state transition event and its processing to transition the ExStart state to the Exchange state: Triggering conditions: Complete the initial exchange of DD messages, determine the master-slave relationship and DD message sequence number; State transition logic: After the master-slave relationship is determined, the state of the OspfNeighbor class enters the Exchange state and starts LSA exchange; Implementation mechanism: When the OspfNeighbor class is in the ExStart state, the master NS3 node sends a DD message containing the summary information of the link state database, parses the DD message received by the target NS3 node, confirms the sequence number and the master-slave relationship, and the state of the OspfNeighbor class enters the Exchange state; Step T42-5, construct the ExchangeDone state transition event and its processing to transition the Exchange state to the Loading state: Trigger condition: Exchange all DD messages and determine the LSAs that need to be synchronized; State transition logic: The state of the OspfNeighbor class enters the Loading state, waiting for the required LSA data; Implementation mechanism: Parse the DD message sent by the neighbor NS3 node, extract the LSA summary information, and the target NS3 node sends LSRequest to request the missing LSA. The state of the OspfNeighbor class enters the Loading state; Step T42-6, construct the LoadingDone state transition event and its processing to transition the Loading state to the Full state: Trigger conditions: All LSAs are successfully received and processed, and link state database synchronization is completed; State transition logic: The state of the OspfNeighbor class enters the Full state, and a complete adjacency relationship is established; Implementation mechanism: Obtain and parse the LS Update message sent by the neighbor NS3 node, update the local link state database, ensure that all requested LSAs have been processed, and the state of the OspfNeighbor class enters the Full state; Step T42-7, construct the SeqNumberMismatch state transition event and its processing to transition the ExStart / Exchange state to the ExStart state: Trigger condition: When exchanging DD messages, a message sequence number mismatch is detected; State transition logic: terminate the current link state database synchronization process, return to the ExStart state and re-establish the session; Implementation mechanism: Check whether the DD message sequence number sent by the neighbor NS3 node matches the DD message sequence number determined by the NegotiationDone state. If not, the current DD session is terminated, and the state of the OspfNeighbor class enters the ExStart state to restart synchronization. Step T42-8, constructing a BadLSReq state transition event and its processing to transition the Loading state to the Exchange state: Trigger condition: An invalid LS Request message is received in the Loading state, that is, the requested LSA does not exist or is invalid; State transition logic: return to the Exchange state and request LSA summary information again; Implementation mechanism: Parse the LS Request message sent by the neighbor NS3 node and check whether the requested LSA exists in the link state database built by the target NS3 node. If the requested LSA is invalid, the state of the OspfNeighbor class enters the Exchange state and re-exchanges LSAs. Step T42-9, constructing a 1-WayReceived state transition event and its processing to transition the 2-Way or higher state to the Init state; Trigger condition: A Hello message is received from a neighboring NS3 node, but the Hello message does not contain the Router ID of the target NS3 node. State transition logic: The state of the OspfNeighbor class enters the Init state and tries to establish an adjacency relationship again; Implementation mechanism: Get the Hello message sent by other neighboring NS3 nodes and check whether it contains the Router ID of the target NS3 node. If not, the state of the OspfNeighbor class enters the Init state to roll back the neighbor state and restart the adjacency process.
Citation Information
Patent Citations
Network clustering type routing rapid convergence method based on state diagram model
CN118175082A