import org.opendaylight.bgpcep.programming.spi.InstructionSchedulerFactory;
import org.opendaylight.mdsal.binding.api.DataBroker;
import org.opendaylight.mdsal.binding.api.DataTreeChangeListener;
-import org.opendaylight.mdsal.binding.api.DataTreeIdentifier;
import org.opendaylight.mdsal.binding.api.DataTreeModification;
import org.opendaylight.mdsal.binding.api.RpcProviderService;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.Topology;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.TopologyTypes;
+import org.opendaylight.yangtools.binding.DataObjectReference;
import org.opendaylight.yangtools.concepts.Registration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;
statsProvider = new TopologyStatsProvider(timer);
statsRpcs = new TopologyStatsRpc(dataBroker, rpcProviderRegistry);
- reg = dataBroker.registerTreeChangeListener(DataTreeIdentifier.of(LogicalDatastoreType.CONFIGURATION,
- InstanceIdentifier.builder(NetworkTopology.class).child(Topology.class).child(TopologyTypes.class)
- .augmentation(TopologyTypes1.class).child(TopologyPcep.class).build()), this);
+ reg = dataBroker.registerTreeChangeListener(LogicalDatastoreType.CONFIGURATION,
+ DataObjectReference.builder(NetworkTopology.class).child(Topology.class).child(TopologyTypes.class)
+ .augmentation(TopologyTypes1.class).child(TopologyPcep.class).build(), this);
LOG.info("PCEP Topology tracker initialized");
}
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.TopologyKey;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey;
+import org.opendaylight.yangtools.binding.DataObjectIdentifier;
import org.opendaylight.yangtools.binding.DataObjectReference;
import org.opendaylight.yangtools.binding.util.BindingMap;
import org.opendaylight.yangtools.concepts.Registration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
final class TopologyStatsRpc implements DataTreeChangeListener<PcepSessionState>, AutoCloseable {
private static final Logger LOG = LoggerFactory.getLogger(TopologyStatsRpc.class);
- private final ConcurrentMap<InstanceIdentifier<PcepSessionState>, PcepSessionState> sessionStateMap =
+ private final ConcurrentMap<DataObjectIdentifier<PcepSessionState>, PcepSessionState> sessionStateMap =
new ConcurrentHashMap<>();
private Registration listenerRegistration;
private Registration rpcRegistration;
@Override
public void onDataTreeChanged(final List<DataTreeModification<PcepSessionState>> changes) {
changes.forEach(change -> {
- final var iid = change.path().toLegacy();
+ final var iid = change.path();
final var mod = change.getRootNode();
switch (mod.modificationType()) {
case SUBTREE_MODIFIED, WRITE:
.setTopologyId(iTopologyId)
.setNode(iNodeIds.stream()
.map(iNodeId -> {
- final PcepSessionState state = sessionStateMap.get(
- InstanceIdentifier.builder(NetworkTopology.class)
+ final var state = sessionStateMap.get(
+ DataObjectIdentifier.builder(NetworkTopology.class)
.child(Topology.class, new TopologyKey(iTopologyId))
.child(Node.class, new NodeKey(iNodeId))
.augmentation(PcepTopologyNodeStatsAug.class)
}
private List<TopologyId> getAvailableTopologyIds() {
- return sessionStateMap.keySet().stream().map(iid -> iid.firstKeyOf(Topology.class).getTopologyId()).distinct()
- .collect(Collectors.toList());
+ return sessionStateMap.keySet().stream()
+ .map(DataObjectIdentifier::toLegacy)
+ .map(iid -> iid.firstKeyOf(Topology.class).getTopologyId())
+ .distinct()
+ .collect(Collectors.toList());
}
private List<NodeId> getAvailableNodeIds(final TopologyId topologyId) {
return sessionStateMap.keySet().stream()
- .filter(iid -> iid.firstKeyOf(Topology.class).getTopologyId().equals(topologyId))
- .map(iid -> iid.firstKeyOf(Node.class).getNodeId()).collect(Collectors.toList());
+ .map(DataObjectIdentifier::toLegacy)
+ .filter(iid -> iid.firstKeyOf(Topology.class).getTopologyId().equals(topologyId))
+ .map(iid -> iid.firstKeyOf(Node.class).getNodeId())
+ .collect(Collectors.toList());
}
}
import org.mockito.Mock;
import org.mockito.junit.MockitoJUnitRunner;
import org.opendaylight.mdsal.binding.api.RpcProviderService;
-import org.opendaylight.mdsal.binding.api.WriteTransaction;
import org.opendaylight.mdsal.binding.dom.adapter.test.AbstractConcurrentDataBrokerTest;
import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.stateful.stats.rev181109.PcepEntityIdRpcAugBuilder;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeBuilder;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.NodeKey;
+import org.opendaylight.yangtools.binding.DataObjectIdentifier;
import org.opendaylight.yangtools.binding.util.BindingMap;
import org.opendaylight.yangtools.concepts.Registration;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.opendaylight.yangtools.yang.common.RpcResult;
import org.opendaylight.yangtools.yang.common.Uint16;
import org.opendaylight.yangtools.yang.common.Uint32;
final Topology t3 = createTopology(NONPCEP_TOPOLOGY,
BindingMap.of(new NodeBuilder().setNodeId(new NodeId(NONPCEP_NODE)).build()));
- final WriteTransaction wtx = getDataBroker().newWriteOnlyTransaction();
- final NetworkTopologyBuilder ntb = new NetworkTopologyBuilder();
- ntb.setTopology(BindingMap.of(t1, t2, t3));
- wtx.put(LogicalDatastoreType.OPERATIONAL, InstanceIdentifier.builder(NetworkTopology.class).build(),
- ntb.build());
+ final var wtx = getDataBroker().newWriteOnlyTransaction();
+ wtx.put(LogicalDatastoreType.OPERATIONAL, DataObjectIdentifier.builder(NetworkTopology.class).build(),
+ new NetworkTopologyBuilder().setTopology(BindingMap.of(t1, t2, t3)).build());
wtx.commit().get();
}