@Override public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) { Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object."); final Attributes pathAttributes = (Attributes) attribute; final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class); if (pathAttributes2 == null) { return; } final MpUnreachNlri mpUnreachNlri = pathAttributes2.getMpUnreachNlri(); final ByteBuf unreachBuffer = Unpooled.buffer(); this.reg.serializeMpUnReach(mpUnreachNlri, unreachBuffer); for (final NlriSerializer nlriSerializer : this.reg.getSerializers()){ nlriSerializer.serializeAttribute(attribute,unreachBuffer); } AttributeUtil.formatAttribute(AttributeUtil.OPTIONAL, TYPE, unreachBuffer, byteAggregator); } }
@Override public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) { Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute object."); final Attributes pathAttributes = (Attributes) attribute; final Attributes1 pathAttributes1 = pathAttributes.getAugmentation(Attributes1.class); final Attributes2 pathAttributes2 = pathAttributes.getAugmentation(Attributes2.class); if (pathAttributes1 != null) { serializeAdvertisedRoutes((pathAttributes1.getMpReachNlri()).getAdvertizedRoutes(), byteAggregator); } else if (pathAttributes2 != null) { serializeWithDrawnRoutes(pathAttributes2.getMpUnreachNlri().getWithdrawnRoutes(), byteAggregator); } }
@Override public final void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) { Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute 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) { serializeMpReachNlri(routes.getDestinationType(), byteAggregator); } } if (pathAttributes2 != null) { final WithdrawnRoutes routes = pathAttributes2.getMpUnreachNlri().getWithdrawnRoutes(); if (routes != null) { serializeMpUnreachNlri(routes.getDestinationType(), byteAggregator); } } }
private CLinkstateDestination getNlriType(final AttributesBuilder pab) { final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.Attributes1 mpr = pab.getAugmentation(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.Attributes1.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 Attributes2 mpu = pab.getAugmentation(Attributes2.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.rev150210.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.rev150210.update.attributes.mp.unreach.nlri.withdrawn. routes.destination.type.DestinationLinkstateCase) dt).getDestinationLinkstate().getCLinkstateDestination()) { return d; } } } return null; }
if (pa.getMpUnreachNlri() != null) { type = new TablesKey(pa.getMpUnreachNlri().getAfi(), pa.getMpUnreachNlri().getSafi()); if (pa.getMpUnreachNlri().getWithdrawnRoutes() == null) {
if (pa.getMpUnreachNlri() != null) { type = new TablesKey(pa.getMpUnreachNlri().getAfi(), pa.getMpUnreachNlri().getSafi()); if (pa.getMpUnreachNlri().getWithdrawnRoutes() == null) {
@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) && (routes.getDestinationType() instanceof DestinationEvpnCase)) { final DestinationEvpnCase evpnCase = (DestinationEvpnCase) routes.getDestinationType(); serializeNlri(evpnCase.getDestinationEvpn().getEvpnDestination(), byteAggregator); } } else if (pathAttributes2 != null) { final MpUnreachNlri mpUnreachNlri = pathAttributes2.getMpUnreachNlri(); final WithdrawnRoutes withdrawnRoutes = mpUnreachNlri.getWithdrawnRoutes(); if (withdrawnRoutes != null && withdrawnRoutes.getDestinationType() instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml .ns.yang.bgp.evpn.rev160321.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCase) { final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev160321.update.attributes.mp.unreach.nlri.withdrawn. routes.destination.type.DestinationEvpnCase evpnCase = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml .ns.yang.bgp.evpn.rev160321.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCase) mpUnreachNlri.getWithdrawnRoutes().getDestinationType(); serializeNlri(evpnCase.getDestinationEvpn().getEvpnDestination(), byteAggregator); } } }
/** * Write on DS Adj-RIBs-In * * @param message */ public void onMessage(final UpdateMessage message) { if (!checkEndOfRib(message)) { final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.Attributes attrs = message.getAttributes(); MpReachNlri mpReach = null; if (message.getNlri() != null) { mpReach = prefixesToMpReach(message); } else if (attrs != null && attrs.getAugmentation(Attributes1.class) != null) { mpReach = attrs.getAugmentation(Attributes1.class).getMpReachNlri(); } if (mpReach != null) { addRoutes(mpReach, attrs); return; } MpUnreachNlri mpUnreach = null; if (message.getWithdrawnRoutes() != null) { mpUnreach = prefixesToMpUnreach(message); } else if (attrs != null && attrs.getAugmentation(Attributes2.class) != null) { mpUnreach = attrs.getAugmentation(Attributes2.class).getMpUnreachNlri(); } if (mpUnreach != null) { removeRoutes(mpUnreach); } } }
@Override public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) { Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute 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 advertizedRoutes = pathAttributes1.getMpReachNlri().getAdvertizedRoutes(); if (advertizedRoutes != null && advertizedRoutes.getDestinationType() instanceof DestinationIpv6Case) { final DestinationIpv6Case destinationIpv6Case = (DestinationIpv6Case) advertizedRoutes.getDestinationType(); for (final Ipv6Prefixes ipv6Prefix : destinationIpv6Case.getDestinationIpv6().getIpv6Prefixes()) { PathIdUtil.writePathId(ipv6Prefix.getPathId(), byteAggregator); ByteBufWriteUtil.writeMinimalPrefix(ipv6Prefix.getPrefix(), byteAggregator); } } } else if (pathAttributes2 != null) { final WithdrawnRoutes withdrawnRoutes = pathAttributes2.getMpUnreachNlri().getWithdrawnRoutes(); if (withdrawnRoutes != null && withdrawnRoutes.getDestinationType() instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case) { final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case destinationIpv6Case = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case) withdrawnRoutes.getDestinationType(); for (final Ipv6Prefixes ipv6Prefix : destinationIpv6Case.getDestinationIpv6().getIpv6Prefixes()) { PathIdUtil.writePathId(ipv6Prefix.getPathId(), byteAggregator); ByteBufWriteUtil.writeMinimalPrefix(ipv6Prefix.getPrefix(), byteAggregator); } } } } }
@Override public void serializeAttribute(final DataObject attribute, final ByteBuf byteAggregator) { Preconditions.checkArgument(attribute instanceof Attributes, "Attribute parameter is not a PathAttribute 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 advertizedRoutes = pathAttributes1.getMpReachNlri().getAdvertizedRoutes(); if (advertizedRoutes != null && advertizedRoutes.getDestinationType() instanceof DestinationIpv4Case) { final DestinationIpv4Case destinationIpv4Case = (DestinationIpv4Case) advertizedRoutes.getDestinationType(); for (final Ipv4Prefixes ipv4Prefix : destinationIpv4Case.getDestinationIpv4().getIpv4Prefixes()) { PathIdUtil.writePathId(ipv4Prefix.getPathId(), byteAggregator); ByteBufWriteUtil.writeMinimalPrefix(ipv4Prefix.getPrefix(), byteAggregator); } } } else if (pathAttributes2 != null) { final WithdrawnRoutes withdrawnRoutes = pathAttributes2.getMpUnreachNlri().getWithdrawnRoutes(); if (withdrawnRoutes != null && withdrawnRoutes.getDestinationType() instanceof org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4Case) { final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4Case destinationIpv4Case = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv4Case) withdrawnRoutes.getDestinationType(); for (final Ipv4Prefixes ipv4Prefix : destinationIpv4Case.getDestinationIpv4().getIpv4Prefixes()) { PathIdUtil.writePathId(ipv4Prefix.getPathId(), byteAggregator); ByteBufWriteUtil.writeMinimalPrefix(ipv4Prefix.getPrefix(), byteAggregator); } } } } }