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


Python utils.ip_version_from_int函数代码示例

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


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

示例1: get_request

    def get_request(cls, context, subnet, subnetpool):
        cidr = subnet.get("cidr")
        subnet_id = subnet.get("id", uuidutils.generate_uuid())
        is_any_subnetpool_request = not attributes.is_attr_set(cidr)

        if is_any_subnetpool_request:
            prefixlen = subnet["prefixlen"]
            if not attributes.is_attr_set(prefixlen):
                prefixlen = int(subnetpool["default_prefixlen"])

            return AnySubnetRequest(
                subnet["tenant_id"], subnet_id, common_utils.ip_version_from_int(subnetpool["ip_version"]), prefixlen
            )
        else:
            return SpecificSubnetRequest(
                subnet["tenant_id"], subnet_id, cidr, subnet.get("gateway_ip"), subnet.get("allocation_pools")
            )
开发者ID:walterleonardo,项目名称:neutron,代码行数:17,代码来源:requests.py

示例2: get_request

    def get_request(cls, context, subnet, subnetpool):
        cidr = subnet.get('cidr')
        subnet_id = subnet.get('id', uuidutils.generate_uuid())
        is_any_subnetpool_request = not attributes.is_attr_set(cidr)

        if is_any_subnetpool_request:
            prefixlen = subnet['prefixlen']
            if not attributes.is_attr_set(prefixlen):
                prefixlen = int(subnetpool['default_prefixlen'])

            return AnySubnetRequest(
                subnet['tenant_id'],
                subnet_id,
                common_utils.ip_version_from_int(subnetpool['ip_version']),
                prefixlen)
        else:
            return SpecificSubnetRequest(subnet['tenant_id'],
                                         subnet_id,
                                         cidr)
开发者ID:rajeshmohan,项目名称:neutron,代码行数:19,代码来源:__init__.py

示例3: _make_subnet_request

    def _make_subnet_request(self, tenant_id, subnet, subnetpool):
        cidr = subnet.get('cidr')
        subnet_id = subnet.get('id', uuidutils.generate_uuid())
        is_any_subnetpool_request = not attributes.is_attr_set(cidr)

        if is_any_subnetpool_request:
            prefixlen = subnet['prefixlen']
            if not attributes.is_attr_set(prefixlen):
                prefixlen = int(subnetpool['default_prefixlen'])

            return ipam.AnySubnetRequest(
                          tenant_id,
                          subnet_id,
                          utils.ip_version_from_int(subnetpool['ip_version']),
                          prefixlen)
        else:
            return ipam.SpecificSubnetRequest(tenant_id,
                                              subnet_id,
                                              cidr)
开发者ID:tealover,项目名称:neutron,代码行数:19,代码来源:db_base_plugin_v2.py

示例4: get_request

    def get_request(cls, context, subnet, subnetpool):
        """Return RomanaAnySubnetRequest."""
        LOG.debug("RomanaSubnetRequestFactory.get_request()")
        cidr = subnet.get('cidr')
        subnet_id = subnet.get('id', uuidutils.generate_uuid())
        is_any_subnetpool_request = not attributes.is_attr_set(cidr)

        if is_any_subnetpool_request:
            prefixlen = subnet['prefixlen']
            if not attributes.is_attr_set(prefixlen):
                prefixlen = int(subnetpool['default_prefixlen'])

            return RomanaAnySubnetRequest(
                subnet['tenant_id'],
                subnet_id,
                common_utils.ip_version_from_int(subnetpool['ip_version']),
                prefixlen)
        else:
            return ipam_req.SpecificSubnetRequest(subnet['tenant_id'],
                                                  subnet_id,
                                                  cidr,
                                                  subnet.get('gateway_ip'),
                                                  subnet.get(
                                                      'allocation_pools'))
开发者ID:romana,项目名称:networking-romana,代码行数:24,代码来源:ipam_romana.py

示例5: test_ip_version_from_int_ipv6

 def test_ip_version_from_int_ipv6(self):
     self.assertEqual(utils.ip_version_from_int(6),
                      constants.IPv6)
开发者ID:cisco-openstack,项目名称:neutron,代码行数:3,代码来源:test_utils.py

示例6: test_ip_version_from_int_ipv4

 def test_ip_version_from_int_ipv4(self):
     self.assertEqual(constants.IPv4,
                      utils.ip_version_from_int(4))
开发者ID:TakeshiTseng,项目名称:neutron,代码行数:3,代码来源:test_utils.py

示例7: test_ip_version_from_int_ipv6

 def test_ip_version_from_int_ipv6(self):
     self.assertEqual(constants.IPv6,
                      utils.ip_version_from_int(constants.IP_VERSION_6))
开发者ID:igordcard,项目名称:neutron,代码行数:3,代码来源:test_utils.py


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