Search in sources :

Example 11 with KeyedInstanceIdentifier

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

the class VppEndpointListener method handleChange.

private ListenableFuture<Void> handleChange(DataObjectModification modification) {
    Collection<DataObjectModification<? extends DataObject>> modifiedChildren = modification.getModifiedChildren();
    List<ListenableFuture<KeyedInstanceIdentifier<Node, NodeKey>>> processingTasks = new ArrayList<>();
    for (DataObjectModification modifiedNode : modifiedChildren) {
        final Node newOrModifiedNode = (Node) modifiedNode.getDataAfter();
        ListenableFuture<KeyedInstanceIdentifier<Node, NodeKey>> processingTask = processNode(newOrModifiedNode);
        Futures.addCallback(processingTask, new FutureCallback<KeyedInstanceIdentifier<Node, NodeKey>>() {

            @Override
            public void onSuccess(@Nullable KeyedInstanceIdentifier<Node, NodeKey> kiiToNode) {
                hostInformationManager.addHostRelatedInfo(newOrModifiedNode.getNodeId().getValue(), LispAddressUtil.toRloc(vppNodeReader.rlocIpOfNode(kiiToNode)));
            }

            @Override
            public void onFailure(Throwable throwable) {
                LOG.debug("Couldn't process {}", newOrModifiedNode.getNodeId().getValue());
            }
        }, MoreExecutors.directExecutor());
        processingTasks.add(processNode(newOrModifiedNode));
    }
    return Futures.immediateFuture(null);
}
Also used : DataObjectModification(org.opendaylight.controller.md.sal.binding.api.DataObjectModification) SupportingNode(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.node.attributes.SupportingNode) Node(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node) ArrayList(java.util.ArrayList) DataObject(org.opendaylight.yangtools.yang.binding.DataObject) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) KeyedInstanceIdentifier(org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier) NodeKey(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey)

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