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 id = result if id is None: raise NoIdError("Object does not exist.") obj = DBMock.read(res_type.replace('-', '_'), [id]) VncApiMock.name_to_uuid.pop(obj.get_name()) DBMock.delete(res_type.replace('-', '_'), id)
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 id = result if id is None: raise NoIdError("Object does not exist.") obj = DBMock.read(res_type.replace('-', '_'), [id]) VncApiMock.name_to_uuid.pop(obj.get_name()) DBMock.delete(res_type.replace('-', '_'), id)
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 id = result if id is None: raise NoIdError("Object does not exist.") ok, ret = DBMock.read(res_type.replace('-', '_'), [id]) if (not ok) or (len(ret) < 1): raise NoIdError("Object does not exist.") return VncApiMock.object_from_dict(res_type, ret[0])
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 id = result if id is None: raise NoIdError("Object does not exist.") ok, ret = DBMock.read(res_type.replace('-', '_'), [id]) if (not ok) or (len(ret) < 1): raise NoIdError("Object does not exist.") return VncApiMock.object_from_dict(res_type, ret[0])