use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.topology.stats.rpc.rev190321.GetStatsInputBuilder in project bgpcep by opendaylight.
the class TopologyStatsRpcServiceImplTest method createGetStatsInput.
private static GetStatsInput createGetStatsInput(final String topologyId, final List<String> nodeIds) {
final Map<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.topology.stats.rpc.rev190321.get.stats.input.topology.NodeKey, org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.topology.stats.rpc.rev190321.get.stats.input.topology.Node> nodes;
if (nodeIds != null) {
nodes = nodeIds.stream().map(nodeId -> new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.topology.stats.rpc.rev190321.get.stats.input.topology.NodeBuilder().setNodeId(new NodeId(nodeId)).build()).collect(BindingMap.toOrderedMap());
} else {
nodes = null;
}
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.topology.stats.rpc.rev190321.get.stats.input.Topology topology;
if (topologyId != null) {
topology = new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.topology.stats.rpc.rev190321.get.stats.input.TopologyBuilder().setTopologyId(new TopologyId(topologyId)).setNode(nodes).build();
} else {
topology = null;
}
return new GetStatsInputBuilder().setTopology(topology != null ? BindingMap.of(topology) : null).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.topology.stats.rpc.rev190321.GetStatsInputBuilder in project bgpcep by opendaylight.
the class TopologyStatsRpcServiceImplTest method testGetStatsAllMatch.
@Test
public void testGetStatsAllMatch() throws Exception {
GetStatsInput in;
final var ot1 = createGetStatsOutput(TOPOLOGY_ID1, Collections.singletonList(NODE_ID1), createRpcSessionState()).getTopology().values().iterator().next();
final var ot2 = createGetStatsOutput(TOPOLOGY_ID2, Arrays.asList(NODE_ID2, NODE_ID3), createRpcSessionState()).getTopology().values().iterator().next();
final GetStatsOutput out = new GetStatsOutputBuilder().setTopology(BindingMap.of(ot1, ot2)).build();
// Implicitly match all PCEP topologies and nodes
in = createGetStatsInput(null, null);
performCountTest(in, out);
// Explicitly match all PCEP topologies and nodes
final var it1 = createGetStatsInput(TOPOLOGY_ID1, Collections.singletonList(NODE_ID1)).getTopology().values().iterator().next();
final var it2 = createGetStatsInput(TOPOLOGY_ID2, Arrays.asList(NODE_ID2, NODE_ID3)).getTopology().values().iterator().next();
in = new GetStatsInputBuilder().setTopology(BindingMap.of(it1, it2)).build();
performCountTest(in, out);
}
Aggregations