summaryrefslogtreecommitdiffstats
path: root/v3po/vpp-translate-utils/src/test/java
diff options
context:
space:
mode:
authorMaros Marsalek <mmarsale@cisco.com>2016-06-08 20:51:32 +0200
committerMaros Marsalek <mmarsale@cisco.com>2016-06-09 18:24:23 +0200
commit973d8c2ecbb02cf6e4971060b6edec3617bce96f (patch)
tree84d2907763553be76a1573cbeca58f14713c380d /v3po/vpp-translate-utils/src/test/java
parente17470c944ae71202cf438bf36f87b4e032618ed (diff)
HONEYCOMB-62: Add Ip readers
+ Fix 1 interface reads. Interface reader worked only if GET interfaces-state was executed + Fix readSubtree for augmentations. Comoposite readers did not check child readers for augmentations, only direct children. Change-Id: I2bc433e3e5785453062ab262b9edabc72c333bf0 Signed-off-by: Maros Marsalek <mmarsale@cisco.com>
Diffstat (limited to 'v3po/vpp-translate-utils/src/test/java')
-rw-r--r--v3po/vpp-translate-utils/src/test/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtilsTest.java22
1 files changed, 22 insertions, 0 deletions
diff --git a/v3po/vpp-translate-utils/src/test/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtilsTest.java b/v3po/vpp-translate-utils/src/test/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtilsTest.java
index 0a851e8c4..ba3861b99 100644
--- a/v3po/vpp-translate-utils/src/test/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtilsTest.java
+++ b/v3po/vpp-translate-utils/src/test/java/io/fd/honeycomb/v3po/translate/v3po/util/TranslateUtilsTest.java
@@ -4,10 +4,32 @@ import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import org.junit.Test;
+import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev130715.Ipv4AddressNoZone;
public class TranslateUtilsTest {
@Test
+ public void testIpv4NoZone() throws Exception {
+ final Ipv4AddressNoZone ipv4Addr = new Ipv4AddressNoZone("192.168.1.1");
+ byte[] bytes = TranslateUtils.ipv4AddressNoZoneToArray(ipv4Addr);
+ assertEquals((byte)192, bytes[0]);
+ // Simulating the magic of VPP
+ bytes = reverseBytes(bytes);
+ final Ipv4AddressNoZone ipv4AddressNoZone = TranslateUtils.arrayToIpv4AddressNoZone(bytes);
+ assertEquals(ipv4Addr, ipv4AddressNoZone);
+ }
+
+ private 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;
+ }
+
+ @Test
public void testToString() {
final byte[] expected = "test".getBytes();
final byte[] cString = new byte[expected.length + 10];