import org.opendaylight.transportpce.networkmodel.util.TpceNetwork;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220922.Network;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.portmapping.rev220922.mapping.Mapping;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev201125.TransportpceServicehandlerListener;
import org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.topology.rev131021.network.topology.topology.Node;
-import org.opendaylight.yangtools.concepts.ListenerRegistration;
import org.opendaylight.yangtools.concepts.Registration;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.osgi.service.component.annotations.Activate;
private final NetConfTopologyListener topologyListener;
private List<Registration> listeners;
private TpceNetwork tpceNetwork;
- private ListenerRegistration<TransportpceServicehandlerListener> serviceHandlerListenerRegistration;
+ private Registration serviceHandlerListenerRegistration;
private NotificationService notificationService;
private FrequenciesService frequenciesService;
private PortMappingListener portMappingListener;
InstanceIdentifiers.NETCONF_TOPOLOGY_II.child(Node.class)), topologyListener));
listeners.add(dataBroker.registerDataTreeChangeListener(
DataTreeIdentifier.create(LogicalDatastoreType.CONFIGURATION, MAPPING_II), portMappingListener));
- TransportpceServicehandlerListener serviceHandlerListner = new ServiceHandlerListener(frequenciesService);
- serviceHandlerListenerRegistration = notificationService.registerNotificationListener(serviceHandlerListner);
+ serviceHandlerListenerRegistration = notificationService.registerCompositeListener(
+ new ServiceHandlerListener(frequenciesService).getCompositeListener());
}
/**
package org.opendaylight.transportpce.networkmodel.listeners;
+import java.util.Set;
+import org.opendaylight.mdsal.binding.api.NotificationService.CompositeListener;
import org.opendaylight.transportpce.networkmodel.service.FrequenciesService;
import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev201125.ServiceRpcResultSh;
-import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev201125.TransportpceServicehandlerListener;
import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev230526.ServiceNotificationTypes;
import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.RpcStatusEx;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public class ServiceHandlerListener implements TransportpceServicehandlerListener {
+public class ServiceHandlerListener {
private static final Logger LOG = LoggerFactory.getLogger(ServiceHandlerListener.class);
private final FrequenciesService service;
+
public ServiceHandlerListener(FrequenciesService service) {
LOG.info("Init service handler listener for network");
this.service = service;
}
- @Override
+ public CompositeListener getCompositeListener() {
+ return new CompositeListener(Set.of(
+ new CompositeListener.Component<>(ServiceRpcResultSh.class, this::onServiceRpcResultSh)));
+ }
+
public void onServiceRpcResultSh(ServiceRpcResultSh notification) {
if (notification.getStatus() != RpcStatusEx.Successful) {
LOG.info("RpcStatusEx of notification not equals successful. Nothing to do for notification {}",