def update(res_type, obj):
     if not obj.uuid:
         obj.uuid = VncApiMock.name_to_id(res_type, obj.name)
     if obj.uuid is None:
         raise NoIdError("Object does not exist.")
     if obj.uuid not in DBMock.get_dict(res_type.replace('-', '_')):
         raise NoIdError("Object does not exist.")
     DBMock.update(res_type.replace('-', '_'), obj.uuid,
                   VncApiMock.object_to_dict(obj))
 def read(res_type, fq_name=None, fq_name_str=None, id=None, fields=None):
     (args_ok,
      result) = VncApiMock._read_args_to_id(res_type, fq_name, fq_name_str,
                                            id)
     if not args_ok:
         return result
     if result is None:
         raise NoIdError("Object does not exist.")
     ok, ret = DBMock.read(res_type.replace('-', '_'), [result])
     if (not ok) or (len(ret) < 1):
         raise NoIdError("Object does not exist.")
     return VncApiMock.object_from_dict(res_type, ret[0])
 def delete(res_type, fq_name=None, id=None, ifmap_id=None):
     (args_ok, result) = VncApiMock._read_args_to_id(res_type,
                                                     fq_name=fq_name,
                                                     id=id)
     if not args_ok:
         return result
     if result is None:
         raise NoIdError("Object does not exist.")
     obj = DBMock.read(res_type.replace('-', '_'), [result])
     VncApiMock.name_to_uuid.pop(obj.get_name())
     DBMock.delete(res_type.replace('-', '_'), result)