summaryrefslogtreecommitdiffstats
path: root/routing/routing-impl
diff options
context:
space:
mode:
Diffstat (limited to 'routing/routing-impl')
-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
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv4RouteNamesFactoryTest.java33
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv6RouteData.java4
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv6RouteNamesFactoryTest.java37
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/RoutingModuleTest.java4
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/helpers/RoutingRequestTestHelper.java45
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/helpers/SchemaContextTestHelper.java35
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/read/ControlPlaneProtocolCustomizerTest.java (renamed from routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/read/RoutingProtocolCustomizerTest.java)41
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/read/Ipv4RouteCustomizerTest.java135
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/read/Ipv6RouteCustomizerTest.java117
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/read/RoutingStateCustomizerTest.java64
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/ControlPlaneProtocolCustomizerTest.java (renamed from routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizerTest.java)38
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv4RouteCustomizerTest.java96
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizerTest.java72
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/PrefixCustomizerTest.java53
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RouterAdvertisementsCustomizerTest.java42
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizerTest.java87
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingInterfaceCustomizerTest.java91
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactoryIpv4Test.java40
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactoryIpv6Test.java29
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactoryIpv4Test.java15
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactoryIpv6Test.java4
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactoryIpv4Test.java52
-rw-r--r--routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactoryIpv6Test.java58
-rw-r--r--routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithClassifier.json37
-rw-r--r--routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithNoRouteAttrs.json35
-rw-r--r--routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithoutClassifier.json37
-rw-r--r--routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteNoRouteAttrs.json7
-rw-r--r--routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteWithClassifier.json11
-rw-r--r--routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteWithoutClassifier.json9
-rw-r--r--routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteBlackhole.json5
-rw-r--r--routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteProhibited.json5
-rw-r--r--routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteReceive.json5
-rw-r--r--routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteUnreachable.json7
-rw-r--r--routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithClassifier.json35
-rw-r--r--routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithoutClassifier.json35
-rw-r--r--routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithoutRouteAttrs.json35
-rw-r--r--routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithClassifier.json13
-rw-r--r--routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithoutClassifier.json11
-rw-r--r--routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithoutRouteAttrs.json9
-rw-r--r--routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteBlackhole.json7
-rw-r--r--routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteProhibited.json7
-rw-r--r--routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteReceive.json7
-rw-r--r--routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteUnreachable.json9
-rw-r--r--routing/routing-impl/src/test/resources/ra/complexRa.json18
-rw-r--r--routing/routing-impl/src/test/resources/ra/simpleRa.json8
-rw-r--r--routing/routing-impl/src/test/resources/routing.json4
82 files changed, 1665 insertions, 2366 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
+}
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv4RouteNamesFactoryTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv4RouteNamesFactoryTest.java
index 3e0c311df..25a1f5640 100644
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv4RouteNamesFactoryTest.java
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv4RouteNamesFactoryTest.java
@@ -34,8 +34,13 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
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.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.routing.rev140524.routing.routing.instance.routing.protocols.routing.protocol.StaticRoutes;
+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.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.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.ietf.routing.rev180313.routing.control.plane.protocols.control.plane.protocol.StaticRoutes;
+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;
@RunWith(HoneycombTestRunner.class)
public class Ipv4RouteNamesFactoryTest
@@ -73,19 +78,27 @@ public class Ipv4RouteNamesFactoryTest
@Test
public void testUniqueRouteName(
@InjectTestData(resourcePath = "/ipv4/simplehop/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH)
- StaticRoutes data) {
- assertEquals("tst-protocol_19216821_24",
- factory.uniqueRouteName(ROUTE_PROTOCOL_NAME, getIpv4RouteWithId(data, 1L)));
- assertEquals("tst-protocol_19216821_24", factory.uniqueRouteName(vppRoute, mappingContext));
+ StaticRoutes data) {
+ assertEquals("tst-protocol_192-168-2-1_24",
+ factory.uniqueRouteName(ROUTE_PROTOCOL_NAME,
+ getIpv4RouteWithId(data, new Ipv4Prefix("192.168.2.1/24"))));
+ assertEquals("tst-protocol_192-168-2-1_24", factory.uniqueRouteName(vppRoute, mappingContext));
}
@Test
public void testUniqueRouteHopName() {
- assertEquals("iface_19216821_3", factory.uniqueRouteHopName(new NextHopBuilder()
- .setAddress(new Ipv4Address("192.168.2.1"))
- .setWeight((short) 3)
+ assertEquals("iface_192-168-2-1_3", factory.uniqueRouteHopName(
+ new NextHopBuilder()
.setOutgoingInterface("iface")
+ .addAugmentation(NextHop1.class,
+ new NextHop1Builder()
+ .setNextHopAddress(new Ipv4Address("192.168.2.1"))
+ .build())
+ .addAugmentation(VppIpv4NextHopAugmentation.class,
+ new VppIpv4NextHopAugmentationBuilder()
+ .setWeight((short) 3)
+ .build())
.build()));
- assertEquals("iface_19216821_3", factory.uniqueRouteHopName(vppPath, mappingContext));
+ assertEquals("iface_192-168-2-1_3", factory.uniqueRouteHopName(vppPath, mappingContext));
}
}
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv6RouteData.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv6RouteData.java
index 0e5ecd942..098055812 100644
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv6RouteData.java
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv6RouteData.java
@@ -18,8 +18,8 @@ package io.fd.hc2vpp.routing;
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.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.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;
public class Ipv6RouteData {
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv6RouteNamesFactoryTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv6RouteNamesFactoryTest.java
index c7e5a0bd4..2acf9fe4f 100644
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv6RouteNamesFactoryTest.java
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/Ipv6RouteNamesFactoryTest.java
@@ -35,8 +35,13 @@ import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
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.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.routing.rev140524.routing.routing.instance.routing.protocols.routing.protocol.StaticRoutes;
+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.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.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.ietf.routing.rev180313.routing.control.plane.protocols.control.plane.protocol.StaticRoutes;
+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;
@RunWith(HoneycombTestRunner.class)
public class Ipv6RouteNamesFactoryTest implements RoutingRequestTestHelper, SchemaContextTestHelper,
@@ -73,20 +78,30 @@ public class Ipv6RouteNamesFactoryTest implements RoutingRequestTestHelper, Sche
@Test
public void testUniqueRouteName(
@InjectTestData(resourcePath = "/ipv6/simplehop/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH)
- StaticRoutes data) {
- assertEquals("tst-protocol_2001db8a0b12f01_64",
- factory.uniqueRouteName(ROUTE_PROTOCOL_NAME, getIpv6RouteWithId(data, 1L)));
- assertEquals("tst-protocol_2001db8a0b12f01_64", factory.uniqueRouteName(vppRoute, mappingContext));
+ StaticRoutes data) {
+ assertEquals("tst-protocol_2001-db8-a0b-12f0--1_64",
+ factory.uniqueRouteName(ROUTE_PROTOCOL_NAME,
+ getIpv6RouteWithId(data,
+ new Ipv6Prefix("2001:0db8:0a0b:12f0:0000:0000:0000:0001/64"))));
+ assertEquals("tst-protocol_2001-db8-a0b-12f0--1_64", factory.uniqueRouteName(vppRoute, mappingContext));
}
@Test
public void testUniqueRouteHopName() {
- assertEquals("iface_2001db8a0b12f01_3", factory.uniqueRouteHopName(new NextHopBuilder()
- .setAddress(new Ipv6Address("2001:0db8:0a0b:12f0:0000:0000:0000:0001"))
- .setWeight((short) 3)
+ assertEquals("iface_2001-db8-a0b-12f0--1_3", factory.uniqueRouteHopName(
+ new NextHopBuilder()
.setOutgoingInterface("iface")
- .build()));
- assertEquals("iface_2001db8a0b12f01_3",
+ .setIndex("1")
+ .addAugmentation(NextHop1.class,
+ new NextHop1Builder()
+ .setNextHopAddress(new Ipv6Address("2001:0db8:0a0b:12f0:0000:0000:0000:0001"))
+ .build())
+ .addAugmentation(VppIpv6NextHopAugmentation.class,
+ new VppIpv6NextHopAugmentationBuilder()
+ .setWeight((short) 3)
+ .build())
+ .build()));
+ assertEquals("iface_2001-db8-a0b-12f0--1_3",
factory.uniqueRouteHopName(vppPath, mappingContext));
}
}
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/RoutingModuleTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/RoutingModuleTest.java
index d8159818b..679b90316 100644
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/RoutingModuleTest.java
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/RoutingModuleTest.java
@@ -31,7 +31,7 @@ import com.google.inject.name.Named;
import com.google.inject.testing.fieldbinder.Bind;
import com.google.inject.testing.fieldbinder.BoundFieldModule;
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.hc2vpp.vpp.classifier.context.VppClassifierContextManager;
import io.fd.honeycomb.translate.impl.read.registry.CompositeReaderRegistryBuilder;
@@ -94,7 +94,7 @@ public class RoutingModuleTest {
readerFactories.stream().forEach(factory -> factory.init(registryBuilder));
assertNotNull(registryBuilder.build());
assertEquals(1, readerFactories.size());
- assertTrue(readerFactories.iterator().next() instanceof RoutingStateReaderFactory);
+ assertTrue(readerFactories.iterator().next() instanceof RoutingReaderFactory);
}
@Test
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/helpers/RoutingRequestTestHelper.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/helpers/RoutingRequestTestHelper.java
index 6ca6bdd8b..fa166cb44 100644
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/helpers/RoutingRequestTestHelper.java
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/helpers/RoutingRequestTestHelper.java
@@ -17,7 +17,7 @@
package io.fd.hc2vpp.routing.helpers;
import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
+import static org.mockito.ArgumentMatchers.any;
import static org.mockito.Mockito.times;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
@@ -32,10 +32,13 @@ import io.fd.vpp.jvpp.core.dto.IpAddDelRouteReply;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import java.util.List;
import org.mockito.ArgumentCaptor;
-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.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.routing.rev140524.routing.routing.instance.routing.protocols.routing.protocol.StaticRoutes;
+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.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.Route;
+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.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.control.plane.protocol.StaticRoutes;
public interface RoutingRequestTestHelper extends ByteDataTranslator, FutureProducer, RouteMapper {
@@ -43,9 +46,9 @@ public interface RoutingRequestTestHelper extends ByteDataTranslator, FutureProd
String ROUTE_PROTOCOL_NAME_2 = "tst-protocol-2";
String ROUTE_NAME = "tst-route";
String STATIC_ROUTE_PATH = "/hc2vpp-ietf-routing:routing" +
- "/hc2vpp-ietf-routing:routing-instance[hc2vpp-ietf-routing:name='" + ROUTE_PROTOCOL_NAME + "']" +
- "/hc2vpp-ietf-routing:routing-protocols" +
- "/hc2vpp-ietf-routing:routing-protocol[hc2vpp-ietf-routing:name='" + ROUTE_NAME + "']" +
+ "/hc2vpp-ietf-routing:control-plane-protocols" +
+ "/hc2vpp-ietf-routing:control-plane-protocol" +
+ "[hc2vpp-ietf-routing:name='" + ROUTE_NAME + "'][hc2vpp-ietf-routing:type='static']" +
"/hc2vpp-ietf-routing:static-routes";
default IpAddDelRoute desiredFlaglessResult(final int add, final int ipv6, final int isMultipath,
@@ -75,8 +78,9 @@ public interface RoutingRequestTestHelper extends ByteDataTranslator, FutureProd
final int protocolTableId,
final int secondaryTableId) {
// verifiaction of special request that has only destination address and flag
- return desiredResult(add, ipv6, 0, destinationAddress, destinationPrefixLength, null, 0, 0, protocolTableId, secondaryTableId, 0, 0,
- isDrop, isReceive, isUnreach, isProhibit);
+ return desiredResult(add, ipv6, 0, destinationAddress, destinationPrefixLength, null, 0, 0,
+ protocolTableId, secondaryTableId, 0, 0, isDrop,
+ isReceive, isUnreach, isProhibit);
}
default IpAddDelRoute desiredResult(final int add, final int ipv6, final int isMultipath,
@@ -136,34 +140,33 @@ public interface RoutingRequestTestHelper extends ByteDataTranslator, FutureProd
when(api.ipAddDelRoute(any())).thenReturn(future(new IpAddDelRouteReply()));
}
- default Route getIpv4RouteWithId(final StaticRoutes staticRoutes, final long id) {
+ default Route getIpv4RouteWithId(final StaticRoutes staticRoutes, final Ipv4Prefix id) {
return staticRoutes.getAugmentation(StaticRoutes1.class)
.getIpv4()
.getRoute()
.stream()
- .filter(route -> route.getId() == id)
+ .filter(route -> route.getDestinationPrefix().getValue().equals(id.getValue()))
.collect(RWUtils.singleItemCollector());
}
default NextHop getHopWithId(
final Route route, final int id) {
- return 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.class
- .cast(route.getNextHopOptions())
- .getNextHopList()
- .getNextHop()
+ return NextHopList.class
+ .cast(route.getNextHop().getNextHopOptions())
+ .getNextHopList().getNextHop()
.stream()
- .filter(nextHop -> nextHop.getKey().getId().intValue() == id)
+ .filter(nextHop -> Integer.valueOf(nextHop.getKey().getIndex()) == id)
.collect(RWUtils.singleItemCollector());
}
- default 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 getIpv6RouteWithId(
- final StaticRoutes staticRoutes, final long id) {
+ default 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 getIpv6RouteWithId(
+ final StaticRoutes staticRoutes, final Ipv6Prefix id) {
return staticRoutes.getAugmentation(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.StaticRoutes1.class)
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.StaticRoutes1.class)
.getIpv6()
.getRoute()
.stream()
- .filter(route -> route.getId() == id)
+ .filter(route -> route.getDestinationPrefix().getValue().equals(id.getValue()))
.collect(RWUtils.singleItemCollector());
}
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/helpers/SchemaContextTestHelper.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/helpers/SchemaContextTestHelper.java
index 7ae84854d..9a0073580 100644
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/helpers/SchemaContextTestHelper.java
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/helpers/SchemaContextTestHelper.java
@@ -26,26 +26,33 @@ public interface SchemaContextTestHelper extends InjectablesProcessor {
@SchemaContextProvider
default ModuleInfoBackedContext getSchemaContext() {
return provideSchemaContextFor(ImmutableSet.of(
+ // Default interfaces
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.$YangModuleInfoImpl
+ .getInstance(),
// Default ietf-ip
org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ip.rev140616.$YangModuleInfoImpl
- .getInstance(),
+ .getInstance(),
// Default ietf-routing
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.$YangModuleInfoImpl
- .getInstance(),
- // Ipv4 augmentations
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev170917.$YangModuleInfoImpl
- .getInstance(),
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.$YangModuleInfoImpl
+ .getInstance(),
// Ipv4 augmentations
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev170917.$YangModuleInfoImpl
- .getInstance(),
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv4.unicast.routing.rev180313.$YangModuleInfoImpl
+ .getInstance(),
+ // Ipv6 augmentations
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.$YangModuleInfoImpl
+ .getInstance(),
// Vpp routing
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev170917.$YangModuleInfoImpl
- .getInstance(),
- // Vpp routing RA
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.ra.rev170502.$YangModuleInfoImpl
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.rev180319.$YangModuleInfoImpl
+ .getInstance(),
+ // Vpp IPv4 augmentations
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv4.unicast.routing.rev180319.$YangModuleInfoImpl
.getInstance(),
- // Table lookup
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.table.lookup.rev170917.$YangModuleInfoImpl.getInstance()
+ // Vpp IPv6 augmentations
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.ipv6.unicast.routing.rev180319.$YangModuleInfoImpl
+ .getInstance(),
+ // Vpp routing RA
+ org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.ra.rev180319.$YangModuleInfoImpl
+ .getInstance()
));
}
}
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/read/RoutingProtocolCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/read/ControlPlaneProtocolCustomizerTest.java
index 1d0057cf2..43ec73bd1 100644
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/read/RoutingProtocolCustomizerTest.java
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/read/ControlPlaneProtocolCustomizerTest.java
@@ -41,16 +41,16 @@ import java.util.Arrays;
import java.util.List;
import org.junit.Test;
import org.mockito.Mock;
-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.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.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.ietf.routing.rev180313.Static;
+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.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.yangtools.yang.binding.InstanceIdentifier;
-public class RoutingProtocolCustomizerTest
- extends ListReaderCustomizerTest<RoutingProtocol, RoutingProtocolKey, RoutingProtocolBuilder>
+public class ControlPlaneProtocolCustomizerTest
+ extends ListReaderCustomizerTest<ControlPlaneProtocol, ControlPlaneProtocolKey, ControlPlaneProtocolBuilder>
implements ByteDataTranslator {
private static final String VPP_PROTOCOL_PREFIX = "vpp-protocol";
@@ -65,8 +65,7 @@ public class RoutingProtocolCustomizerTest
private NamingContext routingProtocolContext;
- public RoutingProtocolCustomizerTest() {
- super(RoutingProtocol.class, RoutingProtocolsBuilder.class);
+ public ControlPlaneProtocolCustomizerTest() { super(ControlPlaneProtocol.class, ControlPlaneProtocolsBuilder.class);
}
@Override
@@ -93,20 +92,22 @@ public class RoutingProtocolCustomizerTest
@Test
public void getAllIds() throws Exception {
- final List<RoutingProtocolKey> keys =
- getCustomizer().getAllIds(InstanceIdentifier.create(RoutingProtocol.class), ctx);
+ final List<ControlPlaneProtocolKey> keys =
+ getCustomizer().getAllIds(InstanceIdentifier.create(ControlPlaneProtocol.class), ctx);
assertThat(keys, hasSize(3));
- assertThat(keys, hasItems(new RoutingProtocolKey(ROUTE_PROTOCOL_NAME), new RoutingProtocolKey("tst-protocol-2"),
- new RoutingProtocolKey("tst-protocol-3")));
+ assertThat(keys, hasItems(new ControlPlaneProtocolKey(ROUTE_PROTOCOL_NAME, Static.class),
+ new ControlPlaneProtocolKey("tst-protocol-2", Static.class),
+ new ControlPlaneProtocolKey("tst-protocol-3", Static.class)));
}
@Test
public void readCurrentAttributes() throws Exception {
- final InstanceIdentifier<RoutingProtocol> identifier = InstanceIdentifier.create(RoutingProtocols.class)
- .child(RoutingProtocol.class, new RoutingProtocolKey(ROUTE_PROTOCOL_NAME));
+ final InstanceIdentifier<ControlPlaneProtocol> identifier =
+ InstanceIdentifier.create(ControlPlaneProtocols.class)
+ .child(ControlPlaneProtocol.class, new ControlPlaneProtocolKey(ROUTE_PROTOCOL_NAME, Static.class));
- final RoutingProtocolBuilder builder = new RoutingProtocolBuilder();
+ final ControlPlaneProtocolBuilder builder = new ControlPlaneProtocolBuilder();
getCustomizer().readCurrentAttributes(identifier, builder, ctx);
assertEquals(ROUTE_PROTOCOL_NAME, builder.getName());
@@ -115,8 +116,8 @@ public class RoutingProtocolCustomizerTest
}
@Override
- protected ReaderCustomizer<RoutingProtocol, RoutingProtocolBuilder> initCustomizer() {
- return new RoutingProtocolCustomizer(routingProtocolContext, ipv4RoutesDumpManager, ipv6RoutesDumpManager);
+ protected ReaderCustomizer<ControlPlaneProtocol, ControlPlaneProtocolBuilder> initCustomizer() {
+ return new ControlPlaneProtocolCustomizer(routingProtocolContext, ipv4RoutesDumpManager, ipv6RoutesDumpManager);
}
private Ip6FibDetailsReplyDump replyDumpIpv6() {
@@ -222,4 +223,4 @@ public class RoutingProtocolCustomizerTest
replyDump.ipFibDetails = Arrays.asList(detail1, detail2, detail3);
return replyDump;
}
-} \ No newline at end of file
+}
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/read/Ipv4RouteCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/read/Ipv4RouteCustomizerTest.java
index a0c890b9b..5e319e370 100644
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/read/Ipv4RouteCustomizerTest.java
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/read/Ipv4RouteCustomizerTest.java
@@ -16,13 +16,24 @@
package io.fd.hc2vpp.routing.read;
+import static io.fd.hc2vpp.routing.helpers.RoutingRequestTestHelper.ROUTE_PROTOCOL_NAME;
+import static org.hamcrest.MatcherAssert.assertThat;
+import static org.hamcrest.Matchers.hasItems;
+import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Mockito.when;
+import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.SpecialNextHop.SpecialNextHopEnum.Receive;
+
import io.fd.hc2vpp.common.test.read.ListReaderCustomizerTest;
import io.fd.hc2vpp.common.translate.util.MultiNamingContext;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.hc2vpp.routing.Ipv4RouteData;
import io.fd.hc2vpp.routing.RoutingConfiguration;
+import io.fd.hc2vpp.routing.helpers.ClassifyTableTestHelper;
import io.fd.hc2vpp.routing.naming.Ipv4RouteNamesFactory;
import io.fd.hc2vpp.routing.trait.RouteMapper;
+import io.fd.hc2vpp.vpp.classifier.context.VppClassifierContextManager;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
import io.fd.honeycomb.translate.util.read.cache.DumpCacheManager;
@@ -30,49 +41,46 @@ import io.fd.honeycomb.translate.util.read.cache.EntityDumpExecutor;
import io.fd.vpp.jvpp.core.dto.IpFibDetails;
import io.fd.vpp.jvpp.core.dto.IpFibDetailsReplyDump;
import io.fd.vpp.jvpp.core.types.FibPath;
+import java.util.Arrays;
+import java.util.List;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.junit.Test;
import org.mockito.Mock;
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.StaticRoutes2;
-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.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.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.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.SimpleNextHop;
-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.SpecialNextHop;
-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.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.next.hop.list.next.hop.list.NextHopKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.SpecialNextHopGrouping;
-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.routing.protocols.RoutingProtocol;
-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.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.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.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.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.routing.rev180313.Static;
+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.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.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.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.next.hop.list.NextHopKey;
+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.ControlPlaneProtocolKey;
+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.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.yangtools.yang.binding.InstanceIdentifier;
-import java.util.Arrays;
-import java.util.List;
-
-import static io.fd.hc2vpp.routing.helpers.RoutingRequestTestHelper.ROUTE_PROTOCOL_NAME;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.hasItems;
-import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.when;
-
public class Ipv4RouteCustomizerTest extends ListReaderCustomizerTest<Route, RouteKey, RouteBuilder>
- implements RouteMapper {
+ implements RouteMapper, ClassifyTableTestHelper {
- private final InstanceIdentifier<Ipv4> ipv4InstanceIdentifier = InstanceIdentifier.create(RoutingProtocols.class)
- .child(RoutingProtocol.class, new RoutingProtocolKey(ROUTE_PROTOCOL_NAME))
+ private final InstanceIdentifier<Ipv4> ipv4InstanceIdentifier =
+ InstanceIdentifier.create(ControlPlaneProtocols.class)
+ .child(ControlPlaneProtocol.class, new ControlPlaneProtocolKey(ROUTE_PROTOCOL_NAME, Static.class))
.child(StaticRoutes.class)
- .augmentation(StaticRoutes2.class)
+ .augmentation(StaticRoutes1.class)
.child(Ipv4.class);
private DumpCacheManager<IpFibDetailsReplyDump, Void> manager;
@Mock
@@ -81,12 +89,18 @@ public class Ipv4RouteCustomizerTest extends ListReaderCustomizerTest<Route, Rou
private MultiNamingContext routeHopContext;
@Mock
private EntityDumpExecutor<IpFibDetailsReplyDump, Void> executor;
+ @Mock
+ private VppClassifierContextManager classifyManager;
+
private NamingContext interfaceContext = new NamingContext("ifaces", "interface-context");
private NamingContext routesContext = new NamingContext("routes", "route-context");
private NamingContext routingProtocolContext = new NamingContext("routing-protocol", "routing-protocol-context");
- private InstanceIdentifier<Route> routeIdSpecialHop = ipv4InstanceIdentifier.child(Route.class, new RouteKey(1L));
- private InstanceIdentifier<Route> routeIdSimpleHop = ipv4InstanceIdentifier.child(Route.class, new RouteKey(2L));
- private InstanceIdentifier<Route> routeIdListHop = ipv4InstanceIdentifier.child(Route.class, new RouteKey(3L));
+ private InstanceIdentifier<Route> routeIdSpecialHop =
+ ipv4InstanceIdentifier.child(Route.class, new RouteKey(new Ipv4Prefix("192.168.2.1/24")));
+ private InstanceIdentifier<Route> routeIdSimpleHop =
+ ipv4InstanceIdentifier.child(Route.class, new RouteKey(new Ipv4Prefix("192.168.2.2/22")));
+ private InstanceIdentifier<Route> routeIdListHop =
+ ipv4InstanceIdentifier.child(Route.class, new RouteKey(new Ipv4Prefix("192.168.2.2/16")));
public Ipv4RouteCustomizerTest() {
@@ -118,6 +132,9 @@ public class Ipv4RouteCustomizerTest extends ListReaderCustomizerTest<Route, Rou
String listRouteName = factory.uniqueRouteName(listRoute, mappingContext);
defineMapping(mappingContext, listRouteName, 3, "route-context");
+ addMapping(classifyManager, CLASSIFY_TABLE_NAME, CLASSIFY_TABLE_INDEX, mappingContext);
+
+
when(routeHopContext.getChildIndex(listRouteName, factory.uniqueRouteHopName(listRoute.path[0], mappingContext),
mappingContext)).thenReturn(0);
when(routeHopContext.getChildIndex(listRouteName, factory.uniqueRouteHopName(listRoute.path[1], mappingContext),
@@ -181,7 +198,9 @@ public class Ipv4RouteCustomizerTest extends ListReaderCustomizerTest<Route, Rou
final List<RouteKey> keys = getCustomizer().getAllIds(routeIdSpecialHop, ctx);
assertThat(keys, hasSize(3));
- assertThat(keys, hasItems(new RouteKey(1L), new RouteKey(2L), new RouteKey(3L)));
+ assertThat(keys, hasItems(new RouteKey(new Ipv4Prefix("192.168.2.1/24")),
+ new RouteKey(new Ipv4Prefix("192.168.2.2/22")),
+ new RouteKey(new Ipv4Prefix("192.168.2.2/16"))));
}
@Test
@@ -189,15 +208,13 @@ public class Ipv4RouteCustomizerTest extends ListReaderCustomizerTest<Route, Rou
final RouteBuilder builder = new RouteBuilder();
getCustomizer().readCurrentAttributes(routeIdSpecialHop, builder, ctx);
- assertEquals(1, builder.getId().intValue());
- assertEquals(1, builder.getKey().getId().intValue());
assertEquals(new Ipv4Prefix("192.168.2.1/24"), builder.getDestinationPrefix());
- NextHopOptions hopOptions = builder.getNextHopOptions();
+ NextHopOptions hopOptions = builder.getNextHop().getNextHopOptions();
assertTrue(hopOptions instanceof SpecialNextHop);
SpecialNextHop hop = SpecialNextHop.class.cast(hopOptions);
- assertEquals(SpecialNextHopGrouping.SpecialNextHop.Receive, hop.getSpecialNextHop());
+ assertEquals(Receive, hop.getSpecialNextHopEnum());
}
@Test
@@ -205,15 +222,13 @@ public class Ipv4RouteCustomizerTest extends ListReaderCustomizerTest<Route, Rou
final RouteBuilder builder = new RouteBuilder();
getCustomizer().readCurrentAttributes(routeIdSimpleHop, builder, ctx);
- assertEquals(2, builder.getId().intValue());
- assertEquals(2, builder.getKey().getId().intValue());
assertEquals(new Ipv4Prefix("192.168.2.2/22"), builder.getDestinationPrefix());
- NextHopOptions hopOptions = builder.getNextHopOptions();
+ NextHopOptions hopOptions = builder.getNextHop().getNextHopOptions();
assertTrue(hopOptions instanceof SimpleNextHop);
SimpleNextHop hop = SimpleNextHop.class.cast(hopOptions);
- assertEquals("192.168.2.1", hop.getNextHop().getValue());
+ assertEquals("192.168.2.1", hop.getAugmentation(SimpleNextHop1.class).getNextHopAddress().getValue());
assertEquals("iface-1", hop.getOutgoingInterface());
}
@@ -223,11 +238,9 @@ public class Ipv4RouteCustomizerTest extends ListReaderCustomizerTest<Route, Rou
final RouteBuilder builder = new RouteBuilder();
getCustomizer().readCurrentAttributes(routeIdListHop, builder, ctx);
- assertEquals(3, builder.getId().intValue());
- assertEquals(3, builder.getKey().getId().intValue());
assertEquals(new Ipv4Prefix("192.168.2.2/16"), builder.getDestinationPrefix());
- NextHopOptions hopOptions = builder.getNextHopOptions();
+ NextHopOptions hopOptions = builder.getNextHop().getNextHopOptions();
assertTrue(hopOptions instanceof NextHopList);
NextHopList hop = NextHopList.class.cast(hopOptions);
@@ -235,32 +248,34 @@ public class Ipv4RouteCustomizerTest extends ListReaderCustomizerTest<Route, Rou
assertThat(hops, hasSize(2));
- assertTrue(areEqual(hops.get(0), desiredHop(0L, "192.168.2.1", 1, "iface-1")));
- assertTrue(areEqual(hops.get(1), desiredHop(1L, "192.168.2.2", 2, "iface-1")));
+ assertTrue(areEqual(hops.get(0), desiredHop("0", "192.168.2.1", 1, "iface-1")));
+ assertTrue(areEqual(hops.get(1), desiredHop("1", "192.168.2.2", 2, "iface-1")));
}
private boolean areEqual(final NextHop first, final NextHop second) {
return new EqualsBuilder()
- .append(true, first.getAddress().getValue().equals(second.getAddress().getValue()))
- .append(true, first.getId().equals(second.getId()))
+ .append(true, first.getAugmentation(NextHop1.class).getNextHopAddress().getValue()
+ .equals(second.getAugmentation(NextHop1.class).getNextHopAddress().getValue()))
+ .append(true, first.getIndex().equals(second.getIndex()))
.append(true, first.getKey().equals(second.getKey()))
.append(true, first.getOutgoingInterface().equals(second.getOutgoingInterface()))
.isEquals();
}
- private NextHop desiredHop(final long id, final String address, final int weight, final String iface) {
+ private NextHop desiredHop(final String id, final String address, final int weight, final String iface) {
return new NextHopBuilder()
- .setAddress(new Ipv4Address(address))
- .setWeight((short) weight)
- .setOutgoingInterface(iface)
- .setId(id)
- .setKey(new NextHopKey(id))
- .build();
+ .setOutgoingInterface(iface)
+ .setIndex(id)
+ .setKey(new NextHopKey(id))
+ .addAugmentation(VppIpv4NextHopAugmentation.class,
+ new VppIpv4NextHopAugmentationBuilder().setWeight((short) weight).build())
+ .addAugmentation(NextHop1.class, new NextHop1Builder().setNextHopAddress(new Ipv4Address(address)).build())
+ .build();
}
@Override
protected ReaderCustomizer<Route, RouteBuilder> initCustomizer() {
return new Ipv4RouteCustomizer(manager, configuration, routeHopContext, interfaceContext,
- routesContext, routingProtocolContext);
+ routesContext, routingProtocolContext);
}
} \ No newline at end of file
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/read/Ipv6RouteCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/read/Ipv6RouteCustomizerTest.java
index 3626056b8..503c01914 100644
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/read/Ipv6RouteCustomizerTest.java
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/read/Ipv6RouteCustomizerTest.java
@@ -23,14 +23,17 @@ import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
+import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.SpecialNextHop.SpecialNextHopEnum.Receive;
import io.fd.hc2vpp.common.test.read.ListReaderCustomizerTest;
import io.fd.hc2vpp.common.translate.util.MultiNamingContext;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.hc2vpp.routing.Ipv6RouteData;
import io.fd.hc2vpp.routing.RoutingConfiguration;
+import io.fd.hc2vpp.routing.helpers.ClassifyTableTestHelper;
import io.fd.hc2vpp.routing.naming.Ipv6RouteNamesFactory;
import io.fd.hc2vpp.routing.trait.RouteMapper;
+import io.fd.hc2vpp.vpp.classifier.context.VppClassifierContextManager;
import io.fd.honeycomb.translate.ModificationCache;
import io.fd.honeycomb.translate.read.ReadFailedException;
import io.fd.honeycomb.translate.spi.read.ReaderCustomizer;
@@ -45,28 +48,34 @@ import org.apache.commons.lang3.builder.EqualsBuilder;
import org.junit.Test;
import org.mockito.Mock;
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.ipv6.unicast.routing.rev170917.StaticRoutes2;
-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.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.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.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.SimpleNextHop;
-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.SpecialNextHop;
-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.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.next.hop.list.next.hop.list.NextHopKey;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.SpecialNextHopGrouping;
-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.routing.protocols.RoutingProtocol;
-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.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.inet.types.rev130715.Ipv6Prefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.StaticRoutes1;
+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.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.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.routing.rev180313.Static;
+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.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.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.ietf.routing.rev180313.next.hop.content.next.hop.options.next.hop.list.next.hop.list.NextHopKey;
+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.ControlPlaneProtocolKey;
+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.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.yangtools.yang.binding.InstanceIdentifier;
public class Ipv6RouteCustomizerTest extends ListReaderCustomizerTest<Route, RouteKey, RouteBuilder>
- implements RouteMapper {
+ implements RouteMapper, ClassifyTableTestHelper {
private static final String ROUTING_PROTOCOL_PREFIX = "route-p-";
private DumpCacheManager<Ip6FibDetailsReplyDump, Void> manager;
@@ -83,6 +92,9 @@ public class Ipv6RouteCustomizerTest extends ListReaderCustomizerTest<Route, Rou
@Mock
private ModificationCache cache;
+ @Mock
+ private VppClassifierContextManager classifyManager;
+
private NamingContext interfaceContext;
private NamingContext routesContext;
private NamingContext routingProtocolContext;
@@ -107,15 +119,18 @@ public class Ipv6RouteCustomizerTest extends ListReaderCustomizerTest<Route, Rou
routesContext = new NamingContext("routes", "route-context");
routingProtocolContext = new NamingContext("routing-protocol", "routing-protocol-context");
- final InstanceIdentifier<Ipv6> ipv6InstanceIdentifier = InstanceIdentifier.create(RoutingProtocols.class)
- .child(RoutingProtocol.class, new RoutingProtocolKey(ROUTE_PROTOCOL_NAME))
+ final InstanceIdentifier<Ipv6> ipv6InstanceIdentifier = InstanceIdentifier.create(ControlPlaneProtocols.class)
+ .child(ControlPlaneProtocol.class, new ControlPlaneProtocolKey(ROUTE_PROTOCOL_NAME, Static.class))
.child(StaticRoutes.class)
- .augmentation(StaticRoutes2.class)
+ .augmentation(StaticRoutes1.class)
.child(Ipv6.class);
- routeIdSpecialHop = ipv6InstanceIdentifier.child(Route.class, new RouteKey(1L));
- routeIdSimpleHop = ipv6InstanceIdentifier.child(Route.class, new RouteKey(2L));
- routeIdListHop = ipv6InstanceIdentifier.child(Route.class, new RouteKey(3L));
+ routeIdSpecialHop =
+ ipv6InstanceIdentifier.child(Route.class, new RouteKey(new Ipv6Prefix("2001:db8:a0b:12f0::1/24")));
+ routeIdSimpleHop =
+ ipv6InstanceIdentifier.child(Route.class, new RouteKey(new Ipv6Prefix("2001:db8:a0b:12f0::2/22")));
+ routeIdListHop =
+ ipv6InstanceIdentifier.child(Route.class, new RouteKey(new Ipv6Prefix("2001:db8:a0b:12f0::2/16")));
factory = new Ipv6RouteNamesFactory(interfaceContext, routingProtocolContext);
@@ -136,6 +151,8 @@ public class Ipv6RouteCustomizerTest extends ListReaderCustomizerTest<Route, Rou
String listRouteName = factory.uniqueRouteName(listRoute, mappingContext);
defineMapping(mappingContext, listRouteName, 3, "route-context");
+ addMapping(classifyManager, CLASSIFY_TABLE_NAME, CLASSIFY_TABLE_INDEX, mappingContext);
+
when(routeHopContext.getChildIndex(listRouteName, factory.uniqueRouteHopName(listRoute.path[0], mappingContext),
mappingContext))
.thenReturn(0);
@@ -201,7 +218,9 @@ public class Ipv6RouteCustomizerTest extends ListReaderCustomizerTest<Route, Rou
final List<RouteKey> keys = getCustomizer().getAllIds(routeIdSpecialHop, ctx);
assertThat(keys, hasSize(3));
- assertThat(keys, hasItems(new RouteKey(1L), new RouteKey(2L), new RouteKey(3L)));
+ assertThat(keys, hasItems(new RouteKey(new Ipv6Prefix("2001:db8:a0b:12f0::1/24")),
+ new RouteKey(new Ipv6Prefix("2001:db8:a0b:12f0::2/22")),
+ new RouteKey(new Ipv6Prefix("2001:db8:a0b:12f0::2/16"))));
}
@Test
@@ -209,15 +228,14 @@ public class Ipv6RouteCustomizerTest extends ListReaderCustomizerTest<Route, Rou
final RouteBuilder builder = new RouteBuilder();
getCustomizer().readCurrentAttributes(routeIdSpecialHop, builder, ctx);
- assertEquals(1, builder.getId().intValue());
- assertEquals(1, builder.getKey().getId().intValue());
+ assertEquals(new Ipv6Prefix("2001:db8:a0b:12f0::1/24"), builder.getDestinationPrefix());
assertEquals("2001:db8:a0b:12f0::1/24", builder.getDestinationPrefix().getValue());
- NextHopOptions hopOptions = builder.getNextHopOptions();
+ NextHopOptions hopOptions = builder.getNextHop().getNextHopOptions();
assertTrue(hopOptions instanceof SpecialNextHop);
SpecialNextHop hop = SpecialNextHop.class.cast(hopOptions);
- assertEquals(SpecialNextHopGrouping.SpecialNextHop.Receive, hop.getSpecialNextHop());
+ assertEquals(Receive, hop.getSpecialNextHopEnum());
}
@Test
@@ -225,15 +243,15 @@ public class Ipv6RouteCustomizerTest extends ListReaderCustomizerTest<Route, Rou
final RouteBuilder builder = new RouteBuilder();
getCustomizer().readCurrentAttributes(routeIdSimpleHop, builder, ctx);
- assertEquals(2, builder.getId().intValue());
- assertEquals(2, builder.getKey().getId().intValue());
+ assertEquals(new Ipv6Prefix("2001:db8:a0b:12f0::2/22"), builder.getDestinationPrefix());
assertEquals("2001:db8:a0b:12f0::2/22", builder.getDestinationPrefix().getValue());
- NextHopOptions hopOptions = builder.getNextHopOptions();
+ NextHopOptions hopOptions = builder.getNextHop().getNextHopOptions();
assertTrue(hopOptions instanceof SimpleNextHop);
SimpleNextHop hop = SimpleNextHop.class.cast(hopOptions);
- assertEquals("2001:db8:a0b:12f0::1", hop.getNextHop().getValue());
+ assertEquals("2001:db8:a0b:12f0::1", hop.getAugmentation(SimpleNextHop1.class)
+ .getNextHopAddress().getValue());
assertEquals("iface-1", hop.getOutgoingInterface());
}
@@ -244,11 +262,10 @@ public class Ipv6RouteCustomizerTest extends ListReaderCustomizerTest<Route, Rou
final RouteBuilder builder = new RouteBuilder();
getCustomizer().readCurrentAttributes(routeIdListHop, builder, ctx);
- assertEquals(3, builder.getId().intValue());
- assertEquals(3, builder.getKey().getId().intValue());
+ assertEquals(new Ipv6Prefix("2001:db8:a0b:12f0::2/16"), builder.getDestinationPrefix());
assertEquals("2001:db8:a0b:12f0::2/16", builder.getDestinationPrefix().getValue());
- NextHopOptions hopOptions = builder.getNextHopOptions();
+ NextHopOptions hopOptions = builder.getNextHop().getNextHopOptions();
assertTrue(hopOptions instanceof NextHopList);
NextHopList hop = NextHopList.class.cast(hopOptions);
@@ -256,32 +273,34 @@ public class Ipv6RouteCustomizerTest extends ListReaderCustomizerTest<Route, Rou
assertThat(hops, hasSize(2));
- assertTrue(areEqual(hops.get(0), desiredHop(0L, "2001:db8:a0b:12f0::1", 1, "iface-1")));
- assertTrue(areEqual(hops.get(1), desiredHop(1L, "2001:db8:a0b:12f0::2", 2, "iface-1")));
+ assertTrue(areEqual(hops.get(0), desiredHop("0", "2001:db8:a0b:12f0::1", 1, "iface-1")));
+ assertTrue(areEqual(hops.get(1), desiredHop("1", "2001:db8:a0b:12f0::2", 2, "iface-1")));
}
private boolean areEqual(final NextHop first, final NextHop second) {
return new EqualsBuilder()
- .append(true, first.getAddress().getValue().equals(second.getAddress().getValue()))
- .append(true, first.getId().equals(second.getId()))
+ .append(true, first.getAugmentation(NextHop1.class).getNextHopAddress().getValue()
+ .equals(second.getAugmentation(NextHop1.class).getNextHopAddress().getValue()))
+ .append(true, first.getIndex().equals(second.getIndex()))
.append(true, first.getKey().equals(second.getKey()))
.append(true, first.getOutgoingInterface().equals(second.getOutgoingInterface()))
.isEquals();
}
- private NextHop desiredHop(final long id, final String address, final int weight, final String iface) {
+ private NextHop desiredHop(final String id, final String address, final int weight, final String iface) {
return new NextHopBuilder()
- .setAddress(new Ipv6Address(address))
- .setWeight((short) weight)
- .setOutgoingInterface(iface)
- .setId(id)
- .setKey(new NextHopKey(id))
- .build();
+ .setOutgoingInterface(iface)
+ .setIndex(id)
+ .setKey(new NextHopKey(id))
+ .addAugmentation(NextHop1.class, new NextHop1Builder().setNextHopAddress(new Ipv6Address(address)).build())
+ .addAugmentation(VppIpv6NextHopAugmentation.class,
+ new VppIpv6NextHopAugmentationBuilder().setWeight((short) weight).build())
+ .build();
}
@Override
protected ReaderCustomizer<Route, RouteBuilder> initCustomizer() {
return new Ipv6RouteCustomizer(manager, configuration, routeHopContext,
- interfaceContext, routesContext, routingProtocolContext);
+ interfaceContext, routesContext, routingProtocolContext);
}
} \ No newline at end of file
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/read/RoutingStateCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/read/RoutingStateCustomizerTest.java
deleted file mode 100644
index 7bece735b..000000000
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/read/RoutingStateCustomizerTest.java
+++ /dev/null
@@ -1,64 +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 static org.junit.Assert.assertEquals;
-
-import io.fd.hc2vpp.routing.helpers.SchemaContextTestHelper;
-import io.fd.honeycomb.test.tools.HoneycombTestRunner;
-import io.fd.honeycomb.test.tools.annotations.InjectTestData;
-import io.fd.honeycomb.translate.read.ReadContext;
-import io.fd.honeycomb.translate.spi.read.Initialized;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-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.RoutingState;
-import org.opendaylight.yangtools.yang.binding.DataObject;
-import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-
-@RunWith(HoneycombTestRunner.class)
-public class RoutingStateCustomizerTest implements SchemaContextTestHelper {
-
- @InjectTestData(resourcePath = "/init/config-data.json")
- private Routing config;
-
- @InjectTestData(resourcePath = "/init/state-data.json")
- private RoutingState state;
-
- @Mock
- private ReadContext readContext;
-
- @Before
- public void init() {
- MockitoAnnotations.initMocks(this);
- }
-
- @Test
- public void testInit() {
- final InstanceIdentifier<RoutingState> identifier = InstanceIdentifier.create(RoutingState.class);
- final Initialized<? extends DataObject> initilized =
- new RoutingStateCustomizer().init(identifier, state, readContext);
-
- final Routing initializedRouting = Routing.class.cast(initilized.getData());
-
- assertEquals(config, initializedRouting);
- }
-}
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/ControlPlaneProtocolCustomizerTest.java
index c283ac726..fa25520ca 100644
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingProtocolCustomizerTest.java
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/ControlPlaneProtocolCustomizerTest.java
@@ -26,29 +26,29 @@ import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
import org.junit.Before;
import org.junit.Test;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.Direct;
-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.RoutingProtocolBuilder;
-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.VniReference;
-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.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.Direct;
+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.ControlPlaneProtocolBuilder;
+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.yang.binding.InstanceIdentifier;
-public class RoutingProtocolCustomizerTest extends WriterCustomizerTest {
+public class ControlPlaneProtocolCustomizerTest extends WriterCustomizerTest {
- private InstanceIdentifier<RoutingProtocol> validId;
- private RoutingProtocol validData;
- private RoutingProtocol validData2;
- private RoutingProtocol invalidData;
- private RoutingProtocolCustomizer customizer;
+ private InstanceIdentifier<ControlPlaneProtocol> validId;
+ private ControlPlaneProtocol validData;
+ private ControlPlaneProtocol validData2;
+ private ControlPlaneProtocol invalidData;
+ private ControlPlaneProtocolCustomizer customizer;
private NamingContext routingProtocolContext;
@Before
public void init() {
- validId = InstanceIdentifier.create(RoutingProtocol.class);
- validData = new RoutingProtocolBuilder()
+ validId = InstanceIdentifier.create(ControlPlaneProtocol.class);
+ validData = new ControlPlaneProtocolBuilder()
.setName(ROUTE_PROTOCOL_NAME)
.setType(Static.class)
.addAugmentation(RoutingProtocolVppAttr.class, new RoutingProtocolVppAttrBuilder()
@@ -58,7 +58,7 @@ public class RoutingProtocolCustomizerTest extends WriterCustomizerTest {
.build())
.build();
- validData2= new RoutingProtocolBuilder()
+ validData2= new ControlPlaneProtocolBuilder()
.setName(ROUTE_PROTOCOL_NAME_2)
.setType(Static.class)
.addAugmentation(RoutingProtocolVppAttr.class, new RoutingProtocolVppAttrBuilder()
@@ -68,12 +68,12 @@ public class RoutingProtocolCustomizerTest extends WriterCustomizerTest {
.build())
.build();
- invalidData = new RoutingProtocolBuilder()
+ invalidData = new ControlPlaneProtocolBuilder()
.setType(Direct.class)
.build();
routingProtocolContext = new NamingContext("routing-protocol", "routing-protocol-context");
- customizer = new RoutingProtocolCustomizer(routingProtocolContext);
+ customizer = new ControlPlaneProtocolCustomizer(routingProtocolContext);
}
@Test
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv4RouteCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv4RouteCustomizerTest.java
index b97658669..41a1ae6d1 100644
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv4RouteCustomizerTest.java
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv4RouteCustomizerTest.java
@@ -16,6 +16,14 @@
package io.fd.hc2vpp.routing.write;
+import static io.fd.hc2vpp.routing.Ipv4RouteData.FIRST_ADDRESS_AS_ARRAY;
+import static io.fd.hc2vpp.routing.Ipv4RouteData.SECOND_ADDRESS_AS_ARRAY;
+import static io.fd.hc2vpp.routing.helpers.InterfaceTestHelper.INTERFACE_INDEX;
+import static io.fd.hc2vpp.routing.helpers.InterfaceTestHelper.INTERFACE_NAME;
+import static org.junit.Assert.assertTrue;
+import static org.junit.Assert.fail;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
import com.google.common.collect.ImmutableList;
import io.fd.hc2vpp.common.test.write.WriterCustomizerTest;
@@ -36,32 +44,21 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
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.StaticRoutes1;
-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.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.next.hop.options.TableLookupBuilder;
-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.RoutingProtocols;
-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.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.rev170917.VniReference;
-
-
-
+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.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.ipv4.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv4.route.NextHopBuilder;
+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.next.hop.content.next.hop.options.TableLookupCaseBuilder;
+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.ControlPlaneProtocolKey;
+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.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.types.rev180406.VniReference;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import static io.fd.hc2vpp.routing.Ipv4RouteData.FIRST_ADDRESS_AS_ARRAY;
-import static io.fd.hc2vpp.routing.Ipv4RouteData.SECOND_ADDRESS_AS_ARRAY;
-import static io.fd.hc2vpp.routing.helpers.InterfaceTestHelper.INTERFACE_INDEX;
-import static io.fd.hc2vpp.routing.helpers.InterfaceTestHelper.INTERFACE_NAME;
-import static org.junit.Assert.assertTrue;
-import static org.junit.Assert.fail;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-
@RunWith(HoneycombTestRunner.class)
public class Ipv4RouteCustomizerTest extends WriterCustomizerTest
implements ClassifyTableTestHelper, RoutingRequestTestHelper, SchemaContextTestHelper {
@@ -89,8 +86,8 @@ public class Ipv4RouteCustomizerTest extends WriterCustomizerTest
new NamingContext("route", "route-context"),
routingProtocolContext, routeHopContext, classifyManager);
- validId = InstanceIdentifier.create(RoutingProtocols.class)
- .child(RoutingProtocol.class, new RoutingProtocolKey(ROUTE_PROTOCOL_NAME))
+ validId = InstanceIdentifier.create(ControlPlaneProtocols.class)
+ .child(ControlPlaneProtocol.class, new ControlPlaneProtocolKey(ROUTE_PROTOCOL_NAME, Static.class))
.child(StaticRoutes.class)
.augmentation(StaticRoutes1.class)
.child(Ipv4.class)
@@ -108,7 +105,7 @@ public class Ipv4RouteCustomizerTest extends WriterCustomizerTest
public void testWriteSingleHop(
@InjectTestData(resourcePath = "/ipv4/simplehop/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route)
throws WriteFailedException {
- final Route route1 = getIpv4RouteWithId(route, 1L);
+ final Route route1 = getIpv4RouteWithId(route, new Ipv4Prefix("192.168.2.1/24"));
noMappingDefined(mappingContext, namesFactory.uniqueRouteName(ROUTE_PROTOCOL_NAME, route1), "route-context");
customizer.writeCurrentAttributes(validId, route1, writeContext);
@@ -123,13 +120,12 @@ public class Ipv4RouteCustomizerTest extends WriterCustomizerTest
@Test
public void testWriteTableLookup() throws WriteFailedException {
final Route route = new RouteBuilder()
- .setKey(new RouteKey(2L))
+ .setKey(new RouteKey(new Ipv4Prefix("192.168.2.1/24")))
.setDestinationPrefix(new Ipv4Prefix("192.168.2.1/24"))
- .setNextHopOptions(new TableLookupBuilder()
- .setTableLookupParams(new TableLookupParamsBuilder()
- .setSecondaryVrf(new VniReference(4L))
- .build())
- .build())
+ .setNextHop(new NextHopBuilder().setNextHopOptions(
+ new TableLookupCaseBuilder()
+ .setSecondaryVrf(new VniReference(4L))
+ .build()).build())
.build();
noMappingDefined(mappingContext, namesFactory.uniqueRouteName(ROUTE_PROTOCOL_NAME, route), "route-context");
customizer.writeCurrentAttributes(validId, route, writeContext);
@@ -142,9 +138,10 @@ public class Ipv4RouteCustomizerTest extends WriterCustomizerTest
@Test
public void testWriteHopList(
- @InjectTestData(resourcePath = "/ipv4/multihop/multiHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route)
+ @InjectTestData(resourcePath = "/ipv4/multihop/multiHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH)
+ StaticRoutes route)
throws WriteFailedException {
- final Route route1 = getIpv4RouteWithId(route, 1L);
+ final Route route1 = getIpv4RouteWithId(route, new Ipv4Prefix("192.168.2.1/24"));
noMappingDefined(mappingContext, namesFactory.uniqueRouteName(ROUTE_PROTOCOL_NAME, route1), "route-context");
customizer.writeCurrentAttributes(validId, route1, writeContext);
@@ -174,21 +171,24 @@ public class Ipv4RouteCustomizerTest extends WriterCustomizerTest
public void testWriteSpecialHop(
@InjectTestData(resourcePath = "/ipv4/specialhop/specialHopRouteBlackhole.json", id = STATIC_ROUTE_PATH) StaticRoutes route)
throws WriteFailedException {
- final Route route1 = getIpv4RouteWithId(route, 1L);
+ final Route route1 = getIpv4RouteWithId(route, new Ipv4Prefix("192.168.2.1/24"));
noMappingDefined(mappingContext, namesFactory.uniqueRouteName(ROUTE_PROTOCOL_NAME, route1), "route-context");
customizer.writeCurrentAttributes(validId, route1, writeContext);
verifyInvocation(1, ImmutableList
- .of(desiredSpecialResult(1, 0, FIRST_ADDRESS_AS_ARRAY, 24, 1, 0, 0, 0, ROUTE_PROTOCOL_INDEX, 0)), api,
- requestCaptor);
+ .of(desiredSpecialResult(1, 0, FIRST_ADDRESS_AS_ARRAY, 24, 1, 0, 0, 0,
+ ROUTE_PROTOCOL_INDEX, 0)),
+ api, requestCaptor);
}
@Test
public void testUpdate(
@InjectTestData(resourcePath = "/ipv4/specialhop/specialHopRouteBlackhole.json", id = STATIC_ROUTE_PATH) StaticRoutes route) {
try {
- customizer.updateCurrentAttributes(validId, new RouteBuilder().build(), getIpv4RouteWithId(route, 1L),
- writeContext);
+ customizer.updateCurrentAttributes(validId,
+ new RouteBuilder().build(),
+ getIpv4RouteWithId(route,
+ new Ipv4Prefix("192.168.2.1/24")), writeContext);
} catch (WriteFailedException e) {
assertTrue(e.getCause() instanceof UnsupportedOperationException);
verifyNotInvoked(api);
@@ -202,18 +202,21 @@ public class Ipv4RouteCustomizerTest extends WriterCustomizerTest
public void testDeleteSingleHop(
@InjectTestData(resourcePath = "/ipv4/simplehop/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route)
throws WriteFailedException {
- customizer.deleteCurrentAttributes(validId, getIpv4RouteWithId(route, 1L), writeContext);
+ customizer.deleteCurrentAttributes(validId,
+ getIpv4RouteWithId(route,
+ new Ipv4Prefix("192.168.2.1/24")), writeContext);
verifyInvocation(1, ImmutableList
.of(desiredFlaglessResult(0, 0, 0, FIRST_ADDRESS_AS_ARRAY, 24,
SECOND_ADDRESS_AS_ARRAY, INTERFACE_INDEX,
- 0, ROUTE_PROTOCOL_INDEX, 0, CLASSIFY_TABLE_INDEX, 1)), api, requestCaptor);
+ 0, ROUTE_PROTOCOL_INDEX, 0, CLASSIFY_TABLE_INDEX, 1)),
+ api, requestCaptor);
}
@Test
public void testDeleteHopList(
@InjectTestData(resourcePath = "/ipv4/multihop/multiHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route)
throws WriteFailedException {
- final Route route1 = getIpv4RouteWithId(route, 1L);
+ final Route route1 = getIpv4RouteWithId(route, new Ipv4Prefix("192.168.2.1/24"));
noMappingDefined(mappingContext, namesFactory.uniqueRouteName(ROUTE_PROTOCOL_NAME, route1), "route-context");
customizer.deleteCurrentAttributes(validId, route1, writeContext);
@@ -242,10 +245,11 @@ public class Ipv4RouteCustomizerTest extends WriterCustomizerTest
public void testDeleteSpecialHop(
@InjectTestData(resourcePath = "/ipv4/specialhop/specialHopRouteBlackhole.json", id = STATIC_ROUTE_PATH) StaticRoutes route)
throws WriteFailedException {
- customizer.deleteCurrentAttributes(validId, getIpv4RouteWithId(route, 1L), writeContext);
+ customizer.deleteCurrentAttributes(validId, getIpv4RouteWithId(route, new Ipv4Prefix("192.168.2.1/24")), writeContext);
verifyInvocation(1,
- ImmutableList.of(desiredSpecialResult(0, 0, FIRST_ADDRESS_AS_ARRAY, 24, 1, 0, 0, 0, ROUTE_PROTOCOL_INDEX, 0)), api,
- requestCaptor);
+ ImmutableList.of(desiredSpecialResult(0, 0, FIRST_ADDRESS_AS_ARRAY, 24, 1, 0, 0, 0,
+ ROUTE_PROTOCOL_INDEX, 0)),
+ api, requestCaptor);
}
}
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizerTest.java
index a68fa57c4..171b59786 100644
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizerTest.java
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/Ipv6RouteCustomizerTest.java
@@ -16,6 +16,9 @@
package io.fd.hc2vpp.routing.write;
+import static io.fd.hc2vpp.routing.helpers.InterfaceTestHelper.INTERFACE_INDEX;
+import static io.fd.hc2vpp.routing.helpers.InterfaceTestHelper.INTERFACE_NAME;
+
import com.google.common.collect.ImmutableList;
import io.fd.hc2vpp.common.test.write.WriterCustomizerTest;
import io.fd.hc2vpp.common.translate.util.MultiNamingContext;
@@ -36,28 +39,27 @@ import org.mockito.ArgumentCaptor;
import org.mockito.Captor;
import org.mockito.Mock;
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.rev170917.StaticRoutes1;
-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.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.next.hop.options.TableLookupBuilder;
-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.RoutingProtocols;
-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.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.rev170917.VniReference;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.StaticRoutes1;
+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.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.ipv6.unicast.routing.rev180313.routing.control.plane.protocols.control.plane.protocol._static.routes.ipv6.route.NextHopBuilder;
+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.next.hop.content.next.hop.options.TableLookupCaseBuilder;
+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.ControlPlaneProtocolKey;
+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.yang.gen.v1.urn.ietf.params.xml.ns.yang.vpp.routing.types.rev180406.VniReference;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
-import static io.fd.hc2vpp.routing.helpers.InterfaceTestHelper.INTERFACE_INDEX;
-import static io.fd.hc2vpp.routing.helpers.InterfaceTestHelper.INTERFACE_NAME;
-
@RunWith(HoneycombTestRunner.class)
public class Ipv6RouteCustomizerTest extends WriterCustomizerTest
implements RoutingRequestTestHelper, ClassifyTableTestHelper, SchemaContextTestHelper {
private static final int ROUTE_PROTOCOL_INDEX = 1;
+ public static final Ipv6Prefix IPV_6_PREFIX = new Ipv6Prefix("2001:0db8:0a0b:12f0:0000:0000:0000:0001/64");
@Captor
private ArgumentCaptor<IpAddDelRoute> requestCaptor;
@@ -84,8 +86,8 @@ public class Ipv6RouteCustomizerTest extends WriterCustomizerTest
new Ipv6RouteCustomizer(api, interfaceContext, routeContext, routingProtocolContext, routeHopContext,
classifyManager);
- validId = InstanceIdentifier.create(RoutingProtocols.class)
- .child(RoutingProtocol.class, new RoutingProtocolKey(ROUTE_PROTOCOL_NAME))
+ validId = InstanceIdentifier.create(ControlPlaneProtocols.class)
+ .child(ControlPlaneProtocol.class, new ControlPlaneProtocolKey(ROUTE_PROTOCOL_NAME, Static.class))
.child(StaticRoutes.class)
.augmentation(StaticRoutes1.class)
.child(Ipv6.class)
@@ -103,7 +105,7 @@ public class Ipv6RouteCustomizerTest extends WriterCustomizerTest
@InjectTestData(resourcePath = "/ipv6/simplehop/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route)
throws WriteFailedException {
whenAddRouteThenSuccess(api);
- customizer.writeCurrentAttributes(validId, getIpv6RouteWithId(route, 1L), writeContext);
+ customizer.writeCurrentAttributes(validId, getIpv6RouteWithId(route, IPV_6_PREFIX), writeContext);
verifyInvocation(1, ImmutableList
.of(desiredFlaglessResult(1, 1, 0, Ipv6RouteData.FIRST_ADDRESS_AS_ARRAY, 64,
Ipv6RouteData.SECOND_ADDRESS_AS_ARRAY, INTERFACE_INDEX, 0, ROUTE_PROTOCOL_INDEX,
@@ -114,19 +116,17 @@ public class Ipv6RouteCustomizerTest extends WriterCustomizerTest
@Test
public void testWriteTableLookup() throws WriteFailedException {
final Route route = new RouteBuilder()
- .setKey(new RouteKey(2L))
- .setDestinationPrefix(new Ipv6Prefix("2001:0db8:0a0b:12f0:0000:0000:0000:0001/24"))
- .setNextHopOptions(new TableLookupBuilder()
- .setTableLookupParams(new TableLookupParamsBuilder()
- .setSecondaryVrf(new VniReference(4L))
- .build())
- .build())
+ .setKey(new RouteKey(IPV_6_PREFIX))
+ .setDestinationPrefix(IPV_6_PREFIX)
+ .setNextHop(new NextHopBuilder().setNextHopOptions(new TableLookupCaseBuilder()
+ .setSecondaryVrf(new VniReference(4L))
+ .build()).build())
.build();
whenAddRouteThenSuccess(api);
noMappingDefined(mappingContext, namesFactory.uniqueRouteName(ROUTE_PROTOCOL_NAME, route), "route-context");
customizer.writeCurrentAttributes(validId, route, writeContext);
verifyInvocation(1, ImmutableList
- .of(desiredFlaglessResult(1, 1, 0, Ipv6RouteData.FIRST_ADDRESS_AS_ARRAY, 24,
+ .of(desiredFlaglessResult(1, 1, 0, Ipv6RouteData.FIRST_ADDRESS_AS_ARRAY, 64,
new byte[4], ~0, 0, ROUTE_PROTOCOL_INDEX, 4,
0, 0)),
api, requestCaptor);
@@ -137,7 +137,7 @@ public class Ipv6RouteCustomizerTest extends WriterCustomizerTest
@InjectTestData(resourcePath = "/ipv6/multihop/multiHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route)
throws WriteFailedException {
whenAddRouteThenSuccess(api);
- customizer.writeCurrentAttributes(validId, getIpv6RouteWithId(route, 1L), writeContext);
+ customizer.writeCurrentAttributes(validId, getIpv6RouteWithId(route, IPV_6_PREFIX), writeContext);
verifyInvocation(2,
ImmutableList.of(
desiredFlaglessResult(1, 1, 1, Ipv6RouteData.FIRST_ADDRESS_AS_ARRAY, 64,
@@ -160,11 +160,12 @@ public class Ipv6RouteCustomizerTest extends WriterCustomizerTest
@InjectTestData(resourcePath = "/ipv6/specialhop/specialHopRouteBlackhole.json", id = STATIC_ROUTE_PATH) StaticRoutes route)
throws WriteFailedException {
whenAddRouteThenSuccess(api);
- customizer.deleteCurrentAttributes(validId, getIpv6RouteWithId(route, 1L),
+ customizer.deleteCurrentAttributes(validId, getIpv6RouteWithId(route, IPV_6_PREFIX),
writeContext);
verifyInvocation(1, ImmutableList
- .of(desiredSpecialResult(0, 1, Ipv6RouteData.FIRST_ADDRESS_AS_ARRAY, 24, 1, 0, 0, 0, ROUTE_PROTOCOL_INDEX, 0)), api,
- requestCaptor);
+ .of(desiredSpecialResult(0, 1, Ipv6RouteData.FIRST_ADDRESS_AS_ARRAY, 64,
+ 1, 0, 0, 0, ROUTE_PROTOCOL_INDEX, 0)),
+ api, requestCaptor);
}
@Test
@@ -172,7 +173,7 @@ public class Ipv6RouteCustomizerTest extends WriterCustomizerTest
@InjectTestData(resourcePath = "/ipv6/simplehop/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route)
throws WriteFailedException {
whenAddRouteThenSuccess(api);
- customizer.deleteCurrentAttributes(validId, getIpv6RouteWithId(route, 1L), writeContext);
+ customizer.deleteCurrentAttributes(validId, getIpv6RouteWithId(route, IPV_6_PREFIX), writeContext);
verifyInvocation(1, ImmutableList
.of(desiredFlaglessResult(0, 1, 0, Ipv6RouteData.FIRST_ADDRESS_AS_ARRAY, 64,
Ipv6RouteData.SECOND_ADDRESS_AS_ARRAY, INTERFACE_INDEX, 0, 1,
@@ -184,7 +185,7 @@ public class Ipv6RouteCustomizerTest extends WriterCustomizerTest
@InjectTestData(resourcePath = "/ipv6/multihop/multiHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH) StaticRoutes route)
throws WriteFailedException {
whenAddRouteThenSuccess(api);
- customizer.deleteCurrentAttributes(validId, getIpv6RouteWithId(route, 1L), writeContext);
+ customizer.deleteCurrentAttributes(validId, getIpv6RouteWithId(route, IPV_6_PREFIX), writeContext);
verifyInvocation(2,
ImmutableList.of(
desiredFlaglessResult(0, 1, 1, Ipv6RouteData.FIRST_ADDRESS_AS_ARRAY, 64,
@@ -201,10 +202,11 @@ public class Ipv6RouteCustomizerTest extends WriterCustomizerTest
@InjectTestData(resourcePath = "/ipv6/specialhop/specialHopRouteBlackhole.json", id = STATIC_ROUTE_PATH) StaticRoutes route)
throws WriteFailedException {
whenAddRouteThenSuccess(api);
- customizer.writeCurrentAttributes(validId, getIpv6RouteWithId(route, 1L),
+ customizer.writeCurrentAttributes(validId, getIpv6RouteWithId(route, IPV_6_PREFIX),
writeContext);
verifyInvocation(1, ImmutableList
- .of(desiredSpecialResult(1, 1, Ipv6RouteData.FIRST_ADDRESS_AS_ARRAY, 24, 1, 0, 0, 0, ROUTE_PROTOCOL_INDEX, 0)), api,
- requestCaptor);
+ .of(desiredSpecialResult(1, 1, Ipv6RouteData.FIRST_ADDRESS_AS_ARRAY, 64,
+ 1, 0, 0, 0, ROUTE_PROTOCOL_INDEX, 0)),
+ api, requestCaptor);
}
}
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/PrefixCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/PrefixCustomizerTest.java
index 86c2df115..7321acde5 100644
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/PrefixCustomizerTest.java
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/PrefixCustomizerTest.java
@@ -31,41 +31,43 @@ import io.fd.vpp.jvpp.core.dto.SwInterfaceIp6NdRaPrefix;
import io.fd.vpp.jvpp.core.dto.SwInterfaceIp6NdRaPrefixReply;
import org.junit.Test;
import org.junit.runner.RunWith;
-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.RoutingInstanceKey;
-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.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.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.interfaces.rev140508.interfaces.InterfaceKey;
+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.ip.rev140616.interfaces._interface.Ipv6;
+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.yangtools.yang.binding.InstanceIdentifier;
@RunWith(HoneycombTestRunner.class)
public class PrefixCustomizerTest extends WriterCustomizerTest implements SchemaContextTestHelper {
- private static final String INSTANCE_NAME = "tst-protocol";
private static final String CTX_NAME = "interface-context";
private static final String IFC_NAME = "eth0";
private static final int IFC_INDEX = 1;
- private static final InstanceIdentifier<Prefix> IID = InstanceIdentifier.create(Routing.class)
- .child(RoutingInstance.class, new RoutingInstanceKey(INSTANCE_NAME)).child(Interfaces.class)
- .child(Interface.class, new InterfaceKey(IFC_NAME)).augmentation(
- Interface1.class).child(Ipv6RouterAdvertisements.class).child(PrefixList.class).child(Prefix.class);
+ private static final InstanceIdentifier<Prefix> IID = InstanceIdentifier
+ .create(Interfaces.class)
+ .child(Interface.class, new InterfaceKey(IFC_NAME))
+ .augmentation(Interface1.class)
+ .child(Ipv6.class)
+ .augmentation(Ipv61.class)
+ .child(Ipv6RouterAdvertisements.class)
+ .child(PrefixList.class)
+ .child(Prefix.class);
- private static final String RA_PATH = "/hc2vpp-ietf-routing:routing" +
- "/hc2vpp-ietf-routing:routing-instance[hc2vpp-ietf-routing:name='" + INSTANCE_NAME + "']" +
- "/hc2vpp-ietf-routing:interfaces" +
- "/hc2vpp-ietf-routing:interface[hc2vpp-ietf-routing:name='" + IFC_NAME + "']" +
+ private static final String RA_PATH = "/ietf-interfaces:interfaces" +
+ "/ietf-interfaces:interface[ietf-interfaces:name='" + IFC_NAME + "']" +
+ "/ietf-ip:ipv6" +
"/hc2vpp-ietf-ipv6-unicast-routing:ipv6-router-advertisements/hc2vpp-ietf-ipv6-unicast-routing:prefix-list";
private PrefixCustomizer customizer;
private NamingContext interfaceContext = new NamingContext("ifaces", CTX_NAME);
@Override
- protected void setUpTest() throws Exception {
+ protected void setUpTest() {
customizer = new PrefixCustomizer(api, interfaceContext);
defineMapping(mappingContext, IFC_NAME, IFC_INDEX, CTX_NAME);
when(api.swInterfaceIp6NdRaPrefix(any())).thenReturn(future(new SwInterfaceIp6NdRaPrefixReply()));
@@ -80,7 +82,8 @@ public class PrefixCustomizerTest extends WriterCustomizerTest implements Schema
request.swIfIndex = IFC_INDEX;
// 2001:0db8:0a0b:12f0:0000:0000:0000:0002/64
- request.address = new byte[] {0x20, 0x01, 0x0d, (byte) 0xb8, 0x0a, 0x0b, 0x12, (byte) 0xf0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0x02};
+ request.address =
+ new byte[] {0x20, 0x01, 0x0d, (byte) 0xb8, 0x0a, 0x0b, 0x12, (byte) 0xf0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0x02};
request.addressLength = 64;
request.valLifetime = 2592000; // default value
request.prefLifetime = 604800; // default value
@@ -96,7 +99,8 @@ public class PrefixCustomizerTest extends WriterCustomizerTest implements Schema
request.swIfIndex = IFC_INDEX;
// 2001:0db8:0a0b:12f0:0000:0000:0000:0002/64
- request.address = new byte[] {0x20, 0x01, 0x0d, (byte) 0xb8, 0x0a, 0x0b, 0x12, (byte) 0xf0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0x02};
+ request.address =
+ new byte[] {0x20, 0x01, 0x0d, (byte) 0xb8, 0x0a, 0x0b, 0x12, (byte) 0xf0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0x02};
request.addressLength = 64;
request.noAdvertise = 1;
request.noAutoconfig = 1;
@@ -113,7 +117,8 @@ public class PrefixCustomizerTest extends WriterCustomizerTest implements Schema
final SwInterfaceIp6NdRaPrefix request = new SwInterfaceIp6NdRaPrefix();
request.swIfIndex = IFC_INDEX;
// 2001:0db8:0a0b:12f0:0000:0000:0000:0002/64
- request.address = new byte[] {0x20, 0x01, 0x0d, (byte) 0xb8, 0x0a, 0x0b, 0x12, (byte) 0xf0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0x02};
+ request.address =
+ new byte[] {0x20, 0x01, 0x0d, (byte) 0xb8, 0x0a, 0x0b, 0x12, (byte) 0xf0, 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0x02};
request.addressLength = 64;
request.isNo = 1;
verify(api).swInterfaceIp6NdRaPrefix(request);
@@ -122,4 +127,4 @@ public class PrefixCustomizerTest extends WriterCustomizerTest implements Schema
private static Prefix getPrefix(final PrefixList prefixList) {
return prefixList.getPrefix().get(0);
}
-} \ No newline at end of file
+}
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RouterAdvertisementsCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RouterAdvertisementsCustomizerTest.java
index dc7dddbca..7e92d1654 100644
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RouterAdvertisementsCustomizerTest.java
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RouterAdvertisementsCustomizerTest.java
@@ -31,38 +31,37 @@ import io.fd.vpp.jvpp.core.dto.SwInterfaceIp6NdRaConfig;
import io.fd.vpp.jvpp.core.dto.SwInterfaceIp6NdRaConfigReply;
import org.junit.Test;
import org.junit.runner.RunWith;
-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.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.RoutingInstanceKey;
-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.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.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.interfaces.rev140508.interfaces.InterfaceKey;
+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.ip.rev140616.interfaces._interface.Ipv6;
+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.yangtools.yang.binding.InstanceIdentifier;
@RunWith(HoneycombTestRunner.class)
public class RouterAdvertisementsCustomizerTest extends WriterCustomizerTest implements SchemaContextTestHelper {
- private static final String INSTANCE_NAME = "tst-protocol";
private static final String CTX_NAME = "interface-context";
private static final String IFC_NAME = "eth0";
private static final int IFC_INDEX = 1;
- private static final InstanceIdentifier<Ipv6RouterAdvertisements> IID = InstanceIdentifier.create(Routing.class)
- .child(RoutingInstance.class, new RoutingInstanceKey(INSTANCE_NAME)).child(Interfaces.class)
- .child(Interface.class, new InterfaceKey(IFC_NAME)).augmentation(
- Interface1.class).child(Ipv6RouterAdvertisements.class);
+ private static final InstanceIdentifier<Ipv6RouterAdvertisements> IID = InstanceIdentifier
+ .create(Interfaces.class)
+ .child(Interface.class, new InterfaceKey(IFC_NAME))
+ .augmentation(Interface1.class)
+ .child(Ipv6.class)
+ .augmentation(Ipv61.class)
+ .child(Ipv6RouterAdvertisements.class);
- private static final String RA_PATH = "/hc2vpp-ietf-routing:routing" +
- "/hc2vpp-ietf-routing:routing-instance[hc2vpp-ietf-routing:name='" + INSTANCE_NAME + "']" +
- "/hc2vpp-ietf-routing:interfaces";
+ private static final String RA_PATH = "/ietf-interfaces:interfaces";
private RouterAdvertisementsCustomizer customizer;
private NamingContext interfaceContext = new NamingContext("ifaces", CTX_NAME);
@Override
- protected void setUpTest() throws Exception {
+ protected void setUpTest() {
customizer = new RouterAdvertisementsCustomizer(api, interfaceContext);
defineMapping(mappingContext, IFC_NAME, IFC_INDEX, CTX_NAME);
when(api.swInterfaceIp6NdRaConfig(any())).thenReturn(future(new SwInterfaceIp6NdRaConfigReply()));
@@ -106,6 +105,11 @@ public class RouterAdvertisementsCustomizerTest extends WriterCustomizerTest imp
}
private static Ipv6RouterAdvertisements getRA(final Interfaces ifc) {
- return ifc.getInterface().get(0).getAugmentation(Interface1.class).getIpv6RouterAdvertisements();
+ return ifc.getInterface()
+ .get(0)
+ .getAugmentation(Interface1.class)
+ .getIpv6()
+ .getAugmentation(Ipv61.class)
+ .getIpv6RouterAdvertisements();
}
-} \ No newline at end of file
+}
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizerTest.java
deleted file mode 100644
index 2e073d726..000000000
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingInstanceCustomizerTest.java
+++ /dev/null
@@ -1,87 +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 org.junit.Assert.fail;
-import static org.mockito.Mockito.when;
-
-import io.fd.hc2vpp.common.test.write.WriterCustomizerTest;
-import io.fd.hc2vpp.routing.RoutingConfiguration;
-import org.junit.Test;
-import org.mockito.Mock;
-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.yangtools.yang.binding.InstanceIdentifier;
-
-public class RoutingInstanceCustomizerTest extends WriterCustomizerTest {
-
- private static final String VALID_NAME = "valid-name";
- private static final String INVALID_NAME = "invalid-name";
-
- @Mock
- private RoutingConfiguration configuration;
-
- private RoutingInstanceCustomizer customizer;
- private InstanceIdentifier<RoutingInstance> id;
-
- private RoutingInstance validData;
- private RoutingInstance invalidData;
-
- @Override
- protected void setUpTest() throws Exception {
- customizer = new RoutingInstanceCustomizer(configuration);
-
- when(configuration.getDefaultRoutingInstanceName()).thenReturn(VALID_NAME);
-
- id = InstanceIdentifier.create(RoutingInstance.class);
- validData = new RoutingInstanceBuilder().setName(VALID_NAME).build();
- invalidData = new RoutingInstanceBuilder().setName(INVALID_NAME).build();
- }
-
- @Test
- public void writeCurrentAttributesValid() throws Exception {
- try {
- customizer.writeCurrentAttributes(id, validData, writeContext);
- } catch (Exception e) {
- fail("Test should passed without exception");
- }
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void writeCurrentAttributesInvalid() throws Exception {
- customizer.writeCurrentAttributes(id, invalidData, writeContext);
- }
-
- @Test(expected = UnsupportedOperationException.class)
- public void updateCurrentAttributes() throws Exception {
- customizer.updateCurrentAttributes(id, validData, validData, writeContext);
- }
-
- @Test
- public void deleteCurrentAttributesValid() throws Exception {
- try {
- customizer.deleteCurrentAttributes(id, validData, writeContext);
- } catch (Exception e) {
- fail("Test should passed without exception");
- }
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void deleteCurrentAttributesInvalid() throws Exception {
- customizer.deleteCurrentAttributes(id, invalidData, writeContext);
- }
-
-} \ No newline at end of file
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingInterfaceCustomizerTest.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingInterfaceCustomizerTest.java
deleted file mode 100644
index 608e727e5..000000000
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/RoutingInterfaceCustomizerTest.java
+++ /dev/null
@@ -1,91 +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 org.mockito.ArgumentMatchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verifyZeroInteractions;
-import static org.mockito.Mockito.when;
-
-import com.google.common.base.Optional;
-import io.fd.honeycomb.translate.write.WriteContext;
-import io.fd.honeycomb.translate.write.WriteFailedException;
-import org.junit.Before;
-import org.junit.Test;
-import org.mockito.Mock;
-import org.mockito.MockitoAnnotations;
-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.RoutingInstanceKey;
-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.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;
-
-public class RoutingInterfaceCustomizerTest {
- private static final String IFC_NAME = "eth0";
-
- @Mock
- private WriteContext ctx;
- private RoutingInterfaceCustomizer customizer;
-
- @Before
- public final void setUp() throws Exception {
- MockitoAnnotations.initMocks(this);
- customizer = new RoutingInterfaceCustomizer();
-
- when(ctx.readAfter(any())).thenReturn(Optional.absent());
- 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(
- org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.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(
- IFC_NAME));
- when(ctx.readAfter(id)).thenReturn(Optional.of(mock(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.interfaces.rev140508.interfaces.Interface.class)));
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testWriteIfcNotConfigured() throws WriteFailedException {
- final String nonExistingIfcName = "someIfc";
- final Interface ifc = mock(Interface.class);
- when(ifc.getName()).thenReturn(nonExistingIfcName);
- customizer.writeCurrentAttributes(getId(nonExistingIfcName), ifc, ctx);
- }
-
- @Test
- public void testUpdate() throws WriteFailedException {
- final Interface ifc = mock(Interface.class);
- when(ifc.getName()).thenReturn(IFC_NAME);
- customizer.updateCurrentAttributes(getId(IFC_NAME), ifc, ifc, ctx);
- }
-
- @Test
- public void testDelete() throws WriteFailedException {
- final Interface ifc = mock(Interface.class);
- when(ifc.getName()).thenReturn(IFC_NAME);
- customizer.deleteCurrentAttributes(getId(IFC_NAME), ifc, ctx);
- verifyZeroInteractions(ctx);
- }
-
- private InstanceIdentifier<Interface> getId(final String ifcName) {
- return InstanceIdentifier.create(Routing.class)
- .child(RoutingInstance.class, new RoutingInstanceKey("routingInstance")).child(Interfaces.class)
- .child(Interface.class, new InterfaceKey(ifcName));
- }
-} \ No newline at end of file
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactoryIpv4Test.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactoryIpv4Test.java
index a17dfa3fb..b4ec3d91d 100644
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactoryIpv4Test.java
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactoryIpv4Test.java
@@ -16,7 +16,6 @@
package io.fd.hc2vpp.routing.write.factory;
-
import static org.junit.Assert.assertEquals;
import io.fd.hc2vpp.common.translate.util.NamingContext;
@@ -36,10 +35,11 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-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.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.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.routing.protocol.StaticRoutes;
+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.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.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.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.control.plane.protocol.StaticRoutes;
@RunWith(HoneycombTestRunner.class)
public class MultipathHopRequestFactoryIpv4Test
@@ -85,26 +85,32 @@ public class MultipathHopRequestFactoryIpv4Test
defineMapping(mappingContext, INTERFACE_NAME, INTERFACE_INDEX, "interface-context");
defineMapping(mappingContext, ROUTE_PROTOCOL_NAME, 1, "routing-protocol-context");
- ipv4MutlipathRouteWithClassifier = getIpv4RouteWithId(ipv4StaticRoutesWithClassifier, 1L);
+ ipv4MutlipathRouteWithClassifier = getIpv4RouteWithId(ipv4StaticRoutesWithClassifier,
+ new Ipv4Prefix("192.168.2.1/24"));
final List<NextHop> ipv4HopsClassified =
- NextHopList.class.cast(ipv4MutlipathRouteWithClassifier.getNextHopOptions()).getNextHopList()
- .getNextHop();
+ NextHopList.class.cast(ipv4MutlipathRouteWithClassifier.getNextHop().getNextHopOptions())
+ .getNextHopList().getNextHop();
ipv4nextHopWithClassifier =
- ipv4HopsClassified.stream().filter(nextHop -> nextHop.getId() == 1L).findFirst().get();
+ ipv4HopsClassified.stream().filter(nextHop -> Integer.valueOf(nextHop.getIndex()) == 1L)
+ .findFirst().get();
- ipv4MutlipathRouteWithoutClassifier = getIpv4RouteWithId(ipv4StaticRoutesWithoutClassifier, 1L);
+ ipv4MutlipathRouteWithoutClassifier = getIpv4RouteWithId(ipv4StaticRoutesWithoutClassifier,
+ new Ipv4Prefix("192.168.2.1/24"));
final List<NextHop> ipv4HopsNonClassified =
- NextHopList.class.cast(ipv4MutlipathRouteWithoutClassifier.getNextHopOptions()).getNextHopList()
- .getNextHop();
+ NextHopList.class.cast(ipv4MutlipathRouteWithoutClassifier.getNextHop().getNextHopOptions())
+ .getNextHopList().getNextHop();
ipv4nextHopWithoutClassifier =
- ipv4HopsNonClassified.stream().filter(nextHop -> nextHop.getId() == 1L).findFirst().get();
+ ipv4HopsNonClassified.stream().filter(nextHop -> Integer.valueOf(nextHop.getIndex()) == 1L)
+ .findFirst().get();
- ipv4MutlipathRouteWithoutRouteAtts = getIpv4RouteWithId(ipv4StaticRoutesWithoutRouteAttrs, 1L);
+ ipv4MutlipathRouteWithoutRouteAtts = getIpv4RouteWithId(ipv4StaticRoutesWithoutRouteAttrs,
+ new Ipv4Prefix("192.168.2.1/24"));
final List<NextHop> ipv4HopsNonRouteAttrs =
- NextHopList.class.cast(ipv4MutlipathRouteWithoutRouteAtts.getNextHopOptions()).getNextHopList()
- .getNextHop();
+ NextHopList.class.cast(ipv4MutlipathRouteWithoutRouteAtts.getNextHop().getNextHopOptions())
+ .getNextHopList().getNextHop();
ipv4nextHopWithoutRouteAtts =
- ipv4HopsNonClassified.stream().filter(nextHop -> nextHop.getId() == 1L).findFirst().get();
+ ipv4HopsNonClassified.stream().filter(nextHop -> Integer.valueOf(nextHop.getIndex()) == 1L)
+ .findFirst().get();
}
@Test
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactoryIpv6Test.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactoryIpv6Test.java
index 50bd106ed..50ada6ef3 100644
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactoryIpv6Test.java
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/MultipathHopRequestFactoryIpv6Test.java
@@ -35,10 +35,11 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-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.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.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.routing.protocol.StaticRoutes;
+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.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.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.control.plane.protocol.StaticRoutes;
@RunWith(HoneycombTestRunner.class)
public class MultipathHopRequestFactoryIpv6Test
@@ -78,22 +79,26 @@ public class MultipathHopRequestFactoryIpv6Test
defineMapping(mappingContext, INTERFACE_NAME, INTERFACE_INDEX, "interface-context");
defineMapping(mappingContext, ROUTE_PROTOCOL_NAME, 1, "routing-protocol-context");
- ipv6MultipathRouteWithClassifier = getIpv6RouteWithId(ipv6StaticRoutesWithClassifier, 1L);
- ipv6MultipathRouteWithoutClassifier = getIpv6RouteWithId(ipv6StaticRoutesWithoutClassifier, 1L);
+ ipv6MultipathRouteWithClassifier =
+ getIpv6RouteWithId(ipv6StaticRoutesWithClassifier,
+ new Ipv6Prefix("2001:0db8:0a0b:12f0:0000:0000:0000:0001/64"));
+ ipv6MultipathRouteWithoutClassifier =
+ getIpv6RouteWithId(ipv6StaticRoutesWithoutClassifier,
+ new Ipv6Prefix("2001:0db8:0a0b:12f0:0000:0000:0000:0001/64"));
final List<NextHop> ipv6HopsClassified =
- NextHopList.class.cast(ipv6MultipathRouteWithClassifier.getNextHopOptions()).getNextHopList()
- .getNextHop();
+ NextHopList.class.cast(ipv6MultipathRouteWithClassifier.getNextHop().getNextHopOptions())
+ .getNextHopList().getNextHop();
final List<NextHop> ipv6HopsNonClassified =
- NextHopList.class.cast(ipv6MultipathRouteWithoutClassifier.getNextHopOptions()).getNextHopList()
- .getNextHop();
+ NextHopList.class.cast(ipv6MultipathRouteWithoutClassifier.getNextHop().getNextHopOptions())
+ .getNextHopList().getNextHop();
ipv6nextHopForClassified = ipv6HopsClassified.stream()
- .filter(nextHop -> nextHop.getId() == 1L)
+ .filter(nextHop -> Integer.valueOf(nextHop.getIndex()) == 1L)
.findFirst().get();
ipv6nextHopForNonClassified = ipv6HopsNonClassified.stream()
- .filter(nextHop -> nextHop.getId() == 1L)
+ .filter(nextHop -> Integer.valueOf(nextHop.getIndex()) == 1L)
.findFirst().get();
}
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactoryIpv4Test.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactoryIpv4Test.java
index 15951f48e..6457feba2 100644
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactoryIpv4Test.java
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactoryIpv4Test.java
@@ -34,8 +34,9 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-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.routing.rev140524.routing.routing.instance.routing.protocols.routing.protocol.StaticRoutes;
+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.rev180313.StaticRoutes1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.routing.control.plane.protocols.control.plane.protocol.StaticRoutes;
@RunWith(HoneycombTestRunner.class)
public class SimpleHopRequestFactoryIpv4Test
@@ -66,10 +67,10 @@ public class SimpleHopRequestFactoryIpv4Test
@Test
public void testIpv4WithClassifier(
@InjectTestData(resourcePath = "/ipv4/simplehop/simpleHopRouteWithClassifier.json", id = STATIC_ROUTE_PATH)
- StaticRoutes ipv4StaticRouteWithClassifier) {
+ StaticRoutes ipv4StaticRouteWithClassifier) {
final IpAddDelRoute request =
factory.createIpv4SimpleHopRequest(false, ROUTE_PROTOCOL_NAME,
- getIpv4RouteWithId(ipv4StaticRouteWithClassifier, 1L),
+ getIpv4RouteWithId(ipv4StaticRouteWithClassifier, new Ipv4Prefix("192.168.2.1/24")),
mappingContext);
assertEquals(desiredFlaglessResult(0, 0, 0, Ipv4RouteData.FIRST_ADDRESS_AS_ARRAY, 24,
@@ -88,7 +89,8 @@ public class SimpleHopRequestFactoryIpv4Test
assertEquals(
desiredFlaglessResult(0, 0, 0, Ipv4RouteData.FIRST_ADDRESS_AS_ARRAY, 24,
- Ipv4RouteData.SECOND_ADDRESS_AS_ARRAY, INTERFACE_INDEX, 0, 1, 0, 0, 0), request);
+ Ipv4RouteData.SECOND_ADDRESS_AS_ARRAY, INTERFACE_INDEX, 0, 1, 0, 0, 0),
+ request);
}
@Test
@@ -102,6 +104,7 @@ public class SimpleHopRequestFactoryIpv4Test
assertEquals(
desiredFlaglessResult(0, 0, 0, Ipv4RouteData.FIRST_ADDRESS_AS_ARRAY, 24,
- Ipv4RouteData.SECOND_ADDRESS_AS_ARRAY, INTERFACE_INDEX, 0, 1, 0, 0, 0), request);
+ Ipv4RouteData.SECOND_ADDRESS_AS_ARRAY, INTERFACE_INDEX, 0, 1, 0, 0, 0),
+ request);
}
}
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactoryIpv6Test.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactoryIpv6Test.java
index c50a14ab4..eadb3995d 100644
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactoryIpv6Test.java
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SimpleHopRequestFactoryIpv6Test.java
@@ -34,8 +34,8 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-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.routing.rev140524.routing.routing.instance.routing.protocols.routing.protocol.StaticRoutes;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.StaticRoutes1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.routing.control.plane.protocols.control.plane.protocol.StaticRoutes;
@RunWith(HoneycombTestRunner.class)
public class SimpleHopRequestFactoryIpv6Test
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactoryIpv4Test.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactoryIpv4Test.java
index 7fcc77737..bce1b5167 100644
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactoryIpv4Test.java
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactoryIpv4Test.java
@@ -18,9 +18,10 @@ package io.fd.hc2vpp.routing.write.factory;
import static io.fd.hc2vpp.routing.write.factory.SpecialNextHopRequestFactory.forContexts;
import static org.junit.Assert.assertEquals;
-import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.SpecialNextHopGrouping.SpecialNextHop.Prohibit;
-import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.SpecialNextHopGrouping.SpecialNextHop.Receive;
-import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.SpecialNextHopGrouping.SpecialNextHop.Unreachable;
+import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.SpecialNextHop.SpecialNextHopEnum.Blackhole;
+import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.SpecialNextHop.SpecialNextHopEnum.Prohibit;
+import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.SpecialNextHop.SpecialNextHopEnum.Receive;
+import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.SpecialNextHop.SpecialNextHopEnum.Unreachable;
import io.fd.hc2vpp.common.test.util.NamingContextHelper;
import io.fd.hc2vpp.common.translate.util.NamingContext;
@@ -40,10 +41,10 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-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.routing.routing.instance.routing.protocols.routing.protocol._static.routes.ipv4.Route;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.SpecialNextHopGrouping;
-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.inet.types.rev130715.Ipv4Prefix;
+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.Route;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.routing.control.plane.protocols.control.plane.protocol.StaticRoutes;
@RunWith(HoneycombTestRunner.class)
public class SpecialNextHopRequestFactoryIpv4Test
@@ -52,6 +53,8 @@ public class SpecialNextHopRequestFactoryIpv4Test
private static final String PARENT_PROTOCOL_4 = "parent-protocol-4";
private static final int PARENT_PROTOCOL_4_INDEX = 4;
+ public static final Ipv4Prefix IPV_4_PREFIX = new Ipv4Prefix("192.168.2.1/24");
+ public static final int DST_PREFIX = 24;
@Mock
private VppClassifierContextManager classifierContextManager;
@@ -79,12 +82,14 @@ public class SpecialNextHopRequestFactoryIpv4Test
@Test
public void testIpv4WithClassifierBlackhole(
@InjectTestData(resourcePath = "/ipv4/specialhop/specialHopRouteBlackhole.json", id = STATIC_ROUTE_PATH)
- StaticRoutes routes) {
+ StaticRoutes routes) {
final IpAddDelRoute request =
- factory.createIpv4SpecialHopRequest(true, PARENT_PROTOCOL_4, extractSingleRoute(routes, 1L), mappingContext,
- SpecialNextHopGrouping.SpecialNextHop.Blackhole);
+ factory.createIpv4SpecialHopRequest(true, PARENT_PROTOCOL_4, extractSingleRoute(routes, IPV_4_PREFIX),
+ mappingContext, Blackhole);
- assertEquals(desiredSpecialResult(1, 0, Ipv4RouteData.FIRST_ADDRESS_AS_ARRAY, 24, 1, 0, 0, 0, PARENT_PROTOCOL_4_INDEX, DEFAULT_VNI), request);
+ assertEquals(desiredSpecialResult(1, 0, Ipv4RouteData.FIRST_ADDRESS_AS_ARRAY, DST_PREFIX, 1, 0, 0, 0,
+ PARENT_PROTOCOL_4_INDEX, DEFAULT_VNI),
+ request);
}
@Test
@@ -92,9 +97,12 @@ public class SpecialNextHopRequestFactoryIpv4Test
@InjectTestData(resourcePath = "/ipv4/specialhop/specialHopRouteReceive.json", id = STATIC_ROUTE_PATH)
StaticRoutes routes) {
final IpAddDelRoute request =
- factory.createIpv4SpecialHopRequest(true, PARENT_PROTOCOL_4, extractSingleRoute(routes, 1L), mappingContext, Receive);
+ factory.createIpv4SpecialHopRequest(true, PARENT_PROTOCOL_4, extractSingleRoute(routes, IPV_4_PREFIX),
+ mappingContext, Receive);
- assertEquals(desiredSpecialResult(1, 0, Ipv4RouteData.FIRST_ADDRESS_AS_ARRAY, 24, 0, 1, 0, 0, PARENT_PROTOCOL_4_INDEX, DEFAULT_VNI), request);
+ assertEquals(desiredSpecialResult(1, 0, Ipv4RouteData.FIRST_ADDRESS_AS_ARRAY, DST_PREFIX, 0, 1, 0, 0,
+ PARENT_PROTOCOL_4_INDEX, DEFAULT_VNI),
+ request);
}
@Test
@@ -102,9 +110,12 @@ public class SpecialNextHopRequestFactoryIpv4Test
@InjectTestData(resourcePath = "/ipv4/specialhop/specialHopRouteUnreachable.json", id = STATIC_ROUTE_PATH)
StaticRoutes routes) {
final IpAddDelRoute request =
- factory.createIpv4SpecialHopRequest(true, PARENT_PROTOCOL_4, extractSingleRoute(routes, 1L), mappingContext, Unreachable);
+ factory.createIpv4SpecialHopRequest(true, PARENT_PROTOCOL_4, extractSingleRoute(routes, IPV_4_PREFIX),
+ mappingContext, Unreachable);
- assertEquals(desiredSpecialResult(1, 0, Ipv4RouteData.FIRST_ADDRESS_AS_ARRAY, 24, 0, 0, 1, 0, PARENT_PROTOCOL_4_INDEX, DEFAULT_VNI), request);
+ assertEquals(desiredSpecialResult(1, 0, Ipv4RouteData.FIRST_ADDRESS_AS_ARRAY, DST_PREFIX, 0, 0, 1, 0,
+ PARENT_PROTOCOL_4_INDEX, DEFAULT_VNI),
+ request);
}
@Test
@@ -112,14 +123,17 @@ public class SpecialNextHopRequestFactoryIpv4Test
@InjectTestData(resourcePath = "/ipv4/specialhop/specialHopRouteProhibited.json", id = STATIC_ROUTE_PATH)
StaticRoutes routes) {
final IpAddDelRoute request =
- factory.createIpv4SpecialHopRequest(true,PARENT_PROTOCOL_4, extractSingleRoute(routes, 1L), mappingContext, Prohibit);
+ factory.createIpv4SpecialHopRequest(true, PARENT_PROTOCOL_4, extractSingleRoute(routes, IPV_4_PREFIX),
+ mappingContext, Prohibit);
- assertEquals(desiredSpecialResult(1, 0, Ipv4RouteData.FIRST_ADDRESS_AS_ARRAY, 24, 0, 0, 0, 1, PARENT_PROTOCOL_4_INDEX, DEFAULT_VNI), request);
+ assertEquals(desiredSpecialResult(1, 0, Ipv4RouteData.FIRST_ADDRESS_AS_ARRAY, DST_PREFIX, 0, 0, 0, 1,
+ PARENT_PROTOCOL_4_INDEX, DEFAULT_VNI),
+ request);
}
- private Route extractSingleRoute(final StaticRoutes staticRoutes, final long id) {
+ private Route extractSingleRoute(final StaticRoutes staticRoutes, final Ipv4Prefix id) {
return staticRoutes.getAugmentation(StaticRoutes1.class).getIpv4().getRoute().stream()
- .filter(route -> route.getId() == id)
+ .filter(route -> route.getDestinationPrefix().getValue().equals(id.getValue()))
.collect(RWUtils.singleItemCollector());
}
}
diff --git a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactoryIpv6Test.java b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactoryIpv6Test.java
index 9ebe1145f..4e0a0efd5 100644
--- a/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactoryIpv6Test.java
+++ b/routing/routing-impl/src/test/java/io/fd/hc2vpp/routing/write/factory/SpecialNextHopRequestFactoryIpv6Test.java
@@ -18,10 +18,10 @@ package io.fd.hc2vpp.routing.write.factory;
import static io.fd.hc2vpp.routing.write.trait.RouteRequestProducer.DEFAULT_VNI;
import static org.junit.Assert.assertEquals;
-import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.SpecialNextHopGrouping.SpecialNextHop.Blackhole;
-import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.SpecialNextHopGrouping.SpecialNextHop.Prohibit;
-import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.SpecialNextHopGrouping.SpecialNextHop.Receive;
-import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev140524.SpecialNextHopGrouping.SpecialNextHop.Unreachable;
+import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.SpecialNextHop.SpecialNextHopEnum.Blackhole;
+import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.SpecialNextHop.SpecialNextHopEnum.Prohibit;
+import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.SpecialNextHop.SpecialNextHopEnum.Receive;
+import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.SpecialNextHop.SpecialNextHopEnum.Unreachable;
import io.fd.hc2vpp.common.test.util.NamingContextHelper;
import io.fd.hc2vpp.common.translate.util.NamingContext;
@@ -40,9 +40,10 @@ import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-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.routing.routing.instance.routing.protocols.routing.protocol._static.routes.ipv6.Route;
-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.inet.types.rev130715.Ipv6Prefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.ipv6.unicast.routing.rev180313.StaticRoutes1;
+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.routing.rev180313.routing.control.plane.protocols.control.plane.protocol.StaticRoutes;
@RunWith(HoneycombTestRunner.class)
public class SpecialNextHopRequestFactoryIpv6Test
@@ -50,6 +51,8 @@ public class SpecialNextHopRequestFactoryIpv6Test
private static final String PARENT_PROTOCOL_6 = "parent-protocol-6";
private static final int PARENT_PROTOCOL_6_INDEX = 6;
+ public static final Ipv6Prefix IPV_6_PREFIX = new Ipv6Prefix("2001:0db8:0a0b:12f0:0000:0000:0000:0001/64");
+ public static final int DST_PREFIX = 64;
@Mock
private VppClassifierContextManager classifierContextManager;
@@ -66,8 +69,10 @@ public class SpecialNextHopRequestFactoryIpv6Test
public void init() {
MockitoAnnotations.initMocks(this);
interfaceContext = new NamingContext("iface", "interface-context");
- routingProtocolContextContext = new NamingContext("routingProtocol", "routing-protocol-context");
- factory = SpecialNextHopRequestFactory.forContexts(classifierContextManager, interfaceContext, routingProtocolContextContext);
+ routingProtocolContextContext =
+ new NamingContext("routingProtocol", "routing-protocol-context");
+ factory = SpecialNextHopRequestFactory.forContexts(classifierContextManager, interfaceContext,
+ routingProtocolContextContext);
addMapping(classifierContextManager, CLASSIFY_TABLE_NAME, CLASSIFY_TABLE_INDEX, mappingContext);
defineMapping(mappingContext, PARENT_PROTOCOL_6, PARENT_PROTOCOL_6_INDEX, "routing-protocol-context");
@@ -76,12 +81,14 @@ public class SpecialNextHopRequestFactoryIpv6Test
@Test
public void testIpv6Blackhole(
@InjectTestData(resourcePath = "/ipv6/specialhop/specialHopRouteBlackhole.json", id = STATIC_ROUTE_PATH)
- StaticRoutes routes) {
+ StaticRoutes routes) {
final IpAddDelRoute request =
- factory.createIpv6SpecialHopRequest(true, PARENT_PROTOCOL_6, extractSingleRoute(routes, 1L), mappingContext, Blackhole);
+ factory.createIpv6SpecialHopRequest(true, PARENT_PROTOCOL_6, extractSingleRoute(routes, IPV_6_PREFIX),
+ mappingContext, Blackhole);
- assertEquals(desiredSpecialResult(1, 1, Ipv6RouteData.FIRST_ADDRESS_AS_ARRAY, 24, 1, 0, 0, 0, PARENT_PROTOCOL_6_INDEX, DEFAULT_VNI),
- request);
+ assertEquals(desiredSpecialResult(1, 1, Ipv6RouteData.FIRST_ADDRESS_AS_ARRAY, DST_PREFIX, 1, 0, 0, 0,
+ PARENT_PROTOCOL_6_INDEX, DEFAULT_VNI),
+ request);
}
@Test
@@ -89,9 +96,12 @@ public class SpecialNextHopRequestFactoryIpv6Test
@InjectTestData(resourcePath = "/ipv6/specialhop/specialHopRouteReceive.json", id = STATIC_ROUTE_PATH)
StaticRoutes routes) {
final IpAddDelRoute request =
- factory.createIpv6SpecialHopRequest(true, PARENT_PROTOCOL_6, extractSingleRoute(routes, 1L), mappingContext, Receive);
+ factory.createIpv6SpecialHopRequest(true, PARENT_PROTOCOL_6, extractSingleRoute(routes, IPV_6_PREFIX),
+ mappingContext, Receive);
- assertEquals(desiredSpecialResult(1, 1, Ipv6RouteData.FIRST_ADDRESS_AS_ARRAY, 24, 0, 1, 0, 0, PARENT_PROTOCOL_6_INDEX, DEFAULT_VNI), request);
+ assertEquals(desiredSpecialResult(1, 1, Ipv6RouteData.FIRST_ADDRESS_AS_ARRAY, DST_PREFIX, 0, 1, 0, 0,
+ PARENT_PROTOCOL_6_INDEX, DEFAULT_VNI),
+ request);
}
@Test
@@ -99,9 +109,12 @@ public class SpecialNextHopRequestFactoryIpv6Test
@InjectTestData(resourcePath = "/ipv6/specialhop/specialHopRouteUnreachable.json", id = STATIC_ROUTE_PATH)
StaticRoutes routes) {
final IpAddDelRoute request =
- factory.createIpv6SpecialHopRequest(true, PARENT_PROTOCOL_6, extractSingleRoute(routes, 1L), mappingContext, Unreachable);
+ factory.createIpv6SpecialHopRequest(true, PARENT_PROTOCOL_6, extractSingleRoute(routes, IPV_6_PREFIX),
+ mappingContext, Unreachable);
- assertEquals(desiredSpecialResult(1, 1, Ipv6RouteData.FIRST_ADDRESS_AS_ARRAY, 24, 0, 0, 1, 0, PARENT_PROTOCOL_6_INDEX, DEFAULT_VNI), request);
+ assertEquals(desiredSpecialResult(1, 1, Ipv6RouteData.FIRST_ADDRESS_AS_ARRAY, DST_PREFIX, 0, 0, 1, 0,
+ PARENT_PROTOCOL_6_INDEX, DEFAULT_VNI),
+ request);
}
@Test
@@ -109,14 +122,17 @@ public class SpecialNextHopRequestFactoryIpv6Test
@InjectTestData(resourcePath = "/ipv6/specialhop/specialHopRouteProhibited.json", id = STATIC_ROUTE_PATH)
StaticRoutes routes) {
final IpAddDelRoute request =
- factory.createIpv6SpecialHopRequest(true, PARENT_PROTOCOL_6, extractSingleRoute(routes, 1L), mappingContext, Prohibit);
+ factory.createIpv6SpecialHopRequest(true, PARENT_PROTOCOL_6, extractSingleRoute(routes, IPV_6_PREFIX),
+ mappingContext, Prohibit);
- assertEquals(desiredSpecialResult(1, 1, Ipv6RouteData.FIRST_ADDRESS_AS_ARRAY, 24, 0, 0, 0, 1, PARENT_PROTOCOL_6_INDEX, DEFAULT_VNI), request);
+ assertEquals(desiredSpecialResult(1, 1, Ipv6RouteData.FIRST_ADDRESS_AS_ARRAY, DST_PREFIX, 0, 0, 0, 1,
+ PARENT_PROTOCOL_6_INDEX, DEFAULT_VNI),
+ request);
}
- private Route extractSingleRoute(final StaticRoutes staticRoutes, final long id) {
+ private Route extractSingleRoute(final StaticRoutes staticRoutes, final Ipv6Prefix id) {
return staticRoutes.getAugmentation(StaticRoutes1.class).getIpv6().getRoute().stream()
- .filter(route -> route.getId() == id).collect(
+ .filter(route -> route.getDestinationPrefix().getValue().equals(id.getValue())).collect(
RWUtils.singleItemCollector());
}
diff --git a/routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithClassifier.json b/routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithClassifier.json
index 99c987e03..5b4012d83 100644
--- a/routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithClassifier.json
+++ b/routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithClassifier.json
@@ -3,29 +3,30 @@
"ipv4": {
"route": [
{
- "id": 1,
"destination-prefix": "192.168.2.1/24",
- "vpp-ipv4-route": {
+ "vpp-v4ur:vpp-ipv4-route": {
"classify-table": "classify-table-one"
},
- "next-hop-list": {
- "next-hop": [
- {
- "id": "1",
- "address": "192.168.2.1",
- "outgoing-interface": "iface",
- "weight": "2"
- },
- {
- "id": "2",
- "address": "192.168.2.2",
- "outgoing-interface": "iface",
- "weight": "3"
- }
- ]
+ "next-hop":{
+ "next-hop-list": {
+ "next-hop": [
+ {
+ "index": "1",
+ "next-hop-address": "192.168.2.1",
+ "outgoing-interface": "iface",
+ "weight": "2"
+ },
+ {
+ "index": "2",
+ "next-hop-address": "192.168.2.2",
+ "outgoing-interface": "iface",
+ "weight": "3"
+ }
+ ]
+ }
}
}
]
}
}
-} \ No newline at end of file
+}
diff --git a/routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithNoRouteAttrs.json b/routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithNoRouteAttrs.json
index 71cefa6cb..a509076aa 100644
--- a/routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithNoRouteAttrs.json
+++ b/routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithNoRouteAttrs.json
@@ -3,26 +3,27 @@
"ipv4": {
"route": [
{
- "id": 1,
"destination-prefix": "192.168.2.1/24",
- "next-hop-list": {
- "next-hop": [
- {
- "id": "1",
- "address": "192.168.2.1",
- "outgoing-interface": "iface",
- "weight": "2"
- },
- {
- "id": "2",
- "address": "192.168.2.2",
- "outgoing-interface": "iface",
- "weight": "3"
- }
- ]
+ "next-hop": {
+ "next-hop-list": {
+ "next-hop": [
+ {
+ "index": "1",
+ "next-hop-address": "192.168.2.1",
+ "outgoing-interface": "iface",
+ "weight": "2"
+ },
+ {
+ "index": "2",
+ "next-hop-address": "192.168.2.2",
+ "outgoing-interface": "iface",
+ "weight": "3"
+ }
+ ]
+ }
}
}
]
}
}
-} \ No newline at end of file
+}
diff --git a/routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithoutClassifier.json b/routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithoutClassifier.json
index d4d4a0693..4c49ba9a8 100644
--- a/routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithoutClassifier.json
+++ b/routing/routing-impl/src/test/resources/ipv4/multihop/multiHopRouteWithoutClassifier.json
@@ -3,28 +3,29 @@
"ipv4": {
"route": [
{
- "id": 1,
"destination-prefix": "192.168.2.1/24",
- "vpp-ipv4-route": {
+ "vpp-v4ur:vpp-ipv4-route": {
},
- "next-hop-list": {
- "next-hop": [
- {
- "id": "1",
- "address": "192.168.2.1",
- "outgoing-interface": "iface",
- "weight": "2"
- },
- {
- "id": "2",
- "address": "192.168.2.2",
- "outgoing-interface": "iface",
- "weight": "3"
- }
- ]
+ "next-hop": {
+ "next-hop-list": {
+ "next-hop": [
+ {
+ "index": "1",
+ "next-hop-address": "192.168.2.1",
+ "outgoing-interface": "iface",
+ "weight": "2"
+ },
+ {
+ "index": "2",
+ "next-hop-address": "192.168.2.2",
+ "outgoing-interface": "iface",
+ "weight": "3"
+ }
+ ]
+ }
}
}
]
}
}
-} \ No newline at end of file
+}
diff --git a/routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteNoRouteAttrs.json b/routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteNoRouteAttrs.json
index d987bb6b1..b28ff6e9b 100644
--- a/routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteNoRouteAttrs.json
+++ b/routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteNoRouteAttrs.json
@@ -3,10 +3,11 @@
"ipv4": {
"route": [
{
- "id": 1,
"destination-prefix": "192.168.2.1/24",
- "next-hop": "192.168.2.2",
- "outgoing-interface": "iface"
+ "next-hop": {
+ "next-hop-address" : "192.168.2.2",
+ "outgoing-interface": "iface"
+ }
}
]
}
diff --git a/routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteWithClassifier.json b/routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteWithClassifier.json
index d00d9a06a..369ddd828 100644
--- a/routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteWithClassifier.json
+++ b/routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteWithClassifier.json
@@ -3,13 +3,14 @@
"ipv4": {
"route": [
{
- "id": 1,
"destination-prefix": "192.168.2.1/24",
- "vpp-ipv4-route": {
- "classify-table": "classify-table-one"
+ "next-hop": {
+ "next-hop-address" : "192.168.2.2",
+ "outgoing-interface": "iface"
},
- "next-hop": "192.168.2.2",
- "outgoing-interface": "iface"
+ "vpp-ipv4-route" : {
+ "classify-table": "classify-table-one"
+ }
}
]
}
diff --git a/routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteWithoutClassifier.json b/routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteWithoutClassifier.json
index 0ef7cf765..9080943c8 100644
--- a/routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteWithoutClassifier.json
+++ b/routing/routing-impl/src/test/resources/ipv4/simplehop/simpleHopRouteWithoutClassifier.json
@@ -3,12 +3,13 @@
"ipv4": {
"route": [
{
- "id": 1,
"destination-prefix": "192.168.2.1/24",
- "vpp-ipv4-route": {
+ "next-hop": {
+ "next-hop-address" : "192.168.2.2",
+ "outgoing-interface": "iface"
},
- "next-hop": "192.168.2.2",
- "outgoing-interface": "iface"
+ "vpp-v4ur:vpp-ipv4-route": {
+ }
}
]
}
diff --git a/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteBlackhole.json b/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteBlackhole.json
index b2ddc238b..04972478e 100644
--- a/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteBlackhole.json
+++ b/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteBlackhole.json
@@ -3,9 +3,10 @@
"ipv4": {
"route": [
{
- "id": 1,
"destination-prefix": "192.168.2.1/24",
- "special-next-hop": "blackhole"
+ "next-hop": {
+ "special-next-hop-enum": "blackhole"
+ }
}
]
}
diff --git a/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteProhibited.json b/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteProhibited.json
index fe9faf44c..cee2e1977 100644
--- a/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteProhibited.json
+++ b/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteProhibited.json
@@ -3,9 +3,10 @@
"ipv4": {
"route": [
{
- "id": 1,
"destination-prefix": "192.168.2.1/24",
- "special-next-hop": "prohibit"
+ "next-hop": {
+ "special-next-hop-enum": "prohibit"
+ }
}
]
}
diff --git a/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteReceive.json b/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteReceive.json
index c967aa542..8000df11d 100644
--- a/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteReceive.json
+++ b/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteReceive.json
@@ -3,9 +3,10 @@
"ipv4": {
"route": [
{
- "id": 1,
"destination-prefix": "192.168.2.1/24",
- "special-next-hop": "receive"
+ "next-hop": {
+ "special-next-hop-enum": "receive"
+ }
}
]
}
diff --git a/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteUnreachable.json b/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteUnreachable.json
index bae467fbd..b52982c47 100644
--- a/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteUnreachable.json
+++ b/routing/routing-impl/src/test/resources/ipv4/specialhop/specialHopRouteUnreachable.json
@@ -3,11 +3,12 @@
"ipv4": {
"route": [
{
- "id": 1,
"destination-prefix": "192.168.2.1/24",
- "special-next-hop": "unreachable"
+ "next-hop": {
+ "special-next-hop-enum": "unreachable"
+ }
}
]
}
}
-} \ No newline at end of file
+}
diff --git a/routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithClassifier.json b/routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithClassifier.json
index c8b1e208e..17fe9d67e 100644
--- a/routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithClassifier.json
+++ b/routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithClassifier.json
@@ -3,29 +3,30 @@
"ipv6": {
"route": [
{
- "id": 1,
"destination-prefix": "2001:0db8:0a0b:12f0:0000:0000:0000:0001/64",
"vpp-ipv6-route": {
"classify-table": "classify-table-one"
},
- "next-hop-list": {
- "next-hop": [
- {
- "id": "1",
- "address": "2001:0db8:0a0b:12f0:0000:0000:0000:0002",
- "outgoing-interface": "iface",
- "weight": "2"
- },
- {
- "id": "2",
- "address": "2001:0db8:0a0b:12f0:0000:0000:0000:0002",
- "outgoing-interface": "iface",
- "weight": "2"
- }
- ]
+ "next-hop": {
+ "next-hop-list": {
+ "next-hop": [
+ {
+ "index": "1",
+ "next-hop-address": "2001:0db8:0a0b:12f0:0000:0000:0000:0002",
+ "outgoing-interface": "iface",
+ "weight": "2"
+ },
+ {
+ "index": "2",
+ "next-hop-address": "2001:0db8:0a0b:12f0:0000:0000:0000:0002",
+ "outgoing-interface": "iface",
+ "weight": "2"
+ }
+ ]
+ }
}
}
]
}
}
-} \ No newline at end of file
+}
diff --git a/routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithoutClassifier.json b/routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithoutClassifier.json
index 2e44ebcf5..612db90c0 100644
--- a/routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithoutClassifier.json
+++ b/routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithoutClassifier.json
@@ -3,28 +3,29 @@
"ipv6": {
"route": [
{
- "id": 1,
"destination-prefix": "2001:0db8:0a0b:12f0:0000:0000:0000:0001/64",
"vpp-ipv6-route": {
},
- "next-hop-list": {
- "next-hop": [
- {
- "id": "1",
- "address": "2001:0db8:0a0b:12f0:0000:0000:0000:0002",
- "outgoing-interface": "iface",
- "weight": "2"
- },
- {
- "id": "2",
- "address": "2001:0db8:0a0b:12f0:0000:0000:0000:0002",
- "outgoing-interface": "iface",
- "weight": "2"
- }
- ]
+ "next-hop": {
+ "next-hop-list": {
+ "next-hop": [
+ {
+ "index": "1",
+ "next-hop-address": "2001:0db8:0a0b:12f0:0000:0000:0000:0002",
+ "outgoing-interface": "iface",
+ "weight": "2"
+ },
+ {
+ "index": "2",
+ "next-hop-address": "2001:0db8:0a0b:12f0:0000:0000:0000:0002",
+ "outgoing-interface": "iface",
+ "weight": "2"
+ }
+ ]
+ }
}
}
]
}
}
-} \ No newline at end of file
+}
diff --git a/routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithoutRouteAttrs.json b/routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithoutRouteAttrs.json
index f85b1b716..f34084238 100644
--- a/routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithoutRouteAttrs.json
+++ b/routing/routing-impl/src/test/resources/ipv6/multihop/multiHopRouteWithoutRouteAttrs.json
@@ -3,26 +3,27 @@
"ipv6": {
"route": [
{
- "id": 1,
"destination-prefix": "2001:0db8:0a0b:12f0:0000:0000:0000:0001/64",
- "next-hop-list": {
- "next-hop": [
- {
- "id": "1",
- "address": "2001:0db8:0a0b:12f0:0000:0000:0000:0002",
- "outgoing-interface": "iface",
- "weight": "2"
- },
- {
- "id": "2",
- "address": "2001:0db8:0a0b:12f0:0000:0000:0000:0002",
- "outgoing-interface": "iface",
- "weight": "2"
- }
- ]
+ "next-hop": {
+ "next-hop-list": {
+ "next-hop": [
+ {
+ "index": "1",
+ "next-hop-address": "2001:0db8:0a0b:12f0:0000:0000:0000:0002",
+ "outgoing-interface": "iface",
+ "weight": "2"
+ },
+ {
+ "index": "2",
+ "next-hop-address": "2001:0db8:0a0b:12f0:0000:0000:0000:0002",
+ "outgoing-interface": "iface",
+ "weight": "2"
+ }
+ ]
+ }
}
}
]
}
}
-} \ No newline at end of file
+}
diff --git a/routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithClassifier.json b/routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithClassifier.json
index c011a8d01..7f09a590e 100644
--- a/routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithClassifier.json
+++ b/routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithClassifier.json
@@ -3,15 +3,16 @@
"ipv6": {
"route": [
{
- "id": 1,
"destination-prefix": "2001:0db8:0a0b:12f0:0000:0000:0000:0001/64",
- "vpp-ipv6-route": {
- "classify-table": "classify-table-one"
+ "next-hop": {
+ "next-hop-address" : "2001:0db8:0a0b:12f0:0000:0000:0000:0002",
+ "outgoing-interface": "iface"
},
- "next-hop": "2001:0db8:0a0b:12f0:0000:0000:0000:0002",
- "outgoing-interface": "iface"
+ "vpp-ipv6-route" : {
+ "classify-table": "classify-table-one"
+ }
}
]
}
}
-} \ No newline at end of file
+}
diff --git a/routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithoutClassifier.json b/routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithoutClassifier.json
index 1cb663ca7..feca92c88 100644
--- a/routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithoutClassifier.json
+++ b/routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithoutClassifier.json
@@ -3,14 +3,15 @@
"ipv6": {
"route": [
{
- "id": 1,
"destination-prefix": "2001:0db8:0a0b:12f0:0000:0000:0000:0001/64",
- "vpp-ipv6-route": {
+ "next-hop": {
+ "next-hop-address" : "2001:0db8:0a0b:12f0:0000:0000:0000:0002",
+ "outgoing-interface": "iface"
},
- "next-hop": "2001:0db8:0a0b:12f0:0000:0000:0000:0002",
- "outgoing-interface": "iface"
+ "vpp-v6ur:vpp-ipv6-route": {
+ }
}
]
}
}
-} \ No newline at end of file
+}
diff --git a/routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithoutRouteAttrs.json b/routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithoutRouteAttrs.json
index a735c193c..fd66f2283 100644
--- a/routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithoutRouteAttrs.json
+++ b/routing/routing-impl/src/test/resources/ipv6/simplehop/simpleHopRouteWithoutRouteAttrs.json
@@ -3,12 +3,13 @@
"ipv6": {
"route": [
{
- "id": 1,
"destination-prefix": "2001:0db8:0a0b:12f0:0000:0000:0000:0001/64",
- "next-hop": "2001:0db8:0a0b:12f0:0000:0000:0000:0002",
- "outgoing-interface": "iface"
+ "next-hop": {
+ "next-hop-address" : "2001:0db8:0a0b:12f0:0000:0000:0000:0002",
+ "outgoing-interface": "iface"
+ }
}
]
}
}
-} \ No newline at end of file
+}
diff --git a/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteBlackhole.json b/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteBlackhole.json
index 1cc319107..43e8366ff 100644
--- a/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteBlackhole.json
+++ b/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteBlackhole.json
@@ -3,9 +3,10 @@
"ipv6": {
"route": [
{
- "id": 1,
- "destination-prefix": "2001:0db8:0a0b:12f0:0000:0000:0000:0001/24",
- "special-next-hop": "blackhole"
+ "destination-prefix": "2001:0db8:0a0b:12f0:0000:0000:0000:0001/64",
+ "next-hop": {
+ "special-next-hop-enum": "blackhole"
+ }
}
]
}
diff --git a/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteProhibited.json b/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteProhibited.json
index d69e817d7..e8f0a0e2e 100644
--- a/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteProhibited.json
+++ b/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteProhibited.json
@@ -3,9 +3,10 @@
"ipv6": {
"route": [
{
- "id": 1,
- "destination-prefix": "2001:0db8:0a0b:12f0:0000:0000:0000:0001/24",
- "special-next-hop": "prohibit"
+ "destination-prefix": "2001:0db8:0a0b:12f0:0000:0000:0000:0001/64",
+ "next-hop": {
+ "special-next-hop-enum": "prohibit"
+ }
}
]
}
diff --git a/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteReceive.json b/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteReceive.json
index 50d447de0..5296e3f01 100644
--- a/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteReceive.json
+++ b/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteReceive.json
@@ -3,9 +3,10 @@
"ipv6": {
"route": [
{
- "id": 1,
- "destination-prefix": "2001:0db8:0a0b:12f0:0000:0000:0000:0001/24",
- "special-next-hop": "receive"
+ "destination-prefix": "2001:0db8:0a0b:12f0:0000:0000:0000:0001/64",
+ "next-hop": {
+ "special-next-hop-enum": "receive"
+ }
}
]
}
diff --git a/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteUnreachable.json b/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteUnreachable.json
index c874549d1..2d351956d 100644
--- a/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteUnreachable.json
+++ b/routing/routing-impl/src/test/resources/ipv6/specialhop/specialHopRouteUnreachable.json
@@ -3,11 +3,12 @@
"ipv6": {
"route": [
{
- "id": 1,
- "destination-prefix": "2001:0db8:0a0b:12f0:0000:0000:0000:0001/24",
- "special-next-hop": "unreachable"
+ "destination-prefix": "2001:0db8:0a0b:12f0:0000:0000:0000:0001/64",
+ "next-hop": {
+ "special-next-hop-enum": "unreachable"
+ }
}
]
}
}
-} \ No newline at end of file
+}
diff --git a/routing/routing-impl/src/test/resources/ra/complexRa.json b/routing/routing-impl/src/test/resources/ra/complexRa.json
index 05079c656..5e9122354 100644
--- a/routing/routing-impl/src/test/resources/ra/complexRa.json
+++ b/routing/routing-impl/src/test/resources/ra/complexRa.json
@@ -3,14 +3,16 @@
"interface": [
{
"name": "eth0",
- "ipv6-router-advertisements": {
- "send-advertisements": "true",
- "min-rtr-adv-interval": "20",
- "max-rtr-adv-interval": "100",
- "default-lifetime": "601",
- "vpp-routing-ra:suppress-link-layer": "false",
- "vpp-routing-ra:initial-count": "2",
- "vpp-routing-ra:initial-interval": "15"
+ "ipv6" :{
+ "ipv6-router-advertisements": {
+ "send-advertisements": "true",
+ "min-rtr-adv-interval": "20",
+ "max-rtr-adv-interval": "100",
+ "default-lifetime": "601",
+ "vpp-routing-ra:suppress-link-layer": "false",
+ "vpp-routing-ra:initial-count": "2",
+ "vpp-routing-ra:initial-interval": "15"
+ }
}
}
]
diff --git a/routing/routing-impl/src/test/resources/ra/simpleRa.json b/routing/routing-impl/src/test/resources/ra/simpleRa.json
index 4a7ce3464..ef81309da 100644
--- a/routing/routing-impl/src/test/resources/ra/simpleRa.json
+++ b/routing/routing-impl/src/test/resources/ra/simpleRa.json
@@ -3,9 +3,11 @@
"interface": [
{
"name": "eth0",
- "ipv6-router-advertisements": {
- "send-advertisements": "true",
- "managed-flag": "true"
+ "ietf-ip:ipv6": {
+ "hc2vpp-ietf-ipv6-unicast-routing:ipv6-router-advertisements": {
+ "send-advertisements": "true",
+ "managed-flag": "true"
+ }
}
}
]
diff --git a/routing/routing-impl/src/test/resources/routing.json b/routing/routing-impl/src/test/resources/routing.json
index 95f85414f..2da6abc3e 100644
--- a/routing/routing-impl/src/test/resources/routing.json
+++ b/routing/routing-impl/src/test/resources/routing.json
@@ -1,4 +1,4 @@
{
- "default-routing-instance-name": "vpp-routing-instance",
+ "default-routing-id": "0.0.0.0",
"learned-route-name-prefix": "learned-route"
-} \ No newline at end of file
+}