use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.reach.mp.reach.nlri.AdvertizedRoutes in project bgpcep by opendaylight.
the class EvpnNlriParserTest method testMpReach.
@Test
public void testMpReach() throws BGPParsingException {
final MpReachNlriBuilder mpReach = new MpReachNlriBuilder();
mpReach.setAfi(L2vpnAddressFamily.class);
mpReach.setSafi(EvpnSubsequentAddressFamily.class);
this.parser.parseNlri(Unpooled.wrappedBuffer(IncMultEthTagRParserTest.RESULT), mpReach, null);
final MpReachNlriBuilder mpReachExpected = new MpReachNlriBuilder();
mpReachExpected.setAfi(L2vpnAddressFamily.class);
mpReachExpected.setSafi(EvpnSubsequentAddressFamily.class);
final AdvertizedRoutes wd = new AdvertizedRoutesBuilder().setDestinationType(new DestinationEvpnCaseBuilder().setDestinationEvpn(new DestinationEvpnBuilder().setEvpnDestination(this.dest).build()).build()).build();
mpReachExpected.setAdvertizedRoutes(wd);
assertEquals(mpReachExpected.build(), mpReach.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.reach.mp.reach.nlri.AdvertizedRoutes in project bgpcep by opendaylight.
the class EvpnNlriParser method serializeAttribute.
@Override
public void serializeAttribute(final Attributes pathAttributes, final ByteBuf byteAggregator) {
final AttributesReach pathAttributes1 = pathAttributes.augmentation(AttributesReach.class);
final AttributesUnreach pathAttributes2 = pathAttributes.augmentation(AttributesUnreach.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.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCase) {
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCase evpnCase = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCase) mpUnreachNlri.getWithdrawnRoutes().getDestinationType();
serializeNlri(evpnCase.getDestinationEvpn().getEvpnDestination(), byteAggregator);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.reach.mp.reach.nlri.AdvertizedRoutes in project bgpcep by opendaylight.
the class L3vpnMcastIpv6NlriHandler method serializeAttribute.
@Override
public void serializeAttribute(final Attributes pathAttributes, final ByteBuf byteAggregator) {
final AttributesReach pathAttributes1 = pathAttributes.augmentation(AttributesReach.class);
final AttributesUnreach pathAttributes2 = pathAttributes.augmentation(AttributesUnreach.class);
if (pathAttributes1 != null) {
final AdvertizedRoutes routes = pathAttributes1.getMpReachNlri().getAdvertizedRoutes();
if (routes != null && routes.getDestinationType() instanceof DestinationL3vpnMcastIpv6AdvertizedCase) {
final DestinationL3vpnMcastIpv6AdvertizedCase reach = (DestinationL3vpnMcastIpv6AdvertizedCase) routes.getDestinationType();
L3vpnMcastNlriSerializer.serializeNlri(reach.getDestinationIpv6L3vpnMcast().getL3vpnMcastDestination(), byteAggregator);
}
} else if (pathAttributes2 != null) {
final WithdrawnRoutes withdrawnRoutes = pathAttributes2.getMpUnreachNlri().getWithdrawnRoutes();
if (withdrawnRoutes != null && withdrawnRoutes.getDestinationType() instanceof DestinationL3vpnMcastIpv6WithdrawnCase) {
final DestinationL3vpnMcastIpv6WithdrawnCase reach = (DestinationL3vpnMcastIpv6WithdrawnCase) withdrawnRoutes.getDestinationType();
L3vpnMcastNlriSerializer.serializeNlri(reach.getDestinationIpv6L3vpnMcast().getL3vpnMcastDestination(), byteAggregator);
}
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.reach.mp.reach.nlri.AdvertizedRoutes in project bgpcep by opendaylight.
the class FlowspecL3vpnIpv6RIBSupportTest method testBuildMpReachNlriUpdate.
@Test
public void testBuildMpReachNlriUpdate() {
final Update update = this.ribSupport.buildUpdate(createRoutes(new FlowspecL3vpnIpv6RoutesBuilder().setFlowspecL3vpnRoute(Map.of(ROUTE.key(), ROUTE)).build()), Collections.emptyList(), ATTRIBUTES);
final AdvertizedRoutes advertised = update.getAttributes().augmentation(AttributesReach.class).getMpReachNlri().getAdvertizedRoutes();
assertEquals(REACH_NLRI, advertised.getDestinationType());
assertNull(update.getAttributes().augmentation(AttributesUnreach.class));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.reach.mp.reach.nlri.AdvertizedRoutes in project bgpcep by opendaylight.
the class Ipv6NlriParser method serializeAttribute.
@Override
public void serializeAttribute(final Attributes pathAttributes, final ByteBuf byteAggregator) {
final AttributesReach pathAttributes1 = pathAttributes.augmentation(AttributesReach.class);
final AttributesUnreach pathAttributes2 = pathAttributes.augmentation(AttributesUnreach.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);
Ipv6Util.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.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case) {
final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case destinationIpv6Case = (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6Case) withdrawnRoutes.getDestinationType();
for (final Ipv6Prefixes ipv6Prefix : destinationIpv6Case.getDestinationIpv6().getIpv6Prefixes()) {
PathIdUtil.writePathId(ipv6Prefix.getPathId(), byteAggregator);
Ipv6Util.writeMinimalPrefix(ipv6Prefix.getPrefix(), byteAggregator);
}
}
}
}
Aggregations