Search in sources :

Example 1 with NeighborSet

use of org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.neighbor.set.NeighborSet in project bgpcep by opendaylight.

the class MatchBgpNeighborSetHandler method loadRoleSets.

private List<PeerId> loadRoleSets(final String key) throws ExecutionException, InterruptedException {
    final ReadOnlyTransaction tr = this.dataBroker.newReadOnlyTransaction();
    final Optional<NeighborSet> result = tr.read(LogicalDatastoreType.CONFIGURATION, NEIGHBOR_SET_IID.child(NeighborSet.class, new NeighborSetKey(key))).get();
    if (!result.isPresent()) {
        return Collections.emptyList();
    }
    return result.get().getNeighbor().stream().map(nei -> RouterIds.createPeerId(nei.getAddress())).collect(Collectors.toList());
}
Also used : LoadingCache(com.google.common.cache.LoadingCache) PeerId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerId) RouterIds(org.opendaylight.protocol.bgp.rib.spi.RouterIds) NeighborSet(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.neighbor.set.NeighborSet) StringUtils(org.apache.commons.lang3.StringUtils) ReadOnlyTransaction(org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction) MatchSetOptionsRestrictedType(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.policy.types.rev151009.MatchSetOptionsRestrictedType) BGPRouteEntryImportParameters(org.opendaylight.protocol.bgp.rib.spi.policy.BGPRouteEntryImportParameters) Optional(com.google.common.base.Optional) Objects.requireNonNull(java.util.Objects.requireNonNull) RouteEntryBaseAttributes(org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.RouteEntryBaseAttributes) Nonnull(javax.annotation.Nonnull) Attributes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes) Nullable(javax.annotation.Nullable) DefinedSets(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.DefinedSets) BGPRouteEntryExportParameters(org.opendaylight.protocol.bgp.rib.spi.policy.BGPRouteEntryExportParameters) BgpConditionsAugmentationPolicy(org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.condition.BgpConditionsAugmentationPolicy) MatchBgpNeighborSet(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp._default.policy.rev180109.match.bgp.neighbor.grouping.MatchBgpNeighborSet) LogicalDatastoreType(org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType) RoutingPolicy(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.RoutingPolicy) Collectors(java.util.stream.Collectors) NeighborSetKey(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.neighbor.set.NeighborSetKey) DataBroker(org.opendaylight.controller.md.sal.binding.api.DataBroker) NeighborSets(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.generic.defined.sets.NeighborSets) CacheLoader(com.google.common.cache.CacheLoader) ExecutionException(java.util.concurrent.ExecutionException) List(java.util.List) BgpNeighbor(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp._default.policy.rev180109.BgpNeighbor) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) MatchBgpNeighborCondition(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp._default.policy.rev180109.MatchBgpNeighborCondition) CacheBuilder(com.google.common.cache.CacheBuilder) Collections(java.util.Collections) NeighborSetKey(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.neighbor.set.NeighborSetKey) NeighborSet(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.neighbor.set.NeighborSet) MatchBgpNeighborSet(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.odl.bgp._default.policy.rev180109.match.bgp.neighbor.grouping.MatchBgpNeighborSet) ReadOnlyTransaction(org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction)

Aggregations

Optional (com.google.common.base.Optional)1 CacheBuilder (com.google.common.cache.CacheBuilder)1 CacheLoader (com.google.common.cache.CacheLoader)1 LoadingCache (com.google.common.cache.LoadingCache)1 Collections (java.util.Collections)1 List (java.util.List)1 Objects.requireNonNull (java.util.Objects.requireNonNull)1 ExecutionException (java.util.concurrent.ExecutionException)1 Collectors (java.util.stream.Collectors)1 Nonnull (javax.annotation.Nonnull)1 Nullable (javax.annotation.Nullable)1 StringUtils (org.apache.commons.lang3.StringUtils)1 DataBroker (org.opendaylight.controller.md.sal.binding.api.DataBroker)1 ReadOnlyTransaction (org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction)1 LogicalDatastoreType (org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType)1 RouteEntryBaseAttributes (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.RouteEntryBaseAttributes)1 BgpConditionsAugmentationPolicy (org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.policy.condition.BgpConditionsAugmentationPolicy)1 RouterIds (org.opendaylight.protocol.bgp.rib.spi.RouterIds)1 BGPRouteEntryExportParameters (org.opendaylight.protocol.bgp.rib.spi.policy.BGPRouteEntryExportParameters)1 BGPRouteEntryImportParameters (org.opendaylight.protocol.bgp.rib.spi.policy.BGPRouteEntryImportParameters)1