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

Python auxiliary_functions.remove_extra_items函数代码示例

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

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



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

示例1: http_post_instance_scenario_action

def http_post_instance_scenario_action(tenant_id, instance_id):
    """take an action over a scenario instance"""
    # check valid tenant_id
    if not nfvo.check_tenant(mydb, tenant_id):
        print "httpserver.http_post_instance_scenario_action() tenant %s not found" % tenant_id
        bottle.abort(HTTP_Not_Found, "Tenant %s not found" % tenant_id)
        return
    # parse input data
    http_content = format_in(instance_scenario_action_schema)
    r = af.remove_extra_items(http_content, instance_scenario_action_schema)
    if r is not None:
        print "http_post_instance_scenario_action: Warning: remove extra items ", r
    print "http_post_instance_scenario_action input: ", http_content
    # obtain data
    result, data = mydb.get_instance_scenario(instance_id, tenant_id)
    if result < 0:
        print "http_get_instance_id error %d %s" % (-result, data)
        bottle.abort(-result, data)

    result, data = nfvo.instance_action(mydb, tenant_id, instance_id, http_content)
    if result < 0:
        print "http_post_scenario_action error %d: %s" % (-result, data)
        bottle.abort(-result, data)
    else:
        return format_out(data)
开发者ID:312v,项目名称:playnet,代码行数:25,代码来源:httpserver.py


示例2: http_post_scenario_action

def http_post_scenario_action(tenant_id, scenario_id):
    '''take an action over a scenario'''
    #check valid tenant_id
    if not nfvo.check_tenant(mydb, tenant_id): 
        print 'httpserver.http_post_scenario_action() tenant %s not found' % tenant_id
        bottle.abort(HTTP_Not_Found, 'Tenant %s not found' % tenant_id)
        return
    #parse input data
    http_content,_ = format_in( scenario_action_schema )
    r = af.remove_extra_items(http_content, scenario_action_schema)
    if r is not None: print "http_post_scenario_action: Warning: remove extra items ", r
    
    if "start" in http_content:
        result, data = nfvo.start_scenario(mydb, tenant_id, scenario_id, http_content['start']['instance_name'], \
                    http_content['start'].get('description',http_content['start']['instance_name']),
                    http_content['start'].get('datacenter') )
        if result < 0:
            print "http_post_scenario_action start error %d: %s" % (-result, data)
            bottle.abort(-result, data)
        else:
            return format_out(data)
    elif "deploy" in http_content:   #Equivalent to start
        result, data = nfvo.start_scenario(mydb, tenant_id, scenario_id, http_content['deploy']['instance_name'],
                    http_content['deploy'].get('description',http_content['deploy']['instance_name']),
                    http_content['deploy'].get('datacenter') )
        if result < 0:
            print "http_post_scenario_action deploy error %d: %s" % (-result, data)
            bottle.abort(-result, data)
        else:
            return format_out(data)
    elif "reserve" in http_content:   #Reserve resources
        result, data = nfvo.start_scenario(mydb, tenant_id, scenario_id, http_content['reserve']['instance_name'],
                    http_content['reserve'].get('description',http_content['reserve']['instance_name']),
                    http_content['reserve'].get('datacenter'),  startvms=False )
        if result < 0:
            print "http_post_scenario_action reserve error %d: %s" % (-result, data)
            bottle.abort(-result, data)
        else:
            return format_out(data)
    elif "verify" in http_content:   #Equivalent to start and then delete
        result, data = nfvo.start_scenario(mydb, tenant_id, scenario_id, http_content['verify']['instance_name'],
                    http_content['verify'].get('description',http_content['verify']['instance_name']),
                    http_content['verify'].get('datacenter'), startvms=False )
        if result < 0 or result!=1:
            print "http_post_scenario_action verify error during start %d: %s" % (-result, data)
            bottle.abort(-result, data)
        instance_id = data['uuid']
        result, message = nfvo.delete_instance(mydb, tenant_id,instance_id)
        if result < 0:
            print "http_post_scenario_action verify error during start delete_instance_id %d %s" % (-result, message)
            bottle.abort(-result, message)
        else:
            #print json.dumps(data, indent=4)
            return format_out({"result":"Verify OK"})
