Search in sources :

Example 1 with KeyedInstanceIdentifier

use of org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier in project bgpcep by opendaylight.

the class BGPPeer method onSessionUp.

@Override
public synchronized void onSessionUp(final BGPSession session) {
    this.session = session;
    if (this.session instanceof BGPSessionStateProvider) {
        ((BGPSessionStateProvider) this.session).registerMessagesCounter(this);
    }
    final List<AddressFamilies> addPathTablesType = session.getAdvertisedAddPathTableTypes();
    final Set<BgpTableType> advertizedTableTypes = session.getAdvertisedTableTypes();
    final List<BgpTableType> advertizedGracefulRestartTableTypes = session.getAdvertisedGracefulRestartTableTypes();
    LOG.info("Session with peer {} went up with tables {} and Add Path tables {}", this.name, advertizedTableTypes, addPathTablesType);
    this.rawIdentifier = InetAddresses.forString(session.getBgpId().getValue()).getAddress();
    final Set<TablesKey> setTables = advertizedTableTypes.stream().map(t -> new TablesKey(t.getAfi(), t.getSafi())).collect(Collectors.toSet());
    this.tables = ImmutableSet.copyOf(setTables);
    setAdvertizedGracefulRestartTableTypes(advertizedGracefulRestartTableTypes.stream().map(t -> new TablesKey(t.getAfi(), t.getSafi())).collect(Collectors.toList()));
    this.addPathTableMaps = ImmutableMap.copyOf(mapTableTypesFamilies(addPathTablesType));
    this.trackerRegistration = this.rib.getPeerTracker().registerPeer(this);
    for (final TablesKey key : this.tables) {
        createAdjRibOutListener(key, true);
    }
    addBgp4Support();
    this.effRibInWriter = EffectiveRibInWriter.create(this, this.rib, this.rib.createPeerChain(this), this.peerIId, this.tables);
    registerPrefixesCounters(this.effRibInWriter, this.effRibInWriter);
    this.ribWriter = this.ribWriter.transform(this.peerId, this.rib.getRibSupportContext(), this.tables, this.addPathTableMaps);
    if (this.rpcRegistry != null) {
        this.rpcRegistration = this.rpcRegistry.addRoutedRpcImplementation(BgpPeerRpcService.class, new BgpPeerRpc(this, session, this.tables));
        final KeyedInstanceIdentifier<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.Peer, PeerKey> path = this.rib.getInstanceIdentifier().child(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.Peer.class, new PeerKey(this.peerId));
        this.rpcRegistration.registerPath(PeerContext.class, path);
    }
}
Also used : Arrays(java.util.Arrays) LoadingCache(com.google.common.cache.LoadingCache) SubsequentAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily) BgpAddPathTableType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.BgpAddPathTableType) AsyncTransaction(org.opendaylight.controller.md.sal.common.api.data.AsyncTransaction) RpcProviderRegistry(org.opendaylight.controller.sal.binding.api.RpcProviderRegistry) PeerId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerId) LoggerFactory(org.slf4j.LoggerFactory) MpReachNlriBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.MpReachNlriBuilder) BgpPeerRpcService(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.peer.rpc.rev171207.BgpPeerRpcService) Tables(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.Tables) LocalPreferenceAttributeParser(org.opendaylight.protocol.bgp.parser.impl.message.update.LocalPreferenceAttributeParser) Notification(org.opendaylight.yangtools.yang.binding.Notification) DestinationIpv4CaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv4CaseBuilder) BGPRouteEntryImportParameters(org.opendaylight.protocol.bgp.rib.spi.policy.BGPRouteEntryImportParameters) TransactionChainListener(org.opendaylight.controller.md.sal.common.api.data.TransactionChainListener) AbstractRegistration(org.opendaylight.protocol.concepts.AbstractRegistration) Map(java.util.Map) UnicastSubsequentAddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily) Peer(org.opendaylight.protocol.bgp.rib.spi.Peer) Update(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.Update) Objects(com.google.common.base.Objects) Attributes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes) DOMTransactionChain(org.opendaylight.controller.md.sal.dom.api.DOMTransactionChain) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) TablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey) Set(java.util.Set) RoutedRpcRegistration(org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration) BGPDocumentedException(org.opendaylight.protocol.bgp.parser.BGPDocumentedException) GuardedBy(javax.annotation.concurrent.GuardedBy) Collectors(java.util.stream.Collectors) Ipv4Prefixes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv4.prefixes.destination.ipv4.Ipv4Prefixes) CacheLoader(com.google.common.cache.CacheLoader) List(java.util.List) MpReachNlri(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.MpReachNlri) BGPSessionStateProvider(org.opendaylight.protocol.bgp.rib.impl.state.BGPSessionStateProvider) BGPTerminationReason(org.opendaylight.protocol.bgp.rib.spi.BGPTerminationReason) Optional(java.util.Optional) CacheBuilder(com.google.common.cache.CacheBuilder) SuppressFBWarnings(edu.umd.cs.findbugs.annotations.SuppressFBWarnings) RouteRefresh(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.RouteRefresh) AdvertizedRoutesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.mp.reach.nlri.AdvertizedRoutesBuilder) RIB(org.opendaylight.protocol.bgp.rib.impl.spi.RIB) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) WithdrawnRoutesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.mp.unreach.nlri.WithdrawnRoutesBuilder) BGPAfiSafiState(org.opendaylight.protocol.bgp.rib.spi.state.BGPAfiSafiState) RouterIds(org.opendaylight.protocol.bgp.rib.spi.RouterIds) HashMap(java.util.HashMap) AddressFamilies(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.add.path.capability.AddressFamilies) BGPError(org.opendaylight.protocol.bgp.parser.BGPError) MpUnreachNlriBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.MpUnreachNlriBuilder) ArrayList(java.util.ArrayList) ToStringHelper(com.google.common.base.MoreObjects.ToStringHelper) HashSet(java.util.HashSet) PeerRole(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.PeerRole) BGPSessionState(org.opendaylight.protocol.bgp.rib.spi.state.BGPSessionState) DestinationIpv4Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv4.prefixes.DestinationIpv4Builder) AdjRibOut(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.peer.AdjRibOut) MessageUtil(org.opendaylight.protocol.bgp.parser.spi.MessageUtil) Objects.requireNonNull(java.util.Objects.requireNonNull) BGPSessionListener(org.opendaylight.protocol.bgp.rib.spi.BGPSessionListener) TransactionChain(org.opendaylight.controller.md.sal.common.api.data.TransactionChain) Nullable(javax.annotation.Nullable) BGPTransportState(org.opendaylight.protocol.bgp.rib.spi.state.BGPTransportState) Logger(org.slf4j.Logger) RIBSupport(org.opendaylight.protocol.bgp.rib.spi.RIBSupport) BGPErrorHandlingState(org.opendaylight.protocol.bgp.rib.spi.state.BGPErrorHandlingState) MoreObjects(com.google.common.base.MoreObjects) PeerContext(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.peer.rpc.rev171207.PeerContext) Ipv4PrefixesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev171207.ipv4.prefixes.destination.ipv4.Ipv4PrefixesBuilder) MpUnreachNlri(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.MpUnreachNlri) AttributesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.AttributesBuilder) Ipv4Util(org.opendaylight.protocol.util.Ipv4Util) Ipv4AddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily) Nlri(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.update.message.Nlri) Futures(com.google.common.util.concurrent.Futures) PeerKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.PeerKey) BgpTableType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.BgpTableType) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) IpAddress(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress) KeyedInstanceIdentifier(org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier) ClusterIdentifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.ClusterIdentifier) InetAddresses(com.google.common.net.InetAddresses) BGPTimersState(org.opendaylight.protocol.bgp.rib.spi.state.BGPTimersState) Collections(java.util.Collections) AddressFamily(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily) BGPPeerStateImpl(org.opendaylight.protocol.bgp.rib.impl.state.BGPPeerStateImpl) BGPSession(org.opendaylight.protocol.bgp.rib.spi.BGPSession) SendReceive(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.SendReceive) Collections(java.util.Collections) AddressFamilies(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.mp.capabilities.add.path.capability.AddressFamilies) BGPSessionStateProvider(org.opendaylight.protocol.bgp.rib.impl.state.BGPSessionStateProvider) BgpTableType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.BgpTableType) TablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey) Peer(org.opendaylight.protocol.bgp.rib.spi.Peer) PeerKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.PeerKey) BgpPeerRpcService(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.peer.rpc.rev171207.BgpPeerRpcService)

