summaryrefslogtreecommitdiffstats
path: root/lisp/lisp2vpp/src/main/java/io/fd
diff options
context:
space:
mode:
authorJan Srnicek <jsrnicek@cisco.com>2016-11-24 11:56:40 +0100
committerJan Srnicek <jsrnicek@cisco.com>2016-11-24 11:56:40 +0100
commite259ab7990b8179eda4462907ecebccd0e85b587 (patch)
treeb0326a66b0a9d775e79dfbc495568df94643f3ef /lisp/lisp2vpp/src/main/java/io/fd
parent927fb75d969b2d39c91ae6735f0127646348b73c (diff)
HON-3 - Address logic refactoring
Ipv4/6 address logic refactored to not use InetAddresses.fromLittleEndianArray to prevent unnecessary reverting of address arrays after fix introduced by VPP-132. Removed unused ***reverted variants of conversion logic. Tested with these plugins - Lisp - V3po - Nat Change-Id: I6a0728f8b3dffd04e2edd822ec61542216cca824 Signed-off-by: Jan Srnicek <jsrnicek@cisco.com>
Diffstat (limited to 'lisp/lisp2vpp/src/main/java/io/fd')
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/MapResolverCustomizer.java4
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizer.java2
-rwxr-xr-xlisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/util/EidTranslator.java20
3 files changed, 13 insertions, 13 deletions
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/MapResolverCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/MapResolverCustomizer.java
index cf6ca8b83..c2a7f0bd8 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/MapResolverCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/MapResolverCustomizer.java
@@ -87,7 +87,7 @@ public class MapResolverCustomizer extends FutureJVppCustomizer
final LispMapResolverDetails mapResolverDetails =
dumpOptional.get().lispMapResolverDetails.stream()
.filter(a -> addressesEqual(key.getIpAddress(),
- arrayToIpAddressReversed(byteToBoolean(a.isIpv6), a.ipAddress)))
+ arrayToIpAddress(byteToBoolean(a.isIpv6), a.ipAddress)))
.collect(RWUtils.singleItemCollector());
builder.setKey(key);
@@ -115,7 +115,7 @@ public class MapResolverCustomizer extends FutureJVppCustomizer
return dumpOptional.get().lispMapResolverDetails.stream()
.map(resolver -> new MapResolverKey(
- arrayToIpAddressReversed(byteToBoolean(resolver.isIpv6), resolver.ipAddress)))
+ arrayToIpAddress(byteToBoolean(resolver.isIpv6), resolver.ipAddress)))
.collect(Collectors.toList());
}
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizer.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizer.java
index 3b00d2800..27b51218c 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizer.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/read/RemoteMappingCustomizer.java
@@ -292,7 +292,7 @@ public class RemoteMappingCustomizer extends FutureJVppCustomizer
}
private Locator detailsToLocator(final LispLocatorDetails details) {
- final IpAddress address = arrayToIpAddressReversed(byteToBoolean(details.isIpv6), details.ipAddress);
+ final IpAddress address = arrayToIpAddress(byteToBoolean(details.isIpv6), details.ipAddress);
return new LocatorBuilder()
.setAddress(address)
.setKey(new LocatorKey(address))
diff --git a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/util/EidTranslator.java b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/util/EidTranslator.java
index 347720958..3110faf07 100755
--- a/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/util/EidTranslator.java
+++ b/lisp/lisp2vpp/src/main/java/io/fd/hc2vpp/lisp/translate/util/EidTranslator.java
@@ -92,12 +92,12 @@ public interface EidTranslator extends AddressTranslator, EidMetadataProvider {
switch (type) {
case IPV4: {
return newLocalEidBuilder(Ipv4Afi.class, vni).setAddress(
- new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZoneReversed(address)).build())
+ new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZone(address)).build())
.build();
}
case IPV6: {
return newLocalEidBuilder(Ipv6Afi.class, vni).setAddress(
- new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZoneReversed(address)).build())
+ new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZone(address)).build())
.build();
}
case MAC: {
@@ -118,14 +118,14 @@ public interface EidTranslator extends AddressTranslator, EidMetadataProvider {
case IPV4: {
return newRemoteEidBuilder(Ipv4Afi.class, vni)
.setAddress(
- new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZoneReversed(address))
+ new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZone(address))
.build())
.build();
}
case IPV6: {
return newRemoteEidBuilder(Ipv6Afi.class, vni)
.setAddress(
- new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZoneReversed(address))
+ new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZone(address))
.build())
.build();
}
@@ -146,14 +146,14 @@ public interface EidTranslator extends AddressTranslator, EidMetadataProvider {
case IPV4: {
return newEidBuilderLocal(Ipv4Afi.class, vni)
.setAddress(
- new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZoneReversed(address))
+ new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZone(address))
.build())
.build();
}
case IPV6: {
return newEidBuilderLocal(Ipv6Afi.class, vni)
.setAddress(
- new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZoneReversed(address))
+ new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZone(address))
.build())
.build();
}
@@ -174,14 +174,14 @@ public interface EidTranslator extends AddressTranslator, EidMetadataProvider {
case IPV4: {
return newEidBuilderRemote(Ipv4Afi.class, vni)
.setAddress(
- new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZoneReversed(address))
+ new Ipv4Builder().setIpv4(arrayToIpv4AddressNoZone(address))
.build())
.build();
}
case IPV6: {
return newEidBuilderRemote(Ipv6Afi.class, vni)
.setAddress(
- new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZoneReversed(address))
+ new Ipv6Builder().setIpv6(arrayToIpv6AddressNoZone(address))
.build())
.build();
}
@@ -201,10 +201,10 @@ public interface EidTranslator extends AddressTranslator, EidMetadataProvider {
EidType type, byte[] address) {
switch (type) {
case IPV4: {
- return arrayToIpv4AddressNoZoneReversed(address).getValue();
+ return arrayToIpv4AddressNoZone(address).getValue();
}
case IPV6: {
- return arrayToIpv6AddressNoZoneReversed(address).getValue();
+ return arrayToIpv6AddressNoZone(address).getValue();
}
case MAC: {
//as wrong as it looks ,its right(second param is not end index,but count)