2 * Copyright (c) 2017 Cisco and/or its affiliates.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at:
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 package io.fd.honeycomb.translate.bgp;
19 import com.google.common.annotations.Beta;
20 import io.fd.honeycomb.translate.SubtreeManager;
21 import io.fd.honeycomb.translate.write.WriteFailedException;
22 import javax.annotation.Nonnull;
23 import javax.annotation.Nullable;
24 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.Route;
25 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
28 * Responsible for translation of Routes from local RIB and any other side.
29 * Handling all update operations(create, update, delete).
30 * Can be used for RIB to FIB translation.
32 * @param <R> Specific Route derived type, that is handled by this writer
35 public interface RouteWriter<R extends Route> extends SubtreeManager<R> {
37 * Handles create operation.
38 * @param id identifier(from root) of data being written
39 * @param dataAfter new data to be written
40 * @throws WriteFailedException.CreateFailedException if create was unsuccessful
42 void create(@Nonnull final InstanceIdentifier<R> id,
43 @Nullable final R dataAfter) throws WriteFailedException.CreateFailedException;
46 * Handles delete operation.
47 * @param id identifier(from root) of data being deleted
48 * @param dataBefore old data being deleted
49 * @throws WriteFailedException.DeleteFailedException if delete was unsuccessful
51 void delete(@Nonnull final InstanceIdentifier<R> id,
52 @Nullable final R dataBefore) throws WriteFailedException.DeleteFailedException;
55 * Handles update operation.
56 * @param id identifier(from root) of data being updated
57 * @param dataBefore old data
58 * @param dataAfter new, updated data
59 * @throws WriteFailedException.UpdateFailedException if update was unsuccessful
61 void update(@Nonnull final InstanceIdentifier<R> id,
62 @Nullable final R dataBefore,
63 @Nullable final R dataAfter) throws WriteFailedException.UpdateFailedException;