flow_entry.set_flow_priority(flow_priority=1012) flow_entry.set_flow_cookie(cookie=401) flow_entry.set_flow_cookie_mask(cookie_mask=255) flow_entry.set_flow_hard_timeout(hard_timeout=1200) 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) # --- Match Fields: Ethernet Type # Ethernet Source Address # Ethernet Destination Address # Input Port match = Match() match.set_eth_type(eth_type) match.set_eth_src(eth_src) match.set_eth_dst(eth_dst) match.set_in_port(in_port=input_port) flow_entry.add_match(match)
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) # --- Match Fields: Ethernet Type # Ethernet Source Address # Ethernet Destination Address # Input Port match = Match() match.set_eth_type(eth_type) match.set_vlan_id(vlan_id) match.set_in_port(in_port = input_port) flow_entry.add_match(match)
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) action.set_eth_type(dot1q_eth_type) instruction.add_apply_action(action) action_order += 1 action = SetFieldAction(action_order) action.set_vlan_id(customer_vlan_id) instruction.add_apply_action(action) action_order += 1 action = OutputAction(action_order, provider_port) instruction.add_apply_action(action)