Remove transportpce-routing-constraint model 83/100483/1
authorGilles Thouenon <gilles.thouenon@orange.com>
Wed, 19 Jan 2022 12:01:44 +0000 (13:01 +0100)
committerGilles Thouenon <gilles.thouenon@orange.com>
Fri, 8 Apr 2022 07:27:41 +0000 (09:27 +0200)
- replace internal redundant transportpce-routing-constraints model by
the official openroadm-routing-constraints one
- remove unecessary mapping class in servicehandler that was converting
routing-constraints from openroadm to transportpce types
- adapt other code, UT and functional tests consequently

NB: This change is the following of change
https://git.opendaylight.org/gerrit/c/transportpce/+/99379, and they
should be cherry-picked together to guarantee YANG revision dates
coherency.

JIRA: TRNSPRTPCE-586
Signed-off-by: Gilles Thouenon <gilles.thouenon@orange.com>
Change-Id: Ieee313f5700bce4924a8e75dea52d59f7f494bc5

18 files changed:
api/src/main/yang/service_path/transportpce-common-service-path-types@2022-01-18.yang
api/src/main/yang/service_path/transportpce-pce@2022-01-18.yang
api/src/main/yang/service_path/transportpce-routing-constraints@2022-01-18.yang [deleted file]
pce/src/main/java/org/opendaylight/transportpce/pce/PceSendingPceRPCs.java
pce/src/main/java/org/opendaylight/transportpce/pce/constraints/PceConstraintsCalc.java
pce/src/main/java/org/opendaylight/transportpce/pce/gnpy/GnpyResult.java
pce/src/main/java/org/opendaylight/transportpce/pce/gnpy/GnpyUtilitiesImpl.java
pce/src/test/java/org/opendaylight/transportpce/pce/constraints/PceConstraintsCalcTest.java
pce/src/test/java/org/opendaylight/transportpce/pce/utils/PceTestData.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/MappingConstraints.java [deleted file]
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/ModelMappingUtils.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/service/PCEServiceWrapper.java
servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/service/ServiceDataStoreOperationsImpl.java
servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/MappingConstraintsTest.java [deleted file]
servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/utils/ModelMappingUtils.java
servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/utils/ServiceDataUtils.java
tests/transportpce_tests/pce/test01_pce.py
tests/transportpce_tests/pce/test03_gnpy.py

