Search in sources :

Example 6 with PathSelectionMode

use of org.opendaylight.protocol.bgp.mode.api.PathSelectionMode in project bgpcep by opendaylight.

the class AddPathAllPathsTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    final Map<TablesKey, PathSelectionMode> pathTables = ImmutableMap.of(TABLES_KEY, new AllPathSelection(this.peerTracker));
    this.ribImpl = new RIBImpl(new RibId("test-rib"), AS_NUMBER, BGP_ID, this.ribExtension, this.serverDispatcher, this.codecsRegistry, getDomBroker(), getDataBroker(), this.policies, this.peerTracker, TABLES_TYPE, pathTables);
    this.ribImpl.instantiateServiceInstance();
    this.ribImpl.onGlobalContextUpdated(this.schemaContext);
    final ChannelFuture channelFuture = this.serverDispatcher.createServer(new InetSocketAddress(RIB_ID, PORT));
    waitFutureSuccess(channelFuture);
    this.serverChannel = channelFuture.channel();
}
Also used : ChannelFuture(io.netty.channel.ChannelFuture) 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) InetSocketAddress(java.net.InetSocketAddress) AllPathSelection(org.opendaylight.protocol.bgp.mode.impl.add.all.paths.AllPathSelection) PathSelectionMode(org.opendaylight.protocol.bgp.mode.api.PathSelectionMode) Before(org.junit.Before)

Example 7 with PathSelectionMode

use of org.opendaylight.protocol.bgp.mode.api.PathSelectionMode in project bgpcep by opendaylight.

the class AddPathBasePathsTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    final TablesKey tk = new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
    final Map<TablesKey, PathSelectionMode> pathTables = ImmutableMap.of(tk, BasePathSelectionModeFactory.createBestPathSelectionStrategy(this.peerTracker));
    this.ribImpl = new RIBImpl(new RibId("test-rib"), AS_NUMBER, new BgpId(RIB_ID), this.ribExtension, this.serverDispatcher, this.codecsRegistry, getDomBroker(), getDataBroker(), this.policies, this.peerTracker, TABLES_TYPE, pathTables);
    this.ribImpl.instantiateServiceInstance();
    this.ribImpl.onGlobalContextUpdated(this.schemaContext);
    final ChannelFuture channelFuture = this.serverDispatcher.createServer(new InetSocketAddress(RIB_ID, PORT));
    waitFutureSuccess(channelFuture);
    this.serverChannel = channelFuture.channel();
}
Also used : ChannelFuture(io.netty.channel.ChannelFuture) 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) InetSocketAddress(java.net.InetSocketAddress) PathSelectionMode(org.opendaylight.protocol.bgp.mode.api.PathSelectionMode) Before(org.junit.Before)

Example 8 with PathSelectionMode

use of org.opendaylight.protocol.bgp.mode.api.PathSelectionMode in project bgpcep by opendaylight.

the class AddPathNPathsTest method setUp.

@Before
public void setUp() throws Exception {
    super.setUp();
    final TablesKey tk = new TablesKey(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
    final Map<TablesKey, PathSelectionMode> pathTables = ImmutableMap.of(tk, new AddPathBestNPathSelection(2L, this.peerTracker));
    this.ribImpl = new RIBImpl(new RibId("test-rib"), AS_NUMBER, new BgpId(RIB_ID), this.ribExtension, this.serverDispatcher, this.codecsRegistry, getDomBroker(), getDataBroker(), this.policies, this.peerTracker, TABLES_TYPE, pathTables);
    this.ribImpl.instantiateServiceInstance();
    this.ribImpl.onGlobalContextUpdated(this.schemaContext);
    final ChannelFuture channelFuture = this.serverDispatcher.createServer(new InetSocketAddress(RIB_ID, PORT));
    waitFutureSuccess(channelFuture);
    this.serverChannel = channelFuture.channel();
}
Also used : ChannelFuture(io.netty.channel.ChannelFuture) 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) AddPathBestNPathSelection(org.opendaylight.protocol.bgp.mode.impl.add.n.paths.AddPathBestNPathSelection) InetSocketAddress(java.net.InetSocketAddress) PathSelectionMode(org.opendaylight.protocol.bgp.mode.api.PathSelectionMode) Before(org.junit.Before)

Example 9 with PathSelectionMode

use of org.opendaylight.protocol.bgp.mode.api.PathSelectionMode in project bgpcep by opendaylight.

