2 * Copyright (c) 2014 Cisco Systems, 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.protocol.pcep.segment.routing;
10 import org.opendaylight.protocol.pcep.spi.PCEPErrors;
11 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.srp.object.Srp;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing.rev150112.SrEroSubobject;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.Ero;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.Subobject;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.path.setup.type.tlv.PathSetupType;
17 public final class SrEroUtil {
19 private static final int MPLS_LABEL_MIN_VALUE = 16;
22 throw new UnsupportedOperationException();
25 protected static PCEPErrors validateSrEroSubobjects(final Ero ero) {
26 if (ero.getSubobject() != null) {
27 for (final Subobject subobject : ero.getSubobject()) {
28 if (!(subobject.getSubobjectType() instanceof SrEroSubobject)) {
29 return PCEPErrors.NON_IDENTICAL_ERO_SUBOBJECTS;
31 final SrEroSubobject srEroSubobject = (SrEroSubobject) subobject.getSubobjectType();
32 if (srEroSubobject.isMFlag() != null && srEroSubobject.isMFlag() && srEroSubobject.getSid() < MPLS_LABEL_MIN_VALUE) {
33 return PCEPErrors.BAD_LABEL_VALUE;
40 protected static boolean isSegmentRoutingPath(final Srp srp) {
41 if (srp != null && srp.getTlvs() != null && isSrTePst(srp.getTlvs().getPathSetupType())) {
47 private static boolean isSrTePst(final PathSetupType tlv) {
48 if (tlv != null && tlv.getPst() == 1) {