Пример #1
0
    instruction.add_apply_action(action)
    flow_entry.add_instruction(instruction)

    # --- Match Fields: Ethernet Type
    #                   Ethernet Source Address
    #                   Ethernet Destination Address
    #                   ARP Operation
    #                   ARP Source IPv4 Address
    #                   ARP Target IPv4 Address
    #                   ARP Source Hardware Address
    #                   ARP Target Hardware Address
    match = Match()
    match.set_eth_type(eth_type)
    match.set_eth_src(eth_src)
    match.set_eth_dst(eth_dst)
    match.set_arp_opcode(arp_opcode)
    match.set_arp_src_transport_address(arp_src_ipv4_addr)
    match.set_arp_tgt_transport_address(arp_tgt_ipv4_addr)
    match.set_arp_src_hw_address(arp_src_hw_addr)
    match.set_arp_tgt_hw_address(arp_tgt_hw_addr)
    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:
Пример #2
0
    instruction.add_apply_action(action)
    flow_entry.add_instruction(instruction)

    # --- Match Fields: Ethernet Type
    #                   Ethernet Source Address
    #                   Ethernet Destination Address
    #                   ARP Operation
    #                   ARP Source IPv4 Address
    #                   ARP Target IPv4 Address
    #                   ARP Source Hardware Address
    #                   ARP Target Hardware Address
    match = Match()
    match.set_eth_type(eth_type)
    match.set_eth_src(eth_src)
    match.set_eth_dst(eth_dst)
    match.set_arp_opcode(arp_opcode)
    match.set_arp_src_transport_address(arp_src_ipv4_addr)
    match.set_arp_tgt_transport_address(arp_tgt_ipv4_addr)
    match.set_arp_src_hw_address(arp_src_hw_addr)
    match.set_arp_tgt_hw_address(arp_tgt_hw_addr)
    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: