Search in sources :

Example 1 with RIBExtensionProviderContext

use of org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext in project bgpcep by opendaylight.

the class AbstractRIBTestSetup method mockRib.

public void mockRib() throws Exception {
    final RIBExtensionProviderContext context = new SimpleRIBExtensionProviderContext();
    final ModuleInfoBackedContext strategy = createClassLoadingStrategy();
    final SchemaContext schemaContext = strategy.tryToCreateSchemaContext().get();
    this.codecFactory = createCodecFactory(strategy, schemaContext);
    final List<BgpTableType> localTables = new ArrayList<>();
    localTables.add(new BgpTableTypeImpl(AFI, SAFI));
    this.a1 = new RIBActivator();
    this.a1.startRIBExtensionProvider(context);
    final CodecsRegistryImpl codecsRegistry = CodecsRegistryImpl.create(this.codecFactory, GeneratedClassLoadingStrategy.getTCCLClassLoadingStrategy());
    mockedMethods();
    doReturn(mock(ClusterSingletonServiceRegistration.class)).when(this.clusterSingletonServiceProvider).registerClusterSingletonService(any(ClusterSingletonService.class));
    this.rib = new RIBImpl(new RibId("test"), new AsNumber(5L), RIB_ID, context, this.dispatcher, codecsRegistry, this.dom, getDataBroker(), this.policies, this.peerTracker, localTables, Collections.singletonMap(new TablesKey(AFI, SAFI), BasePathSelectionModeFactory.createBestPathSelectionStrategy(this.peerTracker)));
    this.rib.onGlobalContextUpdated(schemaContext);
    this.ribSupport = getRib().getRibSupportContext().getRIBSupport(KEY);
}
Also used : BgpTableType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.BgpTableType) TablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey) RIBActivator(org.opendaylight.protocol.bgp.inet.RIBActivator) ArrayList(java.util.ArrayList) AsNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber) ModuleInfoBackedContext(org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext) SimpleRIBExtensionProviderContext(org.opendaylight.protocol.bgp.rib.spi.SimpleRIBExtensionProviderContext) RibId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.RibId) SimpleRIBExtensionProviderContext(org.opendaylight.protocol.bgp.rib.spi.SimpleRIBExtensionProviderContext) RIBExtensionProviderContext(org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext) ClusterSingletonServiceRegistration(org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration) ClusterSingletonService(org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService) SchemaContext(org.opendaylight.yangtools.yang.model.api.SchemaContext) BgpTableTypeImpl(org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl)

Example 2 with RIBExtensionProviderContext

use of org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext in project bgpcep by opendaylight.

the class RIBActivatorTest method testRIBActivator.

@Test
public void testRIBActivator() {
    final RIBActivator ribAct = new RIBActivator();
    final RIBExtensionProviderContext context = new SimpleRIBExtensionProviderContext();
    assertNull(context.getRIBSupport(L2vpnAddressFamily.class, EvpnSubsequentAddressFamily.class));
    ribAct.startRIBExtensionProvider(context);
    assertNotNull(context.getRIBSupport(L2vpnAddressFamily.class, EvpnSubsequentAddressFamily.class));
    ribAct.close();
}
Also used : SimpleRIBExtensionProviderContext(org.opendaylight.protocol.bgp.rib.spi.SimpleRIBExtensionProviderContext) L2vpnAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.L2vpnAddressFamily) RIBExtensionProviderContext(org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext) SimpleRIBExtensionProviderContext(org.opendaylight.protocol.bgp.rib.spi.SimpleRIBExtensionProviderContext) EvpnSubsequentAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.EvpnSubsequentAddressFamily) Test(org.junit.Test)

Example 3 with RIBExtensionProviderContext

use of org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext in project bgpcep by opendaylight.

the class ActivatorTest method testRIBActivator.

@Test
public void testRIBActivator() {
    final RIBActivator ribAct = new RIBActivator();
    final RIBExtensionProviderContext context = new SimpleRIBExtensionProviderContext();
    assertNull(context.getRIBSupport(LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class));
    ribAct.startRIBExtensionProvider(context);
    assertNotNull(context.getRIBSupport(LinkstateAddressFamily.class, LinkstateSubsequentAddressFamily.class));
    ribAct.close();
}
Also used : SimpleRIBExtensionProviderContext(org.opendaylight.protocol.bgp.rib.spi.SimpleRIBExtensionProviderContext) RIBExtensionProviderContext(org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext) SimpleRIBExtensionProviderContext(org.opendaylight.protocol.bgp.rib.spi.SimpleRIBExtensionProviderContext) RIBActivator(org.opendaylight.protocol.bgp.linkstate.impl.RIBActivator) LinkstateSubsequentAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.LinkstateSubsequentAddressFamily) LinkstateAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.LinkstateAddressFamily) Test(org.junit.Test)

Aggregations

RIBExtensionProviderContext (org.opendaylight.protocol.bgp.rib.spi.RIBExtensionProviderContext)3 SimpleRIBExtensionProviderContext (org.opendaylight.protocol.bgp.rib.spi.SimpleRIBExtensionProviderContext)3 Test (org.junit.Test)2 ArrayList (java.util.ArrayList)1 ModuleInfoBackedContext (org.opendaylight.mdsal.binding.generator.impl.ModuleInfoBackedContext)1 ClusterSingletonService (org.opendaylight.mdsal.singleton.common.api.ClusterSingletonService)1 ClusterSingletonServiceRegistration (org.opendaylight.mdsal.singleton.common.api.ClusterSingletonServiceRegistration)1 RIBActivator (org.opendaylight.protocol.bgp.inet.RIBActivator)1 RIBActivator (org.opendaylight.protocol.bgp.linkstate.impl.RIBActivator)1 BgpTableTypeImpl (org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl)1 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)1 EvpnSubsequentAddressFamily (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.EvpnSubsequentAddressFamily)1 L2vpnAddressFamily (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev171213.L2vpnAddressFamily)1 LinkstateAddressFamily (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.LinkstateAddressFamily)1 LinkstateSubsequentAddressFamily (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.LinkstateSubsequentAddressFamily)1 BgpTableType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.BgpTableType)1 RibId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.RibId)1 TablesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey)1 SchemaContext (org.opendaylight.yangtools.yang.model.api.SchemaContext)1