From ec365fe22b9f52fce8daa667c0f0fa9cc25e64f6 Mon Sep 17 00:00:00 2001 From: Marek Gradzki Date: Mon, 2 Jul 2018 14:29:50 +0200 Subject: Fix VXLAN state read Use UnsignedInts.toLong instead of (long) cast. Change-Id: I1b6875860019f3449bc32f16cd959f3084583d20 Signed-off-by: Marek Gradzki --- .../v3po/interfacesstate/VxlanCustomizer.java | 2 +- .../v3po/interfacesstate/VxlanCustomizerTest.java | 45 ++++++++++++++-------- 2 files changed, 31 insertions(+), 16 deletions(-) (limited to 'v3po/v3po2vpp/src') diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizer.java index dac59d6f4..6cb94fd0d 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizer.java @@ -126,7 +126,7 @@ public class VxlanCustomizer extends FutureJVppCustomizer builder.setSrc(new IpAddress(arrayToIpv4AddressNoZone(swInterfaceVxlanDetails.srcAddress))); } builder.setEncapVrfId(new VniReference(UnsignedInts.toLong(swInterfaceVxlanDetails.encapVrfId))); - builder.setVni(new VxlanVni((long) swInterfaceVxlanDetails.vni)); + builder.setVni(new VxlanVni(UnsignedInts.toLong(swInterfaceVxlanDetails.vni))); switch (swInterfaceVxlanDetails.decapNextIndex) { case 1: builder.setDecapNext(L2Input.class); diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizerTest.java index f2384979e..f8ab8673b 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/VxlanCustomizerTest.java @@ -76,22 +76,11 @@ public class VxlanCustomizerTest extends ReaderCustomizerTest initCustomizer() { return new VxlanCustomizer(api, interfacesContext, dumpCacheManager); } + + private static VxlanTunnelDetailsReplyDump getVxlanTunnelDetailsReplyDump(final int encapVrfId) { + final VxlanTunnelDetailsReplyDump replyDump = new VxlanTunnelDetailsReplyDump(); + final VxlanTunnelDetails vxlanTunnelDetails = new VxlanTunnelDetails(); + vxlanTunnelDetails.isIpv6 = 0; + vxlanTunnelDetails.dstAddress = InetAddresses.forString("1.2.3.4").getAddress(); + vxlanTunnelDetails.srcAddress = InetAddresses.forString("1.2.3.5").getAddress(); + vxlanTunnelDetails.encapVrfId = encapVrfId; + vxlanTunnelDetails.swIfIndex = 0; + vxlanTunnelDetails.vni = 9; + vxlanTunnelDetails.decapNextIndex = 1; + replyDump.vxlanTunnelDetails = Lists.newArrayList(vxlanTunnelDetails); + return replyDump; + } } \ No newline at end of file -- cgit 1.2.3-korg