示例#1
0
文件: demo8.py 项目: Elbrys/pydevodl
    action = OutputAction(order=0, port="CONTROLLER", max_len=60)
    instruction.add_apply_action(action)
    flow_entry.add_instruction(instruction)

    # --- Match Fields: Ethernet Type
    #                   Ethernet Source Address
    #                   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")
示例#2
0
    flow_entry.set_flow_table_id(flow_table_id)
    flow_entry.set_flow_id(flow_id)
    flow_id += 1
    flow_entry.set_flow_idle_timeout(12000)
    flow_entry.set_flow_hard_timeout(12000)
    flow_entry.set_flow_priority(1000)

    instruction = Instruction(instruction_order=0)
    action = DropAction(order=0)
    instruction.add_apply_action(action)
    flow_entry.add_instruction(instruction)

    match = Match()
    match.set_eth_type(ETH_TYPE_ARP)
    match.set_eth_src("00:11:22:33:44:55")
    match.set_eth_dst("aa:bb:cc:dd:ee:ff")
    flow_entry.add_match(match)

    flowEntries.append(flow_entry)

    # Sample flow entry
    flow_entry = FlowEntry()
    flow_entry.set_flow_cookie(7001)
    flow_entry.set_flow_table_id(flow_table_id)
    flow_entry.set_flow_id(flow_id)
    flow_id += 1
    flow_entry.set_flow_idle_timeout(2400)
    flow_entry.set_flow_hard_timeout(2400)
    flow_entry.set_flow_priority(2000)

    instruction = Instruction(instruction_order=0)
示例#3
0
    #     Action:      'Output' to CONTROLLER
    instruction = Instruction(instruction_order=0)
    action = OutputAction(order=0, port="CONTROLLER", max_len=60)
    instruction.add_apply_action(action)
    flow_entry.add_instruction(instruction)

    #--- Match Fields: Ethernet Type
    #                  Ethernet Source Address
    #                  Ethernet Destination Address
    #                  IPv4 Source Address
    #                  IPv4 Destination Address
    #                  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_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) == True):
        print("<<< Flow successfully added to the Controller")
    else:
        print("\n")
示例#4
0
 flow_entry.set_flow_table_id(flow_table_id)
 flow_entry.set_flow_id(flow_id)
 flow_id += 1
 flow_entry.set_flow_idle_timeout(12000)
 flow_entry.set_flow_hard_timeout(12000)
 flow_entry.set_flow_priority(1000)
 
 instruction = Instruction(instruction_order = 0)
 action = DropAction(order = 0)
 instruction.add_apply_action(action)
 flow_entry.add_instruction(instruction)
 
 match = Match()
 match.set_eth_type(ETH_TYPE_ARP)
 match.set_eth_src("00:11:22:33:44:55")
 match.set_eth_dst("aa:bb:cc:dd:ee:ff")
 flow_entry.add_match(match)
 
 flowEntries.append(flow_entry)
 
 # Sample flow entry
 flow_entry = FlowEntry()
 flow_entry.set_flow_cookie(7001)
 flow_entry.set_flow_table_id(flow_table_id)
 flow_entry.set_flow_id(flow_id)
 flow_id += 1
 flow_entry.set_flow_idle_timeout(2400)
 flow_entry.set_flow_hard_timeout(2400)
 flow_entry.set_flow_priority(2000)
 
 instruction = Instruction(instruction_order = 0)