Search in sources :

Example 1 with SrlgId

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();
}
Also used : SubobjectContainerBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.exclude.route.object.exclude.route.object.SubobjectContainerBuilder) SrlgCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.SrlgCaseBuilder) RSVPParsingException(org.opendaylight.protocol.rsvp.parser.spi.RSVPParsingException) SrlgId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgId) SrlgBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.srlg._case.SrlgBuilder)

Example 2 with SrlgId

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);
    }
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) SrlgId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgId)

Example 3 with SrlgId

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();
}
Also used : SrlgValues(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.ted.rev131021.srlg.attributes.SrlgValues) ArrayList(java.util.ArrayList) SrlgBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.ted.rev131021.ted.link.attributes.SrlgBuilder) IsisLinkAttributesBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.isis.topology.rev131021.isis.link.attributes.IsisLinkAttributesBuilder) SrlgValuesBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.ted.rev131021.srlg.attributes.SrlgValuesBuilder) SrlgId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgId)

Example 4 with SrlgId

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();
}
Also used : SrlgValues(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.ted.rev131021.srlg.attributes.SrlgValues) ArrayList(java.util.ArrayList) SrlgBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.ted.rev131021.ted.link.attributes.SrlgBuilder) SrlgValuesBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.ted.rev131021.srlg.attributes.SrlgValuesBuilder) SrlgId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgId) OspfLinkAttributesBuilder(org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.ospf.link.attributes.OspfLinkAttributesBuilder)

Example 5 with SrlgId

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();
}
Also used : SrlgCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.SrlgCaseBuilder) PCEPDeserializerException(org.opendaylight.protocol.pcep.spi.PCEPDeserializerException) SubobjectBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.exclude.route.object.xro.SubobjectBuilder) SrlgId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgId) SrlgBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.srlg._case.SrlgBuilder)

Aggregations

SrlgId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.SrlgId)8 ByteBuf (io.netty.buffer.ByteBuf)5 SrlgCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.SrlgCaseBuilder)4 SrlgBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.basic.explicit.route.subobjects.subobject.type.srlg._case.SrlgBuilder)4 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)2 SubobjectBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.pcep.types.rev131005.exclude.route.object.xro.SubobjectBuilder)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 SubobjectContainerBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.rsvp.rev150820.exclude.route.object.exclude.route.object.SubobjectContainerBuilder)2 SrlgValues (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.ted.rev131021.srlg.attributes.SrlgValues)2 SrlgValuesBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.ted.rev131021.srlg.attributes.SrlgValuesBuilder)2 SrlgBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.ted.rev131021.ted.link.attributes.SrlgBuilder)2 XROSRLGSubobjectParser (org.opendaylight.protocol.pcep.parser.subobject.XROSRLGSubobjectParser)1 PCEPDeserializerException (org.opendaylight.protocol.pcep.spi.PCEPDeserializerException)1 XROSrlgSubobjectParser (org.opendaylight.protocol.rsvp.parser.impl.subobject.xro.XROSrlgSubobjectParser)1 RSVPParsingException (org.opendaylight.protocol.rsvp.parser.spi.RSVPParsingException)1 IsisLinkAttributesBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.network.isis.topology.rev131021.isis.link.attributes.IsisLinkAttributesBuilder)1 OspfLinkAttributesBuilder (org.opendaylight.yang.gen.v1.urn.tbd.params.xml.ns.yang.ospf.topology.rev131021.ospf.link.attributes.OspfLinkAttributesBuilder)1