예제 #1
0
파일: demo8.py 프로젝트: Elbrys/pydevodl
           (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
    #                   Ethernet Destination Address
    #                   IPv4 Source Address
    #                   IPv4 Destination Address
    #                   IP Protocol Number
    #                   IP DSCP
예제 #2
0
        "                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)
    action = OutputAction(order=1, port=2)
    instruction.add_apply_action(action)
    flow_entry.add_instruction(instruction)

    # --- Match Fields: Ethernet Type
    #                   Input Port
    #                   MPLS Label
예제 #3
0
        "                Output (Physical Port number %s)" % (hex(qinq_eth_type), provider_vlan_id,
                                                              hex(dot1q_eth_type), customer_vlan_id,
                                                              provider_port))
 
 time.sleep(rundelay)
 
 flow_id = first_flow_id
 flow_entry1 = FlowEntry()
 flow_entry1.set_flow_table_id(table_id)
 flow_entry1.set_flow_name(flow_name = "[MLX1-A] Test flow (match:inport=110,arp;actions:push-QINQ-tag,mod_vlan=100,push-DOT1Q-tag,mod_vlan=998,output:111)")
 flow_entry1.set_flow_id(flow_id)
 flow_entry1.set_flow_hard_timeout(hard_timeout = 600)
 flow_entry1.set_flow_idle_timeout(idle_timeout = 300)
 flow_entry1.set_flow_priority(priority)
 flow_entry1.set_flow_cookie(cookie)
 flow_entry1.set_flow_cookie_mask(cookie_mask)
 
 instruction = Instruction(instruction_order = 0)
 
 action_order = 0
 action = PushVlanHeaderAction(action_order)
 action.set_eth_type(qinq_eth_type)
 instruction.add_apply_action(action)
 
 action_order += 1
 action = SetFieldAction(action_order)
 action.set_vlan_id(provider_vlan_id)
 instruction.add_apply_action(action)
 
 action_order += 1
 action = PushVlanHeaderAction(action_order)