On Diagnosis of Forwarding Plane via Static Forwarding Rules in Software Defined Networks

Software Defined Networks (SDN) decouple the forwarding and control planes from each other. The control plane is assumed to have a global knowledge of the underlying physical and/or logical network topology so that it can monitor, abstract and control the forwarding plane. In our paper, we present solutions that install an optimal or near-optimal (i.e., within 14% of the optimal) number of static forwarding rules on switches/routers so that any controller can verify the topology connectivity and detect/locate link failures at data plane speeds without relying on state updates from other controllers. Our upper bounds on performance indicate that sub-second link failure localization is possible even at data-center scale networks. For networks with hundreds or few thousand links, tens of milliseconds of latency is achievable.

I. INTRODUCTION
SDNs are emerging as a principal component of future IT, ISP, and telco infrastructures. It promises to change networks from a collection of independent autonomous boxes to a wellmanaged, flexible, multi-tenant transport fabric [10], [11]. As core principles, SDNs (i) decouple the forwarding and control plane, (ii) provide well-defined forwarding abstractions (e.g., pipeline of flow tables), (iii) present standard programmatic interfaces to these abstractions (e.g., OpenFlow), and (iv) expose high level abstractions (e.g., VLAN, topology graph, etc.) as well as interfaces to these service layer abstractions (e.g., access control, path control, etc.).
To fulfill its promise to convert the network to a wellmanaged fabric, presumably, a logically centralized network controller is in charge of the whole forwarding plane in an end-to-end fashion with a global oversight of the forwarding elements and their inter-connections (i.e., nodes and links of the forwarding topology) on that plane. However, this might not be always true. For instance, there might be failures (software/hardware failures, buggy code, configuration mistakes, management plane overload, etc.) that disrupt the communication between the controller and a strict subset of forwarding elements. In another interesting case, the forwarding plane might be composed of multiple administrative domains under the foresight of distinct controllers. If controller of a given domain fails to respond or has very poor monitoring and reporting, then the other controllers might have a stale view of the overall network topology leading to suboptimal or infeasible routing decisions.
For many systems that require a high grade of network availability and performance, it is essential for a controller to be able to verify the forwarding plane topology and iden-tify link failures at forwarding plane speeds even under the aforementioned conditions. To attain this, we propose solutions that allocate a fraction of forwarding rules at each switch for control flows that can verify the topological connectivity, detect link failures, and locate one or more failed links. Our solutions are either optimal or order optimal in number of forwarding rules to be allocated for control flows as well as in number of control messages. Although our solutions are not optimal in latency in general, we can achieve tens of milliseconds of latency for topologies with 1000 links. For data-center scale topologies with 100K links, we present how one can effectively trade-off overhead in hardware rules and/or control messages to achieve sub-second latencies. Our solutions can guarantee locating an arbitrary single link failure, while it can also probabilistically locate multiple failed links. We show over a simple example why one cannot guarantee locating multiple link failures over arbitrary topologies and failure scenarios. We also present our simulation results over real topologies to quantify the overhead of our solution and its success of locating more than one failed link.
The paper is organized as follows. In Section II, we provide the detailed system model. In Section III, we focus on verification of topology connectivity and establish optimality results as well as performance bounds. In Section IV, we turn our attention to locating a single but arbitrary link failure. We provide an order optimal solution and present performance bounds on important metrics. In Section V, we extend the results to multiple link failures. In Section VI, we show performance results using publicly available, real world topologies. In Section VII, we cover the most related works. Finally, we conclude in Section VIII.

