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

Python slow.lacp函数代码示例

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

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



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

示例1: _create_lacp

 def _create_lacp(self, datapath, port, req):
     """create a LACP packet."""
     actor_system = datapath.ports[datapath.ofproto.OFPP_LOCAL].hw_addr
     res = slow.lacp(
         actor_system_priority=0xffff,
         actor_system=actor_system,
         actor_key=req.actor_key,
         actor_port_priority=0xff,
         actor_port=port,
         actor_state_activity=req.LACP_STATE_PASSIVE,
         actor_state_timeout=req.actor_state_timeout,
         actor_state_aggregation=req.actor_state_aggregation,
         actor_state_synchronization=req.actor_state_synchronization,
         actor_state_collecting=req.actor_state_collecting,
         actor_state_distributing=req.actor_state_distributing,
         actor_state_defaulted=req.LACP_STATE_OPERATIONAL_PARTNER,
         actor_state_expired=req.LACP_STATE_NOT_EXPIRED,
         partner_system_priority=req.actor_system_priority,
         partner_system=req.actor_system,
         partner_key=req.actor_key,
         partner_port_priority=req.actor_port_priority,
         partner_port=req.actor_port,
         partner_state_activity=req.actor_state_activity,
         partner_state_timeout=req.actor_state_timeout,
         partner_state_aggregation=req.actor_state_aggregation,
         partner_state_synchronization=req.actor_state_synchronization,
         partner_state_collecting=req.actor_state_collecting,
         partner_state_distributing=req.actor_state_distributing,
         partner_state_defaulted=req.actor_state_defaulted,
         partner_state_expired=req.actor_state_expired,
         collector_max_delay=0)
     self.logger.info("SW=%s PORT=%d LACP sent.",
                      dpid_to_str(datapath.id), port)
     self.logger.debug(str(res))
     return res
开发者ID:AkiraSuu,项目名称:ryu,代码行数:35,代码来源:lacplib.py


示例2: test_invalid_partner_state_collecting

 def test_invalid_partner_state_collecting(self):
     l = lacp(self.version,
              self.actor_system_priority,
              self.actor_system,
              self.actor_key,
              self.actor_port_priority,
              self.actor_port,
              self.actor_state_activity,
              self.actor_state_timeout,
              self.actor_state_aggregation,
              self.actor_state_synchronization,
              self.actor_state_collecting,
              self.actor_state_distributing,
              self.actor_state_defaulted,
              self.actor_state_expired,
              self.partner_system_priority,
              self.partner_system,
              self.partner_key,
              self.partner_port_priority,
              self.partner_port,
              self.partner_state_activity,
              self.partner_state_timeout,
              self.partner_state_aggregation,
              self.partner_state_synchronization,
              -1,
              self.partner_state_distributing,
              self.partner_state_defaulted,
              self.partner_state_expired,
              self.collector_max_delay)
     l.serialize()
开发者ID:09beeihaq,项目名称:Coursera-SDN-Assignments,代码行数:30,代码来源:test_slow.py


示例3: setUp

    def setUp(self):
        self.subtype = SLOW_SUBTYPE_LACP
        self.version = lacp.LACP_VERSION_NUMBER
        self.actor_tag = lacp.LACP_TLV_TYPE_ACTOR
        self.actor_length = 20
        self.actor_system_priority = 65534
        self.actor_system = '00:07:0d:af:f4:54'
        self.actor_key = 1
        self.actor_port_priority = 65535
        self.actor_port = 1
        self.actor_state_activity = lacp.LACP_STATE_ACTIVE
        self.actor_state_timeout = lacp.LACP_STATE_LONG_TIMEOUT
        self.actor_state_aggregation = lacp.LACP_STATE_AGGREGATEABLE
        self.actor_state_synchronization = lacp.LACP_STATE_IN_SYNC
        self.actor_state_collecting = lacp.LACP_STATE_COLLECTING_ENABLED
        self.actor_state_distributing = lacp.LACP_STATE_DISTRIBUTING_ENABLED
        self.actor_state_defaulted = lacp.LACP_STATE_OPERATIONAL_PARTNER
        self.actor_state_expired = lacp.LACP_STATE_EXPIRED
        self.actor_state = (
            (self.actor_state_activity << 0) |
            (self.actor_state_timeout << 1) |
            (self.actor_state_aggregation << 2) |
            (self.actor_state_synchronization << 3) |
            (self.actor_state_collecting << 4) |
            (self.actor_state_distributing << 5) |
            (self.actor_state_defaulted << 6) |
            (self.actor_state_expired << 7))
        self.partner_tag = lacp.LACP_TLV_TYPE_PARTNER
        self.partner_length = 20
        self.partner_system_priority = 0
        self.partner_system = '00:00:00:00:00:00'
        self.partner_key = 0
        self.partner_port_priority = 0
        self.partner_port = 0
        self.partner_state_activity = 0
        self.partner_state_timeout = lacp.LACP_STATE_SHORT_TIMEOUT
        self.partner_state_aggregation = 0
        self.partner_state_synchronization = 0
        self.partner_state_collecting = 0
        self.partner_state_distributing = 0
        self.partner_state_defaulted = 0
        self.partner_state_expired = 0
        self.partner_state = (
            (self.partner_state_activity << 0) |
            (self.partner_state_timeout << 1) |
            (self.partner_state_aggregation << 2) |
            (self.partner_state_synchronization << 3) |
            (self.partner_state_collecting << 4) |
            (self.partner_state_distributing << 5) |
            (self.partner_state_defaulted << 6) |
            (self.partner_state_expired << 7))
        self.collector_tag = lacp.LACP_TLV_TYPE_COLLECTOR
        self.collector_length = 16
        self.collector_max_delay = 0
        self.terminator_tag = lacp.LACP_TLV_TYPE_TERMINATOR
        self.terminator_length = 0

        self.head_fmt = lacp._HLEN_PACK_STR
        self.head_len = lacp._HLEN_PACK_LEN
        self.act_fmt = lacp._ACTPRT_INFO_PACK_STR
        self.act_len = lacp._ACTPRT_INFO_PACK_LEN
        self.prt_fmt = lacp._ACTPRT_INFO_PACK_STR
        self.prt_len = lacp._ACTPRT_INFO_PACK_LEN
        self.col_fmt = lacp._COL_INFO_PACK_STR
        self.col_len = lacp._COL_INFO_PACK_LEN
        self.trm_fmt = lacp._TRM_PACK_STR
        self.trm_len = lacp._TRM_PACK_LEN
        self.length = lacp._ALL_PACK_LEN

        self.head_buf = pack(self.head_fmt,
                             self.subtype,
                             self.version)
        self.act_buf = pack(self.act_fmt,
                            self.actor_tag,
                            self.actor_length,
                            self.actor_system_priority,
                            addrconv.mac.text_to_bin(self.actor_system),
                            self.actor_key,
                            self.actor_port_priority,
                            self.actor_port,
                            self.actor_state)
        self.prt_buf = pack(self.prt_fmt,
                            self.partner_tag,
                            self.partner_length,
                            self.partner_system_priority,
                            addrconv.mac.text_to_bin(self.partner_system),
                            self.partner_key,
                            self.partner_port_priority,
                            self.partner_port,
                            self.partner_state)
        self.col_buf = pack(self.col_fmt,
                            self.collector_tag,
                            self.collector_length,
                            self.collector_max_delay)
        self.trm_buf = pack(self.trm_fmt,
                            self.terminator_tag,
                            self.terminator_length)

        self.buf = self.head_buf + self.act_buf + self.prt_buf + \
            self.col_buf + self.trm_buf
