Servicehandler Tests 37/73537/5
authorMartial COULIBALY <martial.coulibaly@gfi.fr>
Tue, 23 Jan 2018 08:48:26 +0000 (09:48 +0100)
committerguillaume.lambert <guillaume.lambert@orange.com>
Mon, 16 Jul 2018 14:54:59 +0000 (16:54 +0200)
this commit includes :
- Add rpc-state-modify on servicehandler.yang to test
rpc-service-restoration which can only be launch on service with
operational state 'outOfService'.
- Move stubpce.yang and stubrenderer.yang to stubmodels maven project
under tests folder.
- Create specific profile for servicehandler tests in tox.ini file.
So now to only launch servihandler tests you have to use this
command : 'tox -e servicehandler' in tests folder.
- Use parameterized loggins.
- Add 5 more tests to 'tests_servicehandler' python file.
- Mofify some errors on service-create rpc implementaion.
- Add python file 'tests_servichandler.py' to test servicehandler
functions.
- Modifiy stubpce and stubrenderer yang model to add RPCs from
servicepath version 1.5. This modification came from having two version
of servicepath (1.5 and 1.6) in the model directory does not allow me
to access some RPCs. For example trying to get service path list for
1.5 version failed caused the url is the same :
http://localhost:8181/restconf/operational/transportpce-servicepath:service-path-list
So REST API seems to use the last version which is 1.6.

Change-Id: Ief8aab19750fe2959407b90772df8a8a6280e73d
Signed-off-by: Martial COULIBALY <martial.coulibaly@gfi.fr>
Signed-off-by: Olivier RENAIS <olivier.renais@orange.com>
27 files changed:
api/src/main/yang/servicehandler.yang
pom.xml
servicehandler/pom.xml
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/MappingAndSendingPCRequest.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/MappingAndSendingSIRequest.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerImpl.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/impl/ServicehandlerProvider.java
tests/pom.xml
tests/setup.cfg
tests/stubmodels/pom.xml [new file with mode: 0644]
tests/stubmodels/src/main/yang/stubpce.yang [moved from api/src/main/yang/stubpce.yang with 84% similarity]
tests/stubmodels/src/main/yang/stubrenderer.yang [moved from api/src/main/yang/stubrenderer.yang with 100% similarity]
tests/stubpce/pom.xml
tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/SendingPceRPCs.java
tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/impl/StubpceImpl.java
tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/impl/StubpceProvider.java
tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/topology/InterNodePath.java
tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/topology/NodePath.java
tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/topology/PathDescriptionsOrdered.java
tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/topology/SuperNodePath.java
tests/stubpce/src/main/java/org/opendaylight/transportpce/stubpce/topology/Topology.java
tests/stubrenderer/pom.xml
tests/stubrenderer/src/main/java/org/opendaylight/transportpce/stubrenderer/SendingRendererRPCs.java
tests/stubrenderer/src/main/java/org/opendaylight/transportpce/stubrenderer/impl/StubrendererImpl.java
tests/stubrenderer/src/main/java/org/opendaylight/transportpce/stubrenderer/impl/StubrendererProvider.java
tests/tox.ini
tests/transportpce_tests/test_servicehandler.py [new file with mode: 0644]

index c6832b0c3b32199a1c83783e623da7ef28503027..b33130fa5968192a77f10021dad9d36fe877f627 100644 (file)
@@ -56,6 +56,23 @@ module servicehandler {
       "Version 1.2";
   }
 
