X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=tapi%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Ftransportpce%2Ftapi%2Fimpl%2FTapiProvider.java;h=b84c3a1561ba99e9d21677211f88d5fc3734810c;hb=268165cb2822b6ce4c55f00cac63eed2bb222ec7;hp=dc30a57ebb5462ea6bde47f981f489078bf84f27;hpb=b16ead644f52fb2d797eece5d1d39c7fa56bb178;p=transportpce.git diff --git a/tapi/src/main/java/org/opendaylight/transportpce/tapi/impl/TapiProvider.java b/tapi/src/main/java/org/opendaylight/transportpce/tapi/impl/TapiProvider.java index dc30a57eb..b84c3a156 100644 --- a/tapi/src/main/java/org/opendaylight/transportpce/tapi/impl/TapiProvider.java +++ b/tapi/src/main/java/org/opendaylight/transportpce/tapi/impl/TapiProvider.java @@ -11,24 +11,40 @@ import java.util.HashMap; import org.eclipse.jdt.annotation.NonNull; import org.opendaylight.mdsal.binding.api.DataBroker; import org.opendaylight.mdsal.binding.api.DataTreeIdentifier; +import org.opendaylight.mdsal.binding.api.NotificationService; import org.opendaylight.mdsal.binding.api.RpcProviderService; import org.opendaylight.mdsal.common.api.LogicalDatastoreType; import org.opendaylight.transportpce.common.InstanceIdentifiers; +import org.opendaylight.transportpce.common.NetworkUtils; import org.opendaylight.transportpce.common.network.NetworkTransactionService; import org.opendaylight.transportpce.servicehandler.service.ServiceDataStoreOperations; import org.opendaylight.transportpce.tapi.connectivity.ConnectivityUtils; import org.opendaylight.transportpce.tapi.connectivity.TapiConnectivityImpl; +import org.opendaylight.transportpce.tapi.listeners.TapiPceListenerImpl; +import org.opendaylight.transportpce.tapi.listeners.TapiRendererListenerImpl; +import org.opendaylight.transportpce.tapi.listeners.TapiServiceHandlerListenerImpl; import org.opendaylight.transportpce.tapi.topology.TapiNetconfTopologyListener; +import org.opendaylight.transportpce.tapi.topology.TapiOrLinkListener; import org.opendaylight.transportpce.tapi.topology.TapiPortMappingListener; import org.opendaylight.transportpce.tapi.topology.TapiTopologyImpl; import org.opendaylight.transportpce.tapi.topology.TopologyUtils; import org.opendaylight.transportpce.tapi.utils.TapiContext; import org.opendaylight.transportpce.tapi.utils.TapiInitialORMapping; +import org.opendaylight.transportpce.tapi.utils.TapiLink; import org.opendaylight.transportpce.tapi.utils.TapiListener; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210315.Network; -import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev210315.network.Nodes; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.TransportpcePceListener; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.Network; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220316.network.Nodes; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.renderer.rev210915.TransportpceRendererListener; +import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev201125.TransportpceServicehandlerListener; import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.tapinetworkutils.rev210408.TransportpceTapinetworkutilsService; -import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.OrgOpenroadmServiceService; +import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev211210.OrgOpenroadmServiceService; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.NetworkId; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.Networks; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.NetworkKey; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.Network1; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.topology.rev180226.networks.network.Link; +import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.common.rev181210.TapiCommonService; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.connectivity.rev181210.TapiConnectivityService; import org.opendaylight.yang.gen.v1.urn.onf.otcc.yang.tapi.topology.rev181210.TapiTopologyService; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.tapi.rev180928.ServiceInterfacePoints; @@ -51,26 +67,41 @@ public class TapiProvider { private static final InstanceIdentifier MAPPING_II = InstanceIdentifier.create(Network.class) .child(org.opendaylight.yang.gen.v1.http - .org.opendaylight.transportpce.portmapping.rev210315.network.Nodes.class); + .org.opendaylight.transportpce.portmapping.rev220316.network.Nodes.class); + private static final InstanceIdentifier LINK_II = InstanceIdentifier.create(Networks.class).child( + org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.network.rev180226.networks.Network.class, + new NetworkKey(new NetworkId(NetworkUtils.OVERLAY_NETWORK_ID))).augmentation(Network1.class) + .child(Link.class); private final DataBroker dataBroker; private final RpcProviderService rpcProviderService; private ObjectRegistration rpcRegistration; private ObjectRegistration tapiNetworkutilsServiceRpcRegistration; private ListenerRegistration dataTreeChangeListenerRegistration; + private ListenerRegistration dataTreeChangeListenerRegistration1; private ListenerRegistration mappingListenerListenerRegistration; + private ListenerRegistration pcelistenerRegistration; + private ListenerRegistration rendererlistenerRegistration; + private ListenerRegistration servicehandlerlistenerRegistration; private final OrgOpenroadmServiceService serviceHandler; private final ServiceDataStoreOperations serviceDataStoreOperations; private final TapiListener tapiListener; private final TapiNetconfTopologyListener topologyListener; + private final TapiOrLinkListener orLinkListener; private TapiPortMappingListener tapiPortMappingListener; private final NetworkTransactionService networkTransactionService; private final TransportpceTapinetworkutilsService tapiNetworkUtils; + private TapiPceListenerImpl pceListenerImpl; + private TapiRendererListenerImpl rendererListenerImpl; + private TapiServiceHandlerListenerImpl serviceHandlerListenerImpl; + private final NotificationService notificationService; public TapiProvider(DataBroker dataBroker, RpcProviderService rpcProviderService, OrgOpenroadmServiceService serviceHandler, ServiceDataStoreOperations serviceDataStoreOperations, TapiListener tapiListener, NetworkTransactionService networkTransactionService, TapiNetconfTopologyListener topologyListener, TapiPortMappingListener tapiPortMappingListener, - TransportpceTapinetworkutilsService tapiNetworkUtils) { + TransportpceTapinetworkutilsService tapiNetworkUtils, TapiPceListenerImpl pceListenerImpl, + TapiRendererListenerImpl rendererListenerImpl, TapiServiceHandlerListenerImpl serviceHandlerListenerImpl, + NotificationService notificationService, TapiOrLinkListener orLinkListener) { this.dataBroker = dataBroker; this.rpcProviderService = rpcProviderService; this.serviceHandler = serviceHandler; @@ -80,6 +111,11 @@ public class TapiProvider { this.topologyListener = topologyListener; this.tapiPortMappingListener = tapiPortMappingListener; this.tapiNetworkUtils = tapiNetworkUtils; + this.pceListenerImpl = pceListenerImpl; + this.rendererListenerImpl = rendererListenerImpl; + this.serviceHandlerListenerImpl = serviceHandlerListenerImpl; + this.notificationService = notificationService; + this.orLinkListener = orLinkListener; } /** @@ -89,19 +125,24 @@ public class TapiProvider { LOG.info("TapiProvider Session Initiated"); TapiContext tapiContext = new TapiContext(this.networkTransactionService); LOG.info("Empty TAPI context created: {}", tapiContext.getTapiContext()); - - TopologyUtils topologyUtils = new TopologyUtils(this.networkTransactionService, this.dataBroker); + TapiLink tapiLink = new TapiLink(this.networkTransactionService); + TopologyUtils topologyUtils = new TopologyUtils(this.networkTransactionService, this.dataBroker, tapiLink); ConnectivityUtils connectivityUtils = new ConnectivityUtils(this.serviceDataStoreOperations, new HashMap<>(), - tapiContext); + tapiContext, this.networkTransactionService); TapiInitialORMapping tapiInitialORMapping = new TapiInitialORMapping(topologyUtils, connectivityUtils, tapiContext, this.serviceDataStoreOperations); tapiInitialORMapping.performTopoInitialMapping(); tapiInitialORMapping.performServInitialMapping(); - TapiConnectivityImpl tapi = new TapiConnectivityImpl(this.serviceHandler); - TapiTopologyImpl topo = new TapiTopologyImpl(this.dataBroker, tapiContext, topologyUtils); + TapiConnectivityImpl tapi = new TapiConnectivityImpl(this.serviceHandler, tapiContext, connectivityUtils, + pceListenerImpl, rendererListenerImpl, serviceHandlerListenerImpl); + TapiTopologyImpl topo = new TapiTopologyImpl(this.dataBroker, tapiContext, topologyUtils, tapiLink); rpcRegistration = rpcProviderService.registerRpcImplementation(TapiConnectivityService.class, tapi); rpcProviderService.registerRpcImplementation(TapiTopologyService.class, topo); + rpcProviderService.registerRpcImplementation(TapiCommonService.class, topo); + dataTreeChangeListenerRegistration1 = + dataBroker.registerDataTreeChangeListener(DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, + LINK_II), orLinkListener); dataTreeChangeListenerRegistration = dataBroker.registerDataTreeChangeListener(DataTreeIdentifier.create(LogicalDatastoreType.OPERATIONAL, InstanceIdentifiers.NETCONF_TOPOLOGY_II.child(Node.class)), topologyListener); @@ -115,6 +156,11 @@ public class TapiProvider { InstanceIdentifier sipIID = InstanceIdentifier.create(ServiceInterfacePoints.class); dataBroker.registerDataTreeChangeListener(DataTreeIdentifier.create( LogicalDatastoreType.CONFIGURATION, sipIID), tapiListener); + // Notification Listener + pcelistenerRegistration = notificationService.registerNotificationListener(pceListenerImpl); + rendererlistenerRegistration = notificationService.registerNotificationListener(rendererListenerImpl); + servicehandlerlistenerRegistration = + notificationService.registerNotificationListener(serviceHandlerListenerImpl); } /** @@ -128,9 +174,15 @@ public class TapiProvider { if (mappingListenerListenerRegistration != null) { mappingListenerListenerRegistration.close(); } + if (dataTreeChangeListenerRegistration1 != null) { + dataTreeChangeListenerRegistration1.close(); + } if (tapiNetworkutilsServiceRpcRegistration != null) { tapiNetworkutilsServiceRpcRegistration.close(); } + pcelistenerRegistration.close(); + rendererlistenerRegistration.close(); + servicehandlerlistenerRegistration.close(); rpcRegistration.close(); } }