use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.destination.DestinationType in project bgpcep by opendaylight.
the class LinkstateAttributeParser method getNlriType.
private static CLinkstateDestination getNlriType(final AttributesBuilder pab) {
final AttributesReach mpr = pab.augmentation(AttributesReach.class);
if (mpr != null && mpr.getMpReachNlri() != null) {
final DestinationType dt = mpr.getMpReachNlri().getAdvertizedRoutes().getDestinationType();
if (dt instanceof DestinationLinkstateCase) {
for (final CLinkstateDestination d : ((DestinationLinkstateCase) dt).getDestinationLinkstate().getCLinkstateDestination()) {
return d;
}
}
}
final AttributesUnreach mpu = pab.augmentation(AttributesUnreach.class);
if (mpu != null && mpu.getMpUnreachNlri() != null) {
final DestinationType dt = mpu.getMpUnreachNlri().getWithdrawnRoutes().getDestinationType();
if (dt instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLinkstateCase) {
for (final CLinkstateDestination d : ((org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.linkstate.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLinkstateCase) dt).getDestinationLinkstate().getCLinkstateDestination()) {
return d;
}
}
}
return null;
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.destination.DestinationType in project bgpcep by opendaylight.
the class AbstractRIBSupportTest method createNlriAdvertiseRoute.
protected final ContainerNode createNlriAdvertiseRoute(final DestinationType destReach) {
final MpReachNlri mpReach = new MpReachNlriBuilder().setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(destReach).build()).build();
final Map.Entry<YangInstanceIdentifier, NormalizedNode> result = this.adapter.currentSerializer().toNormalizedNode(MP_REACH_IID, mpReach);
return (ContainerNode) result.getValue();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.destination.DestinationType in project bgpcep by opendaylight.
the class LUNlriParser method serializeAttribute.
@Override
public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) {
Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a Attributes object");
final Attributes pathAttributes = (Attributes) attribute;
final Attributes1 pathAttributes1 = pathAttributes.getAugmentation(Attributes1.class);
final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class);
if (pathAttributes1 != null) {
final AdvertizedRoutes routes = (pathAttributes1.getMpReachNlri()).getAdvertizedRoutes();
if (routes != null) {
final DestinationType destinationType = routes.getDestinationType();
if (destinationType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationLabeledUnicastCase) {
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationLabeledUnicastCase labeledUnicastCase = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationLabeledUnicastCase) routes.getDestinationType();
serializeNlri(labeledUnicastCase.getDestinationLabeledUnicast().getCLabeledUnicastDestination(), false, byteAggregator);
} else if (destinationType instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv6LabeledUnicastCase) {
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv6LabeledUnicastCase labeledUnicastCase = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv6LabeledUnicastCase) routes.getDestinationType();
serializeNlri(labeledUnicastCase.getDestinationIpv6LabeledUnicast().getCLabeledUnicastDestination(), false, byteAggregator);
}
}
} else if (pathAttributes2 != null) {
final MpUnreachNlri mpUnreachNlri = pathAttributes2.getMpUnreachNlri();
if (mpUnreachNlri.getWithdrawnRoutes() != null) {
final DestinationType destinationType = mpUnreachNlri.getWithdrawnRoutes().getDestinationType();
if (destinationType instanceof DestinationLabeledUnicastCase) {
final DestinationLabeledUnicastCase labeledUnicastCase = (DestinationLabeledUnicastCase) mpUnreachNlri.getWithdrawnRoutes().getDestinationType();
serializeNlri(labeledUnicastCase.getDestinationLabeledUnicast().getCLabeledUnicastDestination(), true, byteAggregator);
} else if (destinationType instanceof DestinationIpv6LabeledUnicastCase) {
final DestinationIpv6LabeledUnicastCase labeledUnicastCase = (DestinationIpv6LabeledUnicastCase) mpUnreachNlri.getWithdrawnRoutes().getDestinationType();
serializeNlri(labeledUnicastCase.getDestinationIpv6LabeledUnicast().getCLabeledUnicastDestination(), true, byteAggregator);
}
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.destination.DestinationType in project bgpcep by opendaylight.
the class LUNlriParser method parseNlri.
@Override
public void parseNlri(final ByteBuf nlri, final MpReachNlriBuilder builder, final PeerSpecificParserConstraint constraint) throws BGPParsingException {
if (!nlri.isReadable()) {
return;
}
final Class<? extends AddressFamily> afi = builder.getAfi();
final boolean multiPathSupported = MultiPathSupportUtil.isTableTypeSupported(constraint, new BgpTableTypeImpl(builder.getAfi(), builder.getSafi()));
final List<CLabeledUnicastDestination> dst = parseNlri(nlri, afi, multiPathSupported);
DestinationType destination = null;
if (afi == Ipv4AddressFamily.class) {
destination = new DestinationLabeledUnicastCaseBuilder().setDestinationLabeledUnicast(new DestinationLabeledUnicastBuilder().setCLabeledUnicastDestination(dst).build()).build();
} else if (afi == Ipv6AddressFamily.class) {
destination = new DestinationIpv6LabeledUnicastCaseBuilder().setDestinationIpv6LabeledUnicast(new DestinationIpv6LabeledUnicastBuilder().setCLabeledUnicastDestination(dst).build()).build();
}
builder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(destination).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.destination.DestinationType in project bgpcep by opendaylight.
the class AbstractFlowspecRIBSupport method buildWithdrawnDestination.
@Override
protected DestinationType buildWithdrawnDestination(final Collection<MapEntryNode> routes) {
final MapEntryNode routesCont = Iterables.getOnlyElement(routes);
final PathId pathId = PathIdUtil.buildPathId(routesCont, routePathIdNid());
return this.nlriParser.createWithdrawnDestinationType(new Object[] { this.nlriParser.extractFlowspec(Iterables.getOnlyElement(routes)) }, pathId);
}
Aggregations