Search in sources :

Example 71 with Routes

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes 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);
        }
    }
}
Also used : AdvertizedRoutes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.reach.mp.reach.nlri.AdvertizedRoutes) WithdrawnRoutes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.mp.unreach.nlri.WithdrawnRoutes) AttributesReach(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesReach) DestinationEvpnCase(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationEvpnCase) MpUnreachNlri(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.MpUnreachNlri) AttributesUnreach(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesUnreach)

Example 72 with Routes

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes in project bgpcep by opendaylight.

the class EvpnRibSupportTest method testChangedRoutes.

@Test
public void testChangedRoutes() {
    final Routes emptyCase = new EvpnRoutesCaseBuilder().build();
    DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyCase)).getRootNode();
    Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
    final Routes emptyRoutes = new EvpnRoutesCaseBuilder().setEvpnRoutes(new EvpnRoutesBuilder().build()).build();
    tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
    Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
    final Routes routes = new EvpnRoutesCaseBuilder().setEvpnRoutes(EVPN_ROUTES).build();
    tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(routes)).getRootNode();
    final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
    Assert.assertFalse(result.isEmpty());
}
Also used : DataTreeCandidateNode(org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode) EvpnRoutesCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.bgp.rib.rib.loc.rib.tables.routes.EvpnRoutesCaseBuilder) EvpnRoutes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.evpn.routes.EvpnRoutes) Routes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes) EvpnRoutesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.evpn.rev200120.evpn.routes.EvpnRoutesBuilder) AbstractRIBSupportTest(org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest) Test(org.junit.Test)

Example 73 with Routes

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes in project bgpcep by opendaylight.

the class IPv6RIBSupportTest method testBuildMpUnreachNlriUpdate.

@Test
public void testBuildMpUnreachNlriUpdate() {
    final Update update = this.ribSupport.buildUpdate(Collections.emptyList(), createRoutes(ROUTES), ATTRIBUTES);
    assertEquals(UNREACH_NLRI, update.getAttributes().augmentation(AttributesUnreach.class).getMpUnreachNlri().getWithdrawnRoutes().getDestinationType());
    assertNull(update.getAttributes().augmentation(AttributesReach.class));
}
Also used : AttributesReach(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesReach) Update(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update) AbstractRIBSupportTest(org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest) Test(org.junit.Test)

Example 74 with Routes

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes in project bgpcep by opendaylight.

the class IPv6RIBSupportTest method testChangedRoutes.

@Test
public void testChangedRoutes() {
    final Routes emptyCase = new Ipv6RoutesCaseBuilder().build();
    DataTreeCandidateNode tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyCase)).getRootNode();
    Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
    final Routes emptyRoutes = new Ipv6RoutesCaseBuilder().setIpv6Routes(new Ipv6RoutesBuilder().build()).build();
    tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(emptyRoutes)).getRootNode();
    Assert.assertTrue(this.ribSupport.changedRoutes(tree).isEmpty());
    final Routes routes = new Ipv6RoutesCaseBuilder().setIpv6Routes(ROUTES).build();
    tree = DataTreeCandidates.fromNormalizedNode(getRoutePath(), createRoutes(routes)).getRootNode();
    final Collection<DataTreeCandidateNode> result = this.ribSupport.changedRoutes(tree);
    Assert.assertFalse(result.isEmpty());
}
Also used : Ipv6RoutesCaseBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.bgp.rib.rib.loc.rib.tables.routes.Ipv6RoutesCaseBuilder) Ipv6RoutesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv6.routes.Ipv6RoutesBuilder) DataTreeCandidateNode(org.opendaylight.yangtools.yang.data.api.schema.tree.DataTreeCandidateNode) Ipv6Routes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev180329.ipv6.routes.Ipv6Routes) Routes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes) AbstractRIBSupportTest(org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest) Test(org.junit.Test)

Example 75 with Routes

use of org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev180329.rib.tables.Routes in project bgpcep by opendaylight.