the class OpenConfigMappingUtil method toPathSelectionMode.

public static Map<BgpTableType, PathSelectionMode> toPathSelectionMode(final List<AfiSafi> afiSafis, final BGPTableTypeRegistryConsumer tableTypeRegistry, final BGPPeerTracker peerTracker) {
    final Map<BgpTableType, PathSelectionMode> pathSelectionModes = new HashMap<>();
    for (final AfiSafi afiSafi : afiSafis) {
        final BgpNeighborAddPathsConfig afiSafi2 = afiSafi.getAugmentation(GlobalAddPathsConfig.class);
        if (afiSafi2 != null) {
            final Optional<BgpTableType> bgpTableType = tableTypeRegistry.getTableType(afiSafi.getAfiSafiName());
            if (bgpTableType.isPresent()) {
                final Short sendMax = afiSafi2.getSendMax();
                final PathSelectionMode selectionMode;
                if (sendMax > 1) {
                    selectionMode = new AddPathBestNPathSelection(sendMax.longValue(), peerTracker);
                } else {
                    selectionMode = new AllPathSelection(peerTracker);
                }
                pathSelectionModes.put(bgpTableType.get(), selectionMode);
            }
        }
    }
    return pathSelectionModes;
}
Also used : BgpTableType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.BgpTableType) HashMap(java.util.HashMap) BgpNeighborAddPathsConfig(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.BgpNeighborAddPathsConfig) AddPathBestNPathSelection(org.opendaylight.protocol.bgp.mode.impl.add.n.paths.AddPathBestNPathSelection) AfiSafi(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi) AllPathSelection(org.opendaylight.protocol.bgp.mode.impl.add.all.paths.AllPathSelection) PathSelectionMode(org.opendaylight.protocol.bgp.mode.api.PathSelectionMode)

Example 10 with PathSelectionMode

use of org.opendaylight.protocol.bgp.mode.api.PathSelectionMode in project bgpcep by opendaylight.

the class RIBImpl method createLocRibWriter.

private synchronized void createLocRibWriter(final TablesKey key) {
    final RIBSupport ribSupport = this.ribContextRegistry.getRIBSupport(key);
    if (ribSupport == null) {
        return;
    }
    LOG.debug("Creating LocRIB writer for key {}", key);
    final BindingTransactionChain txChain = createPeerChain(this);
    PathSelectionMode pathSelectionStrategy = this.bestPathSelectionStrategies.get(key);
    if (pathSelectionStrategy == null) {
        pathSelectionStrategy = BasePathSelectionModeFactory.createBestPathSelectionStrategy(this.peerTracker);
    }
    final LocRibWriter locRibWriter = LocRibWriter.create(ribSupport, key, txChain, getInstanceIdentifier(), this.localAs, getDataBroker(), this.ribPolicies, this.peerTracker, pathSelectionStrategy);
    registerTotalPathCounter(key, locRibWriter);
    registerTotalPrefixesCounter(key, locRibWriter);
    this.txChainToLocRibWriter.put(txChain, locRibWriter);
}
Also used : BindingTransactionChain(org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain) RIBSupport(org.opendaylight.protocol.bgp.rib.spi.RIBSupport) PathSelectionMode(org.opendaylight.protocol.bgp.mode.api.PathSelectionMode)

Aggregations

PathSelectionMode (org.opendaylight.protocol.bgp.mode.api.PathSelectionMode)12 Test (org.junit.Test)6 RibId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.RibId)6 TablesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey)6 BgpId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.BgpId)5 ChannelFuture (io.netty.channel.ChannelFuture)3 InetSocketAddress (java.net.InetSocketAddress)3 Before (org.junit.Before)3 AfiSafi (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi)3 Ipv4Address (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address)3 BgpTableType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.BgpTableType)3 YangInstanceIdentifier (org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier)3 HashMap (java.util.HashMap)2 BindingTransactionChain (org.opendaylight.controller.md.sal.binding.api.BindingTransactionChain)2 AllPathSelection (org.opendaylight.protocol.bgp.mode.impl.add.all.paths.AllPathSelection)2 AddPathBestNPathSelection (org.opendaylight.protocol.bgp.mode.impl.add.n.paths.AddPathBestNPathSelection)2 Preconditions (com.google.common.base.Preconditions)1 Futures (com.google.common.util.concurrent.Futures)1 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 ArrayList (java.util.ArrayList)1