def new_scenario(self, scenario_dict):
        for retry_ in range(0,2):
            created_time = time.time()
            try:
                with self.con:
                    self.cur = self.con.cursor()
                    tenant_id = scenario_dict.get('tenant_id')
                    #scenario
                    INSERT_={'tenant_id': tenant_id,
                    'name': scenario_dict['name'],
                    'description': scenario_dict['description'],
                    'public': scenario_dict.get('public', "false")}
                    
                    r,scenario_uuid =  self._new_row_internal('scenarios', INSERT_, tenant_id, True, None, True,created_time)
                    if r<0:
                        print 'nfvo_db.new_scenario Error inserting at table scenarios: ' + scenario_uuid
                        return r,scenario_uuid
                    #sce_nets
                    for net in scenario_dict['nets'].values():
                        net_dict={'scenario_id': scenario_uuid}
                        net_dict["name"] = net["name"]
                        net_dict["type"] = net["type"]
                        net_dict["description"] = net.get("description")
                        net_dict["external"] = net.get("external", False)
                        if "graph" in net:
                            #net["graph"]=yaml.safe_dump(net["graph"],default_flow_style=True,width=256)
                            #TODO, must be json because of the GUI, change to yaml
                            net_dict["graph"]=json.dumps(net["graph"])
                        created_time += 0.00001
                        r,net_uuid =  self._new_row_internal('sce_nets', net_dict, tenant_id, True, None, True, created_time)
                        if r<0:
                            print 'nfvo_db.new_scenario Error inserting at table sce_vnfs: ' + net_uuid
                            return r, net_uuid
                        net['uuid']=net_uuid
                    #sce_vnfs
                    for k,vnf in scenario_dict['vnfs'].items():
                        INSERT_={'scenario_id': scenario_uuid,
                                'name': k,
                                'vnf_id': vnf['uuid'],
                                #'description': scenario_dict['name']
                                'description': vnf['description']
                            }
                        if "graph" in vnf:
                            #INSERT_["graph"]=yaml.safe_dump(vnf["graph"],default_flow_style=True,width=256)
                            #TODO, must be json because of the GUI, change to yaml
                            INSERT_["graph"]=json.dumps(vnf["graph"])
                        created_time += 0.00001
                        r,scn_vnf_uuid =  self._new_row_internal('sce_vnfs', INSERT_, tenant_id, True, scenario_uuid, True, created_time)
                        if r<0:
                            print 'nfvo_db.new_scenario Error inserting at table sce_vnfs: ' + scn_vnf_uuid
                            return r, scn_vnf_uuid
                        vnf['scn_vnf_uuid']=scn_vnf_uuid
                        #sce_interfaces
                        for iface in vnf['ifaces'].values():
                            print 'iface', iface
                            if 'net_key' not in iface:
                                continue
                            iface['net_id'] = scenario_dict['nets'][ iface['net_key'] ]['uuid']
                            INSERT_={'sce_vnf_id': scn_vnf_uuid,
                                'sce_net_id': iface['net_id'],
                                'interface_id':  iface[ 'uuid' ]
                            }
                            created_time += 0.00001
                            r,iface_uuid =  self._new_row_internal('sce_interfaces', INSERT_, tenant_id, True, scenario_uuid, True, created_time)
                            if r<0:
                                print 'nfvo_db.new_scenario Error inserting at table sce_vnfs: ' + iface_uuid
                                return r, iface_uuid
                            
                    return 1, scenario_uuid
                    
            except (mdb.Error, __HOLE__), e:
                print "nfvo_db.new_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
dataset/ETHPy150Open nfvlabs/openmano/openmano/nfvo_db.py/nfvo_db.new_scenario