Example 2 with KeyedInstanceIdentifier

use of org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier in project bgpcep by opendaylight.

the class LocRibWriter method update.

@SuppressWarnings("unchecked")
private Map<RouteUpdateKey, RouteEntry> update(final WriteTransaction tx, final Collection<DataTreeModification<Tables>> changes) {
    final Map<RouteUpdateKey, RouteEntry> ret = new HashMap<>();
    for (final DataTreeModification<Tables> tc : changes) {
        final DataObjectModification<Tables> table = tc.getRootNode();
        final DataTreeIdentifier<Tables> rootPath = tc.getRootPath();
        final KeyedInstanceIdentifier<Peer, PeerKey> peerKIid = (KeyedInstanceIdentifier<Peer, PeerKey>) rootPath.getRootIdentifier().firstIdentifierOf(Peer.class);
        final UnsignedInteger peerUuid = RouterIds.routerIdForPeerId(peerKIid.getKey().getPeerId());
        /*
            Initialize Peer with routes under loc rib
             */
        if (!this.routeEntries.isEmpty() && table.getDataBefore() == null) {
            final org.opendaylight.protocol.bgp.rib.spi.Peer peer = this.peerTracker.getPeer(peerKIid.getKey().getPeerId());
            if (peer != null && peer.supportsTable(this.entryDep.getLocalTablesKey())) {
                LOG.debug("Peer {} table has been created, inserting existent routes", peer.getPeerId());
                this.routeEntries.forEach((key, value) -> value.initializeBestPaths(this.entryDep, new RouteEntryInfoImpl(peer, key), tx));
            }
        }
        /*
            Process new routes from Peer
             */
        updateNodes(table, peerUuid, tx, ret);
    }
    return ret;
}
Also used : RouteEntry(org.opendaylight.protocol.bgp.mode.api.RouteEntry) HashMap(java.util.HashMap) Peer(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.Peer) PeerKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.PeerKey) Tables(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.Tables) KeyedInstanceIdentifier(org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier) UnsignedInteger(com.google.common.primitives.UnsignedInteger)

