Research Article

SDN Programming for Heterogeneous Switches with Flow Table Pipelining

Algorithm 2

Algorithm to map compressed forwarding tree (DAG) to flow table pipeline.
(1)// global variable
(2)tableID: global variable to record the maximum tableID in pipeline.
(3)Procedure GenerateFT(ft)
(4) tableID = 0; /∗ Initialization. ∗/
(5) GenerateSingleFT(ft.root, ); /∗ Allocate a flow table, and generate flow rules for node. ∗/
(6)def GenerateSingleFT(node, metadata):
(7)if == Leaf: /∗ Check if node is a leaf. ∗/
(8)  match = metadata;
(9)  priority = 0; /∗ Emit a rule for this leaf. The rule matches on the register values in metadata and is inserted in a specific flow table, table-ACTION. ∗/
(10)  emitRule (table-ACTION, match, priority, node.action);
(11)  return table-ACTION;
(12)else /∗ childrenGroup is the set of edges pointing to the same child node in compressed forwarding tree, and childrenGroup.groupID is a unique integer number. ∗/
(13)  for childrenGroup in getChildrenGroup(node):
(14)   tableID_t = tableID;
(15)   tableID = tableID + 1; /∗ Save the matching condition on metadata. ∗/
(16)   metadata += “”; /∗ Generate flow table for this child node. childTableID is the child node’s flow tableID. ∗/
(17)   childTableID = GenerateSingleFT(childrenGroup.node, metadata);
(18)   for edge in childrenGroup:
(19)    match = (node.field: edge.value);
(20)    priority = 0;
(21)    action += goto childTableID; /∗ For each edge pointing to the child node, add a flow rule jumping to child node’s flow table. ∗/
(22)    emitRule(tableID_t, match, priority, action);
(23)  return tableID_t;