• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python ofproto_parser.msg_pack_into函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中ryu.ofproto.ofproto_parser.msg_pack_into函数的典型用法代码示例。如果您正苦于以下问题:Python msg_pack_into函数的具体用法?Python msg_pack_into怎么用?Python msg_pack_into使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



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

示例1: serialize

    def serialize(self):
        # fixup
        self.length = len(self.value)

        buf = bytearray()
        msg_pack_into(self._PACK_STR, buf, 0, self.type, self.length)
        return buf + bytes(self.value)
开发者ID:Yokoloki,项目名称:RouteFlow,代码行数:7,代码来源:bgp.py


示例2: serialize_value

 def serialize_value(self):
     buf = bytearray()
     ifaddr = ipv4.text_to_bin(self.ifaddr)
     area_id = ipv4.text_to_bin(self.area_id)
     router_id = ipv4.text_to_bin(self.router_id)
     msg_pack_into(self._VALUE_PACK_STR, buf, 0, ifaddr, area_id, router_id, status, 0)
     return buf
开发者ID:LittleHippo,项目名称:SegmentRouting-Ryu,代码行数:7,代码来源:ospfapi.py


示例3: serialize_value

 def serialize_value(self):
     args = []
     for f in self._VALUE_FIELDS:
         args.append(getattr(self, f))
     buf = bytearray()
     msg_pack_into(self._VALUE_PACK_STR, buf, 0, *args)
     return buf
开发者ID:09beeihaq,项目名称:Coursera-SDN-Assignments,代码行数:7,代码来源:bgp.py


示例4: serialize_value

 def serialize_value(self):
     buf = bytearray()
     for comm in self.communities:
         bincomm = bytearray()
         msg_pack_into(self._VALUE_PACK_STR, bincomm, 0, comm)
         buf += bincomm
     return buf
开发者ID:MichalPalatinus,项目名称:ryu,代码行数:7,代码来源:bgp.py


示例5: serialize_cap_value

    def serialize_cap_value(self):
        # fixup
        self.reserved = 0

        buf = bytearray()
        msg_pack_into(self._CAP_PACK_STR, buf, 0,
                      self.afi, self.reserved, self.safi)
        return buf
开发者ID:MichalPalatinus,项目名称:ryu,代码行数:8,代码来源:bgp.py


示例6: _serialize_subfield

 def _serialize_subfield(subfield):
     (field, ofs) = subfield
     buf = bytearray()
     n = ofp.oxm_from_user_header(field)
     ofp.oxm_serialize_header(n, buf, 0)
     assert len(buf) == 4  # only 4-bytes NXM/OXM are defined
     msg_pack_into('!H', buf, 4, ofs)
     return buf
开发者ID:cloudysunny14,项目名称:ryu,代码行数:8,代码来源:nx_actions.py


示例7: serialize

    def serialize(self):
        # fixup
        value = self.serialize_value()
        self.length = len(value)

        buf = bytearray()
        msg_pack_into(self._PACK_STR, buf, 0, self.type, self.length)
        return buf + value
开发者ID:ashishtanwer,项目名称:ryu,代码行数:8,代码来源:bgp.py


示例8: serialize_value

    def serialize_value(self):
        # fixup
        cap_value = self.serialize_cap_value()
        self.cap_length = len(cap_value)

        buf = bytearray()
        msg_pack_into(self._CAP_HDR_PACK_STR, buf, 0, self.cap_code,
                      self.cap_length)
        return buf + cap_value
开发者ID:ashishtanwer,项目名称:ryu,代码行数:9,代码来源:bgp.py


示例9: serialize

    def serialize(self, buf, offset):
        """ Serialize PushGPRSNS action into buffer. """
        super(GPRSActionPushGPRSNS,self).serialize(buf, offset)

        imsi_bytes = imsi_to_bytes(self.imsi)

        LOG.debug("push_gprsns.serialize self="+pprint.pformat(self))
        ofproto_parser.msg_pack_into("!HxxIHBBHBBBBBBBBBx", buf, offset+8, 
                self.subtype, self.tlli, self.bvci, self.sapi, self.nsapi, self.drx_param, 
                len(imsi_bytes), *imsi_bytes)
