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
9 package org.opendaylight.protocol.pcep.segment.routing02;
11 import org.opendaylight.protocol.pcep.spi.PCEPErrors;
12 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.lsp.setup.type._01.rev140507.PathSetupTypeTlv;
13 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.segment.routing._02.rev140506.SrEroSubobject;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.Ero;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.explicit.route.object.ero.Subobject;
17 public final class SrEroUtil {
19 private static final int MPLS_LABEL_MIN_VALUE = 16;
24 protected static PCEPErrors validateSrEroSubobjects(final Ero ero) {
25 if (ero.getSubobject() == null || ero.getSubobject().isEmpty()) {
28 for (final Subobject subobject : ero.getSubobject()) {
29 if (!(subobject.getSubobjectType() instanceof SrEroSubobject)) {
30 return PCEPErrors.NON_IDENTICAL_ERO_SUBOBJECTS;
32 final SrEroSubobject srEroSubobject = (SrEroSubobject) subobject.getSubobjectType();
33 if (srEroSubobject.getFlags().isM() && srEroSubobject.getSid() < MPLS_LABEL_MIN_VALUE) {
34 return PCEPErrors.BAD_LABEL_VALUE;
40 protected static boolean isPst(final PathSetupTypeTlv tlv) {
41 if (tlv != null && tlv.getPathSetupType() != null && tlv.getPathSetupType().isPst()) {