Example 3 with KeyedInstanceIdentifier

use of org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier in project bgpcep by opendaylight.

the class BaseAbstractRouteEntry method removePathFromDataStore.

@SuppressWarnings("unchecked")
private void removePathFromDataStore(final RouteEntryDependenciesContainer entryDep, final Identifier routeKey, final WriteTransaction tx) {
    LOG.trace("Best Path removed {}", this.removedBestPath);
    final KeyedInstanceIdentifier<Tables, TablesKey> locRibTarget = entryDep.getLocRibTableTarget();
    final RIBSupport ribSup = entryDep.getRibSupport();
    Identifier newRouteKey = ribSup.createNewRouteKey(this.removedBestPath.getPathId(), routeKey);
    if (newRouteKey == null) {
        newRouteKey = routeKey;
    }
    final InstanceIdentifier routeTarget = ribSup.createRouteIdentifier(locRibTarget, newRouteKey);
    LOG.debug("Delete route from LocRib {}", routeTarget);
    tx.delete(LogicalDatastoreType.OPERATIONAL, routeTarget);
    fillAdjRibsOut(null, null, newRouteKey, this.removedBestPath.getPeerId(), entryDep, tx);
}
Also used : TablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) KeyedInstanceIdentifier(org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier) Identifier(org.opendaylight.yangtools.yang.binding.Identifier) RIBSupport(org.opendaylight.protocol.bgp.rib.spi.RIBSupport) Tables(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.Tables) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) KeyedInstanceIdentifier(org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier)

Example 4 with KeyedInstanceIdentifier

use of org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier in project bgpcep by opendaylight.

the class BaseAbstractRouteEntry method addPathToDataStore.

