2 * Copyright © 2017 Orange, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.transportpce.servicehandler.listeners;
10 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev171017.ServicePathRpcResult;
11 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev171017.TransportpcePceListener;
12 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev171016.RpcStatusEx;
13 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev171016.ServicePathNotificationTypes;
14 import org.slf4j.Logger;
15 import org.slf4j.LoggerFactory;
18 public class PceListenerImpl implements TransportpcePceListener {
20 private static final Logger LOG = LoggerFactory.getLogger(PceListenerImpl.class);
22 private ServicePathRpcResult servicePathRpcResult = null;
25 public void onServicePathRpcResult(ServicePathRpcResult notification) {
26 if (!compareServicePathRpcResult(notification)) {
27 servicePathRpcResult = notification;
28 StringBuilder build = new StringBuilder();
30 "Received '" + notification.getNotificationType() + "' StubPce notification " + "from service '"
31 + notification.getServiceName() + "' " + "with status '" + notification.getStatus() + "'");
32 build.append(" with StatusMessage '" + notification.getStatusMessage() + "'");
33 if ((notification.getStatus() == RpcStatusEx.Successful) && (notification.getNotificationType()
34 .getIntValue() == ServicePathNotificationTypes.PathComputationRequest.getIntValue())) {
35 build.append(" PathDescription : " + notification.getPathDescription().toString());
37 * switch (action.getIntValue()) { case 1: //service-create case
38 * 3: //service-delete case 8: //service-reconfigure case 9:
39 * //service-restoration case 10://service-reversion case
40 * 11://service-reroute break;
46 LOG.info(build.toString());
48 LOG.info("ServicePathRpcResult already wired !");
53 private Boolean compareServicePathRpcResult(ServicePathRpcResult notification) {
54 Boolean result = true;
55 if (servicePathRpcResult == null) {
58 if (servicePathRpcResult.getNotificationType() != notification.getNotificationType()) {
61 if (servicePathRpcResult.getServiceName() != notification.getServiceName()) {
64 if (servicePathRpcResult.getStatus() != notification.getStatus()) {
67 if (servicePathRpcResult.getStatusMessage() != notification.getStatusMessage()) {