Beispiel #1
0
    print(
        "        Match:  Ethernet Type (%s)\n"
        "                Input Port (%s)\n"
        "                MPLS Label (%s)" %
        (hex(eth_type), in_port, mpls_label))
    print(
        "        Action: Set Field (MPLS Label %s)\n"
        "                Output (Physical Port number %s)" %
        (new_mpls_label, output_port))

    time.sleep(rundelay)

    flow_entry = FlowEntry()
    table_id = 0
    flow_id = 29
    flow_entry.set_flow_table_id(table_id)
    flow_entry.set_flow_id(flow_id)
    flow_entry.set_flow_name(flow_name="Change MPLS Label")
    flow_entry.set_flow_hard_timeout(hard_timeout=0)
    flow_entry.set_flow_idle_timeout(idle_timeout=0)
    flow_entry.set_flow_priority(flow_priority=1022)
    flow_entry.set_flow_cookie(cookie=401)
    flow_entry.set_flow_cookie_mask(cookie_mask=255)

    # --- Instruction: 'Apply-actions'
    #     Actions:     'Set Field'
    #                  'Output'
    instruction = Instruction(instruction_order=0)
    action = SetFieldAction(order=0)
    action.set_mpls_label(new_mpls_label)
    instruction.add_apply_action(action)
Beispiel #2
0
           "                Ethernet Type (%s)\n"
           "                IPv4 Destination Address (%s)" %
           (match_in_port,
            hex(match_ip_eth_type),
            match_ipv4_dst))
    print ("        Action: Set IPv4 ToS (tos %s)\n"
           "                Output (Port number %s)" %
           (mod_nw_tos, act_out_port))

    time.sleep(rundelay)

    # Allocate a placeholder for the Flow Entry
    flow_entry1 = FlowEntry()

    # Generic attributes of the Flow Entry
    flow_entry1.set_flow_table_id(table_id)
    flow_entry1.set_flow_name(flow_name)
    flow_entry1.set_flow_id(flow_id)
    flow_entry1.set_flow_cookie(cookie)
    flow_entry1.set_flow_priority(priority)
    flow_entry1.set_flow_hard_timeout(0)
    flow_entry1.set_flow_idle_timeout(0)

    # Instructions/Actions for the Flow Entry
    instruction = Instruction(instruction_order=0)

    action_order = 0
    action = SetNwTosAction(action_order)
    action.set_tos(mod_nw_tos)
    instruction.add_apply_action(action)
Beispiel #3
0
           "                IPv4 Source Address (%s)\n"
           "                IPv4 Destination Address (%s)\n"
           "                IP Protocol Number (%s)\n"
           "                IP DSCP (%s)\n"
           "                Input Port (%s)" %
           (hex(eth_type), eth_src,
            eth_dst, ipv4_src, ipv4_dst,
            ip_proto, ip_dscp,
            input_port))
    print ("        Action: Output (CONTROLLER)")

    time.sleep(rundelay)

    flow_entry = FlowEntry()
    table_id = 0
    flow_entry.set_flow_table_id(table_id)
    flow_id = 15
    flow_entry.set_flow_id(flow_id)
    flow_entry.set_flow_priority(flow_priority=1006)
    flow_entry.set_flow_cookie(cookie=100)
    flow_entry.set_flow_cookie_mask(cookie_mask=255)

    # --- Instruction: 'Apply-actions'
    #     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
Beispiel #4
0
        "                IPv4 Destination Address (%s)"
        % (match_in_port,
           hex(match_ip_eth_type),
           match_ipv4_dst))
 print ("        Action: Set IPv4 ToS (tos %s)\n"
        "                Output (Port number %s)"
        % (mod_nw_tos,
           act_out_port))
 
 time.sleep(rundelay)
 
 # Allocate a placeholder for the Flow Entry 
 flow_entry1 = FlowEntry()
 
 # Generic attributes of the Flow Entry 
 flow_entry1.set_flow_table_id(table_id)
 flow_entry1.set_flow_name(flow_name)
 flow_entry1.set_flow_id(flow_id)
 flow_entry1.set_flow_cookie(cookie)
 flow_entry1.set_flow_priority(priority)
 flow_entry1.set_flow_hard_timeout(0)
 flow_entry1.set_flow_idle_timeout(0)
 
 # Instructions/Actions for the Flow Entry 
 instruction = Instruction(instruction_order = 0)
 
 action_order = 0
 action = SetNwTosAction(action_order)
 action.set_tos(mod_nw_tos)
 instruction.add_apply_action(action)