本文整理汇总了Python中pybvc.openflowdev.ofswitch.OFSwitch.delete_group方法的典型用法代码示例。如果您正苦于以下问题:Python OFSwitch.delete_group方法的具体用法?Python OFSwitch.delete_group怎么用?Python OFSwitch.delete_group使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pybvc.openflowdev.ofswitch.OFSwitch
的用法示例。
在下文中一共展示了OFSwitch.delete_group方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: of_demo_36
# 需要导入模块: from pybvc.openflowdev.ofswitch import OFSwitch [as 别名]
# 或者: from pybvc.openflowdev.ofswitch.OFSwitch import delete_group [as 别名]
#.........这里部分代码省略.........
" Ethernet Type (%s)" %
(match_in_port, hex(match_eth_type)))
print (" Actions: Apply Group (%s)\n" % group_id)
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 = GroupAction(action_order)
action.set_group_id(group_id)
instruction.add_apply_action(action)
flow_entry1.add_instruction(instruction)
# Match Fields for the Flow Entry
match = Match()
match.set_in_port(match_in_port)
match.set_eth_type(match_eth_type)
flow_entry1.add_match(match)
print ("<<< Flow to send:")
print flow_entry1.get_payload()
time.sleep(rundelay)
result = ofswitch.add_modify_flow(flow_entry1)
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.detailed())
delete_groups(ofswitch, grp_ids_cfg)
delete_flows(ofswitch, table_id, range(first_flow_id, flow_id + 1))
exit(0)
print "\n".strip()
print ("<<< Remove all flows from the Controller")
time.sleep(rundelay)
delete_flows(ofswitch, table_id, range(first_flow_id, flow_id + 1))
print "\n".strip()
print ("<<< Remove all groups from the Controller")
for group_id in grp_ids_cfg:
result = ofswitch.delete_group(group_id)
status = result.get_status()
if(status.eq(STATUS.OK)):
print ("<<< Group '%s' successfully removed from the Controller" %
group_id)
else:
print ("\n").strip()
print ("!!!Error, failed to remove group '%s', reason: %s" %
(group_id, status.detailed()))
print ("\n").strip()
print ("<<< Get OpenFlow Groups Information")
time.sleep(rundelay)
result = ofswitch.get_configured_group_ids()
status = result.get_status()
if(status.eq(STATUS.OK)):
grp_ids_cfg = result.get_data()
elif(status.eq(STATUS.DATA_NOT_FOUND)):
grp_ids_cfg = []
else:
print ("\n").strip()
print ("!!!Error, reason: %s" % status.detailed())
result = ofswitch.get_operational_group_ids()
status = result.get_status()
if(status.eq(STATUS.OK)):
grp_ids_oper = result.get_data()
elif(status.eq(STATUS.DATA_NOT_FOUND)):
grp_ids_oper = []
else:
print ("\n")
print ("!!!Error, reason: %s" % status.detailed())
# Show current state of the Group Table in the Controller's
# configuration and operational data stores
print_groups(grp_ids_cfg, grp_ids_oper)
print ("\n").strip()
print (">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
print (">>> Demo End")
print (">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
示例2: of_demo_34
# 需要导入模块: from pybvc.openflowdev.ofswitch import OFSwitch [as 别名]
# 或者: from pybvc.openflowdev.ofswitch.OFSwitch import delete_group [as 别名]
#.........这里部分代码省略.........
print ("<<< Get group '%s' operational status") % group_id
time.sleep(rundelay)
result = ofswitch.get_group_description(group_id)
status = result.get_status()
if(status.eq(STATUS.OK)):
grp = result.get_data()
print ("Group operational info:")
group = result.get_data()
print json.dumps(group, indent=4)
else:
print ("\n").strip()
print ("!!!Error, reason: %s" % status.detailed())
print ("\n").strip()
print ("<<< Get group '%s' statistics information") % group_id
time.sleep(rundelay)
result = ofswitch.get_group_statistics(group_id)
status = result.get_status()
if(status.eq(STATUS.OK)):
grp = result.get_data()
print ("Group statistics info:")
group = result.get_data()
print json.dumps(group, indent=4)
else:
print ("\n").strip()
print ("!!!Error, reason: %s" % status.detailed())
print ("\n").strip()
print ("<<< Get OpenFlow Groups Information")
time.sleep(rundelay)
result = ofswitch.get_configured_group_ids()
status = result.get_status()
if(status.eq(STATUS.OK)):
grp_ids_cfg = result.get_data()
elif(status.eq(STATUS.DATA_NOT_FOUND)):
grp_ids_cfg = []
else:
print ("\n").strip()
print ("!!!Error, reason: %s" % status.detailed())
result = ofswitch.get_operational_group_ids()
status = result.get_status()
if(status.eq(STATUS.OK)):
grp_ids_oper = result.get_data()
elif(status.eq(STATUS.DATA_NOT_FOUND)):
grp_ids_oper = []
else:
print ("\n").strip()
print ("!!!Error, reason: %s" % status.detailed())
# Show current state of the Group Table in the Controller's
# configuration and operational data stores
print_groups(grp_ids_cfg, grp_ids_oper)
print "\n".strip()
print ("<<< Remove all groups from the Controller")
for group_id in grp_ids_cfg:
result = ofswitch.delete_group(group_id)
status = result.get_status()
if(status.eq(STATUS.OK)):
print ("<<< Group '%s' successfully removed from the Controller"
% group_id)
else:
print ("\n").strip()
print ("!!!Error, failed to remove group '%s', reason: %s"
% (group_id, status.detailed()))
print ("\n").strip()
print ("<<< Get OpenFlow Groups Information")
time.sleep(rundelay)
result = ofswitch.get_configured_group_ids()
status = result.get_status()
if(status.eq(STATUS.OK)):
grp_ids_cfg = result.get_data()
elif(status.eq(STATUS.DATA_NOT_FOUND)):
grp_ids_cfg = []
else:
print ("\n").strip()
print ("!!!Error, reason: %s" % status.detailed())
result = ofswitch.get_operational_group_ids()
status = result.get_status()
if(status.eq(STATUS.OK)):
grp_ids_oper = result.get_data()
elif(status.eq(STATUS.DATA_NOT_FOUND)):
grp_ids_oper = []
else:
print ("\n")
print ("!!!Error, reason: %s" % status.detailed())
# Show current state of the Group Table in the Controller's
# configuration and operational data stores
print_groups(grp_ids_cfg, grp_ids_oper)
print ("\n").strip()
print (">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
print (">>> Demo End")
print (">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>")
示例3: elif
# 需要导入模块: from pybvc.openflowdev.ofswitch import OFSwitch [as 别名]
# 或者: from pybvc.openflowdev.ofswitch.OFSwitch import delete_group [as 别名]
grp_ids_oper = result.get_data()
elif(status.eq(STATUS.DATA_NOT_FOUND)):
grp_ids_oper = []
else:
print ("\n").strip()
print ("!!!Error, reason: %s" % status.detailed())
# Show current state of the Group Table in the Controller's
# configuration and operational data stores
print_groups(grp_ids_cfg, grp_ids_oper)
print "\n".strip()
print ("<<< Remove all groups from the Controller")
for group_id in grp_ids_cfg:
result = ofswitch.delete_group(group_id)
status = result.get_status()
if(status.eq(STATUS.OK)):
print ("<<< Group '%s' successfully removed from the Controller") \
% group_id
else:
print ("\n").strip()
print ("!!!Error, failed to remove group '%s', reason: %s" \
% (group_id, status.detailed()))
print ("\n").strip()
print ("<<< Get OpenFlow Groups Information")
time.sleep(rundelay)
result = ofswitch.get_configured_group_ids()