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


Python OFSwitch.add_modify_flow方法代码示例

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


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

示例1: print

# 需要导入模块: from framework.openflowdev.ofswitch import OFSwitch [as 别名]
# 或者: from framework.openflowdev.ofswitch.OFSwitch import add_modify_flow [as 别名]
    
    print ("\n")
    print ("<<< Set OpenFlow flows on the Controller")

    print ("\n")
    print ("<<< Flows to be configured:")
    
    flowEntries = sorted(flowEntries, key=lambda fe: fe.get_flow_priority())
    for fe in flowEntries:
        print (" %s" % fe.to_ofp_oxm_syntax())
    
    
    time.sleep(rundelay)
    success = True
    for fe in flowEntries:
        result = ofswitch.add_modify_flow(fe)
        status = result.get_status()
        if(status.eq(STATUS.OK) == True):
            pass
        else:
            success = False
            print ("\n")
            print ("!!!Demo terminated, failed to add flow:\n '%s'" % fe.to_ofp_oxm_syntax())
            print (" Failure reason: %s" % status.detailed())
    
    if success:
        print "\n"
        print ("<<< Flows successfully added to the Controller")
    else:
        print "\n"
        print ("<<< Removing all flows from the Controller")
开发者ID:jebpublic,项目名称:pydevodl,代码行数:33,代码来源:demo26.py

示例2: Match

# 需要导入模块: from framework.openflowdev.ofswitch import OFSwitch [as 别名]
# 或者: from framework.openflowdev.ofswitch.OFSwitch import add_modify_flow [as 别名]
    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_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")
开发者ID:Elbrys,项目名称:pydevodl,代码行数:33,代码来源:demo8.py

示例3: Match

# 需要导入模块: from framework.openflowdev.ofswitch import OFSwitch [as 别名]
# 或者: from framework.openflowdev.ofswitch.OFSwitch import add_modify_flow [as 别名]
 
 flow_entry1.add_instruction(instruction)
 
 match = Match()
 
 match.set_eth_type(arp_eth_type)
 match.set_vlan_id(customer_vlan_id)
 match.set_in_port(in_port = customer_port)
 
 flow_entry1.add_match(match)
 
 print ("\n")
 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) == True):
     print ("<<< Flow successfully added to the Controller")
 else:
     print ("\n")
     print ("!!!Demo terminated, reason: %s" % status.detailed())
     delete_flows(ofswitch, table_id, range(first_flow_id, flow_id+1))
     exit(0)
 
 # ---------------------------------------------------
 # Second flow entry
 # ---------------------------------------------------
 print "\n"
 print ("<<< Set OpenFlow flow on the Controller")
 print ("        Match:  Ethernet Type (%s)\n"
开发者ID:jebpublic,项目名称:pydevodl,代码行数:33,代码来源:demo25.py


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