def get_scenario(self, scenario_id, tenant_id=None, datacenter_id=None): 
        for retry_ in range(0,2):
            try:
                with self.con:
                    self.cur = self.con.cursor(mdb.cursors.DictCursor)
                    #scenario table
                    if af.check_valid_uuid(scenario_id):
                        where_text = "uuid='%s'" % scenario_id
                    else:
                        where_text = "name='%s'" % scenario_id
                    if not tenant_id and tenant_id != "any":
                        where_text += " AND (tenant_id='%s' OR public='True')" % (tenant_id)
                    cmd = "SELECT * FROM scenarios WHERE "+ where_text
                    print cmd
                    self.cur.execute(cmd)
                    rows = self.cur.fetchall()
                    if self.cur.rowcount==0:
                        return -HTTP_Bad_Request, "No scenario found with this criteria " + where_text
                    elif self.cur.rowcount>1:
                        return -HTTP_Bad_Request, "More than one scenario found with this criteria " + where_text
                    scenario_dict = rows[0]
                    
                    #sce_vnfs
                    cmd = "SELECT uuid,name,vnf_id,description FROM sce_vnfs WHERE scenario_id='%s' ORDER BY created_at" % scenario_dict['uuid']
                    self.cur.execute(cmd)
                    scenario_dict['vnfs'] = self.cur.fetchall()
                    for vnf in scenario_dict['vnfs']:
                        #sce_interfaces
                        cmd = "SELECT uuid,sce_net_id,interface_id FROM sce_interfaces WHERE sce_vnf_id='%s' ORDER BY created_at" %vnf['uuid']
                        self.cur.execute(cmd)
                        vnf['interfaces'] = self.cur.fetchall()
                        #vms
                        cmd = "SELECT vms.uuid as uuid, flavor_id, image_id, vms.name as name, vms.description as description " \
                                " FROM vnfs join vms on vnfs.uuid=vms.vnf_id " \
                                " WHERE vnfs.uuid='" + vnf['vnf_id'] +"'"  \
                                " ORDER BY vms.created_at"
                        self.cur.execute(cmd)
                        vnf['vms'] = self.cur.fetchall()
                        for vm in vnf['vms']:
                            if datacenter_id!=None:
                                self.cur.execute("SELECT vim_id FROM datacenters_images WHERE image_id='%s' AND datacenter_id='%s'" %(vm['image_id'],datacenter_id)) 
                                if self.cur.rowcount==1:
                                    vim_image_dict = self.cur.fetchone()
                                    vm['vim_image_id']=vim_image_dict['vim_id']
                                self.cur.execute("SELECT vim_id FROM datacenters_flavors WHERE flavor_id='%s' AND datacenter_id='%s'" %(vm['flavor_id'],datacenter_id)) 
                                if self.cur.rowcount==1:
                                    vim_flavor_dict = self.cur.fetchone()
                                    vm['vim_flavor_id']=vim_flavor_dict['vim_id']
                                
                            #interfaces
                            cmd = "SELECT uuid,internal_name,external_name,net_id,type,vpci,mac,bw,model" \
                                    " FROM interfaces" \
                                    " WHERE vm_id='%s'" \
                                    " ORDER BY created_at" %   vm['uuid']
                            self.cur.execute(cmd)
                            vm['interfaces'] = self.cur.fetchall()
                        #nets    every net of a vms
                        self.cur.execute("SELECT uuid,name,type,description FROM nets WHERE vnf_id='" + vnf['vnf_id'] +"'"  )
                        vnf['nets'] = self.cur.fetchall()
                    #sce_nets
                    cmd = "SELECT uuid,name,type,external,description" \
                          " FROM sce_nets  WHERE scenario_id='%s'" \
                          " ORDER BY created_at " % scenario_dict['uuid']
                    self.cur.execute(cmd)
                    scenario_dict['nets'] = self.cur.fetchall()
                    #datacenter_nets
                    for net in scenario_dict['nets']:
                        if str(net['external']) == 'false':
                            continue
                        WHERE_=" WHERE name='%s'" % net['name']
                        if datacenter_id!=None:
                            WHERE_ += " AND datacenter_id='%s'" % datacenter_id
                        self.cur.execute("SELECT vim_net_id FROM datacenter_nets" + WHERE_ ) 
                        d_net = self.cur.fetchone()
                        if d_net==None or datacenter_id==None:
                            #print "nfvo_db.get_scenario() WARNING external net %s not found"  % net['name']
                            net['vim_id']=None
                        else:
                            net['vim_id']=d_net['vim_net_id']
                    
                    af.convert_datetime2str(scenario_dict)
                    af.convert_str2boolean(scenario_dict, ('public','shared','external') )
                    return 1, scenario_dict
            except (mdb.Error, AttributeError), e:
                print "nfvo_db.get_scenario DB Exception %d: %s" % (e.args[0], e.args[1])
                r,c = self.format_error(e)
                if r!=-HTTP_Request_Timeout or retry_==1: return r,c
Obtain the scenario information, filtering by one or serveral of the tenant, uuid or name
dataset/ETHPy150Open nfvlabs/openmano/openmano/nfvo_db.py/nfvo_db.get_scenario