Search in sources :

Example 1 with BandwidthObject

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

the class PCEPBandwidthObjectParser method serializeObject.

@Override
public void serializeObject(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.Object object, final ByteBuf buffer) {
    Preconditions.checkArgument(object instanceof Bandwidth, "Wrong instance of PCEPObject. Passed %s. Needed BandwidthObject.", object.getClass());
    final ByteBuf body = Unpooled.buffer();
    writeFloat32(((Bandwidth) object).getBandwidth(), body);
    ObjectUtil.formatSubobject(TYPE, CLASS, object.isProcessingRule(), object.isIgnore(), body, buffer);
}
Also used : Bandwidth(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.bandwidth.object.Bandwidth) ByteBuf(io.netty.buffer.ByteBuf)

Example 2 with BandwidthObject

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

the class BandwidthObjectParser method localSerializeObject.

@Override
public void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf output) {
    Preconditions.checkArgument(teLspObject instanceof BasicBandwidthObject, "BandwidthObject is mandatory.");
    final BasicBandwidthObject bandObject = (BasicBandwidthObject) teLspObject;
    serializeAttributeHeader(BODY_SIZE, CLASS_NUM, CTYPE, output);
    final Bandwidth band = bandObject.getBandwidth();
    output.writeBytes(Unpooled.wrappedBuffer(band.getValue()));
}
Also used : BasicBandwidthObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.bandwidth.object.bandwidth.object.BasicBandwidthObject) Bandwidth(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.Bandwidth)

Example 3 with BandwidthObject

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

the class ReoptimizationBandwidthObjectParser method localSerializeObject.

@Override
public void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf output) {
    Preconditions.checkArgument(teLspObject instanceof ReoptimizationBandwidthObject, "BandwidthObject is mandatory.");
    final ReoptimizationBandwidthObject bandObject = (ReoptimizationBandwidthObject) teLspObject;
    serializeAttributeHeader(BandwidthObjectParser.BODY_SIZE, CLASS_NUM, CTYPE, output);
    final Bandwidth band = bandObject.getBandwidth();
    output.writeBytes(Unpooled.wrappedBuffer(band.getValue()));
}
Also used : Bandwidth(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.Bandwidth) ReoptimizationBandwidthObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.bandwidth.object.bandwidth.object.ReoptimizationBandwidthObject)

Example 4 with BandwidthObject

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.bandwidth.object.BandwidthObject 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");
}
Also used : DynamicControlProtectionObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.object.protection.object.DynamicControlProtectionObject) ByteBuf(io.netty.buffer.ByteBuf) LspRequiredAttributesObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.required.attributes.object.LspRequiredAttributesObject) FlowSpecObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.flow.spec.object.FlowSpecObject) TspecObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.tspec.object.TspecObject) BasicFastRerouteObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.fast.reroute.object.fast.reroute.object.BasicFastRerouteObject) ReoptimizationBandwidthObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.bandwidth.object.bandwidth.object.ReoptimizationBandwidthObject) BandwidthObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.bandwidth.object.BandwidthObject) BasicBandwidthObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.bandwidth.object.bandwidth.object.BasicBandwidthObject) MetricObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.metric.object.MetricObject) BasicProtectionObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.object.protection.object.BasicProtectionObject) LspAttributesObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.lsp.attributes.object.LspAttributesObject) AssociationObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.association.object.AssociationObject) BasicSessionAttributeObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.session.attribute.object.session.attribute.object.BasicSessionAttributeObject) SessionAttributeObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.session.attribute.object.SessionAttributeObject) SessionAttributeObjectWithResourcesAffinities(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.session.attribute.object.session.attribute.object.SessionAttributeObjectWithResourcesAffinities) Ipv4DetourObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.Ipv4DetourObject) Ipv6DetourObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.Ipv6DetourObject) DetourObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.DetourObject) RecordRouteObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.record.route.object.RecordRouteObject) SecondaryRecordRouteObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.SecondaryRecordRouteObject) TeLspAttributes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.path.attribute.link.state.attribute.te.lsp.attributes._case.TeLspAttributes) BasicSessionAttributeObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.session.attribute.object.session.attribute.object.BasicSessionAttributeObject) LegacyFastRerouteObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.fast.reroute.object.fast.reroute.object.LegacyFastRerouteObject) ProtectionObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.object.ProtectionObject) DynamicControlProtectionObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.object.protection.object.DynamicControlProtectionObject) BasicProtectionObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.protection.object.protection.object.BasicProtectionObject) BasicBandwidthObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.bandwidth.object.bandwidth.object.BasicBandwidthObject) SecondaryRecordRouteObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.record.route.object.SecondaryRecordRouteObject) FastRerouteObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.fast.reroute.object.FastRerouteObject) LegacyFastRerouteObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.fast.reroute.object.fast.reroute.object.LegacyFastRerouteObject) BasicFastRerouteObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.fast.reroute.object.fast.reroute.object.BasicFastRerouteObject) Ipv6DetourObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.Ipv6DetourObject) ExplicitRouteObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.object.ExplicitRouteObject) SecondaryExplicitRouteObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.SecondaryExplicitRouteObject) PrimaryPathRouteObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.primary.path.route.object.PrimaryPathRouteObject) AdminStatusObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.admin.status.object.AdminStatusObject) ReoptimizationBandwidthObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.bandwidth.object.bandwidth.object.ReoptimizationBandwidthObject) SecondaryExplicitRouteObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.secondary.explicit.route.object.SecondaryExplicitRouteObject) ExcludeRouteObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.exclude.route.object.ExcludeRouteObject) Ipv4DetourObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.Ipv4DetourObject)

