X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=tapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Ftapi%2Futils%2FTapiContext.java;h=b75cb2d709bc7b6d77c1ea887dc0eda2550618e4;hb=db87ba733190c2e59997e00e0fe9199c9c74234d;hp=a44e508104b4d07b2bc8316b4420037f9d28f86f;hpb=98f18ed6198272340cbb1d12c6eb00aec42878eb;p=transportpce.git diff --git a/tapi/src/main/java/org/opendaylight/transportpce/tapi/utils/TapiContext.java b/tapi/src/main/java/org/opendaylight/transportpce/tapi/utils/TapiContext.java index a44e50810..b75cb2d70 100644 --- a/tapi/src/main/java/org/opendaylight/transportpce/tapi/utils/TapiContext.java +++ b/tapi/src/main/java/org/opendaylight/transportpce/tapi/utils/TapiContext.java @@ -15,43 +15,43 @@ import java.util.UUID; import java.util.concurrent.ExecutionException; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.transportpce.common.network.NetworkTransactionService; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Context; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.ContextBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.LayerProtocolName; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.Uuid; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.Name; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.global._class.NameBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.tapi.context.ServiceInterfacePoint; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.tapi.context.ServiceInterfacePointKey; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.Context1; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.Context1Builder; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.OwnedNodeEdgePoint1; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.OwnedNodeEdgePoint1Builder; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.cep.list.ConnectionEndPoint; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.cep.list.ConnectionEndPointKey; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connection.LowerConnection; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connection.LowerConnectionKey; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.Connection; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.ConnectionKey; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.ConnectivityService; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.ConnectivityServiceKey; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.context.ConnectivityContextBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.context.topology.context.topology.node.owned.node.edge.point.CepList; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.context.topology.context.topology.node.owned.node.edge.point.CepListBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.context.NotificationContextBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.context.TopologyContext; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.context.TopologyContextBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePoint; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePointBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.node.OwnedNodeEdgePointKey; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Link; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.LinkKey; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.NodeKey; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.context.NwTopologyServiceBuilder; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.context.Topology; -import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.context.TopologyKey; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Context; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.ContextBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.LayerProtocolName; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.Uuid; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.Name; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.global._class.NameBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.tapi.context.ServiceInterfacePoint; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev221121.tapi.context.ServiceInterfacePointKey; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.Context1; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.Context1Builder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.OwnedNodeEdgePoint1; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.OwnedNodeEdgePoint1Builder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPoint; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.cep.list.ConnectionEndPointKey; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connection.LowerConnection; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connection.LowerConnectionKey; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.ConnectionKey; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.ConnectivityService; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.ConnectivityServiceKey; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.context.ConnectivityContextBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.context.topology.context.topology.node.owned.node.edge.point.CepList; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.context.topology.context.topology.node.owned.node.edge.point.CepListBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev221121.context.NotificationContextBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.context.TopologyContext; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.context.TopologyContextBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePoint; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.node.OwnedNodeEdgePointKey; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Link; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.LinkKey; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.NodeBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.NodeKey; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.context.NwTopologyServiceBuilder; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.context.Topology; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.context.TopologyKey; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -88,8 +88,8 @@ public class TapiContext { .setValueName("Network Topo Service Name") .build(); - org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.Context1 topologyContext - = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.Context1Builder() + org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.Context1 topologyContext + = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.Context1Builder() .setTopologyContext(new TopologyContextBuilder() .setNwTopologyService(new NwTopologyServiceBuilder() .setTopology(new HashMap<>()) @@ -103,8 +103,8 @@ public class TapiContext { .build()) .build(); - org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.Context1 notificationContext - = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev181210.Context1Builder() + org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev221121.Context1 notificationContext + = new org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.notification.rev221121.Context1Builder() .setNotificationContext(new NotificationContextBuilder() .setNotification(new HashMap<>()) .setNotifSubscription(new HashMap<>()) @@ -142,7 +142,7 @@ public class TapiContext { LOG.error("Tapi context is not present in datastore"); return null; } - return optionalContext.get(); + return optionalContext.orElseThrow(); } catch (InterruptedException | ExecutionException e) { LOG.error("Couldnt read tapi context from datastore", e); return null; @@ -163,7 +163,7 @@ public class TapiContext { .build(); InstanceIdentifier topologycontextIID = InstanceIdentifier.builder(Context.class).augmentation(org.opendaylight.yang.gen.v1.urn - .onf.otcc.yang.tapi.topology.rev181210.Context1.class) + .onf.otcc.yang.tapi.topology.rev221121.Context1.class) .child(TopologyContext.class) .build(); // merge in datastore @@ -195,22 +195,24 @@ public class TapiContext { Map connectionFullMap) { // TODO: verify this is correct. Should we identify the context IID with the context UUID?? try { - org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.context.ConnectivityContext + org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev221121.context.ConnectivityContext connectivityContext = new ConnectivityContextBuilder() .setConnectivityService(connServMap) .setConnection(connectionFullMap) .build(); InstanceIdentifier connectivitycontextIID = + .onf.otcc.yang.tapi.connectivity.rev221121.context.ConnectivityContext> connectivitycontextIID = InstanceIdentifier.builder(Context.class).augmentation(Context1.class) .child(org.opendaylight.yang.gen.v1.urn - .onf.otcc.yang.tapi.connectivity.rev181210.context.ConnectivityContext.class) + .onf.otcc.yang.tapi.connectivity.rev221121.context.ConnectivityContext.class) .build(); // merge in datastore this.networkTransactionService.merge(LogicalDatastoreType.OPERATIONAL, connectivitycontextIID, connectivityContext); this.networkTransactionService.commit().get(); LOG.info("TAPI connectivity merged successfully."); + LOG.debug("TAPI connectivity merged successfully for services {}", connServMap.entrySet().iterator() + .next().getKey().toString()); } catch (InterruptedException | ExecutionException e) { LOG.error("Failed to merge TAPI connectivity", e); } @@ -219,10 +221,10 @@ public class TapiContext { public void updateTopologyWithCep(Uuid topoUuid, Uuid nodeUuid, Uuid nepUuid, ConnectionEndPoint cep) { // TODO: verify this is correct. Should we identify the context IID with the context UUID?? InstanceIdentifier onepIID = InstanceIdentifier.builder(Context.class) - .augmentation(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.Context1.class) - .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.context.TopologyContext.class) + .augmentation(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.Context1.class) + .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.context.TopologyContext.class) .child(Topology.class, new TopologyKey(topoUuid)) - .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node.class, + .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node.class, new NodeKey(nodeUuid)) .child(OwnedNodeEdgePoint.class, new OwnedNodeEdgePointKey(nepUuid)) .build(); @@ -233,7 +235,7 @@ public class TapiContext { LOG.error("ONEP is not present in datastore"); return; } - OwnedNodeEdgePoint onep = optionalOnep.get(); + OwnedNodeEdgePoint onep = optionalOnep.orElseThrow(); LOG.info("ONEP found = {}", onep); // TODO -> If cep exists -> skip merging to datasore OwnedNodeEdgePoint1 onep1 = onep.augmentation(OwnedNodeEdgePoint1.class); @@ -261,10 +263,10 @@ public class TapiContext { public Node getTapiNode(Uuid topoUuid, Uuid nodeUuid) { InstanceIdentifier nodeIID = InstanceIdentifier.builder(Context.class) - .augmentation(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.Context1.class) - .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.context.TopologyContext.class) + .augmentation(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.Context1.class) + .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.context.TopologyContext.class) .child(Topology.class, new TopologyKey(topoUuid)) - .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node.class, + .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node.class, new NodeKey(nodeUuid)).build(); try { Optional optNode = this.networkTransactionService.read(LogicalDatastoreType.OPERATIONAL, nodeIID) @@ -274,7 +276,7 @@ public class TapiContext { return null; } // TODO -> Need to remove CEPs from NEPs. If not error from get Topology details output - Node node = optNode.get(); + Node node = optNode.orElseThrow(); LOG.debug("NEPs of node before creating map to be returned to the getTapiNode function = {}", node.getOwnedNodeEdgePoint().size()); Map onepMap = new HashMap<>(); @@ -287,13 +289,14 @@ public class TapiContext { .setUuid(onep.getUuid()) .setLayerProtocolName(onep.getLayerProtocolName()) .setName(onep.getName()) - .setSupportedCepLayerProtocolQualifier(onep.getSupportedCepLayerProtocolQualifier()) + .setSupportedCepLayerProtocolQualifierInstances( + onep.getSupportedCepLayerProtocolQualifierInstances()) .setAdministrativeState(onep.getAdministrativeState()) .setOperationalState(onep.getOperationalState()) .setLifecycleState(onep.getLifecycleState()) - .setTerminationDirection(onep.getTerminationDirection()) - .setTerminationState(onep.getTerminationState()) - .setLinkPortDirection(onep.getLinkPortDirection()) +// .setTerminationDirection(onep.getTerminationDirection()) +// .setTerminationState(onep.getTerminationState()) + .setDirection(onep.getDirection()) .setLinkPortRole(onep.getLinkPortRole()); if (onep.getMappedServiceInterfacePoint() != null) { newOnepBuilder.setMappedServiceInterfacePoint(onep.getMappedServiceInterfacePoint()); @@ -314,10 +317,10 @@ public class TapiContext { public OwnedNodeEdgePoint getTapiNEP(Uuid topoUuid, Uuid nodeUuid, Uuid nepUuid) { InstanceIdentifier nepIID = InstanceIdentifier.builder(Context.class) - .augmentation(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.Context1.class) - .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.context.TopologyContext.class) + .augmentation(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.Context1.class) + .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.context.TopologyContext.class) .child(Topology.class, new TopologyKey(topoUuid)) - .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node.class, + .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node.class, new NodeKey(nodeUuid)).child(OwnedNodeEdgePoint.class, new OwnedNodeEdgePointKey(nepUuid)).build(); try { Optional optNode = this.networkTransactionService @@ -327,7 +330,7 @@ public class TapiContext { LOG.error(NODE_NOT_PRESENT); return null; } - return optNode.get(); + return optNode.orElseThrow(); } catch (InterruptedException | ExecutionException e) { LOG.error("Couldnt read NEP in topology", e); return null; @@ -336,8 +339,8 @@ public class TapiContext { public Link getTapiLink(Uuid topoUuid, Uuid linkUuid) { InstanceIdentifier linkIID = InstanceIdentifier.builder(Context.class) - .augmentation(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.Context1.class) - .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.context.TopologyContext.class) + .augmentation(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.Context1.class) + .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.context.TopologyContext.class) .child(Topology.class, new TopologyKey(topoUuid)) .child(Link.class, new LinkKey(linkUuid)).build(); try { @@ -347,7 +350,7 @@ public class TapiContext { LOG.error(NODE_NOT_PRESENT); return null; } - return optLink.get(); + return optLink.orElseThrow(); } catch (InterruptedException | ExecutionException e) { LOG.error("Couldnt read link in topology", e); return null; @@ -357,7 +360,7 @@ public class TapiContext { public Map getTopologyContext() { InstanceIdentifier topologycontextIID = InstanceIdentifier.builder(Context.class).augmentation(org.opendaylight.yang.gen.v1.urn - .onf.otcc.yang.tapi.topology.rev181210.Context1.class) + .onf.otcc.yang.tapi.topology.rev221121.Context1.class) .child(TopologyContext.class) .build(); try { @@ -367,7 +370,7 @@ public class TapiContext { LOG.error("Topology context is not present in datastore"); return null; } - return optTopoContext.get().getTopology(); + return optTopoContext.orElseThrow().getTopology(); } catch (InterruptedException | ExecutionException e) { LOG.error("Couldnt read topology context", e); return null; @@ -380,7 +383,7 @@ public class TapiContext { InstanceIdentifier connectivityServIID = InstanceIdentifier.builder(Context.class).augmentation(Context1.class) .child(org.opendaylight.yang.gen.v1.urn - .onf.otcc.yang.tapi.connectivity.rev181210.context.ConnectivityContext.class) + .onf.otcc.yang.tapi.connectivity.rev221121.context.ConnectivityContext.class) .child(ConnectivityService.class, new ConnectivityServiceKey(serviceUuid)) .build(); @@ -390,7 +393,7 @@ public class TapiContext { LOG.error("Connectivity service not found in tapi context"); return null; } - return optConnServ.get(); + return optConnServ.orElseThrow(); } catch (InterruptedException | ExecutionException e) { LOG.error("Connectivity service not found in tapi context. Error:", e); return null; @@ -405,14 +408,14 @@ public class TapiContext { return; } for (org.opendaylight.yang.gen.v1 - .urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.service.Connection connection: + .urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.service.Connection connection: connectivityService.getConnection().values()) { - deleteConnection(connection.getConnectionUuid(), serviceUuid, connectivityService.getServiceLayer()); + deleteConnection(connection.getConnectionUuid(), serviceUuid, connectivityService.getLayerProtocolName()); } InstanceIdentifier connectivityServIID = InstanceIdentifier.builder(Context.class).augmentation(Context1.class) .child(org.opendaylight.yang.gen.v1.urn - .onf.otcc.yang.tapi.connectivity.rev181210.context.ConnectivityContext.class) + .onf.otcc.yang.tapi.connectivity.rev221121.context.ConnectivityContext.class) .child(ConnectivityService.class, new ConnectivityServiceKey(serviceUuid)) .build(); try { @@ -427,14 +430,14 @@ public class TapiContext { private void deleteConnection(Uuid connectionUuid, Uuid serviceUuid, LayerProtocolName serviceLayer) { // First read connectivity service with service uuid and update info InstanceIdentifier connectionIID = + .urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection> connectionIID = InstanceIdentifier.builder(Context.class).augmentation(Context1.class) .child(org.opendaylight.yang.gen.v1.urn - .onf.otcc.yang.tapi.connectivity.rev181210.context.ConnectivityContext.class) + .onf.otcc.yang.tapi.connectivity.rev221121.context.ConnectivityContext.class) .child(org.opendaylight.yang.gen.v1.urn - .onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.Connection.class, + .onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.Connection.class, new org.opendaylight.yang.gen.v1.urn - .onf.otcc.yang.tapi.connectivity.rev181210.connectivity.context.ConnectionKey( + .onf.otcc.yang.tapi.connectivity.rev221121.connectivity.context.ConnectionKey( connectionUuid)) .build(); Connection connection = getConnection(connectionUuid); @@ -500,7 +503,7 @@ public class TapiContext { } if (connService.getConnection().containsKey( new org.opendaylight.yang.gen.v1 - .urn.onf.otcc.yang.tapi.connectivity.rev181210.connectivity.service.ConnectionKey( + .urn.onf.otcc.yang.tapi.connectivity.rev221121.connectivity.service.ConnectionKey( connection.getUuid()))) { LOG.info("isNotUsedByOtherService: Connection {} is in used by service {}. Cannot remove it from " + "context", connection.getUuid().getValue(), connService.getUuid().getValue()); @@ -508,7 +511,7 @@ public class TapiContext { } LOG.info("isNotUsedByOtherService: Going to check lower connections"); for (org.opendaylight.yang.gen.v1.urn - .onf.otcc.yang.tapi.connectivity.rev181210.connectivity.service.Connection + .onf.otcc.yang.tapi.connectivity.rev221121.connectivity.service.Connection conn:connService.getConnection().values()) { Connection connection1 = getConnection(conn.getConnectionUuid()); if (connection1 == null || connection1.getLowerConnection() == null) { @@ -532,7 +535,7 @@ public class TapiContext { InstanceIdentifier connIID = InstanceIdentifier.builder(Context.class).augmentation(Context1.class) .child(org.opendaylight.yang.gen.v1.urn - .onf.otcc.yang.tapi.connectivity.rev181210.context.ConnectivityContext.class) + .onf.otcc.yang.tapi.connectivity.rev221121.context.ConnectivityContext.class) .child(Connection.class, new ConnectionKey(connectionUuid)) .build(); @@ -542,7 +545,7 @@ public class TapiContext { LOG.error("Connection not found in tapi context"); return null; } - return optConn.get(); + return optConn.orElseThrow(); } catch (InterruptedException | ExecutionException e) { LOG.error("Connection not found in tapi context. Error:", e); return null; @@ -553,21 +556,21 @@ public class TapiContext { try { // First read connectivity service with service uuid and update info InstanceIdentifier connectivityContextIID = + .onf.otcc.yang.tapi.connectivity.rev221121.context.ConnectivityContext> connectivityContextIID = InstanceIdentifier.builder(Context.class).augmentation(Context1.class) .child(org.opendaylight.yang.gen.v1.urn - .onf.otcc.yang.tapi.connectivity.rev181210.context.ConnectivityContext.class) + .onf.otcc.yang.tapi.connectivity.rev221121.context.ConnectivityContext.class) .build(); Optional optConnContext = + .onf.otcc.yang.tapi.connectivity.rev221121.context.ConnectivityContext> optConnContext = this.networkTransactionService.read(LogicalDatastoreType.OPERATIONAL, connectivityContextIID) .get(); if (!optConnContext.isPresent()) { LOG.error("Connectivity context not found in tapi context"); return null; } - return optConnContext.get().getConnectivityService(); + return optConnContext.orElseThrow().getConnectivityService(); } catch (InterruptedException | ExecutionException e) { LOG.error("Connectivity context not found in tapi context. Error:", e); return null; @@ -576,10 +579,10 @@ public class TapiContext { public ConnectionEndPoint getTapiCEP(Uuid topoUuid, Uuid nodeUuid, Uuid nepUuid, Uuid cepUuid) { InstanceIdentifier nepIID = InstanceIdentifier.builder(Context.class) - .augmentation(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.Context1.class) - .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.context.TopologyContext.class) + .augmentation(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.Context1.class) + .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.context.TopologyContext.class) .child(Topology.class, new TopologyKey(topoUuid)) - .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.topology.Node.class, + .child(org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev221121.topology.Node.class, new NodeKey(nodeUuid)).child(OwnedNodeEdgePoint.class, new OwnedNodeEdgePointKey(nepUuid)).build(); try { Optional optNode = this.networkTransactionService @@ -588,11 +591,11 @@ public class TapiContext { LOG.error(NODE_NOT_PRESENT); return null; } - if (optNode.get().augmentation(OwnedNodeEdgePoint1.class) == null) { + if (optNode.orElseThrow().augmentation(OwnedNodeEdgePoint1.class) == null) { LOG.error("Node doesnt have ceps"); return null; } - return optNode.get().augmentation(OwnedNodeEdgePoint1.class).getCepList().getConnectionEndPoint() + return optNode.orElseThrow().augmentation(OwnedNodeEdgePoint1.class).getCepList().getConnectionEndPoint() .get(new ConnectionEndPointKey(cepUuid)); } catch (InterruptedException | ExecutionException e) { LOG.error("Couldnt read node in topology", e);