- private void checkDsrNode(Node node, Uuid nodeUuid, boolean isSwitch) {
- assertEquals("incorrect node uuid", nodeUuid, node.getUuid());
- assertEquals("administrative state should be UNLOCKED",
- AdministrativeState.UNLOCKED, node.getAdministrativeState());
- assertEquals("life-cycle state should be INSTALLED", LifecycleState.INSTALLED, node.getLifecycleState());
- assertEquals("operational state should be ENABLED", OperationalState.ENABLED, node.getOperationalState());
- assertEquals("value-name should be 'dsr/odu node name'",
- "dsr/odu node name", node.nonnullName().values().stream().findFirst().get().getValueName());
- assertEquals("dsr node should manage 2 protocol layers : dsr and odu",
- 2, node.getLayerProtocolName().size());
- assertThat("dsr node should manage 2 protocol layers : dsr and odu",
- node.getLayerProtocolName(), hasItems(LayerProtocolName.DSR, LayerProtocolName.ODU));
- List<OwnedNodeEdgePoint> neps = node.nonnullOwnedNodeEdgePoint().values().stream()
- .sorted((nep1, nep2) -> nep1.getUuid().getValue().compareTo(nep2.getUuid().getValue()))
- .collect(Collectors.toList());
- if (isSwitch) {
- assertEquals("Switch-DSR node should have 8 NEPs", 8, neps.size());
- OwnedNodeEdgePoint nep1 = neps.get(5);
- Uuid client4NepUuid = new Uuid(
- UUID.nameUUIDFromBytes("DSR+XPDR2-CLIENT4".getBytes(Charset.forName("UTF-8"))).toString());
- checkNepClient100G(nep1, client4NepUuid, "XPDR2-CLIENT4", "NodeEdgePoint_C4");
- OwnedNodeEdgePoint nep2 = neps.get(1);
- Uuid networkNepUuid = new Uuid(
- UUID.nameUUIDFromBytes("DSR+XPDR2-NETWORK1".getBytes(Charset.forName("UTF-8"))).toString());
- checkNepNetworkODU4(nep2, networkNepUuid, "XPDR2-NETWORK1", "NodeEdgePoint_N1");
- List<NodeRuleGroup> nrgList = node.nonnullNodeRuleGroup().values().stream()
- .sorted((nrg1, nrg2) -> nrg1.getUuid().getValue().compareTo(nrg2.getUuid().getValue()))
- .collect(Collectors.toList());
- checkNodeRuleGroupForSwitchDSR(nrgList, client4NepUuid, networkNepUuid, nodeUuid);
- } else {
- assertEquals("Mux-DSR node should have 5 NEPs", 5, neps.size());
- OwnedNodeEdgePoint nep1 = neps.get(0);
- Uuid client4NepUuid = new Uuid(
- UUID.nameUUIDFromBytes("DSR+XPDR1-CLIENT4".getBytes(Charset.forName("UTF-8"))).toString());
- checkNepClient10G(nep1, client4NepUuid, "XPDR1-CLIENT4", "NodeEdgePoint_C4");
+ @Test
+ void getTopologyDetailsForFullTapiTopologyWithLinksWhenSuccessful()
+ throws ExecutionException, InterruptedException {
+ Uuid topologyUuid = new Uuid(UUID.nameUUIDFromBytes(TapiStringConstants.T0_FULL_MULTILAYER.getBytes(
+ Charset.forName("UTF-8"))).toString());
+ LOG.info("T0FullMultilayerUuid = {}", topologyUuid);
+ GetTopologyDetailsInput input = TapiTopologyDataUtils.buildGetTopologyDetailsInput(topologyUuid);
+ ListenableFuture<RpcResult<GetTopologyDetailsOutput>> result = new GetTopologyDetailsImpl(tapiContext,
+ topologyUtils, tapiLink, networkTransactionService)
+ .invoke(input);
+ RpcResult<GetTopologyDetailsOutput> rpcResult = result.get();
+ @Nullable
+ Topology topology = rpcResult.getResult().getTopology();
+ assertNotNull(topology, "Topology should not be null");
+ // 2 Nodes per Xpdr/Spdr node (DSR-ODU & PHOT) + 3 Node per Roadm
+ assertEquals(10, topology.getNode().size(), "Node list size should be 10");
+ List<Map<NameKey, Name>> nodeNames = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.PHOTONICMEDIA))
+ .map(Node::getName).collect(Collectors.toList());
+ LOG.info("TopologyNodes = {}", nodeNames.toString());
+ Node nodeTsp = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
+ .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
+ .equals("XPDR-A1-XPDR1+XPONDER"))
+ .findAny().orElseThrow();
+ LOG.debug("XPDRA1 NEPs = {}", nodeTsp.getOwnedNodeEdgePoint().toString());
+ long nb1 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
+ .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
+ .equals("XPDR-A1-XPDR1+XPONDER"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("100G-tpdr"))))
+ .count();
+ // 2 client ports in configuration -> removed the checkTp so we have 2 NEPs
+ assertEquals(2, nb1, "XPDR-A1-XPDR1+XPONDER should only have two client neps");
+ long inb1 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
+ .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
+ .equals("XPDR-A1-XPDR1+XPONDER"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("iNodeEdgePoint_N"))))
+ .count();
+ assertEquals(2, inb1, "XPDR-A1-XPDR1+XPONDER should only have two internal network neps");
+ long enb1 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
+ .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
+ .equals("XPDR-A1-XPDR1+XPONDER"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("eNodeEdgePoint_N"))))
+ .count();
+ assertEquals(2, enb1, "XPDR-A1-XPDR1+XPONDER should only have two external network neps");
+ long nb2 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
+ .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
+ .equals("SPDR-SA1-XPDR1+XPONDER"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("NodeEdgePoint_C"))))
+ .count();
+ assertEquals(4, nb2, "SPDR-SA1-XPDR1+XPONDER (mux) should have 4 client neps");
+ long inb3 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
+ .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
+ .equals("SPDR-SA1-XPDR1+XPONDER"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("iNodeEdgePoint_N"))))
+ .count();
+ assertEquals(1, inb3, "SPDR-SA1-XPDR1+XPONDER (mux) should have a single internal network nep");
+ long enb3 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
+ .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
+ .equals("SPDR-SA1-XPDR1+XPONDER"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("eNodeEdgePoint_N"))))
+ .count();
+ assertEquals(4, enb3, "SPDR-SA1-XPDR1+XPONDER (mux) should have 4 external network nep");
+ long nb4 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
+ .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
+ .equals("SPDR-SA1-XPDR2+XPONDER"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("NodeEdgePoint_C"))))
+ .count();
+ assertEquals(4, nb4, "SPDR-SA1-XPDR2+XPONDER (switch) should have 4 client neps");
+ long inb5 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
+ .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
+ .equals("SPDR-SA1-XPDR2+XPONDER"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("iNodeEdgePoint_N"))))
+ .count();
+ assertEquals(4, inb5, "SPDR-SA1-XPDR2+XPONDER (switch) should have 4 internal network neps");
+ long enb5 = topology.getNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
+ .filter(node -> node.getName().get(new NameKey("dsr/odu node name")).getValue()
+ .equals("SPDR-SA1-XPDR1+XPONDER"))
+ .flatMap(node -> node.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("eNodeEdgePoint_N"))))
+ .count();
+ assertEquals(4, enb5, "SPDR-SA1-XPDR2+XPONDER (switch) should have 4 external network neps");