A. Network Architecture
The main features of the network architecture is captured in Fig. 1. Our system model follows the OpenFlow model [11]. Network consists of a forwarding plane and a control plane. The forwarding plane consists of forwarding elements (will use the term switch interchangeably), each supporting a finite number of {match, action} rules. A match pattern is defined using incoming port ID and packet headers using ternary values 0, 1, or * (i.e., don't care). In essence, each match pattern defines a network flow. The following actions on a particular flow match are allowed: forward to outgoing port ID, drop packet, pop outer header field, push outer header field, overwrite header field. Regardless of match length and number of actions taken per matching (e.g., switch can first rewrite a particular field in the packet header, then push an MPLS label, and finally forward to a particular interface), we will count the cost of each flow matching rule as one forwarding rule. The forwarding plane in Fig. 1 has seven switches (s 1 through s 7 ) and nine interfaces/links between them. We assume that each link is bidirectional, i.e., a switch can both receive and send over the same link. The model is applicable to cases where multiple interfaces exist between the same pair of switches, there are logical interfaces (e.g., a preconfigured tunnel with a tunnel ID configured on both ends), or pairs of directional links in opposite directions interconnect the same pair of switches.
The control plane consists of one or more controllers. A switch can be programmed (i.e., forwarding rules are installed) by only one controller (called master controller). In contrast, a controller can install forwarding rules on multiple switches using control interfaces (depicted by red dotted lines in the figure). The control interfaces can be in-band (i.e., a slice of the forwarding plane are used for inter-controller and controller-switch communication) or out-of-band (i.e., a separate physical network interconnects controllers with each other and switches) or a mixture of both. We refer to the subset of switches that a controller can send packets to and install rules on as its control domain D. The rest of the switches constitutes its complementary domain D. For C 3 , D = {s 4 , s 7 } and D = {s 1 , s 2 , s 3 , s 5 , s 6 }, i.e., C 3 can send control packets to and install forwarding rules on s 4 and s 7 . To install a rule on a switch in its D (e.g., s 1 ), C 3 must send its request to the master controller (e.g., C 1 ) of that switch.
Switches are only allowed to check the health of their local forwarding interfaces and report to the controllers using control interfaces. Therefore, a controller cannot receive any failure notifications for the interfaces between the switches in its complementary domain, e.g., an interface failure between s 2 and s 3 is not reported to C 3 by s 4 or s 7 .
One way for a controller to learn about the failures within its D is to receive state updates from other controllers in charge of D. This path however might be slow or might be disrupted for various reasons (e.g., configuration mistakes, controller overload, software/hardware failures on the control plane, DOS attacks) or might be simply untrusted. As long as the overhead is low, installing static rules for verifying connectivity or policies of D would be very valuable under these circumstances.
Once these static forwarding rules are in place, a controller can learn about the topology failures within its D by sending control messages from its D into its D and listen to the responses. These messages constitute control flows. Since the controller cannot install new rules in D, a priori static forwarding rules must be installed on D switches for the control flows. Finding these static rules given the forwarding plane topology for optimal network diagnosis is the focus of this paper. Once the forwarding plane topology is learned and consistently shared across the controllers, any controller Our system model does not assume that D and D are fixed or known a priori. C 3 for instance might have had functional control interfaces to other switches in D, but they may have been lost. A priori C 3 does not have any clue on which control interfaces would be failed. In another case, there might be a dynamic partitioning of the forwarding plane such that a controller become in charge of different forwarding elements over time based on some optimization logic. Not assuming fixed D and D may be useful even when they are actually fixed. If multiple controllers coexist each with a different D and D, instead of setting static rules with respect to each controller, it would be more efficient (i.e., requires less forwarding rules for control flows) to set up static rules independent of what D and D are actually.
In contrast to D, a controller can dynamically install new forwarding rules on its D for control flows. As it will be clear in the later sections, we will make use of this advantage to enforce loopback of the control flows to the controller.

B. Failure Scenarios
We will differentiate between two different failure scenarios: (i) Symmetric failures, where a bidirectional link is either functional in both directions or non-functional in either direction.
(ii) Asymmetric failures, where a bidirectional link can fail in one direction but not necessarily in the other direction.
For symmetric failures, it suffices to visit an interface in any direction to check its health. Thus, if symmetric failures are the most common scenarios, then one can specifically plan network diagnosis for such more probable incidents and save costs. We will model the forwarding plane as an undirected graph G u (S, E) in this case. Here, S is the set of vertices, where there is a 1-1 mapping from the forwarding elements to the vertices in S and E is the set of edges, where there is 1-1 mapping from the forwarding interfaces to the edges in E.
For asymmetric failures, both directions of the link must be examined. The problem is more constrained and imposes higher diagnosis costs. However, as we will see later in the paper, we can find optimal solutions. We will model the forwarding plane as a directed graph G d (S, E) in this case.
Here, E is the set of arcs, where there is 1-1 mapping from each direction of the forwarding interfaces to the arcs in E.

C. Problem Statement and Cost Metrics
Given the forwarding plane topology and without any information on D, we would like to compute and install static forwarding rules such that as long as controller is master of at least one switch (i.e., |D| ≥ 1) it can (i) verify the topology connectivity and (ii) locate link failures.
Static forwarding rules can be interpreted as one or more walks on the undirected (G u (S, E)) or directed (G d (S, E)) topology graph of the forwarding plane. Without loss of generality, we only consider closed walks (i.e., cycles) since such walks are the only ones that can satisfy the constraint |D| ≥ 1.
Let Ω represent the set of all closed walks on G u . Suppose we picked the subset of walks Ω j = {W j1 , . . . , W jK } ∈ Ω to diagnose the forwarding plane. Then, we can measure the cost of Ω j as follows.
1) Number of control messages: Each walk is traversed by a different control packet as otherwise we cannot differentiate among the walks. Thus, the overhead in number of control messages is equal to the number of walks we picked (i.e., K).
2) Latency: Each control packet k traverses the walk W jk and thus experiences a latency of τ × L k . Here, L k is the length of walk W jk and τ is the switching delay for a control packet. Depending on whether the walks can be executed in parallel or not, the overall latency figure would vary. If walks can be done in parallel, then the total latency is given by τ × max k L k . If walks must be done sequentially, then the total latency becomes τ × k L k . Any hybrid solution (i.e., walks are grouped together, within a group they are executed in parallel while across groups they are executed in sequence) would have a latency between these two extremes.
3) Number of static rules: Let E(W jk ) represent the set of arcs traversed by W jk . If an arc is traversed multiple times within the same walk or across walks, it can share the same forwarding rule at the head of arc (i.e., sending switch). 1 For each unique arc in any W jk , there must be a distinct forwarding rule as without such a rule traversing the corresponding link in the specific direction is not possible. Accordingly, we can express the total number of static forwarding rules as | k E(W jk )|, i.e., the cardinality of union of arc sets belonging to distinct walks used for diagnosis.
For an arbitrary topology, it is not possible to optimize each of these cost metrics simultaneously. In the following sections, we present solutions for topology verification and locate an arbitrary (but) single link failure. Our focus will be mainly on minimizing the total number of static forwarding rules. Our solutions are either order-optimal or optimum in 1 The easiest way of proving this is to let controller use source based routing. In this brute-force approach, each arc is assigned a unique label. The whole route is specified in the packet header by concatenating the labels of the links in the order they are visited. Each switch has a matching rule for the label and the action consists of popping the outermost label and forwarding. However, for data-center scale topologies, this would create very large control packets. A better way is to let switches do the packet labeling/tagging where necessary (e.g., see Section III-C). this metric. We will also quantify the costs in terms of latency and number of control messages. As extensions, we will consider how adding more static rules can reduce latency and probabilistically locate multiple link failures. We will also provide how latency and number of control messages can be traded off. In the final part, we exemplify why locating multiple link failures is not a solvable problem for arbitrary topologies and present simulation results about the success of locating multiple link failures using our solution.

