本文整理汇总了Python中pybvc.openflowdev.ofswitch.Match.set_ip_ecn方法的典型用法代码示例。如果您正苦于以下问题:Python Match.set_ip_ecn方法的具体用法?Python Match.set_ip_ecn怎么用?Python Match.set_ip_ecn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pybvc.openflowdev.ofswitch.Match
的用法示例。
在下文中一共展示了Match.set_ip_ecn方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: of_demo_11
# 需要导入模块: from pybvc.openflowdev.ofswitch import Match [as 别名]
# 或者: from pybvc.openflowdev.ofswitch.Match import set_ip_ecn [as 别名]
#.........这里部分代码省略.........
" ICMPv4 Type (%s)\n"
" ICMPv4 Code (%s)\n"
" Input Port (%s)"
% (hex(eth_type), eth_src,
eth_dst, ipv4_src, ipv4_dst,
ip_proto, ip_dscp, ip_ecn,
icmpv4_type, icmpv4_code,
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 = 18
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(1009)
# --- 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
# IP DSCP
# IP ECN
# ICMPv4 Type
# ICMPv4 Code
# Input Port
match = Match()
match.set_eth_type(eth_type)
match.set_eth_src(eth_src)
match.set_eth_dst(eth_dst)
match.set_ipv4_src(ipv4_src)
match.set_ipv4_dst(ipv4_dst)
match.set_ip_proto(ip_proto)
match.set_ip_dscp(ip_dscp)
match.set_ip_ecn(ip_ecn)
match.set_icmpv4_type(icmpv4_type)
match.set_icmpv4_code(icmpv4_code)
match.set_in_port(input_port)
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)):
print ("<<< Flow successfully added to the Controller")
else:
print ("\n")
print ("!!!Demo terminated, reason: %s" % status.brief().lower())
exit(0)
print ("\n")
print ("<<< Get configured flow from the Controller")
time.sleep(rundelay)
result = ofswitch.get_configured_flow(table_id, flow_id)
status = result.get_status()
if(status.eq(STATUS.OK)):
print ("<<< Flow successfully read from the Controller")
print ("Flow info:")
flow = result.get_data()
print json.dumps(flow, indent=4)
else:
print ("\n")
print ("!!!Demo terminated, reason: %s" % status.brief().lower())
exit(0)
print ("\n")
print ("<<< Delete flow with id of '%s' from the Controller's cache "
"and from the table '%s' on the '%s' node"
% (flow_id, table_id, nodeName))
time.sleep(rundelay)
result = ofswitch.delete_flow(flow_entry.get_flow_table_id(),
flow_entry.get_flow_id())
status = result.get_status()
if(status.eq(STATUS.OK)):
print ("<<< Flow successfully removed from the Controller")
else:
print ("\n")
print ("!!!Demo terminated, reason: %s" % status.brief().lower())
exit(0)
print ("\n")
print (">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
print (">>> Demo End")
print (">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
示例2: number
# 需要导入模块: from pybvc.openflowdev.ofswitch import Match [as 别名]
# 或者: from pybvc.openflowdev.ofswitch.Match import set_ip_ecn [as 别名]
flow_entry.add_instruction(instruction)
# --- Match Fields: Ethernet Type
# IP DSCP
# IP ECN
# IPv6 Source Address
# IPv6 Destination Address
# IPv6 Flow Label
# IP protocol number (ICMPv6)
# ICMPv6 Type
# ICMPv6 Code
# Metadata
match = Match()
match.set_eth_type(eth_type)
match.set_ip_dscp(ip_dscp)
match.set_ip_ecn(ip_ecn)
match.set_ipv6_src(ipv6_src)
match.set_ipv6_dst(ipv6_dst)
match.set_ipv6_flabel(ipv6_flabel)
match.set_ip_proto(ip_proto)
match.set_icmpv6_type(icmpv6_type)
match.set_icmpv6_code(icmpv6_code)
match.set_metadata(metadata)
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)
示例3: of_demo_20
# 需要导入模块: from pybvc.openflowdev.ofswitch import Match [as 别名]
# 或者: from pybvc.openflowdev.ofswitch.Match import set_ip_ecn [as 别名]
#.........这里部分代码省略.........
" IPv6 Flow Label (%s)\n"
" ICMPv6 Type (%s)\n"
" ICMPv6 Code (%s)\n"
" Metadata (%s)" %
(hex(eth_type), ip_dscp, ip_ecn,
ipv6_src, ipv6_dst, ipv6_flabel,
icmpv6_type, icmpv6_code, metadata))
print (" Action: Output (to %s)" % (output_port))
time.sleep(rundelay)
flow_entry = FlowEntry()
table_id = 0
flow_id = 26
flow_entry.set_flow_table_id(table_id)
flow_entry.set_flow_name(flow_name="demo20.py")
flow_entry.set_flow_id(flow_id)
flow_entry.set_flow_priority(flow_priority=1019)
flow_entry.set_flow_cookie(cookie=250)
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: '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
# IP protocol number (ICMPv6)
# ICMPv6 Type
# ICMPv6 Code
# Metadata
match = Match()
match.set_eth_type(eth_type)
match.set_ip_dscp(ip_dscp)
match.set_ip_ecn(ip_ecn)
match.set_ipv6_src(ipv6_src)
match.set_ipv6_dst(ipv6_dst)
match.set_ipv6_flabel(ipv6_flabel)
match.set_ip_proto(ip_proto)
match.set_icmpv6_type(icmpv6_type)
match.set_icmpv6_code(icmpv6_code)
match.set_metadata(metadata)
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)):
print ("<<< Flow successfully added to the Controller")
else:
print ("\n")
print ("!!!Demo terminated, reason: %s" % status.brief().lower())
exit(0)
print ("\n")
print ("<<< Get configured flow from the Controller")
time.sleep(rundelay)
result = ofswitch.get_configured_flow(table_id, flow_id)
status = result.get_status()
if(status.eq(STATUS.OK)):
print ("<<< Flow successfully read from the Controller")
print ("Flow info:")
flow = result.get_data()
print json.dumps(flow, indent=4)
else:
print ("\n")
print ("!!!Demo terminated, reason: %s" % status.brief().lower())
exit(0)
print ("\n")
print ("<<< Delete flow with id of '%s' from the Controller's cache "
"and from the table '%s' on the '%s' node" %
(flow_id, table_id, nodeName))
time.sleep(rundelay)
result = ofswitch.delete_flow(flow_entry.get_flow_table_id(),
flow_entry.get_flow_id())
status = result.get_status()
if(status.eq(STATUS.OK)):
print ("<<< Flow successfully removed from the Controller")
else:
print ("\n")
print ("!!!Demo terminated, reason: %s" % status.brief().lower())
exit(0)
print ("\n")
print (">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
print (">>> Demo End")
print (">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")