@SuppressWarnings("unchecked")
private void addPathToDataStore(final RouteEntryDependenciesContainer entryDep, final Identifier routeKey, final WriteTransaction tx) {
    final RIBSupport ribSup = entryDep.getRibSupport();
    Identifier newRouteKey = ribSup.createNewRouteKey(this.bestPath.getPathId(), routeKey);
    if (newRouteKey == null) {
        newRouteKey = routeKey;
    }
    final Route route = createRoute(ribSup, newRouteKey, this.bestPath.getPathId(), this.bestPath);
    LOG.trace("Selected best route {}", route);
    final KeyedInstanceIdentifier<Tables, TablesKey> locRibTarget = entryDep.getLocRibTableTarget();
    final InstanceIdentifier routeTarget = ribSup.createRouteIdentifier(locRibTarget, newRouteKey);
    LOG.debug("Write route to LocRib {}", route);
    tx.put(LogicalDatastoreType.OPERATIONAL, routeTarget, route);
    fillAdjRibsOut(this.bestPath.getAttributes(), route, newRouteKey, this.bestPath.getPeerId(), entryDep, tx);
}
Also used : InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) KeyedInstanceIdentifier(org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier) Identifier(org.opendaylight.yangtools.yang.binding.Identifier) TablesKey(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey) RIBSupport(org.opendaylight.protocol.bgp.rib.spi.RIBSupport) Tables(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.Tables) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) KeyedInstanceIdentifier(org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier) Route(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.Route)

Example 5 with KeyedInstanceIdentifier

use of org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier in project openflowplugin by opendaylight.

the class FlowNodeReconciliationImpl method reconciliationPreProcess.

