Search in sources :

Example 6 with 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 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());
}
Also used : PathId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.PathId) WithdrawnRoutesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.mp.unreach.nlri.WithdrawnRoutesBuilder)

Example 7 with 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 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);
}
Also used : PathId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.PathId) MapEntryNode(org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode)

Example 8 with 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);
}
Also used : PathId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.PathId) RouteDistinguisher(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.RouteDistinguisher) MapEntryNode(org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode)

Example 9 with 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();
}
Also used : DestinationFlowspecL3vpnIpv6Builder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.l3vpn.destination.ipv6.DestinationFlowspecL3vpnIpv6Builder) RouteDistinguisher(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.RouteDistinguisher) Flowspec(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.Flowspec) List(java.util.List)

Example 10 with 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 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());
}
Also used : PathId(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.PathId) Ipv4NextHopBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.next.hop.c.next.hop.ipv4.next.hop._case.Ipv4NextHopBuilder) Ipv4NextHopCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.next.hop.c.next.hop.Ipv4NextHopCaseBuilder) Ipv4AddressNoZone(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone) Statement(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.routing.policy.rev151009.routing.policy.top.routing.policy.policy.definitions.policy.definition.statements.Statement) Attributes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes) RouteEntryBaseAttributes(org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.RouteEntryBaseAttributes) RouteTargetConstrainRouteBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.route.target.constrain.rev180618.route.target.constrain.routes.route.target.constrain.routes.RouteTargetConstrainRouteBuilder) RouteAttributeContainer(org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.registry.RouteAttributeContainer) AttributesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.AttributesBuilder) Route(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.Route) IPV4UNICAST(org.opendaylight.yang.gen.v1.http.openconfig.net.yang.bgp.types.rev151009.IPV4UNICAST) Test(org.junit.Test) AbstractStatementRegistryTest(org.opendaylight.protocol.bgp.openconfig.routing.policy.spi.AbstractStatementRegistryTest)

Aggregations

Test (org.junit.Test)14 PathId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.PathId)14 PathId (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.PathId)9 AbstractRIBSupportTest (org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest)8 RouteDistinguisher (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev200120.RouteDistinguisher)6 List (java.util.List)4 Flowspec (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.destination.Flowspec)4 MapEntryNode (org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode)4 Ipv4AddressNoZone (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone)3 Ipv4Prefix (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix)3 UpdateBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.UpdateBuilder)3 Route (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.Route)3 ByteBuf (io.netty.buffer.ByteBuf)2 ArrayList (java.util.ArrayList)2 Before (org.junit.Before)2 OffsetMap (org.opendaylight.protocol.bgp.mode.impl.add.OffsetMap)2 PeerSpecificParserConstraint (org.opendaylight.protocol.bgp.parser.spi.PeerSpecificParserConstraint)2 AsNumber (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.AsNumber)2 DestinationFlowspecL3vpnIpv4Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.l3vpn.destination.ipv4.DestinationFlowspecL3vpnIpv4Builder)2 DestinationFlowspecL3vpnIpv6Builder (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev200120.flowspec.l3vpn.destination.ipv6.DestinationFlowspecL3vpnIpv6Builder)2