def test_field_display(self):
   tf = TF(HS_FORMAT())
   flow_mod = ofp_flow_mod(xid=124, priority=1, match=ofp_match(nw_tos=6), action=ofp_action_output(port=2))
   switch = create_switch(1, 2)
   switch.table.process_flow_mod(flow_mod)
   generate_transfer_function(tf, switch)
   print "tf: %s" % str(tf)
 def test_basic(self):
   tf = TF(HS_FORMAT())
   switch = create_switch(1, 2)
   flow_mod = ofp_flow_mod(xid=124, priority=1, match=ofp_match(in_port=1, nw_src="1.2.3.4"), action=ofp_action_output(port=2))
   switch.table.process_flow_mod(flow_mod)
   generate_transfer_function(tf, switch)
   print "tf: %s" % str(tf)
 def test_drop(self):
   tf = TF(HS_FORMAT())
   switch = create_switch(1, 2)
   # Don't give it an action
   flow_mod = ofp_flow_mod(xid=124, priority=1, match=ofp_match(in_port=1, nw_src="1.2.3.4"))
   switch.table.process_flow_mod(flow_mod)
   generate_transfer_function(tf, switch)
   print "tf: %s" % str(tf)
 def test_eth_display(self):
   tf = TF(HS_FORMAT())
   print "int value is: ", EthAddr("00:00:11:22:33:00").toInt()
   print "string is:", str(EthAddr("00:00:11:22:33:00"))
   flow_mod = ofp_flow_mod(xid=124, priority=1, match=ofp_match(dl_src="00:00:11:22:33:00"), action=ofp_action_output(port=2))
   switch = create_switch(1, 2)
   switch.table.process_flow_mod(flow_mod)
   generate_transfer_function(tf, switch)
   print "tf: %s" % str(tf)
def generate_NTF(switches):
  ntf = tf.TF(of.HS_FORMAT())
  for switch in switches:
    of.generate_transfer_function(ntf, switch) 
  print "NTF: %s" % str(ntf)
  return ntf