开发者ID:bbandaru,项目名称:openmano,代码行数:54,代码来源:httpserver.py


示例3: http_post_datacenters

def http_post_datacenters():
    '''insert a tenant into the catalogue. '''
    #parse input data
    http_content,_ = format_in( datacenter_schema )
    r = af.remove_extra_items(http_content, datacenter_schema)
    if r is not None: print "http_post_tenants: Warning: remove extra items ", r
    result, data = nfvo.new_datacenter(mydb, http_content['datacenter'])
    if result < 0:
        print "http_post_datacenters error %d %s" % (-result, data)
        bottle.abort(-result, data)
    else:
        return http_get_datacenter_id('any', data)
开发者ID:bbandaru,项目名称:openmano,代码行数:12,代码来源:httpserver.py


示例4: http_post_vnfs

def http_post_vnfs(tenant_id):
    '''insert a vnf into the catalogue. Creates the flavor and images in the VIM, and creates the VNF and its internal structure in the OPENMANO DB'''
    print "Parsing the YAML file of the VNF"
    #parse input data
    http_content, used_schema = format_in( vnfd_schema_v01, ("version",), {"v0.2": vnfd_schema_v02})
    r = af.remove_extra_items(http_content, used_schema)
    if r is not None: print "http_post_vnfs: Warning: remove extra items ", r
    result, data = nfvo.new_vnf(mydb,tenant_id,http_content)
    if result < 0:
        print "http_post_vnfs error %d %s" % (-result, data)
        bottle.abort(-result, data)
    else:
        return http_get_vnf_id(tenant_id,data)
开发者ID:bbandaru,项目名称:openmano,代码行数:13,代码来源:httpserver.py


示例5: http_post_tenants

def http_post_tenants():
    """insert a tenant into the catalogue. """
    # parse input data
    http_content = format_in(tenant_schema)
    r = af.remove_extra_items(http_content, tenant_schema)
    if r is not None:
        print "http_post_tenants: Warning: remove extra items ", r
    result, data = nfvo.new_tenant(mydb, http_content["tenant"])
    if result < 0:
        print "http_post_tenants error %d %s" % (-result, data)
        bottle.abort(-result, data)
    else:
        return http_get_tenant_id(data)
开发者ID:312v,项目名称:playnet,代码行数:13,代码来源:httpserver.py


示例6: http_edit_datacenter_id

def http_edit_datacenter_id(datacenter_id):
    '''edit datacenter details, can use both uuid or name'''
    #parse input data
    http_content,_ = format_in( datacenter_edit_schema )
    r = af.remove_extra_items(http_content, datacenter_edit_schema)
    if r is not None: print "http_edit_datacenter_id: Warning: remove extra items ", r
    
    
    result, data = nfvo.edit_datacenter(mydb, datacenter_id, http_content['datacenter'])
    if result < 0:
        print "http_edit_datacenter_id error %d %s" % (-result, data)
        bottle.abort(-result, data)
    else:
        return http_get_datacenter_id('any', datacenter_id)
开发者ID:bbandaru,项目名称:openmano,代码行数:14,代码来源:httpserver.py


示例7: http_edit_network_id

def http_edit_network_id(network_id_name):
    '''edit network details, can use both uuid or name'''
    #parse input data
    http_content,_ = format_in( network_edit_schema )
    r = af.remove_extra_items(http_content, network_edit_schema)
    if r is not None: print "http_edit_network_id: Warning: remove extra items ", r
    
    
    result, network_id = nfvo.edit_network(mydb, network_id_name, http_content['network'])
    if result < 0:
        print "http_edit_network_id error %d %s" % (-result, network_id)
        bottle.abort(-result, network_id)
    else:
        return http_get_network_id('any', network_id)
开发者ID:312v,项目名称:playnetmanotest,代码行数:14,代码来源:httpserver.py


示例8: http_putnettmap_datacenter_id

