b539aeefb5e3837ad2800aa2eb2c2bc2e096062d
[bgpcep.git] / bgp / rib-spi / src / main / java / org / opendaylight / protocol / bgp / rib / spi / RIBExtensionConsumerContext.java
1 /*
2  * Copyright (c) 2013 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.spi;
9
10 import org.eclipse.jdt.annotation.NonNull;
11 import org.eclipse.jdt.annotation.Nullable;
12 import org.opendaylight.mdsal.binding.generator.impl.GeneratedClassLoadingStrategy;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.Route;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.Tables;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.TablesKey;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.AddressFamily;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.SubsequentAddressFamily;
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.NodeIdentifierWithPredicates;
25
26 /**
27  * Interface for acquiring AdjRIBsIn factories. In order for a model-driven RIB implementation to work correctly, it
28  * has to know how to handle individual NLRI fields, whose encoding is specific to a AFI/SAFI pair. This interface
29  * exposes an entry point for locating the AFI/SAFI-specific implementation handler.
30  */
31 public interface RIBExtensionConsumerContext {
32
33     /**
34      * Acquire a RIB implementation factory for a AFI/SAFI combination.
35      *
36      * @param key AFI/SAFI key
37      * @return RIBSupport instance, or null if the AFI/SAFI is not implemented.
38      */
39     <C extends Routes & DataObject & ChoiceIn<Tables>, S extends ChildOf<C>,
40         R extends Route & ChildOf<S> & Identifiable<I>, I extends Identifier<R>> @Nullable RIBSupport<C, S, R, I>
41             getRIBSupport(@NonNull TablesKey key);
42
43     /**
44      * Acquire a RIB implementation factory for a AFI/SAFI combination.
45      *
46      * @param afi  Address Family Identifier
47      * @param safi Subsequent Address Family identifier
48      * @return RIBSupport instance, or null if the AFI/SAFI is not implemented.
49      */
50     <C extends Routes & DataObject & ChoiceIn<Tables>, S extends ChildOf<C>,
51         R extends Route & ChildOf<S> & Identifiable<I>, I extends Identifier<R>> @Nullable RIBSupport<C, S, R, I>
52             getRIBSupport(@NonNull Class<? extends AddressFamily> afi,
53                     @NonNull Class<? extends SubsequentAddressFamily> safi);
54
55     /**
56      * Acquire a RIB implementation factory for a AFI/SAFI combination.
57      *
58      * @param key Tables key with AFI/SAFI
59      * @return RIBSupport instance, or null if the AFI/SAFI is not implemented.
60      */
61
62     <C extends Routes & DataObject & ChoiceIn<Tables>, S extends ChildOf<C>,
63         R extends Route & ChildOf<S> & Identifiable<I>, I extends Identifier<R>> @Nullable RIBSupport<C, S, R, I>
64             getRIBSupport(@NonNull NodeIdentifierWithPredicates key);
65
66
67     /**
68      * Returns class loading strategy for loading YANG modeled classes
69      * associated with registered RIB supports.
70      *
71      * @return Class loading strategy for loading YANG modeled classes.
72      */
73     @NonNull GeneratedClassLoadingStrategy getClassLoadingStrategy();
74 }