use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.PathId in project bgpcep by opendaylight.
the class AbstractFlowspecNlriParser method parseNlri.
@Override
public final void parseNlri(@NonNull final ByteBuf nlri, @NonNull final MpUnreachNlriBuilder builder, final PeerSpecificParserConstraint constraint) throws BGPParsingException {
if (!nlri.isReadable()) {
return;
}
final PathId pathId = readPathId(nlri, builder.getAfi(), builder.getSafi(), constraint);
final Object[] nlriFields = parseNlri(nlri);
builder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(createWithdrawnDestinationType(nlriFields, pathId)).build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.PathId in project bgpcep by opendaylight.
the class AbstractFlowspecRIBSupport method buildDestination.
@Override
protected DestinationType buildDestination(final Collection<MapEntryNode> routes) {
final MapEntryNode routesCont = Iterables.getOnlyElement(routes);
final PathId pathId = PathIdUtil.buildPathId(routesCont, routePathIdNid());
return this.nlriParser.createAdvertizedRoutesDestinationType(new Object[] { this.nlriParser.extractFlowspec(routesCont) }, pathId);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.PathId in project bgpcep by opendaylight.
the class AbstractFlowspecL3vpnRIBSupport method buildWithdrawnDestination.
@Override
protected DestinationType buildWithdrawnDestination(final Collection<MapEntryNode> routes) {
final MapEntryNode routesCont = Iterables.getOnlyElement(routes);
final PathId pathId = PathIdUtil.buildPathId(routesCont, routePathIdNid());
final RouteDistinguisher rd = extractRouteDistinguisher(routesCont);
return this.nlriParser.createWithdrawnDestinationType(new Object[] { rd, this.nlriParser.extractFlowspec(Iterables.getOnlyElement(routes)) }, pathId);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.PathId in project bgpcep by opendaylight.
the class FlowspecL3vpnIpv6NlriParser method createWithdrawnDestinationType.
@Override
public DestinationType createWithdrawnDestinationType(final Object[] nlriFields, final PathId pathId) {
final RouteDistinguisher rd = (RouteDistinguisher) nlriFields[0];
final List<Flowspec> flowspecList = (List<Flowspec>) nlriFields[1];
return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationFlowspecL3vpnIpv6CaseBuilder().setDestinationFlowspecL3vpnIpv6(new DestinationFlowspecL3vpnIpv6Builder().setRouteDistinguisher(rd).setFlowspec(flowspecList).setPathId(pathId).build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.PathId in project bgpcep by opendaylight.
the class ClientAttributePrependHandlerTest method testPreprendClientAttribute.
@Test
public void testPreprendClientAttribute() {
Statement statement = this.basicStatements.stream().filter(st -> st.getName().equals("client-attribute-append-test")).findFirst().get();
final Attributes att = new AttributesBuilder().setCNextHop(new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder().setGlobal(IPV4).build()).build()).build();
final RouteAttributeContainer attributeContainer = routeAttributeContainerFalse(att);
doReturn(Collections.emptyList()).when(this.exportParameters).getClientRouteTargetContrainCache();
RouteAttributeContainer result = this.statementRegistry.applyExportStatement(this.baseAttributes, IPV4UNICAST.class, this.exportParameters, attributeContainer, statement);
assertEquals(att, result.getAttributes());
final Attributes expected = new AttributesBuilder().setCNextHop(new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder().setGlobal(new Ipv4AddressNoZone("2.2.2.2")).build()).build()).build();
final String rk = "testRoute";
final Route rtRoute = new RouteTargetConstrainRouteBuilder().setRouteKey(rk).setPathId(new PathId(Uint32.ZERO)).setAttributes(expected).build();
doReturn(Collections.singletonList(rtRoute)).when(this.exportParameters).getClientRouteTargetContrainCache();
doReturn(rk).when(this.exportParameters).getRouteKey();
result = this.statementRegistry.applyExportStatement(this.baseAttributes, IPV4UNICAST.class, this.exportParameters, attributeContainer, statement);
assertEquals(expected, result.getAttributes());
}
Aggregations