def http_putnettmap_datacenter_id(tenant_id, datacenter_id, netmap_id):
    '''edit a  netmap'''
    #parse input data
    http_content,_ = format_in( netmap_edit_schema )
    r = af.remove_extra_items(http_content, netmap_edit_schema)
    if r is not None: print "http_putnettmap_datacenter_id: Warning: remove extra items ", r
    
    #obtain data, check that only one exist
    result, content = nfvo.datacenter_edit_netmap(mydb, tenant_id, datacenter_id, netmap_id, http_content)
    if result < 0:
        print "http_putnettmap_datacenter_id error %d %s" % (result, content)
        bottle.abort(-result, content)
    else:
        return http_getnetmap_datacenter_id(tenant_id, datacenter_id, netmap_id)
开发者ID:DorChen,项目名称:openmano,代码行数:14,代码来源:httpserver.py


示例9: http_ssociate_datacenters

def http_ssociate_datacenters(tenant_id, datacenter_id):
    '''associate an existing datacenter to a this tenant. '''
    #parse input data
    http_content = format_in( datacenter_associate_schema )
    r = af.remove_extra_items(http_content, datacenter_associate_schema)
    if r != None: print "http_associate_datacenters: Warning: remove extra items ", r
    result, data = nfvo.associate_datacenter_to_tenant(mydb, tenant_id, datacenter_id, 
                                http_content['datacenter'].get('vim_tenant'),
                                http_content['datacenter'].get('vim_tenant_name') )
    if result < 0:
        print "http_associate_datacenters error %d %s" % (-result, data)
        bottle.abort(-result, data)
    else:
        print "http_associate_datacenters data" , data 
        return http_get_datacenter_id(tenant_id, data)
开发者ID:biddyweb,项目名称:openmano,代码行数:15,代码来源:httpserver.py


示例10: http_action_datacenter_id

def http_action_datacenter_id(tenant_id, datacenter_id):
    '''perform an action over datacenter, can use both uuid or name'''
    #parse input data
    http_content,_ = format_in( datacenter_action_schema )
    r = af.remove_extra_items(http_content, datacenter_action_schema)
    if r is not None: print "http_action_datacenter_id: Warning: remove extra items ", r
    
    #obtain data, check that only one exist
    result, content = nfvo.datacenter_action(mydb, tenant_id, datacenter_id, http_content)
    if result < 0:
        print "http_action_datacenter_id error %d %s" % (result, content)
        bottle.abort(-result, content)
    if 'net-update' in http_content:
        return http_getnetwork_datacenter_id(datacenter_id)
    else:
        return format_out(content)
开发者ID:bbandaru,项目名称:openmano,代码行数:16,代码来源:httpserver.py


示例11: http_post_instances

def http_post_instances(tenant_id):
    '''take an action over a scenario'''
    #check valid tenant_id
    if not nfvo.check_tenant(mydb, tenant_id): 
        print 'httpserver.http_post_scenario_action() tenant %s not found' % tenant_id
        bottle.abort(HTTP_Not_Found, 'Tenant %s not found' % tenant_id)
        return
    #parse input data
    http_content,used_schema = format_in( instance_scenario_create_schema)
    r = af.remove_extra_items(http_content, used_schema)
    if r is not None: print "http_post_instances: Warning: remove extra items ", r
    result, data = nfvo.create_instance(mydb, tenant_id, http_content["instance"])
    if result < 0:
        print "http_post_instances start error %d: %s" % (-result, data)
        bottle.abort(-result, data)
    else:
        return format_out(data)
开发者ID:antoniorafaelbraga,项目名称:openmano,代码行数:17,代码来源:httpserver.py


示例12: http_postnetmap_datacenter_id

def http_postnetmap_datacenter_id(tenant_id, datacenter_id):
    '''creates a new netmap'''
    #parse input data
    http_content,_ = format_in( netmap_new_schema )
    r = af.remove_extra_items(http_content, netmap_new_schema)
    if r is not None: print "http_action_datacenter_id: Warning: remove extra items ", r
    
    #obtain data, check that only one exist
    result, content = nfvo.datacenter_new_netmap(mydb, tenant_id, datacenter_id, http_content)
    if result < 0:
        print "http_postnetmap_datacenter_id error %d %s" % (result, content)
        bottle.abort(-result, content)
    convert_datetime2str(content)
    af.convert_str2boolean(content, ('shared', 'multipoint') )
    print content
    data={'netmaps' : content}
    return format_out(data)
