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. ∗/
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. ∗/