# A Game Model and Fault Recovery Algorithm for SDN Multi-Domain
## 4 SDN-MARA Algorithm  
### SDN-MARA Algorithm Framework  
Based on the aforementioned SDN multi-domain controller game model and its analysis, this paper designs the overall framework of SDN-MARA based on multi-domain controller game model, as depicted in Figure 2. The algorithm comprises fault detection, game domain construction, controller-switch mapping, and switch migration. In the first stage, the faulty controller is detected. In the second stage, when the faulty controller and the out-of-control switch are identified, a game domain is actively constructed, game calculations are performed, and a target controller is selected. In the third stage, the new mapping relationship between the switch and the target controller is established. In the fourth stage, switch migration and target controller role transition are executed to achieve fault recovery.  
As shown in Figure 2, multiple SDN controllers and their respective managed switches collectively form a multi-domain SDN network. For a normally operating network, a heartbeat monitoring mechanism is employed to monitor the status of switches and controllers, collecting and analyzing crucial network and device state information, such as heartbeat delay and bandwidth utilization. Through the analysis and prediction of current state information, it detects the presence of faulty controllers. If a faulty controller is detected at a certain moment, a game domain will be constructed for the out-of-control switch.  
During the construction of the game domain, it is necessary to traverse the faulty controller's domain and its neighboring ones. Throughout this traversal, the remaining capacity of each controller is calculated, and the transition relationship is analyzed. If the remaining capacity of a target controller is greater than the minimum expected request rate of the out-of-control switch and the controller has not joined any other game domains, it is added to the set of target controllers; otherwise, the traversal continues with the remaining  
Figure 2: Framework diagram of SDN multi-domain controller fault recovery algorithm.  
controllers. The candidate target controllers are then sorted in descending order based on their remaining capacity. Subsequently, all out-of-control switches within the faulty controller's domain are obtained and joined with the candidate target controllers in the same game activity, completing the construction of the game domain.  
In order to determine the mapping relationship, this paper designs a game-enhanced dynamic mapping algorithm that employs a multi-population particle swarm optimization (PSO) algorithm [7] with repulsive interaction to determine the mapping between out-of-control switches and target controllers. In this paper, target controllers are abstracted as particles, and the set of target controllers in the game domain is further divided into several decision subdomains, which helps to break down the original problem into sub-problems, thereby simplifying the solving process. Combined with the repulsive relationship optimization technique, the algorithm records the fitness value at every moment to determine the optimal fitness and enhance the global optimization capability. By applying different inter-swarm interaction factors at different steps, the multi-population particle swarm algorithm with a repulsive relationship can gradually approach the optimal mapping.  
The fourth phase of the algorithm is to use the fault autonomous recovery algorithm designed in this paper to achieve fault recovery, including executing switch migration and target controller role transition. Firstly, new connections need to be established. Then, the local controller updates the switch information within its domain and performs flow table update operations. Through these steps, the system autonomously completes the recovery from network faults, allowing the network to reenter a normal operating state.