• No results found

3.3 Heuristic Algorithms

3.3.1 Energy-Aware Routing

The proposed algorithm, shown in Algorithm 1, starts finding the set of admissible routes between every pair of network nodes that satisfy the required constraints for control and data plane communications (line 1). For control traffic, these paths are delay-constrained by the maximum allowed latency bound (Lb) and do not pass through any other controller that is not the source or target of the switch-controller pair. Meanwhile, possible data paths do not pass through any controller in the network. In addition, the subset of paths from each forwarding node to all the controllers in the network is stored in Pc (line 3). Using these computed control

paths, in line 5, a sorted list of forwarding nodes is stored in L. This list is sorted in ascending order following two criteria:

1. the number of possible controllers to associate with, 2. the number of possible control paths.

Going through this list, the algorithm starts satisfying the most critical cases and the solution can be found with fewer iterations. Then, after setting the first element in L as the node n to be initially considered (line 6), the algorithm initializes the set of active links with a maximum value.

The main loop of the algorithm determines for each possible control path of the selected node n, the number of active links in the network after routing all data and control traffic. The configuration of paths with fewer active links is then selected in this process. Inside this loop, we will use a set of additional variables, denoted in the pseudocode as P0, X0, Y0, U0, to denote the temporal values computed at each iteration. Therefore, for each possible control path of the selected node n, these variables are initialized with the resulting values (i.e. control path, active links, controller-switch association and links utilization) derived from routing the considered

Algorithm 1 Energy-Aware Routing

Require: G = (V, E, C) network graph with controller placements, S forwarding nodes, D data

traffic demands

Ensure: P data and control paths, X active links, Y controller-switch associations, U links

utilization

1: R ← Array of admissible routes between every pair of nodes in G 2: for s ∈ S do

3: Pc[s] ← subset of routes r ∈ R from s to every controller c ∈ C

4: end for 5: L ← S_Sorted 6: n ← First node in L 7: len(X) ← ∞ 8: repeat 9: for p ∈ Pc[n] do 10: Initialize(P0, X0, Y0, U0) by routing p 11: for s ∈ L − {n} do 12: PathSelector(s, N one, Pc[s]) 13: end for 14: O ← List of (c, s) in P0 15: for (c, s) ∈ O do 16: PathSelector(c, s, R[c, s]) 17: end for 18: for (c, c) ∈ G do 19: PathSelector(c, c, R[c, c]) 20: end for 21: for (s, s) ∈ D do 22: PathSelector(s, s, R[s, s]) 23: end for

24: if len(X0) ≤ len(X) then

25: len(X), P, X, Y, U ← len(X0), P0, X0, Y0, U0

26: end if

27: end for

28: if len(X) = ∞ then

29: if n = last node in L then break

30: end if

31: n ← Next node in L

32: end if

33: until len(X) 6= ∞

control path (line 10).

Four inner loops are included inside the main loop of the algorithm. The first inner loop is used to determine the path to a controller for each other forwarding node in L (line 12). Note that the possible control paths from each forwarding node are to any controller in the network to which it could be associated under the maximum allowed latency bound (Lb) considered for

3.3. Heuristic Algorithms

node, which is stored in O (line 14). Using this switch-controller associations, the algorithm performs a second inner loop to determine now the control paths from each controller to its associated switches (line 16). Then, the two remaining loops are used to search the rest of required control paths (i.e. controller to controller in line 19) and the data paths (line 22). In the four cases, the paths selection is done using the PathSelector method, which will be further explained later on in this section.

Once all the required paths are computed, a checking process is used to evaluate the suit- ability of the current configuration of paths in line 24. That is, the algorithm compares the number of links required by the current iteration with the values stored in the global variables. If a smaller amount of links is found, the global variables are updated. In this way, the best values achieved after considering all control paths of node n are returned by the algorithm.

On the contrary, if after analyzing all control paths of node n, the algorithm still cannot find a feasible configuration of paths to route all control and data plane traffic flows, the main loop repeats this process for the next node stored in L. This is done until the solution is found or until all forwarding nodes are analyzed, i.e. when the algorithm breaks without a solution. Note that this last option occurs when, given a controller placement, an admissible configuration for controller-switches association could not be found or when the network has not sufficient capacity to meet the demand requirements under the established constraints.

As previously said, the paths selection is done by the PathSelector method described in Algorithm 2. This function is used to select for a pair of nodes (a, b), the best admissible route between them, denoted in the algorithm as SeP , in terms of minimizing the number of active links in the network. When this function is called for the first time, i.e. for determining the path between each forwarding node and one controller, the number of forwarding nodes already associated with the controller is considered (line 4 to 8). In this way, the controller load, in terms of managed forwarding nodes, remains balanced.

For each admissible path the number of required additional links is computed in line 9. This value is used to compare the current route with the previous ones and in case of improvement (i.e. fewer additional links are required), a new candidate solution is saved (line 13). In addition, a path can only be selected if it has sufficient bandwidth to route the demand volume, under the considered MLU constraint.

Algorithm 2 PathSelector(a, b, Admisible_P aths)

1: B ← ∞

2: SeP ← N one

3: for p ∈ Admisible_P aths do

4: if b = N one then

5: if p is related to an already loaded controller then

6: continue

7: end if

8: end if

9: off ← number of links in p that are not in X0

10: if off ≤ B then

11: if p has sufficient bandwidth then

12: B ← off

13: SeP ← p

14: end if

15: end if

16: end for

17: if SeP = N one then

18: continue to evaluate next p ∈ Pc[n]

19: end if

20: Update P0, X0, Y0, U0 by routing SeP

n for a new iteration. Alternatively, the algorithm returns the selected path and updates the considering variables with the values corresponding to the establishment of this new route.