use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgId in project bgpcep by opendaylight.
the class XROSrlgSubobjectParser method parseSubobject.
@Override
public SubobjectContainer parseSubobject(final ByteBuf buffer, final boolean mandatory) throws RSVPParsingException {
Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
if (buffer.readableBytes() != CONTENT_LENGTH) {
throw new RSVPParsingException("Wrong length of array of bytes. Passed: " + buffer.readableBytes() + "; " + "Expected: " + CONTENT_LENGTH + ".");
}
final SubobjectContainerBuilder builder = new SubobjectContainerBuilder();
builder.setMandatory(mandatory);
builder.setSubobjectType(new SrlgCaseBuilder().setSrlg(new SrlgBuilder().setSrlgId(new SrlgId(buffer.readUnsignedInt())).build()).build());
buffer.readByte();
builder.setAttribute(ExcludeRouteSubobjects.Attribute.forValue(buffer.readUnsignedByte()));
return builder.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgId in project bgpcep by opendaylight.
the class LinkAttributesParser method serializeSrlg.
private static void serializeSrlg(final List<SrlgId> srlgList, final ByteBuf byteAggregator) {
if (srlgList != null) {
final ByteBuf sharedRLGBuf = Unpooled.buffer();
for (final SrlgId srlgId : srlgList) {
sharedRLGBuf.writeInt(srlgId.getValue().intValue());
}
TlvUtil.writeTLV(SHARED_RISK_LINK_GROUP, sharedRLGBuf, byteAggregator);
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgId in project bgpcep by opendaylight.
the class ProtocolUtil method isisLinkAttributes.
private static org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.isis.topology.rev131021.IgpLinkAttributes1 isisLinkAttributes(final TopologyIdentifier topologyIdentifier, final LinkAttributes la) {
final org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.isis.topology.rev131021.isis.link.attributes.isis.link.attributes.TedBuilder tb = new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.isis.topology.rev131021.isis.link.attributes.isis.link.attributes.TedBuilder();
if (la != null) {
if (la.getAdminGroup() != null) {
tb.setColor(la.getAdminGroup().getValue());
}
if (la.getTeMetric() != null) {
tb.setTeDefaultMetric(la.getTeMetric().getValue());
}
if (la.getUnreservedBandwidth() != null) {
tb.setUnreservedBandwidth(unreservedBandwidthList(la.getUnreservedBandwidth()));
}
if (la.getMaxLinkBandwidth() != null) {
tb.setMaxLinkBandwidth(bandwidthToBigDecimal(la.getMaxLinkBandwidth()));
}
if (la.getMaxReservableBandwidth() != null) {
tb.setMaxResvLinkBandwidth(bandwidthToBigDecimal(la.getMaxReservableBandwidth()));
}
if (la.getSharedRiskLinkGroups() != null) {
final List<SrlgValues> srlgs = new ArrayList<>();
for (final SrlgId id : la.getSharedRiskLinkGroups()) {
srlgs.add(new SrlgValuesBuilder().setSrlgValue(id.getValue()).build());
}
tb.setSrlg(new SrlgBuilder().setSrlgValues(srlgs).build());
}
}
final IsisLinkAttributesBuilder ilab = new IsisLinkAttributesBuilder();
ilab.setTed(tb.build());
if (topologyIdentifier != null) {
ilab.setMultiTopologyId(topologyIdentifier.getValue().shortValue());
}
return new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.isis.topology.rev131021.IgpLinkAttributes1Builder().setIsisLinkAttributes(ilab.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgId in project bgpcep by opendaylight.
the class ProtocolUtil method ospfLinkAttributes.
private static org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.IgpLinkAttributes1 ospfLinkAttributes(final TopologyIdentifier topologyIdentifier, final LinkAttributes la) {
final org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.ospf.link.attributes.ospf.link.attributes.TedBuilder tb = new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.ospf.link.attributes.ospf.link.attributes.TedBuilder();
if (la != null) {
if (la.getAdminGroup() != null) {
tb.setColor(la.getAdminGroup().getValue());
}
if (la.getTeMetric() != null) {
tb.setTeDefaultMetric(la.getTeMetric().getValue());
}
if (la.getUnreservedBandwidth() != null) {
tb.setUnreservedBandwidth(unreservedBandwidthList(la.getUnreservedBandwidth()));
}
if (la.getMaxLinkBandwidth() != null) {
tb.setMaxLinkBandwidth(bandwidthToBigDecimal(la.getMaxLinkBandwidth()));
}
if (la.getMaxReservableBandwidth() != null) {
tb.setMaxResvLinkBandwidth(bandwidthToBigDecimal(la.getMaxReservableBandwidth()));
}
if (la.getSharedRiskLinkGroups() != null) {
final List<SrlgValues> srlgs = new ArrayList<>();
for (final SrlgId id : la.getSharedRiskLinkGroups()) {
srlgs.add(new SrlgValuesBuilder().setSrlgValue(id.getValue()).build());
}
tb.setSrlg(new SrlgBuilder().setSrlgValues(srlgs).build());
}
}
final OspfLinkAttributesBuilder ilab = new OspfLinkAttributesBuilder();
ilab.setTed(tb.build());
if (topologyIdentifier != null) {
ilab.setMultiTopologyId(topologyIdentifier.getValue().shortValue());
}
return new org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.IgpLinkAttributes1Builder().setOspfLinkAttributes(ilab.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgId in project bgpcep by opendaylight.
the class XROSRLGSubobjectParser method parseSubobject.
@Override
public Subobject parseSubobject(final ByteBuf buffer, final boolean mandatory) throws PCEPDeserializerException {
Preconditions.checkArgument(buffer != null && buffer.isReadable(), "Array of bytes is mandatory. Can't be null or empty.");
if (buffer.readableBytes() != CONTENT_LENGTH) {
throw new PCEPDeserializerException("Wrong length of array of bytes. Passed: " + buffer.readableBytes() + "; Expected: " + CONTENT_LENGTH + ".");
}
final SubobjectBuilder builder = new SubobjectBuilder();
builder.setMandatory(mandatory);
builder.setSubobjectType(new SrlgCaseBuilder().setSrlg(new SrlgBuilder().setSrlgId(new SrlgId(buffer.readUnsignedInt())).build()).build());
buffer.readByte();
builder.setAttribute(ExcludeRouteSubobjects.Attribute.forValue(buffer.readUnsignedByte()));
return builder.build();
}
Aggregations