diff options
author | Marek Gradzki <mgradzki@cisco.com> | 2016-11-21 08:52:48 +0100 |
---|---|---|
committer | Jan Srnicek <jsrnicek@cisco.com> | 2016-11-23 13:45:58 +0000 |
commit | 294d0ea77bd20d580405cc1470dc9a1078be7a5c (patch) | |
tree | 6457b44d889290a685fa20c017737fcccea8677e /v3po/v3po2vpp/src | |
parent | 563a9c165740e59aa08bb3ba5eef123abfaed805 (diff) |
Update IP4 address read order after VPP change (3816)
Change-Id: I2e4a555ca8373b8bed9bf00d4a61fd59b1810bbc
Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/v3po2vpp/src')
5 files changed, 20 insertions, 34 deletions
diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/Ipv4AddressCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/Ipv4AddressCustomizer.java index 4a577ae60..a71c0061e 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/Ipv4AddressCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/Ipv4AddressCustomizer.java @@ -101,7 +101,7 @@ public class Ipv4AddressCustomizer extends FutureJVppCustomizer if (ipAddressDetails.isPresent()) { final IpAddressDetails detail = ipAddressDetails.get(); - builder.setIp(arrayToIpv4AddressNoZone(detail.ip)) + builder.setIp(arrayToIpv4AddressNoZoneReversed(detail.ip)) .setSubnet( new PrefixLengthBuilder().setPrefixLength(Short.valueOf(detail.prefixLength)).build()); diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/Ipv4Reader.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/Ipv4Reader.java index 729ca097d..4caaa5922 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/Ipv4Reader.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/Ipv4Reader.java @@ -47,7 +47,7 @@ interface Ipv4Reader extends Ipv4Translator, JvppReplyConsumer { @Nonnull final Function<Ipv4AddressNoZone, T> keyConstructor) { if (dumpOptional.isPresent() && dumpOptional.get().ipAddressDetails != null) { return dumpOptional.get().ipAddressDetails.stream() - .map(detail -> keyConstructor.apply(arrayToIpv4AddressNoZone(detail.ip))) + .map(detail -> keyConstructor.apply(arrayToIpv4AddressNoZoneReversed(detail.ip))) .collect(Collectors.toList()); } else { return Collections.emptyList(); @@ -63,7 +63,7 @@ interface Ipv4Reader extends Ipv4Translator, JvppReplyConsumer { final List<IpAddressDetails> details = dump.get().ipAddressDetails; return Optional.of(details.stream() - .filter(singleDetail -> ip.equals(arrayToIpv4AddressNoZone(singleDetail.ip))) + .filter(singleDetail -> ip.equals(arrayToIpv4AddressNoZoneReversed(singleDetail.ip))) .collect(RWUtils.singleItemCollector())); } return Optional.absent(); diff --git a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizer.java b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizer.java index eee49799b..3288e0c35 100644 --- a/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizer.java +++ b/v3po/v3po2vpp/src/main/java/io/fd/hc2vpp/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizer.java @@ -95,7 +95,7 @@ public class SubInterfaceIpv4AddressCustomizer extends FutureJVppCustomizer if (ipAddressDetails.isPresent()) { final IpAddressDetails detail = ipAddressDetails.get(); - builder.setIp(arrayToIpv4AddressNoZone(detail.ip)); + builder.setIp(arrayToIpv4AddressNoZoneReversed(detail.ip)); builder.setSubnet(new PrefixLengthBuilder().setPrefixLength(Short.valueOf(detail.prefixLength)).build()); if (LOG.isDebugEnabled()) { diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/ip/Ipv4AddressCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/ip/Ipv4AddressCustomizerTest.java index a2eda9157..bac21c88f 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/ip/Ipv4AddressCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/ip/Ipv4AddressCustomizerTest.java @@ -120,10 +120,8 @@ public class Ipv4AddressCustomizerTest extends ListReaderCustomizerTest<Address, IpAddressDetails detail1 = new IpAddressDetails(); IpAddressDetails detail2 = new IpAddressDetails(); - detail1.ip = reverseBytes( - ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1")))); - detail2.ip = reverseBytes( - ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.2")))); + detail1.ip = ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"))); + detail2.ip = ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.2"))); IpAddressDetailsReplyDump reply = new IpAddressDetailsReplyDump(); reply.ipAddressDetails = ImmutableList.of(detail1); @@ -166,12 +164,9 @@ public class Ipv4AddressCustomizerTest extends ListReaderCustomizerTest<Address, IpAddressDetails detail2 = new IpAddressDetails(); IpAddressDetails detail3 = new IpAddressDetails(); - detail1.ip = reverseBytes( - ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1")))); - detail2.ip = reverseBytes( - ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.2")))); - detail3.ip = reverseBytes( - ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.3")))); + detail1.ip = ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"))); + detail2.ip = ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.2"))); + detail3.ip = ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.3"))); IpAddressDetailsReplyDump reply = new IpAddressDetailsReplyDump(); reply.ipAddressDetails = ImmutableList.of(detail1, detail2, detail3); @@ -192,12 +187,9 @@ public class Ipv4AddressCustomizerTest extends ListReaderCustomizerTest<Address, IpAddressDetails detail2 = new IpAddressDetails(); IpAddressDetails detail3 = new IpAddressDetails(); - detail1.ip = reverseBytes( - ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1")))); - detail2.ip = reverseBytes( - ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.2")))); - detail3.ip = reverseBytes( - ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.3")))); + detail1.ip = ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"))); + detail2.ip = ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.2"))); + detail3.ip = ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.3"))); IpAddressDetailsReplyDump reply = new IpAddressDetailsReplyDump(); reply.ipAddressDetails = ImmutableList.of(detail1, detail2, detail3); @@ -257,12 +249,10 @@ public class Ipv4AddressCustomizerTest extends ListReaderCustomizerTest<Address, replyIfaceOne.ipAddressDetails = Arrays.asList(detailIfaceOneAddressOne); replyIfaceTwo.ipAddressDetails = Arrays.asList(detailIfaceTwoAddressOne); - detailIfaceOneAddressOne.ip = reverseBytes( - ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1")))); + detailIfaceOneAddressOne.ip = ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"))); detailIfaceOneAddressOne.prefixLength = 22; - detailIfaceTwoAddressOne.ip = reverseBytes( - ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1")))); + detailIfaceTwoAddressOne.ip = ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"))); detailIfaceTwoAddressOne.prefixLength = 23; cache.put(cacheKeyFactory.createKey(ifaceOneAddressOneIdentifier), replyIfaceOne); @@ -274,8 +264,7 @@ public class Ipv4AddressCustomizerTest extends ListReaderCustomizerTest<Address, IpAddressDetailsReplyDump replyIfaceOne = new IpAddressDetailsReplyDump(); replyIfaceOne.ipAddressDetails = Arrays.asList(detailIfaceOneAddressOne); - detailIfaceOneAddressOne.ip = reverseBytes( - ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1")))); + detailIfaceOneAddressOne.ip = ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"))); detailIfaceOneAddressOne.prefixLength = 22; cache.put(cacheKeyFactory.createKey(ifaceOneAddressOneIdentifier), replyIfaceOne); diff --git a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizerTest.java b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizerTest.java index cecc70235..4842f5de4 100644 --- a/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizerTest.java +++ b/v3po/v3po2vpp/src/test/java/io/fd/hc2vpp/v3po/interfacesstate/ip/SubInterfaceIpv4AddressCustomizerTest.java @@ -204,12 +204,10 @@ public class SubInterfaceIpv4AddressCustomizerTest extends ListReaderCustomizerT replyIfaceOne.ipAddressDetails = Arrays.asList(detailIfaceOneAddressOne); replyIfaceTwo.ipAddressDetails = Arrays.asList(detailIfaceTwoAddressOne); - detailIfaceOneAddressOne.ip = reverseBytes( - ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1")))); + detailIfaceOneAddressOne.ip = ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"))); detailIfaceOneAddressOne.prefixLength = 22; - detailIfaceTwoAddressOne.ip = reverseBytes( - ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1")))); + detailIfaceTwoAddressOne.ip = ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"))); detailIfaceTwoAddressOne.prefixLength = 23; cache.put(cacheKeyFactory.createKey(ifaceOneAddressOneIdentifier), replyIfaceOne); @@ -221,8 +219,7 @@ public class SubInterfaceIpv4AddressCustomizerTest extends ListReaderCustomizerT IpAddressDetailsReplyDump replyIfaceOne = new IpAddressDetailsReplyDump(); replyIfaceOne.ipAddressDetails = Arrays.asList(detailIfaceOneAddressOne); - detailIfaceOneAddressOne.ip = reverseBytes( - ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1")))); + detailIfaceOneAddressOne.ip = ipv4AddressNoZoneToArray(new Ipv4AddressNoZone(new Ipv4Address("192.168.2.1"))); detailIfaceOneAddressOne.prefixLength = 22; cache.put(cacheKeyFactory.createKey(ifaceOneAddressOneIdentifier), replyIfaceOne); @@ -233,12 +230,12 @@ public class SubInterfaceIpv4AddressCustomizerTest extends ListReaderCustomizerT final IpAddressDetailsReplyDump reply = new IpAddressDetailsReplyDump(); final IpAddressDetails details1 = new IpAddressDetails(); - details1.ip = new byte[]{1, 1, 1, 10}; + details1.ip = new byte[]{10, 1, 1, 1}; details1.prefixLength = (byte) PREFIX_LENGTH; reply.ipAddressDetails.add(details1); final IpAddressDetails details2 = new IpAddressDetails(); - details2.ip = new byte[]{2, 1, 1, 10}; + details2.ip = new byte[]{10, 1, 1, 2}; details2.prefixLength = (byte) PREFIX_LENGTH; reply.ipAddressDetails.add(details2); |