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;
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 {
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;
}
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
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;
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
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 {
+++ /dev/null
-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";
- }
- }
- }
- }
- }
-}
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.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;
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 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.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.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.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);
- private static final Comparator<OrderedHops> ORDERED_HOP_COMPARATOR =
- Comparator.comparing(OrderedHops::getHopNumber);
private PceConstraints pceHardConstraints = new PceConstraints();
private PceConstraints pceSoftConstraints = new PceConstraints();
}
Exclude exclude = tmpGeneral.getExclude();
- List<String> elementsToExclude = 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) {
- 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();
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);
}
+ }
+ 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));
}
}
}
LOG.info("in readDiversity srv={} is not present", srv);
}
}
-
}
private List<String> getAToZNodeList(PathDescription pathDescription) {
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.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;
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)) {
- 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;
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.routing.constraints.rev220118.routing.constraints.sp.HardConstraints;
import org.opendaylight.yangtools.yang.common.Uint32;
/**
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());
new PceConstraintsCalc(PceTestData.getEmptyPCERequestServiceNameWithRequestId(), networkTransactionService);
}
- @Test(expected = Exception.class)
+ @Test()
public void testHardConstrainsExists4() {
new PceConstraintsCalc(PceTestData.getPCE_test2_request_54(), networkTransactionService);
}
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.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.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.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;
.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()
- .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())
.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())
.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()
- .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())
.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())
.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()
- .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())
.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())
.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")
.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()
- .setOrderedHops(Map.of(orderedHops.key(),orderedHops))
+ .setNodeId(Arrays.asList(new NodeIdType("XPONDER-1-2")))
.build())
.build())
.build())
.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())
.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()
- .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())
.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())
+++ /dev/null
-/*
- * 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;
- }
-
-}
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;
.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()
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.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.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;
}
}
- 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) {
- MappingConstraints mappingConstraints = new MappingConstraints(hardConstraints, softConstraints);
- mappingConstraints.serviceToServicePathConstarints();
LOG.info("Calling path computation.");
notification = new ServiceRpcResultShBuilder().setNotificationType(notifType).setServiceName(serviceName)
.setStatus(RpcStatusEx.Pending)
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);
.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())
+++ /dev/null
-/*
- * 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());
- }
-}
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.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;
.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()
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;
}
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) {
.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()))
},
{"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',
"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',
"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'][
"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'][
"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'][