#.........这里部分代码省略.........
开发者ID:09beeihaq,项目名称:Coursera-SDN-Assignments,代码行数:101,代码来源:test_slow.py


示例4: lacp_reqreply

def lacp_reqreply(eth_src,
                  actor_system, actor_key, actor_port,
                  actor_state_synchronization=0,
                  actor_state_activity=0,
                  partner_system='00:00:00:00:00:00',
                  partner_key=0,
                  partner_port=0,
                  partner_system_priority=0,
                  partner_port_priority=0,
                  partner_state_defaulted=0,
                  partner_state_expired=0,
                  partner_state_timeout=0,
                  partner_state_collecting=0,
                  partner_state_distributing=0,
                  partner_state_aggregation=0,
                  partner_state_synchronization=0,
                  partner_state_activity=0):
    """Return a LACP frame.

    Args:
        eth_src (str): source Ethernet MAC address.
        actor_system (str): actor system ID (MAC address)
        actor_key (int): actor's LACP key assigned to this port.
        actor_port (int): actor port number.
        actor_state_synchronization (int): 1 if we will use this link.
        actor_state_activity (int): 1 if actively sending LACP.
        partner_system (str): partner system ID (MAC address)
        partner_key (int): partner's LACP key assigned to this port.
        partner_port (int): partner port number.
        partner_system_priority (int): partner's system priority.
        partner_port_priority (int): partner's port priority.
        partner_state_defaulted (int): 1 if partner reverted to defaults.
        partner_state_expired (int): 1 if partner thinks LACP expired.
        partner_state_timeout (int): 1 if partner has short timeout.
        partner_state_collecting (int): 1 if partner receiving on this link.
        partner_state_distributing (int): 1 if partner transmitting on this link.
        partner_state_aggregation (int): 1 if partner can aggregate this link.
        partner_state_synchronization (int): 1 if partner will use this link.
        partner_state_activity (int): 1 if partner actively sends LACP.
    Returns:
        ryu.lib.packet.ethernet: Ethernet packet with header.
    """
    pkt = build_pkt_header(
        None, eth_src, slow.SLOW_PROTOCOL_MULTICAST, valve_of.ether.ETH_TYPE_SLOW)
    lacp_pkt = slow.lacp(
        version=1,
        actor_system=actor_system,
        actor_port=actor_port,
        partner_system=partner_system,
        partner_port=partner_port,
        actor_key=actor_key,
        partner_key=partner_key,
        actor_system_priority=65535,
        partner_system_priority=partner_system_priority,
        actor_port_priority=255,
        partner_port_priority=partner_port_priority,
        actor_state_defaulted=0,
        partner_state_defaulted=partner_state_defaulted,
        actor_state_expired=0,
        partner_state_expired=partner_state_expired,
        actor_state_timeout=1,
        partner_state_timeout=partner_state_timeout,
        actor_state_collecting=1,
        partner_state_collecting=partner_state_collecting,
        actor_state_distributing=1,
        partner_state_distributing=partner_state_distributing,
        actor_state_aggregation=1,
        partner_state_aggregation=partner_state_aggregation,
        actor_state_synchronization=actor_state_synchronization,
        partner_state_synchronization=partner_state_synchronization,
        actor_state_activity=actor_state_activity,
        partner_state_activity=partner_state_activity)
    pkt.add_protocol(lacp_pkt)
    pkt.serialize()
    return pkt
开发者ID:trungdtbk,项目名称:faucet,代码行数:75,代码来源:valve_packet.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python ofproto_parser.header函数代码示例发布时间:2022-05-27
下一篇:
Python packet_utils.checksum函数代码示例发布时间: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