X-Git-Url: https://git.opendaylight.org/gerrit/gitweb?a=blobdiff_plain;f=pcep%2Fbase-parser%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fprotocol%2Fpcep%2Fparser%2Fsubobject%2FXROSrlgSubobjectParser.java;fp=pcep%2Fbase-parser%2Fsrc%2Fmain%2Fjava%2Forg%2Fopendaylight%2Fprotocol%2Fpcep%2Fparser%2Fsubobject%2FXROSrlgSubobjectParser.java;h=8f65a808a58250103710fbe6e3f7929116789dfc;hb=59bd8a58570b93fef65340808e37cab3c6fced8c;hp=7787de14cf01f42b18999995ca15af6f6f34932e;hpb=3b658310b793d4882ce59198a6d2563ce6ba114d;p=bgpcep.git diff --git a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROSrlgSubobjectParser.java b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROSrlgSubobjectParser.java index 7787de14cf..8f65a808a5 100644 --- a/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROSrlgSubobjectParser.java +++ b/pcep/base-parser/src/main/java/org/opendaylight/protocol/pcep/parser/subobject/XROSrlgSubobjectParser.java @@ -8,8 +8,6 @@ package org.opendaylight.protocol.pcep.parser.subobject; import static com.google.common.base.Preconditions.checkArgument; -import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeUnsignedByte; -import static org.opendaylight.protocol.util.ByteBufWriteUtil.writeUnsignedInt; import io.netty.buffer.ByteBuf; import io.netty.buffer.Unpooled; @@ -20,12 +18,12 @@ import org.opendaylight.protocol.pcep.spi.XROSubobjectUtil; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.exclude.route.object.xro.Subobject; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev181109.exclude.route.object.xro.SubobjectBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ExcludeRouteSubobjects; +import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.ExcludeRouteSubobjects.Attribute; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgId; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgSubobject; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.SrlgCase; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.SrlgCaseBuilder; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.srlg._case.SrlgBuilder; -import org.opendaylight.yangtools.yang.common.Uint8; import org.opendaylight.yangtools.yang.common.netty.ByteBufUtils; /** @@ -61,11 +59,15 @@ public class XROSrlgSubobjectParser implements XROSubobjectParser, XROSubobjectS "Unknown subobject instance. Passed %s. Needed SrlgCase.", subobject.getSubobjectType().getClass()); final SrlgSubobject specObj = ((SrlgCase) subobject.getSubobjectType()).getSrlg(); final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH); - checkArgument(specObj.getSrlgId() != null, "SrlgId is mandatory."); - writeUnsignedInt(specObj.getSrlgId().getValue(), body); - checkArgument(subobject.getAttribute() != null, "Attribute is mandatory."); - writeUnsignedByte((Uint8) null, body); - writeUnsignedByte(Uint8.valueOf(subobject.getAttribute().getIntValue()), body); + + final SrlgId srlgId = specObj.getSrlgId(); + checkArgument(srlgId != null, "SrlgId is mandatory."); + ByteBufUtils.write(body, srlgId.getValue()); + + final Attribute attribute = subobject.getAttribute(); + checkArgument(attribute != null, "Attribute is mandatory."); + body.writeByte(0); + body.writeByte(attribute.getIntValue()); XROSubobjectUtil.formatSubobject(TYPE, subobject.isMandatory(), body, buffer); } }