III. VERIFYING TOPOLOGY CONNECTIVITY
For both symmetric and asymmetric failure cases, our solutions are based on first computing a single walk W opt that has the shortest length across all walks that visit each edge in G u or arc in G d at least once. For symmetric failure case, our solution is order optimal (and tight) in number of static rules. For asymmetric failures, our solution is optimum in number of static rules. For both cases, solutions are optimum in number of control messages as they require only one control message.

A. Symmetric Failure Scenarios
Computing W opt is in general known as Chinese Postman Problem. For undirected connected graphs such as G u (S, E), W opt can be computed in polynomial time [4]. Ideally, we want W opt to be an Euler cycle that visits each edge in E exactly once. A well-known necessary and sufficient condition for existence of an Euler cycle in a connected undirected graph is to have every vertex to have an even degree. When an Euler cycle exists, Ω * = {W opt } becomes the optimum choice for the verification of topology connectivity. Ω * minimizes both the total number of static forwarding rules and the total number of control messages. Specifically, Ω * requires |E| static rules and one control message. The latency of Ω * becomes τ × |E|.
Unfortunately, not all forwarding topologies have Euler cycles. E.g., the forwarding plane in Fig. 1 has no Euler cycles. Remember that when we want to optimize the number of static rules, it is not the length of W opt (denoted as L opt ), but the cardinality of E(W opt ) that must be minimized. Denote the total number of duplicate arcs for a given walk W as κ(W). Then, we can express the total number of static rules by W opt as (L opt − κ(W opt )). After stating the next lemma, we can at least claim order optimality for Ω * in number of static rules, i.e., |E| ≤ (L opt − κ(W opt )) ≤ 2|E|. The solution is obviously optimum in number of control messages. The latency can be written as τ × (L opt − κ(W opt )).
Lemma 3.1: In W opt , no edge is traversed more than twice. In other words: L opt ≤ 2|E|.
Proof: Suppose an edge is traversed more than twice. Then, we can construct an undirected graph G u (S ′ , E ′ ) from G u (S, E) such that S = S ′ and E ⊂ E ′ with each occurrence of an edge in W opt has a 1-1 mapping to E ′ . Since W opt is an Euler cycle on G u (S ′ , E ′ ), every vertex must have an even degree as this is a necessary and sufficient condition for connected graphs [4]. However, if there are more than two edges between two vertices as in this case, one can remove two edges at a time between these vertices until there remains one or two edges between the same vertices. Since we started with vertices that have even degrees, removing an even number of edges would preserve the same property. In other words, an Euler path exists after these edge deletions such that it is strictly shorter than W opt and visited every edge in E at least once. Hence, W opt cannot be the shortest cycle for topology verification, which is a contradiction.
We can express a tighter lower bound for the number of static rules than |E| by counting bridge links.
Definition An edge (if omitted) that partitions an undirected graph into two disconnected sub-graphs is called a bridge.
When a walk on a graph starts on one side of a bridge, if it crosses the bridge in one direction, it has to cross the same bridge in the reverse direction to come back to the starting point. Using this trivial observation, one can state the following lower bound on total number of forwarding rules.
Proof: For topology verification, each edge on G u must be traversed in at least one direction. Moreover, each bridge must be crossed in both directions as otherwise we cannot loop back to the starting point. Thus, there are at least |E| + |B| unique arcs that must be visited. Each uniquely visited arc requires at least one forwarding rule at the head node. Thus, we need at least |E| + |B| forwarding rules.
All the edges in tree, star, and linear topologies are bridges rendering the lower bound 2|E|. Hence, Ω * is indeed the optimum solution in number of static rules over such topologies.
Note that the lower bound given by Lemma 3.2 may not be achievable by W opt in general. Though, it can be achievable by a longer walk. An example is depicted in Figure 2. The forwarding plane topology represented by the leftmost graph has no bridges and has |E| = 8. Lemma 3.2 indicates that we need at least 8 forwarding rules. Solving Chinese Postman Problem however leads to an optimal walk W opt with L opt = 10. The corresponding logical ring is shown at the center of Figure 2. The walk traverses the arc e 41 twice, leading to κ = 1. Hence, W opt requires (L opt − κ) = 9 static forwarding rules. This is strictly larger than the lower bound. The difference is due to the edge between s 2 and s 3 as it must be traversed in both directions requiring installation of one rule at s 2 and one rule at s 3 . Other candidate solutions for W opt suffer from a similar non-bridge link reversal. This situation is avoided over the logical ring constructed by a longer walk as shown by the rightmost ring topology in the figure. Instead of moving directly from s 3 to s 2 (as in the optimal walk), a longer path s 3 − s 4 − s 1 − s 2 is taken. As a result, the ring has 12 hops with κ = 4 (e 12 , e 34 , e 41 occur two, two, and three times, respectively). Thus, this longer walk requires (L − κ) = 8 static rules achieving the lower bound.
Although optimality in number of static rules and number of control messages can be achieved by a longer walk, we may pay a substantial penalty in delay for large topologies as the walk is much longer. Thus, it would be more desirable to pay a small penalty in number of static rules and do not incur Algorithm 1 Heuristic for reducing (L opt − κ(W opt )) Step 1: Find a solution W opt to Chinese Postman Problem.
Let v k denote the absolute position of each hop on W opt and f (v k ) is the actual switch at that position.
Step 2: Construct set Λ such that a pair of arcs {e ij , e ji } ∈ Λ iff both e ij , e ji appear in W opt and the corresponding edge between s i and s j in G u is not a bridge.
Step 3: Remove the pair of arcs {e ij , e ji } from Λ that are closest to each other on W opt . Without this pair, W opt divides into two parts. Denote the part that keeps s i as W 1 and the part that keeps s j as W 2 .
Step 6: Denote the cycle that starts from v k on W 1 and ends at v l on W 2 as W 3 . Denote the cycle that starts from v l on W 2 and ends at v k on W 1 as W 4 . Construct a new walk W ′ opt by stitching W 3 to the reverse of walk W 4 (or equivalently stitching the reverse walk of Step 7: W opt := W ′ opt and break. end if end while Step 8: Remove any pair {e ij , e ji } from Λ if either of its arcs is not on W opt . end while additional delays by sticking with W opt . In general, there is more than one solution to Chinese Postman Problem (CPP). Then, we should search for a solution of CPP that achieves the minimum (L opt − κ(W opt )) (or equivalently maximum κ(W opt )) to attain lower forwarding rule costs. Algorithm 1 provides a simple transformation on top of an initial W opt that iterates over the non-bridge links that have both of their arcs in E(W opt ). An example of these iterative transformations is shown in Fig. 3 based on the forwarding plane topology given in Fig. 1. In Step 1, initial solution of CPP returns a walk of length 11 with κ = 0. In Step 2 of the algorithm, we have Λ = {{e 25 , e 52 }, {e 36 , e 63 }}. In Step 3 and Step 4, we inspect the pair {e 25 , e 52 } and construct Γ = {{v 1 , v 9 }}, respectively. In Step 6, W 3 = s 5 → s 1 → s 2 → s 5 is reversed and the rest of the walk remains the same. The top-right ring in clockwise direction depicts newly constructed walk of same length as before but κ = 1. Hence, it requires one less forwarding rules than the initial walk. Next iteration starts with this new walk (bottom-left ring in the figure). There is only one candidate pair {e 36 , e 63 } to consider with Γ = {{v 4 , v 8 }}. By reversing the part of the ring s 6 → s 3 → s 4 → s 7 → s 6 in Step 6, we obtain a new walk (bottom-right ring) with κ = 2. Algorithm terminates at this stage. The newly constructed walk is still a solution of CPP. Moreover it requires (L opt − κ(W opt )) = 9 static rules. Since |E| = 9 in G u , this is an optimum walk in number of static forwarding rules. Our evaluations over real topologies (see Section VI) indicate that Algorithm 1 is optimum in number of static rules for 60% of the topologies, and for the rest it stays within 14% of the optimum.

B. Asymmetric Failure Scenarios
Verifying topology connectivity in these scenarios require one or more control packets to visit each link in both directions. Since there are exactly 2|E| arcs to be visited and each arc must have a distinct forwarding rule, the number of static forwarding rules is ≥ 2|E|. Due to our bi-directional link assumption on G d (V, E), every vertex has equal indegree (i.e., the number of incoming arcs) and out-degree (i.e., the number of outgoing arcs). In connected graphs, this is a sufficient condition for existence of an Euler cycle [4]. An Euler cycle can be found in Θ(2|E|) steps over G d . Remember that an Euler cycle visits every arc in a directed graph exactly once. Therefore, Ω * = {W opt } is the optimum solution both in total number of static forwarding rules and in number of control messages. The latency of this solution, however, becomes τ × 2|E|.

C. Mapping the Walk to Static Forwarding Rules
Once a walk W is determined, we need to install forwarding rules at switch s i for each arc e ij in E(W ). The walk and the set of corresponding forwarding rules must uniquely define a control flow for topology connectivity. For this purpose, one of the packet headers is used to identify that this packet is used to verify topology connectivity. Suppose source IP address   field is used to this end and a unique local IP address IP A is assigned. Then, all static forwarding rules for W must match source IP address to IP A . Table I shows how the closed walk s 1 → s 5 → s 2 → s 3 → s 6 → s 7 → s 4 → s 3 → s 6 → s 5 → s 2 → s 1 is realized using 9 forwarding rules. Let us use this walk example below to describe the basic steps to convert a walk to a set of static forwarding rules. Note that there are many other alternatives to define matching rules and actions to realize the same walk. If a switch s i is visited only once by W , the static rule does not need to match any other packet field than the one that identifies the control packet. In our example, s 1 , s 4 , and s 7 are visited only once and these switches only need to match source IP address against IP A to take the correct forwarding action. If a switch s i is visited multiple times but always forwards to the same link, then again the static rule does not need to match any other packet field. E.g., s 3 and s 5 occurs twice in the example walk yet their forwarding action is the same: s 3 forwards to s 6 and s 5 forwards to s 2 . If a switch s i is visited multiple times and forwards to different links at some of these visits, it requires a separate forwarding rule for each of these links. In many occasions outgoing link has a one-to-one mapping to the incoming switch port and thus a forwarding rule that matches incoming switch port in addition to the source IP address is sufficient to identify the outgoing link. When incoming switch port is not sufficient, an additional header field must be used to identify the outgoing link. One can use VLAN tagging or MPLS labeling or a custom header field using an extension to OpenFlow protocol. Suppose we use VLAN tags as it is a standard feature in most switches including OpenFlow. Then, we assign a unique VLAN tag for each outgoing link of s j . In the example, s 2 and s 6 receive the same control packet twice from the same incoming interface and yet must forward to different outgoing links at each time. Since there is no 1-1 mapping to an incoming interface, incoming switch port cannot be used as a differentiating field. Consider first s 2 . We first assign each outgoing interface a VLAN tag, vlan 1 to e 23 and vlan 2 to e 21 . Table I shows the matching rules with these tags. Now, the question is which switches as a forwarding action should tag the control packet. The walk example corresponds to clockwise direction over the logical ring depicted at the bottom-right corner of Fig. 3. Iterating back from the tagged interface, we inspect the ring in the counter clockwise direction to identify a switch that can reuse its existing matching rule and add VLAN tagging to the action set of that matching. For instance, starting from e 23 tagged with vlan 1 and traversing the ring in counter clockwise direction, we first reach s 5 . But, s 5 is visited twice on the ring and has only one forwarding rule. Thus, we rule it out as a candidate. Moving counter clockwise direction further, we hit s 1 that occurs once in the ring and has one forwarding rule. Hence, adding VLAN tagging with vlan 1 into its action set would not possibly contradict with another forwarding decision taken at the same switch. We repeat the process with e 21 tagged with vlan 2 . Walking in counter clockwise direction, we reach s 5 , s 6 , and s 3 that cannot add a tagging action either because they require an additional forwarding rule (s 5 , s 3 ) or their forwarding rules are not yet specified (e.g., s 6 ). Taking one more step counter clockwise, s 4 occurs only once on the ring and without modifying its matching rule we can add an additional VLAN tagging action. The only outstanding switch with no forwarding rules specified is s 6 at this point. We first check if we can piggyback on existing VLAN tags vlan 1 and vlan 2 . Indeed, we can reuse vlan 1 for e 67 and vlan 2 for e 65 as shown in Table I.

D. How do controllers verify the topology connectivity?
By constructing a single closed walk that visits each edge (or arc) at least once, we formed a logical ring topology where all switches in the forwarding plane are part of. Thus, any controller C i can use any s j ∈ D Ci to inject a control packet for topology verification. In our example in Fig. 1 and using forwarding rules in Table I, C 3 can use s 4 or s 7 to inject a packet with its source IP address set to IP A . Similarly C 1 can use s 1 , s 2 , or s 5 and C 2 can use s 3 or s 6 to inject the same control packet. Controllers must initialize the control packet header properly. E.g., if s 2 is the injection point, according to Table I, not only the source IP address but also the VLAN tag must be assigned a valid value. In OpenFlow protocol, controllers can either tell the switch to which outgoing interface the control packet should be sent to or tell the switch to treat the packet the same as a packet coming from a particular incoming interface. In either case, the injection point is where the walk starts and once a packet is injected unless there is another rule specified, it would be indefinitely looped around the logical ring topology. Therefore, controllers must break the loop by defining a loopback rule at the injection point so that when the packet completes the walk, the packet is forwarded back to the controller that injected the packet. This loopback rule can be dynamically installed to any switch in a controller's current control domain. Naturally, loopback rules must have priority over the static rules installed for the closed walk. Since multiple controllers might be simultaneously inspecting the topology, this loopback rule must uniquely identify the controller. A simple solution is to use destination MAC address field and install a forwarding rule at the injection point that matches this field to MAC address of the injecting controller. Thus, each controller must also set this field in the packet header before it injects it. An alternative is to use TTL field in a matching rule (i.e., check if T T L == 0) and set the initial value of TTL in the control packet header to the length of the walk at the controller. The action set then must include a "decrement TTL" action.

IV. LOCATING AN ARBITRARY BUT SINGLE LINK FAILURE
The solution to locate an arbitrary link failure (when one or more link failures occur) is based upon constructing a bidirectional logical ring topology. At the high level, controllers inject multiple control packets each inspecting a different segment of the ring. Depending on which control messages are received back or not by the originating controller, the controller not only detects link failures but also guarantees to locate one of the failed links.
We use the solution W opt in the previous section as a clockwise walk on this logical ring. We also define a counter clockwise walk W rev opt by reverting the arcs. E.g., for W opt = s 1 → s 5 → s 2 → s 3 → s 6 → s 7 → s 4 → s 3 → s 6 → s 5 → s 2 → s 1 , W rev opt = s 1 ← s 5 ← s 2 ← s 3 ← s 6 ← s 7 ← s 4 ← s 3 ← s 6 ← s 5 ← s 2 ← s 1 . Since we assume bidirectional links, W rev opt is a valid closed walk over both G u and G d . Further, W rev opt is also a solution to CPP (i.e., W rev opt has length L opt ) and it requires the same number of forwarding rules as W opt (i.e., κ(W opt ) = κ(W rev opt )). Once the distinct forwarding rules for W opt and W rev opt are installed, any controller can attach to this logical ring from any switch in its D and inject control packets that traverse it in either clockwise or counter clockwise direction. Fig. 4 shows an example of the logical ring constructed for the forwarding plane topology in Fig. 1. We label each node on the logical ring uniquely as v i , i = 1, . . . , L opt . A switch on the forwarding plane can map to multiple logical nodes on this ring. Define f (v i ) as the surjective function that maps virtual nodes on the logical ring onto the switches in the forwarding plane. In Fig. 4, actual switch IDs are shown within the circles and virtual node labels are indicated next to them.
To be able to locate a link failure, we should be able to inspect any segment of the logical ring. For this purpose, we also install bounce back rules at each node of the logical ring. Suppose we use source IP address field to differentiate between the directions on the ring, e.g., IP A is used for W opt and IP B is used for W rev opt . The bounce back rule at a node reverses the clockwise walk to the counter clockwise walk. Suppose, we assign each virtual node v i a unique IP address IP vi . A bounce back rule can be specified by using various fields in the packet header. Let us fix the destination IP address for this purpose. For each logical node v i , a static bounce back rule is installed on f (v i ) in the following form If source IP == IP A ∧ destination IP == IP vi then set source IP to IP B and send back to incoming port.
Note that a bounce back rule must always have a higher priority than a forwarding rule for W opt when a packet has matching fields for both rules. When a controller (e.g., C 1 in Fig. 1) injects a packet at f (v in ) (e.g., when v in = v 11 , f (v in ) = s 1 ) with source IP address set to IP A and destination IP address set to IP v k (e.g., IP v5 ), the packet travels in clockwise direction from v in (e.g., v 11 ) to v k (e.g., v 5 ) and travels back to v in in counter clockwise direction over the constructed logical ring. As before, the controller must install a loopback rule at injection point f (v in ) (e.g., s 1 ) so that the switch f (v in ) forwards the packet back to the controller rather than forwarding it along W rev opt . Once the static rules for W opt , W rev opt and bounce back as well as the dynamic loopback rules are in place, each controller can fix an injection point on the logical ring and perform a binary search over the ring by eliminating half of the links from consideration at each iteration. For instance, if the link between s 4 and s 7 fails, C 1 can learn about this using the ring topology in Fig.4 as follows. First C 1 determines whether all the connections are healthy or not by injecting a control packet for topology verification (e.g., source IP is set as IP A ). The packet never comes back to C 1 indicating one or more link failures. Next, C 1 targets half of the logical link topology by sending a control packet with source IP as IP A and destination IP as IP v5 . The packet is received back as there are no failures in this segment. C 1 expands the search up to v 8 by setting the source IP as IP A and destination IP as IP v8 . As this part of the ring includes the failed link, C 1 does not receive the packet back. C 1 shrinks the search up to v 6 and injects a fourth control packet with source IP set to IP A and destination IP set to IP v6 . Since C 1 does not receive this fourth packet, but it received back the second packet, C 1 can conclude that the link between s 4 and s 7 has failed.
Note that when there are multiple link failures, the binary search mechanism would locate the first failure in the clockwise direction from the injection point of the logical ring. E.g., if e 25 and e 47 fail and C 1 uses v 11 as the injection point, the procedure above would be able to locate only e 25 .

A. Cost of Locating a Single Link Failure
Counting the rules for W opt , W rev opt , and bounce backs, the total number of static rules to be installed can be written as 3L opt − 2κ(W opt ). Since κ ≥ 0 and L opt ≤ 2|E|, the total number of static rules is upper bounded by 6|E| for both symmetric and asymmetric failures. As locating a link failure trivially verifies the topology and topology verification requires at least |E| and 2|E| rules for symmetric and asymmetric cases, respectively, we can easily establish the order optimality of our solution.
Including the topology verification stage, the solution requires at most 1 + ⌈log 2 (L opt )⌉ control messages to be injected. Interpreting each control packet as a binary letter, |E| edges and 2|E| arcs cannot be all checked with less than log 2 (|E|) and log 2 (2|E|) messages, respectively. Hence, we also have order optimality in number of control packets for both symmetric and asymmetric cases.
We can find the best case and worst case time delays as follows. For simplification, suppose L opt is a power of two. The best case delay happens when each subsequent control message travels a shorter distance (i.e., exactly half of the previous one). Hence, the best case failure scenario is when the failed link occurs on the logical ring next to the injection point in the clockwise direction. Brute-force summation over these paths including the topology verification stage amounts to (3L opt − 2) hops in total. The worst case delay happens when each subsequent control message travels a longer distance (i.e., increase exactly by half of the not inspected part of the ring). In other words, the worst case failure scenario happens when the failed link occurs on the logical ring next to the injection point in the counter clockwise direction. Again a brute-force summation over the path lengths of each control message including the topology verification stage results with total hop count of L opt (2 log 2 (L opt ) − 1) + 2. With per hop switching delay of τ , the latency T is sandwiched as: To put things into perspective, for data center scale operations with as much as 2 16 = 65536 links and τ = 1µs, the lowest latency is in the order of hundreds of milliseconds and the highest latency is in the order of seconds (to be exact 196.6ms ≤ T ≤ 2.032 seconds). 2 For a moderate size topology with about 1024 links, the worst case latency becomes less than 20 ms with as low delays as 3 ms achievable.

B. Speeding Up Search Time
To reduce the latency of failure location below 1 second mark, we can trade off latency with the overhead of control messages and/or forwarding rules.
1) More Control Messages: Instead of just performing a sequential search on the logical ring, we can use more control packets to parallelize the search. If we allow m control message to be injected in parallel, we can inspect (m + 1) segments of the ring at once. We can then reduce the number of iterations to ⌈log m+1 (L opt )⌉. Including the topology verification stage, the total number of control messages M become 1 + m⌈log m+1 (L opt )⌉. In exchange, a trivial upper bound on latency (T UB ) can be expressed as (L opt + 2L opt ⌈log m+1 (L opt )⌉) × τ . Below, we tabulate T UB in seconds for a large topology with 65536 links and τ = 1µs. Sequential search requires 17 messages and (in previous section) we computed the worst case delay as 2.032 sec. The upper bound above for 17 messages is relatively tight at 2.16 sec. At full parallelization with 65536 control messages all injected at the same time each checking a separate link, the upper bound on latency becomes as low as 200 ms. Using 29 messages total, we can achieve sub-second latency for locating the link failure even for this large topology. Since the control messages are short (e.g., <64 bytes), one can go up to m = 255 parallel messages that would incur a manageable total load (e.g., <16 KByte per iteration round).
2) More Static Rules: Instead of starting the search only in the clockwise direction, we can use both directions on the ring. To enable this, we can install bounce back rules at each v i on the ring topology to reverse W rev opt onto W opt . For this we can assign a second unique IP address IP (2) vi to each v i and install a rule at each f (v i ) as follows: If source IP == IP B ∧ destination IP == IP (2) vi then set source IP to IP A and send back to incoming port.
After determining which half of the ring has a faulty part, provided that the fault is closer to the injection point in the counter clockwise direction, we can switch the search direction to shorten the walk distance. For large topologies, this would cut down the worst case latency of locating a single link failure roughly by one half. Note that adding a second set of bounce back rules still preserves order optimality in number of static rules, which is now 4L opt − 2κ(W opt ) ≤ 8|E|.
This reduction in latency can be combined with the results of the previous section and the upper bounds stated there can again be roughly reduced by one half for small m as new trivial upper bound becomes (L opt + L opt ⌈log m+1 (L opt )⌉) × τ . E.g., for m = 4, T UB ≈ 0.52 seconds for 65536 links.

