Search in sources :

Example 6 with AfiSafis

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafis in project bgpcep by opendaylight.

the class OpenConfigMappingUtil method toAddPathCapability.

public static List<AddressFamilies> toAddPathCapability(final List<AfiSafi> afiSafis, final BGPTableTypeRegistryConsumer tableTypeRegistry) {
    final List<AddressFamilies> addPathCapability = new ArrayList<>();
    for (final AfiSafi afiSafi : afiSafis) {
        final BgpNeighborAddPathsConfig afiSafi1 = afiSafi.getAugmentation(NeighborAddPathsConfig.class);
        final Optional<BgpTableType> bgpTableType = tableTypeRegistry.getTableType(afiSafi.getAfiSafiName());
        if (afiSafi1 != null && bgpTableType.isPresent()) {
            final AddressFamiliesBuilder builder = new AddressFamiliesBuilder(bgpTableType.get());
            builder.setSendReceive(toSendReceiveMode(afiSafi1));
            addPathCapability.add(builder.build());
        }
    }
    return addPathCapability;
}
Also used : BgpTableType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.BgpTableType) AddressFamilies(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.add.path.capability.AddressFamilies) BgpNeighborAddPathsConfig(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.BgpNeighborAddPathsConfig) AfiSafi(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi) ArrayList(java.util.ArrayList) AddressFamiliesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.add.path.capability.AddressFamiliesBuilder)

Example 7 with AfiSafis

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafis 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

AfiSafi (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafi)6 ArrayList (java.util.ArrayList)3 AfiSafis (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafis)3 BgpTableType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.BgpTableType)3 Test (org.junit.Test)2 AfiSafiBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.AfiSafiBuilder)2 BgpNeighborAddPathsConfig (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.BgpNeighborAddPathsConfig)2 AfiSafisBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.AfiSafisBuilder)2 AddressFamilies (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.add.path.capability.AddressFamilies)2 HashMap (java.util.HashMap)1 AbstractConcurrentDataBrokerTest (org.opendaylight.controller.md.sal.binding.test.AbstractConcurrentDataBrokerTest)1 PathSelectionMode (org.opendaylight.protocol.bgp.mode.api.PathSelectionMode)1 AllPathSelection (org.opendaylight.protocol.bgp.mode.impl.add.all.paths.AllPathSelection)1 AddPathBestNPathSelection (org.opendaylight.protocol.bgp.mode.impl.add.n.paths.AddPathBestNPathSelection)1 BgpPeerTest.createAfiSafi (org.opendaylight.protocol.bgp.rib.impl.config.BgpPeerTest.createAfiSafi)1 GracefulRestartBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.GracefulRestartBuilder)1 StateBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.multiprotocol.rev151009.bgp.common.afi.safi.list.afi.safi.graceful.restart.StateBuilder)1 PrefixesBuilder (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.operational.rev151009.bgp.neighbor.prefix.counters_state.PrefixesBuilder)1 GracefulRestart (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.graceful.restart.GracefulRestart)1 ErrorHandling (org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.rev151009.bgp.neighbor.group.ErrorHandling)1