summaryrefslogtreecommitdiffstats
path: root/mpls/impl
diff options
context:
space:
mode:
authorMichal Cmarada <michal.cmarada@pantheon.tech>2018-05-11 12:16:10 +0200
committerMarek Gradzki <mgradzki@cisco.com>2018-05-11 11:02:10 +0000
commit149d172a8d41dc02bd9ae47ff5db76ba751900b4 (patch)
tree26f50ed162bfcc124627658350e8e49405e45f2e /mpls/impl
parent6e6b56482dddb1575820b62ae4a39b6006293e9a (diff)
HC2VPP-297 - MPLS model updates
This patch updates MPLS models to: - hc2vpp-ietf-mpls-static@2017-07-02.yang (draft at: https://tools.ietf.org/html/draft-ietf-mpls-static-yang-05) Due to odl bugs these models were changed, see HC2VPP-307 for more details. see mpls_postman_collection.json for examples and usage Summary of changes: - leaf operation in static-lsp->config was replaced with mpls-operations-type - paths were refactored and moved to static-lsp - outgoing-labels container was introduced in static-lsp->paths - MPLS docker demo was updated to reflect model changes Change-Id: I725ec5e4b3a1acea2aeabec41185949fc498ff26 Signed-off-by: Michal Cmarada <michal.cmarada@pantheon.tech>
Diffstat (limited to 'mpls/impl')
-rw-r--r--mpls/impl/src/main/java/io/fd/hc2vpp/mpls/ImposeAndForwardWriter.java57
-rw-r--r--mpls/impl/src/main/java/io/fd/hc2vpp/mpls/Ipv4LookupWriter.java5
-rw-r--r--mpls/impl/src/main/java/io/fd/hc2vpp/mpls/LspWriter.java2
-rw-r--r--mpls/impl/src/main/java/io/fd/hc2vpp/mpls/MplsInSegmentTranslator.java8
-rw-r--r--mpls/impl/src/main/java/io/fd/hc2vpp/mpls/MplsLookupWriter.java8
-rw-r--r--mpls/impl/src/main/java/io/fd/hc2vpp/mpls/MplsSwapWriter.java20
-rw-r--r--mpls/impl/src/main/java/io/fd/hc2vpp/mpls/MplsWriterFactory.java38
-rw-r--r--mpls/impl/src/main/java/io/fd/hc2vpp/mpls/StaticLspCustomizer.java19
-rw-r--r--mpls/impl/src/test/java/io/fd/hc2vpp/mpls/ImposeAndForwardTest.java120
-rw-r--r--mpls/impl/src/test/java/io/fd/hc2vpp/mpls/PopAndIpv4LookupTest.java32
-rw-r--r--mpls/impl/src/test/java/io/fd/hc2vpp/mpls/PopAndMplsLookupTest.java28
-rw-r--r--mpls/impl/src/test/java/io/fd/hc2vpp/mpls/SwapAndForwardTest.java49
12 files changed, 232 insertions, 154 deletions
diff --git a/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/ImposeAndForwardWriter.java b/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/ImposeAndForwardWriter.java
index 5e384305c..6a09b3eb7 100644
--- a/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/ImposeAndForwardWriter.java
+++ b/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/ImposeAndForwardWriter.java
@@ -31,21 +31,22 @@ import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
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.mpls._static.rev170310.StaticLspConfig.Operation;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp.Config;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.InSegment;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.OutSegment;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.in.segment.Type;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.in.segment.type.IpPrefix;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.out.segment.PathList;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.out.segment.SimplePath;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.out.segment.path.list.Paths;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls._static.lsps.StaticLsp;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.MplsOperationsType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.paths.OutSegment;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.paths.out.segment.MultiplePaths;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.paths.out.segment.SimplePath;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.paths.out.segment.multiple.paths.Paths;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.top.Config;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.in.segment.InSegment;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.in.segment_config.Type;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.in.segment_config.type.IpPrefix;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.path.outgoing.labels.outgoing.labels.OutgoingLabels;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls._static.lsps.StaticLsp;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev171204.MplsLabel;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
- * Translates {@link Operation#ImposeAndForward ImposeAndForward} operation to ip_add_del_route API.
+ * Translates {@link MplsOperationsType#ImposeAndForward ImposeAndForward} operation to ip_add_del_route API.
*
* @see <a href="https://git.fd.io/vpp/tree/src/vnet/ip/ip.api">ip_add_del_route</a> definition
*/
@@ -66,7 +67,7 @@ final class ImposeAndForwardWriter implements LspWriter, Ipv4Translator, MplsLab
request.isAdd = booleanToByte(isAdd);
translate(config.getInSegment(), request);
- translate(config.getOutSegment(), request, ctx);
+ translate(data.getOutSegment(), request, ctx);
// default values based on inspecting VPP's CLI and make test code
request.nextHopWeight = 1;
@@ -76,8 +77,9 @@ final class ImposeAndForwardWriter implements LspWriter, Ipv4Translator, MplsLab
}
private void translate(@Nonnull final InSegment inSegment, @Nonnull final IpAddDelRoute request) {
- checkArgument(inSegment != null, "Configuring impose-and-forward, but in-segment is missing.");
- final Type type = inSegment.getType();
+ checkArgument(inSegment.getConfig() != null,
+ "Configuring impose-and-forward, but in-segment config is missing.");
+ final Type type = inSegment.getConfig().getType();
checkArgument(type instanceof IpPrefix, "Only ip-prefix type is supported, but %s given.", type);
// TODO(HC2VPP-264): add support for mpls + v6
@@ -93,8 +95,8 @@ final class ImposeAndForwardWriter implements LspWriter, Ipv4Translator, MplsLab
final String outgoingInterface;
if (outSegment instanceof SimplePath) {
outgoingInterface = translate((SimplePath) outSegment, request);
- } else if (outSegment instanceof PathList) {
- outgoingInterface = translate((PathList) outSegment, request);
+ } else if (outSegment instanceof MultiplePaths) {
+ outgoingInterface = translate((MultiplePaths) outSegment, request);
} else {
throw new IllegalArgumentException("Unsupported out-segment type: " + outSegment);
}
@@ -104,7 +106,7 @@ final class ImposeAndForwardWriter implements LspWriter, Ipv4Translator, MplsLab
}
private String translate(@Nonnull final SimplePath path, @Nonnull final IpAddDelRoute request) {
- final IpAddress nextHop = path.getNextHop();
+ final IpAddress nextHop = path.getSimplePath().getConfig().getNextHop();
// TODO(HC2VPP-264): add support for mpls + v6
if (nextHop != null) {
@@ -115,18 +117,19 @@ final class ImposeAndForwardWriter implements LspWriter, Ipv4Translator, MplsLab
request.nextHopAddress = new byte[0];
}
- final MplsLabel outgoingLabel = path.getOutgoingLabel();
+ final MplsLabel outgoingLabel = path.getSimplePath().getConfig().getOutgoingLabel();
checkArgument(outgoingLabel != null, "Configuring impose-and-forward, but outgoing-label is missing.");
request.nextHopOutLabelStack = new FibMplsLabel[] {translate(outgoingLabel.getValue())};
request.nextHopNOutLabels = 1;
- return path.getOutgoingInterface();
+ return path.getSimplePath().getConfig().getOutgoingInterface();
}
- private String translate(@Nonnull final PathList pathList, @Nonnull final IpAddDelRoute request) {
- checkArgument(pathList.getPaths() != null && pathList.getPaths().size() == 1, "Only single path is supported");
- final Paths paths = pathList.getPaths().get(0);
- final IpAddress nextHop = paths.getNextHop();
+ private String translate(@Nonnull final MultiplePaths pathList, @Nonnull final IpAddDelRoute request) {
+ checkArgument(pathList.getPaths() != null && pathList.getPaths().getPath().size() == 1,
+ "Only single path is supported");
+ final Paths paths = pathList.getPaths();
+ final IpAddress nextHop = paths.getPath().get(0).getConfig().getNextHop();
// TODO(HC2VPP-264): add support for mpls + v6
if (nextHop != null) {
@@ -137,14 +140,14 @@ final class ImposeAndForwardWriter implements LspWriter, Ipv4Translator, MplsLab
request.nextHopAddress = new byte[0];
}
- final List<MplsLabel> labels = paths.getOutgoingLabels();
+ final List<OutgoingLabels> labels = paths.getOutgoingLabels().getOutgoingLabels();
final int numberOfLabels = labels.size();
checkArgument(numberOfLabels > 0 && numberOfLabels < MAX_LABELS, "Number of labels (%s) not in range (0, %s].",
numberOfLabels, MAX_LABELS, numberOfLabels);
request.nextHopNOutLabels = (byte) numberOfLabels;
- request.nextHopOutLabelStack =
- labels.stream().map(label -> translate(label.getValue())).toArray(FibMplsLabel[]::new);
+ request.nextHopOutLabelStack = labels.stream().map(label -> translate(label.getConfig().getLabel().getValue()))
+ .toArray(FibMplsLabel[]::new);
- return paths.getOutgoingInterface();
+ return paths.getPath().get(0).getConfig().getOutgoingInterface();
}
}
diff --git a/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/Ipv4LookupWriter.java b/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/Ipv4LookupWriter.java
index be26166d3..3b0be1fed 100644
--- a/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/Ipv4LookupWriter.java
+++ b/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/Ipv4LookupWriter.java
@@ -24,9 +24,8 @@ import io.fd.vpp.jvpp.core.dto.MplsRouteAddDel;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import io.fd.vpp.jvpp.core.types.FibMplsLabel;
import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.StaticLspConfig;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp.Config;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls._static.lsps.StaticLsp;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.top.Config;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls._static.lsps.StaticLsp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.mpls.rev171120.LookupType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.mpls.rev171120.StaticLspVppLookupAugmentation;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
diff --git a/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/LspWriter.java b/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/LspWriter.java
index 0e68f0c40..7a67b26db 100644
--- a/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/LspWriter.java
+++ b/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/LspWriter.java
@@ -21,7 +21,7 @@ import io.fd.hc2vpp.common.translate.util.JvppReplyConsumer;
import io.fd.honeycomb.translate.MappingContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls._static.lsps.StaticLsp;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls._static.lsps.StaticLsp;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
diff --git a/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/MplsInSegmentTranslator.java b/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/MplsInSegmentTranslator.java
index 9f531bba4..e15e50a7d 100644
--- a/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/MplsInSegmentTranslator.java
+++ b/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/MplsInSegmentTranslator.java
@@ -20,9 +20,9 @@ import static com.google.common.base.Preconditions.checkArgument;
import io.fd.vpp.jvpp.core.dto.MplsRouteAddDel;
import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.InSegment;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.in.segment.Type;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.in.segment.type.MplsLabel;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.in.segment.InSegment;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.in.segment_config.Type;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.in.segment_config.type.MplsLabel;
/**
* Mixin that translates {@link InSegment} of {@link MplsLabel} type to {@link MplsRouteAddDel} message.
@@ -30,7 +30,7 @@ import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._stati
interface MplsInSegmentTranslator {
default void translate(@Nonnull final InSegment inSegment, @Nonnull final MplsRouteAddDel request) {
checkArgument(inSegment != null, "Missing in-segment");
- final Type type = inSegment.getType();
+ final Type type = inSegment.getConfig().getType();
checkArgument(type instanceof MplsLabel, "Expecting in-segment of type mpls-label, but %s given.", type);
final Long label = ((MplsLabel) type).getIncomingLabel().getValue();
request.mrLabel = label.intValue();
diff --git a/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/MplsLookupWriter.java b/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/MplsLookupWriter.java
index 86e7bdee1..c42aedd27 100644
--- a/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/MplsLookupWriter.java
+++ b/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/MplsLookupWriter.java
@@ -24,15 +24,15 @@ import io.fd.vpp.jvpp.core.dto.MplsRouteAddDel;
import io.fd.vpp.jvpp.core.future.FutureJVppCore;
import io.fd.vpp.jvpp.core.types.FibMplsLabel;
import javax.annotation.Nonnull;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.StaticLspConfig;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp.Config;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls._static.lsps.StaticLsp;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.MplsOperationsType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.top.Config;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls._static.lsps.StaticLsp;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.mpls.rev171120.LookupType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.mpls.rev171120.StaticLspVppLookupAugmentation;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
- * Translates {@link StaticLspConfig.Operation#PopAndLookup} operation with {@link LookupType#Mpls} to
+ * Translates {@link MplsOperationsType#PopAndLookup} operation with {@link LookupType#Mpls} to
* mpls_route_add_del API.
*
* @see <a href="https://git.fd.io/vpp/tree/src/vnet/mpls/mpls.api">mpls_route_add_del</a> definition
diff --git a/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/MplsSwapWriter.java b/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/MplsSwapWriter.java
index 72d9c65ae..c8b47b8da 100644
--- a/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/MplsSwapWriter.java
+++ b/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/MplsSwapWriter.java
@@ -29,16 +29,16 @@ import io.fd.vpp.jvpp.core.types.FibMplsLabel;
import javax.annotation.Nonnull;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
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.mpls._static.rev170310.StaticLspConfig;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp.Config;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.OutSegment;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.out.segment.SimplePath;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls._static.lsps.StaticLsp;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.MplsOperationsType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.paths.OutSegment;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.paths.out.segment.SimplePath;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.top.Config;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls._static.lsps.StaticLsp;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.types.rev171204.MplsLabel;
import org.opendaylight.yangtools.yang.binding.InstanceIdentifier;
/**
- * Translates {@link StaticLspConfig.Operation#SwapAndForward} operation to mpls_route_add_del API.
+ * Translates {@link MplsOperationsType#SwapAndForward} operation to mpls_route_add_del API.
*
* @see <a href="https://git.fd.io/vpp/tree/src/vnet/mpls/mpls.api">mpls_route_add_del</a> definition
*/
@@ -61,7 +61,7 @@ final class MplsSwapWriter implements LspWriter, Ipv4Translator, MplsInSegmentTr
request.mrEos = 1; // only SWAP for the last label in the stack is currently supported
translate(config.getInSegment(), request);
- translate(config.getOutSegment(), request, ctx);
+ translate(data.getOutSegment(), request, ctx);
// default values based on inspecting VPP's CLI and make test code
request.mrClassifyTableIndex = -1;
@@ -75,7 +75,7 @@ final class MplsSwapWriter implements LspWriter, Ipv4Translator, MplsInSegmentTr
@Nonnull final MappingContext ctx) {
checkArgument(outSegment instanceof SimplePath, "Unsupported out-segment type: %s", outSegment);
final SimplePath path = (SimplePath) outSegment;
- final IpAddress nextHop = path.getNextHop();
+ final IpAddress nextHop = path.getSimplePath().getConfig().getNextHop();
checkArgument(nextHop != null, "Configuring swap-and-forward, but next-hop is missing.");
// TODO(HC2VPP-264): add support for mpls + v6
@@ -83,12 +83,12 @@ final class MplsSwapWriter implements LspWriter, Ipv4Translator, MplsInSegmentTr
checkArgument(address != null, "Only IPv4 next-hop address is supported.");
request.mrNextHop = ipv4AddressNoZoneToArray(address.getValue());
- final MplsLabel outgoingLabel = path.getOutgoingLabel();
+ final MplsLabel outgoingLabel = path.getSimplePath().getConfig().getOutgoingLabel();
checkArgument(outgoingLabel != null, "Configuring swap-and-forward, but outgoing-label is missing.");
request.mrNextHopOutLabelStack = new FibMplsLabel[] {translate(outgoingLabel.getValue())};
request.mrNextHopNOutLabels = 1;
- final String outgoingInterface = path.getOutgoingInterface();
+ final String outgoingInterface = path.getSimplePath().getConfig().getOutgoingInterface();
checkArgument(outgoingInterface != null, "Configuring swap-and-forward, but outgoing-interface is missing.");
request.mrNextHopSwIfIndex = interfaceContext.getIndex(outgoingInterface, ctx);
}
diff --git a/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/MplsWriterFactory.java b/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/MplsWriterFactory.java
index d81d6fae3..475a06288 100644
--- a/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/MplsWriterFactory.java
+++ b/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/MplsWriterFactory.java
@@ -27,12 +27,15 @@ import io.fd.honeycomb.translate.write.registry.ModifiableWriterRegistryBuilder;
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.interfaces.rev140508.Interfaces;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.Mpls1;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp.Config;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.InSegment;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.out.segment.path.list.Paths;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls.StaticLsps;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls._static.lsps.StaticLsp;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.Mpls1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.paths.out.segment.multiple.paths.paths.Path;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.paths.out.segment.simple.path.SimplePath;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.paths.out.segment.multiple.paths.Paths;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.top.Config;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.in.segment.InSegment;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.path.outgoing.labels.OutgoingLabels;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls.StaticLsps;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls._static.lsps.StaticLsp;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls.rev170702.Routing1;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls.rev170702.interfaces.mpls.Interface;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls.rev170702.routing.Mpls;
@@ -80,10 +83,27 @@ final class MplsWriterFactory implements WriterFactory {
// First enable MPLS on interface, then configure it:
registry.subtreeAddAfter(
ImmutableSet
- .of(CONFIG_ID, InstanceIdentifier.create(StaticLsp.class).child(Config.class).child(InSegment.class),
- InstanceIdentifier.create(StaticLsp.class).child(Config.class).child(Paths.class),
+ .of(CONFIG_ID,
+ InstanceIdentifier.create(StaticLsp.class).child(Config.class).child(InSegment.class),
+ InstanceIdentifier.create(StaticLsp.class)
+ .child(Config.class)
+ .child(InSegment.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.in.segment.in.segment.Config.class),
InstanceIdentifier.create(StaticLsp.class).child(Config.class)
- .augmentation(StaticLspVppLookupAugmentation.class).child(LabelLookup.class)),
+ .augmentation(StaticLspVppLookupAugmentation.class).child(LabelLookup.class),
+ InstanceIdentifier.create(StaticLsp.class).child(Paths.class),
+ InstanceIdentifier.create(StaticLsp.class).child(Paths.class).child(OutgoingLabels.class),
+ InstanceIdentifier.create(StaticLsp.class).child(Paths.class).child(OutgoingLabels.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.path.outgoing.labels.outgoing.labels.OutgoingLabels.class),
+ InstanceIdentifier.create(StaticLsp.class).child(Paths.class).child(OutgoingLabels.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.path.outgoing.labels.outgoing.labels.OutgoingLabels.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.path.outgoing.labels.outgoing.labels.outgoing.labels.Config.class),
+ InstanceIdentifier.create(StaticLsp.class).child(Paths.class).child(Path.class),
+ InstanceIdentifier.create(StaticLsp.class).child(Paths.class).child(Path.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.paths.out.segment.multiple.paths.paths.path.Config.class),
+ InstanceIdentifier.create(StaticLsp.class).child(SimplePath.class),
+ InstanceIdentifier.create(StaticLsp.class).child(SimplePath.class)
+ .child(org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.paths.out.segment.simple.path.simple.path.Config.class)),
new GenericWriter<>(STATIC_LSP_ID, new StaticLspCustomizer(vppApi, ifcContext)),
INTERFACE_ID);
}
diff --git a/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/StaticLspCustomizer.java b/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/StaticLspCustomizer.java
index 6aab1ed42..b97a36974 100644
--- a/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/StaticLspCustomizer.java
+++ b/mpls/impl/src/main/java/io/fd/hc2vpp/mpls/StaticLspCustomizer.java
@@ -18,9 +18,9 @@ package io.fd.hc2vpp.mpls;
import static com.google.common.base.Preconditions.checkArgument;
import static com.google.common.base.Preconditions.checkNotNull;
-import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.StaticLspConfig.Operation.ImposeAndForward;
-import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.StaticLspConfig.Operation.PopAndLookup;
-import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.StaticLspConfig.Operation.SwapAndForward;
+import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.MplsOperationsType.ImposeAndForward;
+import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.MplsOperationsType.PopAndLookup;
+import static org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.MplsOperationsType.SwapAndForward;
import io.fd.hc2vpp.common.translate.util.NamingContext;
import io.fd.honeycomb.translate.MappingContext;
@@ -29,10 +29,11 @@ import io.fd.honeycomb.translate.write.WriteContext;
import io.fd.honeycomb.translate.write.WriteFailedException;
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.mpls._static.rev170310.StaticLspConfig;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp.Config;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls._static.lsps.StaticLsp;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls._static.lsps.StaticLspKey;
+
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.MplsOperationsType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.top.Config;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls._static.lsps.StaticLsp;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls._static.lsps.StaticLspKey;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.mpls.rev171120.LookupType;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.mpls.rev171120.StaticLspVppLookupAugmentation;
import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.vpp.mpls.rev171120.VppLabelLookupAttributes;
@@ -41,7 +42,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
- * Selects specific {@link LspWriter} based on {@link StaticLspConfig.Operation} and {@link LookupType}.
+ * Selects specific {@link LspWriter} based on {@link MplsOperationsType} and {@link LookupType}.
*/
final class StaticLspCustomizer implements ListWriterCustomizer<StaticLsp, StaticLspKey>, LspWriter {
private static final Logger LOG = LoggerFactory.getLogger(StaticLspCustomizer.class);
@@ -93,7 +94,7 @@ final class StaticLspCustomizer implements ListWriterCustomizer<StaticLsp, Stati
@Nonnull final MappingContext ctx, final boolean isAdd) throws WriteFailedException {
final Config config = data.getConfig();
checkArgument(config != null, "Config node of static-lsp is missing.");
- final StaticLspConfig.Operation operation = config.getOperation();
+ final MplsOperationsType operation = config.getOperation();
if (ImposeAndForward.equals(operation)) {
imposeAndForward.write(id, data, ctx, isAdd);
} else if (PopAndLookup.equals(operation)) {
diff --git a/mpls/impl/src/test/java/io/fd/hc2vpp/mpls/ImposeAndForwardTest.java b/mpls/impl/src/test/java/io/fd/hc2vpp/mpls/ImposeAndForwardTest.java
index ca687b502..12312af37 100644
--- a/mpls/impl/src/test/java/io/fd/hc2vpp/mpls/ImposeAndForwardTest.java
+++ b/mpls/impl/src/test/java/io/fd/hc2vpp/mpls/ImposeAndForwardTest.java
@@ -36,18 +36,20 @@ import org.junit.Test;
import org.mockito.Mock;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddress;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.Mpls1;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.StaticLspConfig;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp.ConfigBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.InSegmentBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.in.segment.type.IpPrefixBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.out.segment.PathListBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.out.segment.SimplePathBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.out.segment.path.list.PathsBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls.StaticLsps;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls._static.lsps.StaticLsp;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls._static.lsps.StaticLspBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls._static.lsps.StaticLspKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.Mpls1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.MplsOperationsType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.paths.out.segment.MultiplePathsBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.paths.out.segment.multiple.paths.PathsBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.paths.out.segment.multiple.paths.paths.PathBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.paths.out.segment.simple.path.SimplePathBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.top.ConfigBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.in.segment.InSegmentBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.in.segment_config.type.IpPrefixBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.path.outgoing.labels.OutgoingLabelsBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls.StaticLsps;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls._static.lsps.StaticLsp;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls._static.lsps.StaticLspBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls._static.lsps.StaticLspKey;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls.rev170702.Routing1;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls.rev170702.routing.Mpls;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.Routing;
@@ -73,44 +75,76 @@ public class ImposeAndForwardTest extends WriterCustomizerTest implements ByteDa
private static StaticLsp getSimpleLsp(final long label) {
return getSimpleLsp(label, IpAddressBuilder.getDefaultInstance("5.6.7.8"));
}
- private static StaticLsp getSimpleLsp(final long label,
- final IpAddress nextHop) {
- return new StaticLspBuilder()
- .setName(LSP_NAME)
- .setConfig(new ConfigBuilder()
- .setInSegment(new InSegmentBuilder()
- .setType(new IpPrefixBuilder().setIpPrefix(getDefaultInstance("1.2.3.4/24"))
- .build())
- .build()
- )
- .setOperation(StaticLspConfig.Operation.ImposeAndForward)
- .setOutSegment(new SimplePathBuilder()
- .setNextHop(nextHop)
- .setOutgoingInterface(IF_NAME)
- .setOutgoingLabel(new MplsLabel(label))
+
+ private static StaticLsp getSimpleLsp(final long label, final IpAddress nextHop) {
+ return new StaticLspBuilder().setName(LSP_NAME)
+ .setConfig(new ConfigBuilder().setInSegment(new InSegmentBuilder().setConfig(
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.in.segment.in.segment.ConfigBuilder()
+ .setType(new IpPrefixBuilder().setIpPrefix(getDefaultInstance("1.2.3.4/24")).build())
+ .build())
+ .build())
+ .setOperation(MplsOperationsType.ImposeAndForward)
+ .build())
+ .setOutSegment(
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.paths.out.segment.SimplePathBuilder()
+ .setSimplePath(new SimplePathBuilder().setConfig(
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.paths.out.segment.simple.path.simple.path.ConfigBuilder()
+ .setNextHop(nextHop)
+ .setOutgoingInterface(IF_NAME)
+ .setOutgoingLabel(new MplsLabel(label))
+ .build()).build())
.build())
- .build())
.build();
}
private static StaticLsp getComplexLsp() {
- return new StaticLspBuilder()
- .setName(LSP_NAME)
- .setConfig(new ConfigBuilder()
- .setInSegment(new InSegmentBuilder()
- .setType(new IpPrefixBuilder().setIpPrefix(getDefaultInstance("10.10.24.0/24"))
+ return new StaticLspBuilder().setName(LSP_NAME)
+ .setConfig(
+ new ConfigBuilder()
+ .setInSegment(
+ new InSegmentBuilder()
+ .setConfig(
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.in.segment.in.segment.ConfigBuilder()
+ .setType(
+ new IpPrefixBuilder()
+ .setIpPrefix(getDefaultInstance("10.10.24.0/24"))
+ .build())
+ .build())
+ .build())
+ .setOperation(MplsOperationsType.ImposeAndForward)
+ .build())
+ .setOutSegment(
+ new MultiplePathsBuilder()
+ .setPaths(
+ new PathsBuilder()
+ .setPath(
+ Collections.singletonList(new PathBuilder()
+ .setConfig(
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.paths.out.segment.multiple.paths.paths.path.ConfigBuilder()
+ .setNextHop(
+ IpAddressBuilder
+ .getDefaultInstance("10.10.12.2"))
+ .setOutgoingInterface(IF_NAME)
+
+ .build()).build()))
+ .setOutgoingLabels(
+ new OutgoingLabelsBuilder()
+ .setOutgoingLabels(Arrays.asList(
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.path.outgoing.labels.outgoing.labels.OutgoingLabelsBuilder()
+ .setIndex((short) 0)
+ .setConfig(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.path.outgoing.labels.outgoing.labels.outgoing.labels.ConfigBuilder()
+ .setLabel(new MplsLabel(102L))
+ .build())
+ .build(),
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.path.outgoing.labels.outgoing.labels.OutgoingLabelsBuilder()
+ .setIndex((short) 1)
+ .setConfig(new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.path.outgoing.labels.outgoing.labels.outgoing.labels.ConfigBuilder()
+ .setLabel(new MplsLabel(104L))
+ .build())
+ .build()))
+ .build())
.build())
- .build()
- )
- .setOperation(StaticLspConfig.Operation.ImposeAndForward)
- .setOutSegment(new PathListBuilder()
- .setPaths(Collections.singletonList(new PathsBuilder()
- .setNextHop(IpAddressBuilder.getDefaultInstance("10.10.12.2"))
- .setOutgoingInterface(IF_NAME)
- .setOutgoingLabels(Arrays.asList(new MplsLabel(102L), new MplsLabel(104L)))
- .build()))
.build())
- .build())
.build();
}
diff --git a/mpls/impl/src/test/java/io/fd/hc2vpp/mpls/PopAndIpv4LookupTest.java b/mpls/impl/src/test/java/io/fd/hc2vpp/mpls/PopAndIpv4LookupTest.java
index 434f3b91d..627c3294f 100644
--- a/mpls/impl/src/test/java/io/fd/hc2vpp/mpls/PopAndIpv4LookupTest.java
+++ b/mpls/impl/src/test/java/io/fd/hc2vpp/mpls/PopAndIpv4LookupTest.java
@@ -30,15 +30,15 @@ import io.fd.vpp.jvpp.core.future.FutureJVppCoreFacade;
import io.fd.vpp.jvpp.core.types.FibMplsLabel;
import org.junit.Test;
import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.Mpls1;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.StaticLspConfig;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp.ConfigBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.InSegmentBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.in.segment.type.MplsLabelBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls.StaticLsps;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls._static.lsps.StaticLsp;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls._static.lsps.StaticLspBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls._static.lsps.StaticLspKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.Mpls1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.MplsOperationsType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.top.ConfigBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.in.segment.InSegmentBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.in.segment_config.type.MplsLabelBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls.StaticLsps;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls._static.lsps.StaticLsp;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls._static.lsps.StaticLspBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls._static.lsps.StaticLspKey;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls.rev170702.Routing1;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls.rev170702.routing.Mpls;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.Routing;
@@ -72,12 +72,18 @@ public class PopAndIpv4LookupTest extends WriterCustomizerTest implements ByteDa
return new StaticLspBuilder()
.setName(LSP_NAME)
.setConfig(new ConfigBuilder()
- .setInSegment(new InSegmentBuilder()
- .setType(new MplsLabelBuilder().setIncomingLabel(new MplsLabel((long) LOCAL_LABEL))
- .build())
+ .setInSegment(
+ new InSegmentBuilder()
+ .setConfig(
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.in.segment.in.segment.ConfigBuilder()
+ .setType(new MplsLabelBuilder()
+ .setIncomingLabel(new MplsLabel((long) LOCAL_LABEL))
+ .build())
+ .build())
+
.build()
)
- .setOperation(StaticLspConfig.Operation.PopAndLookup)
+ .setOperation(MplsOperationsType.PopAndLookup)
.addAugmentation(StaticLspVppLookupAugmentation.class,
new StaticLspVppLookupAugmentationBuilder()
.setLabelLookup(new LabelLookupBuilder()
diff --git a/mpls/impl/src/test/java/io/fd/hc2vpp/mpls/PopAndMplsLookupTest.java b/mpls/impl/src/test/java/io/fd/hc2vpp/mpls/PopAndMplsLookupTest.java
index a6bc3432a..ab069100b 100644
--- a/mpls/impl/src/test/java/io/fd/hc2vpp/mpls/PopAndMplsLookupTest.java
+++ b/mpls/impl/src/test/java/io/fd/hc2vpp/mpls/PopAndMplsLookupTest.java
@@ -30,15 +30,15 @@ import io.fd.vpp.jvpp.core.future.FutureJVppCoreFacade;
import io.fd.vpp.jvpp.core.types.FibMplsLabel;
import org.junit.Test;
import org.mockito.Mock;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.Mpls1;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.StaticLspConfig;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp.ConfigBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.InSegmentBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.in.segment.type.MplsLabelBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls.StaticLsps;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls._static.lsps.StaticLsp;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls._static.lsps.StaticLspBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls._static.lsps.StaticLspKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.Mpls1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.MplsOperationsType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.top.ConfigBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.in.segment.InSegmentBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.in.segment_config.type.MplsLabelBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls.StaticLsps;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls._static.lsps.StaticLsp;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls._static.lsps.StaticLspBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls._static.lsps.StaticLspKey;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls.rev170702.Routing1;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls.rev170702.routing.Mpls;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.Routing;
@@ -72,12 +72,16 @@ public class PopAndMplsLookupTest extends WriterCustomizerTest implements ByteDa
return new StaticLspBuilder()
.setName(LSP_NAME)
.setConfig(new ConfigBuilder()
- .setInSegment(new InSegmentBuilder()
- .setType(new MplsLabelBuilder().setIncomingLabel(new MplsLabel((long) LOCAL_LABEL))
+ .setInSegment(new InSegmentBuilder().setConfig(
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.in.segment.in.segment.ConfigBuilder()
+ .setType(
+ new MplsLabelBuilder()
+ .setIncomingLabel(new MplsLabel((long) LOCAL_LABEL))
+ .build())
.build())
.build()
)
- .setOperation(StaticLspConfig.Operation.PopAndLookup)
+ .setOperation(MplsOperationsType.PopAndLookup)
.addAugmentation(StaticLspVppLookupAugmentation.class,
new StaticLspVppLookupAugmentationBuilder()
.setLabelLookup(new LabelLookupBuilder()
diff --git a/mpls/impl/src/test/java/io/fd/hc2vpp/mpls/SwapAndForwardTest.java b/mpls/impl/src/test/java/io/fd/hc2vpp/mpls/SwapAndForwardTest.java
index 4a962dd9f..677bb0914 100644
--- a/mpls/impl/src/test/java/io/fd/hc2vpp/mpls/SwapAndForwardTest.java
+++ b/mpls/impl/src/test/java/io/fd/hc2vpp/mpls/SwapAndForwardTest.java
@@ -32,16 +32,16 @@ import io.fd.vpp.jvpp.core.types.FibMplsLabel;
import org.junit.Test;
import org.mockito.Mock;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpAddressBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.Mpls1;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.StaticLspConfig;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp.ConfigBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.InSegmentBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.in.segment.type.MplsLabelBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310._static.lsp_config.out.segment.SimplePathBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls.StaticLsps;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls._static.lsps.StaticLsp;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls._static.lsps.StaticLspBuilder;
-import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170310.routing.mpls._static.lsps.StaticLspKey;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.Mpls1;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.MplsOperationsType;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.paths.out.segment.SimplePathBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.top.ConfigBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.in.segment.InSegmentBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.in.segment_config.type.MplsLabelBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls.StaticLsps;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls._static.lsps.StaticLsp;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls._static.lsps.StaticLspBuilder;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.routing.mpls._static.lsps.StaticLspKey;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls.rev170702.Routing1;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls.rev170702.routing.Mpls;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.routing.rev180313.Routing;
@@ -73,18 +73,29 @@ public class SwapAndForwardTest extends WriterCustomizerTest implements ByteData
return new StaticLspBuilder()
.setName(LSP_NAME)
.setConfig(new ConfigBuilder()
- .setInSegment(new InSegmentBuilder()
- .setType(new MplsLabelBuilder().setIncomingLabel(new MplsLabel((long) LOCAL_LABEL))
- .build())
+ .setInSegment(
+ new InSegmentBuilder()
+ .setConfig(
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702.in.segment.in.segment.ConfigBuilder()
+ .setType(new MplsLabelBuilder().setIncomingLabel(new MplsLabel((long) LOCAL_LABEL))
+ .build())
+ .build())
.build()
)
- .setOperation(StaticLspConfig.Operation.SwapAndForward)
- .setOutSegment(new SimplePathBuilder()
- .setNextHop(IpAddressBuilder.getDefaultInstance("10.10.24.4"))
- .setOutgoingInterface(IF_NAME)
- .setOutgoingLabel(new MplsLabel((long) OUT_LABEL))
- .build())
+ .setOperation(MplsOperationsType.SwapAndForward)
.build())
+ .setOutSegment(
+ new SimplePathBuilder()
+ .setSimplePath(
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.paths.out.segment.simple.path.SimplePathBuilder()
+ .setConfig(
+ new org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.mpls._static.rev170702._static.lsp.paths.out.segment.simple.path.simple.path.ConfigBuilder()
+ .setNextHop(IpAddressBuilder.getDefaultInstance("10.10.24.4"))
+ .setOutgoingInterface(IF_NAME)
+ .setOutgoingLabel(new MplsLabel((long) OUT_LABEL))
+ .build())
+ .build())
+ .build())
.build();
}