2 * Copyright © 2018 Orange, Inc. and others. All rights reserved.
4 * This program and the accompanying materials are made available under the
5 * terms of the Eclipse Public License v1.0 which accompanies this distribution,
6 * and is available at http://www.eclipse.org/legal/epl-v10.html
8 package org.opendaylight.transportpce.servicehandler.utils;
10 import java.util.ArrayList;
11 import java.util.Collections;
13 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.CoRoutingBuilder;
14 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.co.routing.ServiceIdentifierList;
15 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.constraints.co.routing.ServiceIdentifierListBuilder;
16 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.equipment.EquipmentBuilder;
17 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.HardConstraints;
18 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.HardConstraintsBuilder;
19 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.SoftConstraints;
20 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.routing.constraints.SoftConstraintsBuilder;
21 import org.opendaylight.yang.gen.v1.http.org.openroadm.routing.constraints.rev211210.service.applicability.g.ServiceApplicabilityBuilder;
24 * Utility Class to Build Hard Constraints and Soft Constraints.
26 * @author Ahmed Helmy ( ahmad.helmy@orange.com )
29 public final class ConstraintsUtils {
31 private ConstraintsUtils() {
35 public static SoftConstraints buildSoftConstraintWithCoRouting() {
36 ServiceIdentifierList sil = new ServiceIdentifierListBuilder()
37 .setServiceIdentifier("service-id-soft")
38 .setServiceApplicability(new ServiceApplicabilityBuilder()
39 .setEquipment(new EquipmentBuilder()
44 return new SoftConstraintsBuilder()
45 .setCustomerCode(new ArrayList<>(Collections.singletonList("customer-code 1")))
46 .setCoRouting(new CoRoutingBuilder()
47 .setServiceIdentifierList(Map.of(sil.key(), sil))
52 public static HardConstraints buildHardConstraintWithCoRouting() {
53 ServiceIdentifierList sil = new ServiceIdentifierListBuilder()
54 .setServiceIdentifier("service-id-hard")
55 .setServiceApplicability(new ServiceApplicabilityBuilder()
56 .setEquipment(new EquipmentBuilder()
61 return new HardConstraintsBuilder()
62 .setCustomerCode(new ArrayList<>(Collections.singletonList("customer-code 1")))
63 .setCoRouting(new CoRoutingBuilder()
64 .setServiceIdentifierList(Map.of(sil.key(), sil))