Esempio n. 1
0
 print ("                Output (to Physical Port Number %s)" % output_port)
 
 
 time.sleep(rundelay)
 
 flow_entry = FlowEntry()
 flow_entry.set_flow_name(flow_name = "Push VLAN")
 table_id = 0
 flow_entry.set_flow_table_id(table_id)
 flow_id = 22
 flow_entry.set_flow_id(flow_id)
 flow_entry.set_flow_priority(flow_priority = 1013)
 flow_entry.set_flow_cookie(cookie = 407)
 flow_entry.set_flow_cookie_mask(cookie_mask = 255)
 flow_entry.set_flow_hard_timeout(hard_timeout = 3400)
 flow_entry.set_flow_idle_timeout(idle_timeout = 3400)
 
 # --- Instruction: 'Apply-actions'
 #     Actions:     'PushVlan'
 #                  'SetField'
 #                  'Output'
 instruction = Instruction(instruction_order = 0)
 action = PushVlanHeaderAction(order = 0)
 action.set_eth_type(eth_type = push_eth_type)
 instruction.add_apply_action(action)
 action = SetFieldAction(order = 1)
 action.set_vlan_id(vid = push_vlan_id)
 instruction.add_apply_action(action)
 action = OutputAction(order = 2, port = output_port)
 instruction.add_apply_action(action)
 flow_entry.add_instruction(instruction)
Esempio n. 2
0
        (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)
    action = OutputAction(order=1, port=2)
    instruction.add_apply_action(action)
    flow_entry.add_instruction(instruction)
Esempio n. 3
0
           "                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)

    action_order += 1
    action = OutputAction(action_order)
    action.set_outport(act_out_port)
    instruction.add_apply_action(action)

    flow_entry1.add_instruction(instruction)
Esempio n. 4
0
                                                           ip_proto, ip_dscp, ip_ecn,
                                                           udp_src_port, udp_dst_port,
                                                           input_port))
 print ("        Action: Output (NORMAL)")
 
 
 time.sleep(rundelay)
 
 
 flow_entry = FlowEntry()
 table_id = 0
 flow_entry.set_flow_table_id(table_id)
 flow_id = 17
 flow_entry.set_flow_id(flow_id)
 flow_entry.set_flow_hard_timeout(0)
 flow_entry.set_flow_idle_timeout(0)
 flow_entry.set_flow_priority(flow_priority = 1008)
 
 # --- Instruction: 'Apply-actions'
 #     Action:      'Output' NORMAL
 instruction = Instruction(instruction_order = 0)
 action = OutputAction(order = 0, port = "NORMAL")
 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
Esempio n. 5
0
    print("<<< 'Controller': %s, 'OpenFlow' switch: '%s'" %
          (ctrlIpAddr, nodeName))

    flow_table_id = 0
    flow_id_base = 12
    flow_id = flow_id_base
    flowEntries = []

    # Sample flow entry
    flow_entry = FlowEntry()
    flow_entry.set_flow_cookie(6001)
    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)
Esempio n. 6
0
        % (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)
 
 action_order += 1
 action = OutputAction(action_order)
 action.set_outport(act_out_port)
 instruction.add_apply_action(action)
 
 flow_entry1.add_instruction(instruction)
Esempio n. 7
0
        "                Metadata (%s)" %
        (hex(eth_type), ip_dscp, ip_ecn, ipv6_src, ipv6_dst, ipv6_flabel,
         ipv6_exthdr, tcp_src_port, tcp_dst_port, metadata))
    print("        Action: Output (to %s)" % output_port)

    time.sleep(rundelay)

    flow_entry = FlowEntry()
    table_id = 0
    flow_id = 27
    flow_entry.set_flow_table_id(table_id)
    flow_entry.set_flow_id(flow_id)
    flow_entry.set_flow_priority(flow_priority=1020)
    flow_entry.set_flow_cookie(cookie=2100)
    flow_entry.set_flow_hard_timeout(hard_timeout=1234)
    flow_entry.set_flow_idle_timeout(idle_timeout=3456)
    flow_entry.set_flow_strict(False)
    flow_entry.set_flow_install_hw(False)

    # --- Instruction: 'Apply-actions'
    #     Actions:     'Output'
    instruction = Instruction(instruction_order=0)
    action = OutputAction(order=0, port=output_port)
    instruction.add_apply_action(action)
    flow_entry.add_instruction(instruction)

    # --- Match Fields: Ethernet Type
    #                   IP DSCP
    #                   IP ECN
    #                   IPv6 Source Address
    #                   IPv6 Destination Address
Esempio n. 8
0
 
 print ("<<< 'Controller': %s, 'OpenFlow' switch: '%s'" % (ctrlIpAddr, nodeName))
 
 
 flow_table_id = 0
 flow_id_base = 12
 flow_id = flow_id_base
 flowEntries = []
 
 # Sample flow entry
 flow_entry = FlowEntry()
 flow_entry.set_flow_cookie(6001)
 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)
Esempio n. 9
0
        "                Set Field (VLAN ID %s)\n"
        "                Push VLAN (Ethernet Type %s)\n"
        "                Set Field (VLAN ID %s)\n"
        "                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)