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


Python ofproto_v1_3.OFP_VERSION属性代码示例

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


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

示例1: stats_reply_handler

# 需要导入模块: from ryu.ofproto import ofproto_v1_3 [as 别名]
# 或者: from ryu.ofproto.ofproto_v1_3 import OFP_VERSION [as 别名]
def stats_reply_handler(self, ev):
        msg = ev.msg
        dp = msg.datapath

        if dp.id not in self.waiters:
            return
        if msg.xid not in self.waiters[dp.id]:
            return
        lock, msgs = self.waiters[dp.id][msg.xid]
        msgs.append(msg)

        flags = 0
        if dp.ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION or \
                dp.ofproto.OFP_VERSION == ofproto_v1_2.OFP_VERSION:
            flags = dp.ofproto.OFPSF_REPLY_MORE
        elif dp.ofproto.OFP_VERSION == ofproto_v1_3.OFP_VERSION:
            flags = dp.ofproto.OFPMPF_REPLY_MORE

        if msg.flags & flags:
            return
        del self.waiters[dp.id][msg.xid]
        lock.set() 
开发者ID:OpenState-SDN,项目名称:ryu,代码行数:24,代码来源:rest_firewall.py

示例2: get_desc_stats

# 需要导入模块: from ryu.ofproto import ofproto_v1_3 [as 别名]
# 或者: from ryu.ofproto.ofproto_v1_3 import OFP_VERSION [as 别名]
def get_desc_stats(self, req, dpid, **_kwargs):

        if type(dpid) == str and not dpid.isdigit():
            LOG.debug('invalid dpid %s', dpid)
            return Response(status=400)

        dp = self.dpset.get(int(dpid))

        if dp is None:
            return Response(status=404)
        _ofp_version = dp.ofproto.OFP_VERSION

        _ofctl = supported_ofctl.get(_ofp_version, None)
        if _ofctl is not None:
            desc = _ofctl.get_desc_stats(dp, self.waiters)

        else:
            LOG.debug('Unsupported OF protocol')
            return Response(status=501)

        body = json.dumps(desc)
        return Response(content_type='application/json', body=body) 
开发者ID:OpenState-SDN,项目名称:ryu,代码行数:24,代码来源:ofctl_rest.py

示例3: get_table_features

# 需要导入模块: from ryu.ofproto import ofproto_v1_3 [as 别名]
# 或者: from ryu.ofproto.ofproto_v1_3 import OFP_VERSION [as 别名]
def get_table_features(self, req, dpid, **_kwargs):

        if type(dpid) == str and not dpid.isdigit():
            LOG.debug('invalid dpid %s', dpid)
            return Response(status=400)

        dp = self.dpset.get(int(dpid))

        if dp is None:
            return Response(status=404)

        _ofp_version = dp.ofproto.OFP_VERSION

        _ofctl = supported_ofctl.get(_ofp_version, None)
        if _ofctl is not None:
            ports = _ofctl.get_table_features(dp, self.waiters)

        else:
            LOG.debug('Unsupported OF protocol')
            return Response(status=501)

        body = json.dumps(ports)
        return Response(content_type='application/json', body=body) 
开发者ID:OpenState-SDN,项目名称:ryu,代码行数:25,代码来源:ofctl_rest.py

示例4: get_port_stats

# 需要导入模块: from ryu.ofproto import ofproto_v1_3 [as 别名]
# 或者: from ryu.ofproto.ofproto_v1_3 import OFP_VERSION [as 别名]
def get_port_stats(self, req, dpid, **_kwargs):

        if type(dpid) == str and not dpid.isdigit():
            LOG.debug('invalid dpid %s', dpid)
            return Response(status=400)

        dp = self.dpset.get(int(dpid))

        if dp is None:
            return Response(status=404)

        _ofp_version = dp.ofproto.OFP_VERSION

        _ofctl = supported_ofctl.get(_ofp_version, None)
        if _ofctl is not None:
            ports = _ofctl.get_port_stats(dp, self.waiters)

        else:
            LOG.debug('Unsupported OF protocol')
            return Response(status=501)

        body = json.dumps(ports)
        return Response(content_type='application/json', body=body) 