V. LOCATING MULTIPLE LINK FAILURES
For arbitrary topologies, one cannot guarantee to locate multiple link failures. A trivial example of this is given in Fig. 5. Forwarding plane is a line topology such that a controller has only one of the end points in its D. When there are multiple failures on this topology, only the closest failure can be located and all the failures that are further away from controllers D are hidden and undetectable. E.g., the failure between s 3 and s 4 in Fig. 5 is not detectable by C 1 .
Nevertheless, by building on the solution in the previous section, we can detect more than one link failure in a probabilistic sense. First, a controller may have a switch in its D in multiple locations on the logical ring. Further, it has typically more than one switch in its D at any given time. Thus, it can tap on the logical ring at multiple points and locate the first  failure in the clockwise direction from each of these points. If the second set of bounce back rules are also installed, it can also detect potentially other failures that are closest to each injection point in the counter clockwise direction. Note that there are no guarantees that these detected failures map actually to the same link. Thus, with probability one, we locate at least one link failure and at non-zero probabilities up to 2×β(D, W opt ) failures might be located. Here, β(D, W opt ) counts the total multiplicity of switches in D on W opt .

VI. EVALUATIONS OVER REAL TOPOLOGIES
In the previous sections, we already presented upper and lower bounds on various performance metrics as well as provided some numerical values mainly for latency. For asymmetric failures, the performance can be computed easily as κ(W opt ) = 0 and L opt = 2|E|. Therefore, our evaluations mainly focus on the performance of symmetric failure case. For evaluations, we use the public topologies posted in Internet Topology Zoo with their sizes varying from a few links to more than one hundred links. We mainly investigate two things: (i) How close do we get to the lower bounds established for symmetric failure cases? (ii) If we install bounce back rules for both W opt and W rev opt , how many failed links do we locate? Fig. 6 plots the ratio (L opt − κ(W opt ))/(|E| + |B|) as a function of the topology size in number of links/edges |E|. When the ratio is one, Algorithm 1 becomes an optimum solution for topology verification. For almost 60% of the topologies, indeed our solution is optimum. The ratio remains at 1.14 or below and except for 2 topologies at 1.1 or below indicating that for real network topologies we remain with at most 14% of the optimum and 10% of the optimum for 98% of the topologies. Another observation is that the performance does not seem to be too sensitive against the topology size. Fig. 7 quantifies how many failures we can actually locate. Provably, we already know that we can locate at least one. For evaluations, we fixed the number of failures, but exhaustively iterated over every failure combination on a given topology. We then assumed that there is only one switch in D of a particular controller and iterated over each switch as a possible injection candidate to find out as a function of injection point how many failures could be located. In the figure, we plot the average number of detected failures where the average is computed over all failure patterns and injection points for a given topology. We fixed the number of failures to four as larger number of failures was computationally quite prohibitive for us. As it can be seen, for a great majority of cases, we could actually locate two or more failures on average. For one topology with as much as 39 edges, the average was at 3.6 (i.e., for many failure patterns we could detect all four failed links). Note that although we consider only one switch in the control domain of the inspecting controller, the same switch can occur multiple times on the constructed logical ring. If a switch occurs twice, using both W opt and W rev opt , directions we can locate up to four failures. In our evaluations, we observed that a switch can occur three times for some topologies. Clearly, not all occurrences lead to locating new failures. We also have not observed any strong correlation between detecting more than one failure and the topology size.