开发者ID:DorChen,项目名称:openmano,代码行数:17,代码来源:httpserver.py


示例13: http_associate_networks

def http_associate_networks(tenant_id, network_id):
    '''associate an existing network to a this tenant. '''
    #parse input data
    http_content,_ = format_in( network_associate_schema )
    r = af.remove_extra_items(http_content, network_associate_schema)
    if r != None: print "http_associate_networks: Warning: remove extra items ", r
    result, data = nfvo.associate_network_to_tenant(mydb, tenant_id, network_id, 
                                http_content['network'].get('vim_tenant'),
                                http_content['network'].get('vim_tenant_name'),
                                http_content['network'].get('vim_username'),
                                http_content['network'].get('vim_password')
                     )
    if result < 0:
        print "http_associate_networks error %d %s" % (-result, data)
        bottle.abort(-result, data)
    else:
        print "http_associate_networks data" , data 
        return http_get_network_id(tenant_id, data)
开发者ID:312v,项目名称:playnetmanotest,代码行数:18,代码来源:httpserver.py


示例14: http_edit_tenant_id

def http_edit_tenant_id(tenant_id):
    '''edit tenant details, can use both uuid or name'''
    #parse input data
    http_content,_ = format_in( tenant_edit_schema )
    r = af.remove_extra_items(http_content, tenant_edit_schema)
    if r is not None: print "http_edit_tenant_id: Warning: remove extra items ", r
    
    #obtain data, check that only one exist
    result, content = mydb.get_table_by_uuid_name('nfvo_tenants', tenant_id)
    if result < 0:
        print "http_edit_tenant_id error %d %s" % (result, content)
        bottle.abort(-result, content)
    
    #edit data 
    tenant_id = content['uuid']
    where={'uuid': content['uuid']}
    result, content = mydb.update_rows('nfvo_tenants', http_content['tenant'], where)
    if result < 0:
        print "http_edit_tenant_id error %d %s" % (result, content)
        bottle.abort(-result, content)

    return http_get_tenant_id(tenant_id)
开发者ID:bbandaru,项目名称:openmano,代码行数:22,代码来源:httpserver.py


示例15: str

     headers_req = {'content-type': 'application/json'}
     payload_req = port_data
     try:
         vim_response = requests.post(self.url_admin+'/ports', headers = headers_req, data=payload_req)
     except requests.exceptions.RequestException, e:
         print "new_external_port Exception: ", e.args
         return -HTTP_Not_Found, str(e.args[0])
     print vim_response
     #print vim_response.status_code
     if vim_response.status_code == 200:
     #print vim_response.json()
     #print json.dumps(vim_response.json(), indent=4)
         res, http_content = af.format_in(vim_response, openmano_schemas.new_port_response_schema)
     #print http_content
         if res:
             r = af.remove_extra_items(http_content, openmano_schemas.new_port_response_schema)
             if r is not None: print "Warning: remove extra items ", r
             #print http_content
             port_id = http_content['port']['id']
             print "Port id: ",port_id
             return vim_response.status_code,port_id
         else: return -HTTP_Bad_Request,http_content
     else:
         #print vim_response.text
         jsonerror = af.format_jsonerror(vim_response)
         text = 'Error in VIM "%s": not possible to add new external port. HTTP Response: %d. Error: %s' % (self.url_admin, vim_response.status_code, jsonerror)
         #print text
         return -vim_response.status_code,text
     
 def new_external_network(self,net_name,net_type):
     '''Adds a external network to VIM (shared)'''
开发者ID:metasensus,项目名称:openmano,代码行数:31,代码来源:vimconnector.py



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
Python blob.im_list_to_blob函数代码示例发布时间:2022-05-26
下一篇:
Python ui.navigate_to函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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