开发者ID:OpenState-SDN,项目名称:ryu,代码行数:25,代码来源:ofctl_rest.py

示例5: get_queue_stats

# 需要导入模块: from ryu.ofproto import ofproto_v1_3 [as 别名]
# 或者: from ryu.ofproto.ofproto_v1_3 import OFP_VERSION [as 别名]
def get_queue_stats(self, req, dpid, **_kwargs):

        if type(dpid) == str and not dpid.isdigit():
            LOG.debug('invalid dpid %s', dpid)
            return Response(status=400)

        dp = self.dpset.get(int(dpid))

        if dp is None:
            return Response(status=404)

        _ofp_version = dp.ofproto.OFP_VERSION

        _ofctl = supported_ofctl.get(_ofp_version, None)
        if _ofctl is not None:
            queues = _ofctl.get_queue_stats(dp, self.waiters)

        else:
            LOG.debug('Unsupported OF protocol')
            return Response(status=501)

        body = json.dumps(queues)
        return Response(content_type='application/json', body=body) 
开发者ID:OpenState-SDN,项目名称:ryu,代码行数:25,代码来源:ofctl_rest.py

示例6: get_meter_features

# 需要导入模块: from ryu.ofproto import ofproto_v1_3 [as 别名]
# 或者: from ryu.ofproto.ofproto_v1_3 import OFP_VERSION [as 别名]
def get_meter_features(self, req, dpid, **_kwargs):

        if type(dpid) == str and not dpid.isdigit():
            LOG.debug('invalid dpid %s', dpid)
            return Response(status=400)

        dp = self.dpset.get(int(dpid))

        if dp is None:
            return Response(status=404)

        _ofp_version = dp.ofproto.OFP_VERSION
        _ofctl = supported_ofctl.get(_ofp_version, None)

        if _ofctl is not None and hasattr(_ofctl, 'get_meter_features'):
            meters = _ofctl.get_meter_features(dp, self.waiters)

        else:
            LOG.debug('Unsupported OF protocol or \
                request not supported in this OF protocol version')
            return Response(status=501)

        body = json.dumps(meters)
        return Response(content_type='application/json', body=body) 
开发者ID:OpenState-SDN,项目名称:ryu,代码行数:26,代码来源:ofctl_rest.py

示例7: get_meter_stats

# 需要导入模块: from ryu.ofproto import ofproto_v1_3 [as 别名]
# 或者: from ryu.ofproto.ofproto_v1_3 import OFP_VERSION [as 别名]
def get_meter_stats(self, req, dpid, **_kwargs):

        if type(dpid) == str and not dpid.isdigit():
            LOG.debug('invalid dpid %s', dpid)
            return Response(status=400)

        dp = self.dpset.get(int(dpid))

        if dp is None:
            return Response(status=404)

        _ofp_version = dp.ofproto.OFP_VERSION
        _ofctl = supported_ofctl.get(_ofp_version, None)

        if _ofctl is not None and hasattr(_ofctl, 'get_meter_stats'):
            meters = _ofctl.get_meter_stats(dp, self.waiters)

        else:
            LOG.debug('Unsupported OF protocol or \
                request not supported in this OF protocol version')
            return Response(status=501)

        body = json.dumps(meters)
        return Response(content_type='application/json', body=body) 
开发者ID:OpenState-SDN,项目名称:ryu,代码行数:26,代码来源:ofctl_rest.py

示例8: get_group_features

# 需要导入模块: from ryu.ofproto import ofproto_v1_3 [as 别名]
# 或者: from ryu.ofproto.ofproto_v1_3 import OFP_VERSION [as 别名]
def get_group_features(self, req, dpid, **_kwargs):

        if type(dpid) == str and not dpid.isdigit():
            LOG.debug('invalid dpid %s', dpid)
            return Response(status=400)

        dp = self.dpset.get(int(dpid))

        if dp is None:
            return Response(status=404)

        _ofp_version = dp.ofproto.OFP_VERSION
        _ofctl = supported_ofctl.get(_ofp_version, None)

        if _ofctl is not None and hasattr(_ofctl, 'get_group_features'):
            groups = _ofctl.get_group_features(dp, self.waiters)

        else:
            LOG.debug('Unsupported OF protocol or \
                request not supported in this OF protocol version')
            return Response(status=501)

        body = json.dumps(groups)
        return Response(content_type='application/json', body=body) 
