use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.evpn.destination.EvpnDestinationBuilder in project bgpcep by opendaylight.
the class EvpnNlriAttributesParserTest method createReach.
private static MpReachNlri createReach() {
final MpReachNlriBuilder mpReachExpected = new MpReachNlriBuilder();
final AdvertizedRoutes wd = new AdvertizedRoutesBuilder().setDestinationType(new DestinationEvpnCaseBuilder().setDestinationEvpn(new DestinationEvpnBuilder().setEvpnDestination(singletonList(new EvpnDestinationBuilder().setRouteDistinguisher(RD).setEvpnChoice(IncMultEthTagRParserTest.createIncMultiCase()).build())).build()).build()).build();
return mpReachExpected.setAdvertizedRoutes(wd).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.evpn.destination.EvpnDestinationBuilder in project bgpcep by opendaylight.
the class EvpnNlriAttributesParserTest method createUnreach.
private static MpUnreachNlri createUnreach() {
final MpUnreachNlriBuilder mpReachExpected = new MpUnreachNlriBuilder();
final WithdrawnRoutes wd = new WithdrawnRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationEvpnCaseBuilder().setDestinationEvpn(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.evpn._case.DestinationEvpnBuilder().setEvpnDestination(singletonList(new EvpnDestinationBuilder().setRouteDistinguisher(RD).setEvpnChoice(IncMultEthTagRParserTest.createIncMultiCase()).build())).build()).build()).build();
return mpReachExpected.setWithdrawnRoutes(wd).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.evpn.destination.EvpnDestinationBuilder in project bgpcep by opendaylight.
the class EvpnNlriParserTest method setUp.
@Before
public void setUp() {
ESIActivator.registerEsiTypeParsers(new ArrayList<>());
NlriActivator.registerNlriParsers(new ArrayList<>());
this.dest = Collections.singletonList(new EvpnDestinationBuilder().setRouteDistinguisher(RD).setEvpnChoice(IncMultEthTagRParserTest.createIncMultiCase()).build());
this.parser = new EvpnNlriParser();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.evpn.destination.EvpnDestinationBuilder in project bgpcep by opendaylight.
the class EvpnNlriParser method parseNlri.
@Nullable
private static List<EvpnDestination> parseNlri(final ByteBuf nlri, final PeerSpecificParserConstraint constraints, final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi) {
if (!nlri.isReadable()) {
return null;
}
final List<EvpnDestination> dests = new ArrayList<>();
while (nlri.isReadable()) {
final EvpnDestinationBuilder builder = new EvpnDestinationBuilder();
if (MultiPathSupportUtil.isTableTypeSupported(constraints, new BgpTableTypeImpl(afi, safi))) {
builder.setPathId(PathIdUtil.readPathId(nlri));
}
final NlriType type = NlriType.forValue(nlri.readUnsignedByte());
final int length = nlri.readUnsignedByte();
final ByteBuf nlriBuf = nlri.readSlice(length);
builder.setRouteDistinguisher(parseRouteDistinguisher(nlriBuf));
builder.setEvpnChoice(SimpleEvpnNlriRegistry.getInstance().parseEvpn(type, nlriBuf));
dests.add(builder.build());
}
return dests;
}
Aggregations