summaryrefslogtreecommitdiffstats
path: root/v3po/vpp-translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtils.java
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2016-06-21 10:21:39 +0200
committerMarek Gradzki <mgradzki@cisco.com>2016-06-21 15:12:00 +0200
commita760fd96233ae4e95e5b2667cdebc1aff92da800 (patch)
treeb8bf7b811a8414971166a454ae26f68f225946e3 /v3po/vpp-translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtils.java
parent6a48826150125820818dbf5d2786af0686b6a0ae (diff)
HONEYCOMB-64: Add ipv4 netmask support
Supported contiguous netmask only (strictly, only leading 1s are allowed) Update postman collection Change-Id: I989bbd013227bc3e1eda0861241543db0cdbf656 Signed-off-by: Tibor Sirovatka <tsirovat@cisco.com> Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'v3po/vpp-translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtils.java')
-rw-r--r--v3po/vpp-translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtils.java15
1 files changed, 15 insertions, 0 deletions
diff --git a/v3po/vpp-translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtils.java b/v3po/vpp-translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtils.java
index 77e60877f..d44bf8fd5 100644
--- a/v3po/vpp-translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtils.java
+++ b/v3po/vpp-translate-utils/src/main/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtils.java
@@ -185,4 +185,19 @@ public final class TranslateUtils {
}
throw new IllegalArgumentException(String.format("0 or 1 was expected but was %d", value));
}
+
+ /**
+ * Reverses bytes in the byte array
+ * @param bytes input array
+ * @return reversed array
+ */
+ public static byte[] reverseBytes(final byte[] bytes) {
+ final byte[] reversed = new byte[bytes.length];
+ int i = 1;
+ for (byte aByte : bytes) {
+ reversed[bytes.length - i++] = aByte;
+ }
+
+ return reversed;
+ }
}