Search in sources :

Example 1 with SrlgSubobject

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgSubobject in project bgpcep by opendaylight.

the class XROSRLGSubobjectParser method serializeSubobject.

@Override
public void serializeSubobject(final Subobject subobject, final ByteBuf buffer) {
    Preconditions.checkArgument(subobject.getSubobjectType() instanceof SrlgCase, "Unknown subobject instance. Passed %s. Needed SrlgCase.", subobject.getSubobjectType().getClass());
    final SrlgSubobject specObj = ((SrlgCase) subobject.getSubobjectType()).getSrlg();
    final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH);
    Preconditions.checkArgument(specObj.getSrlgId() != null, "SrlgId is mandatory.");
    writeUnsignedInt(specObj.getSrlgId().getValue(), body);
    Preconditions.checkArgument(subobject.getAttribute() != null, "Attribute is mandatory.");
    writeUnsignedByte(null, body);
    writeUnsignedByte((short) subobject.getAttribute().getIntValue(), body);
    XROSubobjectUtil.formatSubobject(TYPE, subobject.isMandatory(), body, buffer);
}
Also used : SrlgCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.SrlgCase) ByteBuf(io.netty.buffer.ByteBuf) SrlgSubobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgSubobject)

Example 2 with SrlgSubobject

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgSubobject in project bgpcep by opendaylight.

the class XROSrlgSubobjectParser method serializeSubobject.

@Override
public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
    Preconditions.checkArgument(subobject.getSubobjectType() instanceof SrlgCase, "Unknown subobject instance. Passed %s. Needed SrlgCase.", subobject.getSubobjectType().getClass());
    final SrlgSubobject specObj = ((SrlgCase) subobject.getSubobjectType()).getSrlg();
    final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH);
    Preconditions.checkArgument(specObj.getSrlgId() != null, "SrlgId is mandatory.");
    writeUnsignedInt(specObj.getSrlgId().getValue(), body);
    Preconditions.checkArgument(subobject.getAttribute() != null, "Attribute is mandatory.");
    writeUnsignedByte(null, body);
    writeUnsignedByte((short) subobject.getAttribute().getIntValue(), body);
    XROSubobjectUtil.formatSubobject(TYPE, subobject.isMandatory(), body, buffer);
}
Also used : SrlgCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.SrlgCase) ByteBuf(io.netty.buffer.ByteBuf) SrlgSubobject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgSubobject)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)2 SrlgSubobject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgSubobject)2 SrlgCase (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.SrlgCase)2