Research Article

SDN Programming for Heterogeneous Switches with Flow Table Pipelining

Algorithm 1

Algorithm to recursively compress forwarding tree.
Parameters: ft: Forwarding Tree
(1)Procedure CompressFT(ft)
(2)for node in ft:
(3)  node.compressed = false; /∗ Initialization. ∗/
(4) Compress(ft.root);
(5) return;
(6)def Compress(node): /∗ A depth-first tree traversal. ∗/
(7)if == Leaf: /∗ Check if node is a leaf. ∗/
(8)  node.compressed = true;
(9) return
(10)else:
(11)  for child_t1 in node.children: /∗ Find a child. ∗/
(12)   if child_t1.compressed == false:
(13)    Compress(child_t1); /∗ Recursively compress the child. ∗/
(14)    return;
(15)   for child_t2 in (node.children-child_t1): /∗ Find a child that is the same as child_t1. ∗/
(16)    if child_t2.compressed and child_t1 == child_t2:
(17)     child_t2 points to the same node of child_t1; /∗ Remove redundancies. ∗/
(18)     node.children.delete(child_t2);
(19)  node.compressed = true;
(20)  return