+ @Override
+ public ListenableFuture<RpcResult<GetServiceInterfacePointDetailsOutput>>
+ getServiceInterfacePointDetails(GetServiceInterfacePointDetailsInput input) {
+ Uuid sipUuid = getUuidFromIput(input.getSipIdOrName());
+ 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();
+ }
+ var outSip = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210
+ .get.service._interface.point.details.output.SipBuilder(sips.get(new ServiceInterfacePointKey(sipUuid)))
+ .build();
+ return RpcResultBuilder
+ .success(new GetServiceInterfacePointDetailsOutputBuilder().setSip(outSip).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();
+ }
+
+ private Topology createAbstracted100GTpdrTopology(Topology topology) {
+ List<org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node> dsrNodes =
+ topology.nonnullNode().values().stream()
+ .filter(node -> node.getLayerProtocolName().contains(LayerProtocolName.DSR))
+ .collect(Collectors.toList());
+ List<OwnedNodeEdgePoint> nep100GTpdrList = new ArrayList<>();
+ for (org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node node2: dsrNodes) {
+ List<OwnedNodeEdgePoint> nepList = node2.getOwnedNodeEdgePoint().values().stream()
+ .filter(nep -> nep.getName().containsKey(new NameKey("100G-tpdr"))).collect(Collectors.toList());
+ nep100GTpdrList.addAll(nepList);
+ }
+ Name topoName = new NameBuilder().setValue(TapiStringConstants.TPDR_100G)
+ .setValueName("TAPI Topology Name").build();
+ Uuid topoUuid = new Uuid(UUID.nameUUIDFromBytes(
+ TapiStringConstants.TPDR_100G.getBytes(Charset.forName("UTF-8"))).toString());
+ org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node node =
+ createTapiNode(nep100GTpdrList, topoUuid);
+ return new TopologyBuilder()
+ .setName(Map.of(topoName.key(), topoName))
+ .setUuid(topoUuid)
+ .setNode(Map.of(node.key(), node))
+ .build();
+ }
+
+ private Network readTopology(InstanceIdentifier<Network> networkIID) throws TapiTopologyException {
+ Network topology = null;
+ FluentFuture<Optional<Network>> topologyFuture = dataBroker.newReadOnlyTransaction()
+ .read(LogicalDatastoreType.CONFIGURATION, networkIID);
+ try {
+ topology = topologyFuture.get().orElseThrow();
+ } catch (InterruptedException e) {
+ Thread.currentThread().interrupt();
+ throw new TapiTopologyException("Unable to get from mdsal topology: " + networkIID
+ .firstKeyOf(Network.class).getNetworkId().getValue(), e);
+ } catch (ExecutionException e) {
+ throw new TapiTopologyException("Unable to get from mdsal topology: " + networkIID
+ .firstKeyOf(Network.class).getNetworkId().getValue(), e);