开发者ID:unifycore,项目名称:ryu,代码行数:10,代码来源:magic.py


示例10: serialize

 def serialize(self, buf, offset):
     # fixup
     data = bytearray()
     msg_pack_into(NXActionRegMove._fmt_str, data, 0,
                   self.n_bits, self.src_ofs, self.dst_ofs)
     # src field
     n = ofp.oxm_from_user_header(self.src_field)
     ofp.oxm_serialize_header(n, data, len(data))
     # dst field
     n = ofp.oxm_from_user_header(self.dst_field)
     ofp.oxm_serialize_header(n, data, len(data))
     payload_offset = (
         ofp.OFP_ACTION_EXPERIMENTER_HEADER_SIZE +
         struct.calcsize(NXAction._fmt_str)
     )
     self.len = utils.round_up(payload_offset + len(data), 8)
     super(NXActionRegMove, self).serialize(buf, offset)
     msg_pack_into('!%ds' % len(data), buf, offset + payload_offset,
                   bytes(data))
开发者ID:cloudysunny14,项目名称:ryu,代码行数:19,代码来源:nx_actions.py


示例11: _test_msg_pack_into

    def _test_msg_pack_into(self, offset_type='e'):
        fmt = '!HH'
        len_ = struct.calcsize(fmt)
        buf = bytearray(len_)
        offset = len_
        arg1 = 1
        arg2 = 2

        if offset_type == 'l':
            offset += 1
        elif offset_type == 'g':
            offset -= 1

        ofproto_parser.msg_pack_into(fmt, buf, offset, arg1, arg2)

        check_offset = len(buf) - len_
        res = struct.unpack_from(fmt, buffer(buf), check_offset)

        eq_(arg1, res[0])
        eq_(arg2, res[1])

        return True
开发者ID:09beeihaq,项目名称:Coursera-SDN-Assignments,代码行数:22,代码来源:test_ofproto_parser.py


示例12: serialize_tail

    def serialize_tail(self):
        # fixup
        binroutes = bytearray()
        for r in self.withdrawn_routes:
            binroutes += r.serialize()
        self.withdrawn_routes_len = len(binroutes)
        binpathattrs = bytearray()
        for pa in self.path_attributes:
            binpathattrs += pa.serialize()
        self.total_path_attribute_len = len(binpathattrs)
        binnlri = bytearray()
        for n in self.nlri:
            binnlri += n.serialize()

        msg = bytearray()
        offset = 0
        msg_pack_into('!H', msg, offset, self.withdrawn_routes_len)
        msg += binroutes
        offset += 2 + self.withdrawn_routes_len
        msg_pack_into('!H', msg, offset, self.total_path_attribute_len)
        msg += binpathattrs
        offset += 2 + self.total_path_attribute_len
        msg += binnlri
        return msg
开发者ID:ashishtanwer,项目名称:ryu,代码行数:24,代码来源:bgp.py


示例13: serialize

 def serialize(self, buf, offset):
     """ Serialize PushGPRSNS action into buffer. """
     super(GPRSActionPushGPRSNS,self).serialize(buf, offset)
     ofproto_parser.msg_pack_into("!HxxIHBBxxxx", buf, offset+8, 
             self.subtype, self.tlli, self.bvci, self.sapi, self.nsapi)
开发者ID:MichalPalatinus,项目名称:ryu,代码行数:5,代码来源:experimenter_switch.py


示例14: serialize

 def serialize(self):
     buf = bytearray()
     msg_pack_into(self._PACK_STR, buf, 0, self.type,
                   bytes(self.serialize_value()))
     return buf
开发者ID:09beeihaq,项目名称:Coursera-SDN-Assignments,代码行数:5,代码来源:bgp.py


示例15: serialize_cap_value

 def serialize_cap_value(self):
     buf = bytearray()
     msg_pack_into(self._CAP_PACK_STR, buf, 0, self.as_number)
     return buf
开发者ID:ashishtanwer,项目名称:ryu,代码行数:4,代码来源:bgp.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python base.call函数代码示例发布时间:2022-05-27
下一篇:
Python ofproto_parser.msg函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap