@bottle.route(url_base + '/<tenant_id>/datacenters', method='GET')
def http_get_datacenters(tenant_id):
    #check valid tenant_id
    if tenant_id != 'any':
        if not nfvo.check_tenant(mydb, tenant_id): 
            print 'httpserver.http_get_datacenters () tenant %s not found' % tenant_id
            bottle.abort(HTTP_Not_Found, 'Tenant %s not found' % tenant_id)
            return
    select_,where_,limit_ = filter_query_string(bottle.request.query, None,
            ('uuid','name','vim_url','type','created_at') )
    if tenant_id != 'any':
        where_['nfvo_tenant_id'] = tenant_id
        if 'created_at' in select_:
            select_[ select_.index('created_at') ] = 'd.created_at as created_at'
        if 'created_at' in where_:
            where_['d.created_at'] = where_.pop('created_at')
        result, content = mydb.get_table(FROM='datacenters as d join tenants_datacenters as td on d.uuid=td.datacenter_id',
                                      SELECT=select_,WHERE=where_,LIMIT=limit_)
    else:
        result, content = mydb.get_table(FROM='datacenters',
                                      SELECT=select_,WHERE=where_,LIMIT=limit_)
    if result < 0:
        print "http_get_datacenters Error", content
        bottle.abort(-result, content)
    else:
        #change_keys_http2db(content, http2db_tenant, reverse=True)
        convert_datetime2str(content)
        data={'datacenters' : content}
        return format_out(data)
dataset/ETHPy150Open nfvlabs/openmano/openmano/httpserver.py/http_get_datacenters/original