EffectiveRibInWriter operates with binding databroker and while
we have tools to construct InstanceIdentifier for routesContainer
we are missing tool to extract routes from it. This patch should
provide just that.
JIRA:BGPCEP-495
Change-Id: I1aea06ec4f082d11643566aed761fcc4092b6fcc
Signed-off-by: Robert Varga <robert.varga@pantheon.tech>
Signed-off-by: Matej Perina <matej.perina@pantheon.tech>
17 files changed:
public EvpnRouteKey createRouteListKey(final long pathId, final String routeKey) {
return new EvpnRouteKey(new PathId(pathId), routeKey);
}
public EvpnRouteKey createRouteListKey(final long pathId, final String routeKey) {
return new EvpnRouteKey(new PathId(pathId), routeKey);
}
+
+ @Override
+ public List<EvpnRoute> routesFromContainer(final EvpnRoutes container) {
+ return container.getEvpnRoute();
+ }
package org.opendaylight.protocol.bgp.flowspec;
import java.util.Collections;
package org.opendaylight.protocol.bgp.flowspec;
import java.util.Collections;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.FlowspecSubsequentAddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.rib.loc.rib.tables.routes.FlowspecRoutesCase;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.FlowspecSubsequentAddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.rib.loc.rib.tables.routes.FlowspecRoutesCase;
public FlowspecRouteKey createRouteListKey(final long pathId, final String routeKey) {
return new FlowspecRouteKey(new PathId(pathId), routeKey);
}
public FlowspecRouteKey createRouteListKey(final long pathId, final String routeKey) {
return new FlowspecRouteKey(new PathId(pathId), routeKey);
}
+
+ @Override
+ public List<FlowspecRoute> routesFromContainer(final FlowspecRoutes container) {
+ return container.getFlowspecRoute();
+ }
package org.opendaylight.protocol.bgp.flowspec;
import java.util.Collections;
package org.opendaylight.protocol.bgp.flowspec;
import java.util.Collections;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.FlowspecSubsequentAddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.rib.loc.rib.tables.routes.FlowspecIpv6RoutesCase;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.FlowspecSubsequentAddressFamily;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.flowspec.rev180329.bgp.rib.rib.loc.rib.tables.routes.FlowspecIpv6RoutesCase;
public FlowspecRouteKey createRouteListKey(final long pathId, final String routeKey) {
return new FlowspecRouteKey(new PathId(pathId), routeKey);
}
public FlowspecRouteKey createRouteListKey(final long pathId, final String routeKey) {
return new FlowspecRouteKey(new PathId(pathId), routeKey);
}
+
+ @Override
+ public List<FlowspecRoute> routesFromContainer(final FlowspecIpv6Routes container) {
+ return container.getFlowspecRoute();
+ }
package org.opendaylight.protocol.bgp.flowspec.l3vpn.ipv4;
import java.util.Collections;
package org.opendaylight.protocol.bgp.flowspec.l3vpn.ipv4;
import java.util.Collections;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecExtensionProviderContext;
import org.opendaylight.protocol.bgp.flowspec.l3vpn.AbstractFlowspecL3vpnRIBSupport;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecExtensionProviderContext;
import org.opendaylight.protocol.bgp.flowspec.l3vpn.AbstractFlowspecL3vpnRIBSupport;
- public final FlowspecL3vpnRouteKey createRouteListKey(final long pathId, final String routeKey) {
+ public FlowspecL3vpnRouteKey createRouteListKey(final long pathId, final String routeKey) {
return new FlowspecL3vpnRouteKey(new PathId(pathId), routeKey);
}
return new FlowspecL3vpnRouteKey(new PathId(pathId), routeKey);
}
public FlowspecL3vpnIpv4Routes emptyRoutesContainer() {
return EMPTY_CONTAINER;
}
public FlowspecL3vpnIpv4Routes emptyRoutesContainer() {
return EMPTY_CONTAINER;
}
+
+ @Override
+ public List<FlowspecL3vpnRoute> routesFromContainer(final FlowspecL3vpnIpv4Routes container) {
+ return container.getFlowspecL3vpnRoute();
+ }
package org.opendaylight.protocol.bgp.flowspec.l3vpn.ipv6;
import java.util.Collections;
package org.opendaylight.protocol.bgp.flowspec.l3vpn.ipv6;
import java.util.Collections;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecExtensionProviderContext;
import org.opendaylight.protocol.bgp.flowspec.l3vpn.AbstractFlowspecL3vpnRIBSupport;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.protocol.bgp.flowspec.SimpleFlowspecExtensionProviderContext;
import org.opendaylight.protocol.bgp.flowspec.l3vpn.AbstractFlowspecL3vpnRIBSupport;
- public final FlowspecL3vpnRouteKey createRouteListKey(final long pathId, final String routeKey) {
+ public FlowspecL3vpnRouteKey createRouteListKey(final long pathId, final String routeKey) {
return new FlowspecL3vpnRouteKey(new PathId(pathId), routeKey);
}
return new FlowspecL3vpnRouteKey(new PathId(pathId), routeKey);
}
public FlowspecL3vpnIpv6Routes emptyRoutesContainer() {
return EMPTY_CONTAINER;
}
public FlowspecL3vpnIpv6Routes emptyRoutesContainer() {
return EMPTY_CONTAINER;
}
+
+ @Override
+ public List<FlowspecL3vpnRoute> routesFromContainer(final FlowspecL3vpnIpv6Routes container) {
+ return container.getFlowspecL3vpnRoute();
+ }
public Ipv4RouteKey createRouteListKey(final long pathId, final String routeKey) {
return new Ipv4RouteKey(new PathId(pathId), routeKey);
}
public Ipv4RouteKey createRouteListKey(final long pathId, final String routeKey) {
return new Ipv4RouteKey(new PathId(pathId), routeKey);
}
+
+ @Override
+ public List<Ipv4Route> routesFromContainer(final Ipv4Routes container) {
+ return container.getIpv4Route();
+ }
public Ipv6RouteKey createRouteListKey(final long pathId, final String routeKey) {
return new Ipv6RouteKey(new PathId(pathId), routeKey);
}
public Ipv6RouteKey createRouteListKey(final long pathId, final String routeKey) {
return new Ipv6RouteKey(new PathId(pathId), routeKey);
}
+
+ @Override
+ public List<Ipv6Route> routesFromContainer(final Ipv6Routes container) {
+ return container.getIpv6Route();
+ }
+
+ @Override
+ public final List<L3vpnMcastRoute> routesFromContainer(final S container) {
+ return container.getL3vpnMcastRoute();
+ }
+
abstract NodeIdentifierWithPredicates createRouteKey(UnkeyedListEntryNode l3vpn);
}
abstract NodeIdentifierWithPredicates createRouteKey(UnkeyedListEntryNode l3vpn);
}
- public VpnRouteKey createRouteListKey(final long pathId, final String vpnRouteKey) {
+ public final VpnRouteKey createRouteListKey(final long pathId, final String vpnRouteKey) {
return new VpnRouteKey(new PathId(pathId), vpnRouteKey);
}
return new VpnRouteKey(new PathId(pathId), vpnRouteKey);
}
+
+ @Override
+ public final List<VpnRoute> routesFromContainer(final S container) {
+ return container.getVpnRoute();
+ }
- protected DestinationType getAdvertisedDestinationType(List<VpnDestination> dests) {
+ protected DestinationType getAdvertisedDestinationType(final List<VpnDestination> dests) {
return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev180329.update
.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationVpnIpv4CaseBuilder()
.setVpnIpv4Destination(new VpnIpv4DestinationBuilder().setVpnDestination(dests).build()).build();
}
@Override
return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev180329.update
.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationVpnIpv4CaseBuilder()
.setVpnIpv4Destination(new VpnIpv4DestinationBuilder().setVpnDestination(dests).build()).build();
}
@Override
- protected DestinationType getWithdrawnDestinationType(List<VpnDestination> dests) {
+ protected DestinationType getWithdrawnDestinationType(final List<VpnDestination> dests) {
return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev180329.update
.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationVpnIpv4CaseBuilder()
.setVpnIpv4Destination(new VpnIpv4DestinationBuilder().setVpnDestination(dests).build()).build();
return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv4.rev180329.update
.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationVpnIpv4CaseBuilder()
.setVpnIpv4Destination(new VpnIpv4DestinationBuilder().setVpnDestination(dests).build()).build();
- protected DestinationType getAdvertisedDestinationType(List<VpnDestination> dests) {
+ protected DestinationType getAdvertisedDestinationType(final List<VpnDestination> dests) {
return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329.update
.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationVpnIpv6CaseBuilder()
.setVpnIpv6Destination(new VpnIpv6DestinationBuilder().setVpnDestination(dests).build()).build();
}
@Override
return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329.update
.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationVpnIpv6CaseBuilder()
.setVpnIpv6Destination(new VpnIpv6DestinationBuilder().setVpnDestination(dests).build()).build();
}
@Override
- protected DestinationType getWithdrawnDestinationType(List<VpnDestination> dests) {
+ protected DestinationType getWithdrawnDestinationType(final List<VpnDestination> dests) {
return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329.update
.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationVpnIpv6CaseBuilder()
.setVpnIpv6Destination(new VpnIpv6DestinationBuilder().setVpnDestination(dests).build()).build();
return new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.vpn.ipv6.rev180329.update
.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationVpnIpv6CaseBuilder()
.setVpnIpv6Destination(new VpnIpv6DestinationBuilder().setVpnDestination(dests).build()).build();
return builder.withKey(new LabeledUnicastRouteKey(new PathId(pathId), routeKey))
.setAttributes(attributes).build();
}
return builder.withKey(new LabeledUnicastRouteKey(new PathId(pathId), routeKey))
.setAttributes(attributes).build();
}
+
+ @Override
+ public final List<LabeledUnicastRoute> routesFromContainer(final S container) {
+ return container.getLabeledUnicastRoute();
+ }
public LinkstateRouteKey createRouteListKey(final long pathId, final String routeKey) {
return new LinkstateRouteKey(new PathId(pathId), routeKey);
}
public LinkstateRouteKey createRouteListKey(final long pathId, final String routeKey) {
return new LinkstateRouteKey(new PathId(pathId), routeKey);
}
+
+ @Override
+ public List<LinkstateRoute> routesFromContainer(final LinkstateRoutes container) {
+ return container.getLinkstateRoute();
+ }
return new MvpnRouteKey(new PathId(pathId), routeKey);
}
return new MvpnRouteKey(new PathId(pathId), routeKey);
}
+ @Override
+ public final List<MvpnRoute> routesFromContainer(final S container) {
+ return container.getMvpnRoute();
+ }
+
final MvpnChoice extractMvpnChoice(final DataContainerNode<? extends PathArgument> route) {
final DataObject nn = this.mappingService.fromNormalizedNode(this.routeDefaultYii, route).getValue();
return ((MvpnRoute) nn).getMvpnChoice();
final MvpnChoice extractMvpnChoice(final DataContainerNode<? extends PathArgument> route) {
final DataObject nn = this.mappingService.fromNormalizedNode(this.routeDefaultYii, route).getValue();
return ((MvpnRoute) nn).getMvpnChoice();
public RouteTargetConstrainRouteKey createRouteListKey(final long pathId, final String routeKey) {
return new RouteTargetConstrainRouteKey(new PathId(pathId), routeKey);
}
public RouteTargetConstrainRouteKey createRouteListKey(final long pathId, final String routeKey) {
return new RouteTargetConstrainRouteKey(new PathId(pathId), routeKey);
}
+
+ @Override
+ public List<RouteTargetConstrainRoute> routesFromContainer(final RouteTargetConstrainRoutes container) {
+ return container.getRouteTargetConstrainRoute();
+ }
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableSet;
import java.util.Collection;
import com.google.common.collect.ImmutableCollection;
import com.google.common.collect.ImmutableSet;
import java.util.Collection;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
@Nonnull
Class<R> routesListClass();
@Nonnull
Class<R> routesListClass();
+ @Nullable List<R> routesFromContainer(@Nonnull S container);
+
@Nonnull
default ImmutableCollection<Class<? extends DataObject>> cacheableAttributeObjects() {
return ImmutableSet.of();
@Nonnull
default ImmutableCollection<Class<? extends DataObject>> cacheableAttributeObjects() {
return ImmutableSet.of();
import com.google.common.collect.ImmutableMap;
import java.util.Collection;
import java.util.Collections;
import com.google.common.collect.ImmutableMap;
import java.util.Collection;
import java.util.Collections;
import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.PathId;
import org.opendaylight.controller.md.sal.dom.api.DOMDataWriteTransaction;
import org.opendaylight.mdsal.binding.dom.codec.api.BindingNormalizedNodeSerializer;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev180329.PathId;
public Ipv4RouteKey createRouteListKey(final long pathId, final String routeKey) {
return new Ipv4RouteKey(new PathId(pathId), routeKey);
}
public Ipv4RouteKey createRouteListKey(final long pathId, final String routeKey) {
return new Ipv4RouteKey(new PathId(pathId), routeKey);
}
+
+ @Override
+ public List<Ipv4Route> routesFromContainer(final Ipv4Routes container) {
+ return container.getIpv4Route();
+ }
}
\ No newline at end of file
}
\ No newline at end of file