use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.MpUnreachNlriBuilder in project bgpcep by opendaylight.
the class VpnIpv6NlriParserTest method testMpUnreachNlri.
@Test
public void testMpUnreachNlri() throws BGPParsingException {
final MpUnreachNlriBuilder mpBuilder = new MpUnreachNlriBuilder();
mpBuilder.setAfi(Ipv6AddressFamily.class);
mpBuilder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationVpnIpv6CaseBuilder().setVpnIpv6Destination(new VpnIpv6DestinationBuilder().setVpnDestination(Collections.singletonList(IPV6_VPN_WITHOUT_LABELS)).build()).build()).build()).build();
final MpUnreachNlri mpUnreachExpected1 = mpBuilder.build();
mpBuilder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationVpnIpv6CaseBuilder().setVpnIpv6Destination(new VpnIpv6DestinationBuilder().setVpnDestination(Collections.singletonList(IPV6_VPN)).build()).build()).build()).build();
final MpUnreachNlri mpUnreachExpected2 = mpBuilder.build();
final MpUnreachNlriBuilder testBuilder = new MpUnreachNlriBuilder();
testBuilder.setAfi(Ipv6AddressFamily.class);
PARSER.parseNlri(Unpooled.copiedBuffer(UNREACH_NLRI), testBuilder);
Assert.assertEquals(mpUnreachExpected1, testBuilder.build());
final ByteBuf output = Unpooled.buffer();
PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected2).build()).build(), output);
Assert.assertArrayEquals(UNREACH_NLRI, ByteArray.readAllBytes(output));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.MpUnreachNlriBuilder 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());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.MpUnreachNlriBuilder in project bgpcep by opendaylight.
the class VpnIpv4NlriParserTest method testMpUnreachNlri.
@Test
public void testMpUnreachNlri() throws BGPParsingException {
final MpUnreachNlriBuilder mpBuilder = new MpUnreachNlriBuilder();
mpBuilder.setAfi(Ipv4AddressFamily.class);
mpBuilder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationVpnIpv4CaseBuilder().setVpnIpv4Destination(new VpnIpv4DestinationBuilder().setVpnDestination(Collections.singletonList(IPV4_VPN_WITHOUT_LABELS)).build()).build()).build()).build();
final MpUnreachNlri mpUnreachExpected1 = mpBuilder.build();
mpBuilder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationVpnIpv4CaseBuilder().setVpnIpv4Destination(new VpnIpv4DestinationBuilder().setVpnDestination(Collections.singletonList(IPV4_VPN)).build()).build()).build()).build();
final MpUnreachNlri mpUnreachExpected2 = mpBuilder.build();
final MpUnreachNlriBuilder testBuilder = new MpUnreachNlriBuilder();
testBuilder.setAfi(Ipv4AddressFamily.class);
PARSER.parseNlri(Unpooled.copiedBuffer(UNREACH_NLRI), testBuilder);
Assert.assertEquals(mpUnreachExpected1, testBuilder.build());
final ByteBuf output = Unpooled.buffer();
PARSER.serializeAttribute(new AttributesBuilder().addAugmentation(Attributes2.class, new Attributes2Builder().setMpUnreachNlri(mpUnreachExpected2).build()).build(), output);
Assert.assertArrayEquals(UNREACH_NLRI, ByteArray.readAllBytes(output));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.MpUnreachNlriBuilder in project bgpcep by opendaylight.
the class SimpleRegistryTest method testMpUnReachParser.
@Test
public void testMpUnReachParser() throws BGPParsingException {
final NlriRegistry nlriReg = this.ctx.getNlriRegistry();
final byte[] mpUnreachBytes = { 0x00, 0x01, 0x01 };
final MpUnreachNlri mpUnreach = new MpUnreachNlriBuilder().setAfi(Ipv4AddressFamily.class).setSafi(UnicastSubsequentAddressFamily.class).build();
final ByteBuf buffer = Unpooled.buffer(mpUnreachBytes.length);
nlriReg.serializeMpUnReach(mpUnreach, buffer);
assertArrayEquals(mpUnreachBytes, buffer.array());
assertEquals(mpUnreach, nlriReg.parseMpUnreach(Unpooled.wrappedBuffer(mpUnreachBytes), CONSTRAINT));
verify(this.activator.nlriParser, times(1)).parseNlri(Mockito.any(ByteBuf.class), Mockito.any(MpUnreachNlriBuilder.class), Mockito.any());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.MpUnreachNlriBuilder in project bgpcep by opendaylight.
the class EvpnNlriParserTest method testMpUnreach.
@Test
public void testMpUnreach() throws BGPParsingException {
final MpUnreachNlriBuilder mpReach = new MpUnreachNlriBuilder();
mpReach.setAfi(L2vpnAddressFamily.class);
mpReach.setSafi(EvpnSubsequentAddressFamily.class);
this.parser.parseNlri(Unpooled.wrappedBuffer(IncMultEthTagRParserTest.RESULT), mpReach, null);
assertEquals(createUnreach(), mpReach.build());
}
Aggregations