本文整理汇总了Python中pybvc.openflowdev.ofswitch.FlowEntry.set_flow_strict方法的典型用法代码示例。如果您正苦于以下问题:Python FlowEntry.set_flow_strict方法的具体用法?Python FlowEntry.set_flow_strict怎么用?Python FlowEntry.set_flow_strict使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pybvc.openflowdev.ofswitch.FlowEntry
的用法示例。
在下文中一共展示了FlowEntry.set_flow_strict方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: print
# 需要导入模块: from pybvc.openflowdev.ofswitch import FlowEntry [as 别名]
# 或者: from pybvc.openflowdev.ofswitch.FlowEntry import set_flow_strict [as 别名]
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
# IPv6 Flow Label
示例2: of_demo_21
# 需要导入模块: from pybvc.openflowdev.ofswitch import FlowEntry [as 别名]
# 或者: from pybvc.openflowdev.ofswitch.FlowEntry import set_flow_strict [as 别名]
def of_demo_21():
f = "cfg.yml"
d = {}
if(load_dict_from_file(f, d) is False):
print("Config file '%s' read error: " % f)
exit()
try:
ctrlIpAddr = d['ctrlIpAddr']
ctrlPortNum = d['ctrlPortNum']
ctrlUname = d['ctrlUname']
ctrlPswd = d['ctrlPswd']
nodeName = d['nodeName']
rundelay = d['rundelay']
except:
print ("Failed to get Controller device attributes")
exit(0)
print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
print ("<<< Demo 21 Start")
print ("<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<")
ctrl = Controller(ctrlIpAddr, ctrlPortNum, ctrlUname, ctrlPswd)
ofswitch = OFSwitch(ctrl, nodeName)
# --- Flow Match: Ethernet Type
# IP DSCP
# IP ECN
# IPv6 Source Address
# IPv6 Destination Address
# IPv6 Flow Label
# IPv6 Extension Header
# TCP Source Port
# TCP Destination Port
# Metadata
eth_type = ETH_TYPE_IPv6
ip_dscp = IP_DSCP_CS6 # 'Class Selector' = 'Internet'
ip_ecn = IP_ECN_CE # 'Congestion Encountered'
ipv6_src = "1234:5678:9ABC:DEF0:FDCD:A987:6543:210F/76"
ipv6_dst = "2000:2abc:edff:fe00::3456/94"
ipv6_flabel = 7
ipv6_exthdr = 0 # 'no next header'
ip_proto = IP_PROTO_TCP
tcp_src_port = 1831
tcp_dst_port = 1006
metadata = "123456789"
# --- Flow Actions: Output (CONTROLLER)
output_port = "CONTROLLER"
print ("<<< 'Controller': %s, 'OpenFlow' switch: '%s'" %
(ctrlIpAddr, nodeName))
print "\n"
print ("<<< Set OpenFlow flow on the Controller")
print (" Match: Ethernet Type (%s)\n"
" IP DSCP (%s)\n"
" IP ECN (%s)\n"
" IPv6 Source Address (%s)\n"
" IPv6 Destination Address (%s)\n"
" IPv6 Flow Label (%s)\n"
" IPv6 Extension Header (%s)\n"
" TCP Source Port (%s)\n"
" TCP Destination Port (%s)\n"
" 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
# IPv6 Flow Label
# IPv6 Extension Header
#.........这里部分代码省略.........