开发者ID:OpenState-SDN,项目名称:ryu,代码行数:26,代码来源:ofctl_rest.py

示例9: get_group_desc

# 需要导入模块: from ryu.ofproto import ofproto_v1_3 [as 别名]
# 或者: from ryu.ofproto.ofproto_v1_3 import OFP_VERSION [as 别名]
def get_group_desc(self, req, dpid, **_kwargs):

        if type(dpid) == str and not dpid.isdigit():
            LOG.debug('invalid dpid %s', dpid)
            return Response(status=400)

        dp = self.dpset.get(int(dpid))

        if dp is None:
            return Response(status=404)

        _ofp_version = dp.ofproto.OFP_VERSION
        _ofctl = supported_ofctl.get(_ofp_version, None)

        if _ofctl is not None and hasattr(_ofctl, 'get_group_desc'):
            groups = _ofctl.get_group_desc(dp, self.waiters)

        else:
            LOG.debug('Unsupported OF protocol or \
                request not supported in this OF protocol version')
            return Response(status=501)

        body = json.dumps(groups)
        return Response(content_type='application/json', body=body) 
开发者ID:OpenState-SDN,项目名称:ryu,代码行数:26,代码来源:ofctl_rest.py

示例10: get_group_stats

# 需要导入模块: from ryu.ofproto import ofproto_v1_3 [as 别名]
# 或者: from ryu.ofproto.ofproto_v1_3 import OFP_VERSION [as 别名]
def get_group_stats(self, req, dpid, **_kwargs):

        if type(dpid) == str and not dpid.isdigit():
            LOG.debug('invalid dpid %s', dpid)
            return Response(status=400)

        dp = self.dpset.get(int(dpid))

        if dp is None:
            return Response(status=404)

        _ofp_version = dp.ofproto.OFP_VERSION
        _ofctl = supported_ofctl.get(_ofp_version, None)

        if _ofctl is not None and hasattr(_ofctl, 'get_group_stats'):
            groups = _ofctl.get_group_stats(dp, self.waiters)

        else:
            LOG.debug('Unsupported OF protocol or \
                request not supported in this OF protocol version')
            return Response(status=501)

        body = json.dumps(groups)
        return Response(content_type='application/json', body=body) 
开发者ID:OpenState-SDN,项目名称:ryu,代码行数:26,代码来源:ofctl_rest.py

示例11: get_port_desc

# 需要导入模块: from ryu.ofproto import ofproto_v1_3 [as 别名]
# 或者: from ryu.ofproto.ofproto_v1_3 import OFP_VERSION [as 别名]
def get_port_desc(self, req, dpid, **_kwargs):

        if type(dpid) == str and not dpid.isdigit():
            LOG.debug('invalid dpid %s', dpid)
            return Response(status=400)

        dp = self.dpset.get(int(dpid))

        if dp is None:
            return Response(status=404)

        _ofp_version = dp.ofproto.OFP_VERSION

        _ofctl = supported_ofctl.get(_ofp_version, None)
        if _ofctl is not None:
            groups = _ofctl.get_port_desc(dp, self.waiters)

        else:
            LOG.debug('Unsupported OF protocol')
            return Response(status=501)

        body = json.dumps(groups)
        return Response(content_type='application/json', body=body) 
开发者ID:OpenState-SDN,项目名称:ryu,代码行数:25,代码来源:ofctl_rest.py

示例12: _stats_reply_handler

# 需要导入模块: from ryu.ofproto import ofproto_v1_3 [as 别名]
# 或者: from ryu.ofproto.ofproto_v1_3 import OFP_VERSION [as 别名]
def _stats_reply_handler(self, ev):
        msg = ev.msg
        dp = msg.datapath

        if (dp.id not in self.waiters
                or msg.xid not in self.waiters[dp.id]):
            return
        event, msgs = self.waiters[dp.id][msg.xid]
        msgs.append(msg)

        if ofproto_v1_3.OFP_VERSION == dp.ofproto.OFP_VERSION:
            more = dp.ofproto.OFPMPF_REPLY_MORE
        else:
            more = dp.ofproto.OFPSF_REPLY_MORE
        if msg.flags & more:
            return
        del self.waiters[dp.id][msg.xid]
        event.set()

    # for OpenFlow version1.0 
