+ return RpcResultBuilder.success(new GetTopologyListOutputBuilder().setTopology(newTopoMap).build())
+ .buildFuture();
+ }
+
+ @Override
+ public ListenableFuture<RpcResult<GetServiceInterfacePointListOutput>>
+ getServiceInterfacePointList(GetServiceInterfacePointListInput input) {
+ Map<ServiceInterfacePointKey, ServiceInterfacePoint> sips =
+ this.tapiContext.getTapiContext().getServiceInterfacePoint();
+ if (sips == null || sips.isEmpty()) {
+ return RpcResultBuilder.<GetServiceInterfacePointListOutput>failed()
+ .withError(ErrorType.RPC, "No sips in datastore")
+ .buildFuture();
+ }
+ Map<SipKey, Sip> outSipMap = new HashMap<>();
+ for (ServiceInterfacePoint sip : sips.values()) {
+ Sip si = new SipBuilder(sip).build();
+ outSipMap.put(si.key(), si);
+ }
+ return RpcResultBuilder
+ .success(new GetServiceInterfacePointListOutputBuilder().setSip(outSipMap).build())
+ .buildFuture();
+ }
+
+ @Override
+ public ListenableFuture<RpcResult<UpdateServiceInterfacePointOutput>>
+ updateServiceInterfacePoint(UpdateServiceInterfacePointInput input) {
+ return RpcResultBuilder.<UpdateServiceInterfacePointOutput>failed()
+ .withError(ErrorType.RPC, ErrorTag.OPERATION_NOT_SUPPORTED, "RPC not implemented yet")
+ .buildFuture();
+ }
+
+ @Override
+ public ListenableFuture<RpcResult<GetNodeEdgePointDetailsOutput>> getNodeEdgePointDetails(
+ GetNodeEdgePointDetailsInput input) {
+ // TODO Auto-generated method stub
+ // TODO -> maybe we get errors when having CEPs?
+ Uuid topoUuid = input.getTopologyId();
+ // Node id: if roadm -> ROADMid+PHOTONIC_MEDIA. if xpdr -> XPDRid-XPDRnbr+DSR/OTSi
+ Uuid nodeUuid = input.getNodeId();
+ // NEP id: if roadm -> ROADMid+PHOTONIC_MEDIA/MC/OTSiMC+TPid.
+ // if xpdr -> XPDRid-XPDRnbr+DSR/eODU/iODU/iOTSi/eOTSi/PHOTONIC_MEDIA+TPid
+ Uuid nepUuid = input.getNodeEdgePointId();
+ OwnedNodeEdgePoint nep = this.tapiContext.getTapiNEP(topoUuid, nodeUuid, nepUuid);
+ if (nep == null) {
+ LOG.error("Invalid TAPI nep name");
+ return RpcResultBuilder.<GetNodeEdgePointDetailsOutput>failed()
+ .withError(ErrorType.RPC, "Invalid NEP name")
+ .buildFuture();
+ }
+ return RpcResultBuilder.success(new GetNodeEdgePointDetailsOutputBuilder()
+ .setNodeEdgePoint(new NodeEdgePointBuilder(nep).build()).build()).buildFuture();
+ }
+
+ @Override
+ public ListenableFuture<RpcResult<GetLinkDetailsOutput>> getLinkDetails(GetLinkDetailsInput input) {
+ // TODO Auto-generated method stub
+ Uuid topoUuid = input.getTopologyId();
+ // Link id: same as OR link id
+ Uuid linkUuid = input.getLinkId();
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link link = this.tapiContext
+ .getTapiLink(topoUuid, linkUuid);
+ if (link == null) {
+ LOG.error("Invalid TAPI link name");
+ return RpcResultBuilder.<GetLinkDetailsOutput>failed()
+ .withError(ErrorType.RPC, "Invalid Link name")
+ .buildFuture();
+ }
+ LOG.info("debug link is : {}", link.getName().toString());
+ return RpcResultBuilder.success(new GetLinkDetailsOutputBuilder().setLink(new LinkBuilder(link).build())
+ .build()).buildFuture();
+ }
+
+ @Override
+ public ListenableFuture<RpcResult<GetServiceInterfacePointDetailsOutput>>
+ getServiceInterfacePointDetails(GetServiceInterfacePointDetailsInput input) {
+ Uuid sipUuid = input.getUuid();
+ Map<ServiceInterfacePointKey, ServiceInterfacePoint> sips =
+ this.tapiContext.getTapiContext().getServiceInterfacePoint();
+ if (sips == null || sips.isEmpty()) {
+ return RpcResultBuilder.<GetServiceInterfacePointDetailsOutput>failed()
+ .withError(ErrorType.RPC, "No sips in datastore")
+ .buildFuture();
+ }
+ if (!sips.containsKey(new ServiceInterfacePointKey(sipUuid))) {
+ return RpcResultBuilder.<GetServiceInterfacePointDetailsOutput>failed()
+ .withError(ErrorType.RPC, "Sip doesnt exist in datastore")
+ .buildFuture();
+ }
+ org.opendaylight.yang.gen.v1.urn
+ .onf.otcc.yang.tapi.common.rev221121.get.service._interface.point.details.output.Sip outSip =
+ new org.opendaylight.yang.gen.v1.urn
+ .onf.otcc.yang.tapi.common.rev221121.get.service._interface.point.details.output.SipBuilder(
+ sips.get(new ServiceInterfacePointKey(sipUuid)))
+ .build();
+ return RpcResultBuilder.success(new GetServiceInterfacePointDetailsOutputBuilder().setSip(outSip).build())
+ .buildFuture();
+ }
+
+ public ImmutableClassToInstanceMap<Rpc<?, ?>> registerRPCs() {
+ return ImmutableClassToInstanceMap.<Rpc<?, ?>>builder()
+ .put(GetNodeDetails.class, this::getNodeDetails)
+ .put(GetTopologyDetails.class, this::getTopologyDetails)
+ .put(GetNodeEdgePointDetails.class, this::getNodeEdgePointDetails)
+ .put(GetLinkDetails.class, this::getLinkDetails)
+ .put(GetTopologyList.class, this::getTopologyList)
+ .put(GetServiceInterfacePointDetails.class, this::getServiceInterfacePointDetails)
+ .put(GetServiceInterfacePointList.class, this::getServiceInterfacePointList)
+ .put(UpdateServiceInterfacePoint.class, this::updateServiceInterfacePoint)
+ .build();