Search in sources :

Example 1 with CLinkstateDestination

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.destination.CLinkstateDestination in project bgpcep by opendaylight.

the class LinkstateNlriParser method parseNlri.

@Override
public void parseNlri(final ByteBuf nlri, final MpReachNlriBuilder builder) throws BGPParsingException {
    if (!nlri.isReadable()) {
        return;
    }
    final List<CLinkstateDestination> dst = parseNlri(nlri);
    builder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(new DestinationLinkstateCaseBuilder().setDestinationLinkstate(new DestinationLinkstateBuilder().setCLinkstateDestination(dst).build()).build()).build());
}
Also used : AdvertizedRoutesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.mp.reach.nlri.AdvertizedRoutesBuilder) DestinationLinkstateBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.linkstate._case.DestinationLinkstateBuilder) CLinkstateDestination(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.destination.CLinkstateDestination) DestinationLinkstateCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationLinkstateCaseBuilder)

Example 2 with CLinkstateDestination

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.destination.CLinkstateDestination in project bgpcep by opendaylight.

the class LinkstateNlriParser method extractLinkstateDestination.

public static CLinkstateDestination extractLinkstateDestination(final DataContainerNode<? extends PathArgument> linkstate) {
    final CLinkstateDestinationBuilder builder = new CLinkstateDestinationBuilder();
    serializeCommonParts(builder, linkstate);
    final ChoiceNode objectType = (ChoiceNode) linkstate.getChild(OBJECT_TYPE_NID).get();
    if (objectType.getChild(ADVERTISING_NODE_DESCRIPTORS_NID).isPresent()) {
        serializeAdvertisedNodeDescriptor(builder, objectType);
    } else if (objectType.getChild(LOCAL_NODE_DESCRIPTORS_NID).isPresent()) {
        serializeLocalNodeDescriptor(builder, objectType);
    } else if (objectType.getChild(NODE_DESCRIPTORS_NID).isPresent()) {
        serializeNodeDescriptor(builder, objectType);
    } else if (AbstractTeLspNlriCodec.isTeLsp(objectType)) {
        builder.setObjectType(AbstractTeLspNlriCodec.serializeTeLsp(objectType));
    } else {
        LOG.warn("Unknown Object Type: {}.", objectType);
    }
    return builder.build();
}
Also used : CLinkstateDestinationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.destination.CLinkstateDestinationBuilder) ChoiceNode(org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode)

Example 3 with CLinkstateDestination

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.destination.CLinkstateDestination in project bgpcep by opendaylight.

the class LinkstateNlriParser method parseNlri.

@Override
public void parseNlri(final ByteBuf nlri, final MpUnreachNlriBuilder builder) throws BGPParsingException {
    if (!nlri.isReadable()) {
        return;
    }
    final List<CLinkstateDestination> dst = parseNlri(nlri);
    builder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLinkstateCaseBuilder().setDestinationLinkstate(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.linkstate._case.DestinationLinkstateBuilder().setCLinkstateDestination(dst).build()).build()).build());
}
Also used : Preconditions(com.google.common.base.Preconditions) WithdrawnRoutesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.update.attributes.mp.unreach.nlri.WithdrawnRoutesBuilder) CLinkstateDestination(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.destination.CLinkstateDestination)

Example 4 with CLinkstateDestination

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.destination.CLinkstateDestination in project bgpcep by opendaylight.

the class AbstractNlriTypeCodec method parseTypeNlri.

@Override
public final CLinkstateDestination parseTypeNlri(final ByteBuf nlri) {
    final CLinkstateDestinationBuilder builder = new CLinkstateDestinationBuilder();
    builder.setProtocolId(ProtocolId.forValue(nlri.readUnsignedByte()));
    builder.setIdentifier(new Identifier(BigInteger.valueOf(nlri.readLong())));
    builder.setObjectType(parseObjectType(nlri));
    return builder.build();
}
Also used : Identifier(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.Identifier) CLinkstateDestinationBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.destination.CLinkstateDestinationBuilder)

Example 5 with CLinkstateDestination

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.destination.CLinkstateDestination in project bgpcep by opendaylight.

the class SimpleNlriTypeRegistry method serializeNlriType.

public void serializeNlriType(final CLinkstateDestination nlri, final ByteBuf byteAggregator) {
    if (nlri == null) {
        return;
    }
    requireNonNull(byteAggregator);
    final ObjectType objectType = nlri.getObjectType();
    final NlriTypeCaseSerializer serializer = this.nlriRegistry.getSerializer((Class<? extends ObjectType>) objectType.implementedInterface());
    if (serializer == null) {
        LOG.warn("Linkstate NLRI serializer for Type: {} was not found.", objectType.implementedInterface());
        return;
    }
    final ByteBuf nlriType = Unpooled.buffer();
    serializer.serializeTypeNlri(nlri, nlriType);
    TlvUtil.writeTLV(serializer.getNlriType(), nlriType, byteAggregator);
}
Also used : ObjectType(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.ObjectType) NlriTypeCaseSerializer(org.opendaylight.protocol.bgp.linkstate.spi.NlriTypeCaseSerializer) ByteBuf(io.netty.buffer.ByteBuf)

Aggregations

CLinkstateDestination (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.destination.CLinkstateDestination)9 ByteBuf (io.netty.buffer.ByteBuf)5 DestinationLinkstateCaseBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationLinkstateCaseBuilder)4 DestinationLinkstateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.update.attributes.mp.reach.nlri.advertized.routes.destination.type.destination.linkstate._case.DestinationLinkstateBuilder)4 ArrayList (java.util.ArrayList)3 Test (org.junit.Test)3 CLinkstateDestination (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.destination.CLinkstateDestination)3 CLinkstateDestinationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.destination.CLinkstateDestinationBuilder)3 Attributes (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes)3 AttributesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder)3 AdvertizedRoutesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.reach.mp.reach.nlri.AdvertizedRoutesBuilder)3 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)2 Ipv4AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone)2 CLinkstateDestinationBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev171207.linkstate.destination.CLinkstateDestinationBuilder)2 AreaIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.AreaIdentifier)2 DomainIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.DomainIdentifier)2 Identifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Identifier)2 Ipv4InterfaceIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.Ipv4InterfaceIdentifier)2 OspfInterfaceIdentifier (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.OspfInterfaceIdentifier)2 ObjectType (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.linkstate.ObjectType)2