Search in sources :

Example 1 with AllPathSelection

use of org.opendaylight.protocol.bgp.mode.impl.add.all.paths.AllPathSelection 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 2 with AllPathSelection

use of org.opendaylight.protocol.bgp.mode.impl.add.all.paths.AllPathSelection 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)

Aggregations

PathSelectionMode (org.opendaylight.protocol.bgp.mode.api.PathSelectionMode)2 AllPathSelection (org.opendaylight.protocol.bgp.mode.impl.add.all.paths.AllPathSelection)2 ChannelFuture (io.netty.channel.ChannelFuture)1 InetSocketAddress (java.net.InetSocketAddress)1 HashMap (java.util.HashMap)1 Before (org.junit.Before)1 AddPathBestNPathSelection (org.opendaylight.protocol.bgp.mode.impl.add.n.paths.AddPathBestNPathSelection)1 AfiSafi (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi)1 BgpNeighborAddPathsConfig (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.BgpNeighborAddPathsConfig)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