2 * Copyright (c) 2015 Intel Corporation. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.neutron.spi;
10 import java.util.List;
11 import org.opendaylight.controller.md.sal.binding.api.ReadTransaction;
12 import org.opendaylight.controller.md.sal.common.api.data.ReadFailedException;
13 import org.opendaylight.yangtools.yang.common.OperationFailedException;
16 * This interface defines the methods for CRUD of NB neutron objects.
18 public interface INeutronCRUD<T extends INeutronObject<T>> {
21 * Applications call this interface method to determine if a particular Neutron
24 * @param uuid UUID of the Neutron object
25 * @param tx the ReadTransaction within which to perform the check
27 * @throws ReadFailedException if the read failed
29 boolean exists(String uuid, ReadTransaction tx) throws ReadFailedException;
32 * Applications call this interface method to return if a particular
33 * Neutron object exists.
36 * UUID of the Neutron object
37 * @return {@link org.opendaylight.neutron.spi.INeutronObject}
38 * OpenStack Neutron class
39 * @throws ReadFailedException if the read failed
41 T get(String uuid) throws ReadFailedException;
44 * Applications call this interface method to return all Neutron objects.
46 * @return List of OpenStackNeutrons objects
47 * @throws ReadFailedRuntimeException if the read failed
49 List<T> getAll() throws ReadFailedRuntimeException;
52 * Applications call this interface method to add a Neutron object to the
56 * OpenStackNeutron object
57 * @return result with indication on whether the object was added or not and if so why
58 * @throws OperationFailedException if the write (or a required implicit read) failed
60 Result add(T input) throws OperationFailedException;
63 * Applications call this interface method to remove a Neutron object to the
67 * identifier for the neutron object
68 * @return boolean on whether the object was removed or not
69 * @throws OperationFailedException if the remove (or a required implicit read) failed
71 boolean remove(String uuid) throws OperationFailedException;
74 * Applications call this interface method to edit a Neutron object.
77 * identifier of the neutron object
79 * OpenStackNeutron object containing changes to apply
80 * @return boolean on whether the object was updated or not
81 * @throws OperationFailedException if the update (or a required implicit read) failed
83 Result update(String uuid, T delta) throws OperationFailedException;
85 enum Result { Success, AlreadyExists, DoesNotExist, DependencyMissing }