summaryrefslogtreecommitdiffstats
path: root/vpp-common/vpp-translate-utils
diff options
context:
space:
mode:
authorMarek Gradzki <mgradzki@cisco.com>2017-11-06 10:59:52 +0100
committerMarek Gradzki <mgradzki@cisco.com>2017-11-07 09:09:03 +0000
commit472f13d6bf3f681d4ba575baa0bc03583d1d6f20 (patch)
treed135a325d8fe559e1fed7de5047108b66bc0dbad /vpp-common/vpp-translate-utils
parentbaee9a73ebcf4db04d80f454094496a24595e142 (diff)
Fix operational read for interface's MAC address
Hc2vpp supports 48-bit addresses. VPP returns 64-bits, so ignore extended part. This patch updates MAC address handling broken by https://gerrit.fd.io/r/#/c/9090/ Change-Id: I7cc8d75e19f1f56e1f1adc23848a4a9baef87206 Signed-off-by: Marek Gradzki <mgradzki@cisco.com>
Diffstat (limited to 'vpp-common/vpp-translate-utils')
-rw-r--r--vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/ByteDataTranslator.java8
1 files changed, 6 insertions, 2 deletions
diff --git a/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/ByteDataTranslator.java b/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/ByteDataTranslator.java
index 25b8d50f0..c7583fb52 100644
--- a/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/ByteDataTranslator.java
+++ b/vpp-common/vpp-translate-utils/src/main/java/io/fd/hc2vpp/common/translate/util/ByteDataTranslator.java
@@ -100,10 +100,14 @@ public interface ByteDataTranslator {
default String printHexBinary(@Nonnull final byte[] bytes) {
Objects.requireNonNull(bytes, "bytes array should not be null");
+ return printHexBinary(bytes, 0, bytes.length);
+ }
+
+ default String printHexBinary(@Nonnull final byte[] bytes, final int startIndex, final int endIndex) {
StringBuilder str = new StringBuilder();
- Impl.appendHexByte(str, bytes[0]);
- for (int i = 1; i < bytes.length; i++) {
+ Impl.appendHexByte(str, bytes[startIndex]);
+ for (int i = startIndex + 1; i < endIndex; i++) {
str.append(":");
Impl.appendHexByte(str, bytes[i]);
}