diff options
author | Michal Cmarada <michal.cmarada@pantheon.tech> | 2018-05-04 16:13:09 +0200 |
---|---|---|
committer | Michal Cmarada <michal.cmarada@pantheon.tech> | 2018-05-09 14:36:21 +0200 |
commit | 8f9fe3ca424abc56d212a96af4ec5750a29e7673 (patch) | |
tree | c3472885ef0fb57452b88b4ea76f2935f81ca39f /routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingWriterFactory.java | |
parent | d5883157bff11ee89b95bc1abe7f62fca3509950 (diff) |
HC2VPP-253 - Bump routing models
This patch updates (for support of SRv6 and MPLS) routing models to:
- hc2vpp-ietf-routing@2018-03-13.yang
(RFC 8349, https://tools.ietf.org/html/rfc8349)
- hc2vpp-ietf-ipv4-unicast-routing@2018-03-13.yang (RFC 8349)
- hc2vpp-ietf-ipv6-unicast-routing@2018-03-13.yang (RFC 8349)
- hc2vpp-ietf-ipv6-router-advertisements@2018-03-13 (RFC 8349)
- hc2vpp-ietf-routing-types@2017-12-04
(RFC 8294 ,https://tools.ietf.org/html/rfc8294)
Due to odl bugs these models were changed,
see HC2VPP-298 for more details.
Significant changes in updated models:
- Routing instance was removed, we used vpp-routing-instance
as single instance before, which is no longer needed.
- Routing-protocol and Routing-protocols were refactored to
Control-plane-protocol/s. Control-protocol now uses type and name as key
- Route Key was changed from id to ipPrefix
- Next-hop and Next-Hop-list were refactored
See attached routing_postman_collection.json for updated data structures
and examples for both IPv4 and IPv6 routes.
For router advertisements see routing_advertisments_postman_collection.json
Another fixes in this patch:
- fixes in MPLS module due to Routing model updates
- fixes doc module due to changes in Routing model
Change-Id: I33704a50061aef97dfbd73a7701ff6fe5274d6f0
Signed-off-by: Michal Cmarada <michal.cmarada@pantheon.tech>
Diffstat (limited to 'routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingWriterFactory.java')
-rw-r--r-- | routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingWriterFactory.java | 104 |
1 files changed, 41 insertions, 63 deletions
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingWriterFactory.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingWriterFactory.java index b3306d9a2..05d6916cb 100644 --- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingWriterFactory.java +++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingWriterFactory.java @@ -25,7 +25,10 @@ import com.google.inject.Inject; import com.google.inject.name.Named; import io.fd.hc2vpp.common.translate.util.MultiNamingContext; import io.fd.hc2vpp.common.translate.util.NamingContext; +import io.fd.hc2vpp.routing.Ipv4RoutingNodes; +import io.fd.hc2vpp.routing.Ipv6RoutingNodes; import io.fd.hc2vpp.routing.RoutingConfiguration; +import io.fd.hc2vpp.routing.RoutingIIds; import io.fd.hc2vpp.vpp.classifier.context.VppClassifierContextManager; import io.fd.honeycomb.translate.impl.write.GenericWriter; import io.fd.honeycomb.translate.write.WriterFactory; @@ -33,37 +36,21 @@ import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder; import io.fd.vpp.jvpp.core.future.FutureJVppCore; import java.util.Set; import javax.annotation.Nonnull; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.Route; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.Interface1; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.routing.instance.interfaces._interface.Ipv6RouterAdvertisements; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.routing.instance.interfaces._interface.ipv6.router.advertisements.PrefixList; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.routing.instance.interfaces._interface.ipv6.router.advertisements.prefix.list.Prefix; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.Routing; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.RoutingInstance; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.routing.instance.Interfaces; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.routing.instance.RoutingProtocols; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.routing.instance.interfaces.Interface; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.routing.instance.routing.protocols.RoutingProtocol; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.routing.instance.routing.protocols.routing.protocol.StaticRoutes; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.ra.rev170502.ControlAdvPrefixesVppAugmentation; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.ra.rev170502.Ipv6RouterAdvertisementsVppAugmentation; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev170917.RoutingProtocolVppAttr; -import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev170917.routing.routing.instance.routing.protocols.routing.protocol.VppProtocolAttributes; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.interfaces._interface.ipv6.Ipv6RouterAdvertisements; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.interfaces._interface.ipv6.ipv6.router.advertisements.prefix.list.Prefix; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.Routing; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.routing.ControlPlaneProtocols; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.routing.control.plane.protocols.ControlPlaneProtocol; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.ra.rev180319.ControlAdvPrefixesVppAugmentation; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.ra.rev180319.Ipv6RouterAdvertisementsVppAugmentation; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev180319.RoutingProtocolVppAttr; +import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev180319.routing.control.plane.protocols.control.plane.protocol.VppProtocolAttributes; import org.opendaylight.yangtools.yang.binding.InstanceIdentifier; /** * Factory producing writers for routing plugin's data. */ -public final class RoutingWriterFactory implements WriterFactory, Ipv4WriteRoutingNodes, Ipv6WriteRoutingNodes { - - private static final InstanceIdentifier<Routing> ROOT_CONTAINER_ID = InstanceIdentifier.create(Routing.class); - private static final InstanceIdentifier<Interface> ROUTING_INTERFACE_ID = - ROOT_CONTAINER_ID.child(RoutingInstance.class).child(Interfaces.class).child(Interface.class); - private static final InstanceIdentifier<Ipv6RouterAdvertisements> ROUTING_ADVERTISMENT_ID = - ROUTING_INTERFACE_ID.augmentation( - Interface1.class).child(Ipv6RouterAdvertisements.class); - private static final InstanceIdentifier<Prefix> PREFIX_ID = - ROUTING_ADVERTISMENT_ID.child(PrefixList.class).child(Prefix.class); +public final class RoutingWriterFactory implements WriterFactory, Ipv4RoutingNodes, Ipv6RoutingNodes { private static final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface> IFACE_ID = InstanceIdentifier.create(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces.class) @@ -98,54 +85,45 @@ public final class RoutingWriterFactory implements WriterFactory, Ipv4WriteRouti @Override public void init(@Nonnull final ModifiableWriterRegistryBuilder registry) { - registry.subtreeAdd(rootNodeHandledChildren(ROOT_CONTAINER_ID), - new GenericWriter<>(ROOT_CONTAINER_ID, new RoutingCustomizer())); - - registry.add(new GenericWriter<>(routingInstanceIdentifier(), new RoutingInstanceCustomizer(configuration))); - - registry.subtreeAdd(routingProtocolHandledChildren(),new GenericWriter<>(routingProtocolIdentifier(), - new RoutingProtocolCustomizer(routingProtocolContext))); - - final InstanceIdentifier<StaticRoutes> staticRoutesInstanceIdentifier = staticRoutesIdentifier(); - final InstanceIdentifier<Route> ipv4RouteIdentifier = ipv4RouteIdentifier(staticRoutesInstanceIdentifier); - final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.Route> - ipv6RouteIdentifier = ipv6RouteIdentifier(staticRoutesInstanceIdentifier); - registry.subtreeAddAfter(ipv4RoutingHandledChildren(ipv4RouteSubtree()), new GenericWriter<>(ipv4RouteIdentifier, - new Ipv4RouteCustomizer(vppApi, interfaceContext, routeContext, routingProtocolContext, routHopContext, - vppClassifierContextManager)), IFACE_ID); - registry.subtreeAddAfter(ipv6RoutingHandledChildren(ipv6RouteSubtree()), new GenericWriter<>(ipv6RouteIdentifier, - new Ipv6RouteCustomizer(vppApi, interfaceContext, routeContext, routingProtocolContext, routHopContext, - vppClassifierContextManager)), IFACE_ID); - registry.add(new GenericWriter<>(ROUTING_INTERFACE_ID, new RoutingInterfaceCustomizer())); - registry.subtreeAdd(raHandledChildren(), - new GenericWriter<>(ROUTING_ADVERTISMENT_ID, new RouterAdvertisementsCustomizer(vppApi, interfaceContext))); - registry.subtreeAdd(prefixHandledChildren(), - new GenericWriter<>(PREFIX_ID, new PrefixCustomizer(vppApi, interfaceContext))); + registry.subtreeAdd(rootNodeHandledChildren(RoutingIIds.ROUTING), + new GenericWriter<>(RoutingIIds.ROUTING, new RoutingCustomizer())); - } + registry.subtreeAdd(routingProtocolHandledChildren(),new GenericWriter<>(RoutingIIds.RT_CPS_CP, + new ControlPlaneProtocolCustomizer(routingProtocolContext))); - private static ImmutableSet<InstanceIdentifier<?>> routingProtocolHandledChildren() { - return ImmutableSet - .of(InstanceIdentifier.create(RoutingProtocol.class).augmentation(RoutingProtocolVppAttr.class).child(VppProtocolAttributes.class)); - } + registry.subtreeAddAfter(ipv4RoutingHandledChildren(RoutingIIds.RT_CPS_CP_SR_SRV4_IPV4_RT_PARENT), + new GenericWriter<>(RoutingIIds.RT_CPS_CP_SR_SRV4_IPV4_RT, + new Ipv4RouteCustomizer(vppApi, interfaceContext, routeContext, + routingProtocolContext, routHopContext, + vppClassifierContextManager)), IFACE_ID); + registry.subtreeAddAfter(ipv6RoutingHandledChildren(RoutingIIds.RT_CPS_CP_SR_SRV6_IPV6_RT_PARENT), + new GenericWriter<>(RoutingIIds.RT_CPS_CP_SR_SRV6_IPV6_RT, + new Ipv6RouteCustomizer(vppApi, interfaceContext, routeContext, + routingProtocolContext, routHopContext, + vppClassifierContextManager)), IFACE_ID); - private static InstanceIdentifier<RoutingInstance> routingInstanceIdentifier() { - return ROOT_CONTAINER_ID.child(RoutingInstance.class); - } - private static InstanceIdentifier<RoutingProtocol> routingProtocolIdentifier() { - return routingInstanceIdentifier().child(RoutingProtocols.class).child(RoutingProtocol.class); + //router advertisements + registry.subtreeAdd(raHandledChildren(), + new GenericWriter<>(RoutingIIds.IFCS_IFC_IFC1_IPV6_IPV61_RTADV, + new RouterAdvertisementsCustomizer(vppApi, interfaceContext))); + registry.subtreeAdd(prefixHandledChildren(), + new GenericWriter<>(RoutingIIds.IFCS_IFC_IFC1_IPV6_IPV61_RTADV_PRLST_PRFX, + new PrefixCustomizer(vppApi, interfaceContext))); } - private static InstanceIdentifier<StaticRoutes> staticRoutesIdentifier() { - return routingProtocolIdentifier().child(StaticRoutes.class); + private static ImmutableSet<InstanceIdentifier<?>> routingProtocolHandledChildren() { + return ImmutableSet.of(InstanceIdentifier.create(ControlPlaneProtocol.class) + .augmentation(RoutingProtocolVppAttr.class) + .child(VppProtocolAttributes.class)); } private static Set<InstanceIdentifier<?>> rootNodeHandledChildren(final InstanceIdentifier<Routing> parent) { - return ImmutableSet.of(parent.child(RoutingInstance.class).child(RoutingProtocols.class)); + return ImmutableSet.of(parent.child(ControlPlaneProtocols.class)); } private static Set<InstanceIdentifier<?>> raHandledChildren() { - final InstanceIdentifier<Ipv6RouterAdvertisements> raIID = InstanceIdentifier.create(Ipv6RouterAdvertisements.class); + final InstanceIdentifier<Ipv6RouterAdvertisements> raIID = + InstanceIdentifier.create(Ipv6RouterAdvertisements.class); return ImmutableSet.of(raIID.augmentation(Ipv6RouterAdvertisementsVppAugmentation.class)); } |