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

Python nsxlib.get_all_query_pages函数代码示例

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

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



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

示例1: query_lrouters

def query_lrouters(cluster, fields=None, filters=None):
    return nsxlib.get_all_query_pages(
        nsxlib._build_uri_path(LROUTER_RESOURCE,
                               fields=fields,
                               relations='LogicalRouterStatus',
                               filters=filters),
        cluster)
开发者ID:absolutarin,项目名称:neutron,代码行数:7,代码来源:router.py


示例2: lookup_switches_by_tag

 def lookup_switches_by_tag():
     # Fetch extra logical switches
     lswitch_query_path = nsxlib._build_uri_path(
         LSWITCH_RESOURCE,
         fields="uuid,display_name,tags,lport_count",
         relations="LogicalSwitchStatus",
         filters={'tag': neutron_net_id,
                  'tag_scope': 'quantum_net_id'})
     return nsxlib.get_all_query_pages(lswitch_query_path, cluster)
开发者ID:absolutarin,项目名称:neutron,代码行数:9,代码来源:switch.py


示例3: get_l2_gw_services

def get_l2_gw_services(cluster, tenant_id=None,
                       fields=None, filters=None):
    actual_filters = dict(filters or {})
    if tenant_id:
        actual_filters['tag'] = tenant_id
        actual_filters['tag_scope'] = 'os_tid'
    return get_all_query_pages(
        _build_uri_path(GWSERVICE_RESOURCE,
                        filters=actual_filters),
        cluster)
开发者ID:Doude,项目名称:neutron,代码行数:10,代码来源:l2gateway.py


示例4: get_gateway_devices_status

def get_gateway_devices_status(cluster, tenant_id=None):
    if tenant_id:
        gw_device_query_path = _build_uri_path(
            TRANSPORTNODE_RESOURCE,
            fields="uuid,tags",
            relations="TransportNodeStatus",
            filters={"tag": tenant_id, "tag_scope": "os_tid"},
        )
    else:
        gw_device_query_path = _build_uri_path(
            TRANSPORTNODE_RESOURCE, fields="uuid,tags", relations="TransportNodeStatus"
        )

    response = get_all_query_pages(gw_device_query_path, cluster)
    results = {}
    for item in response:
        results[item["uuid"]] = item["_relations"]["TransportNodeStatus"]["connection"]["connected"]
    return results
开发者ID:raceli,项目名称:neutron,代码行数:18,代码来源:l2gateway.py


示例5: get_gateway_devices_status

def get_gateway_devices_status(cluster, tenant_id=None):
    if tenant_id:
        gw_device_query_path = nsxlib._build_uri_path(
            TRANSPORTNODE_RESOURCE,
            fields="uuid,tags",
            relations="TransportNodeStatus",
            filters={'tag': tenant_id,
                     'tag_scope': 'os_tid'})
    else:
        gw_device_query_path = nsxlib._build_uri_path(
            TRANSPORTNODE_RESOURCE,
            fields="uuid,tags",
            relations="TransportNodeStatus")

    response = nsxlib.get_all_query_pages(gw_device_query_path, cluster)
    results = {}
    for item in response:
        results[item['uuid']] = (item['_relations']['TransportNodeStatus']
                                 ['connection']['connected'])
    return results
开发者ID:HybridCloud-dew,项目名称:hws,代码行数:20,代码来源:l2gateway.py


示例6: query_nat_rules

def query_nat_rules(cluster, router_id, fields="*", filters=None):
    uri = nsxlib._build_uri_path(LROUTERNAT_RESOURCE,
                                 parent_resource_id=router_id,
                                 fields=fields, filters=filters)
    return nsxlib.get_all_query_pages(uri, cluster)
开发者ID:absolutarin,项目名称:neutron,代码行数:5,代码来源:router.py


示例7: get_ports

def get_ports(cluster, networks=None, devices=None, tenants=None):
    vm_filter_obsolete = ""
    vm_filter = ""
    tenant_filter = ""
    # This is used when calling delete_network. Neutron checks to see if
    # the network has any ports.
    if networks:
        # FIXME (Aaron) If we get more than one network_id this won't work
        lswitch = networks[0]
    else:
        lswitch = "*"
    if devices:
        for device_id in devices:
            vm_filter_obsolete = '&'.join(
                ["tag_scope=vm_id",
                 "tag=%s" % utils.device_id_to_vm_id(device_id,
                                                     obfuscate=True),
                 vm_filter_obsolete])
            vm_filter = '&'.join(
                ["tag_scope=vm_id",
                 "tag=%s" % utils.device_id_to_vm_id(device_id),
                 vm_filter])
    if tenants:
        for tenant in tenants:
            tenant_filter = '&'.join(
                ["tag_scope=os_tid",
                 "tag=%s" % tenant,
                 tenant_filter])

    nsx_lports = {}
    lport_fields_str = ("tags,admin_status_enabled,display_name,"
                        "fabric_status_up")
    try:
        lport_query_path_obsolete = (
            "/ws.v1/lswitch/%s/lport?fields=%s&%s%stag_scope=q_port_id"
            "&relations=LogicalPortStatus" %
            (lswitch, lport_fields_str, vm_filter_obsolete, tenant_filter))
        lport_query_path = (
            "/ws.v1/lswitch/%s/lport?fields=%s&%s%stag_scope=q_port_id"
            "&relations=LogicalPortStatus" %
            (lswitch, lport_fields_str, vm_filter, tenant_filter))
        try:
            # NOTE(armando-migliaccio): by querying with obsolete tag first
            # current deployments won't take the performance hit of a double
            # call. In release L-** or M-**, we might want to swap the calls
            # as it's likely that ports with the new tag would outnumber the
            # ones with the old tag
            ports = nsxlib.get_all_query_pages(lport_query_path_obsolete,
                                               cluster)
            if not ports:
                ports = nsxlib.get_all_query_pages(lport_query_path, cluster)
        except exception.NotFound:
            LOG.warn(_LW("Lswitch %s not found in NSX"), lswitch)
            ports = None

        if ports:
            for port in ports:
                for tag in port["tags"]:
                    if tag["scope"] == "q_port_id":
                        nsx_lports[tag["tag"]] = port
    except Exception:
        err_msg = _("Unable to get ports")
        LOG.exception(err_msg)
        raise nsx_exc.NsxPluginException(err_msg=err_msg)
    return nsx_lports
开发者ID:absolutarin,项目名称:neutron,代码行数:65,代码来源:switch.py


示例8: query_security_profiles

def query_security_profiles(cluster, fields=None, filters=None):
    return nsxlib.get_all_query_pages(
        nsxlib._build_uri_path(SECPROF_RESOURCE,
                               fields=fields,
                               filters=filters),
        cluster)
开发者ID:ArifovicH,项目名称:neutron,代码行数:6,代码来源:secgroup.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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