use of org.opendaylight.protocol.bgp.mode.impl.add.n.paths.AddPathBestNPathSelection 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();
}
use of org.opendaylight.protocol.bgp.mode.impl.add.n.paths.AddPathBestNPathSelection 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;
}
Aggregations