开发者ID:OpenState-SDN,项目名称:ryu,代码行数:22,代码来源:rest_router.py

示例13: add_flow

# 需要导入模块: from ryu.ofproto import ofproto_v1_3 [as 别名]
# 或者: from ryu.ofproto.ofproto_v1_3 import OFP_VERSION [as 别名]
def add_flow(self, in_port=None, out_port=None):
        """ Add flow. """
        ofp = self.dp.ofproto
        parser = self.dp.ofproto_parser
        match = parser.OFPMatch(in_port=in_port)
        actions = [parser.OFPActionOutput(out_port)]
        if ofp.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
            mod = parser.OFPFlowMod(
                self.dp, match=match, cookie=0, command=ofp.OFPFC_ADD,
                actions=actions)
        else:
            inst = [parser.OFPInstructionActions(
                ofp.OFPIT_APPLY_ACTIONS, actions)]
            mod = parser.OFPFlowMod(
                self.dp, cookie=0, command=ofp.OFPFC_ADD, match=match,
                instructions=inst)
        return self.send_msg(mod) 
开发者ID:OpenState-SDN,项目名称:ryu,代码行数:19,代码来源:tester.py

示例14: del_flows

# 需要导入模块: from ryu.ofproto import ofproto_v1_3 [as 别名]
# 或者: from ryu.ofproto.ofproto_v1_3 import OFP_VERSION [as 别名]
def del_flows(self, cookie=0):
        """
        Delete all flow except default flow by using the cookie value.

        Note: In OpenFlow 1.0, DELETE and DELETE_STRICT commands can
        not be filtered by the cookie value and this value is ignored.
        """
        ofp = self.dp.ofproto
        parser = self.dp.ofproto_parser
        cookie_mask = 0
        if cookie:
            cookie_mask = 0xffffffffffffffff
        if ofp.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
            match = parser.OFPMatch()
            mod = parser.OFPFlowMod(self.dp, match, cookie, ofp.OFPFC_DELETE)
        else:
            mod = parser.OFPFlowMod(
                self.dp, cookie=cookie, cookie_mask=cookie_mask,
                table_id=ofp.OFPTT_ALL, command=ofp.OFPFC_DELETE,
                out_port=ofp.OFPP_ANY, out_group=ofp.OFPG_ANY)
        return self.send_msg(mod) 
开发者ID:OpenState-SDN,项目名称:ryu,代码行数:23,代码来源:tester.py

示例15: stats_reply_handler

# 需要导入模块: from ryu.ofproto import ofproto_v1_3 [as 别名]
# 或者: from ryu.ofproto.ofproto_v1_3 import OFP_VERSION [as 别名]
def stats_reply_handler(self, ev):
        msg = ev.msg
        dp = msg.datapath

        if dp.id not in self.waiters:
            return
        if msg.xid not in self.waiters[dp.id]:
            return
        lock, msgs = self.waiters[dp.id][msg.xid]
        msgs.append(msg)

        flags = 0
        if dp.ofproto.OFP_VERSION == ofproto_v1_0.OFP_VERSION:
            flags = dp.ofproto.OFPSF_REPLY_MORE
        elif dp.ofproto.OFP_VERSION == ofproto_v1_2.OFP_VERSION:
            flags = dp.ofproto.OFPSF_REPLY_MORE
        elif dp.ofproto.OFP_VERSION >= ofproto_v1_3.OFP_VERSION:
            flags = dp.ofproto.OFPMPF_REPLY_MORE

        if msg.flags & flags:
            return
        del self.waiters[dp.id][msg.xid]
        lock.set() 
开发者ID:PacktPublishing,项目名称:Mastering-Python-Networking,代码行数:25,代码来源:Chapter11_4.py


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