Fix more rib-impl checkstyle
[bgpcep.git] / bgp / rib-impl / src / main / java / org / opendaylight / protocol / bgp / rib / impl / spi / RIBSupportContext.java
1 /*
2  * Copyright (c) 2015 Cisco Systems, Inc. and others.  All rights reserved.
3  *
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
7  */
8 package org.opendaylight.protocol.bgp.rib.impl.spi;
9
10 import java.util.Collection;
11 import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
12 import org.opendaylight.protocol.bgp.rib.spi.RIBSupport;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.path.attributes.Attributes;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.MpReachNlri;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.update.attributes.MpUnreachNlri;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.Route;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.Tables;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
19 import org.opendaylight.yangtools.yang.binding.ChildOf;
20 import org.opendaylight.yangtools.yang.binding.ChoiceIn;
21 import org.opendaylight.yangtools.yang.binding.DataObject;
22 import org.opendaylight.yangtools.yang.binding.Identifiable;
23 import org.opendaylight.yangtools.yang.binding.Identifier;
24 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
25 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
26
27 /**
28  * {@link RIBSupport} wrapper which provides additional functionality
29  * such as logic to update / remove routes using Binding DTOs
30  * for BGP messages.
31  */
32 public abstract class RIBSupportContext {
33     /**
34      * Create specified Rib table structure using supplied transaction.
35      *
36      * @param tx Transaction to to be used
37      * @param tableId Instance Identifier of table to be cleared.
38      */
39     public abstract void createEmptyTableStructure(DOMDataWriteTransaction tx, YangInstanceIdentifier tableId);
40
41     /**
42      * Removes supplied routes from RIB table using supplied transaction.
43      *
44      * @param tx Transaction to be used
45      * @param tableId Instance Identifier of table to be updated
46      * @param nlri UnreachNlri which contains routes to be removed.
47      */
48     public abstract void deleteRoutes(DOMDataWriteTransaction tx, YangInstanceIdentifier tableId, MpUnreachNlri nlri);
49
50     /**
51      * Writes supplied routes and attributes to RIB table using supplied transaction.
52      *
53      * @param tx Transaction to be used
54      * @param tableId Instance Identifier of table to be updated
55      * @param nlri ReachNlri which contains routes to be written.
56      * @param attributes Attributes which should be written.
57      * @return Set of processed route key identifiers
58      */
59     public abstract Collection<NodeIdentifierWithPredicates> writeRoutes(DOMDataWriteTransaction tx,
60                                                                          YangInstanceIdentifier tableId,
61                                                                          MpReachNlri nlri,
62                                                                          Attributes attributes);
63
64     /**
65      * Returns backing RIB support.
66      *
67      * @return RIBSupport
68      */
69     public abstract <C extends Routes & DataObject & ChoiceIn<Tables>, S extends ChildOf<? super C>,
70         R extends Route & ChildOf<? super S> & Identifiable<I>, I extends Identifier<R>>
71             RIBSupport<C, S, R, I> getRibSupport();
72 }