leaf prefix {
type inet:ipv6-prefix;
}
+ uses bgp-msg:path-id-grouping;
}
grouping ipv4-prefixes {
list ipv6-route {
uses ipv6-prefix;
- key prefix;
+ key "prefix path-id";
uses bgp-rib:route {
augment "attributes/bgp-prefix-sid/bgp-prefix-sid-tlvs/bgp-prefix-sid-tlv" {
} else if (routes.getDestinationType() instanceof DestinationIpv6Case) {
final DestinationIpv6Case destinationIpv6Case = (DestinationIpv6Case) routes.getDestinationType();
for (final Ipv6Prefixes ipv6Prefix : destinationIpv6Case.getDestinationIpv6().getIpv6Prefixes()) {
+ PathIdUtil.writePathId(ipv6Prefix.getPathId(), byteAggregator);
ByteBufWriteUtil.writeMinimalPrefix(ipv6Prefix.getPrefix(), byteAggregator);
}
}
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.List;
+import javax.annotation.Nonnull;
+import javax.annotation.Nullable;
import org.opendaylight.protocol.bgp.parser.BGPParsingException;
+import org.opendaylight.protocol.bgp.parser.BgpTableTypeImpl;
+import org.opendaylight.protocol.bgp.parser.spi.MultiPathSupportUtil;
import org.opendaylight.protocol.bgp.parser.spi.NlriParser;
-import org.opendaylight.protocol.util.ByteArray;
+import org.opendaylight.protocol.bgp.parser.spi.PathIdUtil;
+import org.opendaylight.protocol.bgp.parser.spi.PeerSpecificParserConstraint;
import org.opendaylight.protocol.util.Ipv6Util;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv6Prefix;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.prefixes.DestinationIpv6;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.prefixes.DestinationIpv6Builder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.prefixes.destination.ipv6.Ipv6Prefixes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpUnreachNlriBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.mp.reach.nlri.AdvertizedRoutesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.mp.unreach.nlri.WithdrawnRoutesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.AddressFamily;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.types.rev130919.SubsequentAddressFamily;
public final class Ipv6NlriParser implements NlriParser {
- private static DestinationIpv6 prefixes(final ByteBuf nlri) {
- final List<Ipv6Prefix> prefs = Ipv6Util.prefixListForBytes(ByteArray.readAllBytes(nlri));
- final List<Ipv6Prefixes> prefixes = new ArrayList<>(prefs.size());
- for (final Ipv6Prefix p : prefs) {
- prefixes.add(new Ipv6PrefixesBuilder().setPrefix(p).build());
+ private static DestinationIpv6 prefixes(final ByteBuf nlri, final PeerSpecificParserConstraint constraint,
+ final Class<? extends AddressFamily> afi, final Class<? extends SubsequentAddressFamily> safi) {
+ final List<Ipv6Prefixes> prefixes = new ArrayList<>();
+ final boolean supported = MultiPathSupportUtil.isTableTypeSupported(constraint, new BgpTableTypeImpl(afi, safi));
+ while (nlri.isReadable()) {
+ final Ipv6PrefixesBuilder prefixesBuilder = new Ipv6PrefixesBuilder();
+ if (supported) {
+ prefixesBuilder.setPathId(PathIdUtil.readPathId(nlri));
+ }
+ prefixesBuilder.setPrefix(Ipv6Util.prefixForByteBuf(nlri));
+ prefixes.add(prefixesBuilder.build());
}
return new DestinationIpv6Builder().setIpv6Prefixes(prefixes).build();
}
@Override
- public void parseNlri(final ByteBuf nlri, final MpUnreachNlriBuilder builder) {
- builder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6CaseBuilder().setDestinationIpv6(
- prefixes(nlri)).build()).build());
+ public void parseNlri(final ByteBuf nlri, final MpUnreachNlriBuilder builder) throws BGPParsingException {
+ parseNlri(nlri, builder, null);
}
@Override
public void parseNlri(final ByteBuf nlri, final MpReachNlriBuilder builder) throws BGPParsingException {
- builder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(new DestinationIpv6CaseBuilder().setDestinationIpv6(prefixes(nlri)).build()).build());
+ parseNlri(nlri, builder, null);
+ }
+
+ @Override
+ public void parseNlri(@Nonnull final ByteBuf nlri, @Nonnull final MpReachNlriBuilder builder,
+ @Nullable final PeerSpecificParserConstraint constraint) throws BGPParsingException {
+ builder.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(new DestinationIpv6CaseBuilder().
+ setDestinationIpv6(prefixes(nlri, constraint, builder.getAfi(), builder.getSafi())).build()).build());
+ }
+
+ @Override
+ public void parseNlri(@Nonnull final ByteBuf nlri, @Nonnull final MpUnreachNlriBuilder builder, @Nullable final PeerSpecificParserConstraint constraint) throws BGPParsingException {
+ builder.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6CaseBuilder().setDestinationIpv6(
+ prefixes(nlri, constraint, builder.getAfi(), builder.getSafi())).build()).build());
}
}
\ No newline at end of file
final DestinationIpv6Case destinationIpv6Case = (DestinationIpv6Case) routes.getDestinationType();
if (destinationIpv6Case.getDestinationIpv6().getIpv6Prefixes() != null) {
for (final Ipv6Prefixes ipv6Prefix : destinationIpv6Case.getDestinationIpv6().getIpv6Prefixes()) {
+ PathIdUtil.writePathId(ipv6Prefix.getPathId(), byteAggregator);
ByteBufWriteUtil.writeMinimalPrefix(ipv6Prefix.getPrefix(), byteAggregator);
}
}
package org.opendaylight.protocol.bgp.parser.spi;
import com.google.common.base.Preconditions;
+import com.google.common.collect.ImmutableMap;
import io.netty.buffer.ByteBuf;
import javax.annotation.Nullable;
import org.opendaylight.protocol.util.ByteBufWriteUtil;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.PathId;
+import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
+import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
+import org.opendaylight.yangtools.yang.data.api.schema.DataContainerNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNode;
import org.opendaylight.yangtools.yang.data.api.schema.NormalizedNodes;
/**
* Extract PathId from route change received
*
- * @param data
+ * @param data Data containing the path Id
* @param pathNii Path Id NodeIdentifier specific per each Rib support
* @return The path identifier from data change, in case its not provided or supported return null
*/
}
return (Long) pathId.getValue();
}
+
+ /**
+ * Create a Add Path PathArgument Key(prefix+pathId)
+ *
+ * @param pathId Path Id value
+ * @param routeId Route Id value
+ * @param routeQname route QName provided per each RibSupport
+ * @param pathidQname Path Id QName provided per each RibSupport
+ * @param prefixQname Prefix QName provided per each RibSupport
+ * @return
+ */
+ public static PathArgument createNiiKey(final long pathId, final PathArgument routeId, final QName routeQname, final QName pathidQname,
+ final QName prefixQname) {
+ final String prefix = (String) (((NodeIdentifierWithPredicates) routeId).getKeyValues()).get(prefixQname);
+ final ImmutableMap<QName, Object> keyValues = ImmutableMap.of(pathidQname, pathId, prefixQname, prefix);
+
+ return new NodeIdentifierWithPredicates(routeQname, keyValues);
+ }
+
+ /**
+ * Build Path Id
+ *
+ * @param routesCont route container
+ * @param pathIdNii path Id node Identifier
+ * @return PathId or null in case is not the container
+ */
+ public static PathId buildPathId(final DataContainerNode<? extends PathArgument> routesCont, final NodeIdentifier pathIdNii) {
+ final Long pathIdVal = PathIdUtil.extractPathId(routesCont, pathIdNii);
+ return pathIdVal == null ? null : new PathId(pathIdVal);
+ }
}
import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.ImmutableCollection;
-import com.google.common.collect.ImmutableMap;
import com.google.common.collect.ImmutableSet;
import java.util.ArrayList;
import java.util.Collection;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.routes.Ipv4Routes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv4.routes.ipv4.routes.Ipv4Route;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.reach.nlri.advertized.routes.destination.type.DestinationIpv4CaseBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.PathId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpReachNlri;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpReachNlriBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.multiprotocol.rev130919.update.attributes.MpUnreachNlri;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.common.QName;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifier;
-import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.NodeIdentifierWithPredicates;
import org.opendaylight.yangtools.yang.data.api.YangInstanceIdentifier.PathArgument;
import org.opendaylight.yangtools.yang.data.api.schema.ChoiceNode;
import org.opendaylight.yangtools.yang.data.api.schema.MapEntryNode;
private static final QName PATHID_QNAME = QName.create(Ipv4Route.QNAME, "path-id").intern();
private static final IPv4RIBSupport SINGLETON = new IPv4RIBSupport();
private static final ImmutableCollection<Class<? extends DataObject>> CACHEABLE_NLRI_OBJECTS =
- ImmutableSet.<Class<? extends DataObject>>of(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.Ipv4Prefix.class);
+ ImmutableSet.of(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.Ipv4Prefix.class);
private final ChoiceNode emptyRoutes = Builders.choiceBuilder()
.withNodeIdentifier(new NodeIdentifier(Routes.QNAME))
.addChild(Builders.containerBuilder()
@Nonnull
@Override
public PathArgument getRouteIdAddPath(final long pathId, final PathArgument routeId) {
- final String prefix = (String) (((NodeIdentifierWithPredicates) routeId).getKeyValues()).get(PREFIX_QNAME);
- final ImmutableMap<QName, Object> keyValues = ImmutableMap.of(PATHID_QNAME, pathId, PREFIX_QNAME, prefix);
-
- return new NodeIdentifierWithPredicates(Ipv4Route.QNAME, keyValues);
+ return PathIdUtil.createNiiKey(pathId, routeId, Ipv4Route.QNAME, PATHID_QNAME, PREFIX_QNAME);
}
@Override
for (final MapEntryNode route : routes) {
final String prefix = (String) route.getChild(this.routeKeyLeaf).get().getValue();
final Ipv4PrefixesBuilder prefixBuilder = new Ipv4PrefixesBuilder().setPrefix(new Ipv4Prefix(prefix));
- prefixBuilder.setPathId(new PathId(PathIdUtil.extractPathId(route, PATH_ID_LEAF)));
+ prefixBuilder.setPathId(PathIdUtil.buildPathId(route, PATH_ID_LEAF));
prefs.add(prefixBuilder.build());
}
return prefs;
import java.util.ArrayList;
import java.util.Collection;
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.rev100924.Ipv6Prefix;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.bgp.rib.rib.loc.rib.tables.routes.Ipv6RoutesCase;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.prefixes.DestinationIpv6;
private static final QName PREFIX_QNAME = QName.create(Ipv6Route.QNAME, "prefix").intern();
private static final IPv6RIBSupport SINGLETON = new IPv6RIBSupport();
private static final ImmutableCollection<Class<? extends DataObject>> CACHEABLE_NLRI_OBJECTS =
- ImmutableSet.<Class<? extends DataObject>>of(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.Ipv6Prefix.class);
- private final ChoiceNode emptyRoutes = Builders.choiceBuilder()
- .withNodeIdentifier(new NodeIdentifier(Routes.QNAME))
- .addChild(Builders.containerBuilder()
- .withNodeIdentifier(new NodeIdentifier(Ipv6Routes.QNAME))
- .withChild(ImmutableNodes.mapNodeBuilder(Ipv6Route.QNAME).build()).build()).build();
- private final NodeIdentifier destination = new NodeIdentifier(DestinationIpv6.QNAME);
- private final NodeIdentifier route = new NodeIdentifier(Ipv6Route.QNAME);
- private final NodeIdentifier nlriRoutesList = new NodeIdentifier(Ipv6Prefixes.QNAME);
- private final NodeIdentifier routeKeyLeaf = new NodeIdentifier(PREFIX_QNAME);
+ ImmutableSet.of(org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.Ipv6Prefix.class);
+ private static final ChoiceNode EMPTY_ROUTES = Builders.choiceBuilder().withNodeIdentifier(new NodeIdentifier(Routes.QNAME))
+ .addChild(Builders.containerBuilder().withNodeIdentifier(new NodeIdentifier(Ipv6Routes.QNAME)).withChild(ImmutableNodes
+ .mapNodeBuilder(Ipv6Route.QNAME).build()).build()).build();
+ private static final NodeIdentifier DESTINATION = new NodeIdentifier(DestinationIpv6.QNAME);
+ private static final NodeIdentifier ROUTE = new NodeIdentifier(Ipv6Route.QNAME);
+ private static final NodeIdentifier NLRI_ROUTES_LIST = new NodeIdentifier(Ipv6Prefixes.QNAME);
+ private static final NodeIdentifier PATH_ID_LEAF = new NodeIdentifier(PREFIX_QNAME);
private IPv6RIBSupport() {
super(Ipv6RoutesCase.class, Ipv6Routes.class, Ipv6Route.class);
@Override
public ChoiceNode emptyRoutes() {
- return this.emptyRoutes;
+ return EMPTY_ROUTES;
+ }
+
+ @Override
+ public ImmutableCollection<Class<? extends DataObject>> cacheableNlriObjects() {
+ return CACHEABLE_NLRI_OBJECTS;
}
@Override
protected NodeIdentifier destinationContainerIdentifier() {
- return this.destination;
+ return DESTINATION;
}
@Override
- protected NodeIdentifier routeIdentifier() {
- return this.route;
+ protected MpReachNlri buildReach(final Collection<MapEntryNode> routes, final CNextHop hop) {
+ final MpReachNlriBuilder mb = new MpReachNlriBuilder();
+ mb.setAfi(Ipv6AddressFamily.class);
+ mb.setSafi(UnicastSubsequentAddressFamily.class);
+ mb.setCNextHop(hop);
+ mb.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
+ new DestinationIpv6CaseBuilder().setDestinationIpv6(
+ new DestinationIpv6Builder().setIpv6Prefixes(extractPrefixes(routes)).build()).build()).build());
+ return mb.build();
}
@Override
- protected NodeIdentifier routeKeyLeafIdentifier() {
- return this.routeKeyLeaf;
+ protected MpUnreachNlri buildUnreach(final Collection<MapEntryNode> routes) {
+ final MpUnreachNlriBuilder mb = new MpUnreachNlriBuilder();
+ mb.setAfi(Ipv6AddressFamily.class);
+ mb.setSafi(UnicastSubsequentAddressFamily.class);
+ mb.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(
+ new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6CaseBuilder().setDestinationIpv6(
+ new DestinationIpv6Builder().setIpv6Prefixes(extractPrefixes(routes)).build()).build()).build());
+ return mb.build();
+ }
+
+ @Override
+ protected NodeIdentifier routeIdentifier() {
+ return ROUTE;
}
@Override
protected NodeIdentifier nlriRoutesListIdentifier() {
- return this.nlriRoutesList;
+ return NLRI_ROUTES_LIST;
+ }
+
+ @Override
+ protected NodeIdentifier routeKeyLeafIdentifier() {
+ return PATH_ID_LEAF;
}
@Override
return Ipv6Route.QNAME;
}
- @Override
- public ImmutableCollection<Class<? extends DataObject>> cacheableNlriObjects() {
- return CACHEABLE_NLRI_OBJECTS;
- }
-
private List<Ipv6Prefixes> extractPrefixes(final Collection<MapEntryNode> routes) {
final List<Ipv6Prefixes> prefs = new ArrayList<>(routes.size());
for (final MapEntryNode ipv6Route : routes) {
- final String prefix = (String) ipv6Route.getChild(this.routeKeyLeaf).get().getValue();
- prefs.add(new Ipv6PrefixesBuilder().setPrefix(new Ipv6Prefix(prefix)).build());
+ final String prefix = (String) ipv6Route.getChild(PATH_ID_LEAF).get().getValue();
+ prefs.add(new Ipv6PrefixesBuilder().setPathId(PathIdUtil.buildPathId(ipv6Route, PATH_ID_LEAF)).setPrefix(new Ipv6Prefix(prefix)).build());
}
return prefs;
}
-
- @Override
- protected MpReachNlri buildReach(final Collection<MapEntryNode> routes, final CNextHop hop) {
- final MpReachNlriBuilder mb = new MpReachNlriBuilder();
- mb.setAfi(Ipv6AddressFamily.class);
- mb.setSafi(UnicastSubsequentAddressFamily.class);
- mb.setCNextHop(hop);
- mb.setAdvertizedRoutes(new AdvertizedRoutesBuilder().setDestinationType(
- new DestinationIpv6CaseBuilder().setDestinationIpv6(
- new DestinationIpv6Builder().setIpv6Prefixes(extractPrefixes(routes)).build()).build()).build());
- return mb.build();
- }
-
- @Override
- protected MpUnreachNlri buildUnreach(final Collection<MapEntryNode> routes) {
- final MpUnreachNlriBuilder mb = new MpUnreachNlriBuilder();
- mb.setAfi(Ipv6AddressFamily.class);
- mb.setSafi(UnicastSubsequentAddressFamily.class);
- mb.setWithdrawnRoutes(new WithdrawnRoutesBuilder().setDestinationType(
- new org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.update.attributes.mp.unreach.nlri.withdrawn.routes.destination.type.DestinationIpv6CaseBuilder().setDestinationIpv6(
- new DestinationIpv6Builder().setIpv6Prefixes(extractPrefixes(routes)).build()).build()).build());
- return mb.build();
- }
}
public class Ipv4ReachabilityTopologyBuilderTest extends AbstractTopologyBuilderTest {
+ static final long PATH_ID = 1;
private static final String ROUTE_IP4PREFIX = "127.1.0.0/32";
- private static final long ROUTE_IP4PATH_ID = 1;
private static final String NEXT_HOP = "127.1.0.1";
private static final String NEW_NEXT_HOP = "127.1.0.2";
this.ipv4TopoBuilder = new Ipv4ReachabilityTopologyBuilder(dataBroker, LOC_RIB_REF, TEST_TOPOLOGY_ID);
this.ipv4TopoBuilder.start(dataBroker, Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
final InstanceIdentifier<Tables> path = this.ipv4TopoBuilder.tableInstanceIdentifier(Ipv4AddressFamily.class, UnicastSubsequentAddressFamily.class);
- this.ipv4RouteIID = path.builder().child((Class)Ipv4Routes.class).child(Ipv4Route.class, new Ipv4RouteKey(new PathId(ROUTE_IP4PATH_ID),
+ this.ipv4RouteIID = path.builder().child((Class) Ipv4Routes.class).child(Ipv4Route.class, new Ipv4RouteKey(new PathId(PATH_ID),
new Ipv4Prefix(ROUTE_IP4PREFIX))).build();
}
final Attributes attribute = new AttributesBuilder()
.setCNextHop(new Ipv4NextHopCaseBuilder().setIpv4NextHop(new Ipv4NextHopBuilder().setGlobal(new Ipv4Address(nextHop)).build()).build())
.build();
- return new Ipv4RouteBuilder().setKey(new Ipv4RouteKey(new PathId(ROUTE_IP4PATH_ID), new Ipv4Prefix(ROUTE_IP4PREFIX)))
+ return new Ipv4RouteBuilder().setKey(new Ipv4RouteKey(new PathId(PATH_ID), new Ipv4Prefix(ROUTE_IP4PREFIX)))
.setPrefix(new Ipv4Prefix(ROUTE_IP4PREFIX)).setAttributes(attribute).build();
}
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
+import static org.opendaylight.bgpcep.bgp.topology.provider.Ipv4ReachabilityTopologyBuilderTest.PATH_ID;
import com.google.common.base.Optional;
import org.junit.Test;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.routes.ipv6.routes.Ipv6Route;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.routes.ipv6.routes.Ipv6RouteBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.inet.rev150305.ipv6.routes.ipv6.routes.Ipv6RouteKey;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.PathId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.Attributes;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.message.rev130919.path.attributes.AttributesBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.bgp.rib.rev130925.rib.Tables;
this.ipv6TopoBuilder = new Ipv6ReachabilityTopologyBuilder(dataBroker, LOC_RIB_REF, TEST_TOPOLOGY_ID);
this.ipv6TopoBuilder.start(dataBroker, Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class);
final InstanceIdentifier<Tables> path = this.ipv6TopoBuilder.tableInstanceIdentifier(Ipv6AddressFamily.class, UnicastSubsequentAddressFamily.class);
- this.ipv6RouteIID = path.builder().child((Class)Ipv6Routes.class).child(Ipv6Route.class, new Ipv6RouteKey(new Ipv6Prefix(ROUTE_IP6PREFIX))).build();
+ this.ipv6RouteIID = path.builder().child((Class) Ipv6Routes.class).child(Ipv6Route.class, new Ipv6RouteKey(new PathId(PATH_ID),
+ new Ipv6Prefix(ROUTE_IP6PREFIX))).build();
}
@Test
final Attributes attribute = new AttributesBuilder()
.setCNextHop(new Ipv6NextHopCaseBuilder().setIpv6NextHop(new Ipv6NextHopBuilder().setGlobal(new Ipv6Address(netxHop)).build()).build())
.build();
- return new Ipv6RouteBuilder().setKey(new Ipv6RouteKey(new Ipv6Prefix(ROUTE_IP6PREFIX))).setPrefix(new Ipv6Prefix(ROUTE_IP6PREFIX)).setAttributes(attribute).build();
+ return new Ipv6RouteBuilder().setKey(new Ipv6RouteKey(new PathId(PATH_ID), new Ipv6Prefix(ROUTE_IP6PREFIX)))
+ .setPrefix(new Ipv6Prefix(ROUTE_IP6PREFIX)).setAttributes(attribute).build();
}
}