+  rpc service-state-modify {
+      input {
+          leaf service-name {
+              type string;
+              mandatory true;
+          }
+          leaf operational-state {
+              type org-openroadm-common-types:state;
+          }
+      }
+      output {
+        uses org-openroadm-common-service-types:configuration-response-common;
+      }
+      description
+          "Just to test rpc restoration from org-openroadm-service";
+  }
+
   notification service-rpc-result-sh{
     description
       "This Notification indicates result of service RPC";
diff --git a/pom.xml b/pom.xml
index 1fe836077ac44f7123be9e2cb131f58173ba22a4..f1c0a4a3c4e8b15e428c49764a5c87e7a26535e6 100644 (file)
--- a/pom.xml
+++ b/pom.xml
@@ -35,8 +35,8 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
     <module>impl</module>
     <module>renderer</module>
     <module>olm</module>
-    <module>servicehandler</module>
     <module>tests</module>
+    <module>servicehandler</module>
     <module>cli</module>
     <module>features</module>
     <module>karaf</module>
index 4ac732bf7910b716fa4dbe75e5376165e62d8387..78aa8166941a4a19bdabb2d75ffe843656c65259 100644 (file)
@@ -35,6 +35,11 @@ Author: Martial Coulibaly <martial.coulibaly@gfi.com> on behalf of Orange
       <artifactId>transportpce-ordmodels</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>transportpce-stubmodels</artifactId>
+      <version>${project.version}</version>
+    </dependency>
 
     <!-- Testing Dependencies -->
     <dependency>
index c9f75cf64e475e8463d2e0ee604f700ffd88264b..ff386744190f0f764022a16a80411769ed4ce80f 100644 (file)
@@ -343,7 +343,7 @@ public class MappingAndSendingPCRequest {
                 RpcResult<PathComputationRequestOutput> pceOutputResult = null;
                 Boolean output = false;
                 if (pathComputationRequestInput != null) {
-                    LOG.info("pathComputationRequestInput : " + pathComputationRequestInput.toString());
+                    LOG.info("pathComputationRequestInput : {}", pathComputationRequestInput.toString());
                     Future<RpcResult<PathComputationRequestOutput>> pceOutputFuture = service
                             .pathComputationRequest(pathComputationRequestInput);
                     try {
index 691b156c5269df01b195ba38a87eb7543970a139..8d88587f2c9f2c7119cf3decd72b49e268569ce0 100644 (file)
@@ -32,6 +32,7 @@ import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrende
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.service.implementation.request.input.ServiceZEnd;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.service.implementation.request.input.ServiceZEndBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.ServiceFormat;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.sdnc.request.header.SdncRequestHeader;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceCreateInput;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceReconfigureInput;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.Services;
@@ -150,7 +151,7 @@ public class MappingAndSendingSIRequest {
         try {
             tmp = pathComputationOutput.getResponseParameters().getPathDescription();
         } catch (NullPointerException e) {
-            LOG.error("PathDescription is null : " + e.toString());
+            LOG.error("PathDescription is null : {}", e.toString());
         }
         PathDescriptionBuilder pathDescription = new PathDescriptionBuilder();
         if (tmp != null) {
@@ -246,7 +247,7 @@ public class MappingAndSendingSIRequest {
         try {
             tmp = pathComputationOutput.getResponseParameters().getPathDescription();
         } catch (NullPointerException e) {
-            LOG.error("PathDescription is null : " + e.toString());
+            LOG.error("PathDescription is null : {}", e.toString());
         }
         PathDescriptionBuilder pathDescription = new PathDescriptionBuilder();
         if (tmp != null) {
@@ -259,7 +260,7 @@ public class MappingAndSendingSIRequest {
         .setServiceAEnd(serviceAEnd)
         .setServiceZEnd(serviceZEnd)
         .build();
-        LOG.info("ServiceImplementationRequestInput : " + serviceImplementationRequestInput.toString());*/
+        LOG.info("ServiceImplementationRequestInput : {}", serviceImplementationRequestInput.toString());*/
     }
 
 
@@ -310,6 +311,13 @@ public class MappingAndSendingSIRequest {
 
         /** Building ServiceImplementationRequestInput  / ServiceDeleteInput serviceDeleteInput .*/
         ServiceHandlerHeaderBuilder serviceHandlerHeader = new ServiceHandlerHeaderBuilder();
+        SdncRequestHeader sdnc = services.getSdncRequestHeader();
+        if (sdnc != null) {
+            String requestId = services.getSdncRequestHeader().getRequestId();
+            if (requestId != null) {
+                serviceHandlerHeader.setRequestId(requestId);
+            }
+        }
         mappingSIRequest(pathComputationOutput, serviceHandlerHeader, services.getServiceAEnd(),
                 services.getServiceZEnd(), services.getServiceName());
         /*org.opendaylight.yang.gen.v1.http.org.openroadm.common.service
@@ -359,7 +367,7 @@ public class MappingAndSendingSIRequest {
         try {
             tmp = pathComputationOutput.getResponseParameters().getPathDescription();
         } catch (NullPointerException e) {
-            LOG.error("PathDescription is null : " + e.toString());
+            LOG.error("PathDescription is null : {}", e);
         }
         PathDescriptionBuilder pathDescription = new PathDescriptionBuilder();
         if (tmp != null) {
@@ -373,7 +381,7 @@ public class MappingAndSendingSIRequest {
         .setServiceAEnd(serviceAEnd)
         .setServiceZEnd(serviceZEnd)
         .build();
-        LOG.info("ServiceImplementationRequestInput : " + serviceImplementationRequestInput.toString());*/
+        LOG.info("ServiceImplementationRequestInput : {}", serviceImplementationRequestInput.toString());*/
     }
 
     /**
@@ -434,7 +442,7 @@ public class MappingAndSendingSIRequest {
         try {
             tmp = pathComputationOutput.getResponseParameters().getPathDescription();
         } catch (NullPointerException e) {
-            LOG.error("PathDescription is null : " + e.toString());
+            LOG.error("PathDescription is null : {}", e.toString());
         }
         PathDescriptionBuilder pathDescription = new PathDescriptionBuilder();
         if (tmp != null) {
index 1fa5d4e04a287f7018fe41cb8efa19780736257c..225fa272e0d69f6b9d303b95261763ab7c2f7694 100644 (file)
@@ -35,6 +35,10 @@ import org.opendaylight.transportpce.servicehandler.ServicehandlerCompliancyChec
 import org.opendaylight.transportpce.servicehandler.ServicehandlerTxRxCheck;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServiceRpcResultSh;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServiceRpcResultShBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServiceStateModifyInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServiceStateModifyOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServiceStateModifyOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServicehandlerService;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathComputationRequestOutput;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathComputationRequestOutputBuilder;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.ServicePathRpcResult;
@@ -48,6 +52,7 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev1
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommon;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommonBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.sdnc.request.header.SdncRequestHeader;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.sdnc.request.header.SdncRequestHeaderBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.ServiceAEnd;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.ServiceAEndBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.ServiceZEnd;
@@ -119,7 +124,7 @@ import org.slf4j.LoggerFactory;
  *
  * @author <a href="mailto:martial.coulibaly@gfi.com">Martial Coulibaly</a> on behalf of Orange
  */
-public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceListener,
+public class ServicehandlerImpl implements OrgOpenroadmServiceService, ServicehandlerService, StubpceListener,
     StubrendererListener,AutoCloseable {
     /** Logging. */
     private static final Logger LOG = LoggerFactory.getLogger(ServicehandlerImpl.class);
@@ -149,7 +154,6 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
     private ServicePathRpcResult servicePathRpcResult = null;
     private ServiceRpcResultSp serviceRpcResultSp = null;
 
-    private String notificationUrl = "";
     private RpcActions action;
 
     private PathDescription pathDescription;
@@ -188,7 +192,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
             serviceName = service.getServiceName();
         }
         if (serviceName != null) {
-            LOG.info("deleting service '" + serviceName + "'from datastore ...");
+            LOG.info("deleting service '{}' from datastore ...", serviceName);
             ServiceRpcResultSh notification = null;
             String message = "";
             /**
@@ -210,7 +214,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
             try {
                 notificationPublishService.putNotification(notification);
             } catch (InterruptedException e) {
-                LOG.info("notification offer rejected : " + e);
+                LOG.info("notification offer rejected : {}", e);
             }
         } else {
             LOG.error("Parameter 'ServiceName' fro deleteServiceFromDatastore is null !");
@@ -274,13 +278,13 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
                 }
                 notification = new ServiceRpcResultShBuilder()
                         .setNotificationType(notif)
-                        .setServiceName(serviceCreateInput.getServiceName())
+                        .setServiceName(serviceName)
                         .setStatus(RpcStatusEx.Successful).setStatusMessage(message)
                         .build();
                 try {
                     notificationPublishService.putNotification(notification);
                 } catch (InterruptedException e) {
-                    LOG.info("notification offer rejected : " + e);
+                    LOG.info("notification offer rejected : {}", e);
                 }
             } else {
                 message = "pathTopology not in stubrenderer notification, cancelling pce resource reserve ...";
@@ -294,7 +298,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
                 try {
                     notificationPublishService.putNotification(notification);
                 } catch (InterruptedException e) {
-                    LOG.info("notification offer rejected : " + e);
+                    LOG.info("notification offer rejected : {}", e);
                 }
                 pceCancelResResource();
             }
@@ -359,7 +363,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
         try {
             notificationPublishService.putNotification(notification);
         } catch (InterruptedException e) {
-            LOG.info("notification offer rejected : " + e);
+            LOG.info("notification offer rejected : {}", e);
         }
         FutureCallback<Boolean> pceCallback =  new FutureCallback<Boolean>() {
             String message = "";
@@ -383,7 +387,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
                     try {
                         notificationPublishService.putNotification(notification);
                     } catch (InterruptedException e) {
-                        LOG.info("notification offer rejected : " + e);
+                        LOG.info("notification offer rejected : {}", e);
                     }
                 } else {
                     message = mappingAndSendingPCRequest.getError();
@@ -394,7 +398,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
                     try {
                         notificationPublishService.putNotification(notification);
                     } catch (InterruptedException e) {
-                        LOG.info("notification offer rejected : " + e);
+                        LOG.info("notification offer rejected : {}", e);
                     }
                 }
             }
@@ -409,7 +413,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
                 try {
                     notificationPublishService.putNotification(notification);
                 } catch (InterruptedException e) {
-                    LOG.info("notification offer rejected : " + e);
+                    LOG.info("notification offer rejected : {}", e);
                 }
 
             }
@@ -483,7 +487,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
                         try {
                             notificationPublishService.putNotification(notification);
                         } catch (InterruptedException e) {
-                            LOG.info("notification offer rejected : " + e);
+                            LOG.info("notification offer rejected : {}", e);
                         }
                     } else {
                         message = mappingAndSendingPCRequest.getError();
@@ -494,7 +498,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
                         try {
                             notificationPublishService.putNotification(notification);
                         } catch (InterruptedException e) {
-                            LOG.info("notification offer rejected : " + e);
+                            LOG.info("notification offer rejected : {}", e);
                         }
                     }
                 }
@@ -510,7 +514,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
                     try {
                         notificationPublishService.putNotification(notification);
                     } catch (InterruptedException e) {
-                        LOG.info("notification offer rejected : " + e);
+                        LOG.info("notification offer rejected : {}", e);
                     }
 
                 }
@@ -536,7 +540,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
 
         if (tmp != null && id != null) {
             final String serviceName = tmp;
-            LOG.info("stubrendererDelete service '" + serviceName + "'");
+            LOG.info("stubrendererDelete service '{}'", serviceName);
             mappingAndSendingSIRequest = new MappingAndSendingSIRequest(rpcRegistry, id, serviceName);
             ListenableFuture<Boolean> renderer = mappingAndSendingSIRequest.serviceDelete();
             FutureCallback<Boolean> rendererCallback = new FutureCallback<Boolean>() {
@@ -554,7 +558,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
                     try {
                         notificationPublishService.putNotification(notification);
                     } catch (InterruptedException e) {
-                        LOG.info("notification offer rejected : " + e);
+                        LOG.info("notification offer rejected : {}", e);
                     }
 
                 }
@@ -570,7 +574,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
                         try {
                             notificationPublishService.putNotification(notification);
                         } catch (InterruptedException e) {
-                            LOG.info("notification offer rejected : " + e);
+                            LOG.info("notification offer rejected : {}", e);
                         }
                     } else {
                         message = "deleting service failed !";
@@ -582,7 +586,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
                         try {
                             notificationPublishService.putNotification(notification);
                         } catch (InterruptedException e) {
-                            LOG.info("notification offer rejected : " + e);
+                            LOG.info("notification offer rejected : {}", e);
                         }
                     }
                 }
@@ -655,11 +659,11 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
             final ServiceNotificationTypes notifType = type;
             if (!create) { /** ServiceReconfigure. */
                 if ((result = writeOrModifyOrDeleteServiceList(serviceName, pathComputationResponse,null, 1)) == null) {
-                    LOG.info("Service '" + serviceName + "' deleted from datastore");
+                    LOG.info("Service '{}' deleted from datastore", serviceName);
                     serviceName = newServiceName;
                     delete = true;
                 } else {
-                    LOG.info("deleting Service '" + serviceName + "' failed !");
+                    LOG.info("deleting Service '{}' failed !", serviceName);
                 }
             }
             if (delete) {
@@ -682,7 +686,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
                     try {
                         notificationPublishService.putNotification(notification);
                     } catch (InterruptedException e) {
-                        LOG.info("notification offer rejected : " + e);
+                        LOG.info("notification offer rejected : {}", e);
                     }
 
                     FutureCallback<Boolean> rendererCallback = new FutureCallback<Boolean>() {
@@ -707,7 +711,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
                                 try {
                                     notificationPublishService.putNotification(notification);
                                 } catch (InterruptedException e) {
-                                    LOG.info("notification offer rejected : " + e);
+                                    LOG.info("notification offer rejected : {}", e);
                                 }
                             } else {
                                 message = mappingAndSendingSIRequest.getError();
@@ -718,7 +722,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
                                 try {
                                     notificationPublishService.putNotification(notification);
                                 } catch (InterruptedException e) {
-                                    LOG.info("notification offer rejected : " + e);
+                                    LOG.info("notification offer rejected : {}", e);
                                 }
                             }
                         }
@@ -733,7 +737,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
                             try {
                                 notificationPublishService.putNotification(notification);
                             } catch (InterruptedException e) {
-                                LOG.info("notification offer rejected : " + e);
+                                LOG.info("notification offer rejected : {}", e);
                             }
                         }
                     };
@@ -764,10 +768,12 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
         Boolean commonId = true;
         Boolean coherencyHardSoft = false;
 
-        if (sdncRequestHeader != null) {
+        if (rpcActions.equals(RpcActions.ServiceCreate) || rpcActions.equals(RpcActions.ServiceFeasibilityCheck)
+                || rpcActions.equals(RpcActions.ServiceDelete)) {
             sdncRequest = true;
-        }
-        if (connectionType != null) {
+        } else if (rpcActions.equals(RpcActions.ServiceCreate)
+                || rpcActions.equals(RpcActions.ServiceFeasibilityCheck)
+                || rpcActions.equals(RpcActions.ServiceReconfigure)) {
             contype = true;
         }
         compliancyCheck = new ServicehandlerCompliancyCheck(sdncRequestHeader, serviceName,
@@ -832,8 +838,6 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
         pathDescription = null;
         pathTopology = null;
         action = RpcActions.ServiceCreate;
-        notificationUrl = null;
-        LOG.info("notificationUrl : " + notificationUrl);
         setPathDescription(null);
         serviceCreateInput = input;
         setServiceDeleteInput(null);
@@ -852,21 +856,35 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
                 input.getConnectionType(), RpcActions.ServiceCreate, input.getServiceAEnd(), input.getServiceZEnd(),
                 input.getCommonId(), input.getHardConstraints(), input.getSoftConstraints())) != null) {
             message = "Service not compliant : " + serviceCompliancy;
+            responseCode = "500";
             LOG.info(message);
         } else {
             LOG.info("Service compliant !");
-            pcePathComputation(input);
-            LOG.info("PCR Request in progress ");
-            configurationResponseCommon = new ConfigurationResponseCommonBuilder()
-                    .setAckFinalIndicator("No").setRequestId(input.getSdncRequestHeader().getRequestId())
-                    .setResponseMessage("Service compliant, serviceCreate in progress...")
-                    .setResponseCode("200").build();
+            String name = input.getServiceName();
+            if (readServiceList(name) == null) {
+                pcePathComputation(input);
+                LOG.info("PCR Request in progress ");
+                configurationResponseCommon = new ConfigurationResponseCommonBuilder()
+                        .setAckFinalIndicator("No").setRequestId(input.getSdncRequestHeader().getRequestId())
+                        .setResponseMessage("Service compliant, serviceCreate in progress...")
+                        .setResponseCode("200").build();
 
-            ServiceCreateOutputBuilder output = new ServiceCreateOutputBuilder()
-                    .setConfigurationResponseCommon(configurationResponseCommon);
+                ServiceCreateOutputBuilder output = new ServiceCreateOutputBuilder()
+                        .setConfigurationResponseCommon(configurationResponseCommon);
 
-            return RpcResultBuilder.success(output.build()).buildFuture();
+                return RpcResultBuilder.success(output.build()).buildFuture();
+            } else {
+                LOG.info("Service '{}' already created !", name);
+                configurationResponseCommon = new ConfigurationResponseCommonBuilder()
+                        .setAckFinalIndicator("Yes").setRequestId(input.getSdncRequestHeader().getRequestId())
+                        .setResponseMessage("Service already created !")
+                        .setResponseCode("500").build();
 
+                ServiceCreateOutputBuilder output = new ServiceCreateOutputBuilder()
+                        .setConfigurationResponseCommon(configurationResponseCommon);
+
+                return RpcResultBuilder.success(output.build()).buildFuture();
+            }
         }
         /*compliancyCheck = new ServicehandlerCompliancyCheck(input.getSdncRequestHeader(), input.getServiceName(),
                 input.getConnectionType(), RpcActions.ServiceCreate);
@@ -921,22 +939,29 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
             responseCode = "500";
         }*/
 
-        configurationResponseCommon = new ConfigurationResponseCommonBuilder()
+        ConfigurationResponseCommonBuilder builder = new ConfigurationResponseCommonBuilder()
                 .setAckFinalIndicator("Yes")
-                .setRequestId(input.getSdncRequestHeader().getRequestId()).setResponseMessage(message)
-                .setResponseCode(responseCode).build();
+                .setResponseMessage(message)
+                .setResponseCode(responseCode);
+        SdncRequestHeader sdnc = input.getSdncRequestHeader();
+        if (sdnc != null) {
+            String requestId = sdnc.getRequestId();
+            if (requestId != null) {
+                builder.setRequestId(requestId);
+            }
+        }
+        configurationResponseCommon = builder.build();
 
         ServiceCreateOutputBuilder output = new ServiceCreateOutputBuilder()
                 .setConfigurationResponseCommon(configurationResponseCommon);
 
         return RpcResultBuilder.success(output.build()).buildFuture();
-
     }
 
     @Override
     public Future<RpcResult<ServiceDeleteOutput>> serviceDelete(ServiceDeleteInput input) {
-        LOG.info("RPC serviceDelete request received for Service '" + input.getServiceDeleteReqInfo().getServiceName()
-                + "'");
+        LOG.info("RPC serviceDelete request received for Service '{}'", input.getServiceDeleteReqInfo()
+                .getServiceName());
         setServiceDeleteInput(input);
         setServiceReconfigureInput(null);
         serviceCreateInput = null;
@@ -955,7 +980,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
             String serviceName = input.getServiceDeleteReqInfo().getServiceName();
             Services service = readServiceList(serviceName);
             if (service != null) {
-                LOG.debug("Service '" + serviceName + "' present in datastore !");
+                LOG.debug("Service '{}' present in datastore !", serviceName);
                 stubrendererDelete();
                 LOG.info("ServiceDelete Request in progress ... ");
                 ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
@@ -1110,7 +1135,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
             String serviceName = input.getServiceName();
             Services service = readServiceList(serviceName);
             if (service != null) {
-                LOG.debug("Service '" + serviceName + "' present in datastore !");
+                LOG.debug("Service '{}' present in datastore !", serviceName);
                 /**
                  * Sending cancel resource reserve request to PCE.
                  */
@@ -1155,7 +1180,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
                         String serviceName = input.getServiceName();
                         Services service = readServiceList(serviceName);
                         if (service != null) {
-                            LOG.debug("Service '" + serviceName + "' present in datastore !");
+                            LOG.debug("Service '{}' present in datastore !", serviceName);
                             pceCancelResResource();
                             ServiceReconfigureOutput output = new ServiceReconfigureOutputBuilder()
                                     .setStatus(RpcStatusEx.Pending)
@@ -1163,7 +1188,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
                             return RpcResultBuilder.success(output).buildFuture();
                         } else {
                             message = "Service '" + serviceName + "' not exists in datastore";
-                            LOG.error(message);
+                            LOG.error("Service '{}' not exists in datastore", serviceName);
                         }
                     }
                 } else {
@@ -1176,7 +1201,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
             message = compliancyCheck.getMessage();
         }*/
 
-        ServiceReconfigureOutput output = new ServiceReconfigureOutputBuilder().setStatus(RpcStatus.Successful)
+        ServiceReconfigureOutput output = new ServiceReconfigureOutputBuilder().setStatus(RpcStatus.Failed)
                 .setStatusMessage(message).build();
         return RpcResultBuilder.success(output).buildFuture();
     }
@@ -1187,7 +1212,6 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
         ServiceRpcResultSh notification = null;
         setServiceDeleteInput(null);
         setServiceReconfigureInput(null);
-        notificationUrl = null;
         String message = "";
         LOG.info("checking Service Compliancy ...");
         compliancyCheck = new ServicehandlerCompliancyCheck(input.getServiceName(), RpcActions.ServiceRestoration);
@@ -1200,23 +1224,34 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
             Services service = readServiceList(serviceName);
             if (service != null) {
                 this.service = service;
-                LOG.debug("Service '" + serviceName + "' present in datastore !");
-                notification = new ServiceRpcResultShBuilder()
-                        .setNotificationType(ServiceNotificationTypes.ServiceRestorationResult)
-                        .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Pending)
-                        .setStatusMessage("Service '" + serviceName + "' present in datastore, deleting service ...")
-                        .build();
-                try {
-                    notificationPublishService.putNotification(notification);
-                } catch (InterruptedException e) {
-                    LOG.info("notification offer rejected : " + e);
+                LOG.debug("Service '{}' present in datastore !", serviceName);
+                /** verify if service state is down. */
+                State state = service.getOperationalState();
+                if (state != null && !state.equals(State.InService)) {
+                    notification = new ServiceRpcResultShBuilder()
+                            .setNotificationType(ServiceNotificationTypes.ServiceRestorationResult)
+                            .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Pending)
+                            .setStatusMessage("Service '" + serviceName + "' present in datastore, deleting service ..")
+                            .build();
+                    try {
+                        notificationPublishService.putNotification(notification);
+                    } catch (InterruptedException e) {
+                        LOG.info("notification offer rejected : {}", e);
+                    }
+                    stubrendererDelete();
+                    LOG.info("PCR Request in progress ");
+                    ServiceRestorationOutput output = new ServiceRestorationOutputBuilder()
+                            .setStatus(RpcStatus.Successful)
+                            .setStatusMessage("ServiceRestoration in progress...").build();
+                    return RpcResultBuilder.success(output).buildFuture();
+                } else {
+                    LOG.info("Service '{}' still in '{}' state", serviceName, state);
+                    ServiceRestorationOutput output = new ServiceRestorationOutputBuilder()
+                            .setStatus(RpcStatus.Failed)
+                            .setStatusMessage("ServiceRestoration failed : Service still in service !")
+                            .build();
+                    return RpcResultBuilder.success(output).buildFuture();
                 }
-                stubrendererDelete();
-                LOG.info("PCR Request in progress ");
-                ServiceRestorationOutput output = new ServiceRestorationOutputBuilder()
-                        .setStatus(RpcStatus.Successful)
-                        .setStatusMessage("ServiceRestoration in progress...").build();
-                return RpcResultBuilder.success(output).buildFuture();
             } else {
                 message = "Service '" + serviceName + "' not exists in datastore";
                 LOG.error(message);
@@ -1226,7 +1261,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
             LOG.error(message);
         }
 
-        ServiceRestorationOutput output = new ServiceRestorationOutputBuilder().setStatus(RpcStatus.Successful)
+        ServiceRestorationOutput output = new ServiceRestorationOutputBuilder().setStatus(RpcStatus.Failed)
                 .setStatusMessage(message).build();
 
         return RpcResultBuilder.success(output).buildFuture();
@@ -1286,15 +1321,19 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
         if (serviceCreateInput != null) {
             aend = new ServiceAEndBuilder(serviceCreateInput.getServiceAEnd()).build();
             zend = new ServiceZEndBuilder(serviceCreateInput.getServiceZEnd()).build();
-            service.setServiceName(serviceCreateInput.getServiceName()).setAdministrativeState(State.OutOfService)
-            .setOperationalState(State.OutOfService).setCommonId(serviceCreateInput.getCommonId())
-            .setConnectionType(serviceCreateInput.getConnectionType())
-            .setCustomer(serviceCreateInput.getCustomer())
-            .setCustomerContact(serviceCreateInput.getCustomerContact())
-            .setHardConstraints(serviceCreateInput.getHardConstraints())
-            .setSoftConstraints(serviceCreateInput.getSoftConstraints())
-            .setLifecycleState(LifecycleState.Planned).setServiceAEnd(aend).setServiceZEnd(zend)
-            .setSdncRequestHeader(serviceCreateInput.getSdncRequestHeader());
+            service.setServiceName(serviceCreateInput.getServiceName())
+                .setAdministrativeState(State.OutOfService)
+                .setOperationalState(State.OutOfService).setCommonId(serviceCreateInput.getCommonId())
+                .setConnectionType(serviceCreateInput.getConnectionType())
+                .setCustomer(serviceCreateInput.getCustomer())
+                .setCustomerContact(serviceCreateInput.getCustomerContact())
+                .setHardConstraints(serviceCreateInput.getHardConstraints())
+                .setSoftConstraints(serviceCreateInput.getSoftConstraints())
+                .setLifecycleState(LifecycleState.Planned).setServiceAEnd(aend).setServiceZEnd(zend)
+                .setSdncRequestHeader(new SdncRequestHeaderBuilder()
+                        .setRequestId(serviceCreateInput.getSdncRequestHeader().getRequestId())
+                        .setRpcAction(serviceCreateInput.getSdncRequestHeader().getRpcAction())
+                        .build());
 
         } else if (serviceReconfigureInput != null) {
             aend = new ServiceAEndBuilder(serviceReconfigureInput.getServiceAEnd()).build();
@@ -1307,7 +1346,11 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
             .setCustomerContact(serviceReconfigureInput.getCustomerContact())
             .setHardConstraints(serviceReconfigureInput.getHardConstraints())
             .setSoftConstraints(serviceReconfigureInput.getSoftConstraints())
-            .setLifecycleState(LifecycleState.Planned).setServiceAEnd(aend).setServiceZEnd(zend);
+            .setLifecycleState(LifecycleState.Planned).setServiceAEnd(aend).setServiceZEnd(zend)
+            .setSdncRequestHeader(new SdncRequestHeaderBuilder()
+                    .setRequestId("reconfigure_" + serviceReconfigureInput.getNewServiceName())
+                    .setRpcAction(RpcActions.ServiceReconfigure)
+                    .build());
         }
 
         org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.response
@@ -1370,7 +1413,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
             LOG.error("Reading service failed:", e);
         }
         if (optional.isPresent()) {
-            LOG.debug("Service '" + serviceName + "' present !");
+            LOG.debug("Service '{}' present !", serviceName);
             result = new ServicesBuilder(optional.get()).build();
         }
         return result;
@@ -1391,7 +1434,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
      */
     private String writeOrModifyOrDeleteServiceList(String serviceName, PathComputationRequestOutput output,
             Topology topo, int choice) {
-        LOG.info("WriteOrModifyOrDeleting '" + serviceName + "' Service");
+        LOG.info("WriteOrModifyOrDeleting '{}' Service", serviceName);
         WriteTransaction writeTx = db.newWriteOnlyTransaction();
         String result = null;
         Services readService = readServiceList(serviceName);
@@ -1407,7 +1450,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
             String action = null;
             switch (choice) {
                 case 0: /** Modify. */
-                    LOG.info("Modifying '" + serviceName + "' Service");
+                    LOG.info("Modifying '{}' Service", serviceName);
                     service.setOperationalState(State.InService).setAdministrativeState(State.InService);
                     service.setTopology(topo);
                     writeTx.merge(LogicalDatastoreType.OPERATIONAL, iid, service.build());
@@ -1415,7 +1458,7 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
                     break;
 
                 case 1: /** Delete. */
-                    LOG.info("Deleting '" + serviceName + "' Service");
+                    LOG.info("Deleting '{}' Service", serviceName);
                     writeTx.delete(LogicalDatastoreType.OPERATIONAL, iid);
                     action = "delete";
                     break;
@@ -1428,11 +1471,11 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
             try {
                 Futures.getChecked(future, ExecutionException.class);
             } catch (ExecutionException e) {
-                LOG.info("Failed to " + action + " service from Service List");
+                LOG.info("Failed to {} service from Service List", action);
                 result = "Failed to " + action + " service from Service List";
             }
         } else if (choice == 2) { /** Write Service. */
-            LOG.info("Writing '" + serviceName + "' Service");
+            LOG.info("Writing '{}' Service", serviceName);
             InstanceIdentifier<Services> iid = InstanceIdentifier.create(ServiceList.class).child(Services.class,
                     new ServicesKey(serviceName));
             Services writeService = null;
@@ -1705,4 +1748,50 @@ public class ServicehandlerImpl implements OrgOpenroadmServiceService,StubpceLis
     public void setServiceFeasibilityCheckInput(ServiceFeasibilityCheckInput serviceFeasibilityCheckInput) {
         this.serviceFeasibilityCheckInput = serviceFeasibilityCheckInput;
     }
+
+    @Override
+    public Future<RpcResult<ServiceStateModifyOutput>> serviceStateModify(ServiceStateModifyInput input) {
+        LOG.info("RPC service state modify received");
+        String servicename = input.getServiceName();
+        String message = "";
+        String responseCode = "500";
+        if (servicename != null) {
+            Services service = readServiceList(servicename);
+            if (service != null) {
+                LOG.info("Modify '{}' Service state", servicename);
+                WriteTransaction writeTx = db.newWriteOnlyTransaction();
+                String result = null;
+                Future<Void> future = null;
+                InstanceIdentifier<Services> iid = InstanceIdentifier.create(ServiceList.class).child(Services.class,
+                        new ServicesKey(servicename));
+                ServicesBuilder modifyService = new ServicesBuilder(service);
+                modifyService.setOperationalState(State.OutOfService);
+                writeTx.merge(LogicalDatastoreType.OPERATIONAL, iid, modifyService.build());
+                future = writeTx.submit();
+                try {
+                    Futures.getChecked(future, ExecutionException.class);
+                } catch (ExecutionException e) {
+                    LOG.info("Failed to {} service from Service List", action);
+                    result = "Failed to " + action + " service from Service List";
+                }
+                if (result == null) {
+                    responseCode = "200";
+                    message = "Service state modified !";
+                }
+            } else {
+                message = "Service not present in datastore ! ";
+            }
+        } else {
+            message = "servicename not set in ServiceStateModifyInput";
+        }
+        ConfigurationResponseCommon configurationResponseCommon = new ConfigurationResponseCommonBuilder()
+                .setAckFinalIndicator("Yes")
+                .setResponseCode(responseCode)
+                .setResponseMessage(message)
+                .build();
+        ServiceStateModifyOutput output = new ServiceStateModifyOutputBuilder()
+                .setConfigurationResponseCommon(configurationResponseCommon)
+                .build();
+        return RpcResultBuilder.success(output).buildFuture();
+    }
 }
index f2b9fbe51b3b06a9bbfacb78aaf3222ed2b8fb3d..9237fd28494c7f7865186ff5e7a9207f2f59cbe2 100644 (file)
@@ -13,6 +13,7 @@ import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService
 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker.RpcRegistration;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.servicehandler.rev170930.ServicehandlerService;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.StubpceListener;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.StubrendererListener;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.OrgOpenroadmServiceService;
@@ -40,6 +41,7 @@ public class ServicehandlerProvider {
     private ListenerRegistration<StubpceListener> stubpcelistenerRegistration;
     private ListenerRegistration<StubrendererListener> stubrendererlistenerRegistration;
     private RpcRegistration<OrgOpenroadmServiceService> rpcRegistration;
+    private RpcRegistration<ServicehandlerService> rpcRegistrationServiceHandler;
 
 
     public ServicehandlerProvider(final DataBroker dataBroker, RpcProviderRegistry rpcProviderRegistry,
@@ -59,6 +61,7 @@ public class ServicehandlerProvider {
         stubpcelistenerRegistration = notificationService.registerNotificationListener(consumer);
         stubrendererlistenerRegistration = notificationService.registerNotificationListener(consumer);
         rpcRegistration = rpcRegistry.addRpcImplementation(OrgOpenroadmServiceService.class, consumer);
+        rpcRegistrationServiceHandler = rpcRegistry.addRpcImplementation(ServicehandlerService.class, consumer);
     }
 
     /**
@@ -69,5 +72,6 @@ public class ServicehandlerProvider {
         stubpcelistenerRegistration.close();
         stubrendererlistenerRegistration.close();
         rpcRegistration.close();
+        rpcRegistrationServiceHandler.close();
     }
 }
index ad7ee1d910b678253b8cf8a5beb1c5b5a5544421..09dff6a1d0ef76245455e7d539d29e0964775499 100644 (file)
@@ -23,6 +23,7 @@ and is available at http://www.eclipse.org/legal/epl-v10.html INTERNAL
   <packaging>pom</packaging>
 
   <modules>
+    <module>stubmodels</module>
     <module>stubpce</module>
     <module>stubrenderer</module>
   </modules>
index ba641a8e792e26add86cfc5f6bdaddbac03656a2..b55072092a2c2f4c3d61c5ef638d2ac49172761c 100644 (file)
@@ -5,3 +5,4 @@ home-page = https://wiki.opendaylight.org/view/TransportPCE:Main
 
 [files]
 packages = transportpce_tests
+
diff --git a/tests/stubmodels/pom.xml b/tests/stubmodels/pom.xml
new file mode 100644 (file)
index 0000000..37007f5
--- /dev/null
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+Copyright Â© 2016 Orange and others. All rights reserved.
+
+This program and the accompanying materials are made available under the
+terms of the Eclipse Public License v1.0 which accompanies this distribution,
+and is available at http://www.eclipse.org/legal/epl-v10.html
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.opendaylight.mdsal</groupId>
+    <artifactId>binding-parent</artifactId>
+    <version>0.12.3-SNAPSHOT</version>
+    <relativePath/>
+  </parent>
+
+  <groupId>org.opendaylight.transportpce</groupId>
+  <artifactId>transportpce-stubmodels</artifactId>
+  <version>0.2.0-SNAPSHOT</version>
+  <packaging>bundle</packaging>
+
+  <dependencies>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>transportpce-ordmodels</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>transportpce-api</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+
+  <!--
+    Private references
+  -->
+  <build>
+     <plugins>
+       <plugin>
+         <groupId>org.apache.felix</groupId>
+         <artifactId>maven-bundle-plugin</artifactId>
+         <version>3.0.1</version>
+         <extensions>true</extensions>
+         <configuration>
+           <instructions>
+             <Include-Resource>{maven-resources},target/classes/LICENSE,META-INF/git.properties=-target/classes/META-INF/git.properties</Include-Resource>
+             <_exportcontents>
+               org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.transportpce.stubrenderer.rev170403.service.implementation.request.input,*
+             </_exportcontents>
+           </instructions>
+         </configuration>
+       </plugin>
+       <plugin>
+         <groupId>org.apache.maven.plugins</groupId>
+         <artifactId>maven-javadoc-plugin</artifactId>
+         <configuration>
+           <sourcepath>*/target/generated-sources/mdsal-binding/*</sourcepath>
+           <excludePackageNames>*</excludePackageNames>
+         </configuration>
+       </plugin>
+     </plugins>
+  </build>
+
+  <reporting>
+     <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-javadoc-plugin</artifactId>
+        <configuration>
+          <sourcepath>*/target/generated-sources/mdsal-binding/*</sourcepath>
+          <excludePackageNames>*</excludePackageNames>
+        </configuration>
+      </plugin>
+    </plugins>
+  </reporting>
+
+</project>
similarity index 84%
rename from api/src/main/yang/stubpce.yang
rename to tests/stubmodels/src/main/yang/stubpce.yang
index 44ba5ca08474cbdb6e4b9691cb971815d08c97e6..fb142ae9b7a93d457fd94fe867ee6b47a5c13c92 100644 (file)
@@ -120,6 +120,35 @@ module stubpce {
           }
       }
 
+      container service-path-list {
+          description
+            "List of service paths. Can only be created, deleted, modified, etc. using special RPCs.";
+          list service-paths {
+            key "service-path-name";
+            uses transportpce-common-service-path-types:service-path;
+          }
+        }
+
+        grouping stubpce-path-description {
+            leaf path-name {
+                type string;
+                description
+                  "Identifier for the pathDescription to be created in
+                   the ROADM network, e.g., CLFI, CLCI, etc.";
+                mandatory true;
+              }
+            uses transportpce-pathDescription:path-description;
+        }
+
+        container path-description-list {
+          description
+            "List of pathDescription. Can only be created, deleted, modified, etc. using special RPCs.";
+          list pathDescriptions {
+            key "path-name";
+            uses stubpce-path-description;
+          }
+        }
+
       notification service-path-rpc-result {
         description
           "This Notification indicates result of  service RPC";
index f67df06306a5d312e9f7c2db74ca05fdd7befebd..88cee40ecbb184fa4250b39f06b29e329d2d12db 100644 (file)
@@ -52,6 +52,11 @@ Author: Martial Coulibaly <martial.coulibaly@gfi.com> on behalf of Orange
       <artifactId>transportpce-ordmodels</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>transportpce-stubmodels</artifactId>
+      <version>${project.version}</version>
+    </dependency>
 
     <!-- Testing Dependencies -->
     <dependency>
index ad867bde6a4f3b6b27c24426a148dd69e2a195ee..76f727f6e6c1aacfc6cc5ee3dbe9cf8ae18a8554 100644 (file)
@@ -30,6 +30,15 @@ import org.opendaylight.controller.md.sal.binding.api.ReadOnlyTransaction;
 import org.opendaylight.controller.md.sal.binding.api.WriteTransaction;
 import org.opendaylight.controller.md.sal.common.api.data.LogicalDatastoreType;
 import org.opendaylight.transportpce.stubpce.topology.PathDescriptionsOrdered;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.CancelResourceReserveInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathDescriptionList;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.ServicePathList;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.path.description.list.PathDescriptions;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.service.path.list.ServicePaths;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.service.path.list.ServicePathsBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.service.path.list.ServicePathsKey;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.service.path.rpc.result.PathDescriptionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.AToZDirection;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.ZToADirection;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.atoz.direction.AToZ;
@@ -42,18 +51,9 @@ import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev170426.constraints.sp.co.routing.or.general.general.Exclude;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev170426.routing.constraints.sp.HardConstraints;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev170426.routing.constraints.sp.SoftConstraints;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.response.parameters.sp.response.parameters.PathDescriptionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service.handler.header.ServiceHandlerHeaderBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service.path.ServiceAEnd;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service.path.ServiceZEnd;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.CancelResourceReserveInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathDescriptionList;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServicePathList;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.path.description.list.PathDescriptions;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.path.list.ServicePaths;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.path.list.ServicePathsBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.path.list.ServicePathsKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -144,7 +144,7 @@ public class SendingPceRPCs {
     private Boolean egalResource(Resource res1, Resource res2) {
         LOG.info("comparing resource ...");
         Boolean result = false;
-        LOG.info(res1.getClass().getName() + " - " + res2.getClass().getName());
+        LOG.info("{} - {}", res1.getClass().getName(), res2.getClass().getName());
         if (res1.getClass().getName().compareToIgnoreCase(res2.getClass().getName()) == 0) {
             if (res1 instanceof Node && res2 instanceof Node) {
                 Node node1 = (Node)res1;
@@ -187,14 +187,14 @@ public class SendingPceRPCs {
         if (atoz1.getAToZ().size() == atoz2.getAToZ().size()) {
             int index = 0;
             int size = atoz1.getAToZ().size();
-            LOG.info("size : " + size);
+            LOG.info("size : {}", size);
             String id1 = null;
             String id2 = null;
             while (index < size) {
                 id1 = atoz1.getAToZ().get(index).getId();
-                LOG.info("id : " + id1);
+                LOG.info("id : {}", id1);
                 Resource res1 = atoz1.getAToZ().get(index).getResource().getResource();
-                LOG.info("res1 : " + res1.toString());
+                LOG.info("res1 : {}", res1.toString());
                 Resource res2 = null;
                 if (id1 != null) {
                     Boolean trouve = false;
@@ -202,7 +202,7 @@ public class SendingPceRPCs {
                         id2 = atoz2.getAToZ().get(loop).getId();
                         if (id2 != null && id2.compareTo(id1) == 0) {
                             res2 = atoz2.getAToZ().get(loop).getResource().getResource();
-                            LOG.info("res2 : " + res2.toString());
+                            LOG.info("res2 : {}", res2.toString());
                             trouve = true;
                             break;
                         }
@@ -239,14 +239,14 @@ public class SendingPceRPCs {
         if (ztoa1.getZToA().size() == ztoa2.getZToA().size()) {
             int index = 0;
             int size = ztoa1.getZToA().size();
-            LOG.info("size : " + size);
+            LOG.info("size : {}", size);
             String id1 = null;
             String id2 = null;
             while (index < size) {
                 id1 = ztoa1.getZToA().get(index).getId();
-                LOG.info("id : " + id1);
+                LOG.info("id : {}", id1);
                 Resource res1 = ztoa1.getZToA().get(index).getResource().getResource();
-                LOG.info("res1 : " + res1.toString());
+                LOG.info("res1 : {}", res1.toString());
                 Resource res2 = null;
                 if (id1 != null) {
                     Boolean trouve = false;
@@ -254,7 +254,7 @@ public class SendingPceRPCs {
                         id2 = ztoa2.getZToA().get(loop).getId();
                         if (id2 != null && id2.compareTo(id1) == 0) {
                             res2 = ztoa2.getZToA().get(loop).getResource().getResource();
-                            LOG.info("res2 : " + res2.toString());
+                            LOG.info("res2 : {}", res2.toString());
                             trouve = true;
                             break;
                         }
@@ -340,7 +340,7 @@ public class SendingPceRPCs {
                     if (servicePathList != null && !servicePathList.isEmpty()) {
                         for (ServicePaths service : servicePathList) {
                             if (service.getServicePathName().compareTo(tmp) == 0) {
-                                LOG.info("Existing Service '" + tmp + "' found in ServicePathList ...");
+                                LOG.info("Existing Service '{}' found in ServicePathList ...", tmp);
                                 pathDesc = service.getPathDescription();
                             }
                         }
@@ -366,7 +366,7 @@ public class SendingPceRPCs {
                                 break;
                         }
                     } else {
-                        LOG.info("Existing Service '" + tmp + "' not found in ServicePathList !");
+                        LOG.info("Existing Service '{}' not found in ServicePathList !", tmp);
                         result = true;
                     }
                     if (!result) {
@@ -395,7 +395,7 @@ public class SendingPceRPCs {
             LOG.info("retrieving path from servicePath List ...");
             try {
                 if (!servicePathList.isEmpty()) {
-                    LOG.info("ServicePathList not empty, contains " + servicePathList.size() + " paths.");
+                    LOG.info("ServicePathList not empty, contains {} paths.", servicePathList.size());
                     for (ServicePaths service : servicePathList) {
                         org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service
                             .types.rev170426.service.path.PathDescription tmp = service.getPathDescription();
@@ -428,7 +428,7 @@ public class SendingPceRPCs {
             LOG.info("PathDescriptions is null !");
             result = true;
         }
-        LOG.info("testPathDescription result : " + result);
+        LOG.info("testPathDescription result : {}", result);
         return result;
     }
 
@@ -444,13 +444,13 @@ public class SendingPceRPCs {
         List<PathDescriptions> result = new ArrayList<PathDescriptions>();
         List<PathDescriptions> paths = readPathDescriptionList();
         if (!paths.isEmpty() && aendNodeId != null && zendNodeId != null) {
-            LOG.info("retrieving paths from pathDescription List for " + aendNodeId + " / " + zendNodeId);
+            LOG.info("retrieving paths from pathDescription List for {} / {}", aendNodeId, zendNodeId);
             for (PathDescriptions tmp : paths) {
                 Resource pathAend = null;
                 Resource pathZend = null;
                 String id = null;
                 if (tmp != null) {
-                    LOG.info("Getting Aend & ZEnd from path '" + tmp.getPathName() + "'...");
+                    LOG.info("Getting Aend & ZEnd from path '{}'...",tmp.getPathName());
                     int index = 0;
                     int size = tmp.getAToZDirection().getAToZ().size();
                     while (index < size) {
@@ -458,7 +458,7 @@ public class SendingPceRPCs {
                         if (id.compareToIgnoreCase("1") == 0) {
                             Resource resource = tmp.getAToZDirection().getAToZ().get(index).getResource()
                                     .getResource();
-                            LOG.info(resource.getClass().toString() + " : " + resource.toString());
+                            LOG.info("{} : {}", resource.getClass().toString(), resource.toString());
                             pathAend = resource;
                             break;
                         }
@@ -477,8 +477,8 @@ public class SendingPceRPCs {
                         index++;
                     }
                     if (pathAend != null && pathZend != null) {
-                        LOG.info("pathAend : " + pathAend + " - pathZend: " + pathZend);
-                        LOG.info("aendNodeId : " + aendNodeId + " - zendNodeId : " + zendNodeId);
+                        LOG.info("pathAend : {} - pathZend: {}",pathAend, pathZend);
+                        LOG.info("aendNodeId : {} - zendNodeId : {}", aendNodeId, zendNodeId);
                         if (comp(pathAend, pathZend, aendNodeId, zendNodeId)) {
                             LOG.info("PathDescription found !");
                             result.add(tmp);
@@ -506,9 +506,9 @@ public class SendingPceRPCs {
         while (it.hasNext()) {
             PathDescriptions path = it.next();
             String name = path.getPathName();
-            LOG.info("path  : " + name);
+            LOG.info("path  : {}", name);
             if (name != null && name.contains(contain)) {
-                LOG.info("    path gets : " + name);
+                LOG.info("    path gets : {}", name);
                 String [] split = name.split("_");
                 if (split.length == 3) {
                     odr = Integer.parseInt(split[2]);
@@ -628,12 +628,12 @@ public class SendingPceRPCs {
                     /** get pathList ordered. */
                     pathsList = orderPathdescriptionsList(pathsList);
                     if (!pathsList.isEmpty()) {
-                        LOG.info(pathsList.size() + " Paths get from Pathdescription List");
+                        LOG.info("{} Paths get from Pathdescription List", pathsList.size());
                         index = 0;
                         output = false;
                         while (index < pathsList.size()) {
                             path = pathsList.get(index);
-                            LOG.info("path n°" + index + " gets : '" + path.getPathName() + "'!");
+                            LOG.info("path n°{} gets : '{}'!", index, path.getPathName());
                             if (constraints) {
                                 LOG.info("Calculating path with constraints ...");
                                 if (inputHard.getCoRoutingOrGeneral() instanceof General) {
@@ -774,7 +774,7 @@ public class SendingPceRPCs {
     private Boolean writeOrDeleteServicePathList(String serviceName, int choice) {
         Boolean result = null;
         if (serviceName != null && serviceName.compareTo(" ") != 0 && choice >= 0 && choice < 2) {
-            LOG.info("WriteOrDeleting '" + serviceName + "' ServicePaths");
+            LOG.info("WriteOrDeleting '{}' ServicePaths", serviceName);
             WriteTransaction writeTx = db.newWriteOnlyTransaction();
             result = true;
             String action = null;
@@ -783,7 +783,7 @@ public class SendingPceRPCs {
             Future<Void> future = null;
             switch (choice) {
                 case 0: /** Write. */
-                    LOG.info("Writing '" + serviceName + "' Service");
+                    LOG.info("Writing '{}' Service", serviceName);
                     org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.service
                         .path.PathDescriptionBuilder path = new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c
                         ._interface.service.types.rev170426.service.path.PathDescriptionBuilder();
@@ -818,24 +818,24 @@ public class SendingPceRPCs {
                     //CheckedFuture<Void, OperationFailedException> future = transaction.submit();
                     future = writeTx.submit();
                     try {
-                        LOG.info("Sending '" + action + "' command to datastore !");
+                        LOG.info("Sending '{}' command to datastore !", action);
                         Futures.getChecked(future, ExecutionException.class);
                     } catch (ExecutionException e) {
-                        LOG.error("Failed to " + action + " service from Service List");
+                        LOG.error("Failed to {} service from Service List", action);
                         result = false;
                     }
                     break;
 
                 case 1: /** Delete */
-                    LOG.info("Deleting '" + serviceName + "' Service");
+                    LOG.info("Deleting '{}' Service", serviceName);
                     writeTx.delete(LogicalDatastoreType.OPERATIONAL, iid);
                     action = "delete";
                     future = writeTx.submit();
                     try {
-                        LOG.info("Sending '" + action + "' command to datastore !");
+                        LOG.info("Sending '{}' command to datastore !", serviceName);
                         Futures.getChecked(future, ExecutionException.class);
                     } catch (ExecutionException e) {
-                        LOG.error("Failed to " + action + " service from Service List");
+                        LOG.error("Failed to {} service from Service List", serviceName);
                         result = false;
                     }
                     break;
index 89d3404f7d2a20b31fd44e87aed4b0a901d4555d..f8a63c2694186236718fe594cfbd053f1efe4578 100644 (file)
@@ -33,6 +33,26 @@ import org.opendaylight.transportpce.stubpce.StubpceTxRxCheck;
 import org.opendaylight.transportpce.stubpce.topology.PathDescriptionsOrdered;
 import org.opendaylight.transportpce.stubpce.topology.SuperNodePath;
 import org.opendaylight.transportpce.stubpce.topology.Topology;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.CancelResourceReserveInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.CancelResourceReserveOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.CancelResourceReserveOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathComputationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathComputationRequestOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathDescriptionList;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.PathDescriptionListBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.ServicePathList;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.ServicePathListBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.ServicePathRpcResult;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.ServicePathRpcResultBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.StubpceService;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.path.description.list.PathDescriptions;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.path.description.list.PathDescriptionsBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.path.description.list.PathDescriptionsKey;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.service.path.list.ServicePaths;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.service.path.list.ServicePathsBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.service.path.list.ServicePathsKey;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.service.path.rpc.result.PathDescriptionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommonBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.ServiceList;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.Services;
@@ -40,30 +60,6 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev161014.service.list.ServicesKey;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.RpcStatusEx;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.ServicePathNotificationTypes;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.response.parameters.sp.response.parameters.PathDescriptionBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.CancelResourceReserveInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.CancelResourceReserveOutput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.CancelResourceReserveOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathComputationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathComputationRequestOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathDescriptionList;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathDescriptionListBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteOutput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServicePathList;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServicePathListBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServicePathRpcResult;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServicePathRpcResultBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.TransportpceServicepathService;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.path.description.list.PathDescriptions;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.path.description.list.PathDescriptionsBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.path.description.list.PathDescriptionsKey;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.path.list.ServicePaths;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.path.list.ServicePathsBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.path.list.ServicePathsKey;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.path.rpc.result.PathDescription;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yangtools.yang.common.RpcResult;
@@ -77,7 +73,7 @@ import org.slf4j.LoggerFactory;
  *         behalf of Orange
  */
 
-public class StubpceImpl implements TransportpceServicepathService {
+public class StubpceImpl implements StubpceService {
     /** Logging. */
     private static final Logger LOG = LoggerFactory.getLogger(StubpceImpl.class);
     /** Permit to access database. */
@@ -115,7 +111,7 @@ public class StubpceImpl implements TransportpceServicepathService {
         String responseCode = "";
         ConfigurationResponseCommonBuilder configurationResponseCommon = null;
         String serviceName = input.getServiceName();
-        LOG.info("serviceName : " + serviceName);
+        LOG.info("serviceName : {}", serviceName);
         if (serviceName != null) {
             sendingPCE = new SendingPceRPCs(input,db,executor);
             FutureCallback<Boolean> pceCallback = new FutureCallback<Boolean>() {
@@ -124,8 +120,7 @@ public class StubpceImpl implements TransportpceServicepathService {
 
                 @Override
                 public void onFailure(Throwable arg0) {
-                    LOG.error(arg0.toString());
-                    LOG.error("Cancel resource failed !");
+                    LOG.error("Cancel resource failed : {}", arg0);
                     notification = new ServicePathRpcResultBuilder()
                             .setNotificationType(ServicePathNotificationTypes.CancelResourceReserve)
                             .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
@@ -133,13 +128,13 @@ public class StubpceImpl implements TransportpceServicepathService {
                     try {
                         notificationPublishService.putNotification(notification);
                     } catch (InterruptedException e) {
-                        LOG.info("notification offer rejected : " + e);
+                        LOG.info("notification offer rejected : {}", e);
                     }
                 }
 
                 @Override
                 public void onSuccess(Boolean response) {
-                    LOG.info("response : " + response);
+                    LOG.info("response : {}", response);
                     if (response) {
                         message = "Resource cancelled !";
                         notification = new ServicePathRpcResultBuilder()
@@ -160,7 +155,7 @@ public class StubpceImpl implements TransportpceServicepathService {
                     try {
                         notificationPublishService.putNotification(notification);
                     } catch (InterruptedException e) {
-                        LOG.info("notification offer rejected : " + e);
+                        LOG.info("notification offer rejected : {}", e);
                     }
                     LOG.info(message);
                 }
@@ -176,7 +171,6 @@ public class StubpceImpl implements TransportpceServicepathService {
 
             CancelResourceReserveOutputBuilder output = new CancelResourceReserveOutputBuilder()
                     .setConfigurationResponseCommon(configurationResponseCommon.build());
-
             return RpcResultBuilder.success(output.build()).buildFuture();
         } else {
             message = "serviceName / requestId is not correct !";
@@ -188,7 +182,7 @@ public class StubpceImpl implements TransportpceServicepathService {
             try {
                 notificationPublishService.putNotification(notification);
             } catch (InterruptedException e) {
-                LOG.info("notification offer rejected : " + e);
+                LOG.info("notification offer rejected : {}", e);
             }
         }
         configurationResponseCommon = new ConfigurationResponseCommonBuilder();
@@ -255,7 +249,7 @@ public class StubpceImpl implements TransportpceServicepathService {
                         try {
                             notificationPublishService.putNotification(notification);
                         } catch (InterruptedException e) {
-                            LOG.info("notification offer rejected : " + e);
+                            LOG.info("notification offer rejected : {}", e);
                         }
                         sendingPCE = new SendingPceRPCs(input,db,executor);
                         FutureCallback<Boolean> pceCallback = new FutureCallback<Boolean>() {
@@ -264,7 +258,7 @@ public class StubpceImpl implements TransportpceServicepathService {
 
                             @Override
                             public void onFailure(Throwable arg0) {
-                                LOG.error("Failure message : " + arg0.toString());
+                                LOG.error("Failure message : {}", arg0.toString());
                                 LOG.error("Path calculation failed !");
                                 notification = new ServicePathRpcResultBuilder()
                                         .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
@@ -272,13 +266,13 @@ public class StubpceImpl implements TransportpceServicepathService {
                                 try {
                                     notificationPublishService.putNotification(notification);
                                 } catch (InterruptedException e) {
-                                    LOG.info("notification offer rejected : " + e);
+                                    LOG.info("notification offer rejected : {}", e);
                                 }
                             }
 
                             @Override
                             public void onSuccess(Boolean response) {
-                                LOG.info("response : " + response);
+                                LOG.info("response : {}", response);
                                 if (response) {
                                     message = "Path Computated !";
                                     ServicePathRpcResultBuilder tmp = new ServicePathRpcResultBuilder()
@@ -293,7 +287,10 @@ public class StubpceImpl implements TransportpceServicepathService {
                                                 .setAToZDirection(pathDescriptionBuilder.getAToZDirection())
                                                 .setZToADirection(pathDescriptionBuilder.getZToADirection())
                                                 .build();
-                                        tmp.setPathDescription(pathDescription);
+                                        tmp.setPathDescription(new PathDescriptionBuilder()
+                                                .setAToZDirection(pathDescription.getAToZDirection())
+                                                .setZToADirection(pathDescription.getZToADirection())
+                                                .build());
                                     }
                                     notification = tmp.build();
                                 } else {
@@ -308,7 +305,7 @@ public class StubpceImpl implements TransportpceServicepathService {
                                 try {
                                     notificationPublishService.putNotification(notification);
                                 } catch (InterruptedException e) {
-                                    LOG.info("notification offer rejected : " + e);
+                                    LOG.info("notification offer rejected : {}", e);
                                 }
                                 LOG.info(message);
                             }
@@ -345,7 +342,7 @@ public class StubpceImpl implements TransportpceServicepathService {
             try {
                 notificationPublishService.putNotification(notification);
             } catch (InterruptedException e) {
-                LOG.info("notification offer rejected : " + e);
+                LOG.info("notification offer rejected : {}", e);
             }
         }
         configurationResponseCommon = new ConfigurationResponseCommonBuilder();
@@ -400,7 +397,7 @@ public class StubpceImpl implements TransportpceServicepathService {
         try {
             Futures.getChecked(future, ExecutionException.class);
         } catch (ExecutionException e) {
-            LOG.error("Failed to create ServicePathList List : " + e.toString());
+            LOG.error("Failed to create ServicePathList List : {}", e.toString());
             result = false;
         }
         return result;
@@ -415,7 +412,7 @@ public class StubpceImpl implements TransportpceServicepathService {
         LOG.info("filling PathDescription List...");
         Topology topo = new Topology();
         topo.start();
-        LOG.info("Network : " + topo.getNetwork());
+        LOG.info("Network : {}", topo.getNetwork());
         SuperNodePath superNodePath = new SuperNodePath(topo.getNetwork());
         String aend = "NodeA";
         String zend = "NodeZ";
@@ -447,7 +444,7 @@ public class StubpceImpl implements TransportpceServicepathService {
                     try {
                         Futures.getChecked(future, ExecutionException.class);
                     } catch (ExecutionException e) {
-                        LOG.error("Failed to write PathDescriptions to PathDescriptionsList : " + e.toString());
+                        LOG.error("Failed to write PathDescriptions to PathDescriptionsList : {}", e.toString());
                     }
                 } else {
                     LOG.error("PathDescriptions gets is null !");
@@ -480,7 +477,7 @@ public class StubpceImpl implements TransportpceServicepathService {
             LOG.error("Reading service failed:", e);
         }
         if (optional.isPresent()) {
-            LOG.debug("Service '" + serviceName + "' present !");
+            LOG.debug("Service '{}' present !", serviceName);
             result = new ServicesBuilder(optional.get()).build();
         }
         return result;
@@ -508,7 +505,7 @@ public class StubpceImpl implements TransportpceServicepathService {
             LOG.error("Reading service failed:", e);
         }
         if (optional.isPresent()) {
-            LOG.debug("Service '" + serviceName + "' present !");
+            LOG.debug("Service '{}' present !", serviceName);
             result = new ServicePathsBuilder(optional.get()).build();
         }
         return result;
@@ -536,7 +533,7 @@ public class StubpceImpl implements TransportpceServicepathService {
             LOG.error("Reading service failed:", e);
         }
         if (optional.isPresent()) {
-            LOG.debug("PathDescritions '" + pathName + "' present !");
+            LOG.debug("PathDescritions '{}' present !", pathName);
             result = new PathDescriptionsBuilder(optional.get()).build();
         }
         return result;
@@ -553,9 +550,9 @@ public class StubpceImpl implements TransportpceServicepathService {
     @SuppressWarnings("unused")
     private String writeServicePathList(PathComputationRequestInput input) {
         String serviceName = input.getServiceName();
-        LOG.debug("Write ServicePath '" + serviceName + "' Service");
+        LOG.debug("Write ServicePath '{}' Service", serviceName);
         String result = null;
-        LOG.debug("Writing '" + serviceName + "' ServicePath");
+        LOG.debug("Writing '{}' ServicePath", serviceName);
         InstanceIdentifier<ServicePaths> iid = InstanceIdentifier.create(ServicePathList.class)
                 .child(ServicePaths.class, new ServicePathsKey(serviceName));
 
@@ -587,17 +584,4 @@ public class StubpceImpl implements TransportpceServicepathService {
     public void setPathDescriptionBuilder(PathDescriptionBuilder pathDescriptionBuilder) {
         this.pathDescriptionBuilder = pathDescriptionBuilder;
     }
-
-    @Override
-    public Future<RpcResult<ServiceImplementationRequestOutput>> serviceImplementationRequest(
-            ServiceImplementationRequestInput input) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Future<RpcResult<ServiceDeleteOutput>> serviceDelete(ServiceDeleteInput input) {
-        // TODO Auto-generated method stub
-        return null;
-    }
 }
index 9ef48f373e07f5a400802d18da6f7c30d6729242..99163c31465a38f3ada1dd63216d13cc8fbd7b27 100644 (file)
@@ -14,8 +14,8 @@ import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService
 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.TransportpceServicepathListener;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.TransportpceServicepathService;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.StubpceListener;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.StubpceService;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -33,8 +33,8 @@ public class StubpceProvider {
     private final DataBroker dataBroker;
 
 
-    private BindingAwareBroker.RpcRegistration<TransportpceServicepathService> rpcRegistration;
-    private ListenerRegistration<TransportpceServicepathListener> stubPcelistenerRegistration;
+    private BindingAwareBroker.RpcRegistration<StubpceService> rpcRegistration;
+    private ListenerRegistration<StubpceListener> stubPcelistenerRegistration;
 
     public StubpceProvider(RpcProviderRegistry rpcProviderRegistry,final DataBroker dataBroker,
             NotificationService notificationService, NotificationPublishService notificationPublishService) {
@@ -49,7 +49,7 @@ public class StubpceProvider {
     public void init() {
         LOG.info("StubpceProvider Session Initiated");
         final StubpceImpl consumer = new StubpceImpl(notificationPublishService,dataBroker);
-        rpcRegistration = rpcRegistry.addRpcImplementation(TransportpceServicepathService.class, consumer);
+        rpcRegistration = rpcRegistry.addRpcImplementation(StubpceService.class, consumer);
     }
 
     /**
index b1bd4239a9a3deaf52e0f8292667f8d26b73990f..b2781d37b1cbe916860eb21719656f9229c38dbf 100644 (file)
@@ -385,7 +385,7 @@ public class InterNodePath {
                 LOG.info("firstnodeTpId is null !");
             }
         }
-        LOG.info("getAToZDirectionEndBy result size : " + result.size() + "\n " + result.toString());
+        LOG.info("getAToZDirectionEndBy result size : {}\n{}", result.size(),result.toString());
         return result;
     }
 
@@ -445,7 +445,7 @@ public class InterNodePath {
                 }
             }
         } else {
-            LOG.info("getAToZDirectionEndBy size " + tmp.size());
+            LOG.info("getAToZDirectionEndBy size : {}", tmp.size());
         }
         return result;
     }
@@ -473,7 +473,7 @@ public class InterNodePath {
                         if (res != null  && res instanceof TerminationPoint) {
                             TerminationPoint tp = (TerminationPoint) res;
                             if (tp != null && tp.getTpId().contains(beginBy)) {
-                                LOG.info("tmp : " + tmp.toString());
+                                LOG.info("tmp : {}", tmp.toString());
                                 result.add(tmp);
                             }
                         }
@@ -481,7 +481,7 @@ public class InterNodePath {
                 }
             }
         }
-        LOG.info("result size : " + result.size());
+        LOG.info("result size : {}", result.size());
         return result;
     }
 
@@ -501,7 +501,7 @@ public class InterNodePath {
                 path.fill();
                 nodepaths.add(path);
             }
-            LOG.info("nodepaths size : " + nodepaths.size());
+            LOG.info("nodepaths size : {}", nodepaths.size());
             build(superNode.isXpdrSrgAbsent(),superNode.getSuperNodeId(), zend);
         }
     }
index 634c279582098a60446b3c7eddd8968f02cdbe98..a0facda7f51e59f3e0139c63710090e4be6ea244 100644 (file)
@@ -150,13 +150,13 @@ public class NodePath {
         List<TpNodeTp> direction = new ArrayList<TpNodeTp>();
         for (Link link : links) {
             String linkId = link.getLinkId();
-            LOG.info("LinkId : " + linkId);
+            LOG.info("LinkId : {}", linkId);
             if (!isXpdrSrgAbsent) {
                 if (StringUtils.countMatches(link.getLinkId(), "ROADM") < 2) {
                     if ((linkId.contains("XPDR") && linkId.startsWith("ROADM"))
                         || ((linkId.startsWith("DEG") && linkId.contains("SRG")))
                         || (nodeId.contains("XPDR") && linkId.contains("TAIL-LINKS"))) {
-                        LOG.info("reversing TpNodetp list for link '" + linkId + "'");
+                        LOG.info("reversing TpNodetp list for link '{}'", linkId);
                         direction = reverseTpNodetpList();
                     } else {
                         direction = tpNodeTps;
@@ -289,7 +289,7 @@ public class NodePath {
         Network net = topo.getNetwork();
         if (net != null) {
             SuperNode superNode = net.getSuperNodes().get(0);
-            LOG.info("SuperNode : " + superNode.getSuperNodeId());
+            LOG.info("SuperNode : {}", superNode.getSuperNodeId());
             for (org.opendaylight.transportpce.stubpce.topology.Resource res :
                 superNode.getResources()) {
                 LOG.info(res.toString());
index c31c55ee54ea1ee9b7c35495223a470abf6a9b9a..cb8c15ff1547284ead548c8a4ab079d62854fefe 100644 (file)
@@ -8,7 +8,7 @@
 
 package org.opendaylight.transportpce.stubpce.topology;
 
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.path.description.list.PathDescriptions;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.path.description.list.PathDescriptions;
 
 /**
  * class to create structure
index 732f31888c1eaa4d5096d4aa2f752e43c4c00832..ef455f5a545386078141cd42ed96f09ba277a151 100644 (file)
@@ -16,6 +16,7 @@ import java.util.ListIterator;
 import java.util.SortedSet;
 import java.util.TreeSet;
 
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubpce.rev170426.path.description.list.PathDescriptionsBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.AToZDirection;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.AToZDirectionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.path.description.ZToADirection;
@@ -30,7 +31,6 @@ import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdes
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource.ResourceBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource.resource.resource.Link;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev170426.pce.resource.resource.resource.LinkBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.path.description.list.PathDescriptionsBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -121,7 +121,7 @@ public class SuperNodePath {
             for (String tmp : links) {
                 if (tmp.contains(aend)
                         && tmp.contains(zend)) {
-                    LOG.info("direct path found for : " + aend + " / " + zend);
+                    LOG.info("direct path found for : {} / {}", aend, zend);
                     if (tmp.startsWith(aend)) {
                         atozlink = tmp;
                     }
@@ -156,7 +156,7 @@ public class SuperNodePath {
             tmp = tmp.replace("Node", "ROADM");
             if (tmp.compareTo(aend) != 0) {
                 if (link.contains(aend) && link.contains(tmp)) {
-                    LOG.info("hop : " + tmp);
+                    LOG.info("hop : {}", tmp);
                     result = tmp;
                 }
             }
@@ -226,7 +226,7 @@ public class SuperNodePath {
             }
 
         } else {
-            LOG.info(term + " links not found !");
+            LOG.info("{} links not found !", term);
         }
     }
 
@@ -257,7 +257,7 @@ public class SuperNodePath {
                             hop = findHop(tmp, aend, supernodes);
                             if (hop != null) {
                                 if (hop.compareTo(zend.replace("Node", "ROADM")) != 0) {
-                                    LOG.info("next hop found : " + hop);
+                                    LOG.info("next hop found : {}", hop);
                                     links.addAll(findLinks(aend,hop,roadmLinks,false));
                                     links.addAll(findLinks(hop,zend,roadmLinks,false));
                                 } else {
@@ -501,7 +501,7 @@ public class SuperNodePath {
         PathDescriptionsBuilder pathDescr = new PathDescriptionsBuilder();
         int size = atozDirection.size();
         if (!atozDirection.isEmpty()) {
-            LOG.info("result list AToZDirection size  : " + atozDirection.size());
+            LOG.info("result list AToZDirection size  : {}", atozDirection.size());
             List<ZToADirection> ztoadirList = new ArrayList<ZToADirection>();
             for (AToZDirection atozdir : atozDirection) {
                 ZToADirection ztodir = convertToZtoaDirection(atozdir);
@@ -515,10 +515,10 @@ public class SuperNodePath {
                 String pathName = null;
                 for (int indexPath = 0 ; indexPath < size ; indexPath++) {
                     pathName = term.concat(Integer.toString(index));
-                    LOG.info("pathName : " + pathName);
+                    LOG.info("pathName : {}", pathName);
                     pathDescr.setAToZDirection(atozDirection.get(indexPath))
                     .setZToADirection(ztoadirList.get(indexPath)).setPathName(pathName);
-                    LOG.info(pathDescr.build().toString());
+                    LOG.info("pathdesciption : {}", pathDescr.build().toString());
                     result.add(new PathDescriptionsOrdered(pathDescr.build(),index));
                     index++;
                 }
@@ -546,7 +546,7 @@ public class SuperNodePath {
                 String aend = split[0].replaceAll("ROADM", "Node");
                 String zend = split[2].replaceAll("ROADM", "Node");
                 if (aend != null && zend != null) {
-                    LOG.info("getting super node for : " + aend + " and " + zend);
+                    LOG.info("getting super node for : {} and {}", aend, zend);
                     SuperNode aendSp = getSuperNode(aend);
                     SuperNode zendSp = getSuperNode(zend);
                     if (aendSp != null && zendSp != null) {
@@ -575,20 +575,20 @@ public class SuperNodePath {
         if (!paths.isEmpty()) {
             for (NodeLinkNode tmp : paths) {
                 if (tmp.getDirect()) {
-                    LOG.info("Direct NodeLinkNode : " + tmp.toString());
+                    LOG.info("Direct NodeLinkNode : {}", tmp.toString());
                     String atozLink = null;
                     String ztoaLink = null;
                     atozLink = tmp.getAtozLink().get(0);
                     ztoaLink = tmp.getZtoaLink().get(0);
                     if (atozLink != null && ztoaLink != null) {
-                        LOG.info("atozlink : " + atozLink);
-                        LOG.info("ztoalink : " + ztoaLink);
+                        LOG.info("atozlink : {}", atozLink);
+                        LOG.info("ztoalink : {}", ztoaLink);
                         InterNodePath interAend = new InterNodePath(aendSp);
                         interAend.buildPath(zend);
                         InterNodePath interZend = new InterNodePath(zendSp);
                         interZend.buildPath(zend);
                         List<String> deg = getDeg(atozLink,ztoaLink);
-                        LOG.info("deg : " + deg.toString());
+                        LOG.info("deg : {}", deg.toString());
                         if (deg.size() == 2) {
                             List<AToZDirection> cleanInterA =
                                     interAend.replaceOrRemoveAToZDirectionEndLink(deg.get(0),"",atozLink,
@@ -614,7 +614,7 @@ public class SuperNodePath {
             LOG.info("List of direct path is empty !");
         }
         if (!atozdirectionPaths.isEmpty()) {
-            LOG.info("result size : " + result.size());
+            LOG.info("result size : {}", result.size());
             result = buildPathDescription(atozdirectionPaths,aend.concat("To").concat(zend).concat("_direct_"));
         } else {
             LOG.info("result is empty");
@@ -638,17 +638,17 @@ public class SuperNodePath {
         if (!paths.isEmpty()) {
             for (NodeLinkNode tmp : paths) {
                 if (!tmp.getDirect()) {
-                    LOG.info("Indirect NodeLinkNode : " + tmp.toString());
+                    LOG.info("Indirect NodeLinkNode : {}", tmp.toString());
                     int size = tmp.getAtozLink().size();
                     /** must be two for now just one hop. */
-                    LOG.info("number of links  : " + size);
+                    LOG.info("number of links  : {}", size);
                     boolean first = true;
                     if (size == 2) {
                         List<String> atozLinks = tmp.getAtozLink();
                         List<String> ztoaLinks = tmp.getZtoaLink();
                         if (!atozLinks.isEmpty() && !ztoaLinks.isEmpty()) {
-                            LOG.info("atozlink : " + atozLinks.toString());
-                            LOG.info("ztoalink : " + ztoaLinks.toString());
+                            LOG.info("atozlink : {}", atozLinks.toString());
+                            LOG.info("ztoalink : {}", ztoaLinks.toString());
                             int loop = 0;
                             while (loop < 2) {
                                 List<SuperNode> hop = getSuperNodeEndLink(atozLinks.get(loop));
@@ -657,12 +657,12 @@ public class SuperNodePath {
                                     zendSp = hop.get(1);
                                     InterNodePath interAend = new InterNodePath(aendSp);
                                     interAend.buildPath(zend);
-                                    LOG.info("interAend : " + interAend.getAtoz().toString());
+                                    LOG.info("interAend : {}", interAend.getAtoz().toString());
                                     InterNodePath interZend = new InterNodePath(zendSp);
                                     interZend.buildPath(zend);
-                                    LOG.info("interZend : " + interZend.getAtoz().toString());
+                                    LOG.info("interZend : {}", interZend.getAtoz().toString());
                                     List<String> deg1 = getDeg(atozLinks.get(loop),ztoaLinks.get(loop));
-                                    LOG.info("deg1 : " + deg1.toString());
+                                    LOG.info("deg1 : {}", deg1.toString());
                                     if (!deg1.isEmpty() && deg1.size() == 2) {
                                         List<AToZDirection> cleanInterA = null;
                                         List<AToZDirection> cleanInterZ = null;
@@ -702,7 +702,7 @@ public class SuperNodePath {
             LOG.info("List of indirect path is empty !");
         }
         if (!atozdirectionPaths.isEmpty()) {
-            LOG.info("result size : " + result.size());
+            LOG.info("result size : {}", result.size());
             result = buildPathDescription(atozdirectionPaths,aend.concat("To").concat(zend).concat("_indirect_"));
         } else {
             LOG.info("result is empty");
index 72fd5dd582ac72c7ed59187a112e44b2634c011d..0be69beddf39c877069fcf023382d847f1e7136c 100644 (file)
@@ -60,7 +60,7 @@ public class Topology {
             xml = inputStreamToString(is);
             if (xml != null) {
                 setNetwork(xmlMapper.readValue(xml, Network.class));
-                LOG.info("Network : " + network.toString());
+                LOG.info("Network : {}", network.toString());
             } else {
                 LOG.info("String xml is null");
             }
index 5adece408ffaa419cb78374fb18e977743881614..921303a53e1168c0bd169386ec179b0ded5c920e 100644 (file)
@@ -35,6 +35,11 @@ Author: Martial Coulibaly <martial.coulibaly@gfi.com> on behalf of Orange
       <artifactId>transportpce-ordmodels</artifactId>
       <version>${project.version}</version>
     </dependency>
+    <dependency>
+      <groupId>${project.groupId}</groupId>
+      <artifactId>transportpce-stubmodels</artifactId>
+      <version>${project.version}</version>
+    </dependency>
 
     <!-- Testing Dependencies -->
     <dependency>
index c7f587c7fe00e52a63c3b57c0edd13098dda2690..cdcdc0ec64ab810663f88608e6d2a01ff07f15c5 100644 (file)
@@ -70,7 +70,7 @@ public class SendingRendererRPCs {
                     Thread.sleep(10000); //sleep for 10s
                 } catch (InterruptedException e) {
                     output = false;
-                    LOG.error(e.toString());
+                    LOG.error("Thread.sleep failed : {}", e.toString());
                 }
                 buildAtoZ();
                 buildZtoA();
@@ -92,7 +92,7 @@ public class SendingRendererRPCs {
                     Thread.sleep(10000); //sleep for 10s
                 } catch (InterruptedException e) {
                     output = false;
-                    LOG.error(e.toString());
+                    LOG.error("Thread.sleep failed : {}", e.toString());
                 }
                 buildAtoZ();
                 buildZtoA();
index 1be07aa7b52262157dcfd8f65aff61c5b1474055..23ae97628781b7df6f5f778733c618299f5395db 100644 (file)
@@ -21,25 +21,21 @@ import java.util.concurrent.Future;
 import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService;
 import org.opendaylight.transportpce.stubrenderer.SendingRendererRPCs;
 import org.opendaylight.transportpce.stubrenderer.StubrendererCompliancyCheck;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceDeleteInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceDeleteOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceDeleteOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceImplementationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceImplementationRequestOutput;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceImplementationRequestOutputBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceRpcResultSp;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.ServiceRpcResultSpBuilder;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.StubrendererService;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.service.rpc.result.sp.PathTopology;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.service.rpc.result.sp.PathTopologyBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.configuration.response.common.ConfigurationResponseCommonBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev161014.service.TopologyBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.RpcStatusEx;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev170426.ServicePathNotificationTypes;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.CancelResourceReserveInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.CancelResourceReserveOutput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathComputationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.PathComputationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteOutput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceDeleteOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestOutput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceImplementationRequestOutputBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceRpcResultSp;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.ServiceRpcResultSpBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.TransportpceServicepathService;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.rpc.result.sp.PathTopology;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.service.rpc.result.sp.PathTopologyBuilder;
 import org.opendaylight.yangtools.yang.common.RpcResult;
 import org.opendaylight.yangtools.yang.common.RpcResultBuilder;
 import org.slf4j.Logger;
@@ -52,7 +48,7 @@ import org.slf4j.LoggerFactory;
  * @author Martial Coulibaly ( martial.coulibaly@gfi.com ) on behalf of Orange
  *
  */
-public class StubrendererImpl implements TransportpceServicepathService {
+public class StubrendererImpl implements StubrendererService {
     /** Logging. */
     private static final Logger LOG = LoggerFactory.getLogger(StubrendererImpl.class);
     /** send notification. */
@@ -93,7 +89,7 @@ public class StubrendererImpl implements TransportpceServicepathService {
             try {
                 notificationPublishService.putNotification(notification);
             } catch (InterruptedException e) {
-                LOG.info("notification offer rejected : " + e);
+                LOG.info("notification offer rejected : {}", e);
             }
 
             SendingRendererRPCs sendingRenderer = new SendingRendererRPCs(executor);
@@ -104,22 +100,22 @@ public class StubrendererImpl implements TransportpceServicepathService {
 
                 @Override
                 public void onFailure(Throwable arg0) {
-                    LOG.error("Failure message : " + arg0.toString());
+                    LOG.error("Failure message : {}", arg0.toString());
                     LOG.error("Service implementation failed !");
                     notification = new ServiceRpcResultSpBuilder()
                             .setNotificationType(ServicePathNotificationTypes.ServiceImplementationRequest)
                             .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
-                            .setStatusMessage("PCR Request failed  : " + arg0.getMessage()).build();
+                            .setStatusMessage("PCR Request failed  : {}" + arg0.getMessage()).build();
                     try {
                         notificationPublishService.putNotification(notification);
                     } catch (InterruptedException e) {
-                        LOG.info("notification offer rejected : " + e);
+                        LOG.info("notification offer rejected : {}", e);
                     }
                 }
 
                 @Override
                 public void onSuccess(Boolean response) {
-                    LOG.info("response : " + response);
+                    LOG.info("response : {}", response);
                     if (response) {
                         message = "Service implemented !";
                         TopologyBuilder topo = sendingRenderer.getTopology();
@@ -148,7 +144,7 @@ public class StubrendererImpl implements TransportpceServicepathService {
                     try {
                         notificationPublishService.putNotification(notification);
                     } catch (InterruptedException e) {
-                        LOG.info("notification offer rejected : " + e);
+                        LOG.info("notification offer rejected : {}", e);
                     }
                     LOG.info(message);
                 }
@@ -169,7 +165,7 @@ public class StubrendererImpl implements TransportpceServicepathService {
         } else {
             message = compliancyCheck.getMessage();
             responseCode = "500";
-            LOG.info("Service not compliant caused by : " + message);
+            LOG.info("Service not compliant caused by : {}", message);
             notification = new ServiceRpcResultSpBuilder()
                     .setNotificationType(ServicePathNotificationTypes.ServiceDelete)
                     .setServiceName(input.getServiceName()).setStatus(RpcStatusEx.Failed)
@@ -178,7 +174,7 @@ public class StubrendererImpl implements TransportpceServicepathService {
             try {
                 notificationPublishService.putNotification(notification);
             } catch (InterruptedException e) {
-                LOG.info("notification offer rejected : " + e);
+                LOG.info("notification offer rejected : {}", e);
             }
         }
         configurationResponseCommon = new ConfigurationResponseCommonBuilder()
@@ -217,7 +213,7 @@ public class StubrendererImpl implements TransportpceServicepathService {
             try {
                 notificationPublishService.putNotification(notification);
             } catch (InterruptedException e) {
-                LOG.info("notification offer rejected : " + e);
+                LOG.info("notification offer rejected : {}", e);
             }
             SendingRendererRPCs sendingRenderer = new SendingRendererRPCs(executor);
             FutureCallback<Boolean> rendererCallback = new FutureCallback<Boolean>() {
@@ -226,7 +222,7 @@ public class StubrendererImpl implements TransportpceServicepathService {
 
                 @Override
                 public void onFailure(Throwable arg0) {
-                    LOG.error("Failure message : " + arg0.toString());
+                    LOG.error("Failure message : {}", arg0.toString());
                     LOG.error("Service delete failed !");
                     notification = new ServiceRpcResultSpBuilder()
                             .setNotificationType(ServicePathNotificationTypes.ServiceDelete)
@@ -235,13 +231,13 @@ public class StubrendererImpl implements TransportpceServicepathService {
                     try {
                         notificationPublishService.putNotification(notification);
                     } catch (InterruptedException e) {
-                        LOG.info("notification offer rejected : " + e);
+                        LOG.info("notification offer rejected : {}", e);
                     }
                 }
 
                 @Override
                 public void onSuccess(Boolean response) {
-                    LOG.info("response : " + response);
+                    LOG.info("response : {}", response);
                     if (response) {
                         message = "Service deleted !";
                         notification = new ServiceRpcResultSpBuilder()
@@ -260,7 +256,7 @@ public class StubrendererImpl implements TransportpceServicepathService {
                     try {
                         notificationPublishService.putNotification(notification);
                     } catch (InterruptedException e) {
-                        LOG.info("notification offer rejected : " + e);
+                        LOG.info("notification offer rejected : {}", e);
                     }
                     LOG.info(message);
                 }
@@ -280,7 +276,7 @@ public class StubrendererImpl implements TransportpceServicepathService {
             return RpcResultBuilder.success(output).buildFuture();
         } else {
             message = compliancyCheck.getMessage();
-            LOG.info("Service not compliant caused by : " + message);
+            LOG.info("Service not compliant caused by : {}", message);
             responseCode = "500";
             notification = new ServiceRpcResultSpBuilder()
                     .setNotificationType(ServicePathNotificationTypes.ServiceDelete)
@@ -290,7 +286,7 @@ public class StubrendererImpl implements TransportpceServicepathService {
             try {
                 notificationPublishService.putNotification(notification);
             } catch (InterruptedException e) {
-                LOG.info("notification offer rejected : " + e);
+                LOG.info("notification offer rejected : {}", e);
             }
         }
         configurationResponseCommon = new ConfigurationResponseCommonBuilder()
@@ -303,16 +299,4 @@ public class StubrendererImpl implements TransportpceServicepathService {
                 .build();
         return RpcResultBuilder.success(output).buildFuture();
     }
-
-    @Override
-    public Future<RpcResult<CancelResourceReserveOutput>> cancelResourceReserve(CancelResourceReserveInput input) {
-        // TODO Auto-generated method stub
-        return null;
-    }
-
-    @Override
-    public Future<RpcResult<PathComputationRequestOutput>> pathComputationRequest(PathComputationRequestInput input) {
-        // TODO Auto-generated method stub
-        return null;
-    }
 }
index dff06285e2e10435417069c43d942dd9f0f717b9..6dcdb8ebc2e87185de46049184eec92aa21d1bef 100644 (file)
@@ -13,8 +13,8 @@ import org.opendaylight.controller.md.sal.binding.api.NotificationPublishService
 import org.opendaylight.controller.md.sal.binding.api.NotificationService;
 import org.opendaylight.controller.sal.binding.api.BindingAwareBroker;
 import org.opendaylight.controller.sal.binding.api.RpcProviderRegistry;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.TransportpceServicepathListener;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev170426.TransportpceServicepathService;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.StubrendererListener;
+import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.stubrenderer.rev170426.StubrendererService;
 import org.opendaylight.yangtools.concepts.ListenerRegistration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -30,8 +30,8 @@ public class StubrendererProvider {
     private final NotificationPublishService notificationPublishService;
 
 
-    private BindingAwareBroker.RpcRegistration<TransportpceServicepathService> rpcRegistration;
-    private ListenerRegistration<TransportpceServicepathListener> stubRendererlistenerRegistration;
+    private BindingAwareBroker.RpcRegistration<StubrendererService> rpcRegistration;
+    private ListenerRegistration<StubrendererListener> stubRendererlistenerRegistration;
 
     public StubrendererProvider(RpcProviderRegistry rpcProviderRegistry,
             NotificationService notificationService,
@@ -46,7 +46,7 @@ public class StubrendererProvider {
     public void init() {
         LOG.info("StubrendererProvider Session Initiated");
         final StubrendererImpl consumer = new StubrendererImpl(notificationPublishService);
-        rpcRegistration = rpcRegistry.addRpcImplementation(TransportpceServicepathService.class, consumer);
+        rpcRegistration = rpcRegistry.addRpcImplementation(StubrendererService.class, consumer);
     }
 
     /**
index 702fe936092559d66931637e6008f31ea28ba470..368ca4b90d4d06b855a838678ad449fa19d05ece 100644 (file)
@@ -11,3 +11,13 @@ commands =
   bash -c "(cd .. && mvn clean install -DskipTests -Dmaven.javadoc.skip=true)"
   ./build.sh
   nosetests --with-xunit transportpce_tests
+
+[testenv:servicehandler]
+usedevelop = True
+deps =
+  -r{toxinidir}/requirements.txt
+  -r{toxinidir}/test-requirements.txt
+whitelist_externals = bash
+commands =
+  bash -c "(cd .. && mvn clean install -DskipTests -Dmaven.javadoc.skip=true)"
+  nosetests --with-xunit transportpce_tests/test_servicehandler.py
diff --git a/tests/transportpce_tests/test_servicehandler.py b/tests/transportpce_tests/test_servicehandler.py
new file mode 100644 (file)
index 0000000..e3bdc11
--- /dev/null
@@ -0,0 +1,661 @@
+#!/usr/bin/env python
+##############################################################################
+#Copyright (c) 2017 Orange, Inc. and others.  All rights reserved.
+#
+# All rights reserved. This program and the accompanying materials
+# are made available under the terms of the Apache License, Version 2.0
+# which accompanies this distribution, and is available at
+# http://www.apache.org/licenses/LICENSE-2.0
+##############################################################################
+
+import json
+import os
+import psutil
+import requests
+import signal
+import shutil
+import subprocess
+import time
+import unittest
+
+
+class TransportPCEtesting(unittest.TestCase):
+
+    odl_process = None
+    restconf_baseurl = "http://127.0.0.1:8181/restconf"
+
+    @classmethod
+    def __start_odl(cls):
+        executable = "../karaf/target/assembly/bin/karaf"
+        with open('odl.log', 'w') as outfile:
+            cls.odl_process = subprocess.Popen(
+                ["bash", executable], stdout=outfile,
+                stdin=open(os.devnull))
+
+    @classmethod
+    def setUpClass(cls):        #a class method called before tests in an individual class run.
+        cls.__start_odl()
+        time.sleep(90)
+
+    @classmethod
+    def tearDownClass(cls):
+        for child in psutil.Process(cls.odl_process.pid).children():
+            child.send_signal(signal.SIGINT)
+            child.wait()
+        cls.odl_process.send_signal(signal.SIGINT)
+        cls.odl_process.wait()
+
+    def setUp(self):        #instruction executed before each test method
+        time.sleep(1)
+
+    #Get existing PathDesciption
+    def test_01_get_pathdescriptions(self):
+        url = ("{}/operational/stubpce:path-description-list/pathDescriptions/NodeAToNodeZ_direct_1"
+              .format(self.restconf_baseurl))
+        headers = {'content-type': 'application/json',
+        "Accept": "application/json"}
+        response = requests.request(
+            "GET", url, headers=headers, auth=('admin', 'admin'))
+        self.assertEqual(response.status_code, requests.codes.ok)
+        res = response.json()
+        self.assertEqual(
+            res['pathDescriptions'][0]['path-name'],
+            'NodeAToNodeZ_direct_1')
+        time.sleep(1)
+
+    #Get non existing PathDesciption
+    def test_02_get_pathdescriptions(self):
+        url = ("{}/operational/stubpce:path-description-list/pathDescriptions/Node"
+              .format(self.restconf_baseurl))
+        headers = {'content-type': 'application/json',
+        "Accept": "application/json"}
+        response = requests.request(
+            "GET", url, headers=headers, auth=('admin', 'admin'))
+        self.assertEqual(response.status_code, 404)
+        time.sleep(1)
+
+    #Create Service 'test' with correct parameters
+    def test_03_create_service(self):
+        url = ("{}/operations/org-openroadm-service:service-create"
+              .format(self.restconf_baseurl))
+        data = {"input": {
+                "sdnc-request-header": {
+                    "request-id": "e3028bae-a90f-4ddd-a83f-cf224eba0e58",
+                    "rpc-action": "service-create",
+                    "request-system-id": "appname",
+                    "notification-url": "http://localhost:8585/NotificationServer/notify"
+                },
+                "service-name": "test",
+                "common-id": "ASATT1234567",
+                "connection-type": "infrastructure",
+                "service-a-end": {
+                    "service-rate": "100",
+                    "node-id": "XPDRA",
+                    "service-format": "Ethernet",
+                    "clli": "SNJSCAMCJP8",
+                    "tx-direction": {
+                        "port": {
+                            "port-device-name": "ROUTER_SNJSCAMCJP8_000000.00_00",
+                            "port-type": "router",
+                            "port-name": "Gigabit Ethernet_Tx.ge-5/0/0.0",
+                            "port-rack": "000000.00",
+                            "port-shelf": "00"
+                        },
+                        "lgx": {
+                            "lgx-device-name": "LGX Panel_SNJSCAMCJP8_000000.00_00",
+                            "lgx-port-name": "LGX Back.3",
+                            "lgx-port-rack": "000000.00",
+                            "lgx-port-shelf": "00"
+                        }
+                    },
+                    "rx-direction": {
+                        "port": {
+                            "port-device-name": "ROUTER_SNJSCAMCJP8_000000.00_00",
+                            "port-type": "router",
+                            "port-name": "Gigabit Ethernet_Rx.ge-5/0/0.0",
+                            "port-rack": "000000.00",
+                            "port-shelf": "00"
+                        },
+                        "lgx": {
+                            "lgx-device-name": "LGX Panel_SNJSCAMCJP8_000000.00_00",
+                            "lgx-port-name": "LGX Back.4",
+                            "lgx-port-rack": "000000.00",
+                            "lgx-port-shelf": "00"
+                        }
+                    },
+                    "optic-type": "gray"
+                },
+                "service-z-end": {
+                    "service-rate": "100",
+                    "node-id": "XPDRC",
+                    "service-format": "Ethernet",
+                    "clli": "SNJSCAMCJT4",
+                    "tx-direction": {
+                        "port": {
+                            "port-device-name": "ROUTER_SNJSCAMCJT4_000000.00_00",
+                            "port-type": "router",
+                            "port-name": "Gigabit Ethernet_Tx.ge-1/0/0.0",
+                            "port-rack": "000000.00",
+                            "port-shelf": "00"
+                        },
+                        "lgx": {
+                            "lgx-device-name": "LGX Panel_SNJSCAMCJT4_000000.00_00",
+                            "lgx-port-name": "LGX Back.29",
+                            "lgx-port-rack": "000000.00",
+                            "lgx-port-shelf": "00"
+                        }
+                    },
+                    "rx-direction": {
+                        "port": {
+                            "port-device-name": "ROUTER_SNJSCAMCJT4_000000.00_00",
+                            "port-type": "router",
+                            "port-name": "Gigabit Ethernet_Rx.ge-1/0/0.0",
+                            "port-rack": "000000.00",
+                            "port-shelf": "00"
+                        },
+                        "lgx": {
+                            "lgx-device-name": "LGX Panel_SNJSCAMCJT4_000000.00_00",
+                            "lgx-port-name": "LGX Back.30",
+                            "lgx-port-rack": "000000.00",
+                            "lgx-port-shelf": "00"
+                        }
+                    },
+                    "optic-type": "gray"
+                },
+                "due-date": "2016-11-28T00:00:01Z",
+                "operator-contact": "pw1234"
+            }
+        }
+        headers = {'content-type': 'application/json',
+        "Accept": "application/json"}
+        response = requests.request(
+            "POST", url, data=json.dumps(data), headers=headers,
+            auth=('admin', 'admin'))
+        self.assertEqual(response.status_code, requests.codes.ok)
+        res = response.json()
+        self.assertIn('in progress',
+            res['output']['configuration-response-common']['response-message'])
+        time.sleep(30)
+
+    #Create Service 'test' with not compliant parameter : no 'sdnc-request-header' parameter
+    def test_04_create_service(self):
+        url = ("{}/operations/org-openroadm-service:service-create"
+              .format(self.restconf_baseurl))
+        data = {"input": {
+                "service-name": "test",
+                "common-id": "ASATT1234567",
+                "connection-type": "infrastructure",
+                "service-a-end": {
+                    "service-rate": "100",
+                    "node-id": "XPDRA",
+                    "service-format": "Ethernet",
+                    "clli": "SNJSCAMCJP8",
+                    "tx-direction": {
+                        "port": {
+                            "port-device-name": "ROUTER_SNJSCAMCJP8_000000.00_00",
+                            "port-type": "router",
+                            "port-name": "Gigabit Ethernet_Tx.ge-5/0/0.0",
+                            "port-rack": "000000.00",
+                            "port-shelf": "00"
+                        },
+                        "lgx": {
+                            "lgx-device-name": "LGX Panel_SNJSCAMCJP8_000000.00_00",
+                            "lgx-port-name": "LGX Back.3",
+                            "lgx-port-rack": "000000.00",
+                            "lgx-port-shelf": "00"
+                        }
+                    },
+                    "rx-direction": {
+                        "port": {
+                            "port-device-name": "ROUTER_SNJSCAMCJP8_000000.00_00",
+                            "port-type": "router",
+                            "port-name": "Gigabit Ethernet_Rx.ge-5/0/0.0",
+                            "port-rack": "000000.00",
+                            "port-shelf": "00"
+                        },
+                        "lgx": {
+                            "lgx-device-name": "LGX Panel_SNJSCAMCJP8_000000.00_00",
+                            "lgx-port-name": "LGX Back.4",
+                            "lgx-port-rack": "000000.00",
+                            "lgx-port-shelf": "00"
+                        }
+                    },
+                    "optic-type": "gray"
+                },
+                "service-z-end": {
+                    "service-rate": "100",
+                    "node-id": "XPDRC",
+                    "service-format": "Ethernet",
+                    "clli": "SNJSCAMCJT4",
+                    "tx-direction": {
+                        "port": {
+                            "port-device-name": "ROUTER_SNJSCAMCJT4_000000.00_00",
+                            "port-type": "router",
+                            "port-name": "Gigabit Ethernet_Tx.ge-1/0/0.0",
+                            "port-rack": "000000.00",
+                            "port-shelf": "00"
+                        },
+                        "lgx": {
+                            "lgx-device-name": "LGX Panel_SNJSCAMCJT4_000000.00_00",
+                            "lgx-port-name": "LGX Back.29",
+                            "lgx-port-rack": "000000.00",
+                            "lgx-port-shelf": "00"
+                        }
+                    },
+                    "rx-direction": {
+                        "port": {
+                            "port-device-name": "ROUTER_SNJSCAMCJT4_000000.00_00",
+                            "port-type": "router",
+                            "port-name": "Gigabit Ethernet_Rx.ge-1/0/0.0",
+                            "port-rack": "000000.00",
+                            "port-shelf": "00"
+                        },
+                        "lgx": {
+                            "lgx-device-name": "LGX Panel_SNJSCAMCJT4_000000.00_00",
+                            "lgx-port-name": "LGX Back.30",
+                            "lgx-port-rack": "000000.00",
+                            "lgx-port-shelf": "00"
+                        }
+                    },
+                    "optic-type": "gray"
+                },
+                "due-date": "2016-11-28T00:00:01Z",
+                "operator-contact": "pw1234"
+            }
+        }
+        headers = {'content-type': 'application/json',
+        "Accept": "application/json"}
+        response = requests.request(
+            "POST", url, data=json.dumps(data), headers=headers,
+            auth=('admin', 'admin'))
+        self.assertEqual(response.status_code, requests.codes.ok)
+        res = response.json()
+        self.assertIn('Service not compliant',
+            res['output']['configuration-response-common']['response-message'])
+        time.sleep(5)
+
+    #Create Service 'test' with not compliant parameter : no 'tx-direction' for serviceAEnd
+    def test_05_create_service(self):
+        url = ("{}/operations/org-openroadm-service:service-create"
+              .format(self.restconf_baseurl))
+        data = {"input": {
+                "sdnc-request-header": {
+                    "request-id": "e3028bae-a90f-4ddd-a83f-cf224eba0e58",
+                    "rpc-action": "service-create",
+                    "request-system-id": "appname",
+                    "notification-url": "http://localhost:8585/NotificationServer/notify"
+                },
+                "service-name": "test",
+                "common-id": "ASATT1234567",
+                "connection-type": "infrastructure",
+                "service-a-end": {
+                    "service-rate": "100",
+                    "node-id": "XPDRA",
+                    "service-format": "Ethernet",
+                    "clli": "SNJSCAMCJP8",
+                    "rx-direction": {
+                        "port": {
+                            "port-device-name": "ROUTER_SNJSCAMCJP8_000000.00_00",
+                            "port-type": "router",
+                            "port-name": "Gigabit Ethernet_Rx.ge-5/0/0.0",
+                            "port-rack": "000000.00",
+                            "port-shelf": "00"
+                        },
+                        "lgx": {
+                            "lgx-device-name": "LGX Panel_SNJSCAMCJP8_000000.00_00",
+                            "lgx-port-name": "LGX Back.4",
+                            "lgx-port-rack": "000000.00",
+                            "lgx-port-shelf": "00"
+                        }
+                    },
+                    "optic-type": "gray"
+                },
+                "service-z-end": {
+                    "service-rate": "100",
+                    "node-id": "XPDRC",
+                    "service-format": "Ethernet",
+                    "clli": "SNJSCAMCJT4",
+                    "tx-direction": {
+                        "port": {
+                            "port-device-name": "ROUTER_SNJSCAMCJT4_000000.00_00",
+                            "port-type": "router",
+                            "port-name": "Gigabit Ethernet_Tx.ge-1/0/0.0",
+                            "port-rack": "000000.00",
+                            "port-shelf": "00"
+                        },
+                        "lgx": {
+                            "lgx-device-name": "LGX Panel_SNJSCAMCJT4_000000.00_00",
+                            "lgx-port-name": "LGX Back.29",
+                            "lgx-port-rack": "000000.00",
+                            "lgx-port-shelf": "00"
+                        }
+                    },
+                    "rx-direction": {
+                        "port": {
+                            "port-device-name": "ROUTER_SNJSCAMCJT4_000000.00_00",
+                            "port-type": "router",
+                            "port-name": "Gigabit Ethernet_Rx.ge-1/0/0.0",
+                            "port-rack": "000000.00",
+                            "port-shelf": "00"
+                        },
+                        "lgx": {
+                            "lgx-device-name": "LGX Panel_SNJSCAMCJT4_000000.00_00",
+                            "lgx-port-name": "LGX Back.30",
+                            "lgx-port-rack": "000000.00",
+                            "lgx-port-shelf": "00"
+                        }
+                    },
+                    "optic-type": "gray"
+                },
+                "due-date": "2016-11-28T00:00:01Z",
+                "operator-contact": "pw1234"
+            }
+        }
+        headers = {'content-type': 'application/json',
+        "Accept": "application/json"}
+        response = requests.request(
+            "POST", url, data=json.dumps(data), headers=headers,
+            auth=('admin', 'admin'))
+        self.assertEqual(response.status_code, requests.codes.ok)
+        res = response.json()
+        self.assertIn('Service not compliant',
+            res['output']['configuration-response-common']['response-message'])
+        time.sleep(5)
+
+    #Get 'test' service created
+    def test_06_get_service(self):
+        url = ("{}/operational/org-openroadm-service:service-list/services/test"
+              .format(self.restconf_baseurl))
+        headers = {'content-type': 'application/json',
+        "Accept": "application/json"}
+        response = requests.request(
+            "GET", url, headers=headers, auth=('admin', 'admin'))
+        self.assertEqual(response.status_code, requests.codes.ok)
+        res = response.json()
+        self.assertEqual(
+            res['services'][0]['administrative-state'],
+            'inService')
+        time.sleep(1)
+
+    #get non existing service
+    def test_07_get_service(self):
+        url = ("{}/operational/org-openroadm-service:service-list/services/test1"
+              .format(self.restconf_baseurl))
+        headers = {'content-type': 'application/json',
+        "Accept": "application/json"}
+        response = requests.request(
+            "GET", url, headers=headers, auth=('admin', 'admin'))
+        self.assertEqual(response.status_code, 404)
+        time.sleep(1)
+
+    #reconfigure 'test' to be 'test-new'
+    def test_08_reconfigure_service(self):
+        url = ("{}/operations/org-openroadm-service:service-reconfigure"
+              .format(self.restconf_baseurl))
+        data = {"input": {
+                "service-name": "test",
+                "new-service-name": "test-new",
+                "common-id": "ASATT1234567",
+                "connection-type": "infrastructure",
+                "service-a-end": {
+                    "service-rate": "100",
+                    "node-id": "XPDRA",
+                    "service-format": "Ethernet",
+                    "clli": "SNJSCAMCJP8",
+                    "tx-direction": {
+                        "port": {
+                            "port-device-name": "ROUTER_SNJSCAMCJP8_000000.00_00",
+                            "port-type": "router",
+                            "port-name": "Gigabit Ethernet_Tx.ge-5/0/0.0",
+                            "port-rack": "000000.00",
+                            "port-shelf": "00"
+                        },
+                        "lgx": {
+                            "lgx-device-name": "LGX Panel_SNJSCAMCJP8_000000.00_00",
+                            "lgx-port-name": "LGX Back.3",
+                            "lgx-port-rack": "000000.00",
+                            "lgx-port-shelf": "00"
+                        }
+                    },
+                    "rx-direction": {
+                        "port": {
+                            "port-device-name": "ROUTER_SNJSCAMCJP8_000000.00_00",
+                            "port-type": "router",
+                            "port-name": "Gigabit Ethernet_Rx.ge-5/0/0.0",
+                            "port-rack": "000000.00",
+                            "port-shelf": "00"
+                        },
+                        "lgx": {
+                            "lgx-device-name": "LGX Panel_SNJSCAMCJP8_000000.00_00",
+                            "lgx-port-name": "LGX Back.4",
+                            "lgx-port-rack": "000000.00",
+                            "lgx-port-shelf": "00"
+                        }
+                    },
+                    "optic-type": "gray"
+                },
+                "service-z-end": {
+                    "service-rate": "100",
+                    "node-id": "XPDRC",
+                    "service-format": "Ethernet",
+                    "clli": "SNJSCAMCJT4",
+                    "tx-direction": {
+                        "port": {
+                            "port-device-name": "ROUTER_SNJSCAMCJT4_000000.00_00",
+                            "port-type": "router",
+                            "port-name": "Gigabit Ethernet_Tx.ge-1/0/0.0",
+                            "port-rack": "000000.00",
+                            "port-shelf": "00"
+                        },
+                        "lgx": {
+                            "lgx-device-name": "LGX Panel_SNJSCAMCJT4_000000.00_00",
+                            "lgx-port-name": "LGX Back.29",
+                            "lgx-port-rack": "000000.00",
+                            "lgx-port-shelf": "00"
+                        }
+                    },
+                    "rx-direction": {
+                        "port": {
+                            "port-device-name": "ROUTER_SNJSCAMCJT4_000000.00_00",
+                            "port-type": "router",
+                            "port-name": "Gigabit Ethernet_Rx.ge-1/0/0.0",
+                            "port-rack": "000000.00",
+                            "port-shelf": "00"
+                        },
+                        "lgx": {
+                            "lgx-device-name": "LGX Panel_SNJSCAMCJT4_000000.00_00",
+                            "lgx-port-name": "LGX Back.30",
+                            "lgx-port-rack": "000000.00",
+                            "lgx-port-shelf": "00"
+                        }
+                    },
+                    "optic-type": "gray"
+                },
+                "hard-constraints": {
+                    "diversity": {
+                        "existing-service": [
+                            "104/GE100/SNJSCAMCJP8/SNJSCAMCJT4"
+                        ],
+                        "existing-service-applicability": {
+                            "node": "true"
+                        }
+                    },
+                    "exclude": {
+                        "fiber-bundle": [
+                            "l(string)"
+                        ],
+                        "node-id": [
+                            "SNJSCAMCJP8_000000.00"
+                        ]
+                    },
+                    "latency": {
+                        "max-latency": "30"
+                    }
+                }
+            }
+        }
+        headers = {'content-type': 'application/json',
+        "Accept": "application/json"}
+        response = requests.request(
+            "POST", url, data=json.dumps(data), headers=headers,
+            auth=('admin', 'admin'))
+        self.assertEqual(response.status_code, requests.codes.ok)
+        res = response.json()
+        self.assertIn('in progress',
+            res['output']['status-message'])
+        time.sleep(30)
+
+
+    #get new service 'test-new'
+    def test_09_get_service(self):
+        url = ("{}/operational/org-openroadm-service:service-list/services/test-new"
+              .format(self.restconf_baseurl))
+        headers = {'content-type': 'application/json',
+        "Accept": "application/json"}
+        response = requests.request(
+            "GET", url, headers=headers, auth=('admin', 'admin'))
+        res = response.json()
+        self.assertEqual(
+            res['services'][0]['operational-state'],
+            'inService')
+        time.sleep(1)
+
+
+    #Modify 'test-new' state
+    def test_10_modify_service_state(self):
+        url = ("{}/operations/servicehandler:service-state-modify"
+              .format(self.restconf_baseurl))
+        data = {"input": {
+                "service-name": "test-new",
+                "operational-state": "outOfService"
+            }
+        }
+        headers = {'content-type': 'application/json'}
+        response = requests.request(
+            "POST", url, data=json.dumps(data), headers=headers,
+            auth=('admin', 'admin'))
+        res = response.json()
+        self.assertIn('Service state modified',
+            res['output']['configuration-response-common']['response-message'])
+        time.sleep(5)
+
+
+    #get new service 'test-new' state
+    def test_11_get_service(self):
+        url = ("{}/operational/org-openroadm-service:service-list/services/test-new"
+              .format(self.restconf_baseurl))
+        headers = {'content-type': 'application/json',
+        "Accept": "application/json"}
+        response = requests.request(
+            "GET", url, headers=headers, auth=('admin', 'admin'))
+        res = response.json()
+        self.assertEqual(
+            res['services'][0]['operational-state'],
+            'outOfService')
+        time.sleep(1)
+
+
+    #restore service 'test-new'
+    def test_12_restore_service(self):
+        url = ("{}/operations/org-openroadm-service:service-restoration"
+              .format(self.restconf_baseurl))
+        data = {"input": {
+                "service-name": "test-new",
+                "option": "permanent"
+            }
+        }
+        headers = {'content-type': 'application/json'}
+        response = requests.request(
+            "POST", url, data=json.dumps(data), headers=headers,
+            auth=('admin', 'admin'))
+        res = response.json()
+        self.assertIn('in progress',
+            res['output']['status-message'])
+        time.sleep(60)
+
+
+    #get new service 'test-new' state
+    def test_13_get_service(self):
+        url = ("{}/operational/org-openroadm-service:service-list/services/test-new"
+              .format(self.restconf_baseurl))
+        headers = {'content-type': 'application/json',
+        "Accept": "application/json"}
+        response = requests.request(
+            "GET", url, headers=headers, auth=('admin', 'admin'))
+        res = response.json()
+        self.assertEqual(
+            res['services'][0]['operational-state'],
+            'inService')
+        time.sleep(1)
+
+
+    #Delete 'test-new' service
+    def test_14_delete_service(self):
+        url = ("{}/operations/org-openroadm-service:service-delete"
+              .format(self.restconf_baseurl))
+        data = {"input": {
+                "sdnc-request-header": {
+                    "request-id": "e3028bae-a90f-4ddd-a83f-cf224eba0e58",
+                    "rpc-action": "service-delete",
+                    "request-system-id": "appname",
+                    "notification-url": "http://localhost:8585/NotificationServer/notify"
+                },
+                "service-delete-req-info": {
+                    "service-name": "test-new",
+                    "due-date": "2016-11-28T00:00:01Z",
+                    "tail-retention": "no"
+                }
+            }
+        }
+        headers = {'content-type': 'application/json'}
+        response = requests.request(
+            "POST", url, data=json.dumps(data), headers=headers,
+            auth=('admin', 'admin'))
+        res = response.json()
+        self.assertIn('in progress',
+            res['output']['configuration-response-common']['response-message'])
+        time.sleep(30)
+
+
+    #Delete non existing service
+    def test_15_delete_service(self):
+        url = ("{}/operations/org-openroadm-service:service-delete"
+              .format(self.restconf_baseurl))
+        data = {"input": {
+                "sdnc-request-header": {
+                    "request-id": "e3028bae-a90f-4ddd-a83f-cf224eba0e58",
+                    "rpc-action": "service-delete",
+                    "request-system-id": "appname",
+                    "notification-url": "http://localhost:8585/NotificationServer/notify"
+                },
+                "service-delete-req-info": {
+                    "service-name": "test",
+                    "due-date": "2016-11-28T00:00:01Z",
+                    "tail-retention": "no"
+                }
+            }
+        }
+        headers = {'content-type': 'application/json'}
+        response = requests.request(
+            "POST", url, data=json.dumps(data), headers=headers,
+            auth=('admin', 'admin'))
+        self.assertEqual(response.status_code, requests.codes.ok)
+        res = response.json()
+        self.assertIn('not exists in datastore',
+            res['output']['configuration-response-common']['response-message'])
+        time.sleep(1)
+
+
+    #Verify 'test' service deleted
+    def test_16_get_service(self):
+        url = ("{}/operational/org-openroadm-service:service-list/services/test-new"
+              .format(self.restconf_baseurl))
+        headers = {'content-type': 'application/json',
+        "Accept": "application/json"}
+        response = requests.request(
+            "GET", url, headers=headers, auth=('admin', 'admin'))
+        self.assertEqual(response.status_code, 404)
+        time.sleep(1)
+
+if __name__ == "__main__":
+    unittest.main(verbosity=2)