the class BGPParserTest method testParseUpdateMessageWithMalformedAttributes.

/*
     * Tests withdrawn routes with malformed attribute.
     *
     * ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff <- marker
     * 00 36 <- length (54) - including header
     * 02 <- message type
     * 00 00 <- withdrawn routes length
     * 00 1b <- total path attribute length (27)
     * 40 <- attribute flags
     * 01 <- attribute type code (origin)
     * 01 <- WRONG attribute length
     * 00 <- Origin value (IGP)
     * 40 <- attribute flags
     * 03 <- attribute type code (Next Hop)
     * 04 <- attribute length
     * 0a 00 00 02 <- value (10.0.0.2)
     * 40 <- attribute flags
     * 0e <- attribute type code (MP_REACH)
     * 0d <- attribute length
     * 00 01 <- AFI (Ipv4)
     * 01 <- SAFI (Unicast)
     * 04 <- next hop length
     * ff ff ff ff <- next hop
     * 00 <- reserved
     * 18 <- length
     * 0a 00 01 <- prefix (10.0.1.0)
     * //NLRI
     * 18 <- length
     * 0a 00 02 <- prefix (10.0.2.0)
     */
@Test
public void testParseUpdateMessageWithMalformedAttributes() throws Exception {
    final PeerSpecificParserConstraintImpl constraint = new PeerSpecificParserConstraintImpl();
    constraint.addPeerConstraint(RevisedErrorHandlingSupport.class, RevisedErrorHandlingSupportImpl.forExternalPeer());
    final Update message = (Update) messageRegistry.parseMessage(Unpooled.wrappedBuffer(input.get(0)), constraint);
    assertNotNull(message);
    assertNull(message.getNlri());
    final List<WithdrawnRoutes> withdrawnRoutes = message.getWithdrawnRoutes();
    assertNotNull(withdrawnRoutes);
    assertEquals(1, withdrawnRoutes.size());
    final Attributes attributes = message.getAttributes();
    assertNotNull(attributes);
    assertNull(attributes.augmentation(AttributesReach.class));
    final AttributesUnreach AttributesUnreach = attributes.augmentation(AttributesUnreach.class);
    assertNotNull(AttributesUnreach);
    final MpUnreachNlri mpUnreachNlri = AttributesUnreach.getMpUnreachNlri();
    assertNotNull(mpUnreachNlri);
}
Also used : AttributesReach(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesReach) MpUnreachNlri(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.attributes.unreach.MpUnreachNlri) Attributes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.path.attributes.Attributes) AttributesUnreach(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesUnreach) WithdrawnRoutes(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.update.message.WithdrawnRoutes) Update(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update) PeerSpecificParserConstraintImpl(org.opendaylight.protocol.bgp.parser.spi.pojo.PeerSpecificParserConstraintImpl) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)86 ArrayList (java.util.ArrayList)69 AbstractRIBSupportTest (org.opendaylight.protocol.bgp.rib.spi.AbstractRIBSupportTest)61 Update (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev200120.Update)45 Uint32 (org.opendaylight.yangtools.yang.common.Uint32)43 ExecutionException (java.util.concurrent.ExecutionException)41 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)40 Routes (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.to.extraroutes.vpn.extra.routes.Routes)33 Uint64 (org.opendaylight.yangtools.yang.common.Uint64)31 List (java.util.List)30 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)30 BigInteger (java.math.BigInteger)29 InstructionGotoTable (org.opendaylight.genius.mdsalutil.instructions.InstructionGotoTable)27 VrfEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.fibmanager.rev150330.vrfentries.VrfEntry)27 VpnInstanceOpDataEntry (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.vpn.instance.op.data.VpnInstanceOpDataEntry)27 Logger (org.slf4j.Logger)27 LoggerFactory (org.slf4j.LoggerFactory)27 Collections (java.util.Collections)26 Prefixes (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.l3vpn.rev130911.prefix.to._interface.vpn.ids.Prefixes)26 AttributesReach (org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev180329.AttributesReach)26