# --- 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 match = Match() match.set_eth_type(eth_type) match.set_in_port(in_port) match.set_mpls_label(mpls_label) 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")