Search in sources :

Example 1 with BGPTableTypeRegistryConsumer

use of org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryConsumer in project bgpcep by opendaylight.

the class RibImpl method createRib.

private RIBImpl createRib(final Global global, final String bgpInstanceName, final BGPTableTypeRegistryConsumer tableTypeRegistry) {
    this.afiSafi = getAfiSafiWithDefault(global.getAfiSafis(), true);
    final Config globalConfig = global.getConfig();
    this.asNumber = globalConfig.getAs();
    this.routerId = globalConfig.getRouterId();
    this.clusterId = getGlobalClusterIdentifier(globalConfig);
    final BGPPeerTrackerImpl peerTracker = new BGPPeerTrackerImpl();
    final Map<TablesKey, PathSelectionMode> pathSelectionModes = OpenConfigMappingUtil.toPathSelectionMode(this.afiSafi, tableTypeRegistry, peerTracker).entrySet().stream().collect(Collectors.toMap(entry -> new TablesKey(entry.getKey().getAfi(), entry.getKey().getSafi()), Map.Entry::getValue));
    final BGPRibRoutingPolicy ribPolicy = this.policyProvider.buildBGPRibPolicy(this.asNumber.getValue(), this.routerId, this.clusterId, RoutingPolicyUtil.getApplyPolicy(global.getApplyPolicy()));
    final CodecsRegistryImpl codecsRegistry = CodecsRegistryImpl.create(codecTreeFactory, this.extensions.getClassLoadingStrategy());
    return new RIBImpl(new RibId(bgpInstanceName), this.asNumber, new BgpId(this.routerId), this.extensions, this.dispatcher, codecsRegistry, this.domBroker, this.dataBroker, ribPolicy, peerTracker, toTableTypes(this.afiSafi, tableTypeRegistry), pathSelectionModes);
}
Also used : OpenConfigMappingUtil.getGlobalClusterIdentifier(org.opendaylight.protocol.bgp.rib.impl.config.OpenConfigMappingUtil.getGlobalClusterIdentifier) LoggerFactory(org.slf4j.LoggerFactory) ListenerRegistration(org.opendaylight.yangtools.concepts.ListenerRegistration) BGPDispatcher(org.opendaylight.protocol.bgp.rib.impl.spi.BGPDispatcher) Rib(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.Rib) TransactionChainListener(org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener) Map(java.util.Map) AfiSafi(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi) RIBImpl(org.opendaylight.protocol.bgp.rib.impl.RIBImpl) YangInstanceIdentifier(org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier) OpenConfigMappingUtil.toTableTypes(org.opendaylight.protocol.bgp.rib.impl.config.OpenConfigMappingUtil.toTableTypes) BindingTransactionChain(org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain) DOMTransactionChain(org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain) DOMDataTreeChangeService(org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService) Ipv4Address(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address) RibId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.RibId) TablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey) Set(java.util.Set) Collectors(java.util.stream.Collectors) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) List(java.util.List) BgpId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId) DOMDataBroker(org.opendaylight.controller.md.sal.dom.api.DOMDataBroker) BGPRibRoutingPolicyFactory(org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.BGPRibRoutingPolicyFactory) DOMSchemaService(org.opendaylight.mdsal.dom.api.DOMSchemaService) SchemaContextListener(org.opendaylight.yangtools.yang.model.api.SchemaContextListener) RIB(org.opendaylight.protocol.bgp.rib.impl.spi.RIB) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) Config(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config) BGPRibRoutingPolicy(org.opendaylight.protocol.bgp.rib.spi.policy.BGPRibRoutingPolicy) RIBSupportContextRegistry(org.opendaylight.protocol.bgp.rib.impl.spi.RIBSupportContextRegistry) CodecsRegistry(org.opendaylight.protocol.bgp.rib.impl.spi.CodecsRegistry) BGPPeerTracker(org.opendaylight.protocol.bgp.rib.spi.BGPPeerTracker) ServiceRegistration(org.osgi.framework.ServiceRegistration) Global(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.top.bgp.Global) Logger(org.slf4j.Logger) BGPRibState(org.opendaylight.protocol.bgp.rib.spi.state.BGPRibState) RibKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.RibKey) PathSelectionMode(org.opendaylight.protocol.bgp.mode.api.PathSelectionMode) BindingCodecTreeFactory(org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTreeFactory) BGPPeerTrackerImpl(org.opendaylight.protocol.bgp.rib.impl.BGPPeerTrackerImpl) Futures(com.google.common.util.concurrent.Futures) BGPRibStateConsumer(org.opendaylight.protocol.bgp.rib.spi.state.BGPRibStateConsumer) BgpTableType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.BgpTableType) OpenConfigMappingUtil.getAfiSafiWithDefault(org.opendaylight.protocol.bgp.rib.impl.config.OpenConfigMappingUtil.getAfiSafiWithDefault) AsNumber(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber) KeyedInstanceIdentifier(org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier) BGPTableTypeRegistryConsumer(org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryConsumer) Preconditions(com.google.common.base.Preconditions) ClusterIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier) CodecsRegistryImpl(org.opendaylight.protocol.bgp.rib.impl.CodecsRegistryImpl) RIBExtensionConsumerContext(org.opendaylight.protocol.bgp.rib.spi.RIBExtensionConsumerContext) BGPRibRoutingPolicy(org.opendaylight.protocol.bgp.rib.spi.policy.BGPRibRoutingPolicy) RibId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.RibId) TablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey) BgpId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId) CodecsRegistryImpl(org.opendaylight.protocol.bgp.rib.impl.CodecsRegistryImpl) Config(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.global.base.Config) BGPPeerTrackerImpl(org.opendaylight.protocol.bgp.rib.impl.BGPPeerTrackerImpl) PathSelectionMode(org.opendaylight.protocol.bgp.mode.api.PathSelectionMode) Map(java.util.Map) RIBImpl(org.opendaylight.protocol.bgp.rib.impl.RIBImpl)

Aggregations

Preconditions (com.google.common.base.Preconditions)1 Futures (com.google.common.util.concurrent.Futures)1 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 List (java.util.List)1 Map (java.util.Map)1 Set (java.util.Set)1 Collectors (java.util.stream.Collectors)1 BindingTransactionChain (org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain)1 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)1 TransactionChainListener (org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener)1 DOMDataBroker (org.opendaylight.controller.md.sal.dom.api.DOMDataBroker)1 DOMDataTreeChangeService (org.opendaylight.controller.md.sal.dom.api.DOMDataTreeChangeService)1 DOMTransactionChain (org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain)1 BindingCodecTreeFactory (org.opendaylight.mdsal.binding.dom.codec.api.BindingCodecTreeFactory)1 DOMSchemaService (org.opendaylight.mdsal.dom.api.DOMSchemaService)1 PathSelectionMode (org.opendaylight.protocol.bgp.mode.api.PathSelectionMode)1 BGPRibRoutingPolicyFactory (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.BGPRibRoutingPolicyFactory)1 BGPTableTypeRegistryConsumer (org.opendaylight.protocol.bgp.openconfig.spi.BGPTableTypeRegistryConsumer)1 BGPPeerTrackerImpl (org.opendaylight.protocol.bgp.rib.impl.BGPPeerTrackerImpl)1 CodecsRegistryImpl (org.opendaylight.protocol.bgp.rib.impl.CodecsRegistryImpl)1