private void reconciliationPreProcess(final InstanceIdentifier<FlowCapableNode> nodeIdent) {
    List<InstanceIdentifier<StaleFlow>> staleFlowsToBeBulkDeleted = Lists.newArrayList();
    List<InstanceIdentifier<StaleGroup>> staleGroupsToBeBulkDeleted = Lists.newArrayList();
    List<InstanceIdentifier<StaleMeter>> staleMetersToBeBulkDeleted = Lists.newArrayList();
    ReadOnlyTransaction trans = provider.getReadTranaction();
    Optional<FlowCapableNode> flowNode = Optional.absent();
    try {
        flowNode = trans.read(LogicalDatastoreType.CONFIGURATION, nodeIdent).get();
    } catch (ExecutionException | InterruptedException e) {
        LOG.warn("Reconciliation Pre-Processing Fail with read Config/DS for Node {} !", nodeIdent, e);
    }
    if (flowNode.isPresent()) {
        LOG.debug("Proceeding with deletion of stale-marked Flows on switch {} using Openflow interface", nodeIdent.toString());
        /* Stale-Flows - Stale-marked Flows have to be removed first for safety */
        List<Table> tables = flowNode.get().getTable() != null ? flowNode.get().getTable() : Collections.<Table>emptyList();
        for (Table table : tables) {
            final KeyedInstanceIdentifier<Table, TableKey> tableIdent = nodeIdent.child(Table.class, table.getKey());
            List<StaleFlow> staleFlows = table.getStaleFlow() != null ? table.getStaleFlow() : Collections.<StaleFlow>emptyList();
            for (StaleFlow staleFlow : staleFlows) {
                FlowBuilder flowBuilder = new FlowBuilder(staleFlow);
                Flow toBeDeletedFlow = flowBuilder.setId(staleFlow.getId()).build();
                final KeyedInstanceIdentifier<Flow, FlowKey> flowIdent = tableIdent.child(Flow.class, toBeDeletedFlow.getKey());
                this.provider.getFlowCommiter().remove(flowIdent, toBeDeletedFlow, nodeIdent);
                staleFlowsToBeBulkDeleted.add(getStaleFlowInstanceIdentifier(staleFlow, nodeIdent));
            }
        }
        LOG.debug("Proceeding with deletion of stale-marked Groups for switch {} using Openflow interface", nodeIdent.toString());
        // TODO: Should we collate the futures of RPC-calls to be sure that groups are
        // Flows are fully deleted
        // before attempting to delete groups - just in case there are references
        /* Stale-marked Groups - Can be deleted after flows */
        List<StaleGroup> staleGroups = flowNode.get().getStaleGroup() != null ? flowNode.get().getStaleGroup() : Collections.<StaleGroup>emptyList();
        for (StaleGroup staleGroup : staleGroups) {
            GroupBuilder groupBuilder = new GroupBuilder(staleGroup);
            Group toBeDeletedGroup = groupBuilder.setGroupId(staleGroup.getGroupId()).build();
            final KeyedInstanceIdentifier<Group, GroupKey> groupIdent = nodeIdent.child(Group.class, toBeDeletedGroup.getKey());
            this.provider.getGroupCommiter().remove(groupIdent, toBeDeletedGroup, nodeIdent);
            staleGroupsToBeBulkDeleted.add(getStaleGroupInstanceIdentifier(staleGroup, nodeIdent));
        }
        LOG.debug("Proceeding with deletion of stale-marked Meters for switch {} using Openflow interface", nodeIdent.toString());
        /* Stale-marked Meters - can be deleted anytime - so least priority */
        List<StaleMeter> staleMeters = flowNode.get().getStaleMeter() != null ? flowNode.get().getStaleMeter() : Collections.<StaleMeter>emptyList();
        for (StaleMeter staleMeter : staleMeters) {
            MeterBuilder meterBuilder = new MeterBuilder(staleMeter);
            Meter toBeDeletedMeter = meterBuilder.setMeterId(staleMeter.getMeterId()).build();
            final KeyedInstanceIdentifier<Meter, MeterKey> meterIdent = nodeIdent.child(Meter.class, toBeDeletedMeter.getKey());
            this.provider.getMeterCommiter().remove(meterIdent, toBeDeletedMeter, nodeIdent);
            staleMetersToBeBulkDeleted.add(getStaleMeterInstanceIdentifier(staleMeter, nodeIdent));
        }
    }
    /* clean transaction */
    trans.close();
    LOG.debug("Deleting all stale-marked flows/groups/meters of for switch {} in Configuration DS", nodeIdent.toString());
    // Now, do the bulk deletions
    deleteDSStaleFlows(staleFlowsToBeBulkDeleted);
    deleteDSStaleGroups(staleGroupsToBeBulkDeleted);
    deleteDSStaleMeters(staleMetersToBeBulkDeleted);
}
Also used : MeterBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterBuilder) StaleGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.StaleGroup) Group(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.Group) Meter(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.Meter) StaleMeter(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.StaleMeter) GroupBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupBuilder) StaleGroupKey(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.StaleGroupKey) GroupKey(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.GroupKey) InstanceIdentifier(org.opendaylight.yangtools.yang.binding.InstanceIdentifier) KeyedInstanceIdentifier(org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier) StaleMeter(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.StaleMeter) ExecutionException(java.util.concurrent.ExecutionException) FlowKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowKey) StaleFlowKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.StaleFlowKey) Table(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.Table) FlowCapableNode(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.FlowCapableNode) TableKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.TableKey) Flow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.Flow) StaleFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.StaleFlow) MeterKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.MeterKey) StaleMeterKey(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.meters.StaleMeterKey) FlowBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.FlowBuilder) StaleFlow(org.opendaylight.yang.gen.v1.urn.opendaylight.flow.inventory.rev130819.tables.table.StaleFlow) ReadOnlyTransaction(org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction) StaleGroup(org.opendaylight.yang.gen.v1.urn.opendaylight.group.types.rev131018.groups.StaleGroup)

Aggregations

KeyedInstanceIdentifier (org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier)11 InstanceIdentifier (org.opendaylight.yangtools.yang.binding.InstanceIdentifier)7 Tables (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.Tables)6 RIBSupport (org.opendaylight.protocol.bgp.rib.spi.RIBSupport)5 TablesKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.TablesKey)5 Identifier (org.opendaylight.yangtools.yang.binding.Identifier)4 ArrayList (java.util.ArrayList)3 HashMap (java.util.HashMap)3 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)2 Map (java.util.Map)2 Nullable (javax.annotation.Nullable)2 RoutedRpcRegistration (org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RoutedRpcRegistration)2 PeerKey (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.bgp.rib.rib.PeerKey)2 MoreObjects (com.google.common.base.MoreObjects)1 ToStringHelper (com.google.common.base.MoreObjects.ToStringHelper)1 Objects (com.google.common.base.Objects)1 CacheBuilder (com.google.common.cache.CacheBuilder)1 CacheLoader (com.google.common.cache.CacheLoader)1 LoadingCache (com.google.common.cache.LoadingCache)1 ImmutableMap (com.google.common.collect.ImmutableMap)1