use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.SubobjectType in project bgpcep by opendaylight.
the class SrRroSubobjectParser method serializeSubobject.
@Override
public void serializeSubobject(Subobject subobject, ByteBuf buffer) {
final SubobjectType subobjType = subobject.getSubobjectType();
checkArgument(subobjType instanceof SrSubobject, "Unknown subobject instance. Passed %s. Needed SrSubobject.", subobjType.getClass());
final SrSubobject srSubobject = (SrSubobject) subobjType;
final ByteBuf body = serializeSubobject(srSubobject);
RROSubobjectUtil.formatSubobject(this.type, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.SubobjectType in project bgpcep by opendaylight.
the class RROUnnumberedInterfaceSubobjectParser method serializeSubobject.
@Override
public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
final SubobjectType type = subobject.getSubobjectType();
checkArgument(type instanceof UnnumberedCase, "Unknown subobject instance. Passed %s. Needed UnnumberedCase.", type.getClass());
final BitArray flags = new BitArray(FLAGS_SIZE);
flags.set(LPA_F_OFFSET, subobject.getProtectionAvailable());
flags.set(LPIU_F_OFFSET, subobject.getProtectionInUse());
final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH);
flags.toByteBuf(body);
body.writeZero(RESERVED);
final UnnumberedSubobject specObj = ((UnnumberedCase) type).getUnnumbered();
ByteBufUtils.writeMandatory(body, specObj.getRouterId(), "RouterId");
ByteBufUtils.writeMandatory(body, specObj.getInterfaceId(), "InterfaceId");
RROSubobjectUtil.formatSubobject(TYPE, body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.SubobjectType in project bgpcep by opendaylight.
the class XROIpv4PrefixSubobjectParser method serializeSubobject.
@Override
public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
final SubobjectType type = subobject.getSubobjectType();
checkArgument(type instanceof IpPrefixCase, "Unknown subobject instance. Passed %s. Needed IpPrefixCase.", type.getClass());
final IpPrefixSubobject specObj = ((IpPrefixCase) type).getIpPrefix();
final IpPrefix prefix = specObj.getIpPrefix();
final Ipv6Prefix ipv6Prefix = prefix.getIpv6Prefix();
if (ipv6Prefix != null) {
XROIpv6PrefixSubobjectParser.serializeSubobject(buffer, subobject, ipv6Prefix);
return;
}
final ByteBuf body = Unpooled.buffer(CONTENT4_LENGTH);
checkArgument(prefix.getIpv4Prefix() != null, "Ipv4Prefix is mandatory.");
Ipv4Util.writeIpv4Prefix(prefix.getIpv4Prefix(), body);
final Attribute attribute = subobject.getAttribute();
checkArgument(attribute != null, "Attribute is mandatory.");
body.writeByte(attribute.getIntValue());
XROSubobjectUtil.formatSubobject(TYPE, subobject.getMandatory(), body, buffer);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.SubobjectType in project bgpcep by opendaylight.
the class XROIpv6PrefixSubobjectParser method serializeSubobject.
@Override
public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
final SubobjectType type = subobject.getSubobjectType();
checkArgument(type instanceof IpPrefixCase, "Unknown subobject instance. Passed %s. Needed IpPrefixCase.", type.getClass());
final IpPrefixSubobject specObj = ((IpPrefixCase) type).getIpPrefix();
final Ipv6Prefix ipv6Prefix = specObj.getIpPrefix().getIpv6Prefix();
checkArgument(ipv6Prefix != null, "Ipv6Prefix is mandatory.");
serializeSubobject(buffer, subobject, ipv6Prefix);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.SubobjectType in project bgpcep by opendaylight.
the class XROSrlgSubobjectParser method serializeSubobject.
@Override
public void serializeSubobject(final SubobjectContainer subobject, final ByteBuf buffer) {
final SubobjectType type = subobject.getSubobjectType();
checkArgument(type instanceof SrlgCase, "Unknown subobject instance. Passed %s. Needed SrlgCase.", type.getClass());
final SrlgSubobject specObj = ((SrlgCase) type).getSrlg();
final ByteBuf body = Unpooled.buffer(CONTENT_LENGTH);
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.getMandatory(), body, buffer);
}
Aggregations