VII. RELATED WORK
There are several works both for classical networks and SDNs that are closely related to ours. In all-optical networks, fault diagnosis (or failure detection) is done by using monitoring trails (m-trails) [1], [6], [13], [14]. An m-trail is a pre-configured optical path. Supervisory optical signals are launched at the starting node of an m-trail and a monitor is attached to the ending node. When the monitor fails to receive the supervisory signal, it detects that some link(s) along the trail has failed. The objective is then to design a set of m-trails with minimum cost such that all link failures up to a certain level can be uniquely identified. Although the problem set up looks very similar, there are some fundamental differences in our work: (1) Monitor locations are analogous to the switches in set D. Unlike all optical networking scenarios, in our problem set up, these monitor locations are not known a priori. Our solutions would work regardless of where the monitors are placed. (2) In all-optical networks, there is a per link cost measured by the sum bandwidth usage of all m-trails traversing that link. In our set up, the costs are in number of control packets and number of static forwarding rules. Furthermore, in our set up, a given static forwarding rule can be (and are in fact) reused by different walks. There are also works on graph-constrained group testing [2], [3] that is very similar to fault diagnosis in all-optical networks, and share the same fundamental differences.
SDN era has also generated many recent works on network debugging, fault diagnosis and detection, policy verification, dynamic and static state analysis [5], [7]- [9], [12]. As far as we are aware of, all these works are complementary to our work in terms of the problem spaces they specifically target. In [7], for instance, authors piggyback on existing rules installed for data flows to identify which header space can locate link failures given these rules. Installing static forwarding rules to be used for later forwarding plane diagnosis via control flows and optimizing the associated costs are the main features we have that are also absent in prior art on SDNs.

VIII. CONCLUSION
We presented new results on how to diagnose forwarding plane using static forwarding rules in SDNs. Our results are provably either optimal or order optimal in number of static forwarding rules and number of control messages. For topology verification, the evaluations over real topologies revealed that our solution stayed within 14% of the lower bound and for more than half the topologies matched the lower bound in number of control messages. We also presented latency performance. At the expense of slight increase in bandwidth usage and forwarding rules, sub-second delays in locating link failures even at data-center scale topologies are achievable. Our solutions guarantee locating a single link failure, but can also probabilistically locate multiple link failures as dictated by the topology and failure patterns. We lack a closed form tight approximation of finding these probabilities for arbitrary topologies and it remains as a future work.