2 * Copyright (c) 2013 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.ietf.stateful07;
10 import io.netty.buffer.ByteBuf;
12 import org.opendaylight.protocol.pcep.impl.object.PCEPLspaObjectParser;
13 import org.opendaylight.protocol.pcep.spi.TlvRegistry;
14 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.Tlvs2;
15 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.Tlvs2Builder;
16 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.ietf.stateful.rev131222.symbolic.path.name.tlv.SymbolicPathName;
17 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Tlv;
18 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lspa.object.lspa.Tlvs;
19 import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.lspa.object.lspa.TlvsBuilder;
22 * Parser for Lspa object
24 public class Stateful07LspaObjectParser extends PCEPLspaObjectParser {
26 public Stateful07LspaObjectParser(final TlvRegistry tlvReg) {
31 public void addTlv(final TlvsBuilder tbuilder, final Tlv tlv) {
32 super.addTlv(tbuilder, tlv);
33 final Tlvs2Builder nameBuilder = new Tlvs2Builder();
34 if (tbuilder.getAugmentation(Tlvs2.class) != null) {
35 final Tlvs2 t = tbuilder.getAugmentation(Tlvs2.class);
36 if (t.getSymbolicPathName() != null) {
37 nameBuilder.setSymbolicPathName(t.getSymbolicPathName());
40 if (tlv instanceof SymbolicPathName) {
41 nameBuilder.setSymbolicPathName((SymbolicPathName) tlv);
43 tbuilder.addAugmentation(Tlvs2.class, nameBuilder.build());
47 public void serializeTlvs(final Tlvs tlvs, final ByteBuf body) {
51 super.serializeTlvs(tlvs, body);
52 if (tlvs.getAugmentation(Tlvs2.class) != null) {
53 final Tlvs2 nameTlvs = tlvs.getAugmentation(Tlvs2.class);
54 if (nameTlvs.getSymbolicPathName() != null) {
55 serializeTlv(nameTlvs.getSymbolicPathName(), body);