当前位置: 首页>>代码示例>>Python>>正文


Python OFSwitch.add_modify_group方法代码示例

本文整理汇总了Python中pybvc.openflowdev.ofswitch.OFSwitch.add_modify_group方法的典型用法代码示例。如果您正苦于以下问题:Python OFSwitch.add_modify_group方法的具体用法?Python OFSwitch.add_modify_group怎么用?Python OFSwitch.add_modify_group使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pybvc.openflowdev.ofswitch.OFSwitch的用法示例。


在下文中一共展示了OFSwitch.add_modify_group方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: of_demo_36

# 需要导入模块: from pybvc.openflowdev.ofswitch import OFSwitch [as 别名]
# 或者: from pybvc.openflowdev.ofswitch.OFSwitch import add_modify_group [as 别名]

#.........这里部分代码省略.........
    group_entry = GroupEntry(group_id, group_type)
    group_entry.set_group_name(group_name)

    # Fill in group entry with action buckets
    # ---------
    bucket_id = 0
    bucket1 = GroupBucket(bucket_id)
    bucket1.set_watch_port(watch_port1)
    action = OutputAction(order=0, port=out_port1)
    bucket1.add_action(action)
    group_entry.add_bucket(bucket1)

    # ---------
    bucket_id += 1
    bucket2 = GroupBucket(bucket_id)
    bucket2.set_watch_port(watch_port2)
    action = OutputAction(order=0, port=out_port2)
    bucket2.add_action(action)
    group_entry.add_bucket(bucket2)

    # ---------
    bucket_id += 1
    bucket3 = GroupBucket(bucket_id)
    bucket3.set_watch_port(watch_port3)
    action = OutputAction(order=0, port=out_port3)
    bucket3.add_action(action)
    group_entry.add_bucket(bucket3)

    # Request Controller to create the group
    print "\n".strip()
    print ("<<< Group to create:")
    print group_entry.get_payload()
    time.sleep(rundelay)
    result = ofswitch.add_modify_group(group_entry)
    status = result.get_status()
    if(status.eq(STATUS.OK)):
        print ("<<< Group successfully added")
        grp_ids_oper = result.get_data()
    else:
        print ("\n").strip()
        print ("!!!Demo terminated, reason: %s" % status.detailed())
        exit(0)

    print ("\n").strip()
    print ("<<< Get group '%s' configuration status") % group_id
    time.sleep(rundelay)
    result = ofswitch.get_configured_group(group_id)
    status = result.get_status()
    if(status.eq(STATUS.OK)):
        print ("Group configuration info:")
        group = result.get_data()
        print json.dumps(group, indent=4)
    else:
        print ("\n").strip()
        print ("!!!Demo terminated, reason: %s" % status.detailed())
        exit(0)

    print ("\n").strip()
    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)):
        print ("Group operational info:")
        group = result.get_data()
        print json.dumps(group, indent=4)
开发者ID:BillTheBest,项目名称:pybvc,代码行数:70,代码来源:demo36.py

示例2: of_demo_34

# 需要导入模块: from pybvc.openflowdev.ofswitch import OFSwitch [as 别名]
# 或者: from pybvc.openflowdev.ofswitch.OFSwitch import add_modify_group [as 别名]

#.........这里部分代码省略.........
    group_entry = GroupEntry(group_id, group_type)
    group_entry.set_group_name(group_name)

    # Fill in group entry with action buckets
    # ---------
    bucket_id = 0
    bucket1 = GroupBucket(bucket_id)
    bucket1.set_weight(weight1)
    action = OutputAction(order=0, port=out_port1)
    bucket1.add_action(action)
    group_entry.add_bucket(bucket1)

    # ---------
    bucket_id += 1
    bucket2 = GroupBucket(bucket_id)
    bucket2.set_weight(weight2)
    action = OutputAction(order=0, port=out_port2)
    bucket2.add_action(action)
    group_entry.add_bucket(bucket2)

    # ---------
    bucket_id += 1
    bucket3 = GroupBucket(bucket_id)
    bucket3.set_weight(weight3)
    action = OutputAction(order=0, port=out_port3)
    bucket3.add_action(action)
    group_entry.add_bucket(bucket3)

    # Request Controller to create the group
    print "\n".strip()
    print ("<<< Group to create:")
    print group_entry.get_payload()
    time.sleep(rundelay)
    result = ofswitch.add_modify_group(group_entry)
    status = result.get_status()
    if(status.eq(STATUS.OK)):
        print ("<<< Group successfully added")
        grp_ids_oper = result.get_data()
    else:
        print ("\n").strip()
        print ("!!!Demo terminated, reason: %s" % status.detailed())
        exit(0)

    print ("\n").strip()
    print ("<<< Get group '%s' configuration status") % group_id
    time.sleep(rundelay)
    result = ofswitch.get_configured_group(group_id)
    status = result.get_status()
    if(status.eq(STATUS.OK)):
        grp = result.get_data()
        print ("Group configuration info:")
        group = result.get_data()
        print json.dumps(group, indent=4)
    else:
        print ("\n").strip()
        print ("!!!Demo terminated, reason: %s" % status.detailed())
        exit(0)

    print ("\n").strip()
    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:")
开发者ID:pruiksmalw,项目名称:pybvc,代码行数:70,代码来源:demo34.py

示例3: OutputAction

# 需要导入模块: from pybvc.openflowdev.ofswitch import OFSwitch [as 别名]
# 或者: from pybvc.openflowdev.ofswitch.OFSwitch import add_modify_group [as 别名]
 bucket.add_action(action1)
 
 action_order += 1
 action2 = OutputAction(action_order)
 action2.set_outport(out_port)
 bucket.add_action(action2)
 
 # Add actions bucket to the group entry
 group_entry.add_bucket(bucket)
 
 # Request Controller to create the group
 print "\n".strip()
 print ("<<< Group to create:")
 print group_entry.get_payload()
 time.sleep(rundelay)
 result = ofswitch.add_modify_group(group_entry)
 status = result.get_status()
 if(status.eq(STATUS.OK)):
     print ("<<< Group successfully added")
     grp_ids_oper = result.get_data()
 else:
     print ("\n").strip()
     print ("!!!Demo terminated, reason: %s" % status.detailed())
     exit(0)
 
 
 print ("\n").strip()
 print ("<<< Get group '%s' configuration status") % group_id
 time.sleep(rundelay)
 result = ofswitch.get_configured_group(group_id)
 status = result.get_status()
开发者ID:jebpublic,项目名称:pybvcsamples,代码行数:33,代码来源:demo35.py


注:本文中的pybvc.openflowdev.ofswitch.OFSwitch.add_modify_group方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。