## 4 Brown-Field Migration Aware Routing and Spectrum Assignment Algorithm
### Brown-Field Migration Aware Routing and Spectrum Assignment Algorithm
Another case is that the source node of path \(P_{R}\) is a flex-grid node, and if the start node and the end node of each link \(l\) are all flex-grid, we traverse \(S_{FL}\) consecutive frequency slots starting with \(F_{min}^{n,ith}\) then check whether they are unoccupied. If \(S_{FL}\) consecutive frequency slots are unoccupied, we allocate spectrum resources for \(R\), then return \(S_{FL}\) and \(F^{n,jith}\). If there are fixed-grid nodes in the link, we traverse \(S_{FI}\) consecutive frequency slots starting with \(F_{min}^{n,ith}\) and check if they are unoccupied, if so, allocate spectrum resource for \(R\), after that return \(S_{FI}\) and \(F^{n,jith}\). Otherwise, the process of service provisioning for \(R\) will be blocked. In the proposed _BMA-RSA_ algorithm, we provide migration-aware dynamic connection provisioning, based on the probabilistic migration label model before the migration begins, which can effectively avoid a large amount of data loss due to node upgrade. Compared with the method of re-establishing the connection after data transmission is interrupted, the proposed _BMA-RSA_ algorithm that provides pre-consideration protection for the service has great performance in terms of avoiding service interruption. During the process of label setting, the label of each node should be maintained. We can establish the path from the source to a selected node based on the node's final label for data transmission. It should be noted that the parameters \(\alpha\) and \(\beta\) are the weight coefficient for the link distance from the source to the selected node and the node upgrade probability. The value of \(\alpha\) and \(\beta\) can be modified at step 5, step 14 and step 15 for routing strategies which has various weighted label. For example, the _BMA-RSA_ algorithm will evolve to be the shortest path routing algorithm if we set \(\alpha=1\), \(\beta=0\). ```
Input:\(G(V,E,P)\), NodeSet = {src}, LinkSet = {\(\varnothing\)}, \(R(S,D,B)\), \(V_{FI}\), \(V_{FL}\) Output: Migration - aware path from src to node i, \(F^{n,jth}\), \(S_{FL}/S_{FI}\)
```  
**Algorithm 1** Brown-field Migration aware routing and spectrum assignment  
```
1 foreach\(R(S,D,B)\)
2 Label(src) = 0, Label(j) = \(\infty\);
3 foreach node\(j\in V-\{src\}\)
4 ifnode\(j\) is neighbour of\(src\)then
5 calculate\(\text{Label}(j)=\alpha\times dis_{src,j}+\beta\times p_{j}\);
6
7 end if
8
9 while\((V-NodeSet\
eq\emptyset)\)do
10 for each\(\text{link}(i,j)\in E\), \(j\in V-NodeSet\)do
11 find the node \(j\in V-NodeSet\) which has minimum Label(\(j\));
12\(NodeSet\)\(\leftarrow\)\(NodeSet\cup\{j\}\);
13\(LinkSet\)\(\leftarrow\)\(LinkSet\cup\{\text{link}(i,j)\}\);
14 for each node\(k\in V-NodeSet\)do
15 if\(\text{Label}[k]>\text{Label}[j]+\alpha\times dis_{j,k}+\beta\times p_{k}\)then
16 Label\(\{k\}=\text{Label}[j]+\alpha\times dis_{j,k}+\beta\times p_{k}\);
17
18
19 end if
20
21 end if
22
23 get the shortest path \(P_{R}\) from\(src\) to node\(i\);
24 for each link\(l\) in path\(P_{R}\)do
25 if\(\emptyset_{s}\) == 0 then
26 start from\(F^{n,th}_{min}\), traverse\(S_{FI}\) consecutive frequency slots;
27 if\(S_{FI}\) consecutive frequency slots are unoccupied
28 allocate spectrum for\(R\), return\(F^{n,jth}\),\(S_{FI}\)
29 end if
30 else
31 if\(\emptyset_{s(l)}==1\)&\(\emptyset_{e(l)}==1\)then
32 start from\(F^{n,th}_{min}\), traverse\(S_{FL}\) consecutive frequency slots;
33 if\(S_{FL}\) consecutive frequency slots are unoccupied
34 allocate spectrum for\(R\), return\(F^{n,jth}\),\(S_{FL}\)
35 end if
36
37 elseif\(\emptyset_{s(l)}==0\)&\(\emptyset_{e(l)}==1\) or\(\emptyset_{s(l)}==1\)&\(\emptyset_{e(l)}==0\)
38 start from\(F^{n,th}_{min}\), traverse\(S_{FI}\) consecutive frequency slots;
39 if\(S_{FI}\) consecutive frequency slots are unoccupied
40 allocate spectrum for\(R\), return\(F^{n,jth}\),\(S_{FI}\)
41 end if
42
43 end if
44
45 end if
46
47 end for
48
49 end for
50
51 end for
```  
**Algorithm 2** Brown-field Migration aware routing and spectrum assignment