예제 #1
0
    instruction = Instruction(instruction_order=0)
    action = SetFieldAction(order=0)
    action.set_mpls_label(new_mpls_label)
    instruction.add_apply_action(action)
    action = OutputAction(order=1, port=2)
    instruction.add_apply_action(action)
    flow_entry.add_instruction(instruction)

    # --- Match Fields: Ethernet Type
    #                   Input Port
    #                   MPLS Label
    match = Match()
    match.set_eth_type(eth_type)
    match.set_in_port(in_port)
    match.set_mpls_label(mpls_label)
    flow_entry.add_match(match)

    print("\n")
    print("<<< Flow to send:")
    print flow_entry.get_payload()
    time.sleep(rundelay)
    result = ofswitch.add_modify_flow(flow_entry)
    status = result.get_status()
    if (status.eq(STATUS.OK) == True):
        print("<<< Flow successfully added to the Controller")
    else:
        print("\n")
        print("!!!Demo terminated, reason: %s" % status.detailed())
        exit(0)

    print("\n")
예제 #2
0
파일: demo31.py 프로젝트: Elbrys/pydevodl
    action_order += 1
    action = OutputAction(action_order)
    action.set_outport(act_out_port)
    instruction.add_apply_action(action)

    flow_entry1.add_instruction(instruction)

    # Match Fields for the Flow Entry
    match = Match()

    match.set_in_port(match_in_port)
    match.set_eth_type(match_ip_eth_type)
    match.set_ipv4_dst(match_ipv4_dst)

    flow_entry1.add_match(match)

    print ("\n")
    print ("<<< Flow to send:")
    print flow_entry1.get_payload()
    time.sleep(rundelay)
    result = ofswitch.add_modify_flow(flow_entry1)
    status = result.get_status()
    if(status.eq(STATUS.OK)):
        print ("<<< Flow successfully added to the Controller")
    else:
        print ("\n")
        print ("!!!Demo terminated, reason: %s" % status.detailed())
        delete_flows(ofswitch, table_id, range(first_flow_id, flow_id+1))
        exit(0)
예제 #3
0
파일: demo8.py 프로젝트: Elbrys/pydevodl
    #                   Ethernet Destination Address
    #                   IPv4 Source Address
    #                   IPv4 Destination Address
    #                   IP Protocol Number
    #                   IP DSCP
    #                   Input Port
    match = Match()
    match.set_eth_type(eth_type)
    match.set_eth_src(eth_src)
    match.set_eth_dst(eth_dst)
    match.set_ipv4_src(ipv4_src)
    match.set_ipv4_dst(ipv4_dst)
    match.set_ip_proto(ip_proto)
    match.set_ip_dscp(ip_dscp)
    match.set_in_port(input_port)
    flow_entry.add_match(match)

    print ("\n")
    print ("<<< Flow to send:")
    print flow_entry.get_payload()
    time.sleep(rundelay)
    result = ofswitch.add_modify_flow(flow_entry)
    status = result.get_status()
    if(status.eq(STATUS.OK)):
        print ("<<< Flow successfully added to the Controller")
    else:
        print ("\n")
        print ("!!!Demo terminated, reason: %s" % status.brief().lower())
        exit(0)

    print ("\n")
예제 #4
0
 
 action_order += 1
 action = OutputAction(action_order)
 action.set_outport(act_out_port)
 instruction.add_apply_action(action)
 
 flow_entry1.add_instruction(instruction)
 
 # Match Fields for the Flow Entry 
 match = Match()
 
 match.set_in_port(match_in_port)
 match.set_eth_type(match_ip_eth_type)
 match.set_ipv4_dst(match_ipv4_dst)
 
 flow_entry1.add_match(match)
 
 print ("\n")
 print ("<<< Flow to send:")
 print flow_entry1.get_payload()
 time.sleep(rundelay)
 result = ofswitch.add_modify_flow(flow_entry1)
 status = result.get_status()
 if(status.eq(STATUS.OK) == True):
     print ("<<< Flow successfully added to the Controller")
 else:
     print ("\n")
     print ("!!!Demo terminated, reason: %s" % status.detailed())
     delete_flows(ofswitch, table_id, range(first_flow_id, flow_id+1))
     exit(0)