Drop <R, I> generic from RIBSupport
[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.mdsal.dom.api.DOMDataTreeWriteTransaction;
12 import org.opendaylight.protocol.bgp.rib.spi.RIBSupport;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.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.rib.Tables;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
18 import org.opendaylight.yangtools.yang.binding.ChildOf;
19 import org.opendaylight.yangtools.yang.binding.ChoiceIn;
20 import org.opendaylight.yangtools.yang.binding.DataObject;
21 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
22 import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
23
24 /**
25  * {@link RIBSupport} wrapper which provides additional functionality
26  * such as logic to update / remove routes using Binding DTOs
27  * for BGP messages.
28  */
29 public abstract class RIBSupportContext {
30     /**
31      * Create specified Rib table structure using supplied transaction.
32      *
33      * @param tx Transaction to to be used
34      * @param tableId Instance Identifier of table to be cleared.
35      */
36     public abstract void createEmptyTableStructure(DOMDataTreeWriteTransaction tx, YangInstanceIdentifier tableId);
37
38     /**
39      * Removes supplied routes from RIB table using supplied transaction.
40      *
41      * @param tx Transaction to be used
42      * @param tableId Instance Identifier of table to be updated
43      * @param nlri UnreachNlri which contains routes to be removed.
44      */
45     public abstract void deleteRoutes(DOMDataTreeWriteTransaction tx, YangInstanceIdentifier tableId,
46             MpUnreachNlri nlri);
47
48     /**
49      * Writes supplied routes and attributes to RIB table using supplied transaction.
50      *
51      * @param tx Transaction to be used
52      * @param tableId Instance Identifier of table to be updated
53      * @param nlri ReachNlri which contains routes to be written.
54      * @param attributes Attributes which should be written.
55      * @return Set of processed route key identifiers
56      */
57     public abstract Collection<NodeIdentifierWithPredicates> writeRoutes(DOMDataTreeWriteTransaction tx,
58                                                                          YangInstanceIdentifier tableId,
59                                                                          MpReachNlri nlri,
60                                                                          Attributes attributes);
61
62     /**
63      * Returns backing RIB support.
64      *
65      * @return RIBSupport
66      */
67     public abstract <C extends Routes & DataObject & ChoiceIn<Tables>, S extends ChildOf<? super C>>
68         RIBSupport<C, S> getRibSupport();
69 }