summaryrefslogtreecommitdiffstats
path: root/routing/routing-impl/src/main
diff options
context:
space:
mode:
authorMichal Cmarada <michal.cmarada@pantheon.tech>2018-05-04 16:13:09 +0200
committerMichal Cmarada <michal.cmarada@pantheon.tech>2018-05-09 14:36:21 +0200
commit8f9fe3ca424abc56d212a96af4ec5750a29e7673 (patch)
treec3472885ef0fb57452b88b4ea76f2935f81ca39f /routing/routing-impl/src/main
parentd5883157bff11ee89b95bc1abe7f62fca3509950 (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')
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/Ipv4RoutingNodes.java51
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/Ipv6RoutingNodes.java56
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/RoutingConfiguration.java7
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/RoutingIIds.java64
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/RoutingModule.java20
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/naming/Ipv4RouteNamesFactory.java46
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/naming/Ipv6RouteNamesFactory.java41
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/ControlPlaneProtocolCustomizer.java (renamed from routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/RoutingProtocolCustomizer.java)76
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/Ipv4ReadRoutingNodes.java99
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/Ipv4RouteCustomizer.java60
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/Ipv6ReadRoutingNodes.java97
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/Ipv6RouteCustomizer.java57
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/RoutingInstanceCustomizer.java73
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/RoutingReaderFactory.java177
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/RoutingStateCustomizer.java149
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/RoutingStateReaderFactory.java136
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/Ipv4RoutePathParser.java127
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/Ipv6RoutePathParser.java110
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/RouteMapper.java15
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/ControlPlaneProtocolCustomizer.java (renamed from routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizer.java)30
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv4RouteCustomizer.java88
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv4WriteRoutingNodes.java179
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizer.java85
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv6WriteRoutingNodes.java180
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/PrefixCustomizer.java14
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RouterAdvertisementsCustomizer.java6
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingCustomizer.java12
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizer.java66
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingInterfaceCustomizer.java73
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingWriterFactory.java104
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactory.java45
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactory.java63
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactory.java20
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/TableLookupRequestFactory.java52
-rw-r--r--routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/trait/RouteRequestProducer.java2
-rw-r--r--routing/routing-impl/src/main/resources/honeycomb-minimal-resources/config/routing.json3
36 files changed, 934 insertions, 1549 deletions
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/Ipv4RoutingNodes.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/Ipv4RoutingNodes.java
new file mode 100644
index 000000000..50b29a8e2
--- /dev/null
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/Ipv4RoutingNodes.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (c) 2016 Cisco, Bell Canada, Pantheon and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.hc2vpp.routing;
+
+import com.google.common.collect.ImmutableSet;
+import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
+import java.util.Set;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.Route;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.route.NextHop;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.route.next.hop.NextHop1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.route.next.hop.SimpleNextHop1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.NextHopList;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv4.unicast.routing.rev180319.VppIpv4NextHopAugmentation;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv4.unicast.routing.rev180319.VppIpv4RouteAttributesAugmentation;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv4.unicast.routing.rev180319.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.route.VppIpv4Route;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public interface Ipv4RoutingNodes extends JvppReplyConsumer {
+
+ @SuppressWarnings("unchecked")
+ default Set<InstanceIdentifier<?>> ipv4RoutingHandledChildren(final InstanceIdentifier<Route> parent) {
+ return ImmutableSet.of(
+ parent.child(NextHop.class),
+ parent.child(NextHop.class).augmentation((Class)NextHopList.class),
+ parent.child(NextHop.class).augmentation((Class)NextHopList.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.next.hop.list.NextHop.class),
+ parent.child(NextHop.class).augmentation((Class)NextHopList.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.next.hop.list.NextHop.class)
+ .augmentation(NextHop1.class),
+ parent.child(NextHop.class).augmentation((Class)NextHopList.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.next.hop.list.NextHop.class)
+ .augmentation(VppIpv4NextHopAugmentation.class),
+ parent.child(NextHop.class).augmentation((Class)SimpleNextHop1.class),
+ parent.augmentation(VppIpv4RouteAttributesAugmentation.class).child(VppIpv4Route.class));
+ }
+
+}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/Ipv6RoutingNodes.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/Ipv6RoutingNodes.java
new file mode 100644
index 000000000..ca87869c6
--- /dev/null
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/Ipv6RoutingNodes.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 2016 Cisco, Bell Canada, Pantheon and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.hc2vpp.routing;
+
+import com.google.common.collect.ImmutableSet;
+import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
+import java.util.Set;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.Route;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.route.NextHop;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.route.next.hop.NextHop1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.route.next.hop.SimpleNextHop1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.NextHopList;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv6.unicast.routing.rev180319.VppIpv6NextHopAugmentation;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv6.unicast.routing.rev180319.VppIpv6RouteAttributesAugmentation;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv6.unicast.routing.rev180319.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.route.VppIpv6Route;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public interface Ipv6RoutingNodes extends JvppReplyConsumer {
+
+ @SuppressWarnings("unchecked")
+ default Set<InstanceIdentifier<?>> ipv6RoutingHandledChildren(final InstanceIdentifier<Route> parent) {
+ return ImmutableSet.of(
+ parent.augmentation(VppIpv6RouteAttributesAugmentation.class).child(VppIpv6Route.class),
+ parent.child(NextHop.class),
+ parent.child(NextHop.class)
+ .augmentation((Class)NextHopList.class),
+ parent.child(NextHop.class)
+ .augmentation((Class)NextHopList.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.next.hop.list.NextHop.class),
+ parent.child(NextHop.class)
+ .augmentation((Class)NextHopList.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.next.hop.list.NextHop.class)
+ .augmentation(NextHop1.class),
+ parent.child(NextHop.class)
+ .augmentation((Class)NextHopList.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.next.hop.list.NextHop.class)
+ .augmentation(VppIpv6NextHopAugmentation.class),
+ parent.child(NextHop.class)
+ .augmentation((Class) SimpleNextHop1.class));
+ }
+
+}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/RoutingConfiguration.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/RoutingConfiguration.java
index c8f0ba634..3bb7043bf 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/RoutingConfiguration.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/RoutingConfiguration.java
@@ -43,16 +43,9 @@ public class RoutingConfiguration {
*/
public static final String ROUTE_HOP_CONTEXT = "route-hop-context";
-
- @InjectConfig("default-routing-instance-name")
- private String defaultRoutingInstanceName;
-
@InjectConfig("learned-route-name-prefix")
private String learnedRouteNamePrefix;
- public String getDefaultRoutingInstanceName() {
- return defaultRoutingInstanceName;
- }
public String getLearnedRouteNamePrefix() {
return learnedRouteNamePrefix;
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/RoutingIIds.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/RoutingIIds.java
new file mode 100644
index 000000000..e17b4439e
--- /dev/null
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/RoutingIIds.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2018 Bell Canada, Pantheon and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.hc2vpp.routing;
+
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.Interface1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.StaticRoutes1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.Ipv4;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.Route;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.Ipv61;
+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.PrefixList;
+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.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.Ipv6;
+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.ietf.routing.rev180313.routing.control.plane.protocols.control.plane.protocol.StaticRoutes;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+public class RoutingIIds {
+
+ //Reader IIDs
+ public static final InstanceIdentifier<Routing> ROUTING = InstanceIdentifier.create(Routing.class);
+ public static final InstanceIdentifier<ControlPlaneProtocols> RT_CPS = ROUTING.child(ControlPlaneProtocols.class);
+ public static final InstanceIdentifier<ControlPlaneProtocol> RT_CPS_CP = RT_CPS.child(ControlPlaneProtocol.class);
+
+ public static final InstanceIdentifier<StaticRoutes> RT_CPS_CP_SR = RT_CPS_CP.child(StaticRoutes.class);
+ public static final InstanceIdentifier<Route> RT_CPS_CP_SR_SRV4_IPV4_RT =
+ RT_CPS_CP_SR.augmentation(StaticRoutes1.class).child(Ipv4.class).child(Route.class);
+ public static final InstanceIdentifier<Route> RT_CPS_CP_SR_SRV4_IPV4_RT_PARENT =
+ InstanceIdentifier.create(Route.class);
+
+ public static final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.Route>
+ RT_CPS_CP_SR_SRV6_IPV6_RT = RT_CPS_CP_SR.augmentation(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.StaticRoutes1.class)
+ .child(Ipv6.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.Route.class);
+ public static final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.Route>
+ RT_CPS_CP_SR_SRV6_IPV6_RT_PARENT = InstanceIdentifier.create(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.Route.class);
+
+ //Writer IIDs
+ public static final InstanceIdentifier<Ipv6RouterAdvertisements> IFCS_IFC_IFC1_IPV6_IPV61_RTADV =
+ InstanceIdentifier.create(Interfaces.class).child(Interface.class).augmentation(Interface1.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.interfaces._interface.Ipv6.class)
+ .augmentation(Ipv61.class).child(Ipv6RouterAdvertisements.class);
+ public static final InstanceIdentifier<Prefix> IFCS_IFC_IFC1_IPV6_IPV61_RTADV_PRLST_PRFX =
+ IFCS_IFC_IFC1_IPV6_IPV61_RTADV.child(PrefixList.class).child(Prefix.class);
+}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/RoutingModule.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/RoutingModule.java
index a6fadf78c..8a109aece 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/RoutingModule.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/RoutingModule.java
@@ -21,7 +21,7 @@ import com.google.inject.multibindings.Multibinder;
import com.google.inject.name.Names;
import io.fd.hc2vpp.common.translate.util.MultiNamingContext;
import io.fd.hc2vpp.common.translate.util.NamingContext;
-import io.fd.hc2vpp.routing.read.RoutingStateReaderFactory;
+import io.fd.hc2vpp.routing.read.RoutingReaderFactory;
import io.fd.hc2vpp.routing.write.RoutingWriterFactory;
import io.fd.honeycomb.translate.read.ReaderFactory;
import io.fd.honeycomb.translate.write.WriterFactory;
@@ -32,7 +32,7 @@ import org.slf4j.LoggerFactory;
/**
* RoutingModule class instantiating routing plugin components.
*/
-public final class RoutingModule extends AbstractModule {
+public class RoutingModule extends AbstractModule {
private static final Logger LOG = LoggerFactory.getLogger(RoutingModule.class);
@@ -44,22 +44,22 @@ public final class RoutingModule extends AbstractModule {
requestInjection(RoutingConfiguration.class);
bind(NamingContext.class)
- .annotatedWith(Names.named(RoutingConfiguration.ROUTING_PROTOCOL_CONTEXT))
- .toInstance(new NamingContext("learned-protocol-", RoutingConfiguration.ROUTING_PROTOCOL_CONTEXT));
+ .annotatedWith(Names.named(RoutingConfiguration.ROUTING_PROTOCOL_CONTEXT))
+ .toInstance(new NamingContext("learned-protocol-", RoutingConfiguration.ROUTING_PROTOCOL_CONTEXT));
bind(NamingContext.class)
- .annotatedWith(Names.named(RoutingConfiguration.ROUTE_CONTEXT))
- .toInstance(new NamingContext("route-", RoutingConfiguration.ROUTE_CONTEXT));
+ .annotatedWith(Names.named(RoutingConfiguration.ROUTE_CONTEXT))
+ .toInstance(new NamingContext("route-", RoutingConfiguration.ROUTE_CONTEXT));
bind(MultiNamingContext.class)
- .annotatedWith(Names.named(RoutingConfiguration.ROUTE_HOP_CONTEXT))
- .toInstance(new MultiNamingContext(RoutingConfiguration.ROUTE_HOP_CONTEXT,
- RoutingConfiguration.MULTI_MAPPING_START_INDEX));
+ .annotatedWith(Names.named(RoutingConfiguration.ROUTE_HOP_CONTEXT))
+ .toInstance(new MultiNamingContext(RoutingConfiguration.ROUTE_HOP_CONTEXT,
+ RoutingConfiguration.MULTI_MAPPING_START_INDEX));
LOG.info("Injecting reader factories");
// creates reader factory binding
final Multibinder<ReaderFactory> readerFactoryBinder = Multibinder.newSetBinder(binder(), ReaderFactory.class);
- readerFactoryBinder.addBinding().to(RoutingStateReaderFactory.class);
+ readerFactoryBinder.addBinding().to(RoutingReaderFactory.class);
LOG.info("Injecting writers factories");
// create writer factory binding
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/naming/Ipv4RouteNamesFactory.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/naming/Ipv4RouteNamesFactory.java
index 2ed0df12e..1205ffa6b 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/naming/Ipv4RouteNamesFactory.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/naming/Ipv4RouteNamesFactory.java
@@ -16,7 +16,6 @@
package io.fd.hc2vpp.routing.naming;
-
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.hc2vpp.routing.trait.RouteMapper;
import io.fd.hc2vpp.routing.write.trait.RouteRequestProducer;
@@ -29,14 +28,16 @@ import java.util.Arrays;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
-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.ipv4.unicast.routing.rev170917.routing.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.next.hop.list.next.hop.list.NextHop;
-
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.Route;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.route.next.hop.NextHop1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.next.hop.list.NextHop;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv4.unicast.routing.rev180319.VppIpv4NextHopAugmentation;
public final class Ipv4RouteNamesFactory implements RouteMapper, RouteRequestProducer {
private static final String DOT = ".";
- private static final String EMPTY = "";
+ private static final String DASH = "-";
+ private static final String UNDERSCORE = "_";
private final NamingContext interfaceContext;
private final NamingContext routingProtocolContext;
@@ -52,7 +53,7 @@ public final class Ipv4RouteNamesFactory implements RouteMapper, RouteRequestPro
*/
public String uniqueRouteName(@Nonnull final String parentProtocolName, @Nonnull final Route route) {
return bindName(parentProtocolName, dotlessAddress(route.getDestinationPrefix()),
- String.valueOf(extractPrefix(route.getDestinationPrefix())));
+ String.valueOf(extractPrefix(route.getDestinationPrefix())));
}
/**
@@ -60,22 +61,31 @@ public final class Ipv4RouteNamesFactory implements RouteMapper, RouteRequestPro
*/
public String uniqueRouteName(@Nonnull final IpFibDetails details, @Nonnull final MappingContext mappingContext) {
return bindName(routingProtocolContext.getName(details.tableId, mappingContext),
- dotlessAddress(details.address),
- String.valueOf(details.addressLength));
+ dotlessAddress(details.address), String.valueOf(details.addressLength));
+ }
+
+ /**
+ * Construct unique name from provided parentProtocolName and {@code Ipv4Prefix}
+ */
+ public String uniqueRouteName(@Nonnull final String parentProtocolName, @Nonnull final Ipv4Prefix prefix) {
+ return bindName(parentProtocolName, dotlessAddress(prefix),
+ String.valueOf(Byte.toUnsignedInt(extractPrefix(prefix))));
}
+ public Ipv4Prefix ipv4PrefixFromUniqueRouteName(@Nonnull final String uniqueName) {
+ String[] parts = uniqueName.split(UNDERSCORE);
+ return new Ipv4Prefix(dotted(parts[1]) + "/" + parts[2]);
+ }
public String uniqueRouteHopName(@Nonnull final NextHop hop) {
return bindName(hop.getOutgoingInterface(),
- dotlessAddress(hop.getAddress()),
- String.valueOf(hop.getWeight()));
+ dotlessAddress(hop.getAugmentation(NextHop1.class).getNextHopAddress()),
+ String.valueOf(hop.getAugmentation(VppIpv4NextHopAugmentation.class).getWeight()));
}
-
- public String uniqueRouteHopName(@Nonnull final FibPath path,
- @Nonnull final MappingContext mappingContext) {
- return bindName(interfaceContext.getName(path.swIfIndex, mappingContext),
- dotlessAddress(path.nextHop), String.valueOf(path.weight));
+ public String uniqueRouteHopName(@Nonnull final FibPath path, @Nonnull final MappingContext mappingContext) {
+ return bindName(interfaceContext.getName(path.swIfIndex, mappingContext), dotlessAddress(path.nextHop),
+ String.valueOf(path.weight));
}
private String dotlessAddress(final byte[] address) {
@@ -103,6 +113,10 @@ public final class Ipv4RouteNamesFactory implements RouteMapper, RouteRequestPro
}
private String dotless(@Nonnull final String input) {
- return input.replace(DOT, EMPTY);
+ return input.replace(DOT, DASH);
+ }
+
+ private String dotted(@Nonnull final String input) {
+ return input.replace(DASH, DOT);
}
}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/naming/Ipv6RouteNamesFactory.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/naming/Ipv6RouteNamesFactory.java
index abb48618c..da8affb7b 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/naming/Ipv6RouteNamesFactory.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/naming/Ipv6RouteNamesFactory.java
@@ -19,6 +19,7 @@ package io.fd.hc2vpp.routing.naming;
import com.google.common.net.InetAddresses;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.hc2vpp.routing.trait.RouteMapper;
+import io.fd.hc2vpp.routing.write.trait.RouteRequestProducer;
import io.fd.honeycomb.translate.MappingContext;
import io.fd.vpp.jvpp.core.dto.Ip6FibDetails;
import io.fd.vpp.jvpp.core.types.FibPath;
@@ -27,12 +28,16 @@ import java.net.UnknownHostException;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.Route;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.route.next.hop.NextHop1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.next.hop.list.NextHop;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv6.unicast.routing.rev180319.VppIpv6NextHopAugmentation;
+public final class Ipv6RouteNamesFactory implements RouteMapper, RouteRequestProducer {
-public final class Ipv6RouteNamesFactory implements RouteMapper {
-
- private static final String DOUBLE_DOT = ":";
- private static final String EMPTY = "";
+ private static final String COLON = ":";
+ private static final String DASH = "-";
+ private static final String UNDERSCORE = "_";
private final NamingContext interfaceContext;
private final NamingContext routingProtocolContext;
@@ -47,7 +52,7 @@ public final class Ipv6RouteNamesFactory implements RouteMapper {
* Construct unique name from provided {@code Route}
*/
public String uniqueRouteName(@Nonnull final String parentProtocolName,
- @Nonnull final 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 route) {
+ @Nonnull final Route route) {
return bindName(parentProtocolName,
// to have address in compressed form
doubleDotlessAddress(route.getDestinationPrefix()),
@@ -63,11 +68,23 @@ public final class Ipv6RouteNamesFactory implements RouteMapper {
String.valueOf(Byte.toUnsignedInt(details.addressLength)));
}
- public String uniqueRouteHopName(
- @Nonnull final 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.next.hop.options.next.hop.list.next.hop.list.NextHop hop) {
+ /**
+ * Construct unique name from provided parentProtocolName and {@code Ipv6Prefix}
+ */
+ public String uniqueRouteName(@Nonnull final String parentProtocolName, @Nonnull final Ipv6Prefix prefix) {
+ return bindName(parentProtocolName, doubleDotlessAddress(prefix), String.valueOf(extractPrefix(prefix)));
+ }
+
+
+ public Ipv6Prefix ipv6PrefixFromUniqueRouteName(@Nonnull final String uniqueName) {
+ String[] parts = uniqueName.split(UNDERSCORE);
+ return new Ipv6Prefix(coloned(parts[1]) + "/" + parts[2]);
+ }
+
+ public String uniqueRouteHopName(@Nonnull final NextHop hop) {
return bindName(hop.getOutgoingInterface(),
- doubleDotlessAddress(hop.getAddress()),
- String.valueOf(hop.getWeight()));
+ doubleDotlessAddress(hop.getAugmentation(NextHop1.class).getNextHopAddress()),
+ String.valueOf(hop.getAugmentation(VppIpv6NextHopAugmentation.class).getWeight()));
}
public String uniqueRouteHopName(@Nonnull final FibPath path, @Nonnull final MappingContext mappingContext) {
@@ -117,6 +134,10 @@ public final class Ipv6RouteNamesFactory implements RouteMapper {
}
private String doubleDotless(@Nonnull final String input) {
- return input.replace(DOUBLE_DOT, EMPTY);
+ return input.replace(COLON, DASH);
+ }
+
+ private String coloned(@Nonnull final String input) {
+ return input.replace(DASH, COLON);
}
}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/RoutingProtocolCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/ControlPlaneProtocolCustomizer.java
index bbc9727a6..372da27c6 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/RoutingProtocolCustomizer.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/ControlPlaneProtocolCustomizer.java
@@ -32,31 +32,31 @@ import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.Static;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.state.routing.instance.RoutingProtocolsBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.state.routing.instance.routing.protocols.RoutingProtocol;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.state.routing.instance.routing.protocols.RoutingProtocolBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.state.routing.instance.routing.protocols.RoutingProtocolKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev170917.RoutingProtocolStateVppAttr;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev170917.RoutingProtocolStateVppAttrBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev170917.VniReference;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol.VppProtocolStateAttributesBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.Static;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.routing.ControlPlaneProtocolsBuilder;
+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.ietf.routing.rev180313.routing.control.plane.protocols.ControlPlaneProtocolBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.routing.control.plane.protocols.ControlPlaneProtocolKey;
+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.RoutingProtocolVppAttrBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev180319.routing.control.plane.protocols.control.plane.protocol.VppProtocolAttributesBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.types.rev180406.VniReference;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-public class RoutingProtocolCustomizer
- implements ListReaderCustomizer<RoutingProtocol, RoutingProtocolKey, RoutingProtocolBuilder>, RouteMapper {
+final class ControlPlaneProtocolCustomizer
+ implements ListReaderCustomizer<ControlPlaneProtocol, ControlPlaneProtocolKey, ControlPlaneProtocolBuilder>,
+ RouteMapper {
private final NamingContext routingProtocolContext;
private final DumpCacheManager<IpFibDetailsReplyDump, Void> ipv4RoutesDumpManager;
private final DumpCacheManager<Ip6FibDetailsReplyDump, Void> ipv6RoutesDumpManager;
- public RoutingProtocolCustomizer(@Nonnull final NamingContext routingProtocolContext,
- @Nonnull final DumpCacheManager<IpFibDetailsReplyDump, Void> ipv4RoutesDumpManager,
- @Nonnull final DumpCacheManager<Ip6FibDetailsReplyDump, Void> ipv6RoutesDumpManager) {
+ ControlPlaneProtocolCustomizer(@Nonnull final NamingContext routingProtocolContext,
+ @Nonnull final DumpCacheManager<IpFibDetailsReplyDump, Void> ipv4RoutesDumpManager,
+ @Nonnull final DumpCacheManager<Ip6FibDetailsReplyDump, Void> ipv6RoutesDumpManager) {
this.routingProtocolContext = routingProtocolContext;
this.ipv4RoutesDumpManager = ipv4RoutesDumpManager;
this.ipv6RoutesDumpManager = ipv6RoutesDumpManager;
@@ -64,8 +64,8 @@ public class RoutingProtocolCustomizer
@Nonnull
@Override
- public List<RoutingProtocolKey> getAllIds(@Nonnull final InstanceIdentifier<RoutingProtocol> instanceIdentifier,
- @Nonnull final ReadContext readContext) throws ReadFailedException {
+ public List<ControlPlaneProtocolKey> getAllIds(@Nonnull final InstanceIdentifier<ControlPlaneProtocol> instanceIdentifier,
+ @Nonnull final ReadContext readContext) throws ReadFailedException {
final ModificationCache modificationCache = readContext.getModificationCache();
@@ -76,11 +76,11 @@ public class RoutingProtocolCustomizer
.flatMap(Collection::stream)
.map(tableId -> routingProtocolContext.getName(tableId, readContext.getMappingContext()))
.distinct()
- .map(RoutingProtocolKey::new)
+ .map(name -> new ControlPlaneProtocolKey(name, Static.class))
.collect(Collectors.toList());
}
- private List<Integer> ipv4TableIds(final InstanceIdentifier<RoutingProtocol> instanceIdentifier,
+ private List<Integer> ipv4TableIds(final InstanceIdentifier<ControlPlaneProtocol> instanceIdentifier,
final ModificationCache modificationCache) throws ReadFailedException {
final Optional<IpFibDetailsReplyDump>
ipv4Routes = ipv4RoutesDumpManager.getDump(instanceIdentifier, modificationCache);
@@ -93,7 +93,7 @@ public class RoutingProtocolCustomizer
return Collections.emptyList();
}
- private List<Integer> ipv6TableIds(final InstanceIdentifier<RoutingProtocol> instanceIdentifier,
+ private List<Integer> ipv6TableIds(final InstanceIdentifier<ControlPlaneProtocol> instanceIdentifier,
final ModificationCache modificationCache) throws ReadFailedException {
final Optional<Ip6FibDetailsReplyDump>
ipv6Routes = ipv6RoutesDumpManager.getDump(instanceIdentifier, modificationCache);
@@ -107,28 +107,34 @@ public class RoutingProtocolCustomizer
}
@Override
- public void merge(@Nonnull final Builder<? extends DataObject> builder, @Nonnull final List<RoutingProtocol> list) {
- RoutingProtocolsBuilder.class.cast(builder).setRoutingProtocol(list);
+ public void merge(@Nonnull final Builder<? extends DataObject> builder,
+ @Nonnull final List<ControlPlaneProtocol> list) {
+ ((ControlPlaneProtocolsBuilder) builder).setControlPlaneProtocol(list);
}
@Nonnull
@Override
- public RoutingProtocolBuilder getBuilder(@Nonnull final InstanceIdentifier<RoutingProtocol> instanceIdentifier) {
- return new RoutingProtocolBuilder();
+ public ControlPlaneProtocolBuilder getBuilder(@Nonnull final InstanceIdentifier<ControlPlaneProtocol> instanceIdentifier) {
+ return new ControlPlaneProtocolBuilder();
}
@Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<RoutingProtocol> instanceIdentifier,
- @Nonnull final RoutingProtocolBuilder routingProtocolBuilder,
+ public void readCurrentAttributes(@Nonnull final InstanceIdentifier<ControlPlaneProtocol> instanceIdentifier,
+ @Nonnull final ControlPlaneProtocolBuilder routingProtocolBuilder,
@Nonnull final ReadContext readContext) throws ReadFailedException {
-
- final RoutingProtocolKey key = instanceIdentifier.firstKeyOf(RoutingProtocol.class);
- routingProtocolBuilder.setName(key.getName()).setKey(key).setType(Static.class)
- .addAugmentation(RoutingProtocolStateVppAttr.class, new RoutingProtocolStateVppAttrBuilder()
- .setVppProtocolStateAttributes(new VppProtocolStateAttributesBuilder()
- .setPrimaryVrf(new VniReference(Long.valueOf(routingProtocolContext
- .getIndex(key.getName(), readContext.getMappingContext()))))
- .build())
- .build());
+ final ControlPlaneProtocolKey key = instanceIdentifier.firstKeyOf(ControlPlaneProtocol.class);
+ routingProtocolBuilder
+ .setName(key.getName())
+ .setKey(key)
+ .setType(Static.class)
+ .addAugmentation(RoutingProtocolVppAttr.class, new RoutingProtocolVppAttrBuilder().setVppProtocolAttributes(
+ new VppProtocolAttributesBuilder()
+ .setPrimaryVrf(
+ new VniReference(
+ Long.valueOf(routingProtocolContext.getIndex(key.getName(),
+ readContext.getMappingContext()))))
+ .build())
+ .build())
+ .build();
}
}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/Ipv4ReadRoutingNodes.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/Ipv4ReadRoutingNodes.java
deleted file mode 100644
index b42fd558a..000000000
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/Ipv4ReadRoutingNodes.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.routing.read;
-
-
-import com.google.common.collect.ImmutableSet;
-import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
-import io.fd.hc2vpp.common.translate.util.MultiNamingContext;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
-import io.fd.hc2vpp.routing.RoutingConfiguration;
-import io.fd.honeycomb.translate.impl.read.GenericListReader;
-import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.vpp.jvpp.core.dto.IpFibDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.IpFibDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.StaticRoutes2;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.StaticRoutes2Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.Ipv4;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.Route;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.VppIpv4RouteState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.next.hop.list.NextHopList;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.next.hop.list.next.hop.list.NextHop;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.table.lookup.TableLookupParams;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.state.routing.instance.routing.protocols.routing.protocol.StaticRoutes;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-import javax.annotation.Nonnull;
-import java.util.Set;
-
-interface Ipv4ReadRoutingNodes extends JvppReplyConsumer {
-
- static InstanceIdentifier<StaticRoutes2> staticRoutesInstanceIdentifier(
- final InstanceIdentifier<StaticRoutes> staticRoutesInstanceIdentifier) {
- return staticRoutesInstanceIdentifier.augmentation(StaticRoutes2.class);
- }
-
- static InstanceIdentifier<Ipv4> ipv4Identifier(
- final InstanceIdentifier<StaticRoutes2> staticRoutes2InstanceIdentifier) {
- return staticRoutes2InstanceIdentifier.child(Ipv4.class);
- }
-
- default DumpCacheManager<IpFibDetailsReplyDump, Void> newIpv4RoutesDumpManager(
- @Nonnull final FutureJVppCore vppApi) {
- return new DumpCacheManager.DumpCacheManagerBuilder<IpFibDetailsReplyDump, Void>()
- .withExecutor(
- (identifier, params) -> getReplyForRead(vppApi.ipFibDump(new IpFibDump()).toCompletableFuture(),
- identifier))
- .acceptOnly(IpFibDetailsReplyDump.class)
- .build();
- }
-
- default void registerIpv4Routes(@Nonnull final InstanceIdentifier<StaticRoutes> subTreeId,
- @Nonnull final ModifiableReaderRegistryBuilder registry,
- @Nonnull final DumpCacheManager<IpFibDetailsReplyDump, Void> ipv4DumpManager,
- @Nonnull final RoutingConfiguration configuration,
- @Nonnull final MultiNamingContext routeHopContext,
- @Nonnull final NamingContext interfaceContext,
- @Nonnull final NamingContext routeContext,
- @Nonnull final NamingContext routingProtocolContext) {
-
- final InstanceIdentifier<StaticRoutes2> staticRoutes2InstanceIdentifier =
- staticRoutesInstanceIdentifier(subTreeId);
- final InstanceIdentifier<Ipv4> ipv4InstanceIdentifier = ipv4Identifier(staticRoutes2InstanceIdentifier);
-
- registry.addStructuralReader(staticRoutes2InstanceIdentifier, StaticRoutes2Builder.class);
-
- registry.addStructuralReader(ipv4InstanceIdentifier, Ipv4Builder.class);
- registry.subtreeAdd(ipv4RoutingHandledChildren(InstanceIdentifier.create(Route.class)),
- new GenericListReader<>(ipv4InstanceIdentifier.child(Route.class),
- new Ipv4RouteCustomizer(ipv4DumpManager, configuration, routeHopContext, interfaceContext,
- routeContext, routingProtocolContext)));
- }
-
- default Set<InstanceIdentifier<?>> ipv4RoutingHandledChildren(
- final InstanceIdentifier<Route> parent) {
- return ImmutableSet.of(
- parent.child(TableLookupParams.class),
- parent.child(NextHopList.class),
- parent.child(NextHopList.class).child(NextHop.class),
- parent.child(VppIpv4RouteState.class));
- }
-
-}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/Ipv4RouteCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/Ipv4RouteCustomizer.java
index 53d4f8335..1c5665839 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/Ipv4RouteCustomizer.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/Ipv4RouteCustomizer.java
@@ -35,20 +35,21 @@ import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.Ipv4Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.Route;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.RouteBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.RouteKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.VppIpv4RouteStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.state.routing.instance.routing.protocols.RoutingProtocol;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.Ipv4Builder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.Route;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.RouteBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.RouteKey;
+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.ipv4.unicast.routing.rev180319.VppIpv4RouteAttributesAugmentation;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv4.unicast.routing.rev180319.VppIpv4RouteAttributesAugmentationBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv4.unicast.routing.rev180319.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.route.VppIpv4RouteBuilder;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-public class Ipv4RouteCustomizer
+final class Ipv4RouteCustomizer
implements ListReaderCustomizer<Route, RouteKey, RouteBuilder>, RouteMapper, Ipv4RoutePathParser {
-
private final DumpCacheManager<IpFibDetailsReplyDump, Void> ipv4RoutesDumpManager;
private final RoutingConfiguration configuration;
private final MultiNamingContext routeHopContext;
@@ -58,12 +59,12 @@ public class Ipv4RouteCustomizer
private final Ipv4RouteNamesFactory namesFactory;
- public Ipv4RouteCustomizer(@Nonnull final DumpCacheManager<IpFibDetailsReplyDump, Void> ipv4RoutesDumpManager,
- @Nonnull final RoutingConfiguration configuration,
- @Nonnull final MultiNamingContext routeHopContext,
- @Nonnull final NamingContext interfaceContext,
- @Nonnull final NamingContext routesContext,
- @Nonnull final NamingContext routingProtocolContext) {
+ Ipv4RouteCustomizer(@Nonnull final DumpCacheManager<IpFibDetailsReplyDump, Void> ipv4RoutesDumpManager,
+ @Nonnull final RoutingConfiguration configuration,
+ @Nonnull final MultiNamingContext routeHopContext,
+ @Nonnull final NamingContext interfaceContext,
+ @Nonnull final NamingContext routesContext,
+ @Nonnull final NamingContext routingProtocolContext) {
this.ipv4RoutesDumpManager = ipv4RoutesDumpManager;
this.configuration = configuration;
this.interfaceContext = interfaceContext;
@@ -81,7 +82,7 @@ public class Ipv4RouteCustomizer
final Optional<IpFibDetailsReplyDump> ipv4RoutesDump =
ipv4RoutesDumpManager.getDump(instanceIdentifier, readContext.getModificationCache());
- final String protocolName = instanceIdentifier.firstKeyOf(RoutingProtocol.class).getName();
+ final String protocolName = instanceIdentifier.firstKeyOf(ControlPlaneProtocol.class).getName();
final int protocolTableId = routingProtocolContext.getIndex(protocolName, readContext.getMappingContext());
return ipv4RoutesDump.isPresent()
@@ -104,14 +105,19 @@ public class Ipv4RouteCustomizer
if (!routesContext.containsIndex(learnedRouteName, mappingContext)) {
routesContext.addName(learnedRouteName, mappingContext);
}
- return keyForName(mappingContext, learnedRouteName);
+ return keyForLearnedName(learnedRouteName);
}
- return keyForName(mappingContext, routeName);
+ return keyForName(routeName);
+ }
+
+ private RouteKey keyForName(final String name) {
+ // example learned-protocol-0_0-0-0-0_0
+ return new RouteKey(namesFactory.ipv4PrefixFromUniqueRouteName(name));
}
- private RouteKey keyForName(final MappingContext mappingContext, final String name) {
- return new RouteKey(
- Long.valueOf(routesContext.getIndex(name, mappingContext)));
+ private RouteKey keyForLearnedName(final String name) {
+ // example learned-route_learned-protocol-0_0-0-0-0_0
+ return new RouteKey(namesFactory.ipv4PrefixFromUniqueRouteName(name.replace("learned-route_", "")));
}
@Override
@@ -130,8 +136,9 @@ public class Ipv4RouteCustomizer
@Nonnull final RouteBuilder routeBuilder, @Nonnull final ReadContext readContext)
throws ReadFailedException {
final RouteKey key = instanceIdentifier.firstKeyOf(Route.class);
- final String mappedName = routesContext.getName(key.getId().intValue(), readContext.getMappingContext());
- final String protocolName = instanceIdentifier.firstKeyOf(RoutingProtocol.class).getName();
+ final String protocolName = instanceIdentifier.firstKeyOf(ControlPlaneProtocol.class).getName();
+ final String mappedName = namesFactory.uniqueRouteName(protocolName, key.getDestinationPrefix());
+
final int protocolTableId = routingProtocolContext.getIndex(protocolName, readContext.getMappingContext());
final Optional<IpFibDetailsReplyDump> ipv4RoutesDump =
ipv4RoutesDumpManager.getDump(instanceIdentifier, readContext.getModificationCache());
@@ -147,13 +154,16 @@ public class Ipv4RouteCustomizer
if (opDetail.isPresent()) {
final IpFibDetails detail = opDetail.get();
- routeBuilder.setNextHopOptions(
+ routeBuilder.setNextHop(
resolveHopType(mappedName, Arrays.asList(detail.path), interfaceContext, routeHopContext,
readContext.getMappingContext(), namesFactory))
.setKey(key)
- .setId(key.getId())
.setDestinationPrefix(toIpv4Prefix(detail.address, toJavaByte(detail.addressLength)))
- .setVppIpv4RouteState(new VppIpv4RouteStateBuilder().build());
+ .addAugmentation(VppIpv4RouteAttributesAugmentation.class,
+ new VppIpv4RouteAttributesAugmentationBuilder()
+ .setVppIpv4Route(new VppIpv4RouteBuilder()
+ .build())
+ .build());
}
}
}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/Ipv6ReadRoutingNodes.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/Ipv6ReadRoutingNodes.java
deleted file mode 100644
index e37b4a05e..000000000
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/Ipv6ReadRoutingNodes.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.routing.read;
-
-import com.google.common.collect.ImmutableSet;
-import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
-import io.fd.hc2vpp.common.translate.util.MultiNamingContext;
-import io.fd.hc2vpp.common.translate.util.NamingContext;
-import io.fd.hc2vpp.routing.RoutingConfiguration;
-import io.fd.honeycomb.translate.impl.read.GenericListReader;
-import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.vpp.jvpp.core.dto.Ip6FibDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.Ip6FibDump;
-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.ipv6.unicast.routing.rev170917.StaticRoutes2;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.StaticRoutes2Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.Ipv6;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.Ipv6Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.Route;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.VppIpv6RouteState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.next.hop.list.NextHopList;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.next.hop.list.next.hop.list.NextHop;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.table.lookup.TableLookupParams;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.state.routing.instance.routing.protocols.routing.protocol.StaticRoutes;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-interface Ipv6ReadRoutingNodes extends JvppReplyConsumer {
-
- static InstanceIdentifier<StaticRoutes2> staticRoutesInstanceIdentifier(
- final InstanceIdentifier<StaticRoutes> staticRoutesInstanceIdentifier) {
- return staticRoutesInstanceIdentifier.augmentation(StaticRoutes2.class);
- }
-
- static InstanceIdentifier<Ipv6> ipv6Identifier(
- final InstanceIdentifier<StaticRoutes2> staticRoutes2InstanceIdentifier) {
- return staticRoutes2InstanceIdentifier.child(Ipv6.class);
- }
-
- default DumpCacheManager<Ip6FibDetailsReplyDump, Void> newIpv6RoutesDumpManager(
- @Nonnull final FutureJVppCore vppApi) {
- return new DumpCacheManager.DumpCacheManagerBuilder<Ip6FibDetailsReplyDump, Void>()
- .withExecutor(
- (identifier, params) -> getReplyForRead(
- vppApi.ip6FibDump(new Ip6FibDump()).toCompletableFuture(), identifier))
- .acceptOnly(Ip6FibDetailsReplyDump.class)
- .build();
- }
-
- default void registerIpv6Routes(@Nonnull final InstanceIdentifier<StaticRoutes> subTreeId,
- @Nonnull final ModifiableReaderRegistryBuilder registry,
- @Nonnull final DumpCacheManager<Ip6FibDetailsReplyDump, Void> ipv6DumpManager,
- @Nonnull final RoutingConfiguration configuration,
- @Nonnull final MultiNamingContext routeHopContext,
- @Nonnull final NamingContext interfaceContext,
- @Nonnull final NamingContext routeContext,
- @Nonnull final NamingContext routingProtocolContext) {
-
- final InstanceIdentifier<StaticRoutes2> staticRoutes2InstanceIdentifier =
- staticRoutesInstanceIdentifier(subTreeId);
- final InstanceIdentifier<Ipv6> ipv6InstanceIdentifier = ipv6Identifier(staticRoutes2InstanceIdentifier);
-
- registry.addStructuralReader(staticRoutes2InstanceIdentifier, StaticRoutes2Builder.class);
-
- registry.addStructuralReader(ipv6InstanceIdentifier, Ipv6Builder.class);
- registry.subtreeAdd(ipv6RoutingHandledChildren(InstanceIdentifier.create(Route.class)),
- new GenericListReader<>(ipv6InstanceIdentifier.child(Route.class),
- new Ipv6RouteCustomizer(ipv6DumpManager, configuration, routeHopContext, interfaceContext,
- routeContext, routingProtocolContext)));
- }
-
- default Set<InstanceIdentifier<?>> ipv6RoutingHandledChildren(
- final InstanceIdentifier<Route> parent) {
- return ImmutableSet.of(
- parent.child(TableLookupParams.class),
- parent.child(NextHopList.class),
- parent.child(NextHopList.class).child(NextHop.class),
- parent.child(VppIpv6RouteState.class));
- }
-
-}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/Ipv6RouteCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/Ipv6RouteCustomizer.java
index a7ec37733..6003cf88b 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/Ipv6RouteCustomizer.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/Ipv6RouteCustomizer.java
@@ -35,17 +35,19 @@ import java.util.Collections;
import java.util.List;
import java.util.stream.Collectors;
import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.Ipv6Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.Route;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.RouteBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.RouteKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.VppIpv6RouteStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.state.routing.instance.routing.protocols.RoutingProtocol;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.Ipv6Builder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.Route;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.RouteBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.RouteKey;
+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.ipv6.unicast.routing.rev180319.VppIpv6RouteAttributesAugmentation;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv6.unicast.routing.rev180319.VppIpv6RouteAttributesAugmentationBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv6.unicast.routing.rev180319.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.route.VppIpv6RouteBuilder;
import org.opendaylight.yangtools.concepts.Builder;
import org.opendaylight.yangtools.yang.binding.DataObject;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-public class Ipv6RouteCustomizer
+final class Ipv6RouteCustomizer
implements ListReaderCustomizer<Route, RouteKey, RouteBuilder>, RouteMapper, Ipv6RoutePathParser {
private final DumpCacheManager<Ip6FibDetailsReplyDump, Void> ipv6RoutesDumpManager;
@@ -56,12 +58,12 @@ public class Ipv6RouteCustomizer
private final NamingContext routingProtocolContext;
private final Ipv6RouteNamesFactory namesFactory;
- public Ipv6RouteCustomizer(@Nonnull final DumpCacheManager<Ip6FibDetailsReplyDump, Void> ipv6RoutesDumpManager,
- @Nonnull final RoutingConfiguration configuration,
- @Nonnull final MultiNamingContext routeHopContext,
- @Nonnull final NamingContext interfaceContext,
- @Nonnull final NamingContext routesContext,
- @Nonnull final NamingContext routingProtocolContext) {
+ Ipv6RouteCustomizer(@Nonnull final DumpCacheManager<Ip6FibDetailsReplyDump, Void> ipv6RoutesDumpManager,
+ @Nonnull final RoutingConfiguration configuration,
+ @Nonnull final MultiNamingContext routeHopContext,
+ @Nonnull final NamingContext interfaceContext,
+ @Nonnull final NamingContext routesContext,
+ @Nonnull final NamingContext routingProtocolContext) {
this.ipv6RoutesDumpManager = ipv6RoutesDumpManager;
this.configuration = configuration;
this.interfaceContext = interfaceContext;
@@ -79,7 +81,7 @@ public class Ipv6RouteCustomizer
final Optional<Ip6FibDetailsReplyDump> ipv6RoutesDump =
ipv6RoutesDumpManager.getDump(instanceIdentifier, readContext.getModificationCache());
- final String protocolName = instanceIdentifier.firstKeyOf(RoutingProtocol.class).getName();
+ final String protocolName = instanceIdentifier.firstKeyOf(ControlPlaneProtocol.class).getName();
final int protocolTableId = routingProtocolContext.getIndex(protocolName, readContext.getMappingContext());
return ipv6RoutesDump.isPresent()
@@ -102,13 +104,18 @@ public class Ipv6RouteCustomizer
if (!routesContext.containsIndex(learnedRouteName, mappingContext)) {
routesContext.addName(learnedRouteName, mappingContext);
}
- return keyForName(mappingContext, learnedRouteName);
+ return keyForLearnedName(learnedRouteName);
}
- return keyForName(mappingContext, routeName);
+ return keyForName(routeName);
}
- private RouteKey keyForName(final MappingContext mappingContext, final String name) {
- return new RouteKey(Long.valueOf(routesContext.getIndex(name, mappingContext)));
+ private RouteKey keyForName(final String name) {
+ return new RouteKey(namesFactory.ipv6PrefixFromUniqueRouteName(name));
+ }
+
+ private RouteKey keyForLearnedName(final String name) {
+ String learnedPrefix = configuration.getLearnedRouteNamePrefix() + "_";
+ return new RouteKey(namesFactory.ipv6PrefixFromUniqueRouteName(name.replace(learnedPrefix, "")));
}
@Override
@@ -127,8 +134,8 @@ public class Ipv6RouteCustomizer
@Nonnull final RouteBuilder routeBuilder, @Nonnull final ReadContext readContext)
throws ReadFailedException {
final RouteKey key = instanceIdentifier.firstKeyOf(Route.class);
- final String mappedName = routesContext.getName(key.getId().intValue(), readContext.getMappingContext());
- final String protocolName = instanceIdentifier.firstKeyOf(RoutingProtocol.class).getName();
+ final String protocolName = instanceIdentifier.firstKeyOf(ControlPlaneProtocol.class).getName();
+ final String mappedName = namesFactory.uniqueRouteName(protocolName, key.getDestinationPrefix());
final int protocolTableId = routingProtocolContext.getIndex(protocolName, readContext.getMappingContext());
final Optional<Ip6FibDetailsReplyDump> ipv6RoutesDump =
ipv6RoutesDumpManager.getDump(instanceIdentifier, readContext.getModificationCache());
@@ -144,13 +151,17 @@ public class Ipv6RouteCustomizer
if (opDetail.isPresent()) {
final Ip6FibDetails detail = opDetail.get();
- routeBuilder.setNextHopOptions(
+ routeBuilder.setNextHop(
resolveHopType(mappedName, Arrays.asList(detail.path), interfaceContext, routeHopContext,
readContext.getMappingContext(), namesFactory))
.setKey(key)
- .setId(key.getId())
+ .setDestinationPrefix(key.getDestinationPrefix())
.setDestinationPrefix(toIpv6Prefix(detail.address, toJavaByte(detail.addressLength)))
- .setVppIpv6RouteState(new VppIpv6RouteStateBuilder().build());
+ .addAugmentation(VppIpv6RouteAttributesAugmentation.class,
+ new VppIpv6RouteAttributesAugmentationBuilder()
+ .setVppIpv6Route(new VppIpv6RouteBuilder()
+ .build())
+ .build());
}
}
}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/RoutingInstanceCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/RoutingInstanceCustomizer.java
deleted file mode 100644
index 78e869f9a..000000000
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/RoutingInstanceCustomizer.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.routing.read;
-
-import com.google.common.collect.ImmutableList;
-import io.fd.hc2vpp.routing.RoutingConfiguration;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.ListReaderCustomizer;
-import java.util.List;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.RoutingStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.StandardRoutingInstance;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.state.RoutingInstance;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.state.RoutingInstanceBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.state.RoutingInstanceKey;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * Returns default instance of routing instance
- */
-public class RoutingInstanceCustomizer
- implements ListReaderCustomizer<RoutingInstance, RoutingInstanceKey, RoutingInstanceBuilder> {
-
- private RoutingInstanceKey defaultKey;
-
- public RoutingInstanceCustomizer(@Nonnull final RoutingConfiguration configuration) {
- defaultKey = new RoutingInstanceKey(configuration.getDefaultRoutingInstanceName());
- }
-
- @Nonnull
- @Override
- public List<RoutingInstanceKey> getAllIds(@Nonnull final InstanceIdentifier<RoutingInstance> instanceIdentifier,
- @Nonnull final ReadContext readContext) throws ReadFailedException {
- return ImmutableList.of(defaultKey);
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> builder, @Nonnull final List<RoutingInstance> list) {
- RoutingStateBuilder.class.cast(builder).setRoutingInstance(list);
- }
-
- @Nonnull
- @Override
- public RoutingInstanceBuilder getBuilder(@Nonnull final InstanceIdentifier<RoutingInstance> instanceIdentifier) {
- return new RoutingInstanceBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<RoutingInstance> instanceIdentifier,
- @Nonnull final RoutingInstanceBuilder routingInstanceBuilder,
- @Nonnull final ReadContext readContext) throws ReadFailedException {
- routingInstanceBuilder.setType(StandardRoutingInstance.class)
- .setKey(defaultKey)
- .setName(defaultKey.getName());
- }
-}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/RoutingReaderFactory.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/RoutingReaderFactory.java
new file mode 100644
index 000000000..9ec765c86
--- /dev/null
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/RoutingReaderFactory.java
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 2016 Cisco and/or its affiliates.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at:
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package io.fd.hc2vpp.routing.read;
+
+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.honeycomb.translate.impl.read.GenericListReader;
+import io.fd.honeycomb.translate.read.ReaderFactory;
+import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
+import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
+import io.fd.vpp.jvpp.core.dto.Ip6FibDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.Ip6FibDump;
+import io.fd.vpp.jvpp.core.dto.IpFibDetailsReplyDump;
+import io.fd.vpp.jvpp.core.dto.IpFibDump;
+import io.fd.vpp.jvpp.core.future.FutureJVppCore;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.StaticRoutes1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.StaticRoutes1Builder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.Ipv4;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.Ipv4Builder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.Route;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.Ipv6;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.Ipv6Builder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.RoutingBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.routing.ControlPlaneProtocolsBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.routing.control.plane.protocols.control.plane.protocol.StaticRoutesBuilder;
+import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
+
+/**
+ * Factory producing readers for routing plugin's data.
+ */
+public final class RoutingReaderFactory implements ReaderFactory, Ipv4RoutingNodes, Ipv6RoutingNodes {
+
+ @Inject
+ private RoutingConfiguration configuration;
+
+ @Inject
+ @Named("interface-context")
+ private NamingContext interfaceContext;
+
+ @Inject
+ @Named(RoutingConfiguration.ROUTING_PROTOCOL_CONTEXT)
+ private NamingContext routingProtocolContext;
+
+ @Inject
+ @Named(RoutingConfiguration.ROUTE_CONTEXT)
+ private NamingContext routeContext;
+
+ @Inject
+ @Named(RoutingConfiguration.ROUTE_HOP_CONTEXT)
+ private MultiNamingContext routeHopContext;
+
+ @Inject
+ private FutureJVppCore vppApi;
+
+ @Override
+ public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) {
+ final DumpCacheManager<IpFibDetailsReplyDump, Void> ipv4DumpManager = newIpv4RoutesDumpManager(vppApi);
+ final DumpCacheManager<Ip6FibDetailsReplyDump, Void> ipv6DumpManager = newIpv6RoutesDumpManager(vppApi);
+
+ registry.addStructuralReader(RoutingIIds.ROUTING, RoutingBuilder.class);
+ registry.addStructuralReader(RoutingIIds.RT_CPS, ControlPlaneProtocolsBuilder.class);
+ registry.add(new GenericListReader<>(RoutingIIds.RT_CPS_CP,
+ new ControlPlaneProtocolCustomizer(routingProtocolContext,
+ ipv4DumpManager,
+ ipv6DumpManager)));
+ registry.addStructuralReader(RoutingIIds.RT_CPS_CP_SR, StaticRoutesBuilder.class);
+
+ registerIpv4RoutesReaders(registry, ipv4DumpManager, configuration, routeHopContext,
+ interfaceContext, routeContext, routingProtocolContext);
+ registerIpv6RoutesReaders(registry, ipv6DumpManager, configuration, routeHopContext,
+ interfaceContext, routeContext, routingProtocolContext);
+ }
+
+ private static InstanceIdentifier<Ipv4> ipv4Identifier(
+ final InstanceIdentifier<StaticRoutes1> staticRoutes2InstanceIdentifier) {
+ return staticRoutes2InstanceIdentifier.child(Ipv4.class);
+ }
+
+ private static InstanceIdentifier<Ipv6> ipv6Identifier(
+ final InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.StaticRoutes1> staticRoutes2InstanceIdentifier) {
+ return staticRoutes2InstanceIdentifier.child(Ipv6.class);
+ }
+
+ private static InstanceIdentifier<StaticRoutes1> staticRoutesIpv4Iid() {
+ return RoutingIIds.RT_CPS_CP_SR.augmentation(StaticRoutes1.class);
+ }
+
+ private static InstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.StaticRoutes1> staticRoutesIpv6Iid() {
+ return RoutingIIds.RT_CPS_CP_SR.augmentation(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.StaticRoutes1.class);
+ }
+
+ private DumpCacheManager<IpFibDetailsReplyDump, Void> newIpv4RoutesDumpManager(
+ @Nonnull final FutureJVppCore vppApi) {
+ return new DumpCacheManager.DumpCacheManagerBuilder<IpFibDetailsReplyDump, Void>()
+ .withExecutor(
+ (identifier, params) -> getReplyForRead(vppApi.ipFibDump(new IpFibDump()).toCompletableFuture(),
+ identifier))
+ .acceptOnly(IpFibDetailsReplyDump.class)
+ .build();
+ }
+
+ private DumpCacheManager<Ip6FibDetailsReplyDump, Void> newIpv6RoutesDumpManager(
+ @Nonnull final FutureJVppCore vppApi) {
+ return new DumpCacheManager.DumpCacheManagerBuilder<Ip6FibDetailsReplyDump, Void>()
+ .withExecutor(
+ (identifier, params) -> getReplyForRead(
+ vppApi.ip6FibDump(new Ip6FibDump()).toCompletableFuture(), identifier))
+ .acceptOnly(Ip6FibDetailsReplyDump.class)
+ .build();
+ }
+
+ private void registerIpv4RoutesReaders(@Nonnull final ModifiableReaderRegistryBuilder registry,
+ @Nonnull final DumpCacheManager<IpFibDetailsReplyDump, Void> ipv4DumpManager,
+ @Nonnull final RoutingConfiguration configuration,
+ @Nonnull final MultiNamingContext routeHopContext,
+ @Nonnull final NamingContext interfaceContext,
+ @Nonnull final NamingContext routeContext,
+ @Nonnull final NamingContext routingProtocolContext) {
+
+ final InstanceIdentifier<StaticRoutes1> staticRoutes2InstanceIdentifier =
+ staticRoutesIpv4Iid();
+ final InstanceIdentifier<Ipv4> ipv4InstanceIdentifier = ipv4Identifier(staticRoutes2InstanceIdentifier);
+
+ registry.addStructuralReader(staticRoutes2InstanceIdentifier, StaticRoutes1Builder.class);
+
+ registry.addStructuralReader(ipv4InstanceIdentifier, Ipv4Builder.class);
+ registry.subtreeAdd(ipv4RoutingHandledChildren(InstanceIdentifier.create(Route.class)),
+ new GenericListReader<>(ipv4InstanceIdentifier.child(Route.class),
+ new Ipv4RouteCustomizer(ipv4DumpManager, configuration,
+ routeHopContext, interfaceContext,
+ routeContext, routingProtocolContext)));
+ }
+
+ private void registerIpv6RoutesReaders(@Nonnull final ModifiableReaderRegistryBuilder registry,
+ @Nonnull final DumpCacheManager<Ip6FibDetailsReplyDump, Void> ipv6DumpManager,
+ @Nonnull final RoutingConfiguration configuration,
+ @Nonnull final MultiNamingContext routeHopContext,
+ @Nonnull final NamingContext interfaceContext,
+ @Nonnull final NamingContext routeContext,
+ @Nonnull final NamingContext routingProtocolContext) {
+
+ final InstanceIdentifier<Ipv6> ipv6InstanceIdentifier = ipv6Identifier(staticRoutesIpv6Iid());
+
+ registry.addStructuralReader(staticRoutesIpv6Iid(),
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.StaticRoutes1Builder.class);
+ registry.addStructuralReader(ipv6InstanceIdentifier, Ipv6Builder.class);
+ registry.subtreeAdd(ipv6RoutingHandledChildren(InstanceIdentifier.create(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.Route.class)),
+ new GenericListReader<>(ipv6InstanceIdentifier.child(
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.Route.class),
+ new Ipv6RouteCustomizer(ipv6DumpManager, configuration,
+ routeHopContext, interfaceContext,
+ routeContext, routingProtocolContext)));
+ }
+}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/RoutingStateCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/RoutingStateCustomizer.java
deleted file mode 100644
index ce88825b7..000000000
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/RoutingStateCustomizer.java
+++ /dev/null
@@ -1,149 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.routing.read;
-
-import io.fd.hc2vpp.routing.write.Ipv4WriteRoutingNodes;
-import io.fd.hc2vpp.routing.write.Ipv6WriteRoutingNodes;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.read.ReadFailedException;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import io.fd.honeycomb.translate.spi.read.InitializingReaderCustomizer;
-import java.util.List;
-import java.util.stream.Collectors;
-import javax.annotation.Nonnull;
-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.RoutingBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.RoutingState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.RoutingStateBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.StandardRoutingInstance;
-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.RoutingInstanceBuilder;
-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.RoutingProtocolsBuilder;
-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.RoutingProtocolBuilder;
-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.ietf.routing.rev140524.routing.routing.instance.routing.protocols.routing.protocol.StaticRoutesBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev170917.RoutingProtocolStateVppAttr;
-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.RoutingProtocolVppAttrBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev170917.routing.routing.instance.routing.protocols.routing.protocol.VppProtocolAttributesBuilder;
-import org.opendaylight.yangtools.concepts.Builder;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RoutingStateCustomizer
- implements InitializingReaderCustomizer<RoutingState, RoutingStateBuilder>, Ipv4WriteRoutingNodes {
-
- private static final Logger LOG = LoggerFactory.getLogger(RoutingStateCustomizer.class);
-
- private static RoutingInstance mapRoutingInstances(
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.state.RoutingInstance state) {
- return new RoutingInstanceBuilder()
- .setName(state.getName())
- .setEnabled(true)
- .setRouterId(state.getRouterId())
- .setType(StandardRoutingInstance.class)
- .setRoutingProtocols(RoutingStateCustomizer.mapRoutingProtocols(state.getRoutingProtocols()))
- .build();
- }
-
- private static RoutingProtocols mapRoutingProtocols(
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.state.routing.instance.RoutingProtocols state) {
-
- if (state != null) {
- return new RoutingProtocolsBuilder()
- .setRoutingProtocol(state.getRoutingProtocol() != null
- ? RoutingStateCustomizer.mapRoutingProtocol(state.getRoutingProtocol())
- : null)
- .build();
- } else {
- return null;
- }
- }
-
- private static List<RoutingProtocol> mapRoutingProtocol(
- final List<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.state.routing.instance.routing.protocols.RoutingProtocol> state) {
- return state.stream()
- .map(routingProtocol -> new RoutingProtocolBuilder()
- .setName(routingProtocol.getName())
- .setEnabled(true)
- .setType(routingProtocol.getType())
- .setStaticRoutes(RoutingStateCustomizer.mapStaticRoutes(routingProtocol.getStaticRoutes()))
- .addAugmentation(RoutingProtocolVppAttr.class,
- mapVppAttr(routingProtocol.getAugmentation(RoutingProtocolStateVppAttr.class)))
- .build())
- .collect(Collectors.toList());
- }
-
- private static RoutingProtocolVppAttr mapVppAttr(final RoutingProtocolStateVppAttr attrState) {
- return new RoutingProtocolVppAttrBuilder()
- .setVppProtocolAttributes(attrState.getVppProtocolStateAttributes() == null
- ? null
- :
- new VppProtocolAttributesBuilder()
- .setPrimaryVrf(attrState.getVppProtocolStateAttributes().getPrimaryVrf())
- .build())
- .build();
- }
-
- private static StaticRoutes mapStaticRoutes(
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.state.routing.instance.routing.protocols.routing.protocol.StaticRoutes state) {
- return new StaticRoutesBuilder()
- .addAugmentation(CONFIG_IPV4_AUG_CLASS,
- Ipv4WriteRoutingNodes.INSTANCE.mapIpv4Augmentation(state.getAugmentation(STATE_IPV4_AUG_CLASS)))
- .addAugmentation(Ipv6WriteRoutingNodes.CONFIG_IPV6_AUG_CLASS,
- Ipv6WriteRoutingNodes.INSTANCE.mapIpv6Augmentation(state.getAugmentation(
- Ipv6WriteRoutingNodes.STATE_IPV6_AUG_CLASS)))
- .build();
- }
-
- @Nonnull
- @Override
- public RoutingStateBuilder getBuilder(@Nonnull final InstanceIdentifier<RoutingState> instanceIdentifier) {
- return new RoutingStateBuilder();
- }
-
- @Override
- public void readCurrentAttributes(@Nonnull final InstanceIdentifier<RoutingState> instanceIdentifier,
- @Nonnull final RoutingStateBuilder routingStateBuilder,
- @Nonnull final ReadContext readContext) throws ReadFailedException {
- // does nothing
- LOG.info("Reading {}", instanceIdentifier);
- }
-
- @Override
- public void merge(@Nonnull final Builder<? extends DataObject> builder, @Nonnull final RoutingState routingState) {
- //Routing state is root
- }
-
- @Nonnull
- @Override
- public Initialized<? extends DataObject> init(@Nonnull final InstanceIdentifier<RoutingState> id,
- @Nonnull final RoutingState readValue,
- @Nonnull final ReadContext ctx) {
-
- return Initialized.create(InstanceIdentifier.create(Routing.class), new RoutingBuilder()
- .setRoutingInstance(readValue.getRoutingInstance()
- .stream()
- .map(routingInstance -> mapRoutingInstances(routingInstance))
- .collect(Collectors.toList()))
- .build());
- }
-}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/RoutingStateReaderFactory.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/RoutingStateReaderFactory.java
deleted file mode 100644
index ad0bf7494..000000000
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/read/RoutingStateReaderFactory.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.routing.read;
-
-import com.google.common.collect.ImmutableSet;
-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.RoutingConfiguration;
-import io.fd.honeycomb.translate.impl.read.GenericListReader;
-import io.fd.honeycomb.translate.impl.read.GenericReader;
-import io.fd.honeycomb.translate.read.ReaderFactory;
-import io.fd.honeycomb.translate.read.registry.ModifiableReaderRegistryBuilder;
-import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
-import io.fd.vpp.jvpp.core.dto.Ip6FibDetailsReplyDump;
-import io.fd.vpp.jvpp.core.dto.IpFibDetailsReplyDump;
-import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.RoutingState;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.state.RoutingInstance;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.state.routing.instance.RoutingProtocols;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.state.routing.instance.RoutingProtocolsBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.state.routing.instance.routing.protocols.RoutingProtocol;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.state.routing.instance.routing.protocols.routing.protocol.StaticRoutes;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.state.routing.instance.routing.protocols.routing.protocol.StaticRoutesBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev170917.RoutingProtocolStateVppAttr;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol.VppProtocolStateAttributes;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * Factory producing readers for routing plugin's data.
- */
-public final class RoutingStateReaderFactory implements ReaderFactory, Ipv4ReadRoutingNodes, Ipv6ReadRoutingNodes {
-
- private static final InstanceIdentifier<RoutingState> ROOT_STATE_CONTAINER_ID =
- InstanceIdentifier.create(RoutingState.class);
-
- @Inject
- private RoutingConfiguration configuration;
-
- @Inject
- @Named("interface-context")
- private NamingContext interfaceContext;
-
- @Inject
- @Named(RoutingConfiguration.ROUTING_PROTOCOL_CONTEXT)
- private NamingContext routingProtocolContext;
-
- @Inject
- @Named(RoutingConfiguration.ROUTE_CONTEXT)
- private NamingContext routeContext;
-
- @Inject
- @Named(RoutingConfiguration.ROUTE_HOP_CONTEXT)
- private MultiNamingContext routeHopContext;
-
- @Inject
- private FutureJVppCore vppApi;
-
- @Override
- public void init(@Nonnull final ModifiableReaderRegistryBuilder registry) {
- final DumpCacheManager<IpFibDetailsReplyDump, Void> ipv4DumpManager = newIpv4RoutesDumpManager(vppApi);
- final DumpCacheManager<Ip6FibDetailsReplyDump, Void> ipv6DumpManager = newIpv6RoutesDumpManager(vppApi);
-
- final InstanceIdentifier<RoutingInstance> routingInstanceInstanceIdentifier =
- routingInstanceIdentifier(ROOT_STATE_CONTAINER_ID);
- final InstanceIdentifier<RoutingProtocols> routingProtocolsInstanceIdentifier =
- routingProtocolsId(routingInstanceInstanceIdentifier);
- final InstanceIdentifier<RoutingProtocol> routingProtocolInstanceIdentifier =
- routingProtocolInstanceIdentifier(routingProtocolsInstanceIdentifier);
- final InstanceIdentifier<StaticRoutes> staticRoutesInstanceIdentifier =
- staticRoutesInstanceIdentifier(routingProtocolInstanceIdentifier);
-
- // RoutingState
- registry.add(new GenericReader<>(ROOT_STATE_CONTAINER_ID, new RoutingStateCustomizer()));
- // RoutingInstance
- registry.add(new GenericListReader<>(routingInstanceInstanceIdentifier,
- new RoutingInstanceCustomizer(configuration)));
-
- // RoutingProtocols
- registry.addStructuralReader(routingProtocolsInstanceIdentifier, RoutingProtocolsBuilder.class);
-
- // RoutingProtocol
- registry.subtreeAdd(routingProtocolHandledChildren(), new GenericListReader<>(routingProtocolInstanceIdentifier,
- new RoutingProtocolCustomizer(routingProtocolContext, ipv4DumpManager, ipv6DumpManager)));
-
- // StaticRoutes
- registry.addStructuralReader(staticRoutesInstanceIdentifier, StaticRoutesBuilder.class);
-
- registerIpv4Routes(staticRoutesInstanceIdentifier, registry, ipv4DumpManager, configuration, routeHopContext,
- interfaceContext, routeContext, routingProtocolContext);
- registerIpv6Routes(staticRoutesInstanceIdentifier, registry, ipv6DumpManager, configuration, routeHopContext,
- interfaceContext, routeContext, routingProtocolContext);
- }
-
- private static ImmutableSet<InstanceIdentifier<?>> routingProtocolHandledChildren() {
- return ImmutableSet
- .of(InstanceIdentifier.create(RoutingProtocol.class).augmentation(RoutingProtocolStateVppAttr.class)
- .child(VppProtocolStateAttributes.class));
- }
-
- private InstanceIdentifier<StaticRoutes> staticRoutesInstanceIdentifier(
- final InstanceIdentifier<RoutingProtocol> routingProtocolInstanceIdentifier) {
- return routingProtocolInstanceIdentifier.child(StaticRoutes.class);
- }
-
- private InstanceIdentifier<RoutingProtocol> routingProtocolInstanceIdentifier(
- final InstanceIdentifier<RoutingProtocols> routingProtocolsInstanceIdentifier) {
- return routingProtocolsInstanceIdentifier.child(RoutingProtocol.class);
- }
-
- private InstanceIdentifier<RoutingProtocols> routingProtocolsId(
- final InstanceIdentifier<RoutingInstance> routingInstanceInstanceIdentifier) {
- return routingInstanceInstanceIdentifier.child(RoutingProtocols.class);
- }
-
- private InstanceIdentifier<RoutingInstance> routingInstanceIdentifier(
- final InstanceIdentifier<RoutingState> routingStateId) {
- return routingStateId.child(RoutingInstance.class);
- }
-}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/Ipv4RoutePathParser.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/Ipv4RoutePathParser.java
index 6f189af13..f1217ee73 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/Ipv4RoutePathParser.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/Ipv4RoutePathParser.java
@@ -16,26 +16,34 @@
package io.fd.hc2vpp.routing.trait;
+import static io.fd.hc2vpp.routing.trait.RouteMapper.isDefaultInterfaceIndex;
+
import io.fd.hc2vpp.common.translate.util.AddressTranslator;
import io.fd.hc2vpp.common.translate.util.MultiNamingContext;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.hc2vpp.routing.naming.Ipv4RouteNamesFactory;
import io.fd.honeycomb.translate.MappingContext;
import io.fd.vpp.jvpp.core.types.FibPath;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.NextHopOptions;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.*;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.next.hop.list.NextHopListBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.next.hop.list.next.hop.list.NextHopBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.table.lookup.TableLookupParamsBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev170917.VniReference;
-
-
-
-import javax.annotation.Nonnull;
import java.util.List;
import java.util.stream.Collectors;
-
-import static io.fd.hc2vpp.routing.trait.RouteMapper.isDefaultInterfaceIndex;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.route.next.hop.NextHop1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.route.next.hop.NextHop1Builder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.route.next.hop.SimpleNextHop1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.route.next.hop.SimpleNextHop1Builder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.NextHopOptions;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.NextHopList;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.NextHopListBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.SimpleNextHop;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.SimpleNextHopBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.SpecialNextHop;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.SpecialNextHopBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.TableLookupCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.next.hop.list.NextHop;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.next.hop.list.NextHopBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv4.unicast.routing.rev180319.VppIpv4NextHopAugmentation;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv4.unicast.routing.rev180319.VppIpv4NextHopAugmentationBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.types.rev180406.VniReference;
public interface Ipv4RoutePathParser extends RouteMapper {
@@ -55,25 +63,23 @@ public interface Ipv4RoutePathParser extends RouteMapper {
}
static NextHopOptions tableLookup() {
- return new TableLookupBuilder()
- .setTableLookupParams(
- new TableLookupParamsBuilder()
- // TODO - https://jira.fd.io/browse/VPP-994
- .setSecondaryVrf(new VniReference(0L))
- .build()
- ).build();
+ return new TableLookupCaseBuilder()
+ // TODO - https://jira.fd.io/browse/VPP-994
+ .setSecondaryVrf(new VniReference(0L)).build();
}
static SpecialNextHop specialHop(final FibPath singlePath) {
return new SpecialNextHopBuilder()
- .setSpecialNextHop(RouteMapper.INSTANCE.specialHopType(singlePath))
+ .setSpecialNextHopEnum(RouteMapper.INSTANCE.specialHopType(singlePath))
.build();
}
static SimpleNextHop simpleHop(final FibPath path, final NamingContext interfaceContext,
final MappingContext mappingContext) {
return resolveInterfaceIfSpecified(new SimpleNextHopBuilder(), path.swIfIndex, interfaceContext, mappingContext)
- .setNextHop(AddressTranslator.INSTANCE.arrayToIpv4AddressNoZone(path.nextHop))
+ .addAugmentation(SimpleNextHop1.class, new SimpleNextHop1Builder()
+ .setNextHopAddress(AddressTranslator.INSTANCE.arrayToIpv4AddressNoZone(path.nextHop))
+ .build())
.build();
}
@@ -86,29 +92,44 @@ public interface Ipv4RoutePathParser extends RouteMapper {
return builder;
}
- static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.NextHopList hopList(
- final String routeName,
- final List<FibPath> parsedHops,
- final NamingContext interfaceContext,
- final MultiNamingContext routeHopContext,
- final MappingContext mappingContext,
- final Ipv4RouteNamesFactory namesFactory) {
- return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.NextHopListBuilder()
- .setNextHopList(
- new NextHopListBuilder().setNextHop(parsedHops.stream()
- .map(fibPath -> resolveInterfaceIfSpecified(new NextHopBuilder(), fibPath.swIfIndex,
- interfaceContext, mappingContext)
- .setId((long) (routeHopContext.getChildIndex(routeName,
- namesFactory.uniqueRouteHopName(fibPath, mappingContext),
- mappingContext)))
- .setWeight(((short) fibPath.weight))
- .setAddress(
- AddressTranslator.INSTANCE
- .arrayToIpv4AddressNoZone(fibPath.nextHop))
- .build())
- .collect(Collectors.toList()))
- .build())
- .build();
+ static NextHopList hopList(final String routeName, final List<FibPath> parsedHops,
+ final NamingContext interfaceContext, final MultiNamingContext routeHopContext,
+ final MappingContext mappingContext, final Ipv4RouteNamesFactory namesFactory) {
+
+ return new NextHopListBuilder().setNextHopList(
+ parseNextHopList(routeName, parsedHops, interfaceContext, routeHopContext, mappingContext, namesFactory))
+ .build();
+ }
+
+ static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.NextHopList parseNextHopList(
+ String routeName, List<FibPath> parsedHops, NamingContext interfaceContext, MultiNamingContext routeHopContext,
+ MappingContext mappingContext, Ipv4RouteNamesFactory namesFactory) {
+
+ List<NextHop> nextHops = parsedHops.stream()
+ .map(fibPath -> resolveInterfaceIfSpecified(new NextHopBuilder(), fibPath.swIfIndex, interfaceContext,
+ mappingContext).setIndex(
+ getRouteIndex(routeName, routeHopContext, mappingContext, namesFactory, fibPath))
+ .addAugmentation(NextHop1.class, new NextHop1Builder().setNextHopAddress(
+ AddressTranslator.INSTANCE.arrayToIpv4AddressNoZone(fibPath.nextHop)).build())
+ .addAugmentation(VppIpv4NextHopAugmentation.class,
+ new VppIpv4NextHopAugmentationBuilder().setWeight((short) fibPath.weight).build())
+ .build())
+ .collect(Collectors.toList());
+
+ return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.NextHopListBuilder()
+ .setNextHop(nextHops)
+ .build();
+ }
+
+ static String getRouteIndex(String routeName, MultiNamingContext routeHopContext, MappingContext mappingContext,
+ Ipv4RouteNamesFactory namesFactory, FibPath fibPath) {
+ if (routeName.contains("learned-route")) {
+ routeHopContext.addChild(routeName, namesFactory.uniqueRouteHopName(fibPath, mappingContext),
+ mappingContext);
+ }
+ return String.valueOf(
+ routeHopContext.getChildIndex(routeName, namesFactory.uniqueRouteHopName(fibPath, mappingContext),
+ mappingContext));
}
static NextHopBuilder resolveInterfaceIfSpecified(final NextHopBuilder builder, final int index,
@@ -120,15 +141,15 @@ public interface Ipv4RoutePathParser extends RouteMapper {
return builder;
}
- default NextHopOptions resolveHopType(@Nonnull final String routeName,
- final List<FibPath> parsedHops,
- @Nonnull final NamingContext interfaceContext,
- @Nonnull final MultiNamingContext routeHopContext,
- @Nonnull final MappingContext mappingContext,
- @Nonnull final Ipv4RouteNamesFactory namesFactory) {
+ default org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.route.NextHop resolveHopType(
+ @Nonnull final String routeName, final List<FibPath> parsedHops, @Nonnull final NamingContext interfaceContext,
+ @Nonnull final MultiNamingContext routeHopContext, @Nonnull final MappingContext mappingContext,
+ @Nonnull final Ipv4RouteNamesFactory namesFactory) {
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.route.NextHopBuilder
+ nextHopBuilder = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.route.NextHopBuilder();
- return parsedHops == null || parsedHops.isEmpty()
- ? null
- : resolveOption(routeName, parsedHops, interfaceContext, routeHopContext, mappingContext, namesFactory);
+ return parsedHops == null || parsedHops.isEmpty() ? null : nextHopBuilder.setNextHopOptions(
+ resolveOption(routeName, parsedHops, interfaceContext, routeHopContext, mappingContext, namesFactory))
+ .build();
}
}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/Ipv6RoutePathParser.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/Ipv6RoutePathParser.java
index 1c7243ce8..27b5edf5d 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/Ipv6RoutePathParser.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/Ipv6RoutePathParser.java
@@ -16,26 +16,34 @@
package io.fd.hc2vpp.routing.trait;
+import static io.fd.hc2vpp.routing.trait.RouteMapper.isDefaultInterfaceIndex;
+
import io.fd.hc2vpp.common.translate.util.AddressTranslator;
import io.fd.hc2vpp.common.translate.util.MultiNamingContext;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.hc2vpp.routing.naming.Ipv6RouteNamesFactory;
import io.fd.honeycomb.translate.MappingContext;
import io.fd.vpp.jvpp.core.types.FibPath;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.NextHopOptions;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.*;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.next.hop.list.NextHopList;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.next.hop.list.NextHopListBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.next.hop.list.next.hop.list.NextHopBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.table.lookup.TableLookupParamsBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev170917.VniReference;
-
-
-import javax.annotation.Nonnull;
import java.util.List;
import java.util.stream.Collectors;
-
-import static io.fd.hc2vpp.routing.trait.RouteMapper.isDefaultInterfaceIndex;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.route.NextHop;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.route.next.hop.NextHop1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.route.next.hop.NextHop1Builder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.route.next.hop.SimpleNextHop1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.route.next.hop.SimpleNextHop1Builder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.NextHopOptions;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.NextHopList;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.NextHopListBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.SimpleNextHop;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.SimpleNextHopBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.SpecialNextHop;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.SpecialNextHopBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.TableLookupCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.next.hop.list.NextHopBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv6.unicast.routing.rev180319.VppIpv6NextHopAugmentation;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv6.unicast.routing.rev180319.VppIpv6NextHopAugmentationBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.types.rev180406.VniReference;
public interface Ipv6RoutePathParser extends RouteMapper {
@@ -55,25 +63,23 @@ public interface Ipv6RoutePathParser extends RouteMapper {
}
static NextHopOptions tableLookup() {
- return new TableLookupBuilder()
- .setTableLookupParams(
- new TableLookupParamsBuilder()
- // TODO - https://jira.fd.io/browse/VPP-994
- .setSecondaryVrf(new VniReference(0L))
- .build()
- ).build();
+ return new TableLookupCaseBuilder()
+ // TODO - https://jira.fd.io/browse/VPP-994
+ .setSecondaryVrf(new VniReference(0L)).build();
}
static SpecialNextHop specialHop(final FibPath fibPath) {
return new SpecialNextHopBuilder()
- .setSpecialNextHop(INSTANCE.specialHopType(fibPath))
+ .setSpecialNextHopEnum(INSTANCE.specialHopType(fibPath))
.build();
}
static SimpleNextHop simpleHop(final FibPath path, final NamingContext interfaceContext,
final MappingContext mappingContext) {
return resolveInterfaceIfSpecified(new SimpleNextHopBuilder(), path.swIfIndex, interfaceContext, mappingContext)
- .setNextHop(AddressTranslator.INSTANCE.arrayToIpv6AddressNoZone(path.nextHop))
+ .addAugmentation(SimpleNextHop1.class, new SimpleNextHop1Builder()
+ .setNextHopAddress(AddressTranslator.INSTANCE.arrayToIpv6AddressNoZone(path.nextHop))
+ .build())
.build();
}
@@ -87,35 +93,33 @@ public interface Ipv6RoutePathParser extends RouteMapper {
return builder;
}
- static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.NextHopList hopList(
- final String routeName,
- final List<FibPath> parsedHops,
- final NamingContext interfaceContext,
- final MultiNamingContext routeHopContext,
- final MappingContext mappingContext,
- final Ipv6RouteNamesFactory namesFactory) {
- return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.NextHopListBuilder()
- .setNextHopList(
+ static NextHopList hopList(final String routeName, final List<FibPath> parsedHops,
+ final NamingContext interfaceContext, final MultiNamingContext routeHopContext,
+ final MappingContext mappingContext, final Ipv6RouteNamesFactory namesFactory) {
+ return new NextHopListBuilder()
+ .setNextHopList(
buildNextHopList(routeName, parsedHops, interfaceContext, routeHopContext, mappingContext,
namesFactory))
.build();
}
- static NextHopList buildNextHopList(final String routeName, final List<FibPath> parsedHops,
- final NamingContext interfaceContext,
- final MultiNamingContext routeHopContext,
- final MappingContext mappingContext,
- final Ipv6RouteNamesFactory namesFactory) {
- return new NextHopListBuilder().setNextHop(parsedHops.stream()
- .map(fibPath -> resolveInterfaceIfSpecified(new NextHopBuilder(), fibPath.swIfIndex, interfaceContext,
- mappingContext)
- .setId(findIdWithinRouteContext(routeName, routeHopContext, mappingContext, fibPath,
- namesFactory))
- .setWeight((short) fibPath.weight)
- .setAddress(AddressTranslator.INSTANCE.arrayToIpv6AddressNoZone(fibPath.nextHop))
+ static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.NextHopList buildNextHopList(
+ final String routeName, final List<FibPath> parsedHops, final NamingContext interfaceContext,
+ final MultiNamingContext routeHopContext, final MappingContext mappingContext,
+ final Ipv6RouteNamesFactory namesFactory) {
+
+ return new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.NextHopListBuilder().setNextHop(parsedHops.stream()
+ .map(fibPath -> resolveInterfaceIfSpecified(new NextHopBuilder(), fibPath.swIfIndex,
+ interfaceContext, mappingContext)
+ .setIndex(String.valueOf(findIdWithinRouteContext(routeName, routeHopContext, mappingContext,
+ fibPath, namesFactory)))
+ .addAugmentation(NextHop1.class, new NextHop1Builder()
+ .setNextHopAddress(AddressTranslator.INSTANCE.arrayToIpv6AddressNoZone(fibPath.nextHop))
.build())
- .collect(Collectors.toList()))
- .build();
+ .addAugmentation(VppIpv6NextHopAugmentation.class,
+ new VppIpv6NextHopAugmentationBuilder().setWeight((short) fibPath.weight).build())
+ .build())
+ .collect(Collectors.toList())).build();
}
static NextHopBuilder resolveInterfaceIfSpecified(NextHopBuilder builder, final int index,
@@ -135,15 +139,19 @@ public interface Ipv6RoutePathParser extends RouteMapper {
.getChildIndex(routeName, namesFactory.uniqueRouteHopName(fibPath, mappingContext), mappingContext));
}
- default NextHopOptions resolveHopType(@Nonnull final String routeName,
- final List<FibPath> parsedHops,
- @Nonnull final NamingContext interfaceContext,
- @Nonnull final MultiNamingContext routeHopContext,
- @Nonnull final MappingContext mappingContext,
- @Nonnull final Ipv6RouteNamesFactory namesFactory) {
+ default NextHop resolveHopType(@Nonnull final String routeName,
+ final List<FibPath> parsedHops,
+ @Nonnull final NamingContext interfaceContext,
+ @Nonnull final MultiNamingContext routeHopContext,
+ @Nonnull final MappingContext mappingContext,
+ @Nonnull final Ipv6RouteNamesFactory namesFactory) {
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.route.NextHopBuilder
+ nextHopBuilder = new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.route.NextHopBuilder();
return parsedHops == null || parsedHops.isEmpty()
? null
- : resolveOption(routeName, parsedHops, interfaceContext, routeHopContext, mappingContext, namesFactory);
+ : nextHopBuilder.setNextHopOptions(resolveOption(routeName, parsedHops, interfaceContext,
+ routeHopContext, mappingContext,
+ namesFactory)).build();
}
}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/RouteMapper.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/RouteMapper.java
index 8da15c1bd..14b4d0727 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/RouteMapper.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/trait/RouteMapper.java
@@ -19,11 +19,8 @@ package io.fd.hc2vpp.routing.trait;
import io.fd.hc2vpp.common.translate.util.AddressTranslator;
import io.fd.hc2vpp.common.translate.util.ByteDataTranslator;
import io.fd.vpp.jvpp.core.types.FibPath;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.SpecialNextHopGrouping;
-
import javax.annotation.Nonnull;
-import java.util.Arrays;
-import java.util.stream.IntStream;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.SpecialNextHop;
public interface RouteMapper extends AddressTranslator, ByteDataTranslator {
@@ -82,15 +79,15 @@ public interface RouteMapper extends AddressTranslator, ByteDataTranslator {
return !isSpecialHop(path) && isArrayZeroed(path.nextHop);
}
- default SpecialNextHopGrouping.SpecialNextHop specialHopType(final FibPath singlePath) {
+ default SpecialNextHop.SpecialNextHopEnum specialHopType(final FibPath singlePath) {
if (flagEnabled(singlePath.isDrop)) {
- return SpecialNextHopGrouping.SpecialNextHop.Blackhole;
+ return SpecialNextHop.SpecialNextHopEnum.Blackhole;
} else if (flagEnabled(singlePath.isLocal)) {
- return SpecialNextHopGrouping.SpecialNextHop.Receive;
+ return SpecialNextHop.SpecialNextHopEnum.Receive;
} else if (flagEnabled(singlePath.isProhibit)) {
- return SpecialNextHopGrouping.SpecialNextHop.Prohibit;
+ return SpecialNextHop.SpecialNextHopEnum.Prohibit;
} else if (flagEnabled(singlePath.isUnreach)) {
- return SpecialNextHopGrouping.SpecialNextHop.Unreachable;
+ return SpecialNextHop.SpecialNextHopEnum.Unreachable;
} else {
throw new IllegalArgumentException(
String.format("An attempt to resolve illegal path %s detected ", singlePath.toString()));
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/ControlPlaneProtocolCustomizer.java
index 1db6338eb..0a0fa3e47 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizer.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/ControlPlaneProtocolCustomizer.java
@@ -25,27 +25,27 @@ import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.Static;
-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.RoutingProtocolKey;
-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.ietf.routing.rev180313.Static;
+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.ietf.routing.rev180313.routing.control.plane.protocols.ControlPlaneProtocolKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev180319.RoutingProtocolVppAttr;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
- * Customizer for handling of write operations for {@link RoutingProtocol}
+ * Customizer for handling of write operations for {@link ControlPlaneProtocol}
*/
-public class RoutingProtocolCustomizer
- implements ListWriterCustomizer<RoutingProtocol, RoutingProtocolKey> {
+final class ControlPlaneProtocolCustomizer
+ implements ListWriterCustomizer<ControlPlaneProtocol, ControlPlaneProtocolKey> {
private final NamingContext routingProtocolContext;
- public RoutingProtocolCustomizer(@Nonnull final NamingContext routingProtocolContext) {
+ ControlPlaneProtocolCustomizer(@Nonnull final NamingContext routingProtocolContext) {
this.routingProtocolContext = routingProtocolContext;
}
@Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<RoutingProtocol> instanceIdentifier,
- @Nonnull final RoutingProtocol routingProtocol,
+ public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<ControlPlaneProtocol> instanceIdentifier,
+ @Nonnull final ControlPlaneProtocol routingProtocol,
@Nonnull final WriteContext writeContext)
throws WriteFailedException {
checkIsStatic(routingProtocol);
@@ -72,21 +72,21 @@ public class RoutingProtocolCustomizer
}
@Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<RoutingProtocol> instanceIdentifier,
- @Nonnull final RoutingProtocol routingProtocol,
+ public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<ControlPlaneProtocol> instanceIdentifier,
+ @Nonnull final ControlPlaneProtocol routingProtocol,
@Nonnull final WriteContext writeContext)
throws WriteFailedException {
routingProtocolContext.removeName(routingProtocol.getName(), writeContext.getMappingContext());
}
/**
- * Checks whether routing protocol is static(we support only static ones for now)
+ * Checks whether control plane protocol is static(we support only static ones for now)
*/
- private void checkIsStatic(final RoutingProtocol routingProtocol) {
+ private void checkIsStatic(final ControlPlaneProtocol routingProtocol) {
checkArgument(routingProtocol.getType() == Static.class, "Only static routes are allowed");
}
- private int extractTableId(final RoutingProtocol protocol) {
+ private int extractTableId(final ControlPlaneProtocol protocol) {
final RoutingProtocolVppAttr vppAttr = protocol.getAugmentation(RoutingProtocolVppAttr.class);
checkState(vppAttr != null && vppAttr.getVppProtocolAttributes() != null,
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv4RouteCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv4RouteCustomizer.java
index 72254d1f6..1eb249f04 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv4RouteCustomizer.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv4RouteCustomizer.java
@@ -33,24 +33,23 @@ import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.vpp.jvpp.core.dto.IpAddDelRoute;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-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;
-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.ipv4.unicast.routing.rev170917.routing.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.RouteKey;
-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.next.hop.options.NextHopList;
-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.next.hop.options.SimpleNextHop;
-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.next.hop.options.SpecialNextHop;
-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.next.hop.options.TableLookup;
-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.next.hop.options.next.hop.list.next.hop.list.NextHop;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.routing.instance.routing.protocols.RoutingProtocol;
-
+import java.util.Comparator;
+import java.util.List;
+import java.util.stream.Collectors;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.Ipv4;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.Route;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.RouteKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.NextHopList;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.SimpleNextHop;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.SpecialNextHop;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.TableLookupCase;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.next.hop.list.NextHop;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.routing.control.plane.protocols.ControlPlaneProtocol;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.annotation.Nonnull;
-import java.util.List;
-import java.util.stream.Collectors;
-
/**
* Customizer for handling write operations for {@link Ipv4} according to ietf-ipv4-unicast-routing.yang
*/
@@ -59,7 +58,6 @@ public class Ipv4RouteCustomizer extends FutureJVppCustomizer
private static final Logger LOG = LoggerFactory.getLogger(Ipv4RouteCustomizer.class);
-
private final NamingContext routesContext;
private final MultiNamingContext routesHopsContext;
/**
@@ -75,12 +73,12 @@ public class Ipv4RouteCustomizer extends FutureJVppCustomizer
*/
private final Ipv4RouteNamesFactory routeNamesFactory;
- public Ipv4RouteCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext,
- @Nonnull final NamingContext routesContext,
- @Nonnull final NamingContext routingProtocolContext,
- @Nonnull final MultiNamingContext routesHopsContext,
- @Nonnull final VppClassifierContextManager classifierContextManager) {
+ Ipv4RouteCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
+ @Nonnull final NamingContext interfaceContext,
+ @Nonnull final NamingContext routesContext,
+ @Nonnull final NamingContext routingProtocolContext,
+ @Nonnull final MultiNamingContext routesHopsContext,
+ @Nonnull final VppClassifierContextManager classifierContextManager) {
super(futureJVppCore);
this.routesContext = routesContext;
@@ -92,14 +90,15 @@ public class Ipv4RouteCustomizer extends FutureJVppCustomizer
specialNextHopRequestFactory = SpecialNextHopRequestFactory.forContexts(classifierContextManager,
interfaceContext, routingProtocolContext);
routeNamesFactory = new Ipv4RouteNamesFactory(interfaceContext, routingProtocolContext);
- tableLookupRequestFactory = new TableLookupRequestFactory(classifierContextManager, interfaceContext, routingProtocolContext);
+ tableLookupRequestFactory =
+ new TableLookupRequestFactory(classifierContextManager, interfaceContext, routingProtocolContext);
}
@Override
public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Route> instanceIdentifier,
@Nonnull final Route route,
@Nonnull final WriteContext writeContext) throws WriteFailedException {
- final String parentProtocolName = instanceIdentifier.firstKeyOf(RoutingProtocol.class).getName();
+ final String parentProtocolName = instanceIdentifier.firstKeyOf(ControlPlaneProtocol.class).getName();
final String routeName = routeNamesFactory.uniqueRouteName(parentProtocolName, route);
writeRoute(instanceIdentifier, parentProtocolName, routeName, route, writeContext, true);
@@ -120,7 +119,7 @@ public class Ipv4RouteCustomizer extends FutureJVppCustomizer
public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Route> instanceIdentifier,
@Nonnull final Route route,
@Nonnull final WriteContext writeContext) throws WriteFailedException {
- final String parentProtocolName = instanceIdentifier.firstKeyOf(RoutingProtocol.class).getName();
+ final String parentProtocolName = instanceIdentifier.firstKeyOf(ControlPlaneProtocol.class).getName();
final String routeName = routeNamesFactory.uniqueRouteName(parentProtocolName, route);
writeRoute(instanceIdentifier, parentProtocolName, routeName, route, writeContext, false);
routesContext.removeName(routeName, writeContext.getMappingContext());
@@ -132,12 +131,12 @@ public class Ipv4RouteCustomizer extends FutureJVppCustomizer
@Nonnull final Route route,
@Nonnull final WriteContext writeContext,
final boolean isAdd) throws WriteFailedException {
- if (route.getNextHopOptions() instanceof SimpleNextHop) {
+ if (route.getNextHop().getNextHopOptions() instanceof SimpleNextHop) {
writeRoute(
simpleHopRequestFactory.createIpv4SimpleHopRequest(isAdd, parentProtocolName, route,
writeContext.getMappingContext()),
identifier);
- } else if (route.getNextHopOptions() instanceof NextHopList) {
+ } else if (route.getNextHop().getNextHopOptions() instanceof NextHopList) {
final List<NextHop> createdHops =
writeMultihopRoute(identifier, parentProtocolName, route, writeContext, isAdd);
@@ -147,10 +146,14 @@ public class Ipv4RouteCustomizer extends FutureJVppCustomizer
} else {
removeMappingForEachHop(routeName, writeContext, createdHops);
}
- } else if (route.getNextHopOptions() instanceof SpecialNextHop) {
+ } else if (route.getNextHop().getNextHopOptions() instanceof SpecialNextHop) {
writeSpecialHopRoute(identifier, route, parentProtocolName, writeContext, isAdd);
- } else if (route.getNextHopOptions() instanceof TableLookup) {
- writeRoute(tableLookupRequestFactory.createV4TableLookupRouteRequest(isAdd, parentProtocolName, route, writeContext.getMappingContext()), identifier);
+ } else if (route.getNextHop().getNextHopOptions() instanceof TableLookupCase) {
+ writeRoute(tableLookupRequestFactory.createV4TableLookupRouteRequest(isAdd,
+ parentProtocolName,
+ route,
+ writeContext.getMappingContext()),
+ identifier);
} else {
throw new IllegalArgumentException("Unsupported next-hop type");
}
@@ -166,26 +169,23 @@ public class Ipv4RouteCustomizer extends FutureJVppCustomizer
private void addMappingForEachHop(final @Nonnull String routeName, final @Nonnull WriteContext writeContext,
final List<NextHop> createdHops) {
createdHops.forEach(nextHop -> routesHopsContext.addChild(routeName,
- nextHop.getId().intValue(),
+ Integer.valueOf(nextHop.getIndex()),
routeNamesFactory.uniqueRouteHopName(nextHop),
writeContext.getMappingContext()));
}
private List<NextHop> writeMultihopRoute(@Nonnull final InstanceIdentifier<Route> identifier,
- @Nonnull final String parentProtocolName,
- @Nonnull final Route route,
- @Nonnull final WriteContext writeContext,
- final boolean isAdd)
+ @Nonnull final String parentProtocolName, @Nonnull final Route route,
+ @Nonnull final WriteContext writeContext, final boolean isAdd)
throws WriteFailedException {
// list of next hops
- final NextHopList hopList = NextHopList.class.cast(route.getNextHopOptions());
+ final NextHopList hopList = NextHopList.class.cast(route.getNextHop().getNextHopOptions());
final MappingContext mappingContext = writeContext.getMappingContext();
LOG.debug("Writing hop list {} for route {}", hopList, identifier);
// order hops to preserve order by ids(even that model is not ordered)
- final List<NextHop> orderedHops = hopList.getNextHopList().getNextHop()
- .stream()
- .sorted((left, right) -> (int) (left.getId() - right.getId()))
+ final List<NextHop> orderedHops = hopList.getNextHopList().getNextHop().stream()
+ .sorted(Comparator.comparing(NextHop::getIndex))
.collect(Collectors.toList());
for (NextHop hop : orderedHops) {
@@ -200,16 +200,16 @@ public class Ipv4RouteCustomizer extends FutureJVppCustomizer
return orderedHops;
}
-
private void writeSpecialHopRoute(final @Nonnull InstanceIdentifier<Route> identifier, final @Nonnull Route route,
- final @Nonnull String parentProtocolName, final @Nonnull WriteContext writeContext,
- final boolean isAdd)
+ final @Nonnull String parentProtocolName,
+ final @Nonnull WriteContext writeContext, final boolean isAdd)
throws WriteFailedException {
- final SpecialNextHop hop = SpecialNextHop.class.cast(route.getNextHopOptions());
+ final SpecialNextHop hop = SpecialNextHop.class.cast(route.getNextHop().getNextHopOptions());
final MappingContext mappingContext = writeContext.getMappingContext();
- final IpAddDelRoute request = specialNextHopRequestFactory
- .createIpv4SpecialHopRequest(isAdd, parentProtocolName, route, mappingContext, hop.getSpecialNextHop());
+ final IpAddDelRoute request =
+ specialNextHopRequestFactory.createIpv4SpecialHopRequest(isAdd, parentProtocolName, route, mappingContext,
+ hop.getSpecialNextHopEnum());
writeRoute(request, identifier);
}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv4WriteRoutingNodes.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv4WriteRoutingNodes.java
deleted file mode 100644
index 292feb9e9..000000000
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv4WriteRoutingNodes.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.routing.write;
-
-import com.google.common.collect.ImmutableSet;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.StaticRoutes1;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.StaticRoutes1Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.StaticRoutes2;
-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;
-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.Ipv4Builder;
-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.ipv4.unicast.routing.rev170917.routing.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.RouteBuilder;
-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.RouteKey;
-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.NextHopOptions;
-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.VppIpv4Route;
-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.VppIpv4RouteBuilder;
-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.next.hop.options.*;
-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.next.hop.options.next.hop.list.next.hop.list.NextHop;
-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.next.hop.options.next.hop.list.next.hop.list.NextHopBuilder;
-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.next.hop.options.next.hop.list.next.hop.list.NextHopKey;
-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.next.hop.options.table.lookup.TableLookupParams;
-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.next.hop.options.table.lookup.TableLookupParamsBuilder;
-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.yangtools.yang.binding.InstanceIdentifier;
-
-import java.util.Optional;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-public interface Ipv4WriteRoutingNodes {
-
- Ipv4WriteRoutingNodes INSTANCE = new Ipv4WriteRoutingNodes() {
- };
-
- Class<StaticRoutes1> CONFIG_IPV4_AUG_CLASS = StaticRoutes1.class;
- Class<StaticRoutes2> STATE_IPV4_AUG_CLASS = StaticRoutes2.class;
-
- static Ipv4 mapIpv4(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.Ipv4 state) {
- return new Ipv4Builder()
- .setRoute(state.getRoute()
- .stream()
- .map(route -> new RouteBuilder()
- .setKey(new RouteKey(route.getKey().getId()))
- .setDestinationPrefix(route.getDestinationPrefix())
- .setDescription(route.getDescription())
- .setId(route.getId())
- .setVppIpv4Route(mapVppIpv4Route(route.getVppIpv4RouteState()))
- .setNextHopOptions(mapNextHopOptions(route.getNextHopOptions()))
- .build())
- .collect(Collectors.toList()))
- .build();
- }
-
- static VppIpv4Route mapVppIpv4Route(
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.VppIpv4RouteState state) {
-
- return state == null
- ? null
- : new VppIpv4RouteBuilder()
- // false is default
- .setClassifyTable(state.getClassifyTable())
- .build();
- }
-
- static NextHopOptions mapNextHopOptions(
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.NextHopOptions state) {
- if (state instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.SimpleNextHop) {
- return mapSimpleNextHop(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.SimpleNextHop.class
- .cast(state));
- } else if (state instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.NextHopList) {
- return mapNextHopList(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.NextHopList.class
- .cast(state));
- } else if (state instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.SpecialNextHop) {
- return mapSpecialNextHop(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.SpecialNextHop.class
- .cast(state));
- } else if(state instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.TableLookup)
- return mapTableLookup(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.TableLookup.class.cast(state));
- else {
- throw new UnsupportedOperationException("Unsupported next hop type");
- }
- }
-
- static TableLookup mapTableLookup(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.TableLookup state) {
- return new TableLookupBuilder()
- .setTableLookupParams(
- Optional.ofNullable(state.getTableLookupParams())
- .map(params -> new TableLookupParamsBuilder().setSecondaryVrf(params.getSecondaryVrf()).build())
- .orElse(null))
- .build();
- }
-
- static SimpleNextHop mapSimpleNextHop(
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.SimpleNextHop hop) {
- return new SimpleNextHopBuilder()
- .setNextHop(hop.getNextHop())
- .setOutgoingInterface(hop.getOutgoingInterface())
- .build();
- }
-
- static NextHopList mapNextHopList(
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.NextHopList state) {
- return new NextHopListBuilder()
- .setNextHopList(mapNextHopListList(state.getNextHopList()))
- .build();
- }
-
- static 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.next.hop.options.next.hop.list.NextHopList mapNextHopListList(
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.next.hop.list.NextHopList state) {
- return new 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.next.hop.options.next.hop.list.NextHopListBuilder()
- .setNextHop(state.getNextHop()
- .stream()
- .map(nextHop -> new NextHopBuilder()
- .setId(nextHop.getId())
- .setOutgoingInterface(nextHop.getOutgoingInterface())
- .setWeight(nextHop.getWeight())
- .setPriority(nextHop.getPriority())
- .setAddress(nextHop.getAddress())
- .setKey(new NextHopKey(nextHop.getKey().getId()))
- .build())
- .collect(Collectors.toList()))
- .build();
- }
-
- static SpecialNextHop mapSpecialNextHop(
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.route.next.hop.options.SpecialNextHop hop) {
- return new SpecialNextHopBuilder()
- .setSpecialNextHop(hop.getSpecialNextHop())
- .build();
- }
-
- default InstanceIdentifier<Route> ipv4RouteIdentifier(
- final InstanceIdentifier<StaticRoutes> staticRoutesIdentifier) {
- return staticRoutesIdentifier
- .augmentation(StaticRoutes1.class)
- .child(Ipv4.class)
- .child(Route.class);
- }
-
- default Set<InstanceIdentifier<?>> ipv4RoutingHandledChildren(final InstanceIdentifier<Route> parent) {
- return ImmutableSet.of(
- parent.child(TableLookupParams.class),
- parent.child(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.next.hop.options.next.hop.list.NextHopList.class),
- parent.child(
- 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.next.hop.options.next.hop.list.NextHopList.class)
- .child(NextHop.class),
- parent.child(VppIpv4Route.class));
- }
-
- default InstanceIdentifier<Route> ipv4RouteSubtree() {
- return InstanceIdentifier.create(Route.class);
- }
-
- default StaticRoutes1 mapIpv4Augmentation(final StaticRoutes2 state) {
- if (state == null) {
- return null;
- }
- return new StaticRoutes1Builder()
- .setIpv4(mapIpv4(state.getIpv4()))
- .build();
- }
-}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizer.java
index 9d784e693..e30c38fae 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizer.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizer.java
@@ -34,25 +34,23 @@ import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.vpp.jvpp.core.dto.IpAddDelRoute;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
-import 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;
-import 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;
-import 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.RouteKey;
-import 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.next.hop.options.NextHopList;
-import 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.next.hop.options.SimpleNextHop;
-import 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.next.hop.options.SpecialNextHop;
-import 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.next.hop.options.TableLookup;
-import 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.next.hop.options.next.hop.list.next.hop.list.NextHop;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.routing.routing.instance.routing.protocols.RoutingProtocol;
-
-
+import java.util.Comparator;
+import java.util.List;
+import java.util.stream.Collectors;
+import javax.annotation.Nonnull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.Ipv6;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.Route;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.RouteKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.NextHopList;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.SimpleNextHop;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.SpecialNextHop;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.TableLookupCase;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.next.hop.list.NextHop;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.routing.control.plane.protocols.ControlPlaneProtocol;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import javax.annotation.Nonnull;
-import java.util.List;
-import java.util.stream.Collectors;
-
/**
* Customizer for handling write operations for {@link Ipv6} according to ietf-ipv6-unicast-routing.yang
*/
@@ -76,12 +74,12 @@ public class Ipv6RouteCustomizer extends FutureJVppCustomizer
*/
private final Ipv6RouteNamesFactory namesFactory;
- public Ipv6RouteCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
- @Nonnull final NamingContext interfaceContext,
- @Nonnull final NamingContext routesContext,
- @Nonnull final NamingContext routingProtocolContext,
- @Nonnull final MultiNamingContext routesHopsContext,
- @Nonnull final VppClassifierContextManager classifierContextManager) {
+ Ipv6RouteCustomizer(@Nonnull final FutureJVppCore futureJVppCore,
+ @Nonnull final NamingContext interfaceContext,
+ @Nonnull final NamingContext routesContext,
+ @Nonnull final NamingContext routingProtocolContext,
+ @Nonnull final MultiNamingContext routesHopsContext,
+ @Nonnull final VppClassifierContextManager classifierContextManager) {
super(futureJVppCore);
this.routesContext = routesContext;
@@ -90,9 +88,11 @@ public class Ipv6RouteCustomizer extends FutureJVppCustomizer
SimpleHopRequestFactory.forContexts(classifierContextManager, interfaceContext, routingProtocolContext);
multipathHopRequestFactory = MultipathHopRequestFactory
.forContexts(classifierContextManager, interfaceContext, routingProtocolContext);
- specialNextHopRequestFactory = SpecialNextHopRequestFactory.forContexts(classifierContextManager, interfaceContext,
- routingProtocolContext);
- tableLookupRequestFactory = new TableLookupRequestFactory(classifierContextManager, interfaceContext, routingProtocolContext);
+ specialNextHopRequestFactory =
+ SpecialNextHopRequestFactory.forContexts(classifierContextManager, interfaceContext,
+ routingProtocolContext);
+ tableLookupRequestFactory =
+ new TableLookupRequestFactory(classifierContextManager, interfaceContext, routingProtocolContext);
namesFactory = new Ipv6RouteNamesFactory(interfaceContext, routingProtocolContext);
}
@@ -100,7 +100,7 @@ public class Ipv6RouteCustomizer extends FutureJVppCustomizer
public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Route> instanceIdentifier,
@Nonnull final Route route,
@Nonnull final WriteContext writeContext) throws WriteFailedException {
- final String parentProtocolName = instanceIdentifier.firstKeyOf(RoutingProtocol.class).getName();
+ final String parentProtocolName = instanceIdentifier.firstKeyOf(ControlPlaneProtocol.class).getName();
final String routeName = namesFactory.uniqueRouteName(parentProtocolName, route);
writeRoute(instanceIdentifier, parentProtocolName, routeName, route, writeContext, true);
@@ -112,7 +112,7 @@ public class Ipv6RouteCustomizer extends FutureJVppCustomizer
public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Route> instanceIdentifier,
@Nonnull final Route route,
@Nonnull final WriteContext writeContext) throws WriteFailedException {
- final String parentProtocolName = instanceIdentifier.firstKeyOf(RoutingProtocol.class).getName();
+ final String parentProtocolName = instanceIdentifier.firstKeyOf(ControlPlaneProtocol.class).getName();
final String routeName = namesFactory.uniqueRouteName(parentProtocolName, route);
writeRoute(instanceIdentifier, parentProtocolName, routeName, route, writeContext, false);
routesContext.removeName(routeName, writeContext.getMappingContext());
@@ -124,12 +124,12 @@ public class Ipv6RouteCustomizer extends FutureJVppCustomizer
@Nonnull final Route route,
@Nonnull final WriteContext writeContext,
final boolean isAdd) throws WriteFailedException {
- if (route.getNextHopOptions() instanceof SimpleNextHop) {
+ if (route.getNextHop().getNextHopOptions() instanceof SimpleNextHop) {
writeRoute(
simpleHopRequestFactory.createIpv6SimpleHopRequest(isAdd, parentProtocolName, route,
writeContext.getMappingContext()),
identifier);
- } else if (route.getNextHopOptions() instanceof NextHopList) {
+ } else if (route.getNextHop().getNextHopOptions() instanceof NextHopList) {
final List<NextHop> createdHops =
writeMultihopRoute(identifier, parentProtocolName, route, writeContext, isAdd);
@@ -139,10 +139,12 @@ public class Ipv6RouteCustomizer extends FutureJVppCustomizer
} else {
removeMappingForEachHop(routeName, writeContext, createdHops);
}
- } else if (route.getNextHopOptions() instanceof SpecialNextHop) {
+ } else if (route.getNextHop().getNextHopOptions() instanceof SpecialNextHop) {
writeSpecialHopRoute(identifier, route, parentProtocolName, writeContext, isAdd);
- } else if (route.getNextHopOptions() instanceof TableLookup) {
- writeRoute(tableLookupRequestFactory.createV6TableLookupRouteRequest(isAdd, parentProtocolName, route, writeContext.getMappingContext()), identifier);
+ } else if (route.getNextHop().getNextHopOptions() instanceof TableLookupCase) {
+ writeRoute(tableLookupRequestFactory.createV6TableLookupRouteRequest(isAdd, parentProtocolName, route,
+ writeContext.getMappingContext()),
+ identifier);
} else {
throw new IllegalArgumentException("Unsupported next-hop type");
}
@@ -154,14 +156,13 @@ public class Ipv6RouteCustomizer extends FutureJVppCustomizer
final WriteContext writeContext, final boolean isAdd)
throws WriteFailedException {
// list of next hops
- final NextHopList hopList = NextHopList.class.cast(route.getNextHopOptions());
+ final NextHopList hopList = NextHopList.class.cast(route.getNextHop().getNextHopOptions());
final MappingContext mappingContext = writeContext.getMappingContext();
LOG.debug("Writing hop list {} for route {}", hopList, identifier);
// order hops to preserve order by ids(even that model is not ordered)
- final List<NextHop> orderedHops = hopList.getNextHopList().getNextHop()
- .stream()
- .sorted((left, right) -> (int) (left.getId() - right.getId()))
+ final List<NextHop> orderedHops = hopList.getNextHopList().getNextHop().stream()
+ .sorted(Comparator.comparing(NextHop::getIndex))
.collect(Collectors.toList());
for (NextHop hop : orderedHops) {
@@ -176,16 +177,16 @@ public class Ipv6RouteCustomizer extends FutureJVppCustomizer
return orderedHops;
}
-
private void writeSpecialHopRoute(final @Nonnull InstanceIdentifier<Route> identifier, final @Nonnull Route route,
- final @Nonnull String parentProtocolName, final @Nonnull WriteContext writeContext,
- final boolean isAdd)
+ final @Nonnull String parentProtocolName,
+ final @Nonnull WriteContext writeContext, final boolean isAdd)
throws WriteFailedException {
- final SpecialNextHop hop = SpecialNextHop.class.cast(route.getNextHopOptions());
+ final SpecialNextHop hop = SpecialNextHop.class.cast(route.getNextHop().getNextHopOptions());
final MappingContext mappingContext = writeContext.getMappingContext();
- final IpAddDelRoute request = specialNextHopRequestFactory
- .createIpv6SpecialHopRequest(isAdd, parentProtocolName, route, mappingContext, hop.getSpecialNextHop());
+ final IpAddDelRoute request =
+ specialNextHopRequestFactory.createIpv6SpecialHopRequest(isAdd, parentProtocolName, route, mappingContext,
+ hop.getSpecialNextHopEnum());
writeRoute(request, identifier);
}
@@ -206,7 +207,7 @@ public class Ipv6RouteCustomizer extends FutureJVppCustomizer
private void addMappingForEachHop(final @Nonnull String routeName, final @Nonnull WriteContext writeContext,
final List<NextHop> createdHops) {
createdHops.forEach(nextHop -> routesHopsContext.addChild(routeName,
- nextHop.getId().intValue(),
+ Integer.valueOf(nextHop.getIndex()),
namesFactory.uniqueRouteHopName(nextHop),
writeContext.getMappingContext()));
}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv6WriteRoutingNodes.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv6WriteRoutingNodes.java
deleted file mode 100644
index 14c70496b..000000000
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/Ipv6WriteRoutingNodes.java
+++ /dev/null
@@ -1,180 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.routing.write;
-
-import com.google.common.collect.ImmutableSet;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.StaticRoutes1;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.StaticRoutes1Builder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.StaticRoutes2;
-import 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;
-import 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.Ipv6Builder;
-import 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;
-import 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.RouteBuilder;
-import 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.RouteKey;
-import 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.NextHopOptions;
-import 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.VppIpv6Route;
-import 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.VppIpv6RouteBuilder;
-import 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.next.hop.options.*;
-import 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.next.hop.options.next.hop.list.NextHopList;
-import 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.next.hop.options.next.hop.list.next.hop.list.NextHop;
-import 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.next.hop.options.next.hop.list.next.hop.list.NextHopBuilder;
-import 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.next.hop.options.next.hop.list.next.hop.list.NextHopKey;
-import 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.next.hop.options.table.lookup.TableLookupParams;
-import 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.next.hop.options.table.lookup.TableLookupParamsBuilder;
-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.yangtools.yang.binding.InstanceIdentifier;
-
-import java.util.Optional;
-import java.util.Set;
-import java.util.stream.Collectors;
-
-
-public interface Ipv6WriteRoutingNodes {
-
- Ipv6WriteRoutingNodes INSTANCE = new Ipv6WriteRoutingNodes() {
- };
-
- Class<StaticRoutes1> CONFIG_IPV6_AUG_CLASS = StaticRoutes1.class;
- Class<StaticRoutes2> STATE_IPV6_AUG_CLASS = StaticRoutes2.class;
-
- static Ipv6 mapIpv6(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.Ipv6 state) {
- return new Ipv6Builder()
- .setRoute(state.getRoute()
- .stream()
- .map(route -> new RouteBuilder()
- .setKey(new RouteKey(route.getKey().getId()))
- .setDestinationPrefix(route.getDestinationPrefix())
- .setDescription(route.getDescription())
- .setId(route.getId())
- .setVppIpv6Route(mapVppIpv6Route(route.getVppIpv6RouteState()))
- .setNextHopOptions(mapNextHopOptions(route.getNextHopOptions()))
- .build())
- .collect(Collectors.toList()))
- .build();
- }
-
- static VppIpv6Route mapVppIpv6Route(
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.VppIpv6RouteState state) {
- return state == null
- ? null
- : new VppIpv6RouteBuilder()
- .setClassifyTable(state.getClassifyTable())
- .build();
- }
-
- static NextHopOptions mapNextHopOptions(
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.NextHopOptions state) {
- if (state instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.SimpleNextHop) {
- return mapSimpleNextHop(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.SimpleNextHop.class
- .cast(state));
- } else if (state instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.NextHopList) {
- return mapNextHopList(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.NextHopList.class
- .cast(state));
- } else if (state instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.SpecialNextHop) {
- return mapSpecialNextHop(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.SpecialNextHop.class
- .cast(state));
- } else if (state instanceof org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.TableLookup) {
- return mapTableLookup(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.TableLookup.class.cast(state));
- } else
- throw new UnsupportedOperationException("Unsupported next hop type");
- }
-
- static TableLookup mapTableLookup(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.TableLookup state) {
- return new TableLookupBuilder()
- .setTableLookupParams(Optional.ofNullable(state.getTableLookupParams())
- .map(params -> new TableLookupParamsBuilder()
- .setSecondaryVrf(params.getSecondaryVrf())
- .build())
- .orElse(null))
- .build();
- }
-
- static SimpleNextHop mapSimpleNextHop(
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.SimpleNextHop hop) {
- return new SimpleNextHopBuilder()
- .setNextHop(hop.getNextHop())
- .setOutgoingInterface(hop.getOutgoingInterface())
- .build();
- }
-
- static 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.next.hop.options.NextHopList mapNextHopList(
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.NextHopList state) {
- return new NextHopListBuilder()
- .setNextHopList(mapNextHopListList(state.getNextHopList()))
- .build();
- }
-
- static 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.next.hop.options.next.hop.list.NextHopList mapNextHopListList(
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.next.hop.list.NextHopList state) {
- return new 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.next.hop.options.next.hop.list.NextHopListBuilder()
- .setNextHop(state.getNextHop()
- .stream()
- .map(nextHop -> new NextHopBuilder()
- .setId(nextHop.getId())
- .setOutgoingInterface(nextHop.getOutgoingInterface())
- .setWeight(nextHop.getWeight())
- .setPriority(nextHop.getPriority())
- .setAddress(nextHop.getAddress())
- .setKey(new NextHopKey(nextHop.getKey().getId()))
- .build())
- .collect(Collectors.toList()))
- .build();
- }
-
- static SpecialNextHop mapSpecialNextHop(
- final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.routing.state.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.route.next.hop.options.SpecialNextHop hop) {
- return new SpecialNextHopBuilder()
- .setSpecialNextHop(hop.getSpecialNextHop())
- .build();
- }
-
- default InstanceIdentifier<Route> ipv6RouteIdentifier(
- final InstanceIdentifier<StaticRoutes> staticRoutesIdentifier) {
- return staticRoutesIdentifier
- .augmentation(StaticRoutes1.class)
- .child(Ipv6.class)
- .child(Route.class);
- }
-
- default InstanceIdentifier<Route> ipv6RouteSubtree() {
- return InstanceIdentifier
- .create(Route.class);
- }
-
- default Set<InstanceIdentifier<?>> ipv6RoutingHandledChildren(
- final InstanceIdentifier<Route> parent) {
- return ImmutableSet.of(
- parent.child(TableLookupParams.class),
- parent.child(NextHopList.class),
- parent.child(NextHopList.class).child(NextHop.class),
- parent.child(VppIpv6Route.class));
- }
-
- default org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.StaticRoutes1 mapIpv6Augmentation(
- final StaticRoutes2 state) {
- if (state == null) {
- return null;
- }
- return new StaticRoutes1Builder()
- .setIpv6(mapIpv6(state.getIpv6()))
- .build();
- }
-}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/PrefixCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/PrefixCustomizer.java
index 8ab73760b..ee34ee9fa 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/PrefixCustomizer.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/PrefixCustomizer.java
@@ -30,13 +30,13 @@ import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.vpp.jvpp.core.dto.SwInterfaceIp6NdRaPrefix;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import javax.annotation.Nonnull;
-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.ipv6.unicast.routing.rev170917.routing.routing.instance.interfaces._interface.ipv6.router.advertisements.prefix.list.PrefixKey;
-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.ControlAdvPrefixes;
-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.control.adv.prefixes.Advertise;
-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.control.adv.prefixes.NoAdvertise;
-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.vpp.routing.ra.rev170502.ControlAdvPrefixesVppAugmentation;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface;
+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.ipv6.unicast.routing.rev180313.interfaces._interface.ipv6.ipv6.router.advertisements.prefix.list.PrefixKey;
+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.ControlAdvPrefixes;
+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.control.adv.prefixes.Advertise;
+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.control.adv.prefixes.NoAdvertise;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.ra.rev180319.ControlAdvPrefixesVppAugmentation;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RouterAdvertisementsCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RouterAdvertisementsCustomizer.java
index b8c60ba51..3d43afbd4 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RouterAdvertisementsCustomizer.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RouterAdvertisementsCustomizer.java
@@ -27,9 +27,9 @@ import io.fd.honeycomb.translate.write.WriteFailedException;
import io.fd.vpp.jvpp.core.dto.SwInterfaceIp6NdRaConfig;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import javax.annotation.Nonnull;
-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.routing.rev140524.routing.routing.instance.interfaces.Interface;
-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.ietf.interfaces.rev140508.interfaces.Interface;
+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.vpp.routing.ra.rev180319.Ipv6RouterAdvertisementsVppAugmentation;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingCustomizer.java
index 0e99aeead..3a8d05c67 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingCustomizer.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingCustomizer.java
@@ -20,7 +20,7 @@ import io.fd.honeycomb.translate.spi.write.WriterCustomizer;
import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
import javax.annotation.Nonnull;
-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.rev180313.Routing;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -28,7 +28,7 @@ import org.slf4j.LoggerFactory;
/**
* Dummy customizer for Root node,to "handle" non-operational changes
*/
-public class RoutingCustomizer implements WriterCustomizer<Routing> {
+final class RoutingCustomizer implements WriterCustomizer<Routing> {
private static final Logger LOG = LoggerFactory.getLogger(RoutingCustomizer.class);
@@ -37,6 +37,7 @@ public class RoutingCustomizer implements WriterCustomizer<Routing> {
@Nonnull final Routing routing, @Nonnull final WriteContext writeContext)
throws WriteFailedException {
LOG.debug("Writing {}", instanceIdentifier);
+ checkSingletonInstance(routing);
}
@Override
@@ -44,5 +45,12 @@ public class RoutingCustomizer implements WriterCustomizer<Routing> {
@Nonnull final Routing routing, @Nonnull final WriteContext writeContext)
throws WriteFailedException {
LOG.debug("Removing {}", instanceIdentifier);
+ checkSingletonInstance(routing);
+ }
+
+ private void checkSingletonInstance(final Routing data) {
+ if (data.getRouterId() != null) {
+ throw new UnsupportedOperationException("Setting RouterId is not supported.");
+ }
}
}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizer.java
deleted file mode 100644
index 7d63647e0..000000000
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizer.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*
- * Copyright (c) 2016 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.routing.write;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import io.fd.hc2vpp.routing.RoutingConfiguration;
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import javax.annotation.Nonnull;
-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.RoutingInstanceKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-/**
- * Only ensures that requests are written under singleton instance
- */
-public class RoutingInstanceCustomizer implements ListWriterCustomizer<RoutingInstance, RoutingInstanceKey> {
-
- private final RoutingConfiguration configuration;
-
- public RoutingInstanceCustomizer(@Nonnull final RoutingConfiguration configuration) {
- this.configuration = configuration;
- }
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<RoutingInstance> id,
- @Nonnull final RoutingInstance dataAfter,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- checkSingletonInstance(dataAfter);
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<RoutingInstance> id,
- @Nonnull final RoutingInstance dataBefore,
- @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- checkSingletonInstance(dataBefore);
- }
-
- private void checkSingletonInstance(final RoutingInstance data) {
- final String defaultRoutingInstanceName = configuration.getDefaultRoutingInstanceName();
- final String instanceName = data.getName();
-
- checkArgument(defaultRoutingInstanceName.equals(instanceName),
- "Attempt to write/delete data for different than default routing instance detected." +
- "Vpp allows only single instance, configured with name %s, request contains name %s",
- defaultRoutingInstanceName, instanceName);
- }
-}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingInterfaceCustomizer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingInterfaceCustomizer.java
deleted file mode 100644
index e898c718c..000000000
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/RoutingInterfaceCustomizer.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2017 Cisco and/or its affiliates.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at:
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package io.fd.hc2vpp.routing.write;
-
-import static com.google.common.base.Preconditions.checkArgument;
-
-import io.fd.honeycomb.translate.spi.write.ListWriterCustomizer;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.Interfaces;
-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.interfaces.InterfaceKey;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import org.opendaylight.yangtools.yang.binding.KeyedInstanceIdentifier;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Dummy customizer for Interfaces node responsible for validation only.
- */
-final class RoutingInterfaceCustomizer implements ListWriterCustomizer<Interface, InterfaceKey> {
-
- private static final Logger LOG = LoggerFactory.getLogger(RoutingInterfaceCustomizer.class);
-
- @Override
- public void writeCurrentAttributes(@Nonnull final InstanceIdentifier<Interface> id,
- @Nonnull final Interface after, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- LOG.debug("Writing {} after={}", id, after);
- checkIfcIsConfigured(after.getName(), writeContext);
- }
-
- @Override
- public void updateCurrentAttributes(@Nonnull final InstanceIdentifier<Interface> id,
- @Nonnull final Interface before, @Nonnull final Interface after,
- @Nonnull final WriteContext writeContext) throws WriteFailedException {
- LOG.debug("Updating {} before={} after={}", id, before, after);
- checkIfcIsConfigured(after.getName(), writeContext);
- }
-
- @Override
- public void deleteCurrentAttributes(@Nonnull final InstanceIdentifier<Interface> id,
- @Nonnull final Interface after, @Nonnull final WriteContext writeContext)
- throws WriteFailedException {
- LOG.debug("Removing {}", id);
- // here we do not care if the ifc exists or not, because we are removing reference to it
- }
-
- private static void checkIfcIsConfigured(@Nonnull final String ifcName, @Nonnull final WriteContext writeContext) {
- final KeyedInstanceIdentifier<org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface, org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey>
- id = InstanceIdentifier.create(Interfaces.class)
- .child(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface.class,
- new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.InterfaceKey(
- ifcName));
- checkArgument(writeContext.readAfter(id).isPresent(), "Interface %s is not configured", ifcName);
- }
-}
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));
}
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactory.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactory.java
index bad51478d..62e4f4525 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactory.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactory.java
@@ -22,16 +22,20 @@ import io.fd.hc2vpp.routing.write.trait.RouteRequestProducer;
import io.fd.hc2vpp.vpp.classifier.context.VppClassifierContextManager;
import io.fd.honeycomb.translate.MappingContext;
import io.fd.vpp.jvpp.core.dto.IpAddDelRoute;
+import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
-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.VppIpv4Route;
-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.next.hop.options.next.hop.list.next.hop.list.NextHop;
-import 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.VppIpv6Route;
-
-import javax.annotation.Nonnull;
-
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.Route;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.route.next.hop.NextHop1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.next.hop.list.NextHop;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv4.unicast.routing.rev180319.VppIpv4NextHopAugmentation;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv4.unicast.routing.rev180319.VppIpv4RouteAttributesAugmentation;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv4.unicast.routing.rev180319.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.route.VppIpv4Route;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv6.unicast.routing.rev180319.VppIpv6NextHopAugmentation;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv6.unicast.routing.rev180319.VppIpv6RouteAttributesAugmentation;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv6.unicast.routing.rev180319.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.route.VppIpv6Route;
/**
* Factory for creating requests to create route with multiple hops
@@ -53,10 +57,12 @@ public class MultipathHopRequestFactory extends BasicHopRequestFactory implement
public IpAddDelRoute createIpv4MultipathHopRequest(final boolean add,
@Nonnull final String parentProtocolName,
- @Nonnull final 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 route,
+ @Nonnull final Route route,
@Nonnull final NextHop hop,
@Nonnull final MappingContext mappingContext) {
- final VppIpv4Route routingAttributes = route.getVppIpv4Route();
+
+ final VppIpv4Route routingAttributes = route.getAugmentation(VppIpv4RouteAttributesAugmentation.class) != null ?
+ route.getAugmentation(VppIpv4RouteAttributesAugmentation.class).getVppIpv4Route() : null;
final int nextHopInterfaceIndex =
getInterfaceNamingContext().getIndex(hop.getOutgoingInterface(), mappingContext);
@@ -66,8 +72,8 @@ public class MultipathHopRequestFactory extends BasicHopRequestFactory implement
return getMultipathHopRequest(add,
route.getDestinationPrefix(),
nextHopInterfaceIndex,
- hop.getAddress(),
- hop.getWeight().byteValue(),
+ hop.getAugmentation(NextHop1.class).getNextHopAddress(),
+ hop.getAugmentation(VppIpv4NextHopAugmentation.class).getWeight().byteValue(),
getRoutingProtocolContext().getIndex(parentProtocolName, mappingContext),
DEFAULT_VNI,
classifyTableIndex(routingAttributes.getClassifyTable(), getVppClassifierContextManager(),
@@ -77,8 +83,8 @@ public class MultipathHopRequestFactory extends BasicHopRequestFactory implement
return getMultipathHopRequest(add,
route.getDestinationPrefix(),
nextHopInterfaceIndex,
- hop.getAddress(),
- hop.getWeight().byteValue(),
+ hop.getAugmentation(NextHop1.class).getNextHopAddress(),
+ hop.getAugmentation(VppIpv4NextHopAugmentation.class).getWeight().byteValue(),
getRoutingProtocolContext().getIndex(parentProtocolName, mappingContext),
DEFAULT_VNI,
0,
@@ -88,10 +94,11 @@ public class MultipathHopRequestFactory extends BasicHopRequestFactory implement
public IpAddDelRoute createIpv6MultipathHopRequest(final boolean add,
@Nonnull final String parentProtocolName,
- @Nonnull final 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 route,
- @Nonnull final 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.next.hop.options.next.hop.list.next.hop.list.NextHop hop,
+ @Nonnull final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.Route route,
+ @Nonnull final NextHop hop,
@Nonnull final MappingContext mappingContext) {
- final VppIpv6Route routingAttributes = route.getVppIpv6Route();
+ final VppIpv6Route routingAttributes = route.getAugmentation(VppIpv6RouteAttributesAugmentation.class) != null ?
+ route.getAugmentation(VppIpv6RouteAttributesAugmentation.class).getVppIpv6Route() : null;
final int nextHopInterfaceIndex =
getInterfaceNamingContext().getIndex(hop.getOutgoingInterface(), mappingContext);
@@ -101,8 +108,8 @@ public class MultipathHopRequestFactory extends BasicHopRequestFactory implement
return getMultipathHopRequest(add,
route.getDestinationPrefix(),
nextHopInterfaceIndex,
- hop.getAddress(),
- hop.getWeight().byteValue(),
+ hop.getAugmentation(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.route.next.hop.NextHop1.class).getNextHopAddress(),
+ hop.getAugmentation(VppIpv6NextHopAugmentation.class).getWeight().byteValue(),
getRoutingProtocolContext().getIndex(parentProtocolName, mappingContext),
DEFAULT_VNI,
classifyTableIndex(routingAttributes.getClassifyTable(), getVppClassifierContextManager(),
@@ -112,8 +119,8 @@ public class MultipathHopRequestFactory extends BasicHopRequestFactory implement
return getMultipathHopRequest(add,
route.getDestinationPrefix(),
nextHopInterfaceIndex,
- hop.getAddress(),
- hop.getWeight().byteValue(),
+ hop.getAugmentation(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.route.next.hop.NextHop1.class).getNextHopAddress(),
+ hop.getAugmentation(VppIpv6NextHopAugmentation.class).getWeight().byteValue(),
getRoutingProtocolContext().getIndex(parentProtocolName, mappingContext),
DEFAULT_VNI,
0,
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactory.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactory.java
index 6e404923f..079c953a3 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactory.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactory.java
@@ -22,17 +22,18 @@ import io.fd.hc2vpp.routing.write.trait.RouteRequestProducer;
import io.fd.hc2vpp.vpp.classifier.context.VppClassifierContextManager;
import io.fd.honeycomb.translate.MappingContext;
import io.fd.vpp.jvpp.core.dto.IpAddDelRoute;
-
import javax.annotation.Nonnull;
-
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Address;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
-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.VppIpv4Route;
-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.next.hop.options.SimpleNextHop;
-import 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.VppIpv6Route;
-
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.Route;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.route.next.hop.SimpleNextHop1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.SimpleNextHop;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv4.unicast.routing.rev180319.VppIpv4RouteAttributesAugmentation;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv4.unicast.routing.rev180319.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.route.VppIpv4Route;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv6.unicast.routing.rev180319.VppIpv6RouteAttributesAugmentation;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv6.unicast.routing.rev180319.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.route.VppIpv6Route;
/**
* Factory for creating requests to create route with hop simple hop
@@ -54,31 +55,35 @@ public class SimpleHopRequestFactory extends BasicHopRequestFactory implements R
public IpAddDelRoute createIpv4SimpleHopRequest(final boolean add,
@Nonnull final String parentProtocolName,
- @Nonnull final 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 route,
+ @Nonnull final Route route,
@Nonnull final MappingContext mappingContext) {
+ SimpleNextHop simpleNextHop = (SimpleNextHop) route.getNextHop().getNextHopOptions();
+ SimpleNextHop1 hop = simpleNextHop.getAugmentation(SimpleNextHop1.class);
- final SimpleNextHop hop = SimpleNextHop.class.cast(route.getNextHopOptions());
- final VppIpv4Route routingAttributes = route.getVppIpv4Route();
final int nextHopInterfaceIndex =
- getInterfaceNamingContext().getIndex(hop.getOutgoingInterface(), mappingContext);
+ getInterfaceNamingContext().getIndex(simpleNextHop.getOutgoingInterface(), mappingContext);
+
+ final VppIpv4Route routingAttributes =
+ route.getAugmentation(VppIpv4RouteAttributesAugmentation.class) != null ?
+ route.getAugmentation(VppIpv4RouteAttributesAugmentation.class).getVppIpv4Route() : null;
if (routingAttributes != null &&
classifyTablePresent(routingAttributes.getClassifyTable(), getVppClassifierContextManager(),
mappingContext)) {
return getSimpleHopRequest(add,
- route.getDestinationPrefix(),
- nextHopInterfaceIndex,
- hop.getNextHop(),
- getRoutingProtocolContext().getIndex(parentProtocolName, mappingContext),
- DEFAULT_VNI,
- classifyTableIndex(routingAttributes.getClassifyTable(), getVppClassifierContextManager(),
- mappingContext),
- true);
+ route.getDestinationPrefix(),
+ nextHopInterfaceIndex,
+ hop.getNextHopAddress(),
+ getRoutingProtocolContext().getIndex(parentProtocolName, mappingContext),
+ DEFAULT_VNI,
+ classifyTableIndex(routingAttributes.getClassifyTable(),
+ getVppClassifierContextManager(), mappingContext),
+ true);
} else {
return getSimpleHopRequest(add,
route.getDestinationPrefix(),
nextHopInterfaceIndex,
- hop.getNextHop(),
+ hop.getNextHopAddress(),
getRoutingProtocolContext().getIndex(parentProtocolName, mappingContext),
DEFAULT_VNI,
0,
@@ -88,15 +93,17 @@ public class SimpleHopRequestFactory extends BasicHopRequestFactory implements R
public IpAddDelRoute createIpv6SimpleHopRequest(final boolean add,
@Nonnull final String parentProtocolName,
- @Nonnull final 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 route,
+ @Nonnull final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.Route route,
@Nonnull final MappingContext mappingContext) {
- final 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.next.hop.options.SimpleNextHop
- hop =
- (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.next.hop.options.SimpleNextHop) route
- .getNextHopOptions();
- final VppIpv6Route routingAttributes = route.getVppIpv6Route();
+ SimpleNextHop simpleNextHop = (SimpleNextHop) route.getNextHop().getNextHopOptions();
+ final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.route.next.hop.SimpleNextHop1
+ hop = simpleNextHop.getAugmentation(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.route.next.hop.SimpleNextHop1.class);
final int nextHopInterfaceIndex =
- getInterfaceNamingContext().getIndex(hop.getOutgoingInterface(), mappingContext);
+ getInterfaceNamingContext().getIndex(simpleNextHop.getOutgoingInterface(), mappingContext);
+
+ VppIpv6Route routingAttributes =
+ route.getAugmentation(VppIpv6RouteAttributesAugmentation.class) != null ? route.getAugmentation(
+ VppIpv6RouteAttributesAugmentation.class).getVppIpv6Route() : null;
if (routingAttributes != null &&
classifyTablePresent(routingAttributes.getClassifyTable(), getVppClassifierContextManager(),
@@ -104,7 +111,7 @@ public class SimpleHopRequestFactory extends BasicHopRequestFactory implements R
return getSimpleHopRequest(add,
route.getDestinationPrefix(),
nextHopInterfaceIndex,
- hop.getNextHop(),
+ hop.getNextHopAddress(),
getRoutingProtocolContext().getIndex(parentProtocolName, mappingContext),
DEFAULT_VNI,
classifyTableIndex(routingAttributes.getClassifyTable(), getVppClassifierContextManager(),
@@ -114,7 +121,7 @@ public class SimpleHopRequestFactory extends BasicHopRequestFactory implements R
return getSimpleHopRequest(add,
route.getDestinationPrefix(),
nextHopInterfaceIndex,
- hop.getNextHop(),
+ hop.getNextHopAddress(),
getRoutingProtocolContext().getIndex(parentProtocolName, mappingContext),
DEFAULT_VNI,
0,
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactory.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactory.java
index 10e0fc555..85b998204 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactory.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactory.java
@@ -16,19 +16,19 @@
package io.fd.hc2vpp.routing.write.factory;
+import static com.google.common.base.Preconditions.checkNotNull;
+
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.hc2vpp.routing.write.factory.base.BasicHopRequestFactory;
import io.fd.hc2vpp.routing.write.trait.RouteRequestProducer;
import io.fd.hc2vpp.vpp.classifier.context.VppClassifierContextManager;
import io.fd.honeycomb.translate.MappingContext;
import io.fd.vpp.jvpp.core.dto.IpAddDelRoute;
+import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.SpecialNextHopGrouping;
-
-import javax.annotation.Nonnull;
-
-import static com.google.common.base.Preconditions.checkNotNull;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.Route;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.SpecialNextHop;
public class SpecialNextHopRequestFactory extends BasicHopRequestFactory
implements RouteRequestProducer {
@@ -48,9 +48,9 @@ public class SpecialNextHopRequestFactory extends BasicHopRequestFactory
public IpAddDelRoute createIpv4SpecialHopRequest(final boolean add,
@Nonnull final String parentProtocolName,
- @Nonnull final 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 route,
+ @Nonnull final Route route,
@Nonnull final MappingContext mappingContext,
- @Nonnull final SpecialNextHopGrouping.SpecialNextHop flagsVariant) {
+ @Nonnull final SpecialNextHop.SpecialNextHopEnum flagsVariant) {
checkNotNull(route, "Route cannot be null");
checkNotNull(mappingContext, "Mapping Context cannot be null");
checkNotNull(flagsVariant, "Flags variant cannot be null");
@@ -61,9 +61,9 @@ public class SpecialNextHopRequestFactory extends BasicHopRequestFactory
public IpAddDelRoute createIpv6SpecialHopRequest(final boolean add,
@Nonnull final String parentProtocolName,
- @Nonnull final 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 route,
+ @Nonnull final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.Route route,
@Nonnull final MappingContext mappingContext,
- @Nonnull final SpecialNextHopGrouping.SpecialNextHop flagsVariant) {
+ @Nonnull final SpecialNextHop.SpecialNextHopEnum flagsVariant) {
checkNotNull(route, "Route cannot be null");
checkNotNull(mappingContext, "Mapping Context cannot be null");
@@ -89,7 +89,7 @@ public class SpecialNextHopRequestFactory extends BasicHopRequestFactory
}
private IpAddDelRoute resolveFlags(IpAddDelRoute request,
- final SpecialNextHopGrouping.SpecialNextHop flagsVariant) {
+ final SpecialNextHop.SpecialNextHopEnum flagsVariant) {
switch (flagsVariant) {
case Blackhole:
return resolveAsBlackholeVariant(request);
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/TableLookupRequestFactory.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/TableLookupRequestFactory.java
index 231ffcaf4..8a11adc8f 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/TableLookupRequestFactory.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/factory/TableLookupRequestFactory.java
@@ -22,16 +22,19 @@ import io.fd.hc2vpp.routing.write.trait.RouteRequestProducer;
import io.fd.hc2vpp.vpp.classifier.context.VppClassifierContextManager;
import io.fd.honeycomb.translate.MappingContext;
import io.fd.vpp.jvpp.core.dto.IpAddDelRoute;
+import java.util.Optional;
+import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
-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.next.hop.options.TableLookup;
-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.next.hop.options.table.lookup.TableLookupParams;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev170917.VniReference;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev170917.VppRouteAttributes;
-
-
-import javax.annotation.Nonnull;
-import java.util.Optional;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.Route;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.NextHopOptions;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.next.hop.content.next.hop.options.TableLookupCase;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv4.unicast.routing.rev180319.VppIpv4RouteAttributesAugmentation;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv4.unicast.routing.rev180319.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.route.VppIpv4Route;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv6.unicast.routing.rev180319.VppIpv6RouteAttributesAugmentation;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv6.unicast.routing.rev180319.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.route.VppIpv6Route;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev180319.VppRouteAttributes;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.types.rev180406.VniReference;
public class TableLookupRequestFactory extends BasicHopRequestFactory implements RouteRequestProducer {
@@ -46,23 +49,26 @@ public class TableLookupRequestFactory extends BasicHopRequestFactory implements
public IpAddDelRoute createV4TableLookupRouteRequest(final boolean add,
@Nonnull final String parentProtocolName,
- @Nonnull final 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 route,
+ @Nonnull final Route route,
@Nonnull final MappingContext mappingContext) {
final Ipv4Prefix prefix = route.getDestinationPrefix();
final byte[] destinationAddress = ipv4AddressPrefixToArray(prefix);
final byte destinationPrefix = extractPrefix(prefix);
final int primaryTableId = getRoutingProtocolContext().getIndex(parentProtocolName, mappingContext);
- final byte secondaryTableId = Optional.ofNullable(route.getNextHopOptions())
- .filter(nextHopOptions -> nextHopOptions instanceof TableLookup)
- .map(TableLookup.class::cast)
- .map(TableLookup::getTableLookupParams)
- .map(TableLookupParams::getSecondaryVrf)
+ final byte secondaryTableId = Optional.ofNullable(route.getNextHop().getNextHopOptions())
+ .filter(nextHopOptions -> nextHopOptions instanceof TableLookupCase)
+ .map(TableLookupCase.class::cast)
+ .map(TableLookupCase::getSecondaryVrf)
.map(VniReference::getValue)
.map(Long::byteValue)
.orElseThrow(() -> new IllegalArgumentException("Table lookup option not specified correctly"));
- final Optional<String> optClassifyTable = Optional.ofNullable(route.getVppIpv4Route())
+ VppIpv4Route vppIpv4Route =
+ route.getAugmentation(VppIpv4RouteAttributesAugmentation.class) != null ? route.getAugmentation(
+ VppIpv4RouteAttributesAugmentation.class).getVppIpv4Route() : null;
+
+ final Optional<String> optClassifyTable = Optional.ofNullable(vppIpv4Route)
.map(VppRouteAttributes::getClassifyTable);
final byte classifyTableSet = booleanToByte(optClassifyTable.isPresent());
final byte classifyTableIndex = optClassifyTable.map(tableName -> classifyTableIndex(tableName, getVppClassifierContextManager(), mappingContext))
@@ -75,23 +81,25 @@ public class TableLookupRequestFactory extends BasicHopRequestFactory implements
public IpAddDelRoute createV6TableLookupRouteRequest(final boolean add,
@Nonnull final String parentProtocolName,
- @Nonnull final 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 route,
+ @Nonnull final org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.Route route,
@Nonnull final MappingContext mappingContext) {
final Ipv6Prefix prefix = route.getDestinationPrefix();
final byte[] destinationAddress = ipv6AddressPrefixToArray(prefix);
final byte destinationPrefix = extractPrefix(prefix);
final int primaryTableId = getRoutingProtocolContext().getIndex(parentProtocolName, mappingContext);
- final byte secondaryTableId = Optional.ofNullable(route.getNextHopOptions())
- .filter(nextHopOptions -> nextHopOptions instanceof 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.next.hop.options.TableLookup)
- .map(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.next.hop.options.TableLookup.class::cast)
- .map(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.next.hop.options.TableLookup::getTableLookupParams)
- .map(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.next.hop.options.table.lookup.TableLookupParams::getSecondaryVrf)
+ final byte secondaryTableId = Optional.ofNullable(route.getNextHop().getNextHopOptions())
+ .filter(nextHopOptions -> nextHopOptions instanceof TableLookupCase)
+ .map(TableLookupCase.class::cast)
+ .map(TableLookupCase::getSecondaryVrf)
.map(VniReference::getValue)
.map(Long::byteValue)
.orElseThrow(() -> new IllegalArgumentException("Table lookup option not specified correctly"));
- final Optional<String> optClassifyTable = Optional.ofNullable(route.getVppIpv6Route())
+ VppIpv6Route vppIpv6Route = route.getAugmentation(VppIpv6RouteAttributesAugmentation.class) != null
+ ? route.getAugmentation(VppIpv6RouteAttributesAugmentation.class).getVppIpv6Route() : null;
+
+ final Optional<String> optClassifyTable = Optional.ofNullable(vppIpv6Route)
.map(VppRouteAttributes::getClassifyTable);
final byte classifyTableSet = booleanToByte(optClassifyTable.isPresent());
final byte classifyTableIndex = optClassifyTable.map(tableName -> classifyTableIndex(tableName, getVppClassifierContextManager(), mappingContext))
diff --git a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/trait/RouteRequestProducer.java b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/trait/RouteRequestProducer.java
index 97adb3589..f1a97aa22 100644
--- a/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/trait/RouteRequestProducer.java
+++ b/routing/routing-impl/src/main/java/io/fd/hc2vpp/routing/write/trait/RouteRequestProducer.java
@@ -32,7 +32,7 @@ import java.util.Set;
import java.util.regex.Pattern;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Prefix;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv6Prefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev170917.VniReference;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.types.rev180406.VniReference;
/**
diff --git a/routing/routing-impl/src/main/resources/honeycomb-minimal-resources/config/routing.json b/routing/routing-impl/src/main/resources/honeycomb-minimal-resources/config/routing.json
index 95f85414f..5b7fe6de7 100644
--- a/routing/routing-impl/src/main/resources/honeycomb-minimal-resources/config/routing.json
+++ b/routing/routing-impl/src/main/resources/honeycomb-minimal-resources/config/routing.json
@@ -1,4 +1,3 @@
{
- "default-routing-instance-name": "vpp-routing-instance",
"learned-route-name-prefix": "learned-route"
-} \ No newline at end of file
+}