diff options
Diffstat (limited to 'bgp/bgp-prefix-sid')
3 files changed, 14 insertions, 5 deletions
diff --git a/bgp/bgp-prefix-sid/src/main/java/io/fd/hc2vpp/bgp/prefix/sid/IpRouteRequestProducer.java b/bgp/bgp-prefix-sid/src/main/java/io/fd/hc2vpp/bgp/prefix/sid/IpRouteRequestProducer.java index 4093a040b..865993d5e 100644 --- a/bgp/bgp-prefix-sid/src/main/java/io/fd/hc2vpp/bgp/prefix/sid/IpRouteRequestProducer.java +++ b/bgp/bgp-prefix-sid/src/main/java/io/fd/hc2vpp/bgp/prefix/sid/IpRouteRequestProducer.java @@ -20,7 +20,9 @@ import static com.google.common.base.Preconditions.checkArgument; import static io.fd.hc2vpp.bgp.prefix.sid.MplsRouteRequestProducer.MPLS_LABEL_INVALID; import io.fd.hc2vpp.common.translate.util.Ipv4Translator; +import io.fd.hc2vpp.common.translate.util.MplsLabelTranslator; import io.fd.vpp.jvpp.core.dto.IpAddDelRoute; +import io.fd.vpp.jvpp.core.types.FibMplsLabel; import java.util.List; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.IpPrefix; @@ -102,7 +104,7 @@ interface IpRouteRequestProducer { // TODO(HC2VPP-271): add support for special labels, e.g. implicit null (for PHP). // Push label received via BGP on packets destined to the prefix it was assigned to: - request.nextHopOutLabelStack = new int[] {label}; + request.nextHopOutLabelStack = new FibMplsLabel[] {MplsLabelTranslator.INSTANCE.translate(label)}; request.nextHopNOutLabels = 1; } } diff --git a/bgp/bgp-prefix-sid/src/main/java/io/fd/hc2vpp/bgp/prefix/sid/MplsRouteRequestProducer.java b/bgp/bgp-prefix-sid/src/main/java/io/fd/hc2vpp/bgp/prefix/sid/MplsRouteRequestProducer.java index 659cb991f..83a07a993 100644 --- a/bgp/bgp-prefix-sid/src/main/java/io/fd/hc2vpp/bgp/prefix/sid/MplsRouteRequestProducer.java +++ b/bgp/bgp-prefix-sid/src/main/java/io/fd/hc2vpp/bgp/prefix/sid/MplsRouteRequestProducer.java @@ -19,7 +19,9 @@ package io.fd.hc2vpp.bgp.prefix.sid; import static com.google.common.base.Preconditions.checkArgument; import io.fd.hc2vpp.common.translate.util.Ipv4Translator; +import io.fd.hc2vpp.common.translate.util.MplsLabelTranslator; import io.fd.vpp.jvpp.core.dto.MplsRouteAddDel; +import io.fd.vpp.jvpp.core.types.FibMplsLabel; import java.util.List; import javax.annotation.Nonnull; import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4Address; @@ -63,7 +65,7 @@ interface MplsRouteRequestProducer extends Ipv4Translator { return request; } - final class Impl implements Ipv4Translator { + final class Impl implements Ipv4Translator, MplsLabelTranslator { private static MplsRouteAddDel mplsRouteAddDel(final boolean isAdd) { final MplsRouteAddDel request = new MplsRouteAddDel(); request.mrIsAdd = Ipv4Translator.INSTANCE.booleanToByte(isAdd); @@ -145,7 +147,7 @@ interface MplsRouteRequestProducer extends Ipv4Translator { // TODO(HC2VPP-271): add support for special labels, e.g. implicit null (for PHP). // swap one label to another - request.mrNextHopOutLabelStack = new int[] {label}; + request.mrNextHopOutLabelStack = new FibMplsLabel[] {MplsLabelTranslator.INSTANCE.translate(label)}; request.mrNextHopNOutLabels = 1; } } diff --git a/bgp/bgp-prefix-sid/src/test/java/io/fd/hc2vpp/bgp/prefix/sid/BgpPrefixSidMplsWriterTest.java b/bgp/bgp-prefix-sid/src/test/java/io/fd/hc2vpp/bgp/prefix/sid/BgpPrefixSidMplsWriterTest.java index 93b6ac66c..aefd74af2 100644 --- a/bgp/bgp-prefix-sid/src/test/java/io/fd/hc2vpp/bgp/prefix/sid/BgpPrefixSidMplsWriterTest.java +++ b/bgp/bgp-prefix-sid/src/test/java/io/fd/hc2vpp/bgp/prefix/sid/BgpPrefixSidMplsWriterTest.java @@ -35,6 +35,7 @@ import io.fd.vpp.jvpp.core.dto.IpAddDelRouteReply; import io.fd.vpp.jvpp.core.dto.MplsRouteAddDel; import io.fd.vpp.jvpp.core.dto.MplsRouteAddDelReply; import io.fd.vpp.jvpp.core.future.FutureJVppCore; +import io.fd.vpp.jvpp.core.types.FibMplsLabel; import java.util.Collections; import org.junit.Before; import org.junit.Test; @@ -189,7 +190,9 @@ public class BgpPrefixSidMplsWriterTest implements FutureProducer, ByteDataTrans request.mrLabel = 16102; - request.mrNextHopOutLabelStack = new int[] {16101}; + final FibMplsLabel mplsLabel = new FibMplsLabel(); + mplsLabel.label = 16101; + request.mrNextHopOutLabelStack = new FibMplsLabel[] {mplsLabel}; request.mrNextHopNOutLabels = 1; request.mrEos = booleanToByte(isEos); @@ -209,7 +212,9 @@ public class BgpPrefixSidMplsWriterTest implements FutureProducer, ByteDataTrans request.nextHopAddress = new byte[] {5, 6, 7, 8}; request.nextHopSwIfIndex = -1; - request.nextHopOutLabelStack = new int[] {16101}; + final FibMplsLabel mplsLabel = new FibMplsLabel(); + mplsLabel.label = 16101; + request.nextHopOutLabelStack = new FibMplsLabel[] {mplsLabel}; request.nextHopNOutLabels = 1; return request; } |