Example 5 with BandwidthObject

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

the class MetricObjectParser method localSerializeObject.

@Override
public void localSerializeObject(final RsvpTeObject teLspObject, final ByteBuf output) {
    Preconditions.checkArgument(teLspObject instanceof MetricObject, "BandwidthObject is mandatory.");
    final MetricObject metric = (MetricObject) teLspObject;
    serializeAttributeHeader(BODY_SIZE, CLASS_NUM, CTYPE, output);
    output.writeZero(ByteBufWriteUtil.SHORT_BYTES_LENGTH);
    final BitArray reflect = new BitArray(FLAGS_SIZE);
    reflect.set(BOUND, metric.isBound());
    reflect.set(COMPUTED, metric.isComputed());
    reflect.toByteBuf(output);
    output.writeByte(metric.getMetricType());
    writeFloat32(metric.getValue(), output);
}
Also used : BitArray(org.opendaylight.protocol.util.BitArray) MetricObject(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.metric.object.MetricObject)

Aggregations

ByteBuf (io.netty.buffer.ByteBuf)2 Bandwidth (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.network.concepts.rev131125.Bandwidth)2 BasicBandwidthObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.bandwidth.object.bandwidth.object.BasicBandwidthObject)2 ReoptimizationBandwidthObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.bandwidth.object.bandwidth.object.ReoptimizationBandwidthObject)2 MetricObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.metric.object.MetricObject)2 BitArray (org.opendaylight.protocol.util.BitArray)1 TeLspAttributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.path.attribute.link.state.attribute.te.lsp.attributes._case.TeLspAttributes)1 Bandwidth (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.bandwidth.object.Bandwidth)1 AdminStatusObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.admin.status.object.AdminStatusObject)1 AssociationObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.association.object.AssociationObject)1 BandwidthObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.bandwidth.object.BandwidthObject)1 DetourObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.DetourObject)1 Ipv4DetourObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.Ipv4DetourObject)1 Ipv6DetourObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.detour.object.detour.object.Ipv6DetourObject)1 ExcludeRouteObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.exclude.route.object.ExcludeRouteObject)1 ExplicitRouteObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.explicit.route.object.ExplicitRouteObject)1 FastRerouteObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.fast.reroute.object.FastRerouteObject)1 BasicFastRerouteObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.fast.reroute.object.fast.reroute.object.BasicFastRerouteObject)1 LegacyFastRerouteObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.fast.reroute.object.fast.reroute.object.LegacyFastRerouteObject)1 FlowSpecObject (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.flow.spec.object.FlowSpecObject)1