use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.stats.rev181109.PcepTopologyNodeStatsAug in project bgpcep by opendaylight.
the class TopologyStatsProviderImpl method updatePcepStats.
private synchronized void updatePcepStats() {
final WriteTransaction tx = TopologyStatsProviderImpl.this.transactionChain.newWriteOnlyTransaction();
for (final Map.Entry<KeyedInstanceIdentifier<Node, NodeKey>, PcepSessionState> entry : this.statsMap.entrySet()) {
final PcepTopologyNodeStatsAug nodeStatsAug = new PcepTopologyNodeStatsAugBuilder().setPcepSessionState(new PcepSessionStateBuilder(entry.getValue()).build()).build();
final InstanceIdentifier<PcepTopologyNodeStatsAug> statId = entry.getKey().augmentation(PcepTopologyNodeStatsAug.class);
tx.put(LogicalDatastoreType.OPERATIONAL, statId, nodeStatsAug);
}
tx.submit();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.topology.pcep.stats.rev181109.PcepTopologyNodeStatsAug in project bgpcep by opendaylight.
the class PcepStateUtils method displayNodeState.
/**
* Display to stream operational state, rib Id is mandatory.
*
* @param dataBroker data broker
* @param stream where to print
* @param topologyId mandatory, Topology where Node pertains
* @param nodeId mandatory, State per given Node Id will be printed
*/
public static void displayNodeState(@NonNull final DataBroker dataBroker, @NonNull final PrintStream stream, @NonNull final String topologyId, @NonNull final String nodeId) {
final Node node = readNodeFromDataStore(dataBroker, topologyId, nodeId);
if (node == null) {
stream.println(String.format("Node [%s] not found", nodeId));
return;
}
final PcepTopologyNodeStatsAug state = node.augmentation(PcepTopologyNodeStatsAug.class);
if (state == null) {
stream.println(String.format("State not found for [%s]", nodeId));
return;
}
final PcepSessionState nodeState = state.getPcepSessionState();
displayNodeState(topologyId, nodeId, nodeState, stream);
}
Aggregations