*/
package org.opendaylight.lispflowmapping.serializer;
+import static org.junit.Assert.assertArrayEquals;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import java.nio.ByteBuffer;
import java.util.ArrayList;
-import junitx.framework.ArrayAssert;
import org.junit.Test;
import org.opendaylight.lispflowmapping.lisp.serializer.MapRegisterSerializer;
import org.opendaylight.lispflowmapping.lisp.serializer.MapRegisterSerializer.Length;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.SiteId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.XtrId;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.locatorrecords.LocatorRecord;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecord.Action;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.container.MappingRecordBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItem;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping.record.list.MappingRecordItemBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping._record.container.MappingRecord;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping._record.container.MappingRecord.Action;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping._record.container.MappingRecordBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping._record.list.MappingRecordItem;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapping._record.list.MappingRecordItemBuilder;
import org.opendaylight.yang.gen.v1.urn.opendaylight.lfm.lisp.proto.rev151105.mapregisternotification.MapRegisterBuilder;
public class MapRegisterSerializationTest extends BaseTestCase {
byte[] actualAuthenticationData = new byte[20];
bb.get(actualAuthenticationData);
- ArrayAssert.assertEquals(authenticationData, actualAuthenticationData);
+ assertArrayEquals(authenticationData, actualAuthenticationData);
bb.position(bb.position() + 12); // EID in first record
assertEquals(0x1, bb.getInt());
byte[] actualXtrId = new byte[Length.XTRID_SIZE];
bb.get(actualXtrId);
- ArrayAssert.assertEquals(xtrId.getValue(), actualXtrId);
+ assertArrayEquals(xtrId.getValue(), actualXtrId);
byte[] actualSiteId = new byte[Length.SITEID_SIZE];
bb.get(actualSiteId);
- ArrayAssert.assertEquals(siteId.getValue(), actualSiteId);
+ assertArrayEquals(siteId.getValue(), actualSiteId);
assertEquals(bb.position(), bb.capacity());
}
mrBuilder.setAuthenticationData(authenticationData);
MapRegister mapRegister = mrBuilder.build();
- ArrayAssert.assertEquals(
- MapRegisterSerializer.getInstance().serialize(mapRegister).array(),
+ assertArrayEquals(MapRegisterSerializer.getInstance().serialize(mapRegister).array(),
MapRegisterSerializer.getInstance()
.serialize(MapRegisterSerializer.getInstance().deserialize(MapRegisterSerializer.getInstance()
.serialize(mapRegister), null)).array());
+ "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " //
+ "ff 00 00 05 00 01 c0 a8 88 0a"), null);
- assertTrue(mr.isProxyMapReply());
- assertTrue(mr.isWantMapNotify());
+ assertTrue(mr.getProxyMapReply());
+ assertTrue(mr.getWantMapNotify());
assertEquals(1, mr.getMappingRecordItem().size());
assertEquals(0xFFBB000000000000L, mr.getNonce().longValue());
assertEquals(0x0000, mr.getKeyId().shortValue());
byte[] expectedAuthenticationData = {};
- ArrayAssert.assertEquals(expectedAuthenticationData, mr.getAuthenticationData());
+ assertArrayEquals(expectedAuthenticationData, mr.getAuthenticationData());
}
@Test
+ "90 87 20 65 9a b7 00 00 00 00 00 00 00 00 ");
MapRegister mr = MapRegisterSerializer.getInstance().deserialize(bb, null);
- assertTrue(mr.isXtrSiteIdPresent());
+ assertTrue(mr.getXtrSiteIdPresent());
- ArrayAssert.assertEquals(bb.array(), MapRegisterSerializer.getInstance().serialize(mr).array());
+ assertArrayEquals(bb.array(), MapRegisterSerializer.getInstance().serialize(mr).array());
}
@Test
assertEquals((byte) 0x34, loc1.getMulticastWeight().byteValue());
assertEquals((byte) 0xA4, loc2.getMulticastWeight().byteValue());
- assertTrue(loc0.isLocalLocator());
- assertFalse(loc1.isLocalLocator());
- assertFalse(loc2.isLocalLocator());
+ assertTrue(loc0.getLocalLocator());
+ assertFalse(loc1.getLocalLocator());
+ assertFalse(loc2.getLocalLocator());
- assertFalse(loc0.isRlocProbed());
- assertTrue(loc1.isRlocProbed());
- assertTrue(loc2.isRlocProbed());
+ assertFalse(loc0.getRlocProbed());
+ assertTrue(loc1.getRlocProbed());
+ assertTrue(loc2.getRlocProbed());
- assertTrue(loc0.isRouted());
- assertFalse(loc1.isRouted());
- assertTrue(loc2.isRouted());
+ assertTrue(loc0.getRouted());
+ assertFalse(loc1.getRouted());
+ assertTrue(loc2.getRouted());
assertEquals(LispAddressUtil.asIpv4Rloc("192.168.136.10"), loc0.getRloc());
assertEquals(LispAddressUtil.asIpv4Rloc("204.170.170.17"), loc1.getRloc());
assertEquals(Action.NoAction, record2.getAction());
assertEquals(Action.NativelyForward, record3.getAction());
- assertTrue(record0.isAuthoritative());
- assertTrue(record1.isAuthoritative());
- assertFalse(record2.isAuthoritative());
- assertFalse(record3.isAuthoritative());
+ assertTrue(record0.getAuthoritative());
+ assertTrue(record1.getAuthoritative());
+ assertFalse(record2.getAuthoritative());
+ assertFalse(record3.getAuthoritative());
assertEquals(0x000, record0.getMapVersion().shortValue());
assertEquals(0x111, record1.getMapVersion().shortValue());
+ "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " //
+ "ff 00 00 05 00 01 c0 a8 88 0a"), null);
- assertTrue(mr.isProxyMapReply());
- assertTrue(mr.isWantMapNotify());
+ assertTrue(mr.getProxyMapReply());
+ assertTrue(mr.getWantMapNotify());
assertEquals(1, mr.getMappingRecordItem().size());
assertEquals(0xFFBB000000000000L, mr.getNonce().longValue());
byte[] expectedAuthenticationData = { (byte) 0x2c, (byte) 0x61, (byte) 0xb9, (byte) 0xc9, (byte) 0x9a,
(byte) 0x20, (byte) 0xba, (byte) 0xd8, (byte) 0xf5, (byte) 0x40, (byte) 0xd3, (byte) 0x55, (byte) 0x6f,
(byte) 0x5f, (byte) 0x6e, (byte) 0x5a, (byte) 0xb2, (byte) 0x0a, (byte) 0xbf, (byte) 0xb5 };
- ArrayAssert.assertEquals(expectedAuthenticationData, mr.getAuthenticationData());
+ assertArrayEquals(expectedAuthenticationData, mr.getAuthenticationData());
}
@Test
+ "00 0a 01 20 10 00 00 00 00 01 99 10 fe 01 01 64 " //
+ "ff 00 00 05 00 01 c0 a8 88 0a"), null);
- assertTrue(mr.isProxyMapReply());
- assertTrue(mr.isWantMapNotify());
+ assertTrue(mr.getProxyMapReply());
+ assertTrue(mr.getWantMapNotify());
assertEquals(1, mr.getMappingRecordItem().size());
assertEquals(0xFFBB000000000000L, mr.getNonce().longValue());
(byte) 0x8c, (byte) 0x57, (byte) 0x6d, (byte) 0x68, (byte) 0xa5, (byte) 0xbf, (byte) 0x32, (byte) 0x11,
(byte) 0xc9, (byte) 0x7b, (byte) 0x58, (byte) 0xc4, (byte) 0xb9, (byte) 0x9f, (byte) 0x06, (byte) 0x11,
(byte) 0x23, (byte) 0xb9, (byte) 0x38 };
- ArrayAssert.assertEquals(expectedAuthenticationData, mr.getAuthenticationData());
+ assertArrayEquals(expectedAuthenticationData, mr.getAuthenticationData());
}
}