import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-final class EvpnRibSupport extends AbstractRIBSupport<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .bgp.evpn.rev171213.bgp.rib.rib.peer.adj.rib.in.tables.routes.EvpnRoutesCase, EvpnRoute, EvpnRouteKey> {
+final class EvpnRibSupport extends AbstractRIBSupport<EvpnRoute, EvpnRouteKey> {
private static final EvpnRibSupport SINGLETON = new EvpnRibSupport();
private static final Logger LOG = LoggerFactory.getLogger(EvpnRibSupport.class);
private static final QName ROUTE_KEY_QNAME = QName.create(EvpnRoute.QNAME, ROUTE_KEY).intern();
return new NodeIdentifierWithPredicates(routeQName(), ROUTE_KEY_QNAME, ByteArray.encodeBase64(buffer));
}
- @Override
- public EvpnRouteKey extractRouteKey(final EvpnRoute route) {
- return route.getKey();
- }
-
@Override
public EvpnRoute createRoute(final EvpnRoute route, final EvpnRouteKey routeKey, final PathId pathId,
final Attributes attributes) {
}
return builder.setRouteKey(routeKey.getRouteKey()).setAttributes(attributes).build();
}
-
- @Override
- public Collection<EvpnRoute> changedRoutes(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
- .yang.bgp.evpn.rev171213.bgp.rib.rib.peer.adj.rib.in.tables.routes.EvpnRoutesCase routes) {
- final EvpnRoutes routeCont = routes.getEvpnRoutes();
- if (routeCont == null) {
- return Collections.emptyList();
- }
- return routeCont.getEvpnRoute();
- }
}
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
public abstract class AbstractFlowspecRIBSupport<T extends AbstractFlowspecNlriParser,
- C extends Routes, R extends Route, S extends Identifier>
- extends MultiPathAbstractRIBSupport<C, R, S> {
+ R extends Route, S extends Identifier>
+ extends MultiPathAbstractRIBSupport<R, S> {
protected final T nlriParser;
protected AbstractFlowspecRIBSupport(
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
public final class FlowspecIpv4RIBSupport extends AbstractFlowspecRIBSupport<SimpleFlowspecIpv4NlriParser,
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.bgp.rib.rib.peer
- .adj.rib.in.tables.routes.FlowspecRoutesCase, FlowspecRoute, FlowspecRouteKey> {
+ FlowspecRoute, FlowspecRouteKey> {
public FlowspecIpv4RIBSupport(SimpleFlowspecExtensionProviderContext context) {
super(
return new FlowspecIpv4RIBSupport(context);
}
- @Override
- public FlowspecRouteKey extractRouteKey(final FlowspecRoute route) {
- return route.getKey();
- }
-
@Nonnull
@Override
public FlowspecRoute createRoute(
return builder.setRouteKey(routeKey.getRouteKey()).setPathId(pathId).setAttributes(attributes).build();
}
- @Override
- public Collection<FlowspecRoute> changedRoutes(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
- .yang.bgp.flowspec.rev171207.bgp.rib.rib.peer.adj.rib.in.tables.routes.FlowspecRoutesCase routes) {
- final FlowspecRoutes routesCont = routes.getFlowspecRoutes();
- if (routesCont == null) {
- return Collections.emptyList();
- }
- return routesCont.getFlowspecRoute();
- }
-
@Override
public FlowspecRouteKey createNewRouteKey(final PathId pathId, final FlowspecRouteKey routeKey) {
return new FlowspecRouteKey(pathId, routeKey.getRouteKey());
*/
package org.opendaylight.protocol.bgp.flowspec;
-import java.util.Collection;
-import java.util.Collections;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.FlowspecSubsequentAddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.bgp.rib.rib.loc.rib.tables.routes.FlowspecIpv6RoutesCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.flowspec.destination.ipv6.DestinationFlowspec;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily;
public final class FlowspecIpv6RIBSupport extends AbstractFlowspecRIBSupport<SimpleFlowspecIpv6NlriParser,
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.bgp.rib.rib.peer.adj
- .rib.in.tables.routes.FlowspecIpv6RoutesCase, FlowspecRoute, FlowspecRouteKey> {
+ FlowspecRoute, FlowspecRouteKey> {
public FlowspecIpv6RIBSupport(SimpleFlowspecExtensionProviderContext context) {
super(
return new FlowspecIpv6RIBSupport(context);
}
- @Override
- public FlowspecRouteKey extractRouteKey(final FlowspecRoute route) {
- return route.getKey();
- }
-
@Override
public FlowspecRoute createRoute(final FlowspecRoute route, final FlowspecRouteKey routeKey,
final PathId pathId, final Attributes attributes) {
return builder.setRouteKey(routeKey.getRouteKey()).setPathId(pathId).setAttributes(attributes).build();
}
- @Override
- public Collection<FlowspecRoute> changedRoutes(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
- .yang.bgp.flowspec.rev171207.bgp.rib.rib.peer.adj.rib.in.tables.routes.FlowspecIpv6RoutesCase routes) {
- final FlowspecIpv6Routes routesCont = routes.getFlowspecIpv6Routes();
- if (routesCont == null) {
- return Collections.emptyList();
- }
- return routesCont.getFlowspecRoute();
- }
-
@Override
public FlowspecRouteKey createNewRouteKey(final PathId pathId, final FlowspecRouteKey routeKey) {
return new FlowspecRouteKey(pathId, routeKey.getRouteKey());
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
public abstract class AbstractFlowspecL3vpnRIBSupport
- <T extends AbstractFlowspecL3vpnNlriParser, C extends Routes, R extends Route, S extends Identifier>
- extends AbstractFlowspecRIBSupport<T, C, R, S> {
+ <T extends AbstractFlowspecL3vpnNlriParser, R extends Route, S extends Identifier>
+ extends AbstractFlowspecRIBSupport<T, R, S> {
private final NodeIdentifier routeDistinguisherNID;
protected AbstractFlowspecL3vpnRIBSupport(
*/
package org.opendaylight.protocol.bgp.flowspec.l3vpn.ipv4;
-import java.util.Collection;
-import java.util.Collections;
import org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecExtensionProviderContext;
import org.opendaylight.protocol.bgp.flowspec.l3vpn.AbstractFlowspecL3vpnRIBSupport;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.bgp.rib.rib.loc.rib.tables.routes.FlowspecL3vpnIpv4RoutesCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
public final class FlowspecL3vpnIpv4RIBSupport extends AbstractFlowspecL3vpnRIBSupport<FlowspecL3vpnIpv4NlriParser,
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.bgp.rib.rib.peer.adj
- .rib.in.tables.routes.FlowspecL3vpnIpv4RoutesCase, FlowspecL3vpnRoute, FlowspecL3vpnRouteKey> {
+ FlowspecL3vpnRoute, FlowspecL3vpnRouteKey> {
public FlowspecL3vpnIpv4RIBSupport(final SimpleFlowspecExtensionProviderContext context) {
super(
return new FlowspecL3vpnRouteKey(pathId, routeKey.getRouteKey());
}
- @Override
- public FlowspecL3vpnRouteKey extractRouteKey(final FlowspecL3vpnRoute route) {
- return route.getKey();
- }
-
@Override
public FlowspecL3vpnRoute createRoute(
final FlowspecL3vpnRoute route,
}
return builder.setRouteKey(routeKey.getRouteKey()).setPathId(pathId).setAttributes(attributes).build();
}
-
- @Override
- public Collection<FlowspecL3vpnRoute> changedRoutes(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml
- .ns.yang.bgp.flowspec.rev171207.bgp.rib.rib.peer.adj.rib.in.tables.routes.FlowspecL3vpnIpv4RoutesCase routes) {
- final FlowspecL3vpnIpv4Routes routeCont = routes.getFlowspecL3vpnIpv4Routes();
- if (routeCont == null) {
- return Collections.emptyList();
- }
- return routeCont.getFlowspecL3vpnRoute();
- }
}
*/
package org.opendaylight.protocol.bgp.flowspec.l3vpn.ipv6;
-import java.util.Collection;
-import java.util.Collections;
import org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecExtensionProviderContext;
import org.opendaylight.protocol.bgp.flowspec.l3vpn.AbstractFlowspecL3vpnRIBSupport;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.bgp.rib.rib.loc.rib.tables.routes.FlowspecL3vpnIpv6RoutesCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv6AddressFamily;
-public final class FlowspecL3vpnIpv6RIBSupport
- extends AbstractFlowspecL3vpnRIBSupport<FlowspecL3vpnIpv6NlriParser,
- org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev171207.bgp.rib.rib.peer.adj
- .rib.in.tables.routes.FlowspecL3vpnIpv6RoutesCase, FlowspecL3vpnRoute, FlowspecL3vpnRouteKey> {
+public final class FlowspecL3vpnIpv6RIBSupport extends AbstractFlowspecL3vpnRIBSupport<FlowspecL3vpnIpv6NlriParser,
+ FlowspecL3vpnRoute, FlowspecL3vpnRouteKey> {
private FlowspecL3vpnIpv6RIBSupport(SimpleFlowspecExtensionProviderContext context) {
super(
FlowspecL3vpnIpv6RoutesCase.class,
return new FlowspecL3vpnRouteKey(pathId, routeKey.getRouteKey());
}
- @Override
- public FlowspecL3vpnRouteKey extractRouteKey(final FlowspecL3vpnRoute route) {
- return route.getKey();
- }
-
@Override
public FlowspecL3vpnRoute createRoute(
final FlowspecL3vpnRoute route,
}
return builder.setRouteKey(routeKey.getRouteKey()).setPathId(pathId).setAttributes(attributes).build();
}
-
- @Override
- public Collection<FlowspecL3vpnRoute> changedRoutes(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml
- .ns.yang.bgp.flowspec.rev171207.bgp.rib.rib.peer.adj.rib.in.tables.routes.FlowspecL3vpnIpv6RoutesCase routes) {
- final FlowspecL3vpnIpv6Routes routeCont = routes.getFlowspecL3vpnIpv6Routes();
- if (routeCont == null) {
- return Collections.emptyList();
- }
- return routeCont.getFlowspecL3vpnRoute();
- }
}
/**
* Common {@link org.opendaylight.protocol.bgp.rib.spi.RIBSupport} class for IPv4 and IPv6 addresses.
*/
-abstract class AbstractIPRibSupport<C extends Routes, R extends Route, N extends Identifier>
- extends MultiPathAbstractRIBSupport<C, R,N> {
+abstract class AbstractIPRibSupport<R extends Route, N extends Identifier> extends MultiPathAbstractRIBSupport<R,N> {
private static final Logger LOG = LoggerFactory.getLogger(AbstractIPRibSupport.class);
private final NodeIdentifier prefixNid;
private final NodeIdentifier nlriRoutesList;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import javax.annotation.Nonnull;
import org.opendaylight.protocol.bgp.parser.spi.PathIdUtil;
/**
* Class supporting IPv4 unicast RIBs.
*/
-final class IPv4RIBSupport extends AbstractIPRibSupport<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
- .yang.bgp.inet.rev171207.bgp.rib.rib.peer.adj.rib.in.tables.routes.Ipv4RoutesCase,
- Ipv4Route, Ipv4RouteKey> {
+final class IPv4RIBSupport extends AbstractIPRibSupport<Ipv4Route, Ipv4RouteKey> {
private static final IPv4RIBSupport SINGLETON = new IPv4RIBSupport();
.build()).build();
}
- @Override
- public Ipv4RouteKey extractRouteKey(final Ipv4Route route) {
- return route.getKey();
- }
-
@Override
public Ipv4Route createRoute(final Ipv4Route route, final Ipv4RouteKey routeKey, final PathId pathId,
final Attributes attributes) {
return builder.setPrefix(routeKey.getPrefix()).setPathId(pathId).setAttributes(attributes).build();
}
- @Override
- public Collection<Ipv4Route> changedRoutes(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .bgp.inet.rev171207.bgp.rib.rib.peer.adj.rib.in.tables.routes.Ipv4RoutesCase routes) {
- final Ipv4Routes routeCont = routes.getIpv4Routes();
- if (routeCont == null) {
- return Collections.emptyList();
- }
- return routeCont.getIpv4Route();
- }
-
@Override
public Ipv4RouteKey createNewRouteKey(final PathId pathId, final Ipv4RouteKey routeKey) {
return new Ipv4RouteKey(pathId, routeKey.getPrefix());
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import org.opendaylight.protocol.bgp.parser.spi.PathIdUtil;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
/**
* Class supporting IPv6 unicast RIBs.
*/
-final class IPv6RIBSupport extends AbstractIPRibSupport<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
- .yang.bgp.inet.rev171207.bgp.rib.rib.peer.adj.rib.in.tables.routes.Ipv6RoutesCase, Ipv6Route, Ipv6RouteKey> {
+final class IPv6RIBSupport extends AbstractIPRibSupport<Ipv6Route, Ipv6RouteKey> {
private static final IPv6RIBSupport SINGLETON = new IPv6RIBSupport();
return prefs;
}
- @Override
- public Ipv6RouteKey extractRouteKey(final Ipv6Route route) {
- return route.getKey();
- }
-
@Override
public Ipv6Route createRoute(final Ipv6Route route, final Ipv6RouteKey routeKey, final PathId pathId,
final Attributes attributes) {
return builder.setPrefix(routeKey.getPrefix()).setPathId(pathId).setAttributes(attributes).build();
}
- @Override
- public Collection<Ipv6Route> changedRoutes(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .bgp.inet.rev171207.bgp.rib.rib.peer.adj.rib.in.tables.routes.Ipv6RoutesCase routes) {
- final Ipv6Routes routeCont = routes.getIpv6Routes();
- if (routeCont == null) {
- return Collections.emptyList();
- }
- return routeCont.getIpv6Route();
- }
-
@Override
public Ipv6RouteKey createNewRouteKey(final PathId pathId, final Ipv6RouteKey routeKey) {
return new Ipv6RouteKey(pathId, routeKey.getPrefix());
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public abstract class AbstractVpnRIBSupport<C extends Routes> extends AbstractRIBSupport<C, VpnRoute, VpnRouteKey> {
+public abstract class AbstractVpnRIBSupport extends AbstractRIBSupport<VpnRoute, VpnRouteKey> {
private static final Logger LOG = LoggerFactory.getLogger(AbstractVpnRIBSupport.class);
private final NodeIdentifier nlriRoutesListNid;
private final NodeIdentifier prefixTypeNid;
return new NodeIdentifierWithPredicates(routeQName(), this.routeKey, ByteArray.encodeBase64(buffer));
}
-
- @Override
- public final VpnRouteKey extractRouteKey(final VpnRoute route) {
- return route.getKey();
- }
-
@Override
public final VpnRoute createRoute(
final VpnRoute route,
*/
package org.opendaylight.protocol.bgp.l3vpn.ipv4;
-import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import org.opendaylight.protocol.bgp.l3vpn.AbstractVpnRIBSupport;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
-final class VpnIpv4RIBSupport extends AbstractVpnRIBSupport<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml
- .ns.yang.bgp.vpn.ipv4.rev171207.bgp.rib.rib.peer.adj.rib.in.tables.routes.VpnIpv4RoutesCase> {
+final class VpnIpv4RIBSupport extends AbstractVpnRIBSupport {
/**
* Default constructor. Requires the QName of the container augmented under the routes choice
* node in instantiations of the rib grouping. It is assumed that this container is defined by
.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationVpnIpv4CaseBuilder()
.setVpnIpv4Destination(new VpnIpv4DestinationBuilder().setVpnDestination(dests).build()).build();
}
-
- @Override
- public Collection<VpnRoute> changedRoutes(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .bgp.vpn.ipv4.rev171207.bgp.rib.rib.peer.adj.rib.in.tables.routes.VpnIpv4RoutesCase routes) {
- final VpnIpv4Routes routeCont = routes.getVpnIpv4Routes();
- if (routeCont == null) {
- return Collections.emptyList();
- }
- return routeCont.getVpnRoute();
- }
}
*/
package org.opendaylight.protocol.bgp.l3vpn.ipv6;
-import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import org.opendaylight.protocol.bgp.l3vpn.AbstractVpnRIBSupport;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier;
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
-final class VpnIpv6RIBSupport extends AbstractVpnRIBSupport<org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml
- .ns.yang.bgp.vpn.ipv6.rev171207.bgp.rib.rib.peer.adj.rib.in.tables.routes.VpnIpv6RoutesCase> {
+final class VpnIpv6RIBSupport extends AbstractVpnRIBSupport {
/**
* Default constructor. Requires the QName of the container augmented under the routes choice
.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationVpnIpv6CaseBuilder()
.setVpnIpv6Destination(new VpnIpv6DestinationBuilder().setVpnDestination(dests).build()).build();
}
-
- @Override
- public Collection<VpnRoute> changedRoutes(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang
- .bgp.vpn.ipv6.rev171207.bgp.rib.rib.peer.adj.rib.in.tables.routes.VpnIpv6RoutesCase routes) {
- final VpnIpv6Routes routeCont = routes.getVpnIpv6Routes();
- if (routeCont == null) {
- return Collections.emptyList();
- }
- return routeCont.getVpnRoute();
- }
}
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-abstract class AbstractLabeledUnicastRIBSupport<C extends Routes>
- extends MultiPathAbstractRIBSupport<C, LabeledUnicastRoute, LabeledUnicastRouteKey> {
+abstract class AbstractLabeledUnicastRIBSupport
+ extends MultiPathAbstractRIBSupport<LabeledUnicastRoute, LabeledUnicastRouteKey> {
private static final NodeIdentifier PREFIX_TYPE_NID = NodeIdentifier.create(QName.create(CLabeledUnicastDestination.QNAME, "prefix").intern());
private static final NodeIdentifier LABEL_STACK_NID = NodeIdentifier.create(QName.create(CLabeledUnicastDestination.QNAME, "label-stack").intern());
private static final NodeIdentifier LV_NID = NodeIdentifier.create(QName.create(CLabeledUnicastDestination.QNAME, "label-value").intern());
return new LabeledUnicastRouteKey(pathId, routeKey.getRouteKey());
}
- @Override
- public final LabeledUnicastRouteKey extractRouteKey(final LabeledUnicastRoute route) {
- return route.getKey();
- }
-
@Override
public final LabeledUnicastRoute createRoute(final LabeledUnicastRoute route,
final LabeledUnicastRouteKey routeKey,
package org.opendaylight.protocol.bgp.labeled.unicast;
import java.util.Collection;
-import java.util.Collections;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.LabeledUnicastSubsequentAddressFamily;
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-public final class LabeledUnicastIpv4RIBSupport extends AbstractLabeledUnicastRIBSupport<org.opendaylight.yang.gen.v1
- .urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.bgp.rib.rib.peer.adj.rib.in.tables
- .routes.LabeledUnicastRoutesCase> {
+public final class LabeledUnicastIpv4RIBSupport extends AbstractLabeledUnicastRIBSupport {
private static final LabeledUnicastIpv4RIBSupport SINGLETON = new LabeledUnicastIpv4RIBSupport();
private LabeledUnicastIpv4RIBSupport() {
super(LabeledUnicastRoutesCase.class, LabeledUnicastRoutes.class, LabeledUnicastRoute.class,
- Ipv4AddressFamily.class, LabeledUnicastSubsequentAddressFamily.class, DestinationLabeledUnicast.QNAME);
+ Ipv4AddressFamily.class, LabeledUnicastSubsequentAddressFamily.class, DestinationLabeledUnicast.QNAME);
}
static LabeledUnicastIpv4RIBSupport getInstance() {
@Override
protected DestinationType buildDestination(final Collection<MapEntryNode> routes) {
return new DestinationLabeledUnicastCaseBuilder().setDestinationLabeledUnicast(
- new DestinationLabeledUnicastBuilder().setCLabeledUnicastDestination(extractRoutes(routes)).build()).build();
+ new DestinationLabeledUnicastBuilder().setCLabeledUnicastDestination(extractRoutes(routes)).build()).build();
}
@Override
protected DestinationType buildWithdrawnDestination(final Collection<MapEntryNode> routes) {
return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationLabeledUnicastCaseBuilder().setDestinationLabeledUnicast(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.labeled.unicast._case.DestinationLabeledUnicastBuilder().setCLabeledUnicastDestination(
- extractRoutes(routes)).build()).build();
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.destination.labeled.unicast._case.DestinationLabeledUnicastBuilder().setCLabeledUnicastDestination(
+ extractRoutes(routes)).build()).build();
}
@Override
}
return null;
}
-
- @Override
- public Collection<LabeledUnicastRoute> changedRoutes(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml
- .ns.yang.bgp.labeled.unicast.rev171207.bgp.rib.rib.peer.adj.rib.in.tables.routes
- .LabeledUnicastRoutesCase routes) {
- final LabeledUnicastRoutes routeCont = routes.getLabeledUnicastRoutes();
- if (routeCont == null) {
- return Collections.emptyList();
- }
- return routeCont.getLabeledUnicastRoute();
- }
}
package org.opendaylight.protocol.bgp.labeled.unicast;
import java.util.Collection;
-import java.util.Collections;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.LabeledUnicastSubsequentAddressFamily;
import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
-final class LabeledUnicastIpv6RIBSupport extends AbstractLabeledUnicastRIBSupport<org.opendaylight.yang.gen.v1.urn
- .opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.bgp.rib.rib.peer.adj.rib.in.tables
- .routes.LabeledUnicastIpv6RoutesCase> {
+final class LabeledUnicastIpv6RIBSupport extends AbstractLabeledUnicastRIBSupport {
private static final LabeledUnicastIpv6RIBSupport SINGLETON = new LabeledUnicastIpv6RIBSupport();
private LabeledUnicastIpv6RIBSupport() {
super(LabeledUnicastIpv6RoutesCase.class, LabeledUnicastIpv6Routes.class, LabeledUnicastRoute.class,
- Ipv4AddressFamily.class, LabeledUnicastSubsequentAddressFamily.class, DestinationIpv6LabeledUnicast.QNAME);
+ Ipv4AddressFamily.class, LabeledUnicastSubsequentAddressFamily.class, DestinationIpv6LabeledUnicast.QNAME);
}
static LabeledUnicastIpv6RIBSupport getInstance() {
@Override
protected DestinationType buildDestination(final Collection<MapEntryNode> routes) {
return new DestinationIpv6LabeledUnicastCaseBuilder().setDestinationIpv6LabeledUnicast(
- new DestinationIpv6LabeledUnicastBuilder().setCLabeledUnicastDestination(extractRoutes(routes)).build()).build();
+ new DestinationIpv6LabeledUnicastBuilder().setCLabeledUnicastDestination(extractRoutes(routes)).build()).build();
}
@Override
protected DestinationType buildWithdrawnDestination(final Collection<MapEntryNode> routes) {
return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.mp.unreach
- .nlri.withdrawn.routes.destination.type.DestinationIpv6LabeledUnicastCaseBuilder().setDestinationIpv6LabeledUnicast(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.mp
- .unreach.nlri.withdrawn.routes.destination.type.destination.ipv6.labeled.unicast._case.DestinationIpv6LabeledUnicastBuilder()
- .setCLabeledUnicastDestination(extractRoutes(routes)).build()).build();
+ .nlri.withdrawn.routes.destination.type.DestinationIpv6LabeledUnicastCaseBuilder().setDestinationIpv6LabeledUnicast(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.labeled.unicast.rev171207.update.attributes.mp
+ .unreach.nlri.withdrawn.routes.destination.type.destination.ipv6.labeled.unicast._case.DestinationIpv6LabeledUnicastBuilder()
+ .setCLabeledUnicastDestination(extractRoutes(routes)).build()).build();
}
@Override
}
return null;
}
-
- @Override
- public Collection<LabeledUnicastRoute> changedRoutes(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml
- .ns.yang.bgp.labeled.unicast.rev171207.bgp.rib.rib.peer.adj.rib.in.tables.routes.LabeledUnicastIpv6RoutesCase routes) {
- final LabeledUnicastIpv6Routes routeCont = routes.getLabeledUnicastIpv6Routes();
- if (routeCont == null) {
- return Collections.emptyList();
- }
- return routeCont.getLabeledUnicastRoute();
- }
}
import io.netty.buffer.ByteBuf;
import io.netty.buffer.Unpooled;
import java.util.Collection;
-import java.util.Collections;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-public final class LinkstateRIBSupport extends AbstractRIBSupport<org.opendaylight.yang.gen.v1.urn.opendaylight.params
- .xml.ns.yang.bgp.linkstate.rev171207.bgp.rib.rib.peer.adj.rib.in.tables.routes.LinkstateRoutesCase,
- LinkstateRoute, LinkstateRouteKey> {
+public final class LinkstateRIBSupport extends AbstractRIBSupport<LinkstateRoute, LinkstateRouteKey> {
private static final Logger LOG = LoggerFactory.getLogger(LinkstateRIBSupport.class);
private static final QName ROUTE_KEY_QNAME = QName.create(LinkstateRoute.QNAME, ROUTE_KEY).intern();
private static final LinkstateRIBSupport SINGLETON = new LinkstateRIBSupport();
return routes.stream().map(LinkstateNlriParser::extractLinkstateDestination).collect(Collectors.toList());
}
- @Override
- public LinkstateRouteKey extractRouteKey(final LinkstateRoute route) {
- return route.getKey();
- }
-
@Override
public LinkstateRoute createRoute(
final LinkstateRoute route,
}
return builder.setRouteKey(routeKey.getRouteKey()).setAttributes(attributes).build();
}
-
- @Override
- public Collection<LinkstateRoute> changedRoutes(final org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns
- .yang.bgp.linkstate.rev171207.bgp.rib.rib.peer.adj.rib.in.tables.routes.LinkstateRoutesCase routes) {
- final LinkstateRoutes routeCont = routes.getLinkstateRoutes();
- if (routeCont == null) {
- return Collections.emptyList();
- }
- return routeCont.getLinkstateRoute();
- }
}
return this.adjInTracker.getTotalPrefixesInstalled();
}
- private final class AdjInTracker implements PrefixesReceivedCounters, PrefixesInstalledCounters, AutoCloseable,
- ClusteredDataTreeChangeListener<Tables> {
+ private static final class AdjInTracker implements PrefixesReceivedCounters, PrefixesInstalledCounters,
+ AutoCloseable, ClusteredDataTreeChangeListener<Tables> {
private final RIBSupportContextRegistry registry;
private final KeyedInstanceIdentifier<Peer, PeerKey> peerIId;
private final InstanceIdentifier<EffectiveRibIn> effRibTables;
updateRoutes(tx, tk, ribSupport, tablePath, routesChangesContainer.getModifiedChildren());
break;
case WRITE:
- writeTable(tx, table.getDataAfter());
+ writeTable(tx, table);
break;
default:
LOG.warn("Ignoring unhandled root {}", table);
final KeyedInstanceIdentifier<Tables, TablesKey> tablePath,
final Collection<DataObjectModification<? extends DataObject>> routeChanges) {
for (final DataObjectModification<? extends DataObject> routeChanged : routeChanges) {
+ final Identifier routeKey
+ = ((InstanceIdentifier.IdentifiableItem) routeChanged.getIdentifier()).getKey();
switch (routeChanged.getModificationType()) {
case SUBTREE_MODIFIED:
case WRITE:
- writeRoutes(tx, tableKey, ribSupport, tablePath, (Route) routeChanged.getDataAfter());
+ writeRoutes(tx, tableKey, ribSupport, tablePath, routeKey, (Route) routeChanged.getDataAfter());
break;
case DELETE:
- final Route routeDeleted = (Route) routeChanged.getDataBefore();
- final Identifier routeKey = ribSupport.extractRouteKey(routeDeleted);
final InstanceIdentifier routeIID = ribSupport.createRouteIId(tablePath, routeKey);
tx.delete(LogicalDatastoreType.OPERATIONAL, routeIID);
break;
@SuppressWarnings("unchecked")
private void writeRoutes(final WriteTransaction tx, final TablesKey tk, final RIBSupport ribSupport,
- final KeyedInstanceIdentifier<Tables, TablesKey> tablePath, final Route route) {
- final Identifier routeKey = ribSupport.extractRouteKey(route);
+ final KeyedInstanceIdentifier<Tables, TablesKey> tablePath, final Identifier routeKey,
+ final Route route) {
final InstanceIdentifier routeIID = ribSupport.createRouteIId(tablePath, routeKey);
CountersUtil.increment(this.prefixesReceived.get(tk), tk);
final Optional<Attributes> effAtt = this.ribPolicies
}
@SuppressWarnings("unchecked")
- private void writeTable(final WriteTransaction tx, final Tables table) {
- if (table == null) {
+ private void writeTable(final WriteTransaction tx, final DataObjectModification<Tables> table) {
+ final Tables newTable = table.getDataAfter();
+ if (newTable == null) {
return;
}
- final TablesKey tableKey = table.getKey();
+ final TablesKey tableKey = newTable.getKey();
final KeyedInstanceIdentifier<Tables, TablesKey> tablePath
= this.effRibTables.child(Tables.class, tableKey);
LOG.trace("Create Empty table", tablePath);
tx.put(LogicalDatastoreType.OPERATIONAL, tablePath, new TablesBuilder()
.setAfi(tableKey.getAfi()).setSafi(tableKey.getSafi())
- .setAttributes(table.getAttributes()).build());
+ .setAttributes(newTable.getAttributes()).build());
final RIBSupport ribSupport = this.registry.getRIBSupport(tableKey);
- final Routes routes = table.getRoutes();
+ final Routes routes = newTable.getRoutes();
if (routes == null) {
return;
}
- final Collection<? extends Route> changedRoutes = ribSupport.changedRoutes(routes);
- for (final Route route : changedRoutes) {
- writeRoutes(tx, tableKey, ribSupport, tablePath, route);
+
+ final DataObjectModification routesChangesContainer =
+ table.getModifiedChildContainer(ribSupport.routesContainerClass());
+
+ if (routesChangesContainer == null) {
+ return;
}
+ updateRoutes(tx, tableKey, ribSupport, tablePath, routesChangesContainer.getModifiedChildren());
}
@Override
import org.slf4j.LoggerFactory;
@Beta
-public abstract class AbstractRIBSupport<C extends Routes, R extends Route, N extends Identifier>
- implements RIBSupport<C, R, N> {
+public abstract class AbstractRIBSupport<R extends Route, N extends Identifier>
+ implements RIBSupport<R, N> {
public static final String ROUTE_KEY = "route-key";
private static final Logger LOG = LoggerFactory.getLogger(AbstractRIBSupport.class);
private static final NodeIdentifier ADVERTISED_ROUTES = new NodeIdentifier(AdvertizedRoutes.QNAME);
/**
* Implements common methods for Advertisement of Multiple Paths on ribSupport.
*/
-public abstract class MultiPathAbstractRIBSupport<C extends Routes, R extends Route, N extends Identifier>
- extends AbstractRIBSupport<C, R, N> {
+public abstract class MultiPathAbstractRIBSupport<R extends Route, N extends Identifier>
+ extends AbstractRIBSupport<R, N> {
private final QName routeKeyQname;
private final QName pathIdQname;
private final NodeIdentifier pathIdNid;
* to register an implementation of this class and the RIB core then calls into it
* to inquire about details specific to that particular model.
*/
-public interface RIBSupport<C extends Routes, R extends Route, N extends Identifier> extends AddPathRibSupport {
+public interface RIBSupport<R extends Route, N extends Identifier> extends AddPathRibSupport {
/**
* Return the table-type-specific empty routes container, as augmented into the
* bgp-rib model under /rib/tables/routes choice node. This needs to include all
@Nonnull
Class<? extends SubsequentAddressFamily> getSafi();
- /**
- * Extract Routes from Route Container.
- *
- * @param routes container
- * @return routes
- */
- @Nonnull
- Collection<R> changedRoutes(@Nonnull C routes);
-
/**
* Creates Route Rib out Peer InstanceIdentifier.
*
@Nonnull KeyedInstanceIdentifier<Tables, TablesKey> ribOutIId,
@Nonnull N newRouteKey);
- /**
- * Extract key route from route
- *
- * @param route container
- * @return key
- */
- N extractRouteKey(R route);
-
@Nonnull
R createRoute(@Nullable R route, N routeKey, @Nullable PathId pathId, @Nonnull Attributes attributes);
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev171207.path.attributes.Attributes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev171207.destination.DestinationType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.Route;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev171207.rib.tables.Routes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.Ipv4AddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.UnicastSubsequentAddressFamily;
import org.opendaylight.yangtools.yang.binding.DataObject;
return false;
}
- @Override
- public Identifier extractRouteKey(final Route route) {
- return null;
- }
-
@Override
public Route createRoute(final Route route, final Identifier routeKey, final PathId pathId
, final Attributes attributes) {
return null;
}
-
- @Override
- public Collection changedRoutes(final Routes routes) {
- return null;
- }
}
\ No newline at end of file