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 generate_NTF(switches): ntf = tf.TF(of.HS_FORMAT()) for switch in switches: of.generate_transfer_function(ntf, switch) log.debug("network transfer function (routing entries): %s" % str(ntf)) return ntf
def generate_tf_pairs(switches): name_tf_pairs = [] for switch in switches: switch_tf = tf.TF(of.HS_FORMAT()) of.generate_transfer_function(switch_tf, switch) name_tf_pairs.append((switch.name, switch_tf)) log.debug("transfer function: %s" % str(switch_tf)) return name_tf_pairs
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_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_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_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 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)