index deefeaea0f45f734b8c06857c90a2673dcb854f2..2d69e715225ecc37fd49ad8ad7b02c1968b1dae9 100644 (file)
@@ -2,8 +2,8 @@ module transportpce-common-service-path-types {
   namespace "http://org/transportpce/B-C-interface/service/types";
   prefix transportpce-common-service-path-types;
 
   namespace "http://org/transportpce/B-C-interface/service/types";
   prefix transportpce-common-service-path-types;
 
-  import transportpce-routing-constraints {
-    prefix transportpce-routing-constraints;
+  import org-openroadm-routing-constraints {
+    prefix org-openroadm-routing-constraints;
   }
   import transportpce-pathDescription {
     prefix transportpce-pathDescription;
   }
   import transportpce-pathDescription {
     prefix transportpce-pathDescription;
@@ -61,7 +61,8 @@ module transportpce-common-service-path-types {
 
   revision 2022-01-18 {
     description
 
   revision 2022-01-18 {
     description
-      "Add typedef pce-metric";
+      "Add typedef pce-metric.
+       Replace transportpce-routing-constraints by org-openroadm-routing-constraints.";
   }
 
   revision 2020-01-28 {
   }
 
   revision 2020-01-28 {
@@ -148,7 +149,7 @@ module transportpce-common-service-path-types {
 
   grouping response-parameters-sp {
     container response-parameters {
 
   grouping response-parameters-sp {
     container response-parameters {
-      uses transportpce-routing-constraints:routing-constraints-sp;
+      uses org-openroadm-routing-constraints:routing-constraints;
       container path-description {
         uses transportpce-pathDescription:path-description;
       }
       container path-description {
         uses transportpce-pathDescription:path-description;
       }
@@ -263,7 +264,7 @@ module transportpce-common-service-path-types {
     leaf pce-routing-metric {
       type pce-metric;
     }
     leaf pce-routing-metric {
       type pce-metric;
     }
-    uses transportpce-routing-constraints:routing-constraints-sp;
+    uses org-openroadm-routing-constraints:routing-constraints;
     leaf latency {
       type uint32;
       description
     leaf latency {
       type uint32;
       description
index 327681071e9c72e193c89093448afde66e1a88e4..9a6bdb5d873e7854b35df79f5e4b8294b9f61415 100644 (file)
@@ -2,8 +2,8 @@ module transportpce-pce {
   namespace "http://org/opendaylight/transportpce/pce";
   prefix org-opendaylight-transportpce-pce;
 
   namespace "http://org/opendaylight/transportpce/pce";
   prefix org-opendaylight-transportpce-pce;
 
-  import transportpce-routing-constraints {
-    prefix transportpce-routing-constraints;
+  import org-openroadm-routing-constraints {
+    prefix org-openroadm-routing-constraints;
   }
   import org-openroadm-common-service-types {
     prefix org-openroadm-common-service-types;
   }
   import org-openroadm-common-service-types {
     prefix org-openroadm-common-service-types;
@@ -56,7 +56,8 @@ module transportpce-pce {
 
   revision 2022-01-18 {
     description
 
   revision 2022-01-18 {
     description
-      "Add in path-computation-request input the pce-routing-metric";
+      "Add in path-computation-request input the pce-routing-metric.
+       Replace transportpce-routing-constraints by org-openroadm-routing-constraints";
   }
   revision 2021-07-01 {
     description
   }
   revision 2021-07-01 {
     description
@@ -174,7 +175,7 @@ module transportpce-pce {
       container service-z-end {
         uses transportpce-common-service-path-types:service-endpoint-sp;
       }
       container service-z-end {
         uses transportpce-common-service-path-types:service-endpoint-sp;
       }
-      uses transportpce-routing-constraints:routing-constraints-sp;
+      uses org-openroadm-routing-constraints:routing-constraints;
       uses org-openroadm-common-service-types:routing-metric;
     }
     output {
       uses org-openroadm-common-service-types:routing-metric;
     }
     output {
diff --git a/api/src/main/yang/service_path/transportpce-routing-constraints@2022-01-18.yang b/api/src/main/yang/service_path/transportpce-routing-constraints@2022-01-18.yang
deleted file mode 100644 (file)
index b4f9971..0000000
+++ /dev/null
@@ -1,175 +0,0 @@
-module transportpce-routing-constraints {
-  namespace "http://org/transportpce/B-C-interface/routing/constraints";
-  prefix transportpce-routing-constraints;
-
-  organization
-    "transportPCE";
-  contact
-    "transportPCE committers - ODL";
-  description
-    "YANG definitions of B interface (transportPCE). Adapted from service definition (openroadm)
-     Copyright ©  2017 Orange, Inc. and others.  All rights reserved.
-     openroadm copyright:
-      Copyright of the Members of the Open ROADM MSA Agreement dated (c) 2016,
-      AT&T Intellectual Property.  All other rights reserved.
-
-      Redistribution and use in source and binary forms, with or without modification,
-      are permitted provided that the following conditions are met:
-
-      * Redistributions of source code must retain the above copyright notice, this
-        list of conditions and the following disclaimer.
-      * Redistributions in binary form must reproduce the above copyright notice,
-        this list of conditions and the following disclaimer in the documentation and/or
-        other materials provided with the distribution.
-      * Neither the Members of the Open ROADM MSA Agreement nor the names of its
-        contributors may be used to endorse or promote products derived from this software
-        without specific prior written permission.
-
-      THIS SOFTWARE IS PROVIDED BY THE MEMBERS OF THE OPEN ROADM MSA  AGREEMENT ''AS IS''
-      AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
-      WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
-      IN NO EVENT THE MEMBERS OF THE OPEN ROADM MSA  AGREEMENT BE LIABLE FOR ANY DIRECT,
-      INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
-      NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;  LOSS OF USE, DATA,
-      OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-      WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-      ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-      POSSIBILITY OF SUCH DAMAGE";
-
-  revision 2022-01-18 {
-    description
-      "Remove pce-metric from routing-constraint-sp";
-  }
-  revision 2017-10-17 {
-    description
-      "Version 1.6";
-  }
-  revision 2017-04-26 {
-    description
-      "Version 1.5";
-  }
-
-  grouping common-constraints-sp {
-    leaf-list SRLG {
-      type string;
-    }
-    leaf-list clli {
-      type string;
-    }
-    leaf-list node-id {
-      type string;
-    }
-  }
-
-  grouping ordered-constraints-sp {
-    description
-      "";
-    container hop-type {
-      choice hop-type {
-        case SRLG {
-          leaf SRLG {
-            type string;
-            //to be clarified with topology model
-          }
-        }
-        case clli {
-          leaf clli {
-            type string;
-            //to be clarified with topology model
-          }
-        }
-        case node {
-          leaf node-id {
-            type string;
-            // to be clarified with topology model
-          }
-        }
-      }
-    }
-  }
-
-  grouping diversity-existing-service-contraints-sp {
-    leaf-list existing-service {
-      type string;
-      description
-        "Diverse from existing services identified by facility CLFI";
-    }
-    container existing-service-applicability {
-      leaf clli {
-        type boolean;
-      }
-      leaf node {
-        type boolean;
-      }
-      leaf srlg {
-        type boolean;
-      }
-    }
-  }
-
-  grouping routing-constraints-sp {
-    container hard-constraints {
-      uses constraints-sp;
-    }
-    container soft-constraints {
-      uses constraints-sp;
-    }
-    leaf locally-protected-links {
-      type boolean;
-      description
-        "indicates whether it must use locally protected links or not";
-    }
-  }
-
-  grouping constraints-sp {
-    leaf-list customer-code {
-      type string;
-    }
-    choice co-routing-or-general {
-      case general {
-        container diversity {
-          uses diversity-existing-service-contraints-sp;
-        }
-        container exclude_ {
-          uses common-constraints-sp;
-          leaf-list supporting-service-name {
-            type string;
-            description
-              "Supporting service(s) to exclude from this route.";
-          }
-          leaf affinity {
-            type uint32;
-          }
-        }
-        container include_ {
-          list ordered-hops {
-            key "hop-number";
-            leaf hop-number {
-              type uint16;
-              description
-                "designates the id of the hop: node-id, SRLG-id, site-id";
-            }
-            uses ordered-constraints-sp;
-          }
-        }
-        container latency {
-          description
-            "Maximum latency allowed";
-          leaf max-latency {
-            type uint32;
-            units "ms";
-          }
-        }
-      }
-      case co-routing {
-        container co-routing {
-          leaf-list existing-service {
-            type string;
-            description
-              "Diverse from existing services identified by facility CLFI";
-          }
-        }
-      }
-    }
-  }
-}
index 134d2984aabcfe0c71a003ab4b57f1c423ac53a0..751a7ea9873243c8c2999911ea36fef93a325126 100644 (file)
@@ -23,9 +23,9 @@ import org.opendaylight.transportpce.pce.networkanalyzer.PceResult;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.PathComputationRequestInput;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.PathComputationRequestInputBuilder;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.service.path.rpc.result.PathDescriptionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.PathComputationRequestInput;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.PathComputationRequestInputBuilder;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.service.path.rpc.result.PathDescriptionBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.HardConstraints;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.AToZDirection;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.ZToADirection;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.AToZDirection;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.ZToADirection;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing.constraints.sp.HardConstraints;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.PceMetric;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.PceMetric;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
index 8a7a8c6ec430bbda7eeff96066f7aabeb3f7da5c..754d51eeba610568a887e6929c92430831311227 100644 (file)
@@ -8,8 +8,6 @@
 package org.opendaylight.transportpce.pce.constraints;
 
 import java.util.ArrayList;
 package org.opendaylight.transportpce.pce.constraints;
 
 import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
 import java.util.List;
 import java.util.Optional;
 import java.util.concurrent.ExecutionException;
 import java.util.List;
 import java.util.Optional;
 import java.util.concurrent.ExecutionException;
@@ -19,38 +17,35 @@ import java.util.stream.Collectors;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.transportpce.common.Timeouts;
 import org.opendaylight.transportpce.common.network.NetworkTransactionService;
 import org.opendaylight.mdsal.common.api.LogicalDatastoreType;
 import org.opendaylight.transportpce.common.Timeouts;
 import org.opendaylight.transportpce.common.network.NetworkTransactionService;
+import org.opendaylight.transportpce.pce.constraints.PceConstraints.ResourcePair;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.PathComputationRequestInput;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev181130.NodeIdType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.CoRoutingOrGeneral;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.CoRouting;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.General;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.general.Diversity;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.general.Exclude;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.general.Include;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.general.Latency;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.diversity.existing.service.constraints.ExistingServiceApplicability;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.HardConstraints;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.SoftConstraints;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.PathDescription;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.atoz.direction.AToZ;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce.resource.resource.resource.Link;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce.resource.resource.resource.Node;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.PathDescription;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.atoz.direction.AToZ;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce.resource.resource.resource.Link;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.pce.resource.resource.resource.Node;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.CoRoutingOrGeneral;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.CoRouting;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.General;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.general.Diversity;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.general.Exclude;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.general.Include;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.general.Latency;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.general.include_.OrderedHops;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.diversity.existing.service.contraints.sp.ExistingServiceApplicability;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.ordered.constraints.sp.hop.type.HopType;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.ordered.constraints.sp.hop.type.hop.type.Clli;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.ordered.constraints.sp.hop.type.hop.type.SRLG;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing.constraints.sp.HardConstraints;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing.constraints.sp.SoftConstraints;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.PceMetric;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.ServicePathList;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePaths;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePathsKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.PceMetric;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.ServicePathList;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePaths;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.servicepath.rev171017.service.path.list.ServicePathsKey;
 import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+import org.opendaylight.yangtools.yang.common.Uint32;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class PceConstraintsCalc {
     /* Logging. */
     private static final Logger LOG = LoggerFactory.getLogger(PceConstraintsCalc.class);
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 public class PceConstraintsCalc {
     /* Logging. */
     private static final Logger LOG = LoggerFactory.getLogger(PceConstraintsCalc.class);
-    private static final Comparator<OrderedHops> ORDERED_HOP_COMPARATOR =
-            Comparator.comparing(OrderedHops::getHopNumber);
 
     private PceConstraints pceHardConstraints = new PceConstraints();
     private PceConstraints pceSoftConstraints = new PceConstraints();
 
     private PceConstraints pceHardConstraints = new PceConstraints();
     private PceConstraints pceSoftConstraints = new PceConstraints();
@@ -136,35 +131,13 @@ public class PceConstraintsCalc {
         }
 
         Exclude exclude = tmpGeneral.getExclude();
         }
 
         Exclude exclude = tmpGeneral.getExclude();
-        List<String> elementsToExclude = null;
         if (exclude != null) {
         if (exclude != null) {
-            elementsToExclude = exclude.getNodeId();
-            if (elementsToExclude != null) {
-                constraints.setExcludeSupNodes(elementsToExclude);
-            }
-
-            elementsToExclude = exclude.getSRLG();
-            if (elementsToExclude != null) {
-                List<Long> srlgToExclude = new ArrayList<>();
-                for (String str : elementsToExclude) {
-                    srlgToExclude.add(Long.parseLong(str));
-                }
-                constraints.setExcludeSRLG(srlgToExclude);
-            }
-
-            elementsToExclude = exclude.getClli();
-            if (elementsToExclude != null) {
-                constraints.setExcludeCLLI(elementsToExclude);
-            }
+            readExclude(exclude, constraints);
         }
 
         Include include = tmpGeneral.getInclude();
         if (include != null) {
         }
 
         Include include = tmpGeneral.getInclude();
         if (include != null) {
-            List<OrderedHops> listHops = new ArrayList<>(include.nonnullOrderedHops().values());
-            if (listHops != null) {
-                readIncludeNodes(listHops, constraints);
-            }
-            LOG.debug("in readGeneralContrains INCLUDE {} ", include);
+            readInclude(include, constraints);
         }
 
         Diversity diversity = tmpGeneral.getDiversity();
         }
 
         Diversity diversity = tmpGeneral.getDiversity();
@@ -180,43 +153,54 @@ public class PceConstraintsCalc {
             if (Boolean.TRUE.equals(temp.getSrlg())) {
                 rt = PceConstraints.ResourceType.SRLG;
             }
             if (Boolean.TRUE.equals(temp.getSrlg())) {
                 rt = PceConstraints.ResourceType.SRLG;
             }
-            if (Boolean.TRUE.equals(temp.getClli())) {
+            if (Boolean.TRUE.equals(temp.getSite())) {
                 rt = PceConstraints.ResourceType.CLLI;
             }
             LOG.info("in readGeneralContrains {} list is :{}", rt, diversity);
             readDiversity(diversity.getExistingService(), constraints, rt);
         }
                 rt = PceConstraints.ResourceType.CLLI;
             }
             LOG.info("in readGeneralContrains {} list is :{}", rt, diversity);
             readDiversity(diversity.getExistingService(), constraints, rt);
         }
+    }
 
 
+    private void readExclude(Exclude exclude, PceConstraints constraints) {
+        List<NodeIdType> nodes = exclude.getNodeId();
+        if (nodes != null) {
+            List<String> elementsToExclude = new ArrayList<>();
+            for (NodeIdType node : nodes) {
+                elementsToExclude.add(node.getValue());
+            }
+            constraints.setExcludeSupNodes(elementsToExclude);
+        }
+        List<Uint32> srlgs = exclude.getSrlgId();
+        if (srlgs != null) {
+            List<Long> elementsToExclude = new ArrayList<>();
+            for (Uint32 srlg : srlgs) {
+                elementsToExclude.add(srlg.longValue());
+            }
+            constraints.setExcludeSRLG(elementsToExclude);
+        }
+        List<String> sites = exclude.getSite();
+        if (sites != null) {
+            constraints.setExcludeCLLI(exclude.getSite());
+        }
     }
 
     }
 
-    private void readIncludeNodes(List<OrderedHops> listHops, PceConstraints constraints) {
-        Collections.sort(listHops, ORDERED_HOP_COMPARATOR);
-        for (int i = 0; i < listHops.size(); i++) {
-            HopType hoptype = listHops.get(i).getHopType().getHopType();
-
-            String hopt = hoptype.implementedInterface().getSimpleName();
-            LOG.info("in readIncludeNodes next hop to include {}", hopt);
-            switch (hopt) {
-                case "Node":
-                    org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118
-                        .ordered.constraints.sp.hop.type.hop.type.Node node =
-                        (org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118
-                            .ordered.constraints.sp.hop.type.hop.type.Node) hoptype;
-                    constraints.setListToInclude(
-                        new PceConstraints.ResourcePair(PceConstraints.ResourceType.NODE, node.getNodeId()));
-                    break;
-                case "SRLG":
-                    SRLG srlg = (SRLG) hoptype;
-                    constraints.setListToInclude(
-                        new PceConstraints.ResourcePair(PceConstraints.ResourceType.SRLG, srlg.getSRLG()));
-                    break;
-                case "Clli":
-                    Clli clli = (Clli) hoptype;
-                    constraints.setListToInclude(
-                        new PceConstraints.ResourcePair(PceConstraints.ResourceType.CLLI, clli.getClli()));
-                    break;
-                default:
-                    LOG.error("in readIncludeNodes unsupported include type {}", hopt);
+    private void readInclude(Include include, PceConstraints constraints) {
+        List<NodeIdType> nodes = include.getNodeId();
+        if (nodes != null) {
+            for (NodeIdType node : nodes) {
+                constraints.setListToInclude(new ResourcePair(PceConstraints.ResourceType.NODE, node.getValue()));
+            }
+        }
+        List<Uint32> srlgs = include.getSrlgId();
+        if (srlgs != null) {
+            for (Uint32 srlg : srlgs) {
+                constraints.setListToInclude(new ResourcePair(PceConstraints.ResourceType.SRLG, srlg.toString()));
+            }
+        }
+        List<String> sites = include.getSite();
+        if (sites != null) {
+            for (String site : sites) {
+                constraints.setListToInclude(new ResourcePair(PceConstraints.ResourceType.CLLI, site));
             }
         }
     }
             }
         }
     }
@@ -262,7 +246,6 @@ public class PceConstraintsCalc {
                 LOG.info("in readDiversity srv={} is not present", srv);
             }
         }
                 LOG.info("in readDiversity srv={} is not present", srv);
             }
         }
-
     }
 
     private List<String> getAToZNodeList(PathDescription pathDescription) {
     }
 
     private List<String> getAToZNodeList(PathDescription pathDescription) {
index 768760250671dd45dea91bf5a634ffb3238f60ba..70d1a46f4c456070af1bbe33b5b1cfc297360fd0 100644 (file)
@@ -12,7 +12,6 @@ import java.math.BigDecimal;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.List;
-import java.util.stream.Collectors;
 import org.opendaylight.yang.gen.v1.gnpy.path.rev220221.Result;
 import org.opendaylight.yang.gen.v1.gnpy.path.rev220221.explicit.route.hop.type.NumUnnumHop;
 import org.opendaylight.yang.gen.v1.gnpy.path.rev220221.generic.path.properties.path.properties.PathMetric;
 import org.opendaylight.yang.gen.v1.gnpy.path.rev220221.Result;
 import org.opendaylight.yang.gen.v1.gnpy.path.rev220221.explicit.route.hop.type.NumUnnumHop;
 import org.opendaylight.yang.gen.v1.gnpy.path.rev220221.generic.path.properties.path.properties.PathMetric;
@@ -20,18 +19,13 @@ import org.opendaylight.yang.gen.v1.gnpy.path.rev220221.generic.path.properties.
 import org.opendaylight.yang.gen.v1.gnpy.path.rev220221.result.Response;
 import org.opendaylight.yang.gen.v1.gnpy.path.rev220221.result.response.response.type.NoPathCase;
 import org.opendaylight.yang.gen.v1.gnpy.path.rev220221.result.response.response.type.PathCase;
 import org.opendaylight.yang.gen.v1.gnpy.path.rev220221.result.Response;
 import org.opendaylight.yang.gen.v1.gnpy.path.rev220221.result.response.response.type.NoPathCase;
 import org.opendaylight.yang.gen.v1.gnpy.path.rev220221.result.response.response.type.PathCase;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.General;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.GeneralBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.general.Include;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.general.IncludeBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.general.include_.OrderedHops;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.general.include_.OrderedHopsBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.ordered.constraints.sp.HopType;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.ordered.constraints.sp.HopTypeBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.ordered.constraints.sp.hop.type.hop.type.NodeBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing.constraints.sp.HardConstraints;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing.constraints.sp.HardConstraintsBuilder;
-import org.opendaylight.yangtools.yang.common.Uint16;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev181130.NodeIdType;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.General;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.GeneralBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.general.Include;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.general.IncludeBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.HardConstraints;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.HardConstraintsBuilder;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
@@ -114,29 +108,18 @@ public class GnpyResult {
         HardConstraints hardConstraints = null;
         // Includes the list of nodes in the GNPy computed path as constraints
         // for the PCE
         HardConstraints hardConstraints = null;
         // Includes the list of nodes in the GNPy computed path as constraints
         // for the PCE
-        List<OrderedHops> orderedHopsList = new ArrayList<>();
-        int counter = 0;
+        List<NodeIdType> nodeIdList = new ArrayList<>();
         for (PathRouteObjects pathRouteObjects : pathRouteObjectList) {
             if (pathRouteObjects.getPathRouteObject().getType() instanceof NumUnnumHop) {
                 NumUnnumHop numUnnumHop = (NumUnnumHop) pathRouteObjects.getPathRouteObject().getType();
                 String nodeId = numUnnumHop.getNumUnnumHop().getNodeId();
                 if (nodeId != null && this.ordNodeList.contains(nodeId)) {
         for (PathRouteObjects pathRouteObjects : pathRouteObjectList) {
             if (pathRouteObjects.getPathRouteObject().getType() instanceof NumUnnumHop) {
                 NumUnnumHop numUnnumHop = (NumUnnumHop) pathRouteObjects.getPathRouteObject().getType();
                 String nodeId = numUnnumHop.getNumUnnumHop().getNodeId();
                 if (nodeId != null && this.ordNodeList.contains(nodeId)) {
-                    org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118
-                        .ordered.constraints.sp.hop.type.hop.type.Node node = new NodeBuilder().setNodeId(nodeId)
-                        .build();
-                    HopType hopType = new HopTypeBuilder().setHopType(node).build();
-                    OrderedHops orderedHops = new OrderedHopsBuilder()
-                            .setHopNumber(Uint16.valueOf(counter)).setHopType(hopType)
-                        .build();
-                    orderedHopsList.add(orderedHops);
-                    counter++;
+                    nodeIdList.add(new NodeIdType(nodeId));
                 }
             }
         }
                 }
             }
         }
-        Include include = new IncludeBuilder()
-                .setOrderedHops(orderedHopsList.stream()
-                        .collect(Collectors.toMap(OrderedHops::key, orderedHops -> orderedHops)))
-                .build();
+
+        Include include = new IncludeBuilder().setNodeId(nodeIdList).build();
         General general = new GeneralBuilder().setInclude(include).build();
         hardConstraints = new HardConstraintsBuilder().setCoRoutingOrGeneral(general).build();
         return hardConstraints;
         General general = new GeneralBuilder().setInclude(include).build();
         hardConstraints = new HardConstraintsBuilder().setCoRoutingOrGeneral(general).build();
         return hardConstraints;
index f7fc3a425dc715c1a931dc9d5b51a3078cd81af1..e7de91fe68e34f071e53b056ae18152c0f48f8ba 100644 (file)
@@ -24,10 +24,10 @@ import org.opendaylight.yang.gen.v1.gnpy.path.rev220221.generic.path.properties.
 import org.opendaylight.yang.gen.v1.gnpy.path.rev220221.service.PathRequest;
 import org.opendaylight.yang.gen.v1.gnpy.path.rev220221.synchronization.info.Synchronization;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.PathComputationRequestInput;
 import org.opendaylight.yang.gen.v1.gnpy.path.rev220221.service.PathRequest;
 import org.opendaylight.yang.gen.v1.gnpy.path.rev220221.synchronization.info.Synchronization;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.PathComputationRequestInput;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.HardConstraints;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.AToZDirection;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.AToZDirectionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.ZToADirection;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.AToZDirection;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.AToZDirectionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.ZToADirection;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing.constraints.sp.HardConstraints;
 import org.opendaylight.yangtools.yang.common.Uint32;
 
 /**
 import org.opendaylight.yangtools.yang.common.Uint32;
 
 /**
@@ -74,7 +74,6 @@ public class GnpyUtilitiesImpl {
         return isPcePathFeasible;
     }
 
         return isPcePathFeasible;
     }
 
-    @SuppressWarnings("checkstyle:illegalcatch")
     public GnpyResult gnpyResponseOneDirection(GnpyServiceImpl gnpySvc) throws GnpyException {
         requestId = Uint32.valueOf((requestId.toJava()) + 1);
         List<PathRequest> pathRequestList = new ArrayList<>(gnpySvc.getPathRequest().values());
     public GnpyResult gnpyResponseOneDirection(GnpyServiceImpl gnpySvc) throws GnpyException {
         requestId = Uint32.valueOf((requestId.toJava()) + 1);
         List<PathRequest> pathRequestList = new ArrayList<>(gnpySvc.getPathRequest().values());
index d12f22cb22ddb4be4bbdddaa381ea2d94d6a306a..543996d77f2773a440947e4aed47efe018f2c6ea 100644 (file)
@@ -69,7 +69,7 @@ public class PceConstraintsCalcTest extends AbstractTest {
         new PceConstraintsCalc(PceTestData.getEmptyPCERequestServiceNameWithRequestId(), networkTransactionService);
     }
 
         new PceConstraintsCalc(PceTestData.getEmptyPCERequestServiceNameWithRequestId(), networkTransactionService);
     }
 
-    @Test(expected = Exception.class)
+    @Test()
     public void testHardConstrainsExists4() {
         new PceConstraintsCalc(PceTestData.getPCE_test2_request_54(), networkTransactionService);
     }
     public void testHardConstrainsExists4() {
         new PceConstraintsCalc(PceTestData.getPCE_test2_request_54(), networkTransactionService);
     }
index 514105f6dc0a358a91e39da218d9086e49428f9f..7f467e6fd0cf4b5b4308fd9bee7852915dabe4d5 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.transportpce.pce.utils;
 
 import java.util.Arrays;
 package org.opendaylight.transportpce.pce.utils;
 
 import java.util.Arrays;
-import java.util.Map;
 import org.opendaylight.transportpce.common.ResponseCodes;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.PathComputationRequestInput;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.PathComputationRequestInputBuilder;
 import org.opendaylight.transportpce.common.ResponseCodes;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.PathComputationRequestInput;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.PathComputationRequestInputBuilder;
@@ -24,6 +23,18 @@ 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.rev190531.configuration.response.common.ConfigurationResponseCommonBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.sdnc.request.header.SdncRequestHeaderBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.port.PortBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.configuration.response.common.ConfigurationResponseCommonBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.sdnc.request.header.SdncRequestHeaderBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.service.port.PortBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.CoRoutingBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.GeneralBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.general.DiversityBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.general.ExcludeBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.general.IncludeBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.general.LatencyBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.diversity.existing.service.constraints.ExistingServiceApplicability;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.diversity.existing.service.constraints.ExistingServiceApplicabilityBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.HardConstraints;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.HardConstraintsBuilder;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.SoftConstraints;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.SoftConstraintsBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev190531.ServiceFormat;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInput;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInputBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.format.rev190531.ServiceFormat;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInput;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInputBuilder;
@@ -31,21 +42,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.rev210705.path.description.AToZDirectionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.ZToADirection;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.ZToADirectionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.AToZDirectionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.ZToADirection;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.pathdescription.rev210705.path.description.ZToADirectionBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.CoRoutingBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.GeneralBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.general.DiversityBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.general.ExcludeBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.general.IncludeBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.general.LatencyBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.general.include_.OrderedHops;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.general.include_.OrderedHopsBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.diversity.existing.service.contraints.sp.ExistingServiceApplicability;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.diversity.existing.service.contraints.sp.ExistingServiceApplicabilityBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.ordered.constraints.sp.HopTypeBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing.constraints.sp.HardConstraints;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing.constraints.sp.HardConstraintsBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing.constraints.sp.SoftConstraints;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing.constraints.sp.SoftConstraintsBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.PceMetric;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.response.parameters.sp.ResponseParameters;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.response.parameters.sp.ResponseParametersBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.PceMetric;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.response.parameters.sp.ResponseParameters;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.response.parameters.sp.ResponseParametersBuilder;
@@ -55,7 +51,6 @@ import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.TxDirectionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.handler.header.ServiceHandlerHeader;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.handler.header.ServiceHandlerHeaderBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.TxDirectionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.handler.header.ServiceHandlerHeader;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.handler.header.ServiceHandlerHeaderBuilder;
-import org.opendaylight.yangtools.yang.common.Uint16;
 import org.opendaylight.yangtools.yang.common.Uint32;
 
 
 import org.opendaylight.yangtools.yang.common.Uint32;
 
 
@@ -156,16 +151,15 @@ public final class PceTestData {
             .setServiceName("service1")
             .setResourceReserve(true)
             .setPceRoutingMetric(PceMetric.HopCount)
             .setServiceName("service1")
             .setResourceReserve(true)
             .setPceRoutingMetric(PceMetric.HopCount)
-            .setLocallyProtectedLinks(true)
             .setServiceHandlerHeader(serviceHandlerHeader)
             .setServiceAEnd(serviceAEnd)
             .setServiceZEnd(serviceZEnd)
             .setHardConstraints(new HardConstraintsBuilder()
                     .setCustomerCode(Arrays.asList("Some customer-code"))
                     .setCoRoutingOrGeneral(new CoRoutingBuilder()
             .setServiceHandlerHeader(serviceHandlerHeader)
             .setServiceAEnd(serviceAEnd)
             .setServiceZEnd(serviceZEnd)
             .setHardConstraints(new HardConstraintsBuilder()
                     .setCustomerCode(Arrays.asList("Some customer-code"))
                     .setCoRoutingOrGeneral(new CoRoutingBuilder()
-                            .setCoRouting(new org.opendaylight.yang.gen.v1.http.org
-                                        .transportpce.b.c._interface.routing.constraints.rev220118
-                                        .constraints.sp.co.routing.or.general.co.routing.CoRoutingBuilder()
+                            .setCoRouting(
+                                new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329
+                                        .constraints.co.routing.or.general.co.routing.CoRoutingBuilder()
                                     .setExistingService(Arrays.asList("Some existing-service"))
                                     .build())
                             .build())
                                     .setExistingService(Arrays.asList("Some existing-service"))
                                     .build())
                             .build())
@@ -173,9 +167,9 @@ public final class PceTestData {
             .setSoftConstraints(new SoftConstraintsBuilder()
                     .setCustomerCode(Arrays.asList("Some customer-code"))
                     .setCoRoutingOrGeneral(new CoRoutingBuilder()
             .setSoftConstraints(new SoftConstraintsBuilder()
                     .setCustomerCode(Arrays.asList("Some customer-code"))
                     .setCoRoutingOrGeneral(new CoRoutingBuilder()
-                            .setCoRouting(new org.opendaylight.yang.gen.v1.http.org
-                                        .transportpce.b.c._interface.routing.constraints.rev220118
-                                        .constraints.sp.co.routing.or.general.co.routing.CoRoutingBuilder()
+                            .setCoRouting(
+                                new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329
+                                        .constraints.co.routing.or.general.co.routing.CoRoutingBuilder()
                                     .setExistingService(Arrays.asList("Some existing-service"))
                                     .build())
                             .build())
                                     .setExistingService(Arrays.asList("Some existing-service"))
                                     .build())
                             .build())
@@ -247,16 +241,15 @@ public final class PceTestData {
             .setServiceName("service1")
             .setResourceReserve(true)
             .setPceRoutingMetric(PceMetric.HopCount)
             .setServiceName("service1")
             .setResourceReserve(true)
             .setPceRoutingMetric(PceMetric.HopCount)
-            .setLocallyProtectedLinks(true)
             .setServiceHandlerHeader(serviceHandlerHeader)
             .setServiceAEnd(serviceAEnd)
             .setServiceZEnd(serviceZEnd)
             .setHardConstraints(new HardConstraintsBuilder()
                     .setCustomerCode(Arrays.asList("Some customer-code"))
                     .setCoRoutingOrGeneral(new CoRoutingBuilder()
             .setServiceHandlerHeader(serviceHandlerHeader)
             .setServiceAEnd(serviceAEnd)
             .setServiceZEnd(serviceZEnd)
             .setHardConstraints(new HardConstraintsBuilder()
                     .setCustomerCode(Arrays.asList("Some customer-code"))
                     .setCoRoutingOrGeneral(new CoRoutingBuilder()
-                            .setCoRouting(new org.opendaylight.yang.gen.v1.http.org
-                                        .transportpce.b.c._interface.routing.constraints.rev220118
-                                        .constraints.sp.co.routing.or.general.co.routing.CoRoutingBuilder()
+                            .setCoRouting(
+                                new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329
+                                        .constraints.co.routing.or.general.co.routing.CoRoutingBuilder()
                                     .setExistingService(Arrays.asList("Some existing-service"))
                                     .build())
                             .build())
                                     .setExistingService(Arrays.asList("Some existing-service"))
                                     .build())
                             .build())
@@ -264,9 +257,9 @@ public final class PceTestData {
             .setSoftConstraints(new SoftConstraintsBuilder()
                     .setCustomerCode(Arrays.asList("Some customer-code"))
                     .setCoRoutingOrGeneral(new CoRoutingBuilder()
             .setSoftConstraints(new SoftConstraintsBuilder()
                     .setCustomerCode(Arrays.asList("Some customer-code"))
                     .setCoRoutingOrGeneral(new CoRoutingBuilder()
-                            .setCoRouting(new org.opendaylight.yang.gen.v1.http.org
-                                        .transportpce.b.c._interface.routing.constraints.rev220118
-                                        .constraints.sp.co.routing.or.general.co.routing.CoRoutingBuilder()
+                            .setCoRouting(
+                                new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329
+                                        .constraints.co.routing.or.general.co.routing.CoRoutingBuilder()
                                     .setExistingService(Arrays.asList("Some existing-service"))
                                     .build())
                             .build())
                                     .setExistingService(Arrays.asList("Some existing-service"))
                                     .build())
                             .build())
@@ -338,16 +331,15 @@ public final class PceTestData {
             .setServiceName("service1")
             .setResourceReserve(true)
             .setPceRoutingMetric(PceMetric.HopCount)
             .setServiceName("service1")
             .setResourceReserve(true)
             .setPceRoutingMetric(PceMetric.HopCount)
-            .setLocallyProtectedLinks(true)
             .setServiceHandlerHeader(serviceHandlerHeader)
             .setServiceAEnd(serviceAEnd)
             .setServiceZEnd(serviceZEnd)
             .setHardConstraints(new HardConstraintsBuilder()
                     .setCustomerCode(Arrays.asList("Some customer-code"))
                     .setCoRoutingOrGeneral(new CoRoutingBuilder()
             .setServiceHandlerHeader(serviceHandlerHeader)
             .setServiceAEnd(serviceAEnd)
             .setServiceZEnd(serviceZEnd)
             .setHardConstraints(new HardConstraintsBuilder()
                     .setCustomerCode(Arrays.asList("Some customer-code"))
                     .setCoRoutingOrGeneral(new CoRoutingBuilder()
-                            .setCoRouting(new org.opendaylight.yang.gen.v1.http.org
-                                        .transportpce.b.c._interface.routing.constraints.rev220118
-                                        .constraints.sp.co.routing.or.general.co.routing.CoRoutingBuilder()
+                            .setCoRouting(
+                                new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329
+                                        .constraints.co.routing.or.general.co.routing.CoRoutingBuilder()
                                     .setExistingService(Arrays.asList("Some existing-service"))
                                     .build())
                             .build())
                                     .setExistingService(Arrays.asList("Some existing-service"))
                                     .build())
                             .build())
@@ -355,9 +347,9 @@ public final class PceTestData {
             .setSoftConstraints(new SoftConstraintsBuilder()
                     .setCustomerCode(Arrays.asList("Some customer-code"))
                     .setCoRoutingOrGeneral(new CoRoutingBuilder()
             .setSoftConstraints(new SoftConstraintsBuilder()
                     .setCustomerCode(Arrays.asList("Some customer-code"))
                     .setCoRoutingOrGeneral(new CoRoutingBuilder()
-                            .setCoRouting(new org.opendaylight.yang.gen.v1.http.org
-                                        .transportpce.b.c._interface.routing.constraints.rev220118
-                                        .constraints.sp.co.routing.or.general.co.routing.CoRoutingBuilder()
+                            .setCoRouting(
+                                new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329
+                                        .constraints.co.routing.or.general.co.routing.CoRoutingBuilder()
                                     .setExistingService(Arrays.asList("Some existing-service"))
                                     .build())
                             .build())
                                     .setExistingService(Arrays.asList("Some existing-service"))
                                     .build())
                             .build())
@@ -488,11 +480,6 @@ public final class PceTestData {
                 .setServiceRate(Uint32.valueOf(0))
                 .setNodeId("XPONDER-3-2")
                 .build();
                 .setServiceRate(Uint32.valueOf(0))
                 .setNodeId("XPONDER-3-2")
                 .build();
-        OrderedHops orderedHops = new OrderedHopsBuilder()
-                .setHopNumber(Uint16.valueOf(22))
-                .setHopType(new HopTypeBuilder()
-                        .setHopType(new HopTypeBuilder().getHopType()).build())
-                .build();
         return new PathComputationRequestInputBuilder()
             .setServiceHandlerHeader(serviceHandlerHeader)
             .setServiceName("service 1")
         return new PathComputationRequestInputBuilder()
             .setServiceHandlerHeader(serviceHandlerHeader)
             .setServiceName("service 1")
@@ -503,11 +490,11 @@ public final class PceTestData {
             .setHardConstraints(new HardConstraintsBuilder()
                     .setCoRoutingOrGeneral(new GeneralBuilder()
                             .setExclude(new ExcludeBuilder()
             .setHardConstraints(new HardConstraintsBuilder()
                     .setCoRoutingOrGeneral(new GeneralBuilder()
                             .setExclude(new ExcludeBuilder()
-                                    .setNodeId(Arrays.asList("OpenROADM-2-2"))
+                                    .setNodeId(Arrays.asList(new NodeIdType("OpenROADM-2-2")))
                                     .build())
                             .setLatency(new LatencyBuilder().setMaxLatency(Uint32.valueOf(3223)).build())
                             .setInclude(new IncludeBuilder()
                                     .build())
                             .setLatency(new LatencyBuilder().setMaxLatency(Uint32.valueOf(3223)).build())
                             .setInclude(new IncludeBuilder()
-                                    .setOrderedHops(Map.of(orderedHops.key(),orderedHops))
+                                    .setNodeId(Arrays.asList(new NodeIdType("XPONDER-1-2")))
                                     .build())
                             .build())
                     .build())
                                     .build())
                             .build())
                     .build())
@@ -582,7 +569,8 @@ public final class PceTestData {
             .setHardConstraints(new HardConstraintsBuilder()
                     .setCoRoutingOrGeneral(new GeneralBuilder()
                             .setExclude(new ExcludeBuilder()
             .setHardConstraints(new HardConstraintsBuilder()
                     .setCoRoutingOrGeneral(new GeneralBuilder()
                             .setExclude(new ExcludeBuilder()
-                                    .setNodeId(Arrays.asList("OpenROADM-2-1", "OpenROADM-2-2"))
+                                    .setNodeId(Arrays.asList(
+                                        new NodeIdType("OpenROADM-2-1"), new NodeIdType("OpenROADM-2-2")))
                                     .build())
                             .build())
                     .build())
                                     .build())
                             .build())
                     .build())
@@ -859,16 +847,15 @@ public final class PceTestData {
             .setServiceName("service1")
             .setResourceReserve(true)
             .setPceRoutingMetric(PceMetric.HopCount)
             .setServiceName("service1")
             .setResourceReserve(true)
             .setPceRoutingMetric(PceMetric.HopCount)
-            .setLocallyProtectedLinks(true)
             .setServiceHandlerHeader(serviceHandlerHeader)
             .setServiceAEnd(serviceAEnd)
             .setServiceZEnd(serviceZEnd)
             .setHardConstraints(new HardConstraintsBuilder()
                     .setCustomerCode(Arrays.asList("Some customer-code"))
                     .setCoRoutingOrGeneral(new CoRoutingBuilder()
             .setServiceHandlerHeader(serviceHandlerHeader)
             .setServiceAEnd(serviceAEnd)
             .setServiceZEnd(serviceZEnd)
             .setHardConstraints(new HardConstraintsBuilder()
                     .setCustomerCode(Arrays.asList("Some customer-code"))
                     .setCoRoutingOrGeneral(new CoRoutingBuilder()
-                            .setCoRouting(new org.opendaylight.yang.gen.v1.http.org
-                                        .transportpce.b.c._interface.routing.constraints.rev220118
-                                        .constraints.sp.co.routing.or.general.co.routing.CoRoutingBuilder()
+                            .setCoRouting(
+                                new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329
+                                        .constraints.co.routing.or.general.co.routing.CoRoutingBuilder()
                                     .setExistingService(Arrays.asList("Some existing-service"))
                                     .build())
                             .build())
                                     .setExistingService(Arrays.asList("Some existing-service"))
                                     .build())
                             .build())
@@ -876,9 +863,9 @@ public final class PceTestData {
             .setSoftConstraints(new SoftConstraintsBuilder()
                     .setCustomerCode(Arrays.asList("Some customer-code"))
                     .setCoRoutingOrGeneral(new CoRoutingBuilder()
             .setSoftConstraints(new SoftConstraintsBuilder()
                     .setCustomerCode(Arrays.asList("Some customer-code"))
                     .setCoRoutingOrGeneral(new CoRoutingBuilder()
-                            .setCoRouting(new org.opendaylight.yang.gen.v1.http.org
-                                        .transportpce.b.c._interface.routing.constraints.rev220118
-                                        .constraints.sp.co.routing.or.general.co.routing.CoRoutingBuilder()
+                            .setCoRouting(
+                                new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329
+                                        .constraints.co.routing.or.general.co.routing.CoRoutingBuilder()
                                     .setExistingService(Arrays.asList("Some existing-service"))
                                     .build())
                             .build())
                                     .setExistingService(Arrays.asList("Some existing-service"))
                                     .build())
                             .build())
diff --git a/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/MappingConstraints.java b/servicehandler/src/main/java/org/opendaylight/transportpce/servicehandler/MappingConstraints.java
deleted file mode 100644 (file)
index 4b561e3..0000000
+++ /dev/null
@@ -1,285 +0,0 @@
-/*
- * Copyright © 2017 Orange, Inc. 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
- */
-
-
-package org.opendaylight.transportpce.servicehandler;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.common.node.types.rev181130.NodeIdType;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.Constraints;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.CoRoutingOrGeneral;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.CoRouting;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.General;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.general.Diversity;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.general.Exclude;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.general.Include;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.general.Latency;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.HardConstraints;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.SoftConstraints;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.ConstraintsSp;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.co.routing.CoRoutingBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.general.DiversityBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.general.ExcludeBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.general.IncludeBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp.co.routing.or.general.general.LatencyBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.diversity.existing.service.contraints.sp.ExistingServiceApplicabilityBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing.constraints.sp.HardConstraintsBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing.constraints.sp.SoftConstraintsBuilder;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Class for mapping
- * Hard/soft constraint from Service 1.2
- * to servicePath 1.4.
- * @author Martial Coulibaly ( martial.coulibaly@gfi.com ) on behalf of Orange
- *
- */
-public class MappingConstraints {
-    /** Logging. */
-    private static final Logger LOG = LoggerFactory.getLogger(MappingConstraints.class);
-    private HardConstraints serviceHardConstraints;
-    private SoftConstraints serviceSoftConstraints;
-    private org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing
-        .constraints.sp.HardConstraints servicePathHardConstraints;
-    private org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing
-        .constraints.sp.SoftConstraints servicePathSoftConstraints;
-
-    /**
-     * MappingConstraints class constructor
-     * for hard/soft from service 1.2.
-     *
-     * @param hard HardConstraints
-     * @param soft SoftConstraints
-     */
-    public MappingConstraints(HardConstraints hard, SoftConstraints soft) {
-        setServiceHardConstraints(hard);
-        setServiceSoftConstraints(soft);
-    }
-
-    /**
-     * MappingConstraints class constructor
-     * for hard/soft from servicePath 1.4.
-     *
-     * @param hard HardConstraints
-     * @param soft SoftConstraints
-     */
-    public MappingConstraints(
-            org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing
-                .constraints.sp.HardConstraints hard,
-            org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing
-                .constraints.sp.SoftConstraints soft) {
-        setServicePathHardConstraints(hard);
-        setServicePathSoftConstraints(soft);
-    }
-
-    /**
-     *get all constraints informations
-     *from service constraints to map to
-     *servicePath constraints.
-     *
-     * @param input HardConstraints or SoftConstraints
-     * @return ConstraintsSp HardConstraintsSp or HardConstraintsSp
-     */
-    private <T> ConstraintsSp getConstraints(T input) {
-        HardConstraintsBuilder tempHard = new HardConstraintsBuilder();
-        SoftConstraintsBuilder tempSoft = new SoftConstraintsBuilder();
-        if ((input  !=  null) && (input instanceof Constraints)) {
-            updateConstraintBuilders(input, tempHard, tempSoft);
-        }
-        if (input instanceof HardConstraints) {
-            return tempHard.build();
-        } else if (input instanceof SoftConstraints) {
-            return tempSoft.build();
-        } else {
-            return null;
-        }
-    }
-
-    /**
-     * Update hardConstraintsBuilder and softConstraintsBuilder regarding input.
-     * @param <T> T
-     * @param input T
-     * @param hardConstraintsBuilder HardConstraintsBuilder
-     * @param softConstraintsBuilder SoftConstraintsBuilder
-     */
-    private <T> void updateConstraintBuilders(T input,
-            HardConstraintsBuilder hardConstraintsBuilder,
-            SoftConstraintsBuilder softConstraintsBuilder) {
-        Constraints constraints = (Constraints)input;
-        CoRoutingOrGeneral coRoutingOrGeneral = constraints.getCoRoutingOrGeneral();
-        if (coRoutingOrGeneral  !=  null) {
-            if (coRoutingOrGeneral instanceof General) {
-                updateConstraintBuilders4General(hardConstraintsBuilder, softConstraintsBuilder, constraints);
-            } else if (coRoutingOrGeneral instanceof CoRouting) {
-                updateConstraintBuilders4Corouting(hardConstraintsBuilder, softConstraintsBuilder, constraints);
-            }
-        }
-    }
-
-    /**
-     * Update hardConstraintsBuilder and softConstraintsBuilder for corouting constraints.
-     * @param hardConstraintsBuilder HardConstraintsBuilder
-     * @param softConstraintsBuilder SoftConstraintsBuilder
-     * @param constraints Constraints
-     */
-    private void updateConstraintBuilders4Corouting(HardConstraintsBuilder hardConstraintsBuilder,
-            SoftConstraintsBuilder softConstraintsBuilder, Constraints constraints) {
-        org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp
-            .co.routing.or.general.CoRoutingBuilder finalCoRouting =
-            new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118
-                .constraints.sp.co.routing.or.general.CoRoutingBuilder();
-        CoRouting tmpCoRouting = (CoRouting)constraints.getCoRoutingOrGeneral();
-        if (tmpCoRouting  !=  null) {
-            org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or
-                .general.co.routing.CoRouting tmpCoRoutingCoRouting = tmpCoRouting.getCoRouting();
-            if (tmpCoRoutingCoRouting  !=  null) {
-                finalCoRouting.setCoRouting(new CoRoutingBuilder()
-                    .setExistingService(tmpCoRoutingCoRouting.getExistingService())
-                    .build());
-            }
-        }
-        hardConstraintsBuilder
-            .setCoRoutingOrGeneral(finalCoRouting.build())
-            .setCustomerCode(constraints.getCustomerCode());
-        softConstraintsBuilder
-            .setCoRoutingOrGeneral(finalCoRouting.build())
-            .setCustomerCode(constraints.getCustomerCode());
-    }
-
-    /**
-     * Update hardConstraintsBuilder and softConstraintsBuilder for general constraints.
-     * @param hardConstraintsBuilder HardConstraintsBuilder
-     * @param softConstraintsBuilder SoftConstraintsBuilder
-     * @param constraints Constraints
-     */
-    private void updateConstraintBuilders4General(HardConstraintsBuilder hardConstraintsBuilder,
-            SoftConstraintsBuilder softConstraintsBuilder, Constraints constraints) {
-        org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.constraints.sp
-            .co.routing.or.general.GeneralBuilder finalGeneral =
-            new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118
-                .constraints.sp.co.routing.or.general.GeneralBuilder();
-        General tmpGeneral = (General) constraints.getCoRoutingOrGeneral();
-        if (tmpGeneral  !=  null) {
-            Diversity tmpDiversity =  tmpGeneral.getDiversity();
-            if (tmpDiversity  !=  null) {
-                finalGeneral.setDiversity(
-                        new DiversityBuilder()
-                        .setExistingService(tmpDiversity.getExistingService())
-                        .setExistingServiceApplicability(
-                                new ExistingServiceApplicabilityBuilder()
-                                .setClli(tmpDiversity.getExistingServiceApplicability().getSite())
-                                .setNode(tmpDiversity.getExistingServiceApplicability().getNode())
-                                .setSrlg(tmpDiversity.getExistingServiceApplicability().getSrlg())
-                                .build())
-                        .build());
-            }
-            Exclude tmpExclude = tmpGeneral.getExclude();
-            if (tmpExclude  !=  null) {
-                List<String> nodeIdList = new ArrayList<>();
-                for (NodeIdType nodeId : tmpExclude.getNodeId()) {
-                    nodeIdList.add(nodeId.getValue());
-                }
-                finalGeneral.setExclude(
-                        new ExcludeBuilder()
-                        .setSupportingServiceName(tmpExclude.getSupportingServiceName())
-                        .setClli(tmpExclude.getSite())
-                        .setNodeId(nodeIdList)
-                        .build());
-            }
-            Include tmpInclude = tmpGeneral.getInclude();
-            if (tmpInclude  !=  null) {
-                finalGeneral.setInclude(
-                        new IncludeBuilder()
-                        .build());
-            }
-            Latency tmpLatency = tmpGeneral.getLatency();
-            if (tmpLatency != null) {
-                finalGeneral.setLatency(
-                        new LatencyBuilder()
-                        .setMaxLatency(tmpLatency.getMaxLatency())
-                        .build());
-            }
-        }
-        hardConstraintsBuilder.setCoRoutingOrGeneral(finalGeneral.build())
-            .setCustomerCode(constraints.getCustomerCode());
-        softConstraintsBuilder.setCoRoutingOrGeneral(finalGeneral.build())
-            .setCustomerCode(constraints.getCustomerCode());
-    }
-
-    /**
-     * map hard/soft constraints from Service 1.2
-     * to ServicePath 1.4.
-     */
-    public void serviceToServicePathConstarints() {
-        LOG.info("Mapping Service Constraints to ServicePath Constraints");
-        if (serviceHardConstraints  !=  null) {
-            org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing
-                .constraints.sp.HardConstraints tempHard =
-                (org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing
-                    .constraints.sp.HardConstraints) getConstraints(serviceHardConstraints);
-            if (tempHard != null) {
-                servicePathHardConstraints = tempHard;
-            }
-        } else if (serviceSoftConstraints  !=  null) {
-            org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing
-                .constraints.sp.SoftConstraints tempSoft =
-                (org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing
-                    .constraints.sp.SoftConstraints) getConstraints(serviceSoftConstraints);
-            if (tempSoft != null) {
-                servicePathSoftConstraints = tempSoft;
-            }
-        }
-    }
-
-
-    public HardConstraints getServiceHardConstraints() {
-        return serviceHardConstraints;
-    }
-
-
-    public void setServiceHardConstraints(HardConstraints serviceHardConstraints) {
-        this.serviceHardConstraints = serviceHardConstraints;
-    }
-
-
-    public SoftConstraints getServiceSoftConstraints() {
-        return serviceSoftConstraints;
-    }
-
-
-    public void setServiceSoftConstraints(SoftConstraints serviceSoftConstraints) {
-        this.serviceSoftConstraints = serviceSoftConstraints;
-    }
-
-
-    public org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
-            .routing.constraints.rev220118.routing.constraints.sp.HardConstraints getServicePathHardConstraints() {
-        return servicePathHardConstraints;
-    }
-
-
-    public void setServicePathHardConstraints(org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
-            .routing.constraints.rev220118.routing.constraints.sp.HardConstraints servicePathHardConstraints) {
-        this.servicePathHardConstraints = servicePathHardConstraints;
-    }
-
-
-    public org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
-            .routing.constraints.rev220118.routing.constraints.sp.SoftConstraints getServicePathSoftConstraints() {
-        return servicePathSoftConstraints;
-    }
-
-
-    public void setServicePathSoftConstraints(org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface
-            .routing.constraints.rev220118.routing.constraints.sp.SoftConstraints servicePathSoftConstraints) {
-        this.servicePathSoftConstraints = servicePathSoftConstraints;
-    }
-
-}
index d7aea35dff9020a438fae618c7478ff7aa17279c..44d09f6b5261ef4214117258cf95ee953e29a37c 100644 (file)
@@ -73,8 +73,6 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempSer
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.Services;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.ServicesBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.ServicesKey;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.Services;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.ServicesBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.ServicesKey;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing.constraints.sp.HardConstraintsBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing.constraints.sp.SoftConstraintsBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.RxDirection;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.RxDirectionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.TxDirection;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.RxDirection;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.RxDirectionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.TxDirection;
@@ -497,20 +495,11 @@ public final class ModelMappingUtils {
                     .setPort(serviceInput.getServiceZEnd().getRxDirection().getPort()).build());
             servicePathBuilder.setServiceAEnd(serviceAEnd.build());
             servicePathBuilder.setServiceZEnd(serviceZEnd.build());
                     .setPort(serviceInput.getServiceZEnd().getRxDirection().getPort()).build());
             servicePathBuilder.setServiceAEnd(serviceAEnd.build());
             servicePathBuilder.setServiceZEnd(serviceZEnd.build());
-            MappingConstraints mapConstraints = new MappingConstraints(serviceInput.getHardConstraints(),
-                serviceInput.getSoftConstraints());
-            mapConstraints.serviceToServicePathConstarints();
-            if (mapConstraints.getServicePathHardConstraints() != null) {
-                HardConstraintsBuilder hardConstraintBuilder = new HardConstraintsBuilder()
-                    .setCustomerCode(serviceInput.getHardConstraints().getCustomerCode())
-                    .setCoRoutingOrGeneral(mapConstraints.getServicePathHardConstraints().getCoRoutingOrGeneral());
-                servicePathBuilder.setHardConstraints(hardConstraintBuilder.build());
+            if (serviceInput.getHardConstraints() != null) {
+                servicePathBuilder.setHardConstraints(serviceInput.getHardConstraints());
             }
             }
-            if (mapConstraints.getServicePathSoftConstraints() != null) {
-                SoftConstraintsBuilder softConstraintBuilder = new SoftConstraintsBuilder()
-                    .setCustomerCode(mapConstraints.getServicePathSoftConstraints().getCustomerCode())
-                    .setCoRoutingOrGeneral(mapConstraints.getServicePathSoftConstraints().getCoRoutingOrGeneral());
-                servicePathBuilder.setSoftConstraints(softConstraintBuilder.build());
+            if (serviceInput.getSoftConstraints() != null) {
+                servicePathBuilder.setSoftConstraints(serviceInput.getSoftConstraints());
             }
             servicePathBuilder.setServicePathName(serviceInput.getServiceName());
             servicePathBuilder.setServiceHandlerHeader(new ServiceHandlerHeaderBuilder()
             }
             servicePathBuilder.setServicePathName(serviceInput.getServiceName());
             servicePathBuilder.setServiceHandlerHeader(new ServiceHandlerHeaderBuilder()
index 04b71a9b227e23261274f68cc3d6785b6276945c..f5fed74d85ed8edf144fbd79241d56fc6f4e230e 100644 (file)
@@ -16,7 +16,6 @@ import java.util.concurrent.Executors;
 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
 import org.opendaylight.transportpce.common.ResponseCodes;
 import org.opendaylight.transportpce.pce.service.PathComputationService;
 import org.opendaylight.mdsal.binding.api.NotificationPublishService;
 import org.opendaylight.transportpce.common.ResponseCodes;
 import org.opendaylight.transportpce.pce.service.PathComputationService;
-import org.opendaylight.transportpce.servicehandler.MappingConstraints;
 import org.opendaylight.transportpce.servicehandler.ModelMappingUtils;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.CancelResourceReserveInput;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.CancelResourceReserveInputBuilder;
 import org.opendaylight.transportpce.servicehandler.ModelMappingUtils;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.CancelResourceReserveInput;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.CancelResourceReserveInputBuilder;
@@ -33,11 +32,11 @@ 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.rev190531.configuration.response.common.ConfigurationResponseCommon;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.configuration.response.common.ConfigurationResponseCommonBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.sdnc.request.header.SdncRequestHeader;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.configuration.response.common.ConfigurationResponseCommon;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.configuration.response.common.ConfigurationResponseCommonBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.common.service.types.rev190531.sdnc.request.header.SdncRequestHeader;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.HardConstraints;
+import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.SoftConstraints;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInput;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceFeasibilityCheckInput;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceCreateInput;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceCreateInput;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.ServiceFeasibilityCheckInput;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceCreateInput;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing.constraints.sp.HardConstraints;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing.constraints.sp.SoftConstraints;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.PceMetric;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.RpcStatusEx;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.response.parameters.sp.ResponseParameters;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.PceMetric;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.RpcStatusEx;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.response.parameters.sp.ResponseParameters;
@@ -106,13 +105,9 @@ public class PCEServiceWrapper {
         }
     }
 
         }
     }
 
-    private PathComputationRequestOutput performPCE(org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains
-            .rev190329.routing.constraints.HardConstraints hardConstraints, org.opendaylight.yang.gen.v1.http.org
-            .openroadm.routing.constrains.rev190329.routing.constraints.SoftConstraints softConstraints,
+    private PathComputationRequestOutput performPCE(HardConstraints hardConstraints, SoftConstraints softConstraints,
             String serviceName, SdncRequestHeader sdncRequestHeader, ServiceEndpoint serviceAEnd,
             ServiceEndpoint serviceZEnd, ServiceNotificationTypes notifType, boolean reserveResource) {
             String serviceName, SdncRequestHeader sdncRequestHeader, ServiceEndpoint serviceAEnd,
             ServiceEndpoint serviceZEnd, ServiceNotificationTypes notifType, boolean reserveResource) {
-        MappingConstraints mappingConstraints = new MappingConstraints(hardConstraints, softConstraints);
-        mappingConstraints.serviceToServicePathConstarints();
         LOG.info("Calling path computation.");
         notification = new ServiceRpcResultShBuilder().setNotificationType(notifType).setServiceName(serviceName)
                 .setStatus(RpcStatusEx.Pending)
         LOG.info("Calling path computation.");
         notification = new ServiceRpcResultShBuilder().setNotificationType(notifType).setServiceName(serviceName)
                 .setStatus(RpcStatusEx.Pending)
@@ -125,8 +120,7 @@ public class PCEServiceWrapper {
         FutureCallback<PathComputationRequestOutput> pceCallback =
                 new PathComputationRequestOutputCallback(notifType, serviceName);
         PathComputationRequestInput pathComputationRequestInput = createPceRequestInput(serviceName, sdncRequestHeader,
         FutureCallback<PathComputationRequestOutput> pceCallback =
                 new PathComputationRequestOutputCallback(notifType, serviceName);
         PathComputationRequestInput pathComputationRequestInput = createPceRequestInput(serviceName, sdncRequestHeader,
-                mappingConstraints.getServicePathHardConstraints(), mappingConstraints.getServicePathSoftConstraints(),
-                reserveResource, serviceAEnd, serviceZEnd);
+                hardConstraints, softConstraints, reserveResource, serviceAEnd, serviceZEnd);
         ListenableFuture<PathComputationRequestOutput> pce = this.pathComputationService
                 .pathComputationRequest(pathComputationRequestInput);
         Futures.addCallback(pce, pceCallback, executor);
         ListenableFuture<PathComputationRequestOutput> pce = this.pathComputationService
                 .pathComputationRequest(pathComputationRequestInput);
         Futures.addCallback(pce, pceCallback, executor);
index f3e033599eae5415749fc31a9987d363f6ebd70c..55533fb0e96c3b44a823eefb94f896303c999ad5 100644 (file)
@@ -362,7 +362,6 @@ public class ServiceDataStoreOperationsImpl implements ServiceDataStoreOperation
                     .setFiberSpanSrlgs(readServicePath.get().getFiberSpanSrlgs())
                     .setHardConstraints(readServicePath.get().getHardConstraints())
                     .setLatency(readServicePath.get().getLatency())
                     .setFiberSpanSrlgs(readServicePath.get().getFiberSpanSrlgs())
                     .setHardConstraints(readServicePath.get().getHardConstraints())
                     .setLatency(readServicePath.get().getLatency())
-                    .setLocallyProtectedLinks(readServicePath.get().getLocallyProtectedLinks())
                     .setPathDescription(pathDescription)
                     .setPceRoutingMetric(readServicePath.get().getPceRoutingMetric())
                     .setSoftConstraints(readServicePath.get().getSoftConstraints())
                     .setPathDescription(pathDescription)
                     .setPceRoutingMetric(readServicePath.get().getPceRoutingMetric())
                     .setSoftConstraints(readServicePath.get().getSoftConstraints())
diff --git a/servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/MappingConstraintsTest.java b/servicehandler/src/test/java/org/opendaylight/transportpce/servicehandler/MappingConstraintsTest.java
deleted file mode 100644 (file)
index dbec3e2..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-/*
- * Copyright © 2018 Orange, Inc. 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
- */
-package org.opendaylight.transportpce.servicehandler;
-
-import java.util.Arrays;
-import org.junit.Assert;
-import org.junit.Test;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.CoRoutingBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co.routing.or.general.GeneralBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.HardConstraints;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.HardConstraintsBuilder;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.SoftConstraints;
-import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.routing.constraints.SoftConstraintsBuilder;
-
-
-
-public class MappingConstraintsTest {
-
-    private HardConstraints buildHardConstraintWithCoRouting() {
-        return new HardConstraintsBuilder()
-            .setCoRoutingOrGeneral(new CoRoutingBuilder()
-                .setCoRouting(
-                    new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co
-                        .routing.or.general.co.routing.CoRoutingBuilder()
-                        .setExistingService(Arrays.asList("Some existing-service"))
-                        .build())
-                .build())
-            .setCustomerCode(Arrays.asList("Some customer-code"))
-            .build();
-    }
-
-    private HardConstraints buildHardConstraintWithGeneral() {
-        return new HardConstraintsBuilder()
-            .setCoRoutingOrGeneral(new GeneralBuilder().build())
-            .setCustomerCode(Arrays.asList("Some customer-code"))
-            .build();
-    }
-
-    private SoftConstraints buildSoftConstraintWithCoRouting() {
-        return new SoftConstraintsBuilder()
-            .setCoRoutingOrGeneral(new CoRoutingBuilder()
-                .setCoRouting(
-                    new org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constrains.rev190329.constraints.co
-                        .routing.or.general.co.routing.CoRoutingBuilder()
-                        .setExistingService(Arrays.asList("Some existing-service"))
-                        .build())
-                .build())
-            .setCustomerCode(Arrays.asList("Some customer-code"))
-            .build();
-    }
-
-    @Test
-    public void serviceToServicePathConstraintsNullHardConstraints() {
-        MappingConstraints mappingConstraints = new MappingConstraints(null, buildSoftConstraintWithCoRouting());
-        mappingConstraints.serviceToServicePathConstarints();
-        Assert.assertNull(mappingConstraints.getServiceHardConstraints());
-        Assert.assertNull(mappingConstraints.getServicePathHardConstraints());
-    }
-
-    @Test
-    public void serviceToServicePathConstraintsNullSoftConstraints() {
-        MappingConstraints mappingConstraints = new MappingConstraints(buildHardConstraintWithGeneral(), null);
-        mappingConstraints.serviceToServicePathConstarints();
-        Assert.assertNull(mappingConstraints.getServiceSoftConstraints());
-        Assert.assertNull(mappingConstraints.getServicePathSoftConstraints());
-    }
-
-    @Test
-    public void serviceToServicePathConstraintsNullSoftConstraintsGeneral() {
-        MappingConstraints mappingConstraints = new MappingConstraints(buildHardConstraintWithCoRouting(), null);
-        mappingConstraints.serviceToServicePathConstarints();
-        Assert.assertNull(mappingConstraints.getServiceSoftConstraints());
-        Assert.assertNull(mappingConstraints.getServicePathSoftConstraints());
-    }
-
-    @Test
-    public void serviceToServicePathConstraintsNullConstraints() {
-        MappingConstraints mappingConstraints =
-            new MappingConstraints(buildHardConstraintWithCoRouting(), buildSoftConstraintWithCoRouting());
-        mappingConstraints.setServiceHardConstraints(null);
-        mappingConstraints.setServiceSoftConstraints(null);
-        mappingConstraints.serviceToServicePathConstarints();
-        Assert.assertNull(mappingConstraints.getServiceHardConstraints());
-        Assert.assertNull(mappingConstraints.getServicePathHardConstraints());
-        Assert.assertNull(mappingConstraints.getServiceSoftConstraints());
-        Assert.assertNull(mappingConstraints.getServicePathSoftConstraints());
-    }
-
-    @Test
-    public void serviceToServicePathConstraintsNotNullConstraints() {
-        HardConstraints hardConstraints = buildHardConstraintWithCoRouting();
-        SoftConstraints softConstraints = buildSoftConstraintWithCoRouting();
-        MappingConstraints mappingConstraints = new MappingConstraints(hardConstraints, softConstraints);
-        mappingConstraints.serviceToServicePathConstarints();
-        Assert.assertEquals(hardConstraints.getCoRoutingOrGeneral(), mappingConstraints
-            .getServiceHardConstraints().getCoRoutingOrGeneral());
-        Assert.assertEquals(softConstraints, mappingConstraints.getServiceSoftConstraints());
-        Assert.assertNull(mappingConstraints.getServicePathSoftConstraints());
-    }
-
-    @Test
-    public void serviceToServicePathConstraintsParameterizedConstructor() {
-        MappingConstraints mappingConstraints = new MappingConstraints(
-            new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing
-                .constraints.sp.HardConstraintsBuilder()
-                .setCustomerCode(Arrays.asList("Some customer-code"))
-                .setCoRoutingOrGeneral(
-                    new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118
-                        .constraints.sp.co.routing.or.general.CoRoutingBuilder()
-                        .setCoRouting(
-                            new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints
-                                .rev220118.constraints.sp.co.routing.or.general.co.routing.CoRoutingBuilder()
-                                .setExistingService(Arrays.asList("Some existing-service"))
-                                .build())
-                        .build())
-                .build(),
-            new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing
-                .constraints.sp.SoftConstraintsBuilder()
-                .setCustomerCode(Arrays.asList("Some customer-code"))
-                .setCoRoutingOrGeneral(
-                    new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118
-                        .constraints.sp.co.routing.or.general.CoRoutingBuilder()
-                        .setCoRouting(
-                            new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints
-                                .rev220118.constraints.sp.co.routing.or.general.co.routing.CoRoutingBuilder()
-                                .setExistingService(Arrays.asList("Some existing-service"))
-                                .build())
-                        .build())
-                .build());
-
-        mappingConstraints.serviceToServicePathConstarints();
-        Assert.assertEquals(
-            new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118
-                .constraints.sp.co.routing.or.general.CoRoutingBuilder()
-                .setCoRouting(
-                    new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118
-                        .constraints.sp.co.routing.or.general.co.routing.CoRoutingBuilder()
-                        .setExistingService(Arrays.asList("Some existing-service"))
-                        .build())
-                .build(),
-            mappingConstraints.getServicePathHardConstraints().getCoRoutingOrGeneral());
-        Assert.assertEquals(
-            new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing
-                .constraints.sp.SoftConstraintsBuilder()
-                .setCustomerCode(Arrays.asList("Some customer-code"))
-                .setCoRoutingOrGeneral(
-                    new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118
-                        .constraints.sp.co.routing.or.general.CoRoutingBuilder()
-                        .setCoRouting(
-                            new org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints
-                                .rev220118.constraints.sp.co.routing.or.general.co.routing.CoRoutingBuilder()
-                                .setExistingService(Arrays.asList("Some existing-service"))
-                                .build())
-                        .build())
-                .build(),
-            mappingConstraints.getServicePathSoftConstraints());
-    }
-}
index 2194e2a359ec3b86b0f8cd9cd6aea34cc1a072e8..a5fa1fb37a3958a4b28068c306c42f04a0b4ba97 100644 (file)
@@ -8,7 +8,6 @@
 package org.opendaylight.transportpce.servicehandler.utils;
 
 import com.google.common.util.concurrent.ListenableFuture;
 package org.opendaylight.transportpce.servicehandler.utils;
 
 import com.google.common.util.concurrent.ListenableFuture;
-import org.opendaylight.transportpce.servicehandler.MappingConstraints;
 import org.opendaylight.transportpce.servicehandler.ServiceInput;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.PathComputationRequestOutput;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.path.computation.request.input.ServiceAEnd;
 import org.opendaylight.transportpce.servicehandler.ServiceInput;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.PathComputationRequestOutput;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.path.computation.request.input.ServiceAEnd;
@@ -45,8 +44,6 @@ import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempSer
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceDeleteOutputBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.Services;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.ServicesBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.TempServiceDeleteOutputBuilder;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.Services;
 import org.opendaylight.yang.gen.v1.http.org.openroadm.service.rev190531.service.list.ServicesBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing.constraints.sp.HardConstraintsBuilder;
-import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.routing.constraints.rev220118.routing.constraints.sp.SoftConstraintsBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.RxDirection;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.RxDirectionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.TxDirection;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.RxDirection;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.RxDirectionBuilder;
 import org.opendaylight.yang.gen.v1.http.org.transportpce.b.c._interface.service.types.rev220118.service.endpoint.sp.TxDirection;
@@ -325,22 +322,11 @@ public final class ModelMappingUtils {
                     .setPort(serviceInput.getServiceZEnd().getRxDirection().getPort()).build());
             servicePathBuilder.setServiceAEnd(serviceAEnd.build());
             servicePathBuilder.setServiceZEnd(serviceZEnd.build());
                     .setPort(serviceInput.getServiceZEnd().getRxDirection().getPort()).build());
             servicePathBuilder.setServiceAEnd(serviceAEnd.build());
             servicePathBuilder.setServiceZEnd(serviceZEnd.build());
-            MappingConstraints mapConstraints = new MappingConstraints(serviceInput.getHardConstraints(),
-                    serviceInput.getSoftConstraints());
-            mapConstraints.serviceToServicePathConstarints();
-            if (mapConstraints.getServicePathHardConstraints() != null) {
-                HardConstraintsBuilder hardConstraintBuilder = new HardConstraintsBuilder();
-                hardConstraintBuilder.setCustomerCode(serviceInput.getHardConstraints().getCustomerCode());
-                hardConstraintBuilder
-                        .setCoRoutingOrGeneral(mapConstraints.getServicePathHardConstraints().getCoRoutingOrGeneral());
-                servicePathBuilder.setHardConstraints(hardConstraintBuilder.build());
+            if (serviceInput.getHardConstraints() != null) {
+                servicePathBuilder.setHardConstraints(serviceInput.getHardConstraints());
             }
             }
-            if (mapConstraints.getServicePathSoftConstraints() != null) {
-                SoftConstraintsBuilder softConstraintBuilder = new SoftConstraintsBuilder();
-                softConstraintBuilder.setCustomerCode(mapConstraints.getServicePathSoftConstraints().getCustomerCode());
-                softConstraintBuilder
-                        .setCoRoutingOrGeneral(mapConstraints.getServicePathSoftConstraints().getCoRoutingOrGeneral());
-                servicePathBuilder.setSoftConstraints(softConstraintBuilder.build());
+            if (serviceInput.getSoftConstraints() != null) {
+                servicePathBuilder.setSoftConstraints(serviceInput.getSoftConstraints());
             }
             servicePathBuilder.setServicePathName(serviceInput.getServiceName());
             servicePathBuilder.setServiceHandlerHeader(new ServiceHandlerHeaderBuilder()
             }
             servicePathBuilder.setServicePathName(serviceInput.getServiceName());
             servicePathBuilder.setServiceHandlerHeader(new ServiceHandlerHeaderBuilder()
index 871d7933d619dffa3f19041f6e887ffb369aea29..863c6eac817d70109cb72dd8370bb8a2a0bbcc08 100644 (file)
@@ -15,7 +15,6 @@ import java.time.ZoneOffset;
 import java.time.format.DateTimeFormatter;
 import java.util.concurrent.Callable;
 import java.util.concurrent.Executors;
 import java.time.format.DateTimeFormatter;
 import java.util.concurrent.Callable;
 import java.util.concurrent.Executors;
-import org.opendaylight.transportpce.servicehandler.MappingConstraints;
 import org.opendaylight.transportpce.servicehandler.ModelMappingUtils;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.PathComputationRequestInput;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.PathComputationRequestInputBuilder;
 import org.opendaylight.transportpce.servicehandler.ModelMappingUtils;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.PathComputationRequestInput;
 import org.opendaylight.yang.gen.v1.http.org.opendaylight.transportpce.pce.rev220118.PathComputationRequestInputBuilder;
@@ -160,9 +159,6 @@ public final class ServiceDataUtils {
     }
 
     public static PathComputationRequestInput createPceRequestInput(ServiceCreateInput input) {
     }
 
     public static PathComputationRequestInput createPceRequestInput(ServiceCreateInput input) {
-        MappingConstraints mappingConstraints =
-                new MappingConstraints(input.getHardConstraints(), input.getSoftConstraints());
-        mappingConstraints.serviceToServicePathConstarints();
         ServiceHandlerHeaderBuilder serviceHandlerHeader = new ServiceHandlerHeaderBuilder();
         SdncRequestHeader serviceHandler = input.getSdncRequestHeader();
         if (serviceHandler != null) {
         ServiceHandlerHeaderBuilder serviceHandlerHeader = new ServiceHandlerHeaderBuilder();
         SdncRequestHeader serviceHandler = input.getSdncRequestHeader();
         if (serviceHandler != null) {
@@ -172,8 +168,8 @@ public final class ServiceDataUtils {
             .setServiceName(input.getServiceName())
             .setResourceReserve(true)
             .setServiceHandlerHeader(serviceHandlerHeader.build())
             .setServiceName(input.getServiceName())
             .setResourceReserve(true)
             .setServiceHandlerHeader(serviceHandlerHeader.build())
-            .setHardConstraints(mappingConstraints.getServicePathHardConstraints())
-            .setSoftConstraints(mappingConstraints.getServicePathSoftConstraints())
+            .setHardConstraints(input.getHardConstraints())
+            .setSoftConstraints(input.getSoftConstraints())
             .setPceRoutingMetric(PceMetric.TEMetric)
             .setServiceAEnd(ModelMappingUtils.createServiceAEnd(input.getServiceAEnd()))
             .setServiceZEnd(ModelMappingUtils.createServiceZEnd(input.getServiceZEnd()))
             .setPceRoutingMetric(PceMetric.TEMetric)
             .setServiceAEnd(ModelMappingUtils.createServiceAEnd(input.getServiceAEnd()))
             .setServiceZEnd(ModelMappingUtils.createServiceZEnd(input.getServiceZEnd()))
index 8e8ad6713b73a0775445a6ea38c15319577d29ee..d31f79588d1bd4061514eb4c023494aa00e01dac 100644 (file)
@@ -264,8 +264,7 @@ class TransportPCEtesting(unittest.TestCase):
                                                         },
                                                        {"customer-code": ["Some customer-code"],
                                                            "co-routing": {"existing-service": ["Some existing-service"]}
                                                         },
                                                        {"customer-code": ["Some customer-code"],
                                                            "co-routing": {"existing-service": ["Some existing-service"]}
-                                                        },
-                                                       "hop-count", {"locally-protected-links": "true"})
+                                                        }, "hop-count")
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
         self.assertIn('Path is calculated',
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
         self.assertIn('Path is calculated',
@@ -296,7 +295,7 @@ class TransportPCEtesting(unittest.TestCase):
                                                            "node-id": "XPONDER-1-2", "clli": "ORANGE1"},
                                                        {"service-rate": "100", "service-format": "Ethernet",
                                                            "node-id": "XPONDER-3-2", "clli": "ORANGE3"},
                                                            "node-id": "XPONDER-1-2", "clli": "ORANGE1"},
                                                        {"service-rate": "100", "service-format": "Ethernet",
                                                            "node-id": "XPONDER-3-2", "clli": "ORANGE3"},
-                                                       {"exclude_": {"node-id": ["OpenROADM-2-1", "OpenROADM-2-2"]}})
+                                                       {"exclude": {"node-id": ["OpenROADM-2-1", "OpenROADM-2-2"]}})
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
         self.assertIn('Path is calculated',
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
         self.assertIn('Path is calculated',
index cd2d8ceb39f59b4e36147f4926c7f11916bd31b0..5a72ca754511491e8bdc79a984b6e85d4904a4ad 100644 (file)
@@ -141,11 +141,8 @@ class TransportGNPYtesting(unittest.TestCase):
                                                            "service-format": "Ethernet", "clli": "Node1"},
                                                        {"node-id": "XPONDER-5", "service-rate": "100",
                                                            "service-format": "Ethernet", "clli": "Node5"},
                                                            "service-format": "Ethernet", "clli": "Node1"},
                                                        {"node-id": "XPONDER-5", "service-rate": "100",
                                                            "service-format": "Ethernet", "clli": "Node5"},
-                                                       {"include_": {"ordered-hops": [
-                                                           {"hop-number": "0", "hop-type": {"node-id": "OpenROADM-2"}},
-                                                           {"hop-number": "1", "hop-type": {"node-id": "OpenROADM-3"}},
-                                                           {"hop-number": "2", "hop-type": {"node-id": "OpenROADM-4"}}]}
-                                                        })
+                                                       {"include": {"node-id": [
+                                                           "OpenROADM-2", "OpenROADM-3", "OpenROADM-4"]}})
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
         self.assertEqual(res['output']['configuration-response-common'][
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
         self.assertEqual(res['output']['configuration-response-common'][
@@ -172,10 +169,8 @@ class TransportGNPYtesting(unittest.TestCase):
                                                            "service-format": "Ethernet", "clli": "Node1"},
                                                        {"node-id": "XPONDER-4", "service-rate": "100",
                                                            "service-format": "Ethernet", "clli": "Node5"},
                                                            "service-format": "Ethernet", "clli": "Node1"},
                                                        {"node-id": "XPONDER-4", "service-rate": "100",
                                                            "service-format": "Ethernet", "clli": "Node5"},
-                                                       {"include_": {"ordered-hops": [
-                                                           {"hop-number": "0", "hop-type": {"node-id": "OpenROADM-2"}},
-                                                           {"hop-number": "1", "hop-type": {"node-id": "OpenROADM-3"}}]}
-                                                        })
+                                                       {"include": {"node-id": [
+                                                           "OpenROADM-2", "OpenROADM-3"]}})
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
         self.assertEqual(res['output']['configuration-response-common'][
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
         self.assertEqual(res['output']['configuration-response-common'][
@@ -200,11 +195,9 @@ class TransportGNPYtesting(unittest.TestCase):
                                                            "service-format": "Ethernet", "clli": "Node1"},
                                                        {"node-id": "XPONDER-4", "service-rate": "400",
                                                            "service-format": "Ethernet", "clli": "Node4"},
                                                            "service-format": "Ethernet", "clli": "Node1"},
                                                        {"node-id": "XPONDER-4", "service-rate": "400",
                                                            "service-format": "Ethernet", "clli": "Node4"},
-                                                       {"include_": {"ordered-hops": [
-                                                           {"hop-number": "0", "hop-type": {"node-id": "OpenROADM-3"}},
-                                                           {"hop-number": "1", "hop-type": {"node-id": "OpenROADM-2"}},
-                                                           {"hop-number": "2", "hop-type": {"node-id": "OpenROADM-5"}}]}
-                                                        })
+                                                       {"include": {"node-id": [
+                                                           "OpenROADM-3", "OpenROADM-2",
+                                                           "OpenROADM-5"]}})
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
         self.assertEqual(res['output']['configuration-response-common'][
         self.assertEqual(response.status_code, requests.codes.ok)
         res = response.json()
         self.assertEqual(res['output']['configuration-response-common'][