use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.session.attribute.object.SessionAttributeObject in project bgpcep by opendaylight.
the class TeLspAttributesParser method serializeLspAttributes.
static void serializeLspAttributes(final RSVPTeObjectRegistry registry, final TeLspAttributesCase linkState, final ByteBuf output) {
LOG.trace("Started serializing TE LSP Objects");
final ByteBuf byteBuf = Unpooled.buffer();
final TeLspAttributes teLspAttribute = linkState.getTeLspAttributes();
final TspecObject tSpec = teLspAttribute.getTspecObject();
registry.serializeRSPVTe(tSpec, byteBuf);
final FlowSpecObject flow = teLspAttribute.getFlowSpecObject();
registry.serializeRSPVTe(flow, byteBuf);
final SessionAttributeObject sao = teLspAttribute.getSessionAttributeObject();
if (sao instanceof BasicSessionAttributeObject) {
registry.serializeRSPVTe((BasicSessionAttributeObject) sao, byteBuf);
} else if (sao instanceof SessionAttributeObjectWithResourcesAffinities) {
registry.serializeRSPVTe((SessionAttributeObjectWithResourcesAffinities) sao, byteBuf);
}
final ExplicitRouteObject ero = teLspAttribute.getExplicitRouteObject();
registry.serializeRSPVTe(ero, byteBuf);
final RecordRouteObject rro = teLspAttribute.getRecordRouteObject();
registry.serializeRSPVTe(rro, byteBuf);
final FastRerouteObject fro = teLspAttribute.getFastRerouteObject();
if (fro instanceof BasicFastRerouteObject) {
registry.serializeRSPVTe((BasicFastRerouteObject) fro, byteBuf);
} else if (fro instanceof LegacyFastRerouteObject) {
registry.serializeRSPVTe((LegacyFastRerouteObject) fro, byteBuf);
}
final DetourObject dto = teLspAttribute.getDetourObject();
if (dto instanceof Ipv4DetourObject) {
registry.serializeRSPVTe((Ipv4DetourObject) dto, byteBuf);
} else if (dto instanceof Ipv6DetourObject) {
registry.serializeRSPVTe((Ipv6DetourObject) dto, byteBuf);
}
final ExcludeRouteObject exro = teLspAttribute.getExcludeRouteObject();
registry.serializeRSPVTe(exro, byteBuf);
final SecondaryExplicitRouteObject sero = teLspAttribute.getSecondaryExplicitRouteObject();
registry.serializeRSPVTe(sero, byteBuf);
final SecondaryRecordRouteObject srro = teLspAttribute.getSecondaryRecordRouteObject();
registry.serializeRSPVTe(srro, byteBuf);
final LspAttributesObject lspAtt = teLspAttribute.getLspAttributesObject();
registry.serializeRSPVTe(lspAtt, byteBuf);
final LspRequiredAttributesObject rao = teLspAttribute.getLspRequiredAttributesObject();
registry.serializeRSPVTe(rao, byteBuf);
final ProtectionObject po = teLspAttribute.getProtectionObject();
if (po instanceof DynamicControlProtectionObject) {
registry.serializeRSPVTe((DynamicControlProtectionObject) po, byteBuf);
} else if (po instanceof BasicProtectionObject) {
registry.serializeRSPVTe((BasicProtectionObject) po, byteBuf);
}
final AssociationObject aso = teLspAttribute.getAssociationObject();
registry.serializeRSPVTe(aso, byteBuf);
final PrimaryPathRouteObject ppr = teLspAttribute.getPrimaryPathRouteObject();
registry.serializeRSPVTe(ppr, byteBuf);
final AdminStatusObject adso = teLspAttribute.getAdminStatusObject();
registry.serializeRSPVTe(adso, byteBuf);
final BandwidthObject bo = teLspAttribute.getBandwidthObject();
if (bo instanceof BasicBandwidthObject) {
registry.serializeRSPVTe((BasicBandwidthObject) bo, byteBuf);
} else if (bo instanceof ReoptimizationBandwidthObject) {
registry.serializeRSPVTe((ReoptimizationBandwidthObject) bo, byteBuf);
}
final MetricObject mo = teLspAttribute.getMetricObject();
registry.serializeRSPVTe(mo, byteBuf);
output.writeShort(MAGIC_NUMBER);
output.writeShort(byteBuf.readableBytes());
output.writeBytes(byteBuf);
LOG.trace("Finished serializing TE LSP Objects");
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.session.attribute.object.SessionAttributeObject in project bgpcep by opendaylight.
the class SessionAttributeLspObjectParser method localSerializeObject.
@Override
public void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf output) {
Preconditions.checkArgument(teLspObject instanceof BasicSessionAttributeObject, "SessionAttributeObject is mandatory.");
final BasicSessionAttributeObject sessionObject = (BasicSessionAttributeObject) teLspObject;
final ByteBuf sessionName = Unpooled.wrappedBuffer(StandardCharsets.US_ASCII.encode(sessionObject.getSessionName()));
final int pad = getPadding(sessionName.readableBytes());
serializeAttributeHeader(BODY_SIZE_C7 + pad + sessionName.readableBytes(), CLASS_NUM, CTYPE, output);
output.writeByte(sessionObject.getSetupPriority());
output.writeByte(sessionObject.getHoldPriority());
final BitArray bs = new BitArray(FLAGS_SIZE);
bs.set(LOCAL_PROTECTION, sessionObject.isLocalProtectionDesired());
bs.set(LABEL_RECORDING, sessionObject.isLabelRecordingDesired());
bs.set(SE_STYLE, sessionObject.isSeStyleDesired());
bs.toByteBuf(output);
output.writeByte(sessionName.readableBytes());
output.writeBytes(sessionName);
output.writeZero(pad);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.session.attribute.object.SessionAttributeObject in project bgpcep by opendaylight.
the class SessionAttributeLspRaObjectParser method localSerializeObject.
@Override
public void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf output) {
Preconditions.checkArgument(teLspObject instanceof SessionAttributeObjectWithResourcesAffinities, "SessionAttributeObject is mandatory.");
final SessionAttributeObjectWithResourcesAffinities sessionObject = (SessionAttributeObjectWithResourcesAffinities) teLspObject;
final ByteBuf sessionName = Unpooled.wrappedBuffer(StandardCharsets.US_ASCII.encode(sessionObject.getSessionName()));
final int pad = SessionAttributeLspObjectParser.getPadding(sessionName.readableBytes());
serializeAttributeHeader(BODY_SIZE_C1 + pad + sessionName.readableBytes(), CLASS_NUM, CTYPE, output);
writeAttributeFilter(sessionObject.getIncludeAny(), output);
writeAttributeFilter(sessionObject.getExcludeAny(), output);
writeAttributeFilter(sessionObject.getIncludeAll(), output);
output.writeByte(sessionObject.getSetupPriority());
output.writeByte(sessionObject.getHoldPriority());
final BitArray bs = new BitArray(FLAGS_SIZE);
bs.set(SessionAttributeLspObjectParser.LOCAL_PROTECTION, sessionObject.isLocalProtectionDesired());
bs.set(SessionAttributeLspObjectParser.LABEL_RECORDING, sessionObject.isLabelRecordingDesired());
bs.set(SessionAttributeLspObjectParser.SE_STYLE, sessionObject.isSeStyleDesired());
bs.toByteBuf(output);
output.writeByte(sessionName.readableBytes());
output.writeBytes(Unpooled.wrappedBuffer(StandardCharsets.US_ASCII.encode(sessionObject.getSessionName())));
